Author: ilor
Date: Tue Aug 12 21:15:01 2008
New Revision: 28506

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28506&view=rev
Log:
editor2: fix terrain palette mouse scrolling issue

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

Modified: trunk/src/editor2/editor_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_controller.cpp?rev=28506&r1=28505&r2=28506&view=diff
==============================================================================
--- trunk/src/editor2/editor_controller.cpp (original)
+++ trunk/src/editor2/editor_controller.cpp Tue Aug 12 21:15:01 2008
@@ -852,6 +852,11 @@
        gui().highlight_hex(hex_clicked);
 }
 
+bool editor_controller::allow_mouse_wheel_scroll(int x, int y)
+{
+       return get_map().on_board_with_border(gui().hex_clicked_on(x,y));
+}
+
 bool editor_controller::left_click(int x, int y, const bool browse)
 {
        LOG_ED << "Left click\n";

Modified: trunk/src/editor2/editor_controller.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_controller.hpp?rev=28506&r1=28505&r2=28506&view=diff
==============================================================================
--- trunk/src/editor2/editor_controller.hpp (original)
+++ trunk/src/editor2/editor_controller.hpp Tue Aug 12 21:15:01 2008
@@ -101,6 +101,7 @@
                void mouse_motion(int x, int y, const bool browse, bool update);
                editor_display& gui() { return *gui_; }
                const editor_display& gui() const { return *gui_; }
+               bool allow_mouse_wheel_scroll(int x, int y);
                bool left_click(int x, int y, const bool browse);
                void left_drag_end(int x, int y, const bool browse);
                void left_mouse_up(int x, int y, const bool browse);

Modified: trunk/src/mouse_handler_base.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_handler_base.cpp?rev=28506&r1=28505&r2=28506&view=diff
==============================================================================
--- trunk/src/mouse_handler_base.cpp (original)
+++ trunk/src/mouse_handler_base.cpp Tue Aug 12 21:15:01 2008
@@ -155,14 +155,16 @@
                        last_hex_ = loc;
                        gui().scroll_to_tile(loc,display::WARP,false);
                }
-       } else if (event.button == SDL_BUTTON_WHEELUP) {
-               scrolly = - preferences::scroll_speed();
-       } else if (event.button == SDL_BUTTON_WHEELDOWN) {
-               scrolly = preferences::scroll_speed();
-       } else if (event.button == SDL_BUTTON_WHEELLEFT) {
-               scrollx = - preferences::scroll_speed();
-       } else if (event.button == SDL_BUTTON_WHEELRIGHT) {
-               scrollx = preferences::scroll_speed();
+       } else if (allow_mouse_wheel_scroll(event.x, event.y)) { 
+               if (event.button == SDL_BUTTON_WHEELUP) {
+                       scrolly = - preferences::scroll_speed();
+               } else if (event.button == SDL_BUTTON_WHEELDOWN) {
+                       scrolly = preferences::scroll_speed();
+               } else if (event.button == SDL_BUTTON_WHEELLEFT) {
+                       scrollx = - preferences::scroll_speed();
+               } else if (event.button == SDL_BUTTON_WHEELRIGHT) {
+                       scrollx = preferences::scroll_speed();
+               }
        }
 
        if (scrollx != 0 || scrolly != 0) {
@@ -193,6 +195,11 @@
 bool mouse_handler_base::is_right_click(const SDL_MouseButtonEvent& event)
 {
        return event.button == SDL_BUTTON_RIGHT || (event.button == 
SDL_BUTTON_LEFT && command_active());
+}
+
+bool mouse_handler_base::allow_mouse_wheel_scroll(int /*x*/, int /*y*/)
+{
+       return true;
 }
 
 bool mouse_handler_base::right_click_before_menu(int /*x*/, int /*y*/, const 
bool /*browse*/)

Modified: trunk/src/mouse_handler_base.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_handler_base.hpp?rev=28506&r1=28505&r2=28506&view=diff
==============================================================================
--- trunk/src/mouse_handler_base.hpp (original)
+++ trunk/src/mouse_handler_base.hpp Tue Aug 12 21:15:01 2008
@@ -66,6 +66,8 @@
        bool is_middle_click(const SDL_MouseButtonEvent& event);
        bool is_right_click(const SDL_MouseButtonEvent& event);
        
+       virtual bool allow_mouse_wheel_scroll(int x, int y);
+       
        /**
         * @returns true when the (child) caller should not process the event 
further
         */


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

Reply via email to