murrine r26 - in trunk: . src
- From: acimitan svn gnome org
- To: svn-commits-list gnome org
- Subject: murrine r26 - in trunk: . src
- Date: Fri, 7 Mar 2008 22:36:06 +0000 (GMT)
Author: acimitan
Date: Fri Mar 7 22:36:06 2008
New Revision: 26
URL: http://svn.gnome.org/viewvc/murrine?rev=26&view=rev
Log:
2008-03-07 Andrea Cimitan <andrea cimitan gmail com>
* src/murrine_draw.c: (murrine_draw_radiobutton),
(murrine_draw_checkbox):
* src/murrine_draw_rgba.c: (murrine_rgba_draw_radiobutton),
(murrine_rgba_draw_checkbox):
* src/murrine_style.c: (murrine_style_draw_option),
(murrine_style_draw_check):
* src/murrine_types.h:
Implemented inconsistent state for radiobutton
Modified:
trunk/ChangeLog
trunk/src/murrine_draw.c
trunk/src/murrine_draw_rgba.c
trunk/src/murrine_style.c
trunk/src/murrine_types.h
Modified: trunk/src/murrine_draw.c
==============================================================================
--- trunk/src/murrine_draw.c (original)
+++ trunk/src/murrine_draw.c Fri Mar 7 22:36:06 2008
@@ -2117,14 +2117,19 @@
static void
murrine_draw_radiobutton (cairo_t * cr,
- const MurrineColors *colors,
- const WidgetParameters *widget,
- const OptionParameters *status,
+ const MurrineColors *colors,
+ const WidgetParameters *widget,
+ const CheckboxParameters *checkbox,
int x, int y, int width, int height,
double trans)
{
const MurrineRGB *border;
const MurrineRGB *dot;
+ gboolean inconsistent;
+ gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
+
+ inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
+ draw_bullet |= inconsistent;
width = height = 15;
@@ -2136,7 +2141,7 @@
else
{
border = &colors->shade[5];
- if (status->draw_bullet)
+ if (draw_bullet)
border = &colors->spot[2];
dot = &colors->text[widget->state_type];
}
@@ -2160,7 +2165,7 @@
if (widget->state_type != GTK_STATE_INSENSITIVE)
{
const MurrineRGB *bg = &colors->base[0];
- if (status->draw_bullet)
+ if (draw_bullet)
bg = &colors->spot[1];
if (widget->glazestyle != 2)
{
@@ -2182,7 +2187,7 @@
if (widget->state_type != GTK_STATE_INSENSITIVE)
{
const MurrineRGB *bg = &colors->base[0];
- if (status->draw_bullet)
+ if (draw_bullet)
bg = &colors->spot[1];
cairo_rectangle (cr, 0, 7, width, height);
@@ -2197,13 +2202,25 @@
cairo_fill (cr);
}
- /* inconsistent state is missing? */
- if (status->draw_bullet)
+ if (draw_bullet)
{
- cairo_arc (cr, 7, 7, 2, 0, M_PI*2);
- /* murrine_set_color_rgb (cr, dot); */
- murrine_set_color_rgba (cr, dot, trans);
- cairo_fill (cr);
+ if (inconsistent)
+ {
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
+ cairo_set_line_width (cr, 2);
+
+ cairo_move_to(cr, 5, 7);
+ cairo_line_to(cr, 9, 7);
+
+ murrine_set_color_rgba (cr, dot, trans);
+ cairo_stroke (cr);
+ }
+ else
+ {
+ cairo_arc (cr, 7, 7, 3, 0, G_PI*2);
+ murrine_set_color_rgba (cr, dot, trans);
+ cairo_fill (cr);
+ }
}
cairo_restore (cr);
@@ -2211,14 +2228,19 @@
static void
murrine_draw_checkbox (cairo_t * cr,
- const MurrineColors *colors,
- const WidgetParameters *widget,
- const OptionParameters *status,
+ const MurrineColors *colors,
+ const WidgetParameters *widget,
+ const CheckboxParameters *checkbox,
int x, int y, int width, int height,
double trans)
{
const MurrineRGB *border;
const MurrineRGB *dot;
+ gboolean inconsistent = FALSE;
+ gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
+
+ inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
+ draw_bullet |= inconsistent;
width = height = 13;
@@ -2230,7 +2252,7 @@
else
{
border = &colors->shade[5];
- if (status->draw_bullet)
+ if (draw_bullet)
border = &colors->spot[2];
dot = &colors->text[widget->state_type];
}
@@ -2261,7 +2283,7 @@
if (widget->state_type != GTK_STATE_INSENSITIVE)
{
const MurrineRGB *bg = &colors->base[0];
- if (status->draw_bullet)
+ if (draw_bullet)
bg = &colors->spot[1];
if (widget->glazestyle == 2)
@@ -2281,7 +2303,7 @@
if (widget->state_type != GTK_STATE_INSENSITIVE)
{
const MurrineRGB *bg = &colors->base[0];
- if (status->draw_bullet)
+ if (draw_bullet)
bg = &colors->spot[1];
MurrineRGB highlight;
@@ -2303,9 +2325,9 @@
}
cairo_scale (cr, width / 13.0, height / 13.0);
- if (status->draw_bullet)
+ if (draw_bullet)
{
- if (status->inconsistent) /* Inconsistent */
+ if (inconsistent) /* Inconsistent */
{
cairo_set_line_width (cr, 2.0);
cairo_move_to (cr, 3, height*0.5);
Modified: trunk/src/murrine_draw_rgba.c
==============================================================================
--- trunk/src/murrine_draw_rgba.c (original)
+++ trunk/src/murrine_draw_rgba.c Fri Mar 7 22:36:06 2008
@@ -75,7 +75,7 @@
cairo_line_to (cr, x, y);
if (corners & MRN_CORNER_TOPRIGHT)
- cairo_arc (cr, x + w - radius, y + radius, radius, M_PI * 1.5, M_PI * 1.75);
+ cairo_arc (cr, x + w - radius, y + radius, radius, M_PI * 1.5, M_PI * 1.75);
else
cairo_line_to (cr, x + w, y);
@@ -257,7 +257,7 @@
/* Draw the white inner border */
if (widget->glazestyle != 4 && !widget->active)
{
- murrine_shade (&fill, widget->lightborder_ratio*custom_highlight_ratio, &highlight);
+ murrine_shade (&fill, widget->lightborder_ratio*custom_highlight_ratio, &highlight);
if (horizontal)
{
murrine_draw_lightborder (cr, &highlight, &fill, mrn_gradient_custom,
@@ -1659,14 +1659,19 @@
static void
murrine_rgba_draw_radiobutton (cairo_t * cr,
- const MurrineColors *colors,
- const WidgetParameters *widget,
- const OptionParameters *status,
+ const MurrineColors *colors,
+ const WidgetParameters *widget,
+ const CheckboxParameters *checkbox,
int x, int y, int width, int height,
double trans)
{
MurrineRGB border;
const MurrineRGB *dot;
+ gboolean inconsistent;
+ gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
+
+ inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
+ draw_bullet |= inconsistent;
width = height = 15;
@@ -1678,12 +1683,12 @@
else
{
border = colors->shade[6];
- if (status->draw_bullet)
+ if (draw_bullet)
border = colors->spot[2];
dot = &colors->text[widget->state_type];
}
murrine_mix_color (&border, widget->state_type != GTK_STATE_INSENSITIVE ?
- status->draw_bullet ? &colors->spot[1] : &colors->bg[0] : &colors->bg[0], 0.2, &border);
+ draw_bullet ? &colors->spot[1] : &colors->bg[0] : &colors->bg[0], 0.2, &border);
cairo_translate (cr, x, y);
@@ -1702,7 +1707,7 @@
if (widget->state_type != GTK_STATE_INSENSITIVE)
{
const MurrineRGB *bg = &colors->base[0];
- if (status->draw_bullet)
+ if (draw_bullet)
bg = &colors->spot[1];
if (widget->glazestyle != 2)
{
@@ -1724,7 +1729,7 @@
if (widget->state_type != GTK_STATE_INSENSITIVE)
{
const MurrineRGB *bg = &colors->base[0];
- if (status->draw_bullet)
+ if (draw_bullet)
bg = &colors->spot[1];
cairo_rectangle (cr, 0, 7, width, height);
@@ -1739,13 +1744,25 @@
cairo_fill (cr);
}
- /* inconsistent state is missing? */
- if (status->draw_bullet)
+ if (draw_bullet)
{
- cairo_arc (cr, 7, 7, 2, 0, M_PI*2);
- /* murrine_set_color_rgb (cr, dot); */
- murrine_set_color_rgba (cr, dot, trans);
- cairo_fill (cr);
+ if (inconsistent)
+ {
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
+ cairo_set_line_width (cr, 2);
+
+ cairo_move_to(cr, 5, 7);
+ cairo_line_to(cr, 9, 7);
+
+ murrine_set_color_rgba (cr, dot, trans);
+ cairo_stroke (cr);
+ }
+ else
+ {
+ cairo_arc (cr, 7, 7, 3, 0, G_PI*2);
+ murrine_set_color_rgba (cr, dot, trans);
+ cairo_fill (cr);
+ }
}
cairo_restore (cr);
@@ -1753,14 +1770,19 @@
static void
murrine_rgba_draw_checkbox (cairo_t * cr,
- const MurrineColors *colors,
- const WidgetParameters *widget,
- const OptionParameters *status,
+ const MurrineColors *colors,
+ const WidgetParameters *widget,
+ const CheckboxParameters *checkbox,
int x, int y, int width, int height,
double trans)
{
MurrineRGB border;
const MurrineRGB *dot;
+ gboolean inconsistent = FALSE;
+ gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
+
+ inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
+ draw_bullet |= inconsistent;
width = height = 13;
@@ -1772,12 +1794,12 @@
else
{
border = colors->shade[6];
- if (status->draw_bullet)
+ if (draw_bullet)
border = colors->spot[2];
dot = &colors->text[widget->state_type];
}
murrine_mix_color (&border, widget->state_type != GTK_STATE_INSENSITIVE ?
- status->draw_bullet ? &colors->spot[1] : &colors->bg[0] : &colors->bg[0], 0.24, &border);
+ draw_bullet ? &colors->spot[1] : &colors->bg[0] : &colors->bg[0], 0.24, &border);
cairo_translate (cr, x, y);
cairo_set_line_width (cr, 1.0);
@@ -1803,7 +1825,7 @@
if (widget->state_type != GTK_STATE_INSENSITIVE)
{
const MurrineRGB *bg = &colors->base[0];
- if (status->draw_bullet)
+ if (draw_bullet)
bg = &colors->spot[1];
if (widget->glazestyle == 2)
@@ -1823,7 +1845,7 @@
if (widget->state_type != GTK_STATE_INSENSITIVE)
{
const MurrineRGB *bg = &colors->base[0];
- if (status->draw_bullet)
+ if (draw_bullet)
bg = &colors->spot[1];
MurrineRGB highlight;
@@ -1845,9 +1867,9 @@
}
cairo_scale (cr, width / 13.0, height / 13.0);
- if (status->draw_bullet)
+ if (draw_bullet)
{
- if (status->inconsistent) /* Inconsistent */
+ if (inconsistent) /* Inconsistent */
{
cairo_set_line_width (cr, 2.0);
cairo_move_to (cr, 3, height*0.5);
Modified: trunk/src/murrine_style.c
==============================================================================
--- trunk/src/murrine_style.c (original)
+++ trunk/src/murrine_style.c Fri Mar 7 22:36:06 2008
@@ -1219,29 +1219,30 @@
cr = murrine_begin_paint (window, area);
WidgetParameters params;
- OptionParameters option;
+ CheckboxParameters checkbox;
+
+ checkbox.shadow_type = shadow_type;
+ checkbox.in_menu = (widget && GTK_IS_MENU(widget->parent));
- option.draw_bullet = ((shadow_type == GTK_SHADOW_IN) || (shadow_type == GTK_SHADOW_ETCHED_IN));
- option.inconsistent = (shadow_type == GTK_SHADOW_ETCHED_IN);
double trans = 1.0;
murrine_set_widget_parameters (widget, style, state_type, ¶ms);
- #ifdef HAVE_ANIMATION
- if (murrine_style->animation)
- murrine_animation_connect_checkbox (widget);
-
- if (murrine_style->animation &&
- MRN_IS_CHECK_BUTTON (widget) &&
- murrine_animation_is_animated (widget) &&
- !gtk_toggle_button_get_inconsistent (GTK_TOGGLE_BUTTON (widget)))
- {
- gfloat elapsed = murrine_animation_elapsed (widget);
- trans = sqrt (sqrt (MIN(elapsed / CHECK_ANIMATION_TIME, 1.0)));
- }
- #endif
+#ifdef HAVE_ANIMATION
+ if (murrine_style->animation)
+ murrine_animation_connect_checkbox (widget);
+
+ if (murrine_style->animation &&
+ MRN_IS_CHECK_BUTTON (widget) &&
+ murrine_animation_is_animated (widget) &&
+ !gtk_toggle_button_get_inconsistent (GTK_TOGGLE_BUTTON (widget)))
+ {
+ gfloat elapsed = murrine_animation_elapsed (widget);
+ trans = sqrt (sqrt (MIN(elapsed / CHECK_ANIMATION_TIME, 1.0)));
+ }
+#endif
- STYLE_FUNCTION(draw_radiobutton) (cr, colors, ¶ms, &option, x, y, width, height, trans);
+ STYLE_FUNCTION(draw_radiobutton) (cr, colors, ¶ms, &checkbox, x, y, width, height, trans);
cairo_destroy (cr);
}
@@ -1259,28 +1260,30 @@
cr = murrine_begin_paint (window, area);
WidgetParameters params;
- OptionParameters option;
+ CheckboxParameters checkbox;
- option.draw_bullet = ((shadow_type == GTK_SHADOW_IN) || (shadow_type == GTK_SHADOW_ETCHED_IN));
- option.inconsistent = (shadow_type == GTK_SHADOW_ETCHED_IN);
+ checkbox.shadow_type = shadow_type;
+ checkbox.in_cell = DETAIL("cellcheck");
+
+ checkbox.in_menu = (widget && widget->parent && GTK_IS_MENU(widget->parent));
double trans = 1.0;
murrine_set_widget_parameters (widget, style, state_type, ¶ms);
- #ifdef HAVE_ANIMATION
- if (murrine_style->animation)
- murrine_animation_connect_checkbox (widget);
-
- if (murrine_style->animation && MRN_IS_CHECK_BUTTON (widget) &&
- murrine_animation_is_animated (widget) &&
- !gtk_toggle_button_get_inconsistent (GTK_TOGGLE_BUTTON (widget)))
- {
- gfloat elapsed = murrine_animation_elapsed (widget);
- trans = sqrt (sqrt (MIN(elapsed / CHECK_ANIMATION_TIME, 1.0)));
- }
- #endif
+#ifdef HAVE_ANIMATION
+ if (murrine_style->animation)
+ murrine_animation_connect_checkbox (widget);
+
+ if (murrine_style->animation && MRN_IS_CHECK_BUTTON (widget) &&
+ murrine_animation_is_animated (widget) &&
+ !gtk_toggle_button_get_inconsistent (GTK_TOGGLE_BUTTON (widget)))
+ {
+ gfloat elapsed = murrine_animation_elapsed (widget);
+ trans = sqrt (sqrt (MIN(elapsed / CHECK_ANIMATION_TIME, 1.0)));
+ }
+#endif
- STYLE_FUNCTION(draw_checkbox) (cr, colors, ¶ms, &option, x, y, width, height, trans);
+ STYLE_FUNCTION(draw_checkbox) (cr, colors, ¶ms, &checkbox, x, y, width, height, trans);
cairo_destroy (cr);
}
Modified: trunk/src/murrine_types.h
==============================================================================
--- trunk/src/murrine_types.h (original)
+++ trunk/src/murrine_types.h Fri Mar 7 22:36:06 2008
@@ -232,9 +232,10 @@
typedef struct
{
- boolean inconsistent;
- boolean draw_bullet;
-} OptionParameters;
+ MurrineShadowType shadow_type;
+ boolean in_cell;
+ boolean in_menu;
+} CheckboxParameters;
typedef struct
{
@@ -461,16 +462,16 @@
int x, int y, int width, int height);
void (*draw_checkbox) (cairo_t *cr,
- const MurrineColors *colors,
- const WidgetParameters *widget,
- const OptionParameters *status,
+ const MurrineColors *colors,
+ const WidgetParameters *widget,
+ const CheckboxParameters *checkbox,
int x, int y, int width, int height,
double trans);
void (*draw_radiobutton) (cairo_t *cr,
- const MurrineColors *colors,
- const WidgetParameters *widget,
- const OptionParameters *status,
+ const MurrineColors *colors,
+ const WidgetParameters *widget,
+ const CheckboxParameters *checkbox,
int x, int y, int width, int height,
double trans);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]