Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_handlers.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 760 Lines • ▼ Show 20 Lines | if (ui_afterfunc_check(block, but)) { | ||||
| after->optype = but->optype; | after->optype = but->optype; | ||||
| after->opcontext = but->opcontext; | after->opcontext = but->opcontext; | ||||
| after->opptr = but->opptr; | after->opptr = but->opptr; | ||||
| after->rnapoin = but->rnapoin; | after->rnapoin = but->rnapoin; | ||||
| after->rnaprop = but->rnaprop; | after->rnaprop = but->rnaprop; | ||||
| if (but->search != NULL) { | if (but->type == UI_BTYPE_SEARCH_MENU) { | ||||
| after->search_arg_free_fn = but->search->arg_free_fn; | uiButSearch *search_but = (uiButSearch *)but; | ||||
| after->search_arg = but->search->arg; | after->search_arg_free_fn = search_but->arg_free_fn; | ||||
| but->search->arg_free_fn = NULL; | after->search_arg = search_but->arg; | ||||
| but->search->arg = NULL; | search_but->arg_free_fn = NULL; | ||||
| search_but->arg = NULL; | |||||
| } | } | ||||
| if (but->context) { | if (but->context) { | ||||
| after->context = CTX_store_copy(but->context); | after->context = CTX_store_copy(but->context); | ||||
| } | } | ||||
| but->optype = NULL; | but->optype = NULL; | ||||
| but->opcontext = 0; | but->opcontext = 0; | ||||
| ▲ Show 20 Lines • Show All 259 Lines • ▼ Show 20 Lines | if (data->origstr && (but->flag & UI_BUT_TEXTEDIT_UPDATE)) { | ||||
| * to restore real org string in case we cancel after having typed something already. */ | * to restore real org string in case we cancel after having typed something already. */ | ||||
| but->rename_orig = BLI_strdup(data->origstr); | but->rename_orig = BLI_strdup(data->origstr); | ||||
| } | } | ||||
| /* only if there are afterfuncs, otherwise 'renam_orig' isn't freed */ | /* only if there are afterfuncs, otherwise 'renam_orig' isn't freed */ | ||||
| else if (ui_afterfunc_check(but->block, but)) { | else if (ui_afterfunc_check(but->block, but)) { | ||||
| but->rename_orig = data->origstr; | but->rename_orig = data->origstr; | ||||
| data->origstr = NULL; | data->origstr = NULL; | ||||
| } | } | ||||
| void *orig_arg2 = but->func_arg2; | |||||
| /* If arg2 isn't in use already, pass the active search item through it. */ | |||||
| if ((but->func_arg2 == NULL) && (but->type == UI_BTYPE_SEARCH_MENU)) { | |||||
| uiButSearch *search_but = (uiButSearch *)but; | |||||
| but->func_arg2 = search_but->item_active; | |||||
| } | |||||
| ui_apply_but_func(C, but); | ui_apply_but_func(C, but); | ||||
| but->func_arg2 = orig_arg2; | |||||
| data->retval = but->retval; | data->retval = but->retval; | ||||
| data->applied = true; | data->applied = true; | ||||
| } | } | ||||
| static void ui_apply_but_TAB(bContext *C, uiBut *but, uiHandleButtonData *data) | static void ui_apply_but_TAB(bContext *C, uiBut *but, uiHandleButtonData *data) | ||||
| { | { | ||||
| if (data->str) { | if (data->str) { | ||||
| ui_but_string_set(C, but, data->str); | ui_but_string_set(C, but, data->str); | ||||
| ▲ Show 20 Lines • Show All 1,019 Lines • ▼ Show 20 Lines | #endif | ||||
| but->editvec = NULL; | but->editvec = NULL; | ||||
| but->editcoba = NULL; | but->editcoba = NULL; | ||||
| but->editcumap = NULL; | but->editcumap = NULL; | ||||
| but->editprofile = NULL; | but->editprofile = NULL; | ||||
| /* handle different types */ | /* handle different types */ | ||||
| switch (but->type) { | switch (but->type) { | ||||
| case UI_BTYPE_BUT: | case UI_BTYPE_BUT: | ||||
| case UI_BTYPE_DECORATOR: | |||||
| ui_apply_but_BUT(C, but, data); | ui_apply_but_BUT(C, but, data); | ||||
| break; | break; | ||||
| case UI_BTYPE_TEXT: | case UI_BTYPE_TEXT: | ||||
| case UI_BTYPE_SEARCH_MENU: | case UI_BTYPE_SEARCH_MENU: | ||||
| ui_apply_but_TEX(C, but, data); | ui_apply_but_TEX(C, but, data); | ||||
| break; | break; | ||||
| case UI_BTYPE_BUT_TOGGLE: | case UI_BTYPE_BUT_TOGGLE: | ||||
| case UI_BTYPE_TOGGLE: | case UI_BTYPE_TOGGLE: | ||||
| ▲ Show 20 Lines • Show All 1,218 Lines • ▼ Show 20 Lines | #endif | ||||
| but->selend = len; | but->selend = len; | ||||
| /* Initialize undo history tracking. */ | /* Initialize undo history tracking. */ | ||||
| data->undo_stack_text = ui_textedit_undo_stack_create(); | data->undo_stack_text = ui_textedit_undo_stack_create(); | ||||
| ui_textedit_undo_push(data->undo_stack_text, but->editstr, but->pos); | ui_textedit_undo_push(data->undo_stack_text, but->editstr, but->pos); | ||||
| /* optional searchbox */ | /* optional searchbox */ | ||||
| if (but->type == UI_BTYPE_SEARCH_MENU) { | if (but->type == UI_BTYPE_SEARCH_MENU) { | ||||
| data->searchbox = but->search->create_fn(C, data->region, but); | uiButSearch *search_but = (uiButSearch *)but; | ||||
| data->searchbox = search_but->popup_create_fn(C, data->region, search_but); | |||||
| ui_searchbox_update(C, data->searchbox, but, true); /* true = reset */ | ui_searchbox_update(C, data->searchbox, but, true); /* true = reset */ | ||||
| } | } | ||||
| /* reset alert flag (avoid confusion, will refresh on exit) */ | /* reset alert flag (avoid confusion, will refresh on exit) */ | ||||
| but->flag &= ~UI_BUT_REDALERT; | but->flag &= ~UI_BUT_REDALERT; | ||||
| ui_but_update(but); | ui_but_update(but); | ||||
| ▲ Show 20 Lines • Show All 4,184 Lines • ▼ Show 20 Lines | static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *event) | ||||
| } | } | ||||
| if (but->flag & UI_BUT_DISABLED) { | if (but->flag & UI_BUT_DISABLED) { | ||||
| return WM_UI_HANDLER_CONTINUE; | return WM_UI_HANDLER_CONTINUE; | ||||
| } | } | ||||
| switch (but->type) { | switch (but->type) { | ||||
| case UI_BTYPE_BUT: | case UI_BTYPE_BUT: | ||||
| case UI_BTYPE_DECORATOR: | |||||
| retval = ui_do_but_BUT(C, but, data, event); | retval = ui_do_but_BUT(C, but, data, event); | ||||
| break; | break; | ||||
| case UI_BTYPE_KEY_EVENT: | case UI_BTYPE_KEY_EVENT: | ||||
| retval = ui_do_but_KEYEVT(C, but, data, event); | retval = ui_do_but_KEYEVT(C, but, data, event); | ||||
| break; | break; | ||||
| case UI_BTYPE_HOTKEY_EVENT: | case UI_BTYPE_HOTKEY_EVENT: | ||||
| retval = ui_do_but_HOTKEYEVT(C, but, data, event); | retval = ui_do_but_HOTKEYEVT(C, but, data, event); | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 886 Lines • ▼ Show 20 Lines | while (region) { | ||||
| /* find active button */ | /* find active button */ | ||||
| activebut = NULL; | activebut = NULL; | ||||
| for (block = region->uiblocks.first; block; block = block->next) { | for (block = region->uiblocks.first; block; block = block->next) { | ||||
| for (but = block->buttons.first; but; but = but->next) { | for (but = block->buttons.first; but; but = but->next) { | ||||
| ui_but_anim_flag(but, (scene) ? scene->r.cfra : 0.0f); | ui_but_anim_flag(but, (scene) ? scene->r.cfra : 0.0f); | ||||
| ui_but_override_flag(but); | ui_but_override_flag(but); | ||||
| if (UI_but_is_decorator(but)) { | if (UI_but_is_decorator(but)) { | ||||
| ui_but_anim_decorate_update_from_flag(but); | ui_but_anim_decorate_update_from_flag((uiButDecorator *)but); | ||||
| } | } | ||||
| ED_region_tag_redraw(region); | ED_region_tag_redraw(region); | ||||
| if (but->active) { | if (but->active) { | ||||
| activebut = but; | activebut = but; | ||||
| } | } | ||||
| else if (!activebut && (but->flag & UI_BUT_LAST_ACTIVE)) { | else if (!activebut && (but->flag & UI_BUT_LAST_ACTIVE)) { | ||||
| ▲ Show 20 Lines • Show All 2,638 Lines • Show Last 20 Lines | |||||