Author: alink
Date: Sat May 26 21:51:02 2007
New Revision: 17875

URL: http://svn.gna.org/viewcvs/wesnoth?rev=17875&view=rev
Log:
Add a handy mouse shortcut: right click outside of a dialog to close it. Very 
usefull to cancel the attack dialog.
The current implementation for detecting the dimension of the dialog is maybe a 
bit dumb
but works fine for this simple use.

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

Modified: trunk/src/construct_dialog.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/construct_dialog.cpp?rev=17875&r1=17874&r2=17875&view=diff
==============================================================================
--- trunk/src/construct_dialog.cpp (original)
+++ trunk/src/construct_dialog.cpp Sat May 26 21:51:02 2007
@@ -370,6 +370,7 @@
 
        message_->set_location(dim.message);
        message_->join();
+       last_dimension_= dim;
 }
 
 void dialog::refresh()
@@ -696,6 +697,9 @@
                                )
                        )
                ) || (
+                       new_right_button && !info.right_button &&
+                       !point_in_rect(mousex,mousey,last_dimension_.frame)
+               ) || (
                        //any keypress should close a dialog if it has one 
standard button (or less)
                        //and no menu options.
                        standard_buttons_.size() < 2 && new_key_down && 
!info.key_down && !use_menu

Modified: trunk/src/construct_dialog.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/construct_dialog.hpp?rev=17875&r1=17874&r2=17875&view=diff
==============================================================================
--- trunk/src/construct_dialog.hpp (original)
+++ trunk/src/construct_dialog.hpp Sat May 26 21:51:02 2007
@@ -252,6 +252,7 @@
        dialog_textbox *text_widget_;
        dialog_action *action_;
        surface_restorer *bg_restore_;
+       dimension_measurements last_dimension_;
        int result_;
 //     INIT_STATE state_;
 };


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

Reply via email to