murrine r136 - in trunk: . src
- From: acimitan svn gnome org
- To: svn-commits-list gnome org
- Subject: murrine r136 - in trunk: . src
- Date: Sat, 24 Jan 2009 01:23:40 +0000 (UTC)
Author: acimitan
Date: Sat Jan 24 01:23:40 2009
New Revision: 136
URL: http://svn.gnome.org/viewvc/murrine?rev=136&view=rev
Log:
2009-01-24 Andrea Cimitan <andrea cimitan gmail com>
* src/murrine_draw.c (murrine_draw_scale_trough):
* src/murrine_draw_rgba.c (murrine_rgba_draw_scale_trough):
* src/murrine_style.c (murrine_style_draw_box):
* src/murrine_types.h:
Add support for GtkScale::trough-side-details and fill-level.
This will break old themes (the scale's trough).
To update your theme, please add this in the gtkrc:
GtkScale::trough-side-details = 1
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 Sat Jan 24 01:23:40 2009
@@ -350,6 +350,7 @@
}
}
+#define TROUGH_SIZE 6
static void
murrine_draw_scale_trough (cairo_t *cr,
const MurrineColors *colors,
@@ -357,66 +358,52 @@
const SliderParameters *slider,
int x, int y, int width, int height)
{
- int fill_x, fill_y, fill_width, fill_height; /* Fill x,y,w,h */
int trough_width, trough_height;
- int fill_size = slider->fill_size;
- int TROUGH_SIZE = 6;
double translate_x, translate_y;
- MurrineRGB fill;
- murrine_shade (&widget->parentbg, 0.95, &fill);
+ cairo_save (cr);
if (slider->horizontal)
{
- if (fill_size > width-3)
- fill_size = width-3;
-
- fill_x = slider->inverted ? width-fill_size-3 : 0;
- fill_y = 0;
- fill_width = fill_size;
- fill_height = TROUGH_SIZE-2;
+ trough_width = width;
+ trough_height = TROUGH_SIZE;
- trough_width = width-3;
- trough_height = TROUGH_SIZE-2;
-
- translate_x = x+0.5;
- translate_y = y+0.5+(height/2)-(TROUGH_SIZE/2);
+ translate_x = x;
+ translate_y = y+(height/2)-(TROUGH_SIZE/2);
}
else
{
- if (fill_size > height-3)
- fill_size = height-3;
-
- fill_x = 0;
- fill_y = slider->inverted ? height-fill_size-3 : 0;
- fill_width = TROUGH_SIZE-2;
- fill_height = fill_size;
-
- trough_width = TROUGH_SIZE-2;
- trough_height = height-3;
+ trough_width = TROUGH_SIZE;
+ trough_height = height;
- translate_x = x+0.5+(width/2)-(TROUGH_SIZE/2);
- translate_y = y+0.5;
+ translate_x = x+(width/2)-(TROUGH_SIZE/2);
+ translate_y = y;
}
- cairo_translate (cr, translate_x, translate_y);
+ cairo_translate (cr, translate_x+0.5, translate_y+0.5);
- if (widget->reliefstyle != 0)
- murrine_draw_inset (cr, &widget->parentbg, 0, 0, trough_width+2, trough_height+2, 0, 0);
+ if (!slider->fill_level && widget->reliefstyle != 0)
+ murrine_draw_inset (cr, &widget->parentbg, 0, 0, trough_width, trough_height, 0, 0);
- cairo_translate (cr, 1, 1);
+ if (!slider->lower && !slider->fill_level)
+ {
+ MurrineRGB fill;
+ murrine_shade (&widget->parentbg, 0.95, &fill);
- murrine_scale_draw_gradient (cr, &fill, /* fill */
- &colors->shade[4], /* border */
- 1.0,
- 0, 0, trough_width, trough_height,
- TRUE, slider->horizontal);
+ murrine_scale_draw_gradient (cr, &fill, &colors->shade[4],
+ 1.0,
+ 1.0, 1.0, trough_width-2, trough_height-2,
+ TRUE, slider->horizontal);
+ }
+ else
+ {
+ murrine_scale_draw_gradient (cr, &colors->spot[1], &colors->spot[2],
+ widget->disabled ? 1.0 : widget->lightborder_shade,
+ 1.0, 1.0, trough_width-2, trough_height-2,
+ FALSE, slider->horizontal);
+ }
- murrine_scale_draw_gradient (cr, &colors->spot[1], /* fill */
- &colors->spot[2], /* border */
- widget->disabled ? 1.0 : widget->lightborder_shade,
- fill_x, fill_y, fill_width, fill_height,
- FALSE, slider->horizontal);
+ cairo_restore (cr);
}
static void
Modified: trunk/src/murrine_draw_rgba.c
==============================================================================
--- trunk/src/murrine_draw_rgba.c (original)
+++ trunk/src/murrine_draw_rgba.c Sat Jan 24 01:23:40 2009
@@ -336,6 +336,7 @@
}
}
+#define TROUGH_SIZE 6
static void
murrine_rgba_draw_scale_trough (cairo_t *cr,
const MurrineColors *colors,
@@ -343,66 +344,52 @@
const SliderParameters *slider,
int x, int y, int width, int height)
{
- int fill_x, fill_y, fill_width, fill_height; /* Fill x,y,w,h */
int trough_width, trough_height;
- int fill_size = slider->fill_size;
- int TROUGH_SIZE = 6;
double translate_x, translate_y;
- MurrineRGB fill;
- murrine_shade (&widget->parentbg, 0.95, &fill);
+ cairo_save (cr);
if (slider->horizontal)
{
- if (fill_size > width-3)
- fill_size = width-3;
-
- fill_x = slider->inverted ? width-fill_size-3 : 0;
- fill_y = 0;
- fill_width = fill_size;
- fill_height = TROUGH_SIZE-2;
+ trough_width = width;
+ trough_height = TROUGH_SIZE;
- trough_width = width-3;
- trough_height = TROUGH_SIZE-2;
-
- translate_x = x+0.5;
- translate_y = y+0.5+(height/2)-(TROUGH_SIZE/2);
+ translate_x = x;
+ translate_y = y+(height/2)-(TROUGH_SIZE/2);
}
else
{
- if (fill_size > height-3)
- fill_size = height-3;
-
- fill_x = 0;
- fill_y = slider->inverted ? height-fill_size-3 : 0;
- fill_width = TROUGH_SIZE-2;
- fill_height = fill_size;
-
- trough_width = TROUGH_SIZE-2;
- trough_height = height-3;
+ trough_width = TROUGH_SIZE;
+ trough_height = height;
- translate_x = x+0.5+(width/2)-(TROUGH_SIZE/2);
- translate_y = y+0.5;
+ translate_x = x+(width/2)-(TROUGH_SIZE/2);
+ translate_y = y;
}
- cairo_translate (cr, translate_x, translate_y);
+ cairo_translate (cr, translate_x+0.5, translate_y+0.5);
- if (widget->reliefstyle != 0)
- murrine_draw_inset (cr, &widget->parentbg, 0, 0, trough_width+2, trough_height+2, 0, 0);
+ if (!slider->fill_level && widget->reliefstyle != 0)
+ murrine_draw_inset (cr, &widget->parentbg, 0, 0, trough_width, trough_height, 0, 0);
- cairo_translate (cr, 1, 1);
+ if (!slider->lower && !slider->fill_level)
+ {
+ MurrineRGB fill;
+ murrine_shade (&widget->parentbg, 0.95, &fill);
- murrine_scale_draw_gradient (cr, &fill, /* fill */
- &colors->shade[5], /* border */
- 1.0,
- 0, 0, trough_width, trough_height,
- TRUE, slider->horizontal);
+ murrine_scale_draw_gradient (cr, &fill, &colors->shade[5],
+ 1.0,
+ 1.0, 1.0, trough_width-2, trough_height-2,
+ TRUE, slider->horizontal);
+ }
+ else
+ {
+ murrine_scale_draw_gradient (cr, &colors->spot[1], &colors->spot[2],
+ widget->disabled ? 1.0 : widget->lightborder_shade,
+ 1.0, 1.0, trough_width-2, trough_height-2,
+ FALSE, slider->horizontal);
+ }
- murrine_scale_draw_gradient (cr, &colors->spot[1], /* fill */
- &colors->spot[2], /* border */
- widget->disabled ? 1.0 : widget->lightborder_shade,
- fill_x, fill_y, fill_width, fill_height,
- FALSE, slider->horizontal);
+ cairo_restore (cr);
}
static void
Modified: trunk/src/murrine_style.c
==============================================================================
--- trunk/src/murrine_style.c (original)
+++ trunk/src/murrine_style.c Sat Jan 24 01:23:40 2009
@@ -901,26 +901,14 @@
/* draw_spinbutton (cr, &murrine_style->colors, ¶ms, x, y, width, height); */
STYLE_FUNCTION(draw_button) (cr, &murrine_style->colors, ¶ms, x, y, width, height, horizontal);
}
- else if (DETAIL ("trough") && widget && MRN_IS_SCALE (widget))
+ else if (detail && g_str_has_prefix (detail, "trough") && widget && MRN_IS_SCALE (widget))
{
- GtkAdjustment *adjustment = gtk_range_get_adjustment (GTK_RANGE (widget));
WidgetParameters params;
SliderParameters slider;
- gint slider_length;
- gtk_widget_style_get (widget, "slider-length", &slider_length, NULL);
-
- slider.inverted = gtk_range_get_inverted (GTK_RANGE (widget));
+ slider.lower = DETAIL ("trough-lower");
+ slider.fill_level = DETAIL ("trough-fill-level") || DETAIL ("trough-fill-level-full");
slider.horizontal = (GTK_RANGE (widget)->orientation == GTK_ORIENTATION_HORIZONTAL);
- if ((adjustment->upper-adjustment->page_size-adjustment->lower) != 0)
- slider.fill_size = ((slider.horizontal ? width : height)-slider_length)*
- ((adjustment->value-adjustment->lower)/
- (adjustment->upper-adjustment->page_size-adjustment->lower))+
- slider_length/2;
- else
- slider.fill_size = 0;
- if (slider.horizontal)
- slider.inverted = slider.inverted != (murrine_get_direction (widget) == GTK_TEXT_DIR_RTL);
murrine_set_widget_parameters (widget, style, state_type, ¶ms);
params.corners = MRN_CORNER_NONE;
Modified: trunk/src/murrine_types.h
==============================================================================
--- trunk/src/murrine_types.h (original)
+++ trunk/src/murrine_types.h Sat Jan 24 01:23:40 2009
@@ -206,9 +206,9 @@
typedef struct
{
- boolean inverted;
- int fill_size;
+ boolean lower;
boolean horizontal;
+ boolean fill_level;
} SliderParameters;
typedef struct
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]