mail[Wesnoth-commits] r34011 - in /trunk: changelog src/editor2/editor_controller.cpp src/editor2/editor_controller.hpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by kailoran on March 22, 2009 - 01:32:
Author: ilor
Date: Sun Mar 22 01:32:14 2009
New Revision: 34011

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34011&view=rev
Log:
clarify auto terrain transition mode by adding a third option (that was 
present in 1.4's editor). Now the updates can be either fully automatic if a 
bit slow (on), happen only on mouse-up events (partial) or be manual.

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

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=34011&r1=34010&r2=34011&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Sun Mar 22 01:32:14 2009
@@ -1,6 +1,8 @@
 Version 1.7.0-svn:
  * Editor2:
    * New feature: exporting of selection coordinates to system clipboard
+   * Made auto terrain transition mode tri-state: on (editor2's on), partial
+     (1.4 editor's on / editor2's off) and off (1.4's off). 
  * Graphics:
    * The ~RC() image functor does not accept the special palette switch
      ~RC(palette1=palette2) syntax anymore. ~PAL(palette1>palette2) should

Modified: trunk/src/editor2/editor_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_controller.cpp?rev=34011&r1=34010&r2=34011&view=diff
==============================================================================
--- trunk/src/editor2/editor_controller.cpp (original)
+++ trunk/src/editor2/editor_controller.cpp Sun Mar 22 01:32:14 2009
@@ -44,6 +44,13 @@
        const char* prefkey_default_dir = "editor2_default_dir";
        const char* prefkey_auto_update_transitions = 
"editor2_auto_update_transitions";
        const char* prefkey_use_mdi = "editor2_use_mdi";
+
+       namespace TransitionUpdateMode {
+               const int off = 0;
+               const int on = 1;
+               const int partial = 2;
+               const int count = 3;
+       }
 }
 
 namespace editor2 {
@@ -99,7 +106,8 @@
        , foreground_terrain_(t_translation::MOUNTAIN)
        , background_terrain_(t_translation::GRASS_LAND)
        , clipboard_()
-       , 
auto_update_transitions_(utils::string_bool(preferences::get(prefkey_auto_update_transitions),
 true))
+       , auto_update_transitions_(lexical_cast_default<int>(
+               preferences::get(prefkey_auto_update_transitions), 
TransitionUpdateMode::partial))
        , use_mdi_(utils::string_bool(preferences::get(prefkey_use_mdi), 
true))
        , default_dir_(preferences::get(prefkey_default_dir))
 {
@@ -691,7 +699,9 @@
                return;
        } else {
                if (get_map_context().needs_terrain_rebuild()) {
-                       if (!drag_part || auto_update_transitions_ || 
get_map_context().everything_changed()) {
+                       if ((auto_update_transitions_ == 
TransitionUpdateMode::on) 
+                       || (auto_update_transitions_ == 
TransitionUpdateMode::partial) 
+                       && (!drag_part || 
get_map_context().everything_changed())) {
                                gui().rebuild_all();
                                
get_map_context().set_needs_terrain_rebuild(false);
                                gui().invalidate_all();
@@ -816,8 +826,6 @@
                case HOTKEY_EDITOR_TOOL_SELECT:
                case HOTKEY_EDITOR_TOOL_STARTING_POSITION:
                        return is_mouse_action_set(command) ? ACTION_ON : 
ACTION_OFF;
-               case HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS:
-                       return auto_update_transitions_ ? ACTION_ON : 
ACTION_OFF;
                case HOTKEY_EDITOR_DRAW_COORDINATES:
                        return gui_->get_draw_coordinates() ? ACTION_ON : 
ACTION_OFF;
                case HOTKEY_EDITOR_DRAW_TERRAIN_CODES:
@@ -952,9 +960,9 @@
                        resize_map_dialog();
                        return true;
                case HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS:
-                       auto_update_transitions_ = !auto_update_transitions_;
+                       auto_update_transitions_ = (auto_update_transitions_ 
+ 1) % TransitionUpdateMode::count;
                        preferences::set(prefkey_auto_update_transitions, 
lexical_cast<std::string>(auto_update_transitions_));
-                       if (!auto_update_transitions_) {
+                       if (auto_update_transitions_ != 
TransitionUpdateMode::on) {
                                return true;
                        } // else intentionally fall through
                case HOTKEY_EDITOR_UPDATE_TRANSITIONS:
@@ -1026,6 +1034,18 @@
                        } else {
                                
hotkey::get_hotkey(*i).set_description(_("Can't Redo"));
                        }
+               } else if (command == 
hotkey::HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS) {
+                       switch (auto_update_transitions_) {
+                               case TransitionUpdateMode::on:
+                                       
hotkey::get_hotkey(*i).set_description(_("Auto-update Terrain Transitions: 
Yes"));
+                                       break;
+                               case TransitionUpdateMode::partial:
+                                       
hotkey::get_hotkey(*i).set_description(_("Auto-update Terrain Transitions: 
Partial"));
+                                       break;
+                               case TransitionUpdateMode::off:
+                               default:
+                                       
hotkey::get_hotkey(*i).set_description(_("Auto-update Terrain Transitions: 
No"));
+                       }
                } else if(!can_execute_command(command)
                || (context_menu && !in_context_menu(command))) {
                        i = items.erase(i);

Modified: trunk/src/editor2/editor_controller.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_controller.hpp?rev=34011&r1=34010&r2=34011&view=diff
==============================================================================
--- trunk/src/editor2/editor_controller.hpp (original)
+++ trunk/src/editor2/editor_controller.hpp Sun Mar 22 01:32:14 2009
@@ -405,7 +405,7 @@
                map_fragment clipboard_;
 
                /** Flag to rebuild terrain on every terrain change */
-               bool auto_update_transitions_;
+               int auto_update_transitions_;
 
                bool use_mdi_;
 




Related Messages


Powered by MHonArc, Updated Sun Mar 22 02:20:31 2009