summaryrefslogtreecommitdiff
path: root/utils/scenemanager/vcdfile.h
blob: 661f332ede3264121384c33e59ae13b9846e25b0 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================//

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

class CSoundEntry;
class CScene;

#include "itreeitem.h"
#include "ichoreoeventcallback.h"

class CChoreoScene;

class CVCDFile : public ITreeItem, public IChoreoEventCallback
{
public:
	CVCDFile( CScene *scene, char const *filename );
	~CVCDFile();

	CScene		*GetOwnerScene();

	char const *GetName() const;
	char const *GetComments();
	void		SetComments( char const *comments );

	int			GetSoundEntryCount() const;
	CSoundEntry	*GetSoundEntry( int index );

	void		ValidateTree( mxTreeView *tree, mxTreeViewItem* parent );

	// ITreeItem
	virtual CWorkspace	*GetWorkspace() { return NULL; }
	virtual CProject	*GetProject() { return NULL; }
	virtual CScene		*GetScene() { return NULL; }
	virtual CVCDFile	*GetVCDFile() { return this; }
	virtual CSoundEntry	*GetSoundEntry() { return NULL; }
	virtual CWaveFile	*GetWaveFile() { return NULL; }

	// IChoreoEventCallback stubs
	virtual void StartEvent( float currenttime, CChoreoScene *scene, CChoreoEvent *event ) {}
	// Only called for events with HasEndTime() == true
	virtual void EndEvent( float currenttime, CChoreoScene *scene, CChoreoEvent *event ) {}
	// Called for events which have been started but aren't done yet
	virtual void ProcessEvent( float currenttime, CChoreoScene *scene, CChoreoEvent *event ) {}
	// Called for events that are part of a pause condition
	virtual bool CheckEvent( float currenttime, CChoreoScene *scene, CChoreoEvent *event ) { return false; }

	virtual void Checkout( bool updatestateicons = true );
	virtual void Checkin( bool updatestateicons = true );

	bool		IsCheckedOut() const;
	int			GetIconIndex() const;

	virtual void MoveChildUp( ITreeItem *child );
	virtual void MoveChildDown( ITreeItem *child );

	void		SetDirty( bool dirty );

	virtual bool		IsChildFirst( ITreeItem *child );
	virtual bool		IsChildLast( ITreeItem *child );

private:

	CChoreoScene		*LoadScene( char const *filename );

	void				LoadSoundsFromScene( CChoreoScene *scene );

	enum
	{
		MAX_VCD_NAME = 128,
	};

	char	m_szName[ MAX_VCD_NAME ];
	char	*m_pszComments;

	CUtlVector< CSoundEntry * >	m_Sounds;

	CChoreoScene	*m_pScene;

	CScene			*m_pOwner;
};

#endif // VCDFILE_H