[comp.sys.mac] Filtering

lsr@apple.UUCP (05/30/87)

In article <18940@ucbvax.BERKELEY.EDU> oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) writes:
>
>  a.)suppose we are looking at a pascal program. 
>  b.)Now, in our example, we create a "egrep" filter and place it
>  on top of the windowCat window. We tell the egrep filter
>"procedure|function" in its "command line" - a pane of the filter we
>use for giving the filter parameters. 
>The combined pair present us with a new virtual document, or view,
>that contains only the lines with either "procedure" or "function" on
>them. our window looks like:

The same idea is useful in implementing Undo.  

For example, consider selecting all the shapes in a MacDraw document and
changing their shades to white.  To save the old state of the document would
require storage proportional to the size of the document, which would be
unacceptable.  

The solution is to implement the 'change shade to white' command as a filter
on top of the document.  The filter simply displays every shape with a white
fill pattern, rather than the pattern stored in the document.

To undo the command, you simply remove the filter and redisplay the shapes.

At some point you DO have to change the internal data structures, assuming
that the command hasn't been undone..  This happens when the command can no
longer be undone (generally just before the next command is executed).

-- 
Larry Rosenstein

Object Specialist
Apple Computer

AppleLink: Rosenstein1
UUCP:  {sun, voder, nsc, mtxinu, dual}!apple!lsr
CSNET: lsr@Apple.com