diff --git a/schema/murrine.xml.in.in b/schema/murrine.xml.in.in index dea2009..c54d168 100644 --- a/schema/murrine.xml.in.in +++ b/schema/murrine.xml.in.in @@ -28,7 +28,7 @@ General 0 2 - 0.1 + 2 @@ -64,7 +64,7 @@ General 0 2 - 0.1 + 2 @@ -99,7 +99,7 @@ General 0 2 - 0.01 + 2 @@ -108,7 +108,7 @@ General 0 2 - 0.01 + 2 diff --git a/src/murrine_draw.c b/src/murrine_draw.c index 4cab20f..de5e540 100644 --- a/src/murrine_draw.c +++ b/src/murrine_draw.c @@ -397,13 +397,13 @@ murrine_scale_draw_gradient (cairo_t *cr, const MurrineRGB *c2, double lightborder_shade, int x, int y, int width, int height, - boolean alpha, boolean horizontal) + boolean horizontal) { - murrine_set_color_rgba (cr, c1, alpha ? 0.44 : 1.0); + murrine_set_color_rgb (cr, c1); cairo_rectangle (cr, x, y, width, height); cairo_fill (cr); - murrine_set_color_rgba (cr, c2, 0.8); + murrine_set_color_rgb (cr, c2); cairo_rectangle (cr, x, y, width, height); cairo_stroke (cr); @@ -468,20 +468,21 @@ murrine_draw_scale_trough (cairo_t *cr, if (!slider->lower && !slider->fill_level) { - MurrineRGB fill; - murrine_shade (&widget->parentbg, 0.95, &fill); + MurrineRGB fill, border; + murrine_shade (&colors->bg[widget->state_type], 1.0, &fill); + murrine_shade (&colors->bg[GTK_STATE_ACTIVE], get_contrast(0.82, widget->contrast), &border); - murrine_scale_draw_gradient (cr, &fill, &colors->shade[4], + murrine_scale_draw_gradient (cr, &fill, &border, 1.0, 1.0, 1.0, trough_width-2, trough_height-2, - TRUE, slider->horizontal); + 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); + slider->horizontal); } cairo_restore (cr); @@ -527,20 +528,20 @@ murrine_draw_progressbar_trough (cairo_t *cr, const WidgetParameters *widget, int x, int y, int width, int height) { - const MurrineRGB *border = &colors->shade[4]; - MurrineRGB fill; + MurrineRGB border, fill; int roundness = MIN (widget->roundness, MIN ((height-2.0)/2.0, (width-2.0)/2.0)); - murrine_shade (&widget->parentbg, 0.95, &fill); + murrine_shade (&colors->bg[GTK_STATE_ACTIVE], 1.0, &fill); + murrine_shade (&colors->bg[GTK_STATE_ACTIVE], get_contrast(0.82, widget->contrast), &border); /* Create trough box */ murrine_rounded_rectangle_closed (cr, x+1, y+1, width-2, height-2, roundness, widget->corners); - murrine_set_color_rgba (cr, &fill, 0.44); + murrine_set_color_rgb (cr, &fill); cairo_fill (cr); /* Draw border */ murrine_rounded_rectangle (cr, x+0.5, y+0.5, width-1, height-1, roundness, widget->corners); - murrine_set_color_rgba (cr, border, 0.74); + murrine_set_color_rgb (cr, &border); cairo_stroke (cr); if (widget->mrn_gradient.gradients) @@ -548,7 +549,7 @@ murrine_draw_progressbar_trough (cairo_t *cr, cairo_pattern_t *pat; MurrineRGB shadow; - murrine_shade (border, 0.94, &shadow); + murrine_shade (&border, 0.94, &shadow); /* clip the corners of the shadows */ murrine_rounded_rectangle_closed (cr, x+1, y+1, width-2, height-2, roundness, widget->corners); @@ -1414,11 +1415,21 @@ murrine_draw_scrollbar_trough (cairo_t *cr, const ScrollBarParameters *scrollbar, int x, int y, int width, int height) { - const MurrineRGB *border = &colors->shade[scrollbar->stepperstyle < 1 ? 3 : 4]; + MurrineRGB border; MurrineRGB fill; - murrine_shade (&widget->parentbg, scrollbar->stepperstyle < 1 ? 0.95 : 1.065, &fill); - + murrine_shade (&widget->parentbg, + get_contrast (scrollbar->stepperstyle < 1 ? 0.86 : 0.8, widget->contrast), + &border); + murrine_shade (&widget->parentbg, scrollbar->stepperstyle < 1 ? 0.97 : 1.026, &fill); +/* + murrine_shade (&colors->bg[widget->state_type], + get_contrast (scrollbar->stepperstyle < 1 ? 0.86 : 0.8, widget->contrast), + &border_bg); + murrine_shade (&colors->bg[widget->state_type], scrollbar->stepperstyle < 1 ? 0.97 : 1.026, &fill_bg); + murrine_mix_color (&border_bg, &border, 0.5, &border); + murrine_mix_color (&fill_bg, &fill, 0.5, &fill); +*/ if (!scrollbar->horizontal) { cairo_translate (cr, x, y); @@ -1432,13 +1443,21 @@ murrine_draw_scrollbar_trough (cairo_t *cr, } /* Draw fill */ - murrine_set_color_rgba (cr, &fill, 0.4); - clearlooks_rounded_rectangle (cr, 1, 0, width-2, height, widget->roundness, widget->corners); + murrine_set_color_rgb (cr, &fill); + clearlooks_rounded_rectangle (cr, 0, 0, width, height, widget->roundness, widget->corners); cairo_fill (cr); /* Draw border */ - murrine_set_color_rgba (cr, border, 0.8); - murrine_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, widget->roundness, widget->corners); + murrine_set_color_rgb (cr, &border); + if (!scrollbar->within_bevel) + murrine_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, widget->roundness, widget->corners); + else + { + cairo_move_to (cr, 0.5, 0); + cairo_line_to (cr, 0.5, height); +/* cairo_move_to (cr, width-0.5, 0);*/ +/* cairo_line_to (cr, width-0.5, height);*/ + } cairo_stroke (cr); } diff --git a/src/murrine_draw_rgba.c b/src/murrine_draw_rgba.c index 17669c5..319037a 100644 --- a/src/murrine_draw_rgba.c +++ b/src/murrine_draw_rgba.c @@ -309,13 +309,13 @@ murrine_scale_draw_gradient (cairo_t *cr, const MurrineRGB *c2, double lightborder_shade, int x, int y, int width, int height, - boolean alpha, boolean horizontal) + boolean horizontal) { - murrine_set_color_rgba (cr, c1, alpha ? 0.46 : 1.0); + murrine_set_color_rgb (cr, c1); cairo_rectangle (cr, x, y, width, height); cairo_fill (cr); - murrine_set_color_rgba (cr, c2, 0.82); + murrine_set_color_rgb (cr, c2); cairo_rectangle (cr, x, y, width, height); cairo_stroke (cr); @@ -380,20 +380,21 @@ murrine_rgba_draw_scale_trough (cairo_t *cr, if (!slider->lower && !slider->fill_level) { - MurrineRGB fill; - murrine_shade (&widget->parentbg, 0.95, &fill); + MurrineRGB fill, border; + murrine_shade (&colors->bg[widget->state_type], 1.0, &fill); + murrine_shade (&colors->bg[GTK_STATE_ACTIVE], get_contrast(0.82, widget->contrast), &border); - murrine_scale_draw_gradient (cr, &fill, &colors->shade[5], + murrine_scale_draw_gradient (cr, &fill, &border, 1.0, 1.0, 1.0, trough_width-2, trough_height-2, - TRUE, slider->horizontal); + 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); + slider->horizontal); } cairo_restore (cr); @@ -405,11 +406,11 @@ murrine_rgba_draw_progressbar_trough (cairo_t *cr, const WidgetParameters *widget, int x, int y, int width, int height) { - const MurrineRGB *border = &colors->shade[4]; - MurrineRGB fill; + MurrineRGB border, fill; int roundness = MIN (widget->roundness, MIN ((height-2.0)/2.0, (width-2.0)/2.0)); - murrine_shade (&widget->parentbg, 0.95, &fill); + murrine_shade (&colors->bg[GTK_STATE_ACTIVE], 1.0, &fill); + murrine_shade (&colors->bg[GTK_STATE_ACTIVE], get_contrast(0.82, widget->contrast), &border); /* Create trough box */ murrine_rounded_rectangle_closed (cr, x+1, y+1, width-2, height-2, roundness, widget->corners); @@ -418,7 +419,7 @@ murrine_rgba_draw_progressbar_trough (cairo_t *cr, /* Draw border */ murrine_rounded_rectangle (cr, x+0.5, y+0.5, width-1, height-1, roundness, widget->corners); - murrine_set_color_rgba (cr, border, 0.8); + murrine_set_color_rgba (cr, &border, 0.8); cairo_stroke (cr); if (widget->mrn_gradient.gradients) @@ -426,7 +427,7 @@ murrine_rgba_draw_progressbar_trough (cairo_t *cr, cairo_pattern_t *pat; MurrineRGB shadow; - murrine_shade (border, 0.94, &shadow); + murrine_shade (&border, 0.94, &shadow); /* clip the corners of the shadows */ murrine_rounded_rectangle_closed (cr, x+1, y+1, width-2, height-2, roundness, widget->corners); @@ -1136,9 +1137,12 @@ murrine_rgba_draw_scrollbar_trough (cairo_t *cr, const ScrollBarParameters *scrollbar, int x, int y, int width, int height) { - const MurrineRGB *border = &colors->shade[scrollbar->stepperstyle < 1 ? 4 : 5]; + MurrineRGB border; MurrineRGB fill; + murrine_shade (&widget->parentbg, + get_contrast (scrollbar->stepperstyle < 1 ? 0.82 : 0.75, widget->contrast), + &border); murrine_shade (&widget->parentbg, scrollbar->stepperstyle < 1 ? 0.95 : 1.065, &fill); if (!scrollbar->horizontal) @@ -1159,7 +1163,7 @@ murrine_rgba_draw_scrollbar_trough (cairo_t *cr, cairo_fill (cr); /* Draw border */ - murrine_set_color_rgba (cr, border, 0.82); + murrine_set_color_rgba (cr, &border, 0.82); murrine_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, widget->roundness, widget->corners); cairo_stroke (cr); } diff --git a/src/murrine_style.c b/src/murrine_style.c index de93da9..0ddd7f8 100644 --- a/src/murrine_style.c +++ b/src/murrine_style.c @@ -130,12 +130,10 @@ murrine_set_widget_parameters (const GtkWidget *widget, params->focus = widget && GTK_WIDGET_HAS_FOCUS (widget); params->is_default = widget && GTK_WIDGET_HAS_DEFAULT (widget); - if (!params->active && widget && MRN_IS_TOGGLE_BUTTON (widget)) - params->active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); - params->xthickness = style->xthickness; params->ythickness = style->ythickness; + params->contrast = murrine_style->contrast; params->glazestyle = murrine_style->glazestyle; params->glow_shade = murrine_style->glow_shade; params->glowstyle = murrine_style->glowstyle; @@ -957,14 +955,22 @@ murrine_style_draw_box (DRAW_ARGS) { WidgetParameters params; ScrollBarParameters scrollbar; + boolean within_bevel = FALSE; + + if (widget->parent && MRN_IS_SCROLLED_WINDOW (widget->parent)) + gtk_widget_style_get (widget->parent, "scrollbars-within-bevel", &within_bevel, NULL); scrollbar.horizontal = TRUE; scrollbar.junction = murrine_scrollbar_get_junction (widget); scrollbar.steppers = murrine_scrollbar_visible_steppers (widget); scrollbar.stepperstyle = murrine_style->stepperstyle; + scrollbar.within_bevel = within_bevel; murrine_set_widget_parameters (widget, style, state_type, ¶ms); + if (within_bevel) + params.corners = MRN_CORNER_NONE; + if (MRN_IS_RANGE (widget)) scrollbar.horizontal = GTK_RANGE (widget)->orientation == GTK_ORIENTATION_HORIZONTAL; @@ -1225,6 +1231,7 @@ murrine_style_draw_box (DRAW_ARGS) { WidgetParameters params; ScrollBarParameters scrollbar; + boolean within_bevel = FALSE; scrollbar.has_color = FALSE; scrollbar.horizontal = TRUE; @@ -1304,6 +1311,12 @@ murrine_style_draw_box (DRAW_ARGS) else params.corners = MRN_CORNER_NONE; + if (widget->parent && MRN_IS_SCROLLED_WINDOW (widget->parent)) + gtk_widget_style_get (widget->parent, "scrollbars-within-bevel", &within_bevel, NULL); + + if (within_bevel) + params.corners = MRN_CORNER_NONE; + if (murrine_style->stepperstyle != 1) STYLE_FUNCTION(draw_scrollbar_stepper) (cr, colors, ¶ms, &scrollbar, x, y, width, height); } @@ -1819,6 +1832,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->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; murrine_style->glowstyle = MURRINE_RC_STYLE (rc_style)->glowstyle; @@ -2164,7 +2178,8 @@ murrine_style_copy (GtkStyle *style, GtkStyle *src) mrn_style->animation = mrn_src->animation; mrn_style->colorize_scrollbar = mrn_src->colorize_scrollbar; mrn_style->colors = mrn_src->colors; - mrn_style->focus_color = mrn_src->focus_color; + mrn_style->contrast = mrn_src->contrast; + mrn_style->focus_color = mrn_src->focus_color; mrn_style->glazestyle = mrn_src->glazestyle; mrn_style->glow_shade = mrn_src->glow_shade; mrn_style->glowstyle = mrn_src->glowstyle; diff --git a/src/murrine_types.h b/src/murrine_types.h index f9b9f60..c1eae79 100644 --- a/src/murrine_types.h +++ b/src/murrine_types.h @@ -219,6 +219,7 @@ typedef struct int lightborderstyle; int reliefstyle; int roundness; + double contrast; double glow_shade; double highlight_shade; double lightborder_shade; @@ -317,6 +318,7 @@ typedef struct MurrineStepper steppers; /* The visible steppers */ boolean horizontal; boolean has_color; + boolean within_bevel; int style; int stepperstyle; } ScrollBarParameters; diff --git a/src/support.h b/src/support.h index 68c9bd8..78a24d7 100644 --- a/src/support.h +++ b/src/support.h @@ -84,7 +84,9 @@ #define MRN_IS_CHECK_MENU_ITEM(object) ((object) && murrine_object_is_a ((GObject*)(object), "GtkCheckMenuItem")) #define MRN_IS_RANGE(object) ((object) && murrine_object_is_a ((GObject*)(object), "GtkRange")) - + +#define MRN_IS_SCROLLED_WINDOW(object) ((object) && murrine_object_is_a ((GObject*)(object), "GtkScrolledWindow")) + #define MRN_IS_SCROLLBAR(object) ((object) && murrine_object_is_a ((GObject*)(object), "GtkScrollbar")) #define MRN_IS_VSCROLLBAR(object) ((object) && murrine_object_is_a ((GObject*)(object), "GtkVScrollbar")) #define MRN_IS_HSCROLLBAR(object) ((object) && murrine_object_is_a ((GObject*)(object), "GtkHScrollbar"))