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:
authorCampbell Barton <ideasman42@gmail.com>2014-05-01 06:40:49 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-05-01 06:40:49 +0400
commit4849ca8a567dd6c5d198355f94740c9f19fa5a7c (patch)
tree2c649b87a7b9a1b9cd7c09612d730dfcbb8c4355 /source
parent7b0bce19468cf83f1198145a9c6b1408b04f91a1 (diff)
Fix T39884: Displaying filenames with '|' failing in menus
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/include/UI_interface.h1
-rw-r--r--source/blender/editors/interface/interface.c6
-rw-r--r--source/blender/editors/interface/interface_handlers.c8
-rw-r--r--source/blender/editors/interface/interface_regions.c6
-rw-r--r--source/blender/editors/interface/interface_widgets.c4
5 files changed, 18 insertions, 7 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 32db99ff860..8de9650ddef 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -174,6 +174,7 @@ enum {
UI_BUT_LIST_ITEM = (1 << 24), /* This but is "inside" a list item (currently used to change theme colors). */
UI_BUT_DRAG_MULTI = (1 << 25), /* edit this button as well as the active button (not just dragging) */
UI_BUT_SCA_LINK_GREY = (1 << 26), /* used to flag if sca links shoud be grey out */
+ UI_BUT_HAS_SEP_CHAR = (1 << 27), /* but->str contains UI_SEP_CHAR, used for key shortcuts */
};
#define UI_PANEL_WIDTH 340
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 16f88bb8add..3da6b5d8e23 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -886,11 +886,12 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
void ui_but_add_shortcut(uiBut *but, const char *shortcut_str, const bool do_strip)
{
- if (do_strip) {
- char *cpoin = strchr(but->str, UI_SEP_CHAR);
+ if (do_strip && (but->flag & UI_BUT_HAS_SEP_CHAR)) {
+ char *cpoin = strrchr(but->str, UI_SEP_CHAR);
if (cpoin) {
*cpoin = '\0';
}
+ but->flag &= ~UI_BUT_HAS_SEP_CHAR;
}
/* without this, just allow stripping of the shortcut */
@@ -909,6 +910,7 @@ void ui_but_add_shortcut(uiBut *but, const char *shortcut_str, const bool do_str
butstr_orig, shortcut_str);
MEM_freeN(butstr_orig);
but->str = but->strdata;
+ but->flag |= UI_BUT_HAS_SEP_CHAR;
ui_check_but(but);
}
}
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index a1f1d356b9d..4c02346d545 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -5586,6 +5586,14 @@ void ui_panel_menu(bContext *C, ARegion *ar, Panel *pa)
char tmpstr[80];
BLI_snprintf(tmpstr, sizeof(tmpstr), "%s" UI_SEP_CHAR_S "%s", IFACE_("Pin"), IFACE_("Shift+Left Mouse"));
uiItemR(layout, &ptr, "use_pin", 0, tmpstr, ICON_NONE);
+
+ /* evil, force shortcut flag */
+ {
+ uiBlock *block = uiLayoutGetBlock(layout);
+ uiBut *but = block->buttons.last;
+ but->flag |= UI_BUT_HAS_SEP_CHAR;
+ }
+
}
uiPupMenuEnd(C, pup);
}
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 4a88ac22a22..ce807274815 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -767,7 +767,7 @@ bool ui_searchbox_apply(uiBut *but, ARegion *ar)
if (data->active != -1) {
const char *name = data->items.names[data->active];
- const char *name_sep = data->use_sep ? strchr(name, UI_SEP_CHAR) : NULL;
+ const char *name_sep = data->use_sep ? strrchr(name, UI_SEP_CHAR) : NULL;
BLI_strncpy(but->editstr, name, name_sep ? (name_sep - name) : data->items.maxstrlen);
@@ -873,7 +873,7 @@ void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, const bool reset)
for (a = 0; a < data->items.totitem; a++) {
const char *name = data->items.names[a];
- const char *name_sep = data->use_sep ? strchr(name, UI_SEP_CHAR) : NULL;
+ const char *name_sep = data->use_sep ? strrchr(name, UI_SEP_CHAR) : NULL;
if (STREQLEN(but->editstr, name, name_sep ? (name_sep - name) : data->items.maxstrlen)) {
data->active = a;
break;
@@ -2086,7 +2086,7 @@ static unsigned int ui_popup_string_hash(const char *str)
{
/* sometimes button contains hotkey, sometimes not, strip for proper compare */
int hash;
- const char *delimit = strchr(str, UI_SEP_CHAR);
+ const char *delimit = strrchr(str, UI_SEP_CHAR);
if (delimit) {
hash = BLI_ghashutil_strhash_n(str, delimit - str);
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index c9bff1acffc..9c5b160d637 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1284,8 +1284,8 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
/* cut string in 2 parts - only for menu entries */
if ((but->block->flag & UI_BLOCK_LOOP)) {
- if (ELEM3(but->type, NUM, TEX, NUMSLI) == 0) {
- drawstr_right = strchr(drawstr, UI_SEP_CHAR);
+ if (but->flag & UI_BUT_HAS_SEP_CHAR) {
+ drawstr_right = strrchr(drawstr, UI_SEP_CHAR);
if (drawstr_right) {
drawstr_left_len = (drawstr_right - drawstr);
drawstr_right++;