Author: sapient
Date: Mon Jul  2 01:38:57 2007
New Revision: 18609

URL: http://svn.gna.org/viewcvs/wesnoth?rev=18609&view=rev
Log:
add a checkbox next to 'Delay transition updates'

Modified:
    trunk/src/editor/editor.cpp
    trunk/src/editor/editor.hpp
    trunk/src/hotkeys.cpp

Modified: trunk/src/editor/editor.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor/editor.cpp?rev=18609&r1=18608&r2=18609&view=diff
==============================================================================
--- trunk/src/editor/editor.cpp (original)
+++ trunk/src/editor/editor.cpp Mon Jul  2 01:38:57 2007
@@ -252,7 +252,7 @@
                        else if(menu_items.back() == "editupdate")
                                text = _("Update transitions");
                        else if(menu_items.back() == "editautoupdate")
-                               text = _("Delay transitions update");
+                               text = _("Delay transition updates");
                }
 
                if(text != "")
@@ -763,6 +763,13 @@
 
 void map_editor::edit_auto_update() {
        auto_update_ = !auto_update_;
+}
+
+hotkey::ACTION_STATE map_editor::get_action_state(hotkey::HOTKEY_COMMAND 
command) const {
+       if(command == hotkey::HOTKEY_EDIT_AUTO_UPDATE) {
+               return (auto_update_) ? hotkey::ACTION_OFF : hotkey::ACTION_ON;
+       }
+       return command_executor::get_action_state(command);
 }
 
 void map_editor::insert_selection_in_clipboard() {
@@ -1331,29 +1338,17 @@
 
        return true;
 }
-void map_editor::show_menu(const std::vector<std::string>& items_arg, const 
int xloc,
+void map_editor::show_menu(const std::vector<std::string>& items, const int 
xloc,
                                                   const int yloc, const bool 
/*context_menu*/) {
-       std::vector<std::string> items = items_arg;
        // menu is what to display in the menu.
-       std::vector<std::string> menu;
        if(items.size() == 1) {
                execute_command(hotkey::get_hotkey(items.front()).get_id());
                return;
        }
-       for(std::vector<std::string>::const_iterator i = items.begin();
-               i != items.end(); ++i) {
-
-               const hotkey::hotkey_item hk = hotkey::get_hotkey(*i);
-               std::stringstream str;
-               // Try to translate it to nicer format.
-               str << hk.get_description() << COLUMN_SEPARATOR << 
hk.get_name();
-
-               menu.push_back(str.str());
-       }
        static const std::string style = "menu2";
        gui::basic_dialog kmenu = gui::basic_dialog(gui_, "", "", gui::MESSAGE,
                                                    
&gui::basic_dialog::hotkeys_style);
-       kmenu.set_menu(menu);
+       kmenu.set_menu(get_menu_images(items));
        const int res = kmenu.show(xloc, yloc);
        if(res < 0 || (unsigned)res >= items.size())
                return;

Modified: trunk/src/editor/editor.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor/editor.hpp?rev=18609&r1=18608&r2=18609&view=diff
==============================================================================
--- trunk/src/editor/editor.hpp (original)
+++ trunk/src/editor/editor.hpp Mon Jul  2 01:38:57 2007
@@ -134,6 +134,9 @@
        void perform_set_starting_pos();
 
        virtual bool can_execute_command(hotkey::HOTKEY_COMMAND command, int) 
const;
+       //Does the action control a toggle switch? If so, return the state of 
the action (on or off)
+       virtual hotkey::ACTION_STATE get_action_state(hotkey::HOTKEY_COMMAND 
command) const;
+
 
        /// Exception thrown when new map is to be loaded.
        struct new_map_exception {

Modified: trunk/src/hotkeys.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/hotkeys.cpp?rev=18609&r1=18608&r2=18609&view=diff
==============================================================================
--- trunk/src/hotkeys.cpp (original)
+++ trunk/src/hotkeys.cpp Mon Jul  2 01:38:57 2007
@@ -113,7 +113,7 @@
        { hotkey::HOTKEY_EDIT_SELECT_ALL, "editselectall", N_("Select 
All"),true },
        { hotkey::HOTKEY_EDIT_DRAW, "editdraw", N_("Draw Terrain"),true },
        { hotkey::HOTKEY_EDIT_REFRESH, "editrefresh", N_("Refresh Image 
Cache"), true },
-       { hotkey::HOTKEY_EDIT_AUTO_UPDATE, "editautoupdate", N_("Delay 
transitions updates"), true },
+       { hotkey::HOTKEY_EDIT_AUTO_UPDATE, "editautoupdate", N_("Delay 
transition updates"), true },
        { hotkey::HOTKEY_EDIT_UPDATE, "editupdate", N_("Update transitions"), 
true },
 
        { hotkey::HOTKEY_DELAY_SHROUD, "delayshroud", N_("Delay Shroud 
Updates"), false },


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

Reply via email to