[longomatch] Workaround for a stupid orientation bug in GTK with pixmap engine and the Scales



commit e7d83e96dbe27feb02b03e27324e921507b54f02
Author: Julien Moutte <julien fluendo com>
Date:   Mon Oct 20 08:59:39 2014 +0200

    Workaround for a stupid orientation bug in GTK with pixmap engine and the Scales

 data/theme/gtk-2.0/gtkrc    |    5 +-
 data/theme/gtk-2.0/range.rc |  244 ++++++++++++++++++++++++++-----------------
 2 files changed, 150 insertions(+), 99 deletions(-)
---
diff --git a/data/theme/gtk-2.0/gtkrc b/data/theme/gtk-2.0/gtkrc
index be9973e..7cb604b 100644
--- a/data/theme/gtk-2.0/gtkrc
+++ b/data/theme/gtk-2.0/gtkrc
@@ -143,7 +143,10 @@ class "GtkRadioButton"                           style "longomatch-radiobutton"
 class "GtkTreeView"                              style "longomatch-treeview"
 class "GtkIconView"                              style "longomatch-treeview"
 class "GtkTextView"                              style "longomatch-treeview"
-class "GtkScale"                                 style "longomatch-range"
+# Painful bug in GTK forces us to define a style for each orientation.
+# Indeed when providing different images for different orientation, GTK will pick the wrong orientation when 
the scale reaches boundaries…
+class "GtkHScale"                                style "longomatch-hscale"
+class "GtkVScale"                                style "longomatch-vscale"
 
 # Background for the menubar
 class "GtkMenuBar"                               style "longomatch-menubar"
diff --git a/data/theme/gtk-2.0/range.rc b/data/theme/gtk-2.0/range.rc
index 3fab743..ae69c2c 100644
--- a/data/theme/gtk-2.0/range.rc
+++ b/data/theme/gtk-2.0/range.rc
@@ -1,98 +1,146 @@
-style "longomatch-range"
-{
-  GtkRange::trough-border              = 0
-  GtkRange::trough-side-details                = 1
-  GtkRange::activate-slider            = TRUE
-  GtkRange::slider-width               = 20
-  GtkScale::slider-length              = 20
-  engine "pixmap" 
-  {
-    image 
-    {
-          function                     = BOX
-          recolorable                  = TRUE
-          detail                       = "trough-lower"
-          file                         = "Range/trough-horizontal-lower.png"
-          border                       = { 0, 0, 9, 9 }
-          stretch                      = TRUE
-          orientation                  = HORIZONTAL
-    }
-    image 
-    {
-          function                     = BOX
-          recolorable                  = TRUE
-          detail                       = "trough-lower"
-          file                         = "Range/trough-vertical-lower.png"
-          border                       = { 9, 9, 0, 0 }
-          stretch                      = TRUE
-          orientation                  = VERTICAL
-    }
-    image 
-    {
-          function                     = BOX
-          recolorable                  = TRUE
-          detail                       = "trough-upper"
-          file                         = "Range/trough-horizontal.png"
-          border                       = { 0, 0, 9, 9 }
-          stretch                      = TRUE
-          orientation                  = HORIZONTAL
-    }
-    image 
-    {
-          function                     = BOX
-          recolorable                  = TRUE
-          detail                       = "trough-upper"
-          file                         = "Range/trough-vertical.png"
-          border                       = { 9, 9, 0, 0 }
-          stretch                      = TRUE
-          orientation                  = VERTICAL
-    }
-
-############### the sliders ###############
-
-    image 
-    {
-          function                     = SLIDER
-          recolorable                  = TRUE
-          state                                = NORMAL
-          file                         = "Range/null.png"
-          border                       = { 0, 0, 0, 0 }
-          stretch                      = TRUE
-          overlay_file                 = "Range/slider.png"
-          overlay_stretch              = FALSE
-    }
-    image 
-    {
-          function                     = SLIDER
-          recolorable                  = TRUE
-          state                                = PRELIGHT
-          file                         = "Range/null.png"
-          border                       = { 0, 0, 0, 0 }
-          stretch                      = TRUE
-          overlay_file                 = "Range/slider-active.png"
-          overlay_stretch              = FALSE
-    }
-    image 
-    {
-          function                     = SLIDER
-          recolorable                  = TRUE
-          state                                = ACTIVE
-          file                         = "Range/null.png"
-          border                       = { 0, 0, 0, 0 }
-          stretch                      = TRUE
-          overlay_file                 = "Range/slider-active.png"
-          overlay_stretch              = FALSE
-    }
-    image 
-    {
-          function                     = SLIDER
-          recolorable                  = TRUE
-          state                                = INSENSITIVE
-          file                         = "Range/null.png"
-          border                       = { 0, 0, 0, 0 }
-          stretch                      = TRUE
-          overlay_file                 = "Range/slider-insensitive.png"
-          overlay_stretch              = FALSE
-    }
-  }
-}
+style "longomatch-range"
+{
+  GtkRange::trough-border              = 0
+  GtkRange::trough-side-details                = 1
+  GtkRange::activate-slider            = TRUE
+  GtkRange::slider-width               = 20
+  GtkScale::slider-length              = 20
+}
+
+style "longomatch-hscale"  = "longomatch-range"
+{
+  engine "pixmap" 
+  {
+    image 
+    {
+          function                     = BOX
+          recolorable                  = TRUE
+          detail                       = "trough-lower"
+          file                         = "Range/trough-horizontal-lower.png"
+          border                       = { 0, 0, 9, 9 }
+          stretch                      = TRUE
+    }
+    image 
+    {
+          function                     = BOX
+          recolorable                  = TRUE
+          detail                       = "trough-upper"
+          file                         = "Range/trough-horizontal.png"
+          border                       = { 0, 0, 9, 9 }
+          stretch                      = TRUE
+    }
+    image 
+    {
+          function                     = SLIDER
+          recolorable                  = TRUE
+          state                                = NORMAL
+          file                         = "Range/null.png"
+          border                       = { 0, 0, 0, 0 }
+          stretch                      = TRUE
+          overlay_file                 = "Range/slider.png"
+          overlay_stretch              = FALSE
+    }
+    image 
+    {
+          function                     = SLIDER
+          recolorable                  = TRUE
+          state                                = PRELIGHT
+          file                         = "Range/null.png"
+          border                       = { 0, 0, 0, 0 }
+          stretch                      = TRUE
+          overlay_file                 = "Range/slider-active.png"
+          overlay_stretch              = FALSE
+    }
+    image 
+    {
+          function                     = SLIDER
+          recolorable                  = TRUE
+          state                                = ACTIVE
+          file                         = "Range/null.png"
+          border                       = { 0, 0, 0, 0 }
+          stretch                      = TRUE
+          overlay_file                 = "Range/slider-active.png"
+          overlay_stretch              = FALSE
+    }
+    image 
+    {
+          function                     = SLIDER
+          recolorable                  = TRUE
+          state                                = INSENSITIVE
+          file                         = "Range/null.png"
+          border                       = { 0, 0, 0, 0 }
+          stretch                      = TRUE
+          overlay_file                 = "Range/slider-insensitive.png"
+          overlay_stretch              = FALSE
+    }
+  }
+}
+
+style "longomatch-vscale"  = "longomatch-range"
+{
+  engine "pixmap" 
+  {
+    image 
+    {
+          function                     = BOX
+          recolorable                  = TRUE
+          detail                       = "trough-lower"
+          file                         = "Range/trough-vertical-lower.png"
+          border                       = { 9, 9, 0, 0 }
+          stretch                      = TRUE
+    }
+    image 
+    {
+          function                     = BOX
+          recolorable                  = TRUE
+          detail                       = "trough-upper"
+          file                         = "Range/trough-vertical.png"
+          border                       = { 9, 9, 0, 0 }
+          stretch                      = TRUE
+    }
+    image 
+    {
+          function                     = SLIDER
+          recolorable                  = TRUE
+          state                                = NORMAL
+          file                         = "Range/null.png"
+          border                       = { 0, 0, 0, 0 }
+          stretch                      = TRUE
+          overlay_file                 = "Range/slider.png"
+          overlay_stretch              = FALSE
+    }
+    image 
+    {
+          function                     = SLIDER
+          recolorable                  = TRUE
+          state                                = PRELIGHT
+          file                         = "Range/null.png"
+          border                       = { 0, 0, 0, 0 }
+          stretch                      = TRUE
+          overlay_file                 = "Range/slider-active.png"
+          overlay_stretch              = FALSE
+    }
+    image 
+    {
+          function                     = SLIDER
+          recolorable                  = TRUE
+          state                                = ACTIVE
+          file                         = "Range/null.png"
+          border                       = { 0, 0, 0, 0 }
+          stretch                      = TRUE
+          overlay_file                 = "Range/slider-active.png"
+          overlay_stretch              = FALSE
+    }
+    image 
+    {
+          function                     = SLIDER
+          recolorable                  = TRUE
+          state                                = INSENSITIVE
+          file                         = "Range/null.png"
+          border                       = { 0, 0, 0, 0 }
+          stretch                      = TRUE
+          overlay_file                 = "Range/slider-insensitive.png"
+          overlay_stretch              = FALSE
+    }
+  }
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]