UI: Widget Text Cursor Color

Adds a theme setting to specify color of widget text insertion cursor (caret).

Differential Revision: https://developer.blender.org/D6024

Reviewed by Campbell Barton
This commit is contained in:
2019-11-25 08:36:05 -08:00
committed by Harley Acheson
parent 78071d0cdf
commit b374b24f1b
11 changed files with 18 additions and 6 deletions

View File

@@ -238,6 +238,7 @@ const bTheme U_theme_default = {
.menu_shadow_fac = 0.3f,
.menu_shadow_width = 4,
.editor_outline = RGBA(0x1f1f1fff),
.widget_text_cursor = RGBA(0x3399e6ff),
.icon_alpha = 1.0f,
.icon_saturation = 0.5f,
.xaxis = RGBA(0xff3352ff),

View File

@@ -932,6 +932,7 @@ class USERPREF_PT_theme_interface_styles(PreferencePanel, Panel):
flow.prop(ui, "icon_alpha")
flow.prop(ui, "icon_saturation")
flow.prop(ui, "editor_outline")
flow.prop(ui, "widget_text_cursor")
flow.prop(ui, "menu_shadow_width")
flow.prop(ui, "widget_emboss")

View File

@@ -162,6 +162,7 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
{
FROM_DEFAULT_V4_UCHAR(space_sequencer.anim_preview_range);
FROM_DEFAULT_V4_UCHAR(space_text.line_numbers);
FROM_DEFAULT_V4_UCHAR(tui.widget_text_cursor);
}
#undef FROM_DEFAULT_V4_UCHAR

View File

@@ -293,7 +293,7 @@ typedef enum ThemeColorID {
TH_NLA_SOUND_SEL,
TH_WIDGET_EMBOSS,
TH_WIDGET_TEXT_CURSOR,
TH_EDITOR_OUTLINE,
TH_AXIS_X, /* X/Y/Z Axis */

View File

@@ -2227,7 +2227,7 @@ static void widget_draw_text(const uiFontStyle *fstyle,
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3f(0.2f, 0.6f, 0.9f);
immUniformThemeColor(TH_WIDGET_TEXT_CURSOR);
but_cursor_shape.xmin = (rect->xmin + t) - U.pixelsize;
but_cursor_shape.ymin = rect->ymin + U.pixelsize;

View File

@@ -872,6 +872,9 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
case TH_EDITOR_OUTLINE:
cp = btheme->tui.editor_outline;
break;
case TH_WIDGET_TEXT_CURSOR:
cp = btheme->tui.widget_text_cursor;
break;
case TH_AXIS_X:
cp = btheme->tui.xaxis;
break;

View File

@@ -173,7 +173,7 @@ typedef struct ThemeUI {
float icon_alpha;
float icon_saturation;
char _pad[4];
unsigned char widget_text_cursor[4];
/* Axis Colors */
unsigned char xaxis[4], yaxis[4], zaxis[4];

View File

@@ -1487,6 +1487,12 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
prop, "Editor Outline", "Color of the outline of the editors and their round corners");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "widget_text_cursor", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "widget_text_cursor");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Text Cursor", "Color of the interface widgets text insertion cursor (caret)");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
/* axis */
prop = RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "xaxis");