Team Fortress 2 Source Code as on 22/4/2020
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.

149 lines
4.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef MODWIZARD_COPYFILES_H
  7. #define MODWIZARD_COPYFILES_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include <vgui_controls/WizardSubPanel.h>
  12. #include <vgui_controls/Label.h>
  13. #include <vgui_controls/ProgressBar.h>
  14. #include "utlvector.h"
  15. #include "configs.h"
  16. // --------------------------------------------------------------------------------------------------------------------- //
  17. // CreateModWizard sub panel 3.
  18. // This panel asks for the directory to install in and the mod name.
  19. // --------------------------------------------------------------------------------------------------------------------- //
  20. namespace vgui
  21. {
  22. class CModWizardSubPanel_CopyFiles : public WizardSubPanel
  23. {
  24. public:
  25. typedef WizardSubPanel BaseClass;
  26. public:
  27. CModWizardSubPanel_CopyFiles( Panel *parent, const char *panelName );
  28. // Called to store the settings it'll use to copy all the files over.
  29. void GetReady( const char *pOutputDirName, const char *pOutputModGamedirName, const char *modName ) ;
  30. virtual WizardSubPanel* GetNextSubPanel();
  31. virtual void OnDisplayAsNext();
  32. virtual void OnTick();
  33. protected:
  34. class CFileCopyInfo
  35. {
  36. public:
  37. CFileCopyInfo( const char *pIn, const char *pOut )
  38. {
  39. Q_strncpy( m_InFilename, pIn, sizeof( m_InFilename ) );
  40. Q_strncpy( m_OutFilename, pOut, sizeof( m_OutFilename ) );
  41. }
  42. char m_InFilename[MAX_PATH];
  43. char m_OutFilename[MAX_PATH];
  44. };
  45. protected:
  46. bool BuildCopyFiles_R( const char *pSourceDir, const char *pMask, const char *pOutputDirName );
  47. bool BuildCopyFilesForMappings( char **pMappings, int nMappings );
  48. bool HandleSpecialFileCopy( CFileCopyInfo *pInfo, bool &bErrorStatus );
  49. bool HandleReplacements_GenericVCProj( CFileCopyInfo *pInfo, bool &bErrorStatus );
  50. virtual bool BuildCopyFilesForMod_HL2() = 0;
  51. virtual bool BuildCopyFilesForMod_HL2MP() = 0;
  52. virtual bool BuildCopyFilesForMod_FromScratch() = 0;
  53. virtual bool BuildCopyFilesForMod_SourceCodeOnly() = 0;
  54. virtual bool HandleReplacements_GameProjectFiles( CFileCopyInfo *pInfo, bool &bErrorStatus ) = 0;
  55. virtual bool HandleReplacements_Solution( CFileCopyInfo *pInfo, bool &bErrorStatus ) = 0;
  56. // Right now only one of these files gets modified, but keeping it here for expansion in the future.
  57. virtual bool HandleReplacements_TemplateOptions( CFileCopyInfo *pInfo, bool &bErrorStatus ) = 0;
  58. protected:
  59. CUtlVector<CFileCopyInfo> m_FileCopyInfos;
  60. int m_iCurCopyFile; // -1 at the beginning.
  61. Label *m_pLabel;
  62. Label *m_pFinishedLabel;
  63. ProgressBar *m_pProgressBar;
  64. char m_OutputDirName[MAX_PATH]; // c:\mymod
  65. char m_OutModGamedirName[MAX_PATH]; // c:\mymod\mymod
  66. char m_ModName[MAX_PATH]; // mymod
  67. ModType_t m_ModType;
  68. };
  69. class CModWizardSubPanel_CopyFiles_Source2006 : public CModWizardSubPanel_CopyFiles
  70. {
  71. public:
  72. CModWizardSubPanel_CopyFiles_Source2006( Panel *parent, const char *panelName );
  73. private:
  74. bool BuildCopyFilesForMod_HL2();
  75. bool BuildCopyFilesForMod_HL2MP();
  76. bool BuildCopyFilesForMod_FromScratch();
  77. bool BuildCopyFilesForMod_SourceCodeOnly();
  78. bool HandleReplacements_GameProjectFiles( CFileCopyInfo *pInfo, bool &bErrorStatus );
  79. bool HandleReplacements_Solution( CFileCopyInfo *pInfo, bool &bErrorStatus );
  80. bool HandleReplacements_TemplateOptions( CFileCopyInfo *pInfo, bool &bErrorStatus ) { return false; } // Ep1 will never do this.
  81. };
  82. class CModWizardSubPanel_CopyFiles_Source2007 : public CModWizardSubPanel_CopyFiles
  83. {
  84. public:
  85. CModWizardSubPanel_CopyFiles_Source2007( Panel *parent, const char *panelName );
  86. private:
  87. bool BuildCopyFilesForMod_HL2();
  88. bool BuildCopyFilesForMod_HL2MP();
  89. bool BuildCopyFilesForMod_FromScratch();
  90. bool BuildCopyFilesForMod_SourceCodeOnly();
  91. bool HandleReplacements_GameProjectFiles( CFileCopyInfo *pInfo, bool &bErrorStatus );
  92. bool HandleReplacements_Solution( CFileCopyInfo *pInfo, bool &bErrorStatus );
  93. // Right now only one of these files gets modified, but keeping it here for expansion in the future.
  94. bool HandleReplacements_TemplateOptions( CFileCopyInfo *pInfo, bool &bErrorStatus );
  95. };
  96. class CModWizardSubPanel_CopyFiles_Source2009 : public CModWizardSubPanel_CopyFiles
  97. {
  98. public:
  99. CModWizardSubPanel_CopyFiles_Source2009( Panel *parent, const char *panelName );
  100. private:
  101. bool BuildCopyFilesForMod_HL2();
  102. bool BuildCopyFilesForMod_HL2MP();
  103. bool BuildCopyFilesForMod_FromScratch();
  104. bool BuildCopyFilesForMod_SourceCodeOnly();
  105. bool HandleReplacements_GameProjectFiles( CFileCopyInfo *pInfo, bool &bErrorStatus );
  106. bool HandleReplacements_Solution( CFileCopyInfo *pInfo, bool &bErrorStatus );
  107. // Right now only one of these files gets modified, but keeping it here for expansion in the future.
  108. bool HandleReplacements_TemplateOptions( CFileCopyInfo *pInfo, bool &bErrorStatus );
  109. };
  110. }
  111. #endif // MODWIZARD_COPYFILES_H