Exemple #1
0
LRESULT CEditView::OnFindReplaceCmd(WPARAM, LPARAM lParam)
{
	ASSERT_VALID(this);

	_AFX_EDIT_STATE* pEditState = _afxEditState;
	CFindReplaceDialog* pDialog = CFindReplaceDialog::GetNotifier(lParam);
	ASSERT(pDialog != NULL);
	ASSERT(pDialog == pEditState->pFindReplaceDlg);
	if (pDialog->IsTerminating())
	{
		pEditState->pFindReplaceDlg = NULL;
	}
	else if (pDialog->FindNext())
	{
		OnFindNext(pDialog->GetFindString(),
			pDialog->SearchDown(), pDialog->MatchCase());
	}
	else if (pDialog->ReplaceCurrent())
	{
		ASSERT(!pEditState->bFindOnly);
		OnReplaceSel(pDialog->GetFindString(),
			pDialog->SearchDown(), pDialog->MatchCase(),
			pDialog->GetReplaceString());
	}
	else if (pDialog->ReplaceAll())
	{
		ASSERT(!pEditState->bFindOnly);
		OnReplaceAll(pDialog->GetFindString(), pDialog->GetReplaceString(),
			pDialog->MatchCase());
	}
	ASSERT_VALID(this);
	return 0;
}
LRESULT CEditView::OnFindReplaceCmd( WPARAM wParam, LPARAM lParam )
/*****************************************************************/
{
    UNUSED_ALWAYS( wParam );

    CFindReplaceDialog *pDlg = CFindReplaceDialog::GetNotifier( lParam );
    ASSERT( pDlg == _afxEditState->pFindReplaceDlg );
    if( pDlg->FindNext() ) {
        OnFindNext( pDlg->GetFindString(), pDlg->SearchDown(), pDlg->MatchCase() );
    } else if( pDlg->ReplaceCurrent() ) {
        OnReplaceSel( pDlg->GetFindString(), pDlg->SearchDown(), pDlg->MatchCase(),
                      pDlg->GetReplaceString() );
    } else if( pDlg->ReplaceAll() ) {
        OnReplaceAll( pDlg->GetFindString(), pDlg->GetReplaceString(),
                      pDlg->MatchCase() );
    } else if( pDlg->IsTerminating() ) {
        _afxEditState->pFindReplaceDlg = NULL;
    }
    return( 0L );
}