From 3419680f2523414d4ac7349232eb92b627dd993a Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Tue, 7 Dec 2010 00:59:05 +0100
Subject: Implement more of LdCanvas.
1. Add methods for coordinate translation between cairo/GtkWidget
coordinates and LdDocument coordinates.
2. Draw the grid correctly (also make it significantly faster).
3. Place the canvas into a GtkScrolledWindow and register
the set_scroll_adjustments signal in the GtkWidget base class.
4. Allow scrolling inside of an area of 200 x 200 units (for now).
In the future, it should be possible to go to infinity.
---
src/ld-canvas.h | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
(limited to 'src/ld-canvas.h')
diff --git a/src/ld-canvas.h b/src/ld-canvas.h
index a31b2b7..037e727 100644
--- a/src/ld-canvas.h
+++ b/src/ld-canvas.h
@@ -48,22 +48,33 @@ struct _LdCanvasClass
/*< private >*/
GtkDrawingAreaClass parent_class;
-/*
- void (*set_scroll_adjustments) (GtkAdjustment *x, GtkAdjustment *y);
-*/
+ void (*set_scroll_adjustments) (LdCanvas *self,
+ GtkAdjustment *horizontal, GtkAdjustment *vertical);
};
+/**
+ * LD_CANVAS_BASE_UNIT:
+ *
+ * The length of the base unit in milimetres.
+ */
+#define LD_CANVAS_BASE_UNIT_LENGTH 2.5
+
+
GType ld_canvas_get_type (void) G_GNUC_CONST;
LdCanvas *ld_canvas_new (void);
void ld_canvas_set_document (LdCanvas *self, LdDocument *document);
LdDocument *ld_canvas_get_document (LdCanvas *self);
-
void ld_canvas_set_library (LdCanvas *self, LdLibrary *library);
LdLibrary *ld_canvas_get_library (LdCanvas *self);
+void ld_canvas_translate_canvas_coordinates (LdCanvas *self,
+ gdouble *x, gdouble *y);
+void ld_canvas_translate_document_coordinates (LdCanvas *self,
+ gdouble *x, gdouble *y);
+
/* TODO: The rest of the interface. */
--
cgit v1.2.3-70-g09d2