-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathChildFrm.cpp
196 lines (168 loc) · 5.76 KB
/
ChildFrm.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/****************************************************************************************/
/* ChildFrm.cpp */
/* */
/* Author: Jim Mischel, Ken Baird */
/* Description: Frame and splitter window code */
/* */
/* The contents of this file are subject to the Genesis3D Public License */
/* Version 1.01 (the "License"); you may not use this file except in */
/* compliance with the License. You may obtain a copy of the License at */
/* http://www.genesis3d.com */
/* */
/* Software distributed under the License is distributed on an "AS IS" */
/* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */
/* the License for the specific language governing rights and limitations */
/* under the License. */
/* */
/* The Original Code is Genesis3D, released March 25, 1999. */
/*Genesis3D Version 1.1 released November 15, 1999 */
/* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */
/* */
/****************************************************************************************/
#include "stdafx.h"
#include "ChildFrm.h"
#include "FUSIONView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// WM_MOUSEWHEEL isn't defined in earlier versions of MFC, which
// causes us a problem when compiling with VC 4. This should take
// care of the problem...
BEGIN_MESSAGE_MAP(CFixedSplitterWnd, CSplitterWnd)
#if (_MFC_VER == 0x0421)
//{{AFX_MSG_MAP(CFixedSplitterWnd)
ON_WM_MOUSEWHEEL()
//}}AFX_MSG_MAP
#endif
END_MESSAGE_MAP()
#pragma warning (disable: 4100)
BOOL CFixedSplitterWnd::OnMouseWheel (UINT nFlags, short zDelta, CPoint pt)
{
CMDIChildWnd * pParent = (CMDIChildWnd*)GetParent() ;
CFusionView * cv = (CFusionView *)pParent->GetActiveView() ;
if( cv != NULL )
{
if( zDelta > 0 )
{
cv->DoZoom (0.1f);
}
else
{
cv->DoZoom (-0.1f);
}
}
return FALSE;
}
#pragma warning (default: 4100)
/////////////////////////////////////////////////////////////////////////////
// CChildFrame
IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
//{{AFX_MSG_MAP(CChildFrame)
ON_WM_SIZE()
ON_WM_SETFOCUS()
//}}AFX_MSG_MAP
ON_MESSAGE(WM_SETTEXT, OnSetText)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChildFrame construction/destruction
CChildFrame::CChildFrame()
{
InitDone=FALSE;
}
CChildFrame::~CChildFrame()
{
}
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
//Create maximized
cs.style |= WS_MAXIMIZE|WS_VISIBLE;
return CMDIChildWnd::PreCreateWindow(cs);
}
BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT, CCreateContext* pContext)
{
int x, y;
RECT r;
if (!m_wndSplitter.CreateStatic(this, 2, 2))
{
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
}
GetClientRect(&r);
x=r.right>>1;
y=r.bottom>>1;
if (!m_wndSplitter.CreateView(0, 0,
RUNTIME_CLASS(CFusionView), CSize(x, y), pContext))
{
TRACE0("Failed to create first pane\n");
return FALSE;
}
if (!m_wndSplitter.CreateView(0, 1,
RUNTIME_CLASS(CFusionView), CSize(x, y), pContext))
{
TRACE0("Failed to create first pane\n");
return FALSE;
}
if (!m_wndSplitter.CreateView(1, 0,
RUNTIME_CLASS(CFusionView), CSize(x, y), pContext))
{
TRACE0("Failed to create first pane\n");
return FALSE;
}
if (!m_wndSplitter.CreateView(1, 1,
RUNTIME_CLASS(CFusionView), CSize(x, y), pContext))
{
TRACE0("Failed to create first pane\n");
return FALSE;
}
//set the view types
((CFusionView *)m_wndSplitter.GetPane(0,0))->OnViewType(ID_VIEW_TEXTUREVIEW);
((CFusionView *)m_wndSplitter.GetPane(0,1))->OnViewType(ID_VIEW_TOPVIEW);
((CFusionView *)m_wndSplitter.GetPane(1,0))->OnViewType(ID_VIEW_FRONTVIEW);
((CFusionView *)m_wndSplitter.GetPane(1,1))->OnViewType(ID_VIEW_SIDEVIEW);
// activate the top left view
SetActiveView((CView*)m_wndSplitter.GetPane(0,1));
InitDone=TRUE;
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CChildFrame message handlers
#pragma warning (disable: 4100)
LRESULT CChildFrame::OnSetText(WPARAM wParam, LPARAM lParam)
{
// const char *Text = (const char *)lParam;
// if( Text[0] == '-' ) {
return Default();
// }
// return 1;
}
#pragma warning (default: 4100)
void CChildFrame::OnSize(UINT nType, int cx, int cy)
{
//center the panes on a size
if(InitDone &&(m_wndSplitter.GetRowCount()==2 && m_wndSplitter.GetColumnCount()==2))
{
m_wndSplitter.SetColumnInfo(0, cx>>1, 0);
m_wndSplitter.SetColumnInfo(1, cx>>1, 0);
m_wndSplitter.SetRowInfo(0, cy>>1, 0);
m_wndSplitter.SetRowInfo(1, cy>>1, 0);
}
CMDIChildWnd::OnSize(nType, cx, cy);
}
void CChildFrame::OnSetFocus(CWnd* pOldWnd)
{
NMHDR hdr;
CWnd *pParent;
CMDIChildWnd::OnSetFocus(pOldWnd);
// notify main frame window that we've been given the focus
hdr.hwndFrom = this->m_hWnd;
hdr.idFrom = 0;
hdr.code = WM_SETFOCUS;
pParent = this->GetMDIFrame ();
if (pParent != NULL)
{
pParent->SendMessage (WM_NOTIFY, 0, (LPARAM)&hdr);
}
}