From: "Titus J. Anderson" <titus anderson louisville edu>
To: dia-list gnome org
Subject: Re: TODO item: proportional scaling
Date: Thu, 2 May 2002 08:42:24 -0400
On Thu, May 02, 2002 at 07:41:45AM +0200, Cyrille Chepelov wrote:
> Sounds like a good idea; however, this patch can't be applied "as is": there
> has been a lot of StdProp-related changes in CVS, which impact the definition
> of Element (you'll need to add this aspectRatio field to the stdprop
> description of an Element). Also, it must be clear that this approach break
> binary compatibility -- I don't care at all, at least until we hit 1.0, but
> some might.
Well, I guess I'll have to download the CVS code, then.
> > ! if (modifiers == MODIFIER_SHIFT) {
> > ! element_move_handle_aspect(&box->element, handle->id, to, (real) box->element.aspectRatio);
> > ! } else {
> > ! element_move_handle(&box->element, handle->id, to, reason);
> > ! }
>
> Perhaps a better idea here would be to add a parameter to
> element_move_handle (and fix all invocations), passing the modifiers.
> element_move_handle() will be able to access aspectRatio on its own (hmmm --
> better call it aspect_ratio for consistency with the rest of the code,
> thanks), and factorise out the test on the modifiers' state into the common
> element code.
I had this thought as well. Also, why are there two element_move_handle
functions. Wouldn't it make more sense to handle every possible option in
one function? element_move_handle and element_move_handle_aspect have a LOT of
code in common. It would be easy enough to make this one function with an
optional aspect ratio adjustment.
> > *************** box_create(Point *startpoint,
> > *** 511,516 ****
> > --- 515,521 ----
> > elem->corner = *startpoint;
> > elem->width = DEFAULT_WIDTH;
> > elem->height = DEFAULT_WIDTH;
> > + elem->aspectRatio = elem->width / elem->height;
>
> May be better to init this value in element_init(), and not paying attention
> to it if it is zero, and recompute it in element_update_data() ? This way,
> save the extra parameter, there is no change to individual objects, only to
> the common code.
Okay, I'll take a look at that.
--
Titus Anderson