summaryrefslogtreecommitdiff
path: root/tools/foundry/entityreportpanel.h
blob: 2b72ff847009fa1cfa24f9bf15cc8f675d1b560b (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//===========================================================================//

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

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


//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class CFoundryDoc;
class CDmeVMFEntity;

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


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

public:
	CEntityReportPanel( CFoundryDoc *pDoc, vgui::Panel* pParent, const char *pName );   // standard constructor

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

private:
	enum FilterType_t
	{
		FILTER_SHOW_EVERYTHING = 0,
		FILTER_SHOW_POINT_ENTITIES = 1,
		FILTER_SHOW_BRUSH_ENTITIES = 2
	};

	// Messages handled
	MESSAGE_FUNC_PARAMS( OnTextChanged, "TextChanged", kv );
	MESSAGE_FUNC_PARAMS( OnButtonToggled, "ButtonToggled", kv );
	MESSAGE_FUNC( OnDeleteEntities, "DeleteEntities" );

	// FIXME: Necessary because SetSelected doesn't cause a ButtonToggled message to trigger
	MESSAGE_FUNC_PARAMS( OnCheckButtonChecked, "CheckButtonChecked", kv );
	MESSAGE_FUNC_PARAMS( OnRadioButtonChecked, "RadioButtonChecked", kv );

	// Methods related to filtering
	void OnFilterByHidden( bool bState );
	void OnFilterByKeyvalue( bool bState );
	void OnFilterByClass( bool bState );
	void OnFilterKeyValueExact( bool bState );
	void OnFilterByType( FilterType_t type );
	void OnChangeFilterkey( const char *pText ); 
	void OnChangeFiltervalue( const char *pText ); 
	void OnChangeFilterclass( const char *pText );

	// Methods related to updating the listpanel
	void UpdateEntityList();
	bool ShouldAddEntityToList( CDmeVMFEntity *pEntity );

	// Methods related to saving settings 
	void ReadSettingsFromRegistry();
	void SaveSettingsToRegistry();

	// Call this when our settings are dirty
	void MarkDirty( bool bFilterDirty );

	// Shows the most recent selected object in properties window
	void OnProperties();

	CFoundryDoc *m_pDoc;
	FilterType_t m_iFilterByType;
	bool m_bFilterByClass;
	bool m_bFilterByHidden;
	bool m_bFilterByKeyvalue;
	bool m_bExact;
	bool m_bSuppressEntityListUpdate;

	CUtlString m_szFilterKey;
	CUtlString m_szFilterValue;
	CUtlString m_szFilterClass;

	bool m_bFilterTextChanged;
	float m_flFilterTime;

	bool m_bRegistrySettingsChanged;
	float m_flRegistryTime;

	vgui::CheckButton	*m_pExact;
	vgui::ComboBox		*m_pFilterClass;
	vgui::CheckButton	*m_pFilterByClass;
	vgui::ListPanel		*m_pEntities;
	vgui::TextEntry		*m_pFilterKey;
	vgui::TextEntry		*m_pFilterValue;
	vgui::CheckButton	*m_pFilterByKeyvalue;
	vgui::CheckButton	*m_pFilterByHidden;

	vgui::RadioButton	*m_pFilterEverything;
	vgui::RadioButton	*m_pFilterPointEntities;
	vgui::RadioButton	*m_pFilterBrushModels;
};


#endif // ENTITYREPORTPANEL_H