From 53650c4839343807b95444a86e89225fc71de648 Mon Sep 17 00:00:00 2001 From: joncruz Date: Fri, 27 Feb 2009 08:44:52 +0000 Subject: [PATCH] Added work-around for broken themes that fill in with gtk_paint_border, including gtk-qt-engine. Fixes bug #281809. --- src/preferences-skeleton.h | 2 ++ src/ui/dialog/inkscape-preferences.cpp | 6 ++++++ src/ui/dialog/inkscape-preferences.h | 1 + src/widgets/sp-color-scales.cpp | 4 +++- src/widgets/sp-color-slider.cpp | 29 +++++++++++++++++++------- 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index d84c7cacd..ae39a2272 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -328,6 +328,8 @@ static char const preferences_skeleton[] = " empcolor=\"65344\"\n" // 0x0000FF40 " empspacing=\"5\"/>\n" " \n" +" \n" " \n" "\n" " " diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index f2cc0b1b8..fe7b1f7c1 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1075,6 +1075,12 @@ void InkscapePreferences::initPageUI() _page_ui.add_line( false, _("Secondary toolbar icon size"), _misc_small_secondary, "", _("Set the size for the icons in secondary toolbars to use (requires restart)"), false); + + _ui_colorsliders_top.init( _("Work-around color sliders not drawing."), "/options/workarounds/colorsontop", false); + _page_ui.add_line( false, "", _ui_colorsliders_top, "", + _("When on, will attempt to work around bugs in certain GTK themes drawing color sliders."), true); + + _misc_recent.init("/options/maxrecentdocuments/value", 0.0, 1000.0, 1.0, 1.0, 1.0, true, false); Gtk::HBox* recent_hbox = Gtk::manage(new Gtk::HBox()); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 731ccfef8..ac3c96a88 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -187,6 +187,7 @@ protected: PrefCombo _misc_small_toolbar; PrefCombo _misc_small_secondary; PrefCombo _misc_small_tools; + PrefCheckButton _ui_colorsliders_top; PrefSpinButton _misc_recent; ZoomCorrRulerSlider _ui_zoom_correction; diff --git a/src/widgets/sp-color-scales.cpp b/src/widgets/sp-color-scales.cpp index 2cc4915b8..cf06247e7 100644 --- a/src/widgets/sp-color-scales.cpp +++ b/src/widgets/sp-color-scales.cpp @@ -45,6 +45,8 @@ static SPColorSelectorClass *parent_class; #define XPAD 4 #define YPAD 1 +#define noDUMP_CHANGE_INFO 1 + GType sp_color_scales_get_type (void) { @@ -272,7 +274,7 @@ void ColorScales::_setRangeLimit( gdouble upper ) void ColorScales::_colorChanged() { #ifdef DUMP_CHANGE_INFO - g_message("ColorScales::_colorChanged( this=%p, %f, %f, %f, %f)", this, color.v.c[0], color.v.c[1], color.v.c[2], alpha ); + g_message("ColorScales::_colorChanged( this=%p, %f, %f, %f, %f)", this, _color.v.c[0], _color.v.c[1], _color.v.c[2], _alpha ); #endif gfloat tmp[3]; gfloat c[5] = {0.0, 0.0, 0.0, 0.0}; diff --git a/src/widgets/sp-color-slider.cpp b/src/widgets/sp-color-slider.cpp index b8eb899cc..0e30b1ce6 100644 --- a/src/widgets/sp-color-slider.cpp +++ b/src/widgets/sp-color-slider.cpp @@ -15,6 +15,7 @@ #include #include #include "sp-color-scales.h" +#include "preferences.h" #define SLIDER_WIDTH 96 #define SLIDER_HEIGHT 8 @@ -460,6 +461,7 @@ sp_color_slider_paint (SPColorSlider *slider, GdkRectangle *area) GdkRectangle wpaint, cpaint, apaint; const guchar *b; gint w, x, y1, y2; + gboolean colorsOnTop = Inkscape::Preferences::get()->getBool("/options/workarounds/colorsontop", false); widget = GTK_WIDGET (slider); @@ -482,10 +484,21 @@ sp_color_slider_paint (SPColorSlider *slider, GdkRectangle *area) aarea.height = carea.height; /* Actual paintable area */ - if (!gdk_rectangle_intersect (area, &warea, &wpaint)) return; + if (!gdk_rectangle_intersect (area, &warea, &wpaint)) { + return; + } b = NULL; + // Draw shadow + if (colorsOnTop) { + gtk_paint_shadow( widget->style, widget->window, + (GtkStateType)widget->state, GTK_SHADOW_IN, + area, widget, "colorslider", + 0, 0, + warea.width, warea.height); + } + /* Paintable part of color gradient area */ if (gdk_rectangle_intersect (area, &carea, &cpaint)) { if (slider->map) { @@ -556,12 +569,14 @@ sp_color_slider_paint (SPColorSlider *slider, GdkRectangle *area) } } - /* Draw shadow */ - gtk_paint_shadow (widget->style, widget->window, - (GtkStateType)widget->state, GTK_SHADOW_IN, - area, widget, "colorslider", - 0, 0, - warea.width, warea.height); + /* Draw shadow */ + if (!colorsOnTop) { + gtk_paint_shadow( widget->style, widget->window, + (GtkStateType)widget->state, GTK_SHADOW_IN, + area, widget, "colorslider", + 0, 0, + warea.width, warea.height); + } if (gdk_rectangle_intersect (area, &aarea, &apaint)) { -- 2.30.2