[murrine/textstyle-changes] New option: text_shade = 1.0 to specify the shade effect of the text's shadow.



commit 621af09d1deee4c65192ff8e6e007b24d82f9dd8
Author: Andrea Cimitan <andrea cimitan gmail com>
Date:   Fri May 14 15:18:16 2010 +0200

    New option: text_shade = 1.0 to specify the shade effect of the text's shadow.

 NEWS                     |    8 +++--
 schema/murrine.xml.in.in |   18 ++++++++++--
 src/murrine_rc_style.c   |   54 ++++++++++++++++++++++++------------
 src/murrine_rc_style.h   |   67 +++++++++++++++++++++++++--------------------
 src/murrine_style.c      |   11 +++++---
 src/murrine_style.h      |    1 +
 6 files changed, 101 insertions(+), 58 deletions(-)
---
diff --git a/NEWS b/NEWS
index bfbe10d..1068391 100644
--- a/NEWS
+++ b/NEWS
@@ -22,9 +22,11 @@ Changes in this release:
 - New option: shadow_shades = { 1.0, 1.0 } to draw a gradient on
               the shadow of some widgets.
 - New option: spinbuttonstyle = 1 to add a separator on the GtkSpinButton.
-- New option: textstyle = 1 for an inset on the text (use carefully).
-              textstyle = 2 for an inverted inset on the text (use carefully).
-              textstyle = 3 for a subtle shadow on the text (use carefully).
+- New option: textstyle = 1 for a shadow at the bottom of the text.
+              textstyle = 2 for a shadow at the top of the text.
+              textstyle = 3 for a shadow at the bottom right of the text.
+              textstyle = 4 for a shadow at the top left of the text.
+- New option: text_shade = 1.0 to specify the shade effect of the text's shadow.
 - New option: trough_shades = { 1.0, 1.0 } to draw a gradient on
               the trough of GtkScrollbar and GtkProgressBar.
 - Changed option: listviewstyle = 2 for a solid line.
diff --git a/schema/murrine.xml.in.in b/schema/murrine.xml.in.in
index 104759f..742f65e 100644
--- a/schema/murrine.xml.in.in
+++ b/schema/murrine.xml.in.in
@@ -370,14 +370,26 @@
 			<label>No effect</label>
 		</enumeration>
 		<enumeration value="1">
-			<label>Add inset</label>
+			<label>Shadow at bottom</label>
 		</enumeration>
 		<enumeration value="2">
-			<label>Add inverted inset</label>
+			<label>Shadow at top</label>
 		</enumeration>
 		<enumeration value="3">
-			<label>Add shadow</label>
+			<label>Shadow ad bottom right</label>
 		</enumeration>
+		<enumeration value="4">
+			<label>Shadow ad top left</label>
+		</enumeration>
+	</option>
+
+	<option type="enumeration" name="text_shade"  default="1.06">
+		<_long_name>Text Shade</_long_name>
+		<_description>Increse/Decrease the text shadow shade</_description>
+		<section>General</section>
+		<minimum>0</minimum>
+		<maximum>2</maximum>
+		<precision>2</precision>
 	</option>
 
 	<option type="enumeration" name="toolbarstyle" default="0">
diff --git a/src/murrine_rc_style.c b/src/murrine_rc_style.c
index 8000796..fc400ca 100644
--- a/src/murrine_rc_style.c
+++ b/src/murrine_rc_style.c
@@ -71,6 +71,7 @@ enum
 	TOKEN_SPINBUTTONSTYLE,
 	TOKEN_STEPPERSTYLE,
 	TOKEN_TEXTSTYLE,
+	TOKEN_TEXT_SHADE,
 	TOKEN_TOOLBARSTYLE,
 	TOKEN_TROUGH_SHADES,
 
@@ -131,6 +132,7 @@ theme_symbols[] =
 	{ "spinbuttonstyle",     TOKEN_SPINBUTTONSTYLE },
 	{ "stepperstyle",        TOKEN_STEPPERSTYLE },
 	{ "textstyle",           TOKEN_TEXTSTYLE },
+	{ "text_shade",          TOKEN_TEXT_SHADE },
 	{ "toolbarstyle",        TOKEN_TOOLBARSTYLE },
 	{ "trough_shades",       TOKEN_TROUGH_SHADES },
 
@@ -201,6 +203,7 @@ murrine_rc_style_init (MurrineRcStyle *murrine_rc)
 	murrine_rc->spinbuttonstyle = 0;
 	murrine_rc->stepperstyle = 0;
 	murrine_rc->textstyle = 0;
+	murrine_rc->text_shade = 1.06;
 	murrine_rc->toolbarstyle = 0;
 	murrine_rc->trough_shades[0] = 1.0;
 	murrine_rc->trough_shades[1] = 1.0;
@@ -611,7 +614,7 @@ murrine_rc_style_parse (GtkRcStyle *rc_style,
 		{
 			case TOKEN_ANIMATION:
 				token = theme_parse_boolean (settings, scanner, &murrine_style->animation);
-				murrine_style->flags |= MRN_FLAG_ANIMATION;
+				murrine_style->bflags |= MRN_FLAG_ANIMATION;
 				break;
 			case TOKEN_ARROWSTYLE:
 				token = theme_parse_int (settings, scanner, &murrine_style->arrowstyle);
@@ -631,7 +634,7 @@ murrine_rc_style_parse (GtkRcStyle *rc_style,
 				break;
 			case TOKEN_COLORIZE_SCROLLBAR:
 				token = theme_parse_boolean (settings, scanner, &murrine_style->colorize_scrollbar);
-				murrine_style->flags |= MRN_FLAG_COLORIZE_SCROLLBAR;
+				murrine_style->bflags |= MRN_FLAG_COLORIZE_SCROLLBAR;
 				break;
 			case TOKEN_COMBOBOXSTYLE:
 				token = theme_parse_int (settings, scanner, &murrine_style->comboboxstyle);
@@ -639,11 +642,11 @@ murrine_rc_style_parse (GtkRcStyle *rc_style,
 				break;
 			case TOKEN_CONTRAST:
 				token = theme_parse_shade (settings, scanner, &murrine_style->contrast);
-				murrine_style->flags |= MRN_FLAG_CONTRAST;
+				murrine_style->bflags |= MRN_FLAG_CONTRAST;
 				break;
 			case TOKEN_DISABLE_FOCUS:
 				token = theme_parse_boolean (settings, scanner, &murrine_style->disable_focus);
-				murrine_style->flags |= MRN_FLAG_DISABLE_FOCUS;
+				murrine_style->bflags |= MRN_FLAG_DISABLE_FOCUS;
 				break;
 			case TOKEN_FOCUS_COLOR:
 				token = theme_parse_color (settings, scanner, rc_style, &murrine_style->focus_color);
@@ -719,11 +722,11 @@ murrine_rc_style_parse (GtkRcStyle *rc_style,
 				break;
 			case TOKEN_RGBA:
 				token = theme_parse_boolean (settings, scanner, &murrine_style->rgba);
-				murrine_style->flags |= MRN_FLAG_RGBA;
+				murrine_style->bflags |= MRN_FLAG_RGBA;
 				break;
 			case TOKEN_ROUNDNESS:
 				token = theme_parse_int (settings, scanner, &murrine_style->roundness);
-				murrine_style->flags |= MRN_FLAG_ROUNDNESS;
+				murrine_style->bflags |= MRN_FLAG_ROUNDNESS;
 				break;
 			case TOKEN_SCROLLBARSTYLE:
 				token = theme_parse_int (settings, scanner, &murrine_style->scrollbarstyle);
@@ -753,6 +756,10 @@ murrine_rc_style_parse (GtkRcStyle *rc_style,
 				token = theme_parse_int (settings, scanner, &murrine_style->textstyle);
 				murrine_style->flags |= MRN_FLAG_TEXTSTYLE;
 				break;
+			case TOKEN_TEXT_SHADE:
+				token = theme_parse_shade (settings, scanner, &murrine_style->text_shade);
+				murrine_style->flags |= MRN_FLAG_TEXT_SHADE;
+				break;
 			case TOKEN_TOOLBARSTYLE:
 				token = theme_parse_int (settings, scanner, &murrine_style->toolbarstyle);
 				murrine_style->flags |= MRN_FLAG_TOOLBARSTYLE;
@@ -824,6 +831,7 @@ murrine_rc_style_merge (GtkRcStyle *dest,
 {
 	MurrineRcStyle *dest_w, *src_w;
 	MurrineRcFlags flags;
+	MurrineRcBasicFlags bflags;
 	MurrineRcGradientFlags gflags;
 
 	GTK_RC_STYLE_CLASS (murrine_rc_style_parent_class)->merge (dest, src);
@@ -834,22 +842,15 @@ murrine_rc_style_merge (GtkRcStyle *dest,
 	src_w = MURRINE_RC_STYLE (src);
 	dest_w = MURRINE_RC_STYLE (dest);
 
+	/* Flags */
 	flags = (~dest_w->flags) & src_w->flags;
 
-	if (flags & MRN_FLAG_ANIMATION)
-		dest_w->animation = src_w->animation;
 	if (flags & MRN_FLAG_ARROWSTYLE)
 		dest_w->arrowstyle = src_w->arrowstyle;
 	if (flags & MRN_FLAG_CELLSTYLE)
 		dest_w->cellstyle = src_w->cellstyle;
-	if (flags & MRN_FLAG_COLORIZE_SCROLLBAR)
-		dest_w->colorize_scrollbar = src_w->colorize_scrollbar;
 	if (flags & MRN_FLAG_COMBOBOXSTYLE)
 		dest_w->comboboxstyle = src_w->comboboxstyle;
-	if (flags & MRN_FLAG_CONTRAST)
-		dest_w->contrast = src_w->contrast;
-	if (flags & MRN_FLAG_DISABLE_FOCUS)
-		dest_w->disable_focus = src_w->disable_focus;
 	if (flags & MRN_FLAG_FOCUS_COLOR)
 		dest_w->focus_color = src_w->focus_color;
 	if (flags & MRN_FLAG_GLAZESTYLE)
@@ -882,10 +883,6 @@ murrine_rc_style_merge (GtkRcStyle *dest,
 		dest_w->progressbarstyle = src_w->progressbarstyle;
 	if (flags & MRN_FLAG_RELIEFSTYLE)
 		dest_w->reliefstyle = src_w->reliefstyle;
-	if (flags & MRN_FLAG_RGBA)
-		dest_w->rgba = src_w->rgba;
-	if (flags & MRN_FLAG_ROUNDNESS)
-		dest_w->roundness = src_w->roundness;
 	if (flags & MRN_FLAG_SCROLLBARSTYLE)
 		dest_w->scrollbarstyle = src_w->scrollbarstyle;
 	if (flags & MRN_FLAG_SEPARATORSTYLE)
@@ -898,11 +895,32 @@ murrine_rc_style_merge (GtkRcStyle *dest,
 		dest_w->stepperstyle = src_w->stepperstyle;
 	if (flags & MRN_FLAG_TEXTSTYLE)
 		dest_w->textstyle = src_w->textstyle;
+	if (flags & MRN_FLAG_TEXT_SHADE)
+		dest_w->text_shade = src_w->text_shade;
 	if (flags & MRN_FLAG_TOOLBARSTYLE)
 		dest_w->toolbarstyle = src_w->toolbarstyle;
 
 	dest_w->flags |= src_w->flags;
 
+	/* Basic Flags */
+	bflags = (~dest_w->bflags) & src_w->bflags;
+
+	if (bflags & MRN_FLAG_ANIMATION)
+		dest_w->animation = src_w->animation;
+	if (bflags & MRN_FLAG_COLORIZE_SCROLLBAR)
+		dest_w->colorize_scrollbar = src_w->colorize_scrollbar;
+	if (bflags & MRN_FLAG_CONTRAST)
+		dest_w->contrast = src_w->contrast;
+	if (bflags & MRN_FLAG_DISABLE_FOCUS)
+		dest_w->disable_focus = src_w->disable_focus;
+	if (bflags & MRN_FLAG_RGBA)
+		dest_w->rgba = src_w->rgba;
+	if (bflags & MRN_FLAG_ROUNDNESS)
+		dest_w->roundness = src_w->roundness;
+
+	dest_w->bflags |= src_w->bflags;
+
+	/* Gradient Flags */
 	gflags = (~dest_w->gflags) & src_w->gflags;
 
 	if (gflags & MRN_FLAG_BORDER_COLORS)
diff --git a/src/murrine_rc_style.h b/src/murrine_rc_style.h
index c9278b1..4eb44d6 100644
--- a/src/murrine_rc_style.h
+++ b/src/murrine_rc_style.h
@@ -35,42 +35,47 @@ typedef struct _MurrineRcStyleClass MurrineRcStyleClass;
 
 typedef enum
 {
-	MRN_FLAG_ANIMATION = 1 << 0,
 	MRN_FLAG_ARROWSTYLE = 1 << 1,
 	MRN_FLAG_CELLSTYLE = 1 << 2,
-	MRN_FLAG_COLORIZE_SCROLLBAR = 1 << 3,
-	MRN_FLAG_COMBOBOXSTYLE = 1 << 4,
-	MRN_FLAG_CONTRAST = 1 << 5,
-	MRN_FLAG_DISABLE_FOCUS = 1 << 6,
-	MRN_FLAG_FOCUS_COLOR = 1 << 7,
-	MRN_FLAG_GLAZESTYLE = 1 << 8,
-	MRN_FLAG_GLOW_SHADE = 1 << 9,
-	MRN_FLAG_GLOWSTYLE = 1 << 10,
-	MRN_FLAG_HIGHLIGHT_SHADE = 1 << 11,
-	MRN_FLAG_LIGHTBORDER_SHADE = 1 << 12,
-	MRN_FLAG_LIGHTBORDERSTYLE= 1 << 13,
-	MRN_FLAG_LISTVIEWHEADERSTYLE = 1 << 14,
-	MRN_FLAG_LISTVIEWSTYLE = 1 << 15,
-	MRN_FLAG_MENUBARITEMSTYLE = 1 << 16,
-	MRN_FLAG_MENUBARSTYLE = 1 << 17,
-	MRN_FLAG_MENUITEMSTYLE = 1 << 18,
-	MRN_FLAG_MENUSTYLE = 1 << 19,
-	MRN_FLAG_PRELIGHT_SHADE = 1 << 20,
-	MRN_FLAG_PROGRESSBARSTYLE = 1 << 21,
-	MRN_FLAG_RELIEFSTYLE = 1 << 22,
-	MRN_FLAG_RGBA = 1 << 23,
-	MRN_FLAG_ROUNDNESS = 1 << 24,
-	MRN_FLAG_SCROLLBARSTYLE = 1 << 25,
-	MRN_FLAG_SEPARATORSTYLE = 1 << 26,
-	MRN_FLAG_SLIDERSTYLE = 1 << 27,
-	MRN_FLAG_SPINBUTTONSTYLE = 1 << 28,
-	MRN_FLAG_STEPPERSTYLE = 1 << 29,
-	MRN_FLAG_TEXTSTYLE = 1 << 30,
-	MRN_FLAG_TOOLBARSTYLE = 1 << 31
+	MRN_FLAG_COMBOBOXSTYLE = 1 << 3,
+	MRN_FLAG_FOCUS_COLOR = 1 << 4,
+	MRN_FLAG_GLAZESTYLE = 1 << 5,
+	MRN_FLAG_GLOW_SHADE = 1 << 6,
+	MRN_FLAG_GLOWSTYLE = 1 << 7,
+	MRN_FLAG_HIGHLIGHT_SHADE = 1 << 8,
+	MRN_FLAG_LIGHTBORDER_SHADE = 1 << 9,
+	MRN_FLAG_LIGHTBORDERSTYLE= 1 << 10,
+	MRN_FLAG_LISTVIEWHEADERSTYLE = 1 << 11,
+	MRN_FLAG_LISTVIEWSTYLE = 1 << 12,
+	MRN_FLAG_MENUBARITEMSTYLE = 1 << 13,
+	MRN_FLAG_MENUBARSTYLE = 1 << 14,
+	MRN_FLAG_MENUITEMSTYLE = 1 << 15,
+	MRN_FLAG_MENUSTYLE = 1 << 16,
+	MRN_FLAG_PRELIGHT_SHADE = 1 << 17,
+	MRN_FLAG_PROGRESSBARSTYLE = 1 << 18,
+	MRN_FLAG_RELIEFSTYLE = 1 << 19,
+	MRN_FLAG_SCROLLBARSTYLE = 1 << 20,
+	MRN_FLAG_SEPARATORSTYLE = 1 << 21,
+	MRN_FLAG_SLIDERSTYLE = 1 << 22,
+	MRN_FLAG_SPINBUTTONSTYLE = 1 << 23,
+	MRN_FLAG_STEPPERSTYLE = 1 << 24,
+	MRN_FLAG_TEXTSTYLE = 1 << 25,
+	MRN_FLAG_TEXT_SHADE = 1 << 26,
+	MRN_FLAG_TOOLBARSTYLE = 1 << 27
 } MurrineRcFlags;
 
 typedef enum
 {
+	MRN_FLAG_ANIMATION = 1 << 0,
+	MRN_FLAG_COLORIZE_SCROLLBAR = 1 << 1,
+	MRN_FLAG_CONTRAST = 1 << 2,
+	MRN_FLAG_DISABLE_FOCUS = 1 << 3,
+	MRN_FLAG_RGBA = 1 << 4,
+	MRN_FLAG_ROUNDNESS = 1 << 5
+} MurrineRcBasicFlags;
+
+typedef enum
+{
 	MRN_FLAG_BORDER_COLORS = 1 << 1,
 	MRN_FLAG_BORDER_SHADES = 1 << 2,
 	MRN_FLAG_GRADIENT_COLORS = 1 << 3,
@@ -84,6 +89,7 @@ struct _MurrineRcStyle
 	GtkRcStyle parent_instance;
 
 	MurrineRcFlags flags;
+	MurrineRcBasicFlags bflags;
 	MurrineRcGradientFlags gflags;
 
 	double   border_shades[2];
@@ -94,6 +100,7 @@ struct _MurrineRcStyle
 	double   lightborder_shade;
 	double   prelight_shade;
 	double   shadow_shades[2];
+	double   text_shade;
 	double   trough_shades[2];
 
 	guint8   arrowstyle;
diff --git a/src/murrine_style.c b/src/murrine_style.c
index f02f8cc..38e8bfd 100644
--- a/src/murrine_style.c
+++ b/src/murrine_style.c
@@ -1956,25 +1956,26 @@ murrine_style_draw_layout (GtkStyle     *style,
 		GdkColor etched;
 		MurrineRGB temp;
 
-		double shade_level = 1.0;
+		double shade_level = murrine_style->text_shade;
 		int xos = 0;
 		int yos = 0;
 
 		switch (murrine_style->textstyle)
 		{
 			case 1:
-				shade_level = 1.06;
 				yos = 1;
 				break;
 			case 2:
-				shade_level = 0.6;
 				yos = -1;
 				break;
 			case 3:
-				shade_level = 0.82;
 				xos = 1;
 				yos = 1;
 				break;
+			case 4:
+				xos = -1;
+				yos = -1;
+				break;
 		}
 
 		if (state_type == GTK_STATE_INSENSITIVE)
@@ -2384,6 +2385,7 @@ murrine_style_init_from_rc (GtkStyle   *style,
 	murrine_style->spinbuttonstyle     = MURRINE_RC_STYLE (rc_style)->spinbuttonstyle;
 	murrine_style->stepperstyle        = MURRINE_RC_STYLE (rc_style)->stepperstyle;
 	murrine_style->textstyle           = MURRINE_RC_STYLE (rc_style)->textstyle;
+	murrine_style->text_shade          = MURRINE_RC_STYLE (rc_style)->text_shade;
 	murrine_style->toolbarstyle        = MURRINE_RC_STYLE (rc_style)->toolbarstyle;
 
 	if (murrine_style->has_border_colors)
@@ -2532,6 +2534,7 @@ murrine_style_copy (GtkStyle *style, GtkStyle *src)
 	mrn_style->spinbuttonstyle     = mrn_src->spinbuttonstyle;
 	mrn_style->stepperstyle        = mrn_src->stepperstyle;
 	mrn_style->textstyle           = mrn_src->textstyle;
+	mrn_style->text_shade          = mrn_src->text_shade;
 	mrn_style->toolbarstyle        = mrn_src->toolbarstyle;
 	mrn_style->trough_shades[0]    = mrn_src->trough_shades[0];
 	mrn_style->trough_shades[1]    = mrn_src->trough_shades[1];
diff --git a/src/murrine_style.h b/src/murrine_style.h
index 1301b09..a126aeb 100644
--- a/src/murrine_style.h
+++ b/src/murrine_style.h
@@ -50,6 +50,7 @@ struct _MurrineStyle
 	double   lightborder_shade;
 	double   prelight_shade;
 	double   shadow_shades[2];
+	double   text_shade;
 	double   trough_shades[2];
 
 	guint8   arrowstyle;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]