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

Method OnFindReplace

editor/ScriptStudio.cpp:366–412  ·  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

364// This is the message handler of sorts for the Find/Replace dialog, it interprets the message and passes the control
365// to the appropriate function
366LONG CScriptStudio::OnFindReplace(WPARAM wParam, LPARAM lParam) {
367 // Get a pointer to the calling dialog
368 CFindReplaceDialog *pDlg = CFindReplaceDialog::GetNotifier(lParam);
369 ASSERT(pDlg != NULL);
370
371 // See what the user is up to out there...
372 if (pDlg->IsTerminating()) {
373 // Time to kill the dialog box
374 return 0;
375 }
376
377 if (pDlg->ReplaceAll()) {
378 // Put a call to your ReplaceAll() method here...
379 CString find, repl;
380 find = pDlg->GetFindString();
381 repl = pDlg->GetReplaceString();
382 if (pDlg->MatchCase())
383 m_FindMatchCase = true;
384 else
385 m_FindMatchCase = false;
386 ReplaceAll(find.GetBuffer(1), repl.GetBuffer(1));
387 return 0;
388 }
389
390 if (pDlg->ReplaceCurrent()) {
391 // Put a call to your ReplaceCurrent() method here...
392 CString repl;
393 repl = pDlg->GetReplaceString();
394 if (pDlg->MatchCase())
395 m_FindMatchCase = true;
396 else
397 m_FindMatchCase = false;
398 ReplaceCurrent(repl.GetBuffer(1));
399 return 0;
400 }
401
402 CString str;
403 if (pDlg->MatchCase())
404 m_FindMatchCase = true;
405 else
406 m_FindMatchCase = false;
407 str = pDlg->GetFindString();
408
409 FindNext(str.GetBuffer(1));
410
411 return 0;
412}
413
414// This initializes a Find/Replace dialog box (if bFind==false it sets up a Find and Replace, else it's just Find)
415void CScriptStudio::InitFindReplace(BOOL bFind) {

Callers

nothing calls this directly

Calls 3

GetBufferMethod · 0.80
ReplaceAllMethod · 0.45
ReplaceCurrentMethod · 0.45

Tested by

no test coverage detected