[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: gaf.git: branch: master updated (1.6.1-20100214-81-ge5aecb6)
The branch, master has been updated
via e5aecb64ebaa24e9511a7f814aeffc2a334d563f (commit)
via 76010e59b8a1495eaaaa12688b8e70c30827503f (commit)
via f8f053afef5a3e6302e9ec4ed9efcd8f1bf07886 (commit)
via a25595e2e628c2dec91cc1b045fc18ec34b16fc2 (commit)
via f21bae619b0df02e6024fb9dd23397d5698ed47e (commit)
from e19d39a3125cb336da4d8fbbad51a23068e5da4d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
gschem/src/o_buffer.c | 10 ++--------
gschem/src/o_complex.c | 5 -----
gschem/src/o_copy.c | 3 +--
gschem/src/o_misc.c | 2 +-
gschem/src/o_place.c | 5 +----
gschem/src/o_undo.c | 4 ++--
gschem/src/x_clipboard.c | 5 +----
gschem/src/x_multiattrib.c | 2 +-
libgeda/include/libgeda/prototype.h | 14 ++------------
libgeda/include/libgeda/struct.h | 1 -
libgeda/include/prototype_priv.h | 14 ++++++++++++++
libgeda/src/o_bus_basic.c | 5 -----
libgeda/src/o_complex_basic.c | 15 ++-------------
libgeda/src/o_embed.c | 25 ++++++++++++++++---------
libgeda/src/o_list.c | 22 ++++------------------
libgeda/src/o_net_basic.c | 18 +++++++++---------
libgeda/src/o_pin_basic.c | 5 -----
libgeda/src/s_basic.c | 3 ---
libgeda/src/s_page.c | 12 ++++++++++++
libgeda/src/s_tile.c | 28 +++++++++++++++++++++++-----
libgeda/src/s_toplevel.c | 1 -
21 files changed, 91 insertions(+), 108 deletions(-)
=================
Commit Messages
=================
commit e5aecb64ebaa24e9511a7f814aeffc2a334d563f
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
Kill ADDING_SEL flag with FIRE!
The TOPLEVEL.ADDING_SEL flag has long preyed upon intrepid programmers
venturing into the labyrinthine and treacherous depths of the gEDA
source code, introducing strange and hard-to-trace logic errors and
segmentation faults to hinder them on their various quests to fix bugs
and add features.
But no more! The beast lies slain! No more will developers need to
perform the dance of "flag save and restore" to placate the ravening
beast! No more will they mutter strange incantations for hours as they
seek to determine whether the flag should be set or unset!
In serious terms: the flag was only used for controlling whether or
not objects should be added to the tile system. By ensuring that
objects are only added to or removed from the tile system when added
to or removed from the tile's corresponding page, it's then possible
to replace the flag check by checking whether the OBJECT is currently
part of a PAGE.
:100644 100644 ddf32b1... 2f79d0e... M gschem/src/o_buffer.c
:100644 100644 6f4726a... 10f8dbb... M gschem/src/o_complex.c
:100644 100644 6e2f63d... c5008ae... M gschem/src/o_copy.c
:100644 100644 95c920d... 276f168... M gschem/src/o_misc.c
:100644 100644 63e168c... fd3abc3... M gschem/src/o_place.c
:100644 100644 b1b1406... deb3aee... M gschem/src/o_undo.c
:100644 100644 b70fe3c... f240556... M gschem/src/x_clipboard.c
:100644 100644 7bf2140... 7b89ecc... M gschem/src/x_multiattrib.c
:100644 100644 2a00e4e... 06ad67a... M libgeda/include/libgeda/prototype.h
:100644 100644 16552d7... 84d996b... M libgeda/include/libgeda/struct.h
:100644 100644 08c8a6f... 9322634... M libgeda/src/o_complex_basic.c
:100644 100644 d924df5... 0be7c7d... M libgeda/src/o_list.c
:100644 100644 ff12c42... b99f47c... M libgeda/src/s_tile.c
:100644 100644 dccb781... 0bec65b... M libgeda/src/s_toplevel.c
commit 76010e59b8a1495eaaaa12688b8e70c30827503f
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
libgeda: Remove some uses of page_current.
Change some places that use page_current to use o_get_page() or
o_get_page_compat() instead.
:100644 100644 cb3699d... bdcbeca... M libgeda/src/o_embed.c
:100644 100644 ab0e34a... fa7019e... M libgeda/src/o_net_basic.c
:100644 100644 40b9035... ff12c42... M libgeda/src/s_tile.c
commit f8f053afef5a3e6302e9ec4ed9efcd8f1bf07886
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
libgeda: Link tile system contents to page contents.
Instead of adding objects to tile system on object creation and
removing them on object deletion, add and remove objects from tile
system at the same time as they are added to/removed from a page.
This makes more sense, since each page has a separate tile structure.
And has the added advantage of getting rid of a place where the
ADDING_SEL flag is needed!
:100644 100644 aecdafe... d720fb2... M libgeda/src/o_bus_basic.c
:100644 100644 91a0b53... 08c8a6f... M libgeda/src/o_complex_basic.c
:100644 100644 20bbd1c... ab0e34a... M libgeda/src/o_net_basic.c
:100644 100644 6b0547b... c865313... M libgeda/src/o_pin_basic.c
:100644 100644 df0fc66... 6af349c... M libgeda/src/s_basic.c
:100644 100644 dcbb6ab... 0ef30d0... M libgeda/src/s_page.c
:100644 100644 5b7094f... 40b9035... M libgeda/src/s_tile.c
commit a25595e2e628c2dec91cc1b045fc18ec34b16fc2
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
libgeda: Hide some s_conn_* functions from public API.
:100644 100644 5ccc0d6... 2a00e4e... M libgeda/include/libgeda/prototype.h
:100644 100644 2223557... 5868842... M libgeda/include/prototype_priv.h
commit f21bae619b0df02e6024fb9dd23397d5698ed47e
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
libgeda: Hide some s_tile_* functions from public API.
:100644 100644 e738ce1... 5ccc0d6... M libgeda/include/libgeda/prototype.h
:100644 100644 ac52e70... 2223557... M libgeda/include/prototype_priv.h
=========
Changes
=========
commit e5aecb64ebaa24e9511a7f814aeffc2a334d563f
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
Kill ADDING_SEL flag with FIRE!
The TOPLEVEL.ADDING_SEL flag has long preyed upon intrepid programmers
venturing into the labyrinthine and treacherous depths of the gEDA
source code, introducing strange and hard-to-trace logic errors and
segmentation faults to hinder them on their various quests to fix bugs
and add features.
But no more! The beast lies slain! No more will developers need to
perform the dance of "flag save and restore" to placate the ravening
beast! No more will they mutter strange incantations for hours as they
seek to determine whether the flag should be set or unset!
In serious terms: the flag was only used for controlling whether or
not objects should be added to the tile system. By ensuring that
objects are only added to or removed from the tile system when added
to or removed from the tile's corresponding page, it's then possible
to replace the flag check by checking whether the OBJECT is currently
part of a PAGE.
diff --git a/gschem/src/o_buffer.c b/gschem/src/o_buffer.c
index ddf32b1..2f79d0e 100644
--- a/gschem/src/o_buffer.c
+++ b/gschem/src/o_buffer.c
@@ -39,11 +39,8 @@ selection_to_buffer(GSCHEM_TOPLEVEL *w_current, int buf_num)
object_buffer[buf_num] = NULL;
}
- toplevel->ADDING_SEL = 1;
object_buffer[buf_num] = o_glist_copy_all (toplevel, s_current,
- object_buffer[buf_num],
- SELECTION_FLAG);
- toplevel->ADDING_SEL = 0;
+ object_buffer[buf_num]);
}
/*! \todo Finish function documentation!!!
@@ -100,11 +97,9 @@ void o_buffer_paste_start(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y,
s_delete_object_glist(toplevel, toplevel->page_current->place_list);
toplevel->page_current->place_list = NULL;
- toplevel->ADDING_SEL = 1;
toplevel->page_current->place_list =
o_glist_copy_all (toplevel, object_buffer[buf_num],
- toplevel->page_current->place_list,
- SELECTION_FLAG);
+ toplevel->page_current->place_list);
if (!world_get_object_glist_bounds (toplevel,
toplevel->page_current->place_list,
@@ -126,7 +121,6 @@ void o_buffer_paste_start(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y,
o_glist_translate_world (toplevel, w_x - x, w_y - y,
toplevel->page_current->place_list);
- toplevel->ADDING_SEL = 0;
w_current->inside_action = 1;
i_set_state(w_current, ENDPASTE);
diff --git a/gschem/src/o_complex.c b/gschem/src/o_complex.c
index 6f4726a..10f8dbb 100644
--- a/gschem/src/o_complex.c
+++ b/gschem/src/o_complex.c
@@ -89,14 +89,12 @@ void o_complex_prepare_place(GSCHEM_TOPLEVEL *w_current, const CLibSymbol *sym)
temp_list = NULL;
- toplevel->ADDING_SEL=1;
buffer = s_clib_symbol_get_data (sym);
temp_list = o_read_buffer (toplevel,
temp_list,
buffer, -1,
sym_name);
g_free (buffer);
- toplevel->ADDING_SEL=0;
/* Take the added objects */
toplevel->page_current->place_list =
@@ -105,7 +103,6 @@ void o_complex_prepare_place(GSCHEM_TOPLEVEL *w_current, const CLibSymbol *sym)
} else { /* if (w_current->include_complex) {..} else { */
OBJECT *new_object;
- toplevel->ADDING_SEL = 1; /* reuse this flag, rename later hack */
new_object = o_complex_new (toplevel, OBJ_COMPLEX, DEFAULT_COLOR,
0, 0, 0, 0, sym, sym_name, 1);
@@ -115,8 +112,6 @@ void o_complex_prepare_place(GSCHEM_TOPLEVEL *w_current, const CLibSymbol *sym)
toplevel->page_current->place_list =
g_list_append (toplevel->page_current->place_list, new_object);
- toplevel->ADDING_SEL = 0;
-
/* Flag the symbol as embedded if necessary */
o_current = (g_list_last (toplevel->page_current->place_list))->data;
if (w_current->embed_complex) {
diff --git a/gschem/src/o_copy.c b/gschem/src/o_copy.c
index 6e2f63d..c5008ae 100644
--- a/gschem/src/o_copy.c
+++ b/gschem/src/o_copy.c
@@ -57,8 +57,7 @@ void o_copy_start(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
toplevel->page_current->place_list =
o_glist_copy_all (toplevel, s_current,
- toplevel->page_current->place_list,
- SELECTION_FLAG);
+ toplevel->page_current->place_list);
w_current->inside_action = 1;
i_set_state(w_current, COPY);
diff --git a/gschem/src/o_misc.c b/gschem/src/o_misc.c
index 95c920d..276f168 100644
--- a/gschem/src/o_misc.c
+++ b/gschem/src/o_misc.c
@@ -762,7 +762,7 @@ void o_update_component(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
/* add new attribute to old component */
/* make a copy of the attribute object */
- o_attrib = o_object_copy (toplevel, a_current, NORMAL_FLAG);
+ o_attrib = o_object_copy (toplevel, a_current);
s_page_append (toplevel, toplevel->page_current, o_attrib);
/* add the attribute to old */
o_attrib_add (toplevel, o_current, o_attrib);
diff --git a/gschem/src/o_place.c b/gschem/src/o_place.c
index 63e168c..fd3abc3 100644
--- a/gschem/src/o_place.c
+++ b/gschem/src/o_place.c
@@ -73,7 +73,7 @@ void o_place_end (GSCHEM_TOPLEVEL *w_current,
/* Make a copy of the place list if we want to keep it afterwards */
temp_dest_list = o_glist_copy_all (toplevel,
toplevel->page_current->place_list,
- temp_dest_list, SELECTION_FLAG);
+ temp_dest_list);
} else {
/* Otherwise just take it */
temp_dest_list = toplevel->page_current->place_list;
@@ -84,9 +84,6 @@ void o_place_end (GSCHEM_TOPLEVEL *w_current,
*ret_new_objects = g_list_copy (temp_dest_list);
}
- /* Translate with ADDING_SEL=0, so connectable objects (nets, pins, buses)
- * get referenced and updated in the page's tile system. */
- toplevel->ADDING_SEL = 0;
o_glist_translate_world(toplevel, w_diff_x, w_diff_y, temp_dest_list);
/* Clear the old selection list */
diff --git a/gschem/src/o_undo.c b/gschem/src/o_undo.c
index b1b1406..deb3aee 100644
--- a/gschem/src/o_undo.c
+++ b/gschem/src/o_undo.c
@@ -122,7 +122,7 @@ void o_undo_savestate(GSCHEM_TOPLEVEL *w_current, int flag)
} else if (w_current->undo_type == UNDO_MEMORY && flag == UNDO_ALL) {
object_list = o_glist_copy_all (toplevel,
s_page_objects (toplevel->page_current),
- object_list, SELECTION_FLAG);
+ object_list);
}
/* Clear Anything above current */
@@ -379,7 +379,7 @@ void o_undo_callback(GSCHEM_TOPLEVEL *w_current, int type)
s_page_append_list (toplevel, toplevel->page_current,
o_glist_copy_all (toplevel, u_current->object_list,
- NULL, NORMAL_FLAG));
+ NULL));
x_manual_resize(w_current);
toplevel->page_current->page_control = u_current->page_control;
diff --git a/gschem/src/x_clipboard.c b/gschem/src/x_clipboard.c
index b70fe3c..f240556 100644
--- a/gschem/src/x_clipboard.c
+++ b/gschem/src/x_clipboard.c
@@ -193,8 +193,7 @@ x_clipboard_set (GSCHEM_TOPLEVEL *w_current, const GList *object_list)
/* Copy the objects to the clipboard buffer */
w_current->clipboard_buffer =
- o_glist_copy_all (toplevel, object_list, w_current->clipboard_buffer,
- SELECTION_FLAG);
+ o_glist_copy_all (toplevel, object_list, w_current->clipboard_buffer);
/* Advertise that the data is available */
result = gtk_clipboard_set_with_data (cb, &target, 1,
@@ -237,10 +236,8 @@ x_clipboard_get (GSCHEM_TOPLEVEL *w_current)
buf = selection_data->data;
#endif
- toplevel->ADDING_SEL = 1; /* HACK: Avoid adding objects to the tile system */
object_list = o_read_buffer (toplevel, object_list,
(gchar *) buf, -1, "Clipboard");
- toplevel->ADDING_SEL = 0;
gtk_selection_data_free (selection_data);
return object_list;
diff --git a/gschem/src/x_multiattrib.c b/gschem/src/x_multiattrib.c
index 7bf2140..7b89ecc 100644
--- a/gschem/src/x_multiattrib.c
+++ b/gschem/src/x_multiattrib.c
@@ -674,7 +674,7 @@ static void multiattrib_action_promote_attribute (GSCHEM_TOPLEVEL *w_current,
object);
} else {
/* make a copy of the attribute object */
- o_new = o_object_copy (toplevel, o_attrib, NORMAL_FLAG);
+ o_new = o_object_copy (toplevel, o_attrib);
s_page_append (toplevel, toplevel->page_current, o_new);
/* add the attribute its parent */
o_attrib_attach (toplevel, o_new, object, TRUE);
diff --git a/libgeda/include/libgeda/prototype.h b/libgeda/include/libgeda/prototype.h
index 2a00e4e..06ad67a 100644
--- a/libgeda/include/libgeda/prototype.h
+++ b/libgeda/include/libgeda/prototype.h
@@ -187,8 +187,8 @@ void o_line_scale_world(TOPLEVEL *toplevel, int x_scale, int y_scale, OBJECT *ob
double o_line_length(OBJECT *object);
/* o_list.c */
-OBJECT *o_object_copy(TOPLEVEL *toplevel, OBJECT *selected, int flag);
-GList *o_glist_copy_all(TOPLEVEL *toplevel, const GList *src_list, GList *dest_list, int flag);
+OBJECT *o_object_copy(TOPLEVEL *toplevel, OBJECT *selected);
+GList *o_glist_copy_all(TOPLEVEL *toplevel, const GList *src_list, GList *dest_list);
void o_glist_translate_world(TOPLEVEL *toplevel, int dx, int dy, const GList *list);
void o_glist_rotate_world(TOPLEVEL *toplevel, int x, int y, int angle, const GList *list);
void o_glist_mirror_world(TOPLEVEL *toplevel, int x, int y, const GList *list);
diff --git a/libgeda/include/libgeda/struct.h b/libgeda/include/libgeda/struct.h
index 16552d7..84d996b 100644
--- a/libgeda/include/libgeda/struct.h
+++ b/libgeda/include/libgeda/struct.h
@@ -456,7 +456,6 @@ struct st_toplevel {
int last_ps_color; /* used in print code */
int DONT_REDRAW; /* misc flags */
- int ADDING_SEL;
/* page system */
PAGE *page_current;
diff --git a/libgeda/src/o_complex_basic.c b/libgeda/src/o_complex_basic.c
index 08c8a6f..9322634 100644
--- a/libgeda/src/o_complex_basic.c
+++ b/libgeda/src/o_complex_basic.c
@@ -332,8 +332,7 @@ GList *o_complex_promote_attribs (TOPLEVEL *toplevel, OBJECT *object)
if (toplevel->keep_invisible) {
for (iter = promotable; iter != NULL; iter = g_list_next (iter)) {
OBJECT *o_kept = (OBJECT *) iter->data;
- OBJECT *o_copy = o_object_copy (toplevel, o_kept,
- toplevel->ADDING_SEL);
+ OBJECT *o_copy = o_object_copy (toplevel, o_kept);
o_kept->visibility = INVISIBLE;
o_copy->parent = NULL;
promoted = g_list_prepend (promoted, o_copy);
@@ -411,7 +410,6 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
OBJECT *new_prim_obj;
GList *prim_objs;
GList *iter;
- int save_adding_sel = 0;
int loaded_normally = FALSE;
gchar *buffer = NULL;
@@ -449,9 +447,6 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
buffer = s_clib_symbol_get_data (clib);
}
- save_adding_sel = toplevel->ADDING_SEL;
- toplevel->ADDING_SEL = 1; /* name is hack, don't want to */
-
if (clib == NULL || buffer == NULL) {
char *not_found_text = NULL;
@@ -541,7 +536,6 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
g_free (buffer);
}
- toplevel->ADDING_SEL = save_adding_sel;
/* do not mirror/rotate/translate/connect the primitive objects if the
* component was not loaded via o_read
@@ -815,7 +809,7 @@ OBJECT *o_complex_copy(TOPLEVEL *toplevel, OBJECT *o_current)
/* Copy contents and set the parent pointers on the copied objects. */
o_new->complex->prim_objs =
o_glist_copy_all (toplevel, o_current->complex->prim_objs,
- NULL, toplevel->ADDING_SEL);
+ NULL);
for (iter = o_new->complex->prim_objs;
iter != NULL;
diff --git a/libgeda/src/o_list.c b/libgeda/src/o_list.c
index d924df5..0be7c7d 100644
--- a/libgeda/src/o_list.c
+++ b/libgeda/src/o_list.c
@@ -39,21 +39,16 @@ extern int global_sid;
* returns head !!!!!!!!!!!!!!!!!!!
* look at above.. this returns what was passed in!!!!
* copies selected to list_head (!! returns new list)
- * flag is either NORMAL_FLAG or SELECTION_FLAG
*
* \param [in] toplevel The TOPLEVEL object.
* \param [in] selected
- * \param [in] flag
* \return OBJECT pointer.
*/
OBJECT *o_object_copy (TOPLEVEL *toplevel,
- OBJECT *selected, int flag)
+ OBJECT *selected)
{
OBJECT *new_obj;
- /* are we adding a selection or the real object list */
- toplevel->ADDING_SEL = flag;
-
switch(selected->type) {
case(OBJ_LINE):
@@ -116,9 +111,6 @@ OBJECT *o_object_copy (TOPLEVEL *toplevel,
new_obj->sid = selected->sid;
}
- /* I don't think this is a good idea at all */
- /* toplevel->ADDING_SEL = 0; */
-
return new_obj;
}
@@ -142,12 +134,11 @@ OBJECT *o_object_copy (TOPLEVEL *toplevel,
*/
GList *o_glist_copy_all (TOPLEVEL *toplevel,
const GList *src_list,
- GList *dest_list, int flag)
+ GList *dest_list)
{
const GList *src;
GList *dest;
OBJECT *src_object, *dst_object;
- int adding_sel_save;
int selected_save;
src = src_list;
@@ -158,9 +149,6 @@ GList *o_glist_copy_all (TOPLEVEL *toplevel,
return(NULL);
}
- /* Save ADDING_SEL as o_list_copy_to() sets it */
- adding_sel_save = toplevel->ADDING_SEL;
-
/* first do all NON text items */
while(src != NULL) {
src_object = (OBJECT *) src->data;
@@ -171,7 +159,7 @@ GList *o_glist_copy_all (TOPLEVEL *toplevel,
o_selection_unselect (toplevel, src_object);
if (src_object->type != OBJ_TEXT) {
- dst_object = o_object_copy (toplevel, src_object, flag);
+ dst_object = o_object_copy (toplevel, src_object);
dst_object->sid = global_sid++;
dest = g_list_prepend (dest, dst_object);
}
@@ -195,7 +183,7 @@ GList *o_glist_copy_all (TOPLEVEL *toplevel,
o_selection_unselect (toplevel, src_object);
if (src_object->type == OBJ_TEXT) {
- dst_object = o_object_copy (toplevel, src_object, flag);
+ dst_object = o_object_copy (toplevel, src_object);
dst_object->sid = global_sid++;
dest = g_list_prepend (dest, dst_object);
@@ -227,8 +215,6 @@ GList *o_glist_copy_all (TOPLEVEL *toplevel,
/* Reverse the list to be in the correct order */
dest = g_list_reverse (dest);
- toplevel->ADDING_SEL = adding_sel_save;
-
return(dest);
}
diff --git a/libgeda/src/s_tile.c b/libgeda/src/s_tile.c
index ff12c42..b99f47c 100644
--- a/libgeda/src/s_tile.c
+++ b/libgeda/src/s_tile.c
@@ -132,7 +132,7 @@ static void s_tile_add_line_object (TOPLEVEL *toplevel, OBJECT *object)
p_current = o_get_page (toplevel, object);
- if (toplevel->ADDING_SEL || p_current == NULL) {
+ if (p_current == NULL) {
return;
}
diff --git a/libgeda/src/s_toplevel.c b/libgeda/src/s_toplevel.c
index dccb781..0bec65b 100644
--- a/libgeda/src/s_toplevel.c
+++ b/libgeda/src/s_toplevel.c
@@ -61,7 +61,6 @@ TOPLEVEL *s_toplevel_new (void)
toplevel->override_color = -1;
toplevel->DONT_REDRAW = 0;
- toplevel->ADDING_SEL = 0;
toplevel->pages = geda_list_new();
toplevel->page_current = NULL;
commit 76010e59b8a1495eaaaa12688b8e70c30827503f
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
libgeda: Remove some uses of page_current.
Change some places that use page_current to use o_get_page() or
o_get_page_compat() instead.
diff --git a/libgeda/src/o_embed.c b/libgeda/src/o_embed.c
index cb3699d..bdcbeca 100644
--- a/libgeda/src/o_embed.c
+++ b/libgeda/src/o_embed.c
@@ -44,6 +44,8 @@
*/
void o_embed(TOPLEVEL *toplevel, OBJECT *o_current)
{
+ PAGE *page = o_get_page_compat (toplevel, o_current);
+ int page_modified = 0;
/* check o_current is a complex and is not already embedded */
if (o_current->type == OBJ_COMPLEX &&
@@ -55,9 +57,7 @@ void o_embed(TOPLEVEL *toplevel, OBJECT *o_current)
s_log_message (_("Component [%s] has been embedded\n"),
o_current->complex_basename);
-
- /* page content has been modified */
- toplevel->page_current->CHANGED = 1;
+ page_modified = 1;
}
/* If it's a picture and it's not embedded */
@@ -65,8 +65,12 @@ void o_embed(TOPLEVEL *toplevel, OBJECT *o_current)
(o_current->picture->embedded == 0) ) {
o_picture_embed (toplevel, o_current);
+ page_modified = 1;
+ }
+
+ if (page_modified && page != NULL) {
/* page content has been modified */
- toplevel->page_current->CHANGED = 1;
+ page->CHANGED = 1;
}
}
@@ -82,6 +86,8 @@ void o_embed(TOPLEVEL *toplevel, OBJECT *o_current)
void o_unembed(TOPLEVEL *toplevel, OBJECT *o_current)
{
const CLibSymbol *sym;
+ PAGE *page = o_get_page_compat (toplevel, o_current);
+ int page_modified = 0;
/* check o_current is an embedded complex */
if (o_current->type == OBJ_COMPLEX &&
@@ -104,9 +110,7 @@ void o_unembed(TOPLEVEL *toplevel, OBJECT *o_current)
s_log_message (_("Component [%s] has been successfully unembedded\n"),
o_current->complex_basename);
- /* page content has been modified */
- toplevel->page_current->CHANGED = 1;
-
+ page_modified = 1;
}
}
@@ -115,7 +119,10 @@ void o_unembed(TOPLEVEL *toplevel, OBJECT *o_current)
(o_current->picture->embedded == 1) ) {
o_picture_unembed (toplevel, o_current);
- /* page content has been modified */
- toplevel->page_current->CHANGED = 1;
+ page_modified = 1;
+ }
+
+ if (page_modified && page != NULL) {
+ page->CHANGED = 1;
}
}
diff --git a/libgeda/src/o_net_basic.c b/libgeda/src/o_net_basic.c
index ab0e34a..fa7019e 100644
--- a/libgeda/src/o_net_basic.c
+++ b/libgeda/src/o_net_basic.c
@@ -525,6 +525,7 @@ static int o_net_consolidate_segments (TOPLEVEL *toplevel, OBJECT *object)
CONN *conn;
OBJECT *other_object;
int changed = 0;
+ PAGE *page;
if (object == NULL) {
return(0);
@@ -534,6 +535,12 @@ static int o_net_consolidate_segments (TOPLEVEL *toplevel, OBJECT *object)
return(0);
}
+ /* It's meaningless to do anything here without a valid current page. */
+ page = o_get_page_compat (toplevel, object);
+ if (page == NULL) {
+ return (0);
+ }
+
object_orient = o_net_orientation(object);
c_current = object->conn_list;
@@ -563,17 +570,16 @@ static int o_net_consolidate_segments (TOPLEVEL *toplevel, OBJECT *object)
changed++;
if (other_object->selected == TRUE ) {
- o_selection_remove (toplevel, toplevel->page_current->selection_list, other_object);
+ o_selection_remove (toplevel, page->selection_list, other_object);
/* If we're consolidating with a selected object,
* ensure we select the resulting object.
*/
if (object->selected == FALSE) {
- o_selection_add (toplevel, toplevel->page_current->selection_list, object);
+ o_selection_add (toplevel, page->selection_list, object);
}
}
- s_page_remove (toplevel, toplevel->page_current, other_object);
s_delete_object (toplevel, other_object);
o_net_recalc(toplevel, object);
s_tile_update_object(toplevel, object);
diff --git a/libgeda/src/s_tile.c b/libgeda/src/s_tile.c
index 40b9035..ff12c42 100644
--- a/libgeda/src/s_tile.c
+++ b/libgeda/src/s_tile.c
@@ -130,10 +130,9 @@ static void s_tile_add_line_object (TOPLEVEL *toplevel, OBJECT *object)
g_return_if_fail (object != NULL);
g_return_if_fail (object->line != NULL);
- if (toplevel->ADDING_SEL) {
-#if DEBUG
- printf("s_tile_add_object, adding sel TRUE\n");
-#endif
+ p_current = o_get_page (toplevel, object);
+
+ if (toplevel->ADDING_SEL || p_current == NULL) {
return;
}
@@ -146,7 +145,6 @@ static void s_tile_add_line_object (TOPLEVEL *toplevel, OBJECT *object)
y2 = (int) (object->line->y[1] / y_size);
bottom = x2 - x1;
- p_current = toplevel->page_current;
if (bottom != 0.0) {
m = (double) (y2 - y1) / bottom;
commit f8f053afef5a3e6302e9ec4ed9efcd8f1bf07886
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
libgeda: Link tile system contents to page contents.
Instead of adding objects to tile system on object creation and
removing them on object deletion, add and remove objects from tile
system at the same time as they are added to/removed from a page.
This makes more sense, since each page has a separate tile structure.
And has the added advantage of getting rid of a place where the
ADDING_SEL flag is needed!
diff --git a/libgeda/src/o_bus_basic.c b/libgeda/src/o_bus_basic.c
index aecdafe..d720fb2 100644
--- a/libgeda/src/o_bus_basic.c
+++ b/libgeda/src/o_bus_basic.c
@@ -108,11 +108,6 @@ OBJECT *o_bus_new(TOPLEVEL *toplevel,
new_node->draw_func = bus_draw_func;
new_node->sel_func = select_func;
- if (!toplevel->ADDING_SEL) {
- s_tile_add_object (toplevel, new_node);
- s_conn_update_object (toplevel, new_node);
- }
-
return new_node;
}
diff --git a/libgeda/src/o_complex_basic.c b/libgeda/src/o_complex_basic.c
index 91a0b53..08c8a6f 100644
--- a/libgeda/src/o_complex_basic.c
+++ b/libgeda/src/o_complex_basic.c
@@ -565,11 +565,6 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
o_complex_recalc(toplevel, new_node);
- if (!toplevel->ADDING_SEL) {
- s_tile_add_object (toplevel, new_node);
- s_conn_update_object (toplevel, new_node);
- }
-
return new_node;
}
diff --git a/libgeda/src/o_net_basic.c b/libgeda/src/o_net_basic.c
index 20bbd1c..ab0e34a 100644
--- a/libgeda/src/o_net_basic.c
+++ b/libgeda/src/o_net_basic.c
@@ -103,11 +103,6 @@ OBJECT *o_net_new(TOPLEVEL *toplevel, char type,
new_node->draw_func = net_draw_func;
new_node->sel_func = select_func;
- if (!toplevel->ADDING_SEL) {
- s_tile_add_object (toplevel, new_node);
- s_conn_update_object (toplevel, new_node);
- }
-
return new_node;
}
@@ -578,7 +573,6 @@ static int o_net_consolidate_segments (TOPLEVEL *toplevel, OBJECT *object)
}
}
- s_conn_remove_object (toplevel, other_object);
s_page_remove (toplevel, toplevel->page_current, other_object);
s_delete_object (toplevel, other_object);
o_net_recalc(toplevel, object);
diff --git a/libgeda/src/o_pin_basic.c b/libgeda/src/o_pin_basic.c
index 6b0547b..c865313 100644
--- a/libgeda/src/o_pin_basic.c
+++ b/libgeda/src/o_pin_basic.c
@@ -109,11 +109,6 @@ OBJECT *o_pin_new(TOPLEVEL *toplevel,
new_node->sel_func = select_func;
new_node->whichend = whichend;
-
- if (!toplevel->ADDING_SEL) {
- s_tile_add_object (toplevel, new_node);
- s_conn_update_object (toplevel, new_node);
- }
return new_node;
}
diff --git a/libgeda/src/s_basic.c b/libgeda/src/s_basic.c
index df0fc66..6af349c 100644
--- a/libgeda/src/s_basic.c
+++ b/libgeda/src/s_basic.c
@@ -240,9 +240,6 @@ s_delete_object(TOPLEVEL *toplevel, OBJECT *o_current)
if (o_current->line) {
/* printf("sdeleting line\n");*/
g_free(o_current->line);
-
- /* yes this object might be in the tile system */
- s_tile_remove_object(o_current);
}
o_current->line = NULL;
diff --git a/libgeda/src/s_page.c b/libgeda/src/s_page.c
index dcbb6ab..0ef30d0 100644
--- a/libgeda/src/s_page.c
+++ b/libgeda/src/s_page.c
@@ -69,6 +69,12 @@ object_added (TOPLEVEL *toplevel, PAGE *page, OBJECT *object)
}
#endif
object->page = page;
+
+ /* Add object to tile system. */
+ s_tile_add_object (toplevel, object);
+
+ /* Update object connection tracking */
+ s_conn_update_object (toplevel, object);
}
/* Called just after removing an OBJECT from a PAGE. */
@@ -87,6 +93,12 @@ object_removed (TOPLEVEL *toplevel, PAGE *page, OBJECT *object)
if (page->object_lastplace == object) {
page->object_lastplace = NULL;
}
+
+ /* Remove object from connection system */
+ s_conn_remove_object (toplevel, object);
+
+ /* Remove object from tile system */
+ s_tile_remove_object (object);
}
/*! \brief create a new page object
diff --git a/libgeda/src/s_tile.c b/libgeda/src/s_tile.c
index 5b7094f..40b9035 100644
--- a/libgeda/src/s_tile.c
+++ b/libgeda/src/s_tile.c
@@ -309,12 +309,22 @@ static void s_tile_add_line_object (TOPLEVEL *toplevel, OBJECT *object)
*/
void s_tile_add_object (TOPLEVEL *toplevel, OBJECT *object)
{
+ GList *iter;
+
switch (object->type) {
case OBJ_NET:
case OBJ_PIN:
case OBJ_BUS:
s_tile_add_line_object (toplevel, object);
break;
+
+ case OBJ_COMPLEX:
+ case OBJ_PLACEHOLDER:
+ for (iter = object->complex->prim_objs;
+ iter != NULL;
+ iter = g_list_next (iter)) {
+ s_tile_add_object (toplevel, iter->data);
+ }
}
}
@@ -326,8 +336,18 @@ void s_tile_add_object (TOPLEVEL *toplevel, OBJECT *object)
*/
void s_tile_remove_object(OBJECT *object)
{
+ GList *iter;
GList *tl_current;
+ /* Correctly deal with compound objects */
+ if (object->type == OBJ_COMPLEX || object->type == OBJ_PLACEHOLDER) {
+ for (iter = object->complex->prim_objs;
+ iter != NULL;
+ iter = g_list_next (iter)) {
+ s_tile_remove_object (iter->data);
+ }
+ }
+
for (tl_current = object->tiles;
tl_current != NULL;
tl_current = g_list_next (tl_current)) {
commit a25595e2e628c2dec91cc1b045fc18ec34b16fc2
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
libgeda: Hide some s_conn_* functions from public API.
diff --git a/libgeda/include/libgeda/prototype.h b/libgeda/include/libgeda/prototype.h
index 5ccc0d6..2a00e4e 100644
--- a/libgeda/include/libgeda/prototype.h
+++ b/libgeda/include/libgeda/prototype.h
@@ -317,13 +317,8 @@ SCM s_color_map_to_scm (const COLOR *map);
void s_color_map_from_scm (COLOR *map, SCM lst, const char *scheme_proc_name);
/* s_conn.c */
-CONN *s_conn_return_new(OBJECT *other_object, int type, int x, int y, int whichone, int other_whichone);
-int s_conn_uniq(GList *conn_list, CONN *input_conn);
-int s_conn_remove_other(TOPLEVEL *toplevel, OBJECT *other_object, OBJECT *to_remove);
void s_conn_remove_object(TOPLEVEL *toplevel, OBJECT *to_remove);
-OBJECT *s_conn_check_midpoint(OBJECT *o_current, int x, int y);
void s_conn_update_object(TOPLEVEL *toplevel, OBJECT *object);
-void s_conn_print(GList *conn_list);
int s_conn_net_search(OBJECT* new_net, int whichone, GList * conn_list);
GList *s_conn_return_others(GList *input_list, OBJECT *object);
diff --git a/libgeda/include/prototype_priv.h b/libgeda/include/prototype_priv.h
index 2223557..5868842 100644
--- a/libgeda/include/prototype_priv.h
+++ b/libgeda/include/prototype_priv.h
@@ -230,6 +230,13 @@ void s_clib_init (void);
void s_color_init(void);
gchar *s_color_ps_string(gint color);
+/* s_conn.c */
+CONN *s_conn_return_new(OBJECT *other_object, int type, int x, int y, int whichone, int other_whichone);
+int s_conn_uniq(GList *conn_list, CONN *input_conn);
+int s_conn_remove_other(TOPLEVEL *toplevel, OBJECT *other_object, OBJECT *to_remove);
+OBJECT *s_conn_check_midpoint(OBJECT *o_current, int x, int y);
+void s_conn_print(GList *conn_list);
+
/* s_encoding.c */
gchar* s_encoding_base64_encode (gchar* src, guint srclen, guint* dstlenp, gboolean strict);
gchar* s_encoding_base64_decode (gchar* src, guint srclen, guint* dstlenp);
commit f21bae619b0df02e6024fb9dd23397d5698ed47e
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
libgeda: Hide some s_tile_* functions from public API.
diff --git a/libgeda/include/libgeda/prototype.h b/libgeda/include/libgeda/prototype.h
index e738ce1..5ccc0d6 100644
--- a/libgeda/include/libgeda/prototype.h
+++ b/libgeda/include/libgeda/prototype.h
@@ -422,13 +422,8 @@ void s_stretch_print_all(GList *list);
void s_stretch_destroy_all(GList *list);
/* s_tile.c */
-void s_tile_init(TOPLEVEL *toplevel, PAGE *p_current);
-void s_tile_add_object(TOPLEVEL *toplevel, OBJECT *object);
-void s_tile_remove_object(OBJECT *object);
void s_tile_update_object(TOPLEVEL *toplevel, OBJECT *object);
GList *s_tile_get_objectlists(TOPLEVEL *toplevel, int world_x1, int world_y1, int world_x2, int world_y2);
-void s_tile_print(TOPLEVEL *toplevel);
-void s_tile_free_all(PAGE *p_current);
/* s_undo.c */
UNDO *s_undo_return_tail(UNDO *head);
diff --git a/libgeda/include/prototype_priv.h b/libgeda/include/prototype_priv.h
index ac52e70..2223557 100644
--- a/libgeda/include/prototype_priv.h
+++ b/libgeda/include/prototype_priv.h
@@ -244,3 +244,10 @@ TextBuffer *s_textbuffer_free (TextBuffer *tb);
void s_textbuffer_seek (TextBuffer *tb, const gint offset);
gchar *s_textbuffer_next (TextBuffer *tb, const gsize count);
gchar *s_textbuffer_next_line (TextBuffer *tb);
+
+/* s_tile.c */
+void s_tile_init(TOPLEVEL *toplevel, PAGE *p_current);
+void s_tile_add_object(TOPLEVEL *toplevel, OBJECT *object);
+void s_tile_remove_object(OBJECT *object);
+void s_tile_print(TOPLEVEL *toplevel);
+void s_tile_free_all(PAGE *p_current);
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs