[Bf-blender-cvs] [271b53f] UI-graphical-redesign: Cleanup: Use existing methods to init new/changed theme options
Julian Eisel
noreply at git.blender.org
Wed Jun 3 17:03:55 CEST 2015
Commit: 271b53fa57cdaa9e22cd0efbe47ef25c9bb014da
Author: Julian Eisel
Date: Wed Jun 3 15:01:36 2015 +0200
Branches: UI-graphical-redesign
https://developer.blender.org/rB271b53fa57cdaa9e22cd0efbe47ef25c9bb014da
Cleanup: Use existing methods to init new/changed theme options
Think this is the way we should actually do this.
===================================================================
M source/blender/blenloader/intern/versioning_defaults.c
M source/blender/editors/interface/interface_widgets.c
M source/blender/editors/interface/resources.c
M source/blender/makesdna/DNA_userdef_types.h
===================================================================
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index e2ae819..c2e72bd 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -48,32 +48,6 @@
/**
- * Override theme options in startup.blend
- */
-static void blo_update_defaults_themes(void)
-{
- bTheme *btheme;
- ThemeSpace *ts;
- uiWidgetColors *wcol;
-
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- for (wcol = UI_THEMEWIDGETS_START(&btheme->tui); wcol != UI_THEMEWIDGETS_END(&btheme->tui); wcol++) {
- wcol->shaded = 0;
- }
-
- for (ts = UI_THEMESPACE_START(btheme); ts != UI_THEMESPACE_END(btheme); ts++) {
- /* XXX maybe remove show_back/show_header options? */
- ts->panelcolors.show_back = ts->panelcolors.show_header = true;
- rgba_char_args_set(ts->panelcolors.back, 128, 128, 128, 255);
- rgba_char_args_set(ts->panelcolors.header, 97, 97, 97, 255);
- }
-
- /* XXX maybe remove widget_emboss as well? */
- btheme->tui.widget_emboss[3] = 0;
- }
-}
-
-/**
* Override values in in-memory startup.blend, avoids resaving for small changes.
*/
void BLO_update_defaults_userpref_blend(void)
@@ -98,8 +72,6 @@ void BLO_update_defaults_userpref_blend(void)
style->paneltitle.shadowalpha = 0.1f;
style->paneltitle.shadowcolor = 0.0f;
}
-
- blo_update_defaults_themes();
}
/**
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 97eb6d2..0107afe 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1648,8 +1648,11 @@ static struct uiWidgetColors wcol_num = {
{0, 0, 0, 255},
{255, 255, 255, 255},
- 1,
- -20, 0
+ 0,
+ -20, 0,
+
+ 0, /* pad */
+ 0.5f
};
static struct uiWidgetColors wcol_numslider = {
@@ -1661,8 +1664,11 @@ static struct uiWidgetColors wcol_numslider = {
{0, 0, 0, 255},
{255, 255, 255, 255},
- 1,
- -20, 0
+ 0,
+ -20, 0,
+
+ 0, /* pad */
+ 0.5f
};
static struct uiWidgetColors wcol_text = {
@@ -1674,8 +1680,11 @@ static struct uiWidgetColors wcol_text = {
{0, 0, 0, 255},
{255, 255, 255, 255},
- 1,
- 0, 25
+ 0,
+ 0, 25,
+
+ 0, /* pad */
+ 0.2f
};
static struct uiWidgetColors wcol_option = {
@@ -1687,8 +1696,11 @@ static struct uiWidgetColors wcol_option = {
{0, 0, 0, 255},
{255, 255, 255, 255},
- 1,
- 15, -15
+ 0,
+ 15, -15,
+
+ 0, /* pad */
+ 0.35f
};
/* button that shows popup */
@@ -1701,8 +1713,11 @@ static struct uiWidgetColors wcol_menu = {
{255, 255, 255, 255},
{204, 204, 204, 255},
- 1,
- 15, -15
+ 0,
+ 15, -15,
+
+ 0, /* pad */
+ 0.2f
};
/* button that starts pulldown */
@@ -1716,7 +1731,10 @@ static struct uiWidgetColors wcol_pulldown = {
{0, 0, 0, 255},
0,
- 25, -20
+ 25, -20,
+
+ 0, /* pad */
+ 0.2f
};
/* button inside menu */
@@ -1729,8 +1747,11 @@ static struct uiWidgetColors wcol_menu_item = {
{255, 255, 255, 255},
{0, 0, 0, 255},
- 1,
- 38, 0
+ 0,
+ 38, 0,
+
+ 0, /* pad */
+ 0.2f
};
/* backdrop menu + title text color */
@@ -1744,7 +1765,10 @@ static struct uiWidgetColors wcol_menu_back = {
{255, 255, 255, 255},
0,
- 25, -20
+ 25, -20,
+
+ 0, /* pad */
+ 0.25f
};
/* pie menus */
@@ -1757,8 +1781,11 @@ static struct uiWidgetColors wcol_pie_menu = {
{160, 160, 160, 255},
{255, 255, 255, 255},
- 1,
- 10, -10
+ 0,
+ 10, -10,
+
+ 0, /* pad */
+ 0.5f
};
@@ -1773,7 +1800,10 @@ static struct uiWidgetColors wcol_tooltip = {
{255, 255, 255, 255},
0,
- 25, -20
+ 25, -20,
+
+ 0, /* pad */
+ 0.2f
};
static struct uiWidgetColors wcol_radio = {
@@ -1785,8 +1815,11 @@ static struct uiWidgetColors wcol_radio = {
{255, 255, 255, 255},
{0, 0, 0, 255},
- 1,
- 15, -15
+ 0,
+ 15, -15,
+
+ 0, /* pad */
+ 0.2f
};
static struct uiWidgetColors wcol_regular = {
@@ -1799,7 +1832,10 @@ static struct uiWidgetColors wcol_regular = {
{255, 255, 255, 255},
0,
- 0, 0
+ 0, 0,
+
+ 0, /* pad */
+ 0.2f
};
static struct uiWidgetColors wcol_tool = {
@@ -1811,8 +1847,11 @@ static struct uiWidgetColors wcol_tool = {
{0, 0, 0, 255},
{255, 255, 255, 255},
- 1,
- 15, -15
+ 0,
+ 15, -15,
+
+ 0, /* pad */
+ 0.25f
};
static struct uiWidgetColors wcol_box = {
@@ -1825,7 +1864,10 @@ static struct uiWidgetColors wcol_box = {
{255, 255, 255, 255},
0,
- 0, 0
+ 0, 0,
+
+ 0, /* pad */
+ 0.2f
};
static struct uiWidgetColors wcol_toggle = {
@@ -1838,7 +1880,10 @@ static struct uiWidgetColors wcol_toggle = {
{255, 255, 255, 255},
0,
- 0, 0
+ 0, 0,
+
+ 0, /* pad */
+ 0.2f
};
static struct uiWidgetColors wcol_scroll = {
@@ -1850,8 +1895,11 @@ static struct uiWidgetColors wcol_scroll = {
{0, 0, 0, 255},
{255, 255, 255, 255},
- 1,
- 5, -5
+ 0,
+ 5, -5,
+
+ 0, /* pad */
+ 0.5f
};
static struct uiWidgetColors wcol_progress = {
@@ -1864,7 +1912,10 @@ static struct uiWidgetColors wcol_progress = {
{255, 255, 255, 255},
0,
- 0, 0
+ 0, 0,
+
+ 0, /* pad */
+ 0.2f
};
static struct uiWidgetColors wcol_list_item = {
@@ -1877,7 +1928,10 @@ static struct uiWidgetColors wcol_list_item = {
{0, 0, 0, 255},
0,
- 0, 0
+ 0, 0,
+
+ 0, /* pad */
+ 0.2f
};
/* free wcol struct to play with */
@@ -1891,7 +1945,10 @@ static struct uiWidgetColors wcol_tmp = {
{255, 255, 255, 255},
0,
- 0, 0
+ 0, 0,
+
+ 0, /* pad */
+ 0.2f
};
@@ -3194,7 +3251,7 @@ static void widget_menu_radial_itembut(uiBut *but, uiWidgetColors *wcol, rcti *r
wtb.draw_emboss = false;
- rad = 0.5f * BLI_rcti_size_y(rect);
+ rad = wcol->roundness * BLI_rcti_size_y(rect);
round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
wcol->inner[3] *= fac;
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 88cb455..9ce006e 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -2647,27 +2647,20 @@ void init_userdef_do_versions(void)
if (U.versionfile < 274 || (U.versionfile == 274 && U.subversionfile < 6)) {
bTheme *btheme;
+ ThemeSpace *ts;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- btheme->tui.wcol_box.roundness = 0.2f;
- btheme->tui.wcol_list_item.roundness = 0.2f;
- btheme->tui.wcol_menu.roundness = 0.2f;
- btheme->tui.wcol_menu_back.roundness = 0.25f;
- btheme->tui.wcol_menu_item.roundness = 0.2f;
- btheme->tui.wcol_num.roundness = 0.5f;
- btheme->tui.wcol_numslider.roundness = 0.5f;
- btheme->tui.wcol_option.roundness = 0.35f;
- btheme->tui.wcol_progress.roundness = 0.2f;
- btheme->tui.wcol_pulldown.roundness = 0.2f;
- btheme->tui.wcol_radio.roundness = 0.2f;
- btheme->tui.wcol_regular.roundness = 0.2f;
- btheme->tui.wcol_scroll.roundness = 0.5f;
- btheme->tui.wcol_text.roundness = 0.2f;
- btheme->tui.wcol_toggle.roundness = 0.2f;
- btheme->tui.wcol_tool.roundness = 0.25f;
- btheme->tui.wcol_tooltip.roundness = 0.2f;
+ for (ts = UI_THEMESPACE_START(btheme); ts != UI_THEMESPACE_END(btheme); ts++) {
+ /* XXX maybe remove show_back/show_header options? */
+ ts->panelcolors.show_back = ts->panelcolors.show_header = true;
+ rgba_char_args_set(ts->panelcolors.back, 128, 128, 128, 255);
+ rgba_char_args_set(ts->panelcolors.header, 97, 97, 97, 255);
+ }
rgba_char_args_set_fl(btheme->tui.area_edges, 0.15, 0.15f, 0.15f, 1.0f);
+ btheme->tui.widget_emboss[3] = 0;
+
+ ui_widget_color_init(&btheme->tui);
}
}
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 3f901e5..03bc616 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -128,8 +128,9 @@ typedef struct uiWidgetColors {
char text_sel[4];
short shaded;
short shadetop, shadedown;
- short alpha_check;
- float roundness, pad;
+ short pad;
+ float roundness;
+ short alpha_check, pad2;
} uiWidgetColors;
typedef struct uiWidgetStateColors {
@@ -400,9 +401,6 @@ typedef struct bTheme {
#define UI_THEMESPACE_START(btheme) (CHECK_TYPE_INLINE(btheme, bTheme *), &((btheme)->tbuts))
#define UI_THEMESPACE_END(btheme) (CHECK_TYPE_INLINE(btheme, bTheme *), (&((btheme)->tclip) + 1))
-#define UI_THEMEWIDGETS_START(tui) (CHECK_TYPE_INLINE(tui, ThemeUI *), &((tui)->wcol_regular))
-#define UI_THEMEWIDGETS_END(tui) (CHECK_TYPE_INLINE(tui, ThemeUI *), (&((tui)->wcol_pie_menu) + 1))
-
/* for the moment only the name. may want to store options with this later */
typedef struct bAddon {
struct bAddon *next, *prev;
More information about the Bf-blender-cvs
mailing list