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"
34 #include "FindTextureDlg.h"
39 static char THIS_FILE[] = __FILE__;
42 /////////////////////////////////////////////////////////////////////////////
43 // CFindTextureDlg dialog
45 CFindTextureDlg g_TexFindDlg;
46 CFindTextureDlg& g_dlgFind = g_TexFindDlg;
47 static bool g_bFindActive = true;
49 void CFindTextureDlg::updateTextures(const char *p)
64 CFindTextureDlg::CFindTextureDlg(CWnd* pParent /*=NULL*/)
65 : CDialog(CFindTextureDlg::IDD, pParent)
67 //{{AFX_DATA_INIT(CFindTextureDlg)
68 m_bSelectedOnly = FALSE;
70 m_strReplace = _T("");
77 void CFindTextureDlg::DoDataExchange(CDataExchange* pDX)
79 CDialog::DoDataExchange(pDX);
80 //{{AFX_DATA_MAP(CFindTextureDlg)
81 DDX_Check(pDX, IDC_CHECK_SELECTED, m_bSelectedOnly);
82 DDX_Text(pDX, IDC_EDIT_FIND, m_strFind);
83 DDX_Text(pDX, IDC_EDIT_REPLACE, m_strReplace);
84 DDX_Check(pDX, IDC_CHECK_FORCE, m_bForce);
85 DDX_Check(pDX, IDC_CHECK_LIVE, m_bLive);
90 BEGIN_MESSAGE_MAP(CFindTextureDlg, CDialog)
91 //{{AFX_MSG_MAP(CFindTextureDlg)
92 ON_BN_CLICKED(IDC_BTN_APPLY, OnBtnApply)
93 ON_EN_SETFOCUS(IDC_EDIT_FIND, OnSetfocusEditFind)
94 ON_EN_SETFOCUS(IDC_EDIT_REPLACE, OnSetfocusEditReplace)
98 void CFindTextureDlg::OnBtnApply()
103 SaveRegistryInfo("Radiant::TextureFindWindow", &rct, sizeof(rct));
104 FindReplaceTextures( m_strFind, m_strReplace, ( m_bSelectedOnly != FALSE ), ( m_bForce != FALSE ) );
107 void CFindTextureDlg::OnOK()
112 SaveRegistryInfo("Radiant::TextureFindWindow", &rct, sizeof(rct));
113 FindReplaceTextures( m_strFind, m_strReplace, ( m_bSelectedOnly != FALSE ), ( m_bForce != FALSE ) );
117 void CFindTextureDlg::show()
119 if (g_dlgFind.GetSafeHwnd() == NULL || IsWindow(g_dlgFind.GetSafeHwnd()) == FALSE)
121 g_dlgFind.Create(IDD_DIALOG_FINDREPLACE);
122 g_dlgFind.ShowWindow(SW_SHOW);
126 g_dlgFind.ShowWindow(SW_SHOW);
129 LONG lSize = sizeof(rct);
130 if (LoadRegistryInfo("Radiant::TextureFindWindow", &rct, &lSize))
131 g_dlgFind.SetWindowPos(NULL, rct.left, rct.top, 0,0, SWP_NOSIZE | SWP_SHOWWINDOW);
135 bool CFindTextureDlg::isOpen()
137 return (g_dlgFind.GetSafeHwnd() == NULL || ::IsWindowVisible(g_dlgFind.GetSafeHwnd()) == FALSE) ? false : true;
140 void CFindTextureDlg::setFindStr(const char * p)
142 g_dlgFind.UpdateData(TRUE);
143 if (g_dlgFind.m_bLive)
145 g_dlgFind.m_strFind = p;
146 g_dlgFind.UpdateData(FALSE);
150 void CFindTextureDlg::setReplaceStr(const char * p)
152 g_dlgFind.UpdateData(TRUE);
153 if (g_dlgFind.m_bLive)
155 g_dlgFind.m_strReplace = p;
156 g_dlgFind.UpdateData(FALSE);
161 void CFindTextureDlg::OnCancel()
165 SaveRegistryInfo("Radiant::TextureFindWindow", &rct, sizeof(rct));
169 BOOL CFindTextureDlg::DestroyWindow()
171 return CDialog::DestroyWindow();
174 void CFindTextureDlg::OnSetfocusEditFind()
176 g_bFindActive = true;
179 void CFindTextureDlg::OnSetfocusEditReplace()
181 g_bFindActive = false;