Author: ilor
Date: Wed Jul 30 14:58:27 2008
New Revision: 28265

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28265&view=rev
Log:
editor2: map revert

Modified:
    trunk/src/editor2/editor_controller.cpp
    trunk/src/editor2/editor_controller.hpp

Modified: trunk/src/editor2/editor_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_controller.cpp?rev=28265&r1=28264&r2=28265&view=diff
==============================================================================
--- trunk/src/editor2/editor_controller.cpp (original)
+++ trunk/src/editor2/editor_controller.cpp Wed Jul 30 14:58:27 2008
@@ -246,6 +246,16 @@
        }
 }
 
+void editor_controller::revert_map()
+{
+       const std::string& filename = get_map_context().get_filename();
+       if (filename.empty()) {
+               ERR_ED << "Empty filename in map revert\n";
+               return;
+       }
+       load_map(filename);
+}
+
 void editor_controller::new_map(int width, int height, 
t_translation::t_terrain fill)
 {
        set_map(editor_map(game_config_, width, height, fill));
@@ -299,8 +309,10 @@
                case HOTKEY_EDITOR_TERRAIN_PALETTE_SWAP:
                        return true; //editor hotkeys we can always do
                case HOTKEY_EDITOR_MAP_SAVE:
+                       return true;
                case HOTKEY_EDITOR_MAP_REVERT:
-                       return true; //TODO only when the map was modified
+                       return !get_map_context().get_filename().empty();
+                       return true;
                case HOTKEY_EDITOR_TOOL_PAINT:
                case HOTKEY_EDITOR_TOOL_FILL:
                case HOTKEY_EDITOR_TOOL_SELECT:
@@ -312,7 +324,7 @@
                case HOTKEY_EDITOR_SELECTION_FLIP:
                case HOTKEY_EDITOR_SELECTION_GENERATE:
                case HOTKEY_EDITOR_SELECTION_RANDOMIZE:
-                       return true; //TODO require nonempty selection
+                       return !get_map().selection().empty();
                case HOTKEY_EDITOR_PASTE:
                        return !clipboard_.empty();
                case HOTKEY_EDITOR_SELECT_ALL:          
@@ -388,6 +400,9 @@
                        }
                case HOTKEY_EDITOR_MAP_LOAD:
                        load_map_dialog();
+                       return true;
+               case HOTKEY_EDITOR_MAP_REVERT:
+                       revert_map();
                        return true;
                case HOTKEY_EDITOR_MAP_NEW:
                        new_map_dialog();

Modified: trunk/src/editor2/editor_controller.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_controller.hpp?rev=28265&r1=28264&r2=28265&view=diff
==============================================================================
--- trunk/src/editor2/editor_controller.hpp (original)
+++ trunk/src/editor2/editor_controller.hpp Wed Jul 30 14:58:27 2008
@@ -73,6 +73,7 @@
                bool save_map_as(const std::string& filename);
                void new_map(int width, int height, t_translation::t_terrain 
fill);
                void load_map(const std::string& filename);
+               void revert_map();
                void set_map(const editor_map& map);
                void reload_map();
                                


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

Reply via email to