[Bf-blender-cvs] [305fc82] master: UI: don't attempt to draw with the menu-key when only drawing right aligned
Campbell Barton
noreply at git.blender.org
Tue Dec 17 03:14:13 CET 2013
Commit: 305fc825419be427cff26d815eb60ee2cd7d736c
Author: Campbell Barton
Date: Tue Dec 17 13:11:31 2013 +1100
http://developer.blender.org/rB305fc825419be427cff26d815eb60ee2cd7d736c
UI: don't attempt to draw with the menu-key when only drawing right aligned
===================================================================
M source/blender/editors/interface/interface_widgets.c
===================================================================
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 685f2b1..9382a3b 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);
+ }
}
}
}
More information about the Bf-blender-cvs
mailing list