2 ===========================================================================
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
26 ===========================================================================
29 #include "../../idlib/precompiled.h"
35 #include "ConsoleDlg.h"
36 #include "InspectorDialog.h"
39 CInspectorDialog *g_Inspectors = NULL;
40 // CInspectorDialog dialog
42 void InspectorsDockingCallback ( bool docked , int ID , CWnd* wnd )
44 g_Inspectors->SetDockedTabs( docked , ID );
48 // CInspectorDialog dialog
49 //IMPLEMENT_DYNAMIC(CInspectorDialog,CTabsDlg)
50 CInspectorDialog::CInspectorDialog(CWnd* pParent /*=NULL*/)
51 : CTabsDlg(CInspectorDialog::IDD, pParent)
54 dockedTabs = W_CONSOLE | W_TEXTURE | W_MEDIA;
57 CInspectorDialog::~CInspectorDialog()
62 BEGIN_MESSAGE_MAP(CInspectorDialog, CTabsDlg)
63 ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_INSPECTOR, OnTcnSelchange )
70 // CInspectorDialog message handlers
72 BOOL CInspectorDialog::OnInitDialog()
74 CTabsDlg::OnInitDialog();
76 ASSERT ( m_Tabs.GetSafeHwnd() );
78 LoadWindowPlacement(GetSafeHwnd() , "radiant_InspectorsWindow" );
80 consoleWnd.Create(IDD_DIALOG_CONSOLE, this);
81 texWnd.Create(TEXTURE_WINDOW_CLASS, "", QE3_SPLITTER_STYLE, CRect(5, 5, 10, 10), this, 1299);
82 mediaDlg.Create(IDD_DIALOG_TEXTURELIST, this);
83 entityDlg.Create(IDD_DIALOG_ENTITY, this);
85 dockedTabs = GetCvarInt ( "radiant_InspectorDockedDialogs" , W_CONSOLE | W_TEXTURE | W_MEDIA );
87 AddDockedWindow ( &consoleWnd , W_CONSOLE , 1 , "Console" , (dockedTabs & W_CONSOLE ) != 0 , InspectorsDockingCallback );
88 AddDockedWindow ( &texWnd , W_TEXTURE , 2 , "Textures" , (dockedTabs & W_TEXTURE ) != 0 , InspectorsDockingCallback );
89 AddDockedWindow ( &mediaDlg , W_MEDIA , 3 , "Media" , (dockedTabs & W_MEDIA ) != 0 , InspectorsDockingCallback );
90 AddDockedWindow ( &entityDlg , W_ENTITY , 4 , "Entity" , (dockedTabs & W_ENTITY ) != 0 , InspectorsDockingCallback );
95 return TRUE; // return TRUE unless you set the focus to a control
96 // EXCEPTION: OCX Property Pages should return FALSE
99 void CInspectorDialog::SetMode(int mode, bool updateTabs) {
100 FocusWindow ( mode );
103 void CInspectorDialog::UpdateEntitySel(eclass_t *ent) {
104 entityDlg.UpdateEntitySel(ent);
107 void CInspectorDialog::FillClassList() {
108 entityDlg.AddClassNames();
111 void CInspectorDialog::UpdateSelectedEntity() {
112 entityDlg.SetKeyValPairs();
115 bool CInspectorDialog::GetSelectAllCriteria(idStr &key, idStr &val) {
117 entityDlg.editKey.GetWindowText(k);
118 entityDlg.editVal.GetWindowText(v);
126 void CInspectorDialog::OnSize(UINT nType, int cx, int cy)
128 CTabsDlg::OnSize(nType, cx, cy);
130 DockedWindowInfo* info = NULL;
142 m_Tabs.GetWindowRect(tabRect);
143 // retain vert size but size 4 in from edges and 4 up from bottom
145 tabRect.right = rect.Width() - 4;
146 tabRect.top = rect.Height() - tabRect.Height() - 4;
147 tabRect.bottom = rect.Height() - 4;
148 // adjust rect for children size
149 rect.bottom -= 5 + tabRect.Height();
151 m_Tabs.SetWindowPos(NULL, tabRect.left, tabRect.top, tabRect.Width(), tabRect.Height(), 0);
153 for( pos = m_Windows.GetStartPosition(); pos != NULL ; )
155 m_Windows.GetNextAssoc( pos, wID, (void*&)info );
157 if ( (info->m_State == DockedWindowInfo::DOCKED) ) {
158 info->m_Window->SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), 0);
164 void CInspectorDialog::OnDestroy()
166 ::SaveWindowPlacement(GetSafeHwnd() , "radiant_InspectorsWindow" );
167 SetCvarInt("radiant_InspectorDockedDialogs" , dockedTabs );
169 CTabsDlg::OnDestroy();
172 void CInspectorDialog::OnClose()
177 BOOL CInspectorDialog::PreTranslateMessage(MSG* pMsg)
179 // TODO: Add your specialized code here and/or call the base class
180 if ( pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP) {
181 g_pParentWnd->PostMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
183 return CTabsDlg::PreTranslateMessage(pMsg);
186 void CInspectorDialog::SetDockedTabs ( bool docked , int ID )
196 void CInspectorDialog::AssignModel ()
198 entityDlg.AssignModel();