Author: alink
Date: Tue Apr 24 21:56:24 2007
New Revision: 17049

URL: http://svn.gna.org/viewcvs/wesnoth?rev=17049&view=rev
Log:
Add 2 commands in the editor: "update transitions"(key b) and "delay 
transitions update" (key ctrl+t)

Modified:
    trunk/data/themes/editor.cfg
    trunk/src/editor/editor.cpp
    trunk/src/editor/editor.hpp
    trunk/src/hotkeys.cpp
    trunk/src/hotkeys.hpp

Modified: trunk/data/themes/editor.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/themes/editor.cfg?rev=17049&r1=17048&r2=17049&view=diff
==============================================================================
--- trunk/data/themes/editor.cfg (original)
+++ trunk/data/themes/editor.cfg Tue Apr 24 21:56:24 2007
@@ -219,6 +219,23 @@
        alt=no
        shift=no
        [/hotkey]
+       
+       [hotkey]
+       command="editupdate"
+       key="b"
+       cmd=no
+       alt=no
+       shift=no
+       [/hotkey]
+       
+       [hotkey]
+       command="editautoupdate"
+       key="t"
+       cmd=yes
+       alt=no
+       shift=no
+       [/hotkey]
+
 
        [hotkey]
        command="changelanguage"
@@ -432,6 +449,22 @@
        [hotkey]
        command="editrefresh"
        key="e"
+       ctrl=yes
+       alt=no
+       shift=no
+       [/hotkey]
+
+       [hotkey]
+       command="editupdate"
+       key="b"
+       ctrl=no
+       alt=no
+       shift=no
+       [/hotkey]
+
+       [hotkey]
+       command="editautoupdate"
+       key="t"
        ctrl=yes
        alt=no
        shift=no
@@ -469,14 +502,14 @@
        [menu]
        title=_"Edit"
        image=lite
-       
items=undo,redo,editcut,editcopy,editpaste,editselectall,editfillselection,editresize,editflip,editrefresh
+       
items=undo,redo,editcut,editcopy,editpaste,editselectall,editfillselection,editresize,editflip,editrefresh,editupdate,
        rect=107,1,207,22
        [/menu]
 
        [menu]
        title=_"Settings"
        image=lite
-       items=changelanguage,preferences
+       items=changelanguage,preferences,editautoupdate
        rect=211,1,311,22
        [/menu]
 

Modified: trunk/src/editor/editor.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor/editor.cpp?rev=17049&r1=17048&r2=17049&view=diff
==============================================================================
--- trunk/src/editor/editor.cpp (original)
+++ trunk/src/editor/editor.cpp Tue Apr 24 21:56:24 2007
@@ -170,7 +170,7 @@
 
 map_editor::map_editor(display &gui, editormap &map, config &theme, config 
&game_config)
        : gui_(gui), map_(map), abort_(DONT_ABORT),
-         theme_(theme), game_config_(game_config), map_dirty_(false), 
l_button_palette_dirty_(true),
+         theme_(theme), game_config_(game_config), map_dirty_(false),  
auto_update_(true), l_button_palette_dirty_(true),
          everything_dirty_(false), palette_(gui, size_specs_, map, 
game_config), brush_(gui, size_specs_),
          l_button_held_func_(NONE), tooltip_manager_(gui_.video()), 
floating_label_manager_(),
          mouse_moved_(false),
@@ -261,6 +261,10 @@
                                text = _("Resize the map");
                        else if(menu_items.back() == "editflip")
                                text = _("Flip map");
+                       else if(menu_items.back() == "editupdate")
+                               text = _("Update transitions");
+                       else if(menu_items.back() == "editautoupdate")
+                               text = _("Delay transitions update");
                }
 
                if(text != "")
@@ -736,6 +740,20 @@
 void map_editor::edit_refresh() {
        image::flush_cache();
        redraw_everything();
+}
+
+void map_editor::edit_update() {
+       if (map_dirty_) {
+               map_dirty_ = false;
+               gui_.rebuild_all();
+               gui_.invalidate_all();
+               recalculate_starting_pos_labels();
+               gui_.recalculate_minimap();
+       }
+}
+
+void map_editor::edit_auto_update() {
+       auto_update_ = !auto_update_;
 }
 
 void map_editor::insert_selection_in_clipboard() {
@@ -792,6 +810,8 @@
        case hotkey::HOTKEY_EDIT_SELECT_ALL:
        case hotkey::HOTKEY_EDIT_DRAW:
        case hotkey::HOTKEY_EDIT_REFRESH:
+       case hotkey::HOTKEY_EDIT_UPDATE:
+       case hotkey::HOTKEY_EDIT_AUTO_UPDATE:
        case hotkey::HOTKEY_LANGUAGE:
                return true;
        default:
@@ -1529,7 +1549,7 @@
                // When the map has changed, wait until the left mouse button is
                // not held down and then update the minimap and the starting
                // position labels.
-               if (map_dirty_) {
+               if (map_dirty_ && auto_update_) {
                        if (!l_button_down && !r_button_down) {
                                map_dirty_ = false;
                                gui_.rebuild_all();

Modified: trunk/src/editor/editor.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor/editor.hpp?rev=17049&r1=17048&r2=17049&view=diff
==============================================================================
--- trunk/src/editor/editor.hpp (original)
+++ trunk/src/editor/editor.hpp Tue Apr 24 21:56:24 2007
@@ -125,6 +125,8 @@
        virtual void edit_select_all();
        virtual void edit_draw();
        virtual void edit_refresh();
+       virtual void edit_update();
+       virtual void edit_auto_update();
 
        void perform_flood_fill();
        void perform_paste();
@@ -320,8 +322,9 @@
        gamemap::location selected_hex_;
        // When map_dirty_ is true, schedule redraw of the minimap and
        // perform some updates like recalculating labels of starting
-       // positions.
+       // positions. But only it the option auto_update is enabled 
        bool map_dirty_;
+       bool auto_update_;
        bool l_button_palette_dirty_;
        bool everything_dirty_;
        terrain_palette palette_;

Modified: trunk/src/hotkeys.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/hotkeys.cpp?rev=17049&r1=17048&r2=17049&view=diff
==============================================================================
--- trunk/src/hotkeys.cpp (original)
+++ trunk/src/hotkeys.cpp Tue Apr 24 21:56:24 2007
@@ -112,6 +112,8 @@
        { 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_UPDATE, "editupdate", N_("Update transitions"), 
true },
 
        { hotkey::HOTKEY_DELAY_SHROUD, "delayshroud", N_("Delay Shroud 
Updates"), false },
        { hotkey::HOTKEY_UPDATE_SHROUD, "updateshroud", N_("Update Shroud 
Now"), false },
@@ -672,6 +674,12 @@
                 case HOTKEY_EDIT_REFRESH:
                        edit_refresh();
                        break;
+                case HOTKEY_EDIT_UPDATE:
+                       edit_update();
+                       break;
+                case HOTKEY_EDIT_AUTO_UPDATE:
+                       edit_auto_update();
+                       break;
                 case HOTKEY_LANGUAGE:
                        change_language();
                        break;

Modified: trunk/src/hotkeys.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/hotkeys.hpp?rev=17049&r1=17048&r2=17049&view=diff
==============================================================================
--- trunk/src/hotkeys.hpp (original)
+++ trunk/src/hotkeys.hpp Tue Apr 24 21:56:24 2007
@@ -54,7 +54,7 @@
        HOTKEY_EDIT_FILL_SELECTION, HOTKEY_EDIT_CUT, HOTKEY_EDIT_COPY,
        HOTKEY_EDIT_PASTE, HOTKEY_EDIT_REVERT, HOTKEY_EDIT_RESIZE,
        HOTKEY_EDIT_FLIP, HOTKEY_EDIT_SELECT_ALL, HOTKEY_EDIT_DRAW,
-       HOTKEY_EDIT_REFRESH,
+       HOTKEY_EDIT_REFRESH, HOTKEY_EDIT_UPDATE, HOTKEY_EDIT_AUTO_UPDATE,
 
        //misc.
        HOTKEY_USER_CMD,
@@ -216,6 +216,8 @@
        virtual void edit_select_all() {}
        virtual void edit_draw() {}
        virtual void edit_refresh() {}
+       virtual void edit_update() {}
+       virtual void edit_auto_update() {}
 
        //Gets the action's image (if any). Displayed left of the action text 
in menus.
        virtual std::string get_action_image(hotkey::HOTKEY_COMMAND 
/*command*/, int /*index*/) const { return ""; }


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

Reply via email to