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

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



On Wed, 28 Nov 2001, Andrew S. wrote:

> 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 */

Well, it should happen automatically when set_props is called.  That it
doesn't is a problem in object.c, or possibly deeper, in the properties.
The text is a sub-object, and its width doesn't get updated after
set_props.  The update_data function doesn't update the width of the text
object, obviously that object is expected to handle it itself.  But somehow
the text change is propagated to the text object without the width being
set?  I'm a little confused about this.  Your code looks good to me.
Cyrille, do you have any comments on the property updates?

-Lars

-- 
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause)| Hårdgrim of Numenor
"I do not agree with a word that you say, but I   |----------------------------
will defend to the death your right to say it."   | Where are we going, and
    --Evelyn Beatrice Hall paraphrasing Voltaire  | what's with the handbasket?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK