[glabels] Some new label dialog cleanup



commit 84dfd774bae16f8bdc9dde21baabd41cc7638dd0
Author: Jim Evins <evins snaught com>
Date:   Sat Mar 13 10:49:52 2010 -0500

    Some new label dialog cleanup
    
    Draw arrow in mini preview relative to first label, not the entire sheet.
    This should be more obvious what the arrow is indicating, before it could
    have been interpreted as the feed direction.
    
    Don't put an empty line at the end of the list of similar templates.

 src/mini-preview.c     |   31 ++++++++++++++++++-------------
 src/new-label-dialog.c |    6 +++++-
 2 files changed, 23 insertions(+), 14 deletions(-)
---
diff --git a/src/mini-preview.c b/src/mini-preview.c
index abbc104..1d397b3 100644
--- a/src/mini-preview.c
+++ b/src/mini-preview.c
@@ -41,7 +41,7 @@
 #define SHADOW_OFFSET 3
 
 #define ARROW_SCALE 0.35
-#define ARROW_RGBA_ARGS 1.0, 0.0, 0.0, 0.05
+#define ARROW_RGBA_ARGS 1.0, 0.0, 0.0, 0.25
 
 /*===========================================*/
 /* Private types                             */
@@ -145,9 +145,7 @@ static void     draw_labels                    (glMiniPreview          *this,
 						lglTemplate            *template,
 						gdouble                 line_width);
 static void     draw_arrow                     (glMiniPreview          *this,
-                                                cairo_t                *cr,
-                                                gdouble                 width,
-                                                gdouble                 height);
+                                                cairo_t                *cr);
 
 static void     draw_rich_preview              (glMiniPreview          *this,
 						cairo_t                *cr);
@@ -902,8 +900,7 @@ draw (glMiniPreview  *this,
 
                 if (this->priv->draw_arrow_flag)
                 {
-                        draw_arrow (this, cr,
-                                    template->page_width, template->page_height);
+                        draw_arrow (this, cr);
                 }
 
                 if (this->priv->label)
@@ -1058,17 +1055,25 @@ draw_labels (glMiniPreview *this,
 /*--------------------------------------------------------------------------*/
 static void
 draw_arrow  (glMiniPreview      *this,
-             cairo_t            *cr,
-             gdouble             width,
-             gdouble             height)
+             cairo_t            *cr)
 {
-        gdouble min;
+        lglTemplateFrame  *frame;
+        lglTemplateOrigin *origins;
+        gdouble            width, height, min;
+        gdouble            x0, y0;
 
-        cairo_save (cr);
+        frame = (lglTemplateFrame *)this->priv->template->frames->data;
 
+        lgl_template_frame_get_size (frame, &width, &height);
+        origins = lgl_template_frame_get_origins (frame);
+        x0 = origins[0].x;
+        y0 = origins[0].y;
         min = MIN (width, height);
+        g_free (origins);
+
+        cairo_save (cr);
 
-        cairo_translate (cr, width/2, height/2);
+        cairo_translate (cr, x0 + width/2, y0 + height/2);
         cairo_scale (cr, 1, -1);
         if ( this->priv->rotate_flag )
         {
@@ -1076,7 +1081,7 @@ draw_arrow  (glMiniPreview      *this,
         }
 
         cairo_new_path (cr);
-        cairo_move_to (cr, 0, -min*ARROW_SCALE/2);
+        cairo_move_to (cr, 0, -min*ARROW_SCALE);
         cairo_line_to (cr, 0, min*ARROW_SCALE);
 
         cairo_new_sub_path (cr);
diff --git a/src/new-label-dialog.c b/src/new-label-dialog.c
index ffea6dc..0cb690c 100644
--- a/src/new-label-dialog.c
+++ b/src/new-label-dialog.c
@@ -375,7 +375,11 @@ set_info (glNewLabelDialog  *this,
         list_string = g_string_new ("");
         for ( p = list; p; p = p->next )
         {
-                g_string_append_printf (list_string, "%s\n", (char *)p->data);
+                g_string_append (list_string, (char *)p->data);
+                if ( p->next )
+                {
+                        g_string_append (list_string, "\n");
+                }
         }
         gtk_label_set_text (GTK_LABEL (this->priv->similar_label), list_string->str);
 



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