[murrine] Added prelight_shade, uses bg[GTK_STATE_PRELIGHT] on not-colorized scrollbar
- From: Andrea Cimitan <acimitan src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [murrine] Added prelight_shade, uses bg[GTK_STATE_PRELIGHT] on not-colorized scrollbar
- Date: Tue, 8 Dec 2009 15:23:57 +0000 (UTC)
commit 4317e8f715b5c549fdf9e7bda09aa7230a704e31
Author: Andrea Cimitan <andrea cimitan gmail com>
Date: Tue Dec 8 16:02:40 2009 +0100
Added prelight_shade, uses bg[GTK_STATE_PRELIGHT] on not-colorized scrollbar
NEWS | 35 +++++----
schema/murrine.xml.in.in | 9 +++
src/murrine_draw.c | 9 ++-
src/murrine_draw_rgba.c | 6 +-
src/murrine_rc_style.c | 9 +++
src/murrine_rc_style.h | 22 +++---
src/murrine_style.c | 28 ++++---
src/murrine_style.h | 1 +
src/murrine_types.h | 178 +++++++++++++++++++++++-----------------------
9 files changed, 165 insertions(+), 132 deletions(-)
---
diff --git a/NEWS b/NEWS
index cff58d0..039aa64 100644
--- a/NEWS
+++ b/NEWS
@@ -4,18 +4,21 @@ Changes in this release:
- New supported widget: GtkExpander is now themed by the engine.
- New option: arrowstyle = 1 to draw filled arrows.
- New option: border_shades = { 1.0, 1.0 } to draw a gradient on the border.
-- New option: border_colors = { "#ffffff", "#ffffff" }
+- New option: border_colors = { "#ffffff", "#ffffff" }
to set the colors used on the border of many widgets.
border_colors = FALSE to disable.
- New option: comboboxstyle = 1 to colorize the GtkComboBox below the arrow.
- New option: gradient_colors = { "#ffffff", "#ffffff", "#ffffff", "#ffffff" }
to set the colors used on the gradient of many widgets.
gradient_colors = FALSE to disable.
-- New option: shadow_shades = { 1.0, 1.0 } to draw a gradient on
+- New option: prelight_shade = 1.0 to select the shade level used in the
+ scrollbar's slider, GtkComboBox with comboboxstyle = 1 and
+ in the prelight state with gradient_colors.
+- 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 to draw an inset on the text (use carefully).
-- New option: trough_shades = { 1.0, 1.0 } to draw a gradient on
+- New option: trough_shades = { 1.0, 1.0 } to draw a gradient on
the trough of GtkScrollbar and GtkProgressBar.
- Changed option: reliefstyle = 3 for a gradient on shadow,
reliefstyle = 4 for a stronger shadow.
@@ -27,6 +30,8 @@ Changes in this release:
- Improved rendering: draw lightborder with on menubar (with menubarstyle = 1).
- Improved rendering: draw lightborder with on toolbar (with toolbarstyle = 1).
- Improved rendering: better GtkTooltip theming.
+- Improved rendering: use bg[GTK_STATE_PRELIGHT] on the scrollbar's slider
+ with colorize_scrollbar = FALSE.
Bugfixes in this release:
- Fix a potential endless loop in draw_progressbar_fill and draw_menuitem.
@@ -59,19 +64,19 @@ Changes in this release:
Overview of Changes in 0.90.0 (since 0.53.1)
============================================
Too many changes to be listed, let's take a summary.
-This new version is extremely customizable with a huge number of new
-options. Those new options allow the user to achieve an incredible
+This new version is extremely customizable with a huge number of new
+options. Those new options allow the user to achieve an incredible
variety of styles.
-In order to add those features the engine was rewritten in many parts,
-sometimes even 2 or 3 times! :-) This results in a simpler code, more
-readable and more maintainable, with a lot of custom code moved from
-each widget drawing function (before) to a general murrine drawing
-support file (now). For example adding a new glaze style will now cost
-about 20 lines and it will be applied immediately to every single
+In order to add those features the engine was rewritten in many parts,
+sometimes even 2 or 3 times! :-) This results in a simpler code, more
+readable and more maintainable, with a lot of custom code moved from
+each widget drawing function (before) to a general murrine drawing
+support file (now). For example adding a new glaze style will now cost
+about 20 lines and it will be applied immediately to every single
widget.
-Murrine can finally use the alpha channel to draw a real transparent
-theme, all it needs is an application using the RGBA colormap and a
+Murrine can finally use the alpha channel to draw a real transparent
+theme, all it needs is an application using the RGBA colormap and a
theme with the rgba option enabled.
-During the whole development, murrine was kept in sync with
-every bugfix that hit gtk-engines, so this new version can also be
+During the whole development, murrine was kept in sync with
+every bugfix that hit gtk-engines, so this new version can also be
considered much more stable than the previous one.
diff --git a/schema/murrine.xml.in.in b/schema/murrine.xml.in.in
index 410f64d..852a910 100644
--- a/schema/murrine.xml.in.in
+++ b/schema/murrine.xml.in.in
@@ -218,6 +218,15 @@
</enumeration>
</option>
+ <option type="real" name="prelight_shade" default="1.0">
+ <_long_name>Prelight Shade</_long_name>
+ <_description>Increse/Decrease the prelight shade</_description>
+ <section>General</section>
+ <minimum>0</minimum>
+ <maximum>2</maximum>
+ <precision>2</precision>
+ </option>
+
<option type="enumeration" name="progressbarstyle" default="1">
<_long_name>Progressbar style</_long_name>
<section>General</section>
diff --git a/src/murrine_draw.c b/src/murrine_draw.c
index d7137e6..6680b4d 100644
--- a/src/murrine_draw.c
+++ b/src/murrine_draw.c
@@ -809,7 +809,8 @@ murrine_draw_combobox (cairo_t *cr,
box_w -= 3;
int os = (widget.xthickness > 2 && widget.ythickness > 2) ? 1 : 0;
colors_new.bg[GTK_STATE_NORMAL] = colors.spot[1];
- colors_new.bg[GTK_STATE_PRELIGHT] = colors.spot[0];
+ murrine_shade (&colors_new.bg[GTK_STATE_NORMAL], combobox->prelight_shade,
+ &colors_new.bg[GTK_STATE_PRELIGHT]);
cairo_save (cr);
if (params.ltr)
@@ -1699,7 +1700,7 @@ murrine_draw_scrollbar_slider (cairo_t *cr,
MurrineGradients mrn_gradient_new = widget->mrn_gradient;
double border_stop_mid = ((mrn_gradient_new.border_shades[0])+
(mrn_gradient_new.border_shades[1]))/2.0;
- MurrineRGB fill = scrollbar->has_color ? scrollbar->color : colors->bg[0];
+ MurrineRGB fill = scrollbar->has_color ? scrollbar->color : colors->bg[widget->state_type];
MurrineRGB border;
uint8 corners = widget->corners;
@@ -1752,8 +1753,8 @@ murrine_draw_scrollbar_slider (cairo_t *cr,
mrn_gradient_new.border_shades[0] = border_stop_mid;
mrn_gradient_new.border_shades[1] = border_stop_mid;
- if (widget->prelight)
- murrine_shade (&fill, 1.04, &fill);
+ if (widget->prelight && scrollbar->has_color)
+ murrine_shade (&fill, scrollbar->prelight_shade, &fill);
murrine_mix_color (&border, &fill, 0.4, &border);
diff --git a/src/murrine_draw_rgba.c b/src/murrine_draw_rgba.c
index b98a156..faf3da5 100644
--- a/src/murrine_draw_rgba.c
+++ b/src/murrine_draw_rgba.c
@@ -1332,7 +1332,7 @@ murrine_rgba_draw_scrollbar_slider (cairo_t *cr,
MurrineGradients mrn_gradient_new = widget->mrn_gradient;
double border_stop_mid = ((mrn_gradient_new.border_shades[0])+
(mrn_gradient_new.border_shades[1]))/2.0;
- MurrineRGB fill = scrollbar->has_color ? scrollbar->color : colors->bg[0];
+ MurrineRGB fill = scrollbar->has_color ? scrollbar->color : colors->bg[widget->state_type];
MurrineRGB border;
uint8 corners = widget->corners;
@@ -1385,8 +1385,8 @@ murrine_rgba_draw_scrollbar_slider (cairo_t *cr,
mrn_gradient_new.border_shades[0] = border_stop_mid;
mrn_gradient_new.border_shades[1] = border_stop_mid;
- if (widget->prelight)
- murrine_shade (&fill, 1.04, &fill);
+ if (widget->prelight && scrollbar->has_color)
+ murrine_shade (&fill, scrollbar->prelight_shade, &fill);
murrine_mix_color (&border, &fill, 0.5, &border);
diff --git a/src/murrine_rc_style.c b/src/murrine_rc_style.c
index cede05c..0b8c240 100644
--- a/src/murrine_rc_style.c
+++ b/src/murrine_rc_style.c
@@ -57,6 +57,7 @@ enum
TOKEN_MENUBARSTYLE,
TOKEN_MENUITEMSTYLE,
TOKEN_MENUSTYLE,
+ TOKEN_PRELIGHT_SHADE,
TOKEN_PROGRESSBARSTYLE,
TOKEN_RELIEFSTYLE,
TOKEN_RGBA,
@@ -113,6 +114,7 @@ theme_symbols[] =
{ "menubarstyle", TOKEN_MENUBARSTYLE },
{ "menuitemstyle", TOKEN_MENUITEMSTYLE },
{ "menustyle", TOKEN_MENUSTYLE },
+ { "prelight_shade", TOKEN_PRELIGHT_SHADE },
{ "progressbarstyle", TOKEN_PROGRESSBARSTYLE },
{ "reliefstyle", TOKEN_RELIEFSTYLE },
{ "rgba", TOKEN_RGBA },
@@ -178,6 +180,7 @@ murrine_rc_style_init (MurrineRcStyle *murrine_rc)
murrine_rc->menubarstyle = 0;
murrine_rc->menuitemstyle = 1;
murrine_rc->menustyle = 1;
+ murrine_rc->prelight_shade = 1.04;
murrine_rc->progressbarstyle = 1;
murrine_rc->reliefstyle = 2;
murrine_rc->rgba = FALSE;
@@ -685,6 +688,10 @@ murrine_rc_style_parse (GtkRcStyle *rc_style,
token = theme_parse_int (settings, scanner, &murrine_style->menustyle);
murrine_style->flags |= MRN_FLAG_MENUSTYLE;
break;
+ case TOKEN_PRELIGHT_SHADE:
+ token = theme_parse_double (settings, scanner, &murrine_style->prelight_shade);
+ murrine_style->flags |= MRN_FLAG_PRELIGHT_SHADE;
+ break;
case TOKEN_PROGRESSBARSTYLE:
token = theme_parse_int (settings, scanner, &murrine_style->progressbarstyle);
murrine_style->flags |= MRN_FLAG_PROGRESSBARSTYLE;
@@ -844,6 +851,8 @@ murrine_rc_style_merge (GtkRcStyle *dest,
dest_w->menuitemstyle = src_w->menuitemstyle;
if (flags & MRN_FLAG_MENUSTYLE)
dest_w->menustyle = src_w->menustyle;
+ if (flags & MRN_FLAG_PRELIGHT_SHADE)
+ dest_w->prelight_shade = src_w->prelight_shade;
if (flags & MRN_FLAG_PROGRESSBARSTYLE)
dest_w->progressbarstyle = src_w->progressbarstyle;
if (flags & MRN_FLAG_RELIEFSTYLE)
diff --git a/src/murrine_rc_style.h b/src/murrine_rc_style.h
index f6b6722..b9f16e6 100644
--- a/src/murrine_rc_style.h
+++ b/src/murrine_rc_style.h
@@ -53,16 +53,17 @@ typedef enum
MRN_FLAG_MENUBARSTYLE = 1 << 15,
MRN_FLAG_MENUITEMSTYLE = 1 << 16,
MRN_FLAG_MENUSTYLE = 1 << 17,
- MRN_FLAG_PROGRESSBARSTYLE = 1 << 18,
- MRN_FLAG_RELIEFSTYLE = 1 << 19,
- MRN_FLAG_RGBA = 1 << 20,
- MRN_FLAG_ROUNDNESS = 1 << 21,
- MRN_FLAG_SCROLLBARSTYLE = 1 << 22,
- MRN_FLAG_SLIDERSTYLE = 1 << 23,
- MRN_FLAG_SPINBUTTONSTYLE = 1 << 24,
- MRN_FLAG_STEPPERSTYLE = 1 << 25,
- MRN_FLAG_TEXTSTYLE = 1 << 26,
- MRN_FLAG_TOOLBARSTYLE = 1 << 27,
+ MRN_FLAG_PRELIGHT_SHADE = 1 << 18,
+ MRN_FLAG_PROGRESSBARSTYLE = 1 << 19,
+ MRN_FLAG_RELIEFSTYLE = 1 << 20,
+ MRN_FLAG_RGBA = 1 << 21,
+ MRN_FLAG_ROUNDNESS = 1 << 22,
+ MRN_FLAG_SCROLLBARSTYLE = 1 << 23,
+ MRN_FLAG_SLIDERSTYLE = 1 << 24,
+ MRN_FLAG_SPINBUTTONSTYLE = 1 << 25,
+ MRN_FLAG_STEPPERSTYLE = 1 << 26,
+ MRN_FLAG_TEXTSTYLE = 1 << 27,
+ MRN_FLAG_TOOLBARSTYLE = 1 << 28
} MurrineRcFlags;
typedef enum
@@ -88,6 +89,7 @@ struct _MurrineRcStyle
double gradient_shades[4];
double highlight_shade;
double lightborder_shade;
+ double prelight_shade;
double shadow_shades[2];
double trough_shades[2];
diff --git a/src/murrine_style.c b/src/murrine_style.c
index 6f46db9..627c16f 100644
--- a/src/murrine_style.c
+++ b/src/murrine_style.c
@@ -169,10 +169,10 @@ murrine_set_widget_parameters (const GtkWidget *widget,
&mrn_gradient.gradient_colors[3].b);
if (params->prelight && !MRN_IS_PROGRESS_BAR(widget)) //progressbar is prelight, no change in shade
{
- mrn_gradient.gradient_shades[0] *= 1.1;
- mrn_gradient.gradient_shades[1] *= 1.1;
- mrn_gradient.gradient_shades[2] *= 1.1;
- mrn_gradient.gradient_shades[3] *= 1.1;
+ mrn_gradient.gradient_shades[0] *= murrine_style->prelight_shade;
+ mrn_gradient.gradient_shades[1] *= murrine_style->prelight_shade;
+ mrn_gradient.gradient_shades[2] *= murrine_style->prelight_shade;
+ mrn_gradient.gradient_shades[3] *= murrine_style->prelight_shade;
}
}
else
@@ -880,6 +880,7 @@ murrine_style_draw_box (DRAW_ARGS)
ComboBoxParameters combobox;
combobox.box_w = 24;
combobox.style = murrine_style->comboboxstyle;
+ combobox.prelight_shade = murrine_style->prelight_shade;
STYLE_FUNCTION(draw_combobox) (cr, murrine_style->colors, params, &combobox, x, y, width, height, horizontal);
}
}
@@ -1283,6 +1284,7 @@ murrine_style_draw_box (DRAW_ARGS)
ComboBoxParameters combobox;
combobox.box_w = indicator_size.width+indicator_spacing.left+indicator_spacing.right+3;
combobox.style = murrine_style->comboboxstyle;
+ combobox.prelight_shade = murrine_style->prelight_shade;
STYLE_FUNCTION(draw_combobox) (cr, murrine_style->colors, params, &combobox, x, y, width, height, TRUE);
}
else
@@ -1322,12 +1324,13 @@ murrine_style_draw_box (DRAW_ARGS)
ScrollBarParameters scrollbar;
boolean within_bevel = FALSE;
- scrollbar.has_color = FALSE;
- scrollbar.horizontal = TRUE;
- scrollbar.junction = murrine_scrollbar_get_junction (widget);
- scrollbar.steppers = murrine_scrollbar_visible_steppers (widget);
- scrollbar.style = murrine_style->scrollbarstyle;
- scrollbar.stepperstyle = murrine_style->stepperstyle;
+ scrollbar.has_color = FALSE;
+ scrollbar.horizontal = TRUE;
+ scrollbar.junction = murrine_scrollbar_get_junction (widget);
+ scrollbar.steppers = murrine_scrollbar_visible_steppers (widget);
+ scrollbar.style = murrine_style->scrollbarstyle;
+ scrollbar.stepperstyle = murrine_style->stepperstyle;
+ scrollbar.prelight_shade = murrine_style->prelight_shade;
if (MRN_IS_RANGE (widget))
scrollbar.horizontal = GTK_RANGE (widget)->orientation == GTK_ORIENTATION_HORIZONTAL;
@@ -1337,8 +1340,7 @@ murrine_style_draw_box (DRAW_ARGS)
scrollbar.color = colors->spot[1];
scrollbar.has_color = TRUE;
}
-
- if (!scrollbar.has_color)
+ else
scrollbar.color = colors->bg[0];
murrine_set_widget_parameters (widget, style, state_type, ¶ms);
@@ -2263,6 +2265,7 @@ murrine_style_init_from_rc (GtkStyle *style,
murrine_style->menubaritemstyle = MURRINE_RC_STYLE (rc_style)->menubaritemstyle;
murrine_style->menuitemstyle = MURRINE_RC_STYLE (rc_style)->menuitemstyle;
murrine_style->menustyle = MURRINE_RC_STYLE (rc_style)->menustyle;
+ murrine_style->prelight_shade = MURRINE_RC_STYLE (rc_style)->prelight_shade;
murrine_style->progressbarstyle = MURRINE_RC_STYLE (rc_style)->progressbarstyle;
murrine_style->reliefstyle = MURRINE_RC_STYLE (rc_style)->reliefstyle;
murrine_style->rgba = MURRINE_RC_STYLE (rc_style)->rgba;
@@ -2404,6 +2407,7 @@ murrine_style_copy (GtkStyle *style, GtkStyle *src)
mrn_style->menubarstyle = mrn_src->menubarstyle;
mrn_style->menuitemstyle = mrn_src->menuitemstyle;
mrn_style->menustyle = mrn_src->menustyle;
+ mrn_style->prelight_shade = mrn_src->prelight_shade;
mrn_style->progressbarstyle = mrn_src->progressbarstyle;
mrn_style->reliefstyle = mrn_src->reliefstyle;
mrn_style->rgba = mrn_src->rgba;
diff --git a/src/murrine_style.h b/src/murrine_style.h
index e503e6b..5758d1c 100644
--- a/src/murrine_style.h
+++ b/src/murrine_style.h
@@ -48,6 +48,7 @@ struct _MurrineStyle
double gradient_shades[4];
double highlight_shade;
double lightborder_shade;
+ double prelight_shade;
double shadow_shades[2];
double trough_shades[2];
diff --git a/src/murrine_types.h b/src/murrine_types.h
index c9e67c1..54fa280 100644
--- a/src/murrine_types.h
+++ b/src/murrine_types.h
@@ -199,64 +199,24 @@ typedef struct
typedef struct
{
- boolean active;
- boolean prelight;
- boolean disabled;
- boolean ltr;
- boolean focus;
- boolean is_default;
- MurrineStateType state_type;
- uint8 corners;
- uint8 xthickness;
- uint8 ythickness;
- MurrineRGB parentbg;
-
- /* Style */
- int glazestyle;
- int glowstyle;
- int lightborderstyle;
- int reliefstyle;
- int roundness;
- double contrast;
- double glow_shade;
- double highlight_shade;
- double lightborder_shade;
- MurrineGradients mrn_gradient;
-
- MurrineStyles style;
- MurrineStyleFunctions *style_functions;
-} WidgetParameters;
-
-typedef struct
-{
- int box_w;
+ MurrineArrowType type;
+ MurrineDirection direction;
int style;
-} ComboBoxParameters;
-
-typedef struct
-{
- MurrineFocusType type;
- MurrineContinue continue_side;
- MurrineRGB color;
- boolean has_color;
- gint line_width;
- gint padding;
- guint8* dash_list;
- boolean interior;
-} FocusParameters;
+} ArrowParameters;
typedef struct
{
- boolean lower;
- boolean horizontal;
- boolean fill_level;
-} SliderParameters;
+ MurrineShadowType shadow_type;
+ boolean in_cell;
+ boolean in_menu;
+} CheckboxParameters;
typedef struct
{
- MurrineOrientation orientation;
- int style;
-} ProgressBarParameters;
+ int box_w;
+ int style;
+ double prelight_shade;
+} ComboBoxParameters;
typedef struct
{
@@ -272,48 +232,53 @@ typedef struct
typedef struct
{
- int linepos;
-} OptionMenuParameters;
+ MurrineFocusType type;
+ MurrineContinue continue_side;
+ MurrineRGB color;
+ boolean has_color;
+ gint line_width;
+ gint padding;
+ guint8* dash_list;
+ boolean interior;
+} FocusParameters;
typedef struct
{
- MurrineShadowType shadow_type;
- boolean in_cell;
- boolean in_menu;
-} CheckboxParameters;
+ MurrineShadowType shadow;
+ MurrineGapSide gap_side;
+ int gap_x;
+ int gap_width;
+ MurrineRGB *border;
+} FrameParameters;
typedef struct
{
- MurrineShadowType shadow;
- MurrineGapSide gap_side;
- int gap_x;
- int gap_width;
- MurrineRGB *border;
-} FrameParameters;
+ MurrineHandleType type;
+ boolean horizontal;
+} HandleParameters;
typedef struct
{
- MurrineGapSide gap_side;
-} TabParameters;
+ MurrineOrder order;
+ boolean resizable;
+ int style;
+} ListViewHeaderParameters;
typedef struct
{
- MurrineCorners corners;
- MurrineShadowType shadow;
-} ShadowParameters;
+ int linepos;
+} OptionMenuParameters;
typedef struct
{
- boolean horizontal;
- boolean use_rgba;
-} SeparatorParameters;
+ MurrineOrientation orientation;
+ int style;
+} ProgressBarParameters;
typedef struct
{
- MurrineOrder order;
- boolean resizable;
- int style;
-} ListViewHeaderParameters;
+ MurrineWindowEdge edge;
+} ResizeGripParameters;
typedef struct
{
@@ -325,42 +290,79 @@ typedef struct
boolean within_bevel;
int style;
int stepperstyle;
+ double prelight_shade;
} ScrollBarParameters;
typedef struct
{
- MurrineHandleType type;
- boolean horizontal;
-} HandleParameters;
+ MurrineStepper stepper; /* Which stepper to draw */
+} ScrollBarStepperParameters;
typedef struct
{
- MurrineStepper stepper; /* Which stepper to draw */
-} ScrollBarStepperParameters;
+ boolean horizontal;
+ boolean use_rgba;
+} SeparatorParameters;
typedef struct
{
- int style;
-} SpinbuttonParameters;
+ MurrineCorners corners;
+ MurrineShadowType shadow;
+} ShadowParameters;
+
+typedef struct
+{
+ boolean lower;
+ boolean horizontal;
+ boolean fill_level;
+} SliderParameters;
typedef struct
{
- MurrineArrowType type;
- MurrineDirection direction;
int style;
-} ArrowParameters;
+} SpinbuttonParameters;
typedef struct
{
- MurrineWindowEdge edge;
-} ResizeGripParameters;
+ MurrineGapSide gap_side;
+} TabParameters;
typedef struct
{
boolean topmost;
- int style;
+ int style;
} ToolbarParameters;
+typedef struct
+{
+ boolean active;
+ boolean prelight;
+ boolean disabled;
+ boolean ltr;
+ boolean focus;
+ boolean is_default;
+ MurrineStateType state_type;
+ uint8 corners;
+ uint8 xthickness;
+ uint8 ythickness;
+ MurrineRGB parentbg;
+
+ /* Style */
+ int glazestyle;
+ int glowstyle;
+ int lightborderstyle;
+ int reliefstyle;
+ int roundness;
+ double contrast;
+ double glow_shade;
+ double highlight_shade;
+ double lightborder_shade;
+ MurrineGradients mrn_gradient;
+
+ MurrineStyles style;
+ MurrineStyleFunctions *style_functions;
+} WidgetParameters;
+
struct _MurrineStyleFunctions
{
void (*draw_button) (cairo_t *cr,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]