[Bf-blender-cvs] [80af3d6] master: Tab theme colors

Campbell Barton noreply at git.blender.org
Thu Jan 23 01:48:54 CET 2014


Commit: 80af3d685773d58dbe73dc697658ddf93e81b0b7
Author: Campbell Barton
Date:   Thu Jan 23 11:44:35 2014 +1100
https://developer.blender.org/rB80af3d685773d58dbe73dc697658ddf93e81b0b7

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()

===================================================================

M	source/blender/blenkernel/BKE_blender.h
M	source/blender/editors/include/UI_resources.h
M	source/blender/editors/interface/interface_panel.c
M	source/blender/editors/interface/resources.c
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/intern/rna_userdef.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 99595b3..960ca1b 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 23498dc..4e353b1 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 6964965..14523ef 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 2150da8..63f4681 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 864cc81..dca007f 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 e2063b8..c851acd 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_

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list