static void gl_label_object_instance_init (glLabelObject *object);
static void gl_label_object_finalize (GObject *object);
+static void merge_changed_cb (glLabel *label,
+ glLabelObject *object);
+
\f
/*****************************************************************************/
/* Boilerplate object stuff. */
old_parent = object->parent;
if ( old_parent != NULL ) {
+ g_signal_handlers_disconnect_by_func (old_parent,
+ G_CALLBACK(merge_changed_cb),
+ object);
gl_label_remove_object( old_parent, object );
}
gl_label_add_object( label, object );
+ g_signal_connect (G_OBJECT(label), "merge_changed",
+ G_CALLBACK(merge_changed_cb), object);
+
g_signal_emit (G_OBJECT(object), signals[CHANGED], 0);
gl_debug (DEBUG_LABEL, "END");
gl_debug (DEBUG_LABEL, "END");
}
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Label's merge data changed callback. */
+/*--------------------------------------------------------------------------*/
+static void
+merge_changed_cb (glLabel *label,
+ glLabelObject *object)
+{
+ gl_label_object_emit_changed (object);
+}
+
CHANGED,
NAME_CHANGED,
MODIFIED_CHANGED,
+ MERGE_CHANGED,
LAST_SIGNAL
};
gl_marshal_VOID__VOID,
G_TYPE_NONE,
0);
+ signals[MERGE_CHANGED] =
+ g_signal_new ("merge_changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (glLabelClass, merge_changed),
+ NULL, NULL,
+ gl_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
gl_debug (DEBUG_LABEL, "END");
}
label->private->modified_flag = TRUE;
+ g_signal_emit (G_OBJECT(label), signals[MERGE_CHANGED], 0);
g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0);
g_signal_emit (G_OBJECT(label), signals[CHANGED], 0);
void (*modified_changed) (glLabel *label, gpointer user_data);
+ void (*merge_changed) (glLabel *label, gpointer user_data);
+
};
wsection = gl_hig_category_new (_("Properties"));
gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
+ /* Barcode style widget */
+ view_barcode->private->bc_style = gl_wdgt_bc_style_new ();
+ gl_wdgt_bc_style_set_label_size_group (GL_WDGT_BC_STYLE(view_barcode->private->bc_style),
+ label_size_group);
+ gl_wdgt_bc_style_set_params (GL_WDGT_BC_STYLE (view_barcode->private->bc_style),
+ style, text_flag);
+ gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
+ view_barcode->private->bc_style);
+ g_signal_connect (G_OBJECT (view_barcode->private->bc_style),
+ "changed", G_CALLBACK (bc_style_changed_cb),
+ view_barcode);
+
/* barcode props entry */
gl_debug (DEBUG_VIEW, "Creating props entry...");
view_barcode->private->bc_props = gl_wdgt_bc_props_new ();
"changed", G_CALLBACK (bc_props_changed_cb),
view_barcode);
- /* Barcode style widget */
- view_barcode->private->bc_style = gl_wdgt_bc_style_new ();
- gl_wdgt_bc_style_set_label_size_group (GL_WDGT_BC_STYLE(view_barcode->private->bc_style),
- label_size_group);
- gl_wdgt_bc_style_set_params (GL_WDGT_BC_STYLE (view_barcode->private->bc_style),
- style, text_flag);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_barcode->private->bc_style);
- g_signal_connect (G_OBJECT (view_barcode->private->bc_style),
- "changed", G_CALLBACK (bc_style_changed_cb),
- view_barcode);
-
/*----------------------------*/
/* Position section */
gl_wdgt_bc_data_set_data (GL_WDGT_BC_DATA(view_barcode->private->bc_data),
(merge->type != GL_MERGE_NONE),
text_node);
+ gl_wdgt_bc_data_set_field_defs (GL_WDGT_BC_DATA(view_barcode->private->bc_data),
+ merge->field_defs);
gl_wdgt_bc_props_set_params (GL_WDGT_BC_PROPS(view_barcode->private->bc_props),
scale, color);
gl_wdgt_bc_style_set_params (GL_WDGT_BC_STYLE(view_barcode->private->bc_style),
gl_wdgt_text_entry_set_text (GL_WDGT_TEXT_ENTRY(view_text->private->text_entry),
(merge->type != GL_MERGE_NONE),
lines);
+ gl_wdgt_text_entry_set_field_defs (GL_WDGT_TEXT_ENTRY(view_text->private->text_entry),
+ merge->field_defs);
gl_wdgt_text_props_set_params (GL_WDGT_TEXT_PROPS(view_text->private->text_props),
font_family, font_size, font_weight,
font_italic_flag, color, just);
{
GObjectClass *object_class;
+ gl_debug (DEBUG_WDGT, "START");
+
object_class = (GObjectClass *) class;
parent_class = g_type_class_peek_parent (class);
gl_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ gl_debug (DEBUG_WDGT, "END");
}
static void
gl_wdgt_bc_data_instance_init (glWdgtBCData *bc_data)
{
+ gl_debug (DEBUG_WDGT, "START");
+
bc_data->literal_radio = NULL;
bc_data->literal_entry = NULL;
bc_data->key_radio = NULL;
+ bc_data->key_combo = NULL;
bc_data->key_entry = NULL;
+
+ gl_debug (DEBUG_WDGT, "END");
}
static void
glWdgtBCData *bc_data;
glWdgtBCDataClass *class;
+ gl_debug (DEBUG_WDGT, "START");
+
g_return_if_fail (object != NULL);
g_return_if_fail (GL_IS_WDGT_BC_DATA (object));
bc_data = GL_WDGT_BC_DATA (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
+
+ gl_debug (DEBUG_WDGT, "END");
}
/****************************************************************************/
{
glWdgtBCData *bc_data;
+ gl_debug (DEBUG_WDGT, "START");
+
bc_data = g_object_new (gl_wdgt_bc_data_get_type (), NULL);
gl_wdgt_bc_data_construct (bc_data, field_defs);
+ gl_debug (DEBUG_WDGT, "END");
+
return GTK_WIDGET (bc_data);
}
gl_wdgt_bc_data_construct (glWdgtBCData *bc_data,
GList *field_defs)
{
- GtkWidget *wvbox, *whbox, *wcombo;
+ GtkWidget *wvbox, *whbox;
GSList *radio_group = NULL;
GList *keys;
+ gl_debug (DEBUG_WDGT, "START");
+
wvbox = GTK_WIDGET (bc_data);
/* ---- Literal line ---- */
gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), bc_data->key_radio);
/* Key entry widget */
- wcombo = gtk_combo_new ();
+ bc_data->key_combo = gtk_combo_new ();
keys = gl_merge_get_key_list (field_defs);
if (keys != NULL)
- gtk_combo_set_popdown_strings (GTK_COMBO (wcombo), keys);
+ gtk_combo_set_popdown_strings (GTK_COMBO (bc_data->key_combo),
+ keys);
gl_merge_free_key_list (&keys);
- bc_data->key_entry = GTK_COMBO (wcombo)->entry;
+ bc_data->key_entry = GTK_COMBO (bc_data->key_combo)->entry;
gtk_entry_set_editable (GTK_ENTRY (bc_data->key_entry), FALSE);
- gtk_widget_set_size_request (wcombo, 200, -1);
+ gtk_widget_set_size_request (bc_data->key_combo, 200, -1);
g_signal_connect_swapped (G_OBJECT (bc_data->key_entry), "changed",
G_CALLBACK (changed_cb),
G_OBJECT (bc_data));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), wcombo);
+ gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), bc_data->key_combo);
+
+ gl_debug (DEBUG_WDGT, "END");
}
/*--------------------------------------------------------------------------*/
static void
changed_cb (glWdgtBCData *bc_data)
{
+ gl_debug (DEBUG_WDGT, "START");
+
/* Emit our "changed" signal */
g_signal_emit (G_OBJECT (bc_data), wdgt_bc_data_signals[CHANGED], 0);
+
+ gl_debug (DEBUG_WDGT, "END");
}
/*--------------------------------------------------------------------------*/
radio_toggled_cb (GtkToggleButton *togglebutton,
glWdgtBCData *bc_data)
{
+ gl_debug (DEBUG_WDGT, "START");
+
if (gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (bc_data->literal_radio))) {
gtk_widget_set_sensitive (bc_data->literal_entry, TRUE);
- gtk_widget_set_sensitive (bc_data->key_entry, FALSE);
+ gtk_widget_set_sensitive (bc_data->key_combo, FALSE);
} else {
gtk_widget_set_sensitive (bc_data->literal_entry, FALSE);
- gtk_widget_set_sensitive (bc_data->key_entry, TRUE);
+ gtk_widget_set_sensitive (bc_data->key_combo, TRUE);
}
/* Emit our "changed" signal */
g_signal_emit (G_OBJECT (bc_data), wdgt_bc_data_signals[CHANGED], 0);
+
+ gl_debug (DEBUG_WDGT, "END");
}
+/****************************************************************************/
+/* Set new field definitions. */
+/****************************************************************************/
+void
+gl_wdgt_bc_data_set_field_defs (glWdgtBCData *bc_data,
+ GList *field_defs)
+{
+ GList *keys;
+
+ gl_debug (DEBUG_WDGT, "START");
+
+ keys = gl_merge_get_key_list (field_defs);
+ if ( keys != NULL ) {
+ gtk_combo_set_popdown_strings (GTK_COMBO (bc_data->key_combo),
+ keys);
+ gl_merge_free_key_list (&keys);
+ } else {
+ keys = g_list_append (keys, "");
+ gtk_combo_set_popdown_strings (GTK_COMBO (bc_data->key_combo),
+ keys);
+ g_list_free (keys);
+ }
+
+ gl_debug (DEBUG_WDGT, "END");
+}
+
+
/****************************************************************************/
/* Get widget data. */
/****************************************************************************/
{
glTextNode *text_node;
+ gl_debug (DEBUG_WDGT, "START");
+
text_node = g_new0(glTextNode,1);
if (gtk_toggle_button_get_active
text_node->data =
gtk_editable_get_chars (GTK_EDITABLE (bc_data->key_entry),
0, -1);
+ gl_debug (DEBUG_WDGT, "text_node: field_flag=%d, data=%s",
+ text_node->field_flag, text_node->data);
}
+
+ gl_debug (DEBUG_WDGT, "END");
+
+ return text_node;
}
/****************************************************************************/
{
gint pos;
+ gl_debug (DEBUG_WDGT, "START");
+
gtk_widget_set_sensitive (bc_data->key_radio, merge_flag);
if (!text_node->field_flag) {
(bc_data->literal_radio), TRUE);
gtk_widget_set_sensitive (bc_data->literal_entry, TRUE);
- gtk_widget_set_sensitive (bc_data->key_entry, FALSE);
+ gtk_widget_set_sensitive (bc_data->key_combo, FALSE);
g_signal_handlers_block_by_func (G_OBJECT
(bc_data->literal_entry),
(bc_data->key_radio), TRUE);
gtk_widget_set_sensitive (bc_data->literal_entry, FALSE);
- gtk_widget_set_sensitive (bc_data->key_entry, TRUE);
+ gtk_widget_set_sensitive (bc_data->key_combo, TRUE);
g_signal_handlers_block_by_func (G_OBJECT
(bc_data->key_entry),
&pos);
}
+ gl_debug (DEBUG_WDGT, "END");
}
/****************************************************************************/
gl_wdgt_bc_data_set_label_size_group (glWdgtBCData *bc_data,
GtkSizeGroup *label_size_group)
{
+ gl_debug (DEBUG_WDGT, "START");
+
gtk_size_group_add_widget (label_size_group, bc_data->literal_radio);
gtk_size_group_add_widget (label_size_group, bc_data->key_radio);
+
+ gl_debug (DEBUG_WDGT, "END");
}
GtkWidget *literal_entry;
GtkWidget *key_radio;
+ GtkWidget *key_combo;
GtkWidget *key_entry;
};
{
gl_debug (DEBUG_WDGT, "START");
- text_entry->text_entry = NULL;
- text_entry->key_entry = NULL;
+ text_entry->text_entry = NULL;
+
+ text_entry->key_combo = NULL;
+ text_entry->key_entry = NULL;
text_entry->insert_button = NULL;
gl_debug (DEBUG_WDGT, "END");
gl_wdgt_text_entry_construct (glWdgtTextEntry *text_entry,
GList *field_defs)
{
- GtkWidget *wvbox, *whbox, *wscroll, *wcombo;
+ GtkWidget *wvbox, *whbox, *wscroll;
GList *keys;
gl_debug (DEBUG_WDGT, "START");
gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text_entry->key_label);
/* Key entry widget */
- wcombo = gtk_combo_new ();
+ text_entry->key_combo = gtk_combo_new ();
keys = gl_merge_get_key_list (field_defs);
if (keys != NULL)
- gtk_combo_set_popdown_strings (GTK_COMBO (wcombo), keys);
+ gtk_combo_set_popdown_strings (GTK_COMBO (text_entry->key_combo),
+ keys);
gl_merge_free_key_list (&keys);
- text_entry->key_entry = GTK_COMBO (wcombo)->entry;
+ text_entry->key_entry = GTK_COMBO (text_entry->key_combo)->entry;
gtk_entry_set_editable (GTK_ENTRY (text_entry->key_entry), FALSE);
- gtk_widget_set_size_request (wcombo, 200, -1);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), wcombo);
+ gtk_widget_set_size_request (text_entry->key_combo, 200, -1);
+ gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text_entry->key_combo);
/* Insert button */
text_entry->insert_button =
gl_debug (DEBUG_WDGT, "END");
}
+/****************************************************************************/
+/* Set new field definitions. */
+/****************************************************************************/
+void
+gl_wdgt_text_entry_set_field_defs (glWdgtTextEntry *text_entry,
+ GList *field_defs)
+{
+ GList *keys;
+
+ keys = gl_merge_get_key_list (field_defs);
+ if ( keys != NULL ) {
+ gtk_combo_set_popdown_strings (GTK_COMBO (text_entry->key_combo),
+ keys);
+ gl_merge_free_key_list (&keys);
+ } else {
+ keys = g_list_append (keys, "");
+ gtk_combo_set_popdown_strings (GTK_COMBO (text_entry->key_combo),
+ keys);
+ g_list_free (keys);
+ }
+}
+
/****************************************************************************/
/* Get widget data. */
/****************************************************************************/
gl_debug (DEBUG_WDGT, "START");
- gtk_widget_set_sensitive (text_entry->key_entry, merge_flag);
+ gtk_widget_set_sensitive (text_entry->key_combo, merge_flag);
gtk_widget_set_sensitive (text_entry->insert_button, merge_flag);
text = gl_text_node_lines_expand (lines, NULL);
GtkWidget *text_entry;
GtkWidget *key_label;
+ GtkWidget *key_combo;
GtkWidget *key_entry;
GtkWidget *insert_button;
void (*changed) (glWdgtTextEntry * text_entry, gpointer user_data);
};
-guint gl_wdgt_text_entry_get_type (void);
+guint gl_wdgt_text_entry_get_type (void);
-GtkWidget *gl_wdgt_text_entry_new (GList *field_defs);
+GtkWidget *gl_wdgt_text_entry_new (GList *field_defs);
-GList *gl_wdgt_text_entry_get_text (glWdgtTextEntry *text_entry);
+void gl_wdgt_text_entry_set_field_defs (glWdgtTextEntry *text_entry,
+ GList *field_defs);
-void gl_wdgt_text_entry_set_text (glWdgtTextEntry *text_entry,
- gboolean merge_flag,
- GList *lines);
+GList *gl_wdgt_text_entry_get_text (glWdgtTextEntry *text_entry);
+
+void gl_wdgt_text_entry_set_text (glWdgtTextEntry *text_entry,
+ gboolean merge_flag,
+ GList *lines);
void gl_wdgt_text_entry_set_label_size_group (glWdgtTextEntry *text_entry,
GtkSizeGroup *label_size_group);