libgeda: Add parent PAGE pointer to OBJECT structure.
commit9b24bf40fd35e0954acaa89a1aa8f73ce4f3233a
authorPeter TB Brett <peter@peter-b.co.uk>
Wed, 17 Feb 2010 11:45:39 +0000 (17 11:45 +0000)
committerPeter TB Brett <peter@peter-b.co.uk>
Wed, 17 Feb 2010 11:45:39 +0000 (17 11:45 +0000)
treeb5a12fd1463a65232adf72888e6db02c8a59351d
parentace44e31ae453dc7f1fe7c55e514c3435d70932f
libgeda: Add parent PAGE pointer to OBJECT structure.

There are numerous examples of libgeda & gschem code that assumes,
when operating on an OBJECT, that it is part of the "current" PAGE as
set in the TOPLEVEL structure.  This has a number of disadvantages,
including the need for regular frobbing of the ADDING_SEL flag and
page_current pointers, but most importantly restricting the ability to
work with more than one PAGE at once. Furthermore, it is not
convenient or practical to add a PAGE argument to all functions that
may eventually need to manipulate or update the current page based on
changes to OBJECTs.

Instead, this patch adds a parent PAGE pointer that is updated *only*
when adding or removing an OBJECT to a PAGE.

In order to ensure consistency in the case of compound objects, only
the "top-level" compound object has its page pointer set; in general,
*either* OBJECT.parent *or* OBJECT.page may be non-NULL.
libgeda/include/libgeda/prototype.h
libgeda/include/libgeda/struct.h
libgeda/include/prototype_priv.h
libgeda/src/o_basic.c
libgeda/src/s_basic.c
libgeda/src/s_page.c