Merge lp:~widelands-dev/widelands/bug-859245 into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 7302
Proposed branch: lp:~widelands-dev/widelands/bug-859245
Merge into: lp:widelands
Diff against target: 1215 lines (+406/-292)
26 files modified
src/build_info.h (+3/-2)
src/ui_fsmenu/CMakeLists.txt (+2/-0)
src/ui_fsmenu/base.h (+2/-1)
src/ui_fsmenu/campaign_select.h (+4/-2)
src/ui_fsmenu/editor.cc (+37/-28)
src/ui_fsmenu/editor.h (+10/-10)
src/ui_fsmenu/fileview.h (+4/-2)
src/ui_fsmenu/internet_lobby.h (+2/-2)
src/ui_fsmenu/intro.h (+2/-1)
src/ui_fsmenu/launch_mpg.h (+2/-1)
src/ui_fsmenu/launch_spg.h (+2/-1)
src/ui_fsmenu/load_map_or_game.cc (+0/-2)
src/ui_fsmenu/load_map_or_game.h (+2/-1)
src/ui_fsmenu/loadgame.h (+2/-1)
src/ui_fsmenu/main.cc (+79/-77)
src/ui_fsmenu/main.h (+32/-30)
src/ui_fsmenu/main_menu.cc (+37/-0)
src/ui_fsmenu/main_menu.h (+49/-0)
src/ui_fsmenu/mapselect.h (+2/-1)
src/ui_fsmenu/multiplayer.cc (+31/-31)
src/ui_fsmenu/multiplayer.h (+15/-13)
src/ui_fsmenu/netsetup_lan.h (+2/-1)
src/ui_fsmenu/singleplayer.cc (+34/-36)
src/ui_fsmenu/singleplayer.h (+16/-13)
src/wlapplication.cc (+34/-35)
txts/developers (+1/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-859245
Reviewer Review Type Date Requested Status
SirVer Approve
Review via email: mp+241549@code.launchpad.net

Description of the change

Uniform layout for all fullscreen menus that have only buttons in them, with a new superclass "FullscreenMenuMainMenu".

Added an "Authors" button to the main menu.

To post a comment you must log in.
7257. By GunChleoc

Merged trunk

7258. By GunChleoc

Fixed codecheck

Revision history for this message
SirVer (sirver) wrote :

You have been working on the layout of the menus now for quite some time. Do you not think it is time to move to UI::Box and a more manageable layout instead of the hardcoding?

Also, couple of comments.

review: Needs Fixing
7259. By GunChleoc

FullscreenMenuBase and its decendants are now classes rather than structs.

7260. By GunChleoc

Made values for alignment and size const

7261. By GunChleoc

Better use of static_cast

7262. By GunChleoc

Changed layout to UI::Box

Revision history for this message
GunChleoc (gunchleoc) wrote :

All comments are addressed now.

7263. By GunChleoc

Merged trunk.

7264. By GunChleoc

Merged trunk.

7265. By SirVer

Code review.

Revision history for this message
SirVer (sirver) wrote :

looks good. merged.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/build_info.h'
2--- src/build_info.h 2014-07-05 16:41:51 +0000
3+++ src/build_info.h 2014-12-04 06:44:40 +0000
4@@ -20,10 +20,11 @@
5 #ifndef WL_BUILD_INFO_H
6 #define WL_BUILD_INFO_H
7
8-#define WLCR "(C) 2002-2014 "
9-
10 #include <string>
11
12+constexpr uint16_t kWidelandsCopyrightStart = 2002;
13+constexpr uint16_t kWidelandsCopyrightEnd = 2014;
14+
15 ///\return the build id which is automagically created from the checkout's
16 ///revision number or the VERSION file
17 const std::string & build_id();
18
19=== modified file 'src/ui_fsmenu/CMakeLists.txt'
20--- src/ui_fsmenu/CMakeLists.txt 2014-11-03 06:55:18 +0000
21+++ src/ui_fsmenu/CMakeLists.txt 2014-12-04 06:44:40 +0000
22@@ -22,6 +22,8 @@
23 load_map_or_game.h
24 main.cc
25 main.h
26+ main_menu.cc
27+ main_menu.h
28 mapselect.cc
29 mapselect.h
30 multiplayer.cc
31
32=== modified file 'src/ui_fsmenu/base.h'
33--- src/ui_fsmenu/base.h 2014-11-30 10:11:09 +0000
34+++ src/ui_fsmenu/base.h 2014-12-04 06:44:40 +0000
35@@ -33,7 +33,8 @@
36 * A fullscreen menu is a menu which takes the full screen; it has the size
37 * MENU_XRES and MENU_YRES and is a modal UI Element
38 */
39-struct FullscreenMenuBase : public UI::Panel {
40+class FullscreenMenuBase : public UI::Panel {
41+public:
42 FullscreenMenuBase(char const * bgpic);
43 virtual ~FullscreenMenuBase();
44
45
46=== modified file 'src/ui_fsmenu/campaign_select.h'
47--- src/ui_fsmenu/campaign_select.h 2014-10-28 12:50:28 +0000
48+++ src/ui_fsmenu/campaign_select.h 2014-12-04 06:44:40 +0000
49@@ -37,7 +37,8 @@
50 * UI 1 - Selection of Campaign
51 *
52 */
53-struct FullscreenMenuCampaignSelect : public FullscreenMenuLoadMapOrGame {
54+class FullscreenMenuCampaignSelect : public FullscreenMenuLoadMapOrGame {
55+public:
56 FullscreenMenuCampaignSelect();
57
58 int32_t get_campaign();
59@@ -86,7 +87,8 @@
60 * UI 2 - Selection of a map
61 *
62 */
63-struct FullscreenMenuCampaignMapSelect : public FullscreenMenuLoadMapOrGame {
64+class FullscreenMenuCampaignMapSelect : public FullscreenMenuLoadMapOrGame {
65+public:
66 FullscreenMenuCampaignMapSelect(bool is_tutorial = false);
67
68 std::string get_map();
69
70=== modified file 'src/ui_fsmenu/editor.cc'
71--- src/ui_fsmenu/editor.cc 2014-09-27 09:28:51 +0000
72+++ src/ui_fsmenu/editor.cc 2014-12-04 06:44:40 +0000
73@@ -24,43 +24,52 @@
74 #include "wui/text_constants.h"
75
76 FullscreenMenuEditor::FullscreenMenuEditor() :
77- FullscreenMenuBase("ui_fsmenu.jpg"),
78-
79-// Values for alignment and size
80- m_butw (get_w() * 7 / 20),
81- m_buth (get_h() * 19 / 400),
82- m_butx ((get_w() - m_butw) / 2),
83-
84-// Title
85+ FullscreenMenuMainMenu(),
86+
87+ // Title
88 title
89- (this, get_w() / 2, get_h() * 3 / 40, _("Editor"), UI::Align_HCenter),
90+ (this, get_w() / 2, m_title_y, _("Editor"), UI::Align_HCenter),
91
92-// Buttons
93+ // Buttons
94+ vbox(this, m_box_x, m_box_y, UI::Box::Vertical,
95+ m_butw, get_h() - vbox.get_y(), m_padding),
96 new_map
97- (this, "new_map",
98- m_butx, get_h() * 6 / 25, m_butw, m_buth,
99- g_gr->images().get("pics/but1.png"),
100- _("New Map"), std::string(), true, false),
101+ (&vbox, "new_map", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
102+ _("New Map"), "", true, false),
103 load_map
104- (this, "load_map",
105- m_butx, get_h() * 61 / 200, m_butw, m_buth,
106- g_gr->images().get("pics/but1.png"),
107- _("Load Map"), std::string(), true, false),
108+ (&vbox, "load_map", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
109+ _("Load Map"), "", true, false),
110 back
111- (this, "back",
112- m_butx, get_h() * 3 / 4, m_butw, m_buth,
113- g_gr->images().get("pics/but0.png"),
114- _("Back"), std::string(), true, false)
115+ (&vbox, "back", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
116+ _("Back"), "", true, false)
117 {
118 new_map.sigclicked.connect
119- (boost::bind(&FullscreenMenuEditor::end_modal, boost::ref(*this), static_cast<int32_t>(New_Map)));
120+ (boost::bind(
121+ &FullscreenMenuEditor::end_modal,
122+ boost::ref(*this),
123+ static_cast<int32_t>(MenuTarget::kNewMap)));
124 load_map.sigclicked.connect
125- (boost::bind(&FullscreenMenuEditor::end_modal, boost::ref(*this), static_cast<int32_t>(Load_Map)));
126+ (boost::bind
127+ (&FullscreenMenuEditor::end_modal,
128+ boost::ref(*this),
129+ static_cast<int32_t>(MenuTarget::kLoadMap)));
130 back.sigclicked.connect
131- (boost::bind(&FullscreenMenuEditor::end_modal, boost::ref(*this), static_cast<int32_t>(Back)));
132+ (boost::bind
133+ (&FullscreenMenuEditor::end_modal,
134+ boost::ref(*this),
135+ static_cast<int32_t>(MenuTarget::kBack)));
136
137- new_map.set_font(font_small());
138- load_map.set_font(font_small());
139- back.set_font(font_small());
140 title.set_font(ui_fn(), fs_big(), UI_FONT_CLR_FG);
141+
142+ vbox.add(&new_map, UI::Box::AlignCenter);
143+ vbox.add(&load_map, UI::Box::AlignCenter);
144+
145+ // Multiple add_space calls to get the same height for the back button as in the single player menu
146+ vbox.add_space(m_buth);
147+ vbox.add_space(m_buth);
148+ vbox.add_space(6 * m_buth);
149+
150+ vbox.add(&back, UI::Box::AlignCenter);
151+
152+ vbox.set_size(m_butw, get_h() - vbox.get_y());
153 }
154
155=== modified file 'src/ui_fsmenu/editor.h'
156--- src/ui_fsmenu/editor.h 2014-09-10 14:08:25 +0000
157+++ src/ui_fsmenu/editor.h 2014-12-04 06:44:40 +0000
158@@ -20,7 +20,8 @@
159 #ifndef WL_UI_FSMENU_EDITOR_H
160 #define WL_UI_FSMENU_EDITOR_H
161
162-#include "ui_fsmenu/base.h"
163+#include "ui_fsmenu/main_menu.h"
164+#include "ui_basic/box.h"
165 #include "ui_basic/button.h"
166 #include "ui_basic/textarea.h"
167
168@@ -28,19 +29,18 @@
169 * Fullscreen Menu for Editor.
170 * Here you select what game you want to play.
171 */
172-struct FullscreenMenuEditor : public FullscreenMenuBase {
173+class FullscreenMenuEditor : public FullscreenMenuMainMenu {
174+public:
175 FullscreenMenuEditor();
176
177- enum {Back = dying_code, New_Map, Load_Map};
178+ enum class MenuTarget { kBack = UI::Panel::dying_code, kNewMap, kLoadMap };
179
180 private:
181- uint32_t m_butw;
182- uint32_t m_buth;
183- uint32_t m_butx;
184- UI::Textarea title;
185- UI::Button new_map;
186- UI::Button load_map;
187- UI::Button back;
188+ UI::Textarea title;
189+ UI::Box vbox;
190+ UI::Button new_map;
191+ UI::Button load_map;
192+ UI::Button back;
193 };
194
195 #endif // end of include guard: WL_UI_FSMENU_EDITOR_H
196
197=== modified file 'src/ui_fsmenu/fileview.h'
198--- src/ui_fsmenu/fileview.h 2014-09-10 14:48:40 +0000
199+++ src/ui_fsmenu/fileview.h 2014-12-04 06:44:40 +0000
200@@ -38,7 +38,8 @@
201 * Shows a Text in a Fullscreen Menu. Can automatically handle Lua files and
202 * plain text files. Waits for the button Ok to be clicked.
203 */
204-struct FullscreenMenuTextView : public FullscreenMenuBase {
205+class FullscreenMenuTextView : public FullscreenMenuBase {
206+public:
207 FullscreenMenuTextView(const std::string & filename);
208
209 protected:
210@@ -54,7 +55,8 @@
211 * Shows an ASCII-File in a Fullscreen Menu. Waits for the button Ok
212 * to be clicked.
213 */
214-struct FullscreenMenuFileView : public FullscreenMenuTextView {
215+class FullscreenMenuFileView : public FullscreenMenuTextView {
216+public:
217 FullscreenMenuFileView(const std::string & filename);
218 };
219
220
221=== modified file 'src/ui_fsmenu/internet_lobby.h'
222--- src/ui_fsmenu/internet_lobby.h 2014-09-20 09:37:47 +0000
223+++ src/ui_fsmenu/internet_lobby.h 2014-12-04 06:44:40 +0000
224@@ -35,8 +35,8 @@
225 #include "ui_basic/textarea.h"
226 #include "wui/gamechatpanel.h"
227
228-struct FullscreenMenuInternetLobby : public FullscreenMenuBase {
229-
230+class FullscreenMenuInternetLobby : public FullscreenMenuBase {
231+public:
232 FullscreenMenuInternetLobby (const char *, const char *, bool);
233
234 void think() override;
235
236=== modified file 'src/ui_fsmenu/intro.h'
237--- src/ui_fsmenu/intro.h 2014-10-14 06:30:20 +0000
238+++ src/ui_fsmenu/intro.h 2014-12-04 06:44:40 +0000
239@@ -28,7 +28,8 @@
240 * This simply waits modal for a click and in the meantime
241 * shows the splash screen
242 */
243-struct FullscreenMenuIntro : public FullscreenMenuBase {
244+class FullscreenMenuIntro : public FullscreenMenuBase {
245+public:
246 FullscreenMenuIntro();
247
248 protected:
249
250=== modified file 'src/ui_fsmenu/launch_mpg.h'
251--- src/ui_fsmenu/launch_mpg.h 2014-10-12 10:15:00 +0000
252+++ src/ui_fsmenu/launch_mpg.h 2014-12-04 06:44:40 +0000
253@@ -48,7 +48,8 @@
254 * 3 - multi player savegame
255 * 4 - multi player scenario savegame <- not yet implemented
256 */
257-struct FullscreenMenuLaunchMPG : public FullscreenMenuBase {
258+class FullscreenMenuLaunchMPG : public FullscreenMenuBase {
259+public:
260 FullscreenMenuLaunchMPG(GameSettingsProvider *, GameController *);
261 ~FullscreenMenuLaunchMPG();
262
263
264=== modified file 'src/ui_fsmenu/launch_spg.h'
265--- src/ui_fsmenu/launch_spg.h 2014-09-10 14:08:25 +0000
266+++ src/ui_fsmenu/launch_spg.h 2014-12-04 06:44:40 +0000
267@@ -49,7 +49,8 @@
268 * 1 - normal game (either single or multi player)
269 * 2 - scenario game (at the moment only single player)
270 */
271-struct FullscreenMenuLaunchSPG : public FullscreenMenuBase {
272+class FullscreenMenuLaunchSPG : public FullscreenMenuBase {
273+public:
274 FullscreenMenuLaunchSPG
275 (GameSettingsProvider *, GameController * = nullptr, bool autolaunch = false);
276 ~FullscreenMenuLaunchSPG();
277
278=== modified file 'src/ui_fsmenu/load_map_or_game.cc'
279--- src/ui_fsmenu/load_map_or_game.cc 2014-11-22 10:18:20 +0000
280+++ src/ui_fsmenu/load_map_or_game.cc 2014-12-04 06:44:40 +0000
281@@ -87,12 +87,10 @@
282 return FullscreenMenuBase::handle_key(down, code);
283 }
284
285-
286 int32_t FullscreenMenuLoadMapOrGame::get_y_from_preceding(UI::Panel& preceding_panel) {
287 return preceding_panel.get_y() + preceding_panel.get_h();
288 }
289
290-
291 int32_t FullscreenMenuLoadMapOrGame::get_right_column_w(int32_t x) {
292 return get_w() - m_right_column_margin - x;
293 }
294
295=== modified file 'src/ui_fsmenu/load_map_or_game.h'
296--- src/ui_fsmenu/load_map_or_game.h 2014-10-31 07:40:54 +0000
297+++ src/ui_fsmenu/load_map_or_game.h 2014-12-04 06:44:40 +0000
298@@ -72,7 +72,8 @@
299 /// Select a Map, Saved Game or Replay in Fullscreen Mode.
300 /// This class defines common coordinates for these UI screens.
301 /// It also defines common buttons.
302-struct FullscreenMenuLoadMapOrGame : public FullscreenMenuBase {
303+class FullscreenMenuLoadMapOrGame : public FullscreenMenuBase {
304+public:
305 FullscreenMenuLoadMapOrGame(bool sortdesc = false);
306
307 bool handle_key(bool down, SDL_Keysym code) override;
308
309=== modified file 'src/ui_fsmenu/loadgame.h'
310--- src/ui_fsmenu/loadgame.h 2014-11-11 11:28:05 +0000
311+++ src/ui_fsmenu/loadgame.h 2014-12-04 06:44:40 +0000
312@@ -68,7 +68,8 @@
313
314
315 /// Select a Saved Game in Fullscreen Mode. It's a modal fullscreen menu.
316-struct FullscreenMenuLoadGame : public FullscreenMenuLoadMapOrGame {
317+class FullscreenMenuLoadGame : public FullscreenMenuLoadMapOrGame {
318+public:
319 FullscreenMenuLoadGame
320 (Widelands::Game&, GameSettingsProvider* gsp, GameController* gc = nullptr,
321 bool is_replay = false);
322
323=== modified file 'src/ui_fsmenu/main.cc'
324--- src/ui_fsmenu/main.cc 2014-10-11 08:43:07 +0000
325+++ src/ui_fsmenu/main.cc 2014-12-04 06:44:40 +0000
326@@ -19,131 +19,133 @@
327
328 #include "ui_fsmenu/main.h"
329
330+#include <boost/format.hpp>
331+
332 #include "base/i18n.h"
333 #include "build_info.h"
334 #include "graphic/graphic.h"
335
336 FullscreenMenuMain::FullscreenMenuMain() :
337- FullscreenMenuBase("mainmenu.jpg"),
338-
339-// Values for alignment and size
340- m_butx (get_w() * 13 / 40),
341- m_butw (get_w() * 7 / 20),
342- m_buth (get_h() * 19 / 400),
343- wlcr (WLCR),
344-
345-// Buttons
346+ FullscreenMenuMainMenu("mainmenu.jpg"),
347+
348+ // Buttons
349+ // This box needs to be a bit higher than in the other menus, because we have a lot of buttons
350+ vbox(this, m_box_x, m_box_y - m_buth, UI::Box::Vertical,
351+ m_butw, get_h() - vbox.get_y(), m_padding),
352 playtutorial
353- (this, "play_tutorial",
354- m_butx, get_h() * 42 / 200, m_butw, m_buth,
355- g_gr->images().get("pics/but3.png"),
356- _("Play Tutorial"), std::string(), true, false),
357+ (&vbox, "play_tutorial", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
358+ _("Play Tutorial"), "", true, false),
359 singleplayer
360- (this, "single_player",
361- m_butx, get_h() * 61 / 200, m_butw, m_buth,
362- g_gr->images().get("pics/but3.png"),
363- _("Single Player"), std::string(), true, false),
364+ (&vbox, "single_player", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
365+ _("Single Player"), "", true, false),
366 multiplayer
367- (this, "multi_player",
368- m_butx, get_h() * 37 / 100, m_butw, m_buth,
369- g_gr->images().get("pics/but3.png"),
370- _("Multiplayer"), std::string(), true, false),
371+ (&vbox, "multi_player", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
372+ _("Multiplayer"), "", true, false),
373 replay
374- (this, "replay",
375- m_butx, get_h() * 87 / 200, m_butw, m_buth,
376- g_gr->images().get("pics/but3.png"),
377- _("Watch Replay"), std::string(), true, false),
378+ (&vbox, "replay", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
379+ _("Watch Replay"), "", true, false),
380 editor
381- (this, "editor",
382- m_butx, get_h() * 100 / 200, m_butw, m_buth,
383- g_gr->images().get("pics/but3.png"),
384- _("Editor"), std::string(), true, false),
385+ (&vbox, "editor", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
386+ _("Editor"), "", true, false),
387 options
388- (this, "options",
389- m_butx, get_h() * 119 / 200, m_butw, m_buth,
390- g_gr->images().get("pics/but3.png"),
391- _("Options"), std::string(), true, false),
392+ (&vbox, "options", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
393+ _("Options"), "", true, false),
394 readme
395- (this, "readme",
396- m_butx, get_h() * 138 / 200, m_butw, m_buth,
397- g_gr->images().get("pics/but3.png"),
398- _("View Readme"), std::string(), true, false),
399+ (&vbox, "readme", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
400+ _("View Readme"), "", true, false),
401 license
402- (this, "license",
403- m_butx, get_h() * 151 / 200, m_butw, m_buth,
404- g_gr->images().get("pics/but3.png"),
405- _("License"), std::string(), true, false),
406+ (&vbox, "license", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
407+ _("License"), "", true, false),
408+ authors
409+ (&vbox, "authors", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
410+ _("Authors"), "", true, false),
411 exit
412- (this, "exit",
413- m_butx, get_h() * 178 / 200, m_butw, m_buth,
414- g_gr->images().get("pics/but3.png"),
415- _("Exit Widelands"), std::string(), true, false),
416+ (&vbox, "exit", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
417+ _("Exit Widelands"), "", true, false),
418
419-// Textlabels
420+ // Textlabels
421 version
422- (this,
423- get_w(), get_h(),
424- _("Version ") + build_id() + '(' + build_type() + ')',
425+ (this, get_w(), get_h(),
426+ /** TRANSLATORS: %1$s = version string, %2%s = "Debug" or "Release" */
427+ (boost::format(_("Version %1$s (%2$s)")) % build_id().c_str() % build_type().c_str()).str(),
428 UI::Align_BottomRight),
429 copyright
430- (this,
431- 0, get_h() - 0.5 * m_buth,
432- (wlcr + _("by the Widelands Development Team")).c_str(),
433+ (this, 0, get_h() - 0.5 * m_buth,
434+ /** TRANSLATORS: Placeholders are the copyright years */
435+ (boost::format(_("(C) %1%-%2% by the Widelands Development Team"))
436+ % kWidelandsCopyrightStart % kWidelandsCopyrightEnd).str(),
437 UI::Align_BottomLeft),
438 gpl
439- (this,
440- 0, get_h(),
441+ (this, 0, get_h(),
442 _("Licensed under the GNU General Public License V2.0"),
443 UI::Align_BottomLeft)
444 {
445 playtutorial.sigclicked.connect
446 (boost::bind
447 (&FullscreenMenuMain::end_modal, boost::ref(*this),
448- static_cast<int32_t>(mm_playtutorial)));
449+ static_cast<int32_t>(MenuTarget::kTutorial)));
450 singleplayer.sigclicked.connect
451 (boost::bind
452 (&FullscreenMenuMain::end_modal, boost::ref(*this),
453- static_cast<int32_t>(mm_singleplayer)));
454+ static_cast<int32_t>(MenuTarget::kSinglePlayer)));
455 multiplayer.sigclicked.connect
456 (boost::bind
457 (&FullscreenMenuMain::end_modal, boost::ref(*this),
458- static_cast<int32_t>(mm_multiplayer)));
459+ static_cast<int32_t>(MenuTarget::kMultiplayer)));
460 replay.sigclicked.connect
461 (boost::bind
462 (&FullscreenMenuMain::end_modal, boost::ref(*this),
463- static_cast<int32_t>(mm_replay)));
464+ static_cast<int32_t>(MenuTarget::kReplay)));
465 editor.sigclicked.connect
466 (boost::bind
467 (&FullscreenMenuMain::end_modal, boost::ref(*this),
468- static_cast<int32_t>(mm_editor)));
469+ static_cast<int32_t>(MenuTarget::kEditor)));
470 options.sigclicked.connect
471 (boost::bind
472 (&FullscreenMenuMain::end_modal, boost::ref(*this),
473- static_cast<int32_t>(mm_options)));
474+ static_cast<int32_t>(MenuTarget::kOptions)));
475 readme.sigclicked.connect
476 (boost::bind
477 (&FullscreenMenuMain::end_modal, boost::ref(*this),
478- static_cast<int32_t>(mm_readme)));
479+ static_cast<int32_t>(MenuTarget::kReadme)));
480 license.sigclicked.connect
481 (boost::bind
482 (&FullscreenMenuMain::end_modal, boost::ref(*this),
483- static_cast<int32_t>(mm_license)));
484+ static_cast<int32_t>(MenuTarget::kLicense)));
485+ authors.sigclicked.connect
486+ (boost::bind
487+ (&FullscreenMenuMain::end_modal, boost::ref(*this),
488+ static_cast<int32_t>(MenuTarget::kAuthors)));
489 exit.sigclicked.connect
490 (boost::bind
491 (&FullscreenMenuMain::end_modal, boost::ref(*this),
492- static_cast<int32_t>(mm_exit)));
493-
494- playtutorial.set_font(font_small());
495- singleplayer.set_font(font_small());
496- multiplayer.set_font(font_small());
497- replay.set_font(font_small());
498- editor.set_font(font_small());
499- options.set_font(font_small());
500- readme.set_font(font_small());
501- license.set_font(font_small());
502- exit.set_font(font_small());
503-
504- version.set_textstyle(ts_small());
505- copyright.set_textstyle(ts_small());
506- gpl.set_textstyle(ts_small());
507+ static_cast<int32_t>(MenuTarget::kExit)));
508+
509+ vbox.add(&playtutorial, UI::Box::AlignCenter);
510+
511+ vbox.add_space(m_padding);
512+
513+ vbox.add(&singleplayer, UI::Box::AlignCenter);
514+ vbox.add(&multiplayer, UI::Box::AlignCenter);
515+ vbox.add(&replay, UI::Box::AlignCenter);
516+
517+ vbox.add_space(m_padding);
518+
519+ vbox.add(&editor, UI::Box::AlignCenter);
520+
521+ vbox.add_space(m_padding);
522+
523+ vbox.add(&options, UI::Box::AlignCenter);
524+
525+ vbox.add_space(m_padding);
526+
527+ vbox.add(&readme, UI::Box::AlignCenter);
528+ vbox.add(&license, UI::Box::AlignCenter);
529+ vbox.add(&authors, UI::Box::AlignCenter);
530+
531+ vbox.add_space(m_padding);
532+
533+ vbox.add(&exit, UI::Box::AlignCenter);
534+
535+ vbox.set_size(m_butw, get_h() - vbox.get_y());
536 }
537
538=== modified file 'src/ui_fsmenu/main.h'
539--- src/ui_fsmenu/main.h 2014-09-10 14:08:25 +0000
540+++ src/ui_fsmenu/main.h 2014-12-04 06:44:40 +0000
541@@ -20,45 +20,47 @@
542 #ifndef WL_UI_FSMENU_MAIN_H
543 #define WL_UI_FSMENU_MAIN_H
544
545-#include "ui_fsmenu/base.h"
546+#include "ui_fsmenu/main_menu.h"
547 #include "ui_basic/button.h"
548+#include "ui_basic/box.h"
549 #include "ui_basic/textarea.h"
550
551 /**
552 * This runs the main menu. There, you can select
553 * between different playmodes, exit and so on.
554 */
555-struct FullscreenMenuMain : public FullscreenMenuBase {
556+class FullscreenMenuMain : public FullscreenMenuMainMenu {
557+public:
558+ enum class MenuTarget: int32_t {
559+ kTutorial,
560+ kSinglePlayer,
561+ kMultiplayer,
562+ kReplay,
563+ kEditor,
564+ kOptions,
565+ kReadme,
566+ kLicense,
567+ kAuthors,
568+ kExit
569+ };
570+
571 FullscreenMenuMain();
572- enum {
573- mm_summary,
574- mm_playtutorial,
575- mm_singleplayer,
576- mm_multiplayer,
577- mm_replay,
578- mm_editor,
579- mm_options,
580- mm_readme,
581- mm_license,
582- mm_exit
583- };
584+
585 private:
586- uint32_t m_butx;
587- uint32_t m_butw;
588- uint32_t m_buth;
589- std::string wlcr;
590- UI::Button playtutorial;
591- UI::Button singleplayer;
592- UI::Button multiplayer;
593- UI::Button replay;
594- UI::Button editor;
595- UI::Button options;
596- UI::Button readme;
597- UI::Button license;
598- UI::Button exit;
599- UI::Textarea version;
600- UI::Textarea copyright;
601- UI::Textarea gpl;
602+ UI::Box vbox;
603+ UI::Button playtutorial;
604+ UI::Button singleplayer;
605+ UI::Button multiplayer;
606+ UI::Button replay;
607+ UI::Button editor;
608+ UI::Button options;
609+ UI::Button readme;
610+ UI::Button license;
611+ UI::Button authors;
612+ UI::Button exit;
613+ UI::Textarea version;
614+ UI::Textarea copyright;
615+ UI::Textarea gpl;
616 };
617
618 #endif // end of include guard: WL_UI_FSMENU_MAIN_H
619
620=== added file 'src/ui_fsmenu/main_menu.cc'
621--- src/ui_fsmenu/main_menu.cc 1970-01-01 00:00:00 +0000
622+++ src/ui_fsmenu/main_menu.cc 2014-12-04 06:44:40 +0000
623@@ -0,0 +1,37 @@
624+/*
625+ * Copyright (C) 2002-2004, 2006-2009 by the Widelands Development Team
626+ *
627+ * This program is free software; you can redistribute it and/or
628+ * modify it under the terms of the GNU General Public License
629+ * as published by the Free Software Foundation; either version 2
630+ * of the License, or (at your option) any later version.
631+ *
632+ * This program is distributed in the hope that it will be useful,
633+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
634+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
635+ * GNU General Public License for more details.
636+ *
637+ * You should have received a copy of the GNU General Public License
638+ * along with this program; if not, write to the Free Software
639+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
640+ *
641+ */
642+
643+#include "ui_fsmenu/main_menu.h"
644+
645+FullscreenMenuMainMenu::FullscreenMenuMainMenu():
646+ FullscreenMenuMainMenu("ui_fsmenu.jpg")
647+ {}
648+
649+FullscreenMenuMainMenu::FullscreenMenuMainMenu(const char* background_image):
650+ FullscreenMenuBase(background_image),
651+
652+ // Values for alignment and size
653+ m_box_x(get_w() * 13 / 40),
654+ m_box_y(get_h() * 6 / 25),
655+ m_butw(get_w() * 7 / 20),
656+ m_buth(get_h() * 9 / 200),
657+ m_title_y(get_h() * 3 / 40),
658+ m_padding(m_buth / 3),
659+ m_button_background("pics/but3.png")
660+{}
661
662=== added file 'src/ui_fsmenu/main_menu.h'
663--- src/ui_fsmenu/main_menu.h 1970-01-01 00:00:00 +0000
664+++ src/ui_fsmenu/main_menu.h 2014-12-04 06:44:40 +0000
665@@ -0,0 +1,49 @@
666+/*
667+ * Copyright (C) 2002, 2006-2008 by the Widelands Development Team
668+ *
669+ * This program is free software; you can redistribute it and/or
670+ * modify it under the terms of the GNU General Public License
671+ * as published by the Free Software Foundation; either version 2
672+ * of the License, or (at your option) any later version.
673+ *
674+ * This program is distributed in the hope that it will be useful,
675+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
676+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
677+ * GNU General Public License for more details.
678+ *
679+ * You should have received a copy of the GNU General Public License
680+ * along with this program; if not, write to the Free Software
681+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
682+ *
683+ */
684+
685+#ifndef WL_UI_FSMENU_MAIN_MENU_H
686+#define WL_UI_FSMENU_MAIN_MENU_H
687+
688+#include "ui_fsmenu/base.h"
689+
690+/**
691+ * This sets the values for alignment and size and other common properties
692+ * for main menus that contain only buttons.
693+ */
694+class FullscreenMenuMainMenu : public FullscreenMenuBase {
695+public:
696+
697+ /// Calls FullscreenMenuMainMenu(char const * background_image)
698+ /// with a default background image
699+ FullscreenMenuMainMenu();
700+
701+ /// Sets the background image and assigns values
702+ /// for alignment and size, depending on screen size
703+ FullscreenMenuMainMenu(char const * background_image);
704+
705+protected:
706+ const uint32_t m_box_x, m_box_y;
707+ const uint32_t m_butw, m_buth;
708+ const uint32_t m_title_y;
709+ const uint32_t m_padding;
710+
711+ const std::string m_button_background;
712+};
713+
714+#endif // end of include guard: WL_UI_FSMENU_MAIN_MENU_H
715
716=== modified file 'src/ui_fsmenu/mapselect.h'
717--- src/ui_fsmenu/mapselect.h 2014-10-29 06:00:52 +0000
718+++ src/ui_fsmenu/mapselect.h 2014-12-04 06:44:40 +0000
719@@ -67,7 +67,8 @@
720 /**
721 * Select a Map in Fullscreen Mode. It's a modal fullscreen menu
722 */
723-struct FullscreenMenuMapSelect : public FullscreenMenuLoadMapOrGame {
724+class FullscreenMenuMapSelect : public FullscreenMenuLoadMapOrGame {
725+public:
726 FullscreenMenuMapSelect(GameSettingsProvider*, GameController*, bool is_editor = false);
727
728 bool is_scenario();
729
730=== modified file 'src/ui_fsmenu/multiplayer.cc'
731--- src/ui_fsmenu/multiplayer.cc 2014-09-29 19:25:24 +0000
732+++ src/ui_fsmenu/multiplayer.cc 2014-12-04 06:44:40 +0000
733@@ -25,52 +25,52 @@
734 #include "wui/text_constants.h"
735
736 FullscreenMenuMultiPlayer::FullscreenMenuMultiPlayer() :
737- FullscreenMenuBase("ui_fsmenu.jpg"),
738-
739-// Values for alignment and size
740- m_butw (get_w() * 7 / 20),
741- m_buth (get_h() * 19 / 400),
742- m_butx ((get_w() - m_butw) / 2),
743- m_fs (fs_small()),
744- m_fn (ui_fn()),
745+ FullscreenMenuMainMenu(),
746
747 // Title
748 title
749 (this,
750- get_w() / 2, get_h() * 3 / 40,
751+ get_w() / 2, m_title_y,
752 _("Choose game type"), UI::Align_HCenter),
753
754 // Buttons
755+ vbox(this, m_box_x, m_box_y, UI::Box::Vertical,
756+ m_butw, get_h() - vbox.get_y(), m_padding),
757 metaserver
758- (this, "metaserver",
759- m_butx, get_h() * 6 / 25, m_butw, m_buth,
760- g_gr->images().get("pics/but1.png"),
761- _("Internet game"), std::string(), true, false),
762+ (&vbox, "metaserver", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
763+ _("Internet game"), "", true, false),
764 lan
765- (this, "lan",
766- m_butx, get_h() * 61 / 200, m_butw, m_buth,
767- g_gr->images().get("pics/but1.png"),
768- _("LAN / Direct IP"), std::string(), true, false),
769+ (&vbox, "lan", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
770+ _("LAN / Direct IP"), "", true, false),
771 back
772- (this, "back",
773- m_butx, get_h() * 3 / 4, m_butw, m_buth,
774- g_gr->images().get("pics/but0.png"),
775- _("Back"), std::string(), true, false)
776+ (&vbox, "back", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
777+ _("Back"), "", true, false)
778 {
779 metaserver.sigclicked.connect(boost::bind(&FullscreenMenuMultiPlayer::internet_login, boost::ref(*this)));
780- metaserver.set_font(font_small());
781- lan.set_font(font_small());
782+
783 lan.sigclicked.connect
784 (boost::bind
785 (&FullscreenMenuMultiPlayer::end_modal, boost::ref(*this),
786- static_cast<int32_t>(Lan)));
787- back.set_font(font_small());
788+ static_cast<int32_t>(MenuTarget::kLan)));
789+
790 back.sigclicked.connect
791 (boost::bind
792 (&FullscreenMenuMultiPlayer::end_modal, boost::ref(*this),
793- static_cast<int32_t>(Back)));
794-
795- title.set_font(m_fn, fs_big(), UI_FONT_CLR_FG);
796+ static_cast<int32_t>(MenuTarget::kBack)));
797+
798+ title.set_font(ui_fn(), fs_big(), UI_FONT_CLR_FG);
799+
800+ vbox.add(&metaserver, UI::Box::AlignCenter);
801+ vbox.add(&lan, UI::Box::AlignCenter);
802+
803+ // Multiple add_space calls to get the same height for the back button as in the single player menu
804+ vbox.add_space(m_buth);
805+ vbox.add_space(m_buth);
806+ vbox.add_space(6 * m_buth);
807+
808+ vbox.add(&back, UI::Box::AlignCenter);
809+
810+ vbox.set_size(m_butw, get_h() - vbox.get_y());
811
812 Section & s = g_options.pull_section("global");
813 m_auto_log = s.get_bool("auto_log", false);
814@@ -78,7 +78,7 @@
815 showloginbox =
816 new UI::Button
817 (this, "login_dialog",
818- m_butx + m_butw + m_buth / 4, get_h() * 6 / 25, m_buth, m_buth,
819+ m_box_x + m_butw + m_buth / 4, get_h() * 6 / 25, m_buth, m_buth,
820 g_gr->images().get("pics/but1.png"),
821 g_gr->images().get("pics/continue.png"),
822 _("Show login dialog"), true, false);
823@@ -115,7 +115,7 @@
824 m_nickname = s.get_string("nickname", _("nobody"));
825 m_password = s.get_string("password", "nobody");
826 m_register = s.get_bool("registered", false);
827- end_modal(Metaserver);
828+ end_modal(static_cast<int32_t>(MenuTarget::kMetaserver));
829 return;
830 }
831
832@@ -128,6 +128,6 @@
833 s.set_bool("registered", lb.registered());
834 s.set_bool("auto_log", lb.set_automaticlog());
835
836- end_modal(Metaserver);
837+ end_modal(static_cast<int32_t>(MenuTarget::kMetaserver));
838 }
839 }
840
841=== modified file 'src/ui_fsmenu/multiplayer.h'
842--- src/ui_fsmenu/multiplayer.h 2014-09-20 09:37:47 +0000
843+++ src/ui_fsmenu/multiplayer.h 2014-12-04 06:44:40 +0000
844@@ -20,8 +20,9 @@
845 #ifndef WL_UI_FSMENU_MULTIPLAYER_H
846 #define WL_UI_FSMENU_MULTIPLAYER_H
847
848-#include "ui_fsmenu/base.h"
849+#include "ui_fsmenu/main_menu.h"
850 #include "network/internet_gaming.h"
851+#include "ui_basic/box.h"
852 #include "ui_basic/button.h"
853 #include "ui_basic/textarea.h"
854
855@@ -29,10 +30,15 @@
856 * Fullscreen Menu for MultiPlayer.
857 * Here you select what game you want to play.
858 */
859-struct FullscreenMenuMultiPlayer : public FullscreenMenuBase {
860+class FullscreenMenuMultiPlayer : public FullscreenMenuMainMenu {
861+public:
862 FullscreenMenuMultiPlayer();
863
864- enum {Back = dying_code, Metaserver, Lan};
865+ enum class MenuTarget: int32_t {
866+ kBack = UI::Panel::dying_code,
867+ kMetaserver,
868+ kLan
869+ };
870
871 void show_internet_login();
872 void internet_login();
873@@ -41,16 +47,12 @@
874 bool registered() {return m_register;}
875
876 private:
877- uint32_t m_butw;
878- uint32_t m_buth;
879- uint32_t m_butx;
880- uint32_t m_fs;
881- std::string m_fn;
882- UI::Textarea title;
883- UI::Button metaserver;
884- UI::Button * showloginbox;
885- UI::Button lan;
886- UI::Button back;
887+ UI::Textarea title;
888+ UI::Box vbox;
889+ UI::Button metaserver;
890+ UI::Button* showloginbox;
891+ UI::Button lan;
892+ UI::Button back;
893
894 // Values from internet login window
895 std::string m_nickname;
896
897=== modified file 'src/ui_fsmenu/netsetup_lan.h'
898--- src/ui_fsmenu/netsetup_lan.h 2014-09-10 14:48:40 +0000
899+++ src/ui_fsmenu/netsetup_lan.h 2014-12-04 06:44:40 +0000
900@@ -34,7 +34,8 @@
901 struct NetOpenGame;
902 struct NetGameInfo;
903
904-struct FullscreenMenuNetSetupLAN : public FullscreenMenuBase {
905+class FullscreenMenuNetSetupLAN : public FullscreenMenuBase {
906+public:
907 enum {
908 CANCEL = 0,
909 HOSTGAME,
910
911=== modified file 'src/ui_fsmenu/singleplayer.cc'
912--- src/ui_fsmenu/singleplayer.cc 2014-09-27 09:28:51 +0000
913+++ src/ui_fsmenu/singleplayer.cc 2014-12-04 06:44:40 +0000
914@@ -24,65 +24,63 @@
915 #include "wui/text_constants.h"
916
917 FullscreenMenuSinglePlayer::FullscreenMenuSinglePlayer() :
918-FullscreenMenuBase("ui_fsmenu.jpg"),
919-
920-// Values for alignment and size
921- m_butw (get_w() * 7 / 20),
922- m_buth (get_h() * 19 / 400),
923- m_butx ((get_w() - m_butw) / 2),
924- m_fs (fs_small()),
925- m_fn (ui_fn()),
926+ FullscreenMenuMainMenu(),
927
928 // Title
929 title
930 (this,
931- get_w() / 2, get_h() * 3 / 40,
932+ get_w() / 2, m_title_y,
933 _("Single Player"), UI::Align_HCenter),
934
935 // Buttons
936+ vbox(this, m_box_x, m_box_y, UI::Box::Vertical,
937+ m_butw, get_h() - vbox.get_y(), m_padding),
938 new_game
939- (this, "new_game",
940- m_butx, get_h() * 6 / 25, m_butw, m_buth,
941- g_gr->images().get("pics/but1.png"),
942- _("New Game"), std::string(), true, false),
943+ (&vbox, "new_game", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
944+ _("New Game"), "", true, false),
945 campaign
946- (this, "campaigns",
947- m_butx, get_h() * 61 / 200, m_butw, m_buth,
948- g_gr->images().get("pics/but1.png"),
949- _("Campaigns"), std::string(), true, false),
950+ (&vbox, "campaigns", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
951+ _("Campaigns"), "", true, false),
952 load_game
953- (this, "load_game",
954- m_butx, get_h() * 87 / 200, m_butw, m_buth,
955- g_gr->images().get("pics/but1.png"),
956- _("Load Game"), std::string(), true, false),
957+ (&vbox, "load_game", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
958+ _("Load Game"), "", true, false),
959 back
960- (this, "back",
961- m_butx, get_h() * 3 / 4, m_butw, m_buth,
962- g_gr->images().get("pics/but0.png"),
963- _("Back"), std::string(), true, false)
964+ (&vbox, "back", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
965+ _("Back"), "", true, false)
966 {
967 new_game.sigclicked.connect
968 (boost::bind
969 (&FullscreenMenuSinglePlayer::end_modal,
970 boost::ref(*this),
971- static_cast<int32_t>(New_Game)));
972+ static_cast<int32_t>(MenuTarget::kNewGame)));
973 campaign.sigclicked.connect
974 (boost::bind
975 (&FullscreenMenuSinglePlayer::end_modal,
976 boost::ref(*this),
977- static_cast<int32_t>(Campaign)));
978+ static_cast<int32_t>(MenuTarget::kCampaign)));
979 load_game.sigclicked.connect
980 (boost::bind
981 (&FullscreenMenuSinglePlayer::end_modal,
982 boost::ref(*this),
983- static_cast<int32_t>(Load_Game)));
984+ static_cast<int32_t>(MenuTarget::kLoadGame)));
985 back.sigclicked.connect
986- (boost::bind(&FullscreenMenuSinglePlayer::end_modal, boost::ref(*this), static_cast<int32_t>(Back)));
987-
988- back.set_font(font_small());
989- new_game.set_font(font_small());
990- campaign.set_font(font_small());
991- load_game.set_font(font_small());
992-
993- title.set_font(m_fn, fs_big(), UI_FONT_CLR_FG);
994+ (boost::bind
995+ (&FullscreenMenuSinglePlayer::end_modal,
996+ boost::ref(*this),
997+ static_cast<int32_t>(MenuTarget::kBack)));
998+
999+ title.set_font(ui_fn(), fs_big(), UI_FONT_CLR_FG);
1000+
1001+ vbox.add(&new_game, UI::Box::AlignCenter);
1002+ vbox.add(&campaign, UI::Box::AlignCenter);
1003+
1004+ vbox.add_space(m_buth);
1005+
1006+ vbox.add(&load_game, UI::Box::AlignCenter);
1007+
1008+ vbox.add_space(6 * m_buth);
1009+
1010+ vbox.add(&back, UI::Box::AlignCenter);
1011+
1012+ vbox.set_size(m_butw, get_h() - vbox.get_y());
1013 }
1014
1015=== modified file 'src/ui_fsmenu/singleplayer.h'
1016--- src/ui_fsmenu/singleplayer.h 2014-09-10 14:08:25 +0000
1017+++ src/ui_fsmenu/singleplayer.h 2014-12-04 06:44:40 +0000
1018@@ -20,7 +20,8 @@
1019 #ifndef WL_UI_FSMENU_SINGLEPLAYER_H
1020 #define WL_UI_FSMENU_SINGLEPLAYER_H
1021
1022-#include "ui_fsmenu/base.h"
1023+#include "ui_fsmenu/main_menu.h"
1024+#include "ui_basic/box.h"
1025 #include "ui_basic/button.h"
1026 #include "ui_basic/textarea.h"
1027
1028@@ -28,22 +29,24 @@
1029 * Fullscreen Menu for SinglePlayer.
1030 * Here you select what game you want to play.
1031 */
1032-struct FullscreenMenuSinglePlayer : public FullscreenMenuBase {
1033+class FullscreenMenuSinglePlayer : public FullscreenMenuMainMenu {
1034+public:
1035 FullscreenMenuSinglePlayer();
1036
1037- enum {Back = dying_code, New_Game, Campaign, Load_Game};
1038+ enum class MenuTarget: int32_t {
1039+ kBack = UI::Panel::dying_code,
1040+ kNewGame,
1041+ kCampaign,
1042+ kLoadGame
1043+ };
1044
1045 private:
1046- uint32_t m_butw;
1047- uint32_t m_buth;
1048- uint32_t m_butx;
1049- uint32_t m_fs;
1050- std::string m_fn;
1051- UI::Textarea title;
1052- UI::Button new_game;
1053- UI::Button campaign;
1054- UI::Button load_game;
1055- UI::Button back;
1056+ UI::Textarea title;
1057+ UI::Box vbox;
1058+ UI::Button new_game;
1059+ UI::Button campaign;
1060+ UI::Button load_game;
1061+ UI::Button back;
1062 };
1063
1064 #endif // end of include guard: WL_UI_FSMENU_SINGLEPLAYER_H
1065
1066=== modified file 'src/wlapplication.cc'
1067--- src/wlapplication.cc 2014-12-03 20:58:09 +0000
1068+++ src/wlapplication.cc 2014-12-04 06:44:40 +0000
1069@@ -1067,39 +1067,44 @@
1070 }
1071
1072 try {
1073- switch (mm.run()) {
1074- case FullscreenMenuMain::mm_playtutorial:
1075+ switch (static_cast<FullscreenMenuMain::MenuTarget>(mm.run())) {
1076+ case FullscreenMenuMain::MenuTarget::kTutorial:
1077 mainmenu_tutorial();
1078 break;
1079- case FullscreenMenuMain::mm_singleplayer:
1080+ case FullscreenMenuMain::MenuTarget::kSinglePlayer:
1081 mainmenu_singleplayer();
1082 break;
1083- case FullscreenMenuMain::mm_multiplayer:
1084+ case FullscreenMenuMain::MenuTarget::kMultiplayer:
1085 mainmenu_multiplayer();
1086 break;
1087- case FullscreenMenuMain::mm_replay:
1088+ case FullscreenMenuMain::MenuTarget::kReplay:
1089 replay();
1090 break;
1091- case FullscreenMenuMain::mm_options: {
1092+ case FullscreenMenuMain::MenuTarget::kOptions: {
1093 Section & s = g_options.pull_section("global");
1094 OptionsCtrl om(s);
1095 break;
1096 }
1097- case FullscreenMenuMain::mm_readme: {
1098+ case FullscreenMenuMain::MenuTarget::kReadme: {
1099 FullscreenMenuFileView ff("txts/README.lua");
1100 ff.run();
1101 break;
1102 }
1103- case FullscreenMenuMain::mm_license: {
1104+ case FullscreenMenuMain::MenuTarget::kLicense: {
1105 FullscreenMenuFileView ff("txts/license");
1106 ff.run();
1107 break;
1108 }
1109- case FullscreenMenuMain::mm_editor:
1110+ case FullscreenMenuMain::MenuTarget::kAuthors: {
1111+ FullscreenMenuFileView ff("txts/developers");
1112+ ff.run();
1113+ break;
1114+ }
1115+ case FullscreenMenuMain::MenuTarget::kEditor:
1116 mainmenu_editor();
1117 break;
1118 default:
1119- case FullscreenMenuMain::mm_exit:
1120+ case FullscreenMenuMain::MenuTarget::kExit:
1121 return;
1122 }
1123 } catch (const WLWarning & e) {
1124@@ -1168,26 +1173,23 @@
1125 // This is the code returned by UI::Panel::run() when the panel is dying.
1126 // Make sure that the program exits when the window manager says so.
1127 static_assert
1128- (FullscreenMenuSinglePlayer::Back == UI::Panel::dying_code, "Panel should be dying.");
1129+ (static_cast<int32_t>(FullscreenMenuSinglePlayer::MenuTarget::kBack) == UI::Panel::dying_code,
1130+ "Panel should be dying.");
1131
1132 for (;;) {
1133- int32_t code;
1134- {
1135- FullscreenMenuSinglePlayer single_player_menu;
1136- code = single_player_menu.run();
1137- }
1138- switch (code) {
1139- case FullscreenMenuSinglePlayer::Back:
1140+ FullscreenMenuSinglePlayer single_player_menu;
1141+ switch (static_cast<FullscreenMenuSinglePlayer::MenuTarget>(single_player_menu.run())) {
1142+ case FullscreenMenuSinglePlayer::MenuTarget::kBack:
1143 return;
1144- case FullscreenMenuSinglePlayer::New_Game:
1145+ case FullscreenMenuSinglePlayer::MenuTarget::kNewGame:
1146 if (new_game())
1147 return;
1148 break;
1149- case FullscreenMenuSinglePlayer::Load_Game:
1150+ case FullscreenMenuSinglePlayer::MenuTarget::kLoadGame:
1151 if (load_game())
1152 return;
1153 break;
1154- case FullscreenMenuSinglePlayer::Campaign:
1155+ case FullscreenMenuSinglePlayer::MenuTarget::kCampaign:
1156 if (campaign_game())
1157 return;
1158 break;
1159@@ -1208,13 +1210,13 @@
1160 for (;;) { // stay in menu until player clicks "back" button
1161 bool internet = false;
1162 FullscreenMenuMultiPlayer mp;
1163- switch (mp.run()) {
1164- case FullscreenMenuMultiPlayer::Back:
1165+ switch (static_cast<FullscreenMenuMultiPlayer::MenuTarget>(mp.run())) {
1166+ case FullscreenMenuMultiPlayer::MenuTarget::kBack:
1167 return;
1168- case FullscreenMenuMultiPlayer::Metaserver:
1169+ case FullscreenMenuMultiPlayer::MenuTarget::kMetaserver:
1170 internet = true;
1171 break;
1172- case FullscreenMenuMultiPlayer::Lan:
1173+ case FullscreenMenuMultiPlayer::MenuTarget::kLan:
1174 break;
1175 default:
1176 assert(false);
1177@@ -1284,21 +1286,18 @@
1178 // This is the code returned by UI::Panel::run() when the panel is dying.
1179 // Make sure that the program exits when the window manager says so.
1180 static_assert
1181- (FullscreenMenuEditor::Back == UI::Panel::dying_code, "Editor should be dying.");
1182+ (static_cast<int32_t>(FullscreenMenuEditor::MenuTarget::kBack) == UI::Panel::dying_code,
1183+ "Editor should be dying.");
1184
1185 for (;;) {
1186- int32_t code;
1187- {
1188- FullscreenMenuEditor editor_menu;
1189- code = editor_menu.run();
1190- }
1191- switch (code) {
1192- case FullscreenMenuEditor::Back:
1193+ FullscreenMenuEditor editor_menu;
1194+ switch (static_cast<FullscreenMenuEditor::MenuTarget>(editor_menu.run())) {
1195+ case FullscreenMenuEditor::MenuTarget::kBack:
1196 return;
1197- case FullscreenMenuEditor::New_Map:
1198+ case FullscreenMenuEditor::MenuTarget::kNewMap:
1199 EditorInteractive::run_editor(m_filename, m_script_to_run);
1200 return;
1201- case FullscreenMenuEditor::Load_Map: {
1202+ case FullscreenMenuEditor::MenuTarget::kLoadMap: {
1203 std::string filename;
1204 {
1205 SinglePlayerGameSettingsProvider sp;
1206
1207=== modified file 'txts/developers'
1208--- txts/developers 2014-10-12 12:22:54 +0000
1209+++ txts/developers 2014-12-04 06:44:40 +0000
1210@@ -1,4 +1,4 @@
1211-title=_ Development
1212+title=_Authors
1213 text=_""<rt text-align=center><p font-size=28 font-decoration=bold font-face=DejaVuSerif font-color=2F9131>"
1214 _ "Widelands Development Team"
1215 "</p></rt>"

Subscribers

People subscribed via source and target branches

to status/vote changes: