home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Pascal / Snippets / TruchetTiles / Prefs.pas < prev    next >
Encoding:
Text File  |  1994-08-09  |  5.9 KB  |  75 lines  |  [TEXT/PJMM]

  1. unit prefsUnit;
  2. interface
  3.     uses
  4.         PrintTraps, Quickdraw, Picker, Palettes, Globs, DlogStuff;
  5.  
  6.  
  7.     procedure DoPrefs;                {handle the Preferences dialog}
  8.  
  9.     const
  10.         prefsDLOGID = 3141;            {Resource ID of our dialog}
  11.  
  12.         okayBtn = 1;                        {DITL numbers}
  13.         cancelBtn = 2;
  14.         InvertCBx = 3;
  15.         ArcsRB = 4;
  16.         LinesRB = 5;
  17.         BoxSizeET = 7;
  18.         boundTilesCBx = 9;
  19.         randScrl = 10;
  20.  
  21.     var
  22.         PrefsDLOGPtr: DialogPtr;
  23.         tempGlobals: GlobalDataRec;    {storage for temporary values}
  24.  
  25. implementation
  26.  
  27. {====================================fsDLOGPtr, BoxSizeET, anInt, aHdl, aRect);
  28.                             GetIText(aHdl, aStr);
  29.                             anInt := String2Int(aStr);
  30.                             if (anInt > 4) and (anInt < 101) then
  31.                                 begin
  32.                                     tempGlobals.TileSize := anInt;
  33.                                     gdh^^ := tempGlobals;
  34.                                     finished := TRUE;
  35.                                 end
  36.                             else
  37.                                 begin
  38.                                     SysBeep(1);
  39.                                     DoMessage('**Sorry, the side of a tile must be', 'between 5 and 100.', '', '');
  40.                                     SelIText(PrefsDLOGPtr, BoxSizeET, 0, 32767);    {pre-doubleclick the item}
  41.                                 end;
  42.                         end;
  43.                     cancelBtn: 
  44.                         begin
  45.                             finished := TRUE;
  46.                         end;
  47.                     InvertCBx: 
  48.                         begin
  49.                             tempGlobals.InvertRendering := not tempGlobals.InvertRendering;
  50.                             CheckABox(PrefsDLOGPtr, InvertCBx, tempGlobals.InvertRendering);
  51.                         end;
  52.                     ArcsRB: 
  53.                         begin
  54.                             tempGlobals.tileStyle := Arcs;
  55.                             PushRadioButton(PrefsDLOGPtr, ArcsRB, ArcsRB, LinesRB);
  56.                         end;
  57.                     LinesRB: 
  58.                         begin
  59.                             tempGlobals.tileStyle := Lines;
  60.                             PushRadioButton(PrefsDLOGPtr, LinesRB, ArcsRB, LinesRB);
  61.                         end;
  62.                     boundTilesCBx: 
  63.                         begin
  64.                             tempGlobals.showTileBounds := not tempGlobals.showTileBounds;
  65.                             CheckABox(PrefsDLOGPtr, boundTilesCBx, tempGlobals.showTileBounds);
  66.                         end;
  67.                     otherwise
  68.                         ;
  69.                 end;{case itemHit}
  70.             end;{while not finished}
  71.         DisposDialog(PrefsDLOGPtr);
  72.         SetPort(oldPort);
  73.     end;{DoPrefs}
  74.  
  75. end.{prefsUnit unit}