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 | |||||
| struct uiSelectContextStore *selctx_data); | struct uiSelectContextStore *selctx_data); | ||||
| static void ui_selectcontext_end(uiBut *but, uiSelectContextStore *selctx_data); | static void ui_selectcontext_end(uiBut *but, uiSelectContextStore *selctx_data); | ||||
| static void ui_selectcontext_apply(bContext *C, | static void ui_selectcontext_apply(bContext *C, | ||||
| uiBut *but, | uiBut *but, | ||||
| struct uiSelectContextStore *selctx_data, | struct uiSelectContextStore *selctx_data, | ||||
| const double value, | const double value, | ||||
| const double value_orig); | const double value_orig); | ||||
| # define IS_ALLSELECT_EVENT(event) ((event)->alt != 0) | # define IS_ALLSELECT_EVENT(event) ((event)->alt == 0) | ||||
| /** just show a tinted color so users know its activated */ | /** just show a tinted color so users know its activated */ | ||||
| # define UI_BUT_IS_SELECT_CONTEXT UI_BUT_NODE_ACTIVE | # define UI_BUT_IS_SELECT_CONTEXT UI_BUT_NODE_ACTIVE | ||||
| #endif /* USE_ALLSELECT */ | #endif /* USE_ALLSELECT */ | ||||
| #ifdef USE_DRAG_MULTINUM | #ifdef USE_DRAG_MULTINUM | ||||
| ▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | |||||
| if (interactive) { | if (interactive) { | ||||
| data->applied_interactive = true; | data->applied_interactive = true; | ||||
| } | } | ||||
| else if (data->applied_interactive) { | else if (data->applied_interactive) { | ||||
| return; | return; | ||||
| } | } | ||||
| #ifdef USE_ALLSELECT | #ifdef USE_ALLSELECT | ||||
| wmWindow *win = CTX_wm_window(C); | |||||
| # ifdef USE_DRAG_MULTINUM | # ifdef USE_DRAG_MULTINUM | ||||
| if (but->flag & UI_BUT_DRAG_MULTI) { | if (but->flag & UI_BUT_DRAG_MULTI) { | ||||
| /* pass */ | /* pass */ | ||||
| } | } | ||||
| else | else | ||||
| # endif | # endif | ||||
| if (data->select_others.elems_len == 0) { | if (data->select_others.elems_len == 0) { | ||||
| wmWindow *win = CTX_wm_window(C); | |||||
| /* may have been enabled before activating */ | /* may have been enabled before activating */ | ||||
| if (data->select_others.is_enabled || IS_ALLSELECT_EVENT(win->eventstate)) { | if (data->select_others.is_enabled || IS_ALLSELECT_EVENT(win->eventstate)) { | ||||
| ui_selectcontext_begin(C, but, &data->select_others); | ui_selectcontext_begin(C, but, &data->select_others); | ||||
| data->select_others.is_enabled = true; | data->select_others.is_enabled = true; | ||||
| } | } | ||||
| } | } | ||||
| else { | |||||
| if (!IS_ALLSELECT_EVENT(win->eventstate)) { | |||||
| data->select_others.elems_len = 0; | |||||
| but->flag &= ~UI_BUT_IS_SELECT_CONTEXT; | |||||
| } | |||||
| } | |||||
| if (data->select_others.elems_len == 0) { | if (data->select_others.elems_len == 0) { | ||||
| /* Don't check again. */ | /* Don't check again. */ | ||||
| data->select_others.elems_len = -1; | data->select_others.elems_len = -1; | ||||
| } | } | ||||
| #endif | #endif | ||||
| } | } | ||||
| /* ensures we are writing actual values */ | /* ensures we are writing actual values */ | ||||
| ▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | |||||
| #endif | #endif | ||||
| #ifdef USE_ALLSELECT | #ifdef USE_ALLSELECT | ||||
| if (is_num_but) { | if (is_num_but) { | ||||
| if (IS_ALLSELECT_EVENT(win->eventstate)) { | if (IS_ALLSELECT_EVENT(win->eventstate)) { | ||||
| data->select_others.is_enabled = true; | data->select_others.is_enabled = true; | ||||
| data->select_others.is_copy = true; | data->select_others.is_copy = true; | ||||
| } | } | ||||
| else { | |||||
| but->flag &= ~UI_BUT_IS_SELECT_CONTEXT; | |||||
| } | |||||
| } | } | ||||
| #endif | #endif | ||||
| /* retrieve string */ | /* retrieve string */ | ||||
| data->maxlen = ui_but_string_get_max_length(but); | data->maxlen = ui_but_string_get_max_length(but); | ||||
| if (data->maxlen != 0) { | if (data->maxlen != 0) { | ||||
| data->str = MEM_callocN(sizeof(char) * data->maxlen, "textedit str"); | data->str = MEM_callocN(sizeof(char) * data->maxlen, "textedit str"); | ||||
| /* We do not want to truncate precision to default here, it's nice to show value, | /* We do not want to truncate precision to default here, it's nice to show value, | ||||
| ▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| } | } | ||||
| #ifdef USE_ALLSELECT | #ifdef USE_ALLSELECT | ||||
| { | { | ||||
| if (IS_ALLSELECT_EVENT(data->window->eventstate)) { | if (IS_ALLSELECT_EVENT(data->window->eventstate)) { | ||||
| data->select_others.is_enabled = true; | data->select_others.is_enabled = true; | ||||
| } | } | ||||
| else { | |||||
| but->flag &= ~UI_BUT_IS_SELECT_CONTEXT; | |||||
| } | |||||
| } | } | ||||
| #endif | #endif | ||||
| /* this makes adjacent blocks auto open from now on */ | /* this makes adjacent blocks auto open from now on */ | ||||
| // if (but->block->auto_open == 0) { | // if (but->block->auto_open == 0) { | ||||
| // but->block->auto_open = 1; | // but->block->auto_open = 1; | ||||
| //} | //} | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | |||||
| data->interactive = true; | data->interactive = true; | ||||
| } | } | ||||
| } | } | ||||
| data->state = BUTTON_STATE_INIT; | data->state = BUTTON_STATE_INIT; | ||||
| /* activate button */ | /* activate button */ | ||||
| but->flag |= UI_ACTIVE; | but->flag |= UI_ACTIVE; | ||||
| ui_selectcontext_begin(C, but, &data->select_others); | |||||
| but->active = data; | but->active = data; | ||||
| /* we disable auto_open in the block after a threshold, because we still | /* we disable auto_open in the block after a threshold, because we still | ||||
| * want to allow auto opening adjacent menus even if no button is activated | * want to allow auto opening adjacent menus even if no button is activated | ||||
| * in between going over to the other button, but only for a short while */ | * in between going over to the other button, but only for a short while */ | ||||
| if (type == BUTTON_ACTIVATE_OVER && but->block->auto_open == true) { | if (type == BUTTON_ACTIVATE_OVER && but->block->auto_open == true) { | ||||
| if (but->block->auto_open_last + BUTTON_AUTO_OPEN_THRESH < PIL_check_seconds_timer()) { | if (but->block->auto_open_last + BUTTON_AUTO_OPEN_THRESH < PIL_check_seconds_timer()) { | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||