diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-04-26 22:17:33 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-04-26 22:18:27 +0300 |
commit | 226c757b4400b9b423b691a4309f6daf56f775c7 (patch) | |
tree | 4e2afc3c68686a73864a7868751676af5ca60db8 /source/blender | |
parent | 918359269824a081c5e5819c44bc8461f59ebd37 (diff) |
UI: add darker theme color for toolbar items
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 31 | ||||
-rw-r--r-- | source/blender/editors/interface/resources.c | 21 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 5 |
5 files changed, 59 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index f7f30b00a49..8353a17a359 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -72,6 +72,7 @@ typedef enum { UI_WTYPE_NUMBER, UI_WTYPE_SLIDER, UI_WTYPE_EXEC, + UI_WTYPE_TOOLBAR_ITEM, UI_WTYPE_TAB, UI_WTYPE_TOOLTIP, diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 1ce4941554c..10e4b03acef 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -2317,6 +2317,22 @@ static struct uiWidgetColors wcol_tool = { 0.2f, }; +static struct uiWidgetColors wcol_toolbar_item = { + .outline = {0x19, 0x19, 0x19, 0xff}, + .inner = {0x46, 0x46, 0x46, 0xff}, + .inner_sel = {0xb4, 0xb4, 0xb4, 0xff}, + .item = {0x19, 0x19, 0x19, 0xff}, + + .text = {0xff, 0xff, 0xff, 0xff}, + .text_sel = {0x33, 0x33, 0x33, 0xff}, + + .shaded = 0, + .shadetop = 0, + .shadedown = 0, + .alpha_check = 0, + .roundness = 0.3f, +}; + static struct uiWidgetColors wcol_box = { {25, 25, 25, 255}, {128, 128, 128, 255}, @@ -2429,6 +2445,7 @@ void ui_widget_color_init(ThemeUI *tui) { tui->wcol_regular = wcol_regular; tui->wcol_tool = wcol_tool; + tui->wcol_toolbar_item = wcol_toolbar_item; tui->wcol_text = wcol_text; tui->wcol_radio = wcol_radio; tui->wcol_tab = wcol_tab; @@ -4172,6 +4189,11 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type) wt.draw = widget_roundbut_exec; break; + case UI_WTYPE_TOOLBAR_ITEM: + wt.wcol_theme = &btheme->tui.wcol_toolbar_item; + wt.draw = widget_roundbut_exec; + break; + case UI_WTYPE_TAB: wt.wcol_theme = &btheme->tui.wcol_tab; wt.draw = widget_tab; @@ -4415,7 +4437,16 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct break; case UI_BTYPE_BUT: +#ifdef USE_TOOLBAR_HACK + if (UI_but_is_tool(but)) { + wt = widget_type(UI_WTYPE_TOOLBAR_ITEM); + } + else { + wt = widget_type(UI_WTYPE_EXEC); + } +#else wt = widget_type(UI_WTYPE_EXEC); +#endif break; case UI_BTYPE_NUM: diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 1bc834a121c..ade69050622 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -2985,6 +2985,27 @@ void init_userdef_do_versions(void) } } + if (((bTheme *)U.themes.first)->tui.wcol_toolbar_item.text[3] == 0) { + struct uiWidgetColors wcol_toolbar_item = { + .outline = {0x19, 0x19, 0x19, 0xff}, + .inner = {0x46, 0x46, 0x46, 0xff}, + .inner_sel = {0xb4, 0xb4, 0xb4, 0xff}, + .item = {0x19, 0x19, 0x19, 0xff}, + + .text = {0xff, 0xff, 0xff, 0xff}, + .text_sel = {0x33, 0x33, 0x33, 0xff}, + + .shaded = 0, + .shadetop = 0, + .shadedown = 0, + .alpha_check = 0, + .roundness = 0.3f, + }; + for (bTheme *btheme = U.themes.first; btheme; btheme = btheme->next) { + btheme->tui.wcol_toolbar_item = wcol_toolbar_item; + } + } + /** * Include next version bump. */ diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index ba6d022e556..4ef7ce019bb 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -164,7 +164,7 @@ typedef struct uiGradientColors { typedef struct ThemeUI { /* Interface Elements (buttons, menus, icons) */ - uiWidgetColors wcol_regular, wcol_tool, wcol_text; + uiWidgetColors wcol_regular, wcol_tool, wcol_toolbar_item, wcol_text; uiWidgetColors wcol_radio, wcol_option, wcol_toggle; uiWidgetColors wcol_num, wcol_numslider, wcol_tab; uiWidgetColors wcol_menu, wcol_pulldown, wcol_menu_back, wcol_menu_item, wcol_tooltip; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 45843bc2b1c..dc8db500f24 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -962,6 +962,11 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_ui_text(prop, "Tool Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "wcol_toolbar_item", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_ui_text(prop, "Toolbar Item Widget Colors", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); prop = RNA_def_property(srna, "wcol_radio", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); |