Author: mordante
Date: Sat Oct 16 21:53:41 2010
New Revision: 47063
URL: http://svn.gna.org/viewcvs/wesnoth?rev=47063&view=rev
Log:
Move title screen results to title screen dialog.
Might move later again after deciding how to handle automatic assignment
of named buttons.
Modified:
trunk/src/game.cpp
trunk/src/gui/dialogs/title_screen.cpp
trunk/src/gui/dialogs/title_screen.hpp
trunk/src/gui/widgets/window.cpp
trunk/src/titlescreen.hpp
Modified: trunk/src/game.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game.cpp?rev=47063&r1=47062&r2=47063&view=diff
==============================================================================
--- trunk/src/game.cpp (original)
+++ trunk/src/game.cpp Sat Oct 16 21:53:41 2010
@@ -73,7 +73,6 @@
#include "sound.hpp"
#include "statistics.hpp"
#include "thread.hpp"
-#include "titlescreen.hpp"
#include "wml_exception.hpp"
#include "wml_separators.hpp"
#include "serialization/binary_or_text.hpp"
@@ -2342,78 +2341,80 @@
#endif
loadscreen_manager.reset();
- gui::TITLE_RESULT res = game.is_loading() ? gui::LOAD_GAME :
gui::NOTHING;
+ gui2::ttitle_screen::tresult res = game.is_loading()
+ ? gui2::ttitle_screen::LOAD_GAME
+ : gui2::ttitle_screen::NOTHING;
const preferences::display_manager disp_manager(&game.disp());
const font::floating_label_context label_manager;
cursor::set(cursor::NORMAL);
- if(res == gui::NOTHING) {
+ if(res == gui2::ttitle_screen::NOTHING) {
const hotkey::basic_handler key_handler(&game.disp());
gui2::ttitle_screen dlg;
dlg.show(game.disp().video());
- res = static_cast<gui::TITLE_RESULT>(dlg.get_retval());
+ res =
static_cast<gui2::ttitle_screen::tresult>(dlg.get_retval());
}
game_controller::RELOAD_GAME_DATA should_reload =
game_controller::RELOAD_DATA;
- if(res == gui::QUIT_GAME) {
+ if(res == gui2::ttitle_screen::QUIT_GAME) {
LOG_GENERAL << "quitting game...\n";
return 0;
- } else if(res == gui::LOAD_GAME) {
+ } else if(res == gui2::ttitle_screen::LOAD_GAME) {
if(game.load_game() == false) {
game.clear_loaded_game();
- res = gui::NOTHING;
+ res = gui2::ttitle_screen::NOTHING;
continue;
}
should_reload = game_controller::NO_RELOAD_DATA;
- } else if(res == gui::TUTORIAL) {
+ } else if(res == gui2::ttitle_screen::TUTORIAL) {
game.set_tutorial();
- } else if(res == gui::NEW_CAMPAIGN) {
+ } else if(res == gui2::ttitle_screen::NEW_CAMPAIGN) {
if(game.new_campaign() == false) {
continue;
}
- } else if(res == gui::MULTIPLAYER) {
+ } else if(res == gui2::ttitle_screen::MULTIPLAYER) {
if (!game_config::mp_debug) {
game_config::debug = false;
}
if(game.play_multiplayer() == false) {
continue;
}
- } else if(res == gui::CHANGE_LANGUAGE) {
+ } else if(res == gui2::ttitle_screen::CHANGE_LANGUAGE) {
if (game.change_language()) {
tips_of_day.clear();
t_string::reset_translations();
image::flush_cache();
}
continue;
- } else if(res == gui::EDIT_PREFERENCES) {
+ } else if(res == gui2::ttitle_screen::EDIT_PREFERENCES) {
game.show_preferences();
continue;
- } else if(res == gui::SHOW_ABOUT) {
+ } else if(res == gui2::ttitle_screen::SHOW_ABOUT) {
about::show_about(game.disp());
continue;
- } else if(res == gui::SHOW_HELP) {
+ } else if(res == gui2::ttitle_screen::SHOW_HELP) {
help::help_manager help_manager(&game.game_config(),
NULL);
help::show_help(game.disp());
continue;
- } else if(res == gui::GET_ADDONS) {
+ } else if(res == gui2::ttitle_screen::GET_ADDONS) {
try {
manage_addons(game.disp());
} catch(config_changed_exception const&) {
game.reload_changed_game_config();
}
continue;
- } else if(res == gui::RELOAD_GAME_DATA) {
+ } else if(res == gui2::ttitle_screen::RELOAD_GAME_DATA) {
loadscreen::global_loadscreen_manager
loadscreen(game.disp().video());
game.reload_changed_game_config();
image::flush_cache();
continue;
#ifndef DISABLE_EDITOR
- } else if(res == gui::START_MAP_EDITOR) {
+ } else if(res == gui2::ttitle_screen::START_MAP_EDITOR) {
///@todo editor can ask the game to quit completely
if (game.start_editor() ==
editor::EXIT_QUIT_TO_DESKTOP) {
return 0;
Modified: trunk/src/gui/dialogs/title_screen.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/title_screen.cpp?rev=47063&r1=47062&r2=47063&view=diff
==============================================================================
--- trunk/src/gui/dialogs/title_screen.cpp (original)
+++ trunk/src/gui/dialogs/title_screen.cpp Sat Oct 16 21:53:41 2010
@@ -32,7 +32,6 @@
#include "gui/widgets/settings.hpp"
#include "gui/widgets/window.hpp"
#include "preferences_display.hpp"
-#include "titlescreen.hpp"
#include <boost/bind.hpp>
@@ -87,9 +86,9 @@
REGISTER_WINDOW(title_screen)
-static bool hotkey(twindow& window, const gui::TITLE_RESULT title_result)
-{
- window.set_retval(static_cast<twindow::tretval>(title_result));
+static bool hotkey(twindow& window, const ttitle_screen::tresult result)
+{
+ window.set_retval(static_cast<twindow::tretval>(result));
return true;
}
@@ -156,7 +155,7 @@
, boost::bind(
&hotkey
, boost::ref(window)
- , gui::RELOAD_GAME_DATA));
+ , RELOAD_GAME_DATA));
window.register_hotkey(hotkey::HOTKEY_FULLSCREEN
, boost::bind(fullscreen, boost::ref(video)));
@@ -165,25 +164,25 @@
, boost::bind(
&hotkey
, boost::ref(window)
- , gui::CHANGE_LANGUAGE));
+ , CHANGE_LANGUAGE));
window.register_hotkey(hotkey::HOTKEY_LOAD_GAME
, boost::bind(
&hotkey
, boost::ref(window)
- , gui::LOAD_GAME));
+ , LOAD_GAME));
window.register_hotkey(hotkey::HOTKEY_HELP
, boost::bind(
&hotkey
, boost::ref(window)
- , gui::SHOW_HELP));
+ , SHOW_HELP));
window.register_hotkey(hotkey::HOTKEY_PREFERENCES
, boost::bind(
&hotkey
, boost::ref(window)
- , gui::EDIT_PREFERENCES));
+ , EDIT_PREFERENCES));
static const boost::function<void()> next_tip_wrapper = boost::bind(
&ttitle_screen::update_tip
@@ -211,51 +210,51 @@
, boost::bind(
&hotkey
, boost::ref(window)
- , gui::TUTORIAL));
+ , TUTORIAL));
window.register_hotkey(hotkey::TITLE_SCREEN__TUTORIAL
, boost::bind(
&hotkey
, boost::ref(window)
- , gui::TUTORIAL));
+ , TUTORIAL));
window.register_hotkey(hotkey::TITLE_SCREEN__CAMPAIGN
, boost::bind(
&hotkey
, boost::ref(window)
- , gui::NEW_CAMPAIGN));
+ , NEW_CAMPAIGN));
window.register_hotkey(hotkey::TITLE_SCREEN__MULTIPLAYER
, boost::bind(
&hotkey
, boost::ref(window)
- , gui::MULTIPLAYER));
+ , MULTIPLAYER));
window.register_hotkey(hotkey::TITLE_SCREEN__ADDONS
, boost::bind(
&hotkey
, boost::ref(window)
- , gui::GET_ADDONS));
+ , GET_ADDONS));
#ifndef DISABLE_EDITOR
window.register_hotkey(hotkey::TITLE_SCREEN__EDITOR
, boost::bind(
&hotkey
, boost::ref(window)
- , gui::START_MAP_EDITOR));
+ , START_MAP_EDITOR));
#endif
window.register_hotkey(hotkey::TITLE_SCREEN__CREDITS
, boost::bind(
&hotkey
, boost::ref(window)
- , gui::SHOW_ABOUT));
+ , SHOW_ABOUT));
window.register_hotkey(hotkey::HOTKEY_QUIT_GAME
, boost::bind(
&hotkey
, boost::ref(window)
- , gui::QUIT_GAME));
+ , QUIT_GAME));
}
void ttitle_screen::pre_show(CVideo& video, twindow& window)
Modified: trunk/src/gui/dialogs/title_screen.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/title_screen.hpp?rev=47063&r1=47062&r2=47063&view=diff
==============================================================================
--- trunk/src/gui/dialogs/title_screen.hpp (original)
+++ trunk/src/gui/dialogs/title_screen.hpp Sat Oct 16 21:53:41 2010
@@ -28,6 +28,39 @@
~ttitle_screen();
CVideo* video() { return video_; }
+
+ /**
+ * Values for the menu-items of the main menu.
+ *
+ * @todo Evaluate the best place for these items.
+ */
+ enum tresult {
+ TUTORIAL = 1 /**< Start special campaign
'tutorial' */
+ , NEW_CAMPAIGN /**< Let user select a campaign
to play */
+ , MULTIPLAYER /**<
+ * Play single scenario against
humans or AI
+ */
+ , LOAD_GAME
+ , GET_ADDONS
+#ifndef DISABLE_EDITOR
+ , START_MAP_EDITOR
+#endif
+ , CHANGE_LANGUAGE
+ , EDIT_PREFERENCES
+ , SHOW_ABOUT /**< Show credits */
+ , QUIT_GAME
+ , TIP_PREVIOUS /**< Show previous tip-of-the-day
*/
+ , TIP_NEXT /**< Show next tip-of-the-day */
+ , SHOW_HELP
+ , REDRAW_BACKGROUND /**<
+ * Used after an action needing a
redraw (ex:
+ * fullscreen)
+ */
+ , RELOAD_GAME_DATA /**< Used to reload all game data
*/
+ , NOTHING /**<
+ * Default, nothing done, no
redraw needed
+ */
+ };
private:
/** Used in show in order to show child windows. */
Modified: trunk/src/gui/widgets/window.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/window.cpp?rev=47063&r1=47062&r2=47063&view=diff
==============================================================================
--- trunk/src/gui/widgets/window.cpp (original)
+++ trunk/src/gui/widgets/window.cpp Sat Oct 16 21:53:41 2010
@@ -31,6 +31,7 @@
#include "gui/auxiliary/log.hpp"
#include "gui/auxiliary/layout_exception.hpp"
#include "gui/auxiliary/window_builder/control.hpp"
+#include "gui/dialogs/title_screen.hpp"
#include "gui/widgets/button.hpp"
#include "gui/widgets/settings.hpp"
#ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
@@ -38,7 +39,6 @@
#endif
#include "preferences.hpp"
#include "preferences_display.hpp"
-#include "titlescreen.hpp"
#include "video.hpp"
#include <boost/bind.hpp>
@@ -400,15 +400,15 @@
* add some namespaces to avoid names clashing.
*/
} else if(id == "tutorial") {
- return static_cast<tretval>(gui::TUTORIAL);
+ return static_cast<tretval>(ttitle_screen::TUTORIAL);
#ifndef DISABLE_EDITOR
} else if(id == "editor") {
- return static_cast<tretval>(gui::START_MAP_EDITOR);
+ return static_cast<tretval>(ttitle_screen::START_MAP_EDITOR);
#endif
} else if(id == "credits") {
- return static_cast<tretval>(gui::SHOW_ABOUT);
+ return static_cast<tretval>(ttitle_screen::SHOW_ABOUT);
} else if(id == "quit") {
- return static_cast<tretval>(gui::QUIT_GAME);
+ return static_cast<tretval>(ttitle_screen::QUIT_GAME);
/**
* The hacks which are here so the old engine can handle the event. The
new
@@ -416,19 +416,19 @@
* engine to make certain things happen.
*/
} else if(id == "help") {
- return static_cast<tretval>(gui::SHOW_HELP);
+ return static_cast<tretval>(ttitle_screen::SHOW_HELP);
} else if(id == "campaign") {
- return static_cast<tretval>(gui::NEW_CAMPAIGN);
+ return static_cast<tretval>(ttitle_screen::NEW_CAMPAIGN);
} else if(id == "multiplayer") {
- return static_cast<tretval>(gui::MULTIPLAYER);
+ return static_cast<tretval>(ttitle_screen::MULTIPLAYER);
} else if(id == "load") {
- return static_cast<tretval>(gui::LOAD_GAME);
+ return static_cast<tretval>(ttitle_screen::LOAD_GAME);
} else if(id == "addons") {
- return static_cast<tretval>(gui::GET_ADDONS);
+ return static_cast<tretval>(ttitle_screen::GET_ADDONS);
} else if(id == "language") {
- return static_cast<tretval>(gui::CHANGE_LANGUAGE);
+ return static_cast<tretval>(ttitle_screen::CHANGE_LANGUAGE);
} else if(id == "preferences") {
- return static_cast<tretval>(gui::EDIT_PREFERENCES);
+ return static_cast<tretval>(ttitle_screen::EDIT_PREFERENCES);
// default if nothing matched
} else {
Modified: trunk/src/titlescreen.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/titlescreen.hpp?rev=47063&r1=47062&r2=47063&view=diff
==============================================================================
--- trunk/src/titlescreen.hpp (original)
+++ trunk/src/titlescreen.hpp Sat Oct 16 21:53:41 2010
@@ -29,30 +29,6 @@
namespace gui {
-/**
- * Values for the menu-items of the main menu.
- *
- * The code assumes TUTORIAL is the first item.
- * The values are also used as the button retour values, where 0 means no
- * automatic value so we need to avoid 0.
- */
-enum TITLE_RESULT { TUTORIAL = 1, /**< Start special campaign
'tutorial' */
- NEW_CAMPAIGN, /**< Let user
select a campaign to play */
- MULTIPLAYER, /**< Play
single scenario against humans or AI */
- LOAD_GAME, GET_ADDONS,
-#ifndef DISABLE_EDITOR
- START_MAP_EDITOR,
-#endif
- CHANGE_LANGUAGE, EDIT_PREFERENCES,
- SHOW_ABOUT, /**<
Show credits */
- QUIT_GAME,
- TIP_PREVIOUS, /**< Show
previous tip-of-the-day */
- TIP_NEXT, /**<
Show next tip-of-the-day */
- SHOW_HELP,
- REDRAW_BACKGROUND, /**< Used after
an action needing a redraw (ex: fullscreen) */
- RELOAD_GAME_DATA, /**< Used to
reload all game data */
- NOTHING /**<
Default, nothing done, no redraw needed */
- };
}
#endif
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits