Package Name: standardfile

Return to: Package List


with Interfaces.C.Extensions; use  Interfaces.C.Extensions;
with Interfaces.C.Strings; use  Interfaces.C.Strings;
with Types; use Types;
with Events; use Events;
with Files; use Files;
with Dialogs; use Dialogs;

package StandardFile is
   --  
   --  File:       StandardFile.h
   --  
   --  Contains:   Standard File package Interfaces.
   --  
   --  Version:    Technology: System 7.5
   --              Package:    Universal Interfaces 2.1 in ÒMPW LatestÓ on ETO #18
   --  
   --  Copyright:  © 1984-1995 by Apple Computer, Inc.
   --              All rights reserved.

   --  
   -- resource IDs and item offsets of pre-7.0 dialogs 
   putDlgID                :constant := -3999;
   putSave                 :constant := 1;
   putCancel               :constant := 2;
   putEject                :constant := 5;
   putDrive                :constant := 6;
   putName                 :constant := 7;
   getDlgID                :constant := -4000;
   getOpen                 :constant := 1;
   getCancel               :constant := 3;
   getEject                :constant := 5;
   getDrive                :constant := 6;
   getNmList               :constant := 7;
   getScroll               :constant := 8;
   -- resource IDs and item offsets of 7.0 dialogs
   sfPutDialogID           :constant := -6043;
   sfGetDialogID           :constant := -6042;
   sfItemOpenButton        :constant := 1;
   sfItemCancelButton      :constant := 2;
   sfItemBalloonHelp       :constant := 3;
   sfItemVolumeUser        :constant := 4;

   sfItemEjectButton       :constant := 5;
   sfItemDesktopButton     :constant := 6;
   sfItemFileListUser      :constant := 7;
   sfItemPopUpMenuUser     :constant := 8;
   sfItemDividerLinePict   :constant := 9;
   sfItemFileNameTextEdit  :constant := 10;
   sfItemPromptStaticText  :constant := 11;
   sfItemNewFolderUser     :constant := 12;
   -- pseudo-item hits for use in DlgHook 
   sfHookFirstCall         :constant := -1;
   sfHookCharOffset        :constant := 16#1000#;
   sfHookNullEvent         :constant := 100;
   sfHookRebuildList       :constant := 101;
   sfHookFolderPopUp       :constant := 102;
   sfHookOpenFolder        :constant := 103;
   -- the following are only in system 7.0+ 
   sfHookOpenAlias         :constant := 104;
   sfHookGoToDesktop       :constant := 105;
   sfHookGoToAliasTarget   :constant := 106;
   sfHookGoToParent        :constant := 107;
   sfHookGoToNextDrive     :constant := 108;
   sfHookGoToPrevDrive     :constant := 109;

   sfHookChangeSelection   :constant := 110;
   sfHookSetActiveOffset      :constant := 200;

   sfHookLastCall          :constant := -2;
   -- the refcon field of the dialog record during a
   -- modalfilter or dialoghook contains one of the following 
   sfMainDialogRefCon         :constant types.OSType:= types.tores("stdf");
   sfNewFolderDialogRefCon    :constant types.OSType:= types.tores("nfdr");
   sfReplaceDialogRefCon      :constant types.OSType:= types.tores("rplc");
   sfStatWarnDialogRefCon     :constant types.OSType:= types.tores("stat");
   sfLockWarnDialogRefCon     :constant types.OSType:= types.tores("lock");

   sfErrorDialogRefCon        :constant types.OSType:= types.tores("err ");
   type SFReply is 
      record
         good : Boolean;
         copy : Boolean;
         fType : OSType;
         vRefNum : Short_Integer;
         version : Short_Integer;
         fName : Str63;

      end record;
   type StandardFileReply is 
      record
         sfGood      : Boolean;
         sfReplacing : Boolean;
         sfType      : types.OSType;
         sfFile      : files.FSSpec;
         sfScript    : types.ScriptCode;
         sfFlags     : Short_Integer;
         sfIsFolder  : Boolean;
         sfIsVolume  : Boolean;
         sfReserved1 : Long_Integer;
         sfReserved2 : Short_Integer;

      end record;
   --  for CustomXXXFile, ActivationOrderListPtr parameter is a pointer to an array of item numbers

   type ActivationOrderListPtr is Access Short_Integer;
   --  the following also include an extra parameter of "your data pointer"
   type DlgHookProcPtr is access function
      (item        : in     Short_Integer;
       theDialog   : in     DialogPtr)
       return Short_Integer;
   type FileFilterProcPtr is access function
      (pb          : in     CInfoPBPtr)
       return Boolean;
   type DlgHookYDProcPtr is access function
      (item        : in     Short_Integer;
       theDialog   : in     DialogPtr;
       yourDataPtr : in     Void_Ptr)
       return Short_Integer;
   type ModalFilterYDProcPtr is access function
      (theDialog   : in     DialogPtr;
       theEvent    : access EventRecord;
       itemHit     : access Short_Integer;
       yourDataPtr : in     Void_Ptr)
       return Boolean;
   type FileFilterYDProcPtr is access function
      (pb          : in     CInfoPBPtr;
       yourDataPtr : in     Void_Ptr)
       return Boolean;
   type ActivateYDProcPtr is access procedure
      (theDialog   : in     DialogPtr;
       itemNo      : in     Short_Integer;
       activating  : in     Boolean;

       yourDataPtr : in     Void_Ptr);
   subtype DlgHookUPP is UniversalProcPtr;
   subtype FileFilterUPP is UniversalProcPtr;
   subtype DlgHookYDUPP is UniversalProcPtr;
   subtype ModalFilterYDUPP is UniversalProcPtr;
   subtype FileFilterYDUPP is UniversalProcPtr;
   subtype ActivateYDUPP is UniversalProcPtr;
   
   uppDlgHookProcInfo       : constant := 16#000003A0#; -- FUNCTION (2 byte param, 4 byte param): 2 byte result;
   uppFileFilterProcInfo    : constant := 16#000000D0#; -- FUNCTION (4 byte param): 1 byte result;
   uppDlgHookYDProcInfo     : constant := 16#00000FA0#; -- FUNCTION (2 byte param, 4 byte param, 4 byte param): 2 byte result;
   uppModalFilterYDProcInfo : constant := 16#00003FD0#; -- FUNCTION (4 byte param, 4 byte param, 4 byte param, 4 byte param): 1 byte result;
   uppFileFilterYDProcInfo  : constant := 16#000003D0#; -- FUNCTION (4 byte param, 4 byte param): 1 byte result;

   uppActivateYDProcInfo    : constant := 16#000036C0#; -- PROCEDURE (4 byte param, 2 byte param, 1 byte param, 4 byte param);
   type SFTypeList is array(integer range <>) of types.OSType;

   type SFTypeListPtr is access all SFTypeList;
   procedure SFPutFile
     (where              : in     Point;
      prompt             : access Str255;
      origName           : access Str255;
      dlgHook            : in     DlgHookUPP;
      reply              : access SFReply);

   pragma Import (C, SFPutFile, "SFPutFile", "SFPutFile");
   procedure SFGetFile
     (where              : in     Point;
      prompt             : access Str255;
      fileFilter         : in     FileFilterUPP;
      numTypes           : in     Short_Integer;
      typeList           : in     SFTypeListPtr;
      dlgHook            : in     DlgHookUPP;
      reply              : access SFReply);

   pragma Import (C, SFGetFile, "SFGetFile", "SFGetFile");
   procedure SFPPutFile
     (where              : in     Point;
      prompt             : access Str255;
      origName           : access Str255;
      dlgHook            : in     DlgHookUPP;
      reply              : access SFReply;
      dlgID              : in     Short_Integer;
      filterProc         : in     ModalFilterUPP);

   pragma Import (C, SFPPutFile, "SFPPutFile", "SFPPutFile");
   procedure SFPGetFile
     (where              : in     Point;
      prompt             : access Str255;
      fileFilter         : in     FileFilterUPP;
      numTypes           : in     Short_Integer;
      typeList           : in     SFTypeListPtr;
      dlgHook            : in     DlgHookUPP;
      reply              : access SFReply;
      dlgID              : in     Short_Integer;
      filterProc         : in     ModalFilterUPP);

   pragma Import (C, SFPGetFile, "SFPGetFile", "SFPGetFile");
   procedure StandardPutFile
     (prompt             : access Str255;
      defaultName        : access Str255;
      reply              : access StandardFileReply);
   pragma Import (C, StandardPutFile, "StandardPutFile", "StandardPutFile");
   
   procedure StandardGetFile
     (fileFilter         : in     FileFilterUPP;
      numTypes           : in     Short_Integer;
      typeList           : in     SFTypeListPtr;
      reply              : access StandardFileReply);

   pragma Import (C, StandardGetFile, "StandardGetFile", "StandardGetFile");
   procedure CustomPutFile
     (prompt             : access Str255;
      defaultName        : access Str255;
      reply              : access StandardFileReply;
      dlgID              : in     Short_Integer;
      where              : in     Point;
      dlgHook            : in     DlgHookYDUPP;
      filterProc         : in     ModalFilterYDUPP;
      activeList         : in     ActivationOrderListPtr;
      activate           : in     ActivateYDUPP;
      yourDataPtr        : in     Void_Ptr);

   pragma Import (C, CustomPutFile, "CustomPutFile", "CustomPutFile");
   procedure CustomGetFile
     (fileFilter         : in     FileFilterYDUPP;
      numTypes           : in     Short_Integer;
      typeList           : in     SFTypeListPtr;
      reply              : access StandardFileReply;
      dlgID              : in     Short_Integer;
      where              : in     Point;
      dlgHook            : in     DlgHookYDUPP;
      filterProc         : in     ModalFilterYDUPP;
      activeList         : in     ActivationOrderListPtr;
      activate           : in     ActivateYDUPP;
      yourDataPtr        : in     Void_Ptr);

   pragma Import (C, CustomGetFile, "CustomGetFile", "CustomGetFile");
   function StandardOpenDialog
     (reply              : access StandardFileReply)
      return                      OSErr;

   pragma Import (C, StandardOpenDialog, "StandardOpenDialog", "StandardOpenDialog");
   procedure sfpputfileC
     (where              : access Point;
      prompt             : in     Chars_Ptr;
      origName           : in     Chars_Ptr;
      dlgHook            : in     DlgHookUPP;
      reply              : access SFReply;
      dlgID              : in     Short_Integer;
      filterProc         : in     ModalFilterUPP);

   pragma Import (C, sfpputfileC, "sfpputfile", "sfpputfile");
   procedure sfpputfile
     (where              : access Point;
      prompt             : in     Chars_Ptr;
      origName           : in     Chars_Ptr;
      dlgHook            : in     DlgHookUPP;
      reply              : access SFReply;
      dlgID              : in     Short_Integer;
      filterProc         : in     ModalFilterUPP)

   renames sfpputfileC;
   procedure sfpputfile
     (where              : access Point;
      prompt             : in     String;
      origName           : in     String;
      dlgHook            : in     DlgHookUPP;
      reply              : access SFReply;
      dlgID              : in     Short_Integer;

      filterProc         : in     ModalFilterUPP);
   procedure sfgetfileC
     (where              : access Point;
      prompt             : in     Chars_Ptr;
      fileFilter         : in     FileFilterUPP;
      numTypes           : in     Short_Integer;
      typeList           : in     SFTypeListPtr;
      dlgHook            : in     DlgHookUPP;
      reply              : access SFReply);

   pragma Import (C, sfgetfileC, "sfgetfile", "sfgetfile");
   procedure sfgetfile
     (where              : access Point;
      prompt             : in     Chars_Ptr;
      fileFilter         : in     FileFilterUPP;
      numTypes           : in     Short_Integer;
      typeList           : in     SFTypeListPtr;
      dlgHook            : in     DlgHookUPP;
      reply              : access SFReply)

   renames sfgetfileC;
   procedure sfgetfile
     (where              : access Point;
      prompt             : in     String;
      fileFilter         : in     FileFilterUPP;
      numTypes           : in     Short_Integer;
      typeList           : in     SFTypeListPtr;
      dlgHook            : in     DlgHookUPP;

      reply              : access SFReply);
   procedure sfpgetfileC
     (where              : access Point;
      prompt             : in     Chars_Ptr;
      fileFilter         : in     FileFilterUPP;
      numTypes           : in     Short_Integer;
      typeList           : in     SFTypeListPtr;
      dlgHook            : in     DlgHookUPP;
      reply              : access SFReply;
      dlgID              : in     Short_Integer;
      filterProc         : in     ModalFilterUPP);

   pragma Import (C, sfpgetfileC, "sfpgetfile", "sfpgetfile");
   procedure sfpgetfile
     (where              : access Point;
      prompt             : in     Chars_Ptr;
      fileFilter         : in     FileFilterUPP;
      numTypes           : in     Short_Integer;
      typeList           : in     SFTypeListPtr;
      dlgHook            : in     DlgHookUPP;
      reply              : access SFReply;
      dlgID              : in     Short_Integer;
      filterProc         : in     ModalFilterUPP)

   renames sfpgetfileC;
   procedure sfpgetfile
     (where              : access Point;
      prompt             : in     String;
      fileFilter         : in     FileFilterUPP;
      numTypes           : in     Short_Integer;
      typeList           : in     SFTypeListPtr;
      dlgHook            : in     DlgHookUPP;
      reply              : access SFReply;
      dlgID              : in     Short_Integer;

      filterProc         : in     ModalFilterUPP);
   procedure sfputfileC
     (where              : access Point;
      prompt             : in     Chars_Ptr;
      origName           : in     Chars_Ptr;
      dlgHook            : in     DlgHookUPP;
      reply              : access SFReply);

   pragma Import (C, sfputfileC, "sfputfile", "sfputfile");
   procedure sfputfile
     (where              : access Point;
      prompt             : in     Chars_Ptr;
      origName           : in     Chars_Ptr;
      dlgHook            : in     DlgHookUPP;
      reply              : access SFReply)

   renames sfputfileC;
   procedure sfputfile
     (where              : access Point;
      prompt             : in     String;
      origName           : in     String;
      dlgHook            : in     DlgHookUPP;

      reply              : access SFReply);
end StandardFile;