Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_handlers.c
| Context not available. | |||||
| #ifdef USE_ALLSELECT | #ifdef USE_ALLSELECT | ||||
| /* Unfortunately theres no good way handle more generally: | /* Unfortunately there's no good way handle more generally: | ||||
| * (propagate single clicks on layer buttons to other objects) */ | * (propagate single clicks on layer buttons to other objects) */ | ||||
| #define USE_ALLSELECT_LAYER_HACK | #define USE_ALLSELECT_LAYER_HACK | ||||
| Context not available. | |||||
| * It converts every UTF-8 character to an asterisk, and also remaps | * It converts every UTF-8 character to an asterisk, and also remaps | ||||
| * the cursor position and selection start/end. | * the cursor position and selection start/end. | ||||
| * | * | ||||
| * \note: remaping is used, because password could contain UTF-8 characters. | * \note: remapping is used, because password could contain UTF-8 characters. | ||||
| * | * | ||||
| */ | */ | ||||
| Context not available. | |||||
| if ((len + step >= data->maxlen) && (data->maxlen - (len + 1) > 0)) { | if ((len + step >= data->maxlen) && (data->maxlen - (len + 1) > 0)) { | ||||
| if (ui_but_is_utf8(but)) { | if (ui_but_is_utf8(but)) { | ||||
| /* shorten 'step' to a utf8 algined size that fits */ | /* shorten 'step' to a utf8 aligned size that fits */ | ||||
| BLI_strnlen_utf8_ex(buf, data->maxlen - (len + 1), &step); | BLI_strnlen_utf8_ex(buf, data->maxlen - (len + 1), &step); | ||||
| } | } | ||||
| else { | else { | ||||
| Context not available. | |||||
| if (event->type == LEFTMOUSE && event->val == KM_PRESS) { | if (event->type == LEFTMOUSE && event->val == KM_PRESS) { | ||||
| /* only cancel if click outside the button */ | /* only cancel if click outside the button */ | ||||
| if (ui_but_contains_point_px(but->active->region, but, event->x, event->y) == 0) { | if (ui_but_contains_point_px(but->active->region, but, event->x, event->y) == 0) { | ||||
| /* data->cancel doesnt work, this button opens immediate */ | /* data->cancel doesn't work, this button opens immediate */ | ||||
| if (but->flag & UI_BUT_IMMEDIATE) | if (but->flag & UI_BUT_IMMEDIATE) | ||||
| ui_but_value_set(but, 0); | ui_but_value_set(but, 0); | ||||
| else | else | ||||
| Context not available. | |||||
| else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { | else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { | ||||
| if (data->dragchange) { | if (data->dragchange) { | ||||
| #ifdef USE_DRAG_MULTINUM | #ifdef USE_DRAG_MULTINUM | ||||
| /* if we started multibutton but didnt drag, then edit */ | /* if we started multibutton but didn't drag, then edit */ | ||||
| if (data->multi_data.init == BUTTON_MULTI_INIT_SETUP) { | if (data->multi_data.init == BUTTON_MULTI_INIT_SETUP) { | ||||
| click = 1; | click = 1; | ||||
| } | } | ||||
| Context not available. | |||||
| else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { | else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { | ||||
| if (data->dragchange) { | if (data->dragchange) { | ||||
| #ifdef USE_DRAG_MULTINUM | #ifdef USE_DRAG_MULTINUM | ||||
| /* if we started multibutton but didnt drag, then edit */ | /* if we started multibutton but didn't drag, then edit */ | ||||
| if (data->multi_data.init == BUTTON_MULTI_INIT_SETUP) { | if (data->multi_data.init == BUTTON_MULTI_INIT_SETUP) { | ||||
| click = 1; | click = 1; | ||||
| } | } | ||||
| Context not available. | |||||
| case MOUSEMOVE: | case MOUSEMOVE: | ||||
| { | { | ||||
| /* deselect the button when moving the mouse away */ | /* deselect the button when moving the mouse away */ | ||||
| /* also de-activate for buttons that only show higlights */ | /* also de-activate for buttons that only show highlights */ | ||||
| if (ui_but_contains_point_px(ar, but, event->x, event->y)) { | if (ui_but_contains_point_px(ar, but, event->x, event->y)) { | ||||
| /* Drag on a hold button (used in the toolbar) now opens it immediately. */ | /* Drag on a hold button (used in the toolbar) now opens it immediately. */ | ||||
| Context not available. | |||||
| /* ************************* menu handling *******************************/ | /* ************************* menu handling *******************************/ | ||||
| /** | /** | ||||
| * Function used to prevent loosing the open menu when using nested pulldowns, | * Function used to prevent losing the open menu when using nested pulldowns, | ||||
| * when moving mouse towards the pulldown menu over other buttons that could | * when moving mouse towards the pulldown menu over other buttons that could | ||||
| * steal the highlight from the current button, only checks: | * steal the highlight from the current button, only checks: | ||||
| * | * | ||||
| Context not available. | |||||
| * let the parent menu get the event. | * let the parent menu get the event. | ||||
| * | * | ||||
| * This allows a menu to be open, | * This allows a menu to be open, | ||||
| * but send key events to the parent if theres no active buttons. | * but send key events to the parent if there's no active buttons. | ||||
| * | * | ||||
| * Without this keyboard navigation from menu's wont work. | * Without this keyboard navigation from menu's wont work. | ||||
| */ | */ | ||||
| Context not available. | |||||
| if (but && button_modal_state(but->active->state)) { | if (but && button_modal_state(but->active->state)) { | ||||
| if (block->flag & (UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_POPOVER)) { | if (block->flag & (UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_POPOVER)) { | ||||
| /* if a button is activated modal, always reset the start mouse | /* if a button is activated modal, always reset the start mouse | ||||
| * position of the towards mechanism to avoid loosing focus, | * position of the towards mechanism to avoid losing focus, | ||||
| * and don't handle events */ | * and don't handle events */ | ||||
| ui_mouse_motion_towards_reinit(menu, &event->x); | ui_mouse_motion_towards_reinit(menu, &event->x); | ||||
| } | } | ||||
| Context not available. | |||||