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:
authorNicholas Bishop <nicholasbishop@gmail.com>2012-02-29 00:46:55 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2012-02-29 00:46:55 +0400
commit4f884e21b2ca05fb13f7e675d81f3a07c14f3a67 (patch)
tree8d1e1a25bef39de3beb68a857433b7bf34c6b72b /source/blender/editors/interface/interface_widgets.c
parentd309aa2d9acc6758ab9671bfc8b780c85750be94 (diff)
Add solid background behind text in search menu.
This fixes the issue of text being hard to read due to (e.g.) black text on a dark icon. Example: http://www.pasteall.org/pic/show.php?id=27401 Reviewed by Brecht: http://codereview.appspot.com/5699098/
Diffstat (limited to 'source/blender/editors/interface/interface_widgets.c')
-rw-r--r--source/blender/editors/interface/interface_widgets.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 8f5c08236cf..419f13254e6 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -3276,20 +3276,16 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic
void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state)
{
- rcti trect = *rect;
+ rcti trect = *rect, bg_rect;
float font_dims[2] = {0.0f, 0.0f};
uiWidgetType *wt= widget_type(UI_WTYPE_MENU_ITEM);
+ unsigned char bg_col[3];
wt->state(wt, state);
wt->draw(&wt->wcol, rect, 0, 0);
widget_draw_preview(iconid, 1.0f, rect);
- if (state == UI_ACTIVE)
- glColor3ubv((unsigned char*)wt->wcol.text);
- else
- glColor3ubv((unsigned char*)wt->wcol.text_sel);
-
BLF_width_and_height(fstyle->uifont_id, name, &font_dims[0], &font_dims[1]);
/* text rect */
@@ -3300,5 +3296,23 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int
if(trect.xmax > rect->xmax - PREVIEW_PAD)
trect.xmax = rect->xmax - PREVIEW_PAD;
+ bg_rect = trect;
+ bg_rect.xmin = rect->xmin + PREVIEW_PAD;
+ bg_rect.ymin = rect->ymin + PREVIEW_PAD;
+ bg_rect.xmax += PREVIEW_PAD / 2;
+ bg_rect.ymax += PREVIEW_PAD / 2;
+
+ if(bg_rect.xmax > rect->xmax - PREVIEW_PAD)
+ bg_rect.xmax = rect->xmax - PREVIEW_PAD;
+
+ UI_GetThemeColor3ubv(TH_BUTBACK, bg_col);
+ glColor3ubv(bg_col);
+ glRecti(bg_rect.xmin, bg_rect.ymin, bg_rect.xmax, bg_rect.ymax);
+
+ if (state == UI_ACTIVE)
+ glColor3ubv((unsigned char*)wt->wcol.text);
+ else
+ glColor3ubv((unsigned char*)wt->wcol.text_sel);
+
uiStyleFontDraw(fstyle, &trect, name);
}