aboutsummaryrefslogtreecommitdiff
path: root/liblogdiag
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2011-01-16 14:33:52 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2011-01-16 14:33:52 +0100
commit6854c8a64389ea75b2f513680c9ab591cdddafc5 (patch)
treedd394fd0025fcdb1988ea18aea3a8b7b95219d00 /liblogdiag
parentcb278a2bf1424def11fa129c123478b7eb556fc3 (diff)
downloadlogdiag-6854c8a64389ea75b2f513680c9ab591cdddafc5.tar.gz
logdiag-6854c8a64389ea75b2f513680c9ab591cdddafc5.tar.xz
logdiag-6854c8a64389ea75b2f513680c9ab591cdddafc5.zip
Revert the order of LdDiagram objects.
Now they go from oldest to newest.
Diffstat (limited to 'liblogdiag')
-rw-r--r--liblogdiag/ld-canvas.c6
-rw-r--r--liblogdiag/ld-diagram.c3
2 files changed, 4 insertions, 5 deletions
diff --git a/liblogdiag/ld-canvas.c b/liblogdiag/ld-canvas.c
index a4ac720..83ac918 100644
--- a/liblogdiag/ld-canvas.c
+++ b/liblogdiag/ld-canvas.c
@@ -890,7 +890,7 @@ get_object_at_coords (LdCanvas *self, gdouble x, gdouble y)
/* Iterate from the top object downwards. */
objects = (GList *) ld_diagram_get_objects (self->priv->diagram);
- for (iter = objects; iter; iter = g_list_next (iter))
+ for (iter = g_list_last (objects); iter; iter = g_list_previous (iter))
{
LdDiagramObject *object;
@@ -1182,7 +1182,7 @@ on_button_press (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
move_object_to_coords (self, data->object, event->x, event->y);
if (self->priv->diagram)
- ld_diagram_insert_object (self->priv->diagram, data->object, 0);
+ ld_diagram_insert_object (self->priv->diagram, data->object, -1);
/* XXX: "cancel" causes confusion. */
ld_canvas_real_cancel_operation (self);
@@ -1338,7 +1338,7 @@ draw_diagram (GtkWidget *widget, DrawData *data)
/* Draw objects from the diagram, from bottom to top. */
objects = (GList *) ld_diagram_get_objects (data->self->priv->diagram);
- for (iter = g_list_last (objects); iter; iter = g_list_previous (iter))
+ for (iter = objects; iter; iter = g_list_next (iter))
draw_object (LD_DIAGRAM_OBJECT (iter->data), data);
switch (data->self->priv->operation)
diff --git a/liblogdiag/ld-diagram.c b/liblogdiag/ld-diagram.c
index 3aae65d..0075850 100644
--- a/liblogdiag/ld-diagram.c
+++ b/liblogdiag/ld-diagram.c
@@ -461,8 +461,7 @@ serialize_diagram (LdDiagram *self)
json_node_take_object (root_node, root_object);
objects_array = json_array_new ();
- iter = g_list_last (self->priv->objects);
- for (; iter; iter = g_list_previous (iter))
+ for (iter = self->priv->objects; iter; iter = g_list_next (iter))
json_array_add_element (objects_array,
serialize_object (LD_DIAGRAM_OBJECT (iter->data)));