3 * Copyright (C) 2001-2009 Jim Evins <evins@snaught.com>.
5 * This file is part of gLabels.
7 * gLabels is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * gLabels is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with gLabels. If not, see <http://www.gnu.org/licenses/>.
23 #include "mini-preview.h"
27 #include <libglabels.h>
28 #include "cairo-label-path.h"
36 /*===========================================*/
37 /* Private macros and constants. */
38 /*===========================================*/
41 #define SHADOW_OFFSET 3
43 #define ARROW_SCALE 0.35
44 #define ARROW_RGBA_ARGS 1.0, 0.0, 0.0, 0.25
46 /*===========================================*/
48 /*===========================================*/
62 struct _glMiniPreviewPrivate {
66 lglTemplate *template;
67 gint labels_per_sheet;
78 gboolean draw_arrow_flag;
81 gboolean update_scheduled_flag;
89 gboolean collate_flag;
90 gboolean outline_flag;
91 gboolean reverse_flag;
92 gboolean crop_marks_flag;
96 /*===========================================*/
98 /*===========================================*/
100 static gint mini_preview_signals[LAST_SIGNAL] = { 0 };
103 /*===========================================*/
104 /* Local function prototypes */
105 /*===========================================*/
107 static void gl_mini_preview_finalize (GObject *object);
109 static void gl_mini_preview_construct (glMiniPreview *this,
113 static gboolean button_press_event_cb (GtkWidget *widget,
114 GdkEventButton *event);
115 static gboolean motion_notify_event_cb (GtkWidget *widget,
116 GdkEventMotion *event);
117 static gboolean button_release_event_cb (GtkWidget *widget,
118 GdkEventButton *event);
121 static gboolean expose_event_cb (GtkWidget *widget,
122 GdkEventExpose *event,
123 glMiniPreview *this);
124 static void style_set_cb (GtkWidget *widget,
125 GtkStyle *previous_style,
126 glMiniPreview *this);
128 static void redraw (glMiniPreview *this);
129 static void draw (glMiniPreview *this,
132 static void draw_shadow (glMiniPreview *this,
138 static void draw_paper (glMiniPreview *this,
143 static void draw_labels (glMiniPreview *this,
145 lglTemplate *template,
147 static void draw_arrow (glMiniPreview *this,
150 static void draw_rich_preview (glMiniPreview *this,
154 static gint find_closest_label (glMiniPreview *this,
158 static gdouble set_transform_and_get_scale (glMiniPreview *this,
162 /****************************************************************************/
163 /* Object infrastructure. */
164 /****************************************************************************/
165 G_DEFINE_TYPE (glMiniPreview, gl_mini_preview, GTK_TYPE_EVENT_BOX);
168 /*****************************************************************************/
169 /* Class Init Function. */
170 /*****************************************************************************/
172 gl_mini_preview_class_init (glMiniPreviewClass *class)
174 GObjectClass *object_class = G_OBJECT_CLASS (class);
175 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
177 gl_debug (DEBUG_MINI_PREVIEW, "START");
179 gl_mini_preview_parent_class = g_type_class_peek_parent (class);
181 object_class->finalize = gl_mini_preview_finalize;
183 widget_class->button_press_event = button_press_event_cb;
184 widget_class->motion_notify_event = motion_notify_event_cb;
185 widget_class->button_release_event = button_release_event_cb;
187 mini_preview_signals[CLICKED] =
188 g_signal_new ("clicked",
189 G_OBJECT_CLASS_TYPE(object_class),
191 G_STRUCT_OFFSET (glMiniPreviewClass, clicked),
193 gl_marshal_VOID__INT,
194 G_TYPE_NONE, 1, G_TYPE_INT);
196 mini_preview_signals[PRESSED] =
197 g_signal_new ("pressed",
198 G_OBJECT_CLASS_TYPE(object_class),
200 G_STRUCT_OFFSET (glMiniPreviewClass, pressed),
202 gl_marshal_VOID__INT_INT,
203 G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
205 mini_preview_signals[RELEASED] =
206 g_signal_new ("released",
207 G_OBJECT_CLASS_TYPE(object_class),
209 G_STRUCT_OFFSET (glMiniPreviewClass, released),
211 gl_marshal_VOID__INT_INT,
212 G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
214 gl_debug (DEBUG_MINI_PREVIEW, "END");
218 /*****************************************************************************/
219 /* Object Instance Init Function. */
220 /*****************************************************************************/
222 gl_mini_preview_init (glMiniPreview *this)
224 gl_debug (DEBUG_MINI_PREVIEW, "START");
226 this->priv = g_new0 (glMiniPreviewPrivate, 1);
228 gtk_widget_add_events (GTK_WIDGET (this),
229 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
230 GDK_POINTER_MOTION_MASK);
232 gtk_event_box_set_visible_window (GTK_EVENT_BOX (this), FALSE);
234 this->priv->canvas = gtk_drawing_area_new ();
235 gtk_widget_set_has_window(this->priv->canvas, FALSE);
236 gtk_container_add (GTK_CONTAINER (this), this->priv->canvas);
238 g_signal_connect (G_OBJECT (this->priv->canvas), "expose-event",
239 G_CALLBACK (expose_event_cb), this);
240 g_signal_connect (G_OBJECT (this->priv->canvas), "style-set",
241 G_CALLBACK (style_set_cb), this);
243 gl_debug (DEBUG_MINI_PREVIEW, "END");
247 /*****************************************************************************/
248 /* Finalize Method. */
249 /*****************************************************************************/
251 gl_mini_preview_finalize (GObject *object)
253 glMiniPreview *this = GL_MINI_PREVIEW (object);
255 gl_debug (DEBUG_MINI_PREVIEW, "START");
257 g_return_if_fail (object != NULL);
258 g_return_if_fail (GL_IS_MINI_PREVIEW (object));
260 if (this->priv->label)
262 g_object_unref (this->priv->label);
264 lgl_template_free (this->priv->template);
265 g_free (this->priv->centers);
268 G_OBJECT_CLASS (gl_mini_preview_parent_class)->finalize (object);
270 gl_debug (DEBUG_MINI_PREVIEW, "END");
274 /*****************************************************************************/
275 /** New Object Generator. */
276 /*****************************************************************************/
278 gl_mini_preview_new (gint height,
283 gl_debug (DEBUG_MINI_PREVIEW, "START");
285 this = g_object_new (gl_mini_preview_get_type (), NULL);
287 gl_mini_preview_construct (this, height, width);
289 gl_debug (DEBUG_MINI_PREVIEW, "END");
291 return GTK_WIDGET (this);
295 /*--------------------------------------------------------------------------*/
296 /* Construct composite widget. */
297 /*--------------------------------------------------------------------------*/
299 gl_mini_preview_construct (glMiniPreview *this,
303 gl_debug (DEBUG_MINI_PREVIEW, "START");
305 gtk_widget_set_size_request (GTK_WIDGET (this->priv->canvas), width, height);
307 gl_debug (DEBUG_MINI_PREVIEW, "END");
311 /****************************************************************************/
312 /* Set template for mini-preview to determine geometry. */
313 /****************************************************************************/
315 gl_mini_preview_set_by_name (glMiniPreview *this,
318 lglTemplate *template;
320 gl_debug (DEBUG_MINI_PREVIEW, "START");
323 template = lgl_db_lookup_template_from_name (name);
325 gl_mini_preview_set_template (this, template);
327 lgl_template_free (template);
329 gl_debug (DEBUG_MINI_PREVIEW, "END");
333 /****************************************************************************/
334 /* Set template for mini-preview to determine geometry. */
335 /****************************************************************************/
337 gl_mini_preview_set_template (glMiniPreview *this,
338 const lglTemplate *template)
340 const lglTemplateFrame *frame;
341 lglTemplateOrigin *origins;
345 gl_debug (DEBUG_MINI_PREVIEW, "START");
347 frame = (lglTemplateFrame *)template->frames->data;
352 lgl_template_free (this->priv->template);
353 this->priv->template = lgl_template_dup (template);
356 * Set labels per sheet
358 this->priv->labels_per_sheet = lgl_template_frame_get_n_labels (frame);
363 g_free (this->priv->centers);
364 this->priv->centers = g_new0 (LabelCenter, this->priv->labels_per_sheet);
365 origins = lgl_template_frame_get_origins (frame);
366 lgl_template_frame_get_size (frame, &w, &h);
367 for ( i=0; i<this->priv->labels_per_sheet; i++ )
369 this->priv->centers[i].x = origins[i].x + w/2.0;
370 this->priv->centers[i].y = origins[i].y + h/2.0;
375 * Redraw modified preview
379 gl_debug (DEBUG_MINI_PREVIEW, "END");
383 /****************************************************************************/
384 /* Highlight given label outlines. */
385 /****************************************************************************/
387 gl_mini_preview_highlight_range (glMiniPreview *this,
391 gl_debug (DEBUG_MINI_PREVIEW, "START");
393 if ( (first_label != this->priv->highlight_first) ||
394 (last_label != this->priv->highlight_last) )
397 this->priv->highlight_first = first_label;
398 this->priv->highlight_last = last_label;
404 gl_debug (DEBUG_MINI_PREVIEW, "END");
408 /****************************************************************************/
409 /* Set draw arrow. */
410 /****************************************************************************/
412 gl_mini_preview_set_draw_arrow (glMiniPreview *this,
413 gboolean draw_arrow_flag)
415 if ( draw_arrow_flag != this->priv->draw_arrow_flag )
417 this->priv->draw_arrow_flag = draw_arrow_flag;
423 /****************************************************************************/
424 /* Set rotate flag. */
425 /****************************************************************************/
427 gl_mini_preview_set_rotate (glMiniPreview *this,
428 gboolean rotate_flag)
430 if ( rotate_flag != this->priv->rotate_flag )
432 this->priv->rotate_flag = rotate_flag;
438 /****************************************************************************/
440 /****************************************************************************/
442 gl_mini_preview_set_label (glMiniPreview *this,
445 if ( this->priv->label )
447 g_object_unref (this->priv->label);
449 this->priv->label = g_object_ref (label);
454 /****************************************************************************/
455 /* Set page number. */
456 /****************************************************************************/
458 gl_mini_preview_set_page (glMiniPreview *this,
461 if ( page != this->priv->page )
463 this->priv->page = page;
469 /****************************************************************************/
470 /* Set number of sheets. */
471 /****************************************************************************/
473 gl_mini_preview_set_n_sheets (glMiniPreview *this,
476 if ( n_sheets != this->priv->n_sheets )
478 this->priv->n_sheets = n_sheets;
484 /****************************************************************************/
485 /* Set number of copies (merge only). */
486 /****************************************************************************/
488 gl_mini_preview_set_n_copies (glMiniPreview *this,
491 if ( n_copies != this->priv->n_copies )
493 this->priv->n_copies = n_copies;
499 /****************************************************************************/
500 /* Set first label number on first sheet. */
501 /****************************************************************************/
503 gl_mini_preview_set_first (glMiniPreview *this,
506 if ( first != this->priv->first )
508 this->priv->first = first;
514 /****************************************************************************/
515 /* Set last label number on first sheet (non-merge only). */
516 /****************************************************************************/
518 gl_mini_preview_set_last (glMiniPreview *this,
521 if ( last != this->priv->last )
523 this->priv->last = last;
529 /****************************************************************************/
530 /* Set collate flag (merge only). */
531 /****************************************************************************/
533 gl_mini_preview_set_collate_flag (glMiniPreview *this,
534 gboolean collate_flag)
536 if ( collate_flag != this->priv->collate_flag )
538 this->priv->collate_flag = collate_flag;
544 /****************************************************************************/
545 /* Set outline flag. */
546 /****************************************************************************/
548 gl_mini_preview_set_outline_flag (glMiniPreview *this,
549 gboolean outline_flag)
551 if ( outline_flag != this->priv->outline_flag )
553 this->priv->outline_flag = outline_flag;
559 /****************************************************************************/
560 /* Set reverse flag. */
561 /****************************************************************************/
563 gl_mini_preview_set_reverse_flag (glMiniPreview *this,
564 gboolean reverse_flag)
566 if ( reverse_flag != this->priv->reverse_flag )
568 this->priv->reverse_flag = reverse_flag;
574 /****************************************************************************/
575 /* Set crop marks flag. */
576 /****************************************************************************/
578 gl_mini_preview_set_crop_marks_flag (glMiniPreview *this,
579 gboolean crop_marks_flag)
581 if ( crop_marks_flag != this->priv->crop_marks_flag )
583 this->priv->crop_marks_flag = crop_marks_flag;
589 /*--------------------------------------------------------------------------*/
590 /* Set transformation and return scale. */
591 /*--------------------------------------------------------------------------*/
593 set_transform_and_get_scale (glMiniPreview *this,
596 lglTemplate *template = this->priv->template;
597 GtkAllocation allocation;
600 gdouble offset_x, offset_y;
602 /* Establish scale and origin. */
603 gtk_widget_get_allocation (GTK_WIDGET (this), &allocation);
604 w = allocation.width;
605 h = allocation.height;
607 /* establish scale. */
608 scale = MIN( (w - 2*MARGIN - 2*SHADOW_OFFSET)/template->page_width,
609 (h - 2*MARGIN - 2*SHADOW_OFFSET)/template->page_height );
611 /* Find offset to center preview. */
612 offset_x = (w/scale - template->page_width) / 2.0;
613 offset_y = (h/scale - template->page_height) / 2.0;
615 /* Set transformation. */
616 cairo_scale (cr, scale, scale);
617 cairo_translate (cr, offset_x, offset_y);
623 /*--------------------------------------------------------------------------*/
624 /* Button press event handler */
625 /*--------------------------------------------------------------------------*/
627 button_press_event_cb (GtkWidget *widget,
628 GdkEventButton *event)
630 glMiniPreview *this = GL_MINI_PREVIEW (widget);
637 gl_debug (DEBUG_MINI_PREVIEW, "START");
639 if ( event->button == 1 )
642 window = gtk_widget_get_window (this->priv->canvas);
644 cr = gdk_cairo_create (window);
646 scale = set_transform_and_get_scale (this, cr);
650 cairo_device_to_user (cr, &x, &y);
652 i = find_closest_label (this, x, y);
654 g_signal_emit (G_OBJECT(this),
655 mini_preview_signals[CLICKED],
658 this->priv->first_i = i;
659 this->priv->last_i = i;
660 g_signal_emit (G_OBJECT(this),
661 mini_preview_signals[PRESSED],
662 0, this->priv->first_i, this->priv->last_i);
664 this->priv->dragging = TRUE;
665 this->priv->prev_i = i;
670 gl_debug (DEBUG_MINI_PREVIEW, "END");
675 /*--------------------------------------------------------------------------*/
676 /* Motion notify event handler */
677 /*--------------------------------------------------------------------------*/
679 motion_notify_event_cb (GtkWidget *widget,
680 GdkEventMotion *event)
682 glMiniPreview *this = GL_MINI_PREVIEW (widget);
689 gl_debug (DEBUG_MINI_PREVIEW, "START");
691 if (this->priv->dragging)
693 window = gtk_widget_get_window (this->priv->canvas);
695 cr = gdk_cairo_create (window);
697 scale = set_transform_and_get_scale (this, cr);
701 cairo_device_to_user (cr, &x, &y);
703 i = find_closest_label (this, x, y);
705 if ( i != this->priv->prev_i )
707 this->priv->last_i = i;
709 g_signal_emit (G_OBJECT(this),
710 mini_preview_signals[PRESSED],
712 MIN (this->priv->first_i, this->priv->last_i),
713 MAX (this->priv->first_i, this->priv->last_i));
715 this->priv->prev_i = i;
720 gl_debug (DEBUG_MINI_PREVIEW, "END");
725 /*--------------------------------------------------------------------------*/
726 /* Button release event handler */
727 /*--------------------------------------------------------------------------*/
729 button_release_event_cb (GtkWidget *widget,
730 GdkEventButton *event)
732 glMiniPreview *this = GL_MINI_PREVIEW (widget);
734 gl_debug (DEBUG_MINI_PREVIEW, "START");
736 if ( event->button == 1 )
738 this->priv->dragging = FALSE;
742 g_signal_emit (G_OBJECT(this),
743 mini_preview_signals[RELEASED],
744 0, this->priv->first_i, this->priv->last_i);
746 gl_debug (DEBUG_MINI_PREVIEW, "END");
751 /*--------------------------------------------------------------------------*/
752 /* Find index+1 of label closest to given coordinates. */
753 /*--------------------------------------------------------------------------*/
755 find_closest_label (glMiniPreview *this,
761 gdouble dx, dy, d2, min_d2;
763 dx = x - this->priv->centers[0].x;
764 dy = y - this->priv->centers[0].y;
765 min_d2 = dx*dx + dy*dy;
768 for ( i=1; i<this->priv->labels_per_sheet; i++ )
770 dx = x - this->priv->centers[i].x;
771 dy = y - this->priv->centers[i].y;
785 /*--------------------------------------------------------------------------*/
786 /* Expose event handler. */
787 /*--------------------------------------------------------------------------*/
789 expose_event_cb (GtkWidget *widget,
790 GdkEventExpose *event,
795 GtkAllocation allocation;
797 gl_debug (DEBUG_MINI_PREVIEW, "START");
799 this->priv->update_scheduled_flag = FALSE;
801 window = gtk_widget_get_window (widget);
803 cr = gdk_cairo_create (window);
806 event->area.x, event->area.y,
807 event->area.width, event->area.height);
810 gtk_widget_get_allocation (widget, &allocation);
811 cairo_translate (cr, allocation.x, allocation.y);
817 gl_debug (DEBUG_MINI_PREVIEW, "END");
822 /*--------------------------------------------------------------------------*/
823 /* Style set handler (updates colors when style/theme changes). */
824 /*--------------------------------------------------------------------------*/
826 style_set_cb (GtkWidget *widget,
827 GtkStyle *previous_style,
830 gl_debug (DEBUG_MINI_PREVIEW, "START");
834 gl_debug (DEBUG_MINI_PREVIEW, "END");
838 /*--------------------------------------------------------------------------*/
840 /*--------------------------------------------------------------------------*/
842 redraw (glMiniPreview *this)
847 gl_debug (DEBUG_MINI_PREVIEW, "START");
849 window = gtk_widget_get_window (this->priv->canvas);
854 if ( !this->priv->update_scheduled_flag )
856 this->priv->update_scheduled_flag = TRUE;
858 region = gdk_drawable_get_clip_region (window);
859 gdk_window_invalidate_region (window, region, TRUE);
860 gdk_region_destroy (region);
864 gl_debug (DEBUG_MINI_PREVIEW, "END");
868 /*--------------------------------------------------------------------------*/
869 /* Draw mini preview. */
870 /*--------------------------------------------------------------------------*/
872 draw (glMiniPreview *this,
875 lglTemplate *template = this->priv->template;
877 gdouble shadow_x, shadow_y;
880 gl_debug (DEBUG_MINI_PREVIEW, "START");
885 scale = set_transform_and_get_scale (this, cr);
888 shadow_x = SHADOW_OFFSET/scale;
889 shadow_y = SHADOW_OFFSET/scale;
891 draw_shadow (this, cr,
893 template->page_width, template->page_height);
895 draw_paper (this, cr,
896 template->page_width, template->page_height,
899 draw_labels (this, cr, template, 2.0/scale);
901 if (this->priv->draw_arrow_flag)
903 draw_arrow (this, cr);
906 if (this->priv->label)
908 draw_rich_preview (this, cr);
913 gl_debug (DEBUG_MINI_PREVIEW, "END");
918 /*--------------------------------------------------------------------------*/
919 /* Draw page shadow */
920 /*--------------------------------------------------------------------------*/
922 draw_shadow (glMiniPreview *this,
932 gl_debug (DEBUG_MINI_PREVIEW, "START");
936 cairo_rectangle (cr, x, y, width, height);
938 style = gtk_widget_get_style (GTK_WIDGET(this));
939 shadow_color = gl_color_from_gdk_color (&style->dark[GTK_STATE_NORMAL]);
940 cairo_set_source_rgb (cr, GL_COLOR_RGB_ARGS (shadow_color));
946 gl_debug (DEBUG_MINI_PREVIEW, "END");
950 /*--------------------------------------------------------------------------*/
952 /*--------------------------------------------------------------------------*/
954 draw_paper (glMiniPreview *this,
961 guint paper_color, outline_color;
963 gl_debug (DEBUG_MINI_PREVIEW, "START");
967 style = gtk_widget_get_style (GTK_WIDGET(this));
968 paper_color = gl_color_from_gdk_color (&style->light[GTK_STATE_NORMAL]);
969 outline_color = gl_color_from_gdk_color (&style->fg[GTK_STATE_NORMAL]);
971 cairo_rectangle (cr, 0.0, 0.0, width, height);
973 cairo_set_source_rgb (cr, GL_COLOR_RGB_ARGS (paper_color));
974 cairo_fill_preserve (cr);
976 cairo_set_source_rgb (cr, GL_COLOR_RGB_ARGS (outline_color));
977 cairo_set_line_width (cr, line_width);
982 gl_debug (DEBUG_MINI_PREVIEW, "END");
986 /*--------------------------------------------------------------------------*/
988 /*--------------------------------------------------------------------------*/
990 draw_labels (glMiniPreview *this,
992 lglTemplate *template,
995 const lglTemplateFrame *frame;
997 lglTemplateOrigin *origins;
1000 guint highlight_color, paper_color, outline_color;
1002 gl_debug (DEBUG_MINI_PREVIEW, "START");
1004 frame = (lglTemplateFrame *)template->frames->data;
1006 n_labels = lgl_template_frame_get_n_labels (frame);
1007 origins = lgl_template_frame_get_origins (frame);
1009 style = gtk_widget_get_style (GTK_WIDGET(this));
1010 base_color = gl_color_from_gdk_color (&style->base[GTK_STATE_SELECTED]);
1012 paper_color = gl_color_from_gdk_color (&style->light[GTK_STATE_NORMAL]);
1013 highlight_color = gl_color_set_opacity (base_color, 0.10);
1014 if (this->priv->label)
1016 /* Outlines are more subtle when doing a rich preview. */
1017 outline_color = gl_color_set_opacity (base_color, 0.25);
1021 outline_color = gl_color_set_opacity (base_color, 1.00);
1024 for ( i=0; i < n_labels; i++ ) {
1028 cairo_translate (cr, origins[i].x, origins[i].y);
1029 gl_cairo_label_path (cr, template, FALSE, FALSE);
1031 if ( ((i+1) >= this->priv->highlight_first) &&
1032 ((i+1) <= this->priv->highlight_last) )
1034 cairo_set_source_rgba (cr, GL_COLOR_RGBA_ARGS (highlight_color));
1035 cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
1036 cairo_fill_preserve (cr);
1039 cairo_set_line_width (cr, line_width);
1040 cairo_set_source_rgba (cr, GL_COLOR_RGBA_ARGS (outline_color));
1049 gl_debug (DEBUG_MINI_PREVIEW, "END");
1053 /*--------------------------------------------------------------------------*/
1054 /* Draw arrow to indicate top of labels. */
1055 /*--------------------------------------------------------------------------*/
1057 draw_arrow (glMiniPreview *this,
1060 lglTemplateFrame *frame;
1061 lglTemplateOrigin *origins;
1062 gdouble width, height, min;
1065 frame = (lglTemplateFrame *)this->priv->template->frames->data;
1067 lgl_template_frame_get_size (frame, &width, &height);
1068 origins = lgl_template_frame_get_origins (frame);
1071 min = MIN (width, height);
1076 cairo_translate (cr, x0 + width/2, y0 + height/2);
1077 cairo_scale (cr, 1, -1);
1078 if ( this->priv->rotate_flag )
1080 cairo_rotate (cr, -M_PI/2.0);
1083 cairo_new_path (cr);
1084 cairo_move_to (cr, 0, -min*ARROW_SCALE);
1085 cairo_line_to (cr, 0, min*ARROW_SCALE);
1087 cairo_new_sub_path (cr);
1088 cairo_move_to (cr, -min*ARROW_SCALE/2, min*ARROW_SCALE/2);
1089 cairo_line_to (cr, 0, min*ARROW_SCALE);
1090 cairo_line_to (cr, min*ARROW_SCALE/2, min*ARROW_SCALE/2);
1092 cairo_set_line_width (cr, 0.25*min*ARROW_SCALE);
1093 cairo_set_source_rgba (cr, ARROW_RGBA_ARGS);
1101 /*--------------------------------------------------------------------------*/
1102 /* Draw rich preview using print renderers. */
1103 /*--------------------------------------------------------------------------*/
1105 draw_rich_preview (glMiniPreview *this,
1111 merge = gl_label_get_merge (this->priv->label);
1115 gl_print_simple_sheet (this->priv->label,
1118 this->priv->n_sheets,
1121 this->priv->outline_flag,
1122 this->priv->reverse_flag,
1123 this->priv->crop_marks_flag);
1127 /* FIXME: maybe the renderers should be more self contained.
1128 * This will only work for the first page, since
1129 * previous pages must be rendered to establish
1133 state.p_record = (GList *)gl_merge_get_record_list (merge);
1135 if (this->priv->collate_flag)
1137 gl_print_collated_merge_sheet (this->priv->label,
1140 this->priv->n_copies,
1142 this->priv->outline_flag,
1143 this->priv->reverse_flag,
1144 this->priv->crop_marks_flag,
1149 gl_print_uncollated_merge_sheet (this->priv->label,
1152 this->priv->n_copies,
1154 this->priv->outline_flag,
1155 this->priv->reverse_flag,
1156 this->priv->crop_marks_flag,
1165 * Local Variables: -- emacs
1167 * c-basic-offset: 8 -- emacs
1168 * tab-width: 8 -- emacs
1169 * indent-tabs-mode: nil -- emacs