[glabels] Some coding style cleanup.
- From: Jim Evins <jimevins src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glabels] Some coding style cleanup.
- Date: Sun, 19 Dec 2010 19:11:05 +0000 (UTC)
commit 4f37ea189b9cc80ef25d608c024273a345970722
Author: Jim Evins <evins snaught com>
Date: Sun Dec 19 14:10:22 2010 -0500
Some coding style cleanup.
libglabels/lgl-template.h | 4 +-
libglabels/lgl-units.h | 2 +-
libglbarcode/lgl-barcode-render-to-cairo.c | 6 +-
libglbarcode/lgl-barcode.h | 2 +-
src/bc-builtin.c | 50 +-
src/bc-gnubarcode.c | 775 ++++++++++++++++------------
src/bc-iec16022.c | 21 +-
src/bc-iec18004.c | 31 +-
src/bc-zint.c | 215 ++++----
src/color-combo-button.c | 2 +-
src/color-combo-color-menu-item.c | 2 +-
src/color-combo-menu.c | 2 +-
src/color-combo.c | 2 +-
src/color-history-model.c | 2 +-
src/color-swatch.c | 2 +-
src/debug.h | 2 +-
src/field-button-menu.c | 2 +-
src/field-button.c | 2 +-
src/font-combo-menu-item.c | 2 +-
src/font-combo-menu.c | 2 +-
src/font-combo.c | 2 +-
src/font-history-model.c | 2 +-
src/font-sample.c | 2 +-
src/label-barcode.c | 2 +-
src/label-box.c | 2 +-
src/label-ellipse.c | 2 +-
src/label-image.c | 2 +-
src/label-line.c | 2 +-
src/label-object.c | 2 +-
src/label-object.h | 2 +-
src/label-text.c | 2 +-
src/label.c | 2 +-
src/media-select.c | 4 +-
src/merge-evolution.c | 38 +-
src/merge-properties-dialog.c | 2 +-
src/merge-text.c | 4 +-
src/merge-vcard.c | 23 +-
src/merge.c | 2 +-
src/merge.h | 2 +-
src/message-bar.c | 2 +-
src/mini-label-preview.c | 2 +-
src/mini-preview.c | 4 +-
src/new-label-dialog.c | 2 +-
src/object-editor.c | 2 +-
src/prefs-dialog.c | 8 +-
src/prefs-model.c | 6 +-
src/print-op-dialog.c | 4 +-
src/print-op.c | 2 +-
src/print.c | 5 +-
src/template-designer.c | 2 +-
src/template-history-model.c | 2 +-
src/ui-property-bar.c | 14 +-
src/ui-sidebar.c | 2 +-
src/view.c | 4 +-
src/view.h | 2 +-
src/wdgt-chain-button.c | 11 +-
src/window.c | 2 +-
src/xml-label.h | 2 +-
58 files changed, 708 insertions(+), 597 deletions(-)
---
diff --git a/libglabels/lgl-template.h b/libglabels/lgl-template.h
index 83c8f0a..b475f2b 100644
--- a/libglabels/lgl-template.h
+++ b/libglabels/lgl-template.h
@@ -79,7 +79,7 @@ typedef enum {
LGL_TEMPLATE_FRAME_SHAPE_RECT,
LGL_TEMPLATE_FRAME_SHAPE_ELLIPSE,
LGL_TEMPLATE_FRAME_SHAPE_ROUND,
- LGL_TEMPLATE_FRAME_SHAPE_CD,
+ LGL_TEMPLATE_FRAME_SHAPE_CD
} lglTemplateFrameShape;
@@ -197,7 +197,7 @@ typedef enum {
LGL_TEMPLATE_MARKUP_LINE,
LGL_TEMPLATE_MARKUP_CIRCLE,
LGL_TEMPLATE_MARKUP_RECT,
- LGL_TEMPLATE_MARKUP_ELLIPSE,
+ LGL_TEMPLATE_MARKUP_ELLIPSE
} lglTemplateMarkupType;
diff --git a/libglabels/lgl-units.h b/libglabels/lgl-units.h
index 617f865..e3b2beb 100644
--- a/libglabels/lgl-units.h
+++ b/libglabels/lgl-units.h
@@ -39,7 +39,7 @@ typedef enum {
LGL_UNITS_FIRST = LGL_UNITS_POINT,
LGL_UNITS_LAST = LGL_UNITS_PICA,
- LGL_UNITS_INVALID = -1,
+ LGL_UNITS_INVALID = -1
} lglUnits;
diff --git a/libglbarcode/lgl-barcode-render-to-cairo.c b/libglbarcode/lgl-barcode-render-to-cairo.c
index 530c55f..e83175d 100644
--- a/libglbarcode/lgl-barcode-render-to-cairo.c
+++ b/libglbarcode/lgl-barcode-render-to-cairo.c
@@ -163,7 +163,7 @@ lgl_barcode_render_to_cairo (const lglBarcode *bc,
case LGL_BARCODE_SHAPE_RING:
ring = (lglBarcodeShapeRing *) shape;
- cairo_arc (cr, ring->x, ring->y, ring->radius, 0.0, 2 * M_PI);
+ cairo_arc (cr, ring->x, ring->y, ring->radius, 0.0, 2 * G_PI);
cairo_set_line_width (cr, ring->line_width);
cairo_stroke (cr);
@@ -305,10 +305,10 @@ lgl_barcode_render_to_cairo_path (const lglBarcode *bc,
ring = (lglBarcodeShapeRing *) shape;
cairo_new_sub_path (cr);
- cairo_arc (cr, ring->x, ring->y, ring->radius + ring->line_width/2, 0.0, 2 * M_PI);
+ cairo_arc (cr, ring->x, ring->y, ring->radius + ring->line_width/2, 0.0, 2 * G_PI);
cairo_close_path (cr);
cairo_new_sub_path (cr);
- cairo_arc (cr, ring->x, ring->y, ring->radius - ring->line_width/2, 0.0, 2 * M_PI);
+ cairo_arc (cr, ring->x, ring->y, ring->radius - ring->line_width/2, 0.0, 2 * G_PI);
cairo_close_path (cr);
break;
diff --git a/libglbarcode/lgl-barcode.h b/libglbarcode/lgl-barcode.h
index 02177d2..f94b265 100644
--- a/libglbarcode/lgl-barcode.h
+++ b/libglbarcode/lgl-barcode.h
@@ -107,7 +107,7 @@ typedef enum {
LGL_BARCODE_SHAPE_CHAR,
LGL_BARCODE_SHAPE_STRING,
LGL_BARCODE_SHAPE_RING,
- LGL_BARCODE_SHAPE_HEXAGON,
+ LGL_BARCODE_SHAPE_HEXAGON
} lglBarcodeShapeType;
diff --git a/src/bc-builtin.c b/src/bc-builtin.c
index e50ebc8..5b7fe5f 100644
--- a/src/bc-builtin.c
+++ b/src/bc-builtin.c
@@ -50,36 +50,44 @@
/****************************************************************************/
lglBarcode *
gl_barcode_builtin_new (const gchar *id,
- gboolean text_flag,
- gboolean checksum_flag,
- gdouble w,
- gdouble h,
- const gchar *digits)
+ gboolean text_flag,
+ gboolean checksum_flag,
+ gdouble w,
+ gdouble h,
+ const gchar *digits)
{
- if ( (g_ascii_strcasecmp (id, "POSTNET") == 0) ) {
+ if ( (g_ascii_strcasecmp (id, "POSTNET") == 0) )
+ {
return lgl_barcode_create (LGL_BARCODE_TYPE_POSTNET, text_flag, checksum_flag, w, h, digits);
- }
- if ( (g_ascii_strcasecmp (id, "POSTNET-5") == 0) ) {
+ }
+ if ( (g_ascii_strcasecmp (id, "POSTNET-5") == 0) )
+ {
return lgl_barcode_create (LGL_BARCODE_TYPE_POSTNET_5, text_flag, checksum_flag, w, h, digits);
- }
- if ( (g_ascii_strcasecmp (id, "POSTNET-9") == 0) ) {
+ }
+ if ( (g_ascii_strcasecmp (id, "POSTNET-9") == 0) )
+ {
return lgl_barcode_create (LGL_BARCODE_TYPE_POSTNET_9, text_flag, checksum_flag, w, h, digits);
- }
- if ( (g_ascii_strcasecmp (id, "POSTNET-11") == 0) ) {
+ }
+ if ( (g_ascii_strcasecmp (id, "POSTNET-11") == 0) )
+ {
return lgl_barcode_create (LGL_BARCODE_TYPE_POSTNET_11, text_flag, checksum_flag, w, h, digits);
- }
- if ( (g_ascii_strcasecmp (id, "CEPNET") == 0) ) {
+ }
+ if ( (g_ascii_strcasecmp (id, "CEPNET") == 0) )
+ {
return lgl_barcode_create (LGL_BARCODE_TYPE_CEPNET, text_flag, checksum_flag, w, h, digits);
- }
- if ( (g_ascii_strcasecmp (id, "ONECODE") == 0) ) {
+ }
+ if ( (g_ascii_strcasecmp (id, "ONECODE") == 0) )
+ {
return lgl_barcode_create (LGL_BARCODE_TYPE_ONECODE, text_flag, checksum_flag, w, h, digits);
- }
- if ( (g_ascii_strcasecmp (id, "Code39") == 0) ) {
+ }
+ if ( (g_ascii_strcasecmp (id, "Code39") == 0) )
+ {
return lgl_barcode_create (LGL_BARCODE_TYPE_CODE39, text_flag, checksum_flag, w, h, digits);
- }
- if ( (g_ascii_strcasecmp (id, "Code39Ext") == 0) ) {
+ }
+ if ( (g_ascii_strcasecmp (id, "Code39Ext") == 0) )
+ {
return lgl_barcode_create (LGL_BARCODE_TYPE_CODE39_EXT, text_flag, checksum_flag, w, h, digits);
- }
+ }
g_message ("Invalid builtin barcode ID: \"%s\"\n", id);
return NULL;
diff --git a/src/bc-gnubarcode.c b/src/bc-gnubarcode.c
index 88b9e28..f3be2a3 100644
--- a/src/bc-gnubarcode.c
+++ b/src/bc-gnubarcode.c
@@ -35,8 +35,8 @@
/*========================================================*/
/* Private macros and constants. */
/*========================================================*/
-#define SHRINK_AMOUNT 0.15 /* shrink bars to account for ink spreading */
-#define FONT_SCALE 0.95 /* Shrink fonts just a hair */
+#define SHRINK_AMOUNT 0.15 /* shrink bars to account for ink spreading */
+#define FONT_SCALE 0.95 /* Shrink fonts just a hair */
/*===========================================*/
@@ -46,16 +46,16 @@ static lglBarcode *render_pass1 (struct Barcode_Item *bci,
gint flags);
static gboolean is_length_valid (const gchar *digits,
- gint n1,
- gint n2);
+ gint n1,
+ gint n2);
static gboolean is_length1_valid (const gchar *digits,
- gint n1,
- gint n2);
+ gint n1,
+ gint n2);
static gboolean is_length2_valid (const gchar *digits,
- gint n1,
- gint n2);
+ gint n1,
+ gint n2);
/*****************************************************************************/
@@ -63,141 +63,209 @@ static gboolean is_length2_valid (const gchar *digits,
/*****************************************************************************/
lglBarcode *
gl_barcode_gnubarcode_new (const gchar *id,
- gboolean text_flag,
- gboolean checksum_flag,
- gdouble w,
- gdouble h,
- const gchar *digits)
+ gboolean text_flag,
+ gboolean checksum_flag,
+ gdouble w,
+ gdouble h,
+ const gchar *digits)
{
- lglBarcode *gbc;
- struct Barcode_Item *bci;
- gint flags;
-
- /* Assign type flag. Pre-filter by length for subtypes. */
- if (g_ascii_strcasecmp (id, "EAN") == 0) {
- flags = BARCODE_EAN;
- } else if (g_ascii_strcasecmp (id, "EAN-8") == 0) {
- if (!is_length_valid (digits, 7, 8)) {
- return NULL;
- }
- flags = BARCODE_EAN;
- } else if (g_ascii_strcasecmp (id, "EAN-8+2") == 0) {
- if (!is_length1_valid (digits, 7, 8) || !is_length2_valid (digits, 2, 2)) {
- return NULL;
- }
- flags = BARCODE_EAN;
- } else if (g_ascii_strcasecmp (id, "EAN-8+5") == 0) {
- if (!is_length1_valid (digits, 7, 8) || !is_length2_valid (digits, 5, 5)) {
- return NULL;
- }
- flags = BARCODE_EAN;
- } else if (g_ascii_strcasecmp (id, "EAN-13") == 0) {
- if (!is_length_valid (digits, 12, 13)) {
- return NULL;
- }
- flags = BARCODE_EAN;
- } else if (g_ascii_strcasecmp (id, "EAN-13+2") == 0) {
- if (!is_length1_valid (digits, 12,13) || !is_length2_valid (digits, 2,2)) {
- return NULL;
- }
- flags = BARCODE_EAN;
- } else if (g_ascii_strcasecmp (id, "EAN-13+5") == 0) {
- if (!is_length1_valid (digits, 12,13) || !is_length2_valid (digits, 5,5)) {
- return NULL;
- }
- flags = BARCODE_EAN;
- } else if (g_ascii_strcasecmp (id, "UPC") == 0) {
- flags = BARCODE_UPC;
- } else if (g_ascii_strcasecmp (id, "UPC-A") == 0) {
- if (!is_length_valid (digits, 11, 12)) {
- return NULL;
- }
- flags = BARCODE_UPC;
- } else if (g_ascii_strcasecmp (id, "UPC-A+2") == 0) {
- if (!is_length1_valid (digits, 11,12) || !is_length2_valid (digits, 2,2)) {
- return NULL;
- }
- flags = BARCODE_UPC;
- } else if (g_ascii_strcasecmp (id, "UPC-A+5") == 0) {
- if (!is_length1_valid (digits, 11,12) || !is_length2_valid (digits, 5,5)) {
- return NULL;
- }
- flags = BARCODE_UPC;
- } else if (g_ascii_strcasecmp (id, "UPC-E") == 0) {
- if (!is_length_valid (digits, 6, 8)) {
- return NULL;
- }
- flags = BARCODE_UPC;
- } else if (g_ascii_strcasecmp (id, "UPC-E+2") == 0) {
- if (!is_length1_valid (digits, 6, 8) || !is_length2_valid (digits, 2,2)) {
- return NULL;
- }
- flags = BARCODE_UPC;
- } else if (g_ascii_strcasecmp (id, "UPC-E+5") == 0) {
- if (!is_length1_valid (digits, 6, 8) || !is_length2_valid (digits, 5,5)) {
- return NULL;
- }
- flags = BARCODE_UPC;
- } else if (g_ascii_strcasecmp (id, "ISBN") == 0) {
- if (!is_length_valid (digits, 9, 10)) {
- return NULL;
- }
- flags = BARCODE_ISBN;
- } else if (g_ascii_strcasecmp (id, "ISBN+5") == 0) {
- if (!is_length1_valid (digits, 9, 10) || !is_length2_valid (digits, 5,5)) {
- return NULL;
- }
- flags = BARCODE_ISBN;
- } else if (g_ascii_strcasecmp (id, "Code39") == 0) {
- flags = BARCODE_39;
- } else if (g_ascii_strcasecmp (id, "Code128") == 0) {
- flags = BARCODE_128;
- } else if (g_ascii_strcasecmp (id, "Code128C") == 0) {
- flags = BARCODE_128C;
- } else if (g_ascii_strcasecmp (id, "Code128B") == 0) {
- flags = BARCODE_128B;
- } else if (g_ascii_strcasecmp (id, "I25") == 0) {
- flags = BARCODE_I25;
- } else if (g_ascii_strcasecmp (id, "CBR") == 0) {
- flags = BARCODE_CBR;
- } else if (g_ascii_strcasecmp (id, "MSI") == 0) {
- flags = BARCODE_MSI;
- } else if (g_ascii_strcasecmp (id, "PLS") == 0) {
- flags = BARCODE_PLS;
- } else if (g_ascii_strcasecmp (id, "Code93") == 0) {
- flags = BARCODE_93;
- } else {
- g_message( "Illegal barcode id %s", id );
- flags = BARCODE_ANY;
- }
-
-
- bci = Barcode_Create ((char *)digits);
-
- /* First encode using GNU Barcode library */
- if (!text_flag) {
- flags |= BARCODE_NO_ASCII;
- }
- if (!checksum_flag) {
- flags |= BARCODE_NO_CHECKSUM;
- }
-
- bci->scalef = 0.0;
- bci->width = w;
- bci->height = h;
-
- Barcode_Encode (bci, flags);
- if (!bci->partial || !bci->textinfo) {
- Barcode_Delete (bci);
- return NULL;
- }
-
- /* now render with our custom back-end,
- to create appropriate intermdediate format */
- gbc = render_pass1 (bci, flags);
-
- Barcode_Delete (bci);
- return gbc;
+ lglBarcode *gbc;
+ struct Barcode_Item *bci;
+ gint flags;
+
+ /* Assign type flag. Pre-filter by length for subtypes. */
+ if (g_ascii_strcasecmp (id, "EAN") == 0)
+ {
+ flags = BARCODE_EAN;
+ }
+ else if (g_ascii_strcasecmp (id, "EAN-8") == 0)
+ {
+ if (!is_length_valid (digits, 7, 8))
+ {
+ return NULL;
+ }
+ flags = BARCODE_EAN;
+ }
+ else if (g_ascii_strcasecmp (id, "EAN-8+2") == 0)
+ {
+ if (!is_length1_valid (digits, 7, 8) || !is_length2_valid (digits, 2, 2))
+ {
+ return NULL;
+ }
+ flags = BARCODE_EAN;
+ }
+ else if (g_ascii_strcasecmp (id, "EAN-8+5") == 0)
+ {
+ if (!is_length1_valid (digits, 7, 8) || !is_length2_valid (digits, 5, 5))
+ {
+ return NULL;
+ }
+ flags = BARCODE_EAN;
+ }
+ else if (g_ascii_strcasecmp (id, "EAN-13") == 0)
+ {
+ if (!is_length_valid (digits, 12, 13))
+ {
+ return NULL;
+ }
+ flags = BARCODE_EAN;
+ }
+ else if (g_ascii_strcasecmp (id, "EAN-13+2") == 0)
+ {
+ if (!is_length1_valid (digits, 12,13) || !is_length2_valid (digits, 2,2))
+ {
+ return NULL;
+ }
+ flags = BARCODE_EAN;
+ }
+ else if (g_ascii_strcasecmp (id, "EAN-13+5") == 0)
+ {
+ if (!is_length1_valid (digits, 12,13) || !is_length2_valid (digits, 5,5))
+ {
+ return NULL;
+ }
+ flags = BARCODE_EAN;
+ }
+ else if (g_ascii_strcasecmp (id, "UPC") == 0)
+ {
+ flags = BARCODE_UPC;
+ }
+ else if (g_ascii_strcasecmp (id, "UPC-A") == 0)
+ {
+ if (!is_length_valid (digits, 11, 12))
+ {
+ return NULL;
+ }
+ flags = BARCODE_UPC;
+ }
+ else if (g_ascii_strcasecmp (id, "UPC-A+2") == 0)
+ {
+ if (!is_length1_valid (digits, 11,12) || !is_length2_valid (digits, 2,2))
+ {
+ return NULL;
+ }
+ flags = BARCODE_UPC;
+ }
+ else if (g_ascii_strcasecmp (id, "UPC-A+5") == 0)
+ {
+ if (!is_length1_valid (digits, 11,12) || !is_length2_valid (digits, 5,5))
+ {
+ return NULL;
+ }
+ flags = BARCODE_UPC;
+ }
+ else if (g_ascii_strcasecmp (id, "UPC-E") == 0)
+ {
+ if (!is_length_valid (digits, 6, 8))
+ {
+ return NULL;
+ }
+ flags = BARCODE_UPC;
+ }
+ else if (g_ascii_strcasecmp (id, "UPC-E+2") == 0)
+ {
+ if (!is_length1_valid (digits, 6, 8) || !is_length2_valid (digits, 2,2))
+ {
+ return NULL;
+ }
+ flags = BARCODE_UPC;
+ }
+ else if (g_ascii_strcasecmp (id, "UPC-E+5") == 0)
+ {
+ if (!is_length1_valid (digits, 6, 8) || !is_length2_valid (digits, 5,5))
+ {
+ return NULL;
+ }
+ flags = BARCODE_UPC;
+ }
+ else if (g_ascii_strcasecmp (id, "ISBN") == 0)
+ {
+ if (!is_length_valid (digits, 9, 10))
+ {
+ return NULL;
+ }
+ flags = BARCODE_ISBN;
+ }
+ else if (g_ascii_strcasecmp (id, "ISBN+5") == 0)
+ {
+ if (!is_length1_valid (digits, 9, 10) || !is_length2_valid (digits, 5,5))
+ {
+ return NULL;
+ }
+ flags = BARCODE_ISBN;
+ }
+ else if (g_ascii_strcasecmp (id, "Code39") == 0)
+ {
+ flags = BARCODE_39;
+ }
+ else if (g_ascii_strcasecmp (id, "Code128") == 0)
+ {
+ flags = BARCODE_128;
+ }
+ else if (g_ascii_strcasecmp (id, "Code128C") == 0)
+ {
+ flags = BARCODE_128C;
+ }
+ else if (g_ascii_strcasecmp (id, "Code128B") == 0)
+ {
+ flags = BARCODE_128B;
+ }
+ else if (g_ascii_strcasecmp (id, "I25") == 0)
+ {
+ flags = BARCODE_I25;
+ }
+ else if (g_ascii_strcasecmp (id, "CBR") == 0)
+ {
+ flags = BARCODE_CBR;
+ }
+ else if (g_ascii_strcasecmp (id, "MSI") == 0)
+ {
+ flags = BARCODE_MSI;
+ }
+ else if (g_ascii_strcasecmp (id, "PLS") == 0)
+ {
+ flags = BARCODE_PLS;
+ }
+ else if (g_ascii_strcasecmp (id, "Code93") == 0)
+ {
+ flags = BARCODE_93;
+ }
+ else
+ {
+ g_message( "Illegal barcode id %s", id );
+ flags = BARCODE_ANY;
+ }
+
+
+ bci = Barcode_Create ((char *)digits);
+
+ /* First encode using GNU Barcode library */
+ if (!text_flag)
+ {
+ flags |= BARCODE_NO_ASCII;
+ }
+ if (!checksum_flag)
+ {
+ flags |= BARCODE_NO_CHECKSUM;
+ }
+
+ bci->scalef = 0.0;
+ bci->width = w;
+ bci->height = h;
+
+ Barcode_Encode (bci, flags);
+ if (!bci->partial || !bci->textinfo)
+ {
+ Barcode_Delete (bci);
+ return NULL;
+ }
+
+ /* now render with our custom back-end,
+ to create appropriate intermdediate format */
+ gbc = render_pass1 (bci, flags);
+
+ Barcode_Delete (bci);
+ return gbc;
}
@@ -213,143 +281,188 @@ gl_barcode_gnubarcode_new (const gchar *id,
*--------------------------------------------------------------------------*/
static lglBarcode *
render_pass1 (struct Barcode_Item *bci,
- gint flags)
+ gint flags)
{
- gint validbits = BARCODE_NO_ASCII;
- lglBarcode *gbc;
- gdouble scalef = 1.0;
- gdouble x;
- gint i, j, barlen;
- gdouble f1, f2;
- gint mode = '-'; /* text below bars */
- gdouble x0, y0, yr;
- gchar *p, c;
-
- if (bci->width > (2*bci->margin)) {
- bci->width -= 2*bci->margin;
- }
- if (bci->height > (2*bci->margin)) {
- bci->height -= 2*bci->margin;
- }
-
- /* If any flag is clear in "flags", inherit it from "bci->flags" */
- if (!(flags & BARCODE_NO_ASCII)) {
- flags |= bci->flags & BARCODE_NO_ASCII;
- }
- flags = bci->flags = (flags & validbits) | (bci->flags & ~validbits);
-
- /* First calculate barlen */
- barlen = bci->partial[0] - '0';
- for (p = bci->partial + 1; *p != 0; p++) {
- if (isdigit (*p)) {
- barlen += *p - '0';
- } else {
- if ((*p != '+') && (*p != '-')) {
- barlen += *p - 'a' + 1;
- }
- }
- }
-
- /* The scale factor depends on bar length */
- if (!bci->scalef) {
- if (!bci->width) bci->width = barlen; /* default */
- scalef = bci->scalef = (double)bci->width / (double)barlen;
- if (scalef < 0.5) scalef = 0.5;
- }
-
- /* The width defaults to "just enough" */
- bci->width = barlen * scalef + 1;
-
- /* But it can be too small, in this case enlarge and center the area */
- if (bci->width < barlen * scalef) {
- int wid = barlen * scalef + 1;
- bci->xoff -= (wid - bci->width)/2 ;
- bci->width = wid;
- /* Can't extend too far on the left */
- if (bci->xoff < 0) {
- bci->width += -bci->xoff;
- bci->xoff = 0;
- }
- }
-
- /* The height defaults to 80 points (rescaled) */
- if (!bci->height)
- bci->height = 80 * scalef;
-
- /* If too small (5 + text), reduce the scale factor and center */
- i = 5 + 10 * ((bci->flags & BARCODE_NO_ASCII)==0);
- if (bci->height < i * scalef ) {
- bci->height = i * scalef;
- }
-
- gbc = lgl_barcode_new ();
-
- /* Now traverse the code string and create a list of lines */
- x = bci->margin + (bci->partial[0] - '0') * scalef;
- for (p = bci->partial + 1, i = 1; *p != 0; p++, i++) {
- /* special cases: '+' and '-' */
- if (*p == '+' || *p == '-') {
- mode = *p; /* don't count it */
- i++;
- continue;
- }
- /* j is the width of this bar/space */
- if (isdigit (*p))
- j = *p - '0';
- else
- j = *p - 'a' + 1;
- if (i % 2) { /* bar */
- x0 = x + (j * scalef) / 2;
- y0 = bci->margin;
- yr = bci->height;
- if (!(bci->flags & BARCODE_NO_ASCII)) { /* leave space for text */
- if (mode == '-') {
- /* text below bars: 10 or 5 points */
- yr -= (isdigit (*p) ? 10 : 5) * scalef;
- } else { /* '+' */
- /* above bars: 10 or 0 from bottom,
- and 10 from top */
- y0 += 10 * scalef;
- yr -= (isdigit (*p) ? 20 : 10) * scalef;
- }
- }
+ gint validbits = BARCODE_NO_ASCII;
+ lglBarcode *gbc;
+ gdouble scalef = 1.0;
+ gdouble x;
+ gint i, j, barlen;
+ gdouble f1, f2;
+ gint mode = '-'; /* text below bars */
+ gdouble x0, y0, yr;
+ gchar *p, c;
+
+ if (bci->width > (2*bci->margin))
+ {
+ bci->width -= 2*bci->margin;
+ }
+ if (bci->height > (2*bci->margin))
+ {
+ bci->height -= 2*bci->margin;
+ }
+
+ /* If any flag is clear in "flags", inherit it from "bci->flags" */
+ if (!(flags & BARCODE_NO_ASCII))
+ {
+ flags |= bci->flags & BARCODE_NO_ASCII;
+ }
+ flags = bci->flags = (flags & validbits) | (bci->flags & ~validbits);
+
+ /* First calculate barlen */
+ barlen = bci->partial[0] - '0';
+ for (p = bci->partial + 1; *p != 0; p++)
+ {
+ if (isdigit (*p))
+ {
+ barlen += *p - '0';
+ }
+ else
+ {
+ if ((*p != '+') && (*p != '-'))
+ {
+ barlen += *p - 'a' + 1;
+ }
+ }
+ }
+
+ /* The scale factor depends on bar length */
+ if (!bci->scalef)
+ {
+ if (!bci->width)
+ {
+ bci->width = barlen; /* default */
+ }
+ scalef = bci->scalef = (double)bci->width / (double)barlen;
+ if (scalef < 0.5)
+ {
+ scalef = 0.5;
+ }
+ }
+
+ /* The width defaults to "just enough" */
+ bci->width = barlen * scalef + 1;
+
+ /* But it can be too small, in this case enlarge and center the area */
+ if (bci->width < barlen * scalef)
+ {
+ int wid = barlen * scalef + 1;
+ bci->xoff -= (wid - bci->width)/2 ;
+ bci->width = wid;
+ /* Can't extend too far on the left */
+ if (bci->xoff < 0)
+ {
+ bci->width += -bci->xoff;
+ bci->xoff = 0;
+ }
+ }
+
+ /* The height defaults to 80 points (rescaled) */
+ if (!bci->height)
+ {
+ bci->height = 80 * scalef;
+ }
+
+ /* If too small (5 + text), reduce the scale factor and center */
+ i = 5 + 10 * ((bci->flags & BARCODE_NO_ASCII)==0);
+ if (bci->height < i * scalef )
+ {
+ bci->height = i * scalef;
+ }
+
+ gbc = lgl_barcode_new ();
+
+ /* Now traverse the code string and create a list of lines */
+ x = bci->margin + (bci->partial[0] - '0') * scalef;
+ for (p = bci->partial + 1, i = 1; *p != 0; p++, i++)
+ {
+ /* special cases: '+' and '-' */
+ if (*p == '+' || *p == '-')
+ {
+ mode = *p; /* don't count it */
+ i++;
+ continue;
+ }
+ /* j is the width of this bar/space */
+ if (isdigit (*p))
+ {
+ j = *p - '0';
+ }
+ else
+ {
+ j = *p - 'a' + 1;
+ }
+ if (i % 2)
+ {
+ /* bar */
+ x0 = x + (j * scalef) / 2;
+ y0 = bci->margin;
+ yr = bci->height;
+ if (!(bci->flags & BARCODE_NO_ASCII))
+ {
+ /* leave space for text */
+ if (mode == '-')
+ {
+ /* text below bars: 10 or 5 points */
+ yr -= (isdigit (*p) ? 10 : 5) * scalef;
+ }
+ else
+ {
+ /* '+' */
+ /* above bars: 10 or 0 from bottom,
+ and 10 from top */
+ y0 += 10 * scalef;
+ yr -= (isdigit (*p) ? 20 : 10) * scalef;
+ }
+ }
lgl_barcode_add_line (gbc, x0, y0, yr, (j * scalef) - SHRINK_AMOUNT);
- }
- x += j * scalef;
-
- }
-
- /* Now the text */
- mode = '-'; /* reinstantiate default */
- if (!(bci->flags & BARCODE_NO_ASCII)) {
- for (p = bci->textinfo; p; p = strchr (p, ' ')) {
- while (*p == ' ')
- p++;
- if (!*p)
- break;
- if (*p == '+' || *p == '-') {
- mode = *p;
- continue;
- }
- if (sscanf (p, "%lf:%lf:%c", &f1, &f2, &c) != 3) {
- g_message ("impossible data: %s", p);
- continue;
- }
- x0 = f1 * scalef + bci->margin;
- if (mode == '-') {
- y0 = bci->margin + bci->height - 8 * scalef;
- } else {
- y0 = bci->margin;
- }
+ }
+ x += j * scalef;
+
+ }
+
+ /* Now the text */
+ mode = '-'; /* reinstantiate default */
+ if (!(bci->flags & BARCODE_NO_ASCII))
+ {
+ for (p = bci->textinfo; p; p = strchr (p, ' '))
+ {
+ while (*p == ' ')
+ {
+ p++;
+ }
+ if (!*p)
+ {
+ break;
+ }
+ if (*p == '+' || *p == '-')
+ {
+ mode = *p;
+ continue;
+ }
+ if (sscanf (p, "%lf:%lf:%c", &f1, &f2, &c) != 3)
+ {
+ g_message ("impossible data: %s", p);
+ continue;
+ }
+ x0 = f1 * scalef + bci->margin;
+ if (mode == '-')
+ {
+ y0 = bci->margin + bci->height - 8 * scalef;
+ }
+ else
+ {
+ y0 = bci->margin;
+ }
lgl_barcode_add_char (gbc, x0, y0, (f2 * FONT_SCALE * scalef), c);
- }
- }
+ }
+ }
- /* Fill in other info */
- gbc->height = bci->height + 2.0 * bci->margin;
- gbc->width = bci->width + 2.0 * bci->margin;
+ /* Fill in other info */
+ gbc->height = bci->height + 2.0 * bci->margin;
+ gbc->width = bci->width + 2.0 * bci->margin;
- return gbc;
+ return gbc;
}
@@ -358,23 +471,26 @@ render_pass1 (struct Barcode_Item *bci,
/*--------------------------------------------------------------------------*/
static gboolean
is_length_valid (const gchar *digits,
- gint n1,
- gint n2)
+ gint n1,
+ gint n2)
{
- gchar *p;
- gint i;
-
- if (!digits) {
- return FALSE;
- }
-
- for (p = (gchar *)digits, i=0; *p != 0; p++) {
- if (g_ascii_isdigit (*p)) {
- i++;
- }
- }
-
- return (i >= n1) && (i <= n2);
+ gchar *p;
+ gint i;
+
+ if (!digits)
+ {
+ return FALSE;
+ }
+
+ for (p = (gchar *)digits, i=0; *p != 0; p++)
+ {
+ if (g_ascii_isdigit (*p))
+ {
+ i++;
+ }
+ }
+
+ return (i >= n1) && (i <= n2);
}
@@ -383,23 +499,26 @@ is_length_valid (const gchar *digits,
/*--------------------------------------------------------------------------*/
static gboolean
is_length1_valid (const gchar *digits,
- gint n1,
- gint n2)
+ gint n1,
+ gint n2)
{
- gchar *p;
- gint i;
-
- if (!digits) {
- return FALSE;
- }
-
- for (p = (gchar *)digits, i=0; !g_ascii_isspace (*p) && *p != 0; p++) {
- if (g_ascii_isdigit (*p)) {
- i++;
- }
- }
-
- return (i >= n1) && (i <= n2);
+ gchar *p;
+ gint i;
+
+ if (!digits)
+ {
+ return FALSE;
+ }
+
+ for (p = (gchar *)digits, i=0; !g_ascii_isspace (*p) && *p != 0; p++)
+ {
+ if (g_ascii_isdigit (*p))
+ {
+ i++;
+ }
+ }
+
+ return (i >= n1) && (i <= n2);
}
@@ -408,27 +527,31 @@ is_length1_valid (const gchar *digits,
/*--------------------------------------------------------------------------*/
static gboolean
is_length2_valid (const gchar *digits,
- gint n1,
- gint n2)
+ gint n1,
+ gint n2)
{
- gchar *p;
- gint i;
-
- if (!digits) {
- return FALSE;
- }
-
- for (p = (gchar *)digits; !g_ascii_isspace (*p) && (*p != 0); p++) {
- /* Skip over 1st string */
- }
-
- for (i=0; *p != 0; p++) {
- if (g_ascii_isdigit (*p)) {
- i++;
- }
- }
-
- return (i >= n1) && (i <= n2);
+ gchar *p;
+ gint i;
+
+ if (!digits)
+ {
+ return FALSE;
+ }
+
+ for (p = (gchar *)digits; !g_ascii_isspace (*p) && (*p != 0); p++)
+ {
+ /* Skip over 1st string */
+ }
+
+ for (i=0; *p != 0; p++)
+ {
+ if (g_ascii_isdigit (*p))
+ {
+ i++;
+ }
+ }
+
+ return (i >= n1) && (i <= n2);
}
#endif /* HAVE_LIBBARCODE */
diff --git a/src/bc-iec16022.c b/src/bc-iec16022.c
index 0719ed5..a031ef3 100644
--- a/src/bc-iec16022.c
+++ b/src/bc-iec16022.c
@@ -64,7 +64,7 @@ gl_barcode_iec16022_new (const gchar *id,
gint i_width, i_height;
lglBarcode *gbc;
- if ( strlen (digits) == 0 )
+ if ( *digits == '\0' )
{
return NULL;
}
@@ -99,14 +99,17 @@ render_iec16022 (const gchar *grid,
gint x, y;
gdouble aspect_ratio, pixel_size;
- /* Treat requested size as a bounding box, scale to maintain aspect
- * ratio while fitting it in this bounding box. */
- aspect_ratio = (gdouble)i_height / (gdouble)i_width;
- if ( h > w*aspect_ratio ) {
- h = w * aspect_ratio;
- } else {
- w = h / aspect_ratio;
- }
+ /* Treat requested size as a bounding box, scale to maintain aspect
+ * ratio while fitting it in this bounding box. */
+ aspect_ratio = (gdouble)i_height / (gdouble)i_width;
+ if ( h > w*aspect_ratio )
+ {
+ h = w * aspect_ratio;
+ }
+ else
+ {
+ w = h / aspect_ratio;
+ }
/* Now determine pixel size. */
pixel_size = w / i_width;
diff --git a/src/bc-iec18004.c b/src/bc-iec18004.c
index 396b55b..e27db05 100644
--- a/src/bc-iec18004.c
+++ b/src/bc-iec18004.c
@@ -63,9 +63,9 @@ gl_barcode_iec18004_new (const gchar *id,
{
gint i_width, i_height;
lglBarcode *gbc;
- QRcode *qrcode;
+ QRcode *qrcode;
- if ( strlen (digits) == 0 )
+ if ( *digits == '\0' )
{
return NULL;
}
@@ -80,12 +80,12 @@ gl_barcode_iec18004_new (const gchar *id,
return NULL;
}
- i_width = i_height = qrcode->width;
- gbc = render_iec18004 ((const gchar *)qrcode->data, i_width, i_height,
+ i_width = i_height = qrcode->width;
+ gbc = render_iec18004 ((const gchar *)qrcode->data, i_width, i_height,
w, h);
- QRcode_free ( qrcode );
-
+ QRcode_free ( qrcode );
+
return gbc;
}
@@ -104,14 +104,17 @@ render_iec18004 (const gchar *grid,
gint x, y;
gdouble aspect_ratio, pixel_size;
- /* Treat requested size as a bounding box, scale to maintain aspect
- * ratio while fitting it in this bounding box. */
- aspect_ratio = (gdouble)i_height / (gdouble)i_width;
- if ( h > w*aspect_ratio ) {
- h = w * aspect_ratio;
- } else {
- w = h / aspect_ratio;
- }
+ /* Treat requested size as a bounding box, scale to maintain aspect
+ * ratio while fitting it in this bounding box. */
+ aspect_ratio = (gdouble)i_height / (gdouble)i_width;
+ if ( h > w*aspect_ratio )
+ {
+ h = w * aspect_ratio;
+ }
+ else
+ {
+ w = h / aspect_ratio;
+ }
/* Now determine pixel size. */
pixel_size = w / i_width;
diff --git a/src/bc-zint.c b/src/bc-zint.c
index e68efc8..015196e 100644
--- a/src/bc-zint.c
+++ b/src/bc-zint.c
@@ -51,17 +51,17 @@ static lglBarcode *render_zint (struct zint_symbol *symbol, gboolean text_fl
/*****************************************************************************/
lglBarcode *
gl_barcode_zint_new (const gchar *id,
- gboolean text_flag,
- gboolean checksum_flag,
- gdouble w,
- gdouble h,
- const gchar *digits)
+ gboolean text_flag,
+ gboolean checksum_flag,
+ gdouble w,
+ gdouble h,
+ const gchar *digits)
{
- lglBarcode *gbc;
- struct zint_symbol *symbol;
- gint result;
+ lglBarcode *gbc;
+ struct zint_symbol *symbol;
+ gint result;
- symbol = ZBarcode_Create();
+ symbol = ZBarcode_Create();
/* Auto set to default size */
if ( (w == 0) && (h == 0) )
@@ -70,105 +70,102 @@ gl_barcode_zint_new (const gchar *id,
h = DEFAULT_H;
}
- /* Assign type flag. Pre-filter by length for subtypes. */
- if (g_ascii_strcasecmp (id, "AUSP") == 0) { symbol->symbology = BARCODE_AUSPOST; }
- if (g_ascii_strcasecmp (id, "AUSRP") == 0) { symbol->symbology = BARCODE_AUSREPLY; }
- if (g_ascii_strcasecmp (id, "AUSRT") == 0) { symbol->symbology = BARCODE_AUSROUTE; }
- if (g_ascii_strcasecmp (id, "AUSRD") == 0) { symbol->symbology = BARCODE_AUSREDIRECT; }
- if (g_ascii_strcasecmp (id, "AZTEC") == 0) { symbol->symbology = BARCODE_AZTEC; }
- if (g_ascii_strcasecmp (id, "AZRUN") == 0) { symbol->symbology = BARCODE_AZRUNE; }
- if (g_ascii_strcasecmp (id, "CBR") == 0) { symbol->symbology = BARCODE_CODABAR; }
- if (g_ascii_strcasecmp (id, "Code1") == 0) { symbol->symbology = BARCODE_CODEONE; }
- if (g_ascii_strcasecmp (id, "Code11") == 0) { symbol->symbology = BARCODE_CODE11; }
- if (g_ascii_strcasecmp (id, "C16K") == 0) { symbol->symbology = BARCODE_CODE16K; }
- if (g_ascii_strcasecmp (id, "C25M") == 0) { symbol->symbology = BARCODE_C25MATRIX; }
- if (g_ascii_strcasecmp (id, "C25I") == 0) { symbol->symbology = BARCODE_C25IATA; }
- if (g_ascii_strcasecmp (id, "C25DL") == 0) { symbol->symbology = BARCODE_C25LOGIC; }
- if (g_ascii_strcasecmp (id, "Code32") == 0) { symbol->symbology = BARCODE_CODE32; }
- if (g_ascii_strcasecmp (id, "Code39") == 0) { symbol->symbology = BARCODE_CODE39; }
- if (g_ascii_strcasecmp (id, "Code39E") == 0) { symbol->symbology = BARCODE_EXCODE39; }
- if (g_ascii_strcasecmp (id, "Code49") == 0) { symbol->symbology = BARCODE_CODE49; }
- if (g_ascii_strcasecmp (id, "Code93") == 0) { symbol->symbology = BARCODE_CODE93; }
- if (g_ascii_strcasecmp (id, "Code128") == 0) { symbol->symbology = BARCODE_CODE128; }
- if (g_ascii_strcasecmp (id, "Code128B") == 0) { symbol->symbology = BARCODE_CODE128B; }
- if (g_ascii_strcasecmp (id, "DAFT") == 0) { symbol->symbology = BARCODE_DAFT; }
- if (g_ascii_strcasecmp (id, "DMTX") == 0) { symbol->symbology = BARCODE_DATAMATRIX; }
- if (g_ascii_strcasecmp (id, "DPL") == 0) { symbol->symbology = BARCODE_DPLEIT; }
- if (g_ascii_strcasecmp (id, "DPI") == 0) { symbol->symbology = BARCODE_DPIDENT; }
- if (g_ascii_strcasecmp (id, "KIX") == 0) { symbol->symbology = BARCODE_KIX; }
- if (g_ascii_strcasecmp (id, "EAN") == 0) { symbol->symbology = BARCODE_EANX; }
- if (g_ascii_strcasecmp (id, "HIBC128") == 0) { symbol->symbology = BARCODE_HIBC_128; }
- if (g_ascii_strcasecmp (id, "HIBC39") == 0) { symbol->symbology = BARCODE_HIBC_39; }
- if (g_ascii_strcasecmp (id, "HIBCDM") == 0) { symbol->symbology = BARCODE_HIBC_DM; }
- if (g_ascii_strcasecmp (id, "HIBCQR") == 0) { symbol->symbology = BARCODE_HIBC_QR; }
- if (g_ascii_strcasecmp (id, "HIBCPDF") == 0) { symbol->symbology = BARCODE_HIBC_MICPDF; }
- if (g_ascii_strcasecmp (id, "HIBCMPDF") == 0) { symbol->symbology = BARCODE_HIBC_AZTEC; }
- if (g_ascii_strcasecmp (id, "HIBCAZ") == 0) { symbol->symbology = BARCODE_C25INTER; }
- if (g_ascii_strcasecmp (id, "I25") == 0) { symbol->symbology = BARCODE_C25INTER; }
- if (g_ascii_strcasecmp (id, "ISBN") == 0) { symbol->symbology = BARCODE_ISBNX; }
- if (g_ascii_strcasecmp (id, "ITF14") == 0) { symbol->symbology = BARCODE_ITF14; }
- if (g_ascii_strcasecmp (id, "GMTX") == 0) { symbol->symbology = BARCODE_GRIDMATRIX; }
- if (g_ascii_strcasecmp (id, "GS1-128") == 0) { symbol->symbology = BARCODE_EAN128; }
- if (g_ascii_strcasecmp (id, "LOGM") == 0) { symbol->symbology = BARCODE_LOGMARS; }
- if (g_ascii_strcasecmp (id, "RSS14") == 0) { symbol->symbology = BARCODE_RSS14; }
- if (g_ascii_strcasecmp (id, "RSSLTD") == 0) { symbol->symbology = BARCODE_RSS_LTD; }
- if (g_ascii_strcasecmp (id, "RSSEXP") == 0) { symbol->symbology = BARCODE_RSS_EXP; }
- if (g_ascii_strcasecmp (id, "RSSS") == 0) { symbol->symbology = BARCODE_RSS14STACK; }
- if (g_ascii_strcasecmp (id, "RSSSO") == 0) { symbol->symbology = BARCODE_RSS14STACK_OMNI; }
- if (g_ascii_strcasecmp (id, "RSSSE") == 0) { symbol->symbology = BARCODE_RSS_EXPSTACK; }
- if (g_ascii_strcasecmp (id, "PHARMA") == 0) { symbol->symbology = BARCODE_PHARMA; }
- if (g_ascii_strcasecmp (id, "PHARMA2") == 0) { symbol->symbology = BARCODE_PHARMA_TWO; }
- if (g_ascii_strcasecmp (id, "PZN") == 0) { symbol->symbology = BARCODE_PZN; }
- if (g_ascii_strcasecmp (id, "TELE") == 0) { symbol->symbology = BARCODE_TELEPEN; }
- if (g_ascii_strcasecmp (id, "TELEX") == 0) { symbol->symbology = BARCODE_TELEPEN_NUM; }
- if (g_ascii_strcasecmp (id, "JAPAN") == 0) { symbol->symbology = BARCODE_JAPANPOST; }
- if (g_ascii_strcasecmp (id, "KOREA") == 0) { symbol->symbology = BARCODE_KOREAPOST; }
- if (g_ascii_strcasecmp (id, "MAXI") == 0) { symbol->symbology = BARCODE_MAXICODE; }
- if (g_ascii_strcasecmp (id, "MPDF") == 0) { symbol->symbology = BARCODE_MICROPDF417; }
- if (g_ascii_strcasecmp (id, "MSI") == 0) { symbol->symbology = BARCODE_MSI_PLESSEY; }
- if (g_ascii_strcasecmp (id, "MQR") == 0) { symbol->symbology = BARCODE_MICROQR; }
- if (g_ascii_strcasecmp (id, "NVE") == 0) { symbol->symbology = BARCODE_NVE18; }
- if (g_ascii_strcasecmp (id, "PLAN") == 0) { symbol->symbology = BARCODE_PLANET; }
- if (g_ascii_strcasecmp (id, "POSTNET") == 0) { symbol->symbology = BARCODE_POSTNET; }
- if (g_ascii_strcasecmp (id, "PDF") == 0) { symbol->symbology = BARCODE_PDF417; }
- if (g_ascii_strcasecmp (id, "PDFT") == 0) { symbol->symbology = BARCODE_PDF417TRUNC; }
- if (g_ascii_strcasecmp (id, "QR") == 0) { symbol->symbology = BARCODE_QRCODE; }
- if (g_ascii_strcasecmp (id, "RM4") == 0) { symbol->symbology = BARCODE_RM4SCC; }
- if (g_ascii_strcasecmp (id, "UPC-A") == 0) { symbol->symbology = BARCODE_UPCA; }
- if (g_ascii_strcasecmp (id, "UPC-E") == 0) { symbol->symbology = BARCODE_UPCE; }
- if (g_ascii_strcasecmp (id, "USPS") == 0) { symbol->symbology = BARCODE_ONECODE; }
- if (g_ascii_strcasecmp (id, "PLS") == 0) { symbol->symbology = BARCODE_PLESSEY; }
-
-
- /* Checksum not supported yet!!
- if (!checksum_flag) {
- flags |= BARCODE_NO_CHECKSUM;
- }
- */
-
- result = ZBarcode_Encode(symbol, (unsigned char *)digits, 0);
- if (result) {
- gl_debug (DEBUG_BARCODE, "Zint Error: %s", symbol->errtxt);
- ZBarcode_Delete (symbol);
- return NULL;
- }
-
- if(!text_flag) {
- symbol->show_hrt = 0;
- }
-
- if (!ZBarcode_Render(symbol, (float) w, (float) h)) {
- g_message("Zint Rendering Error: %s", symbol->errtxt);
- ZBarcode_Delete(symbol);
- return NULL;
- }
-
- /* Convert Sums provided by zint encode */
- gbc = render_zint(symbol, text_flag);
-
- ZBarcode_Delete(symbol);
-
- return gbc;
+ /* Assign type flag. Pre-filter by length for subtypes. */
+ if (g_ascii_strcasecmp (id, "AUSP") == 0) { symbol->symbology = BARCODE_AUSPOST; }
+ if (g_ascii_strcasecmp (id, "AUSRP") == 0) { symbol->symbology = BARCODE_AUSREPLY; }
+ if (g_ascii_strcasecmp (id, "AUSRT") == 0) { symbol->symbology = BARCODE_AUSROUTE; }
+ if (g_ascii_strcasecmp (id, "AUSRD") == 0) { symbol->symbology = BARCODE_AUSREDIRECT; }
+ if (g_ascii_strcasecmp (id, "AZTEC") == 0) { symbol->symbology = BARCODE_AZTEC; }
+ if (g_ascii_strcasecmp (id, "AZRUN") == 0) { symbol->symbology = BARCODE_AZRUNE; }
+ if (g_ascii_strcasecmp (id, "CBR") == 0) { symbol->symbology = BARCODE_CODABAR; }
+ if (g_ascii_strcasecmp (id, "Code1") == 0) { symbol->symbology = BARCODE_CODEONE; }
+ if (g_ascii_strcasecmp (id, "Code11") == 0) { symbol->symbology = BARCODE_CODE11; }
+ if (g_ascii_strcasecmp (id, "C16K") == 0) { symbol->symbology = BARCODE_CODE16K; }
+ if (g_ascii_strcasecmp (id, "C25M") == 0) { symbol->symbology = BARCODE_C25MATRIX; }
+ if (g_ascii_strcasecmp (id, "C25I") == 0) { symbol->symbology = BARCODE_C25IATA; }
+ if (g_ascii_strcasecmp (id, "C25DL") == 0) { symbol->symbology = BARCODE_C25LOGIC; }
+ if (g_ascii_strcasecmp (id, "Code32") == 0) { symbol->symbology = BARCODE_CODE32; }
+ if (g_ascii_strcasecmp (id, "Code39") == 0) { symbol->symbology = BARCODE_CODE39; }
+ if (g_ascii_strcasecmp (id, "Code39E") == 0) { symbol->symbology = BARCODE_EXCODE39; }
+ if (g_ascii_strcasecmp (id, "Code49") == 0) { symbol->symbology = BARCODE_CODE49; }
+ if (g_ascii_strcasecmp (id, "Code93") == 0) { symbol->symbology = BARCODE_CODE93; }
+ if (g_ascii_strcasecmp (id, "Code128") == 0) { symbol->symbology = BARCODE_CODE128; }
+ if (g_ascii_strcasecmp (id, "Code128B") == 0) { symbol->symbology = BARCODE_CODE128B; }
+ if (g_ascii_strcasecmp (id, "DAFT") == 0) { symbol->symbology = BARCODE_DAFT; }
+ if (g_ascii_strcasecmp (id, "DMTX") == 0) { symbol->symbology = BARCODE_DATAMATRIX; }
+ if (g_ascii_strcasecmp (id, "DPL") == 0) { symbol->symbology = BARCODE_DPLEIT; }
+ if (g_ascii_strcasecmp (id, "DPI") == 0) { symbol->symbology = BARCODE_DPIDENT; }
+ if (g_ascii_strcasecmp (id, "KIX") == 0) { symbol->symbology = BARCODE_KIX; }
+ if (g_ascii_strcasecmp (id, "EAN") == 0) { symbol->symbology = BARCODE_EANX; }
+ if (g_ascii_strcasecmp (id, "HIBC128") == 0) { symbol->symbology = BARCODE_HIBC_128; }
+ if (g_ascii_strcasecmp (id, "HIBC39") == 0) { symbol->symbology = BARCODE_HIBC_39; }
+ if (g_ascii_strcasecmp (id, "HIBCDM") == 0) { symbol->symbology = BARCODE_HIBC_DM; }
+ if (g_ascii_strcasecmp (id, "HIBCQR") == 0) { symbol->symbology = BARCODE_HIBC_QR; }
+ if (g_ascii_strcasecmp (id, "HIBCPDF") == 0) { symbol->symbology = BARCODE_HIBC_MICPDF; }
+ if (g_ascii_strcasecmp (id, "HIBCMPDF") == 0) { symbol->symbology = BARCODE_HIBC_AZTEC; }
+ if (g_ascii_strcasecmp (id, "HIBCAZ") == 0) { symbol->symbology = BARCODE_C25INTER; }
+ if (g_ascii_strcasecmp (id, "I25") == 0) { symbol->symbology = BARCODE_C25INTER; }
+ if (g_ascii_strcasecmp (id, "ISBN") == 0) { symbol->symbology = BARCODE_ISBNX; }
+ if (g_ascii_strcasecmp (id, "ITF14") == 0) { symbol->symbology = BARCODE_ITF14; }
+ if (g_ascii_strcasecmp (id, "GMTX") == 0) { symbol->symbology = BARCODE_GRIDMATRIX; }
+ if (g_ascii_strcasecmp (id, "GS1-128") == 0) { symbol->symbology = BARCODE_EAN128; }
+ if (g_ascii_strcasecmp (id, "LOGM") == 0) { symbol->symbology = BARCODE_LOGMARS; }
+ if (g_ascii_strcasecmp (id, "RSS14") == 0) { symbol->symbology = BARCODE_RSS14; }
+ if (g_ascii_strcasecmp (id, "RSSLTD") == 0) { symbol->symbology = BARCODE_RSS_LTD; }
+ if (g_ascii_strcasecmp (id, "RSSEXP") == 0) { symbol->symbology = BARCODE_RSS_EXP; }
+ if (g_ascii_strcasecmp (id, "RSSS") == 0) { symbol->symbology = BARCODE_RSS14STACK; }
+ if (g_ascii_strcasecmp (id, "RSSSO") == 0) { symbol->symbology = BARCODE_RSS14STACK_OMNI; }
+ if (g_ascii_strcasecmp (id, "RSSSE") == 0) { symbol->symbology = BARCODE_RSS_EXPSTACK; }
+ if (g_ascii_strcasecmp (id, "PHARMA") == 0) { symbol->symbology = BARCODE_PHARMA; }
+ if (g_ascii_strcasecmp (id, "PHARMA2") == 0) { symbol->symbology = BARCODE_PHARMA_TWO; }
+ if (g_ascii_strcasecmp (id, "PZN") == 0) { symbol->symbology = BARCODE_PZN; }
+ if (g_ascii_strcasecmp (id, "TELE") == 0) { symbol->symbology = BARCODE_TELEPEN; }
+ if (g_ascii_strcasecmp (id, "TELEX") == 0) { symbol->symbology = BARCODE_TELEPEN_NUM; }
+ if (g_ascii_strcasecmp (id, "JAPAN") == 0) { symbol->symbology = BARCODE_JAPANPOST; }
+ if (g_ascii_strcasecmp (id, "KOREA") == 0) { symbol->symbology = BARCODE_KOREAPOST; }
+ if (g_ascii_strcasecmp (id, "MAXI") == 0) { symbol->symbology = BARCODE_MAXICODE; }
+ if (g_ascii_strcasecmp (id, "MPDF") == 0) { symbol->symbology = BARCODE_MICROPDF417; }
+ if (g_ascii_strcasecmp (id, "MSI") == 0) { symbol->symbology = BARCODE_MSI_PLESSEY; }
+ if (g_ascii_strcasecmp (id, "MQR") == 0) { symbol->symbology = BARCODE_MICROQR; }
+ if (g_ascii_strcasecmp (id, "NVE") == 0) { symbol->symbology = BARCODE_NVE18; }
+ if (g_ascii_strcasecmp (id, "PLAN") == 0) { symbol->symbology = BARCODE_PLANET; }
+ if (g_ascii_strcasecmp (id, "POSTNET") == 0) { symbol->symbology = BARCODE_POSTNET; }
+ if (g_ascii_strcasecmp (id, "PDF") == 0) { symbol->symbology = BARCODE_PDF417; }
+ if (g_ascii_strcasecmp (id, "PDFT") == 0) { symbol->symbology = BARCODE_PDF417TRUNC; }
+ if (g_ascii_strcasecmp (id, "QR") == 0) { symbol->symbology = BARCODE_QRCODE; }
+ if (g_ascii_strcasecmp (id, "RM4") == 0) { symbol->symbology = BARCODE_RM4SCC; }
+ if (g_ascii_strcasecmp (id, "UPC-A") == 0) { symbol->symbology = BARCODE_UPCA; }
+ if (g_ascii_strcasecmp (id, "UPC-E") == 0) { symbol->symbology = BARCODE_UPCE; }
+ if (g_ascii_strcasecmp (id, "USPS") == 0) { symbol->symbology = BARCODE_ONECODE; }
+ if (g_ascii_strcasecmp (id, "PLS") == 0) { symbol->symbology = BARCODE_PLESSEY; }
+
+
+ result = ZBarcode_Encode(symbol, (unsigned char *)digits, 0);
+ if (result)
+ {
+ gl_debug (DEBUG_BARCODE, "Zint Error: %s", symbol->errtxt);
+ ZBarcode_Delete (symbol);
+ return NULL;
+ }
+
+ if(!text_flag)
+ {
+ symbol->show_hrt = 0;
+ }
+
+ if (!ZBarcode_Render(symbol, (float) w, (float) h))
+ {
+ g_message("Zint Rendering Error: %s", symbol->errtxt);
+ ZBarcode_Delete(symbol);
+ return NULL;
+ }
+
+ /* Convert Sums provided by zint encode */
+ gbc = render_zint(symbol, text_flag);
+
+ ZBarcode_Delete(symbol);
+
+ return gbc;
}
@@ -187,7 +184,7 @@ static lglBarcode *render_zint(struct zint_symbol *symbol, gboolean text_flag)
render = symbol->rendered;
gbc = lgl_barcode_new ();
-
+
for ( zline = render->lines; zline != NULL; zline = zline->next )
{
lgl_barcode_add_box (gbc, zline->x, zline->y, zline->width, zline->length);
diff --git a/src/color-combo-button.c b/src/color-combo-button.c
index 04186f6..8a5e988 100644
--- a/src/color-combo-button.c
+++ b/src/color-combo-button.c
@@ -98,7 +98,7 @@ menu_selection_done_cb (GtkMenuShell *object,
/*****************************************************************************/
/* Object infrastructure. */
/*****************************************************************************/
-G_DEFINE_TYPE (glColorComboButton, gl_color_combo_button, GTK_TYPE_HBOX);
+G_DEFINE_TYPE (glColorComboButton, gl_color_combo_button, GTK_TYPE_HBOX)
/*****************************************************************************/
diff --git a/src/color-combo-color-menu-item.c b/src/color-combo-color-menu-item.c
index bdaca24..334fd19 100644
--- a/src/color-combo-color-menu-item.c
+++ b/src/color-combo-color-menu-item.c
@@ -65,7 +65,7 @@ static void gl_color_combo_color_menu_item_finalize (GObject *
/****************************************************************************/
/* Boilerplate Object stuff. */
/****************************************************************************/
-G_DEFINE_TYPE (glColorComboColorMenuItem, gl_color_combo_color_menu_item, GTK_TYPE_MENU_ITEM);
+G_DEFINE_TYPE (glColorComboColorMenuItem, gl_color_combo_color_menu_item, GTK_TYPE_MENU_ITEM)
/*****************************************************************************/
diff --git a/src/color-combo-menu.c b/src/color-combo-menu.c
index ec24fab..e08f4b2 100644
--- a/src/color-combo-menu.c
+++ b/src/color-combo-menu.c
@@ -154,7 +154,7 @@ static void history_menu_item_activate_cb (GtkMenuItem *item,
/****************************************************************************/
/* Boilerplate Object stuff. */
/****************************************************************************/
-G_DEFINE_TYPE (glColorComboMenu, gl_color_combo_menu, GTK_TYPE_MENU);
+G_DEFINE_TYPE (glColorComboMenu, gl_color_combo_menu, GTK_TYPE_MENU)
/*****************************************************************************/
diff --git a/src/color-combo.c b/src/color-combo.c
index c833f19..ea29ebe 100644
--- a/src/color-combo.c
+++ b/src/color-combo.c
@@ -90,7 +90,7 @@ menu_selection_done_cb (GtkMenuShell *object,
/*****************************************************************************/
/* Object infrastructure. */
/*****************************************************************************/
-G_DEFINE_TYPE (glColorCombo, gl_color_combo, GTK_TYPE_TOGGLE_BUTTON);
+G_DEFINE_TYPE (glColorCombo, gl_color_combo, GTK_TYPE_TOGGLE_BUTTON)
/*****************************************************************************/
diff --git a/src/color-history-model.c b/src/color-history-model.c
index 8069fa3..7f129bc 100644
--- a/src/color-history-model.c
+++ b/src/color-history-model.c
@@ -69,7 +69,7 @@ static void set_color_array (glColorHistoryModel *this,
/*****************************************************************************/
/* Object infrastructure. */
/*****************************************************************************/
-G_DEFINE_TYPE (glColorHistoryModel, gl_color_history_model, G_TYPE_OBJECT);
+G_DEFINE_TYPE (glColorHistoryModel, gl_color_history_model, G_TYPE_OBJECT)
/*****************************************************************************/
diff --git a/src/color-swatch.c b/src/color-swatch.c
index 6856e21..7e97bee 100644
--- a/src/color-swatch.c
+++ b/src/color-swatch.c
@@ -69,7 +69,7 @@ static void draw_swatch (glColorSwatch *this,
/****************************************************************************/
/* Boilerplate Object stuff. */
/****************************************************************************/
-G_DEFINE_TYPE (glColorSwatch, gl_color_swatch, GTK_TYPE_DRAWING_AREA);
+G_DEFINE_TYPE (glColorSwatch, gl_color_swatch, GTK_TYPE_DRAWING_AREA)
/*****************************************************************************/
diff --git a/src/debug.h b/src/debug.h
index 25825a8..a1aad56 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -64,7 +64,7 @@ typedef enum {
GLABELS_DEBUG_WDGT = 1 << 21,
GLABELS_DEBUG_PATH = 1 << 22,
GLABELS_DEBUG_FIELD_BUTTON = 1 << 23,
- GLABELS_DEBUG_BARCODE = 1 << 24,
+ GLABELS_DEBUG_BARCODE = 1 << 24
} glDebugSection;
diff --git a/src/field-button-menu.c b/src/field-button-menu.c
index 37509f2..9177abb 100644
--- a/src/field-button-menu.c
+++ b/src/field-button-menu.c
@@ -66,7 +66,7 @@ static void gl_field_button_menu_finalize (GObject *object);
/****************************************************************************/
/* Boilerplate Object stuff. */
/****************************************************************************/
-G_DEFINE_TYPE (glFieldButtonMenu, gl_field_button_menu, GTK_TYPE_MENU);
+G_DEFINE_TYPE (glFieldButtonMenu, gl_field_button_menu, GTK_TYPE_MENU)
static void
diff --git a/src/field-button.c b/src/field-button.c
index aad5f51..8b8c4e5 100644
--- a/src/field-button.c
+++ b/src/field-button.c
@@ -83,7 +83,7 @@ menu_selection_done_cb (GtkMenuShell *object,
/*****************************************************************************/
/* Object infrastructure. */
/*****************************************************************************/
-G_DEFINE_TYPE (glFieldButton, gl_field_button, GTK_TYPE_TOGGLE_BUTTON);
+G_DEFINE_TYPE (glFieldButton, gl_field_button, GTK_TYPE_TOGGLE_BUTTON)
/*****************************************************************************/
diff --git a/src/font-combo-menu-item.c b/src/font-combo-menu-item.c
index 5f30765..6d958d6 100644
--- a/src/font-combo-menu-item.c
+++ b/src/font-combo-menu-item.c
@@ -64,7 +64,7 @@ static void gl_font_combo_menu_item_finalize (GObject *object)
/****************************************************************************/
/* Boilerplate Object stuff. */
/****************************************************************************/
-G_DEFINE_TYPE (glFontComboMenuItem, gl_font_combo_menu_item, GTK_TYPE_MENU_ITEM);
+G_DEFINE_TYPE (glFontComboMenuItem, gl_font_combo_menu_item, GTK_TYPE_MENU_ITEM)
/*****************************************************************************/
diff --git a/src/font-combo-menu.c b/src/font-combo-menu.c
index 6df363a..f56d500 100644
--- a/src/font-combo-menu.c
+++ b/src/font-combo-menu.c
@@ -82,7 +82,7 @@ static void font_history_changed_cb (glFontComboMenu *this);
/****************************************************************************/
/* Boilerplate Object stuff. */
/****************************************************************************/
-G_DEFINE_TYPE (glFontComboMenu, gl_font_combo_menu, GTK_TYPE_MENU);
+G_DEFINE_TYPE (glFontComboMenu, gl_font_combo_menu, GTK_TYPE_MENU)
/*****************************************************************************/
diff --git a/src/font-combo.c b/src/font-combo.c
index 993089f..3c9480f 100644
--- a/src/font-combo.c
+++ b/src/font-combo.c
@@ -81,7 +81,7 @@ menu_selection_done_cb (GtkMenuShell *object,
/*****************************************************************************/
/* Object infrastructure. */
/*****************************************************************************/
-G_DEFINE_TYPE (glFontCombo, gl_font_combo, GTK_TYPE_TOGGLE_BUTTON);
+G_DEFINE_TYPE (glFontCombo, gl_font_combo, GTK_TYPE_TOGGLE_BUTTON)
/*****************************************************************************/
diff --git a/src/font-history-model.c b/src/font-history-model.c
index 9710f29..3ae9a86 100644
--- a/src/font-history-model.c
+++ b/src/font-history-model.c
@@ -65,7 +65,7 @@ static void history_changed_cb (glFontHistoryModel *this);
/*****************************************************************************/
/* Object infrastructure. */
/*****************************************************************************/
-G_DEFINE_TYPE (glFontHistoryModel, gl_font_history_model, G_TYPE_OBJECT);
+G_DEFINE_TYPE (glFontHistoryModel, gl_font_history_model, G_TYPE_OBJECT)
/*****************************************************************************/
diff --git a/src/font-sample.c b/src/font-sample.c
index cbdc6d6..13d524d 100644
--- a/src/font-sample.c
+++ b/src/font-sample.c
@@ -72,7 +72,7 @@ static void draw_sample (glFontSample *this,
/****************************************************************************/
/* Boilerplate Object stuff. */
/****************************************************************************/
-G_DEFINE_TYPE (glFontSample, gl_font_sample, GTK_TYPE_DRAWING_AREA);
+G_DEFINE_TYPE (glFontSample, gl_font_sample, GTK_TYPE_DRAWING_AREA)
/*****************************************************************************/
diff --git a/src/label-barcode.c b/src/label-barcode.c
index 5a709f6..9a98187 100644
--- a/src/label-barcode.c
+++ b/src/label-barcode.c
@@ -113,7 +113,7 @@ static void create_alt_msg_path (cairo_t *cr,
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glLabelBarcode, gl_label_barcode, GL_TYPE_LABEL_OBJECT);
+G_DEFINE_TYPE (glLabelBarcode, gl_label_barcode, GL_TYPE_LABEL_OBJECT)
static void
diff --git a/src/label-box.c b/src/label-box.c
index c84b0aa..fd63e24 100644
--- a/src/label-box.c
+++ b/src/label-box.c
@@ -88,7 +88,7 @@ static gboolean object_at (glLabelObject *object,
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glLabelBox, gl_label_box, GL_TYPE_LABEL_OBJECT);
+G_DEFINE_TYPE (glLabelBox, gl_label_box, GL_TYPE_LABEL_OBJECT)
static void
diff --git a/src/label-ellipse.c b/src/label-ellipse.c
index 0d38e3e..5b89f3b 100644
--- a/src/label-ellipse.c
+++ b/src/label-ellipse.c
@@ -92,7 +92,7 @@ static gboolean object_at (glLabelObject *object,
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glLabelEllipse, gl_label_ellipse, GL_TYPE_LABEL_OBJECT);
+G_DEFINE_TYPE (glLabelEllipse, gl_label_ellipse, GL_TYPE_LABEL_OBJECT)
static void
diff --git a/src/label-image.c b/src/label-image.c
index 6201e26..f5e4585 100644
--- a/src/label-image.c
+++ b/src/label-image.c
@@ -100,7 +100,7 @@ static gboolean object_at (glLabelObject *object,
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glLabelImage, gl_label_image, GL_TYPE_LABEL_OBJECT);
+G_DEFINE_TYPE (glLabelImage, gl_label_image, GL_TYPE_LABEL_OBJECT)
static void
diff --git a/src/label-line.c b/src/label-line.c
index e8b66e9..c88e2ed 100644
--- a/src/label-line.c
+++ b/src/label-line.c
@@ -81,7 +81,7 @@ static gboolean object_at (glLabelObject *object,
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glLabelLine, gl_label_line, GL_TYPE_LABEL_OBJECT);
+G_DEFINE_TYPE (glLabelLine, gl_label_line, GL_TYPE_LABEL_OBJECT)
static void
diff --git a/src/label-object.c b/src/label-object.c
index 0ccce7c..92a8ec2 100644
--- a/src/label-object.c
+++ b/src/label-object.c
@@ -102,7 +102,7 @@ static void set_size (glLabelObject *object,
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glLabelObject, gl_label_object, G_TYPE_OBJECT);
+G_DEFINE_TYPE (glLabelObject, gl_label_object, G_TYPE_OBJECT)
static void
diff --git a/src/label-object.h b/src/label-object.h
index 859641a..8e898a5 100644
--- a/src/label-object.h
+++ b/src/label-object.h
@@ -51,7 +51,7 @@ typedef enum {
GL_LABEL_OBJECT_HANDLE_SE,
GL_LABEL_OBJECT_HANDLE_SW,
GL_LABEL_OBJECT_HANDLE_P1,
- GL_LABEL_OBJECT_HANDLE_P2,
+ GL_LABEL_OBJECT_HANDLE_P2
} glLabelObjectHandle;
diff --git a/src/label-text.c b/src/label-text.c
index 403c7df..d9146c4 100644
--- a/src/label-text.c
+++ b/src/label-text.c
@@ -179,7 +179,7 @@ static void draw_handles (glLabelObject *object,
/*****************************************************************************/
/* Object infrastructure. */
/*****************************************************************************/
-G_DEFINE_TYPE (glLabelText, gl_label_text, GL_TYPE_LABEL_OBJECT);
+G_DEFINE_TYPE (glLabelText, gl_label_text, GL_TYPE_LABEL_OBJECT)
/*****************************************************************************/
diff --git a/src/label.c b/src/label.c
index 2fb3c7f..efa117f 100644
--- a/src/label.c
+++ b/src/label.c
@@ -189,7 +189,7 @@ static void state_restore (State *state,
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glLabel, gl_label, G_TYPE_OBJECT);
+G_DEFINE_TYPE (glLabel, gl_label, G_TYPE_OBJECT)
static void
diff --git a/src/media-select.c b/src/media-select.c
index ded9319..11ecda0 100644
--- a/src/media-select.c
+++ b/src/media-select.c
@@ -160,7 +160,7 @@ static void load_search_all_list (glMediaSelect *this,
/****************************************************************************/
/* Boilerplate Object stuff. */
/****************************************************************************/
-G_DEFINE_TYPE (glMediaSelect, gl_media_select, GTK_TYPE_VBOX);
+G_DEFINE_TYPE (glMediaSelect, gl_media_select, GTK_TYPE_VBOX)
static void
@@ -827,7 +827,7 @@ gl_media_select_set_name (glMediaSelect *this,
flag = gtk_tree_model_iter_next(model, &iter) )
{
gtk_tree_model_get (model, &iter, NAME_COLUMN, &name_i, -1);
- if (strcasecmp(name, name_i) == 0)
+ if (lgl_str_utf8_casecmp(name, name_i) == 0)
{
gtk_tree_selection_select_iter (selection, &iter);
path = gtk_tree_model_get_path (model, &iter);
diff --git a/src/merge-evolution.c b/src/merge-evolution.c
index aea8601..bd14483 100644
--- a/src/merge-evolution.c
+++ b/src/merge-evolution.c
@@ -58,7 +58,7 @@ enum {
enum {
ARG_0,
- ARG_QUERY,
+ ARG_QUERY
};
@@ -97,7 +97,7 @@ static void free_field_list (GList *fields);
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glMergeEvolution, gl_merge_evolution, GL_TYPE_MERGE);
+G_DEFINE_TYPE (glMergeEvolution, gl_merge_evolution, GL_TYPE_MERGE)
static void
gl_merge_evolution_class_init (glMergeEvolutionClass *class)
@@ -271,26 +271,26 @@ gl_merge_evolution_get_primary_key (const glMerge *merge)
*/
static gint sort_contact_by_file_as(gconstpointer *a, gconstpointer *b)
{
- /*
- * Returns : negative value if a < b; zero if a = b; positive value if a > b
- */
+ /*
+ * Returns : negative value if a < b; zero if a = b; positive value if a > b
+ */
- // Check and cast a and b to EContact
- EContact *contact_a = E_CONTACT(a);
- EContact *contact_b = E_CONTACT(b);
+ /* Check and cast a and b to EContact */
+ EContact *contact_a = E_CONTACT(a);
+ EContact *contact_b = E_CONTACT(b);
- // Extract file_as for each contact and compare...
- gchar *a_file_as = e_contact_get (contact_a, E_CONTACT_FILE_AS);
- gchar *b_file_as = e_contact_get (contact_b, E_CONTACT_FILE_AS);
- gint res = lgl_str_utf8_casecmp(a_file_as, b_file_as);
+ /* Extract file_as for each contact and compare... */
+ gchar *a_file_as = e_contact_get (contact_a, E_CONTACT_FILE_AS);
+ gchar *b_file_as = e_contact_get (contact_b, E_CONTACT_FILE_AS);
+ gint res = lgl_str_utf8_casecmp(a_file_as, b_file_as);
- gl_debug(DEBUG_MERGE, "Sort comparing contacts '%s' and '%s' = %d", a_file_as, b_file_as, res);
+ gl_debug(DEBUG_MERGE, "Sort comparing contacts '%s' and '%s' = %d", a_file_as, b_file_as, res);
- // free file_as strings created earlier....
- g_free (a_file_as);
- g_free (b_file_as);
+ /* free file_as strings created earlier.... */
+ g_free (a_file_as);
+ g_free (b_file_as);
- return res;
+ return res;
}
@@ -505,11 +505,11 @@ gl_merge_evolution_copy (glMerge *dst_merge,
{
GList *src_iter, *dst_iter;
- gl_debug (DEBUG_MERGE, "BEGIN");
-
glMergeEvolution *dst_merge_evolution;
glMergeEvolution *src_merge_evolution;
+ gl_debug (DEBUG_MERGE, "BEGIN");
+
dst_merge_evolution = GL_MERGE_EVOLUTION (dst_merge);
src_merge_evolution = GL_MERGE_EVOLUTION (src_merge);
diff --git a/src/merge-properties-dialog.c b/src/merge-properties-dialog.c
index eac35a5..064223b 100644
--- a/src/merge-properties-dialog.c
+++ b/src/merge-properties-dialog.c
@@ -117,7 +117,7 @@ static void unselect_all_button_clicked_cb (GtkWidget
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glMergePropertiesDialog, gl_merge_properties_dialog, GTK_TYPE_DIALOG);
+G_DEFINE_TYPE (glMergePropertiesDialog, gl_merge_properties_dialog, GTK_TYPE_DIALOG)
/*****************************************************************************/
diff --git a/src/merge-text.c b/src/merge-text.c
index c4c0a6c..a702c3d 100644
--- a/src/merge-text.c
+++ b/src/merge-text.c
@@ -51,7 +51,7 @@ enum {
enum {
ARG_0,
ARG_DELIM,
- ARG_LINE1_HAS_KEYS,
+ ARG_LINE1_HAS_KEYS
};
@@ -98,7 +98,7 @@ static void free_fields (GList **fields);
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glMergeText, gl_merge_text, GL_TYPE_MERGE);
+G_DEFINE_TYPE (glMergeText, gl_merge_text, GL_TYPE_MERGE)
static void
diff --git a/src/merge-vcard.c b/src/merge-vcard.c
index 253bb89..da1deff 100644
--- a/src/merge-vcard.c
+++ b/src/merge-vcard.c
@@ -48,7 +48,7 @@ enum {
};
enum {
- ARG_0,
+ ARG_0
};
@@ -86,7 +86,7 @@ static char * parse_next_vcard (FILE *fp);
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glMergeVCard, gl_merge_vcard, GL_TYPE_MERGE);
+G_DEFINE_TYPE (glMergeVCard, gl_merge_vcard, GL_TYPE_MERGE)
static void
@@ -152,11 +152,10 @@ gl_merge_vcard_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- glMergeVCard *merge_vcard;
+ switch (param_id) {
- merge_vcard = GL_MERGE_VCARD (object);
+ /* Currently no vcard specific properties. */
- switch (param_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -173,11 +172,10 @@ gl_merge_vcard_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- glMergeVCard *merge_vcard;
+ switch (param_id) {
- merge_vcard = GL_MERGE_VCARD (object);
+ /* Currently no vcard specific properties. */
- switch (param_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -192,14 +190,11 @@ gl_merge_vcard_get_property (GObject *object,
static GList *
gl_merge_vcard_get_key_list (const glMerge *merge)
{
- glMergeVCard *merge_vcard;
GList *key_list = NULL;
EContactField field_id;
gl_debug (DEBUG_MERGE, "BEGIN");
- merge_vcard = GL_MERGE_VCARD (merge);
-
for ( field_id = E_CONTACT_FIELD_FIRST; field_id <= E_CONTACT_LAST_SIMPLE_STRING; field_id++ )
{
key_list = g_list_append (key_list, g_strdup (e_contact_pretty_name (field_id)));
@@ -324,11 +319,7 @@ static void
gl_merge_vcard_copy (glMerge *dst_merge,
const glMerge *src_merge)
{
- glMergeVCard *dst_merge_vcard;
- glMergeVCard *src_merge_vcard;
-
- dst_merge_vcard = GL_MERGE_VCARD (dst_merge);
- src_merge_vcard = GL_MERGE_VCARD (src_merge);
+ /* Currently nothing to copy. */
}
diff --git a/src/merge.c b/src/merge.c
index 18379a0..7076c13 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -226,7 +226,7 @@ gl_merge_description_to_name (gchar *description)
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glMerge, gl_merge, G_TYPE_OBJECT);
+G_DEFINE_TYPE (glMerge, gl_merge, G_TYPE_OBJECT)
static void
gl_merge_class_init (glMergeClass *class)
diff --git a/src/merge.h b/src/merge.h
index 23233ee..ecaf0ff 100644
--- a/src/merge.h
+++ b/src/merge.h
@@ -27,7 +27,7 @@ G_BEGIN_DECLS
typedef enum {
GL_MERGE_SRC_IS_FIXED,
- GL_MERGE_SRC_IS_FILE,
+ GL_MERGE_SRC_IS_FILE
} glMergeSrcType;
typedef struct {
diff --git a/src/message-bar.c b/src/message-bar.c
index 507afac..3760821 100644
--- a/src/message-bar.c
+++ b/src/message-bar.c
@@ -60,7 +60,7 @@ static void gl_message_bar_construct (glMessageBar *this,
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glMessageBar, gl_message_bar, GTK_TYPE_INFO_BAR);
+G_DEFINE_TYPE (glMessageBar, gl_message_bar, GTK_TYPE_INFO_BAR)
/*****************************************************************************/
diff --git a/src/mini-label-preview.c b/src/mini-label-preview.c
index ad7565e..72f6f49 100644
--- a/src/mini-label-preview.c
+++ b/src/mini-label-preview.c
@@ -73,7 +73,7 @@ static void draw_preview (glMiniLabelPreview *this,
/****************************************************************************/
/* Boilerplate Object stuff. */
/****************************************************************************/
-G_DEFINE_TYPE (glMiniLabelPreview, gl_mini_label_preview, GTK_TYPE_DRAWING_AREA);
+G_DEFINE_TYPE (glMiniLabelPreview, gl_mini_label_preview, GTK_TYPE_DRAWING_AREA)
/*****************************************************************************/
diff --git a/src/mini-preview.c b/src/mini-preview.c
index 3ea0956..dc92d6e 100644
--- a/src/mini-preview.c
+++ b/src/mini-preview.c
@@ -164,7 +164,7 @@ static gdouble set_transform_and_get_scale (glMiniPreview *this,
/****************************************************************************/
/* Object infrastructure. */
/****************************************************************************/
-G_DEFINE_TYPE (glMiniPreview, gl_mini_preview, GTK_TYPE_EVENT_BOX);
+G_DEFINE_TYPE (glMiniPreview, gl_mini_preview, GTK_TYPE_EVENT_BOX)
/*****************************************************************************/
@@ -1077,7 +1077,7 @@ draw_arrow (glMiniPreview *this,
cairo_scale (cr, 1, -1);
if ( this->priv->rotate_flag )
{
- cairo_rotate (cr, -M_PI/2.0);
+ cairo_rotate (cr, -G_PI/2.0);
}
cairo_new_path (cr);
diff --git a/src/new-label-dialog.c b/src/new-label-dialog.c
index 9ba0685..be122b5 100644
--- a/src/new-label-dialog.c
+++ b/src/new-label-dialog.c
@@ -117,7 +117,7 @@ static void set_info (glNewLabelDialog *this,
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glNewLabelDialog, gl_new_label_dialog, GTK_TYPE_ASSISTANT);
+G_DEFINE_TYPE (glNewLabelDialog, gl_new_label_dialog, GTK_TYPE_ASSISTANT)
/*****************************************************************************/
diff --git a/src/object-editor.c b/src/object-editor.c
index b258f4e..68cfa49 100644
--- a/src/object-editor.c
+++ b/src/object-editor.c
@@ -95,7 +95,7 @@ static void object_moved_cb (glLabelObject *object,
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glObjectEditor, gl_object_editor, GTK_TYPE_VBOX);
+G_DEFINE_TYPE (glObjectEditor, gl_object_editor, GTK_TYPE_VBOX)
static void
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index dd3bcca..2e16074 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -119,7 +119,7 @@ static void update_prefs_from_object_page (glPrefsDialog *dialog);
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glPrefsDialog, gl_prefs_dialog, GTK_TYPE_DIALOG);
+G_DEFINE_TYPE (glPrefsDialog, gl_prefs_dialog, GTK_TYPE_DIALOG)
static void
@@ -529,11 +529,11 @@ update_object_page_from_prefs (glPrefsDialog *dialog)
gl_prefs_model_get_default_text_color (gl_prefs));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->text_left_toggle),
- (gl_prefs_model_get_default_text_alignment (gl_prefs) == GTK_JUSTIFY_LEFT));
+ (gl_prefs_model_get_default_text_alignment (gl_prefs) == PANGO_ALIGN_LEFT));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->text_center_toggle),
- (gl_prefs_model_get_default_text_alignment (gl_prefs) == GTK_JUSTIFY_CENTER));
+ (gl_prefs_model_get_default_text_alignment (gl_prefs) == PANGO_ALIGN_CENTER));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->text_right_toggle),
- (gl_prefs_model_get_default_text_alignment (gl_prefs) == GTK_JUSTIFY_RIGHT));
+ (gl_prefs_model_get_default_text_alignment (gl_prefs) == PANGO_ALIGN_RIGHT));
gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->priv->text_line_spacing_spin),
gl_prefs_model_get_default_text_line_spacing (gl_prefs));
diff --git a/src/prefs-model.c b/src/prefs-model.c
index 167d327..b9232a7 100644
--- a/src/prefs-model.c
+++ b/src/prefs-model.c
@@ -83,7 +83,7 @@ static void gsettings_changed_cb (glPrefsModel *prefs_m
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glPrefsModel, gl_prefs_model, G_TYPE_OBJECT);
+G_DEFINE_TYPE (glPrefsModel, gl_prefs_model, G_TYPE_OBJECT)
static void
@@ -201,7 +201,7 @@ gl_prefs_model_get_units (glPrefsModel *this)
string = g_settings_get_string (this->priv->locale, "units");
/* If not set, make educated guess about locale default. */
- if ( !string || !strlen(string) )
+ if ( !string || (*string == '\0') )
{
pgsize = gtk_paper_size_get_default ();
if ( strcmp (pgsize, GTK_PAPER_NAME_LETTER) == 0 )
@@ -261,7 +261,7 @@ gl_prefs_model_get_default_page_size (glPrefsModel *this)
page_size = g_settings_get_string (this->priv->locale, "default-page-size");
/* If not set, make educated guess about locale default. */
- if ( !page_size || !strlen(page_size) )
+ if ( !page_size || (*page_size == '\0') )
{
pgsize = gtk_paper_size_get_default ();
if ( strcmp (pgsize, GTK_PAPER_NAME_LETTER) == 0 )
diff --git a/src/print-op-dialog.c b/src/print-op-dialog.c
index 412bf17..fdcc45a 100644
--- a/src/print-op-dialog.c
+++ b/src/print-op-dialog.c
@@ -69,8 +69,6 @@ struct _glPrintOpDialogPrivate {
GtkWidget *preview;
- gboolean force_outline_flag;
-
gint labels_per_sheet;
gboolean merge_flag;
gint n_records;
@@ -135,7 +133,7 @@ static void option_toggled_cb (GtkToggleButton *togglebutton,
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glPrintOpDialog, gl_print_op_dialog, GL_TYPE_PRINT_OP);
+G_DEFINE_TYPE (glPrintOpDialog, gl_print_op_dialog, GL_TYPE_PRINT_OP)
static void
diff --git a/src/print-op.c b/src/print-op.c
index 71113ad..e7a9648 100644
--- a/src/print-op.c
+++ b/src/print-op.c
@@ -106,7 +106,7 @@ static void draw_page_cb (GtkPrintOperation *operation,
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glPrintOp, gl_print_op, GTK_TYPE_PRINT_OPERATION);
+G_DEFINE_TYPE (glPrintOp, gl_print_op, GTK_TYPE_PRINT_OPERATION)
static void
diff --git a/src/print.c b/src/print.c
index be58b10..d2a3b66 100644
--- a/src/print.c
+++ b/src/print.c
@@ -499,13 +499,10 @@ print_label (PrintInfo *pi,
gboolean outline_flag,
gboolean reverse_flag)
{
- const lglTemplateFrame *frame;
gdouble width, height;
gl_debug (DEBUG_PRINT, "START");
- frame = (lglTemplateFrame *)pi->template->frames->data;
-
gl_label_get_size (label, &width, &height);
cairo_save (pi->cr);
@@ -523,7 +520,7 @@ print_label (PrintInfo *pi,
/* Special transformations. */
if (pi->rotate_flag) {
gl_debug (DEBUG_PRINT, "Rotate flag set");
- cairo_rotate (pi->cr, M_PI/2.0);
+ cairo_rotate (pi->cr, G_PI/2.0);
cairo_translate (pi->cr, 0.0, -height);
}
if ( reverse_flag ) {
diff --git a/src/template-designer.c b/src/template-designer.c
index 936bfb1..2719958 100644
--- a/src/template-designer.c
+++ b/src/template-designer.c
@@ -292,7 +292,7 @@ static lglTemplate *build_template (glTemplateDesigner *dial
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glTemplateDesigner, gl_template_designer, GTK_TYPE_ASSISTANT);
+G_DEFINE_TYPE (glTemplateDesigner, gl_template_designer, GTK_TYPE_ASSISTANT)
static void
diff --git a/src/template-history-model.c b/src/template-history-model.c
index 7c1cc47..9105a8f 100644
--- a/src/template-history-model.c
+++ b/src/template-history-model.c
@@ -64,7 +64,7 @@ static void history_changed_cb (glTemplateHistoryModel *this);
/*****************************************************************************/
/* Object infrastructure. */
/*****************************************************************************/
-G_DEFINE_TYPE (glTemplateHistoryModel, gl_template_history_model, G_TYPE_OBJECT);
+G_DEFINE_TYPE (glTemplateHistoryModel, gl_template_history_model, G_TYPE_OBJECT)
/*****************************************************************************/
diff --git a/src/ui-property-bar.c b/src/ui-property-bar.c
index 927dae2..4e26f5c 100644
--- a/src/ui-property-bar.c
+++ b/src/ui-property-bar.c
@@ -148,7 +148,7 @@ static void set_line_width_items_sensitive (glUIPropertyBar *this,
/****************************************************************************/
/* Boilerplate Object stuff. */
/****************************************************************************/
-G_DEFINE_TYPE (glUIPropertyBar, gl_ui_property_bar, GTK_TYPE_HBOX);
+G_DEFINE_TYPE (glUIPropertyBar, gl_ui_property_bar, GTK_TYPE_HBOX)
static void
@@ -860,14 +860,12 @@ font_family_changed_cb (GtkComboBox *combo,
gl_debug (DEBUG_PROPERTY_BAR, "START");
font_family = gl_font_combo_get_family (GL_FONT_COMBO (combo));
- if ( strlen(font_family) )
+ if ( *font_family != '\0' )
{
- gl_label_set_selection_font_family (this->priv->label,
- font_family);
- gl_label_set_default_font_family (this->priv->label,
- font_family);
- }
- g_free (font_family);
+ gl_label_set_selection_font_family (this->priv->label, font_family);
+ gl_label_set_default_font_family (this->priv->label, font_family);
+ }
+ g_free (font_family);
gl_debug (DEBUG_PROPERTY_BAR, "END");
diff --git a/src/ui-sidebar.c b/src/ui-sidebar.c
index ad0cba5..d12f812 100644
--- a/src/ui-sidebar.c
+++ b/src/ui-sidebar.c
@@ -63,7 +63,7 @@ static void gl_ui_sidebar_construct (glUISidebar *sidebar);
/****************************************************************************/
/* Boilerplate Object stuff. */
/****************************************************************************/
-G_DEFINE_TYPE (glUISidebar, gl_ui_sidebar, GTK_TYPE_VBOX);
+G_DEFINE_TYPE (glUISidebar, gl_ui_sidebar, GTK_TYPE_VBOX)
static void
diff --git a/src/view.c b/src/view.c
index b1550b4..020713d 100644
--- a/src/view.c
+++ b/src/view.c
@@ -193,7 +193,7 @@ static void resize_event (glView *view,
/****************************************************************************/
/* Boilerplate Object stuff. */
/****************************************************************************/
-G_DEFINE_TYPE (glView, gl_view, GTK_TYPE_VBOX);
+G_DEFINE_TYPE (glView, gl_view, GTK_TYPE_VBOX)
static void
@@ -867,7 +867,7 @@ draw_markup_layer (glView *view,
if (rotate_flag)
{
lgl_template_frame_get_size (frame, &width, &height);
- cairo_rotate (cr, -M_PI/2.0);
+ cairo_rotate (cr, -G_PI/2.0);
cairo_translate (cr, -width, 0.0);
}
diff --git a/src/view.h b/src/view.h
index 8d6ae7c..a23efa7 100644
--- a/src/view.h
+++ b/src/view.h
@@ -35,7 +35,7 @@ typedef enum {
GL_VIEW_ARROW_SELECT_REGION,
GL_VIEW_ARROW_MOVE,
GL_VIEW_ARROW_RESIZE,
- GL_VIEW_CREATE_DRAG,
+ GL_VIEW_CREATE_DRAG
} glViewState;
#define GL_TYPE_VIEW (gl_view_get_type ())
diff --git a/src/wdgt-chain-button.c b/src/wdgt-chain-button.c
index 565f8bc..e3cd8c0 100644
--- a/src/wdgt-chain-button.c
+++ b/src/wdgt-chain-button.c
@@ -49,17 +49,10 @@ static gboolean gl_wdgt_chain_button_draw_lines (GtkWidget *widg
static const gchar *gl_wdgt_chain_stock_items[] =
{
-#if 0
- "glabels-hchain",
- "glabels-hchain-broken",
- "glabels-vchain",
- "glabels-vchain-broken"
-#else
"changes-prevent",
"changes-allow",
"changes-prevent",
- "changes-allow",
-#endif
+ "changes-allow"
};
@@ -67,7 +60,7 @@ static guint gl_wdgt_chain_button_signals[LAST_SIGNAL] = { 0 };
-G_DEFINE_TYPE (glWdgtChainButton, gl_wdgt_chain_button, GTK_TYPE_TABLE);
+G_DEFINE_TYPE (glWdgtChainButton, gl_wdgt_chain_button, GTK_TYPE_TABLE)
static void
diff --git a/src/window.c b/src/window.c
index 98df0c9..f2883dc 100644
--- a/src/window.c
+++ b/src/window.c
@@ -112,7 +112,7 @@ static void label_changed_cb (glLabel *label,
/****************************************************************************/
/* Boilerplate Object stuff. */
/****************************************************************************/
-G_DEFINE_TYPE (glWindow, gl_window, GTK_TYPE_WINDOW);
+G_DEFINE_TYPE (glWindow, gl_window, GTK_TYPE_WINDOW)
static void
diff --git a/src/xml-label.h b/src/xml-label.h
index 21730c5..6429d4b 100644
--- a/src/xml-label.h
+++ b/src/xml-label.h
@@ -30,7 +30,7 @@ typedef enum {
XML_LABEL_UNKNOWN_MEDIA = 1,
XML_LABEL_OK = 0,
XML_LABEL_ERROR_OPEN_PARSE = -10,
- XML_LABEL_ERROR_SAVE_FILE = -20,
+ XML_LABEL_ERROR_SAVE_FILE = -20
} glXMLLabelStatus;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]