Re: function to resize a UML class object's extent?



On 2001.11.28 08:28 Lars Clausen wrote:
On Wed, 28 Nov 2001, Andrew S. wrote:

Anyone know which function I should call (or property to set) to resize a
class object's borders around the text inside?  I took a look at
umlclass_create() in objects/UML/class.c, but I didn't see anything
obvious.

My problem is I'm creating UML class objects on a diagram, and most of
the time the string in the class name is too big for the default extent
of the class box, so it winds up looking like:

     +-------+
A_lon|g_class|_name
     +-------+

and generally leaves a mess when the object is dragged around the
diagram.

I'm doing all this from a plug-in.

The standard function to call is objet_update_data().  How are you
currently changing the text?

Like this:

      /* the {persistent} tag should be made optional (or at least
         concealable) eventually */
      nameprop->string_data =
          g_strdup_printf("%s {persistent}",
                          gschema_element->base_table_def_sql->table_sql->str);
      /* this compulsory capitalization of class-names-as-table-names
         should be made optional eventually */
      nameprop->string_data[0] =
          (char) toupper((int)
                 gschema_element->base_table_def_sql->table_sql->str[0]);
      g_strdown(nameprop->string_data + 1);

      umlclass_obj->ops->set_props(umlclass_obj, props);

      /* need some code here to fit the size of the class box to the
         size of the class name (which doesn't happen automatically) a
         la Properties->Apply button */

Thanks,
Andy




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