summaryrefslogtreecommitdiff
path: root/public/dme_controls
diff options
context:
space:
mode:
Diffstat (limited to 'public/dme_controls')
-rw-r--r--public/dme_controls/AnimSetAttributeValue.h65
-rw-r--r--public/dme_controls/AssetBuilder.h218
-rw-r--r--public/dme_controls/AttributeBasePickerPanel.h52
-rw-r--r--public/dme_controls/AttributeBoolChoicePanel.h69
-rw-r--r--public/dme_controls/AttributeColorPickerPanel.h57
-rw-r--r--public/dme_controls/AttributeElementPanel.h61
-rw-r--r--public/dme_controls/AttributeElementPickerPanel.h61
-rw-r--r--public/dme_controls/AttributeFilePickerPanel.h82
-rw-r--r--public/dme_controls/AttributeIntChoicePanel.h67
-rw-r--r--public/dme_controls/AttributeInterpolatorChoicePanel.h49
-rw-r--r--public/dme_controls/AttributeMDLPickerPanel.h43
-rw-r--r--public/dme_controls/AttributeSequencePickerPanel.h46
-rw-r--r--public/dme_controls/AttributeSoundPickerPanel.h41
-rw-r--r--public/dme_controls/AttributeStringChoicePanel.h68
-rw-r--r--public/dme_controls/AttributeTextEntry.h89
-rw-r--r--public/dme_controls/AttributeTextPanel.h62
-rw-r--r--public/dme_controls/AttributeWidgetFactory.h91
-rw-r--r--public/dme_controls/BaseAnimSetAttributeSliderPanel.h186
-rw-r--r--public/dme_controls/BaseAnimSetControlGroupPanel.h96
-rw-r--r--public/dme_controls/BaseAnimSetPresetFaderPanel.h108
-rw-r--r--public/dme_controls/BaseAnimationSetEditor.h151
-rw-r--r--public/dme_controls/BaseAttributeChoicePanel.h65
-rw-r--r--public/dme_controls/BaseAttributeDoubleChoicePanel.h83
-rw-r--r--public/dme_controls/BaseAttributePanel.h275
-rw-r--r--public/dme_controls/ChannelGraphPanel.h89
-rw-r--r--public/dme_controls/DmeSourceDCCFilePanel.h93
-rw-r--r--public/dme_controls/DmeSourceSkinPanel.h62
-rw-r--r--public/dme_controls/ElementPropertiesTree.h471
-rw-r--r--public/dme_controls/FileListManager.h84
-rw-r--r--public/dme_controls/LogPreview.h75
-rw-r--r--public/dme_controls/RecordingState.h24
-rw-r--r--public/dme_controls/attributeassetpickerpanel.h93
-rw-r--r--public/dme_controls/attributedetailtypepickerpanel.h47
-rw-r--r--public/dme_controls/attributeshaderpickerpanel.h43
-rw-r--r--public/dme_controls/attributeslider.h284
-rw-r--r--public/dme_controls/attributesurfacepropertypickerpanel.h47
-rw-r--r--public/dme_controls/dmecombinationsystemeditorpanel.h93
-rw-r--r--public/dme_controls/dmecontrols.h72
-rw-r--r--public/dme_controls/dmecontrols_utils.h138
-rw-r--r--public/dme_controls/dmedageditpanel.h96
-rw-r--r--public/dme_controls/dmedagrenderpanel.h140
-rw-r--r--public/dme_controls/dmelogeditpanel.h170
-rw-r--r--public/dme_controls/dmemdlpanel.h38
-rw-r--r--public/dme_controls/dmepanel.h280
-rw-r--r--public/dme_controls/dmepicker.h101
-rw-r--r--public/dme_controls/dmepresetgroupeditorpanel.h178
-rw-r--r--public/dme_controls/filtercombobox.h32
-rw-r--r--public/dme_controls/inotifyui.h134
-rw-r--r--public/dme_controls/particlesystempanel.h174
-rw-r--r--public/dme_controls/particlesystempropertiespanel.h84
-rw-r--r--public/dme_controls/presetpicker.h55
-rw-r--r--public/dme_controls/soundpicker.h123
-rw-r--r--public/dme_controls/soundrecordpanel.h66
53 files changed, 5571 insertions, 0 deletions
diff --git a/public/dme_controls/AnimSetAttributeValue.h b/public/dme_controls/AnimSetAttributeValue.h
new file mode 100644
index 0000000..b23f273
--- /dev/null
+++ b/public/dme_controls/AnimSetAttributeValue.h
@@ -0,0 +1,65 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef ANIMSETATTRIBUTEVALUE_H
+#define ANIMSETATTRIBUTEVALUE_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "tier1/utldict.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmAttribute;
+
+
+//-----------------------------------------------------------------------------
+// AnimationControlType
+//-----------------------------------------------------------------------------
+enum AnimationControlType_t
+{
+ ANIM_CONTROL_INVALID = -1,
+
+ ANIM_CONTROL_VALUE = 0,
+ ANIM_CONTROL_BALANCE,
+ ANIM_CONTROL_MULTILEVEL,
+
+ ANIM_CONTROL_COUNT,
+};
+
+
+struct AttributeValue_t
+{
+ AttributeValue_t()
+ {
+ // Default values
+ m_pValue[ANIM_CONTROL_VALUE] = 0.0f;
+ m_pValue[ANIM_CONTROL_BALANCE] = 0.5f;
+ m_pValue[ANIM_CONTROL_MULTILEVEL] = 0.5f;
+ }
+
+ float m_pValue[ANIM_CONTROL_COUNT];
+};
+
+struct AnimationControlAttributes_t : public AttributeValue_t
+{
+ AnimationControlAttributes_t()
+ {
+ // Default values
+ m_pAttribute[ANIM_CONTROL_VALUE] = 0;
+ m_pAttribute[ANIM_CONTROL_BALANCE] = 0;
+ m_pAttribute[ANIM_CONTROL_MULTILEVEL] = 0;
+ }
+
+ CDmAttribute* m_pAttribute[ANIM_CONTROL_COUNT];
+};
+
+typedef CUtlDict< AnimationControlAttributes_t, unsigned short > AttributeDict_t;
+
+#endif // ANIMSETATTRIBUTEVALUE_H \ No newline at end of file
diff --git a/public/dme_controls/AssetBuilder.h b/public/dme_controls/AssetBuilder.h
new file mode 100644
index 0000000..f07db07
--- /dev/null
+++ b/public/dme_controls/AssetBuilder.h
@@ -0,0 +1,218 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef ASSETBUILDER_H
+#define ASSETBUILDER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "vgui_controls/Frame.h"
+#include "vgui_controls/FileOpenStateMachine.h"
+#include "vgui_controls/PHandle.h"
+#include "datamodel/dmehandle.h"
+#include "tier1/utlstack.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+namespace vgui
+{
+ class IScheme;
+ class ListPanel;
+ class Menu;
+ class MenuButton;
+ class Splitter;
+ class FileOpenStateMachine;
+ class PropertySheet;
+ class PropertyPage;
+}
+
+class CDmePanel;
+class CCompileStatusBar;
+class CDmeMakefile;
+class CDmeSource;
+struct DmeMakefileType_t;
+enum CompilationState_t;
+
+
+//-----------------------------------------------------------------------------
+// Purpose: Asset builder
+//-----------------------------------------------------------------------------
+class CAssetBuilder : public vgui::EditablePanel
+{
+ DECLARE_CLASS_SIMPLE( CAssetBuilder, EditablePanel );
+
+public:
+ CAssetBuilder( vgui::Panel *pParent, const char *pPanelName );
+ virtual ~CAssetBuilder();
+
+ // Inherited from vgui::Frame
+ virtual void OnCommand( const char *pCommand );
+ virtual void OnKeyCodeTyped( vgui::KeyCode code );
+ virtual void OnTick();
+
+ void SetRootMakefile( CDmeMakefile *pMakeFile );
+ void SetCurrentMakefile( CDmeMakefile *pMakeFile );
+ void SetDmeElement( CDmeMakefile *pMakeFile );
+ CDmeMakefile *GetMakeFile();
+ CDmeMakefile *GetRootMakeFile();
+
+ void Refresh();
+
+ // Default behavior is to destroy the makefile when we close
+ void DestroyMakefileOnClose( bool bEnable );
+
+ /*
+ messages sent:
+ "DmeElementChanged" The makefile has been changed
+ */
+
+private:
+ MESSAGE_FUNC_PARAMS( OnItemSelected, "ItemSelected", kv );
+ MESSAGE_FUNC_PARAMS( OnItemDeselected, "ItemDeselected", kv );
+ MESSAGE_FUNC_PARAMS( OnFileSelected, "FileSelected", kv );
+ MESSAGE_FUNC_PARAMS( OnOpenContextMenu, "OpenContextMenu", kv );
+ MESSAGE_FUNC_PARAMS( OnPicked, "Picked", kv );
+ MESSAGE_FUNC( SetDirty, "DmeElementChanged" );
+ MESSAGE_FUNC( OnAddSource, "AddSource" );
+ MESSAGE_FUNC( OnNewSourceFile, "NewSourceFile" );
+ MESSAGE_FUNC( OnLoadSourceFile, "LoadSourceFile" );
+ MESSAGE_FUNC( OnEditSourceFile, "EditSourceFile" );
+ MESSAGE_FUNC( OnRemoveSource, "RemoveSource" );
+ MESSAGE_FUNC( OnBrowseSourceFile, "BrowseSourceFile" );
+ MESSAGE_FUNC( OnZoomInSource, "ZoomInSource" );
+ MESSAGE_FUNC( OnZoomOutSource, "ZoomOutSource" );
+
+ void OnCompile();
+ void OnAbortCompile();
+ void OnPublish();
+
+ // Called to create a new makefile
+ void OnNewSourceFileSelected( const char *pFileName, KeyValues *pDialogKeys );
+
+ // Called when a list panel's selection changes
+ void OnSourceItemSelectionChanged( );
+
+ // Refresh the source list
+ void RefreshSourceList( );
+
+ // Refreshes the output list
+ void RefreshOutputList();
+
+ // Selects a particular source
+ void SelectSource( CDmeSource *pSource );
+
+ // Called when the source file name changes
+ void OnSourceFileNameChanged( const char *pFileName );
+
+ // Called when we're browsing for a source file and one was selected
+ void OnSourceFileAdded( const char *pFileName, const char *pTypeName );
+
+ // Shows the source file browser
+ void ShowSourceFileBrowser( const char *pTitle, DmeMakefileType_t *pSourceType, KeyValues *pDialogKeys );
+
+ // Make all outputs writeable
+ void MakeOutputsWriteable( );
+
+ // Cleans up the context menu
+ void CleanupContextMenu();
+
+ // Removes a makefile from memory
+ void CleanupMakefile();
+
+ // Builds a unique list of file IDs
+ void BuildFileIDList( CDmeMakefile *pMakeFile, CUtlVector<DmFileId_t> &fileIds );
+
+ // Selects a particular row of the source list
+ void SelectSourceListRow( int nRow );
+
+ // Returns the curerntly selected row
+ int GetSelectedRow( );
+
+ // Finishes compilation
+ void FinishCompilation( CompilationState_t state );
+
+ // Returns the selected source (if there's only 1 source selected)
+ CDmeSource *GetSelectedSource( );
+ KeyValues *GetSelectedSourceKeyvalues( );
+
+ vgui::PropertySheet *m_pInputOutputSheet;
+ vgui::PropertyPage *m_pInputPage;
+ vgui::PropertyPage *m_pOutputPage;
+ vgui::PropertyPage *m_pCompilePage;
+ vgui::PropertyPage *m_pOutputPreviewPage;
+
+ vgui::Splitter *m_pPropertiesSplitter;
+ vgui::ListPanel *m_pSourcesList;
+ vgui::ListPanel *m_pOutputList;
+ CDmePanel *m_pDmePanel;
+ CDmePanel *m_pOututPreviewPanel;
+ vgui::TextEntry *m_pCompileOutput;
+ vgui::Button *m_pCompile;
+ vgui::Button *m_pPublish;
+ vgui::Button *m_pAbortCompile;
+ vgui::DHANDLE< vgui::Menu > m_hContextMenu;
+ CCompileStatusBar *m_pCompileStatusBar;
+
+ CDmeHandle< CDmeMakefile > m_hRootMakefile;
+ CDmeHandle< CDmeMakefile > m_hMakefile;
+ CUtlStack< CDmeHandle< CDmeMakefile > > m_hMakefileStack;
+ bool m_bIsCompiling : 1;
+ bool m_bDestroyMakefileOnClose : 1;
+};
+
+
+//-----------------------------------------------------------------------------
+// Purpose: Asset builder frame
+//-----------------------------------------------------------------------------
+class CAssetBuilderFrame : public vgui::Frame, public vgui::IFileOpenStateMachineClient
+{
+ DECLARE_CLASS_SIMPLE( CAssetBuilderFrame, vgui::Frame );
+
+public:
+ CAssetBuilderFrame( vgui::Panel *pParent, const char *pTitle );
+ virtual ~CAssetBuilderFrame();
+
+ // Inherited from IFileOpenStateMachineClient
+ virtual void SetupFileOpenDialog( vgui::FileOpenDialog *pDialog, bool bOpenFile, const char *pFileFormat, KeyValues *pContextKeyValues );
+ virtual bool OnReadFileFromDisk( const char *pFileName, const char *pFileFormat, KeyValues *pContextKeyValues );
+ virtual bool OnWriteFileToDisk( const char *pFileName, const char *pFileFormat, KeyValues *pContextKeyValues );
+
+protected:
+ // Call to change the makefile
+ void Reset( CDmeMakefile *pMakefile );
+
+ CAssetBuilder *m_pAssetBuilder;
+
+private:
+ MESSAGE_FUNC( OnDmeElementChanged, "DmeElementChanged" );
+ MESSAGE_FUNC( OnFileNew, "FileNew" );
+ MESSAGE_FUNC( OnFileOpen, "FileOpen" );
+ MESSAGE_FUNC( OnFileSave, "FileSave" );
+ MESSAGE_FUNC( OnFileSaveAs, "FileSaveAs" );
+ MESSAGE_FUNC_PARAMS( OnPicked, "Picked", kv );
+ MESSAGE_FUNC_PARAMS( OnFileSelected, "FileSelected", kv );
+ MESSAGE_FUNC_PARAMS( OnFileStateMachineFinished, "FileStateMachineFinished", kv );
+ MESSAGE_FUNC_PARAMS( OnPerformFileNew, "PerformFileNew", kv );
+
+ // Updates the file name
+ MESSAGE_FUNC( UpdateFileName, "UpdateFileName" );
+
+ // Shows a picker for creating a new asset
+ void ShowNewAssetPicker( );
+
+ // Marks the file dirty ( or not )
+ void SetDirty( bool bDirty );
+ bool IsDirty() const;
+
+ vgui::FileOpenStateMachine *m_pFileOpenStateMachine;
+ CUtlString m_TitleString;
+};
+
+
+#endif // ASSETBUILDER_H
diff --git a/public/dme_controls/AttributeBasePickerPanel.h b/public/dme_controls/AttributeBasePickerPanel.h
new file mode 100644
index 0000000..84e1654
--- /dev/null
+++ b/public/dme_controls/AttributeBasePickerPanel.h
@@ -0,0 +1,52 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef ATTRIBUTEBASEPICKERPANEL_H
+#define ATTRIBUTEBASEPICKERPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/AttributeTextPanel.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmElement;
+
+namespace vgui
+{
+ class Button;
+}
+
+
+//-----------------------------------------------------------------------------
+// CAttributeBasePickerPanel
+//-----------------------------------------------------------------------------
+class CAttributeBasePickerPanel : public CAttributeTextPanel
+{
+ DECLARE_CLASS_SIMPLE( CAttributeBasePickerPanel, CAttributeTextPanel );
+
+public:
+ CAttributeBasePickerPanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+
+ // Inherited from Panel
+ virtual void OnCommand( const char *cmd );
+ virtual void PerformLayout();
+
+private:
+ // Inherited classes must implement this
+ virtual void ShowPickerDialog() = 0;
+
+ vgui::Button *m_pOpen;
+};
+
+
+#endif // ATTRIBUTEBASEPICKERPANEL_H
diff --git a/public/dme_controls/AttributeBoolChoicePanel.h b/public/dme_controls/AttributeBoolChoicePanel.h
new file mode 100644
index 0000000..63af793
--- /dev/null
+++ b/public/dme_controls/AttributeBoolChoicePanel.h
@@ -0,0 +1,69 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef ATTRIBUTEBOOLCHOICEPANEL_h
+#define ATTRIBUTEBOOLCHOICEPANEL_h
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/BaseAttributeChoicePanel.h"
+#include "movieobjects/dmeeditortypedictionary.h"
+#include "vgui_controls/MessageMap.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+struct AttributeWidgetInfo_t;
+
+namespace vgui
+{
+ class Panel;
+ class ComboBox;
+}
+
+
+//-----------------------------------------------------------------------------
+// Configuration for integer choices
+//-----------------------------------------------------------------------------
+class CDmeEditorBoolChoicesInfo : public CDmeEditorChoicesInfo
+{
+ DEFINE_ELEMENT( CDmeEditorBoolChoicesInfo, CDmeEditorChoicesInfo );
+
+public:
+ // Add a choice
+ void SetFalseChoice( const char *pChoiceString );
+ void SetTrueChoice( const char *pChoiceString );
+
+ // Gets the choices
+ const char *GetFalseChoiceString( ) const;
+ const char *GetTrueChoiceString( ) const;
+};
+
+
+//-----------------------------------------------------------------------------
+// CAttributeBoolChoicePanel
+//-----------------------------------------------------------------------------
+class CAttributeBoolChoicePanel : public CBaseAttributeChoicePanel
+{
+ DECLARE_CLASS_SIMPLE( CAttributeBoolChoicePanel, CBaseAttributeChoicePanel );
+
+public:
+ CAttributeBoolChoicePanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+
+private:
+ // Derived classes can re-implement this to fill the combo box however they like
+ virtual void PopulateComboBox( vgui::ComboBox *pComboBox );
+ virtual void SetAttributeFromComboBox( vgui::ComboBox *pComboBox, KeyValues *pKeyValues );
+ virtual void SetComboBoxFromAttribute( vgui::ComboBox *pComboBox );
+};
+
+
+#endif // ATTRIBUTEBOOLCHOICEPANEL_h
diff --git a/public/dme_controls/AttributeColorPickerPanel.h b/public/dme_controls/AttributeColorPickerPanel.h
new file mode 100644
index 0000000..99e669d
--- /dev/null
+++ b/public/dme_controls/AttributeColorPickerPanel.h
@@ -0,0 +1,57 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef ATTRIBUTECOLORPICKERPANEL_H
+#define ATTRIBUTECOLORPICKERPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/AttributeTextPanel.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmElement;
+
+namespace vgui
+{
+ class Button;
+}
+
+
+//-----------------------------------------------------------------------------
+// CAttributeColorPickerPanel
+//-----------------------------------------------------------------------------
+class CAttributeColorPickerPanel : public CAttributeTextPanel
+{
+ DECLARE_CLASS_SIMPLE( CAttributeColorPickerPanel, CAttributeTextPanel );
+
+public:
+ CAttributeColorPickerPanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+
+ // Inherited from Panel
+ virtual void OnCommand( const char *cmd );
+ virtual void PerformLayout();
+ virtual void Refresh();
+ virtual void ApplySchemeSettings(IScheme *pScheme);
+
+private:
+ MESSAGE_FUNC_PARAMS( OnPreview, "ColorPickerPreview", data );
+ MESSAGE_FUNC_PARAMS( OnPicked, "ColorPickerPicked", data );
+ MESSAGE_FUNC( OnCancelled, "ColorPickerCancel" );
+ void UpdateButtonColor();
+
+ vgui::Button *m_pOpen;
+ Color m_InitialColor;
+};
+
+
+#endif // ATTRIBUTECOLORPICKERPANEL_H
diff --git a/public/dme_controls/AttributeElementPanel.h b/public/dme_controls/AttributeElementPanel.h
new file mode 100644
index 0000000..055fe7d
--- /dev/null
+++ b/public/dme_controls/AttributeElementPanel.h
@@ -0,0 +1,61 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef ATTRIBUTEELEMENTPANEL_H
+#define ATTRIBUTEELEMENTPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/BaseAttributePanel.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmElement;
+class CAttributeTextEntry;
+
+namespace vgui
+{
+ class Label;
+}
+
+
+//-----------------------------------------------------------------------------
+// CAttributeElementPanel
+//-----------------------------------------------------------------------------
+class CAttributeElementPanel : public CBaseAttributePanel
+{
+ DECLARE_CLASS_SIMPLE( CAttributeElementPanel, CBaseAttributePanel );
+
+public:
+ CAttributeElementPanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+
+ virtual void PostConstructor();
+ virtual void Apply();
+
+protected:
+ virtual vgui::Panel *GetDataPanel();
+ virtual void OnCreateDragData( KeyValues *msg );
+
+ MESSAGE_FUNC(OnTextChanged, "TextChanged")
+ {
+ SetDirty( true );
+ }
+
+private:
+ virtual void Refresh();
+
+ CAttributeTextEntry *m_pData;
+ bool m_bShowMemoryUsage;
+};
+
+
+#endif // ATTRIBUTEELEMENTPANEL_H
diff --git a/public/dme_controls/AttributeElementPickerPanel.h b/public/dme_controls/AttributeElementPickerPanel.h
new file mode 100644
index 0000000..53d9606
--- /dev/null
+++ b/public/dme_controls/AttributeElementPickerPanel.h
@@ -0,0 +1,61 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef ATTRIBUTEELEMENTPICKERPANEL_H
+#define ATTRIBUTEELEMENTPICKERPANEL_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/BaseAttributeChoicePanel.h"
+#include "vgui_controls/PHandle.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmElement;
+class CAttributeTextEntry;
+
+namespace vgui
+{
+ class Label;
+}
+
+
+//-----------------------------------------------------------------------------
+// CAttributeElementPickerPanel
+//-----------------------------------------------------------------------------
+class CAttributeElementPickerPanel : public CBaseAttributePanel
+{
+ DECLARE_CLASS_SIMPLE( CAttributeElementPickerPanel, CBaseAttributePanel );
+
+public:
+ CAttributeElementPickerPanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+
+ virtual void OnCommand( const char *cmd );
+ virtual void PerformLayout();
+
+ virtual void PostConstructor();
+ virtual void Apply();
+
+private:
+ // Inherited classes must implement this
+ virtual Panel *GetDataPanel();
+ virtual void Refresh();
+
+ MESSAGE_FUNC_PARAMS( OnDmeSelected, "DmeSelected", kv );
+ virtual void ShowPickerDialog();
+
+ vgui::DHANDLE< vgui::Button > m_hEdit;
+ CAttributeTextEntry *m_pData;
+ bool m_bShowMemoryUsage;
+};
+
+
+#endif // ATTRIBUTEELEMENTPICKERPANEL_H
diff --git a/public/dme_controls/AttributeFilePickerPanel.h b/public/dme_controls/AttributeFilePickerPanel.h
new file mode 100644
index 0000000..61d6db0
--- /dev/null
+++ b/public/dme_controls/AttributeFilePickerPanel.h
@@ -0,0 +1,82 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef ATTRIBUTEFILEPICKERPANEL_H
+#define ATTRIBUTEFILEPICKERPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/AttributeBasePickerPanel.h"
+#include "vgui_controls/PHandle.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmElement;
+
+namespace vgui
+{
+ class FileOpenDialog;
+}
+
+
+//-----------------------------------------------------------------------------
+// CAttributeFilePickerPanel
+//-----------------------------------------------------------------------------
+class CAttributeFilePickerPanel : public CAttributeBasePickerPanel
+{
+ DECLARE_CLASS_SIMPLE( CAttributeFilePickerPanel, CAttributeBasePickerPanel );
+
+public:
+ CAttributeFilePickerPanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+ ~CAttributeFilePickerPanel();
+
+private:
+ MESSAGE_FUNC_CHARPTR( OnFileSelected, "FileSelected", fullpath );
+ virtual void ShowPickerDialog();
+ virtual void SetupFileOpenDialog( vgui::FileOpenDialog *pDialog ) = 0;
+};
+
+
+//-----------------------------------------------------------------------------
+// Macro to quickly make new attribute types
+//-----------------------------------------------------------------------------
+#define DECLARE_ATTRIBUTE_FILE_PICKER( _className ) \
+ class _className : public CAttributeFilePickerPanel \
+ { \
+ DECLARE_CLASS_SIMPLE( _className, CAttributeFilePickerPanel ); \
+ public: \
+ _className( vgui::Panel *parent, const AttributeWidgetInfo_t &info ) : \
+ BaseClass( parent, info ) {} \
+ private: \
+ virtual void SetupFileOpenDialog( vgui::FileOpenDialog *pDialog ); \
+ }
+
+#define IMPLEMENT_ATTRIBUTE_FILE_PICKER( _className, _popupTitle, _assetType, _assetExt ) \
+ void _className::SetupFileOpenDialog( vgui::FileOpenDialog *pDialog ) \
+ { \
+ pDialog->SetTitle( _popupTitle, true ); \
+ pDialog->AddFilter( "*." _assetExt, _assetType " (*." _assetExt ")", true ); \
+ pDialog->AddFilter( "*.*", "All Files (*.*)", false ); \
+ }
+
+
+//-----------------------------------------------------------------------------
+// File picker types
+//-----------------------------------------------------------------------------
+DECLARE_ATTRIBUTE_FILE_PICKER( CAttributeTgaFilePickerPanel );
+DECLARE_ATTRIBUTE_FILE_PICKER( CAttributeDmeFilePickerPanel );
+DECLARE_ATTRIBUTE_FILE_PICKER( CAttributeAviFilePickerPanel );
+DECLARE_ATTRIBUTE_FILE_PICKER( CAttributeShtFilePickerPanel );
+DECLARE_ATTRIBUTE_FILE_PICKER( CAttributeRawFilePickerPanel );
+
+
+#endif // ATTRIBUTEFILEPICKERPANEL_H
diff --git a/public/dme_controls/AttributeIntChoicePanel.h b/public/dme_controls/AttributeIntChoicePanel.h
new file mode 100644
index 0000000..4578508
--- /dev/null
+++ b/public/dme_controls/AttributeIntChoicePanel.h
@@ -0,0 +1,67 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef ATTRIBUTEINTCHOICEPANEL_h
+#define ATTRIBUTEINTCHOICEPANEL_h
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/BaseAttributeChoicePanel.h"
+#include "movieobjects/dmeeditortypedictionary.h"
+#include "vgui_controls/MessageMap.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+struct AttributeWidgetInfo_t;
+
+namespace vgui
+{
+ class Panel;
+ class ComboBox;
+}
+
+
+//-----------------------------------------------------------------------------
+// Configuration for integer choices
+//-----------------------------------------------------------------------------
+class CDmeEditorIntChoicesInfo : public CDmeEditorChoicesInfo
+{
+ DEFINE_ELEMENT( CDmeEditorIntChoicesInfo, CDmeEditorChoicesInfo );
+
+public:
+ // Add a choice
+ void AddChoice( int nValue, const char *pChoiceString );
+
+ // Gets the choices
+ int GetChoiceValue( int nIndex ) const;
+};
+
+
+//-----------------------------------------------------------------------------
+// CAttributeIntChoicePanel
+//-----------------------------------------------------------------------------
+class CAttributeIntChoicePanel : public CBaseAttributeChoicePanel
+{
+ DECLARE_CLASS_SIMPLE( CAttributeIntChoicePanel, CBaseAttributeChoicePanel );
+
+public:
+ CAttributeIntChoicePanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+
+private:
+ // Derived classes can re-implement this to fill the combo box however they like
+ virtual void PopulateComboBox( vgui::ComboBox *pComboBox );
+ virtual void SetAttributeFromComboBox( vgui::ComboBox *pComboBox, KeyValues *pKeyValues );
+ virtual void SetComboBoxFromAttribute( vgui::ComboBox *pComboBox );
+};
+
+
+#endif // ATTRIBUTEINTCHOICEPANEL_h
diff --git a/public/dme_controls/AttributeInterpolatorChoicePanel.h b/public/dme_controls/AttributeInterpolatorChoicePanel.h
new file mode 100644
index 0000000..b44817d
--- /dev/null
+++ b/public/dme_controls/AttributeInterpolatorChoicePanel.h
@@ -0,0 +1,49 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef ATTRIBUTEINTERPOLATORTYPECHOICEPANEL_h
+#define ATTRIBUTEINTERPOLATORTYPECHOICEPANEL_h
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/BaseAttributeDoubleChoicePanel.h"
+#include "movieobjects/dmeeditortypedictionary.h"
+#include "vgui_controls/MessageMap.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+struct AttributeWidgetInfo_t;
+
+namespace vgui
+{
+ class Panel;
+ class ComboBox;
+}
+
+//-----------------------------------------------------------------------------
+// CAttributeInterpolatorChoicePanel
+//-----------------------------------------------------------------------------
+class CAttributeInterpolatorChoicePanel : public CBaseAttributeDoubleChoicePanel
+{
+ DECLARE_CLASS_SIMPLE( CAttributeInterpolatorChoicePanel, CBaseAttributeDoubleChoicePanel );
+
+public:
+ CAttributeInterpolatorChoicePanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+
+private:
+ virtual void PopulateComboBoxes( vgui::ComboBox *pComboBox[2] );
+ virtual void SetAttributeFromComboBoxes( vgui::ComboBox *pComboBox[2], KeyValues *pKeyValues[ 2 ] );
+ virtual void SetComboBoxesFromAttribute( vgui::ComboBox *pComboBox[2] );
+};
+
+
+#endif // ATTRIBUTEINTERPOLATORTYPECHOICEPANEL_h
diff --git a/public/dme_controls/AttributeMDLPickerPanel.h b/public/dme_controls/AttributeMDLPickerPanel.h
new file mode 100644
index 0000000..78a61e8
--- /dev/null
+++ b/public/dme_controls/AttributeMDLPickerPanel.h
@@ -0,0 +1,43 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef ATTRIBUTEMDLPICKERPANEL_H
+#define ATTRIBUTEMDLPICKERPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/AttributeBasePickerPanel.h"
+#include "vgui_controls/PHandle.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CMDLPickerFrame;
+
+
+//-----------------------------------------------------------------------------
+// CAttributeMDLPickerPanel
+//-----------------------------------------------------------------------------
+class CAttributeMDLPickerPanel : public CAttributeBasePickerPanel
+{
+ DECLARE_CLASS_SIMPLE( CAttributeMDLPickerPanel, CAttributeBasePickerPanel );
+
+public:
+ CAttributeMDLPickerPanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+ ~CAttributeMDLPickerPanel();
+
+private:
+ MESSAGE_FUNC_PARAMS( OnMDLSelected, "MDLSelected", kv );
+ virtual void ShowPickerDialog();
+};
+
+
+#endif // ATTRIBUTEMDLPICKERPANEL_H
diff --git a/public/dme_controls/AttributeSequencePickerPanel.h b/public/dme_controls/AttributeSequencePickerPanel.h
new file mode 100644
index 0000000..2f28566
--- /dev/null
+++ b/public/dme_controls/AttributeSequencePickerPanel.h
@@ -0,0 +1,46 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef ATTRIBUTESEQUENCEPICKERPANEL_H
+#define ATTRIBUTESEQUENCEPICKERPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/AttributeBasePickerPanel.h"
+#include "vgui_controls/PHandle.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CMDLPickerFrame;
+class CSequencePickerFrame;
+
+
+//-----------------------------------------------------------------------------
+// CAttributeSequencePickerPanel
+//-----------------------------------------------------------------------------
+class CAttributeSequencePickerPanel : public CAttributeBasePickerPanel
+{
+ DECLARE_CLASS_SIMPLE( CAttributeSequencePickerPanel, CAttributeBasePickerPanel );
+
+public:
+ CAttributeSequencePickerPanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+ ~CAttributeSequencePickerPanel();
+
+private:
+ MESSAGE_FUNC_PARAMS( OnMDLSelected, "AssetSelected", kv );
+ MESSAGE_FUNC_PARAMS( OnSequenceSelected, "SequenceSelected", kv );
+ virtual void ShowPickerDialog();
+ void ShowSequencePickerDialog( const char *pMDLName );
+};
+
+
+#endif // ATTRIBUTESEQUENCEPICKERPANEL_H
diff --git a/public/dme_controls/AttributeSoundPickerPanel.h b/public/dme_controls/AttributeSoundPickerPanel.h
new file mode 100644
index 0000000..ef05017
--- /dev/null
+++ b/public/dme_controls/AttributeSoundPickerPanel.h
@@ -0,0 +1,41 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef ATTRIBUTESOUNDPICKERPANEL_H
+#define ATTRIBUTESOUNDPICKERPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/AttributeBasePickerPanel.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+
+
+//-----------------------------------------------------------------------------
+// CAttributeSoundPickerPanel
+//-----------------------------------------------------------------------------
+class CAttributeSoundPickerPanel : public CAttributeBasePickerPanel
+{
+ DECLARE_CLASS_SIMPLE( CAttributeSoundPickerPanel, CAttributeBasePickerPanel );
+
+public:
+ CAttributeSoundPickerPanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+ ~CAttributeSoundPickerPanel();
+
+private:
+ MESSAGE_FUNC_PARAMS( OnSoundSelected, "SoundSelected", kv );
+ virtual void ShowPickerDialog();
+};
+
+
+#endif // ATTRIBUTESOUNDPICKERPANEL_H
diff --git a/public/dme_controls/AttributeStringChoicePanel.h b/public/dme_controls/AttributeStringChoicePanel.h
new file mode 100644
index 0000000..a354822
--- /dev/null
+++ b/public/dme_controls/AttributeStringChoicePanel.h
@@ -0,0 +1,68 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef ATTRIBUTESTRINGCHOICEPANEL_h
+#define ATTRIBUTESTRINGCHOICEPANEL_h
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/BaseAttributeChoicePanel.h"
+#include "movieobjects/dmeeditortypedictionary.h"
+#include "vgui_controls/MessageMap.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+struct AttributeWidgetInfo_t;
+
+namespace vgui
+{
+ class Panel;
+ class ComboBox;
+}
+
+
+//-----------------------------------------------------------------------------
+// Configuration for string choices
+//-----------------------------------------------------------------------------
+class CDmeEditorStringChoicesInfo : public CDmeEditorChoicesInfo
+{
+ DEFINE_ELEMENT( CDmeEditorStringChoicesInfo, CDmeEditorChoicesInfo );
+
+public:
+ // Add a choice
+ CDmElement *AddChoice( const char *pValueString, const char *pChoiceString );
+
+ // Gets the choices
+ const char *GetChoiceValue( int nIndex ) const;
+};
+
+
+//-----------------------------------------------------------------------------
+// CAttributeStringChoicePanel
+//-----------------------------------------------------------------------------
+class CAttributeStringChoicePanel : public CBaseAttributeChoicePanel
+{
+ DECLARE_CLASS_SIMPLE( CAttributeStringChoicePanel, CBaseAttributeChoicePanel );
+
+public:
+ CAttributeStringChoicePanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+
+private:
+ // Derived classes can re-implement this to fill the combo box however they like
+ virtual void PopulateComboBox( vgui::ComboBox *pComboBox );
+ virtual void SetAttributeFromComboBox( vgui::ComboBox *pComboBox, KeyValues *pKeyValues );
+ virtual void SetComboBoxFromAttribute( vgui::ComboBox *pComboBox );
+};
+
+
+// ----------------------------------------------------------------------------
+#endif // ATTRIBUTESTRINGCHOICEPANEL_h
diff --git a/public/dme_controls/AttributeTextEntry.h b/public/dme_controls/AttributeTextEntry.h
new file mode 100644
index 0000000..7a3454b
--- /dev/null
+++ b/public/dme_controls/AttributeTextEntry.h
@@ -0,0 +1,89 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef ATTRIBUTETEXTENTRY_H
+#define ATTRIBUTETEXTENTRY_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "vgui_controls/TextEntry.h"
+#include "tier1/utlvector.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmElement;
+class CAttributeTextPanel;
+class KeyValues;
+
+namespace vgui
+{
+ class IScheme;
+ class Label;
+ class Menu;
+}
+
+
+//-----------------------------------------------------------------------------
+// CAttributeTextEntry
+//-----------------------------------------------------------------------------
+class CAttributeTextEntry : public vgui::TextEntry
+{
+ DECLARE_CLASS_SIMPLE( CAttributeTextEntry, vgui::TextEntry );
+
+public:
+ CAttributeTextEntry( Panel *parent, const char *panelName );
+ virtual bool GetSelectedRange(int& cx0,int& cx1)
+ {
+ return BaseClass::GetSelectedRange( cx0, cx1 );
+ }
+
+protected:
+ CAttributeTextPanel *GetParentAttributePanel();
+ virtual void OnMouseWheeled( int delta );
+
+ // We'll only create an "undo" record if the values differ upon focus change
+ virtual void OnSetFocus();
+ virtual void OnKillFocus();
+ virtual void OnKeyCodeTyped( vgui::KeyCode code );
+
+ virtual void OnPanelDropped( CUtlVector< KeyValues * >& data );
+ virtual bool GetDropContextMenu( vgui::Menu *menu, CUtlVector< KeyValues * >& msglist );
+ virtual bool IsDroppable( CUtlVector< KeyValues * >& msglist );
+
+ virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
+
+ MESSAGE_FUNC_PARAMS( OnTextChanged, "TextChanged", data );
+
+private:
+ enum
+ {
+ MAX_TEXT_LENGTH = 1024
+ };
+
+ template<class T> void ApplyMouseWheel( T newValue, T originalValue );
+ void StoreInitialValue( bool bForce = false );
+ void WriteValueToAttribute();
+ void WriteInitialValueToAttribute();
+
+ bool m_bValueStored;
+ char m_szOriginalText[ MAX_TEXT_LENGTH ];
+ union
+ {
+ float m_flOriginalValue;
+ int m_nOriginalValue;
+ bool m_bOriginalValue;
+ };
+};
+
+
+// ----------------------------------------------------------------------------
+#endif // ATTRIBUTETEXTENTRY_H
diff --git a/public/dme_controls/AttributeTextPanel.h b/public/dme_controls/AttributeTextPanel.h
new file mode 100644
index 0000000..b086a48
--- /dev/null
+++ b/public/dme_controls/AttributeTextPanel.h
@@ -0,0 +1,62 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef ATTRIBUTETEXTPANEL_H
+#define ATTRIBUTETEXTPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/BaseAttributePanel.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmElement;
+class CAttributeTextEntry;
+
+namespace vgui
+{
+ class Label;
+}
+
+
+//-----------------------------------------------------------------------------
+// CAttributeTextPanel
+//-----------------------------------------------------------------------------
+class CAttributeTextPanel : public CBaseAttributePanel
+{
+ DECLARE_CLASS_SIMPLE( CAttributeTextPanel, CBaseAttributePanel );
+
+public:
+ CAttributeTextPanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+ virtual void SetFont( HFont font );
+ virtual void PostConstructor();
+ virtual void Apply();
+ virtual void Refresh();
+
+ // Returns the text type
+ const char *GetTextType();
+
+protected:
+ virtual vgui::Panel *GetDataPanel();
+
+ MESSAGE_FUNC(OnTextChanged, "TextChanged")
+ {
+ SetDirty( true );
+ }
+
+protected:
+ CAttributeTextEntry *m_pData;
+ bool m_bShowMemoryUsage;
+};
+
+
+#endif // ATTRIBUTETEXTPANEL_H
diff --git a/public/dme_controls/AttributeWidgetFactory.h b/public/dme_controls/AttributeWidgetFactory.h
new file mode 100644
index 0000000..7ec31f3
--- /dev/null
+++ b/public/dme_controls/AttributeWidgetFactory.h
@@ -0,0 +1,91 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef ATTRIBUTEWIDGETFACTORY_H
+#define ATTRIBUTEWIDGETFACTORY_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "tier0/platform.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmElement;
+class CMovieDoc;
+class IDmNotify;
+class CDmeEditorAttributeInfo;
+class CDmeEditorTypeDictionary;
+class CDmAttribute;
+
+namespace vgui
+{
+ class EditablePanel;
+ class Panel;
+}
+
+
+//-----------------------------------------------------------------------------
+// Info about the attribute being edited, and how the editor should look
+//-----------------------------------------------------------------------------
+struct AttributeWidgetInfo_t
+{
+ AttributeWidgetInfo_t()
+ {
+ m_nArrayIndex = -1;
+ }
+
+ CDmElement *m_pElement;
+ const char *m_pAttributeName;
+ int m_nArrayIndex;
+ CDmeEditorTypeDictionary *m_pEditorTypeDictionary;
+ CDmeEditorAttributeInfo *m_pEditorInfo;
+
+ IDmNotify *m_pNotify;
+ bool m_bAutoApply;
+ bool m_bShowMemoryUsage;
+};
+
+
+//-----------------------------------------------------------------------------
+// Interface used to create an attribute widget
+//-----------------------------------------------------------------------------
+class IAttributeWidgetFactory
+{
+public:
+ virtual vgui::Panel *Create( vgui::Panel *pParent, const AttributeWidgetInfo_t &info ) = 0;
+};
+
+
+//-----------------------------------------------------------------------------
+// Templatized class used to create widget factories
+//-----------------------------------------------------------------------------
+class IAttributeWidgetFactoryList
+{
+public:
+ // Returns a named widget factory
+ virtual IAttributeWidgetFactory *GetWidgetFactory( const char *pWidgetName ) = 0;
+
+ // Returns a factory used to create widget for the attribute passed in
+ virtual IAttributeWidgetFactory *GetWidgetFactory( CDmElement *object, CDmAttribute *pAttribute, CDmeEditorTypeDictionary *pTypeDictionary ) = 0;
+
+ // Returns a factory used to create widgets for entries in an attribute array
+ virtual IAttributeWidgetFactory *GetArrayWidgetFactory( CDmElement *object, CDmAttribute *pAttribute, CDmeEditorTypeDictionary *pTypeDictionary ) = 0;
+
+ // Applies changes to a widget
+ virtual void ApplyChanges( vgui::Panel *pWidget, vgui::Panel *pSender = NULL ) = 0;
+
+ // Refreshes a widget when attributes change
+ virtual void Refresh( vgui::Panel *pWidget, vgui::Panel *pSender = NULL ) = 0;
+};
+
+extern IAttributeWidgetFactoryList *attributewidgetfactorylist;
+
+
+#endif // ATTRIBUTEWIDGETFACTORY_H \ No newline at end of file
diff --git a/public/dme_controls/BaseAnimSetAttributeSliderPanel.h b/public/dme_controls/BaseAnimSetAttributeSliderPanel.h
new file mode 100644
index 0000000..bc02508
--- /dev/null
+++ b/public/dme_controls/BaseAnimSetAttributeSliderPanel.h
@@ -0,0 +1,186 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef BASEANIMSETATTRIBUTESLIDERPANEL_H
+#define BASEANIMSETATTRIBUTESLIDERPANEL_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "datamodel/dmehandle.h"
+#include "vgui_controls/EditablePanel.h"
+#include "dme_controls/AnimSetAttributeValue.h"
+#include "dme_controls/logpreview.h"
+#include "movieobjects/dmechannel.h"
+#include "dme_controls/BaseAnimSetPresetFaderPanel.h"
+
+using namespace vgui;
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CBaseAnimationSetEditor;
+class CDmeAnimationSet;
+class CAttributeSlider;
+class CDmElement;
+class CDmeChannel;
+class CDmeFilmClip;
+class CDmeTimeSelection;
+struct LogPreview_t;
+enum RecordingMode_t;
+class DmeLog_TimeSelection_t;
+class CPresetSideFilterSlider;
+struct FaderPreview_t;
+
+enum
+{
+ FADER_NAME_CHANGED = ( 1<<0 ),
+ FADER_DRAG_CHANGED = ( 1<<1 ),
+ FADER_CTRLKEY_CHANGED = ( 1<<2 ),
+ FADER_AMOUNT_CHANGED = ( 1<<3 ),
+ FADER_PRESET_CHANGED = ( 1<< 4 ),
+};
+
+//-----------------------------------------------------------------------------
+// CBaseAnimSetAttributeSliderPanel
+//-----------------------------------------------------------------------------
+class CBaseAnimSetAttributeSliderPanel : public vgui::EditablePanel
+{
+ DECLARE_CLASS_SIMPLE( CBaseAnimSetAttributeSliderPanel, vgui::EditablePanel );
+public:
+ CBaseAnimSetAttributeSliderPanel( vgui::Panel *parent, const char *className, CBaseAnimationSetEditor *editor );
+
+public:
+
+ void ChangeAnimationSet( CDmeAnimationSet *newAnimSet );
+ void SetVisibleControlsForSelectionGroup( CUtlSymbolTable& visible );
+ void ApplyPreset( float flScale, AttributeDict_t& values );
+ bool GetAttributeSliderValue( AttributeValue_t *pValue, const char *name );
+
+ void SetLogPreviewControlFromSlider( CAttributeSlider *pSlider );
+ CDmElement *GetElementFromSlider( CAttributeSlider *pSlider );
+ CDmElement *GetLogPreviewControl();
+ CBaseAnimationSetEditor* GetEditor();
+
+ void RecomputePreview();
+ virtual void PerformRecomputePreview();
+
+ virtual CDmeFilmClip *GetCurrentShot();
+ virtual CDmeFilmClip *GetCurrentMovie();
+
+ virtual void ApplySchemeSettings( vgui::IScheme *scheme );
+
+ CUtlVector< LogPreview_t > *GetActiveTransforms();
+
+ void GetChannelsForControl( CDmElement *control, CDmeChannel *channels[LOG_PREVIEW_MAX_CHANNEL_COUNT] );
+ void SetTimeSelectionParametersForRecordingChannels( float flIntensity );
+ void MoveToSlider( CAttributeSlider *pCurrentSlider, int nDirection );
+ void SetLogPreviewControl( CDmElement *ctrl );
+
+ void ClearSelectedControls();
+ void SetControlSelected( CAttributeSlider *slider, bool state );
+ void SetControlSelected( CDmElement *control, bool state );
+
+ virtual int BuildVisibleControlList( CUtlVector< LogPreview_t >& list );
+ virtual int BuildFullControlList( CUtlVector< LogPreview_t >& list );
+
+
+ virtual void StampValueIntoLogs( CDmElement *control, AnimationControlType_t type, float flValue );
+
+ struct VisItem_t
+ {
+ VisItem_t() :
+ element( NULL ), selected( false ), index( 0 )
+ {
+ }
+ CDmElement *element;
+ bool selected;
+ int index;
+ };
+
+ void GetVisibleControls( CUtlVector< VisItem_t >& list );
+
+ // Returns true if slider is visible
+ bool GetSliderValues( AttributeValue_t *pValue, int nIndex );
+
+ virtual void SetupForPreset( FaderPreview_t &fader, int nChangeFlags );
+
+ float GetBalanceSliderValue();
+
+protected:
+
+ virtual void OnThink();
+ virtual void OnCommand( const char *pCommand );
+ virtual bool ApplySliderValues( bool force );
+
+ virtual void PerformLayout();
+
+ KEYBINDING_FUNC( deselectall, KEY_ESCAPE, 0, OnKBDeselectAll, "#deselectall_help", 0 );
+
+protected:
+ struct ChannelToSliderLookup_t
+ {
+ ChannelToSliderLookup_t() : type( ANIM_CONTROL_VALUE ) {}
+
+ CDmeHandle< CDmeChannel > ch;
+ CDmeHandle< CDmElement > slider;
+ AnimationControlType_t type;
+
+ static bool Less( const ChannelToSliderLookup_t& lhs, const ChannelToSliderLookup_t& rhs );
+ };
+
+ void UpdatePreviewSliderTimes();
+ void ActivateControlSetInMode( int mode, int otherChannelsMode, int hiddenChannelsMode, CAttributeSlider *whichSlider = NULL );
+ void MaybeAddPreviewLog( CDmeFilmClip *shot, CUtlVector< LogPreview_t >& list, CDmElement *control, bool bDragging, bool isActiveLog, bool bSelected );
+
+
+ CAttributeSlider *FindSliderForControl( CDmElement *control );
+
+ virtual void GetActiveTimeSelectionParams( DmeLog_TimeSelection_t& params );
+
+ vgui::DHANDLE< CBaseAnimationSetEditor > m_hEditor;
+ // Visible slider list
+ vgui::DHANDLE< vgui::PanelListPanel > m_Sliders;
+ // All sliders
+ CUtlVector< CAttributeSlider * > m_SliderList;
+ vgui::Button *m_pLeftRightBoth[ 2 ];
+ CPresetSideFilterSlider *m_pPresetSideFilter;
+
+ CDmeHandle< CDmeAnimationSet > m_AnimSet;
+ CDmeHandle< CDmElement > m_PreviewControl;
+
+ CDmeHandle< CDmElement > m_CtrlKeyPreviewSliderElement;
+ vgui::DHANDLE< CAttributeSlider > m_CtrlKeyPreviewSlider;
+ float m_flEstimatedValue;
+
+ CUtlString m_PreviousPreviewFader;
+ FaderPreview_t m_Previous;
+
+ int m_nFaderChangeFlags;
+
+ bool m_bRequestedNewPreview : 1;
+ int m_nActiveControlSetMode;
+
+ CUtlRBTree< ChannelToSliderLookup_t, unsigned short > m_ChannelToSliderLookup;
+
+ // list of bones/root transforms which are in the control set
+ CUtlVector< LogPreview_t > m_ActiveTransforms;
+ float m_flRecomputePreviewTime;
+
+ CUtlVector< LogPreview_t > m_CurrentPreview;
+
+ float m_flPrevTime;
+
+};
+
+inline CBaseAnimationSetEditor* CBaseAnimSetAttributeSliderPanel::GetEditor()
+{
+ return m_hEditor;
+}
+
+
+#endif // BASEANIMSETATTRIBUTESLIDERPANEL_H
diff --git a/public/dme_controls/BaseAnimSetControlGroupPanel.h b/public/dme_controls/BaseAnimSetControlGroupPanel.h
new file mode 100644
index 0000000..8151165
--- /dev/null
+++ b/public/dme_controls/BaseAnimSetControlGroupPanel.h
@@ -0,0 +1,96 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef BASEANIMSETCONTROLGROUPPANEL_H
+#define BASEANIMSETCONTROLGROUPPANEL_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "vgui_controls/EditablePanel.h"
+#include "datamodel/dmehandle.h"
+#include "tier1/utlntree.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CBaseAnimationSetEditor;
+class CDmeAnimationSet;
+
+namespace vgui
+{
+ class TreeView;
+ class IScheme;
+ class Menu;
+};
+
+
+//-----------------------------------------------------------------------------
+// Panel which shows a tree of controls
+//-----------------------------------------------------------------------------
+class CBaseAnimSetControlGroupPanel : public vgui::EditablePanel
+{
+ DECLARE_CLASS_SIMPLE( CBaseAnimSetControlGroupPanel, EditablePanel );
+public:
+ CBaseAnimSetControlGroupPanel( vgui::Panel *parent, char const *className, CBaseAnimationSetEditor *editor );
+ virtual ~CBaseAnimSetControlGroupPanel();
+
+ void ChangeAnimationSet( CDmeAnimationSet *newAnimSet );
+ virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
+
+protected:
+
+ MESSAGE_FUNC_INT( OnTreeViewItemSelected, "TreeViewItemSelected", itemIndex );
+ MESSAGE_FUNC_INT( OnTreeViewItemDeselected, "TreeViewItemDeselected", itemIndex );
+ MESSAGE_FUNC( OnTreeViewItemSelectionCleared, "TreeViewItemSelectionCleared" );
+
+protected:
+ enum
+ {
+ EP_EXPANDED = (1<<0),
+ EP_SELECTED = (1<<1),
+ };
+
+ struct TreeItem_t
+ {
+ TreeItem_t() : m_pAttributeName() {}
+ CUtlString m_pAttributeName;
+ };
+
+ // Used to build a list of open element for refresh
+ struct TreeInfo_t
+ {
+ TreeInfo_t() : m_nFlags( 0 ) {}
+ TreeItem_t m_Item; // points to the element referenced in an element array
+ int m_nFlags;
+ };
+
+ typedef CUtlNTree< TreeInfo_t, int > OpenItemTree_t;
+ // Expands all items in the open item tree if they exist
+ void ExpandOpenItems( OpenItemTree_t &tree, int nOpenTreeIndex, int nItemIndex, bool makeVisible );
+ // Builds a list of open items
+ void BuildOpenItemList( OpenItemTree_t &tree, int nParent, int nItemIndex );
+ void FillInDataForItem( TreeItem_t &item, int nItemIndex );
+ // Finds the tree index of a child matching the particular element + attribute
+ int FindTreeItem( int nParentIndex, const TreeItem_t &info );
+
+ vgui::DHANDLE< CBaseAnimationSetEditor > m_hEditor;
+
+ vgui::DHANDLE< vgui::TreeView > m_hGroups;
+ CUtlVector< int > m_hSelectableIndices;
+
+ CDmeHandle< CDmeAnimationSet > m_AnimSet;
+
+ bool m_bStartItemWasSelected;
+ CUtlVector< int > m_SavedSelectedGroups;
+ CUtlSymbolTable m_SliderNames;
+ CUtlVector< CDmeHandle< CDmElement > > m_GroupList;
+
+ friend class CAnimGroupTree;
+};
+
+#endif // BASEANIMSETCONTROLGROUPPANEL_H
diff --git a/public/dme_controls/BaseAnimSetPresetFaderPanel.h b/public/dme_controls/BaseAnimSetPresetFaderPanel.h
new file mode 100644
index 0000000..ef42984
--- /dev/null
+++ b/public/dme_controls/BaseAnimSetPresetFaderPanel.h
@@ -0,0 +1,108 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef BASEANIMSETPRESETFADERPANEL_H
+#define BASEANIMSETPRESETFADERPANEL_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/AnimSetAttributeValue.h"
+#include "datamodel/dmehandle.h"
+#include "vgui_controls/EditablePanel.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CPresetSlider;
+class CBaseAnimationSetEditor;
+class CDmeAnimationSet;
+class CSliderListPanel;
+class CAddPresetDialog;
+class CDmePreset;
+class CDmePresetGroupEditorFrame;
+
+namespace vgui
+{
+ class InputDialog;
+}
+
+struct FaderPreview_t
+{
+ FaderPreview_t() :
+ name( 0 ),
+ amount( 0 ),
+ isbeingdragged( false ),
+ holdingctrl( false ),
+ values( 0 )
+ {
+ }
+ const char *name;
+ float amount;
+ bool isbeingdragged;
+ bool holdingctrl;
+ AttributeDict_t *values;
+ CDmeHandle< CDmePreset > preset;
+};
+
+
+//-----------------------------------------------------------------------------
+// Base class for the preset fader panel
+//-----------------------------------------------------------------------------
+class CBaseAnimSetPresetFaderPanel : public vgui::EditablePanel
+{
+ DECLARE_CLASS_SIMPLE( CBaseAnimSetPresetFaderPanel, vgui::EditablePanel );
+public:
+ CBaseAnimSetPresetFaderPanel( vgui::Panel *parent, const char *className, CBaseAnimationSetEditor *editor );
+
+ void GetPreviewFader( FaderPreview_t& fader );
+
+ void ChangeAnimationSet( CDmeAnimationSet *newAnimSet );
+ void UpdateControlValues();
+
+ void ApplyPreset( float flScale, AttributeDict_t& dict );
+
+ // Takes slider current values and creates a new preset
+ void AddNewPreset( const char *pGroupName, const char *pName );
+ void SetPresetFromSliders( CDmePreset *pPreset );
+ virtual void OnOverwritePreset( CDmePreset *pPreset );
+ void OnDeletePreset( CDmePreset *pPreset );
+
+ virtual void ApplySchemeSettings( vgui::IScheme *scheme );
+
+ virtual void ProceduralPreset_UpdateCrossfade( CDmePreset *pPreset, bool bFadeIn );
+
+protected:
+ MESSAGE_FUNC( OnTextChanged, "TextChanged" );
+ MESSAGE_FUNC( OnAddPreset, "AddPreset" );
+ MESSAGE_FUNC_PARAMS( OnAddNewPreset, "AddNewPreset", params );
+ MESSAGE_FUNC( OnPresetsChanged, "PresetsChanged" );
+ MESSAGE_FUNC( OnSetCrossfadeSpeed, "SetPresetCrossfadeSpeed" );
+ MESSAGE_FUNC( OnManagePresets, "ManagePresets" );
+ MESSAGE_FUNC_PARAMS( OnInputCompleted, "InputCompleted", params );
+ MESSAGE_FUNC_PARAMS( OnPresetNameSelected, "PresetNameSelected", params );
+
+protected:
+ void OnAddCompleted( const char *pText, KeyValues *pContextKeyValues );
+ void PopulateList( bool bChanged );
+ void AddNewPreset( CDmePreset *pPreset );
+
+ vgui::DHANDLE< CBaseAnimationSetEditor > m_hEditor;
+ vgui::EditablePanel *m_pWorkspace;
+ vgui::TextEntry *m_pFilter;
+ CSliderListPanel *m_pSliders;
+ CDmeHandle< CDmeAnimationSet > m_AnimSet;
+ float m_flLastFrameTime;
+ CUtlString m_Filter;
+ vgui::DHANDLE< vgui::InputDialog > m_hInputDialog;
+ vgui::DHANDLE< CAddPresetDialog > m_hAddPresetDialog;
+ vgui::DHANDLE< CDmePresetGroupEditorFrame > m_hPresetEditor;
+
+ CUtlVector< CDmeHandle< CDmePreset > > m_CurrentPresetList;
+};
+
+#endif // BASEANIMSETPRESETFADERPANEL_H
diff --git a/public/dme_controls/BaseAnimationSetEditor.h b/public/dme_controls/BaseAnimationSetEditor.h
new file mode 100644
index 0000000..9133c00
--- /dev/null
+++ b/public/dme_controls/BaseAnimationSetEditor.h
@@ -0,0 +1,151 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef BASEANIMATIONSETEDITOR_H
+#define BASEANIMATIONSETEDITOR_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "vgui_controls/EditablePanel.h"
+#include "vgui_controls/ImageList.h"
+#include "datamodel/dmehandle.h"
+#include "vgui/KeyCode.h"
+#include "dme_controls//AnimSetAttributeValue.h"
+#include "dme_controls/RecordingState.h"
+#include "tier1/utlvector.h"
+#include "movieobjects/dmelog.h"
+#include "vgui_controls/fileopenstatemachine.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+struct LogPreview_t;
+class CDmeAnimationSet;
+class CDmeAnimationList;
+class CDmeChannelsClip;
+class CDmeChannel;
+class CBaseAnimSetControlGroupPanel;
+class CBaseAnimSetPresetFaderPanel;
+class CBaseAnimSetAttributeSliderPanel;
+class CDmeGameModel;
+
+
+//-----------------------------------------------------------------------------
+// Base class for the panel for editing animation sets
+//-----------------------------------------------------------------------------
+class CBaseAnimationSetEditor : public vgui::EditablePanel, public vgui::IFileOpenStateMachineClient
+{
+ DECLARE_CLASS_SIMPLE( CBaseAnimationSetEditor, vgui::EditablePanel );
+
+public:
+ enum EAnimSetLayout_t
+ {
+ LAYOUT_SPLIT = 0,
+ LAYOUT_VERTICAL,
+ LAYOUT_HORIZONTAL,
+ };
+
+ CBaseAnimationSetEditor( vgui::Panel *parent, char const *panelName, bool bShowGroups );
+ virtual ~CBaseAnimationSetEditor();
+
+ virtual void CreateToolsSubPanels();
+ int BuildVisibleControlList( CUtlVector< LogPreview_t >& list );
+ int BuildFullControlList( CUtlVector< LogPreview_t >& list );
+ void RecomputePreview();
+ virtual void ChangeLayout( EAnimSetLayout_t newLayout );
+
+ CBaseAnimSetControlGroupPanel *GetControlGroup();
+ CBaseAnimSetPresetFaderPanel *GetPresetFader();
+ CBaseAnimSetAttributeSliderPanel *GetAttributeSlider();
+
+ void ChangeAnimationSet( CDmeAnimationSet *newAnimSet );
+ virtual void SetRecordingState( RecordingState_t state, bool updateSettings );
+ RecordingState_t GetRecordingState() const;
+ CDmeAnimationSet *GetAnimationSet();
+
+ // Inherited from IFileOpenStateMachineClient
+public:
+ virtual void SetupFileOpenDialog( vgui::FileOpenDialog *pDialog, bool bOpenFile, const char *pFileFormat, KeyValues *pContextKeyValues );
+ virtual bool OnReadFileFromDisk( const char *pFileName, const char *pFileFormat, KeyValues *pContextKeyValues );
+ virtual bool OnWriteFileToDisk( const char *pFileName, const char *pFileFormat, KeyValues *pContextKeyValues );
+
+protected:
+ virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
+ virtual void PerformLayout();
+ virtual void OnDataChanged();
+
+ MESSAGE_FUNC_PARAMS( OnOpenContextMenu, "OpenContextMenu", params );
+ MESSAGE_FUNC_INT( OnChangeLayout, "OnChangeLayout", value );
+ MESSAGE_FUNC( OnTextChanged, "TextChanged" );
+ MESSAGE_FUNC_PARAMS( OnButtonToggled, "ButtonToggled", params );
+ MESSAGE_FUNC_PARAMS( OnFileSelected, "FileSelected", params );
+ MESSAGE_FUNC_PARAMS( OnImportConfirmed, "ImportConfirmed", params );
+ MESSAGE_FUNC_PARAMS( OnImportAnimation, "ImportAnimation", params );
+ MESSAGE_FUNC( OnExportFacialAnimation, "ExportFacialAnimation" );
+ MESSAGE_FUNC_PARAMS( OnImportAnimationSelected, "DmeSelected", params );
+ MESSAGE_FUNC_PARAMS( OnImportAnimationCancelled, "DmeSelectionCancelled", params );
+
+ // Selects an animation to import
+ void SelectImportAnimation( CDmeAnimationList *pAnimationList, bool bVisibleOnly );
+
+ // Imports a specific channels clip into the animation set
+ void ImportAnimation( CDmeChannelsClip *pChannelsClip, bool bVisibleOnly );
+
+ // Finds a channel in the animation set to overwrite with import data
+ CDmeChannel* FindImportChannel( CDmeChannel *pChannel, CDmeChannelsClip *pChannelsClip );
+
+ // Transforms an imported channel, if necessary
+ void TransformImportedChannel( CDmeChannel *pChannel );
+
+ // Transforms an imported position log
+ void TransformImportedPositionLog( const matrix3x4_t& matrix, CDmeVector3Log *pPositionLog );
+
+ // Transforms an imported orientation log
+ void TransformImportedOrientationLog( const matrix3x4_t& matrix, CDmeQuaternionLog *pOrientationLog );
+
+ // Expands channels clip time to encompass log
+ void FixupChannelsClipTime( CDmeChannel *pChannel, CDmeLog *pLog );
+ void FixupChannelsClipTime( CDmeChannelsClip *pChannelsClip, CDmeLog *pLog );
+
+ // Adds a log layer to the list of logs for export
+ void AddLogLayerForExport( CDmElement *pRoot, const char *pControlName, CDmeChannel *pChannel, DmeTime_t tExportStart, DmeTime_t tExportEnd );
+
+ // Exports animations
+ void ExportAnimations( CDmElement *pAnimations, DmeTime_t tExportStart, DmeTime_t tExportEnd );
+
+ // Inherited classes need to implement this for export to work.
+ virtual CDmeFilmClip *GetAnimationSetClip() { return NULL; }
+ virtual CDmeFilmClip *GetRootClip() { return NULL; }
+
+protected:
+ EAnimSetLayout_t m_Layout;
+ vgui::DHANDLE< vgui::Splitter > m_Splitter;
+
+ vgui::DHANDLE< CBaseAnimSetControlGroupPanel > m_hControlGroup;
+ vgui::DHANDLE< CBaseAnimSetPresetFaderPanel > m_hPresetFader;
+ vgui::DHANDLE< CBaseAnimSetAttributeSliderPanel > m_hAttributeSlider;
+
+ vgui::DHANDLE< vgui::Menu > m_hContextMenu;
+
+ vgui::DHANDLE< vgui::FileOpenStateMachine > m_hFileOpenStateMachine;
+
+ vgui::ToggleButton *m_pState[ NUM_AS_RECORDING_STATES ];
+
+ vgui::ToggleButton *m_pSelectionModeType;
+
+ vgui::ImageList m_Images;
+
+ CDmeHandle< CDmeAnimationSet > m_AnimSet;
+
+ vgui::ComboBox *m_pComboBox;
+
+ RecordingState_t m_RecordingState;
+};
+
+
+#endif // BASEANIMATIONSETEDITOR_H
diff --git a/public/dme_controls/BaseAttributeChoicePanel.h b/public/dme_controls/BaseAttributeChoicePanel.h
new file mode 100644
index 0000000..89a25f0
--- /dev/null
+++ b/public/dme_controls/BaseAttributeChoicePanel.h
@@ -0,0 +1,65 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef BASEATTRIBUTECHOICEPANEL_h
+#define BASEATTRIBUTECHOICEPANEL_h
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/BaseAttributePanel.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmElement;
+struct AttributeWidgetInfo_t;
+
+namespace vgui
+{
+ class IScheme;
+ class Panel;
+ class Label;
+ class ComboBox;
+}
+
+
+//-----------------------------------------------------------------------------
+// CBaseAttributeChoicePanel
+//-----------------------------------------------------------------------------
+class CBaseAttributeChoicePanel : public CBaseAttributePanel
+{
+ DECLARE_CLASS_SIMPLE( CBaseAttributeChoicePanel, CBaseAttributePanel );
+
+public:
+ CBaseAttributeChoicePanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+
+ virtual void PostConstructor();
+ virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
+
+protected:
+ virtual void Refresh();
+
+private:
+ // Derived classes can re-implement this to fill the combo box however they like
+ virtual void PopulateComboBox( vgui::ComboBox *pComboBox ) = 0;
+ virtual void SetAttributeFromComboBox( vgui::ComboBox *pComboBox, KeyValues *pKeyValues ) = 0;
+ virtual void SetComboBoxFromAttribute( vgui::ComboBox *pComboBox ) = 0;
+
+ MESSAGE_FUNC_PTR( OnTextChanged, "TextChanged", panel );
+
+ virtual void Apply();
+ virtual vgui::Panel *GetDataPanel();
+
+ vgui::ComboBox *m_pData;
+};
+
+
+#endif // BASEATTRIBUTECHOICEPANEL_h
diff --git a/public/dme_controls/BaseAttributeDoubleChoicePanel.h b/public/dme_controls/BaseAttributeDoubleChoicePanel.h
new file mode 100644
index 0000000..28b1859
--- /dev/null
+++ b/public/dme_controls/BaseAttributeDoubleChoicePanel.h
@@ -0,0 +1,83 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef BASEATTRIBUTEDOUBLECHOICEPANEL_H
+#define BASEATTRIBUTEDOUBLECHOICEPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/BaseAttributePanel.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmElement;
+struct AttributeWidgetInfo_t;
+
+namespace vgui
+{
+ class IScheme;
+ class Panel;
+ class Label;
+ class ComboBox;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Helper to horizontally lay out the two child combo boxes used by
+// CBaseAttributeDoubleChoicePanel below
+//-----------------------------------------------------------------------------
+class CDoubleComboBoxContainerPanel : public vgui::Panel
+{
+ DECLARE_CLASS_SIMPLE( CDoubleComboBoxContainerPanel, vgui::Panel );
+public:
+ CDoubleComboBoxContainerPanel( vgui::Panel *parent, char const *name );
+ void AddComboBox( int slot, vgui::ComboBox *box );
+
+private:
+
+ virtual void PerformLayout();
+
+ vgui::ComboBox *m_pBoxes[ 2 ];
+};
+
+//-----------------------------------------------------------------------------
+// CBaseAttributeDoubleChoicePanel (similar to CBaseAttributeChoicePanel, but with side by side combo boxes)
+//-----------------------------------------------------------------------------
+class CBaseAttributeDoubleChoicePanel : public CBaseAttributePanel
+{
+ DECLARE_CLASS_SIMPLE( CBaseAttributeDoubleChoicePanel, CBaseAttributePanel );
+
+public:
+ CBaseAttributeDoubleChoicePanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+
+ virtual void PostConstructor();
+ virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
+
+protected:
+ virtual void Refresh();
+
+private:
+ // Derived classes can re-implement this to fill the combo box however they like
+ virtual void PopulateComboBoxes( vgui::ComboBox *pComboBox[2] ) = 0;
+ virtual void SetAttributeFromComboBoxes( vgui::ComboBox *pComboBox[2], KeyValues *pKeyValues[ 2 ] ) = 0;
+ virtual void SetComboBoxesFromAttribute( vgui::ComboBox *pComboBox[2] ) = 0;
+
+ MESSAGE_FUNC_PTR( OnTextChanged, "TextChanged", panel );
+
+ virtual void Apply();
+ virtual vgui::Panel *GetDataPanel();
+
+ CDoubleComboBoxContainerPanel *m_pContainerPanel;
+ vgui::ComboBox *m_pData[2];
+};
+
+
+#endif // BASEATTRIBUTEDOUBLECHOICEPANEL_H
diff --git a/public/dme_controls/BaseAttributePanel.h b/public/dme_controls/BaseAttributePanel.h
new file mode 100644
index 0000000..624ce2a
--- /dev/null
+++ b/public/dme_controls/BaseAttributePanel.h
@@ -0,0 +1,275 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: base class for all element attribute panels
+// An attribute panel is a one line widget that can be used by a list
+// or tree control.
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef BASEATTRIBUTEPANEL_H
+#define BASEATTRIBUTEPANEL_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "datamodel/dmattribute.h"
+#include "vgui_controls/Panel.h"
+#include "datamodel/dmehandle.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmElement;
+class IDmNotify;
+class IElementPropertiesChoices;
+struct AttributeWidgetInfo_t;
+class CDmeEditorAttributeInfo;
+class CDmeEditorTypeDictionary;
+
+namespace vgui
+{
+ class Label;
+}
+
+using namespace vgui;
+
+
+//-----------------------------------------------------------------------------
+// CBaseAttributePanel
+//-----------------------------------------------------------------------------
+class CBaseAttributePanel : public vgui::Panel
+{
+ DECLARE_CLASS_SIMPLE( CBaseAttributePanel, vgui::Panel );
+
+public:
+ CBaseAttributePanel( vgui::Panel *pParent, const AttributeWidgetInfo_t &info );
+
+ virtual void PostConstructor();
+ virtual void PerformLayout();
+ virtual void SetFont( HFont font );
+ virtual void ApplySchemeSettings( IScheme *pScheme );
+ virtual void OnCreateDragData( KeyValues *msg );
+
+ void SetDirty( bool dirty );
+ bool GetDirty() const;
+ bool IsAutoApply() const;
+
+ // Sets/gets the attribute value
+ template< class T >
+ void SetAttributeValue( const T& value );
+ void SetAttributeValue( const char *pValue );
+
+ template< class T >
+ const T& GetAttributeValue( );
+
+ // Helper to get/set the attribute value for elements
+ CDmElement *GetAttributeValueElement();
+ void SetAttributeValueElement( CDmElement *pElement );
+
+ void SetAttributeValueFromString( const char *pString );
+ const char *GetAttributeValueAsString( char *pBuf, int nLength );
+
+ // Returns the attribute type to edit
+ DmAttributeType_t GetAttributeType() const;
+
+ // Returns the editor info
+ CDmeEditorTypeDictionary *GetEditorTypeDictionary();
+ CDmeEditorAttributeInfo *GetEditorInfo();
+
+ // Call this when the data changed
+ IDmNotify *GetNotify();
+
+protected:
+ enum
+ {
+ HIDETYPE = 0x01,
+ HIDEVALUE = 0x02,
+ READONLY = 0x04,
+ DIRTY = 0x08,
+ AUTOAPPLY = 0x10,
+ };
+
+ // Inherited classes must implement this
+ virtual Panel *GetDataPanel() = 0;
+ virtual void Apply() = 0;
+ virtual void Refresh() = 0;
+
+ // Methods to get/set column size
+ int GetSizeForColumn( Panel *panel );
+ void SetColumnSize( Panel *panel, int width );
+
+ // Returns the element being edited by the panel
+ CDmElement *GetPanelElement();
+ const CDmElement *GetPanelElement() const;
+
+ // Returns the attribute name
+ const char* GetAttributeName() const;
+
+ // Does the element have the attribute we're attempting to reference?
+ bool HasAttribute() const;
+
+ // Returns the attribute array count
+ int GetAttributeArrayCount() const;
+
+ // Are we editing an entry in an attribute array?
+ bool IsArrayEntry() const;
+
+ // Is a particular flag set?
+ bool HasFlag( int flagMask ) const;
+
+private:
+ struct colinfo_t
+ {
+ Panel *panel;
+ int width;
+ };
+
+ // Set a flag
+ void SetFlag( int flagMask, bool bOn );
+
+ // Used to sort the column list
+ static bool ColInfoLessFunc( const colinfo_t& lhs, const colinfo_t& rhs );
+
+ // Initializes flags from the attribute editor info
+ void InitializeFlags( const AttributeWidgetInfo_t &info );
+
+ // Called when the OK / Apply button is pressed. Changed data should be written into document.
+ MESSAGE_FUNC( OnApplyChanges, "ApplyChanges" );
+ MESSAGE_FUNC( OnRefresh, "Refresh" );
+
+protected:
+ Label *m_pType;
+
+private:
+ CDmeHandle< CDmElement > m_hObject;
+ CDmeHandle< CDmeEditorAttributeInfo > m_hEditorInfo;
+ CDmeHandle< CDmeEditorTypeDictionary > m_hEditorTypeDict;
+
+ char m_szAttributeName[ 256 ];
+ int m_nArrayIndex;
+ DmAttributeType_t m_AttributeType;
+ IDmNotify *m_pNotify;
+ int m_nFlags;
+ CUtlRBTree< colinfo_t, int > m_ColumnSize;
+ HFont m_hFont;
+};
+
+
+//-----------------------------------------------------------------------------
+// Inline methods
+//-----------------------------------------------------------------------------
+inline bool CBaseAttributePanel::HasFlag( int flagMask ) const
+{
+ return ( m_nFlags & flagMask ) ? true : false;
+}
+
+inline void CBaseAttributePanel::SetFlag( int flagMask, bool bOn )
+{
+ if ( bOn )
+ {
+ m_nFlags |= flagMask;
+ }
+ else
+ {
+ m_nFlags &= ~flagMask;
+ }
+}
+
+inline bool CBaseAttributePanel::GetDirty() const
+{
+ return HasFlag( DIRTY );
+}
+
+inline bool CBaseAttributePanel::IsAutoApply() const
+{
+ return HasFlag( AUTOAPPLY );
+}
+
+inline DmAttributeType_t CBaseAttributePanel::GetAttributeType() const
+{
+ return m_AttributeType;
+}
+
+inline IDmNotify *CBaseAttributePanel::GetNotify()
+{
+ return m_pNotify;
+}
+
+inline const char* CBaseAttributePanel::GetAttributeName() const
+{
+ return m_szAttributeName;
+}
+
+inline bool CBaseAttributePanel::IsArrayEntry() const
+{
+ return ( m_nArrayIndex >= 0 );
+}
+
+
+template< class T > inline const T& GetArrayAttributeValue( CDmElement *pElement, const char *pAttribute, int nArrayIndex )
+{
+ const CDmrArray<T> array( pElement, pAttribute );
+ return array[ nArrayIndex ];
+}
+
+template<> inline const DmElementHandle_t& GetArrayAttributeValue<DmElementHandle_t>( CDmElement *pElement, const char *pAttribute, int nArrayIndex )
+{
+ const CDmrElementArray<> array( pElement, pAttribute );
+ return array.GetHandle( nArrayIndex );
+}
+
+
+template< class T > inline void SetArrayAttributeValue( CDmElement *pElement, const char *pAttribute, int nArrayIndex, const T& value )
+{
+ CDmrArray<T> array( pElement, pAttribute );
+ array.Set( nArrayIndex, value );
+}
+
+template<> inline void SetArrayAttributeValue<DmElementHandle_t>( CDmElement *pElement, const char *pAttribute, int nArrayIndex, const DmElementHandle_t& value )
+{
+ CDmrElementArray<> array( pElement, pAttribute );
+ array.SetHandle( nArrayIndex, value );
+}
+
+
+//-----------------------------------------------------------------------------
+// Sets/gets the attribute value
+//-----------------------------------------------------------------------------
+template< class T >
+void CBaseAttributePanel::SetAttributeValue( const T& value )
+{
+ if ( !IsArrayEntry() )
+ {
+ GetPanelElement()->SetValue( m_szAttributeName, value );
+ }
+ else
+ {
+ SetArrayAttributeValue<T>( GetPanelElement(), m_szAttributeName, m_nArrayIndex, value );
+ }
+}
+
+inline void CBaseAttributePanel::SetAttributeValue( const char *pValue )
+{
+ if ( !IsArrayEntry() )
+ {
+ GetPanelElement()->SetValue( m_szAttributeName, pValue );
+ }
+ else
+ {
+ SetArrayAttributeValue<CUtlString>( GetPanelElement(), m_szAttributeName, m_nArrayIndex, pValue );
+ }
+}
+
+template< class T >
+const T& CBaseAttributePanel::GetAttributeValue( )
+{
+ if ( !IsArrayEntry() )
+ return GetPanelElement()->GetValue<T>( m_szAttributeName );
+ return GetArrayAttributeValue<T>( GetPanelElement(), m_szAttributeName, m_nArrayIndex );
+}
+
+
+#endif // BASEATTRIBUTEPANEL_H
diff --git a/public/dme_controls/ChannelGraphPanel.h b/public/dme_controls/ChannelGraphPanel.h
new file mode 100644
index 0000000..3413ede
--- /dev/null
+++ b/public/dme_controls/ChannelGraphPanel.h
@@ -0,0 +1,89 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================//
+
+#ifndef CHANNELGRAPHPANEL_H
+#define CHANNELGRAPHPANEL_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include <vgui_controls/Panel.h>
+#include <vgui_controls/Frame.h>
+#include "utllinkedlist.h"
+#include "utlvector.h"
+#include "movieobjects/dmechannel.h"
+#include "datamodel/dmehandle.h"
+
+namespace vgui
+{
+
+typedef DmeTime_t (*TimeAccessor_t)();
+
+//-----------------------------------------------------------------------------
+// Purpose: Holds and displays a chart of dmechannel data
+//-----------------------------------------------------------------------------
+class CChannelGraphPanel : public Panel
+{
+ DECLARE_CLASS_SIMPLE( CChannelGraphPanel, Panel );
+
+public:
+ CChannelGraphPanel( Panel *parent, const char *name );
+
+ void SetChannel( CDmeChannel *pChannel );
+
+ // input messages
+ virtual void OnCursorMoved( int mx, int my );
+ virtual void OnMousePressed( MouseCode code );
+ virtual void OnMouseReleased( MouseCode code );
+ virtual void OnMouseWheeled( int delta );
+ virtual void OnSizeChanged( int newWide, int newTall ); // called after the size of a panel has been changed
+
+protected:
+ virtual void Paint();
+ virtual void PerformLayout();
+ virtual void ApplySchemeSettings( IScheme *pScheme );
+
+ int TimeToPixel( DmeTime_t time );
+ int ValueToPixel( float flValue );
+
+private:
+ CDmeHandle< CDmeChannel > m_hChannel;
+ HFont m_font;
+ TimeAccessor_t m_timeFunc;
+ DmeTime_t m_graphMinTime, m_graphMaxTime;
+ float m_graphMinValue, m_graphMaxValue;
+ int m_nMouseStartX, m_nMouseStartY;
+ int m_nMouseLastX, m_nMouseLastY;
+ int m_nTextBorder;
+ int m_nGraphOriginX;
+ int m_nGraphOriginY;
+ float m_flTimeToPixel;
+ float m_flValueToPixel;
+};
+
+
+//-----------------------------------------------------------------------------
+// CChannelGraphFrame
+//-----------------------------------------------------------------------------
+class CChannelGraphFrame : public Frame
+{
+ DECLARE_CLASS_SIMPLE( CChannelGraphFrame, Frame );
+
+public:
+ CChannelGraphFrame( Panel *parent, const char *pTitle );
+
+ void SetChannel( CDmeChannel *pChannel );
+
+ virtual void OnCommand( const char *cmd );
+ virtual void PerformLayout();
+
+protected:
+ CChannelGraphPanel *m_pChannelGraph;
+};
+
+} // namespace vgui
+
+#endif // CHANNELGRAPHPANEL_H
diff --git a/public/dme_controls/DmeSourceDCCFilePanel.h b/public/dme_controls/DmeSourceDCCFilePanel.h
new file mode 100644
index 0000000..fbc0df1
--- /dev/null
+++ b/public/dme_controls/DmeSourceDCCFilePanel.h
@@ -0,0 +1,93 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef DMESOURCEDCCFILEPANEL_H
+#define DMESOURCEDCCFILEPANEL_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "vgui_controls/EditablePanel.h"
+#include "datamodel/dmehandle.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+namespace vgui
+{
+ class TextEntry;
+}
+
+class CDmeSourceDCCFile;
+
+
+//-----------------------------------------------------------------------------
+// Purpose: Asset builder
+//-----------------------------------------------------------------------------
+class CDmeSourceDCCFilePanel : public vgui::EditablePanel
+{
+ DECLARE_CLASS_SIMPLE( CDmeSourceDCCFilePanel, EditablePanel );
+
+public:
+ CDmeSourceDCCFilePanel( vgui::Panel *pParent, const char *pPanelName );
+ virtual ~CDmeSourceDCCFilePanel();
+
+ // Inherited from Panel
+ virtual void OnCommand( const char *pCommand );
+ virtual void OnKeyCodeTyped( vgui::KeyCode code );
+
+ void SetDmeElement( CDmeSourceDCCFile *pSourceDCCFile );
+
+ /*
+ messages sent:
+ "DmeElementChanged" The element has been changed
+ */
+
+private:
+ MESSAGE_FUNC_PARAMS( OnTextNewLine, "TextNewLine", kv );
+ MESSAGE_FUNC_PARAMS( OnInputCompleted, "InputCompleted", kv );
+ MESSAGE_FUNC_PARAMS( OnItemSelected, "ItemSelected", kv );
+ MESSAGE_FUNC_PARAMS( OnItemDeselected, "ItemDeselected", kv );
+
+ // Shows the DCC object browser (once we have one)
+ void ShowDCCObjectBrowser( const char *pTitle, const char *pPrompt, KeyValues *pDialogKeys );
+
+ // Called when we're browsing for a DCC object and one was selected
+ void OnDCCObjectAdded( const char *pDCCObjectName, KeyValues *pContextKeys );
+
+ // Refresh the source list
+ void RefreshDCCObjectList( );
+
+ // Called when the source file name changes
+ bool CheckForDuplicateNames( const char *pDCCObjectName, int nDCCObjectSkipIndex = -1 );
+
+ void OnBrowseDCCObject();
+ void OnAddDCCObject();
+ void OnRemoveDCCObject();
+ void OnDCCObjectNameChanged();
+
+ // Selects a particular DCC object
+ void SelectDCCObject( int nDCCObjectIndex );
+
+ // Called when a list panel's selection changes
+ void OnItemSelectionChanged( );
+
+ // Marks the file as dirty
+ void SetDirty( );
+
+ vgui::ListPanel *m_pRootDCCObjects;
+ vgui::Button *m_pDCCObjectBrowser;
+ vgui::Button *m_pAddDCCObject;
+ vgui::Button *m_pRemoveDCCObject;
+ vgui::Button *m_pApplyChanges;
+ vgui::TextEntry *m_pDCCObjectName;
+
+ CDmeHandle< CDmeSourceDCCFile > m_hSourceDCCFile;
+};
+
+
+#endif // DMESOURCEDCCFILEPANEL_H
diff --git a/public/dme_controls/DmeSourceSkinPanel.h b/public/dme_controls/DmeSourceSkinPanel.h
new file mode 100644
index 0000000..aee46a9
--- /dev/null
+++ b/public/dme_controls/DmeSourceSkinPanel.h
@@ -0,0 +1,62 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef DMESOURCESKINPANEL_H
+#define DMESOURCESKINPANEL_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "vgui_controls/EditablePanel.h"
+#include "datamodel/dmehandle.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+namespace vgui
+{
+ class TextEntry;
+ class CheckButton;
+}
+
+class CDmeSourceSkin;
+
+
+//-----------------------------------------------------------------------------
+// Purpose: Asset builder
+//-----------------------------------------------------------------------------
+class CDmeSourceSkinPanel : public vgui::EditablePanel
+{
+ DECLARE_CLASS_SIMPLE( CDmeSourceSkinPanel, EditablePanel );
+
+public:
+ CDmeSourceSkinPanel( vgui::Panel *pParent, const char *pPanelName );
+ virtual ~CDmeSourceSkinPanel();
+
+ void SetDmeElement( CDmeSourceSkin *pSourceSkin );
+
+ /*
+ messages sent:
+ "DmeElementChanged" The element has been changed
+ */
+
+private:
+ MESSAGE_FUNC_PARAMS( OnTextChanged, "TextChanged", kv );
+ MESSAGE_FUNC_INT( OnCheckButtonChecked, "CheckButtonChecked", state );
+
+ // Marks the file as dirty
+ void SetDirty( );
+
+ vgui::TextEntry *m_pSkinName;
+ vgui::TextEntry *m_pScale;
+ vgui::CheckButton *m_pFlipTriangles;
+
+ CDmeHandle< CDmeSourceSkin > m_hSourceSkin;
+};
+
+
+#endif // DMESOURCESKINPANEL_H
diff --git a/public/dme_controls/ElementPropertiesTree.h b/public/dme_controls/ElementPropertiesTree.h
new file mode 100644
index 0000000..aa4e57a
--- /dev/null
+++ b/public/dme_controls/ElementPropertiesTree.h
@@ -0,0 +1,471 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================
+
+#ifndef ELEMENTPROPERTIESTREE_H
+#define ELEMENTPROPERTIESTREE_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "vgui_controls/Frame.h"
+#include "dme_controls/AttributeWidgetFactory.h"
+#include "vgui_controls/TreeView.h"
+#include "vgui_controls/TreeViewListControl.h"
+#include "datamodel/dmelement.h"
+#include "datamodel/dmattribute.h"
+#include "datamodel/dmattributevar.h"
+#include "datamodel/dmehandle.h"
+#include "tier1/utlntree.h"
+#include "tier1/utlstring.h"
+#include "tier1/utlvector.h"
+#include "vgui_controls/InputDialog.h"
+#include "vgui/KeyCode.h"
+#include "dme_controls/inotifyui.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmElement;
+class IDmNotify;
+class CDocAllElements;
+class IAttributeWidgetFactory;
+class CDmeEditorTypeDictionary;
+class CPropertiesTreeToolbar;
+
+namespace vgui
+{
+ class TextEntry;
+ class ComboBox;
+ class Button;
+ class PanelListPanel;
+ class Menu;
+}
+
+//-----------------------------------------------------------------------------
+// CElementTreeViewListControl
+//-----------------------------------------------------------------------------
+class CElementTreeViewListControl : public vgui::CTreeViewListControl
+{
+ DECLARE_CLASS_SIMPLE( CElementTreeViewListControl, CTreeViewListControl );
+
+public:
+ CElementTreeViewListControl( Panel *pParent, const char *pName );
+
+ virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
+ virtual int AddItem( KeyValues *data, bool allowLabelEditing, int parentItemIndex, CUtlVector< vgui::Panel * >& columnPanels );
+ virtual void RemoveItem( int nItemIndex );
+ virtual void PerformLayout();
+ virtual void RemoveAll();
+ virtual vgui::HFont GetFont( int size );
+ virtual void SetFont( vgui::HFont font );
+ virtual int GetFontSize();
+ virtual void SetFontSize( int size );
+ virtual void PostChildPaint();
+ virtual void ExpandItem( int itemIndex, bool bExpand );
+ virtual bool IsItemExpanded( int itemIndex );
+ virtual bool IsItemSelected( int itemIndex );
+ virtual KeyValues *GetItemData( int itemIndex );
+ virtual int GetTreeColumnWidth();
+ virtual void SetTreeColumnWidth( int w );
+ virtual void OnCursorMoved( int x, int y );
+ virtual void OnMousePressed( vgui::MouseCode code );
+ virtual void OnMouseReleased( vgui::MouseCode code );
+ virtual void OnMouseDoublePressed( vgui::MouseCode code );
+ virtual void OnMouseWheeled( int delta );
+ virtual int GetScrollBarSize();
+ virtual void ToggleDrawGrid();
+ virtual bool IsDrawingGrid();
+
+ void ResizeTreeToExpandedWidth();
+
+private:
+ struct ColumnPanels_t
+ {
+ ColumnPanels_t() :
+ treeViewItem( -1 )
+ {
+ }
+
+ ColumnPanels_t( const ColumnPanels_t& src )
+ {
+ treeViewItem = src.treeViewItem;
+ int i, c;
+ c = src.m_Columns.Count();
+ for ( i = 0; i < c; ++i )
+ {
+ m_Columns.AddToTail( src.m_Columns[ i ] );
+ }
+ }
+
+ void SetList( CUtlVector< vgui::Panel * >& list )
+ {
+ m_Columns.RemoveAll();
+ int c = list.Count();
+ for ( int i = 0; i < c; ++i )
+ {
+ m_Columns.AddToTail( list[ i ] );
+ }
+ }
+
+ int treeViewItem;
+ CUtlVector< vgui::Panel * > m_Columns;
+ };
+
+ // Removes an item from the tree recursively
+ void RemoveItem_R( int nItemIndex );
+
+ void HideAll();
+
+ static bool PanelsLessFunc( const ColumnPanels_t& lhs, const ColumnPanels_t& rhs )
+ {
+ return lhs.treeViewItem < rhs.treeViewItem;
+ }
+
+ int m_iTreeColumnWidth;
+ int m_iFontSize; // 1 = verySmall, small, normal, large, verylarge
+ bool m_bMouseLeftIsDown;
+ bool m_bMouseIsDragging;
+ bool m_bDrawGrid;
+ CUtlRBTree< ColumnPanels_t, int > m_Panels;
+};
+
+//-----------------------------------------------------------------------------
+// CElementPropertiesTreeInternal
+//-----------------------------------------------------------------------------
+class CElementPropertiesTreeInternal : public vgui::EditablePanel
+{
+ DECLARE_CLASS_SIMPLE( CElementPropertiesTreeInternal, vgui::EditablePanel );
+
+public:
+ enum RefreshType_t
+ {
+ REFRESH_REBUILD = 0, // Close the entire tree
+ REFRESH_VALUES_ONLY, // Tree topology hasn't changed; only update values
+ REFRESH_TREE_VIEW, // Tree topology changed; some attributes may be added or removed
+ };
+
+ CElementPropertiesTreeInternal( vgui::Panel *parent, IDmNotify *pNotify,
+ CDmElement *pObject, bool autoApply = true, CDmeEditorTypeDictionary *pDict = NULL );
+ ~CElementPropertiesTreeInternal();
+
+ virtual void Init( );
+ virtual void Refresh( RefreshType_t rebuild = REFRESH_TREE_VIEW, bool preservePrevSelectedItem = false );
+ virtual void ApplyChanges();
+ virtual void GenerateChildrenOfNode( int itemIndex );
+ virtual void GenerateContextMenu( int itemIndex, int x, int y );
+ virtual void GenerateDragDataForItem( int itemIndex, KeyValues *msg );
+ virtual void OnLabelChanged( int itemIndex, char const *oldString, char const *newString );
+ virtual bool IsItemDroppable( int itemIndex, CUtlVector< KeyValues * >& msglist );
+ virtual void OnItemDropped( int itemIndex, CUtlVector< KeyValues * >& msglist );
+ virtual bool GetItemDropContextMenu( int itemIndex, vgui::Menu *menu, CUtlVector< KeyValues * >& msglist );
+ virtual vgui::HCursor GetItemDropCursor( int itemIndex, CUtlVector< KeyValues * >& msglist );
+ virtual void SetObject( CDmElement *object );
+ virtual void OnCommand( const char *cmd );
+
+ MESSAGE_FUNC( OnShowMemoryUsage, "OnShowMemoryUsage" );
+
+ CDmElement *GetObject();
+ bool IsLabelBeingEdited() const;
+ bool HasItemsSelected() const;
+
+ enum
+ {
+ DME_PROPERTIESTREE_MENU_BACKWARD = 0,
+ DME_PROPERTIESTREE_MENU_FORWARD,
+ DME_PROPERTIESTREE_MENU_SEARCHHSITORY,
+ };
+
+ virtual void PopulateHistoryMenu( int whichMenu, vgui::Menu *menu );
+ virtual int GetHistoryMenuItemCount( int whichMenu );
+ void AddToSearchHistory( char const *str );
+ void SetTypeDictionary( CDmeEditorTypeDictionary *pDict );
+
+ MESSAGE_FUNC_CHARPTR( OnNavSearch, "OnNavigateSearch", text );
+
+protected:
+ KeyValues *GetTreeItemData( int itemIndex );
+
+protected:
+
+ struct AttributeWidgets_t
+ {
+ vgui::Panel *m_pValueWidget;
+
+ bool operator==( const AttributeWidgets_t &src ) const
+ {
+ return m_pValueWidget == src.m_pValueWidget;
+ }
+ };
+
+ enum
+ {
+ EP_EXPANDED = (1<<0),
+ EP_SELECTED = (1<<1),
+ };
+
+ struct TreeItem_t
+ {
+ TreeItem_t() :
+ m_pElement( 0 ),
+ m_pAttributeName(),
+ m_pArrayElement( 0 )
+ {
+ }
+ CDmElement *m_pElement;
+ CUtlString m_pAttributeName;
+ CDmElement *m_pArrayElement; // points to the element referenced in an element array
+ };
+
+ // Used to build a list of open element for refresh
+ struct TreeInfo_t
+ {
+ TreeInfo_t() :
+ m_nFlags( 0 )
+ {
+ }
+
+ TreeItem_t m_Item; // points to the element referenced in an element array
+
+ int m_nFlags;
+ TreeItem_t m_Preserved;
+ };
+
+ typedef CUtlNTree< TreeInfo_t, int > OpenItemTree_t;
+
+ struct SearchResult_t
+ {
+ CDmeHandle< CDmElement > handle;
+ CUtlString attributeName;
+
+ bool operator == ( const SearchResult_t &other ) const
+ {
+ if ( &other == this )
+ return true;
+
+ if ( other.handle != handle )
+ return false;
+ if ( other.attributeName != attributeName )
+ return false;
+
+ return true;
+ }
+ };
+
+ bool BuildExpansionListToFindElement_R( CUtlRBTree< CDmElement *, int >& visited, int depth, SearchResult_t& sr, CDmElement *owner, CDmElement *element, char const *attributeName, int arrayIndex, CUtlVector< int >& expandIndices );
+ void FindMatchingElements_R( CUtlRBTree< CDmElement *, int >& visited, char const *searchstr, CDmElement *root, CUtlVector< SearchResult_t >& list );
+ void NavigateToSearchResult();
+
+ void SpewOpenItems( int depth, OpenItemTree_t &tree, int nOpenTreeIndex, int nItemIndex );
+
+ // Finds the tree index of a child matching the particular element + attribute
+ int FindTreeItem( int nParentIndex, const TreeItem_t &info );
+
+ // Expands all items in the open item tree if they exist
+ void ExpandOpenItems( OpenItemTree_t &tree, int nOpenTreeIndex, int nItemIndex, bool makeVisible );
+
+ // Builds a list of open items
+ void BuildOpenItemList( OpenItemTree_t &tree, int nParent, int nItemIndex, bool preservePrevSelectedItem );
+
+ void FillInDataForItem( TreeItem_t &item, int nItemIndex );
+
+ // Removes an item from the tree
+ void RemoveItem( int nItemIndex );
+
+ // Removes an item recursively
+ void RemoveItem_R( int nItemIndex );
+
+ // Adds a single entry into the tree
+ void CreateTreeEntry( int parentNodeIndex, CDmElement* obj, CDmAttribute *pAttribute, int nArrayIndex, AttributeWidgets_t &entry );
+
+ // Sets up the attribute widget init info for a particular attribute
+ void SetupWidgetInfo( AttributeWidgetInfo_t *pInfo, CDmElement *obj, CDmAttribute *pAttribute, int nArrayIndex = -1 );
+
+ // Creates an attribute data widget using a specifically requested widget
+ vgui::Panel *CreateAttributeDataWidget( CDmElement *pElement, const char *pWidgetName, CDmElement *obj, CDmAttribute *pAttribute, int nArrayIndex = -1 );
+
+ void UpdateTree();
+ void InsertAttributes( int parentNodeIndex, CDmElement *obj );
+ void InsertAttributeArrayMembers( int parentNodeIndex, CDmElement *obj, CDmAttribute *array );
+
+ // Adds a single editable attribute of the element to the tree
+ void InsertSingleAttribute( int parentNodeIndex, CDmElement *obj, CDmAttribute *pAttribute, int nArrayIndex = -1 );
+
+ // Refreshes the tree view
+ void RefreshTreeView( bool preservePrevSelectedItem = false );
+
+ // Gets tree view text
+ void GetTreeViewText( CDmElement* obj, CDmAttribute *pAttribute, int nArrayIndex, char *pBuffer, int nMaxLen, bool& editableText );
+
+ void RemoveSelected( bool selectLeft );
+
+ void AddToHistory( CDmElement *element );
+
+ void ValidateHistory();
+ void SpewHistory();
+ void JumpToHistoryItem();
+
+ void UpdateButtonState();
+
+ KEYBINDING_FUNC( ondelete, KEY_DELETE, 0, OnKeyDelete, "#elementpropertiestree_ondelete_help", 0 );
+ KEYBINDING_FUNC( onbackspace, KEY_BACKSPACE, 0, OnKeyBackspace, "#elementpropertiestree_ondelete_help", 0 );
+ KEYBINDING_FUNC( onrefresh, KEY_F5, 0, OnRefresh, "#elementpropertiestree_onrefresh_help", 0 );
+
+ MESSAGE_FUNC( OnRename, "OnRename" );
+ MESSAGE_FUNC( OnRemove, "OnRemove" );
+ MESSAGE_FUNC( OnClear, "OnClear" );
+ MESSAGE_FUNC( OnSortByName, "OnSortByName" );
+
+ MESSAGE_FUNC( OnCut, "OnCut" );
+ MESSAGE_FUNC( OnCopy, "OnCopy" );
+ MESSAGE_FUNC( OnPaste, "OnPaste" );
+ MESSAGE_FUNC( OnPasteReference, "OnPasteReference" );
+ MESSAGE_FUNC( OnPasteInsert, "OnPasteInsert" );
+ MESSAGE_FUNC( OnDeleteSelected, "OnDelete" );
+
+ MESSAGE_FUNC_INT( OnElementChangedExternally, "ElementChangedExternally", valuesOnly );
+ MESSAGE_FUNC_INT( OnNavBack, "OnNavigateBack", item );
+ MESSAGE_FUNC_INT( OnNavForward, "OnNavigateForward", item );
+ MESSAGE_FUNC_INT( OnNavigateSearchAgain, "OnNavigateSearchAgain", direction );
+ MESSAGE_FUNC( OnShowSearchResults, "OnShowSearchResults" );
+
+protected:
+
+ MESSAGE_FUNC_PARAMS( OnInputCompleted, "InputCompleted", params );
+ MESSAGE_FUNC( OnAddItem, "OnAddItem" );
+
+ MESSAGE_FUNC_PARAMS( OnSetShared, "OnSetShared", pParams );
+
+ MESSAGE_FUNC_PARAMS( OnChangeFile, "OnChangeFile", pParams );
+
+ MESSAGE_FUNC_PARAMS( OnShowFileDialog, "OnShowFileDialog", pParams );
+ MESSAGE_FUNC_PARAMS( OnFileSelected, "FileSelected", params );
+
+ enum DropOperation_t
+ {
+ DO_MOVE,
+ DO_LINK,
+ DO_COPY,
+ DO_UNKNOWN,
+ };
+
+ DropOperation_t GetDropOperation( int itemIndex, CUtlVector< KeyValues * >& msglist );
+
+ void DropItemsIntoArray( CDmrElementArray<> &array,
+ CUtlVector< KeyValues* > &msglist,
+ CUtlVector< CDmElement* > &list,
+ int nArrayIndex, DropOperation_t op );
+
+ bool OnRemoveFromData( CUtlVector< KeyValues * >& list );
+ bool OnRemoveFromData( KeyValues *item );
+ void OnPaste_( bool reference );
+ bool ShowAddAttributeDialog( CDmElement *pElement, const char *pAttributeType );
+ void AddAttribute( const char *pAttributeName, KeyValues *pContext );
+ bool ShowSetElementAttributeDialog( CDmElement *pOwner, const char *pAttributeName, int nArrayItem, const char *pElementType );
+ void SetElementAttribute( const char *pElementName, KeyValues *pContext );
+ void OnImportElement( const char *pFullPath, KeyValues *pContext );
+ void OnExportElement( const char *pFullPath, KeyValues *pContext );
+
+ void GetPathToItem( CUtlVector< TreeItem_t > &path, int itemIndex );
+ int OpenPath( const CUtlVector< TreeItem_t > &path );
+
+ // Refreshes the color state of the tree
+ void RefreshTreeItemState( int nItemID );
+
+ // Refreshes the color state of the tree
+ void SetTreeItemColor( int nItemID, CDmElement *pEntryElement, bool bIsElementArrayItem, bool bEditableLabel );
+
+ CDmeHandle< CDmeEditorTypeDictionary > m_hTypeDictionary;
+ CUtlVector< AttributeWidgets_t > m_AttributeWidgets;
+ IDmNotify *m_pNotify;
+ CDmeHandle< CDmElement > m_hObject;
+ CElementTreeViewListControl *m_pTree;
+ bool m_bAutoApply;
+ bool m_bShowMemoryUsage;
+ vgui::DHANDLE< vgui::Menu > m_hContextMenu;
+
+ CPropertiesTreeToolbar *m_pToolBar; // Forward/backward navigation and search fields
+
+ enum
+ {
+ DME_PROPERTIESTREE_MAXHISTORYITEMS = 32,
+ DME_PROPERTIESTREE_MAXSEARCHHISTORYITEMS = 32,
+ };
+
+ // Most recent are at the head
+ CUtlVector< CDmeHandle< CDmElement > > m_hHistory;
+ int m_nCurrentHistoryPosition;
+ bool m_bSuppressHistoryUpdates;
+ char m_szSearchStr[ 128 ];
+
+ CUtlVector< SearchResult_t > m_SearchResults;
+ int m_nCurrentSearchResult;
+
+ CUtlVector< CUtlString > m_SearchHistory;
+
+ CDmeHandle< CDmElement > m_SearchResultsRoot;
+
+ vgui::HCursor m_hDragCopyCursor;
+ vgui::HCursor m_hDragLinkCursor;
+ vgui::HCursor m_hDragMoveCursor;
+};
+
+
+//-----------------------------------------------------------------------------
+// CElementPropertiesTree
+//-----------------------------------------------------------------------------
+class CElementPropertiesTree : public vgui::Frame
+{
+ DECLARE_CLASS_SIMPLE( CElementPropertiesTree, vgui::Frame );
+public:
+
+ CElementPropertiesTree( vgui::Panel *parent, IDmNotify *pNotify, CDmElement *pObject, CDmeEditorTypeDictionary *pDict = NULL );
+
+ virtual void Init( );
+ virtual void Refresh( CElementPropertiesTreeInternal::RefreshType_t rebuild = CElementPropertiesTreeInternal::REFRESH_REBUILD, bool preservePrevSelectedItem = false );
+ virtual void GenerateChildrenOfNode( int itemIndex );
+ virtual void SetObject( CDmElement *object );
+ virtual void OnCommand( const char *cmd );
+ virtual void ActivateBuildMode();
+
+ CElementPropertiesTreeInternal *GetInternal();
+
+protected:
+ CElementPropertiesTreeInternal *m_pProperties;
+ vgui::Button *m_pOK;
+ vgui::Button *m_pApply;
+ vgui::Button *m_pCancel;
+};
+
+
+//-----------------------------------------------------------------------------
+// Inline methods
+//-----------------------------------------------------------------------------
+inline CElementPropertiesTreeInternal *CElementPropertiesTree::GetInternal()
+{
+ return m_pProperties;
+}
+
+
+//-----------------------------------------------------------------------------
+// Wrapper panel to hook into DmePanels
+//-----------------------------------------------------------------------------
+class CDmeElementPanel : public CElementPropertiesTreeInternal, public IDmNotify
+{
+ DECLARE_CLASS_SIMPLE( CDmeElementPanel, CElementPropertiesTreeInternal );
+
+public:
+ CDmeElementPanel( vgui::Panel *pParent, const char *pPanelName );
+
+ void SetDmeElement( CDmElement *pElement );
+
+ // Inherited from IDmNotify
+ virtual void NotifyDataChanged( const char *pReason, int nNotifySource, int nNotifyFlags );
+};
+
+#endif // ELEMENTPROPERTIESTREE_H
diff --git a/public/dme_controls/FileListManager.h b/public/dme_controls/FileListManager.h
new file mode 100644
index 0000000..970dc70
--- /dev/null
+++ b/public/dme_controls/FileListManager.h
@@ -0,0 +1,84 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================
+
+#ifndef FILELISTMANAGER_H
+#define FILELISTMANAGER_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "datamodel/idatamodel.h"
+#include "vgui_controls/listpanel.h"
+#include "vgui_controls/Frame.h"
+#include "vgui/KeyCode.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+namespace vgui
+{
+ class CheckButtonList;
+}
+
+//-----------------------------------------------------------------------------
+// CFileListManager
+//-----------------------------------------------------------------------------
+class CFileListManager : public vgui::ListPanel
+{
+ DECLARE_CLASS_SIMPLE( CFileListManager , vgui::ListPanel );
+
+public:
+ CFileListManager( vgui::Panel *parent );
+
+ virtual void Refresh();
+ virtual void OnCommand( const char *cmd );
+ virtual void OnThink();
+ virtual void OnMousePressed( vgui::MouseCode code );
+
+protected:
+ MESSAGE_FUNC_PARAMS( OnOpenContextMenu, "OpenContextMenu", pParams );
+ MESSAGE_FUNC_PARAMS( OnOpenFile, "open", pParams );
+ MESSAGE_FUNC_PARAMS( OnLoadFiles, "load", pParams );
+ MESSAGE_FUNC_PARAMS( OnUnloadFiles, "unload", pParams );
+ MESSAGE_FUNC_PARAMS( OnSaveFiles, "save", pParams );
+ MESSAGE_FUNC_PARAMS( OnSaveFileAs, "saveas", pParams );
+ MESSAGE_FUNC_PARAMS( OnAddToPerforce, "p4add", pParams );
+ MESSAGE_FUNC_PARAMS( OnOpenForEdit, "p4edit", pParams );
+ MESSAGE_FUNC_PARAMS( OnFileSelected, "FileSelected", pParams );
+ MESSAGE_FUNC_PARAMS( OnDataChanged, "DataChanged", pParams );
+
+ int AddItem( DmFileId_t fileid, const char *pFilename, const char *pPath, bool bLoaded, int nElements, bool bChanged, bool bInPerforce, bool bOpenForEdit );
+ void SetLoaded( DmFileId_t fileid, bool bLoaded );
+
+ vgui::CheckButtonList *m_pFileList;
+ bool m_bRefreshRequired;
+
+ vgui::DHANDLE< vgui::Menu > m_hContextMenu;
+};
+
+
+//-----------------------------------------------------------------------------
+// CFileListManagerFrame
+//-----------------------------------------------------------------------------
+class CFileManagerFrame : public vgui::Frame
+{
+ DECLARE_CLASS_SIMPLE( CFileManagerFrame, vgui::Frame );
+
+public:
+ CFileManagerFrame( vgui::Panel *parent );
+
+ virtual void Refresh();
+ virtual void OnCommand( const char *cmd );
+ virtual void PerformLayout();
+
+protected:
+ CFileListManager *m_pFileListManager;
+};
+
+#endif // FILELISTMANAGER_H
diff --git a/public/dme_controls/LogPreview.h b/public/dme_controls/LogPreview.h
new file mode 100644
index 0000000..e70d684
--- /dev/null
+++ b/public/dme_controls/LogPreview.h
@@ -0,0 +1,75 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef LOGPREVIEW_H
+#define LOGPREVIEW_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "datamodel/dmehandle.h"
+
+class CDmElement;
+class CDmeClip;
+class CDmeFilmClip;
+class CDmeChannel;
+
+enum LogPreviewChannelType_t
+{
+ LOG_PREVIEW_VALUE = 0,
+ LOG_PREVIEW_BALANCE,
+ LOG_PREVIEW_MULTILEVEL,
+ LOG_PREVIEW_FLEX_CHANNEL_COUNT,
+
+ LOG_PREVIEW_POSITION = 0,
+ LOG_PREVIEW_ORIENTATION,
+ LOG_PREVIEW_TRANSFORM_CHANNEL_COUNT,
+
+ LOG_PREVIEW_MAX_CHANNEL_COUNT = 3,
+};
+
+struct LogPreview_t
+{
+ LogPreview_t() :
+ m_bDragging( false ),
+ m_bActiveLog( false ),
+ m_bSelected( false )
+ {
+ }
+
+ bool IsEqual( const LogPreview_t& other )
+ {
+ if ( m_hControl != other.m_hControl )
+ return false;
+ for ( int i = 0; i < LOG_PREVIEW_MAX_CHANNEL_COUNT; ++i )
+ {
+ if ( m_hChannels[ i ] != other.m_hChannels[ i ] )
+ return false;
+ }
+ if ( m_hOwner != other.m_hOwner )
+ return false;
+ if ( m_hShot != other.m_hShot )
+ return false;
+ if ( m_bDragging != other.m_bDragging )
+ return false;
+ if ( m_bActiveLog != other.m_bActiveLog )
+ return false;
+ if ( m_bSelected != other.m_bSelected )
+ return false;
+
+ return true;
+ }
+
+ CDmeHandle< CDmElement > m_hControl; // The animation set control
+ CDmeHandle< CDmeChannel > m_hChannels[ LOG_PREVIEW_MAX_CHANNEL_COUNT ];
+ CDmeHandle< CDmeClip > m_hOwner;
+ CDmeHandle< CDmeFilmClip > m_hShot;
+
+ bool m_bDragging : 1;
+ bool m_bActiveLog : 1;
+ bool m_bSelected : 1;
+};
+#endif // LOGPREVIEW_H
diff --git a/public/dme_controls/RecordingState.h b/public/dme_controls/RecordingState.h
new file mode 100644
index 0000000..b50729b
--- /dev/null
+++ b/public/dme_controls/RecordingState.h
@@ -0,0 +1,24 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef RECORDINGSTATE_H
+#define RECORDINGSTATE_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+// Animation set editor recording states
+enum RecordingState_t
+{
+ AS_OFF = 0,
+ AS_PREVIEW,
+ AS_RECORD,
+ AS_PLAYBACK,
+
+ NUM_AS_RECORDING_STATES,
+};
+
+#endif // RECORDINGSTATE_H
diff --git a/public/dme_controls/attributeassetpickerpanel.h b/public/dme_controls/attributeassetpickerpanel.h
new file mode 100644
index 0000000..b1552fa
--- /dev/null
+++ b/public/dme_controls/attributeassetpickerpanel.h
@@ -0,0 +1,93 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef ATTRIBUTEASSETPICKERPANEL_H
+#define ATTRIBUTEASSETPICKERPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/AttributeBasePickerPanel.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CBaseAssetPickerFrame;
+
+
+//-----------------------------------------------------------------------------
+// CAttributeAssetPickerPanel
+//-----------------------------------------------------------------------------
+class CAttributeAssetPickerPanel : public CAttributeBasePickerPanel
+{
+ DECLARE_CLASS_SIMPLE( CAttributeAssetPickerPanel, CAttributeBasePickerPanel );
+
+public:
+ CAttributeAssetPickerPanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+ ~CAttributeAssetPickerPanel();
+
+private:
+ virtual CBaseAssetPickerFrame *CreateAssetPickerFrame() = 0;
+ MESSAGE_FUNC_PARAMS( OnAssetSelected, "AssetSelected", kv );
+ virtual void ShowPickerDialog();
+};
+
+
+//-----------------------------------------------------------------------------
+// Macro to quickly make new attribute types
+//-----------------------------------------------------------------------------
+#define DECLARE_ATTRIBUTE_ASSET_PICKER( _className ) \
+ class _className : public CAttributeAssetPickerPanel \
+ { \
+ DECLARE_CLASS_SIMPLE( _className, CAttributeAssetPickerPanel ); \
+ public: \
+ _className( vgui::Panel *parent, const AttributeWidgetInfo_t &info ) : \
+ BaseClass( parent, info ) {} \
+ private: \
+ virtual CBaseAssetPickerFrame *CreateAssetPickerFrame(); \
+ }
+
+#define IMPLEMENT_ATTRIBUTE_ASSET_PICKER( _className, _popupTitle, _assetType, _assetExt, _assetSubDir, _assetTextType ) \
+ CBaseAssetPickerFrame *_className::CreateAssetPickerFrame() \
+ { \
+ return new CAssetPickerFrame( this, _popupTitle, _assetType, _assetExt, _assetSubDir, _assetTextType ); \
+ }
+
+
+//-----------------------------------------------------------------------------
+// Macro to quickly make new attribute types
+//-----------------------------------------------------------------------------
+#define DECLARE_ATTRIBUTE_ASSET_PREVIEW_PICKER( _className ) \
+ class _className : public CAttributeAssetPickerPanel \
+ { \
+ DECLARE_CLASS_SIMPLE( _className, CAttributeAssetPickerPanel ); \
+ public: \
+ _className( vgui::Panel *parent, const AttributeWidgetInfo_t &info ) : \
+ BaseClass( parent, info ) {} \
+ private: \
+ virtual CBaseAssetPickerFrame *CreateAssetPickerFrame(); \
+ }
+
+#define IMPLEMENT_ATTRIBUTE_ASSET_PREVIEW_PICKER( _className, _pickerClassName, _popupTitle ) \
+ CBaseAssetPickerFrame *_className::CreateAssetPickerFrame() \
+ { \
+ return new _pickerClassName( this, _popupTitle ); \
+ }
+
+
+//-----------------------------------------------------------------------------
+// Assets
+//-----------------------------------------------------------------------------
+DECLARE_ATTRIBUTE_ASSET_PICKER( CAttributeBspPickerPanel );
+DECLARE_ATTRIBUTE_ASSET_PREVIEW_PICKER( CAttributeVmtPickerPanel );
+DECLARE_ATTRIBUTE_ASSET_PREVIEW_PICKER( CAttributeVtfPickerPanel );
+
+
+#endif // ATTRIBUTEASSETPICKERPANEL_H
diff --git a/public/dme_controls/attributedetailtypepickerpanel.h b/public/dme_controls/attributedetailtypepickerpanel.h
new file mode 100644
index 0000000..4f6c946
--- /dev/null
+++ b/public/dme_controls/attributedetailtypepickerpanel.h
@@ -0,0 +1,47 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef ATTRIBUTEDETAILTYPEPICKERPANEL_H
+#define ATTRIBUTEDETAILTYPEPICKERPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/AttributeBasePickerPanel.h"
+#include "matsys_controls/Picker.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CPickerFrame;
+
+
+//-----------------------------------------------------------------------------
+// CAttributeDetailTypePickerPanel
+//-----------------------------------------------------------------------------
+class CAttributeDetailTypePickerPanel : public CAttributeBasePickerPanel
+{
+ DECLARE_CLASS_SIMPLE( CAttributeDetailTypePickerPanel, CAttributeBasePickerPanel );
+
+public:
+ CAttributeDetailTypePickerPanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+ ~CAttributeDetailTypePickerPanel();
+
+private:
+ // Reads the detail types
+ void AddDetailTypesToList( PickerList_t &list );
+
+ MESSAGE_FUNC_PARAMS( OnPicked, "Picked", kv );
+ virtual void ShowPickerDialog();
+};
+
+
+
+#endif // ATTRIBUTEDETAILTYPEPICKERPANEL_H
diff --git a/public/dme_controls/attributeshaderpickerpanel.h b/public/dme_controls/attributeshaderpickerpanel.h
new file mode 100644
index 0000000..65618f7
--- /dev/null
+++ b/public/dme_controls/attributeshaderpickerpanel.h
@@ -0,0 +1,43 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef ATTRIBUTESHADERPICKERPANEL_H
+#define ATTRIBUTESHADERPICKERPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/AttributeBasePickerPanel.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CPickerFrame;
+
+
+//-----------------------------------------------------------------------------
+// CAttributeShaderPickerPanel
+//-----------------------------------------------------------------------------
+class CAttributeShaderPickerPanel : public CAttributeBasePickerPanel
+{
+ DECLARE_CLASS_SIMPLE( CAttributeShaderPickerPanel, CAttributeBasePickerPanel );
+
+public:
+ CAttributeShaderPickerPanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+ ~CAttributeShaderPickerPanel();
+
+private:
+ MESSAGE_FUNC_PARAMS( OnPicked, "Picked", kv );
+ virtual void ShowPickerDialog();
+};
+
+
+
+#endif // ATTRIBUTESHADERPICKERPANEL_H
diff --git a/public/dme_controls/attributeslider.h b/public/dme_controls/attributeslider.h
new file mode 100644
index 0000000..1f68dbf
--- /dev/null
+++ b/public/dme_controls/attributeslider.h
@@ -0,0 +1,284 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef ATTRIBUTESLIDER_H
+#define ATTRIBUTESLIDER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "vgui_controls/EditablePanel.h"
+#include "dme_controls/AnimSetAttributeValue.h"
+#include "materialsystem/MaterialSystemUtil.h"
+#include "datamodel/dmehandle.h"
+
+using namespace vgui;
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CBaseAnimSetAttributeSliderPanel;
+class CDmElement;
+class CAttributeSliderTextEntry;
+class CSubRectImage;
+
+
+//-----------------------------------------------------------------------------
+// CAttributeSlider
+//-----------------------------------------------------------------------------
+
+// THIS CODE IS KIND OF A MESS WRT THE VARIOUS STATES WE CAN BE IN:
+// we can be driven by the preset pane or by dragging on any individual control
+// we can also be driven by ctrl hovering over the preset pane or an individual control
+// if we move from control to control in the preset or here, we need to be able to decay into/out of the various individual sliders
+class CAttributeSlider : public EditablePanel
+{
+ DECLARE_CLASS_SIMPLE( CAttributeSlider, EditablePanel );
+
+ // Overridden methods of EditablePanel
+public:
+ virtual void Paint();
+ virtual void PaintBackground();
+ virtual void ApplySchemeSettings( IScheme *scheme );
+ virtual void PerformLayout();
+ virtual void OnCursorMoved(int x, int y);
+ virtual void OnMousePressed(MouseCode code);
+ virtual void OnMouseDoublePressed(MouseCode code);
+ virtual void OnMouseReleased(MouseCode code);
+ virtual void OnCursorEntered();
+ virtual void OnCursorExited();
+ virtual void OnKeyCodeTyped( KeyCode code );
+
+ // Other public methods
+public:
+ CAttributeSlider( CBaseAnimSetAttributeSliderPanel *parent, const char *panelName, CDmElement *control );
+ virtual ~CAttributeSlider();
+
+ // Returns the control we're modifying
+ CDmElement *GetControl();
+
+ // Activates/deactivates a slider control
+ // NOTE: Slider control 'value' defaults to active, 'balance' and 'multilevel' defaults to inactive
+ void ActivateControl( AnimationControlType_t type, bool bActive );
+ bool IsControlActive( AnimationControlType_t type );
+
+ // Gets/sets the slider value.
+ // NOTE: This may not match the value pushed into the control because of fading
+ void SetValue( AnimationControlType_t type, float flValue );
+ float GetValue( AnimationControlType_t type ) const;
+ void SetValue( const AttributeValue_t& value );
+ const AttributeValue_t& GetValue() const;
+
+ // Is this slider manipulating a transform control?
+ // [NOTE: This is a utility method; the control contains these states]
+ bool IsTransform() const;
+
+ // Returns the default value for a control
+ // [NOTE: These is a utility method; the control contains these states]
+ float GetControlDefaultValue( AnimationControlType_t type ) const;
+
+ // Are we dragging? If so, what control is being dragged?
+ bool IsDragging() const;
+ AnimationControlType_t GetDragControl() const;
+
+ // Are we in text entry mode? If so, what control is having text entered?
+ bool IsInTextEntry() const;
+ AnimationControlType_t GetTextEntryControl() const;
+
+ // Estimates the value of the control given a local coordinate
+ float EstimateValueAtPos( int nLocalX, int nLocalY ) const;
+
+ void SetPreview( const AttributeValue_t &value, const AttributeValue_t &full, bool instantaneous, bool startfromcurrent );
+ float GetPreview( AnimationControlType_t type ) const;
+ const AttributeValue_t &GetPreview() const;
+
+ void EnablePreview( bool state, bool simple, bool faderdrag );
+ bool IsPreviewEnabled() const;
+ bool IsSimplePreview() const;
+
+ void UpdateTime( float dt );
+ void UpdateFaderAmount( float amount );
+
+ bool IsRampingTowardPreview() const;
+ void RampDown();
+
+ bool IsFaderBeingDragged();
+
+ void SetIsLogPreviewControl( bool state );
+
+ void SetSelected( bool state );
+ bool IsSelected() const;
+
+private:
+ // Various slider modes
+ enum SliderMode_t
+ {
+ SLIDER_MODE_FIRST_DRAG_MODE = 0x0,
+ SLIDER_MODE_FIRST_TEXT_MODE = 0x4,
+ SLIDER_MODE_LAST_DRAG_MODE = SLIDER_MODE_FIRST_DRAG_MODE + ANIM_CONTROL_COUNT - 1,
+ SLIDER_MODE_LAST_TEXT_MODE = SLIDER_MODE_FIRST_TEXT_MODE + ANIM_CONTROL_COUNT - 1,
+
+ SLIDER_MODE_NONE = -1,
+
+ SLIDER_MODE_DRAG_VALUE = SLIDER_MODE_FIRST_DRAG_MODE + ANIM_CONTROL_VALUE,
+ SLIDER_MODE_DRAG_BALANCE = SLIDER_MODE_FIRST_DRAG_MODE + ANIM_CONTROL_BALANCE,
+ SLIDER_MODE_DRAG_MULTILEVEL = SLIDER_MODE_FIRST_DRAG_MODE + ANIM_CONTROL_MULTILEVEL,
+
+ SLIDER_MODE_TEXT_VALUE = SLIDER_MODE_FIRST_TEXT_MODE + ANIM_CONTROL_VALUE,
+ SLIDER_MODE_TEXT_BALANCE = SLIDER_MODE_FIRST_TEXT_MODE + ANIM_CONTROL_BALANCE,
+ SLIDER_MODE_TEXT_MULTILEVEL = SLIDER_MODE_FIRST_TEXT_MODE + ANIM_CONTROL_MULTILEVEL,
+ };
+
+ struct Preview_t
+ {
+ AttributeValue_t m_Current;
+ AttributeValue_t m_Full;
+ };
+
+private:
+ // Returns the location of a particular control
+ void GetControlRect( Rect_t *pRect, AnimationControlType_t type ) const;
+
+ // Given a mouse position in (x,y) in local coordinates, which animation control is it over?
+ AnimationControlType_t DetermineControl( int x, int y );
+
+ // Draws a tick on a circular control
+ void DrawCircularTick( const Color& clr, float flValue, int nCenterX, int nCenterY, float flRadius );
+
+ // Draws a preview of a circular control
+ void DrawCircularPreview( AnimationControlType_t type, bool bMainTick, float flRadius );
+
+ // Paints the a circular control
+ void PaintCircularControl( float flValue, const Rect_t& rect );
+
+ // Called by the text entry code to enter the value into the logs
+ void StampValueIntoLogs( AnimationControlType_t type, float flValue );
+
+ // Methods related to rendering
+ void DrawMidpoint( int x, int ty, int ttall );
+ void DrawPreviewTick( bool mainTick );
+ void DrawTick( const Color& clr, float frac, int width, int inset );
+ void DrawNameLabel();
+ void DrawValueLabel( float flValue );
+ float GetPreviewAlphaScale() const;
+
+ // Methods related to text entry mode
+ void EnterTextEntryMode( AnimationControlType_t type, bool bRelatchValues );
+ void AcceptTextEntryValue();
+ void DiscardTextEntryValue();
+
+private:
+ CBaseAnimSetAttributeSliderPanel *m_pParent;
+ TextImage *m_pName;
+ TextImage *m_pValues[ 3 ];
+ CSubRectImage *m_pCircleImage; // The background for the balance + multilevel controls
+
+ // This is the control we're modifying
+ CDmeHandle< CDmElement > m_hControl;
+
+ // White material used for drawing non-textured things
+ CMaterialReference m_pWhite;
+
+ // The current mode of the slider
+ SliderMode_t m_SliderMode;
+
+ // The slider value; it may not match the control attribute value due to blending
+ AttributeValue_t m_Control;
+
+ // Is the slider control active?
+ bool m_bIsControlActive[ANIM_CONTROL_COUNT];
+
+ // Info used when in text entry mode
+ AttributeValue_t m_InitialTextEntryValue;
+ CAttributeSliderTextEntry *m_pTextField; // if this is a stereo control, then this will be the left text field
+ CAttributeSliderTextEntry *m_pRightTextField;
+
+ Preview_t m_Next;
+ Preview_t m_Previous;
+ Preview_t m_Preview;
+ float m_flPreviewGoalTime;
+ float m_flFaderAmount;
+
+ // Fields used to help with drag
+ int m_nDragStartPosition[2]; // Where was the mouse clicked?
+ int m_nAccum[2]; // What's the total mouse movement during the drag?
+ float m_flDragStartValue; // What was the value of the slider before the drag started?
+ float m_flDragStartBalance; // What was the balance of the slider before the drag started?
+
+ bool m_bCursorInsidePanel : 1; // Used to
+ bool m_bRampUp : 1;
+ bool m_bPreviewEnabled : 1;
+ bool m_bSimplePreviewOnly : 1;
+ bool m_bFaderBeingDragged : 1;
+ bool m_bIsLogPreviewControl : 1;
+ bool m_bTransform : 1;
+ bool m_bSelected : 1;
+
+ friend class CAttributeSliderTextEntry;
+};
+
+
+//-----------------------------------------------------------------------------
+// Inline methods
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+// Returns the control
+//-----------------------------------------------------------------------------
+inline CDmElement *CAttributeSlider::GetControl()
+{
+ return m_hControl;
+}
+
+
+//-----------------------------------------------------------------------------
+// Returns information about the control
+//-----------------------------------------------------------------------------
+inline bool CAttributeSlider::IsTransform() const
+{
+ // NOTE: We may well not wish to cache this off in the constructor.
+ // It's done purely for efficiency reasons.
+ // Uncomment the line to make it read from the control.
+ // return m_hControl->GetValue< bool >( "transform" )
+ return m_bTransform;
+}
+
+
+//-----------------------------------------------------------------------------
+// Are we dragging?
+//-----------------------------------------------------------------------------
+inline bool CAttributeSlider::IsDragging() const
+{
+ COMPILE_TIME_ASSERT( ANIM_CONTROL_COUNT < 4 );
+ return ( m_SliderMode >= SLIDER_MODE_FIRST_DRAG_MODE && m_SliderMode <= SLIDER_MODE_LAST_DRAG_MODE );
+}
+
+inline AnimationControlType_t CAttributeSlider::GetDragControl() const
+{
+ if ( IsDragging() )
+ return (AnimationControlType_t)( m_SliderMode - SLIDER_MODE_FIRST_DRAG_MODE );
+ return ANIM_CONTROL_INVALID;
+}
+
+
+//-----------------------------------------------------------------------------
+// Are we in text entry mode?
+//-----------------------------------------------------------------------------
+inline bool CAttributeSlider::IsInTextEntry() const
+{
+ COMPILE_TIME_ASSERT( ANIM_CONTROL_COUNT < 4 );
+ return ( m_SliderMode >= SLIDER_MODE_FIRST_TEXT_MODE && m_SliderMode <= SLIDER_MODE_LAST_TEXT_MODE );
+}
+
+inline AnimationControlType_t CAttributeSlider::GetTextEntryControl() const
+{
+ if ( IsInTextEntry() )
+ return (AnimationControlType_t)( m_SliderMode - SLIDER_MODE_FIRST_TEXT_MODE );
+ return ANIM_CONTROL_INVALID;
+}
+
+#endif // ATTRIBUTESLIDER_H
diff --git a/public/dme_controls/attributesurfacepropertypickerpanel.h b/public/dme_controls/attributesurfacepropertypickerpanel.h
new file mode 100644
index 0000000..97b380b
--- /dev/null
+++ b/public/dme_controls/attributesurfacepropertypickerpanel.h
@@ -0,0 +1,47 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef ATTRIBUTESURFACEPROPERTYPICKERPANEL_H
+#define ATTRIBUTESURFACEPROPERTYPICKERPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "dme_controls/AttributeBasePickerPanel.h"
+#include "matsys_controls/Picker.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CPickerFrame;
+
+
+//-----------------------------------------------------------------------------
+// CAttributeSurfacePropertyPickerPanel
+//-----------------------------------------------------------------------------
+class CAttributeSurfacePropertyPickerPanel : public CAttributeBasePickerPanel
+{
+ DECLARE_CLASS_SIMPLE( CAttributeSurfacePropertyPickerPanel, CAttributeBasePickerPanel );
+
+public:
+ CAttributeSurfacePropertyPickerPanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
+ ~CAttributeSurfacePropertyPickerPanel();
+
+private:
+ // Reads the surface properties
+ void AddSurfacePropertiesToList( PickerList_t &list );
+
+ MESSAGE_FUNC_PARAMS( OnPicked, "Picked", kv );
+ virtual void ShowPickerDialog();
+};
+
+
+
+#endif // ATTRIBUTESURFACEPROPERTYPICKERPANEL_H
diff --git a/public/dme_controls/dmecombinationsystemeditorpanel.h b/public/dme_controls/dmecombinationsystemeditorpanel.h
new file mode 100644
index 0000000..7d62449
--- /dev/null
+++ b/public/dme_controls/dmecombinationsystemeditorpanel.h
@@ -0,0 +1,93 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================
+
+#ifndef DMECOMBINATIONSYSTEMEDITORPANEL_H
+#define DMECOMBINATIONSYSTEMEDITORPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "tier1/utlvector.h"
+#include "vgui_controls/Frame.h"
+#include "datamodel/dmehandle.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmeCombinationControlsPanel;
+class CDmeCombinationDominationRulesPanel;
+class CDmeCombinationOperator;
+class CDmeElementPanel;
+
+namespace vgui
+{
+ class PropertySheet;
+ class PropertyPage;
+ class Button;
+}
+
+
+//-----------------------------------------------------------------------------
+// Dag editor panel
+//-----------------------------------------------------------------------------
+class CDmeCombinationSystemEditorPanel : public vgui::EditablePanel
+{
+ DECLARE_CLASS_SIMPLE( CDmeCombinationSystemEditorPanel, vgui::EditablePanel );
+
+public:
+ // constructor, destructor
+ CDmeCombinationSystemEditorPanel( vgui::Panel *pParent, const char *pName );
+ virtual ~CDmeCombinationSystemEditorPanel();
+
+ // Sets the current scene + animation list
+ void SetDmeElement( CDmeCombinationOperator *pComboSystem );
+ CDmeCombinationOperator *GetDmeElement();
+
+private:
+ // Called when the selection changes moves
+ MESSAGE_FUNC( OnPageChanged, "PageChanged" );
+ MESSAGE_FUNC_PARAMS( OnDmeElementChanged, "DmeElementChanged", kv );
+
+ vgui::PropertySheet *m_pEditorSheet;
+ vgui::PropertyPage *m_pControlsPage;
+ vgui::PropertyPage *m_pDominationRulesPage;
+ vgui::PropertyPage *m_pPropertiesPage;
+ CDmeCombinationControlsPanel *m_pControlsPanel;
+ CDmeCombinationDominationRulesPanel *m_pDominationRulesPanel;
+ CDmeElementPanel *m_pPropertiesPanel;
+};
+
+
+//-----------------------------------------------------------------------------
+// Frame for combination system
+//-----------------------------------------------------------------------------
+class CDmeCombinationSystemEditorFrame : public vgui::Frame
+{
+ DECLARE_CLASS_SIMPLE( CDmeCombinationSystemEditorFrame, vgui::Frame );
+
+public:
+ CDmeCombinationSystemEditorFrame( vgui::Panel *pParent, const char *pTitle );
+ ~CDmeCombinationSystemEditorFrame();
+
+ // Sets the current scene + animation list
+ void SetCombinationOperator( CDmeCombinationOperator *pComboSystem );
+
+ // Inherited from Frame
+ virtual void OnCommand( const char *pCommand );
+
+private:
+ MESSAGE_FUNC( OnDmeElementChanged, "DmeElementChanged" );
+
+ CDmeCombinationSystemEditorPanel *m_pEditor;
+ vgui::Button *m_pOpenButton;
+ vgui::Button *m_pCancelButton;
+};
+
+
+#endif // DMECOMBINATIONSYSTEMEDITORPANEL_H \ No newline at end of file
diff --git a/public/dme_controls/dmecontrols.h b/public/dme_controls/dmecontrols.h
new file mode 100644
index 0000000..25541fd
--- /dev/null
+++ b/public/dme_controls/dmecontrols.h
@@ -0,0 +1,72 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//===========================================================================//
+
+#ifndef DMECONTROLS_H
+#define DMECONTROLS_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "tier1/interface.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class ISoundEmitterSystemBase;
+class IEngineTool;
+class IPhysicsCollision;
+class IElementPropertiesChoices;
+
+namespace vgui
+{
+
+//-----------------------------------------------------------------------------
+// handles the initialization of the vgui interfaces.
+// NOTE: Calls into VGui_InitMatSysInterfacesList
+// interfaces (listed below) are first attempted to be loaded from primaryProvider, then secondaryProvider
+// moduleName should be the name of the module that this instance of the vgui_controls has been compiled into
+//-----------------------------------------------------------------------------
+bool VGui_InitDmeInterfacesList( const char *moduleName, CreateInterfaceFn *factoryList, int numFactories );
+
+
+//-----------------------------------------------------------------------------
+// set of accessor functions to matsys interfaces
+// the appropriate header file for each is listed above the item
+//-----------------------------------------------------------------------------
+
+// #include "soundemittersystem/isoundemittersystembase.h"
+ISoundEmitterSystemBase *SoundEmitterSystem();
+
+// #include "toolsframework/ienginetool.h"
+IEngineTool *EngineTool();
+
+// #include "vphysics_interface.h"
+IPhysicsCollision *PhysicsCollision();
+
+// #include "dme_controls/INotifyUI.h"
+IElementPropertiesChoices *ElementPropertiesChoices();
+void SetElementPropertiesChoices( IElementPropertiesChoices *pChoices );
+
+} // end namespace vgui
+
+
+//-----------------------------------------------------------------------------
+// predeclare all the matsys control class names
+//-----------------------------------------------------------------------------
+class CDmeMDLPanel;
+class CMDLSequencePicker;
+class CMDLPicker;
+class CSequencePicker;
+class CDmePicker;
+class CSoundPicker;
+class CFilterComboBox;
+class CGameFileTreeView;
+
+
+#endif // DMECONTROLS_H
diff --git a/public/dme_controls/dmecontrols_utils.h b/public/dme_controls/dmecontrols_utils.h
new file mode 100644
index 0000000..5e3c175
--- /dev/null
+++ b/public/dme_controls/dmecontrols_utils.h
@@ -0,0 +1,138 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//===========================================================================//
+
+#ifndef DMECONTROLS_UTILS_H
+#define DMECONTROLS_UTILS_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "tier1/KeyValues.h"
+#include "datamodel/dmelement.h"
+#include "datamodel/dmattribute.h"
+#include "datamodel/dmattributevar.h"
+#include "movieobjects/timeutils.h"
+
+//-----------------------------------------------------------------------------
+// Helper method to insert + extract DmElement handles into keyvalues
+//-----------------------------------------------------------------------------
+inline void SetElementKeyValue( KeyValues *pKeyValues, const char *pName, CDmElement *pElement )
+{
+ pKeyValues->SetInt( pName, pElement ? pElement->GetHandle() : DMELEMENT_HANDLE_INVALID );
+}
+
+template< class T >
+T* GetElementKeyValue( KeyValues *pKeyValues, const char *pName )
+{
+ DmElementHandle_t h = (DmElementHandle_t)pKeyValues->GetInt( pName, DMELEMENT_HANDLE_INVALID );
+ return GetElement<T>( h );
+}
+
+inline KeyValues *CreateElementKeyValues( const char *pName, const char *pKey, CDmElement *pElement )
+{
+ return new KeyValues( pName, pKey, pElement ? ( int )pElement->GetHandle() : DMELEMENT_HANDLE_INVALID );
+}
+
+inline void AddStandardElementKeys( KeyValues *pKeyValues, CDmElement *pElement )
+{
+ SetElementKeyValue( pKeyValues, "dmeelement", pElement );
+
+ if ( pElement )
+ {
+ char buf[ 256 ];
+ UniqueIdToString( pElement->GetId(), buf, sizeof( buf ) );
+ pKeyValues->SetString( "text", buf );
+ pKeyValues->SetString( "type", pElement->GetTypeString() );
+ }
+}
+
+
+//-----------------------------------------------------------------------------
+// Helper method to insert + extract DmeTime_t into keyvalues
+//-----------------------------------------------------------------------------
+inline void SetDmeTimeKeyValue( KeyValues *pKeyValues, const char *pName, DmeTime_t t )
+{
+ pKeyValues->SetInt( pName, t.GetTenthsOfMS() );
+}
+
+inline DmeTime_t GetDmeTimeKeyValue( KeyValues *pKeyValues, const char *pName, DmeTime_t defaultTime = DMETIME_ZERO )
+{
+ return DmeTime_t( pKeyValues->GetInt( pName, defaultTime.GetTenthsOfMS() ) );
+}
+
+
+inline bool ElementTree_IsArrayItem( KeyValues *itemData )
+{
+ return !itemData->IsEmpty( "arrayIndex" );
+}
+
+inline CDmAttribute *ElementTree_GetAttribute( KeyValues *itemData )
+{
+ CDmElement *pOwner = GetElementKeyValue< CDmElement >( itemData, "ownerelement" );
+ if ( !pOwner )
+ return NULL;
+
+ const char *pAttributeName = itemData->GetString( "attributeName", "" );
+ return pOwner->GetAttribute( pAttributeName );
+}
+
+inline DmAttributeType_t ElementTree_GetAttributeType( KeyValues *itemData )
+{
+ CDmElement *pOwner = GetElementKeyValue< CDmElement >( itemData, "ownerelement" );
+ if ( !pOwner )
+ return AT_UNKNOWN;
+
+ const char *pAttributeName = itemData->GetString( "attributeName", "" );
+ CDmAttribute *pAttribute = pOwner->GetAttribute( pAttributeName );
+ if ( !pAttribute )
+ return AT_UNKNOWN;
+
+ return pAttribute->GetType();
+}
+
+
+
+inline bool ElementTree_GetDroppableItems( CUtlVector< KeyValues * >& msglist, const char *elementType, CUtlVector< CDmElement * >& list )
+{
+ int c = msglist.Count();
+ for ( int i = 0; i < c; ++i )
+ {
+ KeyValues *data = msglist[ i ];
+
+ CDmElement *e = GetElementKeyValue<CDmElement>( data, "dmeelement" );
+ if ( !e )
+ {
+ continue;
+ }
+
+ //if ( !e->IsA( elementType ) )
+ //{
+ // continue;
+ //}
+
+ list.AddToTail( e );
+ }
+
+ return list.Count() != 0;
+}
+
+inline void ElementTree_RemoveListFromArray( CDmAttribute *pArrayAttribute, CUtlVector< CDmElement * >& list )
+{
+ CDmrElementArray<> array( pArrayAttribute );
+ int c = array.Count();
+ for ( int i = c - 1 ; i >= 0 ; --i )
+ {
+ CDmElement *element = array[ i ];
+ if ( list.Find( element ) != list.InvalidIndex() )
+ {
+ array.Remove( i );
+ }
+ }
+}
+
+#endif // DMECONTROLS_UTILS_H
diff --git a/public/dme_controls/dmedageditpanel.h b/public/dme_controls/dmedageditpanel.h
new file mode 100644
index 0000000..f5cb1f3
--- /dev/null
+++ b/public/dme_controls/dmedageditpanel.h
@@ -0,0 +1,96 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================
+
+#ifndef DMEDAGEDITPANEL_H
+#define DMEDAGEDITPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "tier1/utlvector.h"
+#include "vgui_controls/EditablePanel.h"
+#include "datamodel/dmehandle.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmeDagRenderPanel;
+class CDmeAnimationList;
+class CDmeChannelsClip;
+class CDmeSourceSkin;
+class CDmeSourceAnimation;
+class CDmeDCCMakefile;
+class CDmeCombinationOperatorPanel;
+class CDmeCombinationOperator;
+class CDmeAnimationListPanel;
+class CBaseAnimationSetEditor;
+class CDmeAnimationSet;
+class CDmeDag;
+
+namespace vgui
+{
+ class Splitter;
+ class PropertySheet;
+ class PropertyPage;
+ class ScrollableEditablePanel;
+}
+
+
+
+//-----------------------------------------------------------------------------
+// Dag editor panel
+//-----------------------------------------------------------------------------
+class CDmeDagEditPanel : public vgui::EditablePanel
+{
+ DECLARE_CLASS_SIMPLE( CDmeDagEditPanel, vgui::EditablePanel );
+
+public:
+ // constructor, destructor
+ CDmeDagEditPanel( vgui::Panel *pParent, const char *pName );
+ virtual ~CDmeDagEditPanel();
+
+ // Overriden methods of vgui::Panel
+ virtual void Paint();
+
+ // Sets the current scene + animation list
+ void SetDmeElement( CDmeDag *pScene );
+ void SetAnimationList( CDmeAnimationList *pAnimationList );
+ void SetVertexAnimationList( CDmeAnimationList *pAnimationList );
+ void SetCombinationOperator( CDmeCombinationOperator *pComboOp );
+ void RefreshCombinationOperator();
+
+ CDmeDag *GetDmeElement();
+
+ // Other methods which hook into DmePanel
+ void SetDmeElement( CDmeSourceSkin *pSkin );
+ void SetDmeElement( CDmeSourceAnimation *pAnimation );
+ void SetDmeElement( CDmeDCCMakefile *pDCCMakefile );
+
+private:
+ // Called when the selection changes moves
+ MESSAGE_FUNC( OnPageChanged, "PageChanged" );
+ MESSAGE_FUNC_PARAMS( OnAnimationSelected, "AnimationSelected", kv );
+ MESSAGE_FUNC_PARAMS( OnAnimationDeselected, "AnimationDeselected", kv );
+
+ // Sets up the various panels in the dag editor
+ void SetMakefileRootElement( CDmElement *pRoot );
+
+ vgui::PropertySheet *m_pEditorSheet;
+ vgui::PropertyPage *m_pAnimationPage;
+ vgui::PropertyPage *m_pVertexAnimationPage;
+ vgui::PropertyPage *m_pCombinationPage;
+ vgui::Splitter *m_pPropertiesSplitter;
+ CDmeDagRenderPanel *m_pDagRenderPanel;
+ CDmeAnimationListPanel *m_pAnimationListPanel;
+ CDmeAnimationListPanel *m_pVertexAnimationListPanel;
+ CDmeCombinationOperatorPanel *m_pCombinationPanel;
+};
+
+
+#endif // DMEDAGEDITPANEL_H \ No newline at end of file
diff --git a/public/dme_controls/dmedagrenderpanel.h b/public/dme_controls/dmedagrenderpanel.h
new file mode 100644
index 0000000..17616d7
--- /dev/null
+++ b/public/dme_controls/dmedagrenderpanel.h
@@ -0,0 +1,140 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================
+
+#ifndef DMEDAGRENDERPANEL_H
+#define DMEDAGRENDERPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "tier1/utlvector.h"
+#include "matsys_controls/PotteryWheelPanel.h"
+#include "datamodel/dmehandle.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmeDag;
+class CDmeModel;
+class CDmeAnimationList;
+class CDmeChannelsClip;
+class CDmeSourceSkin;
+class CDmeSourceAnimation;
+class CDmeDCCMakefile;
+class CDmeDrawSettings;
+class vgui::MenuBar;
+
+namespace vgui
+{
+ class IScheme;
+}
+
+
+//-----------------------------------------------------------------------------
+// Material Viewer Panel
+//-----------------------------------------------------------------------------
+class CDmeDagRenderPanel : public CPotteryWheelPanel
+{
+ DECLARE_CLASS_SIMPLE( CDmeDagRenderPanel, CPotteryWheelPanel );
+
+public:
+ // constructor, destructor
+ CDmeDagRenderPanel( vgui::Panel *pParent, const char *pName );
+ virtual ~CDmeDagRenderPanel();
+
+ // Overriden methods of vgui::Panel
+ virtual void PerformLayout();
+ virtual void Paint();
+ virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
+
+ // Sets the current scene + animation list
+ void SetDmeElement( CDmeDag *pScene );
+ void SetAnimationList( CDmeAnimationList *pAnimationList );
+ void SetVertexAnimationList( CDmeAnimationList *pAnimationList );
+ void DrawJoints( bool bDrawJoint );
+ void DrawJointNames( bool bDrawJointNames );
+ void DrawGrid( bool bDrawGrid );
+
+ CDmeDag *GetDmeElement();
+
+ // Other methods which hook into DmePanel
+ void SetDmeElement( CDmeSourceSkin *pSkin );
+ void SetDmeElement( CDmeSourceAnimation *pAnimation );
+ void SetDmeElement( CDmeDCCMakefile *pDCCMakefile );
+
+ // Select animation by name
+ void SelectAnimation( const char *pAnimName );
+ void SelectVertexAnimation( const char *pAnimName );
+
+private:
+ // Select animation by index
+ void SelectAnimation( int nIndex );
+ void SelectVertexAnimation( int nIndex );
+
+ // paint it!
+ void OnPaint3D();
+ void OnMouseDoublePressed( vgui::MouseCode code );
+ virtual void OnKeyCodePressed( vgui::KeyCode code );
+
+ MESSAGE_FUNC( OnSmoothShade, "SmoothShade" );
+ MESSAGE_FUNC( OnFlatShade, "FlatShade" );
+ MESSAGE_FUNC( OnWireframe, "Wireframe" );
+ MESSAGE_FUNC( OnBoundingBox, "BoundingBox" );
+ MESSAGE_FUNC( OnNormals, "Normals" );
+ MESSAGE_FUNC( OnWireframeOnShaded, "WireframeOnShaded" );
+ MESSAGE_FUNC( OnBackfaceCulling, "BackfaceCulling" );
+ MESSAGE_FUNC( OnXRay, "XRay" );
+ MESSAGE_FUNC( OnGrayShade, "GrayShade" );
+ MESSAGE_FUNC( OnFrame, "Frame" );
+
+ // Draw joint names
+ void DrawJointNames( CDmeDag *pRoot, CDmeDag *pDag, const matrix3x4_t& parentToWorld );
+
+ // Rebuilds the list of operators
+ void RebuildOperatorList();
+
+ // Update Menu Status
+ void UpdateMenu();
+ CTextureReference m_DefaultEnvCubemap;
+ CTextureReference m_DefaultHDREnvCubemap;
+ vgui::HFont m_hFont;
+
+ bool m_bDrawJointNames : 1;
+ bool m_bDrawJoints : 1;
+ bool m_bDrawGrid : 1;
+
+ CDmeHandle< CDmeAnimationList > m_hAnimationList;
+ CDmeHandle< CDmeAnimationList > m_hVertexAnimationList;
+ CDmeHandle< CDmeChannelsClip > m_hCurrentAnimation;
+ CDmeHandle< CDmeChannelsClip > m_hCurrentVertexAnimation;
+ CUtlVector< IDmeOperator* > m_operators;
+ float m_flStartTime;
+ CDmeHandle< CDmeDag > m_hDag;
+
+ CDmeDrawSettings *m_pDrawSettings;
+ CDmeHandle< CDmeDrawSettings, true > m_hDrawSettings;
+
+ vgui::MenuBar *m_pMenuBar;
+
+ // Menu item numbers
+ vgui::Menu *m_pShadingMenu;
+ int m_nMenuSmoothShade;
+ int m_nMenuFlatShade;
+ int m_nMenuWireframe;
+ int m_nMenuBoundingBox;
+ int m_nMenuNormals;
+ int m_nMenuWireframeOnShaded;
+ int m_nMenuBackfaceCulling;
+ int m_nMenuXRay;
+ int m_nMenuGrayShade;
+};
+
+
+
+#endif // DMEDAGRENDERPANEL_H \ No newline at end of file
diff --git a/public/dme_controls/dmelogeditpanel.h b/public/dme_controls/dmelogeditpanel.h
new file mode 100644
index 0000000..3dcfeea
--- /dev/null
+++ b/public/dme_controls/dmelogeditpanel.h
@@ -0,0 +1,170 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef DMELOGEDITPANEL_H
+#define DMELOGEDITPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+
+#include "vgui_controls/Frame.h"
+#include "matsys_controls/curveeditorpanel.h"
+#include "datamodel/dmehandle.h"
+#include "movieobjects/timeutils.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmeLog;
+
+namespace vgui
+{
+ class ComboBox;
+}
+
+//-----------------------------------------------------------------------------
+//
+// Curve editor for float DmeLogs
+//
+//-----------------------------------------------------------------------------
+class CDmeLogEditPanel : public CCurveEditorPanel
+{
+ DECLARE_CLASS_SIMPLE( CDmeLogEditPanel, CCurveEditorPanel );
+
+public:
+ enum LogField_t
+ {
+ FIELD_X = 0x1,
+ FIELD_Y = 0x2,
+ FIELD_Z = 0x4,
+ FIELD_W = 0x8,
+
+ FIELD_R = 0x1,
+ FIELD_G = 0x2,
+ FIELD_B = 0x4,
+ FIELD_A = 0x8,
+
+ FIELD_ALL = 0xF,
+ };
+
+
+ // constructor
+ CDmeLogEditPanel( vgui::Panel *pParent, const char *pName );
+ ~CDmeLogEditPanel();
+
+ // Sets the log to edit
+ void SetDmeLog( CDmeLog *pLog );
+ void SetMask( int nMask );
+
+ // Sets the time range on the view in ms
+ void SetTimeRange( DmeTime_t startTime, DmeTime_t endTime );
+
+ // Sets the vertical range on the view
+ void SetVerticalRange( float flMin, float flMax );
+
+protected:
+ // Control points + values...
+ virtual int FindOrAddControlPoint( float flIn, float flTolerance, float flOut );
+ virtual int FindControlPoint( float flIn, float flTolerance );
+ virtual int ModifyControlPoint( int nPoint, float flIn, float flOut );
+ virtual void RemoveControlPoint( int nPoint );
+ virtual float GetValue( float flIn );
+ virtual int ControlPointCount();
+ virtual void GetControlPoint( int nPoint, float *pIn, float *pOut );
+
+private:
+ // Converts normalized values to int time
+ DmeTime_t NormalizedToTime( float flIn );
+ DmeTime_t NormalizedToDuration( float flDuration );
+ float TimeToNormalized( DmeTime_t time );
+ float NormalizedToValue( float flValue );
+ float ValueToNormalized( float flNormalized );
+
+ template< class T > int FindOrAddKey( DmeTime_t time, DmeTime_t tolerance, int nComps, float flValue );
+ template< class T > int ModifyKey( int nPoint, DmeTime_t initialTime, DmeTime_t time, int nComps, float flValue );
+
+ CDmeHandle<CDmeLog> m_hLog;
+ int m_LogFieldMask;
+ int m_nFieldIndex;
+ DmeTime_t m_minTime;
+ DmeTime_t m_maxTime;
+ float m_flMinVertical;
+ float m_flMaxVertical;
+};
+
+
+//-----------------------------------------------------------------------------
+// Finds or adds a key
+//-----------------------------------------------------------------------------
+template< class T >
+int CDmeLogEditPanel::FindOrAddKey( DmeTime_t time, DmeTime_t tolerance, int nComps, float flValue )
+{
+ T vec = CastElement< CDmeTypedLog<T> >( m_hLog )->GetValue( time );
+ for ( int i = 0; i < nComps; ++i )
+ {
+ if ( m_LogFieldMask & (1 << i) )
+ {
+ vec[i] = flValue;
+ }
+ }
+ return CastElement< CDmeTypedLog<T> >( m_hLog )->FindOrAddKey( time, tolerance, vec );
+}
+
+
+//-----------------------------------------------------------------------------
+// Modifies an existing key
+//-----------------------------------------------------------------------------
+template< class T >
+int CDmeLogEditPanel::ModifyKey( int nPoint, DmeTime_t initialTime, DmeTime_t time, int nComps, float flValue )
+{
+ T vec = CastElement< CDmeTypedLog<T> >( m_hLog )->GetValue( initialTime );
+ for ( int i = 0; i < nComps; ++i )
+ {
+ if ( m_LogFieldMask & (1 << i) )
+ {
+ vec[i] = flValue;
+ }
+ }
+ RemoveControlPoint( nPoint );
+ return CastElement< CDmeTypedLog<T> >( m_hLog )->FindOrAddKey( time, DmeTime_t( 0 ), vec );
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Main app window
+//-----------------------------------------------------------------------------
+class CDmeLogEditFrame : public vgui::Frame
+{
+ DECLARE_CLASS_SIMPLE( CDmeLogEditFrame, vgui::Frame );
+
+public:
+ CDmeLogEditFrame( vgui::Panel *pParent, const char *pTitle );
+ ~CDmeLogEditFrame();
+
+ // Inherited from Frame
+ virtual void OnCommand( const char *pCommand );
+
+ // Purpose: Activate the dialog
+ // the message "LogEdited" will be sent if ok was hit
+ // Pass in a message to add as a subkey to the DmeSelected message
+ void DoModal( CDmeLog *pLog, DmeTime_t startTime, DmeTime_t endTime, KeyValues *pContextKeyValues = NULL );
+
+private:
+ MESSAGE_FUNC( OnTextChanged, "TextChanged" );
+
+ void CleanUpMessage();
+
+ CDmeLogEditPanel *m_pCurveEditor;
+ vgui::Button *m_pOkButton;
+ vgui::Button *m_pCancelButton;
+ vgui::ComboBox *m_pFilter;
+ KeyValues *m_pContextKeyValues;
+};
+
+
+#endif // DMELOGEDITPANEL_H \ No newline at end of file
diff --git a/public/dme_controls/dmemdlpanel.h b/public/dme_controls/dmemdlpanel.h
new file mode 100644
index 0000000..2d25100
--- /dev/null
+++ b/public/dme_controls/dmemdlpanel.h
@@ -0,0 +1,38 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef DMEMDLPANEL_H
+#define DMEMDLPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+
+#include "matsys_controls/mdlpanel.h"
+
+
+class CDmeMDLMakefile;
+
+
+//-----------------------------------------------------------------------------
+// MDL Viewer Panel (hooked into DMEPanel)
+//-----------------------------------------------------------------------------
+class CDmeMDLPanel : public CMDLPanel
+{
+ DECLARE_CLASS_SIMPLE( CDmeMDLPanel, CMDLPanel );
+
+public:
+ // constructor, destructor
+ CDmeMDLPanel( vgui::Panel *pParent, const char *pName );
+ virtual ~CDmeMDLPanel();
+
+ // DMEPanel..
+ void SetDmeElement( CDmeMDLMakefile *pMDLMakefile );
+};
+
+
+#endif // DMEMDLPANEL_H
diff --git a/public/dme_controls/dmepanel.h b/public/dme_controls/dmepanel.h
new file mode 100644
index 0000000..e26f0ee
--- /dev/null
+++ b/public/dme_controls/dmepanel.h
@@ -0,0 +1,280 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef DMEPANEL_H
+#define DMEPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+
+#include "tier0/basetypes.h"
+#include "tier1/utlstringmap.h"
+#include "vgui_controls/EditablePanel.h"
+#include "datamodel/dmelement.h"
+#include "datamodel/dmehandle.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmElement;
+class CBaseDmePanelFactory;
+
+namespace vgui
+{
+ class Panel;
+ class EditablePanel;
+ class ComboBox;
+ class IScheme;
+}
+
+
+//-----------------------------------------------------------------------------
+// Dme Panel factory iteration handle
+//-----------------------------------------------------------------------------
+DECLARE_POINTER_HANDLE( DmeFactoryHandle_t );
+#define DMEFACTORY_HANDLE_INVALID ((DmeFactoryHandle_t)0)
+
+
+//-----------------------------------------------------------------------------
+// Dme Panel: used for editing arbitrary dme elements
+//-----------------------------------------------------------------------------
+class CDmePanel : public vgui::EditablePanel
+{
+ DECLARE_CLASS_SIMPLE( CDmePanel, vgui::EditablePanel );
+
+public:
+ // constructor, destructor
+ CDmePanel( vgui::Panel *pParent, const char *pPanelName, bool bComboBoxVisible = true );
+ virtual ~CDmePanel();
+
+ virtual void PerformLayout();
+ virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
+
+ void SetDmeElement( CDmElement *pDmeElement, bool bForce = false, const char *pPanelName = NULL );
+
+ // Switch to a new editor
+ void SetEditor( const char *pEditorName );
+
+ // Drag/drop
+ bool IsDroppable( CUtlVector< KeyValues * >& msglist );
+ void OnPanelDropped( CUtlVector< KeyValues * >& msglist );
+
+ // Refreshes the current panel owing to external change
+ // Values only means no topological change
+ void Refresh( bool bValuesOnly );
+
+ // Sets the default editor type
+ void SetDefaultEditorType( const char *pEditorType );
+
+private:
+ struct EditorPanelMap_t
+ {
+ vgui::EditablePanel *m_pEditorPanel;
+ CBaseDmePanelFactory *m_pFactory;
+ };
+
+ MESSAGE_FUNC( OnTextChanged, "TextChanged" );
+ MESSAGE_FUNC( OnDmeElementChanged, "DmeElementChanged" );
+ MESSAGE_FUNC_PARAMS( OnViewedElementChanged, "NotifyViewedElementChanged", kv );
+
+ // Copy/paste support
+ MESSAGE_FUNC( OnCut, "OnCut" );
+ MESSAGE_FUNC( OnCopy, "OnCopy" );
+ MESSAGE_FUNC( OnPaste, "OnPaste" );
+ MESSAGE_FUNC( OnPasteReference, "OnPasteReference" );
+ MESSAGE_FUNC( OnPasteInsert, "OnPasteInsert" );
+ MESSAGE_FUNC( OnEditDelete, "OnEditDelete" );
+
+ // Context menu support
+ MESSAGE_FUNC_PARAMS( OnOpenContextMenu, "OpenContextMenu", params );
+
+ // Delete cached panels
+ void DeleteCachedPanels();
+
+ // Populate editor name combo box
+ void PopulateEditorNames( const char *pPanelName = NULL );
+
+ // Deactivates the current editor
+ void DeactivateCurrentEditor();
+
+ // Post message to the dme panel
+ void PostMessageToDmePanel( const char *pMessage );
+
+ static bool CreateDmePanel( vgui::Panel *pParent, const char *pPanelName, CDmElement *pElement, const char *pEditorName, EditorPanelMap_t *pMap );
+
+ vgui::ComboBox *m_pEditorNames;
+
+ CDmeHandle< CDmElement > m_hElement;
+ CUtlStringMap< CUtlString > m_LastUsedEditorType;
+ CUtlStringMap< CUtlVector< EditorPanelMap_t > > m_EditorPanelCache;
+ vgui::EditablePanel *m_pDmeEditorPanel;
+ CUtlString m_CurrentEditorName;
+ CUtlString m_DefaultEditorType;
+};
+
+
+//-----------------------------------------------------------------------------
+// Dme Panel factory methods
+//-----------------------------------------------------------------------------
+class CBaseDmePanelFactory
+{
+public:
+ virtual vgui::EditablePanel *CreateDmePanel( vgui::Panel *pParent, const char *pPanelName, CDmElement *pElement ) = 0;
+ virtual void SetDmeElement( vgui::EditablePanel *pPanel, CDmElement *pElement ) = 0;
+
+protected:
+ // Constructor, protected because these should never be instanced directly
+ CBaseDmePanelFactory( const char *pElementType, const char *pEditorName, const char *pEditorDisplayName, bool bIsDefault, bool bIsOverride );
+
+public:
+ const char *m_pElementType;
+ const char *m_pEditorName;
+ const char *m_pEditorDisplayName;
+ bool m_bIsDefault : 1;
+ bool m_bIsOverride : 1;
+
+ CBaseDmePanelFactory *m_pNext;
+ static CBaseDmePanelFactory* s_pFirstDmePanelFactory;
+};
+
+
+template< class PanelType, class ElementType >
+class CDmePanelFactory : public CBaseDmePanelFactory
+{
+ typedef CBaseDmePanelFactory BaseClass;
+
+public:
+ // Constructor
+ CDmePanelFactory( const char *pElementType, const char *pEditorName, const char *pEditorDisplayName, bool bIsDefault, bool bIsOverride ) :
+ BaseClass( pElementType, pEditorName, pEditorDisplayName, bIsDefault, bIsOverride )
+ {
+ }
+
+ virtual vgui::EditablePanel *CreateDmePanel( vgui::Panel *pParent, const char *pPanelName, CDmElement *pElement )
+ {
+ ElementType *pTypedElement = CastElement<ElementType>( pElement );
+ Assert( pTypedElement && pElement->IsA( m_pElementType ) );
+
+ // NOTE: The panel factory assumes T contains the following method:
+ // void SetDmeElement( ElementType *pElement );
+ // You'll get compile errors about 'SetDmeElement' not being defined if not
+ PanelType *pPanel = new PanelType( pParent, pPanelName );
+ pPanel->SetDmeElement( pTypedElement );
+ return pPanel;
+ }
+
+ virtual void SetDmeElement( vgui::EditablePanel *pPanel, CDmElement *pElement )
+ {
+ PanelType *pTypedPanel = static_cast< PanelType* >( pPanel );
+ ElementType *pTypedElement = static_cast< ElementType* >( pElement );
+ pTypedPanel->SetDmeElement( pTypedElement );
+ }
+};
+
+
+template< class PanelType, class ElementType, class DisplayType >
+class CDmePanelConverterFactory : public CBaseDmePanelFactory
+{
+ typedef CBaseDmePanelFactory BaseClass;
+
+public:
+ // Constructor
+ CDmePanelConverterFactory( const char *pElementType, const char *pDisplayType, const char *pEditorName, const char *pEditorDisplayName, bool bIsDefault, bool bIsOverride ) :
+ BaseClass( pElementType, pEditorName, pEditorDisplayName, bIsDefault, bIsOverride )
+ {
+ m_pDisplayType = pDisplayType;
+ }
+
+ virtual vgui::EditablePanel *CreateDmePanel( vgui::Panel *pParent, const char *pPanelName, CDmElement *pElement )
+ {
+ ElementType *pTypedElement = CastElement<ElementType>( pElement );
+ Assert( pTypedElement && pElement->IsA( m_pElementType ) );
+
+ // NOTE: To use the converter factory, the element must implement a method
+ // CDmElement *GetDmePanelElement( const char *pDisplayType );
+ DisplayType *pDisplayElement = CastElement<DisplayType>( pTypedElement->GetDmePanelElement( m_pDisplayType ) );
+
+ // NOTE: The panel factory assumes T contains the following method:
+ // void SetDmeElement( ElementType *pElement );
+ // You'll get compile errors about 'SetDmeElement' not being defined if not
+ PanelType *pPanel = new PanelType( pParent, pPanelName );
+ pPanel->SetDmeElement( pDisplayElement );
+ return pPanel;
+ }
+
+ virtual void SetDmeElement( vgui::EditablePanel *pPanel, CDmElement *pElement )
+ {
+ PanelType *pTypedPanel = static_cast< PanelType* >( pPanel );
+ ElementType *pTypedElement = static_cast< ElementType* >( pElement );
+ DisplayType *pDisplayElement = CastElement<DisplayType>( pTypedElement->GetDmePanelElement( m_pDisplayType ) );
+ pTypedPanel->SetDmeElement( pDisplayElement );
+ }
+
+private:
+ const char *m_pDisplayType;
+};
+
+
+//-----------------------------------------------------------------------------
+// Helper macro to create the panel factory
+// IMPLEMENT_DMEPANEL_FACTORY_OVERRIDE is used by applications to override
+// DmePanels implemented in libraries
+//-----------------------------------------------------------------------------
+#define IMPLEMENT_DMEPANEL_FACTORY( _panelClassName, _dmeLookupName, _editorName, _editorDisplayName, _isDefault ) \
+ CDmePanelFactory< _panelClassName, C##_dmeLookupName > g_##_panelClassName##_##_dmeLookupName##_Factory( #_dmeLookupName, _editorName, _editorDisplayName, _isDefault, false ); \
+ _panelClassName *g_##_panelClassName##_##_dmeLookupName##LinkerHack = NULL;
+
+#define IMPLEMENT_DMEPANEL_FACTORY_OVERRIDE( _panelClassName, _dmeLookupName, _editorName, _editorDisplayName, _isDefault ) \
+ CDmePanelFactory< _panelClassName, C##_dmeLookupName > g_##_panelClassName##_##_dmeLookupName##_Factory( #_dmeLookupName, _editorName, _editorDisplayName, _isDefault, true ); \
+ _panelClassName *g_##_panelClassName##_##_dmeLookupName##LinkerHack = NULL;
+
+#define USING_DMEPANEL_FACTORY( _panelClassName, _dmeLookupName )\
+ class _panelClassName; \
+ extern _panelClassName *g_##_panelClassName##_##_dmeLookupName##LinkerHack; \
+ _panelClassName *g_##_panelClassName##_##_dmeLookupName##PullInModule = g_##_panelClassName##_##_dmeLookupName##LinkerHack;
+
+
+//-----------------------------------------------------------------------------
+// Helper macro to create the converter panel factory
+// IMPLEMENT_DMEPANEL_CONVERSION_FACTORY_OVERRIDE is used by applications to override
+// DmePanels implemented in libraries
+//-----------------------------------------------------------------------------
+#define IMPLEMENT_DMEPANEL_CONVERSION_FACTORY( _panelClassName, _dmeLookupName, _dmeDisplayName, _editorName, _editorDisplayName, _isDefault ) \
+ CDmePanelConverterFactory< _panelClassName, C##_dmeLookupName, C##_dmeDisplayName > g_##_panelClassName##_##_dmeLookupName##_Factory( #_dmeLookupName, #_dmeDisplayName, _editorName, _editorDisplayName, _isDefault, false ); \
+ _panelClassName *g_##_panelClassName##_##_dmeLookupName##LinkerHack = NULL;
+
+#define IMPLEMENT_DMEPANEL_CONVERSION_FACTORY_OVERRIDE( _panelClassName, _dmeLookupName, _dmeDisplayName, _editorName, _editorDisplayName, _isDefault ) \
+ CDmePanelConverterFactory< _panelClassName, C##_dmeLookupName, C##_dmeDisplayName > g_##_panelClassName##_##_dmeLookupName##_Factory( #_dmeLookupName, #_dmeDisplayName, _editorName, _editorDisplayName, _isDefault, true ); \
+ _panelClassName *g_##_panelClassName##_##_dmeLookupName##LinkerHack = NULL;
+
+#define USING_DMEPANEL_CONVERSION_FACTORY( _panelClassName, _dmeLookupName ) \
+ class _panelClassName; \
+ extern _panelClassName *g_##_panelClassName##_##_dmeLookupName##LinkerHack; \
+ _panelClassName *g_##_panelClassName##_##_dmeLookupName##PullInModule = g_##_panelClassName##_##_dmeLookupName##LinkerHack;
+
+
+
+//-----------------------------------------------------------------------------
+// Get Dme Factories for a particular element type
+//-----------------------------------------------------------------------------
+DmeFactoryHandle_t DmePanelFirstFactory( CDmElement *pElement = NULL );
+DmeFactoryHandle_t DmePanelNextFactory( DmeFactoryHandle_t h, CDmElement *pElement = NULL );
+const char *DmePanelFactoryName( DmeFactoryHandle_t h );
+const char *DmePanelFactoryDisplayName( DmeFactoryHandle_t h );
+const char *DmePanelFactoryElementType( DmeFactoryHandle_t h );
+bool DmePanelFactoryIsDefault( DmeFactoryHandle_t h );
+
+
+//-----------------------------------------------------------------------------
+// Dme Panel factory methods
+//-----------------------------------------------------------------------------
+vgui::EditablePanel *CreateDmePanel( vgui::Panel *pParent, const char *pPanelName, CDmElement *pElement, const char *pEditorName = NULL );
+
+
+#endif // DMEPANEL_H
diff --git a/public/dme_controls/dmepicker.h b/public/dme_controls/dmepicker.h
new file mode 100644
index 0000000..2b98adf
--- /dev/null
+++ b/public/dme_controls/dmepicker.h
@@ -0,0 +1,101 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef DMEPICKER_H
+#define DMEPICKER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "vgui_controls/EditablePanel.h"
+#include "vgui_controls/Frame.h"
+#include "datamodel/dmehandle.h"
+#include "tier1/utlstring.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+namespace vgui
+{
+ class Panel;
+ class TextEntry;
+}
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+struct DmePickerInfo_t
+{
+ DmElementHandle_t m_hElement;
+ const char *m_pChoiceString;
+};
+
+
+//-----------------------------------------------------------------------------
+// Purpose: Main app window
+//-----------------------------------------------------------------------------
+class CDmePicker : public vgui::EditablePanel
+{
+ DECLARE_CLASS_SIMPLE( CDmePicker, vgui::EditablePanel );
+
+public:
+ CDmePicker( vgui::Panel *pParent );
+ ~CDmePicker();
+
+ // overridden frame functions
+ virtual void Activate( const CUtlVector< DmePickerInfo_t >& vec );
+
+ // Forward arrow keys to the list
+ virtual void OnKeyCodePressed( vgui::KeyCode code );
+
+ // Returns the selceted DmElement
+ CDmElement *GetSelectedDme( );
+
+private:
+ void RefreshDmeList();
+
+ MESSAGE_FUNC( OnTextChanged, "TextChanged" );
+
+ vgui::TextEntry *m_pFilterList;
+ vgui::ListPanel *m_pDmeBrowser;
+ CUtlString m_Filter;
+
+ friend class CDmePickerFrame;
+};
+
+
+//-----------------------------------------------------------------------------
+// Purpose: Main app window
+//-----------------------------------------------------------------------------
+class CDmePickerFrame : public vgui::Frame
+{
+ DECLARE_CLASS_SIMPLE( CDmePickerFrame, vgui::Frame );
+
+public:
+ CDmePickerFrame( vgui::Panel *pParent, const char *pTitle );
+ ~CDmePickerFrame();
+
+ // Inherited from Frame
+ virtual void OnCommand( const char *pCommand );
+
+ // Purpose: Activate the dialog
+ // the message "DmeSelected" will be sent if one was picked
+ // Pass in a message to add as a subkey to the DmeSelected message
+ void DoModal( const CUtlVector< DmePickerInfo_t >& vec, KeyValues *pContextKeyValues = NULL );
+
+private:
+ void CleanUpMessage();
+
+ CDmePicker *m_pPicker;
+ vgui::Button *m_pOpenButton;
+ vgui::Button *m_pCancelButton;
+ KeyValues *m_pContextKeyValues;
+};
+
+
+#endif // DMEPICKER_H
diff --git a/public/dme_controls/dmepresetgroupeditorpanel.h b/public/dme_controls/dmepresetgroupeditorpanel.h
new file mode 100644
index 0000000..71d9e1b
--- /dev/null
+++ b/public/dme_controls/dmepresetgroupeditorpanel.h
@@ -0,0 +1,178 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================
+
+#ifndef PRESETGROUPEDITORPANEL_H
+#define PRESETGROUPEDITORPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "tier1/utlvector.h"
+#include "vgui_controls/Frame.h"
+#include "datamodel/dmehandle.h"
+#include "vgui_controls/fileopenstatemachine.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmeAnimationSet;
+class CDmePresetListPanel;
+class CDmePresetGroupListPanel;
+class CDmePresetGroup;
+class CDmePreset;
+namespace vgui
+{
+ class PropertySheet;
+ class PropertyPage;
+ class Button;
+}
+
+
+//-----------------------------------------------------------------------------
+// Dag editor panel
+//-----------------------------------------------------------------------------
+class CDmePresetGroupEditorPanel : public vgui::EditablePanel, public vgui::IFileOpenStateMachineClient
+{
+ DECLARE_CLASS_SIMPLE( CDmePresetGroupEditorPanel, vgui::EditablePanel );
+
+public:
+ // constructor, destructor
+ CDmePresetGroupEditorPanel( vgui::Panel *pParent, const char *pName );
+ virtual ~CDmePresetGroupEditorPanel();
+
+ // Sets the current scene + animation list
+ void SetAnimationSet( CDmeAnimationSet *pAnimationSet );
+ CDmeAnimationSet *GetAnimationSet();
+
+ void RefreshAnimationSet();
+ void NotifyDataChanged();
+
+ // Returns selected presets/groups
+ CDmePresetGroup* GetSelectedPresetGroup( );
+ CDmePreset* GetSelectedPreset( );
+
+ // Drag/drop reordering of preset groups
+ void MovePresetGroupInFrontOf( CDmePresetGroup *pDragGroup, CDmePresetGroup *pDropGroup );
+
+ // Drag/drop reordering of presets
+ void MovePresetInFrontOf( CDmePreset *pDragPreset, CDmePreset *pDropPreset );
+
+ // Drag/drop preset moving
+ void MovePresetIntoGroup( CDmePreset *pPreset, CDmePresetGroup *pGroup );
+
+ // Toggle group visibility
+ void ToggleGroupVisibility( CDmePresetGroup *pPresetGroup );
+
+ MESSAGE_FUNC( OnMovePresetUp, "MovePresetUp" );
+ MESSAGE_FUNC( OnMovePresetDown, "MovePresetDown" );
+ MESSAGE_FUNC( OnMoveGroupUp, "MoveGroupUp" );
+ MESSAGE_FUNC( OnMoveGroupDown, "MoveGroupDown" );
+ MESSAGE_FUNC( OnRemoveGroup, "RemoveGroup" );
+ MESSAGE_FUNC( OnRemovePreset, "RemovePreset" );
+
+ // Inherited from IFileOpenStateMachineClient
+ virtual void SetupFileOpenDialog( vgui::FileOpenDialog *pDialog, bool bOpenFile, const char *pFileFormat, KeyValues *pContextKeyValues );
+ virtual bool OnReadFileFromDisk( const char *pFileName, const char *pFileFormat, KeyValues *pContextKeyValues );
+ virtual bool OnWriteFileToDisk( const char *pFileName, const char *pFileFormat, KeyValues *pContextKeyValues );
+
+private:
+ MESSAGE_FUNC_PARAMS( OnOpenContextMenu, "OpenContextMenu", kv );
+ MESSAGE_FUNC_PARAMS( OnInputCompleted, "InputCompleted", kv );
+ MESSAGE_FUNC( OnAddGroup, "AddGroup" );
+ MESSAGE_FUNC( OnAddPhonemeGroup, "AddPhonemeGroup" );
+ MESSAGE_FUNC( OnRenameGroup, "RenameGroup" );
+ MESSAGE_FUNC( OnEditPresetRemapping, "EditPresetRemapping" );
+ MESSAGE_FUNC( OnRemoveDefaultControls, "RemoveDefaultControls" );
+ MESSAGE_FUNC( OnRemapPresets, "RemapPresets" );
+ MESSAGE_FUNC( OnAddPreset, "AddPreset" );
+ MESSAGE_FUNC( OnRenamePreset, "RenamePreset" );
+ MESSAGE_FUNC( OnToggleGroupVisibility, "ToggleGroupVisibility" );
+ MESSAGE_FUNC( OnToggleGroupSharing, "ToggleGroupSharing" );
+ MESSAGE_FUNC_PARAMS( OnItemSelected, "ItemSelected", kv );
+ MESSAGE_FUNC_PARAMS( OnItemDeselected, "ItemDeselected", kv );
+ MESSAGE_FUNC( OnImportPresets, "ImportPresets" );
+ MESSAGE_FUNC( OnExportPresets, "ExportPresets" );
+ MESSAGE_FUNC( OnImportPresetGroups, "ImportPresetGroups" );
+ MESSAGE_FUNC( OnExportPresetGroups, "ExportPresetGroups" );
+ MESSAGE_FUNC( OnExportPresetGroupToVFE, "ExportPresetGroupsToVFE" );
+ MESSAGE_FUNC( OnExportPresetGroupToTXT, "ExportPresetGroupsToTXT" );
+ MESSAGE_FUNC_PARAMS( OnPresetPicked, "PresetPicked", params );
+ MESSAGE_FUNC_PARAMS( OnPresetPickCancelled, "PresetPickCancelled", params );
+ MESSAGE_FUNC_PARAMS( OnFileStateMachineFinished, "FileStateMachineFinished", params );
+
+ // Cleans up the context menu
+ void CleanupContextMenu();
+
+ // If it finds a duplicate group/preset name, reports an error message and returns it found one
+ bool HasDuplicatePresetName( const char *pPresetName, CDmePreset *pIgnorePreset = NULL );
+ bool HasDuplicateGroupName( const char *pControlName, CDmePresetGroup *pIgnoreGroup = NULL );
+
+ // Refreshes the list of presets
+ void RefreshPresetNames( );
+
+ // Called by OnInputCompleted after we get a new group or preset name
+ void PerformAddGroup( const char *pNewGroupName );
+ void PerformAddPhonemeGroup( const char *pNewGroupName );
+ void PerformRenameGroup( const char *pNewGroupName );
+ void PerformAddPreset( const char *pNewPresetName );
+ void PerformRenamePreset( const char *pNewPresetName );
+
+ // Called to open a context-sensitive menu for a particular preset
+ void OnOpenPresetContextMenu( );
+
+ // Gets/sets a selected preset
+ void SetSelectedPreset( CDmePreset* pPreset );
+
+ // Selects a particular preset group
+ void SetSelectedPresetGroup( CDmePresetGroup* pPresetGroup );
+
+ // Imports presets
+ void ImportPresets( const CUtlVector< CDmePreset * >& presets );
+
+ CDmeHandle< CDmeAnimationSet > m_hAnimationSet;
+ vgui::Splitter *m_pSplitter;
+ CDmePresetGroupListPanel *m_pPresetGroupList;
+ CDmePresetListPanel *m_pPresetList;
+ vgui::DHANDLE< vgui::Menu > m_hContextMenu;
+ vgui::DHANDLE< vgui::FileOpenStateMachine > m_hFileOpenStateMachine;
+};
+
+
+//-----------------------------------------------------------------------------
+// Frame for combination system
+//-----------------------------------------------------------------------------
+class CDmePresetGroupEditorFrame : public vgui::Frame, public IDmNotify
+{
+ DECLARE_CLASS_SIMPLE( CDmePresetGroupEditorFrame, vgui::Frame );
+
+public:
+ CDmePresetGroupEditorFrame( vgui::Panel *pParent, const char *pTitle );
+ ~CDmePresetGroupEditorFrame();
+
+ // Sets the current scene + animation list
+ void SetAnimationSet( CDmeAnimationSet *pAnimationSet );
+
+ // Inherited from IDmNotify
+ virtual void NotifyDataChanged( const char *pReason, int nNotifySource, int nNotifyFlags );
+
+private:
+ MESSAGE_FUNC( OnPresetsChanged, "PresetsChanged" );
+ MESSAGE_FUNC_PARAMS( OnAddNewPreset, "AddNewPreset", params );
+ KEYBINDING_FUNC( undo, KEY_Z, vgui::MODIFIER_CONTROL, OnUndo, "#undo_help", 0 );
+ KEYBINDING_FUNC( redo, KEY_Z, vgui::MODIFIER_CONTROL | vgui::MODIFIER_SHIFT, OnRedo, "#redo_help", 0 );
+
+ // Inherited from Frame
+ virtual void OnCommand( const char *pCommand );
+
+ CDmePresetGroupEditorPanel *m_pEditor;
+ vgui::Button *m_pOkButton;
+};
+
+
+#endif // PRESETGROUPEDITORPANEL_H \ No newline at end of file
diff --git a/public/dme_controls/filtercombobox.h b/public/dme_controls/filtercombobox.h
new file mode 100644
index 0000000..81e47cf
--- /dev/null
+++ b/public/dme_controls/filtercombobox.h
@@ -0,0 +1,32 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef FILTERCOMBOBOX_H
+#define FILTERCOMBOBOX_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "vgui_controls/combobox.h"
+
+
+//-----------------------------------------------------------------------------
+// Combo box that adds entry to its history when focus is lost
+//-----------------------------------------------------------------------------
+class CFilterComboBox : public vgui::ComboBox
+{
+ DECLARE_CLASS_SIMPLE( CFilterComboBox, vgui::ComboBox );
+
+public:
+ CFilterComboBox( Panel *parent, const char *panelName, int numLines, bool allowEdit );
+ virtual void OnKillFocus();
+};
+
+
+#endif // FILTERCOMBOBOX_H
+
+
diff --git a/public/dme_controls/inotifyui.h b/public/dme_controls/inotifyui.h
new file mode 100644
index 0000000..c21f38d
--- /dev/null
+++ b/public/dme_controls/inotifyui.h
@@ -0,0 +1,134 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================
+
+#ifndef INOTIFYUI_H
+#define INOTIFYUI_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "tier1/utlvector.h"
+#include "datamodel/idatamodel.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmElement;
+
+
+//-----------------------------------------------------------------------------
+// Interface used to allow tools to deal with dynamic choice lists
+//-----------------------------------------------------------------------------
+struct IntChoice_t
+{
+ int m_nValue;
+ const char *m_pChoiceString;
+};
+
+struct StringChoice_t
+{
+ const char *m_pValue;
+ const char *m_pChoiceString;
+};
+
+struct ElementChoice_t
+{
+ ElementChoice_t() {}
+ ElementChoice_t( CDmElement *pValue, const char *pChoiceString = NULL ) : m_pValue( pValue ), m_pChoiceString( pChoiceString ) {}
+ CDmElement *m_pValue;
+ const char *m_pChoiceString;
+};
+
+typedef CUtlVector<IntChoice_t> IntChoiceList_t;
+typedef CUtlVector<StringChoice_t> StringChoiceList_t;
+typedef CUtlVector<ElementChoice_t> ElementChoiceList_t;
+
+
+//-----------------------------------------------------------------------------
+// Interface used to call back out of the element properties panels
+// to communicate with external systems
+//-----------------------------------------------------------------------------
+enum DmeControlsNotifySource_t
+{
+ NOTIFY_SOURCE_PROPERTIES_TREE = NOTIFY_SOURCE_FIRST_DME_CONTROL_SOURCE,
+ NOTIFY_SOURCE_FILE_LIST_MANAGER,
+ NOTIFY_SOURCE_PRESET_GROUP_EDITOR,
+};
+
+
+//-----------------------------------------------------------------------------
+// Utility scope guards
+//-----------------------------------------------------------------------------
+DEFINE_SOURCE_UNDO_SCOPE_GUARD( ElementTree, NOTIFY_SOURCE_PROPERTIES_TREE );
+DEFINE_SOURCE_NOTIFY_SCOPE_GUARD( ElementTree, NOTIFY_SOURCE_PROPERTIES_TREE );
+
+
+class IElementPropertiesChoices
+{
+public:
+ // For boolean choice lists. Return false if it's an unknown choice list type
+ // Element, attribute specifies the attribute we're editing.
+ // bArray element is true if the attribute is an array attribute and we're editing one of its elements
+ virtual bool GetBoolChoiceList( const char *pChoiceListType, CDmElement *pElement,
+ const char *pAttributeName, bool bArrayElement, const char *pChoiceStrings[2] ) = 0;
+
+ // For integer choice lists. Return false if it's an unknown choice list type
+ virtual bool GetIntChoiceList( const char *pChoiceListType, CDmElement *pElement,
+ const char *pAttributeName, bool bArrayElement, IntChoiceList_t &list ) = 0;
+
+ // For string choice lists. Return false if it's an unknown choice list type
+ virtual bool GetStringChoiceList( const char *pChoiceListType, CDmElement *pElement,
+ const char *pAttributeName, bool bArrayElement, StringChoiceList_t &list ) = 0;
+
+ // For element choice lists. Return false if it's an unknown choice list type
+ virtual bool GetElementChoiceList( const char *pChoiceListType, CDmElement *pElement,
+ const char *pAttributeName, bool bArrayElement, ElementChoiceList_t &list ) = 0;
+
+ virtual const char *GetElementChoiceString( const char *pChoiceListType, CDmElement *pElement,
+ const char *pAttributeName, bool bArrayElement, CDmElement *pValue ) = 0;
+};
+
+
+//-----------------------------------------------------------------------------
+// Default implementation of IElementPropertiesChoices
+//-----------------------------------------------------------------------------
+class CBaseElementPropertiesChoices : public IElementPropertiesChoices
+{
+public:
+ virtual bool GetBoolChoiceList( const char *pChoiceListType, CDmElement *pElement,
+ const char *pAttributeName, bool bArrayElement, const char *pChoiceStrings[2] )
+ {
+ return false;
+ }
+
+ virtual bool GetIntChoiceList( const char *pChoiceListType, CDmElement *pElement,
+ const char *pAttributeName, bool bArrayElement, IntChoiceList_t &list )
+ {
+ return false;
+ }
+
+ virtual bool GetStringChoiceList( const char *pChoiceListType, CDmElement *pElement,
+ const char *pAttributeName, bool bArrayElement, StringChoiceList_t &list )
+ {
+ return false;
+ }
+
+ virtual bool GetElementChoiceList( const char *pChoiceListType, CDmElement *pElement,
+ const char *pAttributeName, bool bArrayElement, ElementChoiceList_t &list )
+ {
+ return false;
+ }
+ virtual const char *GetElementChoiceString( const char *pChoiceListType, CDmElement *pElement,
+ const char *pAttributeName, bool bArrayElement, CDmElement *pValue )
+ {
+ return NULL;
+ }
+};
+
+#endif // INOTIFYUI_H \ No newline at end of file
diff --git a/public/dme_controls/particlesystempanel.h b/public/dme_controls/particlesystempanel.h
new file mode 100644
index 0000000..7401dab
--- /dev/null
+++ b/public/dme_controls/particlesystempanel.h
@@ -0,0 +1,174 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//===========================================================================//
+
+#ifndef DMEPARTICLEPANEL_H
+#define DMEPARTICLEPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "matsys_controls/PotteryWheelPanel.h"
+#include "datamodel/dmattributetypes.h"
+#include "particles/particles.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class IMaterial;
+class CMeshBuilder;
+class Vector;
+class CParticleCollection;
+class CColorPickerButton;
+class CDmeParticleSystemDefinition;
+class CDmeParticleFunction;
+class CControlPointPage;
+
+namespace vgui
+{
+ class ScrollBar;
+ class IScheme;
+ class PropertyPage;
+ class PropertySheet;
+ class Splitter;
+ class Label;
+ class TextEntry;
+}
+
+
+//-----------------------------------------------------------------------------
+// Particle System Viewer Panel
+//-----------------------------------------------------------------------------
+class CParticleSystemPanel : public CPotteryWheelPanel
+{
+ DECLARE_CLASS_SIMPLE( CParticleSystemPanel, CPotteryWheelPanel );
+
+public:
+ // constructor, destructor
+ CParticleSystemPanel( vgui::Panel *pParent, const char *pName );
+ virtual ~CParticleSystemPanel();
+
+ // Set the particle system to draw
+ void SetParticleSystem( CDmeParticleSystemDefinition *pDef );
+ void SetDmeElement( CDmeParticleSystemDefinition *pDef );
+
+ CParticleCollection *GetParticleSystem();
+
+ // Indicates that bounds should be drawn
+ void RenderBounds( bool bEnable );
+
+ // Indicates that cull sphere should be drawn
+ void RenderCullBounds( bool bEnable );
+
+ // Indicates that helpers should be drawn
+ void RenderHelpers( bool bEnable );
+
+ // Indicates which helper to draw
+ void SetRenderedHelper( CDmeParticleFunction *pOp );
+
+ virtual void OnTick();
+ virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
+
+ // Accessor for control point values
+ const Vector& GetControlPointValue( int nControlPoint ) const;
+ void SetControlPointValue( int nControlPoint, const Vector &value );
+
+private:
+ // Shutdown, startup particle collection
+ void StartupParticleCollection();
+ void ShutdownParticleCollection();
+
+ // Draw bounds
+ void DrawBounds();
+ void DrawCullBounds();
+
+ // paint it!
+ virtual void OnPaint3D();
+
+private:
+ bool m_bRenderBounds : 1;
+ bool m_bRenderCullBounds : 1;
+ bool m_bRenderHelpers : 1;
+ bool m_bPerformNameBasedLookup : 1;
+
+ Vector m_pControlPointValue[MAX_PARTICLE_CONTROL_POINTS];
+
+ DmObjectId_t m_RenderHelperId;
+ float m_flLastTime;
+
+ // Stores the id or name of the particle system being viewed
+ DmObjectId_t m_ParticleSystemId;
+ CUtlString m_ParticleSystemName;
+
+ // The particle system to draw
+ CParticleCollection *m_pParticleSystem;
+
+ // A texture to use for a lightmap
+ CTextureReference m_pLightmapTexture;
+
+ // The default env_cubemap
+ CTextureReference m_DefaultEnvCubemap;
+};
+
+
+//-----------------------------------------------------------------------------
+// Accessor for control point values
+//-----------------------------------------------------------------------------
+inline const Vector& CParticleSystemPanel::GetControlPointValue( int nControlPoint ) const
+{
+ return m_pControlPointValue[nControlPoint];
+}
+
+inline void CParticleSystemPanel::SetControlPointValue( int nControlPoint, const Vector &value )
+{
+ m_pControlPointValue[nControlPoint] = value;
+}
+
+
+//-----------------------------------------------------------------------------
+// This panel has a particle system viewer as well as controls
+//-----------------------------------------------------------------------------
+class CParticleSystemPreviewPanel : public vgui::EditablePanel
+{
+ DECLARE_CLASS_SIMPLE( CParticleSystemPreviewPanel, vgui::EditablePanel );
+
+public:
+ // constructor, destructor
+ CParticleSystemPreviewPanel( vgui::Panel *pParent, const char *pName );
+ virtual ~CParticleSystemPreviewPanel();
+
+ // Set the material to draw
+ void SetParticleSystem( CDmeParticleSystemDefinition *pDef );
+ void SetParticleFunction( CDmeParticleFunction *pFunction );
+ void SetDmeElement( CDmeParticleSystemDefinition *pDef );
+ virtual void OnThink();
+
+private:
+ MESSAGE_FUNC_PARAMS( OnCheckButtonChecked, "CheckButtonChecked", params );
+ MESSAGE_FUNC_PARAMS( OnBackgroundColorChanged, "ColorPickerPicked", params );
+ MESSAGE_FUNC_PARAMS( OnBackgroundColorPreview, "ColorPickerPreview", params );
+ MESSAGE_FUNC_PARAMS( OnBackgroundColorCancel, "ColorPickerCancel", params );
+ MESSAGE_FUNC( OnParticleSystemReconstructed, "ParticleSystemReconstructed" );
+
+ vgui::Splitter *m_Splitter;
+ CParticleSystemPanel *m_pParticleSystemPanel;
+ vgui::PropertySheet *m_pControlSheet;
+ vgui::PropertyPage *m_pRenderPage;
+ CControlPointPage *m_pControlPointPage;
+
+ vgui::CheckButton *m_pRenderCullBounds;
+ vgui::CheckButton *m_pRenderBounds;
+ vgui::CheckButton *m_pRenderHelpers;
+ CColorPickerButton *m_pBackgroundColor;
+ vgui::Label *m_pParticleCount;
+};
+
+
+
+#endif // DMEPARTICLEPANEL_H
+ \ No newline at end of file
diff --git a/public/dme_controls/particlesystempropertiespanel.h b/public/dme_controls/particlesystempropertiespanel.h
new file mode 100644
index 0000000..1f02a9a
--- /dev/null
+++ b/public/dme_controls/particlesystempropertiespanel.h
@@ -0,0 +1,84 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: Dialog used to edit properties of a particle system definition
+//
+//===========================================================================//
+
+#ifndef PARTICLESYSTEMPROPERTIESPANEL_H
+#define PARTICLESYSTEMPROPERTIESPANEL_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "vgui_controls/EditablePanel.h"
+#include "tier1/utlstring.h"
+#include "datamodel/dmehandle.h"
+#include "particles/particles.h"
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmeParticleSystemDefinition;
+class CParticleFunctionBrowser;
+class CDmeElementPanel;
+
+namespace vgui
+{
+ class Splitter;
+ class ComboBox;
+}
+
+
+//-----------------------------------------------------------------------------
+// Used by the panel to discover the list of known particle system definitions
+//-----------------------------------------------------------------------------
+class IParticleSystemPropertiesPanelQuery
+{
+public:
+ virtual void GetKnownParticleDefinitions( CUtlVector< CDmeParticleSystemDefinition* > &definitions ) = 0;
+};
+
+
+//-----------------------------------------------------------------------------
+// Panel used to edit a particle system definition
+//-----------------------------------------------------------------------------
+class CParticleSystemPropertiesPanel : public vgui::EditablePanel
+{
+ DECLARE_CLASS_SIMPLE( CParticleSystemPropertiesPanel, vgui::EditablePanel );
+
+ // Sends the message 'ParticleSystemModified' when the particle system was modified in any way
+ // Sends the message 'ParticleFunctionSelChanged' when the selected particle function changed
+ // -- stores the selected CDmeParticleFunction in a subkey called 'function'
+
+public:
+ CParticleSystemPropertiesPanel( IParticleSystemPropertiesPanelQuery *pQuery, vgui::Panel* pParent ); // standard constructor
+
+ // Sets the particle system to look at
+ void SetParticleSystem( CDmeParticleSystemDefinition *pParticleSystem );
+
+ // Refreshes display
+ void Refresh( bool bValuesOnly = true );
+
+private:
+ // For inheriting classes to get notified without having to listen to messages
+ virtual void OnParticleSystemModified() {}
+
+ MESSAGE_FUNC( OnTextChanged, "TextChanged" );
+ MESSAGE_FUNC_PARAMS( OnDmeElementChanged, "DmeElementChanged", params );
+ MESSAGE_FUNC( OnParticleSystemModifiedInternal, "ParticleSystemModified" );
+ MESSAGE_FUNC_PARAMS( OnParticleFunctionSelChanged, "ParticleFunctionSelChanged", params );
+
+ IParticleSystemPropertiesPanelQuery *m_pQuery;
+
+ vgui::Splitter *m_pSplitter;
+ vgui::ComboBox *m_pFunctionTypeCombo;
+ vgui::EditablePanel *m_pFunctionBrowserArea;
+ CParticleFunctionBrowser *m_pParticleFunctionBrowser[PARTICLE_FUNCTION_COUNT];
+
+ CDmeElementPanel *m_pParticleFunctionProperties;
+
+ CDmeHandle< CDmeParticleSystemDefinition > m_hParticleSystem;
+};
+
+
+#endif // PARTICLESYSTEMPROPERTIESPANEL_H
diff --git a/public/dme_controls/presetpicker.h b/public/dme_controls/presetpicker.h
new file mode 100644
index 0000000..29b3b13
--- /dev/null
+++ b/public/dme_controls/presetpicker.h
@@ -0,0 +1,55 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: Dialog used to edit properties of a particle system definition
+//
+//===========================================================================//
+
+#ifndef PRESETPICKER_H
+#define PRESETPICKER_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "vgui_controls/Frame.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CDmElement;
+
+using namespace vgui;
+
+
+//-----------------------------------------------------------------------------
+//
+// Purpose: Picker for animation set presets
+//
+//-----------------------------------------------------------------------------
+class CPresetPickerFrame : public vgui::Frame
+{
+ DECLARE_CLASS_SIMPLE( CPresetPickerFrame, vgui::Frame );
+
+public:
+ CPresetPickerFrame( vgui::Panel *pParent, const char *pTitle, bool bAllowMultiSelect = true );
+ ~CPresetPickerFrame();
+
+ // Shows the modal dialog
+ void DoModal( CDmElement *pPresetGroup, bool bSelectAll, KeyValues *pContextKeyValues );
+
+ // Inherited from Frame
+ virtual void OnCommand( const char *pCommand );
+
+private:
+ // Refreshes the list of presets
+ void RefreshPresetList( CDmElement *pPresetGroup, bool bSelectAll );
+ void CleanUpMessage();
+
+ vgui::ListPanel *m_pPresetList;
+ vgui::Button *m_pOpenButton;
+ vgui::Button *m_pCancelButton;
+ KeyValues *m_pContextKeyValues;
+};
+
+#endif // PRESETPICKER_H
diff --git a/public/dme_controls/soundpicker.h b/public/dme_controls/soundpicker.h
new file mode 100644
index 0000000..401c8e3
--- /dev/null
+++ b/public/dme_controls/soundpicker.h
@@ -0,0 +1,123 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef SOUNDPICKER_H
+#define SOUNDPICKER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "matsys_controls/BaseAssetPicker.h"
+#include "vgui_controls/Frame.h"
+#include "datamodel/dmehandle.h"
+#include "tier1/utlstring.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+namespace vgui
+{
+ class Panel;
+}
+
+
+//-----------------------------------------------------------------------------
+// Purpose: Sound picker panel
+//-----------------------------------------------------------------------------
+class CSoundPicker : public CBaseAssetPicker
+{
+ DECLARE_CLASS_SIMPLE( CSoundPicker, CBaseAssetPicker );
+
+public:
+ enum PickType_t
+ {
+ PICK_NONE = 0,
+ PICK_GAMESOUNDS = 0x1,
+ PICK_WAVFILES = 0x2,
+ PICK_ALL = 0x7FFFFFFF,
+
+ ALLOW_MULTISELECT = 0x80000000,
+ };
+
+ CSoundPicker( vgui::Panel *pParent, int nFlags );
+ ~CSoundPicker();
+
+ // overridden frame functions
+ virtual void Activate();
+
+ // Forward arrow keys to the list
+ virtual void OnKeyCodePressed( vgui::KeyCode code );
+
+ // Sets the current sound choice
+ void SetSelectedSound( PickType_t type, const char *pSoundName );
+
+ // Returns the selceted sound name
+ PickType_t GetSelectedSoundType();
+ const char *GetSelectedSoundName( int nSelectionIndex = -1 );
+ int GetSelectedSoundCount();
+
+private:
+ // Purpose: Called when a page is shown
+ void RequestGameSoundFilterFocus( );
+
+ // Updates the column header in the chooser
+ void UpdateGameSoundColumnHeader( int nMatchCount, int nTotalCount );
+
+ void BuildGameSoundList();
+ void RefreshGameSoundList();
+ void PlayGameSound( const char *pSoundName );
+ void PlayWavSound( const char *pSoundName );
+ void StopSoundPreview( );
+ void OnGameSoundFilterTextChanged( );
+
+ // Derived classes have this called when the previewed asset changes
+ void OnSelectedAssetPicked( const char *pAssetName );
+
+ // Don't play a sound when the next selection is a default selection
+ void OnNextSelectionIsDefault();
+
+ // Purpose: builds the gamesound list
+ bool IsGameSoundVisible( int hGameSound );
+
+ MESSAGE_FUNC_PARAMS( OnTextChanged, "TextChanged", kv );
+ MESSAGE_FUNC_PARAMS( OnItemSelected, "ItemSelected", kv );
+ MESSAGE_FUNC( OnPageChanged, "PageChanged" );
+
+ vgui::TextEntry *m_pGameSoundFilter;
+ vgui::PropertySheet *m_pViewsSheet;
+ vgui::PropertyPage *m_pGameSoundPage;
+ vgui::PropertyPage *m_pWavPage;
+ vgui::ListPanel *m_pGameSoundList;
+ CUtlString m_GameSoundFilter;
+ int m_nPlayingSound;
+ unsigned char m_nSoundSuppressionCount;
+
+ friend class CSoundPickerFrame;
+};
+
+
+//-----------------------------------------------------------------------------
+// Purpose: Modal sound picker window
+//-----------------------------------------------------------------------------
+class CSoundPickerFrame : public CBaseAssetPickerFrame
+{
+ DECLARE_CLASS_SIMPLE( CSoundPickerFrame, CBaseAssetPickerFrame );
+
+public:
+ CSoundPickerFrame( vgui::Panel *pParent, const char *pTitle, int nFlags );
+ virtual ~CSoundPickerFrame();
+
+ // Purpose: Activate the dialog
+ // The message "SoundSelected" will be sent if a sound is picked
+ // Pass in optional context keyvalues to be added to any messages sent by the sound picker
+ void DoModal( CSoundPicker::PickType_t initialType, const char *pInitialValue, KeyValues *pContextKeyValues = NULL );
+
+ virtual void OnCommand( const char *pCommand );
+};
+
+
+#endif // SOUNDPICKER_H
diff --git a/public/dme_controls/soundrecordpanel.h b/public/dme_controls/soundrecordpanel.h
new file mode 100644
index 0000000..7162efc
--- /dev/null
+++ b/public/dme_controls/soundrecordpanel.h
@@ -0,0 +1,66 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef SOUNDRECORDPANEL_H
+#define SOUNDRECORDPANEL_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "vgui_controls/Frame.h"
+#include "tier1/utlstring.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+namespace vgui
+{
+ class Button;
+}
+
+
+//-----------------------------------------------------------------------------
+// Purpose: Modal sound picker window
+//-----------------------------------------------------------------------------
+class CSoundRecordPanel : public vgui::Frame
+{
+ DECLARE_CLASS_SIMPLE( CSoundRecordPanel, vgui::Frame );
+
+public:
+ CSoundRecordPanel( vgui::Panel *pParent, const char *pTitle );
+ ~CSoundRecordPanel();
+
+ // Inherited from Frame
+ virtual void OnCommand( const char *pCommand );
+ virtual void OnTick();
+
+ // Purpose: Activate the dialog
+ // The message "SoundRecorded" will be sent if a sound is recorded
+ void DoModal( const char *pFileName );
+
+private:
+ void StopSoundPreview( );
+ void PlaySoundPreview( );
+
+ // Updates sound record time during recording
+ void UpdateTimeRecorded();
+
+ vgui::Button *m_pRecordButton;
+ vgui::Button *m_pPlayButton;
+ vgui::Button *m_pOkButton;
+ vgui::Button *m_pCancelButton;
+ vgui::TextEntry *m_pRecordTime;
+ vgui::TextEntry *m_pFileName;
+ CUtlString m_FileName;
+ CUtlString m_EngineFileName;
+ int m_nPlayingSound;
+ float m_flRecordStartTime;
+ bool m_bIsRecording;
+};
+
+
+#endif // SOUNDRECORDPANEL_H