home *** CD-ROM | disk | FTP | other *** search
- #include "my color.h"
- do_update(the_event)
- EventRecord *the_event;
- {
- CGrafPtr the_tiff_picture;
- Rect erase_rect, draw_rect, tempRect;
- CWindowPtr active_window;
- short i, number_of_pm_entries = 255;
-
- GetPort(&savedPort); /* SAVE THE CURRENT P0RT */
- active_window = (CWindowPtr)the_event->message;
- SetPort((GrafPtr)active_window); /* SET PORT TO THE ONE NEEDING UPDATING */
-
- if(active_window)
- {
-
- the_tiff_picture = (CGrafPtr)GetWRefCon(active_window);
- erase_rect = active_window->portRect;
- erase_rect.bottom -= BAR_WIDTH; /* Don't erase the scroll bars. If you do, they will flicker terribly */
- erase_rect.right -= BAR_WIDTH;
- BeginUpdate(active_window);
- EraseRect(&erase_rect);
- SetRect(&tempRect, number_of_pm_entries, number_of_pm_entries, number_of_pm_entries, number_of_pm_entries);
- /*
- for (i = 2; i <= number_of_pm_entries; i++)
- {
- PmForeColor(i);
- FrameOval (&tempRect);
- InsetRect (&tempRect, -1, -1);
- }
- */
- if(the_tiff_picture) /* only copy the picture into the window if there is actually a picture */
- {
- draw_rect = active_window->portRect; /* define the destination rectangle for the PixMap */
- draw_rect.bottom = draw_rect.top + ((*the_tiff_picture).portRect.bottom - (*the_tiff_picture).portRect.top);
- draw_rect.right = draw_rect.left + ((*the_tiff_picture).portRect.right - (*the_tiff_picture).portRect.left);
- HLock((*the_tiff_picture).portPixMap);
- HLock((*active_window).portPixMap);
- CopyBits( *(*the_tiff_picture).portPixMap,
- *(*active_window).portPixMap,
- &(*the_tiff_picture).portRect,
- &draw_rect,
- srcCopy, 0L);
- HUnlock((*active_window).portPixMap);
- HUnlock((*the_tiff_picture).portPixMap);
- ActivatePalette(active_window);
- }
- DrawControls(active_window);
- DrawGrowIcon(active_window);
- EndUpdate(active_window);
-
-
- }
- else
- {
- erase_rect = active_window->portRect;
- erase_rect.bottom -= (BAR_WIDTH + ONE_PIXEL); /* Don't erase the scroll bars. If you do, they will flicker terribly */
- erase_rect.right -= (BAR_WIDTH + ONE_PIXEL);
- BeginUpdate(active_window);
- EraseRect(&erase_rect);
- DrawControls(active_window);
- DrawGrowIcon(active_window);
- EndUpdate(active_window);
-
- }
- SetPort(savedPort); /* set port to original port */
- }
-
-
-