diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-05-07 16:16:16 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-05-07 16:32:14 +0300 |
commit | daf10d17f46c933341be12bc9a9baf359d3280f7 (patch) | |
tree | 6a0d1eb6453d5d9e686e2833025b4bfc6399ce14 /source/blender/editors/interface | |
parent | 74c01afe228322137b8c1a813452d185028d4c8f (diff) |
Cleanup: split search menu separator argument into own function
Diffstat (limited to 'source/blender/editors/interface')
5 files changed, 12 insertions, 17 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 13033af6c97..5c38ee1ee08 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -6362,8 +6362,7 @@ void UI_but_func_search_set(uiBut *but, uiButSearchUpdateFn search_update_fn, void *arg, uiButSearchArgFreeFn search_arg_free_fn, - uiButHandleFunc bfunc, - const char *search_sep_string, + uiButHandleFunc handle_fn, void *active) { /* needed since callers don't have access to internal functions @@ -6389,9 +6388,8 @@ void UI_but_func_search_set(uiBut *but, search->arg = arg; search->arg_free_fn = search_arg_free_fn; - search->sep_string = search_sep_string; - if (bfunc) { + if (handle_fn) { #ifdef DEBUG if (but->func) { /* watch this, can be cause of much confusion, see: T47691 */ @@ -6399,7 +6397,7 @@ void UI_but_func_search_set(uiBut *but, __func__); } #endif - UI_but_func_set(but, bfunc, arg, active); + UI_but_func_set(but, handle_fn, search->arg, active); } /* search buttons show red-alert if item doesn't exist, not for menus */ @@ -6411,6 +6409,12 @@ void UI_but_func_search_set(uiBut *but, } } +void UI_but_func_search_set_sep_string(uiBut *but, const char *search_sep_string) +{ + struct uiButSearchData *search = but->search; + search->sep_string = search_sep_string; +} + /* Callbacks for operator search button. */ static void operator_enum_search_cb(const struct bContext *C, void *but, @@ -6499,7 +6503,6 @@ uiBut *uiDefSearchButO_ptr(uiBlock *block, but, NULL, operator_enum_call_cb, - NULL, NULL); but->optype = ot; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 650f343e7dc..2ed6a87840b 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -2701,7 +2701,6 @@ void ui_but_add_search( coll_search, ui_rna_collection_search_free_cb, NULL, - NULL, NULL); } else if (but->type == UI_BTYPE_SEARCH_MENU) { diff --git a/source/blender/editors/interface/interface_template_search_menu.c b/source/blender/editors/interface/interface_template_search_menu.c index 451f426cd71..1e8d32abf67 100644 --- a/source/blender/editors/interface/interface_template_search_menu.c +++ b/source/blender/editors/interface/interface_template_search_menu.c @@ -915,8 +915,8 @@ void UI_but_func_menu_search(uiBut *but) data, menu_items_from_ui_destroy, menu_call_fn, - MENU_SEP, NULL); + UI_but_func_search_set_sep_string(but, MENU_SEP); } void uiTemplateMenuSearch(uiLayout *layout) diff --git a/source/blender/editors/interface/interface_template_search_operator.c b/source/blender/editors/interface/interface_template_search_operator.c index a6fddc8db5a..975ee5fe43d 100644 --- a/source/blender/editors/interface/interface_template_search_operator.c +++ b/source/blender/editors/interface/interface_template_search_operator.c @@ -125,14 +125,8 @@ static void operator_search_cb(const bContext *C, void UI_but_func_operator_search(uiBut *but) { - UI_but_func_search_set(but, - ui_searchbox_create_operator, - operator_search_cb, - NULL, - false, - operator_call_cb, - NULL, - NULL); + UI_but_func_search_set( + but, ui_searchbox_create_operator, operator_search_cb, NULL, false, operator_call_cb, NULL); } void uiTemplateOperatorSearch(uiLayout *layout) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 6b8154816d5..08e077f4cfe 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -283,7 +283,6 @@ static uiBlock *template_common_search_menu(const bContext *C, search_arg, NULL, handle_func, - NULL, active_item); UI_block_bounds_set_normal(block, 0.3f * U.widget_unit); |