summaryrefslogtreecommitdiff
path: root/tools/commedit/commentarypropertiespanel.h
blob: 35e27e5f0106bf3193c4c3983e0272cfdbbb228b (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//===========================================================================//

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

#include "vgui_controls/editablepanel.h"
#include "tier1/utlstring.h"
#include "datamodel/dmehandle.h"


//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class CCommEditDoc;
class CDmeCommentaryNodeEntity;

namespace vgui
{
	class ComboBox;
	class Button;
	class TextEntry;
	class ListPanel;
	class CheckButton;
	class RadioButton;
}


//-----------------------------------------------------------------------------
// Panel that shows all entities in the level
//-----------------------------------------------------------------------------
class CCommentaryPropertiesPanel : public vgui::EditablePanel
{
	DECLARE_CLASS_SIMPLE( CCommentaryPropertiesPanel, vgui::EditablePanel );

public:
	CCommentaryPropertiesPanel( CCommEditDoc *pDoc, vgui::Panel* pParent );   // standard constructor

	// Inherited from Panel
	virtual void OnCommand( const char *pCommand );

	// Sets the object to look at
	void SetObject( CDmeCommentaryNodeEntity *pEntity );

private:
	// Populates the commentary node fields
	void PopulateCommentaryNodeFields();

	// Populates the info_target fields
	void PopulateInfoTargetFields();

	// Text to attribute...
	void TextEntryToAttribute( vgui::TextEntry *pEntry, const char *pAttributeName );
	void TextEntriesToVector( vgui::TextEntry *pEntry[3], const char *pAttributeName );

	// Updates entity state when text fields change
	void UpdateCommentaryNode();
	void UpdateInfoTarget();

	// Called when the audio picker button is selected
	void PickSound();

	// Called when sound recording is requested
	void RecordSound( );

	// Called when the audio picker button is selected
	void PickInfoTarget( vgui::TextEntry *pControl );

	// Messages handled
	MESSAGE_FUNC_PARAMS( OnTextChanged, "TextChanged", kv );
	MESSAGE_FUNC_PARAMS( OnSoundSelected, "SoundSelected", kv );
	MESSAGE_FUNC_PARAMS( OnPicked, "Picked", kv );
	MESSAGE_FUNC_PARAMS( OnFileSelected, "FileSelected", kv );
	MESSAGE_FUNC_PARAMS( OnSoundRecorded, "SoundRecorded", kv );

	CCommEditDoc *m_pDoc;

	vgui::EditablePanel *m_pCommentaryNodeScroll;
	vgui::EditablePanel *m_pInfoTargetScroll;
	vgui::EditablePanel *m_pCommentaryNode;
	vgui::EditablePanel *m_pInfoTarget;

	vgui::TextEntry *m_pNodeName;
	vgui::Button *m_pSoundFilePicker;
	vgui::TextEntry *m_pSoundFileName;
	vgui::Button *m_pRecordSound;
	vgui::TextEntry *m_pSpeakerName;
	vgui::TextEntry *m_pSynopsis;
	vgui::TextEntry *m_pViewPosition;
	vgui::Button *m_pViewPositionPicker;
	vgui::TextEntry *m_pViewTarget;
	vgui::Button *m_pViewTargetPicker;
	vgui::TextEntry *m_pStartCommands;
	vgui::TextEntry *m_pEndCommands;
	vgui::CheckButton *m_pPreventMovement;
	vgui::TextEntry *m_pPosition[3];
	vgui::TextEntry *m_pOrientation[3];

	vgui::TextEntry *m_pTargetName;
	vgui::TextEntry *m_pTargetPosition[3];
	vgui::TextEntry *m_pTargetOrientation[3];

	CDmeHandle< CDmeCommentaryNodeEntity > m_hEntity;
};


#endif // COMMENTARYPROPERTIESPANEL_H