-
Notifications
You must be signed in to change notification settings - Fork 6
/
ToolView.cpp
141 lines (108 loc) · 2.91 KB
/
ToolView.cpp
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
// Tools1.cpp : implementation file
//
#include "stdafx.h"
#include "SparkEdit.h"
#include "ToolView.h"
#include "Perspective.h"
#include "Render.h"
#include "SelectionManager.h"
#include "HaloMapFile.h"
#include "BspManager.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CPerspective *g_pRenderWnd;
extern CRender gRender;
extern CSelectionManager gSelection;
extern CToolView *g_pTools;
extern CHaloMapFile HaloMap;
extern CBspManager gBspManager;
/////////////////////////////////////////////////////////////////////////////
// CToolView
IMPLEMENT_DYNCREATE(CToolView, CFormView)
CToolView::CToolView()
: CFormView(CToolView::IDD)
{
//{{AFX_DATA_INIT(CToolView)
//}}AFX_DATA_INIT
m_pToolSheet = NULL;
}
CToolView::~CToolView()
{
if(m_pToolSheet)
delete m_pToolSheet;
}
void CToolView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CToolView)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CToolView, CFormView)
//{{AFX_MSG_MAP(CToolView)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CToolView diagnostics
#ifdef _DEBUG
void CToolView::AssertValid() const
{
CFormView::AssertValid();
}
void CToolView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CToolView message handlers
void CToolView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
g_pTools = this;
SetTimer(2, 50, 0);
CWnd *pWndPropSheetHolder = GetDlgItem(IDC_SHEET_HOLDER);
m_pToolSheet = new CToolSheet("ToolSheet", pWndPropSheetHolder, 0);
m_pToolSheet->AddPage(&(m_pToolSheet->m_TabNavigate));
m_pToolSheet->AddPage(&(m_pToolSheet->m_EditTab));
m_pToolSheet->AddPage(&(m_pToolSheet->m_ModelsTab));
if(!m_pToolSheet->Create(pWndPropSheetHolder, WS_CHILD|WS_VISIBLE, 0))
{
delete m_pToolSheet;
m_pToolSheet = NULL;
return;
}
CRect rect;
pWndPropSheetHolder->GetWindowRect(&rect);
m_pToolSheet->SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), SWP_NOZORDER|SWP_NOACTIVATE);
}
void CToolView::SetInfoText(CString str)
{
}
void CToolView::SetCameraPosInfo(float x, float y, float z)
{
}
void CToolView::Reset()
{
m_pToolSheet->SetActivePage(0);
m_pToolSheet->m_TabNavigate.Reset();
m_pToolSheet->m_EditTab.Reset();
m_pToolSheet->m_ModelsTab.InitializeModelList();
}
void CToolView::OnTimer(UINT nIDEvent)
{
float Pos[3];
CString str;
if((nIDEvent == 2)&&(g_pRenderWnd)&&(m_hWnd))
{
g_pRenderWnd->GetCameraPosition(Pos);
str.Format("CameraLoc: %.2f, %.2f, %.2f", Pos[0], Pos[1], Pos[2]);
((CWnd*)GetDlgItem(IDC_CAMERA_LOCATION))->SetWindowText(str);
str.Format("FrameRate: %.2f", gRender.GetFrameRate());
((CWnd*)GetDlgItem(IDC_FRAMERATE))->SetWindowText(str);
}
CFormView::OnTimer(nIDEvent);
}