Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

175 lines
5.6 KiB

  1. /***************************************************************************
  2. * FontMan.h -- Definintion for the class: CFontManager
  3. *
  4. *
  5. * Copyright (C) 1992-93 ElseWare Corporation. All rights reserved.
  6. ***************************************************************************/
  7. #if !defined(__FONTMAN_H__)
  8. #define __FONTMAN_H__
  9. #if !defined(__FSNOTIFY_H__)
  10. #include "fsnotify.h"
  11. #endif
  12. #include "strtab.h"
  13. // The database search capabilities have been extended.
  14. enum {
  15. kSearchAny = 1,
  16. kSearchTT,
  17. kSearchNotTT
  18. };
  19. //*********************************************************************
  20. // Forward declarations
  21. //
  22. class CFontClass;
  23. class CFontList;
  24. class CFontManager;
  25. struct IPANOSEMapper;
  26. DWORD dwResetFamilyFlags(void);
  27. //*********************************************************************
  28. // Class CFontManager
  29. //
  30. class CFontManager
  31. {
  32. public:
  33. virtual ~CFontManager( );
  34. BOOL bInit( ); // Any initialization
  35. BOOL bLoadFontList( ); // Build the font list
  36. VOID vReconcileFolder( int iPriority );
  37. VOID vDoReconcileFolder();
  38. CFontClass * poAddToList( LPTSTR lpName, LPTSTR lpPath, LPTSTR lpCompFile = NULL );
  39. CFontList * poLockFontList( );
  40. void vReleaseFontList( );
  41. void vGetFamily( CFontClass * poFont, CFontList * poList );
  42. int iSearchFontList( PTSTR pszTarget, BOOL bExact = TRUE, int iType = kSearchAny );
  43. int iSearchFontListLHS( PTSTR pszLHS );
  44. int iSearchFontListFile( PTSTR pszFile );
  45. CFontClass * poSearchFontList( PTSTR pszTarget, BOOL bExact = TRUE, int iType = kSearchAny );
  46. CFontClass * poSearchFontListLHS( PTSTR pszLHS );
  47. CFontClass * poSearchFontListFile( PTSTR pszFile );
  48. VOID vResetFamilyFlags( );
  49. VOID vDoResetFamilyFlags( );
  50. BOOL bWaitOnFamilyReset( );
  51. BOOL bLoadFamList( );
  52. BOOL bRefresh( BOOL bCheckDup = TRUE );
  53. void vToBeRemoved( CFontList * poList );
  54. BOOL bCheckTBR( );
  55. void vUndoTBR( );
  56. void vVerifyList( );
  57. void vDeleteFontList( CFontList * poList, BOOL bDelete = TRUE );
  58. void vDeleteFont( CFontClass * pFont, BOOL bRemoveFile );
  59. void vDeleteFontFamily( CFontClass * pFont, BOOL bRemoveFile );
  60. int iCompare( CFontClass * pFont1, CFontClass * pFont2, CFontClass * pOrigin );
  61. USHORT nDiff( CFontClass * pFont1, CFontClass * pFont2 );
  62. int GetFontsDirectory( LPTSTR lpDir, int iLen );
  63. BOOL ShouldAutoInstallFile( PTSTR pstr, DWORD dwAttrib );
  64. BOOL bFamiliesNeverReset(void) { return m_bFamiliesNeverReset; }
  65. //
  66. // Members are obsolete. Superceded by dwWaitForInstallationMutex() and
  67. // bReleaseInstallationMutex().
  68. // See comment in header of CFontManager::iSuspendNotify() for details.
  69. //
  70. // int iSuspendNotify( );
  71. // int iResumeNotify( );
  72. //
  73. // Enumerated return values for dwWaitForInstallationMutex().
  74. //
  75. enum { MUTEXWAIT_SUCCESS, // Got the mutex.
  76. MUTEXWAIT_TIMEOUT, // Wait timed out.
  77. MUTEXWAIT_FAILED, // Wait failed.
  78. MUTEXWAIT_WMQUIT // Rcvd WM_QUIT while waiting.
  79. };
  80. DWORD dwWaitForInstallationMutex(DWORD dwTimeout = 2000);
  81. BOOL bReleaseInstallationMutex(void);
  82. #ifdef WINNT
  83. BOOL CheckForType1FontDriver(void);
  84. BOOL Type1FontDriverInstalled(void)
  85. { return m_bType1FontDriverInstalled; }
  86. #endif
  87. private: // Methods
  88. CFontManager();
  89. VOID ProcessRegKey( HKEY hk, BOOL bCheckDup );
  90. VOID ProcessT1RegKey( HKEY hk, BOOL bCheckDup );
  91. int GetSection( LPTSTR lpFile,
  92. LPTSTR lpSection,
  93. LPHANDLE hSection);
  94. HRESULT GetPanMapper( IPANOSEMapper ** ppMapper );
  95. CFontList * m_poFontList;
  96. CFontList * m_poTempList;
  97. IPANOSEMapper * m_poPanMap;
  98. BOOL m_bTriedOnce; // Set to true if an attempt has been made
  99. // to get at the pan mapper.
  100. BOOL m_bFamiliesNeverReset; // T = family reset never done yet.
  101. CFontList * m_poRemoveList; // List of fonts being dragged out.
  102. NOTIFYWATCH m_Notify;
  103. HANDLE m_hNotifyThread;
  104. //
  105. // Member is obsolete. See comment in header of CFontManager::iSuspendNotify()
  106. //
  107. // int m_iSuspendNotify; // The count of suspends
  108. HANDLE m_hReconcileThread;
  109. HANDLE m_hResetFamThread;
  110. HANDLE m_hEventTerminateThreads;
  111. HANDLE m_hEventResetFamily;
  112. HANDLE m_hMutexResetFamily;
  113. HANDLE m_hMutexInstallation; // Prevent concurrent installation
  114. // by reconciliation and main threads.
  115. CRITICAL_SECTION m_cs;
  116. class HiddenFilesList : public StringTable
  117. {
  118. public:
  119. HiddenFilesList(void) { }
  120. ~HiddenFilesList(void) { }
  121. DWORD Initialize(void);
  122. } m_HiddenFontFilesList;
  123. #ifdef WINNT
  124. BOOL m_bType1FontDriverInstalled;
  125. #endif
  126. friend DWORD dwResetFamilyFlags(LPVOID);
  127. friend DWORD dwNotifyWatchProc(LPVOID);
  128. friend DWORD dwReconcileThread(LPVOID);
  129. friend HRESULT GetOrReleaseFontManager(CFontManager **ppoFontManager, bool bGet);
  130. };
  131. //
  132. // Singleton instance management.
  133. //
  134. HRESULT GetFontManager(CFontManager **ppoFontManager);
  135. void ReleaseFontManager(CFontManager **poFontManager);
  136. #endif // __FONTMAN_H__