]> git.sur5r.net Git - glabels/blob - glabels2/src/mini-preview.c
9034ed7b5cbc70567b336255121f6d2d07614072
[glabels] / glabels2 / src / mini-preview.c
1 /*
2  *  mini-preview.c
3  *  Copyright (C) 2001-2009  Jim Evins <evins@snaught.com>.
4  *
5  *  This file is part of gLabels.
6  *
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.
11  *
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.
16  *
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/>.
19  */
20
21 #include <config.h>
22
23 #include "mini-preview.h"
24
25 #include <math.h>
26
27 #include "libglabels/db.h"
28 #include "cairo-label-path.h"
29 #include "marshal.h"
30 #include "color.h"
31
32 #include "debug.h"
33
34
35 /*===========================================*/
36 /* Private macros and constants.             */
37 /*===========================================*/
38
39 #define MARGIN 2
40 #define SHADOW_OFFSET 3
41
42
43 /*===========================================*/
44 /* Private types                             */
45 /*===========================================*/
46
47 enum {
48         CLICKED,
49         PRESSED,
50         LAST_SIGNAL
51 };
52
53 typedef struct {
54         gdouble x;
55         gdouble y;
56 } LabelCenter;
57
58 struct _glMiniPreviewPrivate {
59
60         GtkWidget      *canvas;
61
62         lglTemplate    *template;
63         gint            labels_per_sheet;
64         LabelCenter    *centers;
65
66         gint            highlight_first;
67         gint            highlight_last;
68
69         gboolean        dragging;
70         gint            first_i;
71         gint            last_i;
72         gint            prev_i;
73 };
74
75
76 /*===========================================*/
77 /* Private globals                           */
78 /*===========================================*/
79
80 static gint mini_preview_signals[LAST_SIGNAL] = { 0 };
81
82
83 /*===========================================*/
84 /* Local function prototypes                 */
85 /*===========================================*/
86
87 static void     gl_mini_preview_finalize       (GObject                *object);
88
89 static void     gl_mini_preview_construct      (glMiniPreview          *this,
90                                                 gint                    height,
91                                                 gint                    width);
92
93 static gboolean button_press_event_cb          (GtkWidget              *widget,
94                                                 GdkEventButton         *event);
95 static gboolean motion_notify_event_cb         (GtkWidget              *widget,
96                                                 GdkEventMotion         *event);
97 static gboolean button_release_event_cb        (GtkWidget              *widget,
98                                                 GdkEventButton         *event);
99
100
101 static gboolean expose_event_cb                (GtkWidget              *widget,
102                                                 GdkEventExpose         *event,
103                                                 glMiniPreview          *this);
104 static void     style_set_cb                   (GtkWidget              *widget,
105                                                 GtkStyle               *previous_style,
106                                                 glMiniPreview          *this);
107
108 static void     redraw                         (glMiniPreview          *this);
109 static void     draw                           (glMiniPreview          *this,
110                                                 cairo_t                *cr);
111
112 static void     draw_shadow                    (glMiniPreview          *this,
113                                                 cairo_t                *cr,
114                                                 gdouble                 x,
115                                                 gdouble                 y,
116                                                 gdouble                 width,
117                                                 gdouble                 height);
118 static void     draw_paper                     (glMiniPreview          *this,
119                                                 cairo_t                *cr,
120                                                 gdouble                 width,
121                                                 gdouble                 height,
122                                                 gdouble                 line_width);
123 static void     draw_labels                    (glMiniPreview          *this,
124                                                 cairo_t                *cr,
125                                                 lglTemplate            *template,
126                                                 gdouble                 line_width);
127
128 static gint     find_closest_label             (glMiniPreview          *this,
129                                                 gdouble                 x,
130                                                 gdouble                 y);
131
132 static gdouble  set_transform_and_get_scale    (glMiniPreview          *this,
133                                                 cairo_t                *cr);
134
135
136 /****************************************************************************/
137 /* Object infrastructure.                                                   */
138 /****************************************************************************/
139 G_DEFINE_TYPE (glMiniPreview, gl_mini_preview, GTK_TYPE_EVENT_BOX);
140
141
142 /*****************************************************************************/
143 /* Class Init Function.                                                      */
144 /*****************************************************************************/
145 static void
146 gl_mini_preview_class_init (glMiniPreviewClass *class)
147 {
148         GObjectClass   *object_class = G_OBJECT_CLASS (class);
149         GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
150
151         gl_debug (DEBUG_MINI_PREVIEW, "START");
152
153         gl_mini_preview_parent_class = g_type_class_peek_parent (class);
154
155         object_class->finalize = gl_mini_preview_finalize;
156
157         widget_class->button_press_event   = button_press_event_cb;
158         widget_class->motion_notify_event  = motion_notify_event_cb;
159         widget_class->button_release_event = button_release_event_cb;
160
161         mini_preview_signals[CLICKED] =
162             g_signal_new ("clicked",
163                           G_OBJECT_CLASS_TYPE(object_class),
164                           G_SIGNAL_RUN_LAST,
165                           G_STRUCT_OFFSET (glMiniPreviewClass, clicked),
166                           NULL, NULL,
167                           gl_marshal_VOID__INT,
168                           G_TYPE_NONE, 1, G_TYPE_INT);
169
170         mini_preview_signals[PRESSED] =
171             g_signal_new ("pressed",
172                           G_OBJECT_CLASS_TYPE(object_class),
173                           G_SIGNAL_RUN_LAST,
174                           G_STRUCT_OFFSET (glMiniPreviewClass, pressed),
175                           NULL, NULL,
176                           gl_marshal_VOID__INT_INT,
177                           G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
178
179         gl_debug (DEBUG_MINI_PREVIEW, "END");
180 }
181
182
183 /*****************************************************************************/
184 /* Object Instance Init Function.                                            */
185 /*****************************************************************************/
186 static void
187 gl_mini_preview_init (glMiniPreview *this)
188 {
189         gl_debug (DEBUG_MINI_PREVIEW, "START");
190
191         this->priv = g_new0 (glMiniPreviewPrivate, 1);
192
193         gtk_widget_add_events (GTK_WIDGET (this),
194                                GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
195                                GDK_POINTER_MOTION_MASK);
196
197         gtk_event_box_set_visible_window (GTK_EVENT_BOX (this), FALSE);
198
199         this->priv->canvas = gtk_drawing_area_new ();
200         GTK_WIDGET_SET_FLAGS (this->priv->canvas, GTK_NO_WINDOW);
201         gtk_container_add (GTK_CONTAINER (this), this->priv->canvas);
202
203         g_signal_connect (G_OBJECT (this->priv->canvas), "expose-event",
204                           G_CALLBACK (expose_event_cb), this);
205         g_signal_connect (G_OBJECT (this->priv->canvas), "style-set",
206                           G_CALLBACK (style_set_cb), this);
207
208         gl_debug (DEBUG_MINI_PREVIEW, "END");
209 }
210
211
212 /*****************************************************************************/
213 /* Finalize Method.                                                          */
214 /*****************************************************************************/
215 static void
216 gl_mini_preview_finalize (GObject *object)
217 {
218         glMiniPreview *this = GL_MINI_PREVIEW (object);
219
220         gl_debug (DEBUG_MINI_PREVIEW, "START");
221
222         g_return_if_fail (object != NULL);
223         g_return_if_fail (GL_IS_MINI_PREVIEW (object));
224
225         lgl_template_free (this->priv->template);
226         g_free (this->priv->centers);
227         g_free (this->priv);
228
229         G_OBJECT_CLASS (gl_mini_preview_parent_class)->finalize (object);
230
231         gl_debug (DEBUG_MINI_PREVIEW, "END");
232 }
233
234
235 /*****************************************************************************/
236 /** New Object Generator.                                                    */
237 /*****************************************************************************/
238 GtkWidget *
239 gl_mini_preview_new (gint height,
240                      gint width)
241 {
242         glMiniPreview *this;
243
244         gl_debug (DEBUG_MINI_PREVIEW, "START");
245
246         this = g_object_new (gl_mini_preview_get_type (), NULL);
247
248         gl_mini_preview_construct (this, height, width);
249
250         gl_debug (DEBUG_MINI_PREVIEW, "END");
251
252         return GTK_WIDGET (this);
253 }
254
255
256 /*--------------------------------------------------------------------------*/
257 /* Construct composite widget.                                              */
258 /*--------------------------------------------------------------------------*/
259 static void
260 gl_mini_preview_construct (glMiniPreview *this,
261                            gint           height,
262                            gint           width)
263 {
264         gl_debug (DEBUG_MINI_PREVIEW, "START");
265
266         gtk_widget_set_size_request (GTK_WIDGET (this->priv->canvas), width, height);
267
268         gl_debug (DEBUG_MINI_PREVIEW, "END");
269 }
270
271
272 /****************************************************************************/
273 /* Set label for mini-preview to determine geometry.                        */
274 /****************************************************************************/
275 void
276 gl_mini_preview_set_label_by_name (glMiniPreview *this,
277                                    const gchar   *name)
278 {
279         lglTemplate *template;
280
281         gl_debug (DEBUG_MINI_PREVIEW, "START");
282
283         /* Fetch template */
284         template = lgl_db_lookup_template_from_name (name);
285
286         gl_mini_preview_set_template (this, template);
287
288         lgl_template_free (template);
289
290         gl_debug (DEBUG_MINI_PREVIEW, "END");
291 }
292
293
294 /****************************************************************************/
295 /* Set label for mini-preview to determine geometry.                        */
296 /****************************************************************************/
297 void
298 gl_mini_preview_set_template (glMiniPreview     *this,
299                               const lglTemplate *template)
300 {
301         const lglTemplateFrame    *frame;
302         lglTemplateOrigin         *origins;
303         gdouble                    w, h;
304         gint                       i;
305
306         gl_debug (DEBUG_MINI_PREVIEW, "START");
307
308         frame = (lglTemplateFrame *)template->frames->data;
309
310         /*
311          * Set template
312          */
313         lgl_template_free (this->priv->template);
314         this->priv->template = lgl_template_dup (template);
315
316         /*
317          * Set labels per sheet
318          */
319         this->priv->labels_per_sheet = lgl_template_frame_get_n_labels (frame);
320
321         /*
322          * Initialize centers
323          */
324         g_free (this->priv->centers);
325         this->priv->centers = g_new0 (LabelCenter, this->priv->labels_per_sheet);
326         origins = lgl_template_frame_get_origins (frame);
327         lgl_template_frame_get_size (frame, &w, &h);
328         for ( i=0; i<this->priv->labels_per_sheet; i++ )
329         {
330                 this->priv->centers[i].x = origins[i].x + w/2.0;
331                 this->priv->centers[i].y = origins[i].y + h/2.0;
332         }
333         g_free (origins);
334
335         /*
336          * Redraw modified preview
337          */
338         redraw (this);
339
340         gl_debug (DEBUG_MINI_PREVIEW, "END");
341 }
342
343
344 /****************************************************************************/
345 /* Highlight given label outlines.                                          */
346 /****************************************************************************/
347 void
348 gl_mini_preview_highlight_range (glMiniPreview *this,
349                                  gint           first_label,
350                                  gint           last_label)
351 {
352         gl_debug (DEBUG_MINI_PREVIEW, "START");
353
354         this->priv->highlight_first = first_label;
355         this->priv->highlight_last =  last_label;
356
357         redraw (this);
358
359         gl_debug (DEBUG_MINI_PREVIEW, "END");
360 }
361
362
363 /*--------------------------------------------------------------------------*/
364 /* Set transformation and return scale.                                     */
365 /*--------------------------------------------------------------------------*/
366 static gdouble
367 set_transform_and_get_scale (glMiniPreview *this,
368                              cairo_t       *cr)
369 {
370         lglTemplate *template = this->priv->template;
371         gdouble      w, h;
372         gdouble      w1, h1;
373         gdouble      scale;
374         gdouble      offset_x, offset_y;
375
376         /* Establish scale and origin. */
377         w = GTK_WIDGET (this)->allocation.width;
378         h = GTK_WIDGET (this)->allocation.height;
379
380         /* establish scale. */
381         scale = MIN( (w - 2*MARGIN - 2*SHADOW_OFFSET)/template->page_width,
382                      (h - 2*MARGIN - 2*SHADOW_OFFSET)/template->page_height );
383
384         /* Find offset to center preview. */
385         offset_x = (w/scale - template->page_width) / 2.0;
386         offset_y = (h/scale - template->page_height) / 2.0;
387
388         /* Set transformation. */
389         cairo_scale (cr, scale, scale);
390         cairo_translate (cr, offset_x, offset_y);
391
392         return scale;
393 }
394
395
396 /*--------------------------------------------------------------------------*/
397 /* Button press event handler                                               */
398 /*--------------------------------------------------------------------------*/
399 static gboolean
400 button_press_event_cb (GtkWidget      *widget,
401                        GdkEventButton *event)
402 {
403         glMiniPreview     *this = GL_MINI_PREVIEW (widget);
404         cairo_t           *cr;
405         gdouble            scale;
406         gdouble            x, y;
407         gint               i;
408
409         gl_debug (DEBUG_MINI_PREVIEW, "START");
410
411         if ( event->button == 1 )
412         {
413                 cr = gdk_cairo_create (GTK_WIDGET (this->priv->canvas)->window);
414
415                 scale = set_transform_and_get_scale (this, cr);
416
417                 x = event->x;
418                 y = event->y;
419                 cairo_device_to_user (cr, &x, &y);
420
421                 i = find_closest_label (this, x, y);
422
423                 g_signal_emit (G_OBJECT(this),
424                                mini_preview_signals[CLICKED],
425                                0, i);
426
427                 this->priv->first_i = i;
428                 this->priv->last_i  = i;
429                 g_signal_emit (G_OBJECT(this),
430                                mini_preview_signals[PRESSED],
431                                0, this->priv->first_i, this->priv->last_i);
432
433                 this->priv->dragging = TRUE;
434                 this->priv->prev_i   = i;
435
436                 cairo_destroy (cr);
437         }
438
439         gl_debug (DEBUG_MINI_PREVIEW, "END");
440         return FALSE;
441 }
442
443
444 /*--------------------------------------------------------------------------*/
445 /* Motion notify event handler                                              */
446 /*--------------------------------------------------------------------------*/
447 static gboolean
448 motion_notify_event_cb (GtkWidget      *widget,
449                         GdkEventMotion *event)
450 {
451         glMiniPreview *this = GL_MINI_PREVIEW (widget);
452         cairo_t           *cr;
453         gdouble            scale;
454         gdouble            x, y;
455         gint               i;
456
457         gl_debug (DEBUG_MINI_PREVIEW, "START");
458
459         if (this->priv->dragging)
460         {
461                 cr = gdk_cairo_create (GTK_WIDGET (this->priv->canvas)->window);
462
463                 scale = set_transform_and_get_scale (this, cr);
464
465                 x = event->x;
466                 y = event->y;
467                 cairo_device_to_user (cr, &x, &y);
468
469                 i = find_closest_label (this, x, y);
470
471                 if ( i != this->priv->prev_i )
472                 {
473                         this->priv->last_i = i;
474
475                         g_signal_emit (G_OBJECT(this),
476                                        mini_preview_signals[PRESSED],
477                                        0,
478                                        MIN (this->priv->first_i, this->priv->last_i),
479                                        MAX (this->priv->first_i, this->priv->last_i));
480
481                         this->priv->prev_i = i;
482                 }
483                 cairo_destroy (cr);
484         }
485
486         gl_debug (DEBUG_MINI_PREVIEW, "END");
487         return FALSE;
488 }
489
490
491 /*--------------------------------------------------------------------------*/
492 /* Button release event handler                                             */
493 /*--------------------------------------------------------------------------*/
494 static gboolean
495 button_release_event_cb (GtkWidget      *widget,
496                          GdkEventButton *event)
497 {
498         glMiniPreview *this = GL_MINI_PREVIEW (widget);
499         
500         gl_debug (DEBUG_MINI_PREVIEW, "START");
501
502         if ( event->button == 1 )
503         {
504                 this->priv->dragging = FALSE;
505
506         }
507
508         gl_debug (DEBUG_MINI_PREVIEW, "END");
509         return FALSE;
510 }
511
512
513 /*--------------------------------------------------------------------------*/
514 /* Find index+1 of label closest to given coordinates.                      */
515 /*--------------------------------------------------------------------------*/
516 static gint
517 find_closest_label (glMiniPreview      *this,
518                     gdouble             x,
519                     gdouble             y)
520 {
521         gint    i;
522         gint    min_i;
523         gdouble dx, dy, d2, min_d2;
524
525         dx = x - this->priv->centers[0].x;
526         dy = y - this->priv->centers[0].y;
527         min_d2 = dx*dx + dy*dy;
528         min_i = 0;
529
530         for ( i=1; i<this->priv->labels_per_sheet; i++ )
531         {
532                 dx = x - this->priv->centers[i].x;
533                 dy = y - this->priv->centers[i].y;
534                 d2 = dx*dx + dy*dy;
535
536                 if ( d2 < min_d2 )
537                 {
538                         min_d2 = d2;
539                         min_i  = i;
540                 }
541         }
542
543         return min_i + 1;
544 }
545
546
547 /*--------------------------------------------------------------------------*/
548 /* Expose event handler.                                                    */
549 /*--------------------------------------------------------------------------*/
550 static gboolean
551 expose_event_cb (GtkWidget       *widget,
552                  GdkEventExpose  *event,
553                  glMiniPreview   *this)
554 {
555         cairo_t       *cr;
556
557         gl_debug (DEBUG_MINI_PREVIEW, "START");
558
559         cr = gdk_cairo_create (widget->window);
560
561         cairo_rectangle (cr,
562                         event->area.x, event->area.y,
563                         event->area.width, event->area.height);
564         cairo_clip (cr);
565         cairo_translate (cr, widget->allocation.x, widget->allocation.y);
566         
567         draw (this, cr);
568
569         cairo_destroy (cr);
570
571         gl_debug (DEBUG_MINI_PREVIEW, "END");
572         return FALSE;
573 }
574
575
576 /*--------------------------------------------------------------------------*/
577 /* Style set handler (updates colors when style/theme changes).             */
578 /*--------------------------------------------------------------------------*/
579 static void
580 style_set_cb (GtkWidget        *widget,
581               GtkStyle         *previous_style,
582               glMiniPreview    *this)
583 {
584         gl_debug (DEBUG_MINI_PREVIEW, "START");
585
586         redraw (this);
587
588         gl_debug (DEBUG_MINI_PREVIEW, "END");
589 }
590
591
592 /*--------------------------------------------------------------------------*/
593 /* Redraw.                                                                  */
594 /*--------------------------------------------------------------------------*/
595 static void
596 redraw (glMiniPreview      *this)
597 {
598         GdkRegion *region;
599         
600         gl_debug (DEBUG_MINI_PREVIEW, "START");
601
602         if (GTK_WIDGET (this->priv->canvas)->window)
603         {
604
605                 region = gdk_drawable_get_clip_region (GTK_WIDGET (this->priv->canvas)->window);
606
607                 gdk_window_invalidate_region (GTK_WIDGET (this->priv->canvas)->window, region, TRUE);
608                 gdk_window_process_updates (GTK_WIDGET (this->priv->canvas)->window, TRUE);
609
610                 gdk_region_destroy (region);
611         }
612
613         gl_debug (DEBUG_MINI_PREVIEW, "END");
614 }
615
616
617 /*--------------------------------------------------------------------------*/
618 /* Draw mini preview.                                                       */
619 /*--------------------------------------------------------------------------*/
620 static void
621 draw (glMiniPreview  *this,
622       cairo_t        *cr)
623 {
624         lglTemplate *template = this->priv->template;
625         gdouble      scale;
626         gdouble      shadow_x, shadow_y;
627
628
629         gl_debug (DEBUG_MINI_PREVIEW, "START");
630
631         if (template)
632         {
633
634                 scale = set_transform_and_get_scale (this, cr);
635
636                 /* update shadow */
637                 shadow_x = SHADOW_OFFSET/scale;
638                 shadow_y = SHADOW_OFFSET/scale;
639
640                 draw_shadow (this, cr,
641                              shadow_x, shadow_y,
642                              template->page_width, template->page_height);
643
644                 draw_paper (this, cr,
645                             template->page_width, template->page_height,
646                             1.0/scale);
647
648                 draw_labels (this, cr, template, 1.0/scale);
649                              
650         }
651
652         gl_debug (DEBUG_MINI_PREVIEW, "END");
653
654 }
655
656
657 /*--------------------------------------------------------------------------*/
658 /* Draw page shadow                                                         */
659 /*--------------------------------------------------------------------------*/
660 static void
661 draw_shadow (glMiniPreview      *this,
662              cairo_t            *cr,
663              gdouble             x,
664              gdouble             y,
665              gdouble             width,
666              gdouble             height)
667 {
668         GtkStyle *style;
669         guint     shadow_color;
670
671         gl_debug (DEBUG_MINI_PREVIEW, "START");
672
673         cairo_save (cr);
674
675         cairo_rectangle (cr, x, y, width, height);
676
677         style = gtk_widget_get_style (GTK_WIDGET(this));
678         shadow_color = gl_color_from_gdk_color (&style->dark[GTK_STATE_NORMAL]);
679         cairo_set_source_rgb (cr, GL_COLOR_RGB_ARGS (shadow_color));
680
681         cairo_fill (cr);
682
683         cairo_restore (cr);
684
685         gl_debug (DEBUG_MINI_PREVIEW, "END");
686 }
687
688
689 /*--------------------------------------------------------------------------*/
690 /* Draw page                                                                */
691 /*--------------------------------------------------------------------------*/
692 static void
693 draw_paper (glMiniPreview      *this,
694             cairo_t            *cr,
695             gdouble             width,
696             gdouble             height,
697             gdouble             line_width)
698 {
699         GtkStyle                  *style;
700         guint                      paper_color, outline_color;
701
702         gl_debug (DEBUG_MINI_PREVIEW, "START");
703
704         cairo_save (cr);
705
706         style = gtk_widget_get_style (GTK_WIDGET(this));
707         paper_color   = gl_color_from_gdk_color (&style->light[GTK_STATE_NORMAL]);
708         outline_color = gl_color_from_gdk_color (&style->fg[GTK_STATE_NORMAL]);
709
710         cairo_rectangle (cr, 0.0, 0.0, width, height);
711
712         cairo_set_source_rgb (cr, GL_COLOR_RGB_ARGS (paper_color));
713         cairo_fill_preserve (cr);
714
715         cairo_set_source_rgb (cr, GL_COLOR_RGB_ARGS (outline_color));
716         cairo_set_line_width (cr, line_width);
717         cairo_stroke (cr);
718
719         cairo_restore (cr);
720
721         gl_debug (DEBUG_MINI_PREVIEW, "END");
722 }
723
724
725 /*--------------------------------------------------------------------------*/
726 /* Draw labels                                                              */
727 /*--------------------------------------------------------------------------*/
728 static void
729 draw_labels (glMiniPreview *this,
730              cairo_t       *cr,
731              lglTemplate   *template,
732              gdouble        line_width)
733 {
734         const lglTemplateFrame    *frame;
735         gint                       i, n_labels;
736         lglTemplateOrigin         *origins;
737         GtkStyle                  *style;
738         guint                      highlight_color, paper_color, outline_color;
739
740         gl_debug (DEBUG_MINI_PREVIEW, "START");
741
742         frame = (lglTemplateFrame *)template->frames->data;
743
744         n_labels = lgl_template_frame_get_n_labels (frame);
745         origins  = lgl_template_frame_get_origins (frame);
746
747         style = gtk_widget_get_style (GTK_WIDGET(this));
748         highlight_color = gl_color_from_gdk_color (&style->base[GTK_STATE_SELECTED]);
749         paper_color     = gl_color_from_gdk_color (&style->light[GTK_STATE_NORMAL]);
750         outline_color   = gl_color_from_gdk_color (&style->fg[GTK_STATE_NORMAL]);
751
752         for ( i=0; i < n_labels; i++ ) {
753
754                 cairo_save (cr);
755
756                 cairo_translate (cr, origins[i].x, origins[i].y);
757                 gl_cairo_label_path (cr, template, FALSE, FALSE);
758
759                 if ( ((i+1) >= this->priv->highlight_first) &&
760                      ((i+1) <= this->priv->highlight_last) )
761                 {
762                         cairo_set_source_rgb (cr, GL_COLOR_RGB_ARGS (highlight_color));
763                 }
764                 else
765                 {
766                         cairo_set_source_rgb (cr, GL_COLOR_RGB_ARGS (paper_color));
767                 }
768                 cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
769                 cairo_fill_preserve (cr);
770
771                 cairo_set_line_width (cr, line_width);
772                 cairo_set_source_rgb (cr, GL_COLOR_RGB_ARGS (outline_color));
773                 cairo_stroke (cr);
774
775                 cairo_restore (cr);
776
777         }
778
779         g_free (origins);
780
781         gl_debug (DEBUG_MINI_PREVIEW, "END");
782 }
783
784
785
786 /*
787  * Local Variables:       -- emacs
788  * mode: C                -- emacs
789  * c-basic-offset: 8      -- emacs
790  * tab-width: 8           -- emacs
791  * indent-tabs-mode: nil  -- emacs
792  * End:                   -- emacs
793  */