home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc™ Source Code / Core / Prefs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-28  |  7.1 KB  |  212 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Prefs.h
  3.  
  4.     Contains:    Class definition for Preferences
  5.  
  6.     Owned by:    Caia Grisar 
  7.  
  8.     Copyright:    © 1993 - 1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <4>     6/22/96    EL        1356059: Add fPrevSizeRsrc and
  13.                                     DeletePrefFile
  14.          <3>     5/17/96    EL        #1263100: Add fProgressPictHdl and other
  15.                                     for progress bar in dialog.
  16.          <2>      5/3/96    EL        1257565: Make Read-nmap_Buffer params const
  17.                                     (from Jens).
  18.         <12>    10/20/95    CG        #1294494 GM:Info writing size info to the
  19.                                     wrong prefs file.
  20.         <11>     8/30/95    CG        #1255135 FB2:"Updating Part Editor
  21.                                     database" dlg comes up indefinitely
  22.                                     #1257569 FB3:Editor nmaps on read-only
  23.                                     volumes are not being cached.
  24.         <10>     8/25/95    JP        1272288:Added AETE routines & cacheFile
  25.                                     optimizations
  26.          <9>     6/22/95    jpa        Added fFoundBadAlias [1257556]
  27.          <8>     6/19/95    jpa        Added fScanningDialog and show/close
  28.                                     methods for it [1258142]
  29.          <7>      6/9/95    CG        #1203571 implemented  nmap caching
  30.                                     mechanism.
  31.          <6>     5/25/95    jpa        Store list of editor dirs [1240150]
  32.          <5>     5/18/95    CG        #1241621    BB: Need to implement Purge for
  33.                                     Binding subsystem objects.
  34.          <4>     5/17/95    TJ        Backed out changes from previous checkin.
  35.          <2>     4/24/95    eeh        1231707: fsspec param added to
  36.                                     Read_nmap_Buffer and Read_nmap_Resources
  37.          <1>     4/13/95    CG        first checked in
  38.         <14>     2/14/95    jpa        Changes to support reading Editors folders
  39.                                     on all disks. [1205141]
  40.         <13>      2/2/95    CG        Changed dirIDs to ODSLong and vRefNums to
  41.                                     ODSShort.
  42.         <12>     1/10/95    CG        Removed dead code.
  43.         <11>    12/13/94    CG        #1205141:Prefs code now looks in "Editors"
  44.                                     and "OpenDoc Libraries" folders for nmaps.
  45.         <10>    11/30/94    RR        #1188078 Use FSSpec instead of ODFileSpec
  46.          <9>     9/12/94    CG        #1157104: GetPartEditorNMAPs now looks in
  47.                                     same search path as CFM does for Part
  48.                                     Editor library files.  Temporary fix
  49.                                     removed.
  50.          <8>     8/25/94    CG        #1175107: Temporary fix to allow documents
  51.                                     to be opened from anywhere.
  52.          <7>     8/24/94    CG        #1181622: Updated ownership info.
  53.          <6>     7/29/94    CG        Changed some methods to return booleans
  54.                                     instead of throwing errors.
  55.          <5>     7/26/94    jpa        Don't inherit from ODObject!
  56.          <4>      7/1/94    CG        Renamed LocateASLMLibFiles to
  57.                                     LocatePartLibFiles.
  58.          <3>      7/1/94    CG        Change to LoadNMAPResource param list.
  59.          <2>     6/27/94    CG        Moved IsEditorLoaded to BindngH, removed
  60.                                     fEv.
  61.          <1>     6/14/94    CG        first checked in
  62.          <1>     5/27/94    CG        first checked in
  63.     To Do:
  64.     In Progress:
  65.         
  66. */
  67.  
  68. #ifndef _PREFS_
  69. #define _PREFS_
  70.  
  71. #ifndef _PLFMDEF_
  72. #include "PlfmDef.h"
  73. #endif
  74.  
  75. #ifndef _ODOBJ_
  76. #include "ODObject.xh"
  77. #endif
  78.  
  79. #ifndef _ODTYPES_
  80. #include "ODTypes.h"
  81. #endif
  82.  
  83. #ifndef __DIALOGS__
  84. #include <Dialogs.h>
  85. #endif
  86.  
  87. //=====================================================================================
  88. // Classes defined in this interface
  89. //=====================================================================================
  90.  
  91. class Preferences;
  92. class PrefsDirInfo;
  93. class PrefsDirInfoList;
  94.  
  95. //=====================================================================================
  96. // Classes used by this interface
  97. //=====================================================================================
  98.  
  99. class ODSession;
  100. class PlatformFile;
  101. class ODStorageUnitView;
  102. class LinkedList;
  103. class PrefsDirInfo;
  104.  
  105. //==============================================================================
  106. // Local Function Prototypes (from NamSpacM.cpp)
  107. //==============================================================================
  108.  
  109. //void ReadBytes(ODFileRefNum file, ODStorageUnitView* view,ODPtr bytes, ODULong* length);
  110. //ODULong ReadSize(ODFileRefNum file, ODStorageUnitView* view);
  111. enum {
  112.     kNestedFolder = 0,
  113.     kLibsFolder,
  114.     kSysEditorsFolder,
  115.     kRootEditorsFolder
  116. };
  117. typedef ODULong PrefsDirType;
  118.  
  119.  
  120. //=====================================================================================
  121. // Class Preferences
  122. //=====================================================================================
  123.  
  124. class Preferences
  125. {
  126. public:
  127.     
  128.     Preferences();
  129.     ~Preferences();
  130.     ODNVMethod void            InitPreferences(ODSession* session);
  131.                   
  132.     ODNVMethod ODSize        Purge(ODSize size);
  133.  
  134.     ODNVMethod ODBoolean    HaveEditorsFoldersChanged( );
  135.     ODNVMethod ODBoolean    ScanLibsAndEditors();
  136.     ODNVMethod void            UpdatePreferences();
  137.     ODNVMethod void            GetAETEs( ODSLong languageCode, AEDescList* aeteList);
  138.     ODNVMethod PlatformFile* GetPrefsFile();
  139.     
  140. private:
  141.     ODNVMethod void            CreatePrefsNameSpaces();
  142.     ODNVMethod ODSize        ClearEditorNameSpaces();
  143.     ODNVMethod void            GetOpenDocPrefs();
  144.     ODNVMethod void            GetOpenDoc_nmaps();
  145.     ODNVMethod void            ScanDirectory( ODSShort fldrVRefNum, ODSLong fldrDirID,
  146.                                             PlatformFile* cacheFile ); 
  147.     ODNVMethod void            ScanDirectoryTree(ODSShort fldrVRefNum, ODSLong fldrDirID,
  148.                                                       ODULong fldrModDate, PrefsDirType);
  149.     ODNVMethod void         VerifyCache(ODSShort fldrVRefNum, 
  150.                                           ODSLong fldrDirID, 
  151.                                           ODULong fldrModDate,
  152.                                           PrefsDirType type,
  153.                                           PlatformFile** cacheFile,
  154.                                           LinkedList** dirTreeList, 
  155.                                           ODBoolean* cacheIsValid);
  156.     ODNVMethod ODBoolean     LoadCachedDirList(PlatformFile* cacheFile,
  157.                                           ODSShort fldrVRefNum,
  158.                                           LinkedList** dirTreeList,
  159.                                           PrefsDirType type);
  160.     ODNVMethod ODBoolean    GetCacheFile(PlatformFile** cacheFile, ODSShort fldrVRefNum, 
  161.                                           ODSLong fldrDirID, ODULong fldrModDate );
  162.     ODNVMethod ODBoolean    LoadCachedRezData(PlatformFile* cacheFile, ODSShort vRefNum);
  163.     ODNVMethod void         TraverseDirectory( ODSShort fldrVRefNum, 
  164.                                           ODSLong fldrDirID, 
  165.                                           ODSShort depth, 
  166.                                           LinkedList* dirList );
  167.     ODNVMethod PrefsDirInfo* FindDirInfo( LinkedList* dirList, short vol, long dir );
  168.     ODNVMethod PrefsDirInfo* AddDirInfo( LinkedList* dirList, 
  169.                                         short vol, long dir, ODULong modDate,
  170.                                         ODSShort depth, PrefsDirType = kNestedFolder );
  171.     ODNVMethod    void        AddDirList(LinkedList* dirList);
  172.     ODNVMethod ODBoolean    Read_nmap_Resources(const FSSpec*,
  173.                                             PlatformFile* cacheFile);
  174.     ODNVMethod void            Read_nmap_Buffer( const void* buffer, ODSize bufferSize,
  175.                                             const FSSpec* );
  176.     ODNVMethod void            Write_nmap_Buffer( ODPtr buffer, ODSize bufferSize );
  177.     ODNVMethod ODBoolean    LocatePrefsFile();
  178.     ODNVMethod ODBoolean    LoadPreferences();
  179.     ODNVMethod ODBoolean    VerifyPrefsFileVersion();
  180.     ODNVMethod void            UpdatePrefsFileVersion();
  181.     ODNVMethod void            DeletePrefFile();
  182.     
  183.     ODNVMethod void            ShowScanningDialog( PlatformFile* fCacheFile );
  184.     ODNVMethod void            CloseScanningDialog( );
  185.     ODNVMethod void            CheckCancelScanningDialog( );
  186.  
  187. // Fields:
  188.     ODSession*             fSession;
  189.     ODNameSpaceManager *fNameSpaceMgr;
  190.     Str31                fLibsFolderName;
  191.     Str31                fEditorsFolderName;
  192.     PlatformFile*        fPrefsFile;
  193.     ODULong                fPrefsModDate;
  194.     LinkedList*            fDirList;
  195.     ODULong                fLastSynchedAt;
  196.     ODBoolean            fScanning;
  197.     ODBoolean            fFoundBadAlias;
  198.     PlatformFile*         fCacheFile;
  199.     ODHandle            fPrevSizeRsrc;
  200.     DialogPtr            fScanningDialog;
  201.     ODULong                fSleepTime;
  202.     ODHandle            fButtonControl;
  203.     ODUShort            fProgressPictIndex;
  204.     Rect                fProgressItemRect;
  205.     RgnHandle             fProgressItemRgn;
  206.     ODHandle            fProgresstPictHdl[4];
  207.     
  208.     friend class PrefsDirInfo;
  209. };
  210.  
  211. #endif // _PREFS_
  212.