From 6753411adb54458ee87deda25ca662e0689f676d Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Mon, 15 Feb 2010 02:39:40 +0000 Subject: [PATCH] Console: * Added own theme support for the cursor, was depending on the line_error color before. --- release/scripts/ui/space_userpref.py | 1 + source/blender/editors/include/UI_resources.h | 1 + source/blender/editors/interface/resources.c | 3 +++ source/blender/editors/space_console/console_draw.c | 2 +- source/blender/makesdna/DNA_userdef_types.h | 2 +- source/blender/makesrna/intern/rna_userdef.c | 6 ++++++ 6 files changed, 13 insertions(+), 2 deletions(-) diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py index 2c5e77ec2d9..e9de9f10d03 100644 --- a/release/scripts/ui/space_userpref.py +++ b/release/scripts/ui/space_userpref.py @@ -958,6 +958,7 @@ class USERPREF_PT_theme(bpy.types.Panel): col.prop(prefs, "line_input") col.prop(prefs, "line_info") col.prop(prefs, "line_error") + col.prop(prefs, "cursor") 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 6d9eee62601..2f908559c6c 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -189,6 +189,7 @@ enum { TH_CONSOLE_INPUT, TH_CONSOLE_INFO, TH_CONSOLE_ERROR, + TH_CONSOLE_CURSOR, TH_SEQ_MOVIE, TH_SEQ_IMAGE, diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 00c6e796f8c..f86ffe657cc 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -353,6 +353,8 @@ char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) cp= ts->console_info; break; case TH_CONSOLE_ERROR: cp= ts->console_error; break; + case TH_CONSOLE_CURSOR: + cp= ts->console_cursor; break; case TH_HANDLE_VERTEX: cp= ts->handle_vertex; @@ -622,6 +624,7 @@ void ui_theme_init_userdef(void) 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); + SETCOL(btheme->tconsole.console_cursor, 220, 96, 96, 255); /* space sound */ diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c index 5beb7ff22c9..16f5f47075e 100644 --- a/source/blender/editors/space_console/console_draw.c +++ b/source/blender/editors/space_console/console_draw.c @@ -331,7 +331,7 @@ static int console_text_main__internal(struct SpaceConsole *sc, struct ARegion * BLF_draw(cl->line); /* cursor */ - console_line_color(fg, CONSOLE_LINE_ERROR); /* lazy */ + UI_GetThemeColor3ubv(TH_CONSOLE_CURSOR, (char *)fg); glColor3ub(fg[0], fg[1], fg[2]); glRecti(xy[0]+(cwidth*cl->cursor) -1, xy[1]-2, xy[0]+(cwidth*cl->cursor) +1, xy[1]+sc->lheight-2); diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 5bcb7b20104..a66a6fb9408 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -202,7 +202,7 @@ 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]; + char console_output[4], console_input[4], console_info[4], console_error[4], console_cursor[4]; char vertex_size, facedot_size; char bpad[6]; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 84325e39740..b6e50734b67 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -1003,6 +1003,12 @@ static void rna_def_userdef_theme_space_console(BlenderRNA *brna) RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Line Error", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "cursor", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "console_cursor"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Cursor", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); } static void rna_def_userdef_theme_space_info(BlenderRNA *brna)