home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Pascal / Snippets / PNL Libraries / MyTypes.p < prev    next >
Encoding:
Text File  |  1996-11-27  |  4.3 KB  |  189 lines  |  [TEXT/CWIE]

  1. unit MyTypes;
  2.  
  3. { From Peter's PNL Libraries }
  4. { Copyright 1992 Peter N Lewis }
  5. { This source may be used for any non-commercial purposes as long as I get a mention }
  6. { in the About box and Docs of any derivative program.  It may not be used in any commercial }
  7. { application without my permission }
  8.  
  9. interface
  10.  
  11.     uses
  12.         Quickdraw, Events;
  13.  
  14.     const
  15.         inProgress = 1;                            { I/O in progress }
  16.         sysWDProcID = $4552494B;        { 'ERIK' }
  17.         myErr = -5;
  18.         myErr2 = -6;
  19.         cancelErr = myErr2;
  20.         myErr3 = -7;
  21.         noType = 0;                            { should be OSType(0) !!! }
  22.         fsNoCache = $20;
  23.         fsNewLine = $80; { put the newline character in the high Byte of ioPosMode }
  24.         bad_rn = 0;
  25.         bad_date = 1; {$80000000;}
  26.         bad_refnum = -32768;
  27.         bad_vrefnum = -4567;
  28.         bad_dirID = -4567;
  29.         window_at_front = WindowPtr(-1);
  30.     
  31.     const
  32.         ticks_in_ms = 17;
  33.         second_in_ms = 1000;
  34.         minute_in_ms = longint(60) * second_in_ms;
  35.         hour_in_ms = longint(60) * minute_in_ms;
  36.         day_in_ms = longint(24) * hour_in_ms;
  37.         second_in_ticks = longint(60);
  38.         minute_in_ticks = longint(60)*second_in_ticks;
  39.         hour_in_ticks = longint(60)*minute_in_ticks;
  40.         day_in_ticks = longint(24)*hour_in_ticks;
  41.         minute_in_seconds = longint(60);
  42.         hour_in_seconds = longint(60)*minute_in_seconds;
  43.         day_in_seconds = longint(24)*hour_in_seconds;
  44.         hour_in_minutes = longint(60);
  45.         day_in_minutes = longint(24)*hour_in_minutes;
  46.         day_in_hours = longint(24);
  47.  
  48.     const
  49.         M_Apple = 128;
  50.         M_File = 129;
  51.         M_Edit = 130;
  52.         M_Windows = 150;
  53.  
  54.     const
  55.         Cabout = 'abou';
  56.         Cnew = 'new ';
  57.         Copen = 'open';
  58.         Csave = 'save';
  59.         Csaveas = 'svas';
  60.         Cclose = 'clos';
  61.         Cpreferences = 'pref';
  62.         Cpagesetup = 'pgsu';
  63.         Cprint = 'prnt';
  64.         Chelp = 'help';
  65.         Cquit = 'quit';
  66.         Cundo = 'undo';
  67.         Ccut = 'cut ';
  68.         Ccopy = 'copy';
  69.         Cpaste = 'past';
  70.         Cclear = 'clea';
  71.         Cselectall = 'sela';
  72.  
  73.     const
  74.         keyOdocOption = 'auto'; { optional parameter to open }
  75.         keyOdocControl = 'autC'; { optional parameter to open }
  76.  
  77.     const                                    { Low Memory Globals }
  78.         curApNameA = $910;
  79.         ticksA = $16A;
  80.         SFSaveDiskA = $214;
  81.         CurDirStoreA = $398;
  82.  
  83.     const                                    { Other OS constants, probably declared somewhere now }
  84.         kSysEnvironsVersion = 1;
  85.         kOSEvent = osEvt;                {event used by MultiFinder}
  86.         kSuspendResumeMessage = 1;    {high Byte of suspend/resume event message}
  87.         kResumeMask = 1;                    {bit of message field for resume vs. suspend}
  88.         kMouseMovedMessage = $00FA;    {high Byte of mouse-moved event message}
  89.         kNoEvents = 0;                        {no events mask}
  90.  
  91.     const                                    { Constants that aren't normally defined }
  92.         drawCntlMsg = 0;
  93.         testCntlMsg = 1;
  94.         calcCRgnsMsg = 2;
  95.         initCntlMsg = 3;
  96.         dispCntlMsg = 4;
  97.         posCntlMsg = 5;
  98.         thumbCntlMsg = 6;
  99.         dragCntlMsg = 7;
  100.         autoTrackMsg = 8;
  101.  
  102.     const
  103.         EMundo = 1;
  104.         EMcut = 3;
  105.         EMcopy = 4;
  106.         EMpaste = 5;
  107.         EMclear = 6;
  108.         EMselectall = 7;
  109.  
  110.     const
  111.         nulChar = 0;
  112.         homeChar = $01;
  113.         enterChar = $03;
  114.         endChar = $04;
  115.         helpChar = $05;
  116.         backSpaceChar = $08;
  117.         tabChar = $09;
  118.         lfChar = $0A;
  119.         pageUpChar = $0b;
  120.         pageDownChar = $0c;
  121.         crChar = $0D;
  122.         escChar = $1b;
  123.         escKey = $35;
  124.         clearChar = $1b;
  125.         clearKey = $47;
  126.         leftArrowChar = $1c;
  127.         rightArrowChar = $1d;
  128.         upArrowChar = $1e;
  129.         downArrowChar = $1f;
  130.         spaceChar = $20;
  131.         delChar = $7f;
  132.         bulletChar = $a5;
  133.         undoKey = $7a;
  134.         cutKey = $78;
  135.         copyKey = $63;
  136.         pasteKey = $76;
  137.  
  138.     const
  139.         nul = chr(nulChar);
  140.         enter = chr(enterChar);
  141.         bs = chr(backSpaceChar);
  142.         tab = chr(tabChar);
  143.         lf = chr(lfChar);
  144.         cr = chr(crChar);
  145.         leftArrow = chr(leftArrowChar);
  146.         rightArrow = chr(rightArrowChar);
  147.         upArrow = chr(upArrowChar);
  148.         downArrow = chr(downArrowChar);
  149.         esc = chr(escChar);
  150.         spc = chr(spaceChar);
  151.         del = chr(delChar);
  152.  
  153.     type
  154.         integerP = ^integer;
  155.         integerH = ^integerP;
  156.         unsignedwordP = ^unsignedword;
  157.         unsignedwordH = ^unsignedwordP;
  158.         longintP = ^longint;
  159.         longintH = ^longintP;
  160.         unsignedlongP = ^unsignedlong;
  161.         unsignedlongH = ^unsignedlongP;
  162.         ptrint = longint; { integer type to cast pointers to to do pointer arithmatic }
  163.         forkType = (no_fork, data_fork, rsrc_fork, both_fork);
  164.         buf255 = packed array[0..255] of char;
  165.         CRLFTypes = (CL_CRLF, CL_CR, CL_LF);
  166.         CharSet = set of char;
  167.         short = integer;
  168.         long = longint;
  169.  
  170.     type
  171.         QDGlobalsPtr = ^QDGlobals;
  172.  
  173.     function GetQDGlobals: QDGlobalsPtr;
  174. {$IFC not GENERATINGPOWERPC }
  175.     inline
  176.         $2015, $0480, $0000, $00CA, $2E80;
  177. {$ENDC}
  178.  
  179. implementation
  180.  
  181. {$IFC GENERATINGPOWERPC }
  182.     function GetQDGlobals: QDGlobalsPtr;
  183.     begin
  184.         GetQDGlobals := @qd;
  185.     end;
  186. {$ENDC}
  187.  
  188. end.
  189.