}
*/
- // g_message ("Zint Requested Dimensions: %f x %f", w, h);
-
result = ZBarcode_Encode(symbol, (unsigned char *)digits, 0);
if (result) {
ZBarcode_Delete (symbol);
- g_message ("Zint Error: %s", symbol->errtxt);
+ gl_debug (DEBUG_BARCODE, "Zint Error: %s", symbol->errtxt);
return NULL;
}
/* Scale calculated after height, always maintain aspect ratio */
- // symbol->height = (h > 0.0 ? (gint)h : 50);
symbol->scale = (w / symbol->width);
- symbol->height = h / symbol->scale; // height always in standard size
+ symbol->height = h / symbol->scale; /* height always in standard size */
/* Convert Sums provided by zint encode */
gbc = render_zint(symbol, text_flag);
- // g_message ("Zint Barcode Dimensions: %f x %f", gbc->width, gbc->height);
-
ZBarcode_Delete(symbol);
return gbc;
if (symbol->height < 15) {
symbol->height = 15;
}
- // symbol->height = 50;
if(text_flag && strlen(symbol->text) != 0) {
textheight = 9.0;
} else {
textheight = textoffset = 0.0;
}
- // Update height for texts
+ /* Update height for texts */
symbol->height -= textheight + textoffset;
large_bar_count = 0;
line->length = (row_height - 5.0) * scaler;
}
latch = 0;
- // g_message ("Zint Adding Line at: %f x %f dim: %f x %f", line->x, line->y, line->width, line->length);
gl_barcode_add_shape (gbc, (glBarcodeShape *)line);
} else {
/* a space */
/* That's done the actual data area, everything else is human-friendly */
-
-
-
/* Add the text */
xoffset -= comp_offset;
if (text_flag) {
- // caculate start xoffset to center text
+ /* caculate start xoffset to center text */
xoffset = symbol->width / 2.0;
xoffset -= (strlen(symbol->text) / 2) * 5.0;
bchar->fsize = 8.0 * scaler;
bchar->c = (gchar) *p;
gl_barcode_add_shape (gbc, (glBarcodeShape *)bchar);
- // Poor mans kerning
+ /* Poor mans kerning */
if (*p == '(') {
xoffset += 3.0;
} else if (*p == ')') {
#ifdef HAVE_LIBZINT
- { "GS1-128", N_("GS1-128"), gl_barcode_zint_new,
+ { "GS1-128", N_("GS1-128"), gl_barcode_zint_new,
TRUE, TRUE, FALSE, FALSE, "[00]001234560000000018", TRUE, 16},
#endif /* HAVE_LIBZINT */
debug_flags |= GLABELS_DEBUG_PATH;
if (g_getenv ("GLABELS_DEBUG_FIELD_BUTTON") != NULL)
debug_flags |= GLABELS_DEBUG_FIELD_BUTTON;
+ if (g_getenv ("GLABELS_DEBUG_BARCODE") != NULL)
+ debug_flags |= GLABELS_DEBUG_BARCODE;
}
GLABELS_DEBUG_WDGT = 1 << 20,
GLABELS_DEBUG_PATH = 1 << 21,
GLABELS_DEBUG_FIELD_BUTTON = 1 << 22,
+ GLABELS_DEBUG_BARCODE = 1 << 23,
} glDebugSection;
#define DEBUG_WDGT GLABELS_DEBUG_WDGT, __FILE__, __LINE__, __FUNCTION__
#define DEBUG_PATH GLABELS_DEBUG_PATH, __FILE__, __LINE__, __FUNCTION__
#define DEBUG_FIELD_BUTTON GLABELS_DEBUG_FIELD_BUTTON, __FILE__, __LINE__, __FUNCTION__
+#define DEBUG_BARCODE GLABELS_DEBUG_BARCODE,__FILE__, __LINE__, __FUNCTION__
void gl_debug_init (void);
/* Local function prototypes */
/*===========================================*/
-static void style_changed_cb (glObjectEditor *editor);
-static void bc_radio_toggled_cb (glObjectEditor *editor);
+static void style_changed_cb (glObjectEditor *editor);
+static void bc_radio_toggled_cb (glObjectEditor *editor);
+static void data_digits_spin_changed_cb (glObjectEditor *editor);
/*--------------------------------------------------------------------------*/
G_OBJECT (editor));
g_signal_connect_swapped (G_OBJECT (editor->priv->data_digits_spin),
"changed",
- G_CALLBACK (gl_object_editor_changed_cb),
+ G_CALLBACK (data_digits_spin_changed_cb),
G_OBJECT (editor));
gl_debug (DEBUG_EDITOR, "END");
gl_barcode_csum_optional (id));
editor->priv->data_format_fixed_flag = !gl_barcode_can_freeform (id);
- digits = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->data_digits_spin));
- if (editor->priv->data_format_fixed_flag) {
- digits = gl_barcode_get_prefered_n(id);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->data_digits_spin),
- digits);
- }
+ digits = gl_barcode_get_prefered_n(id);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->data_digits_spin), digits);
ex_string = gl_barcode_default_digits (id, digits);
gtk_label_set_text (GTK_LABEL(editor->priv->data_ex_label), ex_string);
}
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. digits spin changed callback. */
+/*--------------------------------------------------------------------------*/
+static void
+data_digits_spin_changed_cb (glObjectEditor *editor)
+{
+ gchar *style_string;
+ const gchar *id;
+ guint digits;
+ gchar *ex_string;
+
+ if (editor->priv->stop_signals) return;
+
+ style_string = gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->bc_style_combo));
+ if ( *style_string != 0 ) {
+ id = gl_barcode_name_to_id (style_string);
+
+ digits = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->data_digits_spin));
+ ex_string = gl_barcode_default_digits (id, digits);
+ gtk_label_set_text (GTK_LABEL(editor->priv->data_ex_label), ex_string);
+ }
+
+ g_free (style_string);
+ g_free (ex_string);
+
+ gl_object_editor_changed_cb (editor);
+}
+
+
/*
* Local Variables: -- emacs