[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gEDA-dev: [PATCH] gschem: remove unused code



This patch removes most of the unused code from gschem. Please review.
I would also appreciate if original authors would check the remaining
pieces that are still unused. Running git grep '#if 0' with
my patch applied gives:

src/g_hook.c:#if 0 
src/o_copy.c:#if 0
src/o_copy.c:#if 0
src/o_copy.c:#if 0 
src/x_image.c:#if 0

---
 gschem/include/globals.h |   16 ------
 gschem/src/a_zoom.c      |   37 -------------
 gschem/src/g_keys.c      |    9 ---
 gschem/src/g_rc.c        |  105 ------------------------------------
 gschem/src/g_register.c  |    4 --
 gschem/src/i_callbacks.c |   40 --------------
 gschem/src/o_attrib.c    |    6 --
 gschem/src/o_basic.c     |   12 ----
 gschem/src/o_bus.c       |  132 ----------------------------------------------
 gschem/src/o_complex.c   |   38 -------------
 gschem/src/o_cue.c       |    3 -
 gschem/src/o_grips.c     |    7 +--
 gschem/src/o_misc.c      |   13 -----
 gschem/src/o_net.c       |  129 --------------------------------------------
 gschem/src/o_pin.c       |    5 --
 gschem/src/o_select.c    |   14 -----
 gschem/src/o_slot.c      |   11 ----
 gschem/src/o_text.c      |   30 ----------
 gschem/src/x_basic.c     |   43 ---------------
 gschem/src/x_dialog.c    |   22 --------
 gschem/src/x_event.c     |   14 -----
 gschem/src/x_grid.c      |   10 ----
 gschem/src/x_stroke.c    |    8 ---
 gschem/src/x_window.c    |   10 ----
 24 files changed, 1 insertions(+), 717 deletions(-)

diff --git a/gschem/include/globals.h b/gschem/include/globals.h
index bff096b..7830dd5 100644
--- a/gschem/include/globals.h
+++ b/gschem/include/globals.h
@@ -29,22 +29,6 @@ extern GdkVisual *visual;
 extern GdkColor white;
 extern GdkColor black;
 
-#if 0
-extern GdkColor red;
-extern GdkColor green;
-extern GdkColor blue;
-extern GdkColor cyan;
-extern GdkColor yellow;
-extern GdkColor grey;
-extern GdkColor grey90;
-extern GdkColor darkgreen;
-extern GdkColor darkred;
-extern GdkColor darkyellow;
-extern GdkColor darkcyan;
-extern GdkColor darkblue;
-extern GdkColor darkgrey; 
-#endif
-
 extern char *rc_filename; 
 extern char *script_filename;
 extern char *output_filename;
diff --git a/gschem/src/a_zoom.c b/gschem/src/a_zoom.c
index a6f9ac2..23edb4a 100644
--- a/gschem/src/a_zoom.c
+++ b/gschem/src/a_zoom.c
@@ -358,15 +358,6 @@ void correct_aspect(TOPLEVEL *w_current)
         GET_PAGE_WIDTH(w_current) /
         w_current->page_current->coord_aspectratio;
 
-#if 0 /* ER's original zoom extents code */
-      pad_y = (delta_y -
-               delta_x *
-               w_current->page_current->coord_aspectratio) /
-        2;
-      /* widening */
-      w_current->page_current->bottom += pad_y;
-      w_current->page_current->top    -= pad_y;
-#endif
     } else {
 #if DEBUG
       printf("new smaller then coord\n");
@@ -377,16 +368,6 @@ void correct_aspect(TOPLEVEL *w_current)
         w_current->page_current->left +
         GET_PAGE_HEIGHT(w_current) *
         w_current->page_current->coord_aspectratio;
-
-#if 0 /* ER's original zoom extents code */
-      pad_x = (delta_x -
-               delta_y *
-               w_current->page_current->coord_aspectratio) /
-        2;
-      /* shortening */
-      w_current->page_current->right -= pad_x;
-      w_current->page_current->left  += pad_x;
-#endif
     }
 #if DEBUG
     printf("invalid aspectratio corrected\n");
@@ -398,22 +379,4 @@ void correct_aspect(TOPLEVEL *w_current)
 #if DEBUG
   printf("final %f\n", new_aspect);
 #endif
-
-#if 0 /* no longer needed to calc zoom_factor */
-  diff_x = fabs(GET_PAGE_WIDTH(w_current));
-
-#ifdef HAS_RINT
-  zoom_scale = (int) rint(w_current->init_right / diff_x);
-#else
-  zoom_scale = (int)     (w_current->init_right / diff_x);
-#endif
-
-  if (zoom_scale > w_current->max_zoom) {
-    zoom_scale = w_current->max_zoom;
-  }
-  if (zoom_scale < w_current->min_zoom) {
-    zoom_scale = w_current->min_zoom;
-  }
-  w_current->page_current->zoom_factor = zoom_scale;
-#endif
 }
diff --git a/gschem/src/g_keys.c b/gschem/src/g_keys.c
index 5d13beb..e41fbb4 100644
--- a/gschem/src/g_keys.c
+++ b/gschem/src/g_keys.c
@@ -112,11 +112,6 @@ int g_keys_execute(int state, int keyval)
   g_free(guile_string);
   g_free(modifier);
 
-#if 0 /* playing with thi's guile stuff */
-  gh_eval_str("(display (reverse last-command-sequence))");
-  printf("\n");
-#endif
-
   return (SCM_FALSEP (scm_retval)) ? 0 : 1;
 }
 
@@ -251,10 +246,6 @@ DEFINE_G_KEYS(edit_rotate_90)
 DEFINE_G_KEYS(edit_rotate_90_hotkey)
 DEFINE_G_KEYS(edit_mirror)
 DEFINE_G_KEYS(edit_mirror_hotkey)
-#if 0 /* obsolete */
-DEFINE_G_KEYS(edit_stretch)
-DEFINE_G_KEYS(edit_stretch_hotkey)
-#endif
 DEFINE_G_KEYS(edit_slot)
 DEFINE_G_KEYS(edit_color)
 DEFINE_G_KEYS(edit_edit)
diff --git a/gschem/src/g_rc.c b/gschem/src/g_rc.c
index b582106..427bb5f 100644
--- a/gschem/src/g_rc.c
+++ b/gschem/src/g_rc.c
@@ -272,26 +272,6 @@ DEFINE_G_RC_COLOR(g_rc_freestyle_color,
 		  "freestyle-color",
 		  default_dummy)
 
-#if 0
-/*! \deprecated Currently unused.
- *  \todo Finish function documentation!!!
- *  \brief
- *  \par Function Description
- *
- */
-static int vstbl_lookup_val(const vstbl_entry *table, int size, int val)
-{
-  int i;
-
-  for(i = 0; i < size; i++) {
-    if(table[i].m_val == val) {
-      break;
-    }
-  }
-  return i;
-}
-#endif
-
 /*! \todo Finish function documentation!!!
  *  \brief
  *  \par Function Description
@@ -320,19 +300,6 @@ static int vstbl_get_val(const vstbl_entry *table, int index)
   return table[index].m_val;
 }
 
-#if 0
-/*! \deprecated Currently Unused.
- *  \todo Finish function documentation!!!
- *  \brief
- *  \par Function Description
- *
- */
-static const char *vstbl_get_str(const vstbl_entry *table, int index)
-{
-  return table[index].m_str;
-}
-#endif
-
 /*! \todo Finish function documentation!!!
  *  \brief
  *  \par Function Description
@@ -553,39 +520,11 @@ SCM g_rc_text_display_zoomfactor(SCM zoomfactor)
  */
 SCM g_rc_scrollbar_update(SCM scmmode)
 {
-#if 0
-  char *mode;
-  GtkUpdateType policy;
-#endif
   SCM ret = SCM_BOOL_T;
 
   SCM_ASSERT (scm_is_string (scmmode), scmmode,
               SCM_ARG1, "scrollbar-update");
   
-#if 0
-  mode = SCM_STRING_CHARS (scmmode);
-
-  if (strcmp (mode, "continuous") == 0) {
-    policy = GTK_UPDATE_CONTINUOUS;
-    ret = SCM_BOOL_T;
-  } else if (strcmp (mode, "delayed") == 0) {
-    policy = GTK_UPDATE_DELAYED
-    ret = SCM_BOOL_T;
-  } else {
-    fprintf(stderr,
-            _("Invalid mode [%s] passed to scrollbar-update\n"),
-            mode);
-    ret = SCM_BOOL_F;
-  }
-
-  if (ret == SCM_BOOL_T) {
-    gtk_range_set_update_policy (GTK_RANGE (window_current->v_scrollbar),
-                                 policy);
-    gtk_range_set_update_policy (GTK_RANGE (window_current->h_scrollbar),
-                                 policy);
-  }
-#endif
-
   return ret;
 }
 
@@ -778,50 +717,6 @@ SCM g_rc_attribute_name(SCM scm_path)
   return ret;
 }
 
-#if 0
-/*! \deprecated Old obsolete way of handling strokes.
- *  \todo Finish function documentation!!!
- *  \brief
- *  \par Function Description
- *
- */
-SCM g_rc_stroke(SCM scm_stroke, SCM scm_guile_func)
-{
-  SCM ret;
-#ifdef HAS_LIBSTROKE
-  char *stroke;
-
-  SCM_ASSERT (scm_is_string (scm_stroke), scm_stroke,
-              SCM_ARG1, "stroke");
-
-  stroke = SCM_STRING_CHARS (scm_stroke);
-
-  if (!s_stroke_uniq(stroke)) {
-    if (stroke_info_mode) {
-      s_log_message(_("Duplicate stroke definition "
-                    "passed to stroke! [%s]\n"),
-                    stroke);
-      printf(_("Duplicate stroke definition "
-             "passed to stroke! [%s]\n"),
-             stroke);
-    }
-    ret = SCM_BOOL_F;
-  } else {
-    s_stroke_add_entry(stroke, scm_guile_func);
-    ret = SCM_BOOL_T;
-  }
-#else
-  if (stroke_info_mode) {
-    printf(_("A stroke keyword has been found in an rc file, but gschem\n"
-           "is not compiled to support strokes, please recompile gschem\n"
-           "with LibStroke\n"));
-  }
-#endif
-
-  return ret;
-}
-#endif
-
 /*! \todo Finish function documentation!!!
  *  \brief
  *  \par Function Description
diff --git a/gschem/src/g_register.c b/gschem/src/g_register.c
index d369c4c..c9cad7d 100644
--- a/gschem/src/g_register.c
+++ b/gschem/src/g_register.c
@@ -196,10 +196,6 @@ static struct gsubr_t gschem_funcs[] = {
   { "edit-rotate-90-hotkey",     0, 0, 0, g_keys_edit_rotate_90_hotkey },
   { "edit-mirror",               0, 0, 0, g_keys_edit_mirror },
   { "edit-mirror-hotkey",        0, 0, 0, g_keys_edit_mirror_hotkey },
-#if 0 /* Obsolete */
-  { "edit-stretch",              0, 0, 0, g_keys_edit_stretch },
-  { "edit-stretch-hotkey",       0, 0, 0, g_keys_edit_stretch_hotkey },
-#endif
   { "edit-slot",                 0, 0, 0, g_keys_edit_slot },
   { "edit-color",                0, 0, 0, g_keys_edit_color },
   { "edit-edit",                 0, 0, 0, g_keys_edit_edit },
diff --git a/gschem/src/i_callbacks.c b/gschem/src/i_callbacks.c
index f1692fd..cc3477b 100644
--- a/gschem/src/i_callbacks.c
+++ b/gschem/src/i_callbacks.c
@@ -239,16 +239,11 @@ DEFINE_I_CALLBACK(file_new_window)
  */
 DEFINE_I_CALLBACK(file_open)
 {
-
   TOPLEVEL *w_current = (TOPLEVEL *) data;
 
   exit_if_null(w_current);
 
   x_fileselect_open (w_current);
-
-#if 0 /* replaced by above */
-  setup_open_file_selector(w_current);
-#endif
 }
 
 /*! \todo Finish function documentation!!!
@@ -306,12 +301,6 @@ DEFINE_I_CALLBACK(file_save)
   if (strstr(w_current->page_current->page_filename,
              w_current->untitled_name)) {
     x_fileselect_save (w_current);
-#if 0 /* replaced with x_fileselect_setup */
-    setup_saveas_file_selector(
-                               w_current,
-                               SAVEAS,
-                               w_current->page_current->page_filename);
-#endif
   } else {
     x_window_save_page (w_current,
                         w_current->page_current,
@@ -374,12 +363,6 @@ DEFINE_I_CALLBACK(file_save_as)
 
   exit_if_null(w_current);
   x_fileselect_save (w_current);
-
-#if 0 /* replaced with above */
-  setup_saveas_file_selector(w_current,
-                             SAVEAS,
-                             w_current->page_current->page_filename);
-#endif
 }
 
 /*! \todo Finish function documentation!!!
@@ -2226,9 +2209,6 @@ DEFINE_I_CALLBACK(add_component)
 
   x_compselect_open (w_current);
 
-#if 0 /* replaced by above */
-  setup_place_file_selector(w_current);
-#endif
   i_update_middle_button(w_current,
                          i_callback_add_component, _("Component"));
 
@@ -3426,11 +3406,6 @@ DEFINE_I_CALLBACK(cancel)
   /* clear the key guile command-sequence */
   scm_c_eval_string ("(set! current-command-sequence '())");
 
-  /* see above comment hack */
-#if 0
-  set_cursor_normal();
-#endif
-
   if (w_current->inside_action) { 
      o_redraw_all(w_current); 
   }
@@ -3503,21 +3478,6 @@ DEFINE_I_CALLBACK(options_show_coord_window)
   coord_dialog (w_current, mouse_x, mouse_y);
 }
 
-#if 0 /* experimental */
-/*! \todo Finish function documentation!!!
- *  \brief
- *  \par Function Description
- *
- */
-DEFINE_I_CALLBACK(preview)
-{
-  TOPLEVEL *w_current = (TOPLEVEL *) data;
-
-  exit_if_null(w_current);
-  setup_preview(w_current);
-}
-#endif
-
 /* these is a special wrapper function which cannot use the above */
 /* DEFINE_I_CALLBACK macro */
 
diff --git a/gschem/src/o_attrib.c b/gschem/src/o_attrib.c
index e41c487..c847cd8 100644
--- a/gschem/src/o_attrib.c
+++ b/gschem/src/o_attrib.c
@@ -429,12 +429,6 @@ OBJECT *o_attrib_add_attrib(TOPLEVEL *w_current,
         color = w_current->detachedattr_color;
 
 	o_current = NULL;
-
-#if 0 /* don't error out, instead treat text like another OBJECT, but */
-        /* don't attach it anywhere */
-        /* s_log_message("Cannot attach attribute to text item\n");*/
-        /* return(NULL);*/
-#endif
         break;
     }
   } else {
diff --git a/gschem/src/o_basic.c b/gschem/src/o_basic.c
index 57adf68..24639aa 100644
--- a/gschem/src/o_basic.c
+++ b/gschem/src/o_basic.c
@@ -20,12 +20,6 @@
 #include <config.h>
 #include <stdio.h>
 
-/* instrumentation code */
-#if 0
-#include <sys/time.h>
-#include <unistd.h>
-#endif
-
 #include <libgeda/libgeda.h>
 
 #include "../include/x_states.h"
@@ -400,9 +394,6 @@ void o_drawbounding(TOPLEVEL *w_current, OBJECT *o_list, GList *o_glist,
        (w_current->drawbounding_action_mode == FREE)) {
     diff_x = w_current->last_x - w_current->start_x;
     diff_y = w_current->last_y - w_current->start_y;
-#if 0
-    printf("switching to contrained\n");
-#endif
     w_current->drawbounding_action_mode = CONSTRAINED;
 
     if (w_current->actionfeedback_mode == OUTLINE) {
@@ -507,9 +498,6 @@ void o_drawbounding(TOPLEVEL *w_current, OBJECT *o_list, GList *o_glist,
   /* going to free from constrained */
   if ((!w_current->CONTROLKEY) &&
       (w_current->drawbounding_action_mode == CONSTRAINED)) {
-#if 0
-        printf("switching to free\n");
-#endif
         diff_x = w_current->last_x - w_current->start_x;
         diff_y = w_current->last_y - w_current->start_y;
         w_current->drawbounding_action_mode = FREE;
diff --git a/gschem/src/o_bus.c b/gschem/src/o_bus.c
index 953702b..908f489 100644
--- a/gschem/src/o_bus.c
+++ b/gschem/src/o_bus.c
@@ -196,16 +196,6 @@ void o_bus_draw_xor_single(TOPLEVEL *w_current,
   gdk_gc_set_foreground(w_current->outline_xor_gc,
 			x_get_darkcolor(color));
 
-#if 0
-  if (w_current->bus_style == THICK ) {
-    size = SCREENabs(w_current, BUS_WIDTH);
-    gdk_gc_set_line_attributes(w_current->outline_xor_gc, size+1,
-                               GDK_LINE_SOLID,
-                               GDK_CAP_NOT_LAST,
-                               GDK_JOIN_MITER);
-  }
-#endif
-
   if (whichone == 0) {
     dx1 = dx;
     dy1 = dy;
@@ -228,15 +218,6 @@ void o_bus_draw_xor_single(TOPLEVEL *w_current,
                 sx[1]+dx2, sy[1]+dy2);
 
   /* backing store ? not approriate here */
-
-#if 0
-  if (w_current->bus_style == THICK ) {
-    gdk_gc_set_line_attributes(w_current->outline_xor_gc, 0,
-                               GDK_LINE_SOLID,
-                               GDK_CAP_NOT_LAST,
-                               GDK_JOIN_MITER);
-  }
-#endif
 }
 
 /*! \todo Finish function documentation!!!
@@ -251,86 +232,6 @@ void o_bus_start(TOPLEVEL *w_current, int x, int y)
   w_current->last_x = w_current->start_x = fix_x(w_current, x);
   w_current->last_y = w_current->start_y = fix_y(w_current, y);
 
-#if 0 /* not ready for prime time use, this is the snap any point #if 0 */
-  int distance1;
-  int distance2;
-  OBJECT *real;
-  OBJECT *o_current;
-  int temp_x, temp_y;
-  o_current = o_CONN_search_closest_range(w_current,
-                                          w_current->page_current->object_head,
-                                          w_current->start_x, w_current->start_y,
-                                          &temp_x, &temp_y, 200, NULL, NULL);
-
-  if (o_current) {
-    w_current->last_x = w_current->start_x = temp_x;
-    w_current->last_y = w_current->start_y = temp_y;
-  } else {
-    w_current->last_x = w_current->start_x = fix_x(w_current, x);
-    w_current->last_y = w_current->start_y = fix_y(w_current, y);
-  }
-#endif
-
-#if 0 /* not ready for prime time use */
-  /* new bus extenstion stuff */
-  o_current = w_current->page_current->selection_list;
-  if (o_current != NULL && w_current->event_state == STARTDRAWNET) {
-    if (o_current->type == OBJ_BUS) {
-      if (o_current->line) {
-
-        real = o_list_sear( /* ch */
-                           w_current->page_current->object_head,
-                           o_current);
-
-        if (!real) {
-          fprintf(stderr, _("selected a nonexistant object!\n"));
-          exit(-1);
-        }
-        distance1 = dist(
-                         real->line->screen_x[0],
-                         real->line->screen_y[0],
-                         w_current->start_x, w_current->start_y);
-
-        distance2 = dist(
-                         real->line->screen_x[1],
-                         real->line->screen_y[1],
-                         w_current->start_x, w_current->start_y);
-
-        printf("%d %d\n", distance1, distance2);
-
-        if (distance1 < distance2) {
-          w_current->last_x = w_current->start_x =
-            real->line->screen_x[0];
-          w_current->last_y = w_current->start_y =
-            real->line->screen_y[0];
-        } else {
-          w_current->last_x = w_current->start_x =
-            real->line->screen_x[1];
-          w_current->last_y = w_current->start_y =
-            real->line->screen_y[1];
-        }
-      }
-    } else if (o_current->type == OBJ_COMPLEX ||
-               o_current->type == OBJ_PLACEHOLDER) {
-      real = o_list_sear( /* ch */
-                         w_current->page_current->object_head,
-                         o_current);
-
-      if (!real) {
-        fprintf(stderr, _("selected a nonexistant object!\n"));
-        exit(-1);
-      }
-
-      o_CONN_search_closest(w_current, o_current->complex,
-                            w_current->start_x, w_current->start_y,
-                            &temp_x, &temp_y, NULL);
-      w_current->last_x = w_current->start_x = temp_x;
-      w_current->last_y = w_current->start_y = temp_y;
-    }
-
-  }
-#endif
-
   if (w_current->bus_style == THICK ) {
     size = SCREENabs(w_current, BUS_WIDTH);
     gdk_gc_set_line_attributes(w_current->xor_gc, size,
@@ -415,22 +316,6 @@ int o_bus_end(TOPLEVEL *w_current, int x, int y)
          return(FALSE);
        }
 
-#if 0 /* not ready for prime time use */
-  /* second attempt at all snapping */
-  o_current = o_CONN_search_closest_range(w_current,
-                                          w_current->page_current->object_head,
-                                          w_current->last_x, w_current->last_y,
-                                          &temp_x, &temp_y, 200, NULL, NULL);
-
-  if (o_current) {
-    w_current->last_x = temp_x;
-    w_current->last_y = temp_y;
-  } else {
-    w_current->last_x = fix_x(w_current, x);
-    w_current->last_y = fix_y(w_current, y);
-  }
-#endif
-
   gdk_gc_set_foreground(w_current->gc,
 			x_get_color(color));
   gdk_draw_line(w_current->window, w_current->gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
@@ -469,18 +354,6 @@ int o_bus_end(TOPLEVEL *w_current, int x, int y)
   g_list_free(other_objects);
   o_cue_draw_single(w_current, w_current->page_current->object_tail);
 
-  /* this needs to be bus specific... might not be needed */
-#if 0
-  o_bus_conn_erase(w_current, w_current->page_current->object_tail);
-  o_bus_conn_draw(w_current, w_current->page_current->object_tail);
-  o_conn_draw_objects(w_current, w_current->page_current->object_tail);
-
-  if (w_current->net_consolidate == TRUE) {
-    o_bus_consolidate_segments(w_current, 
-                               w_current->page_current->object_tail);
-  }
-#endif
-
   w_current->page_current->CHANGED=1;
   w_current->start_x = w_current->save_x;
   w_current->start_y = w_current->save_y;
@@ -571,11 +444,6 @@ void o_bus_eraserubber(TOPLEVEL *w_current)
                                GDK_JOIN_MITER);
   }
 
-#if 0
-  gdk_gc_set_foreground(w_current->gc,
-			x_get_color(w_current->background_color) );
-#endif
-
   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);
 
   if (w_current->bus_style == THICK ) {
diff --git a/gschem/src/o_complex.c b/gschem/src/o_complex.c
index 6f26434..73fb006 100644
--- a/gschem/src/o_complex.c
+++ b/gschem/src/o_complex.c
@@ -313,9 +313,6 @@ void o_complex_end(TOPLEVEL *w_current, int screen_x, int screen_y)
     g_free(buffer);
 
     if (w_current->actionfeedback_mode == OUTLINE) {
-#if 0
-      printf("inside draw outline here\n");
-#endif
       /* erase outline */
       
       o_complex_translate_display_object_glist(w_current,
@@ -323,9 +320,6 @@ void o_complex_end(TOPLEVEL *w_current, int screen_x, int screen_y)
 					       w_current->page_current->
 					       complex_place_list); 
     } else {
-#if 0
-      printf("inside draw bounding here\n");
-#endif
       world_get_object_glist_bounds(w_current,
 			      w_current->page_current->
 			      complex_place_list,
@@ -407,17 +401,11 @@ void o_complex_end(TOPLEVEL *w_current, int screen_x, int screen_y)
 
   /* check for nulls in all this hack */
   if (w_current->actionfeedback_mode == OUTLINE) {
-#if 0
-    printf("inside draw outline here\n");
-#endif
     /* erase outline */
     o_complex_translate_display_object_glist(w_current,
 					     diff_x, diff_y,
 					     w_current->page_current->complex_place_list);
   } else {
-#if 0
-    printf("inside draw bounding here\n");
-#endif
     world_get_object_glist_bounds(w_current,
                                   w_current->page_current->complex_place_list,
                                   &w_rleft, &w_rtop,
@@ -681,12 +669,6 @@ void o_complex_translate_all(TOPLEVEL *w_current, int offset)
 
   /* this is an experimental mod, to be able to translate to all
    * places */
-#if 0
-  o_complex_world_translate(1000, 1000, object_head);
-  printf("symbol -%d -%d\n", x, y);
-  o_complex_world_translate(-x, -y, object_head); /* to zero, zero */
-#endif
-
   a_zoom_extents(w_current, w_current->page_current->object_head, 
                  A_PAN_DONT_REDRAW);
   o_unselect_all(w_current);
@@ -783,42 +765,22 @@ int o_complex_mirror_world(TOPLEVEL *w_current, int world_centerx, int world_cen
   switch(object->complex->angle) {
     case(90):
       object->complex->angle = 270;
-#if 0
-      o_text_change_angle(w_current, object->complex->prim_objs,
-                          object->complex->angle);
-#endif
-
       change = 1;
       break;
 
     case(270):
       object->complex->angle = 90;
-#if 0
-      o_text_change_angle(w_current, object->complex->prim_objs
-                          object->complex->angle);
-#endif
       change = 1;
       break;
 
   }
-#if 0
-  object->complex->angle = (object->complex->angle + 180) % 360;
-#endif
 
   object->complex->mirror = !object->complex->mirror;
-#if 0
-  object->complex->x = 0;
-  object->complex->y = 0;
-#endif
 
   o_complex_world_translate_toplevel(w_current, x, y, object);
 
 #if DEBUG
   printf("final res %d %d\n", object->complex->x,  object->complex->y);
 #endif
-#if 0
-  object->complex->x = x;
-  object->complex->y = y;
-#endif
   return(change);
 }
diff --git a/gschem/src/o_cue.c b/gschem/src/o_cue.c
index f51f995..cb624c7 100644
--- a/gschem/src/o_cue.c
+++ b/gschem/src/o_cue.c
@@ -103,9 +103,6 @@ void o_cue_draw_lowlevel(TOPLEVEL *w_current, OBJECT *object, int whichone)
     conn = (CONN *) cl_current->data;
    
     if (conn->x == x && conn->y == y) {
-#if 0
-      printf("type: %d x: %d y: %d cx: %d cy: %d\n", conn->type, x, y, conn->x, conn->y);
-#endif
       switch(conn->type) {
         
         case(CONN_ENDPOINT):
diff --git a/gschem/src/o_grips.c b/gschem/src/o_grips.c
index d29c490..698a0d4 100644
--- a/gschem/src/o_grips.c
+++ b/gschem/src/o_grips.c
@@ -147,13 +147,8 @@ OBJECT *o_grips_search_world(TOPLEVEL *w_current, int x, int y, int *whichone)
           if(found != NULL) return found;
           break;
 
-#if 0 
-      /* This code is wrong.  Continue searching even if the object */
-      /* does not have grips */
         default:
-          /* object type is unknown : error condition */
-          return NULL;
-#endif
+          break;
       }
     }
     s_current = s_current->next;	
diff --git a/gschem/src/o_misc.c b/gschem/src/o_misc.c
index 565165f..a394585 100644
--- a/gschem/src/o_misc.c
+++ b/gschem/src/o_misc.c
@@ -683,10 +683,6 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
 
       case(OBJ_ARC):
         o_arc_erase(w_current, object);
-#if 0 /* not needed anymore */
-	SCREENtoWORLD(w_current, centerx, centery, 
-		      &world_centerx, &world_centery);
-#endif
         o_arc_mirror_world(w_current, centerx, centery, object);
         o_arc_draw(w_current, object);
         break;
@@ -930,15 +926,6 @@ int o_edit_find_text(TOPLEVEL * w_current, OBJECT * o_list, char *stext,
      /* replaced strcmp with strstr to simplify the search */
       if (strstr(o_current->text->string,stext)) {
 	if (!skiplast) {
-
-#if 0 /* replaced by code below by avh, might not quite be right though */
-	  set_window(w_current, o_current->text->x - FIND_WINDOW_HALF_SIZE,
-		     o_current->text->x + FIND_WINDOW_HALF_SIZE,
-		     o_current->text->y - FIND_WINDOW_HALF_SIZE,
-		     o_current->text->y + FIND_WINDOW_HALF_SIZE);
-          correct_aspect(w_current);
-
-#endif
           a_zoom(w_current, ZOOM_FULL, DONTCARE, A_PAN_DONT_REDRAW);
           text_screen_height =  SCREENabs(w_current,
                                           o_text_height(o_current->
diff --git a/gschem/src/o_net.c b/gschem/src/o_net.c
index 96a7f23..b27f0ed 100644
--- a/gschem/src/o_net.c
+++ b/gschem/src/o_net.c
@@ -241,16 +241,6 @@ void o_net_draw_xor_single(TOPLEVEL *w_current, int dx, int dy, int whichone,
   gdk_gc_set_foreground(w_current->outline_xor_gc,
 			x_get_darkcolor(color));
 
-#if 0 /* if I had this enabled, than xoring would leave a lot of mouse drops */
-  if (w_current->net_style == THICK ) {
-    size = SCREENabs(w_current, NET_WIDTH);
-    gdk_gc_set_line_attributes(w_current->outline_xor_gc, size+1,
-                               GDK_LINE_SOLID,
-                               GDK_CAP_NOT_LAST,
-                               GDK_JOIN_MITER);
-  }
-#endif
-
   if (whichone == 0) {
     dx1 = dx;
     dy1 = dy;
@@ -273,15 +263,6 @@ void o_net_draw_xor_single(TOPLEVEL *w_current, int dx, int dy, int whichone,
                 sx[1]+dx2, sy[1]+dy2);
 
   /* backing store ? not approriate here */
-
-#if 0 /* if I had this enabled, than xoring would leave a lot of mouse drops */
-  if (w_current->net_style == THICK ) {
-    gdk_gc_set_line_attributes(w_current->outline_xor_gc, 0,
-                               GDK_LINE_SOLID,
-                               GDK_CAP_NOT_LAST,
-                               GDK_JOIN_MITER);
-  }
-#endif
 }
 
 /*! \todo Finish function documentation!!!
@@ -299,86 +280,6 @@ void o_net_start(TOPLEVEL *w_current, int x, int y)
   w_current->last_y = w_current->start_y = w_current->second_y = 
     fix_y(w_current, y);
 
-#if 0 /* not ready for prime time use, this is the snap any point #if 0 */
-  int distance1;
-  int distance2;
-  OBJECT *real;
-  OBJECT *o_current;
-  int temp_x, temp_y;
-  o_current = o_CONN_search_closest_range(w_current,
-                                          w_current->page_current->object_head,
-                                          w_current->start_x, w_current->start_y,
-                                          &temp_x, &temp_y, 200, NULL, NULL);
-
-  if (o_current) {
-    w_current->last_x = w_current->start_x = temp_x;
-    w_current->last_y = w_current->start_y = temp_y;
-  } else {
-    w_current->last_x = w_current->start_x = fix_x(w_current, x);
-    w_current->last_y = w_current->start_y = fix_y(w_current, y);
-  }
-#endif
-
-#if 0 /* not ready for prime time use */
-  /* new net extenstion stuff */
-  o_current = (OBJECT *) w_current->page_current->selection_list->data;
-  if (o_current != NULL && w_current->event_state == STARTDRAWNET) {
-    if (o_current->type == OBJ_NET) {
-      if (o_current->line) {
-
-        real = o_list_sear( /* ch */ 
-                           w_current->page_current->object_head,
-                           o_current);
-
-        if (!real) {
-          fprintf(stderr, _("selected a nonexistant object!\n"));
-          exit(-1);
-        }
-        distance1 = dist(
-                         real->line->screen_x[0],
-                         real->line->screen_y[0],
-                         w_current->start_x, w_current->start_y);
-
-        distance2 = dist(
-                         real->line->screen_x[1],
-                         real->line->screen_y[1],
-                         w_current->start_x, w_current->start_y);
-
-        printf("%d %d\n", distance1, distance2);
-
-        if (distance1 < distance2) {
-          w_current->last_x = w_current->start_x =
-            real->line->screen_x[0];
-          w_current->last_y = w_current->start_y =
-            real->line->screen_y[0];
-        } else {
-          w_current->last_x = w_current->start_x =
-            real->line->screen_x[1];
-          w_current->last_y = w_current->start_y =
-            real->line->screen_y[1];
-        }
-      }
-    } else if (o_current->type == OBJ_COMPLEX || 
-               o_current->type == OBJ_PLACEHOLDER) {
-      real = o_list_sear( /* ch */
-                         w_current->page_current->object_head,
-                         o_current);
-
-      if (!real) {
-        fprintf(stderr, _("selected a nonexistant object!\n"));
-        exit(-1);
-      }
-
-      o_CONN_search_closest(w_current, o_current->complex,
-                            w_current->start_x, w_current->start_y,
-                            &temp_x, &temp_y, NULL);
-      w_current->last_x = w_current->start_x = temp_x;
-      w_current->last_y = w_current->start_y = temp_y;
-    }
-
-  }
-#endif
-
   if (w_current->net_style == THICK ) {
     size = SCREENabs(w_current, NET_WIDTH);
     gdk_gc_set_line_attributes(w_current->xor_gc, size,
@@ -488,23 +389,6 @@ int o_net_end(TOPLEVEL *w_current, int x, int y)
     
     return (FALSE);
   }
-#if 0				/* not ready for prime time use */
-  /* second attempt at all snapping */
-  o_current = o_CONN_search_closest_range(w_current,
-					  w_current->page_current->
-					  object_head, w_current->last_x,
-					  w_current->last_y, &temp_x,
-					  &temp_y, 200, NULL, NULL);
-
-  if (o_current) {
-    w_current->last_x = temp_x;
-    w_current->last_y = temp_y;
-  } else {
-    w_current->last_x = fix_x(w_current, x);
-    w_current->last_y = fix_y(w_current, y);
-  }
-#endif
-
 
   /* Primary net runs from (x1,y1)-(x2,y2) */
   /* Secondary net from (x2,y2)-(x3,y3) */
@@ -645,14 +529,6 @@ int o_net_end(TOPLEVEL *w_current, int x, int y)
   w_current->start_y = w_current->save_y;
   o_undo_savestate(w_current, UNDO_ALL);
 
-#if 0				/* a false attempt at ending the rubberbanding.. */
-  if (conn_count) {
-    w_current->inside_action = 0;
-    i_set_state(w_current, STARTDRAWNET);
-    o_net_eraserubber(w_current);
-  }
-#endif
-
   return (TRUE);
 }
 
@@ -765,11 +641,6 @@ void o_net_eraserubber(TOPLEVEL *w_current)
 			       GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
   }
 
-#if 0
-  gdk_gc_set_foreground(w_current->gc,
-			x_get_color(w_current->background_color));
-#endif
-
   /* Erase primary primary rubber net line */
   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);
diff --git a/gschem/src/o_pin.c b/gschem/src/o_pin.c
index 40f8111..ec871ec 100644
--- a/gschem/src/o_pin.c
+++ b/gschem/src/o_pin.c
@@ -357,11 +357,6 @@ void o_pin_eraserubber(TOPLEVEL *w_current)
                                GDK_JOIN_MITER);
   }
 
-#if 0
-  gdk_gc_set_foreground(w_current->xor_gc,
-			x_get_color(w_current->background_color) );
-#endif
-
   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);
 
   if (w_current->net_style == THICK ) {
diff --git a/gschem/src/o_select.c b/gschem/src/o_select.c
index 60ebd2b..f90c1b9 100644
--- a/gschem/src/o_select.c
+++ b/gschem/src/o_select.c
@@ -280,13 +280,6 @@ void o_select_box_end(TOPLEVEL *w_current, int x, int y)
   int box_width, box_height;
   int box_left, box_top;
 
-#if 0
-  if (w_current->inside_action == 0) {
-    o_redraw(w_current, w_current->page_current->object_head, TRUE);
-    return;
-  }
-#endif
-
   box_width = abs(w_current->last_x - w_current->start_x);
   box_height = abs(w_current->last_y - w_current->start_y);	
 
@@ -322,13 +315,6 @@ void o_select_box_rubberband(TOPLEVEL *w_current, int x, int y)
   int box_width, box_height;
   int box_left, box_top;
 
-#if 0
-  if (w_current->inside_action == 0) {
-    o_redraw(w_current, w_current->page_current->object_head, TRUE);
-    return;
-  }
-#endif
-
   box_width = abs(w_current->last_x - w_current->start_x);
   box_height = abs(w_current->last_y - w_current->start_y);
 
diff --git a/gschem/src/o_slot.c b/gschem/src/o_slot.c
index c30bb3b..da09198 100644
--- a/gschem/src/o_slot.c
+++ b/gschem/src/o_slot.c
@@ -226,17 +226,6 @@ void o_slot_end(TOPLEVEL *w_current, char *string, int len)
     o_erase_single(w_current, object);
     o_attrib_slot_update(w_current, object);
 
-
-#if 0 /* NEWSEL */
-    /* why? */
-    /* erase the selection list */
-    o_erase_selected(w_current);
-
-    o_attrib_slot_copy(w_current, object,
-                       w_current->page_current->selection_list);
-    o_redraw_single(w_current,object);
-#endif
-
     o_redraw_single(w_current,object);
 
     w_current->page_current->CHANGED = 1;
diff --git a/gschem/src/o_text.c b/gschem/src/o_text.c
index 9a777ed..e81de34 100644
--- a/gschem/src/o_text.c
+++ b/gschem/src/o_text.c
@@ -117,24 +117,6 @@ void o_text_draw_rectangle(TOPLEVEL *w_current, OBJECT *o_current)
                         right - left,
                         bottom - top );
   }
-
-#if 0 /* in prep for future performance enhancement */
-  right = right+left;
-  bottom = bottom+top;
-  o_current->left   = min(left, right);
-  o_current->top    = min(top, bottom);
-  o_current->right  = max(left, right);
-  o_current->bottom = max(top, bottom);
-  
-  printf("%d %d %d %d\n", left, top, right, bottom);
-  
-  WORLDtoSCREEN(w_current,
-                o_current->text->x,
-                o_current->text->y,
-                &o_current->text->screen_x,
-                &o_current->text->screen_y);
-#endif
-
 }
 
 /*! \todo Finish function documentation!!!
@@ -156,18 +138,6 @@ void o_text_draw(TOPLEVEL *w_current, OBJECT *o_current)
   }
 
   if (!w_current->fast_mousepan || !w_current->doing_pan) {
-
-#if 0 /* in prep for future performance enhancement... */
-    int pixel_height;
-    pixel_height = SCREENabs(w_current, 26*o_current->text->size/2);
-    if (pixel_height < 4 /* && w_current->text_rectangle */)
-    {
-      o_text_draw_rectangle(w_current, o_current);
-    } else {
-      o_text_draw_lowlevel(w_current, o_current);
-    }
-#endif
-    
     o_text_draw_lowlevel(w_current, o_current);
 
     /* Indicate on the schematic that the text is invisible by */
diff --git a/gschem/src/x_basic.c b/gschem/src/x_basic.c
index b517748..b720904 100644
--- a/gschem/src/x_basic.c
+++ b/gschem/src/x_basic.c
@@ -36,49 +36,6 @@
 #include <gdk/gdkx.h>
 #endif
 
-#if 0 /* once you are sure your new color system works... delete code */
-/*! \todo Finish function documentation!!!
- *  \brief
- *  \par Function Description
- *
- */
-GdkColor *x_get_color(int color)
-{
-  switch(color) {
-    case(RED):    return(&red   ); break;
-    case(BLUE):   return(&blue  ); break;
-    case(GREEN):  return(&green ); break;
-    case(YELLOW): return(&yellow); break;
-    case(CYAN):   return(&cyan  ); break;
-    case(GREY):   return(&grey  ); break;
-    case(GREY90): return(&grey90); break;
-    case(BLACK):  return(&black ); break;
-    case(WHITE):  return(&white ); break;
-    default:      return(&white ); break;
-  }
-}
-
-/*! \todo Finish function documentation!!!
- *  \brief
- *  \par Function Description
- *
- */
-GdkColor *x_get_darkcolor(int color)
-{
-  switch(color) {
-    case(RED):    return(&darkred   ); break;
-    case(BLUE):   return(&darkblue  ); break;
-    case(GREEN):  return(&darkgreen ); break;
-    case(YELLOW): return(&darkyellow); break;
-    case(CYAN):   return(&darkcyan  ); break;
-    case(GREY):   return(&darkgrey  ); break;
-    case(BLACK):  return(&black     ); break;
-    case(WHITE):  return(&grey      ); break;
-    default:      return(&white     ); break;
-  }
-}
-#endif
-
 /*! \todo Finish function documentation!!!
  *  \brief
  *  \par Function Description
diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index 511630c..ed0ed50 100644
--- a/gschem/src/x_dialog.c
+++ b/gschem/src/x_dialog.c
@@ -2612,13 +2612,6 @@ extern GtkWidget *stwindow;
  */
 void x_dialog_raise_all(TOPLEVEL *w_current)
 {
-
-#if 0 /* don't raise the log window */
-  if (stwindow) {
-    gdk_window_raise(stwindow->window);
-  }
-#endif
-
   if(w_current->fowindow) {
     gdk_window_raise(w_current->fowindow->window);
   }
@@ -2635,25 +2628,10 @@ void x_dialog_raise_all(TOPLEVEL *w_current)
     gdk_window_raise(w_current->cswindow->window);
   }
 
-#if 0 /* don't raise these windows ever */ 
-  if(w_current->fileselect[FILESELECT].xfwindow) {
-    gdk_window_raise(w_current->fileselect[FILESELECT].xfwindow->window);
-  }
-  if(w_current->fileselect[COMPSELECT].xfwindow) {
-    gdk_window_raise(w_current->fileselect[COMPSELECT].xfwindow->window);
-  }
-#endif
-
   if(w_current->iwindow) {
     gdk_window_raise(w_current->iwindow->window);
   }
 
-#if 0 /* don't raise the page manager window */
-  if(w_current->pswindow) {
-    gdk_window_raise(w_current->pswindow->window);
-  }
-#endif
-
   if(w_current->tiwindow) {
     gdk_window_raise(w_current->tiwindow->window);
   }
diff --git a/gschem/src/x_event.c b/gschem/src/x_event.c
index ac036ae..b3aa1ab 100644
--- a/gschem/src/x_event.c
+++ b/gschem/src/x_event.c
@@ -377,15 +377,6 @@ gint x_event_button_pressed(GtkWidget *widget, GdkEventButton *event,
         }
         break;
 
-#if 0 /* old way with the text dialog box which was around only once */
-      case(DRAWTEXT):
-        w_current->start_x = fix_x(w_current, (int) event->x);
-        w_current->start_y = fix_y(w_current, (int) event->y);
-        o_text_input(w_current);
-        w_current->inside_action = 1;
-        break;
-#endif
-
       case(ENDCOMP):
         o_complex_end(w_current,
                       fix_x(w_current, (int) event->x),
@@ -1012,11 +1003,6 @@ gint x_event_motion(GtkWidget *widget, GdkEventMotion *event,
          pdiff_x = mouse_x - start_pan_x;
          pdiff_y = mouse_y - start_pan_y;
 
-#if 0
-         printf("current center: %d %d\n", current_center_x, current_center_y);
-         printf("pdiff: %d %d\n", pdiff_x, pdiff_y);
-#endif
-
          if (!(throttle % 5)) {
            a_pan_mouse(w_current, pdiff_x*w_current->mousepan_gain, 
                        pdiff_y*w_current->mousepan_gain);
diff --git a/gschem/src/x_grid.c b/gschem/src/x_grid.c
index 337df3f..58a0666 100644
--- a/gschem/src/x_grid.c
+++ b/gschem/src/x_grid.c
@@ -154,16 +154,6 @@ void x_grid_draw(TOPLEVEL *w_current)
                     w_current->gc, points, count);
   }
 
-#if 0
-  gdk_draw_pixmap(w_current->window,
-                  w_current->gc,
-                  w_current->backingstore,
-                  0, 0, 0, 0,
-                  w_current->drawing_area->allocation.width,
-                  w_current->drawing_area->allocation.height);
-
-#endif
-
 #if DEBUG
   /* highly temp, just for diag purposes */
   x_draw_tiles(w_current);
diff --git a/gschem/src/x_stroke.c b/gschem/src/x_stroke.c
index 2ab0df0..1351ba2 100644
--- a/gschem/src/x_stroke.c
+++ b/gschem/src/x_stroke.c
@@ -61,14 +61,6 @@ void x_stroke_add_point(TOPLEVEL *w_current, int x, int y)
     stroke_points = new_point;
   }
 
-  /* having this xored was causing some grief; when you zoomed
-   * or changed the display, there would be point droppings, so
-   * that's why this isn't xor */
-#if 0
-  gdk_gc_set_foreground(w_current->xor_gc,
-                        x_get_color(w_current->stroke_color));
-#endif
-
   gdk_gc_set_foreground(w_current->gc,
                         x_get_color(w_current->stroke_color));
 
diff --git a/gschem/src/x_window.c b/gschem/src/x_window.c
index d7cd9c0..ef9d274 100644
--- a/gschem/src/x_window.c
+++ b/gschem/src/x_window.c
@@ -446,16 +446,6 @@ void x_window_create_main(TOPLEVEL *w_current)
    if( auto_place_mode )
    	gtk_widget_set_uposition (w_current->main_window, 10, 10);
 
-  /* I could not get the destroy signal to work. always got a: */
-  /* Gdk-ERROR **: an x io error occurred */
-  /* aborting... */
-  /* message */
-#if 0
-  gtk_signal_connect (GTK_OBJECT (w_current->main_window), "destroy",
-                      GTK_SIGNAL_FUNC(i_callback_destroy_wm),
-                      w_current);
-#endif
-
   /* this should work fine */
   gtk_signal_connect (GTK_OBJECT (w_current->main_window), "delete_event",
                       GTK_SIGNAL_FUNC (i_callback_close_wm),
-- 
1.5.2.2



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