enum {
CHANGED,
+ MOVED,
LAST_SIGNAL
};
G_TYPE_NONE,
0);
+ signals[MOVED] =
+ g_signal_new ("moved",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (glLabelObjectClass, moved),
+ NULL, NULL,
+ gl_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
gl_debug (DEBUG_LABEL, "END");
}
object->priv->x = x;
object->priv->y = y;
- }
- gl_label_object_emit_changed (object);
+ g_signal_emit (G_OBJECT(object), signals[MOVED], 0);
+
+ }
gl_debug (DEBUG_LABEL, "END");
}
gl_debug (DEBUG_LABEL, " x = %f, y= %f",
object->priv->x,
object->priv->y);
- }
- gl_label_object_emit_changed (object);
+ g_signal_emit (G_OBJECT(object), signals[MOVED], 0);
+ }
gl_debug (DEBUG_LABEL, "END");
}
static void object_changed_cb (glLabelObject *object,
glLabel *label);
+static void object_moved_cb (glLabelObject *object,
+ glLabel *label);
+
static void do_modify (glLabel *label);
static void begin_selection_op (glLabel *label);
}
+/****************************************************************************/
+/* Object "moved" callback. */
+/****************************************************************************/
+static void
+object_moved_cb (glLabelObject *object,
+ glLabel *label)
+{
+ do_modify (label);
+}
+
+
/****************************************************************************/
/* Do modify. */
/****************************************************************************/
g_signal_connect (G_OBJECT (object), "changed",
G_CALLBACK (object_changed_cb), label);
+ g_signal_connect (G_OBJECT (object), "moved",
+ G_CALLBACK (object_moved_cb), label);
do_modify (label);
g_signal_handlers_disconnect_by_func (G_OBJECT (object),
G_CALLBACK (object_changed_cb), label);
+ g_signal_handlers_disconnect_by_func (G_OBJECT (object),
+ G_CALLBACK (object_moved_cb), label);
g_object_unref (object);
do_modify (label);
static void object_changed_cb (glLabelObject *object,
glObjectEditor *editor);
+static void object_moved_cb (glLabelObject *object,
+ glObjectEditor *editor);
+
/*****************************************************************************/
{
g_signal_handlers_disconnect_by_func (G_OBJECT(editor->priv->object),
object_changed_cb, editor);
+ g_signal_handlers_disconnect_by_func (G_OBJECT(editor->priv->object),
+ object_moved_cb, editor);
g_object_unref (editor->priv->object);
}
{
g_signal_handlers_disconnect_by_func (G_OBJECT(editor->priv->object),
object_changed_cb, editor);
+ g_signal_handlers_disconnect_by_func (G_OBJECT(editor->priv->object),
+ object_moved_cb, editor);
g_object_unref (editor->priv->object);
}
gtk_notebook_set_current_page (GTK_NOTEBOOK (editor->priv->notebook), 0);
}
+ object_moved_cb (object, editor);
object_changed_cb (object, editor);
g_signal_connect (G_OBJECT (object), "changed",
G_CALLBACK (object_changed_cb), editor);
+ g_signal_connect (G_OBJECT (object), "moved",
+ G_CALLBACK (object_moved_cb), editor);
}
else
{
object_changed_cb (glLabelObject *object,
glObjectEditor *editor)
{
- gdouble x, y;
gdouble w, h;
glColorNode *line_color_node;
gdouble line_width;
gl_debug (DEBUG_EDITOR, "BEGIN");
- gl_label_object_get_position (object, &x, &y);
- gl_object_editor_set_position (editor, x, y);
-
label = gl_label_object_get_parent (object);
merge = gl_label_get_merge (label);
}
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. object "moved" callback. */
+/*---------------------------------------------------------------------------*/
+static void
+object_moved_cb (glLabelObject *object,
+ glObjectEditor *editor)
+{
+ gdouble x, y;
+
+ gl_debug (DEBUG_EDITOR, "BEGIN");
+
+ gl_label_object_get_position (object, &x, &y);
+ gl_object_editor_set_position (editor, x, y);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+
/*****************************************************************************/
/* Object editor "changed" callback. */
/*****************************************************************************/
g_signal_handlers_block_by_func (G_OBJECT (object), object_changed_cb, editor);
+ g_signal_handlers_block_by_func (G_OBJECT (object), object_moved_cb, editor);
gl_object_editor_get_position (editor, &x, &y);
g_signal_handlers_unblock_by_func (G_OBJECT (object), object_changed_cb, editor);
+ g_signal_handlers_unblock_by_func (G_OBJECT (object), object_moved_cb, editor);
gl_debug (DEBUG_EDITOR, "END");
}