home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / warphead.zip / H / PREFS.H < prev    next >
C/C++ Source or Header  |  1997-02-28  |  8KB  |  224 lines

  1. /*====START_GENERATED_PROLOG======================================
  2.  */
  3. /*
  4.  *   COMPONENT_NAME: odcore
  5.  *
  6.  *   CLASSES:   Preferences
  7.  *
  8.  *   ORIGINS: 82,27
  9.  *
  10.  *
  11.  *   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  12.  *   All Rights Reserved
  13.  *   Licensed Materials - Property of IBM
  14.  *   US Government Users Restricted Rights - Use, duplication or
  15.  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  16.  *       
  17.  *   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  18.  *   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  19.  *   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  20.  *   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  21.  *   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  22.  *   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  23.  *   OR PERFORMANCE OF THIS SOFTWARE.
  24.  */
  25. /*====END_GENERATED_PROLOG========================================
  26.  */
  27. /* @(#)Z 1.4 com/src/core/Prefs.h, odcore, od96os2, odos29646d 96/11/15 15:24:54 (96/10/30 20:21:51) */
  28. /*
  29.     File:        Prefs.h
  30.  
  31.     Contains:    Class definition for Preferences
  32.  
  33.     Owned by:    Caia Grisar 
  34.  
  35.     Copyright:    ⌐ 1993 - 95 by Apple Computer, Inc., all rights reserved.
  36.  
  37.     Change History (most recent first):
  38.  
  39.         <12>    10/20/95    CG        #1294494 GM:Info writing size info to the
  40.                                     wrong prefs file.
  41.         <11>     8/30/95    CG        #1255135 FB2:"Updating Part Editor
  42.                                     database" dlg comes up indefinitely
  43.                                     #1257569 FB3:Editor nmaps on read-only
  44.                                     volumes are not being cached.
  45.         <10>     8/25/95    JP        1272288:Added AETE routines & cacheFile
  46.                                     optimizations
  47.          <9>     6/22/95    jpa        Added fFoundBadAlias [1257556]
  48.          <8>     6/19/95    jpa        Added fScanningDialog and show/close
  49.                                     methods for it [1258142]
  50.          <7>      6/9/95    CG        #1203571 implemented  nmap caching
  51.                                     mechanism.
  52.          <6>     5/25/95    jpa        Store list of editor dirs [1240150]
  53.          <5>     5/18/95    CG        #1241621    BB: Need to implement Purge for
  54.                                     Binding subsystem objects.
  55.          <4>     5/17/95    TJ        Backed out changes from previous checkin.
  56.          <2>     4/24/95    eeh        1231707: fsspec param added to
  57.                                     Read_nmap_Buffer and Read_nmap_Resources
  58.          <1>     4/13/95    CG        first checked in
  59.         <14>     2/14/95    jpa        Changes to support reading Editors folders
  60.                                     on all disks. [1205141]
  61.         <13>      2/2/95    CG        Changed dirIDs to ODSLong and vRefNums to
  62.                                     ODSShort.
  63.         <12>     1/10/95    CG        Removed dead code.
  64.         <11>    12/13/94    CG        #1205141:Prefs code now looks in "Editors"
  65.                                     and "OpenDoc Libraries" folders for nmaps.
  66.         <10>    11/30/94    RR        #1188078 Use FSSpec instead of ODFileSpec
  67.          <9>     9/12/94    CG        #1157104: GetPartEditorNMAPs now looks in
  68.                                     same search path as CFM does for Part
  69.                                     Editor library files.  Temporary fix
  70.                                     removed.
  71.          <8>     8/25/94    CG        #1175107: Temporary fix to allow documents
  72.                                     to be opened from anywhere.
  73.          <7>     8/24/94    CG        #1181622: Updated ownership info.
  74.          <6>     7/29/94    CG        Changed some methods to return booleans
  75.                                     instead of throwing errors.
  76.          <5>     7/26/94    jpa        Don't inherit from ODObject!
  77.          <4>      7/1/94    CG        Renamed LocateASLMLibFiles to
  78.                                     LocatePartLibFiles.
  79.          <3>      7/1/94    CG        Change to LoadNMAPResource param list.
  80.          <2>     6/27/94    CG        Moved IsEditorLoaded to BindngH, removed
  81.                                     fEv.
  82.          <1>     6/14/94    CG        first checked in
  83.          <1>     5/27/94    CG        first checked in
  84.     To Do:
  85.     In Progress:
  86.         
  87. */
  88.  
  89. #ifndef _PREFS_
  90. #define _PREFS_
  91.  
  92. #ifndef _PLFMDEF_
  93. #include "PlfmDef.h"
  94. #endif
  95.  
  96. #ifndef _ODOBJ_
  97. #include "ODObject.xh"
  98. #endif
  99.  
  100. #ifndef _ODTYPES_
  101. #include "ODTypes.h"
  102. #endif
  103.  
  104. #ifdef _PLATFORM_MACINTOSH_
  105. #ifndef __DIALOGS__
  106. #include <Dialogs.h>
  107. #endif
  108. #endif
  109.  
  110. //=====================================================================================
  111. // Classes defined in this interface
  112. //=====================================================================================
  113.  
  114. class Preferences;
  115. class PrefsDirInfo;
  116. class PrefsDirInfoList;
  117.  
  118. //=====================================================================================
  119. // Classes used by this interface
  120. //=====================================================================================
  121.  
  122. class ODSession;
  123. class PlatformFile;
  124. class ODStorageUnitView;
  125. class LinkedList;
  126. class PrefsDirInfo;
  127.  
  128. //==============================================================================
  129. // Local Function Prototypes (from NamSpacM.cpp)
  130. //==============================================================================
  131.  
  132. //void ReadBytes(ODFileRefNum file, ODStorageUnitView* view,ODPtr bytes, ODULong* length);
  133. //ODULong ReadSize(ODFileRefNum file, ODStorageUnitView* view);
  134. enum {
  135.     kNestedFolder = 0,
  136.     kLibsFolder,
  137.     kSysEditorsFolder,
  138.     kRootEditorsFolder
  139. };
  140. typedef ODULong PrefsDirType;
  141.  
  142.  
  143. //=====================================================================================
  144. // Class Preferences
  145. //=====================================================================================
  146.  
  147. class Preferences
  148. {
  149. public:
  150.     
  151.     Preferences();
  152.     ~Preferences();
  153.     ODNVMethod void            InitPreferences(ODSession* session);
  154.                   
  155.     ODNVMethod ODSize        Purge(ODSize size);
  156.  
  157.     ODNVMethod ODBoolean    HaveEditorsFoldersChanged( );
  158.     ODNVMethod ODBoolean    ScanLibsAndEditors();
  159.     ODNVMethod void            UpdatePreferences();
  160.     ODNVMethod void            GetAETEs( ODSLong languageCode, AEDescList* aeteList);
  161.     ODNVMethod PlatformFile* GetPrefsFile();
  162.     
  163. private:
  164.     ODNVMethod void            CreatePrefsNameSpaces();
  165.     ODNVMethod ODSize        ClearEditorNameSpaces();
  166.     ODNVMethod void            GetOpenDocPrefs();
  167.     ODNVMethod void            GetOpenDoc_nmaps();
  168.     ODNVMethod void            ScanDirectory( ODSShort fldrVRefNum, ODSLong fldrDirID,
  169.                                             PlatformFile* cacheFile ); 
  170.     ODNVMethod void            ScanDirectoryTree(ODSShort fldrVRefNum, ODSLong fldrDirID,
  171.                                                       ODULong fldrModDate, PrefsDirType);
  172.     ODNVMethod void         VerifyCache(ODSShort fldrVRefNum, 
  173.                                           ODSLong fldrDirID, 
  174.                                           ODULong fldrModDate,
  175.                                           PrefsDirType type,
  176.                                           PlatformFile** cacheFile,
  177.                                           LinkedList** dirTreeList, 
  178.                                           ODBoolean* cacheIsValid);
  179.     ODNVMethod ODBoolean     LoadCachedDirList(PlatformFile* cacheFile,
  180.                                           ODSShort fldrVRefNum,
  181.                                           LinkedList** dirTreeList,
  182.                                           PrefsDirType type);
  183.     ODNVMethod ODBoolean    GetCacheFile(PlatformFile** cacheFile, ODSShort fldrVRefNum, 
  184.                                           ODSLong fldrDirID, ODULong fldrModDate );
  185.     ODNVMethod ODBoolean    LoadCachedRezData(PlatformFile* cacheFile, ODSShort vRefNum);
  186.     ODNVMethod void         TraverseDirectory( ODSShort fldrVRefNum, 
  187.                                           ODSLong fldrDirID, 
  188.                                           ODSShort depth, 
  189.                                           LinkedList* dirList );
  190.     ODNVMethod PrefsDirInfo* FindDirInfo( LinkedList* dirList, short vol, long dir );
  191.     ODNVMethod PrefsDirInfo* AddDirInfo( LinkedList* dirList, 
  192.                                         short vol, long dir, ODULong modDate,
  193.                                         ODSShort depth, PrefsDirType = kNestedFolder );
  194.     ODNVMethod    void        AddDirList(LinkedList* dirList);
  195.     ODNVMethod ODBoolean    Read_nmap_Resources(FSSpec* fsspec, PlatformFile* cacheFile);
  196.     ODNVMethod void            Read_nmap_Buffer( ODPtr buffer, ODSize bufferSize,
  197.                                                                 FSSpec* fsspec );
  198.     ODNVMethod void            Write_nmap_Buffer( ODPtr buffer, ODSize bufferSize );
  199.     ODNVMethod ODBoolean    LocatePrefsFile();
  200.     ODNVMethod ODBoolean    LoadPreferences();
  201.     ODNVMethod ODBoolean    VerifyPrefsFileVersion();
  202.     ODNVMethod    void        UpdatePrefsFileVersion();
  203.     
  204.     ODNVMethod void            ShowScanningDialog( );
  205.     ODNVMethod void            CloseScanningDialog( );
  206.  
  207. // Fields:
  208.     ODSession*             fSession;
  209.     ODNameSpaceManager *fNameSpaceMgr;
  210.     Str31                fLibsFolderName;
  211.     Str31                fEditorsFolderName;
  212.     PlatformFile*        fPrefsFile;
  213.     ODULong                fPrefsModDate;
  214.     LinkedList*            fDirList;
  215.     ODULong                fLastSynchedAt;
  216.     ODBoolean            fScanning;
  217.     ODBoolean            fFoundBadAlias;
  218.     DialogPtr            fScanningDialog;
  219.     
  220.     friend class PrefsDirInfo;
  221. };
  222.  
  223. #endif // _PREFS_
  224.