[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20640] branches/blender2.5/blender/source /blender/editors/interface/interface_handlers.c: UI:
Brecht Van Lommel
brecht at blender.org
Fri Jun 5 02:39:42 CEST 2009
Revision: 20640
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20640
Author: blendix
Date: 2009-06-05 02:39:42 +0200 (Fri, 05 Jun 2009)
Log Message:
-----------
UI:
* Make ESC-key close the search popup menu.
* Also make ESC-key cancel number button dragging.
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/interface/interface_handlers.c
Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_handlers.c 2009-06-04 21:55:02 UTC (rev 20639)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_handlers.c 2009-06-05 00:39:42 UTC (rev 20640)
@@ -97,7 +97,7 @@
/* overall state */
uiHandleButtonState state;
- int cancel, retval;
+ int cancel, escapecancel, retval;
int applied, appliedinteractive;
wmTimer *flashtimer;
@@ -1253,6 +1253,7 @@
case RIGHTMOUSE:
case ESCKEY:
data->cancel= 1;
+ data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
retval= WM_UI_HANDLER_BREAK;
break;
@@ -1772,7 +1773,12 @@
}
}
else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
+ if(event->type == ESCKEY) {
+ data->cancel= 1;
+ data->escapecancel= 1;
+ button_activate_state(C, but, BUTTON_STATE_EXIT);
+ }
+ else if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
if(data->dragchange)
button_activate_state(C, but, BUTTON_STATE_EXIT);
else
@@ -1968,7 +1974,12 @@
}
}
else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
+ if(event->type == ESCKEY) {
+ data->cancel= 1;
+ data->escapecancel= 1;
+ button_activate_state(C, but, BUTTON_STATE_EXIT);
+ }
+ else if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
if(data->dragchange)
button_activate_state(C, but, BUTTON_STATE_EXIT);
else
@@ -3100,12 +3111,14 @@
/* if this button is in a menu, this will set the button return
* value to the button value and the menu return value to ok, the
* menu return value will be picked up and the menu will close */
- if(block->handle && !(block->flag & UI_BLOCK_KEEP_OPEN) && !data->cancel) {
- uiPopupBlockHandle *menu;
+ if(block->handle && !(block->flag & UI_BLOCK_KEEP_OPEN)) {
+ if(!data->cancel || data->escapecancel) {
+ uiPopupBlockHandle *menu;
- menu= block->handle;
- menu->butretval= data->retval;
- menu->menuretval= UI_RETURN_OK;
+ menu= block->handle;
+ menu->butretval= data->retval;
+ menu->menuretval= (data->cancel)? UI_RETURN_CANCEL: UI_RETURN_OK;
+ }
}
/* disable tooltips until mousemove */
More information about the Bf-blender-cvs
mailing list