* src/object-editor-size-page.c: (h_spin_cb):
Fixed cut-n-paste error in h_spin_cb that loaded h from
the wrong spinbutton.
* src/object-editor.h:
* src/object-editor.c: (gl_object_editor_class_init),
(gl_object_editor_changed_cb), (gl_object_editor_size_changed_cb):
* src/object-editor-private.h:
* src/object-editor-size-page.c: (w_spin_cb), (h_spin_cb),
(size_reset_cb):
Added "size_changed" signal.
* src/view-text.c: (construct_properties_editor),
(update_object_from_editor_cb),
(update_object_from_editor_size_cb):
Track size changes from object editor separately from other
properties. This is so the default size (0,0) of a text
object is not modified unintentionally.
git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@399
f5e0f49d-192f-0410-a22d-
a8d8700d0965
+2004-01-02 Jim Evins <evins@snaught.com>
+
+ * src/object-editor-size-page.c: (h_spin_cb):
+ Fixed cut-n-paste error in h_spin_cb that loaded h from
+ the wrong spinbutton.
+
+ * src/object-editor.h:
+ * src/object-editor.c: (gl_object_editor_class_init),
+ (gl_object_editor_changed_cb), (gl_object_editor_size_changed_cb):
+ * src/object-editor-private.h:
+ * src/object-editor-size-page.c: (w_spin_cb), (h_spin_cb),
+ (size_reset_cb):
+ Added "size_changed" signal.
+
+ * src/view-text.c: (construct_properties_editor),
+ (update_object_from_editor_cb),
+ (update_object_from_editor_size_cb):
+ Track size changes from object editor separately from other
+ properties. This is so the default size (0,0) of a text
+ object is not modified unintentionally.
+
2003-12-30 Wayne Schuller <k_wayne@linuxpower.org>
Added feature: line spacing - allows you to comfortably space a text box to
enum {
CHANGED,
+ SIZE_CHANGED,
LAST_SIGNAL
};
void gl_object_editor_changed_cb (glObjectEditor *editor);
+void gl_object_editor_size_changed_cb (glObjectEditor *editor);
void lsize_prefs_changed_cb (glObjectEditor *editor);
void size_prefs_changed_cb (glObjectEditor *editor);
/* Emit our "changed" signal */
g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0);
+ g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[SIZE_CHANGED], 0);
}
if (gtk_toggle_button_get_active (toggle)) {
- h = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->size_w_spin));
+ h = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->size_h_spin));
w = h / editor->priv->size_aspect_ratio;
/* Emit our "changed" signal */
g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0);
+ g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[SIZE_CHANGED], 0);
}
editor);
/* Emit our "changed" signal */
g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0);
+ g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[SIZE_CHANGED], 0);
}
/*****************************************************************************/
gl_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ gl_object_editor_signals[SIZE_CHANGED] =
+ g_signal_new ("size_changed",
+ G_OBJECT_CLASS_TYPE(object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (glObjectEditorClass, size_changed),
+ NULL, NULL,
+ gl_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
gl_debug (DEBUG_EDITOR, "END");
}
gl_debug (DEBUG_EDITOR, "END");
}
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Widget size changed callback. Emit our "size-changed" signal. */
+/*--------------------------------------------------------------------------*/
+void
+gl_object_editor_size_changed_cb (glObjectEditor *editor)
+{
+ gl_debug (DEBUG_EDITOR, "START");
+
+ /* Emit our "size_changed" signal */
+ g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[SIZE_CHANGED], 0);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
/*****************************************************************************/
/* Set possible key names from merge object. */
/*****************************************************************************/
{
GtkVBoxClass parent_class;
- void (*changed) (glObjectEditor *editor, gpointer user_data);
+ void (*changed) (glObjectEditor *editor, gpointer user_data);
+ void (*size_changed) (glObjectEditor *editor, gpointer user_data);
};
static void update_object_from_editor_cb (glObjectEditor *editor,
glLabelObject *object);
+static void update_object_from_editor_size_cb (glObjectEditor *editor,
+ glLabelObject *object);
+
static void update_editor_from_object_cb (glLabelObject *object,
glObjectEditor *editor);
/* Connect signals. */
g_signal_connect (G_OBJECT (editor), "changed",
G_CALLBACK(update_object_from_editor_cb), object);
+ g_signal_connect (G_OBJECT (editor), "size_changed",
+ G_CALLBACK(update_object_from_editor_size_cb), object);
g_signal_connect (G_OBJECT (object), "changed",
G_CALLBACK (update_editor_from_object_cb), editor);
g_signal_connect (G_OBJECT (object), "moved",
update_object_from_editor_cb (glObjectEditor *editor,
glLabelObject *object)
{
- gdouble x, y, w, h;
+ gdouble x, y;
gchar *font_family;
gdouble font_size;
GnomeFontWeight font_weight;
editor);
gl_object_editor_get_position (editor, &x, &y);
- gl_object_editor_get_size (editor, &w, &h);
font_family = gl_object_editor_get_font_family (editor);
font_size = gl_object_editor_get_font_size (editor);
font_weight = gl_object_editor_get_font_weight (editor);
text_line_spacing = (gdouble) gl_object_editor_get_text_line_spacing (editor);
gl_label_object_set_position (object, x, y);
- gl_label_object_set_size (object, w, h);
gl_label_object_set_font_family (object, font_family);
gl_label_object_set_font_size (object, font_size);
gl_label_object_set_font_weight (object, font_weight);
gl_debug (DEBUG_VIEW, "END");
}
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. editor "changed" callback. */
+/*---------------------------------------------------------------------------*/
+static void
+update_object_from_editor_size_cb (glObjectEditor *editor,
+ glLabelObject *object)
+{
+ gdouble w, h;
+
+ gl_debug (DEBUG_VIEW, "START");
+
+ g_signal_handlers_block_by_func (G_OBJECT(object),
+ update_editor_from_object_cb,
+ editor);
+ g_signal_handlers_block_by_func (G_OBJECT(object),
+ update_editor_from_move_cb,
+ editor);
+
+ gl_object_editor_get_size (editor, &w, &h);
+
+ gl_label_object_set_size (object, w, h);
+
+ g_signal_handlers_unblock_by_func (G_OBJECT(object),
+ update_editor_from_object_cb,
+ editor);
+ g_signal_handlers_unblock_by_func (G_OBJECT(object),
+ update_editor_from_move_cb,
+ editor);
+
+ gl_debug (DEBUG_VIEW, "END");
+}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. label object "changed" callback. */
/*---------------------------------------------------------------------------*/