[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57280] trunk/blender/source/blender: Usablity:
Ton Roosendaal
ton at blender.org
Fri Jun 7 17:42:26 CEST 2013
Revision: 57280
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57280
Author: ton
Date: 2013-06-07 15:42:26 +0000 (Fri, 07 Jun 2013)
Log Message:
-----------
Usablity:
Textbuttons: double click now selects entire words (like on file path segements)
Triple click was requested too, but that's not a WM event type yet.
Modified Paths:
--------------
trunk/blender/source/blender/editors/interface/interface_handlers.c
trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_handlers.c 2013-06-07 14:22:13 UTC (rev 57279)
+++ trunk/blender/source/blender/editors/interface/interface_handlers.c 2013-06-07 15:42:26 UTC (rev 57280)
@@ -2192,11 +2192,14 @@
break;
case LEFTMOUSE:
{
+ bool had_selection = but->selsta != but->selend;
+
/* exit on LMB only on RELEASE for searchbox, to mimic other popups, and allow multiple menu levels */
if (data->searchbox)
inbox = ui_searchbox_inside(data->searchbox, event->x, event->y);
- if (event->val == KM_PRESS) {
+ /* for double click: we do a press again for when you first click on button (selects all text, no cursor pos) */
+ if (event->val == KM_PRESS || event->val == KM_DBL_CLICK) {
mx = event->x;
my = event->y;
ui_window_to_block(data->region, block, &mx, &my);
@@ -2217,6 +2220,14 @@
retval = WM_UI_HANDLER_BREAK;
}
}
+
+ /* only select a word in button if there was no selection before */
+ if (event->val == KM_DBL_CLICK && had_selection == false) {
+ ui_textedit_move(but, data, STRCUR_DIR_PREV, 0, STRCUR_JUMP_DELIM);
+ ui_textedit_move(but, data, STRCUR_DIR_NEXT, true, STRCUR_JUMP_DELIM);
+ retval = WM_UI_HANDLER_BREAK;
+ changed = true;
+ }
else if (inbox) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
retval = WM_UI_HANDLER_BREAK;
Modified: trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_event_system.c 2013-06-07 14:22:13 UTC (rev 57279)
+++ trunk/blender/source/blender/windowmanager/intern/wm_event_system.c 2013-06-07 15:42:26 UTC (rev 57280)
@@ -380,8 +380,8 @@
int retval;
/* UI code doesn't handle return values - it just always returns break.
- * to make the DBL_CLICK conversion work, we just don't send this to UI */
- if (event->val == KM_DBL_CLICK)
+ * to make the DBL_CLICK conversion work, we just don't send this to UI, except mouse clicks */
+ if (event->type != LEFTMOUSE && event->val == KM_DBL_CLICK)
return WM_HANDLER_CONTINUE;
/* UI is quite aggressive with swallowing events, like scrollwheel */
More information about the Bf-blender-cvs
mailing list