[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: branch: master updated (1.1.1.20070708-60-gdbfe00a)



The branch, master has been updated
       via  dbfe00a20de3f875e519ef60629b968977fc5db8 (commit)
       via  f1451161914a0ed0bb43123279906d82cb7d5b49 (commit)
       via  2ad315fc0badd16a9614d1107b22c973908893d5 (commit)
       via  d8844bb48969aa45a05cbe6836fc96c198e88c19 (commit)
       via  ee1b64a1ae07eb99eae5d63307e9fe23f9604662 (commit)
      from  19b6b06461a906399126803d4c46a5a42d1cc784 (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, 738 insertions(+), 725 deletions(-)


=================
 Commit Messages
=================

commit dbfe00a20de3f875e519ef60629b968977fc5db8
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Fri Aug 10 22:52:18 2007 +0100

    Avoid using s_hierarchy_up() for traversal when we know where we're going.
    
    When trying to reach a specific parent we've come from before, we can use
    s_page_goto() and avoid the search through the page list.

:100644 100644 c42205a... d3a6303... M	gschem/src/o_misc.c
:100644 100644 2fc79f6... 9759c91... M	gschem/src/x_dialog.c
:100644 100644 99bf4ee... 305bc2a... M	libgeda/src/s_hierarchy.c

commit f1451161914a0ed0bb43123279906d82cb7d5b49
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Fri Aug 10 22:45:48 2007 +0100

    Fix indenting / whitespace in gschem/src/o_misc.c

:100644 100644 a39faa6... c42205a... M	gschem/src/o_misc.c

commit 2ad315fc0badd16a9614d1107b22c973908893d5
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Fri Aug 10 21:30:24 2007 +0100

    Add page list "changed" signal handler to gschem's page manager dialog.

:100644 100644 fcf9a1e... 36ff17e... M	gschem/include/x_pagesel.h
:100644 100644 2aad9c7... 4bd4172... M	gschem/src/x_pagesel.c

commit d8844bb48969aa45a05cbe6836fc96c198e88c19
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Fri Aug 10 21:26:10 2007 +0100

    Replace the linked list of PAGEs with a GedaList (typecast to GedaPageList)

:100644 100644 369a831... d7822c2... M	gattrib/src/s_toplevel.c
:100644 100644 f4e0d3f... 66add08... M	gattrib/src/x_fileselect.c
:100644 100644 7f89ebe... 74cbe9c... M	gnetlist/src/g_netlist.c
:100644 100644 383694c... ae63a3b... M	gnetlist/src/s_traverse.c
:100644 100644 b475810... 1532fd2... M	gschem/src/i_callbacks.c
:100644 100644 012cf4f... a39faa6... M	gschem/src/o_misc.c
:100644 100644 3a2fe3f... 2fc79f6... M	gschem/src/x_dialog.c
:100644 100644 fcf553e... 6c656b9... M	gschem/src/x_event.c
:100644 100644 1bd4328... 2aad9c7... M	gschem/src/x_pagesel.c
:100644 100644 74b421b... d6e695e... M	gschem/src/x_window.c
:100644 100644 05f78de... 2156254... M	gsymcheck/src/s_check.c
:100644 100644 5f4560c... 6e4f698... M	libgeda/include/prototype.h
:100644 100644 86bb926... b298662... M	libgeda/include/struct.h
:100644 100644 c9f5c58... c8934c9... M	libgeda/src/o_attrib.c
:100644 100644 7bb4824... 5a9a57a... M	libgeda/src/s_clib.c
:100644 100644 877fba2... 99bf4ee... M	libgeda/src/s_hierarchy.c
:100644 100644 a7a2b92... 1556c0d... M	libgeda/src/s_page.c
:100644 100644 8acadd7... 4adaaf1... M	libgeda/src/s_toplevel.c
:100644 100644 b656bb8... 6944026... M	utils/gschlas/s_util.c

commit ee1b64a1ae07eb99eae5d63307e9fe23f9604662
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Fri Aug 10 01:32:27 2007 +0100

    Add different select box behaviour for left-right and right-left drags
    
    Selections boxes dragged from...
    
      left to right: select elements entirely contained within the box.
      right to left: select any element partially inside the box.

:100644 100644 388e268... acd4401... M	gschem/src/o_select.c

=========
 Changes
=========

commit dbfe00a20de3f875e519ef60629b968977fc5db8
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Fri Aug 10 22:52:18 2007 +0100

    Avoid using s_hierarchy_up() for traversal when we know where we're going.
    
    When trying to reach a specific parent we've come from before, we can use
    s_page_goto() and avoid the search through the page list.

diff --git a/gschem/src/o_misc.c b/gschem/src/o_misc.c
index c42205a..d3a6303 100644
--- a/gschem/src/o_misc.c
+++ b/gschem/src/o_misc.c
@@ -909,7 +909,7 @@ int o_edit_find_text(TOPLEVEL * w_current, OBJECT * o_list, char *stext,
             if (!rv) {
               return 0;
             }
-            s_hierarchy_up(w_current, w_current->page_current->up);
+            s_page_goto( w_current, parent );
           }
         }
       }
diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index 2fc79f6..9759c91 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;
-OBJECT *remember_page;
+PAGE *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);
 
-    while (remember_page != w_current->page_current->object_head) {
-      s_hierarchy_up(w_current, w_current->page_current->up);
+    if (remember_page != w_current->page_current) {
+      s_page_goto(w_current, remember_page);
     }
     done =
-      o_edit_find_text(w_current, remember_page, string,
+      o_edit_find_text(w_current, remember_page->object_head, 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->object_head;
+  remember_page = w_current->page_current;
   if ((object = o_select_return_first_object(w_current)) != NULL) {
     if (object->type == OBJ_TEXT) {
       strncpy(generic_textstring, object->text->string, 256);
diff --git a/libgeda/src/s_hierarchy.c b/libgeda/src/s_hierarchy.c
index 99bf4ee..305bc2a 100644
--- a/libgeda/src/s_hierarchy.c
+++ b/libgeda/src/s_hierarchy.c
@@ -337,7 +337,7 @@ GList *s_hierarchy_traversepages(TOPLEVEL *w_current,
 	  /* call the recursive function */
 	  s_hierarchy_traversepages(w_current,
 				    flags | HIERARCHY_INNERLOOP);
-	  s_hierarchy_up(w_current, w_current->page_current->up);
+	  s_page_goto(w_current, p_current);
 	}
 	else {
 	  s_log_message("ERROR in s_hierarchy_traverse: "

commit f1451161914a0ed0bb43123279906d82cb7d5b49
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Fri Aug 10 22:45:48 2007 +0100

    Fix indenting / whitespace in gschem/src/o_misc.c

diff --git a/gschem/src/o_misc.c b/gschem/src/o_misc.c
index a39faa6..c42205a 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,116 +239,115 @@ 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;
@@ -356,105 +355,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;
@@ -475,26 +474,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;
@@ -512,7 +511,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)
 {
@@ -538,7 +537,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);
@@ -551,14 +550,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);
@@ -569,14 +568,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);
 
@@ -594,7 +593,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):
@@ -603,11 +602,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);
@@ -618,23 +617,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);
@@ -652,32 +651,28 @@ 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;
 
@@ -715,26 +710,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;
@@ -748,7 +743,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)
 {
@@ -777,14 +772,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;
   }
 }
@@ -792,14 +787,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;
@@ -818,7 +813,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)
 {
@@ -841,7 +836,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;
@@ -858,10 +853,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;
@@ -886,75 +881,70 @@ 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_hierarchy_up(w_current, w_current->page_current->up);
-	  }
-	}
+        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) {
@@ -968,10 +958,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;
 
@@ -984,14 +974,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;
@@ -1003,10 +993,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;
 
@@ -1019,15 +1009,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;
@@ -1038,7 +1028,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)
 {
@@ -1055,7 +1045,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;
   }
@@ -1077,13 +1067,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;
@@ -1102,7 +1092,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); }
@@ -1133,7 +1123,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);
 
@@ -1147,11 +1137,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.
@@ -1188,82 +1178,79 @@ 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);
       }
     }
   }

commit 2ad315fc0badd16a9614d1107b22c973908893d5
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Fri Aug 10 21:30:24 2007 +0100

    Add page list "changed" signal handler to gschem's page manager dialog.

diff --git a/gschem/include/x_pagesel.h b/gschem/include/x_pagesel.h
index fcf9a1e..36ff17e 100644
--- a/gschem/include/x_pagesel.h
+++ b/gschem/include/x_pagesel.h
@@ -43,6 +43,7 @@ struct _Pagesel {
   GschemDialog parent_instance;
 
   GtkTreeView *treeview;
+  gulong pagelist_changed_id;
 };
 
 
diff --git a/gschem/src/x_pagesel.c b/gschem/src/x_pagesel.c
index 2aad9c7..4bd4172 100644
--- a/gschem/src/x_pagesel.c
+++ b/gschem/src/x_pagesel.c
@@ -36,6 +36,8 @@
 #include <dmalloc.h>
 #endif
 
+#include <glib-object.h>
+
 #include "../include/gschem_dialog.h"
 #include "../include/x_pagesel.h"
 
@@ -90,6 +92,19 @@ 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
@@ -142,6 +157,7 @@ enum {
   NUM_COLUMNS
 };
 
+static GObjectClass *pagesel_parent_class = NULL;
 
 static void pagesel_class_init (PageselClass *class);
 static void pagesel_init       (Pagesel *pagesel);
@@ -304,8 +320,9 @@ static void pagesel_popup_menu (Pagesel *pagesel,
  *
  *  \par Function Description
  *
- *  When the toplevel property is set on the parent GschemDialog,
- *  we should update the pagesel dialog.
+ *  When the toplevel property is set on the parent GschemDialog:
+ *    Connect to its page list's "changed" signal.
+ *    Update the pagesel dialog.
  *
  *  \param [in] pspec      the GParamSpec of the property which changed
  *  \param [in] gobject    the object which received the signal.
@@ -316,6 +333,11 @@ 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 );
 }
@@ -356,8 +378,30 @@ 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!!!

commit d8844bb48969aa45a05cbe6836fc96c198e88c19
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Fri Aug 10 21:26:10 2007 +0100

    Replace the linked list of PAGEs with a GedaList (typecast to GedaPageList)

diff --git a/gattrib/src/s_toplevel.c b/gattrib/src/s_toplevel.c
index 369a831..d7822c2 100644
--- a/gattrib/src/s_toplevel.c
+++ b/gattrib/src/s_toplevel.c
@@ -78,23 +78,24 @@ 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;
 
-  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;
+  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.  */
       }
-    }  /* if (p_current->pid != -1) */
-    p_current = p_current->next;
+      o_current = o_current->next;
+    }
   }
 
   if (missing_sym_flag) {
@@ -126,27 +127,30 @@ 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  
+#endif
 
-  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 */
-      }
+  /* must iterate over all pages in design */
+  for ( iter = geda_list_get_glist( pr_current->pages );
+        iter != NULL;
+        iter = g_list_next( iter ) ) {
+
+    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 = 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 f4e0d3f..66add08 100644
--- a/gattrib/src/x_fileselect.c
+++ b/gattrib/src/x_fileselect.c
@@ -173,6 +173,7 @@ x_fileselect_setup_filechooser_filters (GtkFileChooser *filechooser)
 gboolean
 x_fileselect_load_files (GSList *filenames)
 {
+  GList *iter;
   PAGE *p_local;
   GSList *filename;
 
@@ -229,27 +230,29 @@ 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);
 
-  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);    
+  /* 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);
 #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);
-        }
-     }
-     p_local = p_local->next;  /* iterate to next schematic page */
-  }
+      /* 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 */
 
   /* -------------- 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 7f89ebe..74cbe9c 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->page_head,
+    return_value = o_attrib_search_toplevel_all(project_current->pages,
 						wanted_attrib);
 
     if (return_value) {
diff --git a/gnetlist/src/s_traverse.c b/gnetlist/src/s_traverse.c
index 383694c..ae63a3b 100644
--- a/gnetlist/src/s_traverse.c
+++ b/gnetlist/src/s_traverse.c
@@ -66,36 +66,34 @@ void s_traverse_init(void)
 
 void s_traverse_start(TOPLEVEL * pr_current)
 {
-    PAGE *p_current;
+  GList *iter;
+  PAGE *p_current;
 
-    p_current = pr_current->page_head;
+  for ( iter = geda_list_get_glist( pr_current->pages );
+        iter != NULL;
+        iter = g_list_next( iter ) ) {
 
-    while (p_current != NULL) {
-	if (p_current->pid != -1) {
+    p_current = (PAGE *)iter->data;
 
-	    /* 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);
-	    }
-
-	}
-
-	p_current = p_current->next;
+    /* 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 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);
-    }
+  /* 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/src/i_callbacks.c b/gschem/src/i_callbacks.c
index b475810..1532fd2 100644
--- a/gschem/src/i_callbacks.c
+++ b/gschem/src/i_callbacks.c
@@ -1649,17 +1649,21 @@ 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);
 
-  if (p_current->next == NULL) {
+  iter = g_list_find( geda_list_get_glist( w_current->pages ), p_current );
+  iter = g_list_next( iter );
+
+  if (iter == NULL) {
     return;
   }
 
   if (w_current->enforce_hierarchy) {
-    p_new = s_hierarchy_find_next_page(p_current, p_current->page_control);
+    p_new = s_hierarchy_find_next_page(w_current->pages, p_current, p_current->page_control);
   } else {
-    p_new = p_current->next;
+    p_new = (PAGE *)iter->data;
   }
 
   if (p_new == NULL || p_new == p_current) {
@@ -1679,17 +1683,22 @@ 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);
 
-  if (p_current->prev == NULL || p_current->prev->pid == -1) {
+  iter = g_list_find( geda_list_get_glist( w_current->pages ), p_current );
+  iter = g_list_previous( iter );
+
+  if ( iter == NULL  )
     return;
-  }
 
-  if (w_current->enforce_hierarchy == TRUE) {
-    p_new = s_hierarchy_find_prev_page(p_current, p_current->page_control);
+  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);
   } else {
-    p_new = p_current->prev;
+    p_new = (PAGE *)iter->data;
   }
 
   if (p_new == NULL || p_new == p_current) {
diff --git a/gschem/src/o_misc.c b/gschem/src/o_misc.c
index 012cf4f..a39faa6 100644
--- a/gschem/src/o_misc.c
+++ b/gschem/src/o_misc.c
@@ -1163,6 +1163,7 @@ 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;
@@ -1172,15 +1173,14 @@ 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 (p_current = toplevel->page_head->next;
-       p_current != NULL;
-       p_current = p_current->next) {
+
+  for ( iter = geda_list_get_glist( toplevel->pages );
+        iter != NULL;
+        iter = g_list_next( iter ) ) {
+
+    p_current = (PAGE *)iter->data;
 
     if (p_current->do_autosave_backup == 0) {
       continue;
diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index 3a2fe3f..2fc79f6 100644
--- a/gschem/src/x_dialog.c
+++ b/gschem/src/x_dialog.c
@@ -4004,17 +4004,18 @@ x_dialog_close_changed_page (TOPLEVEL *toplevel, PAGE *page)
 gboolean
 x_dialog_close_window (TOPLEVEL *toplevel)
 {
-	GtkWidget *dialog;
+  GList *iter;
+  GtkWidget *dialog;
   PAGE *p_current;
   GList *unsaved_pages, *p_unsaved;
   gboolean ret = FALSE;
 
-  /* 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) {
+  for ( iter = geda_list_get_glist( toplevel->pages ), unsaved_pages = NULL;
+        iter != NULL;
+        iter = g_list_next( iter ) ) {
+
+    p_current = (PAGE*)iter->data;
+
     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 fcf553e..6c656b9 100644
--- a/gschem/src/x_event.c
+++ b/gschem/src/x_event.c
@@ -1264,6 +1264,7 @@ 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;
@@ -1320,18 +1321,21 @@ x_event_configure (GtkWidget         *widget,
 
   /* save current page */
   old_page_current = toplevel->page_current;
+
   /* re-pan each page of the toplevel */
-  for (p_current = toplevel->page_head->next;
-       p_current != NULL;
-       p_current = p_current->next) {
+  for ( iter = geda_list_get_glist( toplevel->pages );
+        iter != NULL;
+        iter = g_list_next( iter ) ) {
+
     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 1bd4328..2aad9c7 100644
--- a/gschem/src/x_pagesel.c
+++ b/gschem/src/x_pagesel.c
@@ -508,13 +508,15 @@ 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,
-		      PAGE *page)
+                      GedaPageList *pages, PAGE *page)
 {
   GtkTreeIter iter;
   PAGE *p_current;
+  GList *p_iter;
 
   /* add the page to the store */
   gtk_tree_store_append (GTK_TREE_STORE (model),
@@ -526,16 +528,17 @@ 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_current = page->next;
-       p_current != NULL;
-       p_current = p_current->next) {
+  for ( p_iter = geda_list_get_glist( pages );
+        p_iter != NULL;
+        p_iter = g_list_next( p_iter ) ) {
+
+    p_current = (PAGE *)p_iter->data;
     if (p_current->up == page->pid) {
-      add_page (model, &iter, p_current);
+      add_page (model, &iter, pages, p_current);
     }
   }
-  
 }
 
 /*! \todo Finish function documentation!!!
@@ -583,6 +586,7 @@ void pagesel_update (Pagesel *pagesel)
   GtkTreeModel *model;
   TOPLEVEL *toplevel;
   PAGE *p_current;
+  GList *iter;
 
   g_assert (IS_PAGESEL (pagesel));
 
@@ -594,14 +598,16 @@ void pagesel_update (Pagesel *pagesel)
   /* wipe out every thing in the store */
   gtk_tree_store_clear (GTK_TREE_STORE (model));
   /* now rebuild */
-  for (p_current = toplevel->page_head->next;
-       p_current != NULL;
-       p_current = p_current->next) {
+  for ( iter = geda_list_get_glist( toplevel->pages );
+        iter != NULL;
+        iter = g_list_next( iter ) ) {
+
+    p_current = (PAGE *)iter->data;
     /* find every page that is not a hierarchy-down of another page */
     if (p_current->up < 0 ||
-        s_hierarchy_find_page (toplevel->page_head->next,
+        s_hierarchy_find_page (toplevel->pages,
                                p_current->up) == NULL) {
-      add_page (model, NULL, p_current);
+      add_page (model, NULL, toplevel->pages, p_current);
     }
   }
 
diff --git a/gschem/src/x_window.c b/gschem/src/x_window.c
index 74b421b..d6e695e 100644
--- a/gschem/src/x_window.c
+++ b/gschem/src/x_window.c
@@ -1075,6 +1075,7 @@ 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);
@@ -1084,13 +1085,16 @@ 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->page_head, page->up);
+    new_current = s_hierarchy_find_page (toplevel->pages, page->up);
+
     if (new_current == NULL) {
-      /* 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;
+      /* 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;
       } 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 05f78de..2156254 100644
--- a/gsymcheck/src/s_check.c
+++ b/gsymcheck/src/s_check.c
@@ -41,25 +41,23 @@
 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 ) ) {
 
-  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");
-      }
+    p_current = (PAGE *)iter->data;
 
+    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 5f4560c..6e4f698 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(PAGE *page_head, char *name);
+char *o_attrib_search_toplevel_all(GedaPageList *page_list, 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(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);
+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);
 
 /* s_log.c */
 void s_log_init (const gchar *filename);
@@ -563,15 +563,13 @@ 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 (PAGE *head);
-void s_page_clear_changed (PAGE *head);
+gboolean s_page_check_changed (GedaPageList *list);
+void s_page_clear_changed (GedaPageList *list);
 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 86bb926..b298662 100644
--- a/libgeda/include/struct.h
+++ b/libgeda/include/struct.h
@@ -24,6 +24,7 @@
 
 /* Wrappers around a new list mechanism */
 typedef struct _GedaList SELECTION;
+typedef struct _GedaList GedaPageList;
 
 /* gschem structures (gschem) */
 typedef struct st_complex COMPLEX;
@@ -394,9 +395,6 @@ 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 {
@@ -500,9 +498,8 @@ 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 c9f5c58..c8934c9 100644
--- a/libgeda/src/o_attrib.c
+++ b/libgeda/src/o_attrib.c
@@ -34,6 +34,8 @@
 #include "o_types.h"
 #include "colors.h"
 
+#include "geda_list.h"
+
 #include "../include/prototype.h"
 
 #ifdef HAVE_LIBDMALLOC
@@ -2390,18 +2392,20 @@ 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;
 
-  p_current = w_current->page_head;
+  iter = geda_list_get_glist( w_current->pages );
 
-  while(p_current != NULL) {
+  while( iter != NULL ) {
+    p_current = (PAGE *)iter->data;
 
     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");
@@ -2410,11 +2414,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);
     }
 
-    p_current=p_current->next;
+    iter = g_list_next( iter );
   }
   return(ret_value);
 }
@@ -2426,34 +2430,31 @@ 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_head  PAGE head object to search through.
+ *  \param [in] page_list  Page list 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(PAGE *page_head, char *name)
+char *o_attrib_search_toplevel_all(GedaPageList *page_list, char *name)
 {
+  const GList *iter;
   PAGE *p_current;
   char *ret_value=NULL;
 
-  p_current = page_head;
-
-  while (p_current != NULL) {
-
+  iter = geda_list_get_glist( page_list );
 
-    /* don't look into the head of page_head */
-    if (p_current->pid != -1) {
+  while( iter != NULL ) {
+    p_current = (PAGE *)iter->data;
 
-      /* 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);
     }
-		
-    p_current = p_current->next;
+
+    iter = g_list_next( iter );
   }
 
   return(NULL);
diff --git a/libgeda/src/s_clib.c b/libgeda/src/s_clib.c
index 7bb4824..5a9a57a 100644
--- a/libgeda/src/s_clib.c
+++ b/libgeda/src/s_clib.c
@@ -134,6 +134,7 @@
 #include "colors.h"
 #include "i_vars.h"
 #include "prototype.h"
+#include "geda_list.h"
 
 /* Constant definitions
  * ===================
@@ -1300,14 +1301,18 @@ GList *s_toplevel_get_symbols (const TOPLEVEL *w_current)
   GList *result = NULL;
   GList *iter = NULL;
   OBJECT *o = NULL;
-  PAGE *p = NULL;
+  PAGE *page;
   GList *symlist = NULL;
   CLibSymbol *sym = NULL;
+  const GList *p_iter;
 
   g_assert (w_current != NULL);
 
-  for (p = w_current->page_head->next; p != NULL; p = p->next) {
-    for (o = p->object_head; o != NULL; o = o->next) {
+  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) {
       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 877fba2..99bf4ee 100644
--- a/libgeda/src/s_hierarchy.c
+++ b/libgeda/src/s_hierarchy.c
@@ -36,6 +36,8 @@
 #include "globals.h"
 #include "o_types.h"
 
+#include "geda_list.h"
+
 #include "../include/prototype.h"
 
 #ifdef HAVE_LIBDMALLOC
@@ -93,7 +95,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_page_search_pid(w_current, forbear->up))
+	     forbear = s_hierarchy_find_page (w_current->pages, forbear->up))
 	  ; /* void */
 
 	if (found->pid == forbear->pid) {
@@ -256,7 +258,7 @@ void s_hierarchy_up(TOPLEVEL *w_current, int pid)
     return;
   }
 
-  p_current = s_hierarchy_find_page(w_current->page_head, pid);
+  p_current = s_hierarchy_find_page(w_current->pages, pid);
 
   if (p_current) {
     s_page_goto(w_current, p_current);
@@ -381,15 +383,18 @@ gint s_hierarchy_print_page(PAGE *p_current, void * data)
  *  \par Function Description
  *
  */
-PAGE *s_hierarchy_find_prev_page (PAGE *p_start, int page_control) 
+PAGE *s_hierarchy_find_prev_page (GedaPageList *page_list, PAGE *current_page, int page_control)
 {
-  PAGE *p_current;	
+  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)) {
 
-  for (p_current = p_start->prev;
-       p_current != NULL;
-       p_current = p_current->prev) {
-    if (p_current->page_control == page_control) {
-      return p_current;
+    PAGE *page = (PAGE *)iter->data;
+    if (page->page_control == page_control) {
+      return page;
     }
   }
 
@@ -401,15 +406,18 @@ PAGE *s_hierarchy_find_prev_page (PAGE *p_start, int page_control)
  *  \par Function Description
  *
  */
-PAGE *s_hierarchy_find_next_page (PAGE *p_start, int page_control)
+PAGE *s_hierarchy_find_next_page (GedaPageList *page_list, PAGE *current_page, int page_control)
 {
-  PAGE *p_current;	
+  const GList *iter;
 
-  for (p_current = p_start->next;
-       p_current != NULL;
-       p_current = p_current->next) {
-    if (p_current->page_control == page_control) {
-      return 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;
     }
   }
 
@@ -421,15 +429,17 @@ PAGE *s_hierarchy_find_next_page (PAGE *p_start, int page_control)
  *  \par Function Description
  *
  */
-PAGE *s_hierarchy_find_page (PAGE *p_start, int pid)
+PAGE *s_hierarchy_find_page (GedaPageList *page_list, int pid)
 {
-  PAGE *p_current = p_start;	
+  const GList *iter;
+
+  for ( iter = geda_list_get_glist (page_list);
+        iter != NULL;
+        iter = g_list_next (iter) ) {
 
-  for (p_current = p_start;
-       p_current != NULL;
-       p_current = p_current->next) {
-    if (p_current->pid == pid) {
-      return p_current;
+    PAGE *page = (PAGE *)iter->data;
+    if (page->pid == pid) {
+      return page;
     }
   }
 
diff --git a/libgeda/src/s_page.c b/libgeda/src/s_page.c
index a7a2b92..1556c0d 100644
--- a/libgeda/src/s_page.c
+++ b/libgeda/src/s_page.c
@@ -46,6 +46,8 @@
 #include "o_types.h"
 #include "funcs.h"
 
+#include "geda_list.h"
+
 #include "../include/prototype.h"
 
 #ifdef HAVE_LIBDMALLOC
@@ -140,11 +142,8 @@ 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 */
-  toplevel->page_tail->next = page;
-  page->prev = toplevel->page_tail;
-  page->next = NULL;
-  toplevel->page_tail = page;
-  
+  geda_list_add( toplevel->pages, page );
+
   return page;
 }
 
@@ -153,8 +152,7 @@ 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.
  *
- *  This function is not appropriate for deleting page head. 
- *  See #s_page_delete_list() for that.
+ *  See #s_page_delete_list() to delete all pages of a <B>toplevel</B>
  *
  *  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
@@ -168,11 +166,9 @@ 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;
@@ -236,22 +232,10 @@ void s_page_delete (TOPLEVEL *toplevel, PAGE *page)
 
   /* ouch, deal with parents going away and the children still around */
   page->up = -2;
-  /* p_current->down = NULL; not needed */
-
   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;
-  }
-  
+  geda_list_remove( toplevel->pages, page );
+
 #if DEBUG
   s_tile_print (toplevel);
 #endif
@@ -274,34 +258,6 @@ 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>.
@@ -311,28 +267,22 @@ void s_page_init_list (TOPLEVEL *toplevel)
  */
 void s_page_delete_list(TOPLEVEL *toplevel)
 {
-  PAGE *p_current, *p_prev;
+  GList *list_copy, *iter;
+  PAGE *page;
 
-  p_current = toplevel->page_tail;
+  /* s_page_delete removes items from the page list, so make a copy */
+  list_copy = g_list_copy (geda_list_get_glist (toplevel->pages));
 
-  while (p_current != NULL && p_current->pid != -1) {
-    p_prev = p_current->prev;
-    s_page_delete (toplevel, p_current);
-    p_current = p_prev;
-  }	
+  for (iter = list_copy; iter != NULL; iter = g_list_next (iter)) {
+    page = (PAGE *)iter->data;
 
-  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);
+    s_page_delete (toplevel, page);
+  }
+
+  g_list_free (list_copy);
 
   /* reset toplevel fields */
-  toplevel->page_head    = NULL;
-  toplevel->page_tail    = NULL;
   toplevel->page_current = NULL;
-  
 }
 
 /*! \todo Finish function documentation!!!
@@ -344,13 +294,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!!!
@@ -363,40 +313,21 @@ void s_page_goto (TOPLEVEL *toplevel, PAGE *p_new)
  */
 PAGE *s_page_search (TOPLEVEL *toplevel, const gchar *filename)
 {
-  PAGE *p_current;
-
-  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;
-    }
-  }
+  const GList *iter;
+  PAGE *page;
 
-  return NULL;
-}
+  for ( iter = geda_list_get_glist( toplevel->pages );
+        iter != NULL;
+        iter = g_list_next( iter ) ) {
 
-/*! \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;
+    page = (PAGE *)iter->data;
+    if ( g_strcasecmp( page->page_filename, filename ) == 0 )
+      return page;
   }
-
   return NULL;
 }
 
+
 /*! \brief Print full TOPLEVEL structure.
  *  \par Function Description
  *  This function prints the internal structure of <B>toplevel</B>'s
@@ -406,18 +337,17 @@ PAGE *s_page_search_pid(TOPLEVEL * toplevel, gint page_id)
  */
 void s_page_print_all (TOPLEVEL *toplevel)
 {
-  PAGE *p_current;
+  const GList *iter;
+  PAGE *page;
 
-  g_assert (toplevel->page_head != NULL &&
-            toplevel->page_head->pid == -1);
+  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) {
-    printf ("FILENAME: %s\n", p_current->page_filename);
-    print_struct_forw (p_current->object_head);
+    page = (PAGE *)iter->data;
+    printf ("FILENAME: %s\n", page->page_filename);
+    print_struct_forw (page->object_head);
   }
-  
 }
 
 /*! \todo Finish function documentation!!!
@@ -430,18 +360,19 @@ 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 (p_current = toplevel->page_head->next;
-       p_current != NULL;
-       p_current = p_current->next) {
+
+  for ( iter = geda_list_get_glist( toplevel->pages );
+        iter != NULL;
+        iter = g_list_next( iter ) ) {
+
+    p_current = (PAGE *)iter->data;
+
     /* make p_current the current page of toplevel */
     s_page_goto (toplevel, p_current);
 
@@ -450,14 +381,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 */
@@ -472,19 +403,22 @@ 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>head</B>
+ *  This function checks the CHANGED flag for all pages in the <B>list</B>
  *  object.
  *
- *  \param [in] head  PAGES list to check CHANGED flag in.
+ *  \param [in] list  GedaPageList to check CHANGED flag in.
  *  \return 1 if any page has the CHANGED flag set, 0 otherwise.
  */
-gboolean s_page_check_changed (PAGE *head)
+gboolean s_page_check_changed (GedaPageList *list)
 {
+  const GList *iter;
   PAGE *p_current;
 
-  for (p_current = head;
-       p_current != NULL;
-       p_current = p_current->next) {
+  for ( iter = geda_list_get_glist( list );
+        iter != NULL;
+        iter = g_list_next( iter ) ) {
+
+    p_current = (PAGE *)iter->data;
     if (p_current->CHANGED) {
       return TRUE;
     }
@@ -499,16 +433,18 @@ gboolean s_page_check_changed (PAGE *head)
  *
  *  \param [in,out] head  PAGE list to set CHANGED flags in.
  */
-void s_page_clear_changed (PAGE *head)
+void s_page_clear_changed (GedaPageList *list)
 {
+  const GList *iter;
   PAGE *p_current;
 
-  for (p_current = head;
-       p_current != NULL;
-       p_current = p_current->next) {
+  for ( iter = geda_list_get_glist( list );
+        iter != NULL;
+        iter = g_list_next( iter ) ) {
+
+    p_current = (PAGE *)iter->data;
     p_current->CHANGED = 0;
   }
-
 }
 
 /*! \brief Autosave initialization function.
@@ -540,6 +476,7 @@ void s_page_autosave_init(TOPLEVEL *toplevel)
  */
 gint s_page_autosave (TOPLEVEL *toplevel) 
 {
+  const GList *iter;
   PAGE *p_current;
 
   if (toplevel == NULL) {
@@ -550,26 +487,23 @@ gint s_page_autosave (TOPLEVEL *toplevel)
   if (toplevel->auto_save_interval == 0) {
     return toplevel->auto_save_interval;
   }
-  
-  /* In which situation can be page_head = NULL?
-     Should we just disable the autosave timeout returning 0 or
+
+  /* Should we just disable the autosave timeout returning 0 or
      just wait for more pages to be added? */
-  if ( (toplevel->page_head == NULL) ||
-       (toplevel->page_head->next == NULL) ) {
-    return (toplevel->auto_save_interval);
-  }
+  if ( toplevel->pages == NULL)
+    return toplevel->auto_save_interval;
+
+  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) {
+    p_current = (PAGE *)iter->data;
 
     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 8acadd7..4adaaf1 100644
--- a/libgeda/src/s_toplevel.c
+++ b/libgeda/src/s_toplevel.c
@@ -41,6 +41,8 @@
 
 #include "../include/prototype.h"
 
+#include "geda_list.h"
+
 #ifdef HAVE_LIBDMALLOC
 #include <dmalloc.h>
 #endif
@@ -154,12 +156,10 @@ TOPLEVEL *s_toplevel_new (void)
   toplevel->CONTROLKEY = 0;
   toplevel->SHIFTKEY   = 0;
   toplevel->ALTKEY     = 0;
-	
+
   toplevel->doing_pan = 0;
-  
-  /* Put head node on page list... */
-  toplevel->page_head = NULL;
-  s_page_init_list (toplevel);
+
+  toplevel->pages = geda_list_new();
   toplevel->page_current = NULL;
 
   toplevel->buffer_number = 0;
@@ -498,13 +498,16 @@ 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 b656bb8..6944026 100644
--- a/utils/gschlas/s_util.c
+++ b/utils/gschlas/s_util.c
@@ -45,33 +45,30 @@
 void
 s_util_embed(TOPLEVEL *pr_current, int embed_mode)
 {
-    PAGE *p_current;
-    OBJECT *o_current;
+  GList *iter;
+  PAGE *p_current;
+  OBJECT *o_current;
 
-    p_current = pr_current->page_head;
+  for ( iter = geda_list_get_glist( pr_current->pages );
+        iter != NULL;
+        iter = g_list_next( iter ) ) {
 
-    while (p_current != NULL) {
+    p_current = (PAGE *)iter->data;
 
-      o_current = p_current->object_head;
+    o_current = p_current->object_head;
+    while (o_current != NULL) {
 
-      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;
-	}
+      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;
 
-      p_current = p_current->next;
     }
+  }
 }
 

commit ee1b64a1ae07eb99eae5d63307e9fe23f9604662
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Fri Aug 10 01:32:27 2007 +0100

    Add different select box behaviour for left-right and right-left drags
    
    Selections boxes dragged from...
    
      left to right: select elements entirely contained within the box.
      right to left: select any element partially inside the box.

diff --git a/gschem/src/o_select.c b/gschem/src/o_select.c
index 388e268..acd4401 100644
--- a/gschem/src/o_select.c
+++ b/gschem/src/o_select.c
@@ -367,13 +367,14 @@ 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 ) {
@@ -393,10 +394,18 @@ void o_select_box_search(TOPLEVEL *w_current)
         (o_current->visibility == VISIBLE ||
         (o_current->visibility == INVISIBLE && w_current->show_hidden_text))) {
 
-      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 ) {
+      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   ) ) {
 
         o_select_object(w_current, o_current, MULTIPLE, count);
         count++;




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs