Leaked source code of windows server 2003
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.

195 lines
7.2 KiB

  1. /******************************************************************************
  2. Header File: Driver Resources.H
  3. This defines the CDriverResource class, which contains all of the information
  4. required to build the RC file for the mini-driver.
  5. It contains a list of all of the #include files, any #define'd constants
  6. (which will now go to a separate header file), the GPC tables, of all of the
  7. fonts (in all three formats) and glyph translation tables (again, in all 3
  8. formats). It is designed to be initializaed by reading the Win 3.1 RC file,
  9. and a member function can then generate the RC file for any desired version.
  10. We allow UFM and GTT files to be added to the list without having an
  11. associated PFM, as one purpose of this tool is to wean people away from
  12. UniTool.
  13. Copyright (c) 1997 by Microsoft Corporation. All Rights Reserved.
  14. A Pretty Penny Enterprises Production.
  15. Change History:
  16. 02-08-1997 Bob_Kjelgaard@Prodigy.Net Created it
  17. ******************************************************************************/
  18. #if !defined(DRIVER_RESOURCES)
  19. #define DRIVER_RESOURCES
  20. #include "GTT.H" // Glyph Mapping classes
  21. #include "FontInfo.H" // Font information classes
  22. #include "GPDFile.H"
  23. #include "utility.H"
  24. class CWSCheckDoc ; // Forward declaration
  25. // Definitions used during string ID verification to skip string IDs that are
  26. // in COMMON.RC.
  27. #define FIRSTCOMMONRCSTRID 1000
  28. #define LASTCOMMONRCSTRID 2400
  29. class CDriverResources : public CBasicNode {
  30. DECLARE_SERIAL(CDriverResources)
  31. BOOL m_bUseCommonRC;
  32. CStringArray m_csaIncludes, m_csaTables;
  33. CStringArray m_csaDefineNames, m_csaDefineValues;
  34. // The String table is a separate class, defined above
  35. CStringTable m_cst;
  36. // Manages selected GPDs file names
  37. CStringArray m_csaModelFileNames ;
  38. // TODO: Handle the version resource so it is under project control
  39. // For now, simply let it and any other untranslated lines sit in another
  40. // array.
  41. CStringArray m_csaRemnants;
  42. // Collections of Various items of interest
  43. CFixedNode m_cfnAtlas, m_cfnFonts, m_cfnModels;
  44. CSafeObArray m_csoaAtlas, m_csoaFonts, m_csoaModels;
  45. CFixedNode m_cfnResources ; // "Resources" node in workspace view
  46. CSafeObArray m_csoaResources ; // An empty place holder
  47. CStringsNode m_csnStrings ; // "Strings" node in workspace view
  48. CSafeObArray m_csoaStrings ; // An empty place holder
  49. COldMiniDriverData m_comdd;
  50. unsigned m_ucSynthesized; // "Artificial" UFM count
  51. enum {ItWorked, ItFailed, ItWasIrrelevant};
  52. UINT CheckTable(int iWhere, CString csLine, CStringArray& csaTarget,
  53. BOOL bSansExtension = TRUE);
  54. UINT CheckTable(int iWhere, CString csLine, CStringTable& cstTarget);
  55. BOOL AddStringEntry(CString csDefinition, CStringTable& cstrcstrings);
  56. CString m_csW2000Path ; // Path to Win2K files
  57. CStdioFile* m_pcsfLogFile ; // Used to write log file
  58. bool m_bErrorsLogged ; // True iff errors have been written to the log file
  59. CString m_csConvLogFile ; // Conversion log file name
  60. // Workspace consistency checking related variables
  61. CWSCheckDoc* m_pwscdCheckDoc ; // Checking window document
  62. bool m_bFirstCheckMsg ; // True iff next check msg will be first one
  63. bool m_bIgnoreChecks ; // True iff WS check problems should be ignored
  64. CMDIChildWnd* m_pcmcwCheckFrame ; // Checking window frame
  65. public:
  66. CDriverResources() ;
  67. ~CDriverResources() ;
  68. BOOL SyncUFMWidth();
  69. void CopyResources(CStringArray& pcsaUFMFiles,CStringArray& pcsaGTTFiles, CString& pcsModel,CStringArray& cstrcid);
  70. // Attributes
  71. CString GPCName(unsigned u);
  72. unsigned MapCount() const { return m_csoaAtlas.GetSize(); }
  73. CGlyphMap& GlyphTable(unsigned u) {
  74. return *(CGlyphMap *) m_csoaAtlas[u];
  75. }
  76. unsigned FontCount() const { return m_csoaFonts.GetSize(); }
  77. unsigned OriginalFontCount() const {
  78. return FontCount() - m_ucSynthesized;
  79. }
  80. CFontInfo& Font(unsigned u) const {
  81. return *(CFontInfo *) m_csoaFonts[u];
  82. }
  83. unsigned Models() const { return m_csoaModels.GetSize(); }
  84. CModelData& Model(unsigned u) const {
  85. return *(CModelData *) m_csoaModels[u];
  86. }
  87. CString GetW2000Path() { return m_csW2000Path ; }
  88. CStringTable* GetStrTable() { return &m_cst ; }
  89. // Operations
  90. BOOL Load(class CProjectRecord& cpr);
  91. bool LoadRCFile(CString& csrcfpec, CStringArray& csadefinenames,
  92. CStringArray& csadefinevalues, CStringArray& csaincludes,
  93. CStringArray& csaremnants, CStringArray& csatables,
  94. CStringTable& cstrcstrings, CStringTable& cstfonts,
  95. CStringTable& cstmaps, UINT ufrctype) ;
  96. BOOL LoadFontData(CProjectRecord& cpr);
  97. BOOL ConvertGPCData(CProjectRecord& cpr, WORD wfGPDConvert);
  98. BOOL Generate(UINT ufTarget, LPCTSTR lpstrPath);
  99. void RemUnneededRCDefine(LPCTSTR strdefname) ;
  100. void RemUnneededRCInclude(LPCTSTR strincname) ;
  101. // The next 3 functions support the GPD Selection feature in the Conversion
  102. // Wizard.
  103. BOOL GetGPDModelInfo(CStringArray* pcsamodels, CStringArray* pcsafiles) ;
  104. int SaveVerGPDFNames(CStringArray& csafiles, bool bverifydata) ;
  105. void GenerateGPDFileNames(CStringArray& csamodels, CStringArray& csafiles) ;
  106. void ForceCommonRC(BOOL bOn) { m_bUseCommonRC = bOn; }
  107. // The next group of functions handle conversion log file management.
  108. bool OpenConvLogFile(CString cssourcefile) ;
  109. void CloseConvLogFile(void) ;
  110. void LogConvInfo(int nmsgid, int numargs, CString* pcsarg1 = NULL,
  111. int narg2 = 0) ;
  112. CString GetConvLogFileName() const {return m_csConvLogFile ; }
  113. bool ThereAreConvErrors() {return m_bErrorsLogged ; }
  114. BOOL ReportFileFailure(int idMessage, LPCTSTR lpstrFile) ;
  115. // The next group of functions handle checking a workspace for completeness
  116. // and tidiness.
  117. bool WorkspaceChecker(bool bclosing) ;
  118. void DoGTTWorkspaceChecks(bool bclosing, bool& bwsproblem) ;
  119. void DoUFMWorkspaceChecks(bool bclosing, bool& bwsproblem) ;
  120. void DoStringWorkspaceChecks(bool bclosing, bool& bwsproblem) ;
  121. void DoGPDWorkspaceChecks(bool bclosing, bool& bwsproblem) ;
  122. void ResetWorkspaceErrorWindow(bool bclosing) ;
  123. bool PostWSCheckingMessage(CString csmsg, CProjectNode* ppn) ;
  124. bool IgnoreChecksWhenClosing(bool bclosing) ;
  125. void Fill(CTreeCtrl *pctcWhere, CProjectRecord& cpr);
  126. virtual void Serialize(CArchive& car);
  127. CStringsNode* GetStringsNode() { return &m_csnStrings ; }
  128. bool RunEditor(bool bstring, int nrcid) ;
  129. bool ReparseRCFile(CString& csrcfspec) ;
  130. void UpdateResourceList(CStringTable& cst, CSafeObArray& csoa,
  131. CUIntArray& cuaboldfound,
  132. CUIntArray& cuabnewfound, CString& csrcpath,
  133. int& nc) ;
  134. void UpdateResourceItem(CProjectNode* pcpn, CString& csrcpath,
  135. WORD wkey, CString& cs, FIXEDNODETYPE fnt) ;
  136. void LinkAndLoadFont(CFontInfo& cfi, bool bworkspaceload, bool bonlyglyph = false) ;
  137. } ;
  138. #endif