Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-01-23 04:44:35 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-01-23 04:48:36 +0400
commit80af3d685773d58dbe73dc697658ddf93e81b0b7 (patch)
tree10ee5d92f370c0a0206ae2bbe346b61f08da4597 /source/blender
parent4b820fb673319989026433f284e11671885757c0 (diff)
Tab theme colors
patch D234 from Jonathan Williamson with edits - de-duplicate rna_def_userdef_theme_space_gradient and rna_def_userdef_theme_space_generic - ui_theme_init_new_do now always sets theme settings (no need to test), used by bpy.ops.ui.reset_default_theme()
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/editors/include/UI_resources.h4
-rw-r--r--source/blender/editors/interface/interface_panel.c16
-rw-r--r--source/blender/editors/interface/resources.c64
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h7
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c95
6 files changed, 101 insertions, 87 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 99595b36f6f..960ca1b1d20 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 269
-#define BLENDER_SUBVERSION 9
+#define BLENDER_SUBVERSION 10
/* 262 was the last editmesh release but it has compatibility code for bmesh data */
#define BLENDER_MINVERSION 262
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 23498dcf4aa..4e353b18be8 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -58,6 +58,10 @@ enum {
TH_TEXT,
TH_TEXT_HI,
TH_TITLE,
+ TH_TAB_ACTIVE,
+ TH_TAB_INACTIVE,
+ TH_TAB_BACK,
+ TH_TAB_OUTLINE,
TH_HEADER,
TH_HEADERDESEL,
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 69649651837..14523efaf18 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -1418,9 +1418,12 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
unsigned char theme_col_text[4];
unsigned char theme_col_text_hi[4];
- /* Secondary theme colors */
+ /* Tab colors */
unsigned char theme_col_tab_bg[4];
+ unsigned char theme_col_tab_active[4];
unsigned char theme_col_tab_inactive[4];
+
+ /* Secondary theme colors */
unsigned char theme_col_tab_outline[4];
unsigned char theme_col_tab_divider[4]; /* line that divides tabs from the main area */
unsigned char theme_col_tab_highlight[4];
@@ -1432,11 +1435,12 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
UI_GetThemeColor4ubv(TH_TEXT, theme_col_text);
UI_GetThemeColor4ubv(TH_TEXT_HI, theme_col_text_hi);
- blend_color_interpolate_byte(theme_col_tab_bg, theme_col_back, theme_col_text, 0.2f);
- blend_color_interpolate_byte(theme_col_tab_inactive, theme_col_back, theme_col_text, 0.10f);
- blend_color_interpolate_byte(theme_col_tab_outline, theme_col_back, theme_col_text, 0.3f);
- blend_color_interpolate_byte(theme_col_tab_divider, theme_col_back, theme_col_text, 0.3f);
+ UI_GetThemeColor4ubv(TH_TAB_BACK, theme_col_tab_bg);
+ UI_GetThemeColor4ubv(TH_TAB_ACTIVE, theme_col_tab_active);
+ UI_GetThemeColor4ubv(TH_TAB_INACTIVE, theme_col_tab_inactive);
+ UI_GetThemeColor4ubv(TH_TAB_OUTLINE, theme_col_tab_outline);
+ blend_color_interpolate_byte(theme_col_tab_divider, theme_col_back, theme_col_text, 0.3f);
blend_color_interpolate_byte(theme_col_tab_highlight, theme_col_back, theme_col_text_hi, 0.2f);
blend_color_interpolate_byte(theme_col_tab_highlight_inactive, theme_col_tab_inactive, theme_col_text_hi, 0.12f);
@@ -1509,7 +1513,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
if (is_active)
#endif
{
- glColor3ubv(is_active ? theme_col_back : theme_col_tab_inactive);
+ glColor3ubv(is_active ? theme_col_tab_active : theme_col_tab_inactive);
ui_panel_category_draw_tab(GL_POLYGON, rct->xmin, rct->ymin, rct->xmax, rct->ymax,
tab_curve_radius - px, roundboxtype, true, true, NULL);
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 2150da8893a..63f4681c779 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -246,6 +246,15 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
case TH_BUTBACK_TEXT_HI:
cp = ts->button_text_hi; break;
+ case TH_TAB_ACTIVE:
+ cp = ts->tab_active; break;
+ case TH_TAB_INACTIVE:
+ cp = ts->tab_inactive; break;
+ case TH_TAB_BACK:
+ cp = ts->tab_back; break;
+ case TH_TAB_OUTLINE:
+ cp = ts->tab_outline; break;
+
case TH_SHADE1:
cp = ts->shade1; break;
case TH_SHADE2:
@@ -713,23 +722,30 @@ static void ui_theme_init_boneColorSets(bTheme *btheme)
/* use this call to init new variables in themespace, if they're same for all */
static void ui_theme_init_new_do(ThemeSpace *ts)
{
- rgba_char_args_test_set(ts->header_text, 0, 0, 0, 255);
- rgba_char_args_test_set(ts->header_title, 0, 0, 0, 255);
- rgba_char_args_test_set(ts->header_text_hi, 255, 255, 255, 255);
-
-// rgba_char_args_test_set(ts->panel_text, 0, 0, 0, 255);
-// rgba_char_args_test_set(ts->panel_title, 0, 0, 0, 255);
-// rgba_char_args_test_set(ts->panel_text_hi, 255, 255, 255, 255);
-
- rgba_char_args_test_set(ts->button, 145, 145, 145, 245);
- rgba_char_args_test_set(ts->button_title, 0, 0, 0, 255);
- rgba_char_args_test_set(ts->button_text, 0, 0, 0, 255);
- rgba_char_args_test_set(ts->button_text_hi, 255, 255, 255, 255);
-
- rgba_char_args_test_set(ts->list, 165, 165, 165, 255);
- rgba_char_args_test_set(ts->list_title, 0, 0, 0, 255);
- rgba_char_args_test_set(ts->list_text, 0, 0, 0, 255);
- rgba_char_args_test_set(ts->list_text_hi, 255, 255, 255, 255);
+ rgba_char_args_set(ts->header_text, 0, 0, 0, 255);
+ rgba_char_args_set(ts->header_title, 0, 0, 0, 255);
+ rgba_char_args_set(ts->header_text_hi, 255, 255, 255, 255);
+
+#if 0
+ rgba_char_args_set(ts->panel_text, 0, 0, 0, 255);
+ rgba_char_args_set(ts->panel_title, 0, 0, 0, 255);
+ rgba_char_args_set(ts->panel_text_hi, 255, 255, 255, 255);
+#endif
+
+ rgba_char_args_set(ts->button, 145, 145, 145, 245);
+ rgba_char_args_set(ts->button_title, 0, 0, 0, 255);
+ rgba_char_args_set(ts->button_text, 0, 0, 0, 255);
+ rgba_char_args_set(ts->button_text_hi, 255, 255, 255, 255);
+
+ rgba_char_args_set(ts->list, 165, 165, 165, 255);
+ rgba_char_args_set(ts->list_title, 0, 0, 0, 255);
+ rgba_char_args_set(ts->list_text, 0, 0, 0, 255);
+ rgba_char_args_set(ts->list_text_hi, 255, 255, 255, 255);
+
+ rgba_char_args_set(ts->tab_active, 114, 114, 114, 255);
+ rgba_char_args_set(ts->tab_inactive, 100, 100, 100, 255);
+ rgba_char_args_set(ts->tab_back, 70, 70, 70, 255);
+ rgba_char_args_set(ts->tab_outline, 60, 60, 60, 255);
}
static void ui_theme_init_new(bTheme *btheme)
@@ -2386,6 +2402,20 @@ void init_userdef_do_versions(void)
U.gpencil_new_layer_col[3] = 0.9f;
}
}
+
+ if (U.versionfile < 269 || (U.versionfile == 269 && U.subversionfile < 10)) {
+ bTheme *btheme;
+ for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+ ThemeSpace *ts;
+
+ for (ts = UI_THEMESPACE_START(btheme); ts != UI_THEMESPACE_END(btheme); ts++) {
+ rgba_char_args_set(ts->tab_active, 114, 114, 114, 255);
+ rgba_char_args_set(ts->tab_inactive, 100, 100, 100, 255);
+ rgba_char_args_set(ts->tab_back, 70, 70, 70, 255);
+ rgba_char_args_set(ts->tab_outline, 60, 60, 60, 255);
+ }
+ }
+ }
if (U.pixelsize == 0.0f)
U.pixelsize = 1.0f;
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 864cc8170d6..dca007f83ec 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -154,6 +154,7 @@ typedef struct uiGradientColors {
char high_gradient[4];
int show_grad;
int pad2;
+
} uiGradientColors;
typedef struct ThemeUI {
@@ -197,6 +198,12 @@ typedef struct ThemeSpace {
char header_text[4];
char header_text_hi[4];
+ /* region tabs */
+ char tab_active[4];
+ char tab_inactive[4];
+ char tab_back[4];
+ char tab_outline[4];
+
/* button/tool regions */
char button[4]; /* region background */
char button_title[4]; /* panel title */
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index e2063b82670..c851acd64d9 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -1016,21 +1016,10 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_userdef_update");
}
-static void rna_def_userdef_theme_space_generic(BlenderRNA *brna)
+static void rna_def_userdef_theme_space_common(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ThemeSpaceGeneric", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_ui_text(srna, "Theme Space Settings", "");
-
- /* window */
- prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Window Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
prop = RNA_def_property(srna, "title", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Title", "");
@@ -1089,55 +1078,39 @@ static void rna_def_userdef_theme_space_generic(BlenderRNA *brna)
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Region Text Highlight", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
-/* } */
-}
-
-static void rna_def_userdef_theme_space_gradient(BlenderRNA *brna)
-{
- StructRNA *srna;
- PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ThemeSpaceGradient", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_ui_text(srna, "Theme Space Settings", "");
-
- /* window */
- prop = RNA_def_property(srna, "title", PROP_FLOAT, PROP_COLOR_GAMMA);
+ /* tabs */
+ prop = RNA_def_property(srna, "tab_active", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Title", "");
+ RNA_def_property_ui_text(prop, "Tab Active", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
- prop = RNA_def_property(srna, "text", PROP_FLOAT, PROP_COLOR_GAMMA);
+ prop = RNA_def_property(srna, "tab_inactive", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Text", "");
+ RNA_def_property_ui_text(prop, "Tab Inactive", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
- prop = RNA_def_property(srna, "text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
+ prop = RNA_def_property(srna, "tab_back", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Text Highlight", "");
+ RNA_def_property_ui_text(prop, "Tab Background", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
- /* header */
- prop = RNA_def_property(srna, "header", PROP_FLOAT, PROP_COLOR_GAMMA);
+ prop = RNA_def_property(srna, "tab_outline", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Header", "");
+ RNA_def_property_ui_text(prop, "Tab Outline", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
- prop = RNA_def_property(srna, "header_text", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Header Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+/* } */
+}
- prop = RNA_def_property(srna, "header_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Header Text Highlight", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+static void rna_def_userdef_theme_space_gradient(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
- /* panel settings */
- prop = RNA_def_property(srna, "panelcolors", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Panel Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ srna = RNA_def_struct(brna, "ThemeSpaceGradient", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_ui_text(srna, "Theme Space Settings", "");
/* gradient/background settings */
prop = RNA_def_property(srna, "gradients", PROP_POINTER, PROP_NONE);
@@ -1145,28 +1118,24 @@ static void rna_def_userdef_theme_space_gradient(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Gradient Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
- /* buttons */
-/* if (! ELEM(spacetype, SPACE_BUTS, SPACE_OUTLINER)) { */
- prop = RNA_def_property(srna, "button", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Region Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ rna_def_userdef_theme_space_common(srna);
+}
- prop = RNA_def_property(srna, "button_title", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Region Text Titles", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+static void rna_def_userdef_theme_space_generic(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "button_text", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Region Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ srna = RNA_def_struct(brna, "ThemeSpaceGeneric", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_ui_text(srna, "Theme Space Settings", "");
- prop = RNA_def_property(srna, "button_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
+ prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Region Text Highlight", "");
+ RNA_def_property_ui_text(prop, "Window Background", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
-/* } */
+
+ rna_def_userdef_theme_space_common(srna);
}
/* list / channels */