summaryrefslogtreecommitdiff
path: root/hammer/mainfrm.h
blob: 6022d5e1ea6b85c4e2ebd37b359c50dcff9bb943 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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
197
198
199
200
201
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================//

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

#include "MDIClientWnd.h"
#include "FilterControl.h"
#include "ObjectBar.h"
#include "Texturebar.h"
#include "MapAnimationDlg.h"
#include "SelectModeDlgBar.h"
#include "materialdlg.h"
#include "ManifestDialog.h"

class CChildFrame;
class CObjectProperties;
class CTextureBrowser;
class CSearchReplaceDlg;
class CFaceEditSheet;
class CMessageWnd;
class CLightingPreviewResultsWindow;


class CMainFrame : public CMDIFrameWnd
{
	DECLARE_DYNAMIC( CMainFrame )

public:

	CMainFrame();
	virtual ~CMainFrame();

	bool VerifyBarState(void);

	void BeginShellSession(void);
	void EndShellSession(void);
	bool IsShellSessionActive(void);

	BOOL IsUndoActive() { return m_bUndoActive; }
	void SetUndoActive(BOOL bActive);

	void SetBrightness(float fBrightness);
	void UpdateAllDocViews(DWORD dwCmd);
	void Configure();
	void GlobalNotify(int nCode);
	void OnDeleteActiveDocument(void);

	void LoadWindowStates(std::fstream *pFile = NULL);

	inline CFaceEditSheet *GetFaceEditSheet( void ) { return m_pFaceEditSheet; }
	inline CStatusBar *GetStatusBar() { return &m_wndStatusBar; }

	void ShowSearchReplaceDialog(void);
	void ShowFaceEditSheetOrTextureBar( bool bShowFaceEditSheet );
	HACCEL GetAccelTable( void ) { return m_hAccelTable; }

	CFaceSmoothingVisualDlg *GetSmoothingGroupDialog( void )	{ return &m_SmoothingGroupDlg; }

	void ResetAutosaveTimer();

	bool IsInFaceEditMode();

#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	void OpenURL(const char *pszURL);
	void OpenURL(UINT nID);

	//
	// Public attributes. FIXME: eliminate!
	//
	CTextureBrowser			*pTextureBrowser;
	CObjectProperties		*pObjectProperties;

	CFilterControl			m_FilterControl;
	CObjectBar				m_ObjectBar;
	CTextureBar				m_TextureBar;
	CManifestFilter			m_ManifestFilterControl;
	CFaceEditSheet			*m_pFaceEditSheet;
	CLightingPreviewResultsWindow *m_pLightingPreviewOutputWindow;
	bool					m_bLightingPreviewOutputWindowShowing;

	//CMapAnimationDlg m_AnimationDlg;

	// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMainFrame)
	public:
	virtual void WinHelp(DWORD dwData, UINT nCmd);
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	//}}AFX_VIRTUAL

protected:

	//{{AFX_MSG(CMainFrame)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnEditProperties();
	afx_msg void OnViewMessages();
	afx_msg void OnUpdateViewMessages(CCmdUI* pCmdUI);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnClose();
	afx_msg void OnDestroy();
	afx_msg void OnPaint();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnToolsOptions();
	afx_msg void OnViewShowconnections();
	afx_msg void OnToolsPrefabfactory();
	afx_msg BOOL OnHelpOpenURL(UINT nID);
	afx_msg void OnHelpFinder();
	afx_msg void OnEditUndoredoactive();
	afx_msg void OnUpdateEditUndoredoactive(CCmdUI* pCmdUI);
	afx_msg BOOL OnFileNew(UINT);
	afx_msg void OnSavewindowstate();
	afx_msg void OnLoadwindowstate();
	afx_msg void OnFileOpen();
	afx_msg BOOL OnChange3dViewType(UINT nID);
	afx_msg BOOL OnUnits(UINT nID);
	afx_msg void OnUpdateUnits(CCmdUI *pCmdUI);
	afx_msg void OnUpdateView3d(CCmdUI *pCmdUI);
	afx_msg void OnUpdateView2d(CCmdUI *pCmdUI);
	afx_msg void OnUpdateToolUI(CCmdUI *pUI);
	afx_msg BOOL OnView3dChangeBrightness(UINT nID);
	afx_msg void OnUpdateApplicatorUI(CCmdUI *pUI);
	afx_msg BOOL OnHelpInfo(HELPINFO*);
	afx_msg void OnEnterMenuLoop( BOOL bIsTrackPopupMenu );
#if _MSC_VER < 1300
	afx_msg void OnActivateApp(BOOL bActive, HTASK hTask);
#else
	afx_msg void OnActivateApp(BOOL bActive, DWORD hThread);
#endif
	afx_msg void OnUpdateEditFunction(CCmdUI *pCmdUI);
	afx_msg BOOL OnApplicator(UINT nID);
	afx_msg BOOL OnSoundBrowser(UINT nID);
	afx_msg BOOL OnReloadSounds(UINT nID);
	afx_msg void OnUpdateOpaqueMaterials(CCmdUI *pCmdUI);
	afx_msg void OnOpaqueMaterials();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg BOOL OnChangeTool(UINT nID);
	afx_msg void OnInitMenu( CMenu *pMenu );
	afx_msg void OnHDR( void );
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()

private:

	void DockControlBarLeftOf(CControlBar *Bar, CControlBar *LeftOf);

	void SaveWindowStates(std::fstream *pFile = NULL);

	CChildFrame *GetNextMDIChildWnd(CChildFrame *pCurChild);
	CChildFrame *GetNextMDIChildWndRecursive(CWnd *pCurChild);

	void EnableFaceEditMode(bool bEnable);
	void Autosave( void );
	void LoadOldestAutosave( void );

	CMDIClientWnd			wndMDIClient;			// dvs: what in God's name is this for?

	CSearchReplaceDlg		*m_pSearchReplaceDlg;

	BOOL					m_bUndoActive;

	CStatusBar				m_wndStatusBar;
	CToolBar				m_wndMapToolBar;
	CToolBar				m_wndUndoRedoToolBar;
	CToolBar				m_wndMapEditToolBar;
	CToolBar				m_wndMapOps;

	CSelectModeDlgBar		m_SelectModeDlg;

	CFaceSmoothingVisualDlg	m_SmoothingGroupDlg;

	bool					m_bMinimized;
	bool					m_bShellSessionActive;		// Whether a client has initiated a remote shell editing session.
	CBitmap					m_bmMapEditTools256;

	enum
	{
		AUTOSAVE_TIMER,
		FIRST_TIMER
	};

};


CMainFrame *GetMainWnd();


#endif // MAINFRM_H