[murrine] Added new arrows, arrowstyle = 1
- From: Andrea Cimitan <acimitan src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [murrine] Added new arrows, arrowstyle = 1
- Date: Tue, 8 Dec 2009 15:22:16 +0000 (UTC)
commit 13d172c5b5ec22c4887b005bcee26c7ecad8450e
Author: Andrea Cimitan <andrea cimitan gmail com>
Date: Thu Nov 19 03:03:48 2009 +0100
Added new arrows, arrowstyle = 1
src/murrine_draw.c | 107 +++++++++++++++++++++++++++++++++++++++---------
src/murrine_rc_style.c | 9 ++++
src/murrine_rc_style.h | 58 +++++++++++++------------
src/murrine_style.c | 76 +++++++++++++++++++++++++++-------
src/murrine_style.h | 1 +
src/murrine_types.h | 1 +
6 files changed, 188 insertions(+), 64 deletions(-)
---
diff --git a/src/murrine_draw.c b/src/murrine_draw.c
index 50d1d82..179643e 100644
--- a/src/murrine_draw.c
+++ b/src/murrine_draw.c
@@ -1295,13 +1295,16 @@ murrine_draw_list_view_header (cairo_t *cr,
else
cairo_move_to (cr, 0.0, 0.5);
- murrine_set_color_rgb (cr, &highlight);
- cairo_line_to (cr, width, 0.5);
- cairo_stroke (cr);
+
/* Effects */
switch (header->style)
{
+ case 0:
+ murrine_set_color_rgb (cr, &highlight);
+ cairo_line_to (cr, width, 0.5);
+ cairo_stroke (cr);
+ break;
case 1:
cairo_rectangle (cr, 0, 0, width, height);
@@ -1775,7 +1778,7 @@ murrine_draw_tooltip (cairo_t *cr,
MurrineGradients mrn_gradient_custom = get_decreased_gradient_shades (widget->mrn_gradient, 2.0);
double glow_shade_custom = get_decreased_shade (widget->glow_shade, 2.0);
double highlight_shade_custom = get_decreased_shade (widget->highlight_shade, 2.0);
-
+
murrine_shade (&colors->bg[widget->state_type], get_contrast(0.6, widget->contrast), &border);
cairo_save (cr);
@@ -1867,6 +1870,36 @@ murrine_draw_normal_arrow (cairo_t *cr,
}
static void
+murrine_draw_normal_arrow_new (cairo_t *cr,
+ const MurrineRGB *color,
+ double x, double y, double width, double height)
+{
+ int arrow_width = width;
+ int arrow_height = height;
+ cairo_pattern_t *pattern;
+
+ cairo_save (cr);
+
+ cairo_translate (cr, 0, -0.5);
+ cairo_move_to (cr, -arrow_width/2, -arrow_height/2);
+ cairo_line_to (cr, 0, arrow_height/2);
+ cairo_line_to (cr, arrow_width/2, -arrow_height/2);
+ cairo_close_path (cr);
+
+ pattern = cairo_pattern_create_linear (0, -arrow_height/2, 0, arrow_height/2);
+ cairo_pattern_add_color_stop_rgba (pattern, 0.0, color->r, color->g, color->b, 0.6);
+ cairo_pattern_add_color_stop_rgba (pattern, 1.0, color->r, color->g, color->b, 0.8);
+ cairo_set_source (cr, pattern);
+ cairo_fill_preserve (cr);
+ cairo_pattern_destroy (pattern);
+
+ murrine_set_color_rgb (cr, color);
+ cairo_stroke (cr);
+
+ cairo_restore (cr);
+}
+
+static void
murrine_draw_combo_arrow (cairo_t *cr,
const MurrineRGB *color,
double x, double y, double width, double height)
@@ -1885,17 +1918,40 @@ murrine_draw_combo_arrow (cairo_t *cr,
}
static void
+murrine_draw_combo_arrow_new (cairo_t *cr,
+ const MurrineRGB *color,
+ double x, double y, double width, double height)
+{
+ double arrow_width = 4;
+ double arrow_height = 5;
+
+ cairo_save (cr);
+ cairo_translate (cr, x, y-5.5);
+ cairo_rotate (cr, M_PI);
+ murrine_draw_normal_arrow_new (cr, color, 0, 0, arrow_width, arrow_height);
+ cairo_restore (cr);
+
+ cairo_translate (cr, x, y+5.5);
+
+ murrine_draw_normal_arrow_new (cr, color, 0, 0, arrow_width, arrow_height);
+}
+
+static void
_murrine_draw_arrow (cairo_t *cr,
const MurrineRGB *color,
- MurrineDirection dir, MurrineArrowType type,
+ const ArrowParameters *arrow,
double x, double y, double width, double height)
{
double rotate;
- switch (dir)
+ switch (arrow->direction)
{
default:
- return;
+ case MRN_DIRECTION_DOWN:
+ rotate = 0;
+ break;
+ case MRN_DIRECTION_UP:
+ rotate = M_PI;
break;
case MRN_DIRECTION_LEFT:
rotate = M_PI*1.5;
@@ -1903,24 +1959,36 @@ _murrine_draw_arrow (cairo_t *cr,
case MRN_DIRECTION_RIGHT:
rotate = M_PI*0.5;
break;
- case MRN_DIRECTION_UP:
- rotate = M_PI;
- break;
- case MRN_DIRECTION_DOWN:
- rotate = 0;
- break;
}
- if (type == MRN_ARROW_NORMAL)
+ if (arrow->type == MRN_ARROW_NORMAL)
{
cairo_translate (cr, x, y);
cairo_rotate (cr, -rotate);
- murrine_draw_normal_arrow (cr, color, 0, 0, width, height);
+ switch (arrow->style)
+ {
+ default:
+ case 0:
+ murrine_draw_normal_arrow (cr, color, 0, 0, width, height);
+ break;
+ case 1:
+ murrine_draw_normal_arrow_new (cr, color, 0, 0, width, height);
+ break;
+ }
}
- else if (type == MRN_ARROW_COMBO)
+ else if (arrow->type == MRN_ARROW_COMBO)
{
cairo_translate (cr, x, y);
- murrine_draw_combo_arrow (cr, color, 0, 0, width, height);
+ switch (arrow->style)
+ {
+ default:
+ case 0:
+ murrine_draw_combo_arrow (cr, color, 0, 0, width, height);
+ break;
+ case 1:
+ murrine_draw_combo_arrow_new (cr, color, 0, 0, width, height);
+ break;
+ }
}
}
@@ -1940,14 +2008,13 @@ murrine_draw_arrow (cairo_t *cr,
if (widget->disabled)
{
- _murrine_draw_arrow (cr, &colors->shade[0],
- arrow->direction, arrow->type,
+ _murrine_draw_arrow (cr, &colors->shade[0], arrow,
tx+0.5, ty+0.5, width, height);
}
cairo_identity_matrix (cr);
- _murrine_draw_arrow (cr, &color, arrow->direction, arrow->type,
+ _murrine_draw_arrow (cr, &color, arrow,
tx, ty, width, height);
}
diff --git a/src/murrine_rc_style.c b/src/murrine_rc_style.c
index 90ab4d0..02415dc 100644
--- a/src/murrine_rc_style.c
+++ b/src/murrine_rc_style.c
@@ -36,6 +36,7 @@ static void murrine_rc_style_merge (GtkRcStyle *dest,
enum
{
TOKEN_ANIMATION = G_TOKEN_LAST + 1,
+ TOKEN_ARROWSTYLE,
TOKEN_BORDER_SHADES,
TOKEN_COLORIZE_SCROLLBAR,
TOKEN_CONTRAST,
@@ -90,6 +91,7 @@ static struct
theme_symbols[] =
{
{ "animation", TOKEN_ANIMATION },
+ { "arrowstyle", TOKEN_ARROWSTYLE },
{ "border_shades", TOKEN_BORDER_SHADES },
{ "colorize_scrollbar", TOKEN_COLORIZE_SCROLLBAR },
{ "contrast", TOKEN_CONTRAST },
@@ -150,6 +152,7 @@ murrine_rc_style_init (MurrineRcStyle *murrine_rc)
murrine_rc->flags = 0;
murrine_rc->animation = FALSE;
+ murrine_rc->arrowstyle = 0;
murrine_rc->border_shades[0] = 1.0;
murrine_rc->border_shades[1] = 1.0;
murrine_rc->colorize_scrollbar = TRUE;
@@ -515,6 +518,10 @@ murrine_rc_style_parse (GtkRcStyle *rc_style,
token = theme_parse_boolean (settings, scanner, &murrine_style->animation);
murrine_style->flags |= MRN_FLAG_ANIMATION;
break;
+ case TOKEN_ARROWSTYLE:
+ token = theme_parse_int (settings, scanner, &murrine_style->arrowstyle);
+ murrine_style->flags |= MRN_FLAG_ARROWSTYLE;
+ break;
case TOKEN_BORDER_SHADES:
token = theme_parse_border (settings, scanner, murrine_style->border_shades);
murrine_style->flags |= MRN_FLAG_BORDER_SHADES;
@@ -693,6 +700,8 @@ murrine_rc_style_merge (GtkRcStyle *dest,
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_BORDER_SHADES)
{
dest_w->border_shades[0] = src_w->border_shades[0];
diff --git a/src/murrine_rc_style.h b/src/murrine_rc_style.h
index edde5fc..bf19573 100644
--- a/src/murrine_rc_style.h
+++ b/src/murrine_rc_style.h
@@ -36,34 +36,35 @@ typedef struct _MurrineRcStyleClass MurrineRcStyleClass;
typedef enum
{
MRN_FLAG_ANIMATION = 1 << 0,
- MRN_FLAG_BORDER_SHADES = 1 << 1,
- MRN_FLAG_COLORIZE_SCROLLBAR = 1 << 2,
- MRN_FLAG_CONTRAST = 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_GRADIENT_SHADES = 1 << 8,
- MRN_FLAG_GRADIENTS = 1 << 9,
- MRN_FLAG_HIGHLIGHT_SHADE = 1 << 10,
- MRN_FLAG_LIGHTBORDER_SHADE = 1 << 11,
- MRN_FLAG_LIGHTBORDERSTYLE= 1 << 12,
- MRN_FLAG_LISTVIEWHEADERSTYLE = 1 << 13,
- MRN_FLAG_LISTVIEWSTYLE = 1 << 14,
- MRN_FLAG_MENUBARITEMSTYLE = 1 << 15,
- MRN_FLAG_MENUBARSTYLE = 1 << 16,
- MRN_FLAG_MENUITEMSTYLE = 1 << 17,
- MRN_FLAG_MENUSTYLE = 1 << 18,
- MRN_FLAG_PROFILE = 1 << 19,
- MRN_FLAG_PROGRESSBARSTYLE = 1 << 20,
- MRN_FLAG_RELIEFSTYLE = 1 << 21,
- MRN_FLAG_RGBA = 1 << 22,
- MRN_FLAG_ROUNDNESS = 1 << 23,
- MRN_FLAG_SCROLLBAR_COLOR = 1 << 24,
- MRN_FLAG_SCROLLBARSTYLE = 1 << 25,
- MRN_FLAG_SLIDERSTYLE = 1 << 26,
- MRN_FLAG_STEPPERSTYLE = 1 << 27,
- MRN_FLAG_TOOLBARSTYLE = 1 << 28
+ MRN_FLAG_ARROWSTYLE = 1 << 1,
+ MRN_FLAG_BORDER_SHADES = 1 << 2,
+ MRN_FLAG_COLORIZE_SCROLLBAR = 1 << 3,
+ MRN_FLAG_CONTRAST = 1 << 4,
+ MRN_FLAG_FOCUS_COLOR = 1 << 5,
+ MRN_FLAG_GLAZESTYLE = 1 << 6,
+ MRN_FLAG_GLOW_SHADE = 1 << 7,
+ MRN_FLAG_GLOWSTYLE = 1 << 8,
+ MRN_FLAG_GRADIENT_SHADES = 1 << 9,
+ MRN_FLAG_GRADIENTS = 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_PROFILE = 1 << 20,
+ MRN_FLAG_PROGRESSBARSTYLE = 1 << 21,
+ MRN_FLAG_RELIEFSTYLE = 1 << 22,
+ MRN_FLAG_RGBA = 1 << 23,
+ MRN_FLAG_ROUNDNESS = 1 << 24,
+ MRN_FLAG_SCROLLBAR_COLOR = 1 << 25,
+ MRN_FLAG_SCROLLBARSTYLE = 1 << 26,
+ MRN_FLAG_SLIDERSTYLE = 1 << 27,
+ MRN_FLAG_STEPPERSTYLE = 1 << 28,
+ MRN_FLAG_TOOLBARSTYLE = 1 << 29
} MurrineRcFlags;
struct _MurrineRcStyle
@@ -79,6 +80,7 @@ struct _MurrineRcStyle
double highlight_shade;
double lightborder_shade;
+ guint8 arrowstyle;
guint8 glazestyle;
guint8 glowstyle;
guint8 lightborderstyle;
diff --git a/src/murrine_style.c b/src/murrine_style.c
index 6c301b2..402418d 100644
--- a/src/murrine_style.c
+++ b/src/murrine_style.c
@@ -215,7 +215,6 @@ murrine_style_draw_flat_box (DRAW_ARGS)
MurrineStyle *murrine_style = MURRINE_STYLE (style);
MurrineColors *colors = &murrine_style->colors;
cairo_t *cr;
-/* GtkWidget *parent; */
CHECK_ARGS
SANITIZE_SIZE
@@ -232,12 +231,6 @@ murrine_style_draw_flat_box (DRAW_ARGS)
else
params.corners = MRN_CORNER_NONE;
-/* Not working...
- parent = gtk_widget_get_parent (widget);
- if (GTK_IS_TOOLTIP (parent))
- params.corners = MRN_CORNER_NONE;
-*/
-
STYLE_FUNCTION(draw_tooltip) (cr, colors, ¶ms, x, y, width, height);
cairo_destroy (cr);
@@ -415,7 +408,7 @@ murrine_style_draw_shadow (DRAW_ARGS)
/* Focus color */
if (murrine_style->has_focus_color)
{
- murrine_gdk_color_to_rgb (&murrine_style->focus_color, &focus.color.r,
+ murrine_gdk_color_to_rgb (&murrine_style->focus_color, &focus.color.r,
&focus.color.g,
&focus.color.b);
focus.has_color = TRUE;
@@ -1150,7 +1143,7 @@ murrine_style_draw_box (DRAW_ARGS)
progress.max_size.height -= 2*focus_line_width;
}
}
-
+
if (progress.max_size_known)
{
progress.max_size.x += progress.border.left;
@@ -1522,6 +1515,7 @@ murrine_style_draw_tab (DRAW_ARGS)
arrow.type = MRN_ARROW_COMBO;
arrow.direction = MRN_DIRECTION_DOWN;
+ arrow.style = murrine_style->arrowstyle;
murrine_set_widget_parameters (widget, style, state_type, ¶ms);
@@ -1735,6 +1729,7 @@ murrine_style_draw_arrow (GtkStyle *style,
arrow.type = MRN_ARROW_NORMAL;
arrow.direction = (MurrineDirection)arrow_type;
+ arrow.style = murrine_style->arrowstyle;
if (MRN_IS_COMBO_BOX (widget) && !MRN_IS_COMBO_BOX_ENTRY (widget))
{
@@ -1743,15 +1738,62 @@ murrine_style_draw_arrow (GtkStyle *style,
murrine_set_widget_parameters (widget, style, state_type, ¶ms);
- /* I have no idea why, but the arrow of GtkCombo is larger than in other places.
- * Subtracting 3 seems to fix this. */
- if (widget && widget->parent && MRN_IS_COMBO (widget->parent->parent))
+ if (arrow.style == 1)
{
- if (params.ltr)
- x += 1;
+ if (DETAIL ("menuitem"))
+ {
+ if (arrow.direction == MRN_DIRECTION_UP || arrow.direction == MRN_DIRECTION_DOWN)
+ {
+ x = x + width / 2 - 2;
+ y = y + height / 2 - 2;
+ height = 4; width = 5;
+ }
+ else
+ {
+ x = x + width / 2 - 2;
+ y = y + height / 2 - 2;
+ height = 5; width = 4;
+ }
+ }
+ else if (DETAIL ("hscrollbar") || DETAIL ("vscrollbar"))
+ {
+
+ if (arrow.direction == MRN_DIRECTION_DOWN)
+ y++;
+ else if (arrow.direction == MRN_DIRECTION_RIGHT)
+ x++;
+
+ if (arrow.direction == MRN_DIRECTION_UP || arrow.direction == MRN_DIRECTION_DOWN)
+ {
+ x = x + width / 2 - 2;
+ y = y + height / 2 - 2;
+ height = 4; width = 5;
+ }
+ else
+ {
+ x = x + width / 2 - 2;
+ y = y + height / 2 - 2;
+ height = 5; width = 4;
+ }
+ }
+ else if (DETAIL ("spinbutton"))
+ {
+ x = x + width / 2 - 2;
+ y = y + height / 2 - 1;
+ height = 4; width = 5;
+ }
+ else if (arrow.direction == MRN_DIRECTION_UP || arrow.direction == MRN_DIRECTION_DOWN)
+ {
+ x = x + width / 2 - 3;
+ y = y + height / 2 - 2;
+ height = 6; width = 7;
+ }
else
- x += 2;
- width -= 3;
+ {
+ x = x + width / 2 - 2;
+ y = y + height / 2 - 3;
+ height = 7; width = 6;
+ }
}
STYLE_FUNCTION(draw_arrow) (cr, colors, ¶ms, &arrow, x, y, width, height);
@@ -2099,6 +2141,7 @@ murrine_style_init_from_rc (GtkStyle *style,
else
murrine_style->roundness = MURRINE_RC_STYLE (rc_style)->roundness;
murrine_style->animation = MURRINE_RC_STYLE (rc_style)->animation;
+ murrine_style->arrowstyle = MURRINE_RC_STYLE (rc_style)->arrowstyle;
murrine_style->contrast = MURRINE_RC_STYLE (rc_style)->contrast;
murrine_style->colorize_scrollbar = MURRINE_RC_STYLE (rc_style)->colorize_scrollbar;
murrine_style->has_focus_color = MURRINE_RC_STYLE (rc_style)->has_focus_color;
@@ -2272,6 +2315,7 @@ murrine_style_copy (GtkStyle *style, GtkStyle *src)
MurrineStyle *mrn_src = MURRINE_STYLE (src);
mrn_style->animation = mrn_src->animation;
+ mrn_style->arrowstyle = mrn_src->arrowstyle;
mrn_style->border_shades[0] = mrn_src->border_shades[0];
mrn_style->border_shades[1] = mrn_src->border_shades[1];
mrn_style->colorize_scrollbar = mrn_src->colorize_scrollbar;
diff --git a/src/murrine_style.h b/src/murrine_style.h
index 3c81f8a..60652fc 100644
--- a/src/murrine_style.h
+++ b/src/murrine_style.h
@@ -51,6 +51,7 @@ struct _MurrineStyle
double highlight_shade;
double lightborder_shade;
+ guint8 arrowstyle;
guint8 glazestyle;
guint8 glowstyle;
guint8 lightborderstyle;
diff --git a/src/murrine_types.h b/src/murrine_types.h
index a3df237..da22b96 100644
--- a/src/murrine_types.h
+++ b/src/murrine_types.h
@@ -339,6 +339,7 @@ typedef struct
{
MurrineArrowType type;
MurrineDirection direction;
+ int style;
} ArrowParameters;
typedef struct
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]