castan@munnari.oz (Jason Castan) (06/20/88)
This is a message from John Lim, author of Moire screensaver : I am trying to write a menu clock that is compatible with colour menubars. The code below sets the menubar colour properly if the pixel depth remains the same all the time. However when the pixel depth is changed, the menu clock's port fails to change to match. Obviously I need to use the Palette Manager. Unfortunately, the GrafCPort I use is created at bootup, when the Window/Pallette Manager has not yet been initialized. Furthermore, I dont have easy access to a Mac 2, so programming in colour is difficult for me. If anyone can send me some source showing how to do use the Pallette Manager I would be grateful. I am drawing the clock every 1/2 second in the GetNextEvent Trap, which I have patched. /* This routine ensures that the clockPort blends in with the rest of the menubar, and is called just before the digital clock is drawn using DrawString. */ ResetMenuColor() { register MCEntryPtr mcp; GrafPtr savePort; if (! colorQD) return; GetPort(&savePort); SetPort(clockPortPtr); /* Port created at bootup */ mcp = GetMCEntry(0,0); if (mcp) { RGBColor titles, bar; titles = mcp->mctRGB1; bar = mcp->mctRGB4; RGBForeColor(&titles); RGBBackColor(&bar); } else { static RGBColor blackC = { 0,0,0 }, whiteC = {0xffff,0xffff,0xffff}; RGBForeColor(&blackC); RGBBackColor(&whiteC); } SetPort(savePort); } Thanks. ------------ Please send private email to Jason Castan and I will forward it to John Lim . If there is enough interest, I will post the results to the net. castan@munnari.oz