]> git.sur5r.net Git - glabels/commitdiff
2004-01-02 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Sat, 3 Jan 2004 03:55:02 +0000 (03:55 +0000)
committerJim Evins <evins@snaught.com>
Sat, 3 Jan 2004 03:55:02 +0000 (03:55 +0000)
* 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

glabels2/ChangeLog
glabels2/src/object-editor-private.h
glabels2/src/object-editor-size-page.c
glabels2/src/object-editor.c
glabels2/src/object-editor.h
glabels2/src/view-text.c

index ae921b95b12454a30857d43cd009c9101c38db90..502236a4d3bb6c09f349dcd18c8aaf3d60cf34e8 100644 (file)
@@ -1,3 +1,24 @@
+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
index 61122cd7bd9387da2a90ec1f51cfc783d62738e3..2bc8c3e21888a27dcc0d19a671b20ca3f1ee699e 100644 (file)
@@ -123,6 +123,7 @@ struct _glObjectEditorPrivate {
 
 enum {
        CHANGED,
+       SIZE_CHANGED,
        LAST_SIGNAL
 };
 
@@ -153,6 +154,7 @@ void gl_object_editor_prepare_data_page         (glObjectEditor        *editor);
 
 
 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);
index 874b26069ec154d8eef48712eaa84e7cf5b492ee..85b26cec2cdafb737f748becd7f1731ffbe88697 100644 (file)
@@ -187,6 +187,7 @@ w_spin_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);
                                                                                 
 }
 
@@ -202,7 +203,7 @@ h_spin_cb (glObjectEditor *editor)
                                                                                 
         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;
                                                                                 
@@ -218,6 +219,7 @@ h_spin_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);
                                                                                 
 }
 
@@ -252,6 +254,7 @@ size_reset_cb (glObjectEditor *editor)
                                           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);
 }
 
 /*****************************************************************************/
index e3cc464abc8ffbea6c9cbfd4209ae0b72ad82d06..bd8a373affd9fcb34281ebbce019776b0a7e6ff9 100644 (file)
@@ -120,6 +120,15 @@ gl_object_editor_class_init (glObjectEditorClass *klass)
                          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");
 }
 
@@ -334,6 +343,20 @@ gl_object_editor_changed_cb (glObjectEditor *editor)
        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.                                 */
 /*****************************************************************************/
index 2e13c9fdcdaed60cfcdb73fc4d0ddd037ac25c62..bf9273f45f4754b4148527d278bfae2075da7b2d 100644 (file)
@@ -71,7 +71,8 @@ struct  _glObjectEditorClass
 {
        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);
 };
 
 
index 0727399be452c59b159efdec8824dc42dbdc6477..45c60bbd75dd31be68780991df0dab6aae6c8dd6 100644 (file)
@@ -84,6 +84,9 @@ static void       update_canvas_item_from_object_cb  (glLabelObject    *object,
 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);
 
@@ -261,6 +264,8 @@ construct_properties_editor (glViewObject *view_object)
        /* 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",
@@ -298,7 +303,7 @@ static void
 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;
@@ -317,7 +322,6 @@ update_object_from_editor_cb (glObjectEditor *editor,
                                         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);
@@ -327,7 +331,6 @@ update_object_from_editor_cb (glObjectEditor *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);
@@ -348,6 +351,38 @@ update_object_from_editor_cb (glObjectEditor *editor,
        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.                                 */
 /*---------------------------------------------------------------------------*/