home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / sound / chaneler.sit / Channelizer.ƒ / ResUtil.p < prev    next >
Text File  |  1989-09-08  |  2KB  |  102 lines

  1. unit ResUtil;
  2. { Copyright ⌐ 1989 Chris Muir, Entropy Engineering.        }
  3. { Internet:    (hplabs,pacbell,ucbvax,apple) !well!cbm     }
  4. { Pan:        ZMS                                            }
  5. { US Mail:    360 Elizabeth St. San Francisco, CA 94114    }
  6.  
  7.  
  8. {+++++++++++++++++++++++    History    +++++++++++++++++++++++}
  9.  
  10. { 0.0a        ╩July 27, 1989    cbm}
  11. {    brand spanking new }
  12.  
  13. interface
  14.  
  15.  
  16.     function WasResErr (theRoutine: str255): boolean;
  17.  
  18.  
  19. implementation
  20.  
  21.     const
  22.         rResErrDlg = 11;
  23.         iUmHmm = 1;
  24.  
  25. {_____________________    ResErrDialog    _____________________}
  26.  
  27.     procedure ResErrDialog (Msg1, Msg2: str255);
  28.         var
  29.             tempRect: Rect;
  30.             itemType: Integer;
  31.             item: Handle;
  32.             itemHit: Integer;
  33.             theDialog: DialogPtr;
  34.             ByeBye: boolean;
  35.     begin
  36.         theDialog := GetNewDialog(rResErrDlg, nil, Pointer(-1));        { grab that puppy }
  37.         paramText(Msg1, Msg2, '', '');                                { Speak }
  38.         ShowWindow(theDialog);
  39.         SelectWindow(theDialog);
  40.         ByeBye := false;
  41.  
  42.         repeat    { do that dialog }
  43.             ModalDialog(nil, itemHit);
  44.             GetDItem(theDialog, itemHit, itemType, item, tempRect);
  45.  
  46.             if (itemHit = iUmHmm) then
  47.                 begin
  48.                     ByeBye := TRUE;
  49.                 end;
  50.  
  51.         until ByeBye;            { done w/ bragging }
  52.         DisposDialog(theDialog);    { so flush it }
  53.  
  54.     end;    { ResErrDialog }
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61. {_____________________    WasResErr    _____________________}
  62.  
  63.  
  64.     function WasResErr (theRoutine: str255): boolean;
  65.         var
  66.             myErr: integer;
  67.     begin
  68.         myErr := ResError;
  69.         if myErr <> noErr then
  70.             begin
  71.                 WasResErr := true;
  72.                 case myErr of
  73.                     resNotFound: 
  74.                         begin
  75.                             ResErrDialog('Could not find a requested resource. ', theRoutine)
  76.                         end;
  77.                     resFNotFound: 
  78.                         begin
  79.                             ResErrDialog('Could not find the resource file. ', theRoutine)
  80.                         end;
  81.                     addResFailed: 
  82.                         begin
  83.                             ResErrDialog('Could not add a resource. ', theRoutine)
  84.                         end;
  85.                     rmvResFailed: 
  86.                         begin
  87.                             ResErrDialog('Could not remove a resource. ', theRoutine)
  88.                         end;
  89.                     otherwise
  90.                         begin
  91.  
  92.                         end;
  93.                 end;    { case myErr of }
  94.             end    { if myErr <> noErr  }
  95.         else
  96.             begin    { if myErr = noErr  }
  97.                 WasResErr := false;
  98.             end;
  99.     end;    { CheckResErr }
  100.  
  101.  
  102. end.