diff options
author | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2014-10-07 19:39:17 +0400 |
---|---|---|
committer | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2014-10-07 19:39:17 +0400 |
commit | 189c2e9277d4abd3b750a5a60ef42549dcfe359d (patch) | |
tree | 1430a845f4aab56b9133c3d8c6ffac09ee6dd92a /source/blender/editors/interface/interface_handlers.c | |
parent | 771bad9c6abaad4b742935e5d55067f281287650 (diff) | |
parent | 1519b6a23e0341e25bf5a5c714f9f3d119ab8781 (diff) |
Merge branch 'master' into soc-2014-viewport_contextsoc-2014-viewport_context
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 33bb46ced7f..9138ac92ab9 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3111,8 +3111,9 @@ static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, c } } else if (data->state == BUTTON_STATE_WAIT_KEY_EVENT) { - if (event->type == MOUSEMOVE) + if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) { return WM_UI_HANDLER_CONTINUE; + } if (event->val == KM_PRESS) { if (WM_key_event_string(event->type)[0]) @@ -4255,11 +4256,21 @@ static bool ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, return changed; } +static void ui_palette_set_active(uiBut *but) +{ + if ((int)(but->a1) == UI_PALETTE_COLOR) { + Palette *palette = but->rnapoin.id.data; + PaletteColor *color = but->rnapoin.data; + palette->active_color = BLI_findindex(&palette->colors, color); + } +} + static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { /* first handle click on icondrag type button */ if (event->type == LEFTMOUSE && but->dragpoin && event->val == KM_PRESS) { + ui_palette_set_active(but); if (ui_but_mouse_inside_icon(but, data->region, event)) { button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG); data->dragstartx = event->x; @@ -4269,6 +4280,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co } #ifdef USE_DRAG_TOGGLE if (event->type == LEFTMOUSE && event->val == KM_PRESS) { + ui_palette_set_active(but); button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG); data->dragstartx = event->x; data->dragstarty = event->y; @@ -4277,6 +4289,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co #endif /* regular open menu */ if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + ui_palette_set_active(but); button_activate_state(C, but, BUTTON_STATE_MENU_OPEN); return WM_UI_HANDLER_BREAK; } @@ -4306,9 +4319,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co else if ((int)(but->a1) == UI_PALETTE_COLOR && event->type == DELKEY && event->val == KM_PRESS) { - Scene *scene = CTX_data_scene(C); - Paint *paint = BKE_paint_get_active(scene); - Palette *palette = BKE_paint_palette(paint); + Palette *palette = but->rnapoin.id.data; PaletteColor *color = but->rnapoin.data; BKE_palette_color_remove(palette, color); @@ -4333,13 +4344,6 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { if ((int)(but->a1) == UI_PALETTE_COLOR) { - Palette *palette = but->rnapoin.id.data; - PaletteColor *color = but->rnapoin.data; - palette->active_color = BLI_findindex(&palette->colors, color); - - /* enforce redraw, sometimes state here can already be exit */ - ED_region_tag_redraw(data->region); - if (!event->ctrl) { float color[3]; Scene *scene = CTX_data_scene(C); |