From 1b580dde6e633056c1a9f0436b778dc2797ef469 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Fri, 15 Jan 2010 17:00:37 +0000 Subject: [PATCH] Console: * Added Theme support for the console. You can change: -Header Color -Text Color of Output, Input, Info and Error Messages. (Inside the User Preferences -> Themes) --- release/scripts/ui/space_userpref.py | 13 ++++++ source/blender/editors/include/UI_resources.h | 5 +++ source/blender/editors/interface/resources.c | 21 +++++++++ .../editors/space_console/console_draw.c | 12 +++-- source/blender/makesdna/DNA_userdef_types.h | 3 ++ source/blender/makesrna/RNA_access.h | 1 + source/blender/makesrna/intern/rna_userdef.c | 45 +++++++++++++++++++ 7 files changed, 96 insertions(+), 4 deletions(-) diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py index 534735bfc24..ca89878c9d9 100644 --- a/release/scripts/ui/space_userpref.py +++ b/release/scripts/ui/space_userpref.py @@ -920,6 +920,19 @@ class USERPREF_PT_theme(bpy.types.Panel): col = split.column() col.prop(prefs, "header_text") + + elif theme.theme_area == 'CONSOLE': + prefs = theme.console + + col = split.column() + col.prop(prefs, "header") + + col = split.column() + col.prop(prefs, "line_output") + col.prop(prefs, "line_input") + col.prop(prefs, "line_info") + col.prop(prefs, "line_error") + class USERPREF_PT_file(bpy.types.Panel): diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index 787a39591c7..ad06e56dfa3 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -184,6 +184,11 @@ enum { TH_NODE_CONVERTOR, TH_NODE_GROUP, + TH_CONSOLE_OUTPUT, + TH_CONSOLE_INPUT, + TH_CONSOLE_INFO, + TH_CONSOLE_ERROR, + TH_SEQ_MOVIE, TH_SEQ_IMAGE, TH_SEQ_SCENE, diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 15513daa624..28f9a6e79f5 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -154,6 +154,9 @@ char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) case SPACE_USERPREF: ts= &btheme->tuserpref; break; + case SPACE_CONSOLE: + ts= &btheme->tconsole; + break; case SPACE_TIME: ts= &btheme->ttime; break; @@ -340,6 +343,15 @@ char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) case TH_SEQ_META: cp= ts->meta; break; + case TH_CONSOLE_OUTPUT: + cp= ts->console_output; break; + case TH_CONSOLE_INPUT: + cp= ts-> console_input; break; + case TH_CONSOLE_INFO: + cp= ts->console_info; break; + case TH_CONSOLE_ERROR: + cp= ts->console_error; break; + case TH_HANDLE_VERTEX: cp= ts->handle_vertex; break; @@ -407,6 +419,7 @@ static void ui_theme_init_new(bTheme *btheme) ui_theme_init_new_do(&btheme->tnode); ui_theme_init_new_do(&btheme->tlogic); ui_theme_init_new_do(&btheme->tuserpref); + ui_theme_init_new_do(&btheme->tconsole); } @@ -594,6 +607,14 @@ void ui_theme_init_userdef(void) /* space user preferences */ btheme->tuserpref= btheme->tv3d; SETCOLF(btheme->tuserpref.back, 0.45, 0.45, 0.45, 1.0); + + /* space console */ + btheme->tconsole= btheme->tv3d; + SETCOL(btheme->tconsole.console_output, 96, 128, 255, 255); + SETCOL(btheme->tconsole.console_input, 255, 255, 255, 255); + SETCOL(btheme->tconsole.console_info, 0, 170, 0, 255); + SETCOL(btheme->tconsole.console_error, 220, 96, 96, 255); + /* space sound */ btheme->tsnd= btheme->tv3d; diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c index ab1fc8a5fca..3fee2b6277b 100644 --- a/source/blender/editors/space_console/console_draw.c +++ b/source/blender/editors/space_console/console_draw.c @@ -78,16 +78,20 @@ static void console_line_color(unsigned char *fg, int type) { switch(type) { case CONSOLE_LINE_OUTPUT: - fg[0]=96; fg[1]=128; fg[2]=255; + UI_GetThemeColor3ubv(TH_CONSOLE_OUTPUT, fg); + fg[0], fg[1], fg[2]; break; case CONSOLE_LINE_INPUT: - fg[0]=255; fg[1]=255; fg[2]=255; + UI_GetThemeColor3ubv(TH_CONSOLE_INPUT, fg); + fg[0], fg[1], fg[2]; break; case CONSOLE_LINE_INFO: - fg[0]=0; fg[1]=170; fg[2]=0; + UI_GetThemeColor3ubv(TH_CONSOLE_INFO, fg); + fg[0], fg[1], fg[2]; break; case CONSOLE_LINE_ERROR: - fg[0]=220; fg[1]=96; fg[2]=96; + UI_GetThemeColor3ubv(TH_CONSOLE_ERROR, fg); + fg[0], fg[1], fg[2]; break; } } diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index bd8573fe8ce..96c578c9d35 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -201,6 +201,8 @@ typedef struct ThemeSpace { char cframe[4]; char ds_channel[4], ds_subchannel[4]; // dopesheet + char console_output[4], console_input[4], console_info[4], console_error[4]; // Console + char vertex_size, facedot_size; char bpad[2]; @@ -261,6 +263,7 @@ typedef struct bTheme { ThemeSpace tnode; ThemeSpace tlogic; ThemeSpace tuserpref; + ThemeSpace tconsole; /* 20 sets of bone colors for this theme */ ThemeWireColor tarm[20]; diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index ba2d272309f..3be97710dd5 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -492,6 +492,7 @@ extern StructRNA RNA_TextureSlot; extern StructRNA RNA_Theme; extern StructRNA RNA_ThemeAudioWindow; extern StructRNA RNA_ThemeBoneColorSet; +extern StructRNA RNA_ThemeConsole; extern StructRNA RNA_ThemeDopeSheet; extern StructRNA RNA_ThemeFileBrowser; extern StructRNA RNA_ThemeFontStyle; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index bc0e11bf780..903ed5796dc 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -906,6 +906,44 @@ static void rna_def_userdef_theme_space_userpref(BlenderRNA *brna) rna_def_userdef_theme_spaces_main(srna, SPACE_USERPREF); } +static void rna_def_userdef_theme_space_console(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + /* space_console */ + + srna= RNA_def_struct(brna, "ThemeConsole", NULL); + RNA_def_struct_sdna(srna, "ThemeSpace"); + RNA_def_struct_ui_text(srna, "Theme Console", "Theme settings for the Console."); + + rna_def_userdef_theme_spaces_main(srna, SPACE_CONSOLE); + + prop= RNA_def_property(srna, "line_output", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "console_output"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Line Output", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "line_input", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "console_input"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Line Input", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "line_info", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "console_info"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Line Info", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "line_error", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "console_error"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Line Error", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); +} + static void rna_def_userdef_theme_space_info(BlenderRNA *brna) { StructRNA *srna; @@ -1562,6 +1600,12 @@ static void rna_def_userdef_themes(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "tuserpref"); RNA_def_property_struct_type(prop, "ThemeUserPreferences"); RNA_def_property_ui_text(prop, "User Preferences", ""); + + prop= RNA_def_property(srna, "console", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_pointer_sdna(prop, NULL, "tconsole"); + RNA_def_property_struct_type(prop, "ThemeConsole"); + RNA_def_property_ui_text(prop, "Console", ""); prop= RNA_def_property(srna, "bone_color_sets", PROP_COLLECTION, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); @@ -1590,6 +1634,7 @@ static void rna_def_userdef_dothemes(BlenderRNA *brna) rna_def_userdef_theme_space_outliner(brna); rna_def_userdef_theme_space_info(brna); rna_def_userdef_theme_space_userpref(brna); + rna_def_userdef_theme_space_console(brna); rna_def_userdef_theme_space_sound(brna); rna_def_userdef_theme_space_logic(brna); rna_def_userdef_theme_colorset(brna);