[dia] [gtk-deprecated] restrict GtkRuler access to interface.c



commit 8c05b81e3cf2d6c56dbed509478c866090adc71c
Author: Hans Breuer <hans breuer org>
Date:   Sun Mar 27 12:06:41 2011 +0200

    [gtk-deprecated] restrict GtkRuler access to interface.c
    
    GtkRuler is deprecated by gtk-2-24, gone with gtk-3-0 because it is
    deemed to be too specialized for maintenance in Gtk. Maybe Dia is
    too specialized to be ported?

 app/display.c   |   11 +----------
 app/display.h   |    1 +
 app/interface.c |   26 ++++++++++++++++++++++++++
 3 files changed, 28 insertions(+), 10 deletions(-)
---
diff --git a/app/display.c b/app/display.c
index f6846d3..243d3ed 100644
--- a/app/display.c
+++ b/app/display.c
@@ -757,16 +757,7 @@ ddisplay_set_origo(DDisplay *ddisp, coord x, coord y)
   visible->right = ddisp->origo.x + ddisplay_untransform_length(ddisp, width);
   visible->bottom = ddisp->origo.y + ddisplay_untransform_length(ddisp, height);
 
-  gtk_ruler_set_range  (GTK_RULER (ddisp->hrule),
-			visible->left,
-			visible->right,
-			0.0f /* position*/,
-			MAX(extents->right, visible->right)/* max_size*/);
-  gtk_ruler_set_range  (GTK_RULER (ddisp->vrule),
-			visible->top,
-			visible->bottom,
-			0.0f /*        position*/,
-			MAX(extents->bottom, visible->bottom)/* max_size*/);
+  ddisplay_update_rulers (ddisp, extents, visible);
 }
 
 void
diff --git a/app/display.h b/app/display.h
index 8c81184..f9dc7e5 100644
--- a/app/display.h
+++ b/app/display.h
@@ -169,6 +169,7 @@ Point ddisplay_get_clicked_position(DDisplay *ddisp);
 gboolean display_get_rulers_showing(DDisplay *ddisp);
 void display_rulers_show (DDisplay *ddisp);
 void display_rulers_hide (DDisplay *ddisp);
+void ddisplay_update_rulers (DDisplay *ddisp, const Rectangle *extents, const Rectangle *visible);
 
 gboolean ddisplay_scroll(DDisplay *ddisp, Point *delta);
 gboolean ddisplay_autoscroll(DDisplay *ddisp, int x, int y);
diff --git a/app/interface.c b/app/interface.c
index b7c6421..d550197 100644
--- a/app/interface.c
+++ b/app/interface.c
@@ -23,6 +23,10 @@
 #include <gnome.h>
 #else
 #undef GTK_DISABLE_DEPRECATED /* GtkPixmap */
+/* GtkRuler is deprecated by gtk-2-24, gone with gtk-3-0 because it is 
+ * deemed to be too specialized for maintenance in Gtk. Maybe Dia is 
+ * too specialized to be ported?
+ */
 #include <gtk/gtk.h>
 #endif
 #include "gtkwrapbox.h"
@@ -1005,6 +1009,28 @@ create_display_shell(DDisplay *ddisp,
   gtk_widget_grab_focus (ddisp->canvas);
 }
 
+/**
+ * Adapt the rulers to current field of view
+ *
+ * @param ddisp The display to hide the rulers on.
+ */
+void 
+ddisplay_update_rulers (DDisplay        *ddisp,
+                        const Rectangle *extents,
+		        const Rectangle *visible)
+{
+  gtk_ruler_set_range  (GTK_RULER (ddisp->hrule),
+			visible->left,
+			visible->right,
+			0.0f /* position*/,
+			MAX(extents->right, visible->right)/* max_size*/);
+  gtk_ruler_set_range  (GTK_RULER (ddisp->vrule),
+			visible->top,
+			visible->bottom,
+			0.0f /*        position*/,
+			MAX(extents->bottom, visible->bottom)/* max_size*/);
+}
+
 void
 tool_select_update (GtkWidget *w,
 		     gpointer   data)



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