diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-12-17 06:11:31 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-12-17 06:11:31 +0400 |
commit | 305fc825419be427cff26d815eb60ee2cd7d736c (patch) | |
tree | d94b41521fbe9bb561aae768a2b33ae890cd4d2b /source | |
parent | d9634122f65b41fad0111cd505ecd2f0e003bda9 (diff) |
UI: don't attempt to draw with the menu-key when only drawing right aligned
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 685f2b160a7..9382a3b3a20 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1121,9 +1121,6 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b int drawstr_left_len = UI_MAX_DRAW_STR; char *drawstr_right = NULL; bool use_right_only = false; - - /* for underline drawing */ - float font_xofs, font_yofs; uiStyleFontSet(fstyle); @@ -1217,38 +1214,41 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b glColor4ubv((unsigned char *)wcol->text); if (!use_right_only) { + /* for underline drawing */ + float font_xofs, font_yofs; + uiStyleFontDrawExt(fstyle, rect, but->drawstr + but->ofs, drawstr_left_len - but->ofs, &font_xofs, &font_yofs); - } - if (but->menu_key != '\0') { - char fixedbuf[128]; - char *str; + if (but->menu_key != '\0') { + char fixedbuf[128]; + char *str; - BLI_strncpy(fixedbuf, but->drawstr + but->ofs, min_ii(sizeof(fixedbuf), drawstr_left_len)); + BLI_strncpy(fixedbuf, but->drawstr + but->ofs, min_ii(sizeof(fixedbuf), drawstr_left_len)); - str = strchr(fixedbuf, but->menu_key - 32); /* upper case */ - if (str == NULL) - str = strchr(fixedbuf, but->menu_key); + str = strchr(fixedbuf, but->menu_key - 32); /* upper case */ + if (str == NULL) + str = strchr(fixedbuf, but->menu_key); - if (str) { - int ul_index = -1; - float ul_advance; + if (str) { + int ul_index = -1; + float ul_advance; - ul_index = (int)(str - fixedbuf); + ul_index = (int)(str - fixedbuf); - if (fstyle->kerning == 1) { - BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT); - } + if (fstyle->kerning == 1) { + BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT); + } - fixedbuf[ul_index] = '\0'; - ul_advance = BLF_width(fstyle->uifont_id, fixedbuf, ul_index); + fixedbuf[ul_index] = '\0'; + ul_advance = BLF_width(fstyle->uifont_id, fixedbuf, ul_index); - BLF_position(fstyle->uifont_id, rect->xmin + font_xofs + ul_advance, rect->ymin + font_yofs, 0.0f); - BLF_draw(fstyle->uifont_id, "_", 2); + BLF_position(fstyle->uifont_id, rect->xmin + font_xofs + ul_advance, rect->ymin + font_yofs, 0.0f); + BLF_draw(fstyle->uifont_id, "_", 2); - if (fstyle->kerning == 1) { - BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT); + if (fstyle->kerning == 1) { + BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT); + } } } } |