Lanier, Paul wrote:
> Hey Everyone,
>
> I started building a class to record dc operations in a
list. I have a
> preliminary version and would like to get a review of
the code. It's
> been a while since I did much C++ coding so if
something looks strange,
> that is why
>
> The class is pretty simple. It stores the operations
as a linked list
> of nodes of different types depending on what argument
types a given
> method has. Each list node is associated with an id so
that operations
> can be segmented by what actual object they represent.
Then if an
> object is changed, you can remove the operations
associated with that
> object and then re-draw it.
>
> I also do some coarse clipping to speed things up. I
hope to do this
> clipping at the object level in the future but right
now it is done for
> any drawing operation that I can be sure is outside of
the rect that is
> passed in. Doing it at the object level would allow
SetXXX functions
> and things like DrawText to be clipped where I can't
easily tell whether
> they are needed or not.
>
> Have a look at the code and let me know how it looks.
I've only
> implemented a few of the dc methods so far. I'll
implement the rest
> once I'm sure the architecture is ok.
1. wxWidgets has some container classes already, you might
think about
using one of them for your list.
2. Instead of having the big switch statement in the DrawTo
methods I
would move the drawing operations out to the node classes.
Give each
one of them virtual Draw(dc) and Draw(dc, rect) methods,
then the
playback loop becomes simply something like this:
while (pt != &m_list)
{
pt->Draw(dc, rect);
pt = pt->Next();
}
and the wxPseudoDC class doesn't need to know anything
about the guts of
each type of node.
3. It might be nice to have a way to playback only the nodes
that have a
particular ID.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java
give you jitters? Relax with wxPython!
------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-dev-unsubscribe lists.wxwidgets.org
For additional commands, e-mail: wxPython-dev-help lists.wxwidgets.org
|