summaryrefslogtreecommitdiffstats
path: root/ganv
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-03-30 20:12:48 +0000
committerDavid Robillard <d@drobilla.net>2014-03-30 20:12:48 +0000
commite477fba7331b8a874b00a567defb09a888590aea (patch)
treea9a1626aae2137072e42fe48779f0b43f8d0c42d /ganv
parent7bf9f530dbdfcaa8151424908d492ef7c6c05e79 (diff)
downloadganv-e477fba7331b8a874b00a567defb09a888590aea.tar.gz
ganv-e477fba7331b8a874b00a567defb09a888590aea.tar.bz2
ganv-e477fba7331b8a874b00a567defb09a888590aea.zip
Reimplement canvas zoom.
Make select rectangle translucent. Make ctrl+scroll wheel zoom, not change font size. Add separate controls in Patchage for zoom (scale) and font size. Banish canvas coordinates from item implementations. git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5345 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'ganv')
-rw-r--r--ganv/Canvas.hpp2
-rw-r--r--ganv/canvas.h2
-rw-r--r--ganv/item.h21
3 files changed, 11 insertions, 14 deletions
diff --git a/ganv/Canvas.hpp b/ganv/Canvas.hpp
index b3281ad..2139e93 100644
--- a/ganv/Canvas.hpp
+++ b/ganv/Canvas.hpp
@@ -58,7 +58,7 @@ public:
METHOD0(ganv_canvas, clear);
METHOD0(ganv_canvas, clear_selection);
METHOD0(ganv_canvas, select_all);
- METHOD0(ganv_canvas, get_zoom);
+ METHODRET0(ganv_canvas, double, get_zoom);
METHOD1(ganv_canvas, set_zoom, double, pix_per_unit);
METHOD1(ganv_canvas, set_font_size, double, points);
METHOD0(ganv_canvas, zoom_full);
diff --git a/ganv/canvas.h b/ganv/canvas.h
index 57781dc..a3444dc 100644
--- a/ganv/canvas.h
+++ b/ganv/canvas.h
@@ -501,7 +501,7 @@ ganv_canvas_select_all(GanvCanvas* canvas);
* Return the current zoom factor (pixels per unit).
*/
double
-ganv_canvas_get_zoom(GanvCanvas* canvas);
+ganv_canvas_get_zoom(const GanvCanvas* canvas);
/**
* ganv_canvas_set_zoom:
diff --git a/ganv/item.h b/ganv/item.h
index 25d2985..83b5f3c 100644
--- a/ganv/item.h
+++ b/ganv/item.h
@@ -63,7 +63,7 @@ struct _GanvItem {
/* Position in parent-relative coordinates. */
double x, y;
- /* Bounding box for this item (in canvas coordinates) */
+ /* Bounding box for this item (in world coordinates) */
double x1, y1, x2, y2;
/* True if parent manages this item (don't call add/remove) */
@@ -102,28 +102,25 @@ struct _GanvItemClass {
/* Draw an item of this type.
*
- * (x, y) are the upper-left canvas pixel coordinates of the drawable.
- * (width, height) are the dimensions of the drawable.
+ * (cx, cy) and (width, height) describe the rectangle being drawn in
+ * world-relative coordinates.
*/
void (*draw)(GanvItem* item,
cairo_t* cr,
- int x,
- int y,
- int width,
- int height);
+ double cx,
+ double cy,
+ double cw,
+ double ch);
/* Calculate the distance from an item to the specified point.
*
* It also returns a canvas item which is actual item the point is within,
- * which may not be equal to @item if @item has children. (cx, cy) are the
- * canvas pixel coordinates that correspond to the item-relative
- * coordinates (x, y).
+ * which may not be equal to @item if @item has children.
+ * (x, y) are item-relative coordinates.
*/
double (*point)(GanvItem* item,
double x,
double y,
- int cx,
- int cy,
GanvItem** actual_item);
/* Fetch the item's bounding box (need not be exactly tight).