GtkRuler is right now deprecated for the reason that it seems to be covering a too special use cases. Although there are quite a few apps using it. Some even forked the widget to make it more useful. Instead of removing it, we could also make it better.

Use Cases

  • use with images
  • use for plots as axis labels

Forks and other implementations

Ardour

gtk-custom-ruler.c, gtk-custom-ruler.h, gtk-custom-hruler.c, gtk-custom-hruler.h

  • "show_position" property (no need for GTK_RULER_GET_CLASS(ruler)->draw_pos = NULL; hack)

  • callback based GtkRulerMetric replacement

GtkDatabox

gtkdatabox_ruler.c gtkdatabox_ruler.h

  • supports linear and logarithmic scales
  • in the vertical orientation, the labels are rotated 90°
  • it works for very small and very large value ranges

Things we should change

  • add "show_position" property
    • either boolean or we turn it into a enum { Off, Triangle, ColorTick, ... }

  • have something smarter for GtkRulerMetric as current API is broken:

    • GtkRulerMetric is public, but there is no API using it

    • GtkMetricType is an enum of 3 values with no way of registering own GtkRulerMetric

    • it does not cover non-linear rulers (e.g. Log), that could be solved with a callback
  • open bugs

  • get rid of gtk_ruler_{s,g}et_range and use a GtkAdjustment instead

  • the rulers look not nice
    • add more padding between ticks and numbers
    • use half-color for minor ticks

Attic/GtkRuler (last edited 2018-12-05 18:15:50 by EmmanueleBassi)