]> git.sur5r.net Git - glabels/commitdiff
2008-02-03 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Sun, 3 Feb 2008 06:38:13 +0000 (06:38 +0000)
committerJim Evins <evins@snaught.com>
Sun, 3 Feb 2008 06:38:13 +0000 (06:38 +0000)
* src/object-editor-edit-page.c: (field_selected_cb):
* src/object-editor-lsize-page.c: (gl_object_editor_set_max_lsize):
* src/object-editor-private.h:
* src/object-editor-shadow-page.c:
(gl_object_editor_set_max_shadow_offset):
* src/object-editor-size-page.c: (gl_object_editor_set_max_size):
* src/object-editor.c: (gl_object_editor_finalize),
(gl_object_editor_new), (gl_object_notebook_construct_valist),
(label_changed_cb):
* src/object-editor.h:
* src/ui-sidebar.c: (gl_ui_sidebar_construct):
* src/view-barcode.c: (construct_properties_editor):
* src/view-box.c: (construct_properties_editor):
* src/view-ellipse.c: (construct_properties_editor):
* src/view-image.c: (construct_properties_editor):
* src/view-line.c: (construct_properties_editor):
* src/view-object.c: (gl_view_object_finalize):
* src/view-text.c: (construct_properties_editor),
Move update_editor_from_label callback from individual view objects
to the object editor, so that signals can be disconnected when
object editor is finalized.
* src/view-text.c: (gl_view_text_create_button_press_event):
Fixed bug that caused multiple view objects to be created for a
single text object.  This bug would manifest itself as a crash
when deleting multi-object selections which included text objects.

git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@741 f5e0f49d-192f-0410-a22d-a8d8700d0965

15 files changed:
glabels2/src/object-editor-edit-page.c
glabels2/src/object-editor-lsize-page.c
glabels2/src/object-editor-private.h
glabels2/src/object-editor-shadow-page.c
glabels2/src/object-editor-size-page.c
glabels2/src/object-editor.c
glabels2/src/object-editor.h
glabels2/src/ui-sidebar.c
glabels2/src/view-barcode.c
glabels2/src/view-box.c
glabels2/src/view-ellipse.c
glabels2/src/view-image.c
glabels2/src/view-line.c
glabels2/src/view-object.c
glabels2/src/view-text.c

index 46edfc18f1a0ada59cd29e17ceaa3f9acfb41d8b..5f2ff0353f3e14270a6d873926630289e8fcd02d 100644 (file)
@@ -106,8 +106,6 @@ field_selected_cb (glObjectEditor *editor, gchar *field)
  
         gl_debug (DEBUG_EDITOR, "START");
  
-        g_print( "Field activated: \"%s\"\n", field );
-
         field_string = g_strdup_printf ("${%s}", field);
         gl_debug (DEBUG_WDGT, "Inserting %s", field_string);
  
index f2bbadfad99d17c09efba3bd45409ea7d2301c86..d87c2470468d1e3ea778b6e62ca6547cfbc4d6b6 100644 (file)
@@ -159,25 +159,30 @@ gl_object_editor_set_max_lsize (glObjectEditor      *editor,
 
        gl_debug (DEBUG_EDITOR, "START");
 
-        editor->priv->stop_signals = TRUE;
+        if (editor->priv->lsize_page_vbox)
+        {
 
-       /* save a copy in internal units */
-       editor->priv->dx_max = dx_max;
-       editor->priv->dy_max = dy_max;
+                editor->priv->stop_signals = TRUE;
 
-       /* convert internal units to displayed units */
-       gl_debug (DEBUG_EDITOR, "internal dx_max,dy_max = %g, %g", dx_max, dy_max);
-       dx_max *= editor->priv->units_per_point;
-       dy_max *= editor->priv->units_per_point;
-       gl_debug (DEBUG_EDITOR, "display dx_max,dy_max = %g, %g", dx_max, dy_max);
+                /* save a copy in internal units */
+                editor->priv->dx_max = dx_max;
+                editor->priv->dy_max = dy_max;
 
-       /* Set widget values */
-       tmp = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->lsize_r_spin));
-       gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->lsize_r_spin),
-                                  0.0, 2.0*LENGTH (dx_max, dy_max));
-       gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->lsize_r_spin), tmp);
+                /* convert internal units to displayed units */
+                gl_debug (DEBUG_EDITOR, "internal dx_max,dy_max = %g, %g", dx_max, dy_max);
+                dx_max *= editor->priv->units_per_point;
+                dy_max *= editor->priv->units_per_point;
+                gl_debug (DEBUG_EDITOR, "display dx_max,dy_max = %g, %g", dx_max, dy_max);
 
-        editor->priv->stop_signals = FALSE;
+                /* Set widget values */
+                tmp = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->lsize_r_spin));
+                gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->lsize_r_spin),
+                                           0.0, 2.0*LENGTH (dx_max, dy_max));
+                gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->lsize_r_spin), tmp);
+
+                editor->priv->stop_signals = FALSE;
+
+        }
 
        gl_debug (DEBUG_EDITOR, "END");
 }
index 188064258da530fbc697b2c9ab66fc9ca58da7ef..48eb9cf547621e49355399097b88b5994fa3e008 100644 (file)
@@ -34,6 +34,8 @@ struct _glObjectEditorPrivate {
        GladeXML   *gui;
        GtkWidget  *editor_vbox;
 
+        glLabel    *label;
+
        gdouble     units_per_point;
 
        GtkWidget  *title_image;
index 1396d36b34feeefdc763bef8599ed94d4bb815db..4be309e9a9e9a5bfeff5beb52d8d9d9097fe231a 100644 (file)
@@ -281,29 +281,34 @@ gl_object_editor_set_max_shadow_offset (glObjectEditor      *editor,
 
        gl_debug (DEBUG_EDITOR, "START");
 
-        editor->priv->stop_signals = TRUE;
+        if (editor->priv->shadow_page_vbox)
+        {
 
-       /* save a copy in internal units */
-       editor->priv->shadow_x_max = x_max;
-       editor->priv->shadow_y_max = y_max;
+                editor->priv->stop_signals = TRUE;
 
-       /* convert internal units to displayed units */
-       gl_debug (DEBUG_EDITOR, "internal x_max,y_max = %g, %g", x_max, y_max);
-       x_max *= editor->priv->units_per_point;
-       y_max *= editor->priv->units_per_point;
-       gl_debug (DEBUG_EDITOR, "display x_max,y_max = %g, %g", x_max, y_max);
+                /* save a copy in internal units */
+                editor->priv->shadow_x_max = x_max;
+                editor->priv->shadow_y_max = y_max;
 
-       /* Set widget values */
-       tmp = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->shadow_x_spin));
-       gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->shadow_x_spin),
-                                  -x_max, x_max);
-       gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->shadow_x_spin), tmp);
-       tmp = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->shadow_y_spin));
-       gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->shadow_y_spin),
-                                  -y_max, y_max);
-       gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->shadow_y_spin), tmp);
+                /* convert internal units to displayed units */
+                gl_debug (DEBUG_EDITOR, "internal x_max,y_max = %g, %g", x_max, y_max);
+                x_max *= editor->priv->units_per_point;
+                y_max *= editor->priv->units_per_point;
+                gl_debug (DEBUG_EDITOR, "display x_max,y_max = %g, %g", x_max, y_max);
 
-        editor->priv->stop_signals = FALSE;
+                /* Set widget values */
+                tmp = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->shadow_x_spin));
+                gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->shadow_x_spin),
+                                           -x_max, x_max);
+                gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->shadow_x_spin), tmp);
+                tmp = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->shadow_y_spin));
+                gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->shadow_y_spin),
+                                           -y_max, y_max);
+                gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->shadow_y_spin), tmp);
+
+                editor->priv->stop_signals = FALSE;
+
+        }
 
        gl_debug (DEBUG_EDITOR, "END");
 }
index 4d8b1700850a9be46c8e043db67c06e8d3a04a99..58fbe5fabe2cdc1aebfbd9ddc55160caf23a105e 100644 (file)
@@ -328,29 +328,34 @@ gl_object_editor_set_max_size (glObjectEditor      *editor,
 
        gl_debug (DEBUG_EDITOR, "START");
 
-        editor->priv->stop_signals = TRUE;
+        if (editor->priv->size_page_vbox)
+        {
 
-       /* save a copy in internal units */
-       editor->priv->w_max = w_max;
-       editor->priv->h_max = h_max;
+                editor->priv->stop_signals = TRUE;
 
-       /* convert internal units to displayed units */
-       gl_debug (DEBUG_EDITOR, "internal w_max,h_max = %g, %g", w_max, h_max);
-       w_max *= editor->priv->units_per_point;
-       h_max *= editor->priv->units_per_point;
-       gl_debug (DEBUG_EDITOR, "display w_max,h_max = %g, %g", w_max, h_max);
+                /* save a copy in internal units */
+                editor->priv->w_max = w_max;
+                editor->priv->h_max = h_max;
+
+                /* convert internal units to displayed units */
+                gl_debug (DEBUG_EDITOR, "internal w_max,h_max = %g, %g", w_max, h_max);
+                w_max *= editor->priv->units_per_point;
+                h_max *= editor->priv->units_per_point;
+                gl_debug (DEBUG_EDITOR, "display w_max,h_max = %g, %g", w_max, h_max);
+
+                /* Set widget values */
+                tmp = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->size_w_spin));
+                gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->size_w_spin),
+                                           0.0, 2.0*w_max);
+                gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_w_spin), tmp);
+                tmp = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->size_h_spin));
+                gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->size_h_spin),
+                                           0.0, 2.0*h_max);
+                gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_h_spin), tmp);
 
-       /* Set widget values */
-       tmp = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->size_w_spin));
-       gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->size_w_spin),
-                                  0.0, 2.0*w_max);
-       gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_w_spin), tmp);
-       tmp = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->size_h_spin));
-       gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->size_h_spin),
-                                  0.0, 2.0*h_max);
-       gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_h_spin), tmp);
+                editor->priv->stop_signals = FALSE;
 
-        editor->priv->stop_signals = FALSE;
+        }
 
        gl_debug (DEBUG_EDITOR, "END");
 }
index c2941be4bf15fbc189635df62087013b6a62a130..e02abaf02c91a7d99720fce2a226daac0b676e1e 100644 (file)
@@ -69,11 +69,15 @@ gint gl_object_editor_signals[LAST_SIGNAL] = { 0 };
 static void gl_object_editor_finalize           (GObject              *object);
 
 static void gl_object_notebook_construct_valist (glObjectEditor       *editor,
+                                                 glLabel              *label,
                                                 glObjectEditorOption  first_option,
                                                 va_list               args);
 
 static void prefs_changed_cb                    (glObjectEditor       *editor);
 
+static void label_changed_cb                    (glLabel              *label,
+                                                 glObjectEditor       *editor);
+
 \f
 /*****************************************************************************/
 /* Boilerplate object stuff.                                                 */
@@ -161,11 +165,13 @@ gl_object_editor_finalize (GObject *object)
        g_return_if_fail (GL_IS_OBJECT_EDITOR (editor));
        g_return_if_fail (editor->priv != NULL);
 
-        g_object_unref (editor->priv->gui);
-       g_free (editor->priv);
-
        g_signal_handlers_disconnect_by_func (G_OBJECT(gl_prefs),
                                              prefs_changed_cb, editor);
+       g_signal_handlers_disconnect_by_func (G_OBJECT(editor->priv->label),
+                                             label_changed_cb, editor);
+
+        g_object_unref (editor->priv->gui);
+       g_free (editor->priv);
 
        G_OBJECT_CLASS (gl_object_editor_parent_class)->finalize (object);
 
@@ -177,7 +183,8 @@ gl_object_editor_finalize (GObject *object)
 /*****************************************************************************/
 GtkWidget*
 gl_object_editor_new (gchar                *image,
-                     gchar                *label,
+                     gchar                *title,
+                      glLabel              *label,
                      glObjectEditorOption  first_option, ...)
 {
        glObjectEditor *editor;
@@ -193,11 +200,11 @@ gl_object_editor_new (gchar                *image,
                                          GTK_ICON_SIZE_LARGE_TOOLBAR);
        }
 
-       if (label) {
+       if (title) {
                gchar *s;
 
                s = g_strdup_printf ("<span weight=\"bold\">%s</span>",
-                                    label);
+                                    title);
                gtk_label_set_text (GTK_LABEL(editor->priv->title_label), s);
                g_free (s);
 
@@ -208,13 +215,9 @@ gl_object_editor_new (gchar                *image,
        gtk_notebook_set_homogeneous_tabs (GTK_NOTEBOOK(editor->priv->notebook), TRUE);
 
        va_start (args, first_option);
-       gl_object_notebook_construct_valist (editor, first_option, args);
+       gl_object_notebook_construct_valist (editor, label, first_option, args);
        va_end (args);
 
-       if (editor->priv->gui) {
-               g_object_unref (G_OBJECT (editor->priv->gui));
-       }
-
        gl_debug (DEBUG_EDITOR, "END");
 
        return GTK_WIDGET(editor);
@@ -225,6 +228,7 @@ gl_object_editor_new (gchar                *image,
 /*--------------------------------------------------------------------------*/
 static void
 gl_object_notebook_construct_valist (glObjectEditor       *editor,
+                                     glLabel              *label,
                                     glObjectEditorOption  first_option,
                                     va_list               args)
 {
@@ -233,6 +237,8 @@ gl_object_notebook_construct_valist (glObjectEditor       *editor,
 
        gl_debug (DEBUG_EDITOR, "START");
 
+        editor->priv->label = label;
+
        option = first_option;
 
        for ( option=first_option; option; option=va_arg (args, glObjectEditorOption) ) {
@@ -313,6 +319,16 @@ gl_object_notebook_construct_valist (glObjectEditor       *editor,
        g_signal_connect_swapped (G_OBJECT (gl_prefs), "changed",
                                  G_CALLBACK (prefs_changed_cb),
                                  editor);
+        if (label)
+        {
+                label_changed_cb (label, editor);
+                g_signal_connect (G_OBJECT (label), "size_changed",
+                                  G_CALLBACK (label_changed_cb),
+                                  editor);
+                g_signal_connect (G_OBJECT (label), "merge_changed",
+                                  G_CALLBACK (label_changed_cb),
+                                  editor);
+        }
 
        gl_debug (DEBUG_EDITOR, "END");
 }
@@ -642,3 +658,32 @@ prefs_changed_cb (glObjectEditor *editor)
 
        gl_debug (DEBUG_EDITOR, "END");
 }
+
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. label "changed" callback.                                        */
+/*---------------------------------------------------------------------------*/
+static void
+label_changed_cb (glLabel        *label,
+                  glObjectEditor *editor)
+{
+       gdouble   label_width, label_height;
+       glMerge  *merge;
+
+       gl_debug (DEBUG_EDITOR, "START");
+
+       gl_label_get_size (label, &label_width, &label_height);
+       gl_object_editor_set_max_position (GL_OBJECT_EDITOR (editor),
+                                          label_width, label_height);
+       gl_object_editor_set_max_size (GL_OBJECT_EDITOR (editor),
+                                      label_width, label_height);
+       gl_object_editor_set_max_lsize (GL_OBJECT_EDITOR (editor),
+                                      label_width, label_height);
+       gl_object_editor_set_max_shadow_offset (GL_OBJECT_EDITOR (editor),
+                                               label_width, label_height);
+       
+       merge = gl_label_get_merge (label);
+       gl_object_editor_set_key_names (editor, merge);
+
+       gl_debug (DEBUG_EDITOR, "END");
+}
+
index 2f229bb76956b9cd6c7043b166a7949741e6aa8a..fe3bbe56ac326f3ce908b7de7d218b8b0480a5c4 100644 (file)
@@ -28,6 +28,7 @@
 #include <gtk/gtktextbuffer.h>
 
 #include "text-node.h"
+#include "label.h"
 #include "merge.h"
 #include "bc.h"
 #include "color.h"
@@ -85,7 +86,8 @@ struct  _glObjectEditorClass
 GtkType     gl_object_editor_get_type             (void) G_GNUC_CONST;
 
 GtkWidget  *gl_object_editor_new                  (gchar               *image,
-                                                  gchar               *label,
+                                                  gchar               *title,
+                                                   glLabel             *label,
                                                   glObjectEditorOption first_option, ...);
 
 void        gl_object_editor_set_key_names        (glObjectEditor      *editor,
index 924b0fa24455d707241d3da41cc9a02359820e07..f8c398f4eea89d90803f76ade1a572ec40ccda9b 100644 (file)
@@ -150,6 +150,7 @@ gl_ui_sidebar_construct (glUISidebar       *sidebar)
 
        sidebar->priv->empty_child = gl_object_editor_new (GL_STOCK_PROPERTIES,
                                                           _("Object properties"),
+                                                           NULL,
                                                           GL_OBJECT_EDITOR_EMPTY,
                                                           NULL);
 
index 559d134f064e95a1322455db7bc570f9e90586ab..522d334c599e85b6df66fbe10a2126d057e7d5b6 100644 (file)
@@ -72,9 +72,6 @@ static void       update_editor_from_move_cb        (glLabelObject    *object,
                                                     gdouble           dy,
                                                     glObjectEditor   *editor);
 
-static void       update_editor_from_label_cb       (glLabel          *label,
-                                                    glObjectEditor   *editor);
-
 static gboolean   object_at                         (glViewObject     *view_object,
                                                      cairo_t          *cr,
                                                      gdouble           x,
@@ -175,6 +172,7 @@ construct_properties_editor (glViewObject *view_object)
 
        /* Build editor. */
        editor = gl_object_editor_new (GL_STOCK_BARCODE, _("Barcode object properties"),
+                                       object->parent,
                                       GL_OBJECT_EDITOR_POSITION_PAGE,
                                       GL_OBJECT_EDITOR_SIZE_PAGE,
                                       GL_OBJECT_EDITOR_BC_PAGE,
@@ -182,7 +180,6 @@ construct_properties_editor (glViewObject *view_object)
                                       0);
 
        /* Update */
-       update_editor_from_label_cb (object->parent, GL_OBJECT_EDITOR(editor));
        update_editor_from_object_cb (object, GL_OBJECT_EDITOR(editor));
        update_editor_from_move_cb (object, 0, 0, GL_OBJECT_EDITOR(editor));
 
@@ -193,10 +190,6 @@ construct_properties_editor (glViewObject *view_object)
                          G_CALLBACK (update_editor_from_object_cb), editor);
        g_signal_connect (G_OBJECT (object), "moved",
                          G_CALLBACK (update_editor_from_move_cb), editor);
-       g_signal_connect (G_OBJECT (object->parent), "size_changed",
-                         G_CALLBACK (update_editor_from_label_cb), editor);
-       g_signal_connect (G_OBJECT (object->parent), "merge_changed",
-                         G_CALLBACK (update_editor_from_label_cb), editor);
 
        gl_debug (DEBUG_VIEW, "END");
 
@@ -312,30 +305,6 @@ update_editor_from_move_cb (glLabelObject    *object,
        gl_debug (DEBUG_VIEW, "END");
 }
 
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. label "changed" callback.                                        */
-/*---------------------------------------------------------------------------*/
-static void
-update_editor_from_label_cb (glLabel        *label,
-                            glObjectEditor *editor)
-{
-       gdouble            label_width, label_height;
-       glMerge                    *merge;
-
-       gl_debug (DEBUG_VIEW, "START");
-
-       gl_label_get_size (label, &label_width, &label_height);
-       gl_object_editor_set_max_position (GL_OBJECT_EDITOR (editor),
-                                          label_width, label_height);
-       gl_object_editor_set_max_size (GL_OBJECT_EDITOR (editor),
-                                      label_width, label_height);
-
-       merge = gl_label_get_merge (label);
-       gl_object_editor_set_key_names (editor, merge);
-
-       gl_debug (DEBUG_VIEW, "END");
-}
-
 /*****************************************************************************/
 /* Is object at (x,y)?                                                       */
 /*****************************************************************************/
index 710bce278b73f892c449dca5d688a4ebcdbbb8f8..42f39803ac9fbd4bd39f109cc5476a35c4dbc06a 100644 (file)
@@ -73,9 +73,6 @@ static void       update_editor_from_move_cb        (glLabelObject    *object,
                                                     gdouble           dy,
                                                     glObjectEditor   *editor);
 
-static void       update_editor_from_label_cb       (glLabel          *label,
-                                                    glObjectEditor   *editor);
-
 static gboolean   object_at                         (glViewObject     *view_object,
                                                      cairo_t          *cr,
                                                      gdouble           x,
@@ -176,6 +173,7 @@ construct_properties_editor (glViewObject *view_object)
 
        /* Build editor. */
        editor = gl_object_editor_new (GL_STOCK_BOX, _("Box object properties"),
+                                       object->parent,
                                       GL_OBJECT_EDITOR_SHADOW_PAGE,
                                       GL_OBJECT_EDITOR_POSITION_PAGE,
                                       GL_OBJECT_EDITOR_SIZE_PAGE,
@@ -184,7 +182,6 @@ construct_properties_editor (glViewObject *view_object)
                                       0);
        
        /* Update */
-       update_editor_from_label_cb (object->parent, GL_OBJECT_EDITOR(editor));
        update_editor_from_object_cb (object, GL_OBJECT_EDITOR(editor));
        update_editor_from_move_cb (object, 0, 0, GL_OBJECT_EDITOR(editor));
 
@@ -195,10 +192,6 @@ construct_properties_editor (glViewObject *view_object)
                          G_CALLBACK (update_editor_from_object_cb), editor);
        g_signal_connect (G_OBJECT (object), "moved",
                          G_CALLBACK (update_editor_from_move_cb), editor);
-       g_signal_connect (G_OBJECT (object->parent), "size_changed",
-                         G_CALLBACK (update_editor_from_label_cb), editor);
-       g_signal_connect (G_OBJECT (object->parent), "merge_changed",
-                         G_CALLBACK (update_editor_from_label_cb), editor);
 
        gl_debug (DEBUG_VIEW, "END");
 
@@ -340,32 +333,6 @@ update_editor_from_move_cb (glLabelObject    *object,
        gl_debug (DEBUG_VIEW, "END");
 }
 
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. label "changed" callback.                                        */
-/*---------------------------------------------------------------------------*/
-static void
-update_editor_from_label_cb (glLabel        *label,
-                            glObjectEditor *editor)
-{
-       gdouble            label_width, label_height;
-       glMerge                    *merge;
-
-       gl_debug (DEBUG_VIEW, "START");
-
-       gl_label_get_size (label, &label_width, &label_height);
-       gl_object_editor_set_max_position (GL_OBJECT_EDITOR (editor),
-                                          label_width, label_height);
-       gl_object_editor_set_max_size (GL_OBJECT_EDITOR (editor),
-                                      label_width, label_height);
-       gl_object_editor_set_max_shadow_offset (GL_OBJECT_EDITOR (editor),
-                                               label_width, label_height);
-       
-       merge = gl_label_get_merge (label);
-       gl_object_editor_set_key_names (editor, merge);
-
-       gl_debug (DEBUG_VIEW, "END");
-}
-
 /*****************************************************************************/
 /* Is object at (x,y)?                                                       */
 /*****************************************************************************/
index bed1eb7d5b31cc6e71fed302caf81ffaf19dcec4..854747041d5df7dd5f9ab9da25afdeb0932dd6f9 100644 (file)
@@ -74,9 +74,6 @@ static void       update_editor_from_move_cb        (glLabelObject    *object,
                                                     gdouble           dy,
                                                     glObjectEditor   *editor);
 
-static void       update_editor_from_label_cb       (glLabel          *label,
-                                                    glObjectEditor   *editor);
-
 static gboolean   object_at                         (glViewObject     *view_object,
                                                      cairo_t          *cr,
                                                      gdouble           x,
@@ -176,6 +173,7 @@ construct_properties_editor (glViewObject *view_object)
 
        /* Build editor. */
        editor = gl_object_editor_new (GL_STOCK_ELLIPSE, _("Ellipse object properties"),
+                                       object->parent,
                                       GL_OBJECT_EDITOR_SHADOW_PAGE,
                                       GL_OBJECT_EDITOR_POSITION_PAGE,
                                       GL_OBJECT_EDITOR_SIZE_PAGE,
@@ -184,7 +182,6 @@ construct_properties_editor (glViewObject *view_object)
                                       0);
        
        /* Update */
-       update_editor_from_label_cb (object->parent, GL_OBJECT_EDITOR(editor));
        update_editor_from_object_cb (object, GL_OBJECT_EDITOR(editor));
        update_editor_from_move_cb (object, 0, 0, GL_OBJECT_EDITOR(editor));
 
@@ -195,10 +192,6 @@ construct_properties_editor (glViewObject *view_object)
                          G_CALLBACK (update_editor_from_object_cb), editor);
        g_signal_connect (G_OBJECT (object), "moved",
                          G_CALLBACK (update_editor_from_move_cb), editor);
-       g_signal_connect (G_OBJECT (object->parent), "size_changed",
-                         G_CALLBACK (update_editor_from_label_cb), editor);
-       g_signal_connect (G_OBJECT (object->parent), "merge_changed",
-                         G_CALLBACK (update_editor_from_label_cb), editor);
 
        gl_debug (DEBUG_VIEW, "END");
 
@@ -340,32 +333,6 @@ update_editor_from_move_cb (glLabelObject    *object,
        gl_debug (DEBUG_VIEW, "END");
 }
 
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. label "changed" callback.                                        */
-/*---------------------------------------------------------------------------*/
-static void
-update_editor_from_label_cb (glLabel        *label,
-                            glObjectEditor *editor)
-{
-       gdouble            label_width, label_height;
-       glMerge                    *merge;
-
-       gl_debug (DEBUG_VIEW, "START");
-
-       gl_label_get_size (label, &label_width, &label_height);
-       gl_object_editor_set_max_position (GL_OBJECT_EDITOR (editor),
-                                          label_width, label_height);
-       gl_object_editor_set_max_size (GL_OBJECT_EDITOR (editor),
-                                      label_width, label_height);
-       gl_object_editor_set_max_shadow_offset (GL_OBJECT_EDITOR (editor),
-                                               label_width, label_height);
-       
-       merge = gl_label_get_merge (label);
-       gl_object_editor_set_key_names (editor, merge);
-
-       gl_debug (DEBUG_VIEW, "END");
-}
-
 /*****************************************************************************/
 /* Is object at (x,y)?                                                       */
 /*****************************************************************************/
index c1ec594633122da34c25312e5c633797f52d1bab..8e72241cb15cf8e6d318fb5422c0531f44307b1b 100644 (file)
@@ -73,9 +73,6 @@ static void       update_editor_from_move_cb        (glLabelObject    *object,
                                                     gdouble           dy,
                                                     glObjectEditor   *editor);
 
-static void       update_editor_from_label_cb       (glLabel          *label,
-                                                    glObjectEditor   *editor);
-
 static gboolean   object_at                         (glViewObject     *view_object,
                                                      cairo_t          *cr,
                                                      gdouble           x,
@@ -175,13 +172,13 @@ construct_properties_editor (glViewObject *view_object)
 
        /* Build editor. */
        editor = gl_object_editor_new (GL_STOCK_IMAGE, _("Image object properties"),
+                                       object->parent,
                                       GL_OBJECT_EDITOR_POSITION_PAGE,
                                       GL_OBJECT_EDITOR_SIZE_IMAGE_PAGE,
                                       GL_OBJECT_EDITOR_IMAGE_PAGE,
                                       0);
        
        /* Update */
-       update_editor_from_label_cb (object->parent, GL_OBJECT_EDITOR(editor));
        update_editor_from_object_cb (object, GL_OBJECT_EDITOR(editor));
        update_editor_from_move_cb (object, 0, 0, GL_OBJECT_EDITOR(editor));
 
@@ -192,10 +189,6 @@ construct_properties_editor (glViewObject *view_object)
                          G_CALLBACK (update_editor_from_object_cb), editor);
        g_signal_connect (G_OBJECT (object), "moved",
                          G_CALLBACK (update_editor_from_move_cb), editor);
-       g_signal_connect (G_OBJECT (object->parent), "size_changed",
-                         G_CALLBACK (update_editor_from_label_cb), editor);
-       g_signal_connect (G_OBJECT (object->parent), "merge_changed",
-                         G_CALLBACK (update_editor_from_label_cb), editor);
 
        gl_debug (DEBUG_VIEW, "END");
 
@@ -305,30 +298,6 @@ update_editor_from_move_cb (glLabelObject    *object,
        gl_debug (DEBUG_VIEW, "END");
 }
 
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. label "changed" callback.                                        */
-/*---------------------------------------------------------------------------*/
-static void
-update_editor_from_label_cb (glLabel        *label,
-                            glObjectEditor *editor)
-{
-       gdouble            label_width, label_height;
-       glMerge                    *merge;
-
-       gl_debug (DEBUG_VIEW, "START");
-
-       gl_label_get_size (label, &label_width, &label_height);
-       gl_object_editor_set_max_position (GL_OBJECT_EDITOR (editor),
-                                          label_width, label_height);
-       gl_object_editor_set_max_size (GL_OBJECT_EDITOR (editor),
-                                      label_width, label_height);
-       
-       merge = gl_label_get_merge (label);
-       gl_object_editor_set_key_names (editor, merge);
-
-       gl_debug (DEBUG_VIEW, "END");
-}
-
 /*****************************************************************************/
 /* Is object at (x,y)?                                                       */
 /*****************************************************************************/
index 7b0412d16113563a6220e9b4aa3c3ff141f5f2dd..12f29a4105ddeb9e5458d9f8924a05333d956b8e 100644 (file)
@@ -73,9 +73,6 @@ static void       update_editor_from_move_cb        (glLabelObject    *object,
                                                     gdouble           dy,
                                                     glObjectEditor   *editor);
 
-static void       update_editor_from_label_cb       (glLabel          *label,
-                                                    glObjectEditor   *editor);
-
 static gboolean   object_at                         (glViewObject     *view_object,
                                                      cairo_t          *cr,
                                                      gdouble           x,
@@ -175,6 +172,7 @@ construct_properties_editor (glViewObject *view_object)
 
        /* Build editor. */
        editor = gl_object_editor_new (GL_STOCK_LINE, _("Line object properties"),
+                                       object->parent,
                                       GL_OBJECT_EDITOR_SHADOW_PAGE,
                                       GL_OBJECT_EDITOR_POSITION_PAGE,
                                       GL_OBJECT_EDITOR_SIZE_LINE_PAGE,
@@ -182,7 +180,6 @@ construct_properties_editor (glViewObject *view_object)
                                       0);
        
        /* Update */
-       update_editor_from_label_cb (object->parent, GL_OBJECT_EDITOR(editor));
        update_editor_from_object_cb (object, GL_OBJECT_EDITOR(editor));
        update_editor_from_move_cb (object, 0, 0, GL_OBJECT_EDITOR(editor));
 
@@ -193,10 +190,6 @@ construct_properties_editor (glViewObject *view_object)
                          G_CALLBACK (update_editor_from_object_cb), editor);
        g_signal_connect (G_OBJECT (object), "moved",
                          G_CALLBACK (update_editor_from_move_cb), editor);
-       g_signal_connect (G_OBJECT (object->parent), "size_changed",
-                         G_CALLBACK (update_editor_from_label_cb), editor);
-       g_signal_connect (G_OBJECT (object->parent), "merge_changed",
-                         G_CALLBACK (update_editor_from_label_cb), editor);
 
        gl_debug (DEBUG_VIEW, "END");
 
@@ -328,32 +321,6 @@ update_editor_from_move_cb (glLabelObject    *object,
        gl_debug (DEBUG_VIEW, "END");
 }
 
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. label "changed" callback.                                        */
-/*---------------------------------------------------------------------------*/
-static void
-update_editor_from_label_cb (glLabel        *label,
-                            glObjectEditor *editor)
-{
-       gdouble            label_width, label_height;
-       glMerge                    *merge;
-
-       gl_debug (DEBUG_VIEW, "START");
-
-       gl_label_get_size (label, &label_width, &label_height);
-       gl_object_editor_set_max_position (GL_OBJECT_EDITOR (editor),
-                                          label_width, label_height);
-       gl_object_editor_set_max_lsize (GL_OBJECT_EDITOR (editor),
-                                        label_width, label_height);
-       gl_object_editor_set_max_shadow_offset (GL_OBJECT_EDITOR (editor),
-                                               label_width, label_height);
-       
-       merge = gl_label_get_merge (label);
-       gl_object_editor_set_key_names (editor, merge);
-
-       gl_debug (DEBUG_VIEW, "END");
-}
-
 /*****************************************************************************/
 /* Is object at (x,y)?                                                       */
 /*****************************************************************************/
index ccbf153f70bda0541a9364855ca1dba38bda554e..394735a3876de6d727b162b34b341d123b7dec54 100644 (file)
@@ -124,7 +124,8 @@ gl_view_object_finalize (GObject *object)
 
        g_object_unref (view_object->priv->object);
        if (view_object->priv->property_editor) {
-               gtk_object_destroy (GTK_OBJECT(view_object->priv->property_editor));
+                gl_debug (DEBUG_VIEW, "Destroy editor");
+               g_object_unref (G_OBJECT(view_object->priv->property_editor));
        }
        g_free (view_object->priv);
 
index 55d9ac9cd65927758950c6fcafdb435e15d9656f..bca4048b70e8fdf60d370e902ecc581304332eb6 100644 (file)
@@ -75,9 +75,6 @@ static void       update_editor_from_move_cb        (glLabelObject    *object,
                                                     gdouble           dy,
                                                     glObjectEditor   *editor);
 
-static void       update_editor_from_label_cb       (glLabel          *label,
-                                                    glObjectEditor   *editor);
-
 static gboolean   object_at                         (glViewObject     *view_object,
                                                      cairo_t          *cr,
                                                      gdouble           x,
@@ -179,6 +176,7 @@ construct_properties_editor (glViewObject *view_object)
 
        /* Build editor. */
        editor = gl_object_editor_new (GL_STOCK_TEXT, _("Text object properties"),
+                                       object->parent,
                                       GL_OBJECT_EDITOR_SHADOW_PAGE,
                                       GL_OBJECT_EDITOR_POSITION_PAGE,
                                       GL_OBJECT_EDITOR_SIZE_PAGE,
@@ -190,7 +188,6 @@ construct_properties_editor (glViewObject *view_object)
        gl_object_editor_set_text_buffer (GL_OBJECT_EDITOR(editor), buffer);
        
        /* Update */
-       update_editor_from_label_cb (object->parent, GL_OBJECT_EDITOR(editor));
        update_editor_from_object_cb (object, GL_OBJECT_EDITOR(editor));
        update_editor_from_move_cb (object, 0, 0, GL_OBJECT_EDITOR(editor));
 
@@ -203,10 +200,6 @@ construct_properties_editor (glViewObject *view_object)
                          G_CALLBACK (update_editor_from_object_cb), editor);
        g_signal_connect (G_OBJECT (object), "moved",
                          G_CALLBACK (update_editor_from_move_cb), editor);
-       g_signal_connect (G_OBJECT (object->parent), "size_changed",
-                         G_CALLBACK (update_editor_from_label_cb), editor);                      
-       g_signal_connect (G_OBJECT (object->parent), "merge_changed",
-                         G_CALLBACK (update_editor_from_label_cb), editor);
 
        gl_debug (DEBUG_VIEW, "END");
 
@@ -405,31 +398,6 @@ update_editor_from_move_cb (glLabelObject    *object,
        gl_debug (DEBUG_VIEW, "END");
 }
 
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. label "changed" callback.                                        */
-/*---------------------------------------------------------------------------*/
-static void
-update_editor_from_label_cb (glLabel        *label,
-                            glObjectEditor *editor)
-{
-       gdouble            label_width, label_height;
-       glMerge                    *merge;
-
-       gl_debug (DEBUG_VIEW, "START");
-
-       gl_label_get_size (label, &label_width, &label_height);
-       gl_object_editor_set_max_position (GL_OBJECT_EDITOR (editor),
-                                          label_width, label_height);
-       gl_object_editor_set_max_size (GL_OBJECT_EDITOR (editor),
-                                      label_width, label_height);
-       gl_object_editor_set_max_shadow_offset (GL_OBJECT_EDITOR (editor),
-                                               label_width, label_height);
-       
-       merge = gl_label_get_merge (label);
-       gl_object_editor_set_key_names (editor, merge);
-
-       gl_debug (DEBUG_VIEW, "END");
-}
 
 /*****************************************************************************/
 /* Is object at (x,y)?                                                       */
@@ -526,7 +494,6 @@ gl_view_text_create_button_press_event   (glView *view,
         g_free (family);
         lines = gl_text_node_lines_new_from_text (_("Text"));
         gl_label_text_set_lines (GL_LABEL_TEXT(object), lines);
-        view_text = gl_view_text_new (GL_LABEL_TEXT(object), view);
         gl_color_node_free (&color_node);
 
         view->create_object = GL_LABEL_OBJECT (object);