home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / PowerPlant / AGA Classes 1.2 / AGAColors.cp < prev    next >
Encoding:
Text File  |  1996-06-30  |  4.5 KB  |  110 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //    AGAColors.cp
  3. // ===========================================================================
  4. //    “Apple Grayscale Appearance” compliant colors
  5. //    Copyright © 1996 Chrisoft (Christophe ANDRES)  All rights reserved.
  6. //
  7. //    You may use this source code in any application (commercial, shareware, freeware,
  8. //    postcardware, etc), but not remove this notice (no need to acknowledge the use of
  9. //    this class in the about box)
  10. //    You may not sell this source code in any form. This source code may be placed on 
  11. //    publicly accessable archive sites and source code disks. It may not be placed on 
  12. //    profit archive sites and source code disks without the permission of the author, 
  13. //    Christophe ANDRES.
  14. //    
  15. //        This source code is distributed in the hope that it will be useful,
  16. //        but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. //        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  18. //
  19. //    If you make any change or improvement on this class, please send the improved/changed
  20. //    version to : chrisoft@calva.net or Christophe ANDRES
  21. //                                     20, rue Prosper Mérimée
  22. //                                     67100 STRASBOURG
  23. //                                     FRANCE
  24. //
  25. // ===========================================================================
  26. //    AGAColors.h            <- double-click + Command-D to see declaration
  27. //
  28. //    AGAColors define the colors of the “Apple Grayscale Appearance for System 7.5”
  29. //        and some related routines
  30. //
  31. //        Version : 1.2
  32. //
  33. //        Change History (most recent first, date in US form : mm/dd/yy):
  34. //
  35. //                        06/30/96    ca        Public release of version 1.2
  36. //                        06/04/96    ca        Increased version to 1.2
  37. //                        05/25/96    ca        Changed PaneInColor to return false if less than 16 colors
  38. //                        05/20/96    M™H        Added the A1 to A4 colors needed for LAGADiscloTriangle
  39. //                        05/15/96    ca        Added the “A” color which is needed only for the Indeterminate progress indicator
  40. //                                                        Replaced HasAGAColors with PaneInColor, which carries the same purpose, but is better
  41. //                                                        and was designed and submitted by Michael(tm) Hamel <mhamel@adi.co.nz> (Thanks ;)
  42. //                        05/11/96    ca        Increased release version to 1.1
  43. //                                                        Added HasAGAColors to check if a pane can draw in color
  44. //                                                        Added Change History
  45. //                        04/22/96    ca        file made available
  46. //                                                        (version 1.0)
  47. //
  48. //        To Do:
  49. //
  50.  
  51. #pragma once
  52.  
  53. #include "AGAColors.h"
  54. #include <QuickDraw.h>
  55. #include <UEnvironment.h>
  56.  
  57. const RGBColor gAGAColorArray[] = {    {0xFFFF, 0xFFFF, 0xFFFF},        //    W
  58.                                                                         {0xEEEE, 0xEEEE, 0xEEEE},     //    1
  59.                                                                         {0xDDDD, 0xDDDD, 0xDDDD},     //    2
  60.                                                                         {0xCCCC, 0xCCCC, 0xCCCC},     //    3
  61.                                                                         {0xBBBB, 0xBBBB, 0xBBBB},     //    4
  62.                                                                         {0xAAAA, 0xAAAA, 0xAAAA},     //    5
  63.                                                                         {0x9999, 0x9999, 0x9999},     //    6
  64.                                                                         {0x8888, 0x8888, 0x8888},        //    7
  65.                                                                         {0x7777, 0x7777, 0x7777},        //    8
  66.                                                                         {0x6666, 0x6666, 0x6666},        //    9
  67.                                                                         {0x5555, 0x5555, 0x5555},        //    10
  68.                                                                         {0x4444, 0x4444, 0x4444},        //    11
  69.                                                                         {0x2222, 0x2222, 0x2222},        //    12
  70.                                                                         {0x0000, 0x0000, 0x0000},        //    B
  71.                                                                         {0x3333, 0x3333, 0x3333},        //    A                                                            <05/15/96    ca>
  72.                                                                         {0xCCCC, 0xCCCC, 0xFFFF},        //    A1                                                        <05/20/96 M™H> for LAGADiscloTriangle
  73.                                                                         {0x9999, 0x9999, 0xFFFF},        //    A2
  74.                                                                         {0x6666, 0x6666, 0xCCCC},        //    A3
  75.                                                                         {0x3333, 0x3333, 0x9999}        //    A4
  76.                                                                     };
  77.  
  78.  
  79. // -Contributed by Michael(tm) Hamel <mhamel@adi.co.nz>------------------------------------------------------------
  80. Boolean PaneInColor (LPane* aPane)
  81. // Return false if any part of this pane is on a monochrome device - M™H
  82. {
  83.     Rect pRect;
  84.     GDHandle aDevice;
  85.     Rect iSect;
  86.  
  87.     if (!UEnvironment::HasFeature(env_SupportsColor))
  88.         return false;
  89.         
  90.     if (!aPane->CalcPortFrameRect(pRect))
  91.         return false;        // Outside QD space, so its academic really
  92.         
  93.     aPane->PortToGlobalPoint(topLeft(pRect));
  94.     aPane->PortToGlobalPoint(botRight(pRect));
  95.     aDevice = ::GetDeviceList();
  96.     while (aDevice!=nil)
  97.         {
  98.             if (::TestDeviceAttribute(aDevice,screenActive) &&
  99.                    ::TestDeviceAttribute(aDevice,screenDevice))
  100.               {
  101.                    ::SectRect(&((**aDevice).gdRect),&pRect,&iSect);
  102.                    if (iSect.left!=iSect.right)
  103.                          if ((**((**aDevice).gdPMap)).pixelSize < 4)                                                                            //    <05/25/96    ca>
  104.                              return false;
  105.                 }
  106.             aDevice = ::GetNextDevice(aDevice);
  107.         }
  108.     return true;
  109. }
  110.