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

gEDA-cvs: gaf.git: branch: master updated (1.7.1-20110619-176-gd1b632e)



The branch, master has been updated
       via  d1b632e03de0610209e24d8c72ccb37beb3c4aa3 (commit)
      from  bdb529ee1c070c0119cafbd143e067d2aea99457 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gschem/include/gschem_struct.h |    5 +--
 gschem/include/prototype.h     |    9 ++--
 gschem/src/i_basic.c           |    4 +-
 gschem/src/o_bus.c             |   18 ++++++-
 gschem/src/o_move.c            |   99 ++++++++++++----------------------------
 gschem/src/o_net.c             |   18 ++++++-
 gschem/src/s_stretch.c         |   38 ++-------------
 7 files changed, 73 insertions(+), 118 deletions(-)


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

commit d1b632e03de0610209e24d8c72ccb37beb3c4aa3
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Revert the last four commits - pushed by accident
    
    Those last four commits weren't ready for prime-time yet.
    
    This reverts:
    
        commit bdb529ee1c070c0119cafbd143e067d2aea99457
        commit 7b4bd14b22cb890cfc156ef83678fef44e41afad
        commit a909848f6efd539c10348f23f1b01ae35882a956
        commit 50365b0d5da45201a834574441cdc02f0181db2a
    
    Thanks to Peter Brett for spotting my mistake.

:100644 100644 7a92209... 5f241e0... M	gschem/include/gschem_struct.h
:100644 100644 7122893... 463c709... M	gschem/include/prototype.h
:100644 100644 f44e4e9... e6a3add... M	gschem/src/i_basic.c
:100644 100644 9bfeba7... 666669e... M	gschem/src/o_bus.c
:100644 100644 d744a5c... 00865ed... M	gschem/src/o_move.c
:100644 100644 20aba7d... d4b1b27... M	gschem/src/o_net.c
:100644 100644 9d4a384... 4bbf39e... M	gschem/src/s_stretch.c

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

commit d1b632e03de0610209e24d8c72ccb37beb3c4aa3
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Revert the last four commits - pushed by accident
    
    Those last four commits weren't ready for prime-time yet.
    
    This reverts:
    
        commit bdb529ee1c070c0119cafbd143e067d2aea99457
        commit 7b4bd14b22cb890cfc156ef83678fef44e41afad
        commit a909848f6efd539c10348f23f1b01ae35882a956
        commit 50365b0d5da45201a834574441cdc02f0181db2a
    
    Thanks to Peter Brett for spotting my mistake.

diff --git a/gschem/include/gschem_struct.h b/gschem/include/gschem_struct.h
index 7a92209..5f241e0 100644
--- a/gschem/include/gschem_struct.h
+++ b/gschem/include/gschem_struct.h
@@ -216,8 +216,5 @@ struct st_gschem_toplevel {
 struct st_stretch
 {
   OBJECT *object;
-  int x1_percent;
-  int y1_percent;
-  int x2_percent;
-  int y2_percent;
+  int whichone;
 };
diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 7122893..463c709 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -517,7 +517,7 @@ void o_buffer_free(GSCHEM_TOPLEVEL *w_current);
 /* o_bus.c */
 void o_bus_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
 void o_bus_draw_place(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
-void o_bus_draw_stretch(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int dx1, int dy1, int dx2, int dy2);
+void o_bus_draw_stretch(GSCHEM_TOPLEVEL *w_current, int dx, int dy, int whichone, OBJECT *o_current);
 void o_bus_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
 int o_bus_end(GSCHEM_TOPLEVEL *w_current, int x, int y);
 void o_bus_motion(GSCHEM_TOPLEVEL *w_current, int x, int y);
@@ -610,7 +610,7 @@ void o_move_end_rubberband(GSCHEM_TOPLEVEL *w_current, int world_diff_x, int wor
 void o_net_reset(GSCHEM_TOPLEVEL *w_current); 
 void o_net_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
 void o_net_draw_place(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
-void o_net_draw_stretch(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int dx1, int dy1, int dx2, int dy2);
+void o_net_draw_stretch(GSCHEM_TOPLEVEL *w_current, int dx, int dy, int whichone, OBJECT *o_current);
 void o_net_guess_direction(GSCHEM_TOPLEVEL *w_current, int x, int y);
 void o_net_find_magnetic(GSCHEM_TOPLEVEL *w_current, int event_x, int event_y);
 void o_net_finishmagnetic(GSCHEM_TOPLEVEL *w_current);
@@ -697,11 +697,10 @@ void o_undo_remove_last_undo(GSCHEM_TOPLEVEL *w_current);
 /* parsecmd.c */
 int parse_commandline(int argc, char *argv[]);
 /* s_stretch.c */
-GList *s_stretch_add(GList *list, OBJECT *object, int x1_percent, int y1_percent, int x2_percent, int y2_percent);
-GList *s_stretch_remove_object(GList *list, OBJECT *object);
+GList *s_stretch_add(GList *list, OBJECT *object, int whichone);
+GList *s_stretch_remove(GList *list, OBJECT *object);
 void s_stretch_print_all(GList *list);
 void s_stretch_destroy_all(GList *list);
-void s_stretch_calc_deltas(GSCHEM_TOPLEVEL *w_current, STRETCH *stretch, int diff_x, int diff_y, int *dx1, int *dy1, int *dx2, int *dy2);
 /* x_attribedit.c */
 gint option_menu_get_history(GtkOptionMenu *option_menu);
 void attrib_edit_dialog_ok(GtkWidget *w, GSCHEM_TOPLEVEL *w_current);
diff --git a/gschem/src/i_basic.c b/gschem/src/i_basic.c
index f44e4e9..e6a3add 100644
--- a/gschem/src/i_basic.c
+++ b/gschem/src/i_basic.c
@@ -40,8 +40,6 @@
  */
 static void i_update_status(GSCHEM_TOPLEVEL *w_current, const char *string)
 {
-  return;
-
   if (!w_current->status_label)
     return;
 
@@ -589,7 +587,7 @@ void i_update_grid_info (GSCHEM_TOPLEVEL *w_current)
   }
 
   print_string = g_strdup_printf(_("Grid(%s, %s)"), snap, grid);
-//  gtk_label_set(GTK_LABEL(w_current->grid_label), print_string);
+  gtk_label_set(GTK_LABEL(w_current->grid_label), print_string);
   
   g_free(print_string);
   g_free(grid);
diff --git a/gschem/src/o_bus.c b/gschem/src/o_bus.c
index 9bfeba7..666669e 100644
--- a/gschem/src/o_bus.c
+++ b/gschem/src/o_bus.c
@@ -96,13 +96,27 @@ void o_bus_draw_place (GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_cur
  *  \par Function Description
  *
  */
-void o_bus_draw_stretch (GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
-                         int dx1, int dy1, int dx2, int dy2)
+void o_bus_draw_stretch (GSCHEM_TOPLEVEL *w_current,
+                         int dx, int dy, int whichone, OBJECT *o_current)
 {
+  int dx1= - 1, dy1 = - 1, dx2 = -1, dy2 = -1;
+
   if (o_current->line == NULL) {
     return;
   }
 
+  if (whichone == 0) {
+    dx1 = dx;
+    dy1 = dy;
+    dx2 = dy2 = 0;
+  } else if (whichone == 1) {
+    dx1 = dy1 = 0;
+    dx2 = dx;
+    dy2 = dy;
+  } else {
+    fprintf(stderr, _("Got an invalid which one in o_bus_draw_stretch\n"));
+  }
+
   gschem_cairo_line (w_current, END_NONE, 0,
                      o_current->line->x[0] + dx1, o_current->line->y[0] + dy1,
                      o_current->line->x[1] + dx2, o_current->line->y[1] + dy2);
diff --git a/gschem/src/o_move.c b/gschem/src/o_move.c
index d744a5c..00865ed 100644
--- a/gschem/src/o_move.c
+++ b/gschem/src/o_move.c
@@ -339,16 +339,12 @@ void o_move_motion (GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
 void o_move_invalidate_rubber (GSCHEM_TOPLEVEL *w_current, int drawing)
 {
   GList *s_iter;
-  int diff_x, diff_y;
   int dx1, dx2, dy1, dy2;
   int x1, y1, x2, y2;
 
   o_place_invalidate_rubber (w_current, drawing);
   if (w_current->netconn_rubberband) {
 
-    diff_x = w_current->second_wx - w_current->first_wx;
-    diff_y = w_current->second_wy - w_current->first_wy;
-
     for (s_iter = w_current->stretch_list;
          s_iter != NULL; s_iter = g_list_next (s_iter)) {
       STRETCH *s_current = s_iter->data;
@@ -357,8 +353,15 @@ void o_move_invalidate_rubber (GSCHEM_TOPLEVEL *w_current, int drawing)
       switch (object->type) {
         case (OBJ_NET):
         case (OBJ_BUS):
-          s_stretch_calc_deltas (w_current, s_current,
-                                 diff_x, diff_y, &dx1, &dy1, &dx2, &dy2);
+          if (s_current->whichone == 0) {
+            dx1 = w_current->second_wx - w_current->first_wx;
+            dy1 = w_current->second_wy - w_current->first_wy;
+            dx2 = dy2 = 0;
+          } else {
+            dx1 = dy1 = 0;
+            dx2 = w_current->second_wx - w_current->first_wx;
+            dy2 = w_current->second_wy - w_current->first_wy;
+          }
 
           WORLDtoSCREEN (w_current, object->line->x[0] + dx1,
                                     object->line->y[0] + dy1, &x1, &y1);
@@ -381,7 +384,6 @@ void o_move_draw_rubber (GSCHEM_TOPLEVEL *w_current, int drawing)
 {
   GList *s_iter;
   int diff_x, diff_y;
-  int dx1, dy1, dx2, dy2;
 
   o_place_draw_rubber (w_current, drawing);
 
@@ -395,17 +397,15 @@ void o_move_draw_rubber (GSCHEM_TOPLEVEL *w_current, int drawing)
        s_iter != NULL; s_iter = g_list_next (s_iter)) {
     STRETCH *s_current = s_iter->data;
     OBJECT *object = s_current->object;
-
-    s_stretch_calc_deltas (w_current, s_current,
-                           diff_x, diff_y, &dx1, &dy1, &dx2, &dy2);
+    int whichone = s_current->whichone;
 
     switch (object->type) {
       case (OBJ_NET):
-        o_net_draw_stretch (w_current, object, dx1, dy1, dx2, dy2);
+        o_net_draw_stretch (w_current, diff_x, diff_y, whichone, object);
         break;
 
       case (OBJ_BUS):
-        o_bus_draw_stretch (w_current, object, dx1, dy1, dx2, dy2);
+        o_bus_draw_stretch (w_current, diff_x, diff_y, whichone, object);
         break;
     }
   }
@@ -432,22 +432,6 @@ int o_move_return_whichone(OBJECT * object, int x, int y)
   return (-1);
 }
 
-
-static GList *add_dummy_stretch_net (GSCHEM_TOPLEVEL *w_current,
-                                     GList *new_nets, CONN *conn,
-                                     int x1_percent, int y1_percent,
-                                     int x2_percent, int y2_percent)
-{
-  OBJECT *new_net = o_net_new (w_current->toplevel, OBJ_NET, NET_COLOR,
-                               conn->x, conn->y, conn->x, conn->y);
-
-  w_current->stretch_list = s_stretch_add (w_current->stretch_list, new_net,
-                                           x1_percent, y1_percent,
-                                           x2_percent, y2_percent);
-
-  return g_list_prepend (new_nets, new_net);
-}
-
 /*! \todo Finish function documentation!!!
  *  \brief
  *  \par Function Description
@@ -460,7 +444,6 @@ void o_move_check_endpoint(GSCHEM_TOPLEVEL *w_current, OBJECT * object)
   CONN *c_current;
   OBJECT *other;
   int whichone;
-  GList *new_nets = NULL;
 
   if (!object)
   return;
@@ -502,39 +485,24 @@ void o_move_check_endpoint(GSCHEM_TOPLEVEL *w_current, OBJECT * object)
      /* (object->type == OBJ_NET &&
           other->type == OBJ_PIN && other->pin_type == PIN_TYPE_NET) */
 
-      /* other object is a pin, insert some nets to take up the slack */
-
-      /* This new net objects are explicitly added with the appropriate
-       * coefficients for them to take up the stretch between the pins.
-       * These nets become added to the page's connectivity list when
-       * they are added to the page at the end of this function, but won't
-       * really be important until they are rubber-banded into place.
-       *
-       * If the move operation is cancelled, the dummy 0 length nets
-       * are removed by the "undo" operation invoked.
-       *
-       * The following isn't a complete, there needs to be far better
-       * heuristics to adding these intermediate stretch nets.
+      OBJECT *new_net;
+      /* other object is a pin, insert a net */
+      new_net = o_net_new (toplevel, OBJ_NET, NET_COLOR,
+                           c_current->x, c_current->y,
+                           c_current->x, c_current->y);
+      s_page_append (toplevel, toplevel->page_current, new_net);
+      /* This new net object is only picked up for stretching later,
+       * somewhat of a kludge. If the move operation is cancelled, these
+       * new 0 length nets are removed by the "undo" operation invoked.
        */
-
-      /* ASSUME CASE FOR TWO BUTTING HORIZONTAL PINS */
-      if (1) {
-        /* Absorb half X movement */
-        new_nets = add_dummy_stretch_net (w_current, new_nets,
-                                          c_current, 0, 0, 50, 0);
-        /* Absorb the Y movement, shift by half X movement */
-        new_nets = add_dummy_stretch_net (w_current, new_nets,
-                                          c_current, 50, 0, 50, 100);
-        /* Absorb half X movement, shift by half X movement */
-        new_nets = add_dummy_stretch_net (w_current, new_nets,
-                                          c_current, 50, 100, 100, 100);
-      }
     }
 
     /* Only attempt to stretch nets and buses */
     if (other->type != OBJ_NET && other->type != OBJ_BUS)
       continue;
 
+    whichone = o_move_return_whichone (other, c_current->x, c_current->y);
+
 #if DEBUG
     printf ("FOUND: %s type: %d, whichone: %d, x,y: %d %d\n",
             other->name, c_current->type,
@@ -546,17 +514,12 @@ void o_move_check_endpoint(GSCHEM_TOPLEVEL *w_current, OBJECT * object)
            c_current->other_whichone);
 #endif
 
-    whichone = o_move_return_whichone (other, c_current->x, c_current->y);
-    if (whichone == 0) {
-      w_current->stretch_list =
-        s_stretch_add (w_current->stretch_list, other, 100, 100, 0, 0);
-    } else if (whichone == 1) {
-      w_current->stretch_list =
-        s_stretch_add (w_current->stretch_list, other, 0, 0, 100, 100);
+    if (whichone >= 0 && whichone <= 1) {
+      w_current->stretch_list = s_stretch_add (w_current->stretch_list,
+                                               other, whichone);
     }
   }
 
-  s_page_append_list (toplevel, toplevel->page_current, new_nets);
 }
 
 /*! \todo Finish function documentation!!!
@@ -633,12 +596,12 @@ void o_move_end_rubberband (GSCHEM_TOPLEVEL *w_current,
 {
   TOPLEVEL *toplevel = w_current->toplevel;
   GList *s_iter, *s_iter_next;
-  int dx1, dy1, dx2, dy2;
 
   for (s_iter = w_current->stretch_list;
        s_iter != NULL; s_iter = s_iter_next) {
     STRETCH *s_current = s_iter->data;
     OBJECT *object = s_current->object;
+    int whichone = s_current->whichone;
 
     /* Store this now, since we may delete the current item */
     s_iter_next = g_list_next (s_iter);
@@ -649,14 +612,12 @@ void o_move_end_rubberband (GSCHEM_TOPLEVEL *w_current,
       /* remove the object's connections */
       s_conn_remove_object (toplevel, object);
 
-      s_stretch_calc_deltas (w_current, s_current,
-                             w_dx, w_dy, &dx1, &dy1, &dx2, &dy2);
-      object->line->x[0] += dx1;  object->line->y[0] += dy1;
-      object->line->x[1] += dx2;  object->line->y[1] += dy2;
+      object->line->x[whichone] += w_dx;
+      object->line->y[whichone] += w_dy;
 
       if (o_move_zero_length (object)) {
         w_current->stretch_list =
-          s_stretch_remove_object (w_current->stretch_list, object);
+          s_stretch_remove (w_current->stretch_list, object);
         o_delete (w_current, object);
         continue;
       }
diff --git a/gschem/src/o_net.c b/gschem/src/o_net.c
index 20aba7d..d4b1b27 100644
--- a/gschem/src/o_net.c
+++ b/gschem/src/o_net.c
@@ -137,13 +137,27 @@ void o_net_draw_place (GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_cur
  *  \par Function Description
  *
  */
-void o_net_draw_stretch (GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
-                         int dx1, int dy1, int dx2, int dy2)
+void o_net_draw_stretch (GSCHEM_TOPLEVEL *w_current,
+                         int dx, int dy, int whichone, OBJECT *o_current)
 {
+  int dx1 = -1, dx2 = -1, dy1 = -1,dy2 = -1;
+
   if (o_current->line == NULL) {
     return;
   }
 
+  if (whichone == 0) {
+    dx1 = dx;
+    dy1 = dy;
+    dx2 = dy2 = 0;
+  } else if (whichone == 1) {
+    dx1 = dy1 = 0;
+    dx2 = dx;
+    dy2 = dy;
+  } else {
+    fprintf(stderr, _("Got an invalid which one in o_net_draw_stretch\n"));
+  }
+
   gschem_cairo_line (w_current, END_NONE, 0,
                      o_current->line->x[0] + dx1, o_current->line->y[0] + dy1,
                      o_current->line->x[1] + dx2, o_current->line->y[1] + dy2);
diff --git a/gschem/src/s_stretch.c b/gschem/src/s_stretch.c
index 9d4a384..4bbf39e 100644
--- a/gschem/src/s_stretch.c
+++ b/gschem/src/s_stretch.c
@@ -33,9 +33,7 @@
  *  \par Function Description
  *
  */
-GList *s_stretch_add (GList *list, OBJECT *object,
-                      int x1_percent, int y1_percent,
-                      int x2_percent, int y2_percent)
+GList *s_stretch_add (GList *list, OBJECT *object, int whichone)
 {
   GList *s_iter;
   STRETCH *s_new;
@@ -50,10 +48,7 @@ GList *s_stretch_add (GList *list, OBJECT *object,
 
   s_new = g_malloc (sizeof (STRETCH));
   s_new->object = object;
-  s_new->x1_percent = x1_percent;
-  s_new->y1_percent = y1_percent;
-  s_new->x2_percent = x2_percent;
-  s_new->y2_percent = y2_percent;
+  s_new->whichone = whichone;
 
   return g_list_append (list, s_new);
 }
@@ -80,7 +75,7 @@ static gint find_object (gconstpointer a, gconstpointer b)
  *  \par Function Description
  *
  */
-GList *s_stretch_remove_object (GList *list, OBJECT *object)
+GList *s_stretch_remove (GList *list, OBJECT *object)
 {
   GList *item;
 
@@ -111,6 +106,8 @@ void s_stretch_print_all (GList *list)
     } else {
       printf("Object is NULL\n");
     }
+
+    printf("which one: %d\n", s_current->whichone);
   }
   printf("DONE printing stretch ********************\n\n");
 }
@@ -125,28 +122,3 @@ void s_stretch_destroy_all (GList *list)
   g_list_foreach (list, (GFunc)g_free, NULL);
   g_list_free (list);
 }
-
-/*! \todo Finish function documentation!!!
- *  \brief
- *  \par Function Description
- *
- */
-void s_stretch_calc_deltas (GSCHEM_TOPLEVEL *w_current,
-                            STRETCH *stretch, int diff_x, int diff_y,
-                            int *dx1, int *dy1, int *dx2, int *dy2)
-{
-  /* Calculate line-end deltas from stretch percentages */
-  *dx1 = diff_x * stretch->x1_percent / 100;
-  *dy1 = diff_y * stretch->y1_percent / 100;
-  *dx2 = diff_x * stretch->x2_percent / 100;
-  *dy2 = diff_y * stretch->y2_percent / 100;
-
-  if (w_current->snap != SNAP_OFF) {
-    /* Round (down) to snap-grid */
-    /* NB: This might not be quite right for SNAP_RESNAP. */
-    *dx1 = (*dx1 / w_current->snap_size) * w_current->snap_size;
-    *dy1 = (*dy1 / w_current->snap_size) * w_current->snap_size;
-    *dx2 = (*dx2 / w_current->snap_size) * w_current->snap_size;
-    *dy2 = (*dy2 / w_current->snap_size) * w_current->snap_size;
-  }
-}




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