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

gEDA-cvs: CVS update: o_complex_basic.c



  User: cnieves 
  Date: 06/10/21 16:35:57

  Modified:    .        Tag: glist_dev o_complex_basic.c o_text_basic.c
  Log:
  libgeda/gschem: Rename get_complex_bounds to get_object_list_bounds.
  
  libgeda: Make get_object_list_bounds to call a new function 
  
  get_single_object_bounds, for each object in the list.
  
  
  
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.27.2.3  +58 -31    eda/geda/gaf/libgeda/src/o_complex_basic.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_complex_basic.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_complex_basic.c,v
  retrieving revision 1.27.2.2
  retrieving revision 1.27.2.3
  diff -u -b -r1.27.2.2 -r1.27.2.3
  --- o_complex_basic.c	21 Oct 2006 20:17:38 -0000	1.27.2.2
  +++ o_complex_basic.c	21 Oct 2006 20:35:56 -0000	1.27.2.3
  @@ -43,57 +43,51 @@
   #include <dmalloc.h>
   #endif
   
  -/*! \brief
  - *  \par Function Description
  +/*! \brief Return the bounds of the given object.
  + *  \par Given an object, calcule the bounds coordinates.
  + *  \param [in] w_current The toplevel structure.
  + *  \param [in] o_current The object to look the bounds for.
  + *  \param [out] rleft   pointer to the left coordinate of the object.
  + *  \param [out] rtop    pointer to the top coordinate of the object.
  + *  \param [out] rright  pointer to the right coordinate of the object.
  + *  \param [out] rbottom pointer to the bottom coordinate of the object.
    *
    */
  -void get_complex_bounds(TOPLEVEL *w_current, OBJECT *complex, 
  -			int *left, int *top, int *right, int *bottom)
  +void get_single_object_bounds(TOPLEVEL *w_current, OBJECT *o_current, 
  +			      int *rleft, int *rtop, int *rright, int *rbottom)
   {
  -  OBJECT *o_current=NULL;
  -  int rleft, rtop, rright, rbottom;
  -	
  -  *left = rleft = 999999;
  -  *top = rtop = 9999999;
  -  *right = rright = 0;
  -  *bottom = rbottom = 0;
  -	
  -
  -
  -  o_current = complex;
  -	
  -  while ( o_current != NULL ) {
  +  if (o_current != NULL) {
       switch(o_current->type) {
         case(OBJ_LINE):
  -        get_line_bounds(w_current, o_current->line, &rleft, &rtop, &rright, &rbottom);
  +        get_line_bounds(w_current, o_current->line, rleft, rtop, rright, rbottom);
           break;
   
         case(OBJ_NET):
           /* same as a line (diff name)*/
  -        get_net_bounds(w_current, o_current->line, &rleft, &rtop, &rright, &rbottom);
  +        get_net_bounds(w_current, o_current->line, rleft, rtop, rright, rbottom);
           break;
   
         case(OBJ_BUS):
           /* same as a line (diff name)*/
  -        get_bus_bounds(w_current, o_current->line, &rleft, &rtop, &rright, &rbottom);
  +        get_bus_bounds(w_current, o_current->line, rleft, rtop, rright, rbottom);
           break;
   	
         case(OBJ_BOX):
  -        get_box_bounds(w_current, o_current->box, &rleft, &rtop, &rright, &rbottom);
  +        get_box_bounds(w_current, o_current->box, rleft, rtop, rright, rbottom);
           break;
   
         case(OBJ_PICTURE):
  -        get_picture_bounds(w_current, o_current->picture, &rleft, &rtop, &rright, &rbottom);
  +        get_picture_bounds(w_current, o_current->picture, rleft, rtop, rright, rbottom);
           break;
   
         case(OBJ_CIRCLE):
  -        get_circle_bounds(w_current, o_current->circle, &rleft, &rtop, &rright, &rbottom);
  +        get_circle_bounds(w_current, o_current->circle, rleft, rtop, rright, rbottom);
           break;
   
         case(OBJ_COMPLEX):
         case(OBJ_PLACEHOLDER):
           /* recursive objects ?*/
  -        get_complex_bounds(w_current, o_current->complex->prim_objs, &rleft, &rtop, &rright, &rbottom);
  +        get_object_list_bounds(w_current, o_current->complex->prim_objs, rleft, rtop, rright, rbottom);
           break;
   
         case(OBJ_TEXT):
  @@ -101,22 +95,52 @@
           /* you might lose some attrs though */
           if (o_current->visibility == VISIBLE ||
               (o_current->visibility == INVISIBLE && w_current->show_hidden_text)) {
  -          get_text_bounds(w_current, o_current, &rleft, &rtop, &rright, &rbottom);
  +          get_text_bounds(w_current, o_current, rleft, rtop, rright, rbottom);
           }
           break;
   
         case(OBJ_PIN):
  -        get_pin_bounds(w_current, o_current->line, &rleft, &rtop, &rright, &rbottom);
  +        get_pin_bounds(w_current, o_current->line, rleft, rtop, rright, rbottom);
           break;
   
         case(OBJ_ARC):
  -        get_arc_bounds(w_current, o_current, &rleft, &rtop, &rright, &rbottom);
  +        get_arc_bounds(w_current, o_current, rleft, rtop, rright, rbottom);
           break;
   
         default:
           break;
       }
  +  }
  +}
  +
  +/*! \brief Return the bounds of the given list of objects.
  + *  \par Given a list of objects, calcule the bounds coordinates.
  + *  \param [in] w_current The toplevel structure.
  + *  \param [in] complex   The list of objects to look the bounds for.
  + *  \param [out] left   pointer to the left coordinate of the object.
  + *  \param [out] top    pointer to the top coordinate of the object.
  + *  \param [out] right  pointer to the right coordinate of the object.
  + *  \param [out] bottom pointer to the bottom coordinate of the object.
  + */
  +void
  +get_object_list_bounds(TOPLEVEL *w_current, OBJECT *complex, 
  +		       int *left, int *top, int *right, int *bottom)
  +{
  +  OBJECT *o_current=NULL;
  +  int rleft, rtop, rright, rbottom;
   
  +  *left = rleft = 999999;
  +  *top = rtop = 9999999;
  +  *right = rright = 0;
  +  *bottom = rbottom = 0;
  +	
  +
  +
  +  o_current = complex;
  +	
  +  while ( o_current != NULL ) {
  +    get_single_object_bounds(w_current, o_current, &rleft, &rtop, 
  +			     &rright, &rbottom);
       if (rleft < *left) *left = rleft;
       if (rtop < *top) *top = rtop;
       if (rright > *right) *right = rright;
  @@ -185,7 +209,7 @@
         case(OBJ_COMPLEX):
         case(OBJ_PLACEHOLDER):
           /* recursive objects ?*/
  -        get_complex_bounds(w_current, o_current->complex->prim_objs, &rleft, &rtop, &rright, &rbottom);
  +        get_object_list_bounds(w_current, o_current->complex->prim_objs, &rleft, &rtop, &rright, &rbottom);
           break;
   
         case(OBJ_TEXT):
  @@ -720,7 +744,10 @@
     /* libhack */
     /* o_recalc(w_current, o_current->complex);*/
   
  -  get_complex_bounds(w_current, o_current->complex->prim_objs, &left, &top, &right, &bottom);
  +  if ((!o_current) || (o_current->type != OBJ_COMPLEX && o_current->type != OBJ_PLACEHOLDER))
  +    return;
  +
  +  get_object_list_bounds(w_current, o_current->complex->prim_objs, &left, &top, &right, &bottom);
     o_current->left = left;
     o_current->top = top;
     o_current->right = right;
  @@ -1032,7 +1059,7 @@
     o_complex_world_translate(w_current, x1, y1, 
                               object->complex->prim_objs);
   
  -  get_complex_bounds(w_current, object->complex->prim_objs, 
  +  get_object_list_bounds(w_current, object->complex->prim_objs, 
                        &left, &top, &right, &bottom);
   	
     object->left = left;
  
  
  
  1.23.2.1  +4 -4      eda/geda/gaf/libgeda/src/o_text_basic.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_text_basic.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_text_basic.c,v
  retrieving revision 1.23
  retrieving revision 1.23.2.1
  diff -u -b -r1.23 -r1.23.2.1
  --- o_text_basic.c	17 Oct 2006 10:02:27 -0000	1.23
  +++ o_text_basic.c	21 Oct 2006 20:35:56 -0000	1.23.2.1
  @@ -69,7 +69,7 @@
   void get_text_bounds(TOPLEVEL *w_current, OBJECT *o_current,
   		     int *left, int *top, int *right, int *bottom)
   {
  -  get_complex_bounds(w_current, o_current->text->prim_objs, left, top,
  +  get_object_list_bounds(w_current, o_current->text->prim_objs, left, top,
                        right, bottom);
   }
   
  @@ -1019,7 +1019,7 @@
       return;
     }
   
  -  get_complex_bounds(w_current, o_current->text->prim_objs, 
  +  get_object_list_bounds(w_current, o_current->text->prim_objs, 
                        &left, &top, &right, &bottom);
     o_current->left = left;
     o_current->top = top;
  
  
  


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