Fix for T84038: Improved Report Warnings
Improved contrast for Status Bar report warning messages. Differential Revision: https://developer.blender.org/D10242 Reviewed by Hans Goudey
This commit is contained in:
parent
21a2b975b8
commit
694bc4d040
Notes:
blender-bot
2023-09-07 07:57:12 +02:00
Referenced by commit3f9a15bc30
, Fix #112052: Theme access asserts on startup Referenced by commit3059c3ee26
, UI: display a short pulse when displaying reports in the status bar
|
@ -489,16 +489,17 @@ const bTheme U_theme_default = {
|
|||
.facedot_size = 4,
|
||||
.info_selected = RGBA(0x3b5689ff),
|
||||
.info_selected_text = RGBA(0xffffffff),
|
||||
.info_error = RGBA(0xff613dff),
|
||||
.info_error = RGBA(0xb34c34ff),
|
||||
.info_error_text = RGBA(0xffffffff),
|
||||
.info_warning = RGBA(0xf5bc41ff),
|
||||
.info_warning = RGBA(0xac8737ff),
|
||||
.info_warning_text = RGBA(0xffffffff),
|
||||
.info_info = RGBA(0x1d4383ff),
|
||||
.info_info = RGBA(0x1f3862ff),
|
||||
.info_info_text = RGBA(0xffffffff),
|
||||
.info_debug = RGBA(0xd3d3d3ff),
|
||||
.info_property = RGBA(0x3ace87ff),
|
||||
.info_debug = RGBA(0x6b3293ff),
|
||||
.info_debug_text = RGBA(0xffffffff),
|
||||
.info_property = RGBA(0x329364ff),
|
||||
.info_property_text = RGBA(0xffffffff),
|
||||
.info_operator = RGBA(0x3ace87ff),
|
||||
.info_operator = RGBA(0x329364ff),
|
||||
.info_operator_text = RGBA(0xffffffff),
|
||||
},
|
||||
.space_action = {
|
||||
|
|
|
@ -1053,19 +1053,19 @@
|
|||
<info>
|
||||
<ThemeInfo
|
||||
info_selected="#6080ff"
|
||||
info_selected_text="#ffffff"
|
||||
info_error="#990000ff"
|
||||
info_error_text="#ffffff"
|
||||
info_warning="#b36a00ff"
|
||||
info_warning_text="#ffffff"
|
||||
info_info="#1d4383ff"
|
||||
info_info_text="#ffffff"
|
||||
info_debug="#d3d3d3ff"
|
||||
info_selected_text="#000000"
|
||||
info_error="#FF0038ff"
|
||||
info_error_text="#000000"
|
||||
info_warning="#FFE900ff"
|
||||
info_warning_text="#000000"
|
||||
info_info="#0068B3ff"
|
||||
info_info_text="#000000"
|
||||
info_debug="#B30095ff"
|
||||
info_debug_text="#000000"
|
||||
info_property="#3ace87ff"
|
||||
info_property_text="#ffffff"
|
||||
info_operator="#3ace87ff"
|
||||
info_operator_text="#ffffff"
|
||||
info_property="#44B300ff"
|
||||
info_property_text="#000000"
|
||||
info_operator="#44B300ff"
|
||||
info_operator_text="#000000"
|
||||
>
|
||||
<space>
|
||||
<ThemeSpaceGeneric
|
||||
|
|
|
@ -273,6 +273,15 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
|
|||
{
|
||||
/* Keep this block, even when empty. */
|
||||
FROM_DEFAULT_V4_UCHAR(space_properties.active);
|
||||
|
||||
FROM_DEFAULT_V4_UCHAR(space_info.info_error);
|
||||
FROM_DEFAULT_V4_UCHAR(space_info.info_warning);
|
||||
FROM_DEFAULT_V4_UCHAR(space_info.info_info);
|
||||
FROM_DEFAULT_V4_UCHAR(space_info.info_debug);
|
||||
FROM_DEFAULT_V4_UCHAR(space_info.info_debug_text);
|
||||
FROM_DEFAULT_V4_UCHAR(space_info.info_property);
|
||||
FROM_DEFAULT_V4_UCHAR(space_info.info_error);
|
||||
FROM_DEFAULT_V4_UCHAR(space_info.info_operator);
|
||||
}
|
||||
|
||||
#undef FROM_DEFAULT_V4_UCHAR
|
||||
|
|
|
@ -1413,6 +1413,8 @@ enum {
|
|||
|
||||
int UI_icon_from_id(struct ID *id);
|
||||
int UI_icon_from_report_type(int type);
|
||||
int UI_icon_colorid_from_report_type(int type);
|
||||
int UI_text_colorid_from_report_type(int type);
|
||||
|
||||
int UI_icon_from_event_type(short event_type, short event_value);
|
||||
int UI_icon_from_keymap_item(const struct wmKeyMapItem *kmi, int r_icon_mod[4]);
|
||||
|
|
|
@ -6831,18 +6831,32 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
|
|||
width = min_ii((int)(rti->widthfac * width), width);
|
||||
width = max_ii(width, 10 * UI_DPI_FAC);
|
||||
|
||||
/* make a box around the report to make it stand out */
|
||||
UI_block_align_begin(block);
|
||||
but = uiDefBut(
|
||||
block, UI_BTYPE_ROUNDBOX, 0, "", 0, 0, UI_UNIT_X + 5, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
|
||||
/* set the report's bg color in but->col - UI_BTYPE_ROUNDBOX feature */
|
||||
rgba_float_to_uchar(but->col, rti->col);
|
||||
|
||||
/* Background for icon. */
|
||||
but = uiDefBut(block,
|
||||
UI_BTYPE_ROUNDBOX,
|
||||
0,
|
||||
"",
|
||||
UI_UNIT_X + 5,
|
||||
0,
|
||||
0,
|
||||
UI_UNIT_X + (6 * UI_DPI_FAC),
|
||||
UI_UNIT_Y,
|
||||
NULL,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
/* UI_BTYPE_ROUNDBOX's bg color is set in but->col. */
|
||||
UI_GetThemeColorType4ubv(UI_icon_colorid_from_report_type(report->type), SPACE_INFO, but->col);
|
||||
|
||||
/* Background for the rest of the message. */
|
||||
but = uiDefBut(block,
|
||||
UI_BTYPE_ROUNDBOX,
|
||||
0,
|
||||
"",
|
||||
UI_UNIT_X + (6 * UI_DPI_FAC),
|
||||
0,
|
||||
UI_UNIT_X + width,
|
||||
UI_UNIT_Y,
|
||||
|
@ -6852,46 +6866,39 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
|
|||
0,
|
||||
0,
|
||||
"");
|
||||
rgba_float_to_uchar(but->col, rti->col);
|
||||
|
||||
/* Use icon background at low opacity to highlight, but still contrasting with area TH_TEXT. */
|
||||
UI_GetThemeColorType4ubv(UI_icon_colorid_from_report_type(report->type), SPACE_INFO, but->col);
|
||||
but->col[3] = 64;
|
||||
|
||||
UI_block_align_end(block);
|
||||
|
||||
/* icon and report message on top */
|
||||
const int icon = UI_icon_from_report_type(report->type);
|
||||
|
||||
/* XXX: temporary operator to dump all reports to a text block, but only if more than 1 report
|
||||
* to be shown instead of icon when appropriate...
|
||||
*/
|
||||
UI_block_emboss_set(block, UI_EMBOSS_NONE);
|
||||
|
||||
if (reports->list.first != reports->list.last) {
|
||||
uiDefIconButO(block,
|
||||
UI_BTYPE_BUT,
|
||||
"SCREEN_OT_info_log_show",
|
||||
WM_OP_INVOKE_REGION_WIN,
|
||||
icon,
|
||||
2,
|
||||
0,
|
||||
UI_UNIT_X,
|
||||
UI_UNIT_Y,
|
||||
TIP_("Click to see the remaining reports in text block: 'Recent Reports'"));
|
||||
}
|
||||
else {
|
||||
uiDefIconBut(
|
||||
block, UI_BTYPE_LABEL, 0, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
|
||||
}
|
||||
/* The report icon itself. */
|
||||
but = uiDefIconButO(block,
|
||||
UI_BTYPE_BUT,
|
||||
"SCREEN_OT_info_log_show",
|
||||
WM_OP_INVOKE_REGION_WIN,
|
||||
UI_icon_from_report_type(report->type),
|
||||
(3 * UI_DPI_FAC),
|
||||
0,
|
||||
UI_UNIT_X,
|
||||
UI_UNIT_Y,
|
||||
TIP_("Click to see the remaining reports in text block: 'Recent Reports'"));
|
||||
UI_GetThemeColorType4ubv(UI_text_colorid_from_report_type(report->type), SPACE_INFO, but->col);
|
||||
but->col[3] = 255; /* This theme color is RBG only, so have to set alpha here. */
|
||||
|
||||
/* The report message. */
|
||||
but = uiDefButO(block,
|
||||
UI_BTYPE_BUT,
|
||||
"SCREEN_OT_info_log_show",
|
||||
WM_OP_INVOKE_REGION_WIN,
|
||||
report->message,
|
||||
UI_UNIT_X + 5,
|
||||
UI_UNIT_X,
|
||||
0,
|
||||
UI_UNIT_X + width,
|
||||
width + UI_UNIT_X,
|
||||
UI_UNIT_Y,
|
||||
"Show in Info Log");
|
||||
rgba_float_to_uchar(but->col, rti->col);
|
||||
}
|
||||
|
||||
void uiTemplateInputStatus(uiLayout *layout, struct bContext *C)
|
||||
|
|
|
@ -544,15 +544,74 @@ int UI_icon_from_id(ID *id)
|
|||
int UI_icon_from_report_type(int type)
|
||||
{
|
||||
if (type & RPT_ERROR_ALL) {
|
||||
return ICON_CANCEL;
|
||||
}
|
||||
else if (type & RPT_WARNING_ALL) {
|
||||
return ICON_ERROR;
|
||||
}
|
||||
if (type & RPT_WARNING_ALL) {
|
||||
return ICON_ERROR;
|
||||
}
|
||||
if (type & RPT_INFO_ALL) {
|
||||
else if (type & RPT_INFO_ALL) {
|
||||
return ICON_INFO;
|
||||
}
|
||||
return ICON_NONE;
|
||||
else if (type & RPT_DEBUG_ALL) {
|
||||
return ICON_SYSTEM;
|
||||
}
|
||||
else if (type & RPT_PROPERTY) {
|
||||
return ICON_OPTIONS;
|
||||
}
|
||||
else if (type & RPT_OPERATOR) {
|
||||
return ICON_CHECKMARK;
|
||||
}
|
||||
return ICON_INFO;
|
||||
}
|
||||
|
||||
int UI_icon_colorid_from_report_type(int type)
|
||||
{
|
||||
if (type & RPT_ERROR_ALL) {
|
||||
return TH_INFO_ERROR;
|
||||
}
|
||||
else if (type & RPT_WARNING_ALL) {
|
||||
return TH_INFO_WARNING;
|
||||
}
|
||||
else if (type & RPT_INFO_ALL) {
|
||||
return TH_INFO_INFO;
|
||||
}
|
||||
else if (type & RPT_DEBUG_ALL) {
|
||||
return TH_INFO_DEBUG;
|
||||
}
|
||||
else if (type & RPT_PROPERTY) {
|
||||
return TH_INFO_PROPERTY;
|
||||
}
|
||||
else if (type & RPT_OPERATOR) {
|
||||
return TH_INFO_OPERATOR;
|
||||
}
|
||||
else {
|
||||
return TH_INFO_WARNING;
|
||||
}
|
||||
}
|
||||
|
||||
int UI_text_colorid_from_report_type(int type)
|
||||
{
|
||||
if (type & RPT_ERROR_ALL) {
|
||||
return TH_INFO_ERROR_TEXT;
|
||||
}
|
||||
else if (type & RPT_WARNING_ALL) {
|
||||
return TH_INFO_WARNING_TEXT;
|
||||
}
|
||||
else if (type & RPT_INFO_ALL) {
|
||||
return TH_INFO_INFO_TEXT;
|
||||
}
|
||||
else if (type & RPT_DEBUG_ALL) {
|
||||
return TH_INFO_DEBUG_TEXT;
|
||||
}
|
||||
else if (type & RPT_PROPERTY) {
|
||||
return TH_INFO_PROPERTY_TEXT;
|
||||
}
|
||||
else if (type & RPT_OPERATOR) {
|
||||
return TH_INFO_OPERATOR_TEXT;
|
||||
}
|
||||
else {
|
||||
return TH_INFO_WARNING_TEXT;
|
||||
}
|
||||
}
|
||||
|
||||
/********************************** Misc **************************************/
|
||||
|
|
|
@ -2410,7 +2410,9 @@ static void widget_draw_text_icon(const uiFontStyle *fstyle,
|
|||
rect->xmin += 0.2f * U.widget_unit;
|
||||
}
|
||||
|
||||
widget_draw_icon(but, icon, alpha, rect, wcol->text);
|
||||
/* By default icon is the color of text, but can optionally override with but->col. */
|
||||
widget_draw_icon(but, icon, alpha, rect, (but->col[3] != 0) ? but->col : wcol->text);
|
||||
|
||||
if (show_menu_icon) {
|
||||
BLI_assert(but->block->content_hints & UI_BLOCK_CONTAINS_SUBMENU_BUT);
|
||||
widget_draw_submenu_tria(but, rect, wcol);
|
||||
|
|
|
@ -56,47 +56,11 @@ static enum eTextViewContext_LineFlag report_line_data(TextViewContext *tvc,
|
|||
int shade = (tvc->iter_tmp % 2) ? 4 : -4;
|
||||
UI_GetThemeColorShade4ubv(bg_id, shade, bg);
|
||||
|
||||
/* Icon color and background depend of report type. */
|
||||
/* Don't show icon on subsequent rows of multirow report. */
|
||||
*r_icon = (tvc->iter_char_begin != 0) ? ICON_NONE : UI_icon_from_report_type(report->type);
|
||||
|
||||
int icon_fg_id;
|
||||
int icon_bg_id;
|
||||
|
||||
if (tvc->iter_char_begin != 0) {
|
||||
*r_icon = ICON_NONE;
|
||||
}
|
||||
else if (report->type & RPT_ERROR_ALL) {
|
||||
icon_fg_id = TH_INFO_ERROR_TEXT;
|
||||
icon_bg_id = TH_INFO_ERROR;
|
||||
*r_icon = ICON_CANCEL;
|
||||
}
|
||||
else if (report->type & RPT_WARNING_ALL) {
|
||||
icon_fg_id = TH_INFO_WARNING_TEXT;
|
||||
icon_bg_id = TH_INFO_WARNING;
|
||||
*r_icon = ICON_ERROR;
|
||||
}
|
||||
else if (report->type & RPT_INFO_ALL) {
|
||||
icon_fg_id = TH_INFO_INFO_TEXT;
|
||||
icon_bg_id = TH_INFO_INFO;
|
||||
*r_icon = ICON_INFO;
|
||||
}
|
||||
else if (report->type & RPT_DEBUG_ALL) {
|
||||
icon_fg_id = TH_INFO_DEBUG_TEXT;
|
||||
icon_bg_id = TH_INFO_DEBUG;
|
||||
*r_icon = ICON_SYSTEM;
|
||||
}
|
||||
else if (report->type & RPT_PROPERTY) {
|
||||
icon_fg_id = TH_INFO_PROPERTY_TEXT;
|
||||
icon_bg_id = TH_INFO_PROPERTY;
|
||||
*r_icon = ICON_OPTIONS;
|
||||
}
|
||||
else if (report->type & RPT_OPERATOR) {
|
||||
icon_fg_id = TH_INFO_OPERATOR_TEXT;
|
||||
icon_bg_id = TH_INFO_OPERATOR;
|
||||
*r_icon = ICON_CHECKMARK;
|
||||
}
|
||||
else {
|
||||
*r_icon = ICON_NONE;
|
||||
}
|
||||
int icon_fg_id = UI_text_colorid_from_report_type(report->type);
|
||||
int icon_bg_id = UI_icon_colorid_from_report_type(report->type);
|
||||
|
||||
if (report->flag & SELECT) {
|
||||
icon_fg_id = TH_INFO_SELECTED;
|
||||
|
@ -105,6 +69,8 @@ static enum eTextViewContext_LineFlag report_line_data(TextViewContext *tvc,
|
|||
|
||||
if (*r_icon != ICON_NONE) {
|
||||
UI_GetThemeColor4ubv(icon_fg_id, r_icon_fg);
|
||||
/* This theme color is RGB only, so set alpha. */
|
||||
r_icon_fg[3] = 255;
|
||||
UI_GetThemeColor4ubv(icon_bg_id, r_icon_bg);
|
||||
return TVC_LINE_FG | TVC_LINE_BG | TVC_LINE_ICON | TVC_LINE_ICON_FG | TVC_LINE_ICON_BG;
|
||||
}
|
||||
|
|
|
@ -567,15 +567,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), co
|
|||
}
|
||||
|
||||
/* set target color based on report type */
|
||||
if (report->type & RPT_ERROR_ALL) {
|
||||
UI_GetThemeColorType3fv(TH_INFO_ERROR, SPACE_INFO, target_col);
|
||||
}
|
||||
else if (report->type & RPT_WARNING_ALL) {
|
||||
UI_GetThemeColorType3fv(TH_INFO_WARNING, SPACE_INFO, target_col);
|
||||
}
|
||||
else if (report->type & RPT_INFO_ALL) {
|
||||
UI_GetThemeColorType3fv(TH_INFO_INFO, SPACE_INFO, target_col);
|
||||
}
|
||||
UI_GetThemeColorType3fv(UI_icon_colorid_from_report_type(report->type), SPACE_INFO, target_col);
|
||||
target_col[3] = 0.65f;
|
||||
|
||||
if (rti->widthfac == 0.0f) {
|
||||
|
|
|
@ -225,7 +225,7 @@ static bool textview_draw_string(TextViewDrawState *tds,
|
|||
|
||||
rgba_uchar_to_float(col, icon_bg);
|
||||
UI_draw_roundbox_corner_set(UI_CNR_ALL);
|
||||
UI_draw_roundbox_aa(
|
||||
UI_draw_roundbox_4fv(
|
||||
&(const rctf){
|
||||
.xmin = hpadding,
|
||||
.xmax = bg_size + hpadding,
|
||||
|
|
Loading…
Reference in New Issue