]> git.sur5r.net Git - glabels/commitdiff
Created 2 methods for setting label for mini-preview widget. The first is "by name...
authorJim Evins <evins@snaught.com>
Fri, 19 Dec 2003 05:21:02 +0000 (05:21 +0000)
committerJim Evins <evins@snaught.com>
Fri, 19 Dec 2003 05:21:02 +0000 (05:21 +0000)
git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@377 f5e0f49d-192f-0410-a22d-a8d8700d0965

glabels2/src/wdgt-media-select.c
glabels2/src/wdgt-mini-preview.c
glabels2/src/wdgt-mini-preview.h
glabels2/src/wdgt-print-copies.c
glabels2/src/wdgt-print-merge.c

index 0dbe82c247e096da8fd8610cd94c5a9d8c56bef1..4ec6b35f94965eca9fe400972b5ea4326c40e751 100644 (file)
@@ -312,8 +312,8 @@ gl_wdgt_media_select_construct (glWdgtMediaSelect *media_select)
            gtk_editable_get_chars (GTK_EDITABLE (media_select->template_entry),
                                    0, -1);
        gl_debug (DEBUG_MEDIA_SELECT, "name = \"%s\"", name);
-       gl_wdgt_mini_preview_set_label (GL_WDGT_MINI_PREVIEW (media_select->mini_preview),
-                                  name);
+       gl_wdgt_mini_preview_set_label_by_name (GL_WDGT_MINI_PREVIEW (media_select->mini_preview),
+                                               name);
        details_update (media_select, name);
        g_free (name);
 
@@ -385,8 +385,8 @@ template_entry_changed_cb (GtkEntry *entry,
        name = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
        if ( strlen(name) ) {
                gl_debug (DEBUG_MEDIA_SELECT, "name = \"%s\"", name);
-               gl_wdgt_mini_preview_set_label (GL_WDGT_MINI_PREVIEW (media_select->mini_preview),
-                                               name);
+               gl_wdgt_mini_preview_set_label_by_name (GL_WDGT_MINI_PREVIEW (media_select->mini_preview),
+                                                       name);
                gl_debug (DEBUG_MEDIA_SELECT, "m1");
                details_update (media_select, name);
                gl_debug (DEBUG_MEDIA_SELECT, "m2");
index 6108224c15c37600938073762ea254101afe3a57..210d6841182c5652b391cf8267437c8b67cf6d52 100644 (file)
@@ -66,8 +66,8 @@ static void gl_wdgt_mini_preview_finalize      (GObject * object);
 static void gl_wdgt_mini_preview_construct     (glWdgtMiniPreview * preview,
                                                gint height, gint width);
 
-static GList *mini_outline_list_new            (GnomeCanvas *canvas,
-                                               glTemplate *template);
+static GList *mini_outline_list_new            (GnomeCanvas      *canvas,
+                                               const glTemplate *template);
 static void mini_outline_list_free             (GList ** list);
 
 static gint canvas_event_cb                    (GnomeCanvas * canvas,
@@ -77,7 +77,7 @@ static gint canvas_event_cb                    (GnomeCanvas * canvas,
 static GnomeCanvasItem *cdbc_item              (GnomeCanvasGroup *group,
                                                gdouble           x1,
                                                gdouble           y1,
-                                               glTemplate       *template);
+                                               const glTemplate *template);
 
 static void style_set_cb                       (GtkWidget        *widget,
                                                GtkStyle         *previous_style,
@@ -273,10 +273,29 @@ gl_wdgt_mini_preview_construct (glWdgtMiniPreview * preview,
 /****************************************************************************/
 /* Set label for mini-preview to determine geometry.                        */
 /****************************************************************************/
-void gl_wdgt_mini_preview_set_label (glWdgtMiniPreview *preview,
-                                    gchar             *name)
+void gl_wdgt_mini_preview_set_label_by_name (glWdgtMiniPreview *preview,
+                                            const gchar       *name)
 {
        glTemplate *template;
+
+       gl_debug (DEBUG_MINI_PREVIEW, "START");
+
+       /* Fetch template */
+       template = gl_template_from_name (name);
+
+       gl_wdgt_mini_preview_set_template (preview, template);
+
+       gl_template_free( &template );
+
+       gl_debug (DEBUG_MINI_PREVIEW, "END");
+}
+
+/****************************************************************************/
+/* Set label for mini-preview to determine geometry.                        */
+/****************************************************************************/
+void gl_wdgt_mini_preview_set_template (glWdgtMiniPreview *preview,
+                                       const glTemplate  *template)
+{
        gchar      *page_size;
        gdouble     canvas_scale;
        gdouble     w, h;
@@ -284,9 +303,6 @@ void gl_wdgt_mini_preview_set_label (glWdgtMiniPreview *preview,
 
        gl_debug (DEBUG_MINI_PREVIEW, "START");
 
-       /* Fetch template */
-       template = gl_template_from_name (name);
-
        gl_debug (DEBUG_MINI_PREVIEW, "page_size = %s, page_width = %g, page_height = %g",
                  template->page_size, template->page_width, template->page_height);
 
@@ -333,8 +349,6 @@ void gl_wdgt_mini_preview_set_label (glWdgtMiniPreview *preview,
                mini_outline_list_new (GNOME_CANVAS(preview->canvas),
                                       template);
 
-       gl_template_free( &template );
-       
        gl_debug (DEBUG_MINI_PREVIEW, "END");
 }
 
@@ -342,8 +356,8 @@ void gl_wdgt_mini_preview_set_label (glWdgtMiniPreview *preview,
 /* PRIVATE.  Draw label outlines and return canvas item list.               */
 /*--------------------------------------------------------------------------*/
 static GList *
-mini_outline_list_new (GnomeCanvas *canvas,
-                      glTemplate  *template)
+mini_outline_list_new (GnomeCanvas       *canvas,
+                      const glTemplate  *template)
 {
        GnomeCanvasGroup      *group = NULL;
        GnomeCanvasItem       *item = NULL;
@@ -632,7 +646,7 @@ static GnomeCanvasItem *
 cdbc_item (GnomeCanvasGroup *group,
           gdouble           x1,
           gdouble           y1,
-          glTemplate       *template)
+          const glTemplate *template)
 {
        GnomeCanvasPoints *points;
        gint               i_coords, i_theta;
index fdb07483f69774a3648e42d007aca8afb794550e..3e61b8710ec4d04f04cf1f193722f8b44544b30d 100644 (file)
@@ -71,17 +71,20 @@ struct _glWdgtMiniPreviewClass {
                         gpointer user_data);
 };
 
-guint      gl_wdgt_mini_preview_get_type        (void);
+guint      gl_wdgt_mini_preview_get_type          (void);
 
-GtkWidget *gl_wdgt_mini_preview_new             (gint               height,
-                                                gint               width);
+GtkWidget *gl_wdgt_mini_preview_new               (gint               height,
+                                                  gint               width);
 
-void       gl_wdgt_mini_preview_set_label       (glWdgtMiniPreview *preview,
-                                                gchar             *name);
+void       gl_wdgt_mini_preview_set_label_by_name (glWdgtMiniPreview *preview,
+                                                  const gchar       *name);
 
-void       gl_wdgt_mini_preview_highlight_range (glWdgtMiniPreview *preview,
-                                                gint               first_label,
-                                                gint               last_label);
+void       gl_wdgt_mini_preview_set_template      (glWdgtMiniPreview *preview,
+                                                  const glTemplate  *template);
+
+void       gl_wdgt_mini_preview_highlight_range   (glWdgtMiniPreview *preview,
+                                                  gint               first_label,
+                                                  gint               last_label);
 G_END_DECLS
 
 #endif
index 2e2f960eed5a4e000ad3dc1d4723d9099ed399e6..4166ec860b303d6ead2d3fa18f337461f52eb2ed 100644 (file)
@@ -163,8 +163,8 @@ gl_wdgt_print_copies_construct (glWdgtPrintCopies *copies,
        /* mini_preview canvas */
        copies->mini_preview = gl_wdgt_mini_preview_new (WDGT_MINI_PREVIEW_HEIGHT,
                                                    WDGT_MINI_PREVIEW_WIDTH);
-       gl_wdgt_mini_preview_set_label (GL_WDGT_MINI_PREVIEW(copies->mini_preview),
-                                       template->name);
+       gl_wdgt_mini_preview_set_template (GL_WDGT_MINI_PREVIEW(copies->mini_preview),
+                                          template);
        gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), copies->mini_preview);
 
        wvbox = gl_hig_vbox_new (GL_HIG_VBOX_INNER);
index f635baa64354569fd399e83c46769fa1d48be79f..4b4e6f3e67fe82d5f70b99c7280c9ded1e21e26f 100644 (file)
@@ -160,8 +160,8 @@ gl_wdgt_print_merge_construct (glWdgtPrintMerge * merge,
        /* mini_preview canvas */
        merge->mini_preview = gl_wdgt_mini_preview_new (WDGT_MINI_PREVIEW_HEIGHT,
                                                        WDGT_MINI_PREVIEW_WIDTH);
-       gl_wdgt_mini_preview_set_label( GL_WDGT_MINI_PREVIEW (merge->mini_preview),
-                                       template->name );
+       gl_wdgt_mini_preview_set_template( GL_WDGT_MINI_PREVIEW (merge->mini_preview),
+                                          template );
        gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), merge->mini_preview);
        gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(merge->mini_preview),
                                              1, 1);