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

gEDA-cvs: CVS update: o_arc_basic.c



  User: pcjc2   
  Date: 07/03/26 15:16:12

  Modified:    .        Tag: noscreen o_arc_basic.c o_basic.c o_box_basic.c
                        o_bus_basic.c o_circle_basic.c o_line_basic.c
                        o_net_basic.c o_picture.c o_pin_basic.c
  Log:
  Pass OBJECT instead of derived type into world_get_..._bounds().
  
  Modifed objects to include the drawn line width  when calculating bounds. 
  
  Set OBJECT->line_width to {NET|BUS|PIN}_WIDTH as appropriate in o_{net|bus|pin}_add().
  
  Replaced copied code in world_get_{net|pin|bus}_bounds() with calls to world_get_line_bounds().
  
  Added call to o_recalc_single_object() in o_set_line_options() to keep line width up-to-date with 
  
  editing.
  
  
  
  
  
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.31.2.10 +9 -1      eda/geda/gaf/libgeda/src/o_arc_basic.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_arc_basic.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_arc_basic.c,v
  retrieving revision 1.31.2.9
  retrieving revision 1.31.2.10
  diff -u -b -r1.31.2.9 -r1.31.2.10
  --- o_arc_basic.c	25 Feb 2007 13:43:20 -0000	1.31.2.9
  +++ o_arc_basic.c	26 Mar 2007 19:16:12 -0000	1.31.2.10
  @@ -573,6 +573,9 @@
     int x1, y1, x2, y2, x3, y3;
     int radius, start_angle, end_angle;
     int i, angle;
  +  int halfwidth;
  +
  +  halfwidth = object->line_width / 2;
   
     radius      = object->arc->width / 2;
     start_angle = object->arc->start_angle % 360;
  @@ -608,7 +611,12 @@
       }
     }
   
  -  /* PB : same problem as above */
  +  /* This isn't strictly correct, but a 1st order approximation */
  +  *left   -= halfwidth;
  +  *top    -= halfwidth;
  +  *right  += halfwidth;
  +  *bottom += halfwidth;
  +
   }
   
   
  
  
  
  1.15.2.3  +3 -0      eda/geda/gaf/libgeda/src/o_basic.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_basic.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_basic.c,v
  retrieving revision 1.15.2.2
  retrieving revision 1.15.2.3
  diff -u -b -r1.15.2.2 -r1.15.2.3
  --- o_basic.c	12 Feb 2007 02:20:24 -0000	1.15.2.2
  +++ o_basic.c	26 Mar 2007 19:16:12 -0000	1.15.2.3
  @@ -243,6 +243,9 @@
   
     o_current->line_length = length;
     o_current->line_space  = space;
  +
  +  /* Recalculate the object's bounding box */
  +  o_recalc_single_object( w_current, o_current );
   }
   
   /*! \brief Set #OBJECT's fill options.
  
  
  
  1.26.2.9  +18 -13    eda/geda/gaf/libgeda/src/o_box_basic.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_box_basic.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_box_basic.c,v
  retrieving revision 1.26.2.8
  retrieving revision 1.26.2.9
  diff -u -b -r1.26.2.8 -r1.26.2.9
  --- o_box_basic.c	25 Feb 2007 13:43:20 -0000	1.26.2.8
  +++ o_box_basic.c	26 Mar 2007 19:16:12 -0000	1.26.2.9
  @@ -636,7 +636,7 @@
     }
   
     /* update the bounding box - world unit */
  -  world_get_box_bounds(w_current, o_current->box, &left, &top, &right, &bottom);
  +  world_get_box_bounds(w_current, o_current, &left, &top, &right, &bottom);
     o_current->w_left   = left;
     o_current->w_top    = top;
     o_current->w_right  = right;
  @@ -651,24 +651,29 @@
    *  in world units.
    *
    *  \param [in]  w_current  The TOPLEVEL object.
  - *  \param [in]  box        BOX OBJECT to read coordinates from.
  + *  \param [in]  object     BOX OBJECT to read coordinates from.
    *  \param [out] left       Left box coordinate in WORLD units.
    *  \param [out] top        Top box coordinate in WORLD units.
    *  \param [out] right      Right box coordinate in WORLD units.
    *  \param [out] bottom     Bottom box coordinate in WORLD units.
    */
  -void world_get_box_bounds(TOPLEVEL *w_current, BOX *box,
  +void world_get_box_bounds(TOPLEVEL *w_current, OBJECT *object,
   			  int *left, int *top, int *right, int *bottom)
   {
  -  *left   = min(box->upper_x, box->lower_x);
  -  *top    = min(box->upper_y, box->lower_y);
  -  *right  = max(box->upper_x, box->lower_x);
  -  *bottom = max(box->upper_y, box->lower_y);
  +  int halfwidth;
     
  -#if DEBUG 
  -  printf("box: %d %d %d %d\n", *left, *top, *right, *bottom);
  -#endif
  +  halfwidth = object->line_width / 2;
   	
  +  *left   = min(object->box->upper_x, object->box->lower_x);
  +  *top    = min(object->box->upper_y, object->box->lower_y);
  +  *right  = max(object->box->upper_x, object->box->lower_x);
  +  *bottom = max(object->box->upper_y, object->box->lower_y);
  +
  +  /* This isn't strictly correct, but a 1st order approximation */
  +  *left   -= halfwidth;
  +  *top    -= halfwidth;
  +  *right  += halfwidth;
  +  *bottom += halfwidth;
   }
                    
   /*! \brief Print BOX to Postscript document.
  
  
  
  1.17.2.8  +7 -9      eda/geda/gaf/libgeda/src/o_bus_basic.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_bus_basic.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_bus_basic.c,v
  retrieving revision 1.17.2.7
  retrieving revision 1.17.2.8
  diff -u -b -r1.17.2.7 -r1.17.2.8
  --- o_bus_basic.c	25 Feb 2007 13:43:20 -0000	1.17.2.7
  +++ o_bus_basic.c	26 Mar 2007 19:16:12 -0000	1.17.2.8
  @@ -47,13 +47,10 @@
    * \par Function Description
    *
    */
  -void world_get_bus_bounds(TOPLEVEL *w_current, LINE *line, int *left, int *top,
  +void world_get_bus_bounds(TOPLEVEL *w_current, OBJECT *object, int *left, int *top,
   			  int *right, int *bottom)
   {
  -  *left = min( line->x[0], line->x[1] );
  -  *top = min( line->y[0], line->y[1] );
  -  *right = max( line->x[0], line->x[1] );
  -  *bottom = max( line->y[0], line->y[1] );
  +  world_get_line_bounds( w_current, object, left, top, right, bottom );
   }
   
   /* \brief
  @@ -79,10 +76,11 @@
     new_node->line->y[0] = y1;
     new_node->line->x[1] = x2;
     new_node->line->y[1] = y2;
  +  new_node->line_width = BUS_WIDTH;
   
     new_node->bus_ripper_direction = bus_ripper_direction;
   
  -  world_get_bus_bounds(w_current, new_node->line, &left, &top, &right, &bottom);
  +  world_get_bus_bounds(w_current, new_node, &left, &top, &right, &bottom);
   	
     new_node->w_left = left;
     new_node->w_top = top;
  @@ -121,7 +119,7 @@
       return;
     }
   
  -  world_get_bus_bounds(w_current, o_current->line, &left, &top, &right, &bottom);
  +  world_get_bus_bounds(w_current, o_current, &left, &top, &right, &bottom);
   
     o_current->w_left = left;
     o_current->w_top = top;
  @@ -232,7 +230,7 @@
     object->line->y[1] = object->line->y[1] + y1;
   
     /* Update bounding box */
  -  world_get_bus_bounds(w_current, object->line, &left, &top, &right, &bottom);
  +  world_get_bus_bounds(w_current, object, &left, &top, &right, &bottom);
   
     object->w_left = left;
     object->w_top = top;
  @@ -600,7 +598,7 @@
     object->line->x[whichone] = x;
     object->line->y[whichone] = y;
   
  -  world_get_bus_bounds(w_current, object->line, &left, &top, &right, &bottom);
  +  world_get_bus_bounds(w_current, object, &left, &top, &right, &bottom);
   	
     object->w_left = left;
     object->w_top = top;
  
  
  
  1.27.2.9  +16 -11    eda/geda/gaf/libgeda/src/o_circle_basic.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_circle_basic.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_circle_basic.c,v
  retrieving revision 1.27.2.8
  retrieving revision 1.27.2.9
  diff -u -b -r1.27.2.8 -r1.27.2.9
  --- o_circle_basic.c	25 Feb 2007 13:43:20 -0000	1.27.2.8
  +++ o_circle_basic.c	26 Mar 2007 19:16:12 -0000	1.27.2.9
  @@ -556,7 +556,7 @@
     }
     
     /* update the bounding box - world unit */
  -  world_get_circle_bounds(w_current, o_current->circle,
  +  world_get_circle_bounds(w_current, o_current,
   		    &left, &top, &right, &bottom);
     o_current->w_left   = left;
     o_current->w_top    = top;
  @@ -572,24 +572,29 @@
    *  in world units.
    *
    *  \param [in]  w_current  The TOPLEVEL object.
  - *  \param [in]  circle     Circle OBJECT to read coordinates from.
  + *  \param [in]  object     Circle OBJECT to read coordinates from.
    *  \param [out] left       Left circle coordinate in WORLD units.
    *  \param [out] top        Top circle coordinate in WORLD units.
    *  \param [out] right      Right circle coordinate in WORLD units.
    *  \param [out] bottom     Bottom circle coordinate in WORLD units.
    */
  -void world_get_circle_bounds(TOPLEVEL *w_current, CIRCLE *circle, int *left,
  +void world_get_circle_bounds(TOPLEVEL *w_current, OBJECT *object, int *left,
   			     int *top, int *right, int *bottom)
   {
  +  int halfwidth;
   
  -  *left   = circle->center_x - circle->radius;
  -  *top    = circle->center_y - circle->radius;
  -  *right  = circle->center_x + circle->radius;
  -  *bottom = circle->center_y + circle->radius;
  +  halfwidth = object->line_width / 2;
   
  -#if DEBUG 
  -  printf("circle: %d %d %d %d\n", *left, *top, *right, *bottom);
  -#endif
  +  *left   = object->circle->center_x - object->circle->radius;
  +  *top    = object->circle->center_y - object->circle->radius;
  +  *right  = object->circle->center_x + object->circle->radius;
  +  *bottom = object->circle->center_y + object->circle->radius;
  +
  +  /* This isn't strictly correct, but a 1st order approximation */
  +  *left   -= halfwidth;
  +  *top    -= halfwidth;
  +  *right  += halfwidth;
  +  *bottom += halfwidth;
   
   }
   
  
  
  
  1.26.2.9  +19 -9     eda/geda/gaf/libgeda/src/o_line_basic.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_line_basic.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_line_basic.c,v
  retrieving revision 1.26.2.8
  retrieving revision 1.26.2.9
  diff -u -b -r1.26.2.8 -r1.26.2.9
  --- o_line_basic.c	25 Feb 2007 13:43:20 -0000	1.26.2.8
  +++ o_line_basic.c	26 Mar 2007 19:16:12 -0000	1.26.2.9
  @@ -416,7 +416,7 @@
     object->line->y[1] = object->line->y[1] + y1;
     
     /* Update bounding box */
  -  world_get_line_bounds(w_current, object->line, &left, &top, &right, &bottom);
  +  world_get_line_bounds(w_current, object, &left, &top, &right, &bottom);
     
     object->w_left   = left;
     object->w_top    = top;
  @@ -524,7 +524,7 @@
     }
     
     /* update the bounding box - screen unit */
  -  world_get_line_bounds(w_current, o_current->line, 
  +  world_get_line_bounds(w_current, o_current, 
   		  &left, &top, &right, &bottom);
     o_current->w_left   = left;
     o_current->w_top    = top;
  @@ -540,19 +540,29 @@
    *  in <B>*line</B> in world units.
    *
    *  \param [in]  w_current  The TOPLEVEL object.
  - *  \param [in]  line       Line OBJECT to read coordinates from.
  + *  \param [in]  OBJECT     Line OBJECT to read coordinates from.
    *  \param [out] left       Left line coordinate in WORLD units.
    *  \param [out] top        Top line coordinate in WORLD units.
    *  \param [out] right      Right line coordinate in WORLD units.
    *  \param [out] bottom     Bottom line coordinate in WORLD units.
    */
  -void world_get_line_bounds(TOPLEVEL *w_current, LINE *line,
  +void world_get_line_bounds(TOPLEVEL *w_current, OBJECT *object,
   			   int *left, int *top, int *right, int *bottom)
   {
  -  *left = min( line->x[0], line->x[1] );
  -  *top = min( line->y[0], line->y[1] );
  -  *right = max( line->x[0], line->x[1] );
  -  *bottom = max( line->y[0], line->y[1] );
  +  int halfwidth;
  +
  +  halfwidth = object->line_width / 2;
  +
  +  *left = min( object->line->x[0], object->line->x[1] );
  +  *top = min( object->line->y[0], object->line->y[1] );
  +  *right = max( object->line->x[0], object->line->x[1] );
  +  *bottom = max( object->line->y[0], object->line->y[1] );
  +
  +  /* This isn't strictly correct, but a 1st order approximation */
  +  *left   -= halfwidth;
  +  *top    -= halfwidth;
  +  *right  += halfwidth;
  +  *bottom += halfwidth;
   }
   
   /*! \brief Print line to Postscript document.
  
  
  
  1.34.2.8  +8 -10     eda/geda/gaf/libgeda/src/o_net_basic.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_net_basic.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_net_basic.c,v
  retrieving revision 1.34.2.7
  retrieving revision 1.34.2.8
  diff -u -b -r1.34.2.7 -r1.34.2.8
  --- o_net_basic.c	25 Feb 2007 13:43:20 -0000	1.34.2.7
  +++ o_net_basic.c	26 Mar 2007 19:16:12 -0000	1.34.2.8
  @@ -52,13 +52,10 @@
    *  \param [out] right
    *  \param [out] bottom
    */
  -void world_get_net_bounds(TOPLEVEL *w_current, LINE *line, int *left,
  +void world_get_net_bounds(TOPLEVEL *w_current, OBJECT *object, int *left,
   			  int *top, int *right, int *bottom)
   {
  -  *left = min( line->x[0], line->x[1] );
  -  *top = min( line->y[0], line->y[1] );
  -  *right = max( line->x[0], line->x[1] );
  -  *bottom = max( line->y[0], line->y[1] );
  +  world_get_line_bounds( w_current, object, left, top, right, bottom );
   }
   
   /*! \todo Finish function documentation!!!
  @@ -92,8 +89,9 @@
     new_node->line->y[0] = y1;
     new_node->line->x[1] = x2;
     new_node->line->y[1] = y2;
  +  new_node->line_width = NET_WIDTH;
   
  -  world_get_net_bounds(w_current, new_node->line, &left, &top, &right,
  +  world_get_net_bounds(w_current, new_node, &left, &top, &right,
                    &bottom);
   
     new_node->w_left = left;
  @@ -135,7 +133,7 @@
       return;
     }
   
  -  world_get_net_bounds(w_current, o_current->line, &left, &top, &right,
  +  world_get_net_bounds(w_current, o_current, &left, &top, &right,
                    &bottom);
   
     o_current->w_left = left;
  @@ -243,7 +241,7 @@
     object->line->y[1] = object->line->y[1] + y1;
   
     /* Update bounding box */
  -  world_get_net_bounds(w_current, object->line, &left, &top, &right, &bottom);
  +  world_get_net_bounds(w_current, object, &left, &top, &right, &bottom);
   
     object->w_left = left;
     object->w_top = top;
  @@ -754,7 +752,7 @@
     object->line->x[whichone] = x;
     object->line->y[whichone] = y;
   
  -  world_get_net_bounds(w_current, object->line, &left, &top, &right, &bottom);
  +  world_get_net_bounds(w_current, object, &left, &top, &right, &bottom);
   
     object->w_left = left;
     object->w_top = top;
  
  
  
  1.5.2.8   +9 -13     eda/geda/gaf/libgeda/src/o_picture.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_picture.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_picture.c,v
  retrieving revision 1.5.2.7
  retrieving revision 1.5.2.8
  diff -u -b -r1.5.2.7 -r1.5.2.8
  --- o_picture.c	25 Feb 2007 13:43:20 -0000	1.5.2.7
  +++ o_picture.c	26 Mar 2007 19:16:12 -0000	1.5.2.8
  @@ -471,7 +471,7 @@
     }
   
     /* update the bounding picture - world units */
  -  world_get_picture_bounds(w_current, o_current->picture,
  +  world_get_picture_bounds(w_current, o_current,
   		     &left, &top, &right, &bottom);
     o_current->w_left   = left;
     o_current->w_top    = top;
  @@ -487,23 +487,19 @@
    *  described in <B>*picture</B> in WORLD units.
    *
    *  \param [in]  w_current  The TOPLEVEL object.
  - *  \param [in]  picture    Picture OBJECT to read coordinates from.
  + *  \param [in]  object     Picture OBJECT to read coordinates from.
    *  \param [out] left       Left picture coordinate in WORLD units.
    *  \param [out] top        Top picture coordinate in WORLD units.
    *  \param [out] right      Right picture coordinate in WORLD units.
    *  \param [out] bottom     Bottom picture coordinate in WORLD units.
    */
  -void world_get_picture_bounds(TOPLEVEL *w_current, PICTURE *picture,
  +void world_get_picture_bounds(TOPLEVEL *w_current, OBJECT *object,
   			      int *left, int *top, int *right, int *bottom)
   {
  -	*left   = min(picture->upper_x, picture->lower_x);
  -	*top    = min(picture->upper_y, picture->lower_y);
  -	*right  = max(picture->upper_x, picture->lower_x);
  -	*bottom = max(picture->upper_y, picture->lower_y);
  -
  -#if DEBUG 
  -	printf("picture: %d %d %d %d\n", *left, *top, *right, *bottom);
  -#endif
  +  *left   = min(object->picture->upper_x, object->picture->lower_x);
  +  *top    = min(object->picture->upper_y, object->picture->lower_y);
  +  *right  = max(object->picture->upper_x, object->picture->lower_x);
  +  *bottom = max(object->picture->upper_y, object->picture->lower_y);
   	
   }
                    
  
  
  
  1.24.2.9  +7 -9      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.8
  retrieving revision 1.24.2.9
  diff -u -b -r1.24.2.8 -r1.24.2.9
  --- o_pin_basic.c	24 Mar 2007 02:49:02 -0000	1.24.2.8
  +++ o_pin_basic.c	26 Mar 2007 19:16:12 -0000	1.24.2.9
  @@ -46,13 +46,10 @@
    *  \par Function Description
    *
    */
  -void world_get_pin_bounds(TOPLEVEL *w_current, LINE *line, int *left, int *top,
  +void world_get_pin_bounds(TOPLEVEL *w_current, OBJECT *object, int *left, int *top,
   			  int *right, int *bottom)
   {
  -  *left = min( line->x[0], line->x[1] );
  -  *top = min( line->y[0], line->y[1] );
  -  *right = max( line->x[0], line->x[1] );
  -  *bottom = max( line->y[0], line->y[1] );
  +  world_get_line_bounds( w_current, object, left, top, right, bottom );
   }
   
   /*! \todo Finish function documentation!!!
  @@ -77,8 +74,9 @@
     new_node->line->y[0] = y1;
     new_node->line->x[1] = x2;
     new_node->line->y[1] = y2;
  +  new_node->line_width = PIN_WIDTH;
   
  -  world_get_pin_bounds(w_current, new_node->line, &left, &top, &right, &bottom);
  +  world_get_pin_bounds(w_current, new_node, &left, &top, &right, &bottom);
   	
     new_node->w_left = left;
     new_node->w_top = top;
  @@ -131,7 +129,7 @@
       return;
     }
   
  -  world_get_pin_bounds(w_current, o_current->line, &left, &top, &right, &bottom);
  +  world_get_pin_bounds(w_current, o_current, &left, &top, &right, &bottom);
   
     o_current->w_left = left;
     o_current->w_top = top;
  @@ -256,7 +254,7 @@
     object->line->y[1] = object->line->y[1] + y1;
   
     /* Update bounding box */
  -  world_get_pin_bounds(w_current, object->line, &left, &top, &right, &bottom);
  +  world_get_pin_bounds(w_current, object, &left, &top, &right, &bottom);
   
     object->w_left = left;
     object->w_top = top;
  @@ -452,7 +450,7 @@
     object->line->x[whichone] = x;
     object->line->y[whichone] = y;
   
  -  world_get_pin_bounds(w_current, object->line, &left, &top, &right, &bottom);
  +  world_get_pin_bounds(w_current, object, &left, &top, &right, &bottom);
   	
     object->w_left = left;
     object->w_top = top;
  
  
  


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