Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-10-21 20:50:55 +0300
committerHans Goudey <h.goudey@me.com>2021-10-21 20:52:08 +0300
commit3858bf5c6fb4b40f6dc09312372d79e797da3750 (patch)
tree810d4f34d8e9a2fcf74fa7a2f42d8aca5cc13963
parent7b9319adf90e1742873213abbcd9293c3c4c3749 (diff)
Cleanup: Use common define for menu separator arrow
-rw-r--r--source/blender/editors/include/UI_interface.h3
-rw-r--r--source/blender/editors/interface/interface_template_search_menu.c15
-rw-r--r--source/blender/editors/space_node/node_geometry_attribute_search.cc7
3 files changed, 10 insertions, 15 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index ed132422d3b..00e96955fb4 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -96,6 +96,9 @@ typedef struct uiTreeViewItemHandle uiTreeViewItemHandle;
#define UI_SEP_CHAR '|'
#define UI_SEP_CHAR_S "|"
+/* Separator for text in search menus. */
+#define UI_MENU_ARROW_SEP "▶"
+
/* names */
#define UI_MAX_DRAW_STR 400
#define UI_MAX_NAME_STR 128
diff --git a/source/blender/editors/interface/interface_template_search_menu.c b/source/blender/editors/interface/interface_template_search_menu.c
index f305199c6b0..5877b4fe6d7 100644
--- a/source/blender/editors/interface/interface_template_search_menu.c
+++ b/source/blender/editors/interface/interface_template_search_menu.c
@@ -69,9 +69,6 @@
/** \name Menu Search Template Implementation
* \{ */
-/* Unicode arrow. */
-#define MENU_SEP "\xe2\x96\xb6"
-
/**
* Use when #menu_items_from_ui_create is called with `include_all_areas`.
* so we can run the menu item in the area it was extracted from.
@@ -415,7 +412,7 @@ static void menu_items_from_all_operators(bContext *C, struct MenuSearch_Data *d
char uiname[256];
WM_operator_py_idname(idname_as_py, ot->idname);
- SNPRINTF(uiname, "%s " MENU_SEP "%s", idname_as_py, ot_ui_name);
+ SNPRINTF(uiname, "%s " UI_MENU_ARROW_SEP "%s", idname_as_py, ot_ui_name);
item->drawwstr_full = strdup_memarena(memarena, uiname);
item->drawstr = ot_ui_name;
@@ -841,7 +838,7 @@ static struct MenuSearch_Data *menu_items_from_ui_create(
}
while (menu_parent) {
BLI_dynstr_append(dyn_str, menu_parent->drawstr);
- BLI_dynstr_append(dyn_str, " " MENU_SEP " ");
+ BLI_dynstr_append(dyn_str, " " UI_MENU_ARROW_SEP " ");
menu_parent = menu_parent->temp_child;
}
}
@@ -859,13 +856,13 @@ static struct MenuSearch_Data *menu_items_from_ui_create(
BLI_dynstr_appendf(dyn_str, " (%s)", kmi_str);
}
- BLI_dynstr_append(dyn_str, " " MENU_SEP " ");
+ BLI_dynstr_append(dyn_str, " " UI_MENU_ARROW_SEP " ");
}
/* Optional nested menu. */
if (item->drawstr_submenu != NULL) {
BLI_dynstr_append(dyn_str, item->drawstr_submenu);
- BLI_dynstr_append(dyn_str, " " MENU_SEP " ");
+ BLI_dynstr_append(dyn_str, " " UI_MENU_ARROW_SEP " ");
}
BLI_dynstr_append(dyn_str, item->drawstr);
@@ -1160,7 +1157,7 @@ void UI_but_func_menu_search(uiBut *but)
UI_but_func_search_set_context_menu(but, ui_search_menu_create_context_menu);
UI_but_func_search_set_tooltip(but, ui_search_menu_create_tooltip);
- UI_but_func_search_set_sep_string(but, MENU_SEP);
+ UI_but_func_search_set_sep_string(but, UI_MENU_ARROW_SEP);
}
void uiTemplateMenuSearch(uiLayout *layout)
@@ -1177,6 +1174,4 @@ void uiTemplateMenuSearch(uiLayout *layout)
UI_but_func_menu_search(but);
}
-#undef MENU_SEP
-
/** \} */
diff --git a/source/blender/editors/space_node/node_geometry_attribute_search.cc b/source/blender/editors/space_node/node_geometry_attribute_search.cc
index 411719cf6c0..a69109db69c 100644
--- a/source/blender/editors/space_node/node_geometry_attribute_search.cc
+++ b/source/blender/editors/space_node/node_geometry_attribute_search.cc
@@ -74,14 +74,11 @@ static StringRef attribute_domain_string(const AttributeDomain domain)
return StringRef(IFACE_(name));
}
-/* Unicode arrow. */
-#define MENU_SEP "\xe2\x96\xb6"
-
static bool attribute_search_item_add(uiSearchItems *items, const GeometryAttributeInfo &item)
{
const StringRef data_type_name = attribute_data_type_string(item.data_type);
const StringRef domain_name = attribute_domain_string(item.domain);
- std::string search_item_text = domain_name + " " + MENU_SEP + item.name + UI_SEP_CHAR +
+ std::string search_item_text = domain_name + " " + UI_MENU_ARROW_SEP + item.name + UI_SEP_CHAR +
data_type_name;
return UI_search_item_add(
@@ -198,7 +195,7 @@ void node_geometry_add_attribute_search_button(const bContext *UNUSED(C),
AttributeSearchData, {node_tree, node, (bNodeSocket *)socket_ptr->data});
UI_but_func_search_set_results_are_suggestions(but, true);
- UI_but_func_search_set_sep_string(but, MENU_SEP);
+ UI_but_func_search_set_sep_string(but, UI_MENU_ARROW_SEP);
UI_but_func_search_set(but,
nullptr,
attribute_search_update_fn,