diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2021-02-08 19:19:23 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2021-02-08 19:19:23 +0300 |
commit | 694bc4d040a8bf762284598e98bf0575549a3e1c (patch) | |
tree | 0e4d95baac18731e0ab5a135acf5eff6f8b53432 /source/blender/editors/interface/interface_templates.c | |
parent | 21a2b975b8192c2714625c8f5e98a08fde796ba7 (diff) |
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
Diffstat (limited to 'source/blender/editors/interface/interface_templates.c')
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 73 |
1 files changed, 40 insertions, 33 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index cf0c1444d4d..dad8253d101 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -6831,20 +6831,16 @@ 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, - UI_UNIT_X + width, + 0, + UI_UNIT_X + (6 * UI_DPI_FAC), UI_UNIT_Y, NULL, 0.0f, @@ -6852,46 +6848,57 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) 0, 0, ""); - rgba_float_to_uchar(but->col, rti->col); + /* 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); - UI_block_align_end(block); + /* 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, + NULL, + 0.0f, + 0.0f, + 0, + 0, + ""); - /* icon and report message on top */ - const int icon = UI_icon_from_report_type(report->type); + /* 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; - /* 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_align_end(block); 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) |