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;
LGL_TEMPLATE_MARKUP_LINE,
LGL_TEMPLATE_MARKUP_CIRCLE,
LGL_TEMPLATE_MARKUP_RECT,
- LGL_TEMPLATE_MARKUP_ELLIPSE,
+ LGL_TEMPLATE_MARKUP_ELLIPSE
} lglTemplateMarkupType;
LGL_UNITS_FIRST = LGL_UNITS_POINT,
LGL_UNITS_LAST = LGL_UNITS_PICA,
- LGL_UNITS_INVALID = -1,
+ LGL_UNITS_INVALID = -1
} lglUnits;
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);
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;
LGL_BARCODE_SHAPE_CHAR,
LGL_BARCODE_SHAPE_STRING,
LGL_BARCODE_SHAPE_RING,
- LGL_BARCODE_SHAPE_HEXAGON,
+ LGL_BARCODE_SHAPE_HEXAGON
} lglBarcodeShapeType;
/****************************************************************************/
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;
/*========================================================*/
/* 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 */
/*===========================================*/
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);
/*****************************************************************************/
/*****************************************************************************/
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;
}
*--------------------------------------------------------------------------*/
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;
}
/*--------------------------------------------------------------------------*/
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);
}
/*--------------------------------------------------------------------------*/
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);
}
/*--------------------------------------------------------------------------*/
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 */
gint i_width, i_height;
lglBarcode *gbc;
- if ( strlen (digits) == 0 )
+ if ( *digits == '\0' )
{
return NULL;
}
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;
{
gint i_width, i_height;
lglBarcode *gbc;
- QRcode *qrcode;
+ QRcode *qrcode;
- if ( strlen (digits) == 0 )
+ if ( *digits == '\0' )
{
return NULL;
}
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;
}
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;
/*****************************************************************************/
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) )
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;
}
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);
/*****************************************************************************/
/* Object infrastructure. */
/*****************************************************************************/
-G_DEFINE_TYPE (glColorComboButton, gl_color_combo_button, GTK_TYPE_HBOX);
+G_DEFINE_TYPE (glColorComboButton, gl_color_combo_button, GTK_TYPE_HBOX)
/*****************************************************************************/
/****************************************************************************/
/* 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)
/*****************************************************************************/
/****************************************************************************/
/* 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)
/*****************************************************************************/
/*****************************************************************************/
/* Object infrastructure. */
/*****************************************************************************/
-G_DEFINE_TYPE (glColorCombo, gl_color_combo, GTK_TYPE_TOGGLE_BUTTON);
+G_DEFINE_TYPE (glColorCombo, gl_color_combo, GTK_TYPE_TOGGLE_BUTTON)
/*****************************************************************************/
/*****************************************************************************/
/* Object infrastructure. */
/*****************************************************************************/
-G_DEFINE_TYPE (glColorHistoryModel, gl_color_history_model, G_TYPE_OBJECT);
+G_DEFINE_TYPE (glColorHistoryModel, gl_color_history_model, G_TYPE_OBJECT)
/*****************************************************************************/
/****************************************************************************/
/* 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)
/*****************************************************************************/
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;
/****************************************************************************/
/* 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
/*****************************************************************************/
/* Object infrastructure. */
/*****************************************************************************/
-G_DEFINE_TYPE (glFieldButton, gl_field_button, GTK_TYPE_TOGGLE_BUTTON);
+G_DEFINE_TYPE (glFieldButton, gl_field_button, GTK_TYPE_TOGGLE_BUTTON)
/*****************************************************************************/
/****************************************************************************/
/* 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)
/*****************************************************************************/
/****************************************************************************/
/* 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)
/*****************************************************************************/
/*****************************************************************************/
/* Object infrastructure. */
/*****************************************************************************/
-G_DEFINE_TYPE (glFontCombo, gl_font_combo, GTK_TYPE_TOGGLE_BUTTON);
+G_DEFINE_TYPE (glFontCombo, gl_font_combo, GTK_TYPE_TOGGLE_BUTTON)
/*****************************************************************************/
/*****************************************************************************/
/* Object infrastructure. */
/*****************************************************************************/
-G_DEFINE_TYPE (glFontHistoryModel, gl_font_history_model, G_TYPE_OBJECT);
+G_DEFINE_TYPE (glFontHistoryModel, gl_font_history_model, G_TYPE_OBJECT)
/*****************************************************************************/
/****************************************************************************/
/* 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)
/*****************************************************************************/
/*****************************************************************************/
/* 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
/*****************************************************************************/
/* 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
/*****************************************************************************/
/* 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
/*****************************************************************************/
/* 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
/*****************************************************************************/
/* 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
/*****************************************************************************/
/* 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
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;
/*****************************************************************************/
/* Object infrastructure. */
/*****************************************************************************/
-G_DEFINE_TYPE (glLabelText, gl_label_text, GL_TYPE_LABEL_OBJECT);
+G_DEFINE_TYPE (glLabelText, gl_label_text, GL_TYPE_LABEL_OBJECT)
/*****************************************************************************/
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
-G_DEFINE_TYPE (glLabel, gl_label, G_TYPE_OBJECT);
+G_DEFINE_TYPE (glLabel, gl_label, G_TYPE_OBJECT)
static void
/****************************************************************************/
/* 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
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);
enum {
ARG_0,
- ARG_QUERY,
+ ARG_QUERY
};
/*****************************************************************************/
/* 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)
*/
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;
}
{
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);
/*****************************************************************************/
/* 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)
/*****************************************************************************/
enum {
ARG_0,
ARG_DELIM,
- ARG_LINE1_HAS_KEYS,
+ ARG_LINE1_HAS_KEYS
};
/*****************************************************************************/
/* 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
};
enum {
- ARG_0,
+ ARG_0
};
/*****************************************************************************/
/* 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
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;
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;
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)));
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. */
}
/*****************************************************************************/
/* 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)
typedef enum {
GL_MERGE_SRC_IS_FIXED,
- GL_MERGE_SRC_IS_FILE,
+ GL_MERGE_SRC_IS_FILE
} glMergeSrcType;
typedef struct {
/*****************************************************************************/
/* 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)
/*****************************************************************************/
/****************************************************************************/
/* 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)
/*****************************************************************************/
/****************************************************************************/
/* Object infrastructure. */
/****************************************************************************/
-G_DEFINE_TYPE (glMiniPreview, gl_mini_preview, GTK_TYPE_EVENT_BOX);
+G_DEFINE_TYPE (glMiniPreview, gl_mini_preview, GTK_TYPE_EVENT_BOX)
/*****************************************************************************/
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);
/*****************************************************************************/
/* 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)
/*****************************************************************************/
/*****************************************************************************/
/* 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
/*****************************************************************************/
/* 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
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));
/*****************************************************************************/
/* 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
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 )
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 )
GtkWidget *preview;
- gboolean force_outline_flag;
-
gint labels_per_sheet;
gboolean merge_flag;
gint n_records;
/*****************************************************************************/
/* 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
/*****************************************************************************/
/* 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
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);
/* 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 ) {
/*****************************************************************************/
/* 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
/*****************************************************************************/
/* Object infrastructure. */
/*****************************************************************************/
-G_DEFINE_TYPE (glTemplateHistoryModel, gl_template_history_model, G_TYPE_OBJECT);
+G_DEFINE_TYPE (glTemplateHistoryModel, gl_template_history_model, G_TYPE_OBJECT)
/*****************************************************************************/
/****************************************************************************/
/* 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
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");
/****************************************************************************/
/* 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
/****************************************************************************/
/* Boilerplate Object stuff. */
/****************************************************************************/
-G_DEFINE_TYPE (glView, gl_view, GTK_TYPE_VBOX);
+G_DEFINE_TYPE (glView, gl_view, GTK_TYPE_VBOX)
static void
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);
}
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 ())
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"
};
-G_DEFINE_TYPE (glWdgtChainButton, gl_wdgt_chain_button, GTK_TYPE_TABLE);
+G_DEFINE_TYPE (glWdgtChainButton, gl_wdgt_chain_button, GTK_TYPE_TABLE)
static void
/****************************************************************************/
/* Boilerplate Object stuff. */
/****************************************************************************/
-G_DEFINE_TYPE (glWindow, gl_window, GTK_TYPE_WINDOW);
+G_DEFINE_TYPE (glWindow, gl_window, GTK_TYPE_WINDOW)
static void
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;