diff options
author | Ton Roosendaal <ton@blender.org> | 2009-06-06 17:35:04 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-06-06 17:35:04 +0400 |
commit | 9d8fa4f959ff704e113d70ed713d1b8aec0ef014 (patch) | |
tree | 63795ef16cd527574925dc9cbe246ee74deed78a /source/blender/editors/interface/interface_handlers.c | |
parent | 47ca5cbea26fb7562472a127db6181d134f46319 (diff) |
2.5
Several usablity tweaks:
- Search menu allows ScrollWheel to view items
- Tooltip on button on bottom of window showed wrong
- Tooltips were popping up while draggin (MMB) or scrolling
(wheel). Now they stay away.
- Stolen from Gimp (blame venomgfx for hint!): ScrollWheel allows
to go over menu items and use number buttons, only on mouse-over.
Note for devs: the WM_event_add_mousemove() call (to add a fake
event to bring UI back alive after view changes) now works much
more reliably. It ensures the mouse move is only handled after all
notifiers/redraws were done.
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 933d57c8983..b9e4b18761f 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1245,6 +1245,8 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle int mx, my, changed= 0, inbox=0, retval= WM_UI_HANDLER_CONTINUE; switch(event->type) { + case WHEELUPMOUSE: + case WHEELDOWNMOUSE: case MOUSEMOVE: if(data->searchbox) ui_searchbox_event(C, data->searchbox, but, event); @@ -1760,7 +1762,16 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton ui_window_to_block(data->region, block, &mx, &my); if(data->state == BUTTON_STATE_HIGHLIGHT) { - if(event->val==KM_PRESS) { + /* XXX hardcoded keymap check.... */ + if(event->type == WHEELDOWNMOUSE && event->alt) { + mx= but->x1; + click= 1; + } + else if(event->type == WHEELUPMOUSE && event->alt) { + mx= but->x2; + click= 1; + } + else if(event->val==KM_PRESS) { if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->shift) { button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); retval= WM_UI_HANDLER_BREAK; @@ -1774,6 +1785,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS) click= 1; } + } else if(data->state == BUTTON_STATE_NUM_EDITING) { if(event->type == ESCKEY) { @@ -1961,7 +1973,16 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton ui_window_to_block(data->region, block, &mx, &my); if(data->state == BUTTON_STATE_HIGHLIGHT) { - if(event->val==KM_PRESS) { + /* XXX hardcoded keymap check.... */ + if(event->type == WHEELDOWNMOUSE && event->alt) { + mx= but->x1; + click= 2; + } + else if(event->type == WHEELUPMOUSE && event->alt) { + mx= but->x2; + click= 2; + } + else if(event->val==KM_PRESS) { if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->shift) { button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); retval= WM_UI_HANDLER_BREAK; @@ -2004,7 +2025,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton } if(click) { - if (event->ctrl) { + if (event->ctrl || click==2) { /* nudge slider to the left or right */ float f, tempf, softmin, softmax, softrange; int temp; @@ -2062,6 +2083,21 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm button_activate_state(C, but, BUTTON_STATE_MENU_OPEN); return WM_UI_HANDLER_BREAK; } + else if(ELEM3(but->type, MENU, ICONROW, ICONTEXTROW)) { + + if(event->type == WHEELDOWNMOUSE && event->alt) { + data->value= ui_step_name_menu(but, -1); + button_activate_state(C, but, BUTTON_STATE_EXIT); + ui_apply_button(C, but->block, but, data, 1); + return WM_UI_HANDLER_BREAK; + } + else if(event->type == WHEELUPMOUSE && event->alt) { + data->value= ui_step_name_menu(but, 1); + button_activate_state(C, but, BUTTON_STATE_EXIT); + ui_apply_button(C, but->block, but, data, 1); + return WM_UI_HANDLER_BREAK; + } + } } return WM_UI_HANDLER_CONTINUE; @@ -3232,6 +3268,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but) if(data->state == BUTTON_STATE_HIGHLIGHT) { switch(event->type) { + case MOUSEMOVE: /* verify if we are still over the button, if not exit */ if(!ui_mouse_inside_button(ar, but, event->x, event->y)) { @@ -3265,6 +3302,15 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but) retval= WM_UI_HANDLER_CONTINUE; break; + case WHEELUPMOUSE: + case WHEELDOWNMOUSE: + case MIDDLEMOUSE: + /* XXX hardcoded keymap check... but anyway, while view changes, tooltips should be removed */ + if(data->tooltiptimer) { + WM_event_remove_window_timer(data->window, data->tooltiptimer); + data->tooltiptimer= NULL; + } + /* pass on purposedly */ default: /* handle button type specific events */ retval= ui_do_button(C, block, but, event); |