From: Jim Evins Date: Mon, 29 Apr 2002 03:12:54 +0000 (+0000) Subject: Fixed layout of labels so that they are layed out in the proper coordinate system: X-Git-Tag: glabels-2_3_0~870 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=80c7efe71c394abaab547eee7172ec4c24f2067f;p=glabels Fixed layout of labels so that they are layed out in the proper coordinate system: The canvas origin is at the upper left, while the origin on paper is at the lower left. This was not apparent until a non-symetric (vertical) layout was used. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@8 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- diff --git a/glabels1/src/mini_preview.c b/glabels1/src/mini_preview.c index b5b434ee..21e61fa4 100644 --- a/glabels1/src/mini_preview.c +++ b/glabels1/src/mini_preview.c @@ -269,13 +269,19 @@ mini_outline_list_new (GnomeCanvas * canvas, GnomeCanvasItem *item = NULL; GList *list = NULL; gint i, ix, iy; - gdouble x1, y1, x2, y2; + gdouble x1, y1, x2, y2, y_temp; + const GnomePaper *paper = NULL; + gdouble paper_height; + + /* get paper height */ + paper = gnome_paper_with_name (template->page_size); + paper_height = gnome_paper_psheight (paper); group = gnome_canvas_root (canvas); /* draw mini label outlines */ i = 1; - for (iy = 0; iy < template->ny; iy++) { + for (iy = (template->ny - 1); iy >= 0; iy--) { for (ix = 0; ix < template->nx; ix++, i++) { x1 = ix * (template->dx) + template->x0; @@ -283,6 +289,12 @@ mini_outline_list_new (GnomeCanvas * canvas, x2 = x1 + template->label_width; y2 = y1 + template->label_height; + /* transform origin from lower left to upper left */ + /* and swap y's so that (y1 < y2) */ + y_temp = y2; + y2 = paper_height - y1; + y1 = paper_height - y_temp; + switch (template->style) { case GL_TEMPLATE_STYLE_RECT: item = gnome_canvas_item_new (group,