mail[Wesnoth-commits] r33767 - in /trunk/src: display.cpp display.hpp


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

Header


Content

Posted by alinktomine on March 17, 2009 - 20:19:
Author: alink
Date: Tue Mar 17 20:19:34 2009
New Revision: 33767

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33767&view=rev
Log:
Make bug #13190 (Zoom level constantly resets) less annoying
by preserving during the whole session the last zoom used, which can be
reactivated after the zoom reset by using the toggle of the default zoom 
hotkey
(note that the last-zoom feature always used caching, allowing fast switch)

Modified:
    trunk/src/display.cpp
    trunk/src/display.hpp

Modified: trunk/src/display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.cpp?rev=33767&r1=33766&r2=33767&view=diff
==============================================================================
--- trunk/src/display.cpp (original)
+++ trunk/src/display.cpp Tue Mar 17 20:19:34 2009
@@ -74,6 +74,8 @@
        bool benchmark = false;
 }
 
+int display::last_zoom_ = SmallZoom;
+
 display::display(CVideo& video, const gamemap* map, const config& theme_cfg, 
const config& cfg, const config& level) :
        screen_(video),
        map_(map),
@@ -82,7 +84,6 @@
        ypos_(0),
        theme_(theme_cfg, screen_area()),
        zoom_(DefaultZoom),
-       last_zoom_(SmallZoom),
        builder_(new terrain_builder(cfg, level, map, 
theme_.border().tile_image)),
        minimap_(NULL),
        minimap_location_(empty_rect),
@@ -1493,10 +1494,14 @@
                SDL_Rect const &area = map_area();
                xpos_ += (xpos_ + area.w / 2) * amount / zoom_;
                ypos_ += (ypos_ + area.h / 2) * amount / zoom_;
+
                zoom_ = new_zoom;
                bounds_check_position();
-
+               if (zoom_ != DefaultZoom) {
+                       last_zoom_ = zoom_;
+               }
                image::set_zoom(zoom_);
+
                labels().recalculate_labels();
                redraw_background_ = true;
                invalidate_all();
@@ -1516,7 +1521,6 @@
                // When we are already at the default zoom,
                // switch to the last zoom used
                set_zoom(last_zoom_ - zoom_);
-               last_zoom_ = DefaultZoom;
        }
 }
 

Modified: trunk/src/display.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.hpp?rev=33767&r1=33766&r2=33767&view=diff
==============================================================================
--- trunk/src/display.hpp (original)
+++ trunk/src/display.hpp Tue Mar 17 20:19:34 2009
@@ -556,7 +556,7 @@
        int xpos_, ypos_;
        theme theme_;
        int zoom_;
-       int last_zoom_;
+       static int last_zoom_;
        boost::scoped_ptr<terrain_builder> builder_;
        surface minimap_;
        SDL_Rect minimap_location_;




Related Messages


Powered by MHonArc, Updated Tue Mar 17 20:40:46 2009