Author: alink
Date: Mon Jun 23 12:01:23 2008
New Revision: 27429

URL: http://svn.gna.org/viewcvs/wesnoth?rev=27429&view=rev
Log:
Allow to use the small-gui mode by starting wesnoth with --smallgui
The configure switch is still working, will remove it later

Modified:
    trunk/src/dialogs.cpp
    trunk/src/game.cpp
    trunk/src/game_config.cpp
    trunk/src/game_config.hpp
    trunk/src/preferences.cpp
    trunk/src/preferences.hpp
    trunk/src/preferences_display.cpp
    trunk/src/video.cpp

Modified: trunk/src/dialogs.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/dialogs.cpp?rev=27429&r1=27428&r2=27429&view=diff
==============================================================================
--- trunk/src/dialogs.cpp (original)
+++ trunk/src/dialogs.cpp Mon Jun 23 12:01:23 2008
@@ -671,30 +671,21 @@
        lmenu.add_pane(&save_preview);
        // create an option for whether the replay should be shown or not
        if(show_replay != NULL) {
-               #ifdef USE_SMALL_GUI
-                       lmenu.add_option(_("Show replay"), false, 
gui::dialog::BUTTON_STANDARD);
-               #else
-                       lmenu.add_option(_("Show replay"), false);
-               #endif
+               lmenu.add_option(_("Show replay"), false,
+                       game_config::small_gui ? gui::dialog::BUTTON_CHECKBOX : 
gui::dialog::BUTTON_STANDARD);
        }
        if(cancel_orders != NULL) {
-               #ifdef USE_SMALL_GUI
-                       lmenu.add_option(_("Cancel orders"), false, 
gui::dialog::BUTTON_STANDARD);
-               #else
-                       lmenu.add_option(_("Cancel orders"), false);
-               #endif
+               lmenu.add_option(_("Cancel orders"), false,
+                       game_config::small_gui ? gui::dialog::BUTTON_EXTRA : 
gui::dialog::BUTTON_STANDARD);
        }
        lmenu.add_button(new 
gui::standard_dialog_button(disp.video(),_("OK"),0,false), 
gui::dialog::BUTTON_STANDARD);
        lmenu.add_button(new 
gui::standard_dialog_button(disp.video(),_("Cancel"),1,true), 
gui::dialog::BUTTON_STANDARD);
 
        delete_save save_deleter(disp,*filter,games,summaries);
        gui::dialog_button_info delete_button(&save_deleter,_("Delete Save"));
-       #ifdef USE_SMALL_GUI
-               //placing the buttons in one line so that none is coverd by any 
of the others
-               lmenu.add_button(delete_button,gui::dialog::BUTTON_HELP);
-       #else
-               lmenu.add_button(delete_button);
-       #endif
+       
+       lmenu.add_button(delete_button,
+               game_config::small_gui ? gui::dialog::BUTTON_HELP : 
gui::dialog::BUTTON_STANDARD);
 
        int res = lmenu.show();
 

Modified: trunk/src/game.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game.cpp?rev=27429&r1=27428&r2=27429&view=diff
==============================================================================
--- trunk/src/game.cpp (original)
+++ trunk/src/game.cpp Mon Jun 23 12:01:23 2008
@@ -273,6 +273,8 @@
                        no_gui_ = true;
                        no_sound = true;
                        preferences::disable_preferences_save();
+               } else if(val == "--smallgui") {
+                       game_config::small_gui = true;
                } else if(val == "--windowed" || val == "-w") {
                        preferences::set_fullscreen(false);
                } else if(val == "--fullscreen" || val == "-f") {
@@ -339,6 +341,11 @@
        }
        std::cerr << "Data at '" << game_config::path << "'\n";
 
+       //TODO: remove this and the configure option
+#ifdef USE_SMALL_GUI
+       game_config::small_gui = true;
+#endif
+
        // disable sound in nosound mode, or when sound engine failed to 
initialize
        if (no_sound || ((preferences::sound_on() || preferences::music_on() ||
                          preferences::turn_bell() || 
preferences::UI_sound_on()) &&
@@ -439,8 +446,7 @@
                }
 #endif
 
-#ifdef USE_SMALL_GUI
-        if(bpp == 0) {
+        if(game_config::small_gui && bpp == 0) {
             std::cerr << "800x600x" << DefaultBPP << " not available - 
attempting 800x480x" << DefaultBPP << "...\n";
 
             resolution.first = 800;
@@ -448,7 +454,6 @@
 
             bpp = 
video_.modePossible(resolution.first,resolution.second,DefaultBPP,video_flags);
         }
-#endif
 
                if(bpp == 0) {
                        //couldn't do 1024x768 or 800x600
@@ -2215,9 +2220,8 @@
        defines_map_["TINY"] = preproc_define();
 #endif
 
-#ifdef USE_SMALL_GUI
-    defines_map_["SMALL_GUI"] = preproc_define();
-#endif
+       if (game_config::small_gui)
+       defines_map_["SMALL_GUI"] = preproc_define();
 
 #ifdef HAVE_PYTHON
        defines_map_["PYTHON"] = preproc_define();

Modified: trunk/src/game_config.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_config.cpp?rev=27429&r1=27428&r2=27429&view=diff
==============================================================================
--- trunk/src/game_config.cpp (original)
+++ trunk/src/game_config.cpp Mon Jun 23 12:01:23 2008
@@ -51,7 +51,7 @@
        const std::string revision = VERSION;
 #endif
        std::string wesnothd_name;
-       bool debug = false, editor = false, ignore_replay_errors = false, 
mp_debug = false, exit_at_end = false, no_delay = false, disable_autosave = 
false;
+       bool debug = false, editor = false, ignore_replay_errors = false, 
mp_debug = false, exit_at_end = false, no_delay = false, small_gui = false, 
disable_autosave = false;
 
        std::string game_icon = "wesnoth-icon.png", game_title, game_logo, 
title_music, lobby_music;
        int title_logo_x = 0, title_logo_y = 0, title_buttons_x = 0, 
title_buttons_y = 0, title_buttons_padding = 0,

Modified: trunk/src/game_config.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_config.hpp?rev=27429&r1=27428&r2=27429&view=diff
==============================================================================
--- trunk/src/game_config.hpp (original)
+++ trunk/src/game_config.hpp Mon Jun 23 12:01:23 2008
@@ -46,7 +46,7 @@
        //! starting gold and carryover gold.
        extern const bool gold_carryover_add;
 
-       extern bool debug, editor, ignore_replay_errors, mp_debug, exit_at_end, 
no_delay, disable_autosave;
+       extern bool debug, editor, ignore_replay_errors, mp_debug, exit_at_end, 
no_delay, small_gui, disable_autosave;
 
        extern std::string path;
 

Modified: trunk/src/preferences.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/preferences.cpp?rev=27429&r1=27428&r2=27429&view=diff
==============================================================================
--- trunk/src/preferences.cpp (original)
+++ trunk/src/preferences.cpp Mon Jun 23 12:01:23 2008
@@ -117,6 +117,25 @@
        prefs["fullscreen"] = (ison ? "true" : "false");
 }
 
+int min_allowed_width()
+{
+#ifdef USE_TINY_GUI
+       return 320;
+#endif
+       return 800;
+}
+
+int min_allowed_height()
+{
+#ifdef USE_TINY_GUI
+       return 240;
+#endif
+       if (game_config::small_gui)
+               return 480;
+
+       return 600;
+}
+
 std::pair<int,int> resolution()
 {
        const std::string postfix = fullscreen() ? "resolution" : "windowsize";
@@ -124,8 +143,8 @@
        const string_map::const_iterator y = prefs.values.find('y' + postfix);
        if(x != prefs.values.end() && y != prefs.values.end() &&
           x->second.empty() == false && y->second.empty() == false) {
-               std::pair<int,int> res 
(maximum(atoi(x->second.c_str()),min_allowed_width),
-                                       
maximum(atoi(y->second.c_str()),min_allowed_height));
+               std::pair<int,int> res 
(maximum(atoi(x->second.c_str()),min_allowed_width()),
+                                       
maximum(atoi(y->second.c_str()),min_allowed_height()));
 
                // Make sure resolutions are always divisible by 4
                //res.first &= ~3;

Modified: trunk/src/preferences.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/preferences.hpp?rev=27429&r1=27428&r2=27429&view=diff
==============================================================================
--- trunk/src/preferences.hpp (original)
+++ trunk/src/preferences.hpp Mon Jun 23 12:01:23 2008
@@ -28,18 +28,6 @@
 #include <utility>
 #include <set>
 
-// Only there temporary
-#ifdef USE_TINY_GUI
-const int min_allowed_width = 320;
-const int min_allowed_height = 240;
-#elif defined USE_SMALL_GUI
-const int min_allowed_width = 800;
-const int min_allowed_height = 480;
-#else
-const int min_allowed_width = 800;
-const int min_allowed_height = 600;
-#endif
-
 namespace preferences {
 
        struct base_manager
@@ -63,6 +51,9 @@
 
        bool fullscreen();
        void _set_fullscreen(bool ison);
+
+       int min_allowed_width();
+       int min_allowed_height();
 
        std::pair<int,int> resolution();
        void _set_resolution(const std::pair<int,int>& res);

Modified: trunk/src/preferences_display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/preferences_display.cpp?rev=27429&r1=27428&r2=27429&view=diff
==============================================================================
--- trunk/src/preferences_display.cpp (original)
+++ trunk/src/preferences_display.cpp Mon Jun 23 12:01:23 2008
@@ -435,7 +435,7 @@
        std::vector<std::pair<int,int> > resolutions;
 
        for(int i = 0; modes[i] != NULL; ++i) {
-               if(modes[i]->w >= min_allowed_width && modes[i]->h >= 
min_allowed_height) {
+               if(modes[i]->w >= min_allowed_width() && modes[i]->h >= 
min_allowed_height()) {
                        
resolutions.push_back(std::pair<int,int>(modes[i]->w,modes[i]->h));
                }
        }

Modified: trunk/src/video.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/video.cpp?rev=27429&r1=27428&r2=27429&view=diff
==============================================================================
--- trunk/src/video.cpp (original)
+++ trunk/src/video.cpp Mon Jun 23 12:01:23 2008
@@ -80,8 +80,8 @@
        int disallow_resize = 0;
 }
 void resize_monitor::process(events::pump_info &info) {
-       if(info.resize_dimensions.first >= min_allowed_width
-       && info.resize_dimensions.second >= min_allowed_height
+       if(info.resize_dimensions.first >= preferences::min_allowed_width()
+       && info.resize_dimensions.second >= preferences::min_allowed_height()
        && disallow_resize == 0) {
                preferences::set_resolution(info.resize_dimensions);
        }


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to