Code

Added work-around for broken themes that fill in with gtk_paint_border, including...
authorjoncruz <joncruz@users.sourceforge.net>
Fri, 27 Feb 2009 08:44:52 +0000 (08:44 +0000)
committerjoncruz <joncruz@users.sourceforge.net>
Fri, 27 Feb 2009 08:44:52 +0000 (08:44 +0000)
src/preferences-skeleton.h
src/ui/dialog/inkscape-preferences.cpp
src/ui/dialog/inkscape-preferences.h
src/widgets/sp-color-scales.cpp
src/widgets/sp-color-slider.cpp

index d84c7cacdfdb1033c511ea650e8c8f29e25cd320..ae39a22720927f9cf453e2e25609e876bd0a0146 100644 (file)
@@ -328,6 +328,8 @@ static char const preferences_skeleton[] =
 "             empcolor=\"65344\"\n" // 0x0000FF40
 "             empspacing=\"5\"/>\n"
 "    </group>\n"
+"    <group id=\"workarounds\"\n"
+"           colorsontop=\"0\"/>\n"
 "  </group>\n"
 "\n"
 "  <group id=\"extensions\">"
index f2cc0b1b8cdfd06df3f893bdf2bea30aab344445..fe7b1f7c13dd68ab9ec32431b5f4ee40fd7432a8 100644 (file)
@@ -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());
index 731ccfef8ccb841caf201d4ed6b8a2a421f5c035..ac3c96a88d5a9013653886b21a19a80a336f590f 100644 (file)
@@ -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;
 
index 2cc4915b8c9ce86fe96748eb7d76bc49b4a4dac6..cf06247e7393906f9b90276bde679c8fdf907655 100644 (file)
@@ -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};
index b8eb899cc7259223ee70a3f6379b5de05948cc44..0e30b1ce64928402194a77bc9fda295504c2ed08 100644 (file)
@@ -15,6 +15,7 @@
 #include <gtk/gtkversion.h>
 #include <gtk/gtksignal.h>
 #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)) {