Re: Improving lifeline objects behaviour



On Fri, 2007-08-31 at 12:13 +0200, Filippo Bergamasco wrote:
Hi guys!
[...]

Interesting, and a nice use of movies to show the problem (though the
"after" movie doesn't show your changes to their best effect).


So... this is what I've done:

* ConnectionPoints distance are no more function of box height, but is
box height that is function of ConnectionPoints distance and the
number of connection points.

This simple change ensure that, unless you mantain stable cp
distance: 
1) you can add connection points without loose alignment between
connectionpoints of different lifetime objects.

...as long as the different lifetime objects have the same distance
between connectionpoints, or you add the connection points after the
ones that have lines from them.

2) you can move activation rectangle in lifetime object without the
need to resize it (the operation of resizing activation rectangle is
not as necessary as moving it, because it size depends of number of
connectionpoints that you need on it) 

Very nice.  I must have mispointed the first time, but it's very nice to
be able to just move the rectangle.

* I have added a new connectionpoint in the same place of rbot handle
so you can attach another lifetime object at the bottom of activation
rectangle of the current one in case of multiple activation times in a
sequence diagram (this occurs very often) 

Sounds like a good idea. 

* I have added 3 new menu items to:
1) Increase distance of connectionpoints by a specific factor
2) Decrease distance of connectionpoints by a specific factor
3) Set distance of connectionpoints to default 

I'd suggest having the distance as a distinct property rather than a
factor of size and # of connectionpoints.  That way, you can set a
default distance for new timelines, and you can change it in one go
(once Sameer's properties stuff is in).  Also, you'd be able to set a
specific distance rather than having only hard-coded intervals.

What about backward compatibility in loading/saving diagrams?

Old lifeline objects contains in their saved properties rtop, rbot
(activation rectangle height) and number of connection points. So..
for us is simple to calculate cp distance by reversing the function
explained before. This cause painless perfect loading of old objects,
that will operate with new behaviour once loaded. 
Also, new objects are saved exactly like old ones ( i haven't modified
properties metadata) because there was no need to do that.

While there's no *need* to change the properties, I think it'd be nicer
in the long run with a property change rather than "piggy-backing" on
old properties.  To load old diagrams correctly, we'd need to check the
version number in the load function and set the distance based on the
size there.

Final considerations:

I decided to post to Dia mailing list because maybe someone of you
could find this changes useful or just a good base to start a
discussion about how to improve lifeline objects. This is only my
proposal... of course i don't expect it will be merged  to Dia main
development tree, but for me if just one of you will try to apply the
patch to see the result... will be a great success :) 

Here's one great success for you, then:)  I've checked it out and
fiddled with the code a bit.  What I'd prefer to see before committing
is making the CP distance a real property instead of using "magic" (I
don't like magic in my code).  If you want to make it really good, I
think it's possible to reduce it to one CPLine per side by adding the
appropriate conversion in the loading phase.  Then you can have only one
pair of points added per menu activation, making it possible to extend
the rectangle without having *any* lines move!  Plus the code would be a
great deal cleaner.  If you were to document what you've found out about
the workings, you'd warm my old coder's heart.

-Lars




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