Author: esr
Date: Sat Jun 30 23:48:27 2007
New Revision: 18578

URL: http://svn.gna.org/viewcvs/wesnoth?rev=18578&view=rev
Log:
Replace all show_dialog calls with instantiations of the basic_dialog object.

Modified:
    trunk/src/editor/editor.cpp
    trunk/src/editor/editor_dialogs.cpp

Modified: trunk/src/editor/editor.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor/editor.cpp?rev=18578&r1=18577&r2=18578&view=diff
==============================================================================
--- trunk/src/editor/editor.cpp (original)
+++ trunk/src/editor/editor.cpp Sat Jun 30 23:48:27 2007
@@ -15,6 +15,7 @@
 #include "SDL_keysym.h"
 
 #include "../config.hpp"
+#include "../basic_dialog.hpp"
 #include "../cursor.hpp"
 #include "../file_chooser.hpp"
 #include "../filesystem.hpp"
@@ -457,9 +458,12 @@
        langs.reserve(langdefs.size());
        
std::transform(langdefs.begin(),langdefs.end(),std::back_inserter(langs),languagedef_name);
 
-       const int res = gui::show_dialog(gui_,NULL,_("Language"),
-                                _("Choose your preferred language:"),
-                                gui::OK_CANCEL,&langs);
+       const std::string language = _("Language");
+       const std::string preferred = _("Choose your preferred language:");
+       gui::basic_dialog lmenu = gui::basic_dialog(gui_, language, preferred,
+                                         gui::OK_CANCEL);
+       lmenu.set_menu(langs);
+       int res = lmenu.show();
        const std::vector<language_def>& languages = get_languages();
        if(size_t(res) < languages.size()) {
                ::set_language(languages[res]);
@@ -506,9 +510,9 @@
                                continue;
                        }
                        else if (file_exists(input_name)) {
-                               overwrite = gui::show_dialog(gui_, NULL, "",
+                               overwrite = gui::basic_dialog(gui_, "",
                                        _("The map already exists. Do you want 
to overwrite it?"),
-                                       gui::YES_NO);
+                                       gui::YES_NO).show();
                        }
                        else
                                overwrite = 0;
@@ -538,10 +542,12 @@
                str << _("Player") << " " << i + 1;
                players.push_back(str.str());
        }
-       int res = gui::show_dialog(gui_, NULL, _("Which Player?"),
-                                        _("Which player should start here?"),
-                                        gui::OK_CANCEL, &players);
-
+       gui::basic_dialog pmenu = gui::basic_dialog(gui_, 
+                                      _("Which Player?"),
+                                      _("Which player should start here?"),
+                                      gui::OK_CANCEL);
+       pmenu.set_menu(players);
+       int res = pmenu.show(); 
        if (res >= 0) {
                // we erase previous starting position on this hex
                // this will prevent to cause a "stack" of these
@@ -1242,12 +1248,12 @@
 bool map_editor::confirm_exit_and_save() {
        if (!changed_since_save())
                return true;
-       if (gui::show_dialog(gui_, NULL, "",
-                            _("Quit Editor"), gui::YES_NO) != 0) {
+       if (gui::basic_dialog(gui_, "",
+                            _("Quit Editor"), gui::YES_NO).show() != 0) {
                return false;
        }
-       if (gui::show_dialog(gui_, NULL, "",
-                            _("Do you want to save the map before quitting?"), 
gui::YES_NO) == 0) {
+       if (gui::basic_dialog(gui_, "",
+                            _("Do you want to save the map before quitting?"), 
gui::YES_NO).show() == 0) {
                if (!save_map("", false)) {
                        return false;
                }
@@ -1345,8 +1351,10 @@
                menu.push_back(str.str());
        }
        static const std::string style = "menu2";
-       const int res = gui::show_dialog(gui_, NULL, "", "", gui::MESSAGE, 
&menu, NULL, "",
-                                        NULL, 256, NULL, xloc, yloc, 
&gui::basic_dialog::hotkeys_style);
+       gui::basic_dialog kmenu = gui::basic_dialog(gui_, "", "", gui::MESSAGE,
+                                                   
&gui::basic_dialog::hotkeys_style);
+       kmenu.set_menu(menu);
+       const int res = kmenu.show(xloc, yloc);
        if(res < 0 || (unsigned)res >= items.size())
                return;
        const hotkey::HOTKEY_COMMAND cmd = 
hotkey::get_hotkey(items[res]).get_id();

Modified: trunk/src/editor/editor_dialogs.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor/editor_dialogs.cpp?rev=18578&r1=18577&r2=18578&view=diff
==============================================================================
--- trunk/src/editor/editor_dialogs.cpp (original)
+++ trunk/src/editor/editor_dialogs.cpp Sat Jun 30 23:48:27 2007
@@ -27,7 +27,7 @@
 #include "../map_create.hpp"
 #include "../marked-up_text.hpp"
 #include "../construct_dialog.hpp"
-#include "../show_dialog.hpp"
+#include "../basic_dialog.hpp"
 #include "../util.hpp"
 #include "../preferences_display.hpp"
 #include "../video.hpp"
@@ -46,9 +46,9 @@
 namespace map_editor {
 
 bool confirm_modification_disposal(display& disp) {
-       const int res = gui::show_dialog(disp, NULL, "",
+       const int res = gui::basic_dialog(disp, "",
                                         _("Your modifications to the map will 
be lost. Continue?"),
-                                        gui::OK_CANCEL);
+                                        gui::OK_CANCEL).show();
        return res == 0;
 }
 
@@ -497,11 +497,11 @@
        items.push_back(_("X-Axis"));
        items.push_back(_("Y-Axis"));
        const std::string msg = _("Flip around (this may change the dimensions 
of the map):");
-       const int res =
-               gui::show_dialog(disp, NULL, "",
+        gui::basic_dialog flipmenu = gui::basic_dialog(disp, "",
                                                 font::word_wrap_text(msg, 12, 
180),
-                                                gui::OK_CANCEL, &items);
-       switch (res) {
+                                                gui::OK_CANCEL);
+       flipmenu.set_menu(items);
+       switch (flipmenu.show()) {
        case 0:
                return FLIP_X;
        case 1:


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

Reply via email to