Platinum Backgrounds
A problem was discovered in redrawing some
window content under Mac OS 8 with the Platinum
Appearance. When the window needs updating due to
resizing, contents change, window z-order change,
etc. the background color may draw using the
standard white background rather than the proper
Platinum Appearance color.
The fix involves replacing four files:
- UWindow.cp
- UBackgroundAdorner.h
- UBackgroundAdorner.cp
- UView.cp
These four files can be found in the "Late
Breaking" folder in the MacApp Release 13
distribution.
To accomplish the basic change to the color
environment, TWindow::Focus was modified to set the
current grafport's background color if a content
region color is available for the window. This
solves 99% of the problem. When drawing in an
update cycle, the windows erase to the right color,
views and adorners draw in their desired colors and
everything is fine... almost. Direct drawing, that
is, drawing when the view wants to rather than in
response to an update, was still problematic.
TTEView and TEditText will illustrate this problem.
The views will image correctly but then during
typing will draw with a gray background even when
they have a TWhiteBackgroundAdorner attached.
MacApp has a means of controllling the drawing
environment even more completely:
TDrawingEnvironment. This class has three methods
of interest: Prepare, Setup and Complete. Prepare
and Complete are designed be balanced, saving and
restoring the pen and colors (or going offscreen
and back if you have a custom TDrawingEnvironment
for double buffering). Prepare is designed
"prepare" the grafport for drawing, that is, apply
the desired changes to the drawing environment just
before drawing. TView::Focus was modified so that
it calls the Setup method of any attached drawing
environment after focusing. TWhiteBackgroundAdorner
was changed to install a drawing environment in the
view to which it was attached when it had a color
environment identical to the one used during
drawing. This way, whenever the view was focused
the color environment was properly specified.
|