MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / OnFindReplace

Method OnFindReplace

editor/ScriptEditorDlg.cpp:175–221  ·  view source on GitHub ↗

This is the message handler of sorts for the Find/Replace dialog, it interprets the message and passes the control to the appropriate function

Source from the content-addressed store, hash-verified

173// This is the message handler of sorts for the Find/Replace dialog, it interprets the message and passes the control
174// to the appropriate function
175LONG CScriptEditorDlg::OnFindReplace(WPARAM wParam, LPARAM lParam) {
176 // Get a pointer to the calling dialog
177 CFindReplaceDialog *pDlg = CFindReplaceDialog::GetNotifier(lParam);
178 ASSERT(pDlg != NULL);
179
180 // See what the user is up to out there...
181 if (pDlg->IsTerminating()) {
182 // Time to kill the dialog box
183 return 0;
184 }
185
186 if (pDlg->ReplaceAll()) {
187 // Put a call to your ReplaceAll() method here...
188 CString find, repl;
189 find = pDlg->GetFindString();
190 repl = pDlg->GetReplaceString();
191 if (pDlg->MatchCase())
192 m_FindMatchCase = true;
193 else
194 m_FindMatchCase = false;
195 ReplaceAll(find.GetBuffer(1), repl.GetBuffer(1));
196 return 0;
197 }
198
199 if (pDlg->ReplaceCurrent()) {
200 // Put a call to your ReplaceCurrent() method here...
201 CString repl;
202 repl = pDlg->GetReplaceString();
203 if (pDlg->MatchCase())
204 m_FindMatchCase = true;
205 else
206 m_FindMatchCase = false;
207 ReplaceCurrent(repl.GetBuffer(1));
208 return 0;
209 }
210
211 CString str;
212 if (pDlg->MatchCase())
213 m_FindMatchCase = true;
214 else
215 m_FindMatchCase = false;
216 str = pDlg->GetFindString();
217
218 FindNext(str.GetBuffer(1));
219
220 return 0;
221}
222
223// This will look for the next series of charaters (given by the null terminated w)
224// If it finds the string, it will highlight/select it and move the caret to the beginning of the word

Callers

nothing calls this directly

Calls 3

GetBufferMethod · 0.80
ReplaceAllMethod · 0.45
ReplaceCurrentMethod · 0.45

Tested by

no test coverage detected