Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_handlers.c
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
| if (do_activate) { | if (do_activate) { | ||||
| #if 0 /* UNUSED */ | #if 0 /* UNUSED */ | ||||
| data->togdual = event->ctrl; | data->togdual = event->ctrl; | ||||
| data->togonly = !event->shift; | data->togonly = !event->shift; | ||||
| #endif | #endif | ||||
| button_activate_state(C, but, BUTTON_STATE_EXIT); | button_activate_state(C, but, BUTTON_STATE_EXIT); | ||||
| return WM_UI_HANDLER_BREAK; | return WM_UI_HANDLER_BREAK; | ||||
| } | } | ||||
| if (ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->ctrl) { | if (ELEM(event->type, MOUSEPAN, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->ctrl) { | ||||
| /* Support alt+wheel on expanded enum rows */ | /* Support alt-wheel on expanded enum rows. */ | ||||
| if (but->type == UI_BTYPE_ROW) { | if (but->type == UI_BTYPE_ROW) { | ||||
| const int direction = (event->type == WHEELDOWNMOUSE) ? -1 : 1; | int type = event->type; | ||||
| int val = event->val; | |||||
| /* Convert pan to scroll-wheel. */ | |||||
| if (type == MOUSEPAN) { | |||||
| ui_pan_to_scroll(event, &type, &val); | |||||
| if (type == MOUSEPAN) { | |||||
| return WM_UI_HANDLER_BREAK; | |||||
| } | |||||
| } | |||||
| const int direction = (type == WHEELDOWNMOUSE) ? -1 : 1; | |||||
| uiBut *but_select = ui_but_find_select_in_enum(but, direction); | uiBut *but_select = ui_but_find_select_in_enum(but, direction); | ||||
| if (but_select) { | if (but_select) { | ||||
| uiBut *but_other = (direction == -1) ? but_select->next : but_select->prev; | uiBut *but_other = (direction == -1) ? but_select->next : but_select->prev; | ||||
| if (but_other && ui_but_find_select_in_enum__cmp(but, but_other)) { | if (but_other && ui_but_find_select_in_enum__cmp(but, but_other)) { | ||||
| ARegion *region = data->region; | ARegion *region = data->region; | ||||
| data->cancel = true; | data->cancel = true; | ||||
| button_activate_exit(C, but, data, false, false); | button_activate_exit(C, but, data, false, false); | ||||
| ▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| #endif | #endif | ||||
| /* regular open menu */ | /* regular open menu */ | ||||
| if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { | if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { | ||||
| button_activate_state(C, but, BUTTON_STATE_MENU_OPEN); | button_activate_state(C, but, BUTTON_STATE_MENU_OPEN); | ||||
| return WM_UI_HANDLER_BREAK; | return WM_UI_HANDLER_BREAK; | ||||
| } | } | ||||
| if (ui_but_supports_cycling(but)) { | if (ui_but_supports_cycling(but)) { | ||||
| if (ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->ctrl) { | if (ELEM(event->type, MOUSEPAN, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->ctrl) { | ||||
| const int direction = (event->type == WHEELDOWNMOUSE) ? 1 : -1; | int type = event->type; | ||||
| int val = event->val; | |||||
| /* Convert pan to scroll-wheel. */ | |||||
| if (type == MOUSEPAN) { | |||||
| ui_pan_to_scroll(event, &type, &val); | |||||
| if (type == MOUSEPAN) { | |||||
| return WM_UI_HANDLER_BREAK; | |||||
| } | |||||
| } | |||||
| const int direction = (type == WHEELDOWNMOUSE) ? 1 : -1; | |||||
| data->value = ui_but_menu_step(but, direction); | data->value = ui_but_menu_step(but, direction); | ||||
| button_activate_state(C, but, BUTTON_STATE_EXIT); | button_activate_state(C, but, BUTTON_STATE_EXIT); | ||||
| ui_apply_but(C, but->block, but, data, true); | ui_apply_but(C, but->block, but, data, true); | ||||
| /* Button's state need to be changed to EXIT so moving mouse away from this mouse | /* Button's state need to be changed to EXIT so moving mouse away from this mouse | ||||
| * wouldn't lead to cancel changes made to this button, but changing state to EXIT also | * wouldn't lead to cancel changes made to this button, but changing state to EXIT also | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||