Index: release/scripts/startup/bl_ui/space_userpref.py =================================================================== --- release/scripts/startup/bl_ui/space_userpref.py (revision 45048) +++ release/scripts/startup/bl_ui/space_userpref.py (working copy) @@ -627,6 +627,10 @@ ui = theme.user_interface.wcol_menu_back col.label(text="Menu Back:") ui_items_general(col, ui) + + ui = theme.user_interface.wcol_tooltip + col.label(text="Tooltip:") + ui_items_general(col, ui) ui = theme.user_interface.wcol_tooltip col.label(text="Tooltip:") Index: source/blender/editors/interface/resources.c =================================================================== --- source/blender/editors/interface/resources.c (revision 45048) +++ source/blender/editors/interface/resources.c (working copy) @@ -1745,6 +1745,7 @@ for(btheme= U.themes.first; btheme; btheme= btheme->next) { if (btheme->tui.wcol_tooltip.inner[3] == 0) { btheme->tui.wcol_tooltip = btheme->tui.wcol_menu_back; + rgba_char_args_set(btheme->tui.wcol_tooltip.text, 255, 255, 255, 255); } } } Index: source/blender/editors/interface/interface_intern.h =================================================================== --- source/blender/editors/interface/interface_intern.h (revision 45048) +++ source/blender/editors/interface/interface_intern.h (working copy) @@ -466,7 +466,8 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3); void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float maxy, float rad); void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect); -void ui_draw_tooltip(uiStyle *UNUSED(style), uiBlock *block, rcti *rect); +uiWidgetColors* ui_tooltip_get_theme(void); +void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock *block, rcti *rect); void ui_draw_search_back(struct uiStyle *style, uiBlock *block, rcti *rect); int ui_link_bezier_points(rcti *rect, float coord_array[][2], int resol); void ui_draw_link_bezier(rcti *rect); Index: source/blender/editors/interface/interface_regions.c =================================================================== --- source/blender/editors/interface/interface_regions.c (revision 45048) +++ source/blender/editors/interface/interface_regions.c (working copy) @@ -308,13 +308,28 @@ /************************* Creating Tooltips **********************/ +typedef enum{ + UI_TIP_LC_NORMAL, + UI_TIP_LC_PYTHON, + UI_TIP_LC_ALERT, + UI_TIP_LC_HIGHLIGHT +} uiTooltipLineColour; + #define MAX_TOOLTIP_LINES 8 - typedef struct uiTooltipData { rcti bbox; uiFontStyle fstyle; char lines[MAX_TOOLTIP_LINES][512]; - unsigned int color[MAX_TOOLTIP_LINES]; + /*line_brightness + full brightness = 1 was 0xFFFFFF + 3/4 brightness = 2 was 0xDDDDDD + 1/2 brightness = 3 was 0x888888 + 1/4 brightness = 4 + - alert - = 0 was 0x6666ff + using this instead of assigning actual colors because theme + colors are contained within interface_widgets rather than interface_regions + which is where these values are assigned*/ + uiTooltipLineColour line_brightness[MAX_TOOLTIP_LINES]; int totline; int toth, spaceh, lineh; } uiTooltipData; @@ -322,23 +337,55 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) { uiTooltipData *data= ar->regiondata; + uiWidgetColors* theme = ui_tooltip_get_theme(); rcti bbox= data->bbox; - int a; + char alert_colour[4] = {102, 102, 255, 255}; + char normal_colour[4]; + char highlight_colour[4]; + char python_colour[4]; + int a, i; - ui_draw_tooltip(UI_GetStyle(), NULL, &data->bbox); - - /* draw text */ - uiStyleFontSet(&data->fstyle); + /*draw background*/ + ui_draw_tooltip_background(UI_GetStyle(), NULL, &bbox); + + /*calculate bright_colour*/ + for(i=0;i<4;i++){ + normal_colour[i] = theme->text[i]; + } + /*calculate medium colour*/ + for(i=0;i<4;i++){ + highlight_colour[i] = (int)(((float)normal_colour[i]) * 0.86666); + } + /*calculate dark_clolour*/ + for(i=0;i<4;i++){ + python_colour[i] = (int)(((float)normal_colour[i]) * 0.53333); + } + + /* draw text */ + uiStyleFontSet(&data->fstyle); - bbox.ymax= bbox.ymax - 0.5f*((bbox.ymax - bbox.ymin) - data->toth); - bbox.ymin= bbox.ymax - data->lineh; + bbox.ymax= bbox.ymax - 0.5f*((bbox.ymax - bbox.ymin) - data->toth); + bbox.ymin= bbox.ymax - data->lineh; - for(a=0; atotline; a++) { - cpack(data->color[a]); + for(a=0; atotline; a++) { + switch(data->line_brightness[a]){ + case UI_TIP_LC_ALERT: + glColor3ubv((unsigned char*)alert_colour); + break; + case UI_TIP_LC_NORMAL: + glColor3ubv((unsigned char*)normal_colour); + break; + case UI_TIP_LC_HIGHLIGHT: + glColor3ubv((unsigned char*)highlight_colour); + break; + case UI_TIP_LC_PYTHON: + glColor3ubv((unsigned char*)python_colour); + break; + } uiStyleFontDraw(&data->fstyle, &bbox, data->lines[a]); bbox.ymin -= data->lineh + data->spaceh; bbox.ymax -= data->lineh + data->spaceh; - } + } } static void ui_tooltip_region_free_cb(ARegion *ar) @@ -373,7 +420,8 @@ const char *descr= RNA_property_description(but->rnaprop); if(descr && descr[0]) { BLI_strncpy(data->lines[data->totline], descr, sizeof(data->lines[0])); - data->color[data->totline]= 0xFFFFFF; + /*light text*/ + data->line_brightness[data->totline]= UI_TIP_LC_NORMAL; data->totline++; } @@ -388,7 +436,8 @@ if(item[i].identifier[0] && item[i].value == value) { if(item[i].description && item[i].description[0]) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "%s: %s", item[i].name, item[i].description); - data->color[data->totline]= 0xDDDDDD; + /*dark text*/ + data->line_brightness[data->totline]= UI_TIP_LC_ALERT; data->totline++; } break; @@ -403,7 +452,7 @@ if(but->tip && but->tip[0] != '\0') { BLI_strncpy(data->lines[data->totline], but->tip, sizeof(data->lines[0])); - data->color[data->totline]= 0xFFFFFF; + data->line_brightness[data->totline]= UI_TIP_LC_NORMAL; data->totline++; } @@ -415,7 +464,7 @@ buf, sizeof(buf))) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Shortcut: %s"), buf); - data->color[data->totline]= 0x888888; + data->line_brightness[data->totline]= UI_TIP_LC_PYTHON; data->totline++; } } @@ -425,7 +474,7 @@ ui_get_but_string(but, buf, sizeof(buf)); if(buf[0]) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Value: %s"), buf); - data->color[data->totline]= 0x888888; + data->line_brightness[data->totline]= UI_TIP_LC_PYTHON; data->totline++; } } @@ -437,7 +486,7 @@ if (RNA_property_type(but->rnaprop) == PROP_FLOAT) { float value= RNA_property_array_check(but->rnaprop) ? RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex) : RNA_property_float_get(&but->rnapoin, but->rnaprop); BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Radians: %f"), value); - data->color[data->totline]= 0x888888; + data->line_brightness[data->totline]= UI_TIP_LC_PYTHON; data->totline++; } } @@ -446,7 +495,7 @@ if(ui_but_anim_expression_get(but, buf, sizeof(buf))) { /* expression */ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Expression: %s"), buf); - data->color[data->totline]= 0x888888; + data->line_brightness[data->totline]= UI_TIP_LC_PYTHON; data->totline++; } } @@ -454,7 +503,7 @@ /* rna info */ if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s.%s"), RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); - data->color[data->totline]= 0x888888; + data->line_brightness[data->totline]= UI_TIP_LC_PYTHON; data->totline++; } @@ -462,7 +511,7 @@ ID *id= but->rnapoin.id.data; if(id->lib && id->lib->name) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Library: %s"), id->lib->name); - data->color[data->totline]= 0x888888; + data->line_brightness[data->totline]= UI_TIP_LC_PYTHON; data->totline++; } } @@ -477,7 +526,7 @@ /* operator info */ if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s"), str); - data->color[data->totline]= 0x888888; + data->line_brightness[data->totline]= UI_TIP_LC_PYTHON; data->totline++; } @@ -491,7 +540,7 @@ poll_msg= CTX_wm_operator_poll_msg_get(C); if(poll_msg) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Disabled: %s"), poll_msg); - data->color[data->totline]= 0x6666ff; /* alert */ + data->line_brightness[data->totline]= UI_TIP_LC_ALERT; /* alert */ data->totline++; } } @@ -501,7 +550,7 @@ MenuType *mt= uiButGetMenuType(but); if (mt) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s"), mt->idname); - data->color[data->totline]= 0x888888; + data->line_brightness[data->totline]= UI_TIP_LC_PYTHON; data->totline++; } } Index: source/blender/editors/interface/interface_widgets.c =================================================================== --- source/blender/editors/interface/interface_widgets.c (revision 45057) +++ source/blender/editors/interface/interface_widgets.c (working copy) @@ -3226,7 +3226,12 @@ } } -void ui_draw_tooltip(uiStyle *UNUSED(style), uiBlock *UNUSED(block), rcti *rect) +uiWidgetColors* ui_tooltip_get_theme(void){ + uiWidgetType *wt = widget_type(UI_WTYPE_TOOLTIP); + return wt->wcol_theme; +} + +void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock *UNUSED(block), rcti *rect) { uiWidgetType *wt = widget_type(UI_WTYPE_TOOLTIP); wt->state(wt, 0);