From d9e0dd7675822598ed33528baa97c41d68b617e2 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Sun, 3 Feb 2008 06:38:13 +0000 Subject: [PATCH] 2008-02-03 Jim Evins * 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 --- glabels2/src/object-editor-edit-page.c | 2 - glabels2/src/object-editor-lsize-page.c | 35 +++++++------ glabels2/src/object-editor-private.h | 2 + glabels2/src/object-editor-shadow-page.c | 43 ++++++++------- glabels2/src/object-editor-size-page.c | 43 ++++++++------- glabels2/src/object-editor.c | 67 ++++++++++++++++++++---- glabels2/src/object-editor.h | 4 +- glabels2/src/ui-sidebar.c | 1 + glabels2/src/view-barcode.c | 33 +----------- glabels2/src/view-box.c | 35 +------------ glabels2/src/view-ellipse.c | 35 +------------ glabels2/src/view-image.c | 33 +----------- glabels2/src/view-line.c | 35 +------------ glabels2/src/view-object.c | 3 +- glabels2/src/view-text.c | 35 +------------ 15 files changed, 138 insertions(+), 268 deletions(-) diff --git a/glabels2/src/object-editor-edit-page.c b/glabels2/src/object-editor-edit-page.c index 46edfc18..5f2ff035 100644 --- a/glabels2/src/object-editor-edit-page.c +++ b/glabels2/src/object-editor-edit-page.c @@ -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); diff --git a/glabels2/src/object-editor-lsize-page.c b/glabels2/src/object-editor-lsize-page.c index f2bbadfa..d87c2470 100644 --- a/glabels2/src/object-editor-lsize-page.c +++ b/glabels2/src/object-editor-lsize-page.c @@ -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"); } diff --git a/glabels2/src/object-editor-private.h b/glabels2/src/object-editor-private.h index 18806425..48eb9cf5 100644 --- a/glabels2/src/object-editor-private.h +++ b/glabels2/src/object-editor-private.h @@ -34,6 +34,8 @@ struct _glObjectEditorPrivate { GladeXML *gui; GtkWidget *editor_vbox; + glLabel *label; + gdouble units_per_point; GtkWidget *title_image; diff --git a/glabels2/src/object-editor-shadow-page.c b/glabels2/src/object-editor-shadow-page.c index 1396d36b..4be309e9 100644 --- a/glabels2/src/object-editor-shadow-page.c +++ b/glabels2/src/object-editor-shadow-page.c @@ -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"); } diff --git a/glabels2/src/object-editor-size-page.c b/glabels2/src/object-editor-size-page.c index 4d8b1700..58fbe5fa 100644 --- a/glabels2/src/object-editor-size-page.c +++ b/glabels2/src/object-editor-size-page.c @@ -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"); } diff --git a/glabels2/src/object-editor.c b/glabels2/src/object-editor.c index c2941be4..e02abaf0 100644 --- a/glabels2/src/object-editor.c +++ b/glabels2/src/object-editor.c @@ -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); + /*****************************************************************************/ /* 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 ("%s", - 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"); +} + diff --git a/glabels2/src/object-editor.h b/glabels2/src/object-editor.h index 2f229bb7..fe3bbe56 100644 --- a/glabels2/src/object-editor.h +++ b/glabels2/src/object-editor.h @@ -28,6 +28,7 @@ #include #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, diff --git a/glabels2/src/ui-sidebar.c b/glabels2/src/ui-sidebar.c index 924b0fa2..f8c398f4 100644 --- a/glabels2/src/ui-sidebar.c +++ b/glabels2/src/ui-sidebar.c @@ -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); diff --git a/glabels2/src/view-barcode.c b/glabels2/src/view-barcode.c index 559d134f..522d334c 100644 --- a/glabels2/src/view-barcode.c +++ b/glabels2/src/view-barcode.c @@ -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)? */ /*****************************************************************************/ diff --git a/glabels2/src/view-box.c b/glabels2/src/view-box.c index 710bce27..42f39803 100644 --- a/glabels2/src/view-box.c +++ b/glabels2/src/view-box.c @@ -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)? */ /*****************************************************************************/ diff --git a/glabels2/src/view-ellipse.c b/glabels2/src/view-ellipse.c index bed1eb7d..85474704 100644 --- a/glabels2/src/view-ellipse.c +++ b/glabels2/src/view-ellipse.c @@ -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)? */ /*****************************************************************************/ diff --git a/glabels2/src/view-image.c b/glabels2/src/view-image.c index c1ec5946..8e72241c 100644 --- a/glabels2/src/view-image.c +++ b/glabels2/src/view-image.c @@ -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)? */ /*****************************************************************************/ diff --git a/glabels2/src/view-line.c b/glabels2/src/view-line.c index 7b0412d1..12f29a41 100644 --- a/glabels2/src/view-line.c +++ b/glabels2/src/view-line.c @@ -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)? */ /*****************************************************************************/ diff --git a/glabels2/src/view-object.c b/glabels2/src/view-object.c index ccbf153f..394735a3 100644 --- a/glabels2/src/view-object.c +++ b/glabels2/src/view-object.c @@ -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); diff --git a/glabels2/src/view-text.c b/glabels2/src/view-text.c index 55d9ac9c..bca4048b 100644 --- a/glabels2/src/view-text.c +++ b/glabels2/src/view-text.c @@ -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); -- 2.39.5