>>> The inconsistencies are intentional.  One can select specific collections
>>> of points from a polygon or spline to edit, where the edit is a separate
>>> command.  The selected points need to be saved on the undo stack in between.
>> Isn't this a premature optimization of sorts? Would it be conceptually 
>> simpler
>> to just copy the whole object to the undo stack, and move it back on redo?
> 
> I didn't mean to suggest that only the selected points were saved to the undo
> stack.  Although there is optimization where the element doesn't change, e.g.,
> "move element right 100" is saved on the undo stack as "move from X to X + 
> 100".
> Where the element may change, it's just a wholesale copy, like you say.

OK, so I will remove that optimization, since in light of other upcoming 
changes it'll
make little sense. I have to delve into the undo code and figure what can be 
simplified,
but first I have to get a hang of how it works.

> 
>> I presume it would be OK, then, to always perform the cycle copy, then -- at 
>> most
>> the copied cycle point list will be unused. This makes the code cleaner and 
>> you
>> don't have to worry about potentially not copying it when it'd need to be 
>> copied.
> 
> Yes, I don't see any issue with this.

Great, thanks.

BTW, it's funny how we both did similar things with editing and redraws.

I've modified the 4.6 code to draw spline and arc edit handles in the expose 
code,
in all cases (say a spline within a path). That's due to all of the drawing 
code outside of
expose being a no-op. I was using getsubpart to get currently edited part in a 
path.

Then 4.7 came, and you rolled edited elements into the selection -- that made 
the code
simpler, of course, and no more UDrawEditSpline -- yay. Now the virtual draw() 
method
handles drawing of everything; I still have to figure how to unintrusively 
handle levels in
objinsts but that's a minor gripe; probably draw() will get the level as a 
parameter.

 -- Kuba

PS. The change I made in 4.6 looked like this -- I added handling of Exxx_MODE.

         else if (eventmode == ARC_MODE || eventmode == EARC_MODE) {
            arcptr newarc = TOARC(EDITPART);
            XSetXORFg(newarc->color, BACKGROUND);
            UDrawArc(newarc);
            UDrawXLine(areawin->save, newarc->position);
         }
         else if (eventmode == SPLINE_MODE || eventmode == ESPLINE_MODE) {
            splineptr newspline = TOSPLINE(EDITPART);
            XSetXORFg(newspline->color, BACKGROUND);
            UDrawEditSpline(newspline);
         }
         else if (eventmode == EPATH_MODE) {
            genericptr ggen = getsubpart(TOPATH(EDITPART));
            if (IS_SPLINE(ggen)) {
                splineptr newspline = TOSPLINE(&ggen);
                XSetXORFg(newspline->color, BACKGROUND);
                UDrawEditSpline(newspline);
            }
         }


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

Reply via email to