Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_handlers.c
| Show First 20 Lines • Show All 415 Lines • ▼ Show 20 Lines | if (but->func || but->funcN || block->handle_func || but->rename_func || | ||||
| } | } | ||||
| else | else | ||||
| after->func = but->func; | after->func = but->func; | ||||
| after->func_arg1 = but->func_arg1; | after->func_arg1 = but->func_arg1; | ||||
| after->func_arg2 = but->func_arg2; | after->func_arg2 = but->func_arg2; | ||||
| after->funcN = but->funcN; | after->funcN = but->funcN; | ||||
| after->func_argN = MEM_dupallocN(but->func_argN); | after->func_argN = (but->func_argN) ? MEM_dupallocN(but->func_argN) : NULL; | ||||
| after->rename_func = but->rename_func; | after->rename_func = but->rename_func; | ||||
| after->rename_arg1 = but->rename_arg1; | after->rename_arg1 = but->rename_arg1; | ||||
| after->rename_orig = but->rename_orig; /* needs free! */ | after->rename_orig = but->rename_orig; /* needs free! */ | ||||
| after->handle_func = block->handle_func; | after->handle_func = block->handle_func; | ||||
| after->handle_func_arg = block->handle_func_arg; | after->handle_func_arg = block->handle_func_arg; | ||||
| after->retval = but->retval; | after->retval = but->retval; | ||||
| ▲ Show 20 Lines • Show All 1,484 Lines • ▼ Show 20 Lines | if (len != 0) { | ||||
| changed = true; | changed = true; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return changed; | return changed; | ||||
| } | } | ||||
| static bool ui_textedit_autocomplete(bContext *C, uiBut *but, uiHandleButtonData *data) | static int ui_textedit_autocomplete(bContext *C, uiBut *but, uiHandleButtonData *data) | ||||
| { | { | ||||
| char *str; | char *str; | ||||
| bool changed = true; | int changed; | ||||
| str = data->str; | str = data->str; | ||||
| if (data->searchbox) | if (data->searchbox) | ||||
| changed = ui_searchbox_autocomplete(C, data->searchbox, but, data->str); | changed = ui_searchbox_autocomplete(C, data->searchbox, but, data->str); | ||||
| else | else | ||||
| changed = but->autocomplete_func(C, str, but->autofunc_arg); | changed = but->autocomplete_func(C, str, but->autofunc_arg); | ||||
| ▲ Show 20 Lines • Show All 390 Lines • ▼ Show 20 Lines | #endif | ||||
| true, STRCUR_JUMP_ALL); | true, STRCUR_JUMP_ALL); | ||||
| retval = WM_UI_HANDLER_BREAK; | retval = WM_UI_HANDLER_BREAK; | ||||
| } | } | ||||
| break; | break; | ||||
| case TABKEY: | case TABKEY: | ||||
| /* there is a key conflict here, we can't tab with autocomplete */ | /* there is a key conflict here, we can't tab with autocomplete */ | ||||
| if (but->autocomplete_func || data->searchbox) { | if (but->autocomplete_func || data->searchbox) { | ||||
| changed = ui_textedit_autocomplete(C, but, data); | int autocomplete = ui_textedit_autocomplete(C, but, data); | ||||
| changed = autocomplete != AUTOCOMPLETE_NO_MATCH; | |||||
| if(autocomplete == AUTOCOMPLETE_FULL_MATCH) | |||||
| button_activate_state(C, but, BUTTON_STATE_EXIT); | |||||
| update = true; /* do live update for tab key */ | update = true; /* do live update for tab key */ | ||||
brecht: Note to self, this part of the code is also potentially unfinished. | |||||
| } | } | ||||
| /* the hotkey here is not well defined, was G.qual so we check all */ | /* the hotkey here is not well defined, was G.qual so we check all */ | ||||
| else if (event->shift || event->ctrl || event->alt || event->oskey) { | else if (event->shift || event->ctrl || event->alt || event->oskey) { | ||||
| ui_textedit_prev_but(block, but, data); | ui_textedit_prev_but(block, but, data); | ||||
| button_activate_state(C, but, BUTTON_STATE_EXIT); | button_activate_state(C, but, BUTTON_STATE_EXIT); | ||||
| } | } | ||||
| else { | else { | ||||
| ui_textedit_next_but(block, but, data); | ui_textedit_next_but(block, but, data); | ||||
| ▲ Show 20 Lines • Show All 5,683 Lines • ▼ Show 20 Lines | void UI_remove_popup_handlers(ListBase *handlers, uiPopupBlockHandle *popup) | ||||
| WM_event_remove_ui_handler(handlers, ui_handler_popup, ui_handler_remove_popup, popup, FALSE); | WM_event_remove_ui_handler(handlers, ui_handler_popup, ui_handler_remove_popup, popup, FALSE); | ||||
| } | } | ||||
| void UI_remove_popup_handlers_all(bContext *C, ListBase *handlers) | void UI_remove_popup_handlers_all(bContext *C, ListBase *handlers) | ||||
| { | { | ||||
| WM_event_free_ui_handler_all(C, handlers, ui_handler_popup, ui_handler_remove_popup); | WM_event_free_ui_handler_all(C, handlers, ui_handler_popup, ui_handler_remove_popup); | ||||
| } | } | ||||
| bool UI_textbutton_activate_event(const bContext *C, ARegion *ar, | bool UI_textbutton_activate_rna(const bContext *C, ARegion *ar, | ||||
| const void *rna_poin_data, const char *rna_prop_id) | const void *rna_poin_data, const char *rna_prop_id) | ||||
| { | { | ||||
| uiBlock *block; | uiBlock *block; | ||||
| uiBut *but = NULL; | uiBut *but = NULL; | ||||
| for (block = ar->uiblocks.first; block; block = block->next) { | for (block = ar->uiblocks.first; block; block = block->next) { | ||||
| for (but = block->buttons.first; but; but = but->next) { | for (but = block->buttons.first; but; but = but->next) { | ||||
| if (but->type == TEX) { | if (but->type == TEX) { | ||||
| if (but->rnaprop && but->rnapoin.data == rna_poin_data) { | if (but->rnaprop && but->rnapoin.data == rna_poin_data) { | ||||
| Show All 11 Lines | if (but) { | ||||
| uiButActiveOnly(C, ar, block, but); | uiButActiveOnly(C, ar, block, but); | ||||
| return true; | return true; | ||||
| } | } | ||||
| else { | else { | ||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| bool UI_textbutton_activate_but(const bContext *C, uiBut *actbut) | |||||
| { | |||||
| ARegion *ar = CTX_wm_region(C); | |||||
| uiBlock *block; | |||||
| uiBut *but = NULL; | |||||
| for (block = ar->uiblocks.first; block; block = block->next) { | |||||
| for (but = block->buttons.first; but; but = but->next) | |||||
| if (but == actbut && but->type == TEX) | |||||
| break; | |||||
| if (but) | |||||
| break; | |||||
| } | |||||
| if (but) { | |||||
| uiButActiveOnly(C, ar, block, but); | |||||
| return true; | |||||
| } | |||||
| else { | |||||
| return false; | |||||
| } | |||||
| } | |||||
| void ui_button_clipboard_free(void) | void ui_button_clipboard_free(void) | ||||
| { | { | ||||
| curvemapping_free_data(&but_copypaste_curve); | curvemapping_free_data(&but_copypaste_curve); | ||||
| } | } | ||||
Note to self, this part of the code is also potentially unfinished.