From: Jim Evins Date: Thu, 27 Nov 2003 06:27:43 +0000 (+0000) Subject: Created generic "get" methods for text, fill and line properties for all label object... X-Git-Tag: glabels-2_3_0~537 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6836860e2dab3b384e89982b8df9856b64c6c911;p=glabels Created generic "get" methods for text, fill and line properties for all label objects. This will make it easier to track changes in a general view such as the property toolbar. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@356 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- diff --git a/glabels2/src/label-barcode.c b/glabels2/src/label-barcode.c index 67cd0761..b9c767da 100644 --- a/glabels2/src/label-barcode.c +++ b/glabels2/src/label-barcode.c @@ -57,19 +57,21 @@ static guint instance = 0; /* Private function prototypes. */ /*========================================================*/ -static void gl_label_barcode_class_init (glLabelBarcodeClass *klass); -static void gl_label_barcode_instance_init (glLabelBarcode *lbc); -static void gl_label_barcode_finalize (GObject *object); +static void gl_label_barcode_class_init (glLabelBarcodeClass *klass); +static void gl_label_barcode_instance_init (glLabelBarcode *lbc); +static void gl_label_barcode_finalize (GObject *object); -static void copy (glLabelObject *dst_object, - glLabelObject *src_object); +static void copy (glLabelObject *dst_object, + glLabelObject *src_object); -static void get_size (glLabelObject *object, - gdouble *w, - gdouble *h); +static void get_size (glLabelObject *object, + gdouble *w, + gdouble *h); -static void set_line_color (glLabelObject *object, - guint line_color); +static void set_line_color (glLabelObject *object, + guint line_color); + +static guint get_line_color (glLabelObject *object); @@ -112,6 +114,7 @@ gl_label_barcode_class_init (glLabelBarcodeClass *klass) label_object_class->copy = copy; label_object_class->get_size = get_size; label_object_class->set_line_color = set_line_color; + label_object_class->get_line_color = get_line_color; object_class->finalize = gl_label_barcode_finalize; } @@ -166,7 +169,6 @@ copy (glLabelObject *dst_object, gboolean text_flag; gboolean checksum_flag; guint color; - gdouble scale; gl_debug (DEBUG_LABEL, "START"); @@ -174,10 +176,12 @@ copy (glLabelObject *dst_object, g_return_if_fail (new_lbc && GL_IS_LABEL_BARCODE (new_lbc)); text_node = gl_label_barcode_get_data (lbc); - gl_label_barcode_get_props (lbc, &style, &text_flag, &checksum_flag, &color); + gl_label_barcode_get_props (lbc, &style, &text_flag, &checksum_flag); + color = get_line_color (src_object); gl_label_barcode_set_data (new_lbc, text_node); - gl_label_barcode_set_props (new_lbc,style, text_flag, checksum_flag, color); + gl_label_barcode_set_props (new_lbc,style, text_flag, checksum_flag); + set_line_color (dst_object, color); gl_text_node_free (&text_node); @@ -208,8 +212,7 @@ void gl_label_barcode_set_props (glLabelBarcode *lbc, glBarcodeStyle style, gboolean text_flag, - gboolean checksum_flag, - guint color) + gboolean checksum_flag) { gl_debug (DEBUG_LABEL, "START"); @@ -218,7 +221,6 @@ gl_label_barcode_set_props (glLabelBarcode *lbc, lbc->private->style = style; lbc->private->text_flag = text_flag; lbc->private->checksum_flag = checksum_flag; - lbc->private->color = color; gl_label_object_emit_changed (GL_LABEL_OBJECT(lbc)); @@ -241,15 +243,13 @@ void gl_label_barcode_get_props (glLabelBarcode *lbc, glBarcodeStyle *style, gboolean *text_flag, - gboolean *checksum_flag, - guint *color) + gboolean *checksum_flag) { g_return_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc)); *style = lbc->private->style; *text_flag = lbc->private->text_flag; *checksum_flag = lbc->private->checksum_flag; - *color = lbc->private->color; } /*---------------------------------------------------------------------------*/ @@ -322,3 +322,16 @@ set_line_color (glLabelObject *object, } } +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Get line color method. */ +/*---------------------------------------------------------------------------*/ +static guint +get_line_color (glLabelObject *object) +{ + glLabelBarcode *lbarcode = (glLabelBarcode *)object; + + g_return_if_fail (lbarcode && GL_IS_LABEL_BARCODE (lbarcode)); + + return lbarcode->private->color; +} + diff --git a/glabels2/src/label-barcode.h b/glabels2/src/label-barcode.h index 4fbecea0..b8955345 100644 --- a/glabels2/src/label-barcode.h +++ b/glabels2/src/label-barcode.h @@ -63,15 +63,13 @@ void gl_label_barcode_set_data (glLabelBarcode *lbc, void gl_label_barcode_set_props (glLabelBarcode *lbc, glBarcodeStyle style, gboolean text_flag, - gboolean checksum_flag, - guint color); + gboolean checksum_flag); glTextNode *gl_label_barcode_get_data (glLabelBarcode *lbc); void gl_label_barcode_get_props (glLabelBarcode *lbc, glBarcodeStyle *style, gboolean *text_flag, - gboolean *checksum_flag, - guint *color); + gboolean *checksum_flag); G_END_DECLS diff --git a/glabels2/src/label-box.c b/glabels2/src/label-box.c index a3db3009..d0548826 100644 --- a/glabels2/src/label-box.c +++ b/glabels2/src/label-box.c @@ -48,21 +48,27 @@ static guint instance = 0; /* Private function prototypes. */ /*========================================================*/ -static void gl_label_box_class_init (glLabelBoxClass *klass); -static void gl_label_box_instance_init (glLabelBox *lbox); -static void gl_label_box_finalize (GObject *object); +static void gl_label_box_class_init (glLabelBoxClass *klass); +static void gl_label_box_instance_init (glLabelBox *lbox); +static void gl_label_box_finalize (GObject *object); -static void copy (glLabelObject *dst_object, - glLabelObject *src_object); +static void copy (glLabelObject *dst_object, + glLabelObject *src_object); -static void set_fill_color (glLabelObject *object, - guint fill_color); +static void set_fill_color (glLabelObject *object, + guint fill_color); -static void set_line_color (glLabelObject *object, - guint line_color); +static void set_line_color (glLabelObject *object, + guint line_color); -static void set_line_width (glLabelObject *object, - gdouble line_width); +static void set_line_width (glLabelObject *object, + gdouble line_width); + +static guint get_fill_color (glLabelObject *object); + +static guint get_line_color (glLabelObject *object); + +static gdouble get_line_width (glLabelObject *object); @@ -106,6 +112,9 @@ gl_label_box_class_init (glLabelBoxClass *klass) label_object_class->set_fill_color = set_fill_color; label_object_class->set_line_color = set_line_color; label_object_class->set_line_width = set_line_width; + label_object_class->get_fill_color = get_fill_color; + label_object_class->get_line_color = get_line_color; + label_object_class->get_line_width = get_line_width; object_class->finalize = gl_label_box_finalize; } @@ -162,84 +171,18 @@ copy (glLabelObject *dst_object, g_return_if_fail (lbox && GL_IS_LABEL_BOX (lbox)); g_return_if_fail (new_lbox && GL_IS_LABEL_BOX (new_lbox)); - line_width = gl_label_box_get_line_width (lbox); - line_color = gl_label_box_get_line_color (lbox); - fill_color = gl_label_box_get_fill_color (lbox); + line_width = get_line_width (src_object); + line_color = get_line_color (src_object); + fill_color = get_fill_color (src_object); - gl_label_box_set_line_width (new_lbox, line_width); - gl_label_box_set_line_color (new_lbox, line_color); - gl_label_box_set_fill_color (new_lbox, fill_color); + set_line_width (dst_object, line_width); + set_line_color (dst_object, line_color); + set_fill_color (dst_object, fill_color); gl_debug (DEBUG_LABEL, "END"); } -/*****************************************************************************/ -/* Set object params. */ -/*****************************************************************************/ -void -gl_label_box_set_line_width (glLabelBox *lbox, - gdouble line_width) -{ - g_return_if_fail (lbox && GL_IS_LABEL_BOX (lbox)); - - if ( lbox->private->line_width != line_width ) { - lbox->private->line_width = line_width; - gl_label_object_emit_changed (GL_LABEL_OBJECT(lbox)); - } -} - -void -gl_label_box_set_line_color (glLabelBox *lbox, - guint line_color) -{ - g_return_if_fail (lbox && GL_IS_LABEL_BOX (lbox)); - - if ( lbox->private->line_color != line_color ) { - lbox->private->line_color = line_color; - gl_label_object_emit_changed (GL_LABEL_OBJECT(lbox)); - } -} - -void -gl_label_box_set_fill_color (glLabelBox *lbox, - guint fill_color) -{ - g_return_if_fail (lbox && GL_IS_LABEL_BOX (lbox)); - - if ( lbox->private->fill_color != fill_color ) { - lbox->private->fill_color = fill_color; - gl_label_object_emit_changed (GL_LABEL_OBJECT(lbox)); - } -} - -/*****************************************************************************/ -/* Get object params. */ -/*****************************************************************************/ -gdouble -gl_label_box_get_line_width (glLabelBox *lbox) -{ - g_return_val_if_fail (lbox && GL_IS_LABEL_BOX (lbox), 0.0); - - return lbox->private->line_width; -} - -guint -gl_label_box_get_line_color (glLabelBox *lbox) -{ - g_return_val_if_fail (lbox && GL_IS_LABEL_BOX (lbox), 0); - - return lbox->private->line_color; -} - -guint -gl_label_box_get_fill_color (glLabelBox *lbox) -{ - g_return_val_if_fail (lbox && GL_IS_LABEL_BOX (lbox), 0); - - return lbox->private->fill_color; -} - /*---------------------------------------------------------------------------*/ /* PRIVATE. Set fill color method. */ /*---------------------------------------------------------------------------*/ @@ -292,3 +235,42 @@ set_line_width (glLabelObject *object, } +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Get fill color method. */ +/*---------------------------------------------------------------------------*/ +static gdouble +get_line_width (glLabelObject *object) +{ + glLabelBox *lbox = (glLabelBox *)object; + + g_return_val_if_fail (lbox && GL_IS_LABEL_BOX (lbox), 0.0); + + return lbox->private->line_width; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Get line color method. */ +/*---------------------------------------------------------------------------*/ +static guint +get_line_color (glLabelObject *object) +{ + glLabelBox *lbox = (glLabelBox *)object; + + g_return_val_if_fail (lbox && GL_IS_LABEL_BOX (lbox), 0); + + return lbox->private->line_color; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Get line width method. */ +/*---------------------------------------------------------------------------*/ +static guint +get_fill_color (glLabelObject *object) +{ + glLabelBox *lbox = (glLabelBox *)object; + + g_return_val_if_fail (lbox && GL_IS_LABEL_BOX (lbox), 0); + + return lbox->private->fill_color; +} + diff --git a/glabels2/src/label-box.h b/glabels2/src/label-box.h index d257ab56..16b67419 100644 --- a/glabels2/src/label-box.h +++ b/glabels2/src/label-box.h @@ -54,20 +54,6 @@ GType gl_label_box_get_type (void); GObject *gl_label_box_new (glLabel *label); -void gl_label_box_set_line_width (glLabelBox *lbox, - gdouble line_width); - -void gl_label_box_set_line_color (glLabelBox *lbox, - guint line_color); - -void gl_label_box_set_fill_color (glLabelBox *lbox, - guint fill_color); - -gdouble gl_label_box_get_line_width (glLabelBox *lbox); -guint gl_label_box_get_line_color (glLabelBox *lbox); -guint gl_label_box_get_fill_color (glLabelBox *lbox); - - G_END_DECLS #endif /* __LABEL_BOX_H__ */ diff --git a/glabels2/src/label-ellipse.c b/glabels2/src/label-ellipse.c index 0b333d76..c034e730 100644 --- a/glabels2/src/label-ellipse.c +++ b/glabels2/src/label-ellipse.c @@ -48,21 +48,27 @@ static guint instance = 0; /* Private function prototypes. */ /*========================================================*/ -static void gl_label_ellipse_class_init (glLabelEllipseClass *klass); -static void gl_label_ellipse_instance_init (glLabelEllipse *lellipse); -static void gl_label_ellipse_finalize (GObject *object); +static void gl_label_ellipse_class_init (glLabelEllipseClass *klass); +static void gl_label_ellipse_instance_init (glLabelEllipse *lellipse); +static void gl_label_ellipse_finalize (GObject *object); -static void copy (glLabelObject *dst_object, - glLabelObject *src_object); +static void copy (glLabelObject *dst_object, + glLabelObject *src_object); -static void set_fill_color (glLabelObject *object, - guint fill_color); +static void set_fill_color (glLabelObject *object, + guint fill_color); -static void set_line_color (glLabelObject *object, - guint line_color); +static void set_line_color (glLabelObject *object, + guint line_color); -static void set_line_width (glLabelObject *object, - gdouble line_width); +static void set_line_width (glLabelObject *object, + gdouble line_width); + +static guint get_fill_color (glLabelObject *object); + +static guint get_line_color (glLabelObject *object); + +static gdouble get_line_width (glLabelObject *object); @@ -106,6 +112,9 @@ gl_label_ellipse_class_init (glLabelEllipseClass *klass) label_object_class->set_fill_color = set_fill_color; label_object_class->set_line_color = set_line_color; label_object_class->set_line_width = set_line_width; + label_object_class->get_fill_color = get_fill_color; + label_object_class->get_line_color = get_line_color; + label_object_class->get_line_width = get_line_width; object_class->finalize = gl_label_ellipse_finalize; } @@ -162,84 +171,18 @@ copy (glLabelObject *dst_object, g_return_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse)); g_return_if_fail (new_lellipse && GL_IS_LABEL_ELLIPSE (new_lellipse)); - line_width = gl_label_ellipse_get_line_width (lellipse); - line_color = gl_label_ellipse_get_line_color (lellipse); - fill_color = gl_label_ellipse_get_fill_color (lellipse); + line_width = get_line_width (src_object); + line_color = get_line_color (src_object); + fill_color = get_fill_color (src_object); - gl_label_ellipse_set_line_width (new_lellipse, line_width); - gl_label_ellipse_set_line_color (new_lellipse, line_color); - gl_label_ellipse_set_fill_color (new_lellipse, fill_color); + set_line_width (dst_object, line_width); + set_line_color (dst_object, line_color); + set_fill_color (dst_object, fill_color); gl_debug (DEBUG_LABEL, "END"); } -/*****************************************************************************/ -/* Set object params. */ -/*****************************************************************************/ -void -gl_label_ellipse_set_line_width (glLabelEllipse *lellipse, - gdouble line_width) -{ - g_return_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse)); - - if ( lellipse->private->line_width != line_width ) { - lellipse->private->line_width = line_width; - gl_label_object_emit_changed (GL_LABEL_OBJECT(lellipse)); - } -} - -void -gl_label_ellipse_set_line_color (glLabelEllipse *lellipse, - guint line_color) -{ - g_return_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse)); - - if ( lellipse->private->line_color != line_color ) { - lellipse->private->line_color = line_color; - gl_label_object_emit_changed (GL_LABEL_OBJECT(lellipse)); - } -} - -void -gl_label_ellipse_set_fill_color (glLabelEllipse *lellipse, - guint fill_color) -{ - g_return_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse)); - - if ( lellipse->private->fill_color != fill_color ) { - lellipse->private->fill_color = fill_color; - gl_label_object_emit_changed (GL_LABEL_OBJECT(lellipse)); - } -} - -/*****************************************************************************/ -/* Get object params. */ -/*****************************************************************************/ -gdouble -gl_label_ellipse_get_line_width (glLabelEllipse *lellipse) -{ - g_return_val_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse), 0.0); - - return lellipse->private->line_width; -} - -guint -gl_label_ellipse_get_line_color (glLabelEllipse *lellipse) -{ - g_return_val_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse), 0); - - return lellipse->private->line_color; -} - -guint -gl_label_ellipse_get_fill_color (glLabelEllipse *lellipse) -{ - g_return_val_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse), 0); - - return lellipse->private->fill_color; -} - /*---------------------------------------------------------------------------*/ /* PRIVATE. Set fill color method. */ /*---------------------------------------------------------------------------*/ @@ -292,3 +235,43 @@ set_line_width (glLabelObject *object, } +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Get fill color method. */ +/*---------------------------------------------------------------------------*/ +static gdouble +get_line_width (glLabelObject *object) +{ + glLabelEllipse *lellipse = (glLabelEllipse *)object; + + g_return_val_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse), 0.0); + + return lellipse->private->line_width; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Get line color method. */ +/*---------------------------------------------------------------------------*/ +static guint +get_line_color (glLabelObject *object) +{ + glLabelEllipse *lellipse = (glLabelEllipse *)object; + + g_return_val_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse), 0); + + return lellipse->private->line_color; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Get line width method. */ +/*---------------------------------------------------------------------------*/ +static guint +get_fill_color (glLabelObject *object) +{ + glLabelEllipse *lellipse = (glLabelEllipse *)object; + + g_return_val_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse), 0); + + return lellipse->private->fill_color; +} + + diff --git a/glabels2/src/label-ellipse.h b/glabels2/src/label-ellipse.h index faf35f3f..bc950d9c 100644 --- a/glabels2/src/label-ellipse.h +++ b/glabels2/src/label-ellipse.h @@ -54,20 +54,6 @@ GType gl_label_ellipse_get_type (void); GObject *gl_label_ellipse_new (glLabel *label); -void gl_label_ellipse_set_line_width (glLabelEllipse *lellipse, - gdouble line_width); - -void gl_label_ellipse_set_line_color (glLabelEllipse *lellipse, - guint line_color); - -void gl_label_ellipse_set_fill_color (glLabelEllipse *lellipse, - guint fill_color); - -gdouble gl_label_ellipse_get_line_width (glLabelEllipse *lellipse); -guint gl_label_ellipse_get_line_color (glLabelEllipse *lellipse); -guint gl_label_ellipse_get_fill_color (glLabelEllipse *lellipse); - - G_END_DECLS #endif /* __LABEL_ELLIPSE_H__ */ diff --git a/glabels2/src/label-line.c b/glabels2/src/label-line.c index ec189f29..48784232 100644 --- a/glabels2/src/label-line.c +++ b/glabels2/src/label-line.c @@ -47,18 +47,22 @@ static guint instance = 0; /* Private function prototypes. */ /*========================================================*/ -static void gl_label_line_class_init (glLabelLineClass *klass); -static void gl_label_line_instance_init (glLabelLine *lline); -static void gl_label_line_finalize (GObject *object); +static void gl_label_line_class_init (glLabelLineClass *klass); +static void gl_label_line_instance_init (glLabelLine *lline); +static void gl_label_line_finalize (GObject *object); -static void copy (glLabelObject *dst_object, - glLabelObject *src_object); +static void copy (glLabelObject *dst_object, + glLabelObject *src_object); -static void set_line_color (glLabelObject *object, - guint line_color); +static void set_line_color (glLabelObject *object, + guint line_color); -static void set_line_width (glLabelObject *object, - gdouble line_width); +static void set_line_width (glLabelObject *object, + gdouble line_width); + +static guint get_line_color (glLabelObject *object); + +static gdouble get_line_width (glLabelObject *object); @@ -101,6 +105,8 @@ gl_label_line_class_init (glLabelLineClass *klass) label_object_class->copy = copy; label_object_class->set_line_color = set_line_color; label_object_class->set_line_width = set_line_width; + label_object_class->get_line_color = get_line_color; + label_object_class->get_line_width = get_line_width; object_class->finalize = gl_label_line_finalize; } @@ -157,63 +163,16 @@ copy (glLabelObject *dst_object, g_return_if_fail (lline && GL_IS_LABEL_LINE (lline)); g_return_if_fail (new_lline && GL_IS_LABEL_LINE (new_lline)); - line_width = gl_label_line_get_line_width (lline); - line_color = gl_label_line_get_line_color (lline); + line_width = get_line_width (src_object); + line_color = get_line_color (src_object); - gl_label_line_set_line_width (new_lline, line_width); - gl_label_line_set_line_color (new_lline, line_color); + set_line_width (dst_object, line_width); + set_line_color (dst_object, line_color); gl_debug (DEBUG_LABEL, "END"); } -/*****************************************************************************/ -/* Set object params. */ -/*****************************************************************************/ -void -gl_label_line_set_line_width (glLabelLine *lline, - gdouble line_width) -{ - g_return_if_fail (lline && GL_IS_LABEL_LINE (lline)); - - if ( lline->private->line_width != line_width ) { - lline->private->line_width = line_width; - gl_label_object_emit_changed (GL_LABEL_OBJECT(lline)); - } -} - -void -gl_label_line_set_line_color (glLabelLine *lline, - guint line_color) -{ - g_return_if_fail (lline && GL_IS_LABEL_LINE (lline)); - - if ( lline->private->line_color != line_color ) { - lline->private->line_color = line_color; - gl_label_object_emit_changed (GL_LABEL_OBJECT(lline)); - } -} - - -/*****************************************************************************/ -/* Get object params. */ -/*****************************************************************************/ -gdouble -gl_label_line_get_line_width (glLabelLine *lline) -{ - g_return_val_if_fail (lline && GL_IS_LABEL_LINE (lline), 0.0); - - return lline->private->line_width; -} - -guint -gl_label_line_get_line_color (glLabelLine *lline) -{ - g_return_val_if_fail (lline && GL_IS_LABEL_LINE (lline), 0); - - return lline->private->line_color; -} - /*---------------------------------------------------------------------------*/ /* PRIVATE. Set line color method. */ /*---------------------------------------------------------------------------*/ @@ -249,3 +208,29 @@ set_line_width (glLabelObject *object, } +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Get line color method. */ +/*---------------------------------------------------------------------------*/ +static gdouble +get_line_width (glLabelObject *object) +{ + glLabelLine *lline = (glLabelLine *)object; + + g_return_val_if_fail (lline && GL_IS_LABEL_LINE (lline), 0.0); + + return lline->private->line_width; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Get line width method. */ +/*---------------------------------------------------------------------------*/ +static guint +get_line_color (glLabelObject *object) +{ + glLabelLine *lline = (glLabelLine *)object; + + g_return_val_if_fail (lline && GL_IS_LABEL_LINE (lline), 0); + + return lline->private->line_color; +} + diff --git a/glabels2/src/label-line.h b/glabels2/src/label-line.h index 84fda6da..6caeb685 100644 --- a/glabels2/src/label-line.h +++ b/glabels2/src/label-line.h @@ -54,15 +54,6 @@ GType gl_label_line_get_type (void); GObject *gl_label_line_new (glLabel *label); -void gl_label_line_set_line_width (glLabelLine *lline, - gdouble line_width); - -void gl_label_line_set_line_color (glLabelLine *lline, - guint line_color); - -gdouble gl_label_line_get_line_width (glLabelLine *lline); -guint gl_label_line_get_line_color (glLabelLine *lline); - G_END_DECLS diff --git a/glabels2/src/label-object.c b/glabels2/src/label-object.c index f26a8cb7..ebdafab1 100644 --- a/glabels2/src/label-object.c +++ b/glabels2/src/label-object.c @@ -705,6 +705,150 @@ gl_label_object_set_text_color (glLabelObject *object, gl_debug (DEBUG_LABEL, "END"); } +/*****************************************************************************/ +/* Get font family for all text contained in object. */ +/*****************************************************************************/ +gchar * +gl_label_object_get_font_family (glLabelObject *object) +{ + gchar *ret = NULL; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), NULL); + + if ( GL_LABEL_OBJECT_GET_CLASS(object)->get_font_family != NULL ) { + + /* We have an object specific method, use it */ + ret = GL_LABEL_OBJECT_GET_CLASS(object)->get_font_family (object); + + } + + gl_debug (DEBUG_LABEL, "END"); + + return ret; +} + +/****************************************************************************/ +/* Get font size for all text contained in object. */ +/****************************************************************************/ +gdouble +gl_label_object_get_font_size (glLabelObject *object) +{ + gdouble ret = 0.0; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), 0.0); + + if ( GL_LABEL_OBJECT_GET_CLASS(object)->get_font_size != NULL ) { + + /* We have an object specific method, use it */ + ret = GL_LABEL_OBJECT_GET_CLASS(object)->get_font_size (object); + + } + + gl_debug (DEBUG_LABEL, "END"); + + return ret; +} + +/****************************************************************************/ +/* Get font weight for all text contained in object. */ +/****************************************************************************/ +GnomeFontWeight +gl_label_object_get_font_weight (glLabelObject *object) +{ + GnomeFontWeight ret = GNOME_FONT_BOOK; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), GNOME_FONT_BOOK); + + if ( GL_LABEL_OBJECT_GET_CLASS(object)->get_font_weight != NULL ) { + + /* We have an object specific method, use it */ + ret = GL_LABEL_OBJECT_GET_CLASS(object)->get_font_weight (object); + + } + + gl_debug (DEBUG_LABEL, "END"); + + return ret; +} + +/****************************************************************************/ +/* Get font italic flag for all text contained in object. */ +/****************************************************************************/ +gboolean +gl_label_object_get_font_italic_flag (glLabelObject *object) +{ + gboolean ret = FALSE; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), FALSE); + + if ( GL_LABEL_OBJECT_GET_CLASS(object)->get_font_italic_flag != NULL ) { + + /* We have an object specific method, use it */ + ret = GL_LABEL_OBJECT_GET_CLASS(object)->get_font_italic_flag (object); + + } + + gl_debug (DEBUG_LABEL, "END"); + + return ret; +} + +/****************************************************************************/ +/* Get text alignment for all text contained in object. */ +/****************************************************************************/ +GtkJustification +gl_label_object_get_text_alignment (glLabelObject *object) +{ + GtkJustification ret = GTK_JUSTIFY_LEFT; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), GTK_JUSTIFY_LEFT); + + if ( GL_LABEL_OBJECT_GET_CLASS(object)->get_text_alignment != NULL ) { + + /* We have an object specific method, use it */ + ret = GL_LABEL_OBJECT_GET_CLASS(object)->get_text_alignment (object); + + } + + gl_debug (DEBUG_LABEL, "END"); + + return ret; +} + +/****************************************************************************/ +/* Get text color for all text contained in object. */ +/****************************************************************************/ +guint +gl_label_object_get_text_color (glLabelObject *object) +{ + guint ret = 0; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), 0); + + if ( GL_LABEL_OBJECT_GET_CLASS(object)->get_text_color != NULL ) { + + /* We have an object specific method, use it */ + ret = GL_LABEL_OBJECT_GET_CLASS(object)->get_text_color (object); + + } + + gl_debug (DEBUG_LABEL, "END"); + + return ret; +} + /*****************************************************************************/ /* Can fill properties be set for this object? */ /*****************************************************************************/ @@ -748,6 +892,30 @@ gl_label_object_set_fill_color (glLabelObject *object, gl_debug (DEBUG_LABEL, "END"); } +/****************************************************************************/ +/* Get fill color for object. */ +/****************************************************************************/ +guint +gl_label_object_get_fill_color (glLabelObject *object) +{ + guint ret = 0; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), 0); + + if ( GL_LABEL_OBJECT_GET_CLASS(object)->get_fill_color != NULL ) { + + /* We have an object specific method, use it */ + ret = GL_LABEL_OBJECT_GET_CLASS(object)->get_fill_color (object); + + } + + gl_debug (DEBUG_LABEL, "END"); + + return ret; +} + /*****************************************************************************/ /* Can line color property be set for this object? */ /*****************************************************************************/ @@ -791,6 +959,30 @@ gl_label_object_set_line_color (glLabelObject *object, gl_debug (DEBUG_LABEL, "END"); } +/****************************************************************************/ +/* Get line color for object. */ +/****************************************************************************/ +guint +gl_label_object_get_line_color (glLabelObject *object) +{ + guint ret = 0; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), 0); + + if ( GL_LABEL_OBJECT_GET_CLASS(object)->get_line_color != NULL ) { + + /* We have an object specific method, use it */ + ret = GL_LABEL_OBJECT_GET_CLASS(object)->get_line_color (object); + + } + + gl_debug (DEBUG_LABEL, "END"); + + return ret; +} + /*****************************************************************************/ /* Can line width property be set for this object? */ /*****************************************************************************/ @@ -834,6 +1026,30 @@ gl_label_object_set_line_width (glLabelObject *object, gl_debug (DEBUG_LABEL, "END"); } +/****************************************************************************/ +/* Get line width for object. */ +/****************************************************************************/ +gdouble +gl_label_object_get_line_width (glLabelObject *object) +{ + gdouble ret = 0.0; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), 0.0); + + if ( GL_LABEL_OBJECT_GET_CLASS(object)->get_line_width != NULL ) { + + /* We have an object specific method, use it */ + ret = GL_LABEL_OBJECT_GET_CLASS(object)->get_line_width (object); + + } + + gl_debug (DEBUG_LABEL, "END"); + + return ret; +} + /****************************************************************************/ /* Flip object horizontally. */ /****************************************************************************/ diff --git a/glabels2/src/label-object.h b/glabels2/src/label-object.h index ebb8707f..d2fe2009 100644 --- a/glabels2/src/label-object.h +++ b/glabels2/src/label-object.h @@ -70,43 +70,61 @@ struct _glLabelObjectClass { * Methods */ - void (*set_size) (glLabelObject *object, - gdouble w, - gdouble h); + void (*set_size) (glLabelObject *object, + gdouble w, + gdouble h); - void (*get_size) (glLabelObject *object, - gdouble *w, - gdouble *h); + void (*get_size) (glLabelObject *object, + gdouble *w, + gdouble *h); - void (*set_font_family) (glLabelObject *object, - const gchar *font_family); + void (*set_font_family) (glLabelObject *object, + const gchar *font_family); - void (*set_font_size) (glLabelObject *object, - gdouble font_size); + void (*set_font_size) (glLabelObject *object, + gdouble font_size); - void (*set_font_weight) (glLabelObject *object, - GnomeFontWeight font_weight); + void (*set_font_weight) (glLabelObject *object, + GnomeFontWeight font_weight); - void (*set_font_italic_flag) (glLabelObject *object, - gboolean font_italic_flag); + void (*set_font_italic_flag) (glLabelObject *object, + gboolean font_italic_flag); - void (*set_text_alignment) (glLabelObject *object, - GtkJustification text_alignment); + void (*set_text_alignment) (glLabelObject *object, + GtkJustification text_alignment); - void (*set_text_color) (glLabelObject *object, - guint text_color); + void (*set_text_color) (glLabelObject *object, + guint text_color); - void (*set_fill_color) (glLabelObject *object, - guint fill_color); + void (*set_fill_color) (glLabelObject *object, + guint fill_color); - void (*set_line_color) (glLabelObject *object, - guint line_color); + void (*set_line_color) (glLabelObject *object, + guint line_color); - void (*set_line_width) (glLabelObject *object, - gdouble line_width); + void (*set_line_width) (glLabelObject *object, + gdouble line_width); - void (*copy) (glLabelObject *dst_object, - glLabelObject *src_object); + gchar *(*get_font_family) (glLabelObject *object); + + gdouble (*get_font_size) (glLabelObject *object); + + GnomeFontWeight (*get_font_weight) (glLabelObject *object); + + gboolean (*get_font_italic_flag) (glLabelObject *object); + + GtkJustification (*get_text_alignment) (glLabelObject *object); + + guint (*get_text_color) (glLabelObject *object); + + guint (*get_fill_color) (glLabelObject *object); + + guint (*get_line_color) (glLabelObject *object); + + gdouble (*get_line_width) (glLabelObject *object); + + void (*copy) (glLabelObject *dst_object, + glLabelObject *src_object); /* * Signals @@ -178,6 +196,7 @@ void gl_label_object_get_extent (glLabelObject *object, gdouble *x2, gdouble *y2); + gboolean gl_label_object_can_text (glLabelObject *object); void gl_label_object_set_font_family (glLabelObject *object, @@ -199,22 +218,41 @@ void gl_label_object_set_text_color (glLabelObject *object, guint text_color); +gchar *gl_label_object_get_font_family (glLabelObject *object); + +gdouble gl_label_object_get_font_size (glLabelObject *object); + +GnomeFontWeight gl_label_object_get_font_weight (glLabelObject *object); + +gboolean gl_label_object_get_font_italic_flag (glLabelObject *object); + +GtkJustification gl_label_object_get_text_alignment (glLabelObject *object); + +guint gl_label_object_get_text_color (glLabelObject *object); + + gboolean gl_label_object_can_fill (glLabelObject *object); void gl_label_object_set_fill_color (glLabelObject *object, guint fill_color); +guint gl_label_object_get_fill_color (glLabelObject *object); + gboolean gl_label_object_can_line_color (glLabelObject *object); void gl_label_object_set_line_color (glLabelObject *object, guint line_color); +guint gl_label_object_get_line_color (glLabelObject *object); + gboolean gl_label_object_can_line_width (glLabelObject *object); void gl_label_object_set_line_width (glLabelObject *object, gdouble line_width); +gdouble gl_label_object_get_line_width (glLabelObject *object); + void gl_label_object_raise_to_top (glLabelObject *object); diff --git a/glabels2/src/label-text.c b/glabels2/src/label-text.c index 46fd6d00..883e54a2 100644 --- a/glabels2/src/label-text.c +++ b/glabels2/src/label-text.c @@ -100,6 +100,18 @@ static void set_text_alignment (glLabelObject *object, static void set_text_color (glLabelObject *object, guint text_color); +static gchar *get_font_family (glLabelObject *object); + +static gdouble get_font_size (glLabelObject *object); + +static GnomeFontWeight get_font_weight (glLabelObject *object); + +static gboolean get_font_italic_flag (glLabelObject *object); + +static GtkJustification get_text_alignment (glLabelObject *object); + +static guint get_text_color (glLabelObject *object); + /*****************************************************************************/ /* Boilerplate object stuff. */ @@ -147,6 +159,12 @@ gl_label_text_class_init (glLabelTextClass *klass) label_object_class->set_font_italic_flag = set_font_italic_flag; label_object_class->set_text_alignment = set_text_alignment; label_object_class->set_text_color = set_text_color; + label_object_class->get_font_family = get_font_family; + label_object_class->get_font_size = get_font_size; + label_object_class->get_font_weight = get_font_weight; + label_object_class->get_font_italic_flag = get_font_italic_flag; + label_object_class->get_text_alignment = get_text_alignment; + label_object_class->get_text_color = get_text_color; object_class->finalize = gl_label_text_finalize; } @@ -224,16 +242,14 @@ copy (glLabelObject *dst_object, g_return_if_fail (new_ltext && GL_IS_LABEL_TEXT (new_ltext)); lines = gl_label_text_get_lines (ltext); - gl_label_text_get_props (ltext, - &font_family, &font_size, &font_weight, - &font_italic_flag, - &color, &just); - gl_label_text_set_lines (new_ltext, lines); - gl_label_text_set_props (new_ltext, - font_family, font_size, font_weight, - font_italic_flag, - color, just); + + new_ltext->private->font_family = g_strdup (ltext->private->font_family); + new_ltext->private->font_size = ltext->private->font_size; + new_ltext->private->font_weight = ltext->private->font_weight; + new_ltext->private->font_italic_flag = ltext->private->font_italic_flag; + new_ltext->private->color = ltext->private->color; + new_ltext->private->just = ltext->private->just; gl_text_node_lines_free (&lines); g_free (font_family); @@ -262,52 +278,6 @@ gl_label_text_set_lines (glLabelText *ltext, gl_debug (DEBUG_LABEL, "END"); } -void -gl_label_text_set_props (glLabelText *ltext, - gchar *font_family, - gdouble font_size, - GnomeFontWeight font_weight, - gboolean font_italic_flag, - guint color, - GtkJustification just) -{ - GList *family_names; - gchar *good_font_family; - - gl_debug (DEBUG_LABEL, "START"); - - g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); - - /* Make sure we have a valid font family. if not provide a good default. */ - family_names = gnome_font_family_list (); - if (g_list_find_custom (family_names, font_family, (GCompareFunc)g_utf8_collate)) { - good_font_family = g_strdup (font_family); - } else { - if (family_names != NULL) { - good_font_family = g_strdup (family_names->data); /* 1st entry */ - } else { - good_font_family = NULL; - } - } - gnome_font_family_list_free (family_names); - - g_free (ltext->private->font_family); - - ltext->private->font_family = good_font_family; - ltext->private->font_size = font_size; - ltext->private->font_weight = font_weight; - ltext->private->font_italic_flag = font_italic_flag; - ltext->private->color = color; - ltext->private->just = just; - - gl_debug (DEBUG_LABEL, "just = %d", ltext->private->just); - - gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext)); - - gl_debug (DEBUG_LABEL, "END"); -} - - /*****************************************************************************/ /* Get object params. */ /*****************************************************************************/ @@ -337,35 +307,6 @@ gl_label_text_get_lines (glLabelText *ltext) return lines; } -void -gl_label_text_get_props (glLabelText *ltext, - gchar **font_family, - gdouble *font_size, - GnomeFontWeight *font_weight, - gboolean *font_italic_flag, - guint *color, - GtkJustification *just) -{ - g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); - - *font_family = g_strdup (ltext->private->font_family); - *font_size = ltext->private->font_size; - *font_weight = ltext->private->font_weight; - *font_italic_flag = ltext->private->font_italic_flag; - *color = ltext->private->color; - *just = ltext->private->just; - - gl_debug (DEBUG_LABEL, "just = %d", *just); -} - -GtkJustification -gl_label_text_get_text_alignment (glLabelText *ltext) -{ - g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); - - return ltext->private->just; -} - void gl_label_text_get_box (glLabelText *ltext, gdouble *w, @@ -618,3 +559,93 @@ set_text_color (glLabelObject *object, gl_debug (DEBUG_LABEL, "END"); } +/*---------------------------------------------------------------------------*/ +/* PRIVATE. get font family method. */ +/*---------------------------------------------------------------------------*/ +static gchar * +get_font_family (glLabelObject *object) +{ + glLabelText *ltext = (glLabelText *)object; + + gl_debug (DEBUG_LABEL, ""); + + g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), NULL); + + return g_strdup (ltext->private->font_family); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. get font size method. */ +/*---------------------------------------------------------------------------*/ +static gdouble +get_font_size (glLabelObject *object) +{ + glLabelText *ltext = (glLabelText *)object; + + gl_debug (DEBUG_LABEL, ""); + + g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), 0.0); + + return ltext->private->font_size; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. get font weight method. */ +/*---------------------------------------------------------------------------*/ +static GnomeFontWeight +get_font_weight (glLabelObject *object) +{ + glLabelText *ltext = (glLabelText *)object; + + gl_debug (DEBUG_LABEL, ""); + + g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), GNOME_FONT_BOOK); + + return ltext->private->font_weight; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. get font italic flag method. */ +/*---------------------------------------------------------------------------*/ +static gboolean +get_font_italic_flag (glLabelObject *object) +{ + glLabelText *ltext = (glLabelText *)object; + + gl_debug (DEBUG_LABEL, ""); + + g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), FALSE); + + return ltext->private->font_italic_flag; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. get text alignment method. */ +/*---------------------------------------------------------------------------*/ +static GtkJustification +get_text_alignment (glLabelObject *object) +{ + glLabelText *ltext = (glLabelText *)object; + + gl_debug (DEBUG_LABEL, ""); + + g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), GTK_JUSTIFY_LEFT); + + return ltext->private->just; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. get text color method. */ +/*---------------------------------------------------------------------------*/ +static guint +get_text_color (glLabelObject *object) +{ + glLabelText *ltext = (glLabelText *)object; + + gl_debug (DEBUG_LABEL, ""); + + g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), 0); + + return ltext->private->color; +} + diff --git a/glabels2/src/label-text.h b/glabels2/src/label-text.h index 92a0684f..40bdb3aa 100644 --- a/glabels2/src/label-text.h +++ b/glabels2/src/label-text.h @@ -60,26 +60,8 @@ GObject *gl_label_text_new (glLabel *label); void gl_label_text_set_lines (glLabelText *ltext, GList *lines); -void gl_label_text_set_props (glLabelText *ltext, - gchar *font_family, - gdouble font_size, - GnomeFontWeight font_weight, - gboolean font_italic_flag, - guint color, - GtkJustification just); - GtkTextBuffer *gl_label_text_get_buffer (glLabelText *ltext); GList *gl_label_text_get_lines (glLabelText *ltext); -void gl_label_text_get_props (glLabelText *ltext, - gchar **font_family, - gdouble *font_size, - GnomeFontWeight *font_weight, - gboolean *font_italic_flag, - guint *color, - GtkJustification *just); - -GtkJustification gl_label_text_get_text_alignment (glLabelText *ltext); - void gl_label_text_get_box (glLabelText *ltext, gdouble *w, gdouble *h); diff --git a/glabels2/src/print.c b/glabels2/src/print.c index bebc16d6..f768eae7 100644 --- a/glabels2/src/print.c +++ b/glabels2/src/print.c @@ -732,10 +732,12 @@ draw_text_object (PrintInfo *pi, gl_label_object_get_size (GL_LABEL_OBJECT(object), &object_w, &object_h); lines = gl_label_text_get_lines (object); - gl_label_text_get_props (object, - &font_family, &font_size, &font_weight, - &font_italic_flag, - &color, &just); + font_family = gl_label_object_get_font_family (GL_LABEL_OBJECT(object)); + font_size = gl_label_object_get_font_size (GL_LABEL_OBJECT(object)); + font_weight = gl_label_object_get_font_weight (GL_LABEL_OBJECT(object)); + font_italic_flag = gl_label_object_get_font_italic_flag (GL_LABEL_OBJECT(object)); + color = gl_label_object_get_text_color (GL_LABEL_OBJECT(object)); + just = gl_label_object_get_text_alignment (GL_LABEL_OBJECT(object)); font = gnome_font_find_closest_from_weight_slant ( font_family, @@ -813,9 +815,9 @@ draw_box_object (PrintInfo *pi, gl_debug (DEBUG_PRINT, "START"); gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); - line_width = gl_label_box_get_line_width (object); - line_color = gl_label_box_get_line_color (object); - fill_color = gl_label_box_get_fill_color (object); + line_width = gl_label_object_get_line_width (GL_LABEL_OBJECT(object)); + line_color = gl_label_object_get_line_color (GL_LABEL_OBJECT(object)); + fill_color = gl_label_object_get_fill_color (GL_LABEL_OBJECT(object)); /* Paint fill color */ create_rectangle_path (pi->pc, 0.0, 0.0, w, h); @@ -853,8 +855,8 @@ draw_line_object (PrintInfo *pi, gl_debug (DEBUG_PRINT, "START"); gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); - line_width = gl_label_line_get_line_width (object); - line_color = gl_label_line_get_line_color (object); + line_width = gl_label_object_get_line_width (GL_LABEL_OBJECT(object)); + line_color = gl_label_object_get_line_color (GL_LABEL_OBJECT(object)); gnome_print_moveto (pi->pc, 0.0, 0.0); gnome_print_lineto (pi->pc, w, h); @@ -883,9 +885,9 @@ draw_ellipse_object (PrintInfo *pi, gl_debug (DEBUG_PRINT, "START"); gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); - line_width = gl_label_ellipse_get_line_width (object); - line_color = gl_label_ellipse_get_line_color (object); - fill_color = gl_label_ellipse_get_fill_color (object); + line_width = gl_label_object_get_line_width (GL_LABEL_OBJECT(object)); + line_color = gl_label_object_get_line_color (GL_LABEL_OBJECT(object)); + fill_color = gl_label_object_get_fill_color (GL_LABEL_OBJECT(object)); rx = w / 2.0; ry = h / 2.0; @@ -990,7 +992,8 @@ draw_barcode_object (PrintInfo *pi, text_node = gl_label_barcode_get_data (object); gl_label_barcode_get_props (object, - &style, &text_flag, &checksum_flag, &color); + &style, &text_flag, &checksum_flag); + color = gl_label_object_get_line_color (GL_LABEL_OBJECT(object)); gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); text = gl_text_node_expand (text_node, record); diff --git a/glabels2/src/view-barcode.c b/glabels2/src/view-barcode.c index 901ff9b9..a7bbfc60 100644 --- a/glabels2/src/view-barcode.c +++ b/glabels2/src/view-barcode.c @@ -285,7 +285,8 @@ update_object_from_editor_cb (glObjectEditor *editor, gl_object_editor_get_bc_style (editor, &style, &text_flag, &cs_flag); color = gl_object_editor_get_bc_color (editor); gl_label_barcode_set_props (GL_LABEL_BARCODE(object), - style, text_flag, cs_flag, color); + style, text_flag, cs_flag); + gl_label_object_set_line_color (object, color); g_signal_handlers_unblock_by_func (G_OBJECT(object), update_editor_from_object_cb, @@ -317,7 +318,8 @@ update_editor_from_object_cb (glLabelObject *object, gl_object_editor_set_size (editor, w, h); gl_label_barcode_get_props (GL_LABEL_BARCODE(object), - &style, &text_flag, &cs_flag, &color); + &style, &text_flag, &cs_flag); + color = gl_label_object_get_line_color (object); gl_object_editor_set_bc_style (editor, style, text_flag, cs_flag); gl_object_editor_set_bc_color (editor, color); @@ -447,7 +449,8 @@ gl_view_barcode_create_event_handler (GnomeCanvas *canvas, gl_label_barcode_set_props (GL_LABEL_BARCODE(object), GL_BARCODE_STYLE_POSTNET, FALSE, - TRUE, + TRUE); + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), gl_color_set_opacity ( gl_view_get_default_line_color(view), 0.5)); @@ -475,8 +478,9 @@ gl_view_barcode_create_event_handler (GnomeCanvas *canvas, gl_label_barcode_set_props (GL_LABEL_BARCODE(object), GL_BARCODE_STYLE_POSTNET, FALSE, - TRUE, - gl_view_get_default_line_color(view)); + TRUE); + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), + gl_view_get_default_line_color(view)); gl_view_unselect_all (view); gl_view_object_select (GL_VIEW_OBJECT(view_barcode)); gl_view_arrow_mode (view); @@ -535,7 +539,8 @@ draw_barcode (glViewBarcode *view_barcode) /* Query label object and properties */ object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode)); gl_label_barcode_get_props (GL_LABEL_BARCODE(object), - &style, &text_flag, &checksum_flag, &color); + &style, &text_flag, &checksum_flag); + color = gl_label_object_get_line_color (object); gl_label_object_get_size (object, &w, &h); text_node = gl_label_barcode_get_data(GL_LABEL_BARCODE(object)); if (text_node->field_flag) { diff --git a/glabels2/src/view-box.c b/glabels2/src/view-box.c index 158d5353..a2b85574 100644 --- a/glabels2/src/view-box.c +++ b/glabels2/src/view-box.c @@ -179,9 +179,9 @@ gl_view_box_new (glLabelBox *object, /* Query properties of object. */ gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); - line_width = gl_label_box_get_line_width(object); - line_color = gl_label_box_get_line_color(object); - fill_color = gl_label_box_get_fill_color(object); + line_width = gl_label_object_get_line_width(GL_LABEL_OBJECT(object)); + line_color = gl_label_object_get_line_color(GL_LABEL_OBJECT(object)); + fill_color = gl_label_object_get_fill_color(GL_LABEL_OBJECT(object)); /* Create analogous canvas item. */ view_box->private->item = @@ -261,9 +261,9 @@ update_canvas_item_from_object_cb (glLabelObject *object, /* Query properties of object. */ gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); - line_width = gl_label_box_get_line_width(GL_LABEL_BOX(object)); - line_color = gl_label_box_get_line_color(GL_LABEL_BOX(object)); - fill_color = gl_label_box_get_fill_color(GL_LABEL_BOX(object)); + line_width = gl_label_object_get_line_width(GL_LABEL_OBJECT(object)); + line_color = gl_label_object_get_line_color(GL_LABEL_OBJECT(object)); + fill_color = gl_label_object_get_fill_color(GL_LABEL_OBJECT(object)); /* Adjust appearance of analogous canvas item. */ gnome_canvas_item_set (view_box->private->item, @@ -336,13 +336,13 @@ update_editor_from_object_cb (glLabelObject *object, gl_label_object_get_size (object, &w, &h); gl_object_editor_set_size (editor, w, h); - fill_color = gl_label_box_get_fill_color (GL_LABEL_BOX(object)); + fill_color = gl_label_object_get_fill_color (GL_LABEL_OBJECT(object)); gl_object_editor_set_fill_color (editor, fill_color); - line_color = gl_label_box_get_line_color (GL_LABEL_BOX(object)); + line_color = gl_label_object_get_line_color (GL_LABEL_OBJECT(object)); gl_object_editor_set_line_color (editor, line_color); - line_width = gl_label_box_get_line_width (GL_LABEL_BOX(object)); + line_width = gl_label_object_get_line_width (GL_LABEL_OBJECT(object)); gl_object_editor_set_line_width (editor, line_width); gl_debug (DEBUG_VIEW, "END"); @@ -458,11 +458,11 @@ gl_view_box_create_event_handler (GnomeCanvas *canvas, 0.0, 0.0); line_color = gl_color_set_opacity (gl_view_get_default_line_color(view), 0.5); fill_color = gl_color_set_opacity (gl_view_get_default_fill_color(view), 0.5); - gl_label_box_set_line_width (GL_LABEL_BOX(object), + gl_label_object_set_line_width (GL_LABEL_OBJECT(object), gl_view_get_default_line_width(view)); - gl_label_box_set_line_color (GL_LABEL_BOX(object), + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color); - gl_label_box_set_fill_color (GL_LABEL_BOX(object), + gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), fill_color); view_box = gl_view_box_new (GL_LABEL_BOX(object), view); @@ -492,9 +492,9 @@ gl_view_box_create_event_handler (GnomeCanvas *canvas, h = MAX (y, y0) - MIN (y, y0); gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); - gl_label_box_set_line_color (GL_LABEL_BOX(object), + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), gl_view_get_default_line_color(view)); - gl_label_box_set_fill_color (GL_LABEL_BOX(object), + gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), gl_view_get_default_fill_color(view)); gl_view_unselect_all (view); gl_view_object_select (GL_VIEW_OBJECT(view_box)); diff --git a/glabels2/src/view-ellipse.c b/glabels2/src/view-ellipse.c index 837b5e03..37ee8b0c 100644 --- a/glabels2/src/view-ellipse.c +++ b/glabels2/src/view-ellipse.c @@ -179,9 +179,9 @@ gl_view_ellipse_new (glLabelEllipse *object, /* Query properties of object. */ gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); - line_width = gl_label_ellipse_get_line_width(object); - line_color = gl_label_ellipse_get_line_color(object); - fill_color = gl_label_ellipse_get_fill_color(object); + line_width = gl_label_object_get_line_width(GL_LABEL_OBJECT(object)); + line_color = gl_label_object_get_line_color(GL_LABEL_OBJECT(object)); + fill_color = gl_label_object_get_fill_color(GL_LABEL_OBJECT(object)); /* Create analogous canvas item. */ view_ellipse->private->item = @@ -261,9 +261,9 @@ update_canvas_item_from_object_cb (glLabelObject *object, /* Query properties of object. */ gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); - line_width = gl_label_ellipse_get_line_width(GL_LABEL_ELLIPSE(object)); - line_color = gl_label_ellipse_get_line_color(GL_LABEL_ELLIPSE(object)); - fill_color = gl_label_ellipse_get_fill_color(GL_LABEL_ELLIPSE(object)); + line_width = gl_label_object_get_line_width(GL_LABEL_OBJECT(object)); + line_color = gl_label_object_get_line_color(GL_LABEL_OBJECT(object)); + fill_color = gl_label_object_get_fill_color(GL_LABEL_OBJECT(object)); /* Adjust appearance of analogous canvas item. */ gnome_canvas_item_set (view_ellipse->private->item, @@ -340,13 +340,13 @@ update_editor_from_object_cb (glLabelObject *object, gl_label_object_get_size (object, &w, &h); gl_object_editor_set_size (editor, w, h); - fill_color = gl_label_ellipse_get_fill_color (GL_LABEL_ELLIPSE(object)); + fill_color = gl_label_object_get_fill_color (GL_LABEL_OBJECT(object)); gl_object_editor_set_fill_color (editor, fill_color); - line_color = gl_label_ellipse_get_line_color (GL_LABEL_ELLIPSE(object)); + line_color = gl_label_object_get_line_color (GL_LABEL_OBJECT(object)); gl_object_editor_set_line_color (editor, line_color); - line_width = gl_label_ellipse_get_line_width (GL_LABEL_ELLIPSE(object)); + line_width = gl_label_object_get_line_width (GL_LABEL_OBJECT(object)); gl_object_editor_set_line_width (editor, line_width); gl_debug (DEBUG_VIEW, "END"); @@ -462,11 +462,11 @@ gl_view_ellipse_create_event_handler (GnomeCanvas *canvas, 0.0, 0.0); line_color = gl_color_set_opacity (gl_view_get_default_line_color(view), 0.5); fill_color = gl_color_set_opacity (gl_view_get_default_fill_color(view), 0.5); - gl_label_ellipse_set_line_width (GL_LABEL_ELLIPSE(object), + gl_label_object_set_line_width (GL_LABEL_OBJECT(object), gl_view_get_default_line_width(view)); - gl_label_ellipse_set_line_color (GL_LABEL_ELLIPSE(object), + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color); - gl_label_ellipse_set_fill_color (GL_LABEL_ELLIPSE(object), + gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), fill_color); view_ellipse = gl_view_ellipse_new (GL_LABEL_ELLIPSE(object), view); @@ -496,9 +496,9 @@ gl_view_ellipse_create_event_handler (GnomeCanvas *canvas, h = MAX (y, y0) - MIN (y, y0); gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); - gl_label_ellipse_set_line_color (GL_LABEL_ELLIPSE(object), + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), gl_view_get_default_line_color(view)); - gl_label_ellipse_set_fill_color (GL_LABEL_ELLIPSE(object), + gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), gl_view_get_default_fill_color(view)); gl_view_unselect_all (view); gl_view_object_select (GL_VIEW_OBJECT(view_ellipse)); diff --git a/glabels2/src/view-line.c b/glabels2/src/view-line.c index 3190d962..065a3226 100644 --- a/glabels2/src/view-line.c +++ b/glabels2/src/view-line.c @@ -178,8 +178,8 @@ gl_view_line_new (glLabelLine *object, /* Query properties of object. */ gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); - line_width = gl_label_line_get_line_width(object); - line_color = gl_label_line_get_line_color(object); + line_width = gl_label_object_get_line_width(GL_LABEL_OBJECT(object)); + line_color = gl_label_object_get_line_color(GL_LABEL_OBJECT(object)); /* Create analogous canvas item. */ points = gnome_canvas_points_new (2); @@ -261,8 +261,8 @@ update_canvas_item_from_object_cb (glLabelObject *object, /* Query properties of object. */ gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); - line_width = gl_label_line_get_line_width(GL_LABEL_LINE(object)); - line_color = gl_label_line_get_line_color(GL_LABEL_LINE(object)); + line_width = gl_label_object_get_line_width(GL_LABEL_OBJECT(object)); + line_color = gl_label_object_get_line_color(GL_LABEL_OBJECT(object)); /* Adjust appearance of analogous canvas item. */ points = gnome_canvas_points_new (2); @@ -340,10 +340,10 @@ update_editor_from_object_cb (glLabelObject *object, gl_label_object_get_size (object, &w, &h); gl_object_editor_set_lsize (editor, w, h); - line_color = gl_label_line_get_line_color (GL_LABEL_LINE(object)); + line_color = gl_label_object_get_line_color (GL_LABEL_OBJECT(object)); gl_object_editor_set_line_color (editor, line_color); - line_width = gl_label_line_get_line_width (GL_LABEL_LINE(object)); + line_width = gl_label_object_get_line_width (GL_LABEL_OBJECT(object)); gl_object_editor_set_line_width (editor, line_width); gl_debug (DEBUG_VIEW, "END"); @@ -382,8 +382,8 @@ update_editor_from_label_cb (glLabel *label, gl_label_get_size (label, &label_width, &label_height); gl_object_editor_set_max_position (GL_OBJECT_EDITOR (editor), label_width, label_height); - gl_object_editor_set_max_size (GL_OBJECT_EDITOR (editor), - label_width, label_height); + gl_object_editor_set_max_lsize (GL_OBJECT_EDITOR (editor), + label_width, label_height); gl_debug (DEBUG_VIEW, "END"); } @@ -456,9 +456,9 @@ gl_view_line_create_event_handler (GnomeCanvas *canvas, x, y); gl_label_object_set_size (GL_LABEL_OBJECT(object), 0.0, 0.0); - gl_label_line_set_line_width (GL_LABEL_LINE(object), + gl_label_object_set_line_width (GL_LABEL_OBJECT(object), gl_view_get_default_line_width(view)); - gl_label_line_set_line_color (GL_LABEL_LINE(object), + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), gl_color_set_opacity (gl_view_get_default_line_color(view), 0.5)); view_line = gl_view_line_new (GL_LABEL_LINE(object), view); @@ -486,7 +486,7 @@ gl_view_line_create_event_handler (GnomeCanvas *canvas, h = y - y0; gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); - gl_label_line_set_line_color (GL_LABEL_LINE(object), + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), gl_view_get_default_line_color(view)); gl_view_unselect_all (view); gl_view_object_select (GL_VIEW_OBJECT(view_line)); diff --git a/glabels2/src/view-text.c b/glabels2/src/view-text.c index 6ff471fa..01f268ec 100644 --- a/glabels2/src/view-text.c +++ b/glabels2/src/view-text.c @@ -317,30 +317,24 @@ update_object_from_editor_cb (glObjectEditor *editor, gl_object_editor_get_position (editor, &x, &y); - gl_label_object_set_position (object, x, y); - gl_object_editor_get_size (editor, &w, &h); - gl_label_object_set_size (object, w, h); - font_family = gl_object_editor_get_font_family (editor); - gl_label_object_set_font_family (object, font_family); - g_free (font_family); - font_size = gl_object_editor_get_font_size (editor); - gl_label_object_set_font_size (object, font_size); - font_weight = gl_object_editor_get_font_weight (editor); - gl_label_object_set_font_weight (object, font_weight); - font_italic_flag = gl_object_editor_get_font_italic_flag (editor); - gl_label_object_set_font_italic_flag (object, font_italic_flag); - color = gl_object_editor_get_text_color (editor); - gl_label_object_set_text_color (object, color); - just = gl_object_editor_get_text_alignment (editor); + + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + gl_label_object_set_font_family (object, font_family); + gl_label_object_set_font_size (object, font_size); + gl_label_object_set_font_weight (object, font_weight); + gl_label_object_set_font_italic_flag (object, font_italic_flag); + gl_label_object_set_text_color (object, color); gl_label_object_set_text_alignment (object, just); + g_free (font_family); g_signal_handlers_unblock_by_func (G_OBJECT(object), update_editor_from_object_cb, @@ -372,24 +366,21 @@ update_editor_from_object_cb (glLabelObject *object, gl_label_object_get_size (object, &w, &h); gl_object_editor_set_size (editor, w, h); - gl_label_text_get_props (GL_LABEL_TEXT(object), - &font_family, &font_size, - &font_weight, &font_italic_flag, - &color, &just); + font_family = gl_label_object_get_font_family (object); + font_size = gl_label_object_get_font_size (object); + font_weight = gl_label_object_get_font_weight (object); + font_italic_flag = gl_label_object_get_font_italic_flag (object); + color = gl_label_object_get_text_color (object); + just = gl_label_object_get_text_alignment (object); gl_object_editor_set_font_family (editor, font_family); - g_free (font_family); - gl_object_editor_set_font_size (editor, font_size); - gl_object_editor_set_font_weight (editor, font_weight); - gl_object_editor_set_font_italic_flag (editor, font_italic_flag); - gl_object_editor_set_text_color (editor, color); - gl_object_editor_set_text_alignment (editor, just); + g_free (font_family); gl_debug (DEBUG_VIEW, "END"); } @@ -475,8 +466,8 @@ gl_view_text_get_create_cursor (void) /*****************************************************************************/ int gl_view_text_create_event_handler (GnomeCanvas *canvas, - GdkEvent *event, - glView *view) + GdkEvent *event, + glView *view) { static gdouble x0, y0; static gboolean dragging = FALSE; @@ -507,13 +498,17 @@ gl_view_text_create_event_handler (GnomeCanvas *canvas, gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); family = gl_view_get_default_font_family (view); - gl_label_text_set_props (GL_LABEL_TEXT(object), - family, - gl_view_get_default_font_size (view), - gl_view_get_default_font_weight (view), - gl_view_get_default_font_italic_flag (view), - gl_color_set_opacity (gl_view_get_default_text_color (view), 0.5), - gl_view_get_default_text_alignment (view)); + gl_label_object_set_font_family (GL_LABEL_OBJECT(object), family); + gl_label_object_set_font_size (GL_LABEL_OBJECT(object), + gl_view_get_default_font_size (view)); + gl_label_object_set_font_weight (GL_LABEL_OBJECT(object), + gl_view_get_default_font_weight (view)); + gl_label_object_set_font_italic_flag (GL_LABEL_OBJECT(object), + gl_view_get_default_font_italic_flag (view)); + gl_label_object_set_text_color (GL_LABEL_OBJECT(object), + gl_color_set_opacity (gl_view_get_default_text_color (view), 0.5)); + gl_label_object_set_text_alignment (GL_LABEL_OBJECT(object), + gl_view_get_default_text_alignment (view)); g_free (family); lines = gl_text_node_lines_new_from_text (_("Text")); gl_label_text_set_lines (GL_LABEL_TEXT(object), lines); @@ -539,13 +534,17 @@ gl_view_text_create_event_handler (GnomeCanvas *canvas, gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); family = gl_view_get_default_font_family (view); - gl_label_text_set_props (GL_LABEL_TEXT(object), - family, - gl_view_get_default_font_size (view), - gl_view_get_default_font_weight (view), - gl_view_get_default_font_italic_flag (view), - gl_view_get_default_text_color (view), - gl_view_get_default_text_alignment (view)); + gl_label_object_set_font_family (GL_LABEL_OBJECT(object), family); + gl_label_object_set_font_size (GL_LABEL_OBJECT(object), + gl_view_get_default_font_size (view)); + gl_label_object_set_font_weight (GL_LABEL_OBJECT(object), + gl_view_get_default_font_weight (view)); + gl_label_object_set_font_italic_flag (GL_LABEL_OBJECT(object), + gl_view_get_default_font_italic_flag (view)); + gl_label_object_set_text_color (GL_LABEL_OBJECT(object), + gl_view_get_default_text_color (view)); + gl_label_object_set_text_alignment (GL_LABEL_OBJECT(object), + gl_view_get_default_text_alignment (view)); g_free (family); gl_view_unselect_all (view); gl_view_object_select (GL_VIEW_OBJECT(view_text)); @@ -606,10 +605,12 @@ draw_hacktext (glViewText *view_text) /* Query label object and properties */ object = gl_view_object_get_object (GL_VIEW_OBJECT(view_text)); gl_label_object_get_size (object, &object_w, &object_h); - gl_label_text_get_props (GL_LABEL_TEXT(object), - &font_family, &font_size, - &font_weight, &font_italic_flag, - &color, &just); + font_family = gl_label_object_get_font_family (object); + font_size = gl_label_object_get_font_size (object); + font_weight = gl_label_object_get_font_weight (object); + font_italic_flag = gl_label_object_get_font_italic_flag (object); + color = gl_label_object_get_text_color (object); + just = gl_label_object_get_text_alignment (object); buffer = gl_label_text_get_buffer(GL_LABEL_TEXT(object)); gtk_text_buffer_get_bounds (buffer, &start, &end); text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE); @@ -712,10 +713,12 @@ draw_cursor (glViewText *view_text) /* Query label object and properties */ object = gl_view_object_get_object (GL_VIEW_OBJECT(view_text)); gl_label_object_get_size (object, &object_w, &object_h); - gl_label_text_get_props (GL_LABEL_TEXT(object), - &font_family, &font_size, - &font_weight, &font_italic_flag, - &color, &just); + font_family = gl_label_object_get_font_family (object); + font_size = gl_label_object_get_font_size (object); + font_weight = gl_label_object_get_font_weight (object); + font_italic_flag = gl_label_object_get_font_italic_flag (object); + color = gl_label_object_get_text_color (object); + just = gl_label_object_get_text_alignment (object); buffer = gl_label_text_get_buffer(GL_LABEL_TEXT(object)); gtk_text_buffer_get_bounds (buffer, &start, &end); text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE); diff --git a/glabels2/src/xml-label-04.c b/glabels2/src/xml-label-04.c index 2d9abd17..1d3a2063 100644 --- a/glabels2/src/xml-label-04.c +++ b/glabels2/src/xml-label-04.c @@ -218,13 +218,12 @@ xml04_parse_text_props (xmlNodePtr object_node, color = gl_xml_get_prop_uint (object_node, "color", 0); - gl_label_text_set_props (object, - font_family, - font_size, - font_weight, - font_italic_flag, - color, - just); + gl_label_object_set_font_family (GL_LABEL_OBJECT(object), font_family); + gl_label_object_set_font_size (GL_LABEL_OBJECT(object), font_size); + gl_label_object_set_font_weight (GL_LABEL_OBJECT(object), font_weight); + gl_label_object_set_font_italic_flag (GL_LABEL_OBJECT(object), font_italic_flag); + gl_label_object_set_text_color (GL_LABEL_OBJECT(object), color); + gl_label_object_set_text_alignment (GL_LABEL_OBJECT(object), just); lines = NULL; for (line_node = object_node->xmlChildrenNode; line_node != NULL; @@ -320,9 +319,9 @@ xml04_parse_box_props (xmlNodePtr node, fill_color = gl_xml_get_prop_uint (node, "fill_color", 0); gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); - gl_label_box_set_line_width (object, line_width); - gl_label_box_set_line_color (object, line_color); - gl_label_box_set_fill_color (object, fill_color); + gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width); + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color); + gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), fill_color); gl_debug (DEBUG_XML, "END"); } @@ -347,8 +346,8 @@ xml04_parse_line_props (xmlNodePtr node, line_color = gl_xml_get_prop_uint (node, "line_color", 0); gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); - gl_label_line_set_line_width (object, line_width); - gl_label_line_set_line_color (object, line_color); + gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width); + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color); gl_debug (DEBUG_XML, "END"); } @@ -374,9 +373,9 @@ xml04_parse_ellipse_props (xmlNodePtr node, fill_color = gl_xml_get_prop_uint (node, "fill_color", 0); gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); - gl_label_ellipse_set_line_width (object, line_width); - gl_label_ellipse_set_line_color (object, line_color); - gl_label_ellipse_set_fill_color (object, fill_color); + gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width); + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color); + gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), fill_color); gl_debug (DEBUG_XML, "END"); } @@ -434,7 +433,8 @@ xml04_parse_barcode_props (xmlNodePtr node, if (scale == 0.0) { scale = 0.5; /* Set to a valid value */ } - gl_label_barcode_set_props (object, style, text_flag, color, scale); + gl_label_barcode_set_props (object, style, text_flag, TRUE); + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), color); child = node->xmlChildrenNode; text_node = g_new0 (glTextNode, 1); diff --git a/glabels2/src/xml-label-191.c b/glabels2/src/xml-label-191.c index bbffde84..bbf1dc19 100644 --- a/glabels2/src/xml-label-191.c +++ b/glabels2/src/xml-label-191.c @@ -340,10 +340,12 @@ xml191_parse_text_props (xmlNodePtr object_node, gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); gl_label_text_set_lines (GL_LABEL_TEXT(object), lines); - gl_label_text_set_props (GL_LABEL_TEXT(object), - font_family, font_size, font_weight, - font_italic_flag, - color, just); + gl_label_object_set_font_family (GL_LABEL_OBJECT(object), font_family); + gl_label_object_set_font_size (GL_LABEL_OBJECT(object), font_size); + gl_label_object_set_font_weight (GL_LABEL_OBJECT(object), font_weight); + gl_label_object_set_font_italic_flag (GL_LABEL_OBJECT(object), font_italic_flag); + gl_label_object_set_text_color (GL_LABEL_OBJECT(object), color); + gl_label_object_set_text_alignment (GL_LABEL_OBJECT(object), just); gl_text_node_lines_free (&lines); g_free (font_family); @@ -378,9 +380,9 @@ xml191_parse_box_props (xmlNodePtr node, fill_color = gl_xml_get_prop_uint (node, "fill_color", 0); gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); - gl_label_box_set_line_width (GL_LABEL_BOX(object), line_width); - gl_label_box_set_line_color (GL_LABEL_BOX(object), line_color); - gl_label_box_set_fill_color (GL_LABEL_BOX(object), fill_color); + gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width); + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color); + gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), fill_color); gl_debug (DEBUG_XML, "END"); @@ -411,8 +413,8 @@ xml191_parse_line_props (xmlNodePtr node, line_color = gl_xml_get_prop_uint (node, "line_color", 0); gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); - gl_label_line_set_line_width (GL_LABEL_LINE(object), line_width); - gl_label_line_set_line_color (GL_LABEL_LINE(object), line_color); + gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width); + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color); gl_debug (DEBUG_XML, "END"); @@ -444,9 +446,9 @@ xml191_parse_ellipse_props (xmlNodePtr node, fill_color = gl_xml_get_prop_uint (node, "fill_color", 0); gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); - gl_label_ellipse_set_line_width (GL_LABEL_ELLIPSE(object), line_width); - gl_label_ellipse_set_line_color (GL_LABEL_ELLIPSE(object), line_color); - gl_label_ellipse_set_fill_color (GL_LABEL_ELLIPSE(object), fill_color); + gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width); + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color); + gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), fill_color); gl_debug (DEBUG_XML, "END"); @@ -545,7 +547,8 @@ xml191_parse_barcode_props (xmlNodePtr node, gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node); gl_label_barcode_set_props (GL_LABEL_BARCODE(object), - style, text_flag, checksum_flag, color); + style, text_flag, checksum_flag); + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), color); gl_text_node_free (&text_node); diff --git a/glabels2/src/xml-label.c b/glabels2/src/xml-label.c index 21c19d77..849a74b4 100644 --- a/glabels2/src/xml-label.c +++ b/glabels2/src/xml-label.c @@ -484,12 +484,12 @@ xml_parse_object_box (xmlNodePtr node, /* line attrs */ line_width = gl_xml_get_prop_length (node, "line_width", 1.0); line_color = gl_xml_get_prop_uint (node, "line_color", 0); - gl_label_box_set_line_width (GL_LABEL_BOX(object), line_width); - gl_label_box_set_line_color (GL_LABEL_BOX(object), line_color); + gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width); + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color); /* fill attrs */ fill_color = gl_xml_get_prop_uint (node, "fill_color", 0); - gl_label_box_set_fill_color (GL_LABEL_BOX(object), fill_color); + gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), fill_color); /* affine attrs */ affine[0] = gl_xml_get_prop_double (node, "a0", 0.0); @@ -534,12 +534,12 @@ xml_parse_object_ellipse (xmlNodePtr node, /* line attrs */ line_width = gl_xml_get_prop_length (node, "line_width", 1.0); line_color = gl_xml_get_prop_uint (node, "line_color", 0); - gl_label_ellipse_set_line_width (GL_LABEL_ELLIPSE(object), line_width); - gl_label_ellipse_set_line_color (GL_LABEL_ELLIPSE(object), line_color); + gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width); + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color); /* fill attrs */ fill_color = gl_xml_get_prop_uint (node, "fill_color", 0); - gl_label_ellipse_set_fill_color (GL_LABEL_ELLIPSE(object), fill_color); + gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), fill_color); /* affine attrs */ affine[0] = gl_xml_get_prop_double (node, "a0", 0.0); @@ -584,8 +584,8 @@ xml_parse_object_line (xmlNodePtr node, /* line attrs */ line_width = gl_xml_get_prop_length (node, "line_width", 1.0); line_color = gl_xml_get_prop_uint (node, "line_color", 0); - gl_label_line_set_line_width (GL_LABEL_LINE(object), line_width); - gl_label_line_set_line_color (GL_LABEL_LINE(object), line_color); + gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width); + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color); /* affine attrs */ affine[0] = gl_xml_get_prop_double (node, "a0", 0.0); @@ -700,7 +700,8 @@ xml_parse_object_barcode (xmlNodePtr node, checksum_flag = gl_xml_get_prop_boolean (node, "checksum", TRUE); color = gl_xml_get_prop_uint (node, "color", 0); gl_label_barcode_set_props (GL_LABEL_BARCODE(object), - style, text_flag, checksum_flag, color); + style, text_flag, checksum_flag); + gl_label_object_set_line_color (GL_LABEL_OBJECT(object), color); /* data or field attr */ string = xmlGetProp (node, "data"); @@ -1105,7 +1106,7 @@ xml_create_object_text (xmlNodePtr root, gl_xml_set_prop_length (node, "h", h); /* justify attr */ - just = gl_label_text_get_text_alignment (GL_LABEL_TEXT(object)); + just = gl_label_object_get_text_alignment (object); xmlSetProp (node, "justify", gl_util_just_to_string (just)); /* affine attrs */ @@ -1153,13 +1154,13 @@ xml_create_object_box (xmlNodePtr root, gl_xml_set_prop_length (node, "h", h); /* line attrs */ - line_width = gl_label_box_get_line_width (GL_LABEL_BOX(object)); - line_color = gl_label_box_get_line_color (GL_LABEL_BOX(object)); + line_width = gl_label_object_get_line_width (GL_LABEL_OBJECT(object)); + line_color = gl_label_object_get_line_color (GL_LABEL_OBJECT(object)); gl_xml_set_prop_length (node, "line_width", line_width); gl_xml_set_prop_uint_hex (node, "line_color", line_color); /* fill attrs */ - fill_color = gl_label_box_get_fill_color (GL_LABEL_BOX(object)); + fill_color = gl_label_object_get_fill_color (GL_LABEL_OBJECT(object)); gl_xml_set_prop_uint_hex (node, "fill_color", fill_color); /* affine attrs */ @@ -1204,13 +1205,13 @@ xml_create_object_ellipse (xmlNodePtr root, gl_xml_set_prop_length (node, "h", h); /* line attrs */ - line_width = gl_label_ellipse_get_line_width (GL_LABEL_ELLIPSE(object)); - line_color = gl_label_ellipse_get_line_color (GL_LABEL_ELLIPSE(object)); + line_width = gl_label_object_get_line_width (GL_LABEL_OBJECT(object)); + line_color = gl_label_object_get_line_color (GL_LABEL_OBJECT(object)); gl_xml_set_prop_length (node, "line_width", line_width); gl_xml_set_prop_uint_hex (node, "line_color", line_color); /* fill attrs */ - fill_color = gl_label_ellipse_get_fill_color (GL_LABEL_ELLIPSE(object)); + fill_color = gl_label_object_get_fill_color (GL_LABEL_OBJECT(object)); gl_xml_set_prop_uint_hex (node, "fill_color", fill_color); /* affine attrs */ @@ -1255,8 +1256,8 @@ xml_create_object_line (xmlNodePtr root, gl_xml_set_prop_length (node, "dy", dy); /* line attrs */ - line_width = gl_label_line_get_line_width (GL_LABEL_LINE(object)); - line_color = gl_label_line_get_line_color (GL_LABEL_LINE(object)); + line_width = gl_label_object_get_line_width (GL_LABEL_OBJECT(object)); + line_color = gl_label_object_get_line_color (GL_LABEL_OBJECT(object)); gl_xml_set_prop_length (node, "line_width", line_width); gl_xml_set_prop_uint_hex (node, "line_color", line_color); @@ -1355,7 +1356,8 @@ xml_create_object_barcode (xmlNodePtr root, /* Barcode properties attrs */ gl_label_barcode_get_props (GL_LABEL_BARCODE(object), - &style, &text_flag, &checksum_flag, &color); + &style, &text_flag, &checksum_flag); + color = gl_label_object_get_line_color (GL_LABEL_OBJECT(object)); xmlSetProp (node, "style", gl_barcode_style_to_text (style)); gl_xml_set_prop_boolean (node, "text", text_flag); gl_xml_set_prop_boolean (node, "checksum", checksum_flag); @@ -1509,10 +1511,12 @@ xml_create_toplevel_span (xmlNodePtr root, node = xmlNewChild (root, ns, "Span", NULL); /* All span attrs at top level. */ - gl_label_text_get_props (GL_LABEL_TEXT(object_text), - &font_family, &font_size, &font_weight, - &font_italic_flag, - &color, &just); + font_family = gl_label_object_get_font_family (GL_LABEL_OBJECT(object_text)); + font_size = gl_label_object_get_font_size (GL_LABEL_OBJECT(object_text)); + font_weight = gl_label_object_get_font_weight (GL_LABEL_OBJECT(object_text)); + font_italic_flag = gl_label_object_get_font_italic_flag (GL_LABEL_OBJECT(object_text)); + color = gl_label_object_get_text_color (GL_LABEL_OBJECT(object_text)); + just = gl_label_object_get_text_alignment (GL_LABEL_OBJECT(object_text)); xmlSetProp (node, "font_family", font_family); gl_xml_set_prop_double (node, "font_size", font_size); xmlSetProp (node, "font_weight", gl_util_weight_to_string (font_weight));