+2004-07-18 Jim Evins <evins@snaught.com>
+
+ * data/glabels-2.0.dtd:
+ * src/bc.c: (gl_barcode_default_digits), (gl_barcode_can_freeform),
+ (gl_barcode_get_prefered_n):
+ * src/bc.h:
+ * src/label-barcode.c: (copy), (gl_label_barcode_set_props),
+ (gl_label_barcode_get_props), (get_size):
+ * src/label-barcode.h:
+ * src/object-editor-bc-page.c: (gl_object_editor_prepare_bc_page),
+ (style_changed_cb), (gl_object_editor_set_bc_style),
+ (gl_object_editor_get_bc_style):
+ * src/object-editor-data-page.c: (data_radio_toggled_cb),
+ (gl_object_editor_set_data), (gl_object_editor_get_data):
+ * src/object-editor-private.h:
+ * src/object-editor.c: (gl_object_editor_set_key_names):
+ * src/object-editor.glade:
+ * src/object-editor.h:
+ * src/print.c: (draw_barcode_object):
+ * src/view-barcode.c: (update_object_from_editor_cb),
+ (update_editor_from_object_cb),
+ (gl_view_barcode_create_event_handler), (draw_barcode):
+ * src/xml-label-04.c: (xml04_parse_barcode_props):
+ * src/xml-label-191.c: (xml191_parse_barcode_props):
+ * src/xml-label.c: (xml_parse_object_barcode),
+ (xml_create_object_barcode):
+ Added "format" attribute to barcode objects. This attribute is used
+ to properly format freeform barcodes barcodes prior to merge data is
+ applied, so that barcodes can be accurately layed out. This addresses
+ remaining issues of feature request #824787. Also added an example of
+ the format in the object editor.
+
2004-07-12 Jim Evins <evins@snaught.com>
Various code cleanups.
color %UINT_TYPE; #REQUIRED
data %STRING_TYPE; #IMPLIED
field %STRING_TYPE; #IMPLIED
+ format %UINT_TYPE; #IMPLIED
%affine_attrs;
%shadow_attrs;
>
gboolean can_checksum;
gboolean checksum_optional;
gchar *default_digits;
+ gboolean can_freeform;
+ guint prefered_n;
} Backend;
Backend backends[] = {
{ "POSTNET", N_("POSTNET (any)"), gl_barcode_postnet_new,
- FALSE, FALSE, TRUE, FALSE, "000000000"},
+ FALSE, FALSE, TRUE, FALSE, "12345-6789-12", FALSE, 11},
{ "POSTNET-5", N_("POSTNET-5 (ZIP only)"), gl_barcode_postnet_new,
- FALSE, FALSE, TRUE, FALSE, "00000"},
+ FALSE, FALSE, TRUE, FALSE, "12345", FALSE, 5},
{ "POSTNET-9", N_("POSTNET-9 (ZIP+4)"), gl_barcode_postnet_new,
- FALSE, FALSE, TRUE, FALSE, "000000000"},
+ FALSE, FALSE, TRUE, FALSE, "12345-6789", FALSE, 9},
{ "POSTNET-11", N_("POSTNET-11 (DPBC)"), gl_barcode_postnet_new,
- FALSE, FALSE, TRUE, FALSE, "00000000000"},
+ FALSE, FALSE, TRUE, FALSE, "12345-6789-12", FALSE, 11},
{ "EAN", N_("EAN (any)"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, FALSE, "000000000000 00000"},
+ TRUE, TRUE, TRUE, FALSE, "000000000000 00000", FALSE, 17},
{ "EAN-8", N_("EAN-8"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, FALSE, "0000000"},
+ TRUE, TRUE, TRUE, FALSE, "0000000", FALSE, 7},
{ "EAN-8+2", N_("EAN-8 +2"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, FALSE, "0000000 00"},
+ TRUE, TRUE, TRUE, FALSE, "0000000 00", FALSE, 9},
{ "EAN-8+5", N_("EAN-8 +5"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, FALSE, "0000000 00000"},
+ TRUE, TRUE, TRUE, FALSE, "0000000 00000", FALSE, 12},
{ "EAN-13", N_("EAN-13"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, FALSE, "000000000000"},
+ TRUE, TRUE, TRUE, FALSE, "000000000000", FALSE, 12},
{ "EAN-13+2", N_("EAN-13 +2"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, FALSE, "000000000000 00"},
+ TRUE, TRUE, TRUE, FALSE, "000000000000 00", FALSE, 14},
{ "EAN-13+5", N_("EAN-13 +5"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, FALSE, "000000000000 00000"},
+ TRUE, TRUE, TRUE, FALSE, "000000000000 00000", FALSE, 17},
{ "UPC", N_("UPC (UPC-A or UPC-E)"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, FALSE, "00000000000 00000"},
+ TRUE, TRUE, TRUE, FALSE, "00000000000 00000", FALSE, 16},
{ "UPC-A", N_("UPC-A"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, FALSE, "00000000000"},
+ TRUE, TRUE, TRUE, FALSE, "00000000000", FALSE, 11},
{ "UPC-A+2", N_("UPC-A +2"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, FALSE, "00000000000 00"},
+ TRUE, TRUE, TRUE, FALSE, "00000000000 00", FALSE, 13},
{ "UPC-A+5", N_("UPC-A +5"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, FALSE, "00000000000 00000"},
+ TRUE, TRUE, TRUE, FALSE, "00000000000 00000", FALSE, 16},
{ "UPC-E", N_("UPC-E"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, FALSE, "000000"},
+ TRUE, TRUE, TRUE, FALSE, "000000", FALSE, 6},
{ "UPC-E+2", N_("UPC-E +2"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, FALSE, "000000 00"},
+ TRUE, TRUE, TRUE, FALSE, "000000 00", FALSE, 8},
{ "UPC-E+5", N_("UPC-E +5"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, FALSE, "000000 00000"},
+ TRUE, TRUE, TRUE, FALSE, "000000 00000", FALSE, 11},
{ "ISBN", N_("ISBN"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, TRUE, "0-00000-000-0"},
+ TRUE, TRUE, TRUE, TRUE, "0-00000-000-0", FALSE, 10},
{ "ISBN+5", N_("ISBN +5"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, TRUE, "0-00000-000-0 00000"},
+ TRUE, TRUE, TRUE, TRUE, "0-00000-000-0 00000", FALSE, 15},
{ "Code39", N_("Code 39"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, TRUE, "0000000000"},
+ TRUE, TRUE, TRUE, TRUE, "0000000000", TRUE, 10},
{ "Code128", N_("Code 128"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, TRUE, "0000000000"},
+ TRUE, TRUE, TRUE, TRUE, "0000000000", TRUE, 10},
{ "Code128C", N_("Code 128C"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, TRUE, "0000000000"},
+ TRUE, TRUE, TRUE, TRUE, "0000000000", TRUE, 10},
{ "Code128B", N_("Code 128B"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, TRUE, "0000000000"},
+ TRUE, TRUE, TRUE, TRUE, "0000000000", TRUE, 10},
{ "I25", N_("Interleaved 2 of 5"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, TRUE, "0000000000"},
+ TRUE, TRUE, TRUE, TRUE, "0000000000", TRUE, 10},
{ "CBR", N_("Codabar"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, TRUE, "0000000000"},
+ TRUE, TRUE, TRUE, TRUE, "0000000000", TRUE, 10},
{ "MSI", N_("MSI"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, TRUE, "0000000000"},
+ TRUE, TRUE, TRUE, TRUE, "0000000000", TRUE, 10},
{ "PLS", N_("Plessey"), gl_barcode_gnubarcode_new,
- TRUE, TRUE, TRUE, TRUE, "0000000000"},
+ TRUE, TRUE, TRUE, TRUE, "0000000000", TRUE, 10},
- { NULL, NULL, NULL, FALSE, FALSE, FALSE, FALSE, NULL}
+ { NULL, NULL, NULL, FALSE, FALSE, FALSE, FALSE, NULL, FALSE, 0}
};
/* Return an appropriate set of digits for the given barcode style. */
/*****************************************************************************/
gchar *
-gl_barcode_default_digits (const gchar *id)
+gl_barcode_default_digits (const gchar *id,
+ guint n)
{
- return g_strdup (backends[id_to_index (id)].default_digits);
+ int i;
+
+ i = id_to_index (id);
+
+ if (backends[i].can_freeform) {
+
+ return g_strnfill (n, '0');
+
+ } else {
+
+ return g_strdup (backends[i].default_digits);
+
+ }
}
/*****************************************************************************/
return backends[id_to_index (id)].checksum_optional;
}
+
+/*****************************************************************************/
+/* Query if freeform input is allowed. */
+/*****************************************************************************/
+gboolean
+gl_barcode_can_freeform (const gchar *id)
+{
+ return backends[id_to_index (id)].can_freeform;
+}
+
+/*****************************************************************************/
+/* Query prefered number of digits of input. */
+/*****************************************************************************/
+guint
+gl_barcode_get_prefered_n (const gchar *id)
+{
+ return backends[id_to_index (id)].prefered_n;
+}
+
/*****************************************************************************/
/* Convert style to text. */
/*****************************************************************************/
GList *gl_barcode_get_styles_list (void);
void gl_barcode_free_styles_list (GList *styles_list);
-gchar *gl_barcode_default_digits (const gchar *id);
+gchar *gl_barcode_default_digits (const gchar *id,
+ guint n);
gboolean gl_barcode_can_text (const gchar *id);
gboolean gl_barcode_text_optional (const gchar *id);
gboolean gl_barcode_can_csum (const gchar *id);
gboolean gl_barcode_csum_optional (const gchar *id);
+gboolean gl_barcode_can_freeform (const gchar *id);
+guint gl_barcode_get_prefered_n (const gchar *id);
+
const gchar *gl_barcode_id_to_name (const gchar *id);
const gchar *gl_barcode_name_to_id (const gchar *name);
guint color;
gboolean text_flag;
gboolean checksum_flag;
+ guint format_digits;
};
/*========================================================*/
gboolean text_flag;
gboolean checksum_flag;
guint color;
+ guint format_digits;
gl_debug (DEBUG_LABEL, "START");
g_return_if_fail (new_lbc && GL_IS_LABEL_BARCODE (new_lbc));
text_node = gl_label_barcode_get_data (lbc);
- gl_label_barcode_get_props (lbc, &id, &text_flag, &checksum_flag);
+ gl_label_barcode_get_props (lbc, &id, &text_flag, &checksum_flag, &format_digits);
color = get_line_color (src_object);
gl_label_barcode_set_data (new_lbc, text_node);
- gl_label_barcode_set_props (new_lbc, id, text_flag, checksum_flag);
+ gl_label_barcode_set_props (new_lbc, id, text_flag, checksum_flag, format_digits);
set_line_color (dst_object, color);
gl_text_node_free (&text_node);
gl_label_barcode_set_props (glLabelBarcode *lbc,
gchar *id,
gboolean text_flag,
- gboolean checksum_flag)
+ gboolean checksum_flag,
+ guint format_digits)
{
gl_debug (DEBUG_LABEL, "START");
if ( ((lbc->private->id == NULL) && (id != NULL))
|| (g_strcasecmp (lbc->private->id, id) != 0)
|| (lbc->private->text_flag != text_flag)
- || (lbc->private->checksum_flag != checksum_flag) ) {
+ || (lbc->private->checksum_flag != checksum_flag)
+ || (lbc->private->format_digits != format_digits)) {
lbc->private->id = g_strdup (id);
lbc->private->text_flag = text_flag;
lbc->private->checksum_flag = checksum_flag;
+ lbc->private->format_digits = format_digits;
gl_label_object_emit_changed (GL_LABEL_OBJECT(lbc));
gl_label_barcode_get_props (glLabelBarcode *lbc,
gchar **id,
gboolean *text_flag,
- gboolean *checksum_flag)
+ gboolean *checksum_flag,
+ guint *format_digits)
{
g_return_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc));
*id = g_strdup (lbc->private->id);
*text_flag = lbc->private->text_flag;
*checksum_flag = lbc->private->checksum_flag;
+ *format_digits = lbc->private->format_digits;
}
/*---------------------------------------------------------------------------*/
if (lbc->private->text_node->field_flag) {
- data = gl_barcode_default_digits (lbc->private->id);
+ data = gl_barcode_default_digits (lbc->private->id,
+ lbc->private->format_digits);
} else {
data = gl_text_node_expand (lbc->private->text_node, NULL);
}
if ( gbc == NULL ) {
/* Try again with default digits. */
- data = gl_barcode_default_digits (lbc->private->id);
+ data = gl_barcode_default_digits (lbc->private->id,
+ lbc->private->format_digits);
gbc = gl_barcode_new (lbc->private->id,
lbc->private->text_flag,
lbc->private->checksum_flag,
void gl_label_barcode_set_props (glLabelBarcode *lbc,
gchar *id,
gboolean text_flag,
- gboolean checksum_flag);
+ gboolean checksum_flag,
+ guint format_digits);
glTextNode *gl_label_barcode_get_data (glLabelBarcode *lbc);
void gl_label_barcode_get_props (glLabelBarcode *lbc,
gchar **id,
gboolean *text_flag,
- gboolean *checksum_flag);
+ gboolean *checksum_flag,
+ guint *format_digits);
G_END_DECLS
glade_xml_get_widget (editor->priv->gui, "bc_cs_check");
editor->priv->bc_color_combo =
glade_xml_get_widget (editor->priv->gui, "bc_color_combo");
+ editor->priv->data_format_label =
+ glade_xml_get_widget (editor->priv->gui, "data_format_label");
+ editor->priv->data_ex_label =
+ glade_xml_get_widget (editor->priv->gui, "data_ex_label");
+ editor->priv->data_digits_label =
+ glade_xml_get_widget (editor->priv->gui, "data_digits_label");
+ editor->priv->data_digits_spin =
+ glade_xml_get_widget (editor->priv->gui, "data_digits_spin");
+
+ editor->priv->data_format_fixed_flag = FALSE;
/* Load barcode styles */
styles = gl_barcode_get_styles_list ();
"color_changed",
G_CALLBACK (gl_object_editor_changed_cb),
G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->data_digits_spin),
+ "changed",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
gl_debug (DEBUG_EDITOR, "END");
}
static void
style_changed_cb (glObjectEditor *editor)
{
- gchar *style_string;
+ gchar *style_string = NULL;
const gchar *id;
+ gchar *ex_string = NULL;
+ guint digits;
style_string =
gtk_editable_get_chars (GTK_EDITABLE(editor->priv->bc_style_entry), 0, -1);
gtk_widget_set_sensitive (editor->priv->bc_cs_check,
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);
+ }
+ ex_string = gl_barcode_default_digits (id, digits);
+ gtk_label_set_text (GTK_LABEL(editor->priv->data_ex_label), ex_string);
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->data_literal_radio))) {
+ gtk_widget_set_sensitive (editor->priv->data_format_label, FALSE);
+ gtk_widget_set_sensitive (editor->priv->data_ex_label, FALSE);
+ gtk_widget_set_sensitive (editor->priv->data_digits_label, FALSE);
+ gtk_widget_set_sensitive (editor->priv->data_digits_spin, FALSE);
+ } else {
+ gtk_widget_set_sensitive (editor->priv->data_format_label, TRUE);
+ gtk_widget_set_sensitive (editor->priv->data_ex_label, TRUE);
+ gtk_widget_set_sensitive (editor->priv->data_digits_label,
+ !editor->priv->data_format_fixed_flag);
+ gtk_widget_set_sensitive (editor->priv->data_digits_spin,
+ !editor->priv->data_format_fixed_flag);
+ }
+
/* Emit our "changed" signal */
g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0);
}
g_free (style_string);
+ g_free (ex_string);
}
/*****************************************************************************/
gl_object_editor_set_bc_style (glObjectEditor *editor,
gchar *id,
gboolean text_flag,
- gboolean checksum_flag)
+ gboolean checksum_flag,
+ guint format_digits)
{
const gchar *style_string;
gint pos;
+ gchar *ex_string;
gl_debug (DEBUG_EDITOR, "START");
g_signal_handlers_block_by_func (G_OBJECT(editor->priv->bc_cs_check),
G_CALLBACK (gl_object_editor_changed_cb),
editor);
+ g_signal_handlers_block_by_func (G_OBJECT (editor->priv->data_digits_spin),
+ G_CALLBACK (gl_object_editor_changed_cb),
+ editor);
style_string = gl_barcode_id_to_name (id);
gtk_widget_set_sensitive (editor->priv->bc_cs_check,
gl_barcode_csum_optional (id));
+ editor->priv->data_format_fixed_flag = !gl_barcode_can_freeform (id);
+
+ if (editor->priv->data_format_fixed_flag) {
+ format_digits = gl_barcode_get_prefered_n (id);
+ }
+
+ ex_string = gl_barcode_default_digits (id, format_digits);
+ gtk_label_set_text (GTK_LABEL(editor->priv->data_ex_label), ex_string);
+ g_free (ex_string);
+
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->data_digits_spin),
+ format_digits);
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->data_literal_radio))) {
+ gtk_widget_set_sensitive (editor->priv->data_format_label, FALSE);
+ gtk_widget_set_sensitive (editor->priv->data_ex_label, FALSE);
+ gtk_widget_set_sensitive (editor->priv->data_digits_label, FALSE);
+ gtk_widget_set_sensitive (editor->priv->data_digits_spin, FALSE);
+ } else {
+ gtk_widget_set_sensitive (editor->priv->data_format_label, TRUE);
+ gtk_widget_set_sensitive (editor->priv->data_ex_label, TRUE);
+ gtk_widget_set_sensitive (editor->priv->data_digits_label,
+ !editor->priv->data_format_fixed_flag);
+ gtk_widget_set_sensitive (editor->priv->data_digits_spin,
+ !editor->priv->data_format_fixed_flag);
+ }
+
g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->bc_style_entry),
G_CALLBACK (style_changed_cb),
editor);
g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->bc_cs_check),
G_CALLBACK (gl_object_editor_changed_cb),
editor);
+ g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->data_digits_spin),
+ G_CALLBACK (gl_object_editor_changed_cb),
+ editor);
gl_debug (DEBUG_EDITOR, "END");
}
gl_object_editor_get_bc_style (glObjectEditor *editor,
gchar **id,
gboolean *text_flag,
- gboolean *checksum_flag)
+ gboolean *checksum_flag,
+ guint *format_digits)
{
gchar *style_string;
*checksum_flag =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->bc_cs_check));
+
+ *format_digits =
+ gtk_spin_button_get_value (GTK_SPIN_BUTTON(editor->priv->data_digits_spin));
+
g_free (style_string);
gl_debug (DEBUG_EDITOR, "END");
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->data_literal_radio))) {
gtk_widget_set_sensitive (editor->priv->data_text_entry, TRUE);
gtk_widget_set_sensitive (editor->priv->data_key_combo, FALSE);
+ gtk_widget_set_sensitive (editor->priv->data_format_label, FALSE);
+ gtk_widget_set_sensitive (editor->priv->data_ex_label, FALSE);
+ gtk_widget_set_sensitive (editor->priv->data_digits_label, FALSE);
+ gtk_widget_set_sensitive (editor->priv->data_digits_spin, FALSE);
} else {
gtk_widget_set_sensitive (editor->priv->data_text_entry, FALSE);
gtk_widget_set_sensitive (editor->priv->data_key_combo, TRUE);
- }
+ gtk_widget_set_sensitive (editor->priv->data_format_label, TRUE);
+ gtk_widget_set_sensitive (editor->priv->data_ex_label, TRUE);
+ gtk_widget_set_sensitive (editor->priv->data_digits_label,
+ !editor->priv->data_format_fixed_flag);
+ gtk_widget_set_sensitive (editor->priv->data_digits_spin,
+ !editor->priv->data_format_fixed_flag);
+ }
/* Emit our "changed" signal */
g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0);
(editor->priv->data_literal_radio), TRUE);
gtk_widget_set_sensitive (editor->priv->data_text_entry, TRUE);
gtk_widget_set_sensitive (editor->priv->data_key_combo, FALSE);
+ gtk_widget_set_sensitive (editor->priv->data_format_label, FALSE);
+ gtk_widget_set_sensitive (editor->priv->data_ex_label, FALSE);
+ gtk_widget_set_sensitive (editor->priv->data_digits_spin, FALSE);
+ gtk_widget_set_sensitive (editor->priv->data_digits_label, FALSE);
gtk_editable_delete_text (GTK_EDITABLE (editor->priv->data_text_entry), 0, -1);
pos = 0;
gtk_widget_set_sensitive (editor->priv->data_text_entry, FALSE);
gtk_widget_set_sensitive (editor->priv->data_key_combo, TRUE);
+ gtk_widget_set_sensitive (editor->priv->data_format_label, TRUE);
+ gtk_widget_set_sensitive (editor->priv->data_ex_label, TRUE);
+ gtk_widget_set_sensitive (editor->priv->data_digits_label,
+ !editor->priv->data_format_fixed_flag);
+ gtk_widget_set_sensitive (editor->priv->data_digits_spin,
+ !editor->priv->data_format_fixed_flag);
gtk_editable_delete_text (GTK_EDITABLE (editor->priv->data_key_entry), 0, -1);
pos = 0;
return text_node;
}
-
GtkWidget *data_text_entry;
GtkWidget *data_key_entry;
GtkWidget *data_key_combo;
-
+ GtkWidget *data_format_label;
+ GtkWidget *data_ex_label;
+ GtkWidget *data_digits_label;
+ GtkWidget *data_digits_spin;
+ gboolean data_format_fixed_flag;
};
enum {
{
GList *keys;
GtkWidget *combo;
+ gboolean fixed_flag;
gl_debug (DEBUG_EDITOR, "START");
}
}
-
+ fixed_flag = editor->priv->data_format_fixed_flag;
+ if (editor->priv->data_format_label) {
+ gtk_widget_set_sensitive (editor->priv->data_format_label,
+ (merge != NULL));
+ }
+ if (editor->priv->data_ex_label) {
+ gtk_widget_set_sensitive (editor->priv->data_ex_label,
+ (merge != NULL));
+ }
+ if (editor->priv->data_digits_label) {
+ gtk_widget_set_sensitive (editor->priv->data_digits_label,
+ (merge != NULL) && !fixed_flag);
+ }
+ if (editor->priv->data_digits_spin) {
+ gtk_widget_set_sensitive (editor->priv->data_digits_spin,
+ (merge != NULL) && !fixed_flag);
+ }
keys = gl_merge_get_key_list (merge);
if ( keys != NULL ) {
<child>
<widget class="GtkTable" id="table4">
<property name="visible">True</property>
- <property name="n_rows">2</property>
+ <property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">12</property>
<property name="y_options">fill</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkTable" id="table9">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="data_format_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">format:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="data_ex_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">00000000000 00000</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="data_digits_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">digits:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox32">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkSpinButton" id="data_digits_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">1 1 100 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
void gl_object_editor_set_bc_style (glObjectEditor *editor,
gchar *id,
gboolean text_flag,
- gboolean checksum_flag);
+ gboolean checksum_flag,
+ guint format_digits);
void gl_object_editor_get_bc_style (glObjectEditor *editor,
gchar **id,
gboolean *text_flag,
- gboolean *checksum_flag);
+ gboolean *checksum_flag,
+ guint *format_digits);
void gl_object_editor_set_bc_color (glObjectEditor *editor,
guint text_color);
-
G_END_DECLS
#endif
gboolean text_flag;
gboolean checksum_flag;
guint color;
+ guint format_digits;
gdouble w, h;
gl_debug (DEBUG_PRINT, "START");
text_node = gl_label_barcode_get_data (object);
gl_label_barcode_get_props (object,
- &id, &text_flag, &checksum_flag);
+ &id, &text_flag, &checksum_flag, &format_digits);
color = gl_label_object_get_line_color (GL_LABEL_OBJECT(object));
gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h);
gchar *id;
gboolean text_flag, cs_flag;
guint color;
+ guint format_digits;
gl_debug (DEBUG_VIEW, "START");
gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node);
gl_text_node_free (&text_node);
- gl_object_editor_get_bc_style (editor, &id, &text_flag, &cs_flag);
+ gl_object_editor_get_bc_style (editor, &id, &text_flag, &cs_flag, &format_digits);
color = gl_object_editor_get_bc_color (editor);
gl_label_barcode_set_props (GL_LABEL_BARCODE(object),
- id, text_flag, cs_flag);
+ id, text_flag, cs_flag, format_digits);
gl_label_object_set_line_color (object, color);
g_free (id);
gboolean text_flag, cs_flag;
guint color;
glMerge *merge;
+ guint format_digits;
gl_debug (DEBUG_VIEW, "START");
gl_object_editor_set_size (editor, w, h);
gl_label_barcode_get_props (GL_LABEL_BARCODE(object),
- &id, &text_flag, &cs_flag);
+ &id, &text_flag, &cs_flag, &format_digits);
color = gl_label_object_get_line_color (object);
- gl_object_editor_set_bc_style (editor, id, text_flag, cs_flag);
+ gl_object_editor_set_bc_style (editor, id, text_flag, cs_flag, format_digits);
gl_object_editor_set_bc_color (editor, color);
g_free (id);
gl_label_barcode_set_props (GL_LABEL_BARCODE(object),
"POSTNET",
FALSE,
- TRUE);
+ TRUE,
+ 0);
gl_label_object_set_line_color (GL_LABEL_OBJECT(object),
gl_color_set_opacity (
gl_view_get_default_line_color(view),
gl_label_barcode_set_props (GL_LABEL_BARCODE(object),
"POSTNET",
FALSE,
- TRUE);
+ TRUE,
+ 0);
gl_label_object_set_line_color (GL_LABEL_OBJECT(object),
gl_view_get_default_line_color(view));
gl_view_unselect_all (view);
GnomeFont *font;
GnomeGlyphList *glyphlist;
gdouble y_offset;
+ guint format_digits;
gl_debug (DEBUG_VIEW, "START");
/* Query label object and properties */
object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode));
gl_label_barcode_get_props (GL_LABEL_BARCODE(object),
- &id, &text_flag, &checksum_flag);
+ &id, &text_flag, &checksum_flag, &format_digits);
color = gl_label_object_get_line_color (object);
gl_label_object_get_size (object, &w, &h);
text_node = gl_label_barcode_get_data(GL_LABEL_BARCODE(object));
if (text_node->field_flag) {
- digits = gl_barcode_default_digits (id);
+ digits = gl_barcode_default_digits (id, format_digits);
} else {
digits = gl_text_node_expand (text_node, NULL);
}
if (scale == 0.0) {
scale = 0.5; /* Set to a valid value */
}
- gl_label_barcode_set_props (object, id, text_flag, TRUE);
+ gl_label_barcode_set_props (object, id, text_flag, TRUE, 0);
gl_label_object_set_line_color (GL_LABEL_OBJECT(object), color);
child = node->xmlChildrenNode;
gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node);
gl_label_barcode_set_props (GL_LABEL_BARCODE(object),
- id, text_flag, checksum_flag);
+ id, text_flag, checksum_flag, 0);
gl_label_object_set_line_color (GL_LABEL_OBJECT(object), color);
gl_text_node_free (&text_node);
gboolean text_flag;
gboolean checksum_flag;
guint color;
+ guint format_digits;
gdouble affine[6];
gl_debug (DEBUG_XML, "START");
text_flag = gl_xml_get_prop_boolean (node, "text", FALSE);
checksum_flag = gl_xml_get_prop_boolean (node, "checksum", TRUE);
color = gl_xml_get_prop_uint (node, "color", 0);
+ format_digits = gl_xml_get_prop_uint (node, "format", 0);
gl_label_barcode_set_props (GL_LABEL_BARCODE(object),
- id, text_flag, checksum_flag);
+ id, text_flag, checksum_flag, format_digits);
gl_label_object_set_line_color (GL_LABEL_OBJECT(object), color);
g_free (id);
gboolean text_flag;
gboolean checksum_flag;
guint color;
+ guint format_digits;
gdouble affine[6];
gl_debug (DEBUG_XML, "START");
/* Barcode properties attrs */
gl_label_barcode_get_props (GL_LABEL_BARCODE(object),
- &id, &text_flag, &checksum_flag);
+ &id, &text_flag, &checksum_flag, &format_digits);
color = gl_label_object_get_line_color (GL_LABEL_OBJECT(object));
xmlSetProp (node, "style", id);
gl_xml_set_prop_boolean (node, "text", text_flag);
text_node = gl_label_barcode_get_data (GL_LABEL_BARCODE(object));
if (text_node->field_flag) {
xmlSetProp (node, "field", text_node->data);
+ gl_xml_set_prop_int (node, "format", format_digits);
} else {
xmlSetProp (node, "data", text_node->data);
}