On Nov 11, 2010, at 2:02 PM, Tim Edwards wrote:

> Kuba,
> 
>>>> Any ideas how to decouple that? I haven't looked very closely, I admit.
>>> Further note: the code in question is below the telling comment
>>> /* Redraw the label */ -- so it should be removed, preserving any side 
>>> effects.
>>> It appears to have no side effects besides moving the origin of the areawin,
>>> thus I put it into an #if 0 block. I presume that this code intends to keep 
>>> the label
>>> visible in the window while you edit it.
>> 
>> I guess I was wrong. areawin->origin is used often in editing and selection 
>> code. So
>> this is nothing about keeping stuff visible I'd guess, and this code needs 
>> to be preserved.
> 
> On the contrary, I don't really see what the code is doing---all of
> it appears to be doing nothing more than what is already done in the
> redraw code.  I commented out everything except for the GXcopy set and
> redrawtext() call at the end, and I can't see that anything has changed.
> I assume that it is just redundant or unnecessary code.

Well, I won't complain about that of course, I'm all for getting rid of useless 
code.
The question is: does anything use the areawin->origin that was set there? 
That's the
real deal. If nothing uses it, then the code should go. I've disabled it in an 
#if 0 block, just
in case. 

>> A similar areawin->origin manipulation is done in edit() for the LABEL case.
> 
> I use areawin->origin mostly to preserve the starting point for moves and
> pans, edits and such;  it's just a general-purpose placeholder.
> 
>> I will simply create a local context for that, since the first thing the 
>> context does is to
>> call UMakeWCTM() on the top of matStack. So this is no biggie, apparently, 
>> as long
>> as it checks works ;)
>> 
>> Methinks that ULength() and its ilk care for, when called from a random 
>> non-repaint event,
>> is the WCTM -- as there would be nothing else on the MatStack at that time.
> 
> ULength() is used in the painting code to get the dimensions of a
> label, in the window coordinates.  It is re-used other places to get
> the dimensions of a label in user-space coordinates.  It should be
> easy enough to let ULength() return only the user coordinates, and
> have a separate routine that scales the result according to UTopScale().
> Only the latter would be called from the repaint code, presumably.

OK, that makes sense. Am I right that ULength() deals with user coordinates
when given a 0.0 scale, and window coordinates otherwise?

Kuba
_______________________________________________
Xcircuit-dev mailing list
[email protected]
http://www.opencircuitdesign.com/mailman/listinfo/xcircuit-dev

Reply via email to