1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#include "mdmpRipper.h"
#include "vgui_controls/MessageMap.h"
#include "vgui_controls/MenuBar.h"
#include "vgui_controls/Menu.h"
#include "tier1/KeyValues.h"
#include "vgui/ISurface.h"
#include "vgui_controls/Frame.h"
#include "vgui_controls/FileOpenDialog.h"
#include "vgui_controls/MenuButton.h"
#include "CMDModulePanel.h"
#include "CMDErrorPanel.h"
using namespace vgui;
//-----------------------------------------------------------------------------
// Test panel
//-----------------------------------------------------------------------------
class CVGuiTestPanel : public vgui::Panel
{
DECLARE_CLASS_SIMPLE( CVGuiTestPanel, vgui::Panel );
public:
CVGuiTestPanel( vgui::Panel *pParent, const char *pName );
virtual void PerformLayout();
private:
MESSAGE_FUNC( OnOpen, "Open" );
MESSAGE_FUNC( OnError, "Error" );
MESSAGE_FUNC_PARAMS( OnCompare, "compare", data );
MESSAGE_FUNC_CHARPTR( OnFileSelected, "FileSelected", fullpath );
void CVGuiTestPanel::MiniDumpCompare( CUtlVector<HANDLE> *pMiniDumpHandles );
vgui::MenuBar *m_pMenuBar;
vgui::Panel *m_pClientArea;
// void OnFileSelected( const char * filename );
};
//-----------------------------------------------------------------------------
// Class factory
//-----------------------------------------------------------------------------
vgui::Panel *CreateVGuiTestPanel( const char *pName )
{
CVGuiTestPanel *pVGuiTestPanel = new CVGuiTestPanel( NULL, pName );
// pVGuiTestPanel->SetParent( g_pVGuiSurface->GetEmbeddedPanel() );
return pVGuiTestPanel;
}
//-----------------------------------------------------------------------------
// Constructor
//-----------------------------------------------------------------------------
CVGuiTestPanel::CVGuiTestPanel( vgui::Panel *pParent, const char *pName ) : BaseClass( NULL, pName )
{
// Create the menu bar
m_pMenuBar = new vgui::MenuBar( this, "Main Menu Bar" );
m_pMenuBar->SetSize( 10, 28 );
// Create a test menu
Menu *pFileMenu = new Menu(NULL, "File");
pFileMenu->AddMenuItem( "&Open", new KeyValues( "Open" ), this );
m_pMenuBar->AddMenu( "&File", pFileMenu );
Menu *pErrorMenu = new Menu(NULL, "Error");
pErrorMenu->AddMenuItem( "&Error", new KeyValues("Error"), this);
m_pMenuBar->AddMenu( "&Error", pErrorMenu );
MenuButton *pCloseButton = new vgui::MenuButton( this, "Close", "X" );
m_pMenuBar->AddButton( pCloseButton );
// Area below the menu bar
m_pClientArea = new vgui::Panel( this, "VGuiTest Client Area ");
}
//-----------------------------------------------------------------------------
// Test menu button
//-----------------------------------------------------------------------------
void CVGuiTestPanel::OnOpen()
{
FileOpenDialog *pFileDialog = new FileOpenDialog ( this, "File Open", true);
pFileDialog->AddActionSignalTarget(this);
pFileDialog->AddFilter( "*.mdmp", "MiniDumps", true );
pFileDialog->DoModal( false );
}
void CVGuiTestPanel::OnError()
{
CMDErrorPanel *pPanel = new CMDErrorPanel( this, "MDError Panel" );
pPanel->Create();
pPanel->AddActionSignalTarget( this );
pPanel->DoModal();
}
//-----------------------------------------------------------------------------
// The editor panel should always fill the space...
//-----------------------------------------------------------------------------
void CVGuiTestPanel::PerformLayout()
{
// Make the editor panel fill the space
int iWidth, iHeight;
vgui::VPANEL parent = GetParent() ? GetParent()->GetVPanel() : vgui::surface()->GetEmbeddedPanel();
vgui::ipanel()->GetSize( parent, iWidth, iHeight );
SetSize( iWidth, iHeight );
m_pMenuBar->SetSize( iWidth, 28 );
// Make the client area also fill the space not used by the menu bar
int iTemp, iMenuHeight;
m_pMenuBar->GetSize( iTemp, iMenuHeight );
m_pClientArea->SetPos( 0, iMenuHeight );
m_pClientArea->SetSize( iWidth, iHeight - iMenuHeight );
}
void CVGuiTestPanel::OnCompare( KeyValues *data )
{
int test = data->GetInt( "handlePointer" );
CUtlVector<HANDLE> *pMiniDumpHandles = (CUtlVector<HANDLE> *)(void *)test;
CUtlVector<CMiniDumpObject *> miniDumps;
for( int i = 0; i < pMiniDumpHandles->Count(); i++ )
{
miniDumps.AddToTail( new CMiniDumpObject( pMiniDumpHandles->Element( i ) ) );
}
CMDModulePanel *pPanel = new CMDModulePanel( this, "MDModule Panel" );
pPanel->Create( &miniDumps );
pPanel->DoModal();
miniDumps.RemoveAll();
pMiniDumpHandles->RemoveAll();
}
void CVGuiTestPanel::OnFileSelected( const char *filename )
{
CMDModulePanel *pPanel = new CMDModulePanel( this, "MDModule Panel" );
pPanel->Create( filename );
pPanel->DoModal();
}
|