[Bf-blender-cvs] [f034e69] master: UI: Theme Colors for Info space

Sv. Lockal noreply at git.blender.org
Tue Dec 17 19:08:34 CET 2013


Commit: f034e69f0c3d247c5fb9343bceb7c8a249e43c90
Author: Sv. Lockal
Date:   Wed Dec 18 05:02:42 2013 +1100
http://developer.blender.org/rBf034e69f0c3d247c5fb9343bceb7c8a249e43c90

UI: Theme Colors for Info space

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

M	source/blender/editors/include/UI_resources.h
M	source/blender/editors/interface/resources.c
M	source/blender/editors/space_info/info_draw.c
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index af0df0e..0773b86 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -248,7 +248,18 @@ enum {
 
 	TH_LOW_GRAD,
 	TH_HIGH_GRAD,
-	TH_SHOW_BACK_GRAD
+	TH_SHOW_BACK_GRAD,
+
+	TH_INFO_SELECTED,
+	TH_INFO_SELECTED_TEXT,
+	TH_INFO_ERROR,
+	TH_INFO_ERROR_TEXT,
+	TH_INFO_WARNING,
+	TH_INFO_WARNING_TEXT,
+	TH_INFO_INFO,
+	TH_INFO_INFO_TEXT,
+	TH_INFO_DEBUG,
+	TH_INFO_DEBUG_TEXT
 };
 /* XXX WARNING: previous is saved in file, so do not change order! */
 
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 42b17fa..e9d5332 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -580,6 +580,37 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
 					cp = btheme->tui.yaxis; break;
 				case TH_AXIS_Z:
 					cp = btheme->tui.zaxis; break;
+
+				case TH_INFO_SELECTED:
+					cp = ts->info_selected;
+					break;
+				case TH_INFO_SELECTED_TEXT:
+					cp = ts->info_selected_text;
+					break;
+				case TH_INFO_ERROR:
+					cp = ts->info_error;
+					break;
+				case TH_INFO_ERROR_TEXT:
+					cp = ts->info_error_text;
+					break;
+				case TH_INFO_WARNING:
+					cp = ts->info_warning;
+					break;
+				case TH_INFO_WARNING_TEXT:
+					cp = ts->info_warning_text;
+					break;
+				case TH_INFO_INFO:
+					cp = ts->info_info;
+					break;
+				case TH_INFO_INFO_TEXT:
+					cp = ts->info_info_text;
+					break;
+				case TH_INFO_DEBUG:
+					cp = ts->info_debug;
+					break;
+				case TH_INFO_DEBUG_TEXT:
+					cp = ts->info_debug_text;
+					break;
 			}
 		}
 	}
@@ -974,6 +1005,16 @@ void ui_theme_init_default(void)
 	/* space info */
 	btheme->tinfo = btheme->tv3d;
 	rgba_char_args_set_fl(btheme->tinfo.back,   0.45, 0.45, 0.45, 1.0);
+	rgba_char_args_set(btheme->tinfo.info_selected, 96, 128, 255, 255);
+	rgba_char_args_set(btheme->tinfo.info_selected_text, 255, 255, 255, 255);
+	rgba_char_args_set(btheme->tinfo.info_error, 220, 0, 0, 255);
+	rgba_char_args_set(btheme->tinfo.info_error_text, 0, 0, 0, 255);
+	rgba_char_args_set(btheme->tinfo.info_warning, 220, 128, 96, 255);
+	rgba_char_args_set(btheme->tinfo.info_warning_text, 0, 0, 0, 255);
+	rgba_char_args_set(btheme->tinfo.info_info, 0, 170, 0, 255);
+	rgba_char_args_set(btheme->tinfo.info_info_text, 0, 0, 0, 255);
+	rgba_char_args_set(btheme->tinfo.info_debug, 196, 196, 196, 255);
+	rgba_char_args_set(btheme->tinfo.info_debug_text, 0, 0, 0, 255);
 
 	/* space user preferences */
 	btheme->tuserpref = btheme->tv3d;
@@ -2279,7 +2320,22 @@ void init_userdef_do_versions(void)
 			rgba_char_args_test_set(btheme->tnode.nodeclass_pattern, r, g, b, 255);
 			rgba_char_args_test_set(btheme->tnode.nodeclass_layout, r, g, b, 255);
 		}
-		
+	}
+
+	if (U.versionfile < 269 || (U.versionfile == 269 && U.subversionfile < 8)) {
+		bTheme *btheme;
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+			rgba_char_args_test_set(btheme->tinfo.info_selected, 96, 128, 255, 255);
+			rgba_char_args_test_set(btheme->tinfo.info_selected_text, 255, 255, 255, 255);
+			rgba_char_args_test_set(btheme->tinfo.info_error, 220, 0, 0, 255);
+			rgba_char_args_test_set(btheme->tinfo.info_error_text, 0, 0, 0, 255);
+			rgba_char_args_test_set(btheme->tinfo.info_warning, 220, 128, 96, 255);
+			rgba_char_args_test_set(btheme->tinfo.info_warning_text, 0, 0, 0, 255);
+			rgba_char_args_test_set(btheme->tinfo.info_info, 0, 170, 0, 255);
+			rgba_char_args_test_set(btheme->tinfo.info_info_text, 0, 0, 0, 255);
+			rgba_char_args_test_set(btheme->tinfo.info_debug, 196, 196, 196, 255);
+			rgba_char_args_test_set(btheme->tinfo.info_debug_text, 0, 0, 0, 255);
+		}
 	}
 	
 	if (U.versionfile < 270) {
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index a748c30..6647a8e 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -67,45 +67,36 @@
 
 static void info_report_color(unsigned char *fg, unsigned char *bg, Report *report, const short do_tint)
 {
+	int bg_id = TH_BACK, fg_id = TH_TEXT;
+	int shade = do_tint ? 0 : -6;
+
 	if (report->flag & SELECT) {
-		fg[0] = 255; fg[1] = 255; fg[2] = 255;
-		if (do_tint) {
-			bg[0] = 96; bg[1] = 128; bg[2] = 255;
-		}
-		else {
-			bg[0] = 90; bg[1] = 122; bg[2] = 249;
-		}
+		bg_id = TH_INFO_SELECTED;
+		fg_id = TH_INFO_SELECTED_TEXT;
+	}
+	else if (report->type & RPT_ERROR_ALL) {
+		bg_id = TH_INFO_ERROR;
+		fg_id = TH_INFO_ERROR_TEXT;
+	}
+	else if (report->type & RPT_WARNING_ALL) {
+		bg_id = TH_INFO_WARNING;
+		fg_id = TH_INFO_WARNING_TEXT;
+	}
+	else if (report->type & RPT_INFO_ALL) {
+		bg_id = TH_INFO_INFO;
+		fg_id = TH_INFO_INFO_TEXT;
+	}
+	else if (report->type & RPT_DEBUG_ALL) {
+		bg_id = TH_INFO_DEBUG;
+		fg_id = TH_INFO_DEBUG_TEXT;
 	}
 	else {
-		fg[0] = 0; fg[1] = 0; fg[2] = 0;
-		
-		if (report->type & RPT_ERROR_ALL) {
-			if (do_tint) { bg[0] = 220; bg[1] = 0;   bg[2] = 0;   }
-			else         { bg[0] = 214; bg[1] = 0;   bg[2] = 0;   }
-		}
-		else if (report->type & RPT_WARNING_ALL) {
-			if (do_tint) { bg[0] = 220; bg[1] = 128; bg[2] = 96;  }
-			else         { bg[0] = 214; bg[1] = 122; bg[2] = 90;  }
-		}
-#if 0 // XXX: this looks like the selected color, so don't use this
-		else if (report->type & RPT_OPERATOR_ALL) {
-			if (do_tint) { bg[0] = 96;  bg[1] = 128; bg[2] = 255; }
-			else         { bg[0] = 90;  bg[1] = 122; bg[2] = 249; }
-		}
-#endif
-		else if (report->type & RPT_INFO_ALL) {
-			if (do_tint) { bg[0] = 0;   bg[1] = 170; bg[2] = 0;   }
-			else         { bg[0] = 0;   bg[1] = 164; bg[2] = 0;   }
-		}
-		else if (report->type & RPT_DEBUG_ALL) {
-			if (do_tint) { bg[0] = 196; bg[1] = 196; bg[2] = 196; }
-			else         { bg[0] = 190; bg[1] = 190; bg[2] = 190; }
-		}
-		else {
-			if (do_tint) { bg[0] = 120; bg[1] = 120; bg[2] = 120; }
-			else         { bg[0] = 114; bg[1] = 114; bg[2] = 114; }
-		}
+		bg_id = TH_BACK;
+		fg_id = TH_TEXT;
 	}
+
+	UI_GetThemeColorShade3ubv(bg_id, shade, bg);
+	UI_GetThemeColor3ubv(fg_id, fg);
 }
 
 /* reports! */
@@ -148,7 +139,7 @@ static int report_textview_begin(TextViewContext *tvc)
 	/* iterator */
 	tvc->iter = reports->list.last;
 
-	glClearColor(120.0 / 255.0, 120.0 / 255.0, 120.0 / 255.0, 1.0);
+	UI_ThemeClearColor(TH_BACK);
 	glClear(GL_COLOR_BUFFER_BIT);
 
 #ifdef USE_INFO_NEWLINE
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 6aab0a0..111477f 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -309,6 +309,13 @@ typedef struct ThemeSpace {
 	char nla_transition[4], nla_transition_sel[4]; /* NLA "Transition" strips */
 	char nla_meta[4], nla_meta_sel[4];             /* NLA "Meta" strips */
 	char nla_sound[4], nla_sound_sel[4];           /* NLA "Sound" strips */
+
+	/* info */
+	char info_selected[4], info_selected_text[4];
+	char info_error[4], info_error_text[4];
+	char info_warning[4], info_warning_text[4];
+	char info_info[4], info_info_text[4];
+	char info_debug[4], info_debug_text[4];
 } ThemeSpace;
 
 
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 9af1de4..8b42fc7 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -1811,6 +1811,7 @@ static void rna_def_userdef_theme_space_console(BlenderRNA *brna)
 static void rna_def_userdef_theme_space_info(BlenderRNA *brna)
 {
 	StructRNA *srna;
+	PropertyRNA *prop;
 
 	/* space_info */
 
@@ -1820,6 +1821,66 @@ static void rna_def_userdef_theme_space_info(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "Theme Info", "Theme settings for Info");
 
 	rna_def_userdef_theme_spaces_main(srna);
+
+	prop = RNA_def_property(srna, "info_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_float_sdna(prop, NULL, "info_selected");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_text(prop, "Selected Line Background", "");
+	RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+	prop = RNA_def_property(srna, "info_selected_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_float_sdna(prop, NULL, "info_selected_text");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_text(prop, "Selected Line Text", "");
+	RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+	prop = RNA_def_property(srna, "info_error", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_float_sdna(prop, NULL, "info_error");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_text(prop, "Error Background", "");
+	RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+	prop = RNA_def_property(srna, "info_error_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_float_sdna(prop, NULL, "info_error_text");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_text(prop, "Error Text", "");
+	RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+	prop = RNA_def_property(srna, "info_warning", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_float_sdna(prop, NULL, "info_warning");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_text(prop, "Warning Background", "");
+	RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+	prop = RNA_def_property(srna, "info_warning_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_float_sdna(prop, NULL, "info_warning_text");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_text(prop, "Warning Text", "");
+	RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+	prop = RNA_def_property(srna, "info_info", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_float_sdna(prop, NULL, "info_info");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_text(prop, "Info Background", "");
+	RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+	prop = RNA_def_property(srna, "info_info_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_float_sdna(prop, NULL, "info_info_text");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_tex

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list