UI: Widget Text Cursor Color
authorPaul (Thirio) <paul@paulcoops.com>
Mon, 25 Nov 2019 16:36:05 +0000 (08:36 -0800)
committerHarley Acheson <harley.acheson@gmail.com>
Mon, 25 Nov 2019 16:36:05 +0000 (08:36 -0800)
Adds a theme setting to specify color of widget text insertion cursor (caret).

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

Reviewed by Campbell Barton

release/datafiles/locale
release/datafiles/userdef/userdef_default_theme.c
release/scripts/addons
release/scripts/addons_contrib
release/scripts/startup/bl_ui/space_userpref.py
source/blender/blenloader/intern/versioning_userdef.c
source/blender/editors/include/UI_resources.h
source/blender/editors/interface/interface_widgets.c
source/blender/editors/interface/resources.c
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/intern/rna_userdef.c

index 5402eec9637b5c360e35bdd936d9e7a076d5df7f..a2fb7b56b6c99ca14aa1dd09659ad0242c1b1589 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 5402eec9637b5c360e35bdd936d9e7a076d5df7f
+Subproject commit a2fb7b56b6c99ca14aa1dd09659ad0242c1b1589
index 6d0107de2fe1d71223faf4a8179dd3091c5cf4cb..383f3542c7fc4b4b899f21aeea42ef89c6adf0d7 100644 (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),
index 249288e02afdcd024a64480ec29fa61be53dc5ec..14d4b8f4e936d37eb783ae7368549f6b98d34761 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 249288e02afdcd024a64480ec29fa61be53dc5ec
+Subproject commit 14d4b8f4e936d37eb783ae7368549f6b98d34761
index f3beaf241996d17feec0dee5f0888b0e9f55b4e3..a7fe2ba6378e81c7e8a9f73167567141882834c1 160000 (submodule)
@@ -1 +1 @@
-Subproject commit f3beaf241996d17feec0dee5f0888b0e9f55b4e3
+Subproject commit a7fe2ba6378e81c7e8a9f73167567141882834c1
index e5c65ac0905d2d3e5e9d3f714e9a017350625ded..7c6a7ecbcee4430feef0d1e85875ad868c5f2c68 100644 (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")
 
index ac7fcdd376955fc460af16dbf0fbb7555e92565c..ad06d512266084724a24d94a182f19db256b70b6 100644 (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
index c909c9b8d587f2fb2c5c232fcda6d2143ab58038..738a91c085d2ce3f0477f8531f92886b2ddfe49c 100644 (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 */
index df2b78e0a6fbfac05aae41f479a3198884b69b24..f2027d491fbf9b2c7e7bfd733c9aec9e82cc39d2 100644 (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;
index a4dd0cb5c9f36141e881116601252063d029007f..99833e9200d18f29e78cbf4f47a8fe661dd86cf8 100644 (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;
index 3e10e817946ca50e48953a23aff2b49b19addc7a..11a0e4413921824ffe9a733797f53e3dfeab8d5c 100644 (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];
index 66ed6ca1431cae891bee455a53ee90ba4656c907..3ccf53db180f52d97361f0beae54f00ee7d5e391 100644 (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");