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 | |
parent | 74c01afe228322137b8c1a813452d185028d4c8f (diff) |
Cleanup: split search menu separator argument into own function
Diffstat (limited to 'source')
8 files changed, 17 insertions, 22 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index d56771e5445..4f010156c17 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -1572,15 +1572,15 @@ eAutoPropButsReturn uiDefAutoButsRNA(uiLayout *layout, /* use inside searchfunc to add items */ bool UI_search_item_add(uiSearchItems *items, const char *name, void *poin, int iconid, int state); -/* bfunc gets search item *poin as arg2, or if NULL the old string */ void UI_but_func_search_set(uiBut *but, uiButSearchCreateFn search_create_fn, uiButSearchUpdateFn search_update_fn, void *arg, uiButSearchArgFreeFn search_arg_free_fn, - uiButHandleFunc bfunc, - const char *search_sep_string, + uiButHandleFunc handle_fn, void *active); +void UI_but_func_search_set_sep_string(uiBut *but, const char *search_sep_string); + /* height in pixels, it's using hardcoded values still */ int UI_searchbox_size_y(void); int UI_searchbox_size_x(void); 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); diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index c55b5510caf..53938ff4d41 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -1182,7 +1182,7 @@ static uiBlock *node_find_menu(bContext *C, ARegion *region, void *arg_op) 0, 0, ""); - UI_but_func_search_set(but, NULL, node_find_cb, op->type, NULL, node_find_call_cb, NULL, NULL); + UI_but_func_search_set(but, NULL, node_find_cb, op->type, NULL, node_find_call_cb, NULL); UI_but_flag_enable(but, UI_BUT_ACTIVATE_ON_INIT); /* fake button, it holds space for search items */ diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 172d64c9c67..e4449d21405 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -600,7 +600,7 @@ static uiBlock *merged_element_search_menu(bContext *C, ARegion *region, void *d but = uiDefSearchBut( block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, menu_width, UI_UNIT_Y, 0, 0, ""); UI_but_func_search_set( - but, NULL, merged_element_search_cb, data, NULL, merged_element_search_call_cb, NULL, NULL); + but, NULL, merged_element_search_cb, data, NULL, merged_element_search_call_cb, NULL); UI_but_flag_enable(but, UI_BUT_ACTIVATE_ON_INIT); /* Fake button to hold space for search items */ |