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

gEDA-cvs: CVS update: g_smob.c



  User: cnieves 
  Date: 06/11/01 11:11:27

  Modified:    .        g_smob.c
  Log:
  * include/prototype.h, src/g_smob.c: Added new "get-attribute-bounds"
  
    scheme function.
  
  
  
  
  Revision  Changes    Path
  1.9       +44 -0     eda/geda/gaf/libgeda/src/g_smob.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: g_smob.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/g_smob.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- g_smob.c	28 Sep 2006 18:00:32 -0000	1.8
  +++ g_smob.c	1 Nov 2006 16:11:27 -0000	1.9
  @@ -219,9 +219,53 @@
     scm_c_define_gsubr("get-attribute-name-value", 1, 0, 0,
   		     g_get_attrib_name_value);
   
  +  scm_c_define_gsubr ("get-attribute-bounds", 1, 0, 0, g_get_attrib_bounds);
  +  
  +
     return;
   }
   
  +/*! \brief Get the bounds of an attribute.
  + *  \par Function Description
  + *  Get the bounds of an attribute.
  + *  I got top and bottom values reversed from world_get_complex_bounds,
  + *  so don\'t rely on the position in the list. 
  + *  \param[in] attrib_smob the attribute.
  + *  \return a list of the bounds of the <B>object smob</B>. 
  + *  The list has the format: ( (left right) (top bottom) )
  + */
  +SCM g_get_attrib_bounds(SCM attrib_smob)
  +{
  +  TOPLEVEL *w_current;
  +  struct st_attrib_smob *attribute;
  +  SCM vertical = SCM_EOL;
  +  SCM horizontal = SCM_EOL;
  +  int left=0, right=0, bottom=0, top=0; 
  +  SCM returned = SCM_EOL;
  +
  +  SCM_ASSERT ( SCM_NIMP(attrib_smob) && 
  +               ((long) SCM_CAR(attrib_smob) == attrib_smob_tag),
  +               attrib_smob, SCM_ARG1, "get-attribute-bounds");
  +  
  +  attribute = (struct st_attrib_smob *)SCM_CDR(attrib_smob);
  +  w_current = attribute->world;
  +
  +  if (attribute &&
  +      attribute->attribute &&
  +      attribute->attribute->object &&
  +      attribute->attribute->object->text->string ) {
  +
  +    world_get_text_bounds (w_current, attribute->attribute->object, 
  +			   &left, &top, &right, &bottom);
  +    
  +    horizontal = scm_cons (SCM_MAKINUM(left), SCM_MAKINUM(right));
  +    vertical = scm_cons (SCM_MAKINUM(top), SCM_MAKINUM(bottom));
  +    returned = scm_cons (horizontal, vertical);
  +  }
  +
  +  return returned;
  +}
  +
   /*! \brief Free object smob memory.
    *  \par Function Description
    *  Free the memory allocated by the object smob and return its size.
  
  
  


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