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

gEDA-cvs: CVS update: o_pin_basic.c



  User: pcjc2   
  Date: 07/03/23 22:49:02

  Modified:    .        Tag: noscreen o_pin_basic.c
  Log:
  Re-write the bounds checking in o_pin_update_whichend() to be more robust
  
  
  
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.24.2.8  +20 -13    eda/geda/gaf/libgeda/src/o_pin_basic.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_pin_basic.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_pin_basic.c,v
  retrieving revision 1.24.2.7
  retrieving revision 1.24.2.8
  diff -u -b -r1.24.2.7 -r1.24.2.8
  --- o_pin_basic.c	25 Feb 2007 13:43:20 -0000	1.24.2.7
  +++ o_pin_basic.c	24 Mar 2007 02:49:02 -0000	1.24.2.8
  @@ -477,34 +477,40 @@
     int min0, min1;
     int min0_whichend, min1_whichend;
     int rleft, rtop, rright, rbottom;
  +  int found;
   
     if (object_list && num_pins) {
       if (num_pins == 1 || w_current->force_boundingbox) {
         world_get_complex_bounds(w_current, object_list,
                                &left, &top, &right, &bottom);
       } else {
  -      left = rleft = w_current->init_right;
  -      top = rtop = w_current->init_bottom;;
  -      right = rright = 0;
  -      bottom = rbottom = 0;
  +      found = 0;
   
         /* only look at the pins to calculate bounds of the symbol */
         o_current = object_list;
         while (o_current != NULL) {
           if (o_current->type == OBJ_PIN) {
  -          world_get_pin_bounds(w_current, o_current->line,
  -                               &rleft, &rtop, &rright, &rbottom);
  +          rleft = o_current->w_left;
  +          rtop = o_current->w_top;
  +          rright = o_current->w_right;
  +          rbottom = o_current->w_bottom;
  +
  +          if ( found ) {
  +            left = min( left, rleft );
  +            top = min( top, rtop );
  +            right = max( right, rright );
  +            bottom = max( bottom, rbottom );
  +          } else {
  +            left = rleft;
  +            top = rtop;
  +            right = rright;
  +            bottom = rbottom;
  +            found = 1;
  +          }
           }
  -
  -        if (rleft < left) left = rleft;
  -        if (rtop < top) top = rtop;
  -        if (rright > right) right = rright;
  -        if (rbottom > bottom) bottom = rbottom;
  -      
           o_current=o_current->next;
         }
   
  -      
       }
     } else {
       return;
  @@ -512,6 +518,7 @@
   
     o_current = object_list;
     while (o_current != NULL) {
  +    /* Determine which end of the pin is on or nearest the boundary */
       if (o_current->type == OBJ_PIN && o_current->whichend == -1) {
         if (o_current->line->y[0] == o_current->line->y[1]) {
           /* horizontal */
  
  
  


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