summaryrefslogtreecommitdiff
path: root/utils/scenemanager/workspacemanager.h
blob: e7c5eb0abc773806af70bf8838023cdcd1f8c0e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================//

#ifndef WORKSPACEMANAGER_H
#define WORKSPACEMANAGER_H
#ifdef _WIN32
#pragma once
#endif

class CWorkspaceBrowser;
class CWorkspaceWorkArea;
class CWorkspace;
class CProject;
class CScene;
class CVCDFile;
class CSoundEntry;
class ITreeItem;
class CSoundBrowser;
class CWaveBrowser;
class CWaveFile;

struct _IMAGELIST;
typedef struct _IMAGELIST NEAR* HIMAGELIST;

enum
{
	IMAGE_WORKSPACE = 0,
	IMAGE_WORKSPACE_CHECKEDOUT,
	IMAGE_PROJECT,
	IMAGE_PROJECT_CHECKEDOUT,
	IMAGE_SCENE,
//	IMAGE_SCENE_CHECKEDOUT,
	IMAGE_VCD,
	IMAGE_VCD_CHECKEDOUT,
	IMAGE_WAV,
	IMAGE_WAV_CHECKEDOUT,
	IMAGE_SPEAK,
	IMAGE_SPEAK_CHECKEDOUT,

	NUM_IMAGES,
};

class CWorkspaceManager : public mxWindow
{
public:
	CWorkspaceManager();
	~CWorkspaceManager();

	virtual int handleEvent( mxEvent *event );

	CWorkspaceBrowser	*GetBrowser();
	CSoundBrowser	*GetSoundBrowser();
	CWaveBrowser	*GetWaveBrowser();
	void			LoadWorkspace( char const *filename );

	void			AutoLoad( char const *workspace );

	void			ShowContextMenu( int x, int y, ITreeItem *item );
	void			OnDoubleClicked( ITreeItem *item );

	void			UpdateMenus();

	virtual bool	Closing();

	HIMAGELIST		CreateImageList();

	void			RefreshBrowsers();

	void			OnSoundShowInBrowsers();

	void			SetWorkspaceDirty();

	int				GetLanguageId() const;

private:

	void			PerformLayout( bool movebrowsers );

	void			Think( float dt );
	void			Frame( void );

	virtual void	OnDelete();

	void			SetWorkspace( CWorkspace *ws );
	void			OnUpdateTitle( void );

	void			CreateFileMenu( mxMenu *m );
	void			CreateProjectMenu( mxMenu *m );

	int				GetMaxRecentFiles( void ) const;

// Workspace message handlers
	void			OnNewWorkspace();
	void			OnOpenWorkspace();
	void			OnCloseWorkspace();
	void			OnSaveWorkspace();

	void			OnChangeVSSProperites();

	void			OnCheckoutWorkspace();
	void			OnCheckinWorkspace();

// Project message handlers
	void			OnNewProject();
	void			OnInsertProject();
	void			OnRemoveProject();
	void			OnModifyProjectComments();

// Scene message handlers
	void			OnNewScene();
	void			OnModifySceneComments();
	void			OnRemoveScene();

// Sound entry handlers
	void			OnSoundPlay();
	void			OnSoundToggleVoiceDuck();
	void			OnSoundEditText();

	void			OnSoundProperties();
	void			OnWaveProperties();

	void			OnCheckout();
	void			OnCheckin();

	void			OnMoveUp();
	void			OnMoveDown();

	//void			OnSoundCheckOut();
	//void			OnSoundCheckIn();

// Scene entries
	void			OnSceneAddVCD();
	void			OnSceneRemoveVCD();
	void			OnModifyVCDComments();

	void			OnRecentWorkspace( int index );
	void			OnChangeLanguage( int lang_index, bool force = false );
	void			AddFileToRecentWorkspaceList( char const *filename );
	void			UpdateRecentFilesMenu();

	void			LoadRecentFilesMenuFromDisk();
	void			SaveRecentFilesMenuToDisk();


	bool			CloseWorkspace();

	void		ShowContextMenu_Workspace( int x, int y, CWorkspace *ws );
	void		ShowContextMenu_Project( int x, int y, CProject *project );
	void		ShowContextMenu_Scene( int x, int y, CScene *scene );
	void		ShowContextMenu_VCD( int x, int y, CVCDFile *vcd );
	void		ShowContextMenu_SoundEntry( int x, int y, CSoundEntry *entry );
	void		ShowContextMenu_WaveFile( int x, int y, CWaveFile *entry );

	mxMenuBar		*m_pMenuBar;

	mxMenu			*m_pFileMenu;
	mxMenu			*m_pRecentFileMenu;
	int				m_nRecentMenuItems;
	mxMenu			*m_pProjectMenu;
	mxMenu			*m_pOptionsMenu;
	mxMenu			*m_pMenuCloseCaptionLanguages;

	CWorkspaceWorkArea	*m_pWorkArea;

	CWorkspaceBrowser	*m_pBrowser;
	CSoundBrowser		*m_pSoundBrowser;
	CWaveBrowser		*m_pWaveBrowser;

	struct RecentFile
	{
		char filename[ 256 ];
	};

	CUtlVector< RecentFile > m_RecentFiles;
	int				m_nLanguageId;
	long			m_lEnglishCaptionsFileChangeTime;
};

CWorkspaceManager *GetWorkspaceManager();

#endif // WORKSPACEMANAGER_H