Esempio n. 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;
}
/**
 Function to implement FIND and FIND REPLACE & REPLACE ALL functionality.
 This function is called whenever there is a message from the findreplace dialog box.
*/
wyBool
FindAndReplace::FindReplace(HWND hwnd, LPARAM lparam, wyBool val)
{
	LPFINDREPLACE		lpfr;
	lpfr = (LPFINDREPLACE)lparam;

    m_findflag = lpfr->Flags;

	// check if the message to end the dialog.
	if(lpfr->Flags & FR_DIALOGTERM) 
	{
		OnEndDlg(lpfr);
		return wyFalse;
	}
		
	 //save the selection in m_lastfind
	CopyFindData(&m_lastfind, lpfr);
	
	//if find next is pressed
	if(lpfr->Flags & FR_FINDNEXT) 
	{
        //save the search text and search option
        pGlobals->m_pcmainwin->m_findtext.SetAs(lpfr->lpstrFindWhat);
        CopyFindData(&pGlobals->m_pcmainwin->m_frstruct, lpfr);

		// for Query Editor Find 
		if(val == wyFalse)
		{
			 OnFindNext(hwnd, lpfr);
		}
		else
		{
			//for Find In Show result in text
			FindNextText(hwnd, lparam);
		}

        //set the focus to owner window
        //SetFocus(lpfr->hwndOwner);

        return wyTrue;
	}
		
	// if replace button is pressed
	if(lpfr->Flags & FR_REPLACE) 
	{
		OnReplaceButton(lpfr);
		return wyTrue;
	}
		
	// if replace all is clicked
	if(lpfr->Flags & FR_REPLACEALL) 
	{   OnReplaceAll(lpfr);
		return wyTrue;
	}

	return wyTrue;
}
Esempio n. 3
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 );
}