[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: branch: master updated (1.1.1.20070708-61-g7160021)
The branch, master has been updated
via 71600215311af0a98ed371ab750b09182de139a1 (commit)
from dbfe00a20de3f875e519ef60629b968977fc5db8 (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
=========
gattrib/src/s_toplevel.c | 48 ++--
gattrib/src/x_fileselect.c | 37 +--
gnetlist/src/g_netlist.c | 2 +-
gnetlist/src/s_traverse.c | 46 ++--
gschem/include/x_pagesel.h | 1 -
gschem/src/i_callbacks.c | 25 +-
gschem/src/o_misc.c | 725 ++++++++++++++++++++++---------------------
gschem/src/o_select.c | 19 +-
gschem/src/x_dialog.c | 25 +-
gschem/src/x_event.c | 14 +-
gschem/src/x_pagesel.c | 78 +----
gschem/src/x_window.c | 16 +-
gsymcheck/src/s_check.c | 22 +-
libgeda/include/prototype.h | 14 +-
libgeda/include/struct.h | 7 +-
libgeda/src/o_attrib.c | 45 ++--
libgeda/src/s_clib.c | 11 +-
libgeda/src/s_hierarchy.c | 58 ++--
libgeda/src/s_page.c | 212 +++++++++-----
libgeda/src/s_toplevel.c | 19 +-
utils/gschlas/s_util.c | 39 ++-
21 files changed, 725 insertions(+), 738 deletions(-)
=================
Commit Messages
=================
commit 71600215311af0a98ed371ab750b09182de139a1
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date: Sat Aug 11 00:52:25 2007 +0100
Revert inadvertent commits:
dbfe00a20de3f875e519ef60629b968977fc5db8 (commit)
f1451161914a0ed0bb43123279906d82cb7d5b49 (commit)
2ad315fc0badd16a9614d1107b22c973908893d5 (commit)
d8844bb48969aa45a05cbe6836fc96c198e88c19 (commit)
ee1b64a1ae07eb99eae5d63307e9fe23f9604662 (commit)
:100644 100644 d7822c2... 369a831... M gattrib/src/s_toplevel.c
:100644 100644 66add08... f4e0d3f... M gattrib/src/x_fileselect.c
:100644 100644 74cbe9c... 7f89ebe... M gnetlist/src/g_netlist.c
:100644 100644 ae63a3b... 383694c... M gnetlist/src/s_traverse.c
:100644 100644 36ff17e... fcf9a1e... M gschem/include/x_pagesel.h
:100644 100644 1532fd2... b475810... M gschem/src/i_callbacks.c
:100644 100644 d3a6303... 012cf4f... M gschem/src/o_misc.c
:100644 100644 acd4401... 388e268... M gschem/src/o_select.c
:100644 100644 9759c91... 3a2fe3f... M gschem/src/x_dialog.c
:100644 100644 6c656b9... fcf553e... M gschem/src/x_event.c
:100644 100644 4bd4172... 1bd4328... M gschem/src/x_pagesel.c
:100644 100644 d6e695e... 74b421b... M gschem/src/x_window.c
:100644 100644 2156254... 05f78de... M gsymcheck/src/s_check.c
:100644 100644 6e4f698... 5f4560c... M libgeda/include/prototype.h
:100644 100644 b298662... 86bb926... M libgeda/include/struct.h
:100644 100644 c8934c9... c9f5c58... M libgeda/src/o_attrib.c
:100644 100644 5a9a57a... 7bb4824... M libgeda/src/s_clib.c
:100644 100644 305bc2a... 877fba2... M libgeda/src/s_hierarchy.c
:100644 100644 1556c0d... a7a2b92... M libgeda/src/s_page.c
:100644 100644 4adaaf1... 8acadd7... M libgeda/src/s_toplevel.c
:100644 100644 6944026... b656bb8... M utils/gschlas/s_util.c
=========
Changes
=========
commit 71600215311af0a98ed371ab750b09182de139a1
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date: Sat Aug 11 00:52:25 2007 +0100
Revert inadvertent commits:
dbfe00a20de3f875e519ef60629b968977fc5db8 (commit)
f1451161914a0ed0bb43123279906d82cb7d5b49 (commit)
2ad315fc0badd16a9614d1107b22c973908893d5 (commit)
d8844bb48969aa45a05cbe6836fc96c198e88c19 (commit)
ee1b64a1ae07eb99eae5d63307e9fe23f9604662 (commit)
diff --git a/gattrib/src/s_toplevel.c b/gattrib/src/s_toplevel.c
index d7822c2..369a831 100644
--- a/gattrib/src/s_toplevel.c
+++ b/gattrib/src/s_toplevel.c
@@ -78,24 +78,23 @@ int s_toplevel_read_page(char *filename)
*/
void s_toplevel_verify_design(TOPLEVEL *pr_current)
{
- GList *iter;
OBJECT *o_current;
PAGE *p_current;
int missing_sym_flag = 0;
- for ( iter = geda_list_get_glist( pr_current->pages );
- iter != NULL;
- iter = g_list_next( iter ) ) {
-
- p_current = (PAGE *)iter->data;
- o_current = p_current->object_head;
- while (o_current != NULL) {
- /* --- look for object, and verify that it has a symbol file attached. ---- */
- if (o_current->type == OBJ_PLACEHOLDER) {
- missing_sym_flag = 1; /* flag to signal that problem exists. */
+ p_current = pr_current->page_head; /* must iterate over all pages in design */
+ while (p_current != NULL) {
+ if (p_current->pid != -1) { /* skip over page_head which has pid = -1. */
+ o_current = p_current->object_head;
+ while (o_current != NULL) {
+ /* --- look for object, and verify that it has a symbol file attached. ---- */
+ if (o_current->type == OBJ_PLACEHOLDER) {
+ missing_sym_flag = 1; /* flag to signal that problem exists. */
+ }
+ o_current = o_current->next;
}
- o_current = o_current->next;
- }
+ } /* if (p_current->pid != -1) */
+ p_current = p_current->next;
}
if (missing_sym_flag) {
@@ -127,30 +126,27 @@ void s_toplevel_empty_project()
void
s_toplevel_gtksheet_to_toplevel()
{
- GList *iter;
PAGE *p_current;
#if DEBUG
printf("--------------------- Entering s_toplevel_gtksheet_to_toplevel -------------------\n");
-#endif
+#endif
+
s_sheet_data_gtksheet_to_sheetdata(); /* read data from gtksheet into SHEET_DATA */
#if DEBUG
printf("In s_toplevel_gtksheet_to_toplevel -- done writing stuff from gtksheet into SHEET_DATA.\n");
-#endif
-
- /* must iterate over all pages in design */
- for ( iter = geda_list_get_glist( pr_current->pages );
- iter != NULL;
- iter = g_list_next( iter ) ) {
+#endif
- p_current = (PAGE *)iter->data;
- /* only traverse pages which are toplevel */
- if (p_current->object_head && p_current->page_control == 0) {
- s_toplevel_sheetdata_to_toplevel(p_current->object_head); /* adds all objects from page */
+ p_current = pr_current->page_head; /* must iterate over all pages in design */
+ while (p_current != NULL) {
+ if (p_current->pid != -1) { /* only traverse pages which are toplevel */
+ if (p_current->object_head && p_current->page_control == 0) {
+ s_toplevel_sheetdata_to_toplevel(p_current->object_head); /* adds all objects from page */
+ }
}
+ p_current = p_current->next; /* iterate to next schematic page */
}
-
#if DEBUG
printf("In s_toplevel_gtksheet_to_toplevel -- done writing SHEEET_DATA text back into pr_currnet.\n");
#endif
diff --git a/gattrib/src/x_fileselect.c b/gattrib/src/x_fileselect.c
index 66add08..f4e0d3f 100644
--- a/gattrib/src/x_fileselect.c
+++ b/gattrib/src/x_fileselect.c
@@ -173,7 +173,6 @@ x_fileselect_setup_filechooser_filters (GtkFileChooser *filechooser)
gboolean
x_fileselect_load_files (GSList *filenames)
{
- GList *iter;
PAGE *p_local;
GSList *filename;
@@ -230,29 +229,27 @@ x_fileselect_load_files (GSList *filenames)
sheet_head->net_table = s_table_new(sheet_head->net_count, sheet_head->net_attrib_count);
sheet_head->pin_table = s_table_new(sheet_head->pin_count, sheet_head->pin_attrib_count);
- /* must iterate over all pages in design */
- for ( iter = geda_list_get_glist( pr_current->pages );
- iter != NULL;
- iter = g_list_next( iter ) ) {
- p_local = (PAGE *)iter->data;
-
- /* only traverse pages which are toplevel */
- if (p_local->object_head && p_local->page_control == 0) {
- /* adds all components from page to comp_table */
- s_table_add_toplevel_comp_items_to_comp_table(p_local->object_head);
+ p_local = pr_current->page_head; /* must iterate over all pages in design */
+ while (p_local != NULL) {
+ if (p_local->pid != -1) { /* only traverse pages which are toplevel */
+ if (p_local->object_head && p_local->page_control == 0) {
+ /* adds all components from page to comp_table */
+ s_table_add_toplevel_comp_items_to_comp_table(p_local->object_head);
#if 0
- /* Note that this must be changed. We need to input the entire project
- * before doing anything with the nets because we need to first
- * determine where they are all connected! */
+ /* Note that this must be changed. We need to input the entire project
+ * before doing anything with the nets because we need to first
+ * determine where they are all connected! */
- /* adds all nets from page to net_table */
- s_table_add_toplevel_net_items_to_net_table(p_local->object_head);
+ /* adds all nets from page to net_table */
+ s_table_add_toplevel_net_items_to_net_table(p_local->object_head);
#endif
- /* adds all pins from page to pin_table */
- s_table_add_toplevel_pin_items_to_pin_table(p_local->object_head);
- }
- } /* for loop over pages */
+ /* adds all pins from page to pin_table */
+ s_table_add_toplevel_pin_items_to_pin_table(p_local->object_head);
+ }
+ }
+ p_local = p_local->next; /* iterate to next schematic page */
+ }
/* -------------- update windows --------------- */
x_window_add_items(); /* This updates the top level stuff,
diff --git a/gnetlist/src/g_netlist.c b/gnetlist/src/g_netlist.c
index 74cbe9c..7f89ebe 100644
--- a/gnetlist/src/g_netlist.c
+++ b/gnetlist/src/g_netlist.c
@@ -736,7 +736,7 @@ SCM g_get_toplevel_attribute(SCM scm_wanted_attrib)
wanted_attrib = SCM_STRING_CHARS (scm_wanted_attrib);
- return_value = o_attrib_search_toplevel_all(project_current->pages,
+ return_value = o_attrib_search_toplevel_all(project_current->page_head,
wanted_attrib);
if (return_value) {
diff --git a/gnetlist/src/s_traverse.c b/gnetlist/src/s_traverse.c
index ae63a3b..383694c 100644
--- a/gnetlist/src/s_traverse.c
+++ b/gnetlist/src/s_traverse.c
@@ -66,34 +66,36 @@ void s_traverse_init(void)
void s_traverse_start(TOPLEVEL * pr_current)
{
- GList *iter;
- PAGE *p_current;
+ PAGE *p_current;
- for ( iter = geda_list_get_glist( pr_current->pages );
- iter != NULL;
- iter = g_list_next( iter ) ) {
+ p_current = pr_current->page_head;
- p_current = (PAGE *)iter->data;
+ while (p_current != NULL) {
+ if (p_current->pid != -1) {
- /* only traverse pages which are toplevel, ie not underneath */
- if (p_current->object_head && p_current->page_control == 0) {
- pr_current->page_current = p_current;
- s_traverse_sheet(pr_current, p_current->object_head, NULL);
- }
- }
+ /* only traverse pages which are toplevel, ie not underneath */
+ if (p_current->object_head && p_current->page_control == 0) {
+ pr_current->page_current = p_current;
+ s_traverse_sheet(pr_current, p_current->object_head, NULL);
+ }
- /* now that all the sheets have been read, go through and do the */
- /* post processing work */
- s_netlist_post_process(pr_current, netlist_head);
+ }
- /* Now match the graphical netlist with the net names already assigned */
- s_netlist_name_named_nets(pr_current, netlist_head,
- graphical_netlist_head);
+ p_current = p_current->next;
+ }
- if (verbose_mode) {
- printf("\nInternal netlist representation:\n\n");
- s_netlist_print(netlist_head);
- }
+ /* now that all the sheets have been read, go through and do the */
+ /* post processing work */
+ s_netlist_post_process(pr_current, netlist_head);
+
+ /* Now match the graphical netlist with the net names already assigned */
+ s_netlist_name_named_nets(pr_current, netlist_head,
+ graphical_netlist_head);
+
+ if (verbose_mode) {
+ printf("\nInternal netlist representation:\n\n");
+ s_netlist_print(netlist_head);
+ }
}
diff --git a/gschem/include/x_pagesel.h b/gschem/include/x_pagesel.h
index 36ff17e..fcf9a1e 100644
--- a/gschem/include/x_pagesel.h
+++ b/gschem/include/x_pagesel.h
@@ -43,7 +43,6 @@ struct _Pagesel {
GschemDialog parent_instance;
GtkTreeView *treeview;
- gulong pagelist_changed_id;
};
diff --git a/gschem/src/i_callbacks.c b/gschem/src/i_callbacks.c
index 1532fd2..b475810 100644
--- a/gschem/src/i_callbacks.c
+++ b/gschem/src/i_callbacks.c
@@ -1649,21 +1649,17 @@ DEFINE_I_CALLBACK(page_next)
TOPLEVEL *w_current = (TOPLEVEL*)data;
PAGE *p_current = w_current->page_current;
PAGE *p_new;
- GList *iter;
exit_if_null(w_current);
- iter = g_list_find( geda_list_get_glist( w_current->pages ), p_current );
- iter = g_list_next( iter );
-
- if (iter == NULL) {
+ if (p_current->next == NULL) {
return;
}
if (w_current->enforce_hierarchy) {
- p_new = s_hierarchy_find_next_page(w_current->pages, p_current, p_current->page_control);
+ p_new = s_hierarchy_find_next_page(p_current, p_current->page_control);
} else {
- p_new = (PAGE *)iter->data;
+ p_new = p_current->next;
}
if (p_new == NULL || p_new == p_current) {
@@ -1683,22 +1679,17 @@ DEFINE_I_CALLBACK(page_prev)
TOPLEVEL *w_current = (TOPLEVEL*)data;
PAGE *p_current = w_current->page_current;
PAGE *p_new;
- GList *iter;
exit_if_null(w_current);
- iter = g_list_find( geda_list_get_glist( w_current->pages ), p_current );
- iter = g_list_previous( iter );
-
- if ( iter == NULL )
+ if (p_current->prev == NULL || p_current->prev->pid == -1) {
return;
+ }
- p_new = (PAGE *)iter->data;
-
- if (w_current->enforce_hierarchy) {
- p_new = s_hierarchy_find_prev_page(w_current->pages, p_current, p_current->page_control);
+ if (w_current->enforce_hierarchy == TRUE) {
+ p_new = s_hierarchy_find_prev_page(p_current, p_current->page_control);
} else {
- p_new = (PAGE *)iter->data;
+ p_new = p_current->prev;
}
if (p_new == NULL || p_new == p_current) {
diff --git a/gschem/src/o_misc.c b/gschem/src/o_misc.c
index d3a6303..012cf4f 100644
--- a/gschem/src/o_misc.c
+++ b/gschem/src/o_misc.c
@@ -60,7 +60,7 @@ void o_edit(TOPLEVEL *w_current, GList *list)
return;
}
- o_current = (OBJECT *) list->data;
+ o_current = (OBJECT *) list->data;
if (o_current == NULL) {
fprintf(stderr, _("Got an unexpected NULL in o_edit\n"));
exit(-1);
@@ -84,8 +84,8 @@ void o_edit(TOPLEVEL *w_current, GList *list)
case(OBJ_TEXT):
if(strchr(o_current->text->string,'=')) {
- /* now really make sure it's an attribute by
- * checking that there are NO spaces around the ='s
+ /* now really make sure it's an attribute by
+ * checking that there are NO spaces around the ='s
*/
equal_ptr = strchr(o_current->text->string, '=');
@@ -99,12 +99,12 @@ void o_edit(TOPLEVEL *w_current, GList *list)
if ( (*(equal_ptr + 1) != ' ') &&
(*(equal_ptr - 1) != ' ') &&
(num_lines == 1) ) {
- attrib_edit_dialog(w_current,o_current, FROM_MENU);
- /* multi_attrib_edit(w_current, o_current); */
+ attrib_edit_dialog(w_current,o_current, FROM_MENU);
+ /* multi_attrib_edit(w_current, o_current); */
} else {
o_text_edit(w_current, o_current);
- }
+ }
} else {
o_text_edit(w_current, o_current);
}
@@ -121,7 +121,7 @@ void o_edit(TOPLEVEL *w_current, GList *list)
*
*/
/* This locks the entire selected list. It does lock components, but does NOT
- * change the color (of primatives of the components) though
+ * change the color (of primatives of the components) though
* this cannot be called recursively */
void o_lock(TOPLEVEL *w_current)
{
@@ -197,14 +197,14 @@ void o_unlock(TOPLEVEL *w_current)
* (refdes, pinname, pinlabel, ...).
* There is a second pass to run the rotate hooks of non-simple objects,
* like pin or complex objects, for example.
- *
+ *
* \param [in] w_current The TOPLEVEL object.
* \param [in] list The list of objects to rotate.
* \param [in] centerx Center x coordinate of rotation.
* \param [in] centery Center y coordinate of rotation.
*/
void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
- int centerx, int centery)
+ int centerx, int centery)
{
OBJECT *object;
GList *s_current;
@@ -212,7 +212,7 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
GList *other_objects=NULL;
GList *connected_objects=NULL;
OBJECT *o_current=NULL;
-
+
/* this is okay if you just hit rotate and have nothing selected */
if (list == NULL) {
w_current->inside_action = 0;
@@ -239,115 +239,116 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
case(OBJ_NET):
- if (!w_current->DONT_REDRAW) {
- o_cue_undraw(w_current, object);
- o_net_erase(w_current, object);
- o_line_erase_grips(w_current, object);
- }
-
+ if (!w_current->DONT_REDRAW) {
+ o_cue_undraw(w_current, object);
+ o_net_erase(w_current, object);
+ o_line_erase_grips(w_current, object);
+ }
+
/* save the other objects */
other_objects = s_conn_return_others(other_objects, object);
s_conn_remove(w_current, object);
-
+
o_net_rotate_world(w_current, centerx, centery, 90, object);
s_conn_update_object(w_current, object);
- if (!w_current->DONT_REDRAW) {
- o_net_draw(w_current, object);
-
- /* draw the other objects */
- o_cue_undraw_list(w_current, other_objects);
- o_cue_draw_list(w_current, other_objects);
- }
+ if (!w_current->DONT_REDRAW) {
+ o_net_draw(w_current, object);
+
+ /* draw the other objects */
+ o_cue_undraw_list(w_current, other_objects);
+ o_cue_draw_list(w_current, other_objects);
+ }
/* get other connected objects and redraw */
connected_objects = s_conn_return_others(connected_objects, object);
- if (!w_current->DONT_REDRAW) {
- o_cue_undraw_list(w_current, connected_objects);
- o_cue_draw_list(w_current, connected_objects);
-
- /* finally redraw the cues on the current object */
- o_cue_draw_single(w_current, object);
- }
+ if (!w_current->DONT_REDRAW) {
+ o_cue_undraw_list(w_current, connected_objects);
+ o_cue_draw_list(w_current, connected_objects);
+
+ /* finally redraw the cues on the current object */
+ o_cue_draw_single(w_current, object);
+ }
break;
case(OBJ_BUS):
- if (!w_current->DONT_REDRAW) {
- o_cue_undraw(w_current, object);
- o_bus_erase(w_current, object);
- o_line_erase_grips(w_current, object);
+ if (!w_current->DONT_REDRAW) {
+ o_cue_undraw(w_current, object);
+ o_bus_erase(w_current, object);
+ o_line_erase_grips(w_current, object);
}
other_objects = s_conn_return_others(other_objects, object);
s_conn_remove(w_current, object);
-
+
o_bus_rotate_world(w_current, centerx, centery, 90, object);
s_conn_update_object(w_current, object);
- if (!w_current->DONT_REDRAW) {
- o_bus_draw(w_current, object);
-
- /* draw the other objects */
- o_cue_undraw_list(w_current, other_objects);
- o_cue_draw_list(w_current, other_objects);
- }
+ if (!w_current->DONT_REDRAW) {
+ o_bus_draw(w_current, object);
+
+ /* draw the other objects */
+ o_cue_undraw_list(w_current, other_objects);
+ o_cue_draw_list(w_current, other_objects);
+ }
/* get other connected objects and redraw */
connected_objects = s_conn_return_others(connected_objects, object);
- if (!w_current->DONT_REDRAW) {
- o_cue_undraw_list(w_current, connected_objects);
- o_cue_draw_list(w_current, connected_objects);
+ if (!w_current->DONT_REDRAW) {
+ o_cue_undraw_list(w_current, connected_objects);
+ o_cue_draw_list(w_current, connected_objects);
- /* finally redraw the cues on the current object */
- o_cue_draw_single(w_current, object);
- }
+ /* finally redraw the cues on the current object */
+ o_cue_draw_single(w_current, object);
+ }
break;
case(OBJ_PIN):
- if (!w_current->DONT_REDRAW) {
- o_cue_undraw(w_current, object);
- o_pin_erase(w_current, object);
- o_line_erase_grips(w_current, object);
- }
-
+ if (!w_current->DONT_REDRAW) {
+ o_cue_undraw(w_current, object);
+ o_pin_erase(w_current, object);
+ o_line_erase_grips(w_current, object);
+ }
+
other_objects = s_conn_return_others(other_objects, object);
s_conn_remove(w_current, object);
-
- o_pin_rotate_world(w_current, centerx, centery, 90, object);
+
+ o_pin_rotate_world(w_current, centerx, centery,
+ 90, object);
s_conn_update_object(w_current, object);
- if (!w_current->DONT_REDRAW) {
- o_pin_draw(w_current, object);
-
- /* draw the other objects */
- o_cue_undraw_list(w_current, other_objects);
- o_cue_draw_list(w_current, other_objects);
- }
-
- /* get other connected objects and redraw */
+ if (!w_current->DONT_REDRAW) {
+ o_pin_draw(w_current, object);
+
+ /* draw the other objects */
+ o_cue_undraw_list(w_current, other_objects);
+ o_cue_draw_list(w_current, other_objects);
+ }
+
+ /* get other connected objects and redraw */
connected_objects = s_conn_return_others(connected_objects, object);
- if (!w_current->DONT_REDRAW) {
- o_cue_undraw_list(w_current, connected_objects);
- o_cue_draw_list(w_current, connected_objects);
-
- /* finally redraw the cues on the current object */
- o_cue_draw_single(w_current, object);
- }
+ if (!w_current->DONT_REDRAW) {
+ o_cue_undraw_list(w_current, connected_objects);
+ o_cue_draw_list(w_current, connected_objects);
+
+ /* finally redraw the cues on the current object */
+ o_cue_draw_single(w_current, object);
+ }
break;
case(OBJ_COMPLEX):
- if (!w_current->DONT_REDRAW) {
- o_cue_undraw_objects(w_current, object->complex->prim_objs);
- /* erase the current selection */
- o_complex_erase(w_current, object);
- }
+ if (!w_current->DONT_REDRAW) {
+ o_cue_undraw_objects(w_current, object->complex->prim_objs);
+ /* erase the current selection */
+ o_complex_erase(w_current, object);
+ }
other_objects = s_conn_return_complex_others(other_objects, object);
-
+
/* remove all conn references */
o_current = object->complex->prim_objs;
while(o_current != NULL) {
s_conn_remove(w_current, o_current);
o_current = o_current->next;
}
-
+
/* do the rotate */
/*w_current->ADDING_SEL=1; NEWSEL: needed? */
new_angle = (object->complex->angle + 90) % 360;
@@ -355,105 +356,105 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
new_angle, 90, object);
/*w_current->ADDING_SEL = 0; NEWSEL: needed? */
s_conn_update_complex(w_current, object->complex->prim_objs);
- if (!w_current->DONT_REDRAW) {
- o_complex_draw(w_current, object);
-
- o_cue_undraw_list(w_current, other_objects);
- o_cue_draw_list(w_current, other_objects);
- }
+ if (!w_current->DONT_REDRAW) {
+ o_complex_draw(w_current, object);
+
+ o_cue_undraw_list(w_current, other_objects);
+ o_cue_draw_list(w_current, other_objects);
+ }
/* now draw the newly connected objects */
connected_objects = s_conn_return_complex_others(connected_objects,
object);
- if (!w_current->DONT_REDRAW) {
- o_cue_undraw_list(w_current, connected_objects);
- o_cue_draw_list(w_current, connected_objects);
- }
+ if (!w_current->DONT_REDRAW) {
+ o_cue_undraw_list(w_current, connected_objects);
+ o_cue_draw_list(w_current, connected_objects);
+ }
break;
-
+
case(OBJ_LINE):
- if (!w_current->DONT_REDRAW) {
- o_line_erase_grips(w_current, object);
- o_line_erase(w_current, object);
- }
+ if (!w_current->DONT_REDRAW) {
+ o_line_erase_grips(w_current, object);
+ o_line_erase(w_current, object);
+ }
- o_line_rotate_world(w_current, centerx, centery,
+ o_line_rotate_world(w_current, centerx, centery,
90, object);
- if (!w_current->DONT_REDRAW) {
- o_line_draw(w_current, object);
- }
+ if (!w_current->DONT_REDRAW) {
+ o_line_draw(w_current, object);
+ }
break;
case(OBJ_BOX):
- /* erase the current selection */
- if (!w_current->DONT_REDRAW) {
- o_box_erase_grips(w_current, object);
- o_box_erase(w_current, object);
- }
+ /* erase the current selection */
+ if (!w_current->DONT_REDRAW) {
+ o_box_erase_grips(w_current, object);
+ o_box_erase(w_current, object);
+ }
- o_box_rotate_world(w_current, centerx, centery,
+ o_box_rotate_world(w_current, centerx, centery,
90, object);
- if (!w_current->DONT_REDRAW) {
- o_box_draw(w_current, object);
- }
+ if (!w_current->DONT_REDRAW) {
+ o_box_draw(w_current, object);
+ }
break;
case(OBJ_PICTURE):
- /* erase the current selection */
-
- if (!w_current->DONT_REDRAW) {
- o_picture_erase_grips(w_current, object);
- o_picture_erase(w_current, object);
- }
-
- o_picture_rotate_world(w_current, centerx, centery,
+ /* erase the current selection */
+
+ if (!w_current->DONT_REDRAW) {
+ o_picture_erase_grips(w_current, object);
+ o_picture_erase(w_current, object);
+ }
+
+ o_picture_rotate_world(w_current, centerx, centery,
90, object);
- if (!w_current->DONT_REDRAW) {
- o_picture_draw(w_current, object);
- }
+ if (!w_current->DONT_REDRAW) {
+ o_picture_draw(w_current, object);
+ }
break;
case(OBJ_CIRCLE):
- if (!w_current->DONT_REDRAW) {
- o_circle_erase_grips(w_current, object);
- o_circle_erase(w_current, object);
- }
+ if (!w_current->DONT_REDRAW) {
+ o_circle_erase_grips(w_current, object);
+ o_circle_erase(w_current, object);
+ }
- o_circle_rotate_world(w_current, centerx, centery,
+ o_circle_rotate_world(w_current, centerx, centery,
90, object);
- if (!w_current->DONT_REDRAW) {
- o_circle_draw(w_current, object);
- }
+ if (!w_current->DONT_REDRAW) {
+ o_circle_draw(w_current, object);
+ }
break;
case(OBJ_ARC):
- if (!w_current->DONT_REDRAW) {
- o_arc_erase(w_current, object);
- }
+ if (!w_current->DONT_REDRAW) {
+ o_arc_erase(w_current, object);
+ }
o_arc_rotate_world(w_current, centerx, centery, 90, object);
- if (!w_current->DONT_REDRAW) {
- o_arc_draw(w_current, object);
- }
+ if (!w_current->DONT_REDRAW) {
+ o_arc_draw(w_current, object);
+ }
break;
case(OBJ_TEXT):
- /* erase the current selection */
- if (!w_current->DONT_REDRAW) {
- o_text_erase(w_current, object);
- }
+ /* erase the current selection */
+ if (!w_current->DONT_REDRAW) {
+ o_text_erase(w_current, object);
+ }
new_angle = (object->text->angle + 90) % 360;
o_text_rotate_world(w_current, centerx, centery,
new_angle, 90, object);
- if (!w_current->DONT_REDRAW) {
- o_text_draw(w_current, object);
- }
+ if (!w_current->DONT_REDRAW) {
+ o_text_draw(w_current, object);
+ }
break;
}
s_current = s_current->next;
@@ -474,26 +475,26 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
switch(object->type) {
case(OBJ_PIN):
- /* Run the rotate pin hook */
- if (scm_hook_empty_p(rotate_pin_hook) == SCM_BOOL_F &&
- object != NULL) {
- scm_run_hook(rotate_pin_hook,
- scm_cons(g_make_object_smob(w_current, object),
- SCM_EOL));
- }
- break;
+ /* Run the rotate pin hook */
+ if (scm_hook_empty_p(rotate_pin_hook) == SCM_BOOL_F &&
+ object != NULL) {
+ scm_run_hook(rotate_pin_hook,
+ scm_cons(g_make_object_smob(w_current, object),
+ SCM_EOL));
+ }
+ break;
case (OBJ_COMPLEX):
- /* Run the rotate hook */
- if (scm_hook_empty_p(rotate_component_object_hook) == SCM_BOOL_F &&
- object != NULL) {
- scm_run_hook(rotate_component_object_hook,
- scm_cons(g_make_object_smob(w_current, object),
- SCM_EOL));
- }
- break;
+ /* Run the rotate hook */
+ if (scm_hook_empty_p(rotate_component_object_hook) == SCM_BOOL_F &&
+ object != NULL) {
+ scm_run_hook(rotate_component_object_hook,
+ scm_cons(g_make_object_smob(w_current, object),
+ SCM_EOL));
+ }
+ break;
default:
- break;
+ break;
}
s_current = s_current->next;
@@ -511,7 +512,7 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
- *
+ *
*/
void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
{
@@ -537,7 +538,7 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
fprintf(stderr, _("ERROR: NULL object in o_mirror!\n"));
return;
}
-
+
g_list_free(other_objects);
other_objects = NULL;
g_list_free(connected_objects);
@@ -550,14 +551,14 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
o_cue_undraw(w_current, object);
o_net_erase(w_current, object);
o_line_erase_grips(w_current, object);
-
+
other_objects = s_conn_return_others(other_objects, object);
s_conn_remove(w_current, object);
o_net_mirror_world(w_current, centerx, centery, object);
s_conn_update_object(w_current, object);
o_net_draw(w_current, object);
-
+
/* draw the other objects */
o_cue_undraw_list(w_current, other_objects);
o_cue_draw_list(w_current, other_objects);
@@ -568,14 +569,14 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
o_cue_draw_list(w_current, connected_objects);
/* finally redraw the cues on the current object */
- o_cue_draw_single(w_current, object);
+ o_cue_draw_single(w_current, object);
break;
case(OBJ_PIN):
o_cue_undraw(w_current, object);
o_pin_erase(w_current, object);
o_line_erase_grips(w_current, object);
-
+
other_objects = s_conn_return_others(other_objects, object);
s_conn_remove(w_current, object);
@@ -593,7 +594,7 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
o_cue_draw_list(w_current, connected_objects);
/* finally redraw the cues on the current object */
- o_cue_draw_single(w_current, object);
+ o_cue_draw_single(w_current, object);
break;
case(OBJ_BUS):
@@ -602,11 +603,11 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
other_objects = s_conn_return_others(other_objects, object);
s_conn_remove(w_current, object);
-
+
o_bus_mirror_world(w_current, centerx, centery, object);
s_conn_update_object(w_current, object);
o_bus_draw(w_current, object);
-
+
/* draw the other objects */
o_cue_undraw_list(w_current, other_objects);
o_cue_draw_list(w_current, other_objects);
@@ -617,23 +618,23 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
o_cue_draw_list(w_current, connected_objects);
/* finally redraw the cues on the current object */
- o_cue_draw_single(w_current, object);
+ o_cue_draw_single(w_current, object);
break;
-
+
case(OBJ_COMPLEX):
o_cue_undraw_objects(w_current, object->complex->prim_objs);
/* erase the current selection */
o_complex_erase(w_current, object);
other_objects = s_conn_return_complex_others(other_objects, object);
-
+
/* remove all conn references */
o_current = object->complex->prim_objs;
while(o_current != NULL) {
s_conn_remove(w_current, o_current);
o_current = o_current->next;
}
-
+
o_complex_mirror_world(w_current, centerx, centery, object);
s_conn_update_complex(w_current, object->complex->prim_objs);
o_complex_draw(w_current, object);
@@ -651,28 +652,32 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
case(OBJ_LINE):
o_line_erase_grips(w_current, object);
o_line_erase(w_current, object);
- o_line_mirror_world(w_current, centerx, centery, object);
+ o_line_mirror_world(w_current,
+ centerx, centery, object);
o_line_draw(w_current, object);
break;
case(OBJ_BOX):
o_box_erase_grips(w_current, object);
o_box_erase(w_current, object);
- o_box_mirror_world(w_current, centerx, centery, object);
+ o_box_mirror_world(w_current,
+ centerx, centery, object);
o_box_draw(w_current, object);
break;
case(OBJ_PICTURE):
o_picture_erase_grips(w_current, object);
o_picture_erase(w_current, object);
- o_picture_mirror_world(w_current, centerx, centery, object);
+ o_picture_mirror_world(w_current,
+ centerx, centery, object);
o_picture_draw(w_current, object);
break;
case(OBJ_CIRCLE):
o_circle_erase_grips(w_current, object);
o_circle_erase(w_current, object);
- o_circle_mirror_world(w_current, centerx, centery, object);
+ o_circle_mirror_world(w_current,
+ centerx, centery, object);
o_circle_draw(w_current, object);
break;
@@ -710,26 +715,26 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
switch(object->type) {
case(OBJ_PIN):
- /* Run the rotate pin hook */
- if (scm_hook_empty_p(mirror_pin_hook) == SCM_BOOL_F &&
- object != NULL) {
- scm_run_hook(rotate_pin_hook,
- scm_cons(g_make_object_smob(w_current, object),
- SCM_EOL));
- }
- break;
+ /* Run the rotate pin hook */
+ if (scm_hook_empty_p(mirror_pin_hook) == SCM_BOOL_F &&
+ object != NULL) {
+ scm_run_hook(rotate_pin_hook,
+ scm_cons(g_make_object_smob(w_current, object),
+ SCM_EOL));
+ }
+ break;
case (OBJ_COMPLEX):
- /* Run the rotate pin hook */
- if (scm_hook_empty_p(rotate_component_object_hook) == SCM_BOOL_F &&
- object != NULL) {
- scm_run_hook(mirror_component_object_hook,
- scm_cons(g_make_object_smob(w_current, object),
- SCM_EOL));
- }
- break;
+ /* Run the rotate pin hook */
+ if (scm_hook_empty_p(rotate_component_object_hook) == SCM_BOOL_F &&
+ object != NULL) {
+ scm_run_hook(mirror_component_object_hook,
+ scm_cons(g_make_object_smob(w_current, object),
+ SCM_EOL));
+ }
+ break;
default:
- break;
+ break;
}
s_current = s_current->next;
@@ -743,7 +748,7 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
- *
+ *
*/
void o_edit_show_hidden_lowlevel(TOPLEVEL *w_current, OBJECT *o_list)
{
@@ -772,14 +777,14 @@ void o_edit_show_hidden_lowlevel(TOPLEVEL *w_current, OBJECT *o_list)
o_text_recalc(w_current, o_current);
/* unfortunately, you cannot erase the old visible text here */
/* because o_text_draw will just return */
- }
+ }
}
if (o_current->type == OBJ_COMPLEX || o_current->type == OBJ_PLACEHOLDER) {
o_edit_show_hidden_lowlevel(w_current, o_current->complex->prim_objs);
o_complex_recalc(w_current, o_current);
}
-
+
o_current = o_current->next;
}
}
@@ -787,14 +792,14 @@ void o_edit_show_hidden_lowlevel(TOPLEVEL *w_current, OBJECT *o_list)
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
- *
+ *
*/
void o_edit_show_hidden(TOPLEVEL *w_current, OBJECT *o_list)
{
/* this function just shows the hidden text, but doesn't toggle it */
/* this function does not change the CHANGED bit, no real changes are */
/* made to the schematic */
-
+
/* toggle show_hidden_text variable, which when it is true */
/* means that hidden text IS drawn */
w_current->show_hidden_text = !w_current->show_hidden_text;
@@ -813,7 +818,7 @@ void o_edit_show_hidden(TOPLEVEL *w_current, OBJECT *o_list)
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
- *
+ *
*/
void o_edit_make_visible(TOPLEVEL *w_current, OBJECT *o_list)
{
@@ -836,7 +841,7 @@ void o_edit_make_visible(TOPLEVEL *w_current, OBJECT *o_list)
o_text_draw(w_current, o_current);
- w_current->page_current->CHANGED = 1;
+ w_current->page_current->CHANGED = 1;
}
}
o_current = o_current->next;
@@ -853,10 +858,10 @@ int skiplast;
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
- *
+ *
*/
int o_edit_find_text(TOPLEVEL * w_current, OBJECT * o_list, char *stext,
- int descend, int skip)
+ int descend, int skip)
{
char *attrib = NULL;
@@ -881,70 +886,75 @@ int o_edit_find_text(TOPLEVEL * w_current, OBJECT * o_list, char *stext,
if (descend) {
if (o_current->type == OBJ_COMPLEX) {
- parent = w_current->page_current;
- attrib = o_attrib_search_name_single_count(o_current, "source", count);
-
- /* if above is null, then look inside symbol */
- if (attrib == NULL) {
- attrib = o_attrib_search_name(o_current->complex->prim_objs,
- "source", count);
- /* looking_inside = TRUE; */
- }
-
- if (attrib) {
- pcount = 0;
- current_filename = u_basic_breakup_string(attrib, ',', pcount);
- if (current_filename != NULL) {
- page_control =
- s_hierarchy_down_schematic_single(w_current,
- current_filename,
- parent,
- page_control,
- HIERARCHY_NORMAL_LOAD);
- /* o_redraw_all(w_current); */
-
- rv = o_edit_find_text(w_current,
- w_current->page_current->object_head,
- stext, descend, skiplast);
- if (!rv) {
- return 0;
- }
- s_page_goto( w_current, parent );
- }
- }
+ parent = w_current->page_current;
+ attrib = o_attrib_search_name_single_count(o_current,
+ "source", count);
+
+ /* if above is null, then look inside symbol */
+ if (attrib == NULL) {
+ attrib = o_attrib_search_name(o_current->
+ complex->
+ prim_objs, "source", count);
+ /* looking_inside = TRUE; */
+ }
+
+ if (attrib) {
+ pcount = 0;
+ current_filename = u_basic_breakup_string(attrib, ',', pcount);
+ if (current_filename != NULL) {
+ page_control =
+ s_hierarchy_down_schematic_single(w_current,
+ current_filename,
+ parent,
+ page_control,
+ HIERARCHY_NORMAL_LOAD);
+ /* o_redraw_all(w_current); */
+
+ rv = o_edit_find_text(w_current,
+ w_current->page_current->object_head,
+ stext, descend, skiplast);
+ if (!rv) {
+ return 0;
+ }
+ s_hierarchy_up(w_current, w_current->page_current->up);
+ }
+ }
}
}
if (o_current->type == OBJ_TEXT) {
/* replaced strcmp with strstr to simplify the search */
if (strstr(o_current->text->string,stext)) {
- if (!skiplast) {
+ if (!skiplast) {
a_zoom(w_current, ZOOM_FULL, DONTCARE, A_PAN_DONT_REDRAW);
- text_screen_height =
- SCREENabs(w_current, o_text_height(o_current->text->string,
- o_current->text->size));
+ text_screen_height = SCREENabs(w_current,
+ o_text_height(o_current->
+ text->string,
+ o_current->
+ text->size));
/* this code will zoom/pan till the text screen height is about */
/* 50 pixels high, perhaps a future enhancement will be to make */
/* this number configurable */
while (text_screen_height < 50) {
a_zoom(w_current, ZOOM_IN, DONTCARE, A_PAN_DONT_REDRAW);
- text_screen_height =
- SCREENabs(w_current, o_text_height(o_current->text->string,
- o_current->text->size));
+ text_screen_height = SCREENabs(w_current,
+ o_text_height(o_current->
+ text->string,
+ o_current->
+ text->size));
}
- a_pan_general(w_current,
- o_current->text->x, o_current->text->y,
- 1, 0);
+ a_pan_general(w_current, o_current->text->x, o_current->text->y,
+ 1, 0);
- last_o = o_current;
- break;
- }
- if (last_o == o_current) {
- skiplast = 0;
- }
+ last_o = o_current;
+ break;
+ }
+ if (last_o == o_current) {
+ skiplast = 0;
+ }
- } /* if (strstr(o_current->text->string,stext)) */
- } /* if (o_current->type == OBJ_TEXT) */
+ }
+ }
o_current = o_current->next;
if (o_current == NULL) {
@@ -958,10 +968,10 @@ int o_edit_find_text(TOPLEVEL * w_current, OBJECT * o_list, char *stext,
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
- *
+ *
*/
void o_edit_hide_specific_text(TOPLEVEL * w_current, OBJECT * o_list,
- char *stext)
+ char *stext)
{
OBJECT *o_current = NULL;
@@ -974,14 +984,14 @@ void o_edit_hide_specific_text(TOPLEVEL * w_current, OBJECT * o_list,
if (o_current->type == OBJ_TEXT) {
if (!strncmp(stext, o_current->text->string, strlen(stext))) {
- if (o_current->visibility == VISIBLE) {
- o_current->visibility = INVISIBLE;
-
- if (o_current->text->prim_objs == NULL) {
- o_text_recreate(w_current, o_current);
- }
- w_current->page_current->CHANGED = 1;
- }
+ if (o_current->visibility == VISIBLE) {
+ o_current->visibility = INVISIBLE;
+
+ if (o_current->text->prim_objs == NULL) {
+ o_text_recreate(w_current, o_current);
+ }
+ w_current->page_current->CHANGED = 1;
+ }
}
}
o_current = o_current->next;
@@ -993,10 +1003,10 @@ void o_edit_hide_specific_text(TOPLEVEL * w_current, OBJECT * o_list,
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
- *
+ *
*/
void o_edit_show_specific_text(TOPLEVEL * w_current, OBJECT * o_list,
- char *stext)
+ char *stext)
{
OBJECT *o_current = NULL;
@@ -1009,15 +1019,15 @@ void o_edit_show_specific_text(TOPLEVEL * w_current, OBJECT * o_list,
if (o_current->type == OBJ_TEXT) {
if (!strncmp(stext, o_current->text->string, strlen(stext))) {
- if (o_current->visibility == INVISIBLE) {
- o_current->visibility = VISIBLE;
-
- if (o_current->text->prim_objs == NULL) {
- o_text_recreate(w_current, o_current);
- }
- o_text_draw(w_current, o_current);
- w_current->page_current->CHANGED = 1;
- }
+ if (o_current->visibility == INVISIBLE) {
+ o_current->visibility = VISIBLE;
+
+ if (o_current->text->prim_objs == NULL) {
+ o_text_recreate(w_current, o_current);
+ }
+ o_text_draw(w_current, o_current);
+ w_current->page_current->CHANGED = 1;
+ }
}
}
o_current = o_current->next;
@@ -1028,7 +1038,7 @@ void o_edit_show_specific_text(TOPLEVEL * w_current, OBJECT * o_list,
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
- *
+ *
*/
void o_update_component(TOPLEVEL *w_current, OBJECT *o_current)
{
@@ -1045,7 +1055,7 @@ void o_update_component(TOPLEVEL *w_current, OBJECT *o_current)
clib = s_clib_get_symbol_by_name (o_current->complex_basename);
if (clib == NULL) {
- s_log_message (_("Could not find symbol [%s] in library. Update failed.\n"),
+ s_log_message (_("Could not find symbol [%s] in library. Update failed.\n"),
o_current->complex_basename);
return;
}
@@ -1067,13 +1077,13 @@ void o_update_component(TOPLEVEL *w_current, OBJECT *o_current)
o_current->complex->y,
o_current->complex->angle,
o_current->complex->mirror,
- clib, o_current->complex_basename,
- 1, TRUE);
+ clib, o_current->complex_basename,
+ 1, TRUE);
/* updating the old complex with data from the new one */
/* first process the prim_objs: */
/* - delete the prim_objs of the old component */
- s_delete_list_fromstart (w_current,
+ s_delete_list_fromstart (w_current,
o_current->complex->prim_objs);
/* - put the prim_objs of the new component in the old one */
o_current->complex->prim_objs = new_complex->complex->prim_objs;
@@ -1092,7 +1102,7 @@ void o_update_component(TOPLEVEL *w_current, OBJECT *o_current)
o_attrib_get_name_value (a_current->object->text->string,
&name, &value);
- attrfound = o_attrib_search_name_single(o_current, name, NULL);
+ attrfound = o_attrib_search_name_single(o_current, name, NULL);
/* free these now since they are no longer being used */
if (name) { g_free(name); }
@@ -1123,7 +1133,7 @@ void o_update_component(TOPLEVEL *w_current, OBJECT *o_current)
a_current = a_current->next;
}
-
+
/* finally delete the temp list with the updated complex */
s_delete_list_fromstart (w_current, tmp_list);
@@ -1137,11 +1147,11 @@ void o_update_component(TOPLEVEL *w_current, OBJECT *o_current)
/* Re-flag as embedded if necessary */
o_current->complex_embedded = is_embedded;
-
+
/* mark the page as modified */
w_current->page_current->CHANGED = 1;
o_undo_savestate (w_current, UNDO_ALL);
-
+
}
/*! \brief Do autosave on all pages that are marked.
@@ -1153,7 +1163,6 @@ void o_update_component(TOPLEVEL *w_current, OBJECT *o_current)
*/
void o_autosave_backups(TOPLEVEL *toplevel)
{
- GList *iter;
PAGE *p_save, *p_current;
gchar *backup_filename;
gchar *real_filename;
@@ -1163,14 +1172,15 @@ void o_autosave_backups(TOPLEVEL *toplevel)
mode_t mask;
struct stat st;
+ g_assert (toplevel->page_head != NULL &&
+ toplevel->page_head->pid == -1);
+
/* save current page */
p_save = toplevel->page_current;
-
- for ( iter = geda_list_get_glist( toplevel->pages );
- iter != NULL;
- iter = g_list_next( iter ) ) {
-
- p_current = (PAGE *)iter->data;
+
+ for (p_current = toplevel->page_head->next;
+ p_current != NULL;
+ p_current = p_current->next) {
if (p_current->do_autosave_backup == 0) {
continue;
@@ -1178,79 +1188,82 @@ void o_autosave_backups(TOPLEVEL *toplevel)
if (p_current->ops_since_last_backup != 0) {
/* make p_current the current page of toplevel */
s_page_goto (toplevel, p_current);
-
+
/* Get the real filename and file permissions */
real_filename = follow_symlinks (p_current->page_filename, NULL);
-
+
if (real_filename == NULL) {
- s_log_message (_("o_autosave_backups: Can't get the real filename of %s."), p_current->page_filename);
- fprintf (stderr, "o_autosave_backups: Can't get the real filename of %s.\n", p_current->page_filename);
- } else {
- /* Get the directory in which the real filename lives */
- dirname = g_path_get_dirname (real_filename);
- only_filename = g_path_get_basename(real_filename);
-
- backup_filename = g_strdup_printf("%s%c"AUTOSAVE_BACKUP_FILENAME_STRING,
- dirname, G_DIR_SEPARATOR, only_filename);
-
- /* If there is not an existing file with that name, compute the
- * permissions and uid/gid that we will use for the newly-created file.
- */
-
- if (stat (real_filename, &st) != 0) {
- struct stat dir_st;
- int result;
-
- /* Use default permissions */
- saved_umask = umask(0);
- st.st_mode = 0666 & ~saved_umask;
- umask(saved_umask);
- st.st_uid = getuid ();
-
- result = stat (dirname, &dir_st);
-
- if (result == 0 && (dir_st.st_mode & S_ISGID))
- st.st_gid = dir_st.st_gid;
- else
- st.st_gid = getgid ();
- }
- g_free (dirname);
- g_free (only_filename);
- g_free (real_filename);
-
- /* Make the backup file writable before saving a new one */
- if ( g_file_test (backup_filename, G_FILE_TEST_EXISTS) &&
- (! g_file_test (backup_filename, G_FILE_TEST_IS_DIR))) {
- saved_umask = umask(0);
- if (chmod(backup_filename, (S_IWRITE|S_IWGRP|S_IWOTH) &
- ((~saved_umask) & 0777)) != 0) {
- s_log_message (_("Could NOT set previous backup file [%s] read-write\n"),
- backup_filename);
- }
- umask(saved_umask);
- }
-
- if (o_save (toplevel, backup_filename)) {
-
- p_current->ops_since_last_backup = 0;
- p_current->do_autosave_backup = 0;
-
- /* Make the backup file readonly so a 'rm *' command will ask
- the user before deleting it */
- saved_umask = umask(0);
- mask = (S_IWRITE|S_IWGRP|S_IEXEC|S_IXGRP|S_IXOTH);
- mask = (~mask)&0777;
- mask &= ((~saved_umask) & 0777);
- if (chmod(backup_filename,mask) != 0) {
- s_log_message (_("Could NOT set backup file [%s] readonly\n"),
- backup_filename);
- }
- umask(saved_umask);
- } else {
- s_log_message (_("Could NOT save backup file [%s]\n"),
- backup_filename);
- }
- g_free (backup_filename);
+ s_log_message (_("o_autosave_backups: Can't get the real filename of %s."), p_current->page_filename);
+ fprintf (stderr, "o_autosave_backups: Can't get the real filename of %s.\n", p_current->page_filename);
+ }
+ else {
+ /* Get the directory in which the real filename lives */
+ dirname = g_path_get_dirname (real_filename);
+ only_filename = g_path_get_basename(real_filename);
+
+
+ backup_filename = g_strdup_printf("%s%c"AUTOSAVE_BACKUP_FILENAME_STRING,
+ dirname, G_DIR_SEPARATOR, only_filename);
+
+ /* If there is not an existing file with that name, compute the
+ * permissions and uid/gid that we will use for the newly-created file.
+ */
+
+ if (stat (real_filename, &st) != 0)
+ {
+ struct stat dir_st;
+ int result;
+
+ /* Use default permissions */
+ saved_umask = umask(0);
+ st.st_mode = 0666 & ~saved_umask;
+ umask(saved_umask);
+ st.st_uid = getuid ();
+
+ result = stat (dirname, &dir_st);
+
+ if (result == 0 && (dir_st.st_mode & S_ISGID))
+ st.st_gid = dir_st.st_gid;
+ else
+ st.st_gid = getgid ();
+ }
+ g_free (dirname);
+ g_free (only_filename);
+ g_free (real_filename);
+
+ /* Make the backup file writable before saving a new one */
+ if ( g_file_test (backup_filename, G_FILE_TEST_EXISTS) &&
+ (! g_file_test (backup_filename, G_FILE_TEST_IS_DIR))) {
+ saved_umask = umask(0);
+ if (chmod(backup_filename, (S_IWRITE|S_IWGRP|S_IWOTH) &
+ ((~saved_umask) & 0777)) != 0) {
+ s_log_message (_("Could NOT set previous backup file [%s] read-write\n"),
+ backup_filename);
+ }
+ umask(saved_umask);
+ }
+
+ if (o_save (toplevel, backup_filename)) {
+
+ p_current->ops_since_last_backup = 0;
+ p_current->do_autosave_backup = 0;
+
+ /* Make the backup file readonly so a 'rm *' command will ask
+ the user before deleting it */
+ saved_umask = umask(0);
+ mask = (S_IWRITE|S_IWGRP|S_IEXEC|S_IXGRP|S_IXOTH);
+ mask = (~mask)&0777;
+ mask &= ((~saved_umask) & 0777);
+ if (chmod(backup_filename,mask) != 0) {
+ s_log_message (_("Could NOT set backup file [%s] readonly\n"),
+ backup_filename);
+ }
+ umask(saved_umask);
+ } else {
+ s_log_message (_("Could NOT save backup file [%s]\n"),
+ backup_filename);
+ }
+ g_free (backup_filename);
}
}
}
diff --git a/gschem/src/o_select.c b/gschem/src/o_select.c
index acd4401..388e268 100644
--- a/gschem/src/o_select.c
+++ b/gschem/src/o_select.c
@@ -367,14 +367,13 @@ void o_select_box_search(TOPLEVEL *w_current)
int count = 0; /* object count */
int SHIFTKEY = w_current->SHIFTKEY;
int w_start_x, w_start_y, w_last_x, w_last_y;
- gboolean right_to_left = FALSE;
+
int tmp;
if( w_current->last_x < w_current->start_x ) {
tmp = w_current->last_x;
w_current->last_x = w_current->start_x;
w_current->start_x = tmp;
- right_to_left = TRUE;
}
if( w_current->last_y < w_current->start_y ) {
@@ -394,18 +393,10 @@ void o_select_box_search(TOPLEVEL *w_current)
(o_current->visibility == VISIBLE ||
(o_current->visibility == INVISIBLE && w_current->show_hidden_text))) {
- if ( /* Select any objects completely enclosed by the dragged box */
- (o_current->w_left >= w_start_x &&
- o_current->w_right <= w_last_x &&
- o_current->w_top >= w_last_y &&
- o_current->w_bottom <= w_start_y ) ||
- /* Select any touched objects if box was dragged right to left,
- * but only if they aren't locked (have a sel_func). */
- (right_to_left && o_current->sel_func != NULL &&
- o_current->w_left <= w_last_x &&
- o_current->w_right >= w_start_x &&
- o_current->w_top <= w_start_y &&
- o_current->w_bottom >= w_last_y ) ) {
+ if ( o_current->w_left >= w_start_x &&
+ o_current->w_right <= w_last_x &&
+ o_current->w_top >= w_last_y &&
+ o_current->w_bottom <= w_start_y ) {
o_select_object(w_current, o_current, MULTIPLE, count);
count++;
diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index 9759c91..3a2fe3f 100644
--- a/gschem/src/x_dialog.c
+++ b/gschem/src/x_dialog.c
@@ -2846,7 +2846,7 @@ char *generic_filesel_dialog (const char *msg, const char *templ, gint flags)
/*********** Start of find text dialog box *******/
int start_find;
-PAGE *remember_page;
+OBJECT *remember_page;
/*! \brief response function for the find text dialog
* \par Function Description
@@ -2869,11 +2869,11 @@ void find_text_dialog_response(GtkWidget *w, gint response,
strncpy(generic_textstring, string, 256);
- if (remember_page != w_current->page_current) {
- s_page_goto(w_current, remember_page);
+ while (remember_page != w_current->page_current->object_head) {
+ s_hierarchy_up(w_current, w_current->page_current->up);
}
done =
- o_edit_find_text(w_current, remember_page->object_head, string,
+ o_edit_find_text(w_current, remember_page, string,
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
(checkdescend)),
!start_find);
@@ -2909,7 +2909,7 @@ void find_text_dialog(TOPLEVEL * w_current)
OBJECT *object = NULL;
start_find = 1;
- remember_page = w_current->page_current;
+ remember_page = w_current->page_current->object_head;
if ((object = o_select_return_first_object(w_current)) != NULL) {
if (object->type == OBJ_TEXT) {
strncpy(generic_textstring, object->text->string, 256);
@@ -4004,18 +4004,17 @@ x_dialog_close_changed_page (TOPLEVEL *toplevel, PAGE *page)
gboolean
x_dialog_close_window (TOPLEVEL *toplevel)
{
- GList *iter;
- GtkWidget *dialog;
+ GtkWidget *dialog;
PAGE *p_current;
GList *unsaved_pages, *p_unsaved;
gboolean ret = FALSE;
- for ( iter = geda_list_get_glist( toplevel->pages ), unsaved_pages = NULL;
- iter != NULL;
- iter = g_list_next( iter ) ) {
-
- p_current = (PAGE*)iter->data;
-
+ /* build a list of unsaved pages */
+ g_assert (toplevel->page_head != NULL &&
+ toplevel->page_head->next != NULL);
+ for (p_current = toplevel->page_head->next, unsaved_pages = NULL;
+ p_current != NULL;
+ p_current = p_current->next) {
if (p_current->CHANGED) {
unsaved_pages = g_list_append (unsaved_pages, (gpointer)p_current);
}
diff --git a/gschem/src/x_event.c b/gschem/src/x_event.c
index 6c656b9..fcf553e 100644
--- a/gschem/src/x_event.c
+++ b/gschem/src/x_event.c
@@ -1264,7 +1264,6 @@ x_event_configure (GtkWidget *widget,
GdkEventConfigure *event,
gpointer user_data)
{
- GList *iter;
TOPLEVEL *toplevel = (TOPLEVEL*)user_data;
PAGE *old_page_current, *p_current;
gint old_win_width, old_win_height, new_win_width, new_win_height;
@@ -1321,21 +1320,18 @@ x_event_configure (GtkWidget *widget,
/* save current page */
old_page_current = toplevel->page_current;
-
/* re-pan each page of the toplevel */
- for ( iter = geda_list_get_glist( toplevel->pages );
- iter != NULL;
- iter = g_list_next( iter ) ) {
-
+ for (p_current = toplevel->page_head->next;
+ p_current != NULL;
+ p_current = p_current->next) {
gdouble cx, cy;
- p_current = (PAGE *)iter->data;
-
+
/* doing this the aspectratio is kept when changing (hw)*/
cx = ((gdouble)(p_current->left + p_current->right)) / 2;
cy = ((gdouble)(p_current->top + p_current->bottom)) / 2;
s_page_goto (toplevel, p_current);
a_pan_general (toplevel, cx, cy, relativ_zoom_factor, A_PAN_DONT_REDRAW);
-
+
}
/* restore current page to saved value */
s_page_goto (toplevel, old_page_current);
diff --git a/gschem/src/x_pagesel.c b/gschem/src/x_pagesel.c
index 4bd4172..1bd4328 100644
--- a/gschem/src/x_pagesel.c
+++ b/gschem/src/x_pagesel.c
@@ -36,8 +36,6 @@
#include <dmalloc.h>
#endif
-#include <glib-object.h>
-
#include "../include/gschem_dialog.h"
#include "../include/x_pagesel.h"
@@ -92,19 +90,6 @@ void x_pagesel_close (TOPLEVEL *toplevel)
}
-/*! \brief Callback activated when the <B>toplevel</B>'s page list changes.
- * \par Function Description
- * Calls x_pagesel_update(...) when the <B>toplevel</B>'s page list changes.
- *
- * \param [in] pages the page list which changed.
- * \param [in] user_data a pointer to the pagesel which registered this callback.
- */
-static void pagelist_changed_cb( GedaList *page_list, gpointer user_data )
-{
- Pagesel *pagesel = (Pagesel *)user_data;
- pagesel_update( pagesel );
-}
-
/*! \brief Update the list and status of <B>toplevel</B>'s pages.
* \par Function Description
* Updates the list and status of <B>toplevel</B>\'s pages if the page
@@ -157,7 +142,6 @@ enum {
NUM_COLUMNS
};
-static GObjectClass *pagesel_parent_class = NULL;
static void pagesel_class_init (PageselClass *class);
static void pagesel_init (Pagesel *pagesel);
@@ -320,9 +304,8 @@ static void pagesel_popup_menu (Pagesel *pagesel,
*
* \par Function Description
*
- * When the toplevel property is set on the parent GschemDialog:
- * Connect to its page list's "changed" signal.
- * Update the pagesel dialog.
+ * When the toplevel property is set on the parent GschemDialog,
+ * we should update the pagesel dialog.
*
* \param [in] pspec the GParamSpec of the property which changed
* \param [in] gobject the object which received the signal.
@@ -333,11 +316,6 @@ static void notify_toplevel_cb (GObject *gobject,
gpointer user_data)
{
Pagesel *pagesel = PAGESEL( gobject );
- GschemDialog *dialog = GSCHEM_DIALOG( pagesel );
-
- pagesel->pagelist_changed_id =
- g_signal_connect( dialog->toplevel->pages, "changed",
- G_CALLBACK( pagelist_changed_cb ), pagesel );
pagesel_update( pagesel );
}
@@ -378,30 +356,8 @@ GType pagesel_get_type()
* \par Function Description
*
*/
-static void pagesel_finalize (GObject *object)
-{
- Pagesel *pagesel = PAGESEL (object);
- GschemDialog *dialog = GSCHEM_DIALOG (pagesel);
-
- if (dialog->toplevel)
- g_signal_handler_disconnect (dialog->toplevel->pages,
- pagesel->pagelist_changed_id);
-
- G_OBJECT_CLASS (pagesel_parent_class)->finalize (object);
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
static void pagesel_class_init (PageselClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- pagesel_parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->finalize = pagesel_finalize;
}
/*! \todo Finish function documentation!!!
@@ -552,15 +508,13 @@ static void pagesel_init (Pagesel *pagesel)
*
* \param [in] model GtkTreeModel to update.
* \param [in] parent GtkTreeIter pointer to tree root.
- * \param [in] pages GedaPageList of pages for this toplevel.
* \param [in] page The PAGE object to update tree model from.
*/
static void add_page (GtkTreeModel *model, GtkTreeIter *parent,
- GedaPageList *pages, PAGE *page)
+ PAGE *page)
{
GtkTreeIter iter;
PAGE *p_current;
- GList *p_iter;
/* add the page to the store */
gtk_tree_store_append (GTK_TREE_STORE (model),
@@ -572,17 +526,16 @@ static void add_page (GtkTreeModel *model, GtkTreeIter *parent,
COLUMN_NAME, page->page_filename,
COLUMN_CHANGED, page->CHANGED,
-1);
-
+
/* search a page that has a up field == p_current->pid */
- for ( p_iter = geda_list_get_glist( pages );
- p_iter != NULL;
- p_iter = g_list_next( p_iter ) ) {
-
- p_current = (PAGE *)p_iter->data;
+ for (p_current = page->next;
+ p_current != NULL;
+ p_current = p_current->next) {
if (p_current->up == page->pid) {
- add_page (model, &iter, pages, p_current);
+ add_page (model, &iter, p_current);
}
}
+
}
/*! \todo Finish function documentation!!!
@@ -630,7 +583,6 @@ void pagesel_update (Pagesel *pagesel)
GtkTreeModel *model;
TOPLEVEL *toplevel;
PAGE *p_current;
- GList *iter;
g_assert (IS_PAGESEL (pagesel));
@@ -642,16 +594,14 @@ void pagesel_update (Pagesel *pagesel)
/* wipe out every thing in the store */
gtk_tree_store_clear (GTK_TREE_STORE (model));
/* now rebuild */
- for ( iter = geda_list_get_glist( toplevel->pages );
- iter != NULL;
- iter = g_list_next( iter ) ) {
-
- p_current = (PAGE *)iter->data;
+ for (p_current = toplevel->page_head->next;
+ p_current != NULL;
+ p_current = p_current->next) {
/* find every page that is not a hierarchy-down of another page */
if (p_current->up < 0 ||
- s_hierarchy_find_page (toplevel->pages,
+ s_hierarchy_find_page (toplevel->page_head->next,
p_current->up) == NULL) {
- add_page (model, NULL, toplevel->pages, p_current);
+ add_page (model, NULL, p_current);
}
}
diff --git a/gschem/src/x_window.c b/gschem/src/x_window.c
index d6e695e..74b421b 100644
--- a/gschem/src/x_window.c
+++ b/gschem/src/x_window.c
@@ -1075,7 +1075,6 @@ void
x_window_close_page (TOPLEVEL *toplevel, PAGE *page)
{
PAGE *new_current = NULL;
- GList *iter;
g_return_if_fail (toplevel != NULL);
g_return_if_fail (page != NULL);
@@ -1085,16 +1084,13 @@ x_window_close_page (TOPLEVEL *toplevel, PAGE *page)
if (page == toplevel->page_current) {
/* as it will delete current page, select new current page */
/* first look up in page hierarchy */
- new_current = s_hierarchy_find_page (toplevel->pages, page->up);
-
+ new_current = s_hierarchy_find_page (toplevel->page_head, page->up);
if (new_current == NULL) {
- /* no up in hierarchy, choice is prev, next, new page */
- iter = g_list_find( geda_list_get_glist( toplevel->pages ), page );
-
- if ( g_list_previous( iter ) ) {
- new_current = (PAGE *)g_list_previous( iter )->data;
- } else if ( g_list_next( iter ) ) {
- new_current = (PAGE *)g_list_next( iter )->data;
+ /* no up in hierarchy, choice is next, prev, new page */
+ if (page->prev && page->prev->pid != -1) {
+ new_current = page->prev;
+ } else if (page->next != NULL) {
+ new_current = page->next;
} else {
/* need to add a new untitled page */
new_current = NULL;
diff --git a/gsymcheck/src/s_check.c b/gsymcheck/src/s_check.c
index 2156254..05f78de 100644
--- a/gsymcheck/src/s_check.c
+++ b/gsymcheck/src/s_check.c
@@ -41,23 +41,25 @@
int
s_check_all(TOPLEVEL *pr_current)
{
- GList *iter;
PAGE *p_current;
int return_status=0;
+ p_current = pr_current->page_head;
- for ( iter = geda_list_get_glist( pr_current->pages );
- iter != NULL;
- iter = g_list_next( iter ) ) {
- p_current = (PAGE *)iter->data;
+ while(p_current != NULL) {
+ if (p_current->pid != -1) {
+
+ if (p_current->object_head) {
+ return_status = return_status +
+ s_check_symbol(pr_current, p_current,
+ p_current->object_head);
+ if (!quiet_mode) s_log_message("\n");
+ }
- if (p_current->object_head) {
- return_status = return_status +
- s_check_symbol(pr_current, p_current,
- p_current->object_head);
- if (!quiet_mode) s_log_message("\n");
}
+
+ p_current = p_current->next;
}
return(return_status);
diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index 6e4f698..5f4560c 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -196,7 +196,7 @@ char *o_attrib_search_component(OBJECT *object, char *name);
void o_attrib_slot_update(TOPLEVEL *w_current, OBJECT *object);
void o_attrib_slot_copy(TOPLEVEL *w_current, OBJECT *original, OBJECT *target);
int o_attrib_count_toplevel(TOPLEVEL *w_current, char *name);
-char *o_attrib_search_toplevel_all(GedaPageList *page_list, char *name);
+char *o_attrib_search_toplevel_all(PAGE *page_head, char *name);
OBJECT **o_attrib_return_attribs(OBJECT *object_list, OBJECT *sel_object);
void o_attrib_free_returned(OBJECT **found_objects);
@@ -543,9 +543,9 @@ void s_hierarchy_down_symbol (TOPLEVEL *w_current, const CLibSymbol *symbol, PAG
void s_hierarchy_up(TOPLEVEL *w_current, int pid);
GList* s_hierarchy_traversepages(TOPLEVEL *w_current, gint flags);
gint s_hierarchy_print_page(PAGE *p_current, void * data);
-PAGE *s_hierarchy_find_prev_page(GedaPageList *page_list, PAGE *current_page, int page_control);
-PAGE *s_hierarchy_find_next_page(GedaPageList *page_list, PAGE *current_page, int page_control);
-PAGE *s_hierarchy_find_page(GedaPageList *page_list, int pid);
+PAGE *s_hierarchy_find_prev_page(PAGE *p_start, int page_control);
+PAGE *s_hierarchy_find_next_page(PAGE *p_start, int page_control);
+PAGE *s_hierarchy_find_page(PAGE *p_start, int pid);
/* s_log.c */
void s_log_init (const gchar *filename);
@@ -563,13 +563,15 @@ void s_menu_init(void);
/* s_page.c */
PAGE *s_page_new (TOPLEVEL *toplevel, const gchar *filename);
void s_page_delete (TOPLEVEL *toplevel, PAGE *page);
+void s_page_init_list (TOPLEVEL *toplevel);
void s_page_delete_list(TOPLEVEL *toplevel);
void s_page_goto (TOPLEVEL *toplevel, PAGE *p_new);
PAGE *s_page_search (TOPLEVEL *toplevel, const gchar *filename);
+PAGE* s_page_search_pid(TOPLEVEL * toplevel, gint page_id);
void s_page_print_all (TOPLEVEL *toplevel);
gint s_page_save_all (TOPLEVEL *toplevel);
-gboolean s_page_check_changed (GedaPageList *list);
-void s_page_clear_changed (GedaPageList *list);
+gboolean s_page_check_changed (PAGE *head);
+void s_page_clear_changed (PAGE *head);
void s_page_autosave_init(TOPLEVEL *toplevel);
gint s_page_autosave (TOPLEVEL *w_current);
diff --git a/libgeda/include/struct.h b/libgeda/include/struct.h
index b298662..86bb926 100644
--- a/libgeda/include/struct.h
+++ b/libgeda/include/struct.h
@@ -24,7 +24,6 @@
/* Wrappers around a new list mechanism */
typedef struct _GedaList SELECTION;
-typedef struct _GedaList GedaPageList;
/* gschem structures (gschem) */
typedef struct st_complex COMPLEX;
@@ -395,6 +394,9 @@ struct st_page {
/* Function which asks the user wether to load a newer backup file */
int (*load_newer_backup_func)();
+ /* left to right movement */
+ PAGE *prev;
+ PAGE *next;
};
struct st_toplevel {
@@ -498,8 +500,9 @@ struct st_toplevel {
int doing_pan; /* mouse pan status flag */
/* page system */
+ PAGE *page_head;
+ PAGE *page_tail;
PAGE *page_current;
- GedaPageList *pages;
/* buffer_number is used by the buffer copy/cut/paste mechanism */
/* in gschem to keep track of the current buffer number */
diff --git a/libgeda/src/o_attrib.c b/libgeda/src/o_attrib.c
index c8934c9..c9f5c58 100644
--- a/libgeda/src/o_attrib.c
+++ b/libgeda/src/o_attrib.c
@@ -34,8 +34,6 @@
#include "o_types.h"
#include "colors.h"
-#include "geda_list.h"
-
#include "../include/prototype.h"
#ifdef HAVE_LIBDMALLOC
@@ -2392,20 +2390,18 @@ void o_attrib_slot_copy(TOPLEVEL *w_current, OBJECT *original, OBJECT *target)
/* returns the number of toplevel attributes in all loaded pages */
int o_attrib_count_toplevel(TOPLEVEL *w_current, char *name)
{
- const GList *iter;
int ret_value=0;
int counter=0;
PAGE *p_current;
char *string;
- iter = geda_list_get_glist( w_current->pages );
+ p_current = w_current->page_head;
- while( iter != NULL ) {
- p_current = (PAGE *)iter->data;
+ while(p_current != NULL) {
counter = 0;
- string = o_attrib_search_name(p_current->object_head,
- name, counter);
+ string = o_attrib_search_name(p_current->object_head,
+ name, counter);
printf("%s %d\n", name, counter);
while(string) {
printf("inside\n");
@@ -2414,11 +2410,11 @@ int o_attrib_count_toplevel(TOPLEVEL *w_current, char *name)
string=NULL;
counter++;
- string = o_attrib_search_name(p_current->object_head,
- name, counter);
+ string = o_attrib_search_name(p_current->object_head,
+ name, counter);
}
- iter = g_list_next( iter );
+ p_current=p_current->next;
}
return(ret_value);
}
@@ -2430,31 +2426,34 @@ int o_attrib_count_toplevel(TOPLEVEL *w_current, char *name)
* The caller is responsible for freeing the returned value.
* See #o_attrib_search_toplevel() for other comments.
*
- * \param [in] page_list Page list to search through.
+ * \param [in] page_head PAGE head object to search through.
* \param [in] name Character string name to search for.
* \return Character string from the found attribute, NULL otherwise.
*/
-char *o_attrib_search_toplevel_all(GedaPageList *page_list, char *name)
+char *o_attrib_search_toplevel_all(PAGE *page_head, char *name)
{
- const GList *iter;
PAGE *p_current;
char *ret_value=NULL;
- iter = geda_list_get_glist( page_list );
+ p_current = page_head;
+
+ while (p_current != NULL) {
+
- while( iter != NULL ) {
- p_current = (PAGE *)iter->data;
+ /* don't look into the head of page_head */
+ if (p_current->pid != -1) {
- /* only look for first occurrance of the attribute */
- ret_value = o_attrib_search_toplevel(
- p_current->object_head,
- name, 0);
+ /* only look for first occurrance of the attribute */
+ ret_value = o_attrib_search_toplevel(
+ p_current->object_head,
+ name, 0);
+ }
if (ret_value != NULL) {
return(ret_value);
}
-
- iter = g_list_next( iter );
+
+ p_current = p_current->next;
}
return(NULL);
diff --git a/libgeda/src/s_clib.c b/libgeda/src/s_clib.c
index 5a9a57a..7bb4824 100644
--- a/libgeda/src/s_clib.c
+++ b/libgeda/src/s_clib.c
@@ -134,7 +134,6 @@
#include "colors.h"
#include "i_vars.h"
#include "prototype.h"
-#include "geda_list.h"
/* Constant definitions
* ===================
@@ -1301,18 +1300,14 @@ GList *s_toplevel_get_symbols (const TOPLEVEL *w_current)
GList *result = NULL;
GList *iter = NULL;
OBJECT *o = NULL;
- PAGE *page;
+ PAGE *p = NULL;
GList *symlist = NULL;
CLibSymbol *sym = NULL;
- const GList *p_iter;
g_assert (w_current != NULL);
- for ( p_iter = geda_list_get_glist( w_current->pages );
- p_iter != NULL;
- p_iter = g_list_next( p_iter )) {
- page = (PAGE *)p_iter->data;
- for (o = page->object_head; o != NULL; o = o->next) {
+ for (p = w_current->page_head->next; p != NULL; p = p->next) {
+ for (o = p->object_head; o != NULL; o = o->next) {
if (o->type != OBJ_COMPLEX) continue;
if (o->complex_basename == NULL) continue;
diff --git a/libgeda/src/s_hierarchy.c b/libgeda/src/s_hierarchy.c
index 305bc2a..877fba2 100644
--- a/libgeda/src/s_hierarchy.c
+++ b/libgeda/src/s_hierarchy.c
@@ -36,8 +36,6 @@
#include "globals.h"
#include "o_types.h"
-#include "geda_list.h"
-
#include "../include/prototype.h"
#ifdef HAVE_LIBDMALLOC
@@ -95,7 +93,7 @@ int s_hierarchy_down_schematic_single(TOPLEVEL *w_current,
/* check whether this page is in the parents list */
for (forbear = parent;
forbear != NULL && found->pid != forbear->pid && forbear->up >= 0;
- forbear = s_hierarchy_find_page (w_current->pages, forbear->up))
+ forbear = s_page_search_pid(w_current, forbear->up))
; /* void */
if (found->pid == forbear->pid) {
@@ -258,7 +256,7 @@ void s_hierarchy_up(TOPLEVEL *w_current, int pid)
return;
}
- p_current = s_hierarchy_find_page(w_current->pages, pid);
+ p_current = s_hierarchy_find_page(w_current->page_head, pid);
if (p_current) {
s_page_goto(w_current, p_current);
@@ -337,7 +335,7 @@ GList *s_hierarchy_traversepages(TOPLEVEL *w_current,
/* call the recursive function */
s_hierarchy_traversepages(w_current,
flags | HIERARCHY_INNERLOOP);
- s_page_goto(w_current, p_current);
+ s_hierarchy_up(w_current, w_current->page_current->up);
}
else {
s_log_message("ERROR in s_hierarchy_traverse: "
@@ -383,18 +381,15 @@ gint s_hierarchy_print_page(PAGE *p_current, void * data)
* \par Function Description
*
*/
-PAGE *s_hierarchy_find_prev_page (GedaPageList *page_list, PAGE *current_page, int page_control)
+PAGE *s_hierarchy_find_prev_page (PAGE *p_start, int page_control)
{
- const GList *iter;
-
- iter = g_list_find (geda_list_get_glist (page_list), current_page);
- for (iter = g_list_previous (iter);
- iter != NULL;
- iter = g_list_previous (iter)) {
+ PAGE *p_current;
- PAGE *page = (PAGE *)iter->data;
- if (page->page_control == page_control) {
- return page;
+ for (p_current = p_start->prev;
+ p_current != NULL;
+ p_current = p_current->prev) {
+ if (p_current->page_control == page_control) {
+ return p_current;
}
}
@@ -406,18 +401,15 @@ PAGE *s_hierarchy_find_prev_page (GedaPageList *page_list, PAGE *current_page, i
* \par Function Description
*
*/
-PAGE *s_hierarchy_find_next_page (GedaPageList *page_list, PAGE *current_page, int page_control)
+PAGE *s_hierarchy_find_next_page (PAGE *p_start, int page_control)
{
- const GList *iter;
+ PAGE *p_current;
- iter = g_list_find (geda_list_get_glist (page_list), current_page);
- for (iter = g_list_next (iter);
- iter != NULL;
- iter = g_list_next (iter)) {
-
- PAGE *page = (PAGE *)iter->data;
- if (page->page_control == page_control) {
- return page;
+ for (p_current = p_start->next;
+ p_current != NULL;
+ p_current = p_current->next) {
+ if (p_current->page_control == page_control) {
+ return p_current;
}
}
@@ -429,17 +421,15 @@ PAGE *s_hierarchy_find_next_page (GedaPageList *page_list, PAGE *current_page, i
* \par Function Description
*
*/
-PAGE *s_hierarchy_find_page (GedaPageList *page_list, int pid)
+PAGE *s_hierarchy_find_page (PAGE *p_start, int pid)
{
- const GList *iter;
-
- for ( iter = geda_list_get_glist (page_list);
- iter != NULL;
- iter = g_list_next (iter) ) {
+ PAGE *p_current = p_start;
- PAGE *page = (PAGE *)iter->data;
- if (page->pid == pid) {
- return page;
+ for (p_current = p_start;
+ p_current != NULL;
+ p_current = p_current->next) {
+ if (p_current->pid == pid) {
+ return p_current;
}
}
diff --git a/libgeda/src/s_page.c b/libgeda/src/s_page.c
index 1556c0d..a7a2b92 100644
--- a/libgeda/src/s_page.c
+++ b/libgeda/src/s_page.c
@@ -46,8 +46,6 @@
#include "o_types.h"
#include "funcs.h"
-#include "geda_list.h"
-
#include "../include/prototype.h"
#ifdef HAVE_LIBDMALLOC
@@ -142,8 +140,11 @@ PAGE *s_page_new (TOPLEVEL *toplevel, const gchar *filename)
page->load_newer_backup_func = load_newer_backup_func;
/* now append page to page list of toplevel */
- geda_list_add( toplevel->pages, page );
-
+ toplevel->page_tail->next = page;
+ page->prev = toplevel->page_tail;
+ page->next = NULL;
+ toplevel->page_tail = page;
+
return page;
}
@@ -152,7 +153,8 @@ PAGE *s_page_new (TOPLEVEL *toplevel, const gchar *filename)
* \par Function Description
* Deletes a single page <B>page</B> from <B>toplevel</B>'s list of pages.
*
- * See #s_page_delete_list() to delete all pages of a <B>toplevel</B>
+ * This function is not appropriate for deleting page head.
+ * See #s_page_delete_list() for that.
*
* If the current page of toplevel is given as parameter <B>page</B>,
* the function sets the field <B>page_current</B> of the TOPLEVEL
@@ -166,9 +168,11 @@ void s_page_delete (TOPLEVEL *toplevel, PAGE *page)
gchar *only_filename;
gchar *dirname;
+ g_assert (page->pid != -1);
+
/* we need to play with page_current because s_delete_list_fromstart() */
/* make use of it (see s_tile_remove_object_all) */
-
+
/* save page_current and switch to page */
if (page == toplevel->page_current) {
tmp = NULL;
@@ -232,10 +236,22 @@ void s_page_delete (TOPLEVEL *toplevel, PAGE *page)
/* ouch, deal with parents going away and the children still around */
page->up = -2;
- g_free (page->page_filename);
+ /* p_current->down = NULL; not needed */
- geda_list_remove( toplevel->pages, page );
+ g_free (page->page_filename);
+ /* now unlink page from its list */
+ if (page->next) {
+ page->next->prev = page->prev;
+ } else {
+ /* page if the tail of page list: update toplevel */
+ g_assert (toplevel->page_tail == page);
+ toplevel->page_tail = page->prev;
+ }
+ if (page->prev) {
+ page->prev->next = page->next;
+ }
+
#if DEBUG
s_tile_print (toplevel);
#endif
@@ -258,6 +274,34 @@ void s_page_delete (TOPLEVEL *toplevel, PAGE *page)
}
+/*! \todo Finish function documentation!!!
+ * \brief Initializes <B>toplevel</B>'s list of pages.
+ * \par Function Description
+ * This function creates a head page and set the toplevel fields relative
+ * to page management.
+ */
+void s_page_init_list (TOPLEVEL *toplevel)
+{
+ PAGE *head;
+
+ g_assert (toplevel->page_head == NULL);
+
+ head = (PAGE*)g_new (PAGE, 1);
+
+ head->pid = -1;
+ head->CHANGED = 0;
+ head->page_filename = g_strdup ("page_head");
+ head->prev = NULL;
+ head->next = NULL;
+ /* this is important so that page_next and page_prev ignore the
+ * page head node
+ */
+ head->page_control = -1;
+
+ /* add head as page head of toplevel */
+ toplevel->page_head = toplevel->page_tail = head;
+
+}
/*! \todo Finish function documentation!!!
* \brief Deletes the list of pages of <B>toplevel</B>.
@@ -267,22 +311,28 @@ void s_page_delete (TOPLEVEL *toplevel, PAGE *page)
*/
void s_page_delete_list(TOPLEVEL *toplevel)
{
- GList *list_copy, *iter;
- PAGE *page;
-
- /* s_page_delete removes items from the page list, so make a copy */
- list_copy = g_list_copy (geda_list_get_glist (toplevel->pages));
+ PAGE *p_current, *p_prev;
- for (iter = list_copy; iter != NULL; iter = g_list_next (iter)) {
- page = (PAGE *)iter->data;
+ p_current = toplevel->page_tail;
- s_page_delete (toplevel, page);
- }
+ while (p_current != NULL && p_current->pid != -1) {
+ p_prev = p_current->prev;
+ s_page_delete (toplevel, p_current);
+ p_current = p_prev;
+ }
- g_list_free (list_copy);
+ g_assert (p_current->pid == -1 &&
+ p_current->prev == NULL && p_current->next == NULL);
+
+ /* Now free the head */
+ g_free (p_current->page_filename);
+ g_free (p_current);
/* reset toplevel fields */
+ toplevel->page_head = NULL;
+ toplevel->page_tail = NULL;
toplevel->page_current = NULL;
+
}
/*! \todo Finish function documentation!!!
@@ -294,13 +344,13 @@ void s_page_delete_list(TOPLEVEL *toplevel)
void s_page_goto (TOPLEVEL *toplevel, PAGE *p_new)
{
gchar *dirname;
-
+
toplevel->page_current = p_new;
dirname = g_dirname (p_new->page_filename);
chdir (dirname);
g_free (dirname);
-
+
}
/*! \todo Finish function documentation!!!
@@ -313,20 +363,39 @@ void s_page_goto (TOPLEVEL *toplevel, PAGE *p_new)
*/
PAGE *s_page_search (TOPLEVEL *toplevel, const gchar *filename)
{
- const GList *iter;
- PAGE *page;
-
- for ( iter = geda_list_get_glist( toplevel->pages );
- iter != NULL;
- iter = g_list_next( iter ) ) {
+ PAGE *p_current;
- page = (PAGE *)iter->data;
- if ( g_strcasecmp( page->page_filename, filename ) == 0 )
- return page;
+ for (p_current = toplevel->page_head;
+ p_current != NULL;
+ p_current = p_current->next) {
+ if (g_strcasecmp (p_current->page_filename, filename) == 0) {
+ return p_current;
+ }
}
+
return NULL;
}
+/*! \todo Finish function documentation!!!
+ * \brief Search for pages by page id.
+ * \par Function Description
+ * This function tries to find a page refered by its <B>page_id</B>.
+ *
+ * \return PAGE pointer to matching page, NULL otherwise.
+ */
+PAGE *s_page_search_pid(TOPLEVEL * toplevel, gint page_id)
+{
+ PAGE* p_current;
+
+ for (p_current = toplevel->page_head;
+ p_current != NULL;
+ p_current = p_current->next) {
+ if (p_current->pid == page_id)
+ return p_current;
+ }
+
+ return NULL;
+}
/*! \brief Print full TOPLEVEL structure.
* \par Function Description
@@ -337,17 +406,18 @@ PAGE *s_page_search (TOPLEVEL *toplevel, const gchar *filename)
*/
void s_page_print_all (TOPLEVEL *toplevel)
{
- const GList *iter;
- PAGE *page;
+ PAGE *p_current;
- for ( iter = geda_list_get_glist( toplevel->pages );
- iter != NULL;
- iter = g_list_next( iter ) ) {
+ g_assert (toplevel->page_head != NULL &&
+ toplevel->page_head->pid == -1);
- page = (PAGE *)iter->data;
- printf ("FILENAME: %s\n", page->page_filename);
- print_struct_forw (page->object_head);
+ for (p_current = toplevel->page_head->next;
+ p_current != NULL;
+ p_current = p_current->next) {
+ printf ("FILENAME: %s\n", p_current->page_filename);
+ print_struct_forw (p_current->object_head);
}
+
}
/*! \todo Finish function documentation!!!
@@ -360,19 +430,18 @@ void s_page_print_all (TOPLEVEL *toplevel)
*/
gint s_page_save_all (TOPLEVEL *toplevel)
{
- const GList *iter;
PAGE *p_save, *p_current;
gint status = 0;
+ g_assert (toplevel->page_head != NULL &&
+ toplevel->page_head->pid == -1);
+
/* save current page */
p_save = toplevel->page_current;
-
- for ( iter = geda_list_get_glist( toplevel->pages );
- iter != NULL;
- iter = g_list_next( iter ) ) {
-
- p_current = (PAGE *)iter->data;
-
+
+ for (p_current = toplevel->page_head->next;
+ p_current != NULL;
+ p_current = p_current->next) {
/* make p_current the current page of toplevel */
s_page_goto (toplevel, p_current);
@@ -381,14 +450,14 @@ gint s_page_save_all (TOPLEVEL *toplevel)
toplevel->page_current->page_filename);
/* reset the CHANGED flag of p_current */
p_current->CHANGED = 0;
-
+
} else {
s_log_message ("Could NOT save [%s]\n",
toplevel->page_current->page_filename);
/* increase the error counter */
status++;
}
-
+
}
/* restore current page */
@@ -403,22 +472,19 @@ gint s_page_save_all (TOPLEVEL *toplevel)
/*! \todo Finish function documentation!!!
* \brief Check if CHANGED flag is set for any page in list.
* \par Function Description
- * This function checks the CHANGED flag for all pages in the <B>list</B>
+ * This function checks the CHANGED flag for all pages in the <B>head</B>
* object.
*
- * \param [in] list GedaPageList to check CHANGED flag in.
+ * \param [in] head PAGES list to check CHANGED flag in.
* \return 1 if any page has the CHANGED flag set, 0 otherwise.
*/
-gboolean s_page_check_changed (GedaPageList *list)
+gboolean s_page_check_changed (PAGE *head)
{
- const GList *iter;
PAGE *p_current;
- for ( iter = geda_list_get_glist( list );
- iter != NULL;
- iter = g_list_next( iter ) ) {
-
- p_current = (PAGE *)iter->data;
+ for (p_current = head;
+ p_current != NULL;
+ p_current = p_current->next) {
if (p_current->CHANGED) {
return TRUE;
}
@@ -433,18 +499,16 @@ gboolean s_page_check_changed (GedaPageList *list)
*
* \param [in,out] head PAGE list to set CHANGED flags in.
*/
-void s_page_clear_changed (GedaPageList *list)
+void s_page_clear_changed (PAGE *head)
{
- const GList *iter;
PAGE *p_current;
- for ( iter = geda_list_get_glist( list );
- iter != NULL;
- iter = g_list_next( iter ) ) {
-
- p_current = (PAGE *)iter->data;
+ for (p_current = head;
+ p_current != NULL;
+ p_current = p_current->next) {
p_current->CHANGED = 0;
}
+
}
/*! \brief Autosave initialization function.
@@ -476,7 +540,6 @@ void s_page_autosave_init(TOPLEVEL *toplevel)
*/
gint s_page_autosave (TOPLEVEL *toplevel)
{
- const GList *iter;
PAGE *p_current;
if (toplevel == NULL) {
@@ -487,23 +550,26 @@ gint s_page_autosave (TOPLEVEL *toplevel)
if (toplevel->auto_save_interval == 0) {
return toplevel->auto_save_interval;
}
-
- /* Should we just disable the autosave timeout returning 0 or
+
+ /* In which situation can be page_head = NULL?
+ Should we just disable the autosave timeout returning 0 or
just wait for more pages to be added? */
- if ( toplevel->pages == NULL)
- return toplevel->auto_save_interval;
-
- for ( iter = geda_list_get_glist( toplevel->pages );
- iter != NULL;
- iter = g_list_next( iter ) ) {
+ if ( (toplevel->page_head == NULL) ||
+ (toplevel->page_head->next == NULL) ) {
+ return (toplevel->auto_save_interval);
+ }
- p_current = (PAGE *)iter->data;
+ for (p_current = toplevel->page_head->next;
+ p_current != NULL;
+ p_current = p_current->next) {
if (p_current->ops_since_last_backup != 0) {
/* Real autosave is done in o_undo_savestate */
p_current->do_autosave_backup = 1;
}
+
}
return toplevel->auto_save_interval;
+
}
diff --git a/libgeda/src/s_toplevel.c b/libgeda/src/s_toplevel.c
index 4adaaf1..8acadd7 100644
--- a/libgeda/src/s_toplevel.c
+++ b/libgeda/src/s_toplevel.c
@@ -41,8 +41,6 @@
#include "../include/prototype.h"
-#include "geda_list.h"
-
#ifdef HAVE_LIBDMALLOC
#include <dmalloc.h>
#endif
@@ -156,10 +154,12 @@ TOPLEVEL *s_toplevel_new (void)
toplevel->CONTROLKEY = 0;
toplevel->SHIFTKEY = 0;
toplevel->ALTKEY = 0;
-
+
toplevel->doing_pan = 0;
-
- toplevel->pages = geda_list_new();
+
+ /* Put head node on page list... */
+ toplevel->page_head = NULL;
+ s_page_init_list (toplevel);
toplevel->page_current = NULL;
toplevel->buffer_number = 0;
@@ -498,16 +498,13 @@ void s_toplevel_delete (TOPLEVEL *toplevel)
/* delete all pages */
s_page_delete_list (toplevel);
-
- /* Delete the page list */
- g_object_unref(toplevel->pages);
-
+
/* unlink toplevel from toplevel list */
toplevel->prev->next = toplevel->next;
if (toplevel->next != NULL) {
toplevel->next->prev = toplevel->prev;
}
-
+
g_free (toplevel);
-
+
}
diff --git a/utils/gschlas/s_util.c b/utils/gschlas/s_util.c
index 6944026..b656bb8 100644
--- a/utils/gschlas/s_util.c
+++ b/utils/gschlas/s_util.c
@@ -45,30 +45,33 @@
void
s_util_embed(TOPLEVEL *pr_current, int embed_mode)
{
- GList *iter;
- PAGE *p_current;
- OBJECT *o_current;
+ PAGE *p_current;
+ OBJECT *o_current;
- for ( iter = geda_list_get_glist( pr_current->pages );
- iter != NULL;
- iter = g_list_next( iter ) ) {
+ p_current = pr_current->page_head;
- p_current = (PAGE *)iter->data;
+ while (p_current != NULL) {
- o_current = p_current->object_head;
- while (o_current != NULL) {
+ o_current = p_current->object_head;
- if (o_current->type == OBJ_COMPLEX ||
- o_current->type == OBJ_PICTURE) {
- if (embed_mode == TRUE) {
- o_embed(pr_current, o_current);
- } else {
- o_unembed(pr_current, o_current);
- }
+ if (p_current->pid != -1) {
+
+ while (o_current != NULL) {
+
+ if (o_current->type == OBJ_COMPLEX ||
+ o_current->type == OBJ_PICTURE) {
+ if (embed_mode == TRUE) {
+ o_embed(pr_current, o_current);
+ } else {
+ o_unembed(pr_current, o_current);
+ }
+ }
+
+ o_current = o_current->next;
+ }
}
- o_current = o_current->next;
+ p_current = p_current->next;
}
- }
}
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs