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.

184 lines
3.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef WORKSPACEMANAGER_H
  7. #define WORKSPACEMANAGER_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. class CWorkspaceBrowser;
  12. class CWorkspaceWorkArea;
  13. class CWorkspace;
  14. class CProject;
  15. class CScene;
  16. class CVCDFile;
  17. class CSoundEntry;
  18. class ITreeItem;
  19. class CSoundBrowser;
  20. class CWaveBrowser;
  21. class CWaveFile;
  22. struct _IMAGELIST;
  23. typedef struct _IMAGELIST NEAR* HIMAGELIST;
  24. enum
  25. {
  26. IMAGE_WORKSPACE = 0,
  27. IMAGE_WORKSPACE_CHECKEDOUT,
  28. IMAGE_PROJECT,
  29. IMAGE_PROJECT_CHECKEDOUT,
  30. IMAGE_SCENE,
  31. // IMAGE_SCENE_CHECKEDOUT,
  32. IMAGE_VCD,
  33. IMAGE_VCD_CHECKEDOUT,
  34. IMAGE_WAV,
  35. IMAGE_WAV_CHECKEDOUT,
  36. IMAGE_SPEAK,
  37. IMAGE_SPEAK_CHECKEDOUT,
  38. NUM_IMAGES,
  39. };
  40. class CWorkspaceManager : public mxWindow
  41. {
  42. public:
  43. CWorkspaceManager();
  44. ~CWorkspaceManager();
  45. virtual int handleEvent( mxEvent *event );
  46. CWorkspaceBrowser *GetBrowser();
  47. CSoundBrowser *GetSoundBrowser();
  48. CWaveBrowser *GetWaveBrowser();
  49. void LoadWorkspace( char const *filename );
  50. void AutoLoad( char const *workspace );
  51. void ShowContextMenu( int x, int y, ITreeItem *item );
  52. void OnDoubleClicked( ITreeItem *item );
  53. void UpdateMenus();
  54. virtual bool Closing();
  55. HIMAGELIST CreateImageList();
  56. void RefreshBrowsers();
  57. void OnSoundShowInBrowsers();
  58. void SetWorkspaceDirty();
  59. int GetLanguageId() const;
  60. private:
  61. void PerformLayout( bool movebrowsers );
  62. void Think( float dt );
  63. void Frame( void );
  64. virtual void OnDelete();
  65. void SetWorkspace( CWorkspace *ws );
  66. void OnUpdateTitle( void );
  67. void CreateFileMenu( mxMenu *m );
  68. void CreateProjectMenu( mxMenu *m );
  69. int GetMaxRecentFiles( void ) const;
  70. // Workspace message handlers
  71. void OnNewWorkspace();
  72. void OnOpenWorkspace();
  73. void OnCloseWorkspace();
  74. void OnSaveWorkspace();
  75. void OnChangeVSSProperites();
  76. void OnCheckoutWorkspace();
  77. void OnCheckinWorkspace();
  78. // Project message handlers
  79. void OnNewProject();
  80. void OnInsertProject();
  81. void OnRemoveProject();
  82. void OnModifyProjectComments();
  83. // Scene message handlers
  84. void OnNewScene();
  85. void OnModifySceneComments();
  86. void OnRemoveScene();
  87. // Sound entry handlers
  88. void OnSoundPlay();
  89. void OnSoundToggleVoiceDuck();
  90. void OnSoundEditText();
  91. void OnSoundProperties();
  92. void OnWaveProperties();
  93. void OnCheckout();
  94. void OnCheckin();
  95. void OnMoveUp();
  96. void OnMoveDown();
  97. //void OnSoundCheckOut();
  98. //void OnSoundCheckIn();
  99. // Scene entries
  100. void OnSceneAddVCD();
  101. void OnSceneRemoveVCD();
  102. void OnModifyVCDComments();
  103. void OnRecentWorkspace( int index );
  104. void OnChangeLanguage( int lang_index, bool force = false );
  105. void AddFileToRecentWorkspaceList( char const *filename );
  106. void UpdateRecentFilesMenu();
  107. void LoadRecentFilesMenuFromDisk();
  108. void SaveRecentFilesMenuToDisk();
  109. bool CloseWorkspace();
  110. void ShowContextMenu_Workspace( int x, int y, CWorkspace *ws );
  111. void ShowContextMenu_Project( int x, int y, CProject *project );
  112. void ShowContextMenu_Scene( int x, int y, CScene *scene );
  113. void ShowContextMenu_VCD( int x, int y, CVCDFile *vcd );
  114. void ShowContextMenu_SoundEntry( int x, int y, CSoundEntry *entry );
  115. void ShowContextMenu_WaveFile( int x, int y, CWaveFile *entry );
  116. mxMenuBar *m_pMenuBar;
  117. mxMenu *m_pFileMenu;
  118. mxMenu *m_pRecentFileMenu;
  119. int m_nRecentMenuItems;
  120. mxMenu *m_pProjectMenu;
  121. mxMenu *m_pOptionsMenu;
  122. mxMenu *m_pMenuCloseCaptionLanguages;
  123. CWorkspaceWorkArea *m_pWorkArea;
  124. CWorkspaceBrowser *m_pBrowser;
  125. CSoundBrowser *m_pSoundBrowser;
  126. CWaveBrowser *m_pWaveBrowser;
  127. struct RecentFile
  128. {
  129. char filename[ 256 ];
  130. };
  131. CUtlVector< RecentFile > m_RecentFiles;
  132. int m_nLanguageId;
  133. long m_lEnglishCaptionsFileChangeTime;
  134. };
  135. CWorkspaceManager *GetWorkspaceManager();
  136. #endif // WORKSPACEMANAGER_H