From e477fba7331b8a874b00a567defb09a888590aea Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 30 Mar 2014 20:12:48 +0000 Subject: 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 --- src/module.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'src/module.c') diff --git a/src/module.c b/src/module.c index 5434fc8..c8da4d2 100644 --- a/src/module.c +++ b/src/module.c @@ -564,34 +564,32 @@ ganv_module_update(GanvItem* item, int flags) static void ganv_module_draw(GanvItem* item, - cairo_t* cr, - int cx, int cy, - int width, int height) + cairo_t* cr, double cx, double cy, double cw, double ch) { GanvNode* node = GANV_NODE(item); GanvModule* module = GANV_MODULE(item); // Draw box if (GANV_ITEM_CLASS(parent_class)->draw) { - (*GANV_ITEM_CLASS(parent_class)->draw)(item, cr, cx, cy, width, height); + (*GANV_ITEM_CLASS(parent_class)->draw)(item, cr, cx, cy, cw, ch); } // Draw label if (node->impl->label) { GanvItem* label_item = GANV_ITEM(node->impl->label); - GANV_ITEM_GET_CLASS(label_item)->draw(label_item, cr, cx, cy, width, height); + GANV_ITEM_GET_CLASS(label_item)->draw(label_item, cr, cx, cy, cw, ch); } // Draw ports FOREACH_PORT(module->impl->ports, p) { GANV_ITEM_GET_CLASS(GANV_ITEM(*p))->draw( - GANV_ITEM(*p), cr, cx, cy, width, height); + GANV_ITEM(*p), cr, cx, cy, cw, ch); } // Draw embed item if (module->impl->embed_item) { GANV_ITEM_GET_CLASS(module->impl->embed_item)->draw( - module->impl->embed_item, cr, cx, cy, width, height); + module->impl->embed_item, cr, cx, cy, cw, ch); } } @@ -626,15 +624,11 @@ ganv_module_move(GanvNode* node, } static double -ganv_module_point(GanvItem* item, - double x, double y, - int cx, int cy, - GanvItem** actual_item) +ganv_module_point(GanvItem* item, double x, double y, GanvItem** actual_item) { GanvModule* module = GANV_MODULE(item); - double d = GANV_ITEM_CLASS(parent_class)->point( - item, x, y, cx, cy, actual_item); + double d = GANV_ITEM_CLASS(parent_class)->point(item, x, y, actual_item); if (!*actual_item) { // Point is not inside module at all, no point in checking children @@ -646,10 +640,7 @@ ganv_module_point(GanvItem* item, *actual_item = NULL; d = GANV_ITEM_GET_CLASS(port)->point( - port, - x - port->x, y - port->y, - cx, cy, - actual_item); + port, x - port->x, y - port->y, actual_item); if (*actual_item) { // Point is inside a port -- cgit v1.2.1