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
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2012-09-19 23:42:01 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2012-09-19 23:42:01 +0400
commit88010085074a4e5c3cfb7f56683b410bcafbba3b (patch)
treec0df8208e471badd5381bfaf16c3b1809987fd72 /source
parentf3d261d7956e0b18f2939707f6a21dadc06474f2 (diff)
Fixed "cleaning" of some menu labels (those with all the ugly %t/|), wasn't working in all cases.
Also cleaned some old, no more used piece of code.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/interface.c19
-rw-r--r--source/blender/editors/interface/interface_handlers.c9
2 files changed, 10 insertions, 18 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 7bef69c61ec..e343b1f9850 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -3790,15 +3790,16 @@ void uiButGetStrInfo(bContext *C, uiBut *but, int nbr, ...)
if (type == BUT_GET_LABEL) {
if (but->str) {
/* Menu labels can have some complex formating stuff marked by pipes or %t, we don't want those here! */
- const char *tc;
-
- if (but->type == MENU)
- tc = strstr(but->str, "%t");
- else
- tc = strchr(but->str, '|');
-
- if (tc)
- tmp = BLI_strdupn(but->str, tc - but->str);
+ const char *tc1, *tc2;
+
+ tc1 = strstr(but->str, "%t");
+ tc2 = strstr(but->str, "|"); /* XXX For some reason strchr seems to not work here? */
+
+ if (tc2 && (!tc1 || tc1 > tc2))
+ tc1 = tc2;
+
+ if (tc1)
+ tmp = BLI_strdupn(but->str, tc1 - but->str);
else
tmp = BLI_strdup(but->str);
}
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 6d9fdde3b0a..d370dfe1abf 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4513,17 +4513,8 @@ static int ui_but_menu(bContext *C, uiBut *but)
button_timers_tooltip_remove(C, but);
-#if 0
- if (but->rnaprop)
- name = RNA_property_ui_name(but->rnaprop);
- else if (but->optype && but->optype->srna)
- name = RNA_struct_ui_name(but->optype->srna);
- else
- name = IFACE_("<needs_name>"); // XXX - should never happen.
-#else
uiButGetStrInfo(C, but, 1, &label);
name = label.strinfo;
-#endif
pup = uiPupMenuBegin(C, name, ICON_NONE);
layout = uiPupMenuLayout(pup);