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

gEDA-cvs: branch: master updated (1.1.1.20070708-52-gc8b92f2)



The branch, master has been updated
       via  c8b92f207d9a34e5ec69aaee19cfb2cfe88a3a81 (commit)
       via  512561395fb348a0fb71625edb4fe1ec96553c3f (commit)
       via  4cbb0c15240f649cfd69b120e7ed7ecd6c752896 (commit)
       via  8dc511639494940987582871d9f2efa09ecc2b37 (commit)
       via  aec624dc87dc204b399b0e070f8fcfce8e3edbc6 (commit)
       via  92ef419c46d5a41aa33b399d43ccde2ba2a99998 (commit)
      from  0a7ab22a482a896818dff52fbf289856d76efc87 (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/include/prototype.h |   45 +---
 gattrib/src/x_gtksheet.c    |  580 +------------------------------------
 gschem/src/gschem.c         |   10 +
 gschem/src/o_basic.c        |    1 +
 gschem/src/o_grips.c        |  675 +++++++++++++++++++------------------------
 gschem/src/x_window.c       |    3 +-
 libgeda/src/f_basic.c       |    3 +-
 libgeda/src/o_net_basic.c   |    3 -
 8 files changed, 325 insertions(+), 995 deletions(-)


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

commit c8b92f207d9a34e5ec69aaee19cfb2cfe88a3a81
Author: Ivan Stankovic <ivan.stankovic@xxxxxx>
Date:   Thu Aug 2 13:27:15 2007 +0100

    gattrib: remove unused code from x_gtksheet.c

:100644 100644 1191737... f2c0b48... M	gattrib/include/prototype.h
:100644 100644 b1d7b79... 4f9ca8c... M	gattrib/src/x_gtksheet.c

commit 512561395fb348a0fb71625edb4fe1ec96553c3f
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Aug 2 13:17:58 2007 +0100

    Fix to allow automatic loading of untitled backup files

:100644 100644 015b3f8... c0aab55... M	gschem/src/gschem.c
:100644 100644 29d89c9... 74b421b... M	gschem/src/x_window.c
:100644 100644 7cd7a9c... c19a1ca... M	libgeda/src/f_basic.c

commit 4cbb0c15240f649cfd69b120e7ed7ecd6c752896
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Aug 2 13:16:22 2007 +0100

    Fix drawing artifact when dragging a net / bus to zero length.
    
    The grip dragging code cancels editing if you resize to a zero length line
    segment. Don't attempt to undraw the (zero length) rubberbanded line after
    the coordinates have been invalidated.

:100644 100644 80883d4... 4a41fc6... M	gschem/src/o_grips.c

commit 8dc511639494940987582871d9f2efa09ecc2b37
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Aug 2 13:07:30 2007 +0100

    Refactor code in o_grips.c to reduce duplication
    
    Also make many whitespace fixes. The code paths should remain the same.

:100644 100644 0c6e8a8... 80883d4... M	gschem/src/o_grips.c

commit aec624dc87dc204b399b0e070f8fcfce8e3edbc6
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Aug 2 13:07:23 2007 +0100

    Remove old code commented out in o_net_consolidate_segments()

:100644 100644 5386ee1... 89e34cf... M	libgeda/src/o_net_basic.c

commit 92ef419c46d5a41aa33b399d43ccde2ba2a99998
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Aug 2 13:06:09 2007 +0100

    Fix drawing of cues after moving a single line segment

:100644 100644 c599759... a7631c4... M	gschem/src/o_basic.c

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

commit c8b92f207d9a34e5ec69aaee19cfb2cfe88a3a81
Author: Ivan Stankovic <ivan.stankovic@xxxxxx>
Date:   Thu Aug 2 13:27:15 2007 +0100

    gattrib: remove unused code from x_gtksheet.c

diff --git a/gattrib/include/prototype.h b/gattrib/include/prototype.h
index 1191737..f2c0b48 100644
--- a/gattrib/include/prototype.h
+++ b/gattrib/include/prototype.h
@@ -175,55 +175,14 @@ void x_dialog_export_file();
 
 /* ------------- x_gtksheet.c ------------- */
 void x_gtksheet_init();
-void x_notebook_init();
 void x_gtksheet_add_row_labels(GtkSheet *sheet, int count, STRING_LIST *list_head);
 void x_gtksheet_add_col_labels(GtkSheet *sheet, int count, STRING_LIST *list_head);
 void x_gtksheet_add_cell_item(GtkSheet *sheet, gint i, gint j, 
 			      char *text, gint visibility, gint show_name_value);
-int x_gtksheet_get_min_col(GtkSheet *sheet);
-int x_gtksheet_get_max_col(GtkSheet *sheet);
 void x_gtksheet_set_cell_text_color(GtkSheet *sheet, gint row, gint col, 
 				    gint color_name);
-
-void format_text (GtkSheet *sheet, gchar *text, gint *justification, char *label);
-void alarm_change(GtkWidget *widget, gint row, gint col,
-                  gpointer data);
-void alarm_activate(GtkWidget *widget, gint row, gint col,
-                    gpointer data);
-void alarm_deactivate(GtkWidget *widget, gint row, gint col,
-                      gpointer data);
-gint alarm_traverse(GtkWidget *widget,
-                    gint row, gint col, gint *new_row, gint *new_col,
-                    gpointer data);
-void clipboard_handler(GtkWidget *widget, GdkEventKey *key);
-void parse_numbers(GtkWidget *widget, gpointer data);
-void resize_handler(GtkWidget *widget, GtkSheetRange *old_range, 
-		    GtkSheetRange *new_range, 
-		    gpointer data);
-void move_handler(GtkWidget *widget, GtkSheetRange *old_range, 
-		  GtkSheetRange *new_range, 
-		  gpointer data);
-gint change_entry(GtkWidget *widget, 
-		  gint row, gint col, gint *new_row, gint *new_col,
-		  gpointer data);
-void set_cell(GtkWidget *widget, gchar *insert, gint text_legth, gint position, 
-	      gpointer data);
-void show_sheet_entry(GtkWidget *widget, gpointer data);
-void activate_sheet_entry(GtkWidget *widget, gpointer data);
-void show_entry(GtkWidget *widget, gpointer data);
-void justify_left(GtkWidget *widget);
-void justify_center(GtkWidget *widget);
-void justify_right(GtkWidget *widget);
-gint activate_sheet_cell(GtkWidget *widget, gint row, 
-			 gint column, gpointer data);
-void change_border (GtkWidget *widget, gint border);
-void change_fg(GtkWidget *widget, gint i, gchar *color_name);
-void change_bg(GtkWidget *widget, gint i, gchar *color_name);
-void do_hide_row_titles(GtkWidget *widget);
-void do_hide_column_titles(GtkWidget *widget);
-void do_show_row_titles(GtkWidget *widget);
-void do_show_column_titles(GtkWidget *widget);
-
+int x_gtksheet_get_min_col(GtkSheet *sheet);
+int x_gtksheet_get_max_col(GtkSheet *sheet);
 
 /* ------------- x_fileselect.c ------------- */
 GSList *x_fileselect_open (void);
diff --git a/gattrib/src/x_gtksheet.c b/gattrib/src/x_gtksheet.c
index b1d7b79..4f9ca8c 100644
--- a/gattrib/src/x_gtksheet.c
+++ b/gattrib/src/x_gtksheet.c
@@ -60,13 +60,11 @@
 #include <dmalloc.h>
 #endif
 
+static void show_entry(GtkWidget *widget, gpointer data);
 
-/*  ==================== Public functions ===================  */
-
-/*------------------------------------------------------------------
- * x_gtksheet_init -- This creates and initializes the GtkSheet widget,
- * which is the spreadsheet widget used for displaying the data.
- *------------------------------------------------------------------*/
+/*! \brief Creates and initializes the GtkSheet widget, which is the
+ *         spreadsheet widget used for displaying the data.
+ */
 void
 x_gtksheet_init()
 {
@@ -80,29 +78,14 @@ x_gtksheet_init()
 
   /* -----  Components  ----- */
   if ((sheet_head->comp_count > 0) && (sheet_head->comp_attrib_count >0)) {
-#ifdef DEBUG
-    fflush(stderr);
-    fflush(stdout);
-    printf("In x_gtksheet_init, creating comp sheet. . . .\n");
-#endif
     sheets[0] = (GtkSheet *) gtk_sheet_new((guint) sheet_head->comp_count, (guint) sheet_head->comp_attrib_count, "Components");
   } else {
-#ifdef DEBUG
-    fflush(stderr);
-    fflush(stdout);
-    printf("In x_gtksheet_init, no components in comp sheet.\n");
-#endif
     x_dialog_fatal_error("No components found in design.  Please check your schematic and try again!\n", 1);
   }
   
 
   /* -----  Nets  ----- */
   if ((sheet_head->net_count > 0) && (sheet_head->net_attrib_count >0)) {
-#ifdef DEBUG
-    fflush(stderr);
-    fflush(stdout);
-    printf("In x_gtksheet_init, creating net sheet. . . .\n");
-#endif
     sheets[1] = (GtkSheet *) gtk_sheet_new(sheet_head->net_count, sheet_head->net_attrib_count, "Nets");
     gtk_sheet_set_locked(GTK_SHEET(sheets[1]), TRUE);   /* disallow editing of attribs for now */
   } else {
@@ -112,31 +95,16 @@ x_gtksheet_init()
     gtk_sheet_column_button_add_label(sheets[1], 0, "TBD");
     gtk_sheet_column_button_justify(sheets[1], 0, GTK_JUSTIFY_LEFT);
     gtk_sheet_set_locked(GTK_SHEET(sheets[1]), TRUE);   /* disallow editing of attribs for now */
-#ifdef DEBUG
-    fflush(stderr);
-    fflush(stdout);
-    printf("In x_gtksheet_init, no entries in net sheet. . . .\n");
-#endif
   }
   
 
   /* -----  Pins  ----- */
   if ((sheet_head->pin_count > 0) && (sheet_head->pin_attrib_count >0)) {
-#ifdef DEBUG
-    fflush(stderr);
-    fflush(stdout);
-    printf("In x_gtksheet_init, creating pin sheet. . . .\n");
-#endif
     sheets[2] = (GtkSheet *) gtk_sheet_new(sheet_head->pin_count, sheet_head->pin_attrib_count, "Pins");
     gtk_sheet_set_locked(GTK_SHEET(sheets[2]), TRUE);   /* disallow editing of attribs for now */
   } else {
     sheets[2] = (GtkSheet *) gtk_sheet_new(1, 1, "Pins");
     gtk_sheet_set_locked(GTK_SHEET(sheets[2]), TRUE);    /* disallow editing of attribs for now */
-#ifdef DEBUG
-    fflush(stderr);
-  fflush(stdout);
-  printf("In x_gtksheet_init, no entries in pin sheet. . . .\n");
-#endif
   }
 
 
@@ -146,27 +114,16 @@ x_gtksheet_init()
     if (sheets[i] != NULL) {  /* is this check needed? 
 			       * Yes, it prevents us from segfaulting on empty nets sheet. */
 
-#ifdef DEBUG
-      fflush(stderr);
-      fflush(stdout);
-      printf("In x_gtksheet_init, placing labels on sheet no %d.\n", i);
-#endif
 
       scrolled_windows=(GtkWidget **)realloc(scrolled_windows, (i+1)*sizeof(GtkWidget *));
       scrolled_windows[i]=gtk_scrolled_window_new(NULL, NULL);
       
-#ifdef DEBUG
-      printf("In x_gtksheet_init, working on sheet %d.  About to add sheet to scrolled_window.\n", i);
-#endif
       gtk_container_add( GTK_CONTAINER(scrolled_windows[i]), GTK_WIDGET(sheets[i]) );
 
       /* First remove old notebook page.  I should probably do some checking here. */
       if (notebook != NULL) 
 	gtk_notebook_remove_page(GTK_NOTEBOOK(notebook), i);
 
-#ifdef DEBUG
-      printf("In x_gtksheet_init, working on sheet %d.  About to get new label and call gtk_notebook_append_page.\n", i);
-#endif
 
       /* Then add new, updated notebook page */
       label= gtk_label_new(folder[i]);
@@ -185,21 +142,8 @@ x_gtksheet_init()
        *  gattrib, but leave the code in just in case I want to put it back.  */
       gtk_signal_connect(GTK_OBJECT(gtk_sheet_get_entry(GTK_SHEET(sheets[i]))),
 			   "changed", (GtkSignalFunc) show_entry, NULL);
-      
-#if 0
-      /*  "activate" signal raised when user hits <enter>  */
-      gtk_signal_connect(GTK_OBJECT(sheets[i]),
-			 "activate", (GtkSignalFunc) activate_sheet_cell,
-			 NULL);
-#endif
-
-
-
     }
   }
-
-  return;
-
 }
 
 
@@ -242,8 +186,6 @@ x_gtksheet_add_row_labels(GtkSheet *sheet, int count, STRING_LIST *list_head)
 
 
   gtk_sheet_set_row_titles_width(sheet, width+8);
-
-  return;
 }
 
 
@@ -269,7 +211,6 @@ x_gtksheet_add_col_labels(GtkSheet *sheet, int count, STRING_LIST *list_head)
     g_free(text);
     string_list_item = string_list_item->next;
   }
-  return;
 }
   
 
@@ -309,15 +250,12 @@ x_gtksheet_add_cell_item(GtkSheet *sheet,gint i, gint j,
 
   /* Need to find a way to ensure that the text in a cell is clipped.
    * Otherwise, long attribs overwrite adjacent cells.  */
-
-  return;
 }
 
 
-/*  -----------------------------------------------------------------  *
- *  This fcn returns the index of the first column selected, or 
- *  -1 if no column is selected
- *  -----------------------------------------------------------------  */
+/*! \brief Returns the index of the first column selected, or -1 if
+ *         no column is selected.
+ */
 int x_gtksheet_get_min_col(GtkSheet *sheet) {
   if (sheet->state == GTK_SHEET_COLUMN_SELECTED) {
     return sheet->range.col0;
@@ -327,10 +265,9 @@ int x_gtksheet_get_min_col(GtkSheet *sheet) {
 }
 
 
-/*  -----------------------------------------------------------------  *
- *  This fcn returns the index of the last column selected, or 
- *  -1 if no column is selected
- *  -----------------------------------------------------------------  */
+/*! \brief Returns the index of the last column selected, or -1 if
+ *         no column is selected.
+ */
 int x_gtksheet_get_max_col(GtkSheet *sheet) {
   if (sheet->state == GTK_SHEET_COLUMN_SELECTED) {
     return sheet->range.coli;
@@ -340,9 +277,8 @@ int x_gtksheet_get_max_col(GtkSheet *sheet) {
 }
 
 
-/*  -----------------------------------------------------------------  *
- *  This fcn sets the color of a cell identified by row, col
- *  -----------------------------------------------------------------  */
+/*! \brief Sets the color of a cell identified by row, col.
+ */
 void x_gtksheet_set_cell_text_color(GtkSheet *sheet, gint row, gint col, 
 			       gint color_name)
 {
@@ -350,9 +286,7 @@ void x_gtksheet_set_cell_text_color(GtkSheet *sheet, gint row, gint col,
   GdkColormap *cmap;
   GdkColor *color;
 
-  
   /* First get the system color map and allocate the color */
-  
   cmap = gdk_colormap_get_system ();
   color = g_malloc(sizeof(GdkColor));
   switch(color_name) {
@@ -399,253 +333,17 @@ void x_gtksheet_set_cell_text_color(GtkSheet *sheet, gint row, gint col,
   range->coli = col;
 
   /* Now set color */
-#ifdef DEBUG
-  printf("In x_gtksheet_set_cell_text_color, trying to set color.\n");
-#endif
   gtk_sheet_range_set_foreground(sheet, range, color);
-#ifdef DEBUG
-  printf("In x_gtksheet_set_cell_text_color, done setting color.\n");
-#endif
   g_free(color);
   g_free(range);
 }
 
 
-
-
-/*  ==================== Private functions ===================  */
-
-/*  The stuff below was copied over from testgtksheet.c  */
-
-/*  -----------------------------------------------------------------  *
- *  Copied from testgtksheet.c
- *  -----------------------------------------------------------------  */
-void
-format_text (GtkSheet *sheet, gchar *text, gint *justification, gchar *label)
-{
-  /*  I probably don't need this */
-#if 0
-  double auxval;
-  int digspace=0;
-  int cell_width, char_width;
-  double val = 0.0;
-  int format;
-  double space;
-  int intspace;
-  int nonzero=FALSE;
-  int ipos;
-  gchar nchar;
-  
-  /* SDB says: I had to modifiy these names to make them work. . . .  */
-  enum {EMPTY_LOCAL, TEXT_LOCAL, NUMERIC_LOCAL};
-
-  cell_width=sheet->column[sheet->active_cell.col].width;
-
-  char_width = gdk_char_width (GTK_WIDGET(sheet)->style->private_font,(gchar)'X');
-
-  space= (double)cell_width/(double)char_width;
-
-  intspace=MIN(space, DEFAULT_SPACE);
-
-  format=EMPTY_LOCAL;
-  if(strlen(text) != 0)
-  { 
-        for(ipos=0; ipos<strlen(text); ipos++){
-
-          switch(nchar=text[ipos]){
-           case '.':
-           case ' ': case ',':
-           case '-': case '+':
-           case 'd': case 'D':
-           case 'E': case 'e':
-           case '1': case '2': case '3': case '4': case '5': case '6':
-           case '7': case '8': case '9':
-            nonzero=TRUE;
-            break;
-           case '0':
-            break;
-           default:
-            format=TEXT_LOCAL;
-          }
-          if(format != EMPTY_LOCAL) break;
-        }
-        val=atof(text);
-        if(format!=EMPTY_LOCAL || (val==0. && nonzero))
-             format = TEXT_LOCAL;
-        else
-             format = NUMERIC_LOCAL;
-  }
-
-  switch(format){
-    case TEXT_LOCAL:
-    case EMPTY_LOCAL:
-      strcpy(label, text);
-      return;
-    case NUMERIC_LOCAL:
-      val=atof(text);
-      *justification = GTK_JUSTIFY_LEFT;
-  }
-
-  auxval= val < 0 ? -val : val;
-
-  while(auxval<1 && auxval != 0.){
-   auxval=auxval*10.;
-   digspace+=1;
-  }
-
-  if(digspace+DEFAULT_PRECISION+1>intspace || digspace > DEFAULT_PRECISION){
-    sprintf (label, "%*.*E", intspace, DEFAULT_PRECISION, val);
-  }
-  else
-    {
-    intspace=MIN(intspace, strlen(text)-digspace-1);
-    sprintf (label, "%*.*f", intspace, DEFAULT_PRECISION, val);
-    if(strlen(label) > space)
-      sprintf (label, "%*.*E", intspace, DEFAULT_PRECISION, val);
-  }
-#endif
-}
-
-
-
-/*  -----------------------------------------------------------------  *
- *  Do we need this?
- *  -----------------------------------------------------------------  */
-gint change_entry(GtkWidget *widget, 
-                    gint row, gint col, gint *new_row, gint *new_col,
-                    gpointer data)
-{
-  GtkSheet *sheet;
-
-  sheet = GTK_SHEET(widget);
-
-  if(*new_col == 0 && col != 0)
-         gtk_sheet_change_entry(sheet, gtk_combo_get_type());
-
-  if(*new_col == 1 && col != 1)
-         gtk_sheet_change_entry(sheet, GTK_TYPE_ENTRY);
-
-  if(*new_col == 2 && col != 2)
-         gtk_sheet_change_entry(sheet, GTK_TYPE_SPIN_BUTTON);
-
-  if(*new_col >= 3 && col < 3)
-         gtk_sheet_change_entry(sheet, GTK_TYPE_ITEM_ENTRY);
-
-  return TRUE;
-}
-
-
-/*  -----------------------------------------------------------------  *
- *  Do we need this?  Yes -- this sets the value in the cell.
- *  -----------------------------------------------------------------  */
-void
-set_cell(GtkWidget *widget, gchar *insert, gint text_legth, gint position, 
-         gpointer data)
-{
-  gchar *text;
-  GtkEntry *sheet_entry;
-
-#ifdef DEBUG
-  /*  Debug statement  */
-  printf("Entering set_cell\n");
-#endif
-
-  sheet_entry = GTK_ENTRY(gtk_sheet_get_entry(GTK_SHEET(widget)));
-
-  if( (text = (gchar *) gtk_entry_get_text (GTK_ENTRY(sheet_entry)) ) ) {
-                          gtk_entry_set_text(GTK_ENTRY(entry), text);
-  }
-
-  GTK_WIDGET_UNSET_FLAGS(entry, GTK_HAS_FOCUS);
-  GTK_WIDGET_SET_FLAGS(GTK_SHEET(widget)->sheet_entry, GTK_HAS_FOCUS);
-
-#ifdef DEBUG
-  /*  Debug statement  */
-  printf("Leaving set_cell\n");
-#endif
-
-} 
-
-
-/*  -----------------------------------------------------------------  *
- *  This is invoked each time the sheet is displayed.
- *  -----------------------------------------------------------------  */
-void
-show_sheet_entry(GtkWidget *widget, gpointer data)
-{
- gchar *text;
- GtkSheet *sheet;
- GtkEntry *sheet_entry;
- gint cur_page;
-
-#ifdef DEBUG
- /*  Debug statement  */
- printf("Entering show_sheet_entry\n");
-#endif
-
- if(!GTK_WIDGET_HAS_FOCUS(widget)) return;
-
- cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
-
-  sheet=GTK_SHEET(sheets[cur_page]);
- sheet_entry = GTK_ENTRY(gtk_sheet_get_entry( GTK_SHEET(sheet) ));
-
- if((text = (gchar *) gtk_entry_get_text (GTK_ENTRY(entry)))){
-   gtk_entry_set_text( GTK_ENTRY(sheet_entry), text);
- }
-
-#ifdef DEBUG
- /*  Debug statement  */
- printf("Leaving show_sheet_entry\n");
-#endif
-
-}
-
-/*  -----------------------------------------------------------------  *
- *  Do we need this?
- *  -----------------------------------------------------------------  */
-void 
-activate_sheet_entry(GtkWidget *widget, gpointer data)
-{
-  GtkSheet *sheet;
-  GtkEntry *sheet_entry;
-  gint cur_page, row, col;
-  gint justification=GTK_JUSTIFY_LEFT;
-
-#ifdef DEBUG
-  /*  Debug statement  */
-  printf("Entering activate_sheet_entry\n");
-#endif
-  
-  cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
-  sheet=GTK_SHEET(sheets[cur_page]);
-  row=sheet->active_cell.row; col=sheet->active_cell.col;
-  
-  sheet_entry = GTK_ENTRY(gtk_sheet_get_entry( GTK_SHEET(sheet) ));
-  
-  if(GTK_IS_ITEM_ENTRY(sheet_entry))
-    justification = GTK_ITEM_ENTRY(sheet_entry)->justification;
-  
-  gtk_sheet_set_cell(sheet, row, col,
-		     justification,
-		     gtk_entry_get_text (sheet_entry));
-  
-  
-
-#ifdef DEBUG
-  /*  Debug statement  */
-  printf("Leaving activate_sheet_entry\n");
-#endif
-
-}
-
-/*  -----------------------------------------------------------------  *
- *  This fcn displays a text entry box at the 
- *  top of the working area.  It is removed since it 
- *  is not needed now, but
- *  may come in handy later. Therefore I keep the code around.
- *  -----------------------------------------------------------------  */
-void 
+/*! \brief Displays a text entry box at the top of the working area.
+ *         It is removed since it is not needed now, but may come in
+ *         handy later. Therefore I keep the code around.
+ */
+static void
 show_entry(GtkWidget *widget, gpointer data)
 {
  gchar *text; 
@@ -653,36 +351,15 @@ show_entry(GtkWidget *widget, gpointer data)
  GtkWidget *sheet_entry = NULL;
  gint cur_page;
 
-#ifdef DEBUG
-  /*  Debug statement  */
-  printf("Entering show_entry\n");
-#endif
-
  if(!GTK_WIDGET_HAS_FOCUS(widget)) {
-
-#ifdef DEBUG
-   /*  Debug statement  */
-   printf("Leaving show_entry -- we don't have focus!!\n");
-#endif
-
    return;
  }
 
  cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
 
-#ifdef DEBUG
-   /*  Debug statement  */
-   printf("In show_entry, handling cur_page = %d!!\n", cur_page);
-#endif
-
  sheet = GTK_SHEET(sheets[cur_page]);
  if (sheet != NULL) {
    sheet_entry = gtk_sheet_get_entry( GTK_SHEET(sheet) );
- } else {
-#ifdef DEBUG
-   /*  Debug statement  */
-   printf("In show_entry, sheet_entry == NULL!\n");
-#endif
  }
 
  /*  Here's another place where we mix entry and sheet_entry  */
@@ -696,228 +373,5 @@ show_entry(GtkWidget *widget, gpointer data)
      /* gtk_entry_set_text(GTK_ENTRY(entry), NULL); */
    }
  }
-
-#ifdef DEBUG
-  /*  Debug statement  */
-  printf("Leaving show_entry normally.\n");
-#endif
-
 }
 
-/*  -----------------------------------------------------------------  *
- *  Do we need this?
- *  -----------------------------------------------------------------  */
-void 
-justify_left(GtkWidget *widget)
-{
-  GtkSheet *current;
-  gint cur_page;
-
-  cur_page=gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
-  current=GTK_SHEET(sheets[cur_page]);
-
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(left_button),
-  GTK_STATE_ACTIVE);
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(right_button),
-  GTK_STATE_NORMAL);
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(center_button),
-  GTK_STATE_NORMAL);
-
-  gtk_sheet_range_set_justification(current, &current->range,
-  GTK_JUSTIFY_LEFT);
-}
-
-/*  -----------------------------------------------------------------  *
- *  Do we need this?
- *  -----------------------------------------------------------------  */
-void 
-justify_center(GtkWidget *widget) 
-{
-  GtkSheet *current;
-  gint cur_page;
-
-  cur_page=gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
-  current=GTK_SHEET(sheets[cur_page]);
-
-  gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(center_button),
-  GTK_STATE_ACTIVE);
-  gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(right_button),
-  GTK_STATE_NORMAL);
-  gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(left_button),
-  GTK_STATE_NORMAL);
-
-  gtk_sheet_range_set_justification(current, &current->range,
-  GTK_JUSTIFY_CENTER);
-}
-
-/*  -----------------------------------------------------------------  *
- *  Do we need this?
- *  -----------------------------------------------------------------  */
-void 
-justify_right(GtkWidget *widget) 
-{
-  GtkSheet *current;
-  gint cur_page;
-
-  cur_page=gtk_notebook_current_page(GTK_NOTEBOOK(notebook));
-  current=GTK_SHEET(sheets[cur_page]);
-
-  gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(right_button),
-  GTK_STATE_ACTIVE);
-  gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(left_button),
-  GTK_STATE_NORMAL);
-  gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(center_button),
-  GTK_STATE_NORMAL);
-
-  gtk_sheet_range_set_justification(current, &current->range,
-  GTK_JUSTIFY_RIGHT);
-}
-
-/*  -----------------------------------------------------------------  *
- *  Do we need this?  In principle, this is the callback for 
- *  when the user hits <enter>.   HOwever, I have commented out the
- *  callback connection statement, and the sheet continues to 
- *  function normally.
- *  -----------------------------------------------------------------  */
-gint
-activate_sheet_cell(GtkWidget *widget, gint row, gint column, gpointer data) 
-{
-
-  GtkSheet *sheet;
-  GtkEntry *sheet_entry;
-  gchar cell[100];
-  gchar *text;
-  GtkSheetCellAttr attributes;
-
-#ifdef DEBUG
-  /*  Debug statement  */
-  printf("Entering activate_sheet_cell\n");
-#endif
-
-  sheet=GTK_SHEET(widget);
-  sheet_entry = GTK_ENTRY(gtk_sheet_get_entry( GTK_SHEET(sheet) ));
-
-  if(GTK_SHEET(widget)->column[column].name)
-   sprintf(cell,"  %s:%d  ",GTK_SHEET(widget)->column[column].name, row);
-  else
-   sprintf(cell, " ROW: %d COLUMN: %d ", row, column);
-
-  if (location != NULL) {
-    gtk_label_set(GTK_LABEL(location), cell);
-  }
-
-  
-  if (entry != NULL) {
-    gtk_entry_set_max_length(GTK_ENTRY(entry),
-			     GTK_ENTRY(sheet_entry)->text_max_length);
-  }
-  
-  
-  if((text = (gchar *) gtk_entry_get_text(GTK_ENTRY(gtk_sheet_get_entry( GTK_SHEET(sheet) )))))
-    gtk_entry_set_text(GTK_ENTRY(sheet_entry), text);
-  else
-       gtk_entry_set_text(GTK_ENTRY(sheet_entry), (const gchar *) "");
-      /* gtk_entry_set_text(GTK_ENTRY(sheet_entry), NULL); */
-  
-  
-  
-  gtk_sheet_get_attributes(sheet, sheet->active_cell.row,
-			   sheet->active_cell.col, &attributes);
-
-
-  if (entry != NULL) {
-    gtk_entry_set_editable(GTK_ENTRY(entry), attributes.is_editable);
-  }
-
-
-  /*  These probably also spew errors . . .
-   *  switch (attributes.justification){
-   *  case GTK_JUSTIFY_LEFT:
-   *      justify_left(NULL);
-   *	  break;
-   *  case GTK_JUSTIFY_CENTER:
-   *      justify_center(NULL);
-   *	  break;
-   *  case GTK_JUSTIFY_RIGHT:
-   *      justify_right(NULL);
-   * 	  break;
-   *  default:
-   *      justify_left(NULL);
-   *	  break;
-   *
-   *  }
-   */
-
-#ifdef DEBUG
-  /*  Debug statement  */
-  printf("Leaving activate_sheet_cell\n");
-#endif
- 
-  return TRUE;
-
-}
-
-
-/*  -----------------------------------------------------------------  *
- *  Do we need this?
- *  -----------------------------------------------------------------  */
-void 
-do_hide_row_titles(GtkWidget *widget) 
-{
-  GtkSheet *current;
-  gint cur_page;
-
-  cur_page=gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
-  current=GTK_SHEET(sheets[cur_page]);
-
-  gtk_sheet_hide_row_titles(current);
-}
-
-/*  -----------------------------------------------------------------  *
- *  Do we need this?
- *  -----------------------------------------------------------------  */
-void 
-do_hide_column_titles(GtkWidget *widget) 
-{
-  GtkSheet *current; 
-  gint cur_page;
-
-  cur_page=gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
-  current=GTK_SHEET(sheets[cur_page]);
-
-  gtk_sheet_hide_column_titles(current);
-
-}
-
-/*  -----------------------------------------------------------------  *
- *  Do we need this?
- *  -----------------------------------------------------------------  */
-void 
-do_show_row_titles(GtkWidget *widget) 
-{
-  GtkSheet *current; 
-  gint cur_page;
-
-  cur_page=gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
-  current=GTK_SHEET(sheets[cur_page]);
-
-  gtk_sheet_show_row_titles(current);
-}
-
-/*  -----------------------------------------------------------------  *
- *  Do we need this?
- *  -----------------------------------------------------------------  */
-void 
-do_show_column_titles(GtkWidget *widget) 
-{
-  GtkSheet *current; 
-  gint cur_page;
-
-  cur_page=gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
-  current=GTK_SHEET(sheets[cur_page]);
-
-  gtk_sheet_show_column_titles(current);
-
-}
-
-

commit 512561395fb348a0fb71625edb4fe1ec96553c3f
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Aug 2 13:17:58 2007 +0100

    Fix to allow automatic loading of untitled backup files

diff --git a/gschem/src/gschem.c b/gschem/src/gschem.c
index 015b3f8..c0aab55 100644
--- a/gschem/src/gschem.c
+++ b/gschem/src/gschem.c
@@ -137,6 +137,7 @@ void main_prog(void *closure, int argc, char *argv[])
   int first_page = 1;
   char *geda_data = NULL;
   char *filename;
+  gboolean save_grid;
 
 #ifdef HAVE_GTHREAD
   /* Gschem isn't threaded, but some of GTK's file chooser
@@ -263,6 +264,15 @@ void main_prog(void *closure, int argc, char *argv[])
   x_window_setup_colors();
   x_window_setup (w_current);
 
+  /* Repaint the background in-case we have to throw up a "restore backup?"
+   * dialog box. Disable grid drawing as there is no page loaded, hence no
+   * scale factor to draw the grid at. (gschem will segfault otherwise.)
+   */
+  save_grid = w_current->grid;
+  w_current->grid = FALSE;
+  x_repaint_background (w_current);
+  w_current->grid = save_grid;
+
   i = argv_index;
   while (argv[i] != NULL) {
 
diff --git a/gschem/src/x_window.c b/gschem/src/x_window.c
index 29d89c9..74b421b 100644
--- a/gschem/src/x_window.c
+++ b/gschem/src/x_window.c
@@ -925,8 +925,7 @@ x_window_open_page (TOPLEVEL *toplevel, const gchar *filename)
   if (!quiet_mode)
     printf(_("Loading schematic [%s]\n"), filename);
 
-  if (g_file_test (filename, G_FILE_TEST_EXISTS))
-    f_open (toplevel, (gchar *) filename);
+  f_open (toplevel, (gchar *) filename);
 
   if (scm_hook_empty_p (new_page_hook) == SCM_BOOL_F)
     scm_run_hook (new_page_hook,
diff --git a/libgeda/src/f_basic.c b/libgeda/src/f_basic.c
index 7cd7a9c..c19a1ca 100644
--- a/libgeda/src/f_basic.c
+++ b/libgeda/src/f_basic.c
@@ -199,8 +199,7 @@ int f_open_flags(TOPLEVEL *w_current, const gchar *filename,
     w_current->page_current->object_tail = (OBJECT *) 
     o_read(w_current, w_current->page_current->object_tail, 
 	   backup_filename);
-  }
-  else {
+  } else if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
     /* Load the original file */
     w_current->page_current->object_tail = (OBJECT *) 
     o_read(w_current, w_current->page_current->object_tail, 

commit 4cbb0c15240f649cfd69b120e7ed7ecd6c752896
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Aug 2 13:16:22 2007 +0100

    Fix drawing artifact when dragging a net / bus to zero length.
    
    The grip dragging code cancels editing if you resize to a zero length line
    segment. Don't attempt to undraw the (zero length) rubberbanded line after
    the coordinates have been invalidated.

diff --git a/gschem/src/o_grips.c b/gschem/src/o_grips.c
index 80883d4..4a41fc6 100644
--- a/gschem/src/o_grips.c
+++ b/gschem/src/o_grips.c
@@ -1108,7 +1108,6 @@ void o_grips_end(TOPLEVEL *w_current)
       w_current->last_y = (-1);
       w_current->inside_action=0;
       i_set_state(w_current, SELECT);
-      o_net_eraserubber(w_current);
       o_redraw_single(w_current, object);
       i_update_toolbar(w_current);
       return;
@@ -1265,7 +1264,6 @@ void o_grips_end(TOPLEVEL *w_current)
       w_current->start_y = (-1);
       w_current->last_x = (-1);
       w_current->last_y = (-1);
-      o_net_eraserubber(w_current);
       o_redraw_single(w_current, object);
       w_current->inside_action=0;
       i_set_state(w_current, SELECT);

commit 8dc511639494940987582871d9f2efa09ecc2b37
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Aug 2 13:07:30 2007 +0100

    Refactor code in o_grips.c to reduce duplication
    
    Also make many whitespace fixes. The code paths should remain the same.

diff --git a/gschem/src/o_grips.c b/gschem/src/o_grips.c
index 0c6e8a8..80883d4 100644
--- a/gschem/src/o_grips.c
+++ b/gschem/src/o_grips.c
@@ -31,25 +31,17 @@
 #include <dmalloc.h>
 #endif
 
-/* Kazu on July 16, 1999 - Added these macros to simplify the code */
-#define GET_BOX_WIDTH(w)                        \
-        abs((w)->last_x - (w)->start_x)
-#define GET_BOX_HEIGHT(w)                       \
-	        abs((w)->last_y - (w)->start_y)
-#define GET_BOX_LEFT(w)                         \
-	        min((w)->start_x, (w)->last_x);
-#define GET_BOX_TOP(w)                          \
-	        min((w)->start_y, (w)->last_y);
-
-#define GET_PICTURE_WIDTH(w)			\
-	abs((w)->last_x - (w)->start_x) 
-#define GET_PICTURE_HEIGHT(w)			\
-	(w)->pixbuf_wh_ratio == 0 ? 0 : abs((w)->last_x - (w)->start_x)/(w)->pixbuf_wh_ratio
-#define GET_PICTURE_LEFT(w)				\
-	min((w)->start_x, (w)->last_x);
-#define GET_PICTURE_TOP(w)				\
-	(w)->start_y < (w)->last_y ? (w)->start_y  : \
-                                     (w)->start_y-abs((w)->last_x - (w)->start_x)/(w)->pixbuf_wh_ratio;
+#define GET_BOX_WIDTH(w)  abs((w)->last_x - (w)->start_x)
+#define GET_BOX_HEIGHT(w) abs((w)->last_y - (w)->start_y)
+#define GET_BOX_LEFT(w)   min((w)->start_x, (w)->last_x);
+#define GET_BOX_TOP(w)    min((w)->start_y, (w)->last_y);
+
+#define GET_PICTURE_WIDTH(w) abs((w)->last_x - (w)->start_x)
+#define GET_PICTURE_HEIGHT(w) (w)->pixbuf_wh_ratio == 0 ? 0 : \
+          abs((w)->last_x - (w)->start_x)/(w)->pixbuf_wh_ratio
+#define GET_PICTURE_LEFT(w) min((w)->start_x, (w)->last_x);
+#define GET_PICTURE_TOP(w)  (w)->start_y < (w)->last_y ? (w)->start_y : \
+          (w)->start_y-abs((w)->last_x - (w)->start_x)/(w)->pixbuf_wh_ratio;
 
 /*! \brief
  *  This variable holds the identifier of the grip currently under
@@ -88,21 +80,17 @@ OBJECT *o_grips_search_world(TOPLEVEL *w_current, int x, int y, int *whichone)
   OBJECT *object=NULL;
   OBJECT *found=NULL;
   GList *s_current;
-  int size, x2size;
+  int size;
   int w_size;
-	
+
   if (!whichone) {
     return(NULL);
   }
 
   /* get the size of the grip according to zoom level */
   size = o_grips_size(w_current);
-  /* size is half the width of a grip, x2size is full width */
-  x2size = size * 2;
-
   w_size = WORLDabs( w_current, size );
-	
-  /* skip over head */
+
   s_current = geda_list_get_glist( w_current->page_current->selection_list );
   while (s_current != NULL) {
     object = (OBJECT *) s_current->data;
@@ -114,28 +102,28 @@ OBJECT *o_grips_search_world(TOPLEVEL *w_current, int x, int y, int *whichone)
                                            x, y, w_size, whichone);
           if(found != NULL) return found;
           break;
-				
+
         case(OBJ_BOX):
           /* check the grips of the box object */
           found = o_grips_search_box_world(w_current, object,
                                            x, y, w_size, whichone);
           if(found != NULL) return found;
           break;
-		  
+
         case(OBJ_PICTURE):
           /* check the grips of the picture object */
           found = o_grips_search_picture_world(w_current, object,
                                                x, y, w_size, whichone);
           if(found != NULL) return found;
           break;
-		  
+
         case(OBJ_CIRCLE):
           /* check the grips of the circle object */
           found = o_grips_search_circle_world(w_current, object,
                                               x, y, w_size, whichone);
           if(found != NULL) return found;
           break;
-			
+
         case(OBJ_LINE):
         case(OBJ_PIN):
         case(OBJ_NET):
@@ -151,12 +139,38 @@ OBJECT *o_grips_search_world(TOPLEVEL *w_current, int x, int y, int *whichone)
           break;
       }
     }
-    s_current = s_current->next;	
+    s_current = s_current->next;
   }
-	
+
   return(NULL);
 }
 
+
+/*! \brief Check if pointer is inside the grip region.
+ *
+ *  \par Function Description
+ *  This function checks if the point (<B>x</B>,<B>y</B>) is
+ *  inside the grip centered at (<B>grip_x</B>,<B>grip_y</B>).
+ *
+ *  \param [in]  x          Current x coordinate of pointer in world units.
+ *  \param [in]  y          Current y coordinate of pointer in world units.
+ *  \param [in]  grip_x     Current x coordinate of grip center in world units.
+ *  \param [in]  grip_y     Current y coordinate of grip center in world units.
+ *  \param [in]  size       Half the width of the grip square in world units.
+ *  \return True / False whether the mouse pointer is inside the grip.
+ */
+static gboolean inside_grip( int x, int y, int grip_x, int grip_y, int size )
+{
+  int xmin, ymin, xmax, ymax;
+
+  xmin = grip_x - size;
+  ymin = grip_y - size;
+  xmax = xmin + 2 * size;
+  ymax = ymin + 2 * size;
+
+  return inside_region(xmin, ymin, xmax, ymax, x, y);
+}
+
 /*! \brief Check if pointer is inside arc grip.
  *  \par Function Description
  *  This function checks if the pointer event occuring at (<B>x</B>,<B>y</B>) is
@@ -193,11 +207,9 @@ OBJECT *o_grips_search_world(TOPLEVEL *w_current, int x, int y, int *whichone)
  *  \return Pointer to OBJECT the grip is on, NULL otherwise.
  */
 OBJECT *o_grips_search_arc_world(TOPLEVEL *w_current, OBJECT *o_current,
-			   int x, int y, int size, int *whichone)
+                                 int x, int y, int size, int *whichone)
 {
   int centerx, centery, radius, start_angle, end_angle;
-  int xmin, ymin, xmax, ymax;
-  int x2size;
   double tmp;
 
   centerx     = o_current->arc->x;
@@ -206,37 +218,26 @@ OBJECT *o_grips_search_arc_world(TOPLEVEL *w_current, OBJECT *o_current,
   start_angle = o_current->arc->start_angle;
   end_angle   = o_current->arc->end_angle;
 
-  /* width/height of the grip */
-  x2size = 2 * size;
-
   /* check the grip on the center of the arc */
-  xmin = centerx - size;
-  ymin = centery - size;
-  xmax = xmin + x2size;
-  ymax = ymin + x2size;
-  if (inside_region(xmin, ymin, xmax, ymax, x, y)) {
+  if (inside_grip(x, y, centerx, centery, size)) {
     *whichone = ARC_RADIUS;
     return(o_current);
   }
 
   /* check the grip at the start angle of the arc */
   tmp = ((double) start_angle) * M_PI / 180;
-  xmin = centerx + radius * cos(tmp) - size;
-  ymin = centery + radius * sin(tmp) - size;
-  xmax = xmin + x2size;
-  ymax = ymin + x2size;
-  if (inside_region(xmin, ymin, xmax, ymax, x, y)) {
+  if (inside_grip(x, y,
+                  centerx + radius * cos(tmp),
+                  centery + radius * sin(tmp), size)) {
     *whichone = ARC_START_ANGLE;
     return(o_current);
   }
 
   /* check the grip at the end angle of the arc */
   tmp = ((double) start_angle + end_angle) * M_PI / 180;
-  xmin = centerx + radius * cos(tmp) - size;
-  ymin = centery + radius * sin(tmp) - size;
-  xmax = xmin + x2size;
-  ymax = ymin + x2size;
-  if (inside_region(xmin, ymin, xmax, ymax, x, y)) {
+  if (inside_grip(x, y,
+                  centerx + radius * cos(tmp),
+                  centery + radius * sin(tmp), size)) {
     *whichone = ARC_END_ANGLE;
     return(o_current);
   }
@@ -249,7 +250,7 @@ OBJECT *o_grips_search_arc_world(TOPLEVEL *w_current, OBJECT *o_current,
  *  This function checks if the pointer event occuring at (<B>x</B>,<B>y</B>) is
  *  inside one of the grips of the <B>o_current</B> pointed box object.
  *  If so, the <B>whichone</B> pointed integer is set to the identifier of
- *  this grip and the returned pointer is a pointer on this object. 
+ *  this grip and the returned pointer is a pointer on this object.
  *  If the point is not inside a grip the function returns a NULL pointer
  *  and the <B>whichone</B> pointed integer is unset.
  *
@@ -271,50 +272,36 @@ OBJECT *o_grips_search_arc_world(TOPLEVEL *w_current, OBJECT *o_current,
  *  \return Pointer to OBJECT the grip is on, NULL otherwise.
  */
 OBJECT *o_grips_search_box_world(TOPLEVEL *w_current, OBJECT *o_current,
-			   int x, int y, int size, int *whichone)
+                                 int x, int y, int size, int *whichone)
 {
-  int xmin, ymin, xmax, ymax;
-  int x2size;
-
-  /* width/height of the grip */
-  x2size = 2 * size;
-
   /* inside upper left grip ? */
-  xmin = o_current->box->upper_x - size;
-  ymin = o_current->box->upper_y - size;
-  xmax = xmin + x2size;
-  ymax = ymin + x2size;
-  if (inside_region(xmin, ymin, xmax, ymax, x, y)) {
+  if (inside_grip(x, y,
+                  o_current->box->upper_x,
+                  o_current->box->upper_y, size)) {
     *whichone = BOX_UPPER_LEFT;
     return(o_current);
   }
 
   /* inside lower right grip ? */
-  xmin = o_current->box->lower_x - size;
-  ymin = o_current->box->lower_y - size;
-  xmax = xmin + x2size;
-  ymax = ymin + x2size;
-  if (inside_region(xmin, ymin, xmax, ymax, x, y)) {
+  if (inside_grip(x, y,
+                  o_current->box->lower_x,
+                  o_current->box->lower_y, size)) {
     *whichone = BOX_LOWER_RIGHT;
     return(o_current);
   }
 
   /* inside upper right grip ? */
-  xmin = o_current->box->lower_x - size;
-  ymin = o_current->box->upper_y - size;
-  xmax = xmin + x2size;
-  ymax = ymin + x2size;
-  if (inside_region(xmin, ymin, xmax, ymax, x, y)) {
+  if (inside_grip(x, y,
+                  o_current->box->lower_x,
+                  o_current->box->upper_y, size)) {
     *whichone = BOX_UPPER_RIGHT;
     return(o_current);
   }
 
   /* inside lower left grip ? */
-  xmin = o_current->box->upper_x - size;
-  ymin = o_current->box->lower_y - size;
-  xmax = xmin + x2size;
-  ymax = ymin + x2size;
-  if (inside_region(xmin, ymin, xmax, ymax, x, y)) {
+  if (inside_grip(x, y,
+                  o_current->box->upper_x,
+                  o_current->box->lower_y, size)) {
     *whichone = BOX_LOWER_LEFT;
     return(o_current);
   }
@@ -325,9 +312,9 @@ OBJECT *o_grips_search_box_world(TOPLEVEL *w_current, OBJECT *o_current,
 /*! \brief Check if pointer is inside picture grip.
  *  \par Function Description
  *  This function checks if the pointer event occuring at (<B>x</B>,<B>y</B>)
- *  is inside one of the grips of the <B>o_current</B> pointed picture object. 
+ *  is inside one of the grips of the <B>o_current</B> pointed picture object.
  *  If so, the <B>whichone</B> pointed integer is set to the identifier of
- *  this grip and the returned pointer is a pointer on this object. 
+ *  this grip and the returned pointer is a pointer on this object.
  *  If the point is not inside a grip the function returns a NULL pointer
  *  and the <B>whichone</B> pointed integer is unset.
  *
@@ -350,50 +337,36 @@ OBJECT *o_grips_search_box_world(TOPLEVEL *w_current, OBJECT *o_current,
  *  \return Pointer to OBJECT the grip is on, NULL otherwise.
  */
 OBJECT *o_grips_search_picture_world(TOPLEVEL *w_current, OBJECT *o_current,
-			       int x, int y, int size, int *whichone)
+                                     int x, int y, int size, int *whichone)
 {
-  int xmin, xmax, ymin, ymax;
-  int x2size;
-
-  /* width/height of the grip */
-  x2size = 2 * size;
-
   /* inside upper left grip ? */
-  xmin = o_current->picture->upper_x - size;
-  ymin = o_current->picture->upper_y - size;
-  xmax = xmin + x2size;
-  ymax = ymin + x2size;
-  if (inside_region(xmin, ymin, xmax, ymax, x, y)) {
+  if (inside_grip(x, y,
+                  o_current->picture->upper_x,
+                  o_current->picture->upper_y, size)) {
     *whichone = PICTURE_UPPER_LEFT;
     return(o_current);
   }
 
   /* inside lower right grip ? */
-  xmin = o_current->picture->lower_x - size;
-  ymin = o_current->picture->lower_y - size;
-  xmax = xmin + x2size;
-  ymax = ymin + x2size;
-  if (inside_region(xmin, ymin, xmax, ymax, x, y)) {
+  if (inside_grip(x, y,
+                  o_current->picture->lower_x,
+                  o_current->picture->lower_y, size)) {
     *whichone = PICTURE_LOWER_RIGHT;
     return(o_current);
   }
 
   /* inside upper right grip ? */
-  xmin = o_current->picture->lower_x - size;
-  ymin = o_current->picture->upper_y - size;
-  xmax = xmin + x2size;
-  ymax = ymin + x2size;
-  if (inside_region(xmin, ymin, xmax, ymax, x, y)) {
+  if (inside_grip(x, y,
+                  o_current->picture->lower_x,
+                  o_current->picture->upper_y, size)) {
     *whichone = PICTURE_UPPER_RIGHT;
     return(o_current);
   }
 
   /* inside lower left grip ? */
-  xmin = o_current->picture->upper_x - size;
-  ymin = o_current->picture->lower_y - size;
-  xmax = xmin + x2size;
-  ymax = ymin + x2size;
-  if (inside_region(xmin, ymin, xmax, ymax, x, y)) {
+  if (inside_grip(x, y,
+                  o_current->picture->upper_x,
+                  o_current->picture->lower_y, size)) {
     *whichone = PICTURE_LOWER_LEFT;
     return(o_current);
   }
@@ -427,29 +400,18 @@ OBJECT *o_grips_search_picture_world(TOPLEVEL *w_current, OBJECT *o_current,
  *  \return Pointer to OBJECT the grip is on, NULL otherwise.
  */
 OBJECT *o_grips_search_circle_world(TOPLEVEL *w_current, OBJECT *o_current,
-			      int x, int y, int size, int *whichone)
+                                    int x, int y, int size, int *whichone)
 {
-	int xmin, ymin, xmax, ymax;
-	int x1, y1;
-	int x2size;
-	
-	/* width/height of the grip */
-	x2size = 2 * size;
-
-        /* check the grip for radius */	
-	x1 = o_current->circle->center_x + o_current->circle->radius;
-	y1 = o_current->circle->center_y - o_current->circle->radius;
-	xmin = x1 - size;
-	ymin = y1 - size;
-	xmax = xmin + x2size;
-	ymax = ymin + x2size;
-	if (inside_region(xmin, ymin, xmax, ymax, x, y)) {
-		/* printf("found something 0!\n"); */
-		*whichone = CIRCLE_RADIUS;
-		return(o_current);
-	}
-
-	return NULL;
+  /* check the grip for radius */
+  if (inside_grip(x, y,
+                  o_current->circle->center_x + o_current->circle->radius,
+                  o_current->circle->center_y - o_current->circle->radius,
+                  size)) {
+    *whichone = CIRCLE_RADIUS;
+    return(o_current);
+  }
+
+  return NULL;
 }
 
 /*! \brief Check if pointer is inside line grip.
@@ -457,7 +419,7 @@ OBJECT *o_grips_search_circle_world(TOPLEVEL *w_current, OBJECT *o_current,
  *  This function determines if the (<B>x</B>,<B>y</B>) point is inside one of
  *  the grip of the line object <B>o_current</B>.
  *  It computes the area covered by each grip and check if (<B>x</B>,<B>y</B>)
- *  is in one of these areas. 
+ *  is in one of these areas.
  *  If the event occured in one of its grip, a pointer on the object is
  *  returned and <B>*whichone</B> is set to the identifier of the grip. If not,
  *  the function returns <B>NULL</B> pointer and <B>*whichone</B> is unchanged.
@@ -473,35 +435,25 @@ OBJECT *o_grips_search_circle_world(TOPLEVEL *w_current, OBJECT *o_current,
  *  \return Pointer to OBJECT the grip is on, NULL otherwise.
  */
 OBJECT *o_grips_search_line_world(TOPLEVEL *w_current, OBJECT *o_current,
-			    int x, int y, int size, int *whichone)
+                                  int x, int y, int size, int *whichone)
 {
-	int xmin, ymin, xmax, ymax;
-	int x2size;
-
-	/* width/height of the grip */
-	x2size = 2 * size;
-
-	/* check the grip on the end of line 1 */
-	xmin = o_current->line->x[LINE_END1] - size;
-	ymin = o_current->line->y[LINE_END1] - size;
-	xmax = xmin + x2size;
-	ymax = ymin + x2size;
-	if (inside_region(xmin, ymin, xmax, ymax, x, y)) {
-		*whichone = LINE_END1;
-		return(o_current);
-	}
-
-	/* check the grip on the end of line 2 */
-	xmin = o_current->line->x[LINE_END2] - size;
-	ymin = o_current->line->y[LINE_END2] - size;
-	xmax = xmin + x2size;
-	ymax = ymin + x2size;
-	if (inside_region(xmin, ymin, xmax, ymax, x, y)) {
-		*whichone = LINE_END2;
-		return(o_current);
-	}
-
-	return NULL;
+  /* check the grip on the end of line 1 */
+  if (inside_grip(x, y,
+                  o_current->line->x[LINE_END1],
+                  o_current->line->y[LINE_END1], size)) {
+    *whichone = LINE_END1;
+    return(o_current);
+  }
+
+  /* check the grip on the end of line 2 */
+  if (inside_grip(x, y,
+                  o_current->line->x[LINE_END2],
+                  o_current->line->y[LINE_END2], size)) {
+    *whichone = LINE_END2;
+    return(o_current);
+  }
+
+  return NULL;
 }
 
 /*! \brief Start process of modifiying one grip.
@@ -529,7 +481,7 @@ int o_grips_start(TOPLEVEL *w_current, int x, int y)
   int w_x, w_y;
   OBJECT *object;
   int whichone;
-	
+
   if (w_current->draw_grips == FALSE) {
     return(FALSE);
   }
@@ -539,129 +491,96 @@ int o_grips_start(TOPLEVEL *w_current, int x, int y)
   /* search if there is a grip on a selected object at (x,y) */
   object = o_grips_search_world(w_current, w_x, w_y, &whichone);
   if (object) {
+    whichone_changing = whichone;
+    object_changing = object;
+
     /* there is one */
     /* depending on its type, start the modification process */
     switch(object->type) {
       case(OBJ_ARC):
-	/* start the modification of a grip on an arc */
+        /* start the modification of a grip on an arc */
         o_grips_start_arc(w_current, object, x, y, whichone);
-				
-        whichone_changing = whichone;
-        object_changing = object;
         return(TRUE);
-        break;
 
       case(OBJ_BOX):
-	/* start the modification of a grip on a box */
+        /* start the modification of a grip on a box */
         o_grips_start_box(w_current, object, x, y, whichone);
-				
-        whichone_changing = whichone;
-        object_changing = object;
         return(TRUE);
-        break;
-				
+
       case(OBJ_PICTURE):
-	/* start the modification of a grip on a picture */
+        /* start the modification of a grip on a picture */
         o_grips_start_picture(w_current, object, x, y, whichone);
-				
-        whichone_changing = whichone;
-        object_changing = object;
         return(TRUE);
-        break;
-				
+
       case(OBJ_CIRCLE):
-	/* start the modification of a grip on a circle */
+        /* start the modification of a grip on a circle */
         o_grips_start_circle(w_current, object, x, y, whichone);
-				
-        whichone_changing = whichone;
-        object_changing = object;
         return(TRUE);
-        break;
-			
+
       case(OBJ_LINE):
-	/* start the modification of a grip on a line */
+        /* start the modification of a grip on a line */
         o_grips_start_line(w_current, object, x, y, whichone);
-				
-        whichone_changing = whichone;
-        object_changing = object;
         return(TRUE);
-        break;
 
-      case(OBJ_NET): 
+      case(OBJ_NET):
         w_current->last_drawb_mode = -1;
         WORLDtoSCREEN( w_current, object->line->x[whichone], object->line->y[whichone],
                        &w_current->last_x, &w_current->last_y );
         WORLDtoSCREEN( w_current, object->line->x[!whichone], object->line->y[!whichone],
                        &w_current->start_x, &w_current->start_y );
-				
+
         o_net_erase(w_current, object);
-        gdk_gc_set_foreground(w_current->xor_gc, 
+        gdk_gc_set_foreground(w_current->xor_gc,
                               x_get_darkcolor(w_current->select_color) );
-        gdk_draw_line(w_current->window, w_current->xor_gc, 
-                      w_current->start_x, w_current->start_y, 
+        gdk_draw_line(w_current->window, w_current->xor_gc,
+                      w_current->start_x, w_current->start_y,
                       w_current->last_x, w_current->last_y);
         o_line_erase_grips(w_current, object);
-				
-        whichone_changing = whichone;
-        object_changing = object;
-        gdk_gc_set_foreground(w_current->gc, 
-                              x_get_color(w_current->background_color)); 
+
+        gdk_gc_set_foreground(w_current->gc,
+                              x_get_color(w_current->background_color));
         return(TRUE);
-				
-        break; 
-				
-      case(OBJ_PIN): 
-				
+
+      case(OBJ_PIN):
         w_current->last_drawb_mode = -1;
         WORLDtoSCREEN( w_current, object->line->x[whichone], object->line->y[whichone],
                        &w_current->last_x, &w_current->last_y );
         WORLDtoSCREEN( w_current, object->line->x[!whichone], object->line->y[!whichone],
                        &w_current->start_x, &w_current->start_y );
-				
+
         o_pin_erase(w_current, object);
-        gdk_gc_set_foreground(w_current->xor_gc, 
+        gdk_gc_set_foreground(w_current->xor_gc,
                               x_get_darkcolor(w_current->select_color) );
-        gdk_draw_line(w_current->window, w_current->xor_gc, 
-                      w_current->start_x, w_current->start_y, 
+        gdk_draw_line(w_current->window, w_current->xor_gc,
+                      w_current->start_x, w_current->start_y,
                       w_current->last_x, w_current->last_y);
         o_line_erase_grips(w_current, object);
-				
-        whichone_changing = whichone;
-        object_changing = object;
         return(TRUE);
-				
-        break; 
-				
-      case(OBJ_BUS): 
+
+      case(OBJ_BUS):
         w_current->last_drawb_mode = -1;
         WORLDtoSCREEN( w_current, object->line->x[whichone], object->line->y[whichone],
                        &w_current->last_x, &w_current->last_y );
         WORLDtoSCREEN( w_current, object->line->x[!whichone], object->line->y[!whichone],
                        &w_current->start_x, &w_current->start_y );
-				
+
         o_bus_erase(w_current, object);
-        gdk_gc_set_foreground(w_current->xor_gc, 
+        gdk_gc_set_foreground(w_current->xor_gc,
                               x_get_darkcolor(w_current->select_color) );
-        gdk_draw_line(w_current->window, w_current->xor_gc, 
-                      w_current->start_x, w_current->start_y, 
+        gdk_draw_line(w_current->window, w_current->xor_gc,
+                      w_current->start_x, w_current->start_y,
                       w_current->last_x, w_current->last_y);
         o_line_erase_grips(w_current, object);
-				
-        whichone_changing = whichone;
-        object_changing = object;
-        gdk_gc_set_foreground(w_current->gc, 
-                              x_get_color(w_current->background_color)); 
+
+        gdk_gc_set_foreground(w_current->gc,
+                              x_get_color(w_current->background_color));
         return(TRUE);
-				
-        break;
 
       default:
-				/* object type unknown : error condition */
+        /* object type unknown : error condition */
         return(FALSE);
-				
     }
   }
-	
   return(FALSE);
 }
 
@@ -694,7 +613,7 @@ int o_grips_start(TOPLEVEL *w_current, int x, int y)
  *  \param [out] whichone   (unused)
  */
 void o_grips_start_arc(TOPLEVEL *w_current, OBJECT *o_current,
-		       int x, int y, int whichone)
+                       int x, int y, int whichone)
 {
   w_current->last_drawb_mode = -1;
 
@@ -712,7 +631,7 @@ void o_grips_start_arc(TOPLEVEL *w_current, OBJECT *o_current,
 
   /* draw the first temporary arc */
   o_arc_rubberarc_xor(w_current);
-	
+
 }
 
 /*! \brief Initialize grip motion process for a box.
@@ -737,35 +656,35 @@ void o_grips_start_arc(TOPLEVEL *w_current, OBJECT *o_current,
  *  \param [out] whichone   Which coordinate to check.
  */
 void o_grips_start_box(TOPLEVEL *w_current, OBJECT *o_current,
-		       int x, int y, int whichone)
+                       int x, int y, int whichone)
 {
   w_current->last_drawb_mode = -1;
-	
+
   /* erase the box before */
   o_box_erase(w_current, o_current);
 
   /* (last_x,last_y)    is the selected corner */
   /* (start_x, start_y) is the opposite corner */
   switch(whichone) {
-    case BOX_UPPER_LEFT: 
+    case BOX_UPPER_LEFT:
       WORLDtoSCREEN( w_current, o_current->box->upper_x, o_current->box->upper_y,
                      &w_current->last_x, &w_current->last_y );
       WORLDtoSCREEN( w_current, o_current->box->lower_x, o_current->box->lower_y,
                      &w_current->start_x, &w_current->start_y );
       break;
-    case BOX_LOWER_RIGHT: 
+    case BOX_LOWER_RIGHT:
       WORLDtoSCREEN( w_current, o_current->box->lower_x, o_current->box->lower_y,
                      &w_current->last_x, &w_current->last_y );
       WORLDtoSCREEN( w_current, o_current->box->upper_x, o_current->box->upper_y,
                      &w_current->start_x, &w_current->start_y );
       break;
-    case BOX_UPPER_RIGHT: 
+    case BOX_UPPER_RIGHT:
       WORLDtoSCREEN( w_current, o_current->box->lower_x, o_current->box->upper_y,
                      &w_current->last_x, &w_current->last_y );
       WORLDtoSCREEN( w_current, o_current->box->upper_x, o_current->box->lower_y,
                      &w_current->start_x, &w_current->start_y );
       break;
-    case BOX_LOWER_LEFT: 
+    case BOX_LOWER_LEFT:
       WORLDtoSCREEN( w_current, o_current->box->upper_x, o_current->box->lower_y,
                      &w_current->last_x, &w_current->last_y );
       WORLDtoSCREEN( w_current, o_current->box->lower_x, o_current->box->upper_y,
@@ -802,10 +721,10 @@ void o_grips_start_box(TOPLEVEL *w_current, OBJECT *o_current,
  *  \param [out] whichone   Which coordinate to check.
  */
 void o_grips_start_picture(TOPLEVEL *w_current, OBJECT *o_current,
-			   int x, int y, int whichone)
+                           int x, int y, int whichone)
 {
   w_current->last_drawb_mode = -1;
-	
+
   /* erase the picture before */
   o_picture_erase(w_current, o_current);
   w_current->current_pixbuf = o_current->picture->original_picture;
@@ -815,25 +734,25 @@ void o_grips_start_picture(TOPLEVEL *w_current, OBJECT *o_current,
   /* (last_x,last_y)    is the selected corner */
   /* (start_x, start_y) is the opposite corner */
   switch(whichone) {
-    case PICTURE_UPPER_LEFT: 
+    case PICTURE_UPPER_LEFT:
       WORLDtoSCREEN( w_current, o_current->picture->upper_x, o_current->picture->upper_y,
                      &w_current->last_x, &w_current->last_y );
       WORLDtoSCREEN( w_current, o_current->picture->lower_x, o_current->picture->lower_y,
                      &w_current->start_x, &w_current->start_y );
       break;
-    case PICTURE_LOWER_RIGHT: 
+    case PICTURE_LOWER_RIGHT:
       WORLDtoSCREEN( w_current, o_current->picture->lower_x, o_current->picture->lower_y,
                      &w_current->last_x, &w_current->last_y );
       WORLDtoSCREEN( w_current, o_current->picture->upper_x, o_current->picture->upper_y,
                      &w_current->start_x, &w_current->start_y );
       break;
-    case PICTURE_UPPER_RIGHT: 
+    case PICTURE_UPPER_RIGHT:
       WORLDtoSCREEN( w_current, o_current->picture->lower_x, o_current->picture->upper_y,
                      &w_current->last_x, &w_current->last_y );
       WORLDtoSCREEN( w_current, o_current->picture->upper_x, o_current->picture->lower_y,
                      &w_current->start_x, &w_current->start_y );
       break;
-    case PICTURE_LOWER_LEFT: 
+    case PICTURE_LOWER_LEFT:
       WORLDtoSCREEN( w_current, o_current->picture->upper_x, o_current->picture->lower_y,
                      &w_current->last_x, &w_current->last_y );
       WORLDtoSCREEN( w_current, o_current->picture->lower_x, o_current->picture->upper_y,
@@ -871,13 +790,13 @@ void o_grips_start_picture(TOPLEVEL *w_current, OBJECT *o_current,
  *  \param [out] whichone   Which coordinate to check.
  */
 void o_grips_start_circle(TOPLEVEL *w_current, OBJECT *o_current,
-			  int x, int y, int whichone)
+                          int x, int y, int whichone)
 {
   w_current->last_drawb_mode = -1;
-  
+
   /* erase the circle before */
   o_circle_erase(w_current, o_current);
-  
+
   /* describe the circle with TOPLEVEL variables */
   /* (start_x, start_y) is the center of the circle */
   WORLDtoSCREEN( w_current, o_current->circle->center_x, o_current->circle->center_y,
@@ -887,12 +806,12 @@ void o_grips_start_circle(TOPLEVEL *w_current, OBJECT *o_current,
                  &w_current->last_x, &w_current->last_y );
   /* distance           is the radius of the circle */
   w_current->distance = SCREENabs( w_current, o_current->circle->radius );
-  
+
   /* draw the first temporary circle */
   o_circle_rubbercircle_xor(w_current);
 
 }
-	
+
 /*! \brief Initialize grip motion process for a line.
  *  This function starts the move of one of the two grips of the line
  *  object <B>o_current</B>.
@@ -914,19 +833,19 @@ void o_grips_start_circle(TOPLEVEL *w_current, OBJECT *o_current,
  *  \param [out] whichone   Which coordinate to check.
  */
 void o_grips_start_line(TOPLEVEL *w_current, OBJECT *o_current,
-			int x, int y, int whichone)
+                        int x, int y, int whichone)
 {
   w_current->last_drawb_mode = -1;
-  
+
   /* erase the line before */
   o_line_erase(w_current, o_current);
-  
+
   /* describe the line with TOPLEVEL variables */
   WORLDtoSCREEN( w_current, o_current->line->x[whichone], o_current->line->y[whichone],
                  &w_current->last_x, &w_current->last_y );
   WORLDtoSCREEN( w_current, o_current->line->x[!whichone], o_current->line->y[!whichone],
                  &w_current->start_x, &w_current->start_y );
-  
+
   /* draw the first temporary line */
   o_line_rubberline_xor(w_current);
 }
@@ -950,7 +869,7 @@ void o_grips_start_line(TOPLEVEL *w_current, OBJECT *o_current,
  */
 void o_grips_motion(TOPLEVEL *w_current, int x, int y)
 {
-	
+
   if (w_current->inside_action == 0) {
     o_redraw(w_current, w_current->page_current->object_head, TRUE);
     return;
@@ -962,7 +881,7 @@ void o_grips_motion(TOPLEVEL *w_current, int x, int y)
     o_redraw(w_current, w_current->page_current->object_head, TRUE);
     return;
   }
-	
+
   switch(object_changing->type) {
     case(OBJ_ARC):
     /* erase, update and draw an arc */
@@ -973,17 +892,17 @@ void o_grips_motion(TOPLEVEL *w_current, int x, int y)
     /* erase, update and draw a box */
     o_grips_motion_box(w_current, x, y, whichone_changing);
     break;
-		
+
     case(OBJ_PICTURE):
     /* erase, update and draw a box */
     o_grips_motion_picture(w_current, x, y, whichone_changing);
     break;
-		
+
     case(OBJ_CIRCLE):
     /* erase, update and draw a circle */
     o_grips_motion_circle(w_current, x, y, whichone_changing);
     break;
-		
+
     case(OBJ_LINE):
     case(OBJ_NET):
     case(OBJ_PIN):
@@ -996,7 +915,6 @@ void o_grips_motion(TOPLEVEL *w_current, int x, int y)
     default:
     return; /* error condition */
   }
-	
 }
 
 /*! \brief Modify previously selected arc according to mouse position.
@@ -1097,9 +1015,8 @@ void o_grips_motion_picture(TOPLEVEL *w_current, int x, int y, int whichone)
  */
 void o_grips_motion_circle(TOPLEVEL *w_current, int x, int y, int whichone)
 {
-	/* erase, update and draw the temporary circle */
-	o_circle_rubbercircle(w_current, x, y);
-
+  /* erase, update and draw the temporary circle */
+  o_circle_rubbercircle(w_current, x, y);
 }
 
 /*! \brief Modify previously selected line according to mouse position.
@@ -1117,7 +1034,6 @@ void o_grips_motion_line(TOPLEVEL *w_current, int x, int y, int whichone)
 {
   /* erase, update and draw the temporary line */
   o_line_rubberline(w_current, x, y);
-	
 }
 
 /*! \brief End process of modifying object with grip.
@@ -1143,7 +1059,7 @@ void o_grips_end(TOPLEVEL *w_current)
   GList *other_objects = NULL;
   GList *connected_objects = NULL;
   int size;
-	
+
   object = object_changing;
 
   if (!object) {
@@ -1154,27 +1070,27 @@ void o_grips_end(TOPLEVEL *w_current)
   }
 
   switch(object->type) {
-    
+
     case(OBJ_ARC):
     /* modify an arc object */
     o_grips_end_arc(w_current, object, whichone_changing);
     break;
-	  
+
     case(OBJ_BOX):
     /* modify a box object */
     o_grips_end_box(w_current, object, whichone_changing);
     break;
-	  
+
     case(OBJ_PICTURE):
     /* modify a picture object */
     o_grips_end_picture(w_current, object, whichone_changing);
     break;
-	  
+
     case(OBJ_CIRCLE):
     /* modify a circle object */
     o_grips_end_circle(w_current, object, whichone_changing);
     break;
-	  
+
     case(OBJ_LINE):
     /* modify a line object */
     o_grips_end_line(w_current, object, whichone_changing);
@@ -1182,7 +1098,7 @@ void o_grips_end(TOPLEVEL *w_current)
 
     case(OBJ_NET):
     /* don't allow zero length nets / lines / pins
-     * this ends the net drawing behavior 
+     * this ends the net drawing behavior
      * we want this? hack */
     if ((w_current->start_x == w_current->last_x) &&
         (w_current->start_y == w_current->last_y)) {
@@ -1197,15 +1113,14 @@ void o_grips_end(TOPLEVEL *w_current)
       i_update_toolbar(w_current);
       return;
     }
-	  
-	  
-    SCREENtoWORLD(w_current, 
-                  w_current->last_x, 
+
+    SCREENtoWORLD(w_current,
+                  w_current->last_x,
                   w_current->last_y, &x, &y);
-	  
+
     x = snap_grid(w_current, x);
     y = snap_grid(w_current, y);
-	  
+
     o_cue_undraw(w_current, object);
     o_net_erase(w_current, object);
     /* erase xor line */
@@ -1215,36 +1130,36 @@ void o_grips_end(TOPLEVEL *w_current)
                   w_current->start_x, w_current->start_y,
                   w_current->last_x, w_current->last_y);
     o_line_erase_grips(w_current, object);
-	  
+
     other_objects = s_conn_return_others(other_objects, object);
     s_conn_remove(w_current, object);
-	  
+
     o_net_modify(w_current, object, x, y, whichone_changing);
 
     s_conn_update_object(w_current, object);
-	  
+
     /* get the other connected objects and redraw them */
     connected_objects = s_conn_return_others(connected_objects,
                                              object);
-    
+
     /* add bus rippers if necessary */
     if (o_net_add_busrippers(w_current, object, connected_objects)) {
-      
+
       o_net_erase(w_current, object);
       /*o_line_erase_grips(w_current, object); */
-      
+
       if (w_current->net_style == THICK ) {
         size = SCREENabs(w_current, 10);
-        
+
         if (size < 0)
           size=0;
-          
-          gdk_gc_set_line_attributes(w_current->gc, size, 
-                                     GDK_LINE_SOLID,
-                                     GDK_CAP_BUTT,
-                                     GDK_JOIN_MITER);
-        }
-      
+
+        gdk_gc_set_line_attributes(w_current->gc, size,
+                                   GDK_LINE_SOLID,
+                                   GDK_CAP_BUTT,
+                                   GDK_JOIN_MITER);
+      }
+
       gdk_gc_set_foreground(w_current->gc,
                           x_get_color(w_current->background_color));
       gdk_draw_line(w_current->window, w_current->gc,
@@ -1254,9 +1169,9 @@ void o_grips_end(TOPLEVEL *w_current)
       o_cue_undraw(w_current, object);
       o_net_draw(w_current, object);
       o_cue_draw_single(w_current, object);
-      
+
       if (w_current->net_style == THICK ) {
-        gdk_gc_set_line_attributes(w_current->gc, 0, 
+        gdk_gc_set_line_attributes(w_current->gc, 0,
                                    GDK_LINE_SOLID,
                                    GDK_CAP_NOT_LAST,
                                    GDK_JOIN_MITER);
@@ -1266,7 +1181,7 @@ void o_grips_end(TOPLEVEL *w_current)
     /* draw the object objects */
     o_cue_undraw_list(w_current, other_objects);
     o_cue_draw_list(w_current, other_objects);
-    
+
     o_redraw_single(w_current, object);
 
     if (connected_objects) {
@@ -1277,7 +1192,7 @@ void o_grips_end(TOPLEVEL *w_current)
     /* get the other connected objects and redraw them */
     connected_objects = s_conn_return_others(connected_objects,
                                              object);
-    
+
     o_cue_undraw_list(w_current, connected_objects);
     o_cue_draw_list(w_current, connected_objects);
     /* finally draw this objects cues */
@@ -1286,7 +1201,7 @@ void o_grips_end(TOPLEVEL *w_current)
 
     case(OBJ_PIN):
     /* don't allow zero length nets / lines / pins
-     * this ends the net drawing behavior 
+     * this ends the net drawing behavior
      * we want this? hack */
     if ((w_current->start_x == w_current->last_x) &&
         (w_current->start_y == w_current->last_y)) {
@@ -1300,15 +1215,14 @@ void o_grips_end(TOPLEVEL *w_current)
       i_update_toolbar(w_current);
       return;
     }
-	  
-	  
-    SCREENtoWORLD(w_current, 
-                  w_current->last_x, 
+
+    SCREENtoWORLD(w_current,
+                  w_current->last_x,
                   w_current->last_y, &x, &y);
-	  
+
     x = snap_grid(w_current, x);
     y = snap_grid(w_current, y);
-	  
+
     o_cue_undraw(w_current, object);
     o_pin_erase(w_current, object);
     /* erase xor line */
@@ -1318,32 +1232,32 @@ void o_grips_end(TOPLEVEL *w_current)
                   w_current->start_x, w_current->start_y,
                   w_current->last_x, w_current->last_y);
     o_line_erase_grips(w_current, object);
-	  
+
     other_objects = s_conn_return_others(other_objects, object);
     s_conn_remove(w_current, object);
-	  
-    o_pin_modify(w_current, object, x, y, 
+
+    o_pin_modify(w_current, object, x, y,
                  whichone_changing);
     s_conn_update_object(w_current, object);
     o_redraw_single(w_current, object);
-	  
+
     /* draw the object objects */
     o_cue_undraw_list(w_current, other_objects);
     o_cue_draw_list(w_current, other_objects);
-	  
+
     /* get the other connected objects and redraw them */
     connected_objects = s_conn_return_others(connected_objects,
                                              object);
     o_cue_undraw_list(w_current, connected_objects);
     o_cue_draw_list(w_current, connected_objects);
-	  
+
     /* finally draw this objects cues */
     o_cue_draw_single(w_current, object);
     break;
-	  
+
     case(OBJ_BUS):
     /* don't allow zero length nets / lines / pins
-     * this ends the net drawing behavior 
+     * this ends the net drawing behavior
      * we want this? hack */
     if ((w_current->start_x == w_current->last_x) &&
         (w_current->start_y == w_current->last_y)) {
@@ -1358,14 +1272,14 @@ void o_grips_end(TOPLEVEL *w_current)
       i_update_toolbar(w_current);
       return;
     }
-	  
-    SCREENtoWORLD(w_current, 
-                  w_current->last_x, 
+
+    SCREENtoWORLD(w_current,
+                  w_current->last_x,
                   w_current->last_y, &x, &y);
-	  
+
     x = snap_grid(w_current, x);
     y = snap_grid(w_current, y);
-	  
+
     o_cue_undraw(w_current, object);
     o_bus_erase(w_current, object);
     /* erase xor line */
@@ -1375,36 +1289,35 @@ void o_grips_end(TOPLEVEL *w_current)
                   w_current->start_x, w_current->start_y,
                   w_current->last_x, w_current->last_y);
     o_line_erase_grips(w_current, object);
-	  
+
     other_objects = s_conn_return_others(other_objects, object);
     s_conn_remove(w_current, object);
-	  
-    o_bus_modify(w_current, object, x, y, 
+
+    o_bus_modify(w_current, object, x, y,
                  whichone_changing);
     s_conn_update_object(w_current, object);
     o_redraw_single(w_current, object);
-	  
+
     /* draw the object objects */
     o_cue_undraw_list(w_current, other_objects);
     o_cue_draw_list(w_current, other_objects);
-	  
+
     /* get the other connected objects and redraw them */
     connected_objects = s_conn_return_others(connected_objects,
                                              object);
     o_cue_undraw_list(w_current, connected_objects);
     o_cue_draw_list(w_current, connected_objects);
-	  
+
     /* finally draw this objects cues */
     o_cue_draw_single(w_current, object);
     break;
-	  
+
     default:
     return;
   }
 
-			
   w_current->page_current->CHANGED=1;
-  
+
   g_list_free(other_objects);
   other_objects = NULL;
   g_list_free(connected_objects);
@@ -1413,7 +1326,7 @@ void o_grips_end(TOPLEVEL *w_current)
   /* reset global variables */
   whichone_changing = -1;
   object_changing = NULL;
-  
+
   o_undo_savestate(w_current, UNDO_ALL);
 }
 
@@ -1452,7 +1365,7 @@ void o_grips_end_arc(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
       /* second parameter is not used */
       arg2 = -1;
       break;
-		  
+
     case ARC_START_ANGLE:
       /* get the start angle from w_current */
       arg1 = w_current->loc_x;
@@ -1482,7 +1395,7 @@ void o_grips_end_arc(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
 /*! \todo Finish function documentation!!!
  *  \brief End process of modifying box object with grip.
  *  \par Function Description
- * 
+ *
  *  \param [in] w_current  The TOPLEVEL object.
  *  \param [in] o_current  Box OBJECT to end modification on.
  *  \param [in] whichone   Which grip is pointed to.
@@ -1491,39 +1404,39 @@ void o_grips_end_box(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
 {
   int box_width, box_height;
   int x, y;
-  
+
   box_width  = GET_BOX_WIDTH (w_current);
   box_height = GET_BOX_HEIGHT(w_current);
-  
+
   /* don't allow zero width/height boxes
-   * this ends the box drawing behavior 
+   * this ends the box drawing behavior
    * we want this? hack */
   if ((box_width == 0) && (box_height == 0)) {
     w_current->start_x = (-1);
     w_current->start_y = (-1);
     w_current->last_x  = (-1);
     w_current->last_y  = (-1);
-    
+
     w_current->inside_action=0;
     i_set_state(w_current, SELECT);
-    
+
     o_redraw_single(w_current, o_current);
     i_update_toolbar(w_current);
-    
+
     return;
   }
 
-  SCREENtoWORLD(w_current, 
-		w_current->last_x, w_current->last_y,
-		&x, &y);
+  SCREENtoWORLD(w_current,
+                w_current->last_x, w_current->last_y,
+                &x, &y);
   x = snap_grid(w_current, x);
   y = snap_grid(w_current, y);
-  
+
   o_box_modify(w_current, o_current, x, y, whichone);
-  
+
   /* erase the temporary box */
   o_box_rubberbox_xor(w_current);
-  
+
   /* draw the modified box */
   o_redraw_single(w_current, o_current);
 }
@@ -1531,7 +1444,7 @@ void o_grips_end_box(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
 /*! \todo Finish function documentation!!!
  *  \brief End process of modifying picture object with grip.
  *  \par Function Description
- * 
+ *
  *  \param [in] w_current  The TOPLEVEL object.
  *  \param [in] o_current  Picture OBJECT to end modification on.
  *  \param [in] whichone   Which grip is pointed to.
@@ -1540,42 +1453,42 @@ void o_grips_end_picture(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
 {
   int picture_width, picture_height;
   int x, y;
-  
+
   picture_width  = GET_PICTURE_WIDTH (w_current);
   picture_height = GET_PICTURE_HEIGHT(w_current);
 
   /* don't allow zero width/height picturees
-   * this ends the picture drawing behavior 
+   * this ends the picture drawing behavior
    * we want this? hack */
   if ((picture_width == 0) && (picture_height == 0)) {
     w_current->start_x = (-1);
     w_current->start_y = (-1);
     w_current->last_x  = (-1);
     w_current->last_y  = (-1);
-    
+
     w_current->inside_action=0;
     i_set_state(w_current, SELECT);
-    
+
     o_redraw_single(w_current, o_current);
     i_update_toolbar(w_current);
-    
+
     return;
   }
-  
-  SCREENtoWORLD(w_current, 
-		w_current->last_x, w_current->last_y,
-		&x, &y);
+
+  SCREENtoWORLD(w_current,
+                w_current->last_x, w_current->last_y,
+                &x, &y);
   x = snap_grid(w_current, x);
   y = snap_grid(w_current, y);
-  
+
   o_picture_modify(w_current, o_current, x, y, whichone);
-  
+
   /* erase the temporary picture */
   o_picture_rubberbox_xor(w_current);
-  
+
   /* draw the modified picture */
   o_redraw_single(w_current, o_current);
-  
+
   w_current->current_pixbuf = NULL;
   w_current->pixbuf_filename = NULL;
   w_current->pixbuf_wh_ratio = 0;
@@ -1599,12 +1512,12 @@ void o_grips_end_picture(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
 void o_grips_end_circle(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
 {
   int radius;
-  
+
   /* erase the temporary circle */
   o_circle_rubbercircle_xor(w_current);
-  
+
   /* don't allow zero radius circles
-   * this ends the circle drawing behavior 
+   * this ends the circle drawing behavior
    * we want this? hack */
   if ((w_current->start_x == w_current->last_x) &&
       (w_current->start_y == w_current->last_y)) {
@@ -1612,24 +1525,24 @@ void o_grips_end_circle(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
     w_current->start_y = (-1);
     w_current->last_x  = (-1);
     w_current->last_y  = (-1);
-    
+
     /* return to select mode */
     w_current->inside_action = 0;
     i_set_state(w_current, SELECT);
     i_update_toolbar(w_current);
-    
+
     o_redraw_single(w_current, o_current);
     return;
   }
-  
+
   /* convert the radius in world unit */
   radius = WORLDabs(w_current, w_current->distance);
-  
+
   /* modify the radius of the circle */
   o_circle_modify(w_current, o_current, radius, -1, CIRCLE_RADIUS);
-  
+
   /* display the new circle */
-  o_redraw_single(w_current, o_current); 
+  o_redraw_single(w_current, o_current);
 }
 
 /*! \brief End process of modifying line object with grip.
@@ -1651,12 +1564,12 @@ void o_grips_end_circle(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
 void o_grips_end_line(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
 {
   int x, y;
-  
+
   /* erase the temporary line */
   o_line_rubberline_xor(w_current);
-  
+
   /* don't allow zero length nets / lines / pins
-   * this ends the net drawing behavior 
+   * this ends the net drawing behavior
    * we want this? hack */
   if ((w_current->start_x == w_current->last_x) &&
       (w_current->start_y == w_current->last_y)) {
@@ -1664,30 +1577,30 @@ void o_grips_end_line(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
     w_current->start_y = (-1);
     w_current->last_x  = (-1);
     w_current->last_y  = (-1);
-    
+
     /* return to select mode */
     w_current->inside_action=0;
     i_set_state(w_current, SELECT);
     i_update_toolbar(w_current);
-    
+
     o_redraw_single(w_current, o_current);
     return;
   }
-  
+
   /* convert the line end coords in world unit */
-  SCREENtoWORLD(w_current, 
-		w_current->last_x, w_current->last_y,
-		&x, &y);
+  SCREENtoWORLD(w_current,
+                w_current->last_x, w_current->last_y,
+                &x, &y);
   x = snap_grid(w_current, x);
   y = snap_grid(w_current, y);
-  
+
   /* modify the right line end according to whichone */
   o_line_modify(w_current, o_current, x, y, whichone);
-  
+
   /* display the new line */
   o_redraw_single(w_current, o_current);
 }
-	
+
 /*! \brief Get half the width and height of grip in screen units.
  *  \par Function Description
  *  According to the current zoom level, the function returns half the width
@@ -1737,7 +1650,7 @@ void o_grips_draw(TOPLEVEL *w_current, int x, int y)
 {
   GdkColor *color;
   int size, x2size;
-  
+
   /*
    * Depending on the current zoom level, the size of the grip is
    * determined. <B>size</B> is half the width and height of the grip
@@ -1764,11 +1677,11 @@ void o_grips_draw(TOPLEVEL *w_current, int x, int y)
   }
   /* set the color for the grip */
   gdk_gc_set_foreground(w_current->gc, color);
- 
+
   /* set the line options for grip : solid, 1 pix wide */
   gdk_gc_set_line_attributes(w_current->gc, 0, GDK_LINE_SOLID,
-			     GDK_CAP_BUTT, GDK_JOIN_MITER);
-	
+                             GDK_CAP_BUTT, GDK_JOIN_MITER);
+
   /*
    * A grip is a hollow square centered at (<B>x</B>,<B>y</B>) with a
    * width/height of <B>x2size</B>.
@@ -1776,16 +1689,16 @@ void o_grips_draw(TOPLEVEL *w_current, int x, int y)
   if (w_current->DONT_REDRAW == 0) {
     /* draw the grip in window */
     gdk_draw_rectangle(w_current->window, w_current->gc, FALSE,
-		       x - size, y - size, x2size, x2size);
+                       x - size, y - size, x2size, x2size);
     /* draw the grip in backingstore */
     gdk_draw_rectangle(w_current->backingstore, w_current->gc, FALSE,
-		       x - size, y - size, x2size, x2size);
+                       x - size, y - size, x2size, x2size);
   }
 }
 
 /*! \brief Erase grip centered at <B>x</B>,<B>y</B>
  *  \par Function Description
- *  This function erases a grip centered at (<B>x</B>,<B>y</B>). 
+ *  This function erases a grip centered at (<B>x</B>,<B>y</B>).
  *  The size of the grip depends on the current zoom factor.
  *
  *  The grip is erased by drawing with the background color over the

commit aec624dc87dc204b399b0e070f8fcfce8e3edbc6
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Aug 2 13:07:23 2007 +0100

    Remove old code commented out in o_net_consolidate_segments()

diff --git a/libgeda/src/o_net_basic.c b/libgeda/src/o_net_basic.c
index 5386ee1..89e34cf 100644
--- a/libgeda/src/o_net_basic.c
+++ b/libgeda/src/o_net_basic.c
@@ -603,9 +603,6 @@ int o_net_consolidate_segments(TOPLEVEL *w_current, OBJECT *object)
 
   object_orient = o_net_orientation(object);
 
-  /*screen_x = object->line->screen_x[j];
-    screen_y = object->line->screen_y[i];*/
-
   c_current = object->conn_list;
   while(c_current != NULL) {
     conn = (CONN *) c_current->data;

commit 92ef419c46d5a41aa33b399d43ccde2ba2a99998
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Aug 2 13:06:09 2007 +0100

    Fix drawing of cues after moving a single line segment

diff --git a/gschem/src/o_basic.c b/gschem/src/o_basic.c
index c599759..a7631c4 100644
--- a/gschem/src/o_basic.c
+++ b/gschem/src/o_basic.c
@@ -198,6 +198,7 @@ void o_draw_selected(TOPLEVEL *w_current)
 
     if (o_current) {
       o_redraw_single(w_current, o_current);
+      o_cue_draw_single(w_current, o_current);
     }
     s_current=s_current->next;
   }




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