Merge lp:~widelands-dev/widelands/refactor_editor_start into lp:widelands

Proposed by Tino
Status: Merged
Merged at revision: 7341
Proposed branch: lp:~widelands-dev/widelands/refactor_editor_start
Merge into: lp:widelands
Diff against target: 207 lines (+1/-161)
4 files modified
src/ui_fsmenu/CMakeLists.txt (+0/-2)
src/ui_fsmenu/editor.cc (+0/-75)
src/ui_fsmenu/editor.h (+0/-46)
src/wlapplication.cc (+1/-38)
To merge this branch: bzr merge lp:~widelands-dev/widelands/refactor_editor_start
Reviewer Review Type Date Requested Status
SirVer Approve
Review via email: mp+245412@code.launchpad.net

Description of the change

The "Editor" button in the main menu now starts directly the editor, the new map/load map menu was removed.

To post a comment you must log in.
Revision history for this message
SirVer (sirver) wrote :

Ship it! :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ui_fsmenu/CMakeLists.txt'
2--- src/ui_fsmenu/CMakeLists.txt 2014-12-06 12:22:35 +0000
3+++ src/ui_fsmenu/CMakeLists.txt 2014-12-28 15:16:30 +0000
4@@ -4,8 +4,6 @@
5 base.h
6 campaign_select.cc
7 campaign_select.h
8- editor.cc
9- editor.h
10 fileview.cc
11 fileview.h
12 internet_lobby.cc
13
14=== removed file 'src/ui_fsmenu/editor.cc'
15--- src/ui_fsmenu/editor.cc 2014-12-06 12:22:35 +0000
16+++ src/ui_fsmenu/editor.cc 1970-01-01 00:00:00 +0000
17@@ -1,75 +0,0 @@
18-/*
19- * Copyright (C) 2008 by the Widelands Development Team
20- *
21- * This program is free software; you can redistribute it and/or
22- * modify it under the terms of the GNU General Public License
23- * as published by the Free Software Foundation; either version 2
24- * of the License, or (at your option) any later version.
25- *
26- * This program is distributed in the hope that it will be useful,
27- * but WITHOUT ANY WARRANTY; without even the implied warranty of
28- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29- * GNU General Public License for more details.
30- *
31- * You should have received a copy of the GNU General Public License
32- * along with this program; if not, write to the Free Software
33- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
34- *
35- */
36-
37-#include "ui_fsmenu/editor.h"
38-
39-#include "base/i18n.h"
40-#include "graphic/graphic.h"
41-#include "graphic/text_constants.h"
42-
43-FullscreenMenuEditor::FullscreenMenuEditor() :
44- FullscreenMenuMainMenu(),
45-
46- // Title
47- title
48- (this, get_w() / 2, m_title_y, _("Editor"), UI::Align_HCenter),
49-
50- // Buttons
51- vbox(this, m_box_x, m_box_y, UI::Box::Vertical,
52- m_butw, get_h() - vbox.get_y(), m_padding),
53- new_map
54- (&vbox, "new_map", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
55- _("New Map"), "", true, false),
56- load_map
57- (&vbox, "load_map", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
58- _("Load Map"), "", true, false),
59- back
60- (&vbox, "back", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
61- _("Back"), "", true, false)
62-{
63- new_map.sigclicked.connect
64- (boost::bind(
65- &FullscreenMenuEditor::end_modal,
66- boost::ref(*this),
67- static_cast<int32_t>(MenuTarget::kNewMap)));
68- load_map.sigclicked.connect
69- (boost::bind
70- (&FullscreenMenuEditor::end_modal,
71- boost::ref(*this),
72- static_cast<int32_t>(MenuTarget::kLoadMap)));
73- back.sigclicked.connect
74- (boost::bind
75- (&FullscreenMenuEditor::end_modal,
76- boost::ref(*this),
77- static_cast<int32_t>(MenuTarget::kBack)));
78-
79- title.set_font(ui_fn(), fs_big(), UI_FONT_CLR_FG);
80-
81- vbox.add(&new_map, UI::Box::AlignCenter);
82- vbox.add(&load_map, UI::Box::AlignCenter);
83-
84- // Multiple add_space calls to get the same height for the back button as in the single player menu
85- vbox.add_space(m_buth);
86- vbox.add_space(m_buth);
87- vbox.add_space(6 * m_buth);
88-
89- vbox.add(&back, UI::Box::AlignCenter);
90-
91- vbox.set_size(m_butw, get_h() - vbox.get_y());
92-}
93
94=== removed file 'src/ui_fsmenu/editor.h'
95--- src/ui_fsmenu/editor.h 2014-12-27 09:46:38 +0000
96+++ src/ui_fsmenu/editor.h 1970-01-01 00:00:00 +0000
97@@ -1,46 +0,0 @@
98-/*
99- * Copyright (C) 2008 by the Widelands Development Team
100- *
101- * This program is free software; you can redistribute it and/or
102- * modify it under the terms of the GNU General Public License
103- * as published by the Free Software Foundation; either version 2
104- * of the License, or (at your option) any later version.
105- *
106- * This program is distributed in the hope that it will be useful,
107- * but WITHOUT ANY WARRANTY; without even the implied warranty of
108- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
109- * GNU General Public License for more details.
110- *
111- * You should have received a copy of the GNU General Public License
112- * along with this program; if not, write to the Free Software
113- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
114- *
115- */
116-
117-#ifndef WL_UI_FSMENU_EDITOR_H
118-#define WL_UI_FSMENU_EDITOR_H
119-
120-#include "ui_fsmenu/main_menu.h"
121-#include "ui_basic/box.h"
122-#include "ui_basic/button.h"
123-#include "ui_basic/textarea.h"
124-
125-/**
126- * Fullscreen Menu for Editor.
127- * Here you select what game you want to play.
128- */
129-class FullscreenMenuEditor : public FullscreenMenuMainMenu {
130-public:
131- FullscreenMenuEditor();
132-
133- enum class MenuTarget {kBack = UI::Panel::dying_code, kNewMap, kLoadMap};
134-
135-private:
136- UI::Textarea title;
137- UI::Box vbox;
138- UI::Button new_map;
139- UI::Button load_map;
140- UI::Button back;
141-};
142-
143-#endif // end of include guard: WL_UI_FSMENU_EDITOR_H
144
145=== modified file 'src/wlapplication.cc'
146--- src/wlapplication.cc 2014-12-20 17:52:18 +0000
147+++ src/wlapplication.cc 2014-12-28 15:16:30 +0000
148@@ -78,7 +78,6 @@
149 #include "ui_basic/messagebox.h"
150 #include "ui_basic/progresswindow.h"
151 #include "ui_fsmenu/campaign_select.h"
152-#include "ui_fsmenu/editor.h"
153 #include "ui_fsmenu/fileview.h"
154 #include "ui_fsmenu/internet_lobby.h"
155 #include "ui_fsmenu/intro.h"
156@@ -1088,7 +1087,7 @@
157 break;
158 }
159 case FullscreenMenuMain::MenuTarget::kEditor:
160- mainmenu_editor();
161+ EditorInteractive::run_editor(m_filename, m_script_to_run);
162 break;
163 default:
164 case FullscreenMenuMain::MenuTarget::kExit:
165@@ -1268,42 +1267,6 @@
166 }
167 }
168
169-void WLApplication::mainmenu_editor()
170-{
171- // This is the code returned by UI::Panel::run() when the panel is dying.
172- // Make sure that the program exits when the window manager says so.
173- static_assert
174- (static_cast<int32_t>(FullscreenMenuEditor::MenuTarget::kBack) == UI::Panel::dying_code,
175- "Editor should be dying.");
176-
177- for (;;) {
178- FullscreenMenuEditor editor_menu;
179- switch (static_cast<FullscreenMenuEditor::MenuTarget>(editor_menu.run())) {
180- case FullscreenMenuEditor::MenuTarget::kBack:
181- return;
182- case FullscreenMenuEditor::MenuTarget::kNewMap:
183- EditorInteractive::run_editor(m_filename, m_script_to_run);
184- return;
185- case FullscreenMenuEditor::MenuTarget::kLoadMap: {
186- std::string filename;
187- {
188- SinglePlayerGameSettingsProvider sp;
189- FullscreenMenuMapSelect emsm(&sp, nullptr, true);
190- if (emsm.run() <= 0)
191- break;
192-
193- filename = emsm.get_map()->filename;
194- }
195- EditorInteractive::run_editor(filename.c_str(), "");
196- return;
197- }
198- default:
199- assert(false);
200- break;
201- }
202- }
203-}
204-
205 /**
206 * Handle the "New game" menu option: Configure a single player game and
207 * run it.

Subscribers

People subscribed via source and target branches

to status/vote changes: