CLIM mail archive

[Prev][Next][Index][Thread]

Avoid updating parent output-record's size since already known



   Date:	Tue, 4 Jan 1994 08:23:02 -0800
   From:	Curt Eggemeyer <curt@eraserhead.jpl.nasa.gov>

   Within the Clim1.1 world!

   Is there a quickie way of avoid having the generation of children output
   records factor into the size of their respective parent records ala overwriting
   a particular method of the parent object to not bother figuring this out? 
   This would speed things for my particular case as illustrated below.

   Parent record is a rectangular area with the children output records
   as sub-rectangles within that area (below). Basically drawing rectangles
   within larger rectangles!

Make a subclass of linear-output-record to serve as your new parent
record.  Then write an :AROUND method like this:

(defvar *suppress-extent-calculation* nil)

(defmethod recompute-extent-for-new-element :around ((record my-new-class) element)
  (unless *suppress-extent-calculation*
    (call-next-method)))

Then you can bind the special (presumably via a
with-extent-calculation-suppressed macro) around the code that wants
to avoid the extent-calculation overhead, hopefully without breaking
anything else.

One issue: you need to get the parent record sized at least once to
encompass the area that will be occupied by the children.  You could
do this by creating an initial child big enough to hold everything, or
by manually setting the size:

(bounding-rectangle-set-edges record min-x min-y max-x max-y)

Of course, any of this that uses undocumented CLIM interfaces will
probably break in the next release.

References:

Main Index | Thread Index