doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FindDialog.cpp
Go to the documentation of this file.
1 /*
2 ===========================================================================
3 
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
8 
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.
13 
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.
18 
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/>.
21 
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.
23 
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.
25 
26 ===========================================================================
27 */
28 
29 #include "../../idlib/precompiled.h"
30 #pragma hdrstop
31 
32 #include "FindDialog.h"
33 
34 #include "MEMainFrame.h"
35 
36 IMPLEMENT_DYNAMIC(FindDialog, CDialog)
37 
38 BEGIN_MESSAGE_MAP(FindDialog, CDialog)
39  ON_BN_CLICKED(ID_FIND_NEXT, OnBnClickedFindNext)
40 END_MESSAGE_MAP()
41 
45 FindDialog::FindDialog(CWnd* pParent)
46 : CDialog(FindDialog::IDD, pParent) {
47  registry.Init("Software\\id Software\\DOOM3\\Tools\\MaterialEditor\\Find");
48  parent = (MEMainFrame*)pParent;
49 }
50 
55 }
56 
61  return CDialog::Create(FindDialog::IDD, parent);
62 }
63 
67 void FindDialog::DoDataExchange(CDataExchange* pDX) {
68  CDialog::DoDataExchange(pDX);
69 
70  CString temp = searchData.searchText;
71  DDX_Text(pDX, IDC_EDIT_FINDTEXT, temp);
72  DDX_Check(pDX, IDC_CHECK_NAME_ONLY, searchData.nameOnly);
74 
75  searchData.searchText = temp;
76 }
77 
83  CDialog::OnInitDialog();
84 
86 
87  GetDlgItem(IDC_EDIT_FINDTEXT)->SetFocus();
88 
89  return FALSE;
90 }
91 
96 
97  UpdateData();
98  searchData.searched = false;
100 }
101 
106 {
108 
109  parent->CloseFind();
110  DestroyWindow();
111 }
112 
118  registry.Load();
119 
120  searchData.searchText = registry.GetString("searchText");
121  searchData.nameOnly = (int)registry.GetFloat("nameOnly");
122  searchData.searchScope = (int)registry.GetFloat("searchScope");
123 
124  registry.GetWindowPlacement("findDialog", GetSafeHwnd());
125 
126  UpdateData(FALSE);
127 }
128 
133 
134  UpdateData();
135 
136  registry.SetString("searchText", searchData.searchText);
137  registry.SetFloat("nameOnly", searchData.nameOnly);
138  registry.SetFloat("searchScope", searchData.searchScope);
139 
140  registry.SetWindowPlacement("findDialog", GetSafeHwnd());
141 
142  registry.Save();
143 }
144 
145 
void SetString(const char *name, const char *v)
#define IDC_RADIO_SEARCHFILE
bool GetWindowPlacement(const char *name, HWND hwnd)
void CloseFind()
Called by the find dialog when it is closing.
void LoadFindSettings()
Loads the search parameters from the registry and makes sure the controls are properly initialized...
Definition: FindDialog.cpp:117
case const int
Definition: Callbacks.cpp:52
MEMainFrame * parent
Definition: FindDialog.h:69
#define ID_FIND_NEXT
void SaveFindSettings()
Saves the search parameters to the registry.
Definition: FindDialog.cpp:132
#define BOOL
Definition: mprintf.c:71
float GetFloat(const char *name)
virtual BOOL OnInitDialog()
Called while the dialog is being initialized to load the find parameters from the registry and set th...
Definition: FindDialog.cpp:82
afx_msg void OnBnClickedFindNext()
Triggers a search based on the parameters in the dialog.
Definition: FindDialog.cpp:95
virtual void OnCancel()
Saves the search parameters and closes the find dialog.
Definition: FindDialog.cpp:105
virtual void DoDataExchange(CDataExchange *pDX)
Transfers data to and from the controls in the find dialog.
Definition: FindDialog.cpp:67
Dialog that provides an input box and several checkboxes to define the parameters of a search...
Definition: FindDialog.h:40
void FindNext(MaterialSearchData_t *search)
Begins a search based on the provided parameters or the previously used parameters.
#define IDC_EDIT_FINDTEXT
void SetWindowPlacement(const char *name, HWND hwnd)
rvRegistryOptions registry
Definition: FindDialog.h:71
BOOL Create()
Creates and instance of the find dialog.
Definition: FindDialog.cpp:60
MaterialSearchData_t searchData
Definition: FindDialog.h:70
#define FALSE
Definition: mprintf.c:70
virtual ~FindDialog()
Destructor for FindDialog.
Definition: FindDialog.cpp:54
#define IDC_CHECK_NAME_ONLY
void SetFloat(const char *name, float v)
const char * GetString(const char *name)
The main window for the material editor.
Definition: MEMainFrame.h:47