• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ wxFindDialogEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中wxFindDialogEvent的典型用法代码示例。如果您正苦于以下问题:C++ wxFindDialogEvent类的具体用法?C++ wxFindDialogEvent怎么用?C++ wxFindDialogEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了wxFindDialogEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: MenuReplaceAll

void MyFrame::MenuReplaceAll ( wxFindDialogEvent& event ) {
    if (stc==0)
        return;
    int flags = 0;
    if (event.GetFlags() & wxFR_WHOLEWORD)
        flags += wxSTC_FIND_WHOLEWORD;

    if (event.GetFlags() & wxFR_MATCHCASE)
        flags += wxSTC_FIND_MATCHCASE;

    ReplaceAll(event.GetFindString(), event.GetReplaceString(), flags);
}
开发者ID:bihai,项目名称:fbide,代码行数:12,代码来源:search.cpp


示例2: FindClose

void MyFrame::FindClose ( wxFindDialogEvent& event ) {

    if (event.GetDialog() == FindDialog) {
        FindDialog->Destroy();
        FindDialog = NULL;
    }

    else if (event.GetDialog() == ReplaceDialog) {
        ReplaceDialog->Destroy();
        ReplaceDialog = NULL;
    }
    return;
}
开发者ID:bihai,项目名称:fbide,代码行数:13,代码来源:search.cpp


示例3: OnFindDrcMarker

void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
{
    static SCH_MARKER* lastMarker = NULL;

    wxString           msg;
    SCH_SHEET_LIST     schematic;
    SCH_SHEET_PATH*    sheetFoundIn = NULL;
    bool               wrap = ( event.GetFlags() & FR_SEARCH_WRAP ) != 0;
    wxRect             clientRect( wxPoint( 0, 0 ), GetClientSize() );
    bool               warpCursor = ( ( event.GetId() == wxEVT_COMMAND_FIND_CLOSE ) ||
                                      !( event.GetFlags() & FR_NO_WARP_CURSOR ) );

    if( event.GetFlags() & FR_CURRENT_SHEET_ONLY )
    {
        sheetFoundIn = m_CurrentSheet;
        lastMarker = (SCH_MARKER*) m_CurrentSheet->FindNextItem( SCH_MARKER_T, lastMarker, wrap );
    }
    else
    {
        lastMarker = (SCH_MARKER*) schematic.FindNextItem( SCH_MARKER_T, &sheetFoundIn,
                                                           lastMarker, wrap );
    }

    if( lastMarker != NULL )
    {
        if( *sheetFoundIn != *m_CurrentSheet )
        {
            sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() );
            *m_CurrentSheet = *sheetFoundIn;
            m_CurrentSheet->UpdateAllScreenReferences();
        }

        sheetFoundIn->LastScreen()->SetCrossHairPosition( lastMarker->GetPosition() );

        RedrawScreen( lastMarker->GetPosition(), warpCursor );

        wxString path = sheetFoundIn->Path();
        wxString units = GetAbbreviatedUnitsLabel();
        double x = To_User_Unit( g_UserUnit, (double) lastMarker->GetPosition().x,
                                 m_internalUnits );
        double y = To_User_Unit( g_UserUnit, (double) lastMarker->GetPosition().y,
                                 m_internalUnits );
        msg.Printf( _( "Design rule check marker found in sheet %s at %0.3f%s, %0.3f%s" ),
                    GetChars( path ), x, GetChars( units ), y, GetChars( units) );
        SetStatusText( msg );
    }
    else
    {
        SetStatusText( _( "No more markers were found." ) );
    }
}
开发者ID:,项目名称:,代码行数:51,代码来源:


示例4: OnFind

void ctFindReplaceDialog::OnFind(wxFindDialogEvent& event)
{
    wxString textToFind = event.GetFindString();
    bool matchCase = ((event.GetFlags() & wxFR_MATCHCASE) != 0);
    bool wholeWord = ((event.GetFlags() & wxFR_WHOLEWORD) != 0);

    wxGetApp().GetSettings().m_matchCase = matchCase;
    wxGetApp().GetSettings().m_matchWholeWord = wholeWord;

    if (!DoFind(textToFind, matchCase, wholeWord))
    {
        wxMessageBox(wxT("No more matches."), wxT("Search"), wxOK|wxICON_INFORMATION, this);
    }
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:14,代码来源:configtoolview.cpp


示例5: OnFindDialog

void MyFrame::OnFindDialog(wxFindDialogEvent& event)
{
    wxEventType type = event.GetEventType();

    if ( type == wxEVT_COMMAND_FIND || type == wxEVT_COMMAND_FIND_NEXT )
    {
        wxLogMessage(wxT("Find %s'%s' (flags: %s)"),
                     type == wxEVT_COMMAND_FIND_NEXT ? wxT("next ") : wxT(""),
                     event.GetFindString().c_str(),
                     DecodeFindDialogEventFlags(event.GetFlags()).c_str());
    }
    else if ( type == wxEVT_COMMAND_FIND_REPLACE ||
              type == wxEVT_COMMAND_FIND_REPLACE_ALL )
    {
        wxLogMessage(wxT("Replace %s'%s' with '%s' (flags: %s)"),
                     type == wxEVT_COMMAND_FIND_REPLACE_ALL ? _T("all ") : wxT(""),
                     event.GetFindString().c_str(),
                     event.GetReplaceString().c_str(),
                     DecodeFindDialogEventFlags(event.GetFlags()).c_str());
    }
    else if ( type == wxEVT_COMMAND_FIND_CLOSE )
    {
        wxFindReplaceDialog *dlg = event.GetDialog();

        int idMenu;
        const wxChar *txt;
        if ( dlg == m_dlgFind )
        {
            txt = _T("Find");
            idMenu = DIALOGS_FIND;
            m_dlgFind = NULL;
        }
        else if ( dlg == m_dlgReplace )
        {
            txt = _T("Replace");
            idMenu = DIALOGS_REPLACE;
            m_dlgReplace = NULL;
        }
        else
        {
            txt = _T("Unknown");
            idMenu = wxID_ANY;

            wxFAIL_MSG( _T("unexpected event") );
        }

        wxLogMessage(wxT("%s dialog is being closed."), txt);

        if ( idMenu != wxID_ANY )
        {
            GetMenuBar()->Check(idMenu, false);
        }

        dlg->Destroy();
    }
    else
    {
        wxLogError(wxT("Unknown find dialog event!"));
    }
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:60,代码来源:dialogs.cpp


示例6: OnClose

void ctFindReplaceDialog::OnClose(wxFindDialogEvent& event)
{
    bool matchCase = ((event.GetFlags() & wxFR_MATCHCASE) != 0);
    bool wholeWord = ((event.GetFlags() & wxFR_WHOLEWORD) != 0);
    wxGetApp().GetSettings().m_matchCase = matchCase;
    wxGetApp().GetSettings().m_matchWholeWord = wholeWord;

    this->Destroy();
    ((ctMainFrame*) GetParent())->SetFindDialog(NULL);
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:10,代码来源:configtoolview.cpp


示例7: FindButton

void MyFrame::FindButton ( wxFindDialogEvent& event ) {
    if (stc==0)
        return;
    int flags = 0;
    if (event.GetFlags() & wxFR_WHOLEWORD)
        flags += wxSTC_FIND_WHOLEWORD;

    if (event.GetFlags() & wxFR_MATCHCASE)
        flags += wxSTC_FIND_MATCHCASE;

    // Search Down
    if (event.GetFlags() & wxFR_DOWN)
        FindOccurence(event.GetFindString(), 0, flags);

    // Search Up
    else
        FindOccurence(event.GetFindString(), 1, flags);

    return;
}
开发者ID:bihai,项目名称:fbide,代码行数:20,代码来源:search.cpp


示例8: Send

void wxFindReplaceDialogBase::Send(wxFindDialogEvent& event)
{
    // we copy the data to dialog->GetData() as well

    m_FindReplaceData->m_Flags = event.GetFlags();
    m_FindReplaceData->m_FindWhat = event.GetFindString();
    if ( HasFlag(wxFR_REPLACEDIALOG) &&
         (event.GetEventType() == wxEVT_FIND_REPLACE ||
          event.GetEventType() == wxEVT_FIND_REPLACE_ALL) )
    {
        m_FindReplaceData->m_ReplaceWith = event.GetReplaceString();
    }

    // translate wxEVT_FIND_NEXT to wxEVT_FIND if needed
    if ( event.GetEventType() == wxEVT_FIND_NEXT )
    {
        if ( m_FindReplaceData->m_FindWhat != m_lastSearch )
        {
            event.SetEventType(wxEVT_FIND);

            m_lastSearch = m_FindReplaceData->m_FindWhat;
        }
    }

    if ( !GetEventHandler()->ProcessEvent(event) )
    {
        // the event is not propagated upwards to the parent automatically
        // because the dialog is a top level window, so do it manually as
        // in 9 cases of 10 the message must be processed by the dialog
        // owner and not the dialog itself
        (void)GetParent()->GetEventHandler()->ProcessEvent(event);
    }
}
开发者ID:chromylei,项目名称:third_party,代码行数:33,代码来源:fddlgcmn.cpp


示例9: OnFindReplaceDialog

void Edit::OnFindReplaceDialog(wxFindDialogEvent& event)
{
  const wxEventType type = event.GetEventType();
  const wxString find_string = m_FindData.GetFindString();
  int found_start, found_end;

  if (type == wxEVT_FIND || type == wxEVT_FIND_NEXT) {
    // search
    if (FindText(found_start, found_end, type == wxEVT_FIND_NEXT)) {
      SetSelection(found_start, found_end);
    }
    else {
      wxMessageDialog dialog(this, wxT("Cannot find the text \"" + find_string + "\" from current position"), wxT("Find"));
      dialog.ShowModal();
    }
  }
  else if (type == wxEVT_FIND_REPLACE) {
    ReplaceText(find_string);
  }
  else if (type == wxEVT_FIND_REPLACE_ALL) {
    const wxString replace_string = m_FindData.GetReplaceString();
    int start_index = 0;
    bool found = true;
    int found_count = 0;
    do {
      // set search area
      SetTargetStart(start_index); SetTargetEnd(GetLastPosition());

      // search and replace
      found_start = SearchInTarget(find_string);
      if (found_start > -1) {
        found_end = found_start + find_string.size();
        SetTargetStart(found_start);
        SetTargetEnd(found_end);
        ReplaceTarget(replace_string);
        start_index = found_start + replace_string.size();
        found_count++;
      }
      else {
        found = false;
      }
    }
    while (found);

    const wxString message = wxString::Format(wxT("%d occurrence(s) of \"%s\" were replaced with \"%s\"."), 
      found_count, find_string, replace_string);
    wxMessageDialog replace_dialog(this, message, wxT("Replaced Text"));
    replace_dialog.ShowModal();
  }
}
开发者ID:8l,项目名称:objeck-lang,代码行数:50,代码来源:editor.cpp


示例10: OnFindReplace

void SCH_EDIT_FRAME::OnFindReplace( wxFindDialogEvent& aEvent )
{
    SCH_FIND_COLLECTOR_DATA data;

    bool warpCursor = !( aEvent.GetFlags() & FR_NO_WARP_CURSOR );
    SCH_ITEM* item = (SCH_ITEM*) m_foundItems.GetItem( data );

    wxCHECK_RET( item != NULL, wxT( "Invalid replace item in find collector list." ) );

    wxLogTrace( traceFindReplace, wxT( "Replacing %s with %s in item %s" ),
                GetChars( aEvent.GetFindString() ), GetChars( aEvent.GetReplaceString() ),
                GetChars( m_foundItems.GetText() ) );

    SCH_ITEM* undoItem = data.GetParent();

    if( undoItem == NULL )
        undoItem = item;

    SetUndoItem( undoItem );

    if( m_foundItems.ReplaceItem() )
    {
        OnModify();
        SaveUndoItemInUndoList( undoItem );
        RedrawScreen( data.GetPosition(), warpCursor );
    }

    OnFindSchematicItem( aEvent );

    if( aEvent.GetEventType() == wxEVT_COMMAND_FIND_REPLACE_ALL )
    {
        while( ( item = (SCH_ITEM*) m_foundItems.GetItem( data ) ) != NULL )
        {
            wxLogTrace( traceFindReplace, wxT( "Replacing %s with %s in item %s" ),
                        GetChars( aEvent.GetFindString() ), GetChars( aEvent.GetReplaceString() ),
                        GetChars( m_foundItems.GetText() ) );

            SCH_ITEM* undoItem = data.GetParent();

            // Don't save child items in undo list.
            if( undoItem == NULL )
                undoItem = item;

            SetUndoItem( undoItem );

            if( m_foundItems.ReplaceItem() )
            {
                OnModify();
                SaveUndoItemInUndoList( undoItem );
                RedrawScreen( data.GetPosition(), warpCursor );
            }

            OnFindSchematicItem( aEvent );
        }
    }
}
开发者ID:james-sakalaukus,项目名称:kicad,代码行数:56,代码来源:find.cpp


示例11: OnFindSchematicItem

void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& aEvent )
{
    SCH_FIND_REPLACE_DATA   searchCriteria;
    SCH_FIND_COLLECTOR_DATA data;

    searchCriteria.SetFlags( aEvent.GetFlags() );
    searchCriteria.SetFindString( aEvent.GetFindString() );
    searchCriteria.SetReplaceString( aEvent.GetReplaceString() );

    if( aEvent.GetEventType() == wxEVT_COMMAND_FIND_CLOSE )
    {
        if( m_foundItems.GetCount() == 0 )
            return;

        // Refresh the search cache in case something has changed.  This prevents any stale
        // pointers from crashing Eeschema when the wxEVT_FIND_CLOSE event is handled.
        if( IsSearchCacheObsolete( searchCriteria ) )
        {
            if( aEvent.GetFlags() & FR_CURRENT_SHEET_ONLY && g_RootSheet->CountSheets() > 1 )
            {
                m_foundItems.Collect( searchCriteria, m_CurrentSheet );
            }
            else
            {
                m_foundItems.Collect( searchCriteria );
            }
        }
    }
    else if( IsSearchCacheObsolete( searchCriteria ) )
    {
        if( aEvent.GetFlags() & FR_CURRENT_SHEET_ONLY && g_RootSheet->CountSheets() > 1 )
        {
            m_foundItems.Collect( searchCriteria, m_CurrentSheet );
        }
        else
        {
            m_foundItems.Collect( searchCriteria );
        }
    }
    else
    {
        EDA_ITEM* currentItem = m_foundItems.GetItem( data );

        if( currentItem != NULL )
            currentItem->SetForceVisible( false );

        m_foundItems.UpdateIndex();
    }

    updateFindReplaceView( aEvent );
}
开发者ID:AlexanderBrevig,项目名称:kicad-source-mirror,代码行数:51,代码来源:find.cpp


示例12: OnFindDialog

void wxExFrame::OnFindDialog(wxFindDialogEvent& event)
{
    if (event.GetEventType() == wxEVT_COMMAND_FIND_CLOSE)
    {
        wxASSERT(m_FindReplaceDialog != NULL);

        // Hiding instead of destroying, does not
        // show the dialog next time.
        m_FindReplaceDialog->Destroy();
        m_FindReplaceDialog = NULL;
    }
    else
    {
        if (m_FindFocus != NULL)
        {
            wxPostEvent(m_FindFocus, event);
        }
    }
}
开发者ID:hfvw,项目名称:wxExtension,代码行数:19,代码来源:frame.cpp


示例13: OnFindDialog

void CCTestFrame::OnFindDialog(wxFindDialogEvent& event)
{
    wxEventType type = event.GetEventType();
    if (type == wxEVT_COMMAND_FIND || type == wxEVT_COMMAND_FIND_NEXT)
    {
        if (event.GetFlags() & wxFR_DOWN)
        {
            if (type == wxEVT_COMMAND_FIND)
            {
                m_LastIndex = m_LogCtrl->GetInsertionPoint();
                wxString tmp = m_LogCtrl->GetValue().SubString(m_LastIndex, m_LogCtrl->GetLastPosition() - 1);
                int i;
                if (event.GetFlags() & wxFR_MATCHCASE)
                    i = m_LogCtrl->GetValue().Find(event.GetFindString().c_str());
                else
                    i = tmp.Upper().Find(event.GetFindString().Upper().c_str());
                if (i >= 0)
                {
                    m_LastIndex += i;
                    m_LogCtrl->SetSelection(m_LastIndex, m_LastIndex + event.GetFindString().Length());
                }
            }
            else // find next
            {
                wxString tmp = m_LogCtrl->GetValue().SubString(++m_LastIndex, m_LogCtrl->GetLastPosition() - 1) ;
                int i;
                if (event.GetFlags() & wxFR_MATCHCASE)
                    i = tmp.Find(event.GetFindString().c_str());
                else
                    i = tmp.Upper().Find(event.GetFindString().Upper().c_str());
                if (i >= 0)
                {
                    m_LastIndex += i;
                    m_LogCtrl->SetSelection(m_LastIndex, m_LastIndex + event.GetFindString().Length());
                }
            }
            m_LogCtrl->SetFocus();
        }
        else //find up
        {
            if (type == wxEVT_COMMAND_FIND)
            {
                m_LastIndex = m_LogCtrl->GetInsertionPoint();
                int i;
                if (event.GetFlags() & wxFR_MATCHCASE)
                    i = m_LogCtrl->GetValue().rfind(event.GetFindString().c_str(), m_LastIndex);
                else
                    i = m_LogCtrl->GetValue().Upper().rfind(event.GetFindString().Upper().c_str(), m_LastIndex);

                if (i >= 0)
                {
                    m_LogCtrl->SetSelection(i, i + event.GetFindString().Length());
                    m_LastIndex = i;
                }
            }
            else
            {
                wxString tmp = m_LogCtrl->GetValue().SubString(0, --m_LastIndex) ;
                int i;
                if (event.GetFlags() & wxFR_MATCHCASE)
                    i = tmp.rfind(event.GetFindString().c_str(), m_LastIndex);
                else
                    i = tmp.Upper().rfind(event.GetFindString().Upper().c_str(), m_LastIndex);
                if (i >= 0)
                {
                    m_LastIndex = i;
                    m_LogCtrl->SetSelection(m_LastIndex, m_LastIndex + event.GetFindString().Length());
                }
            }
        }

        m_LogCtrl->SetFocus();
    }
    else if (type == wxEVT_COMMAND_FIND_CLOSE)
    {
        delete m_FRDlg;
        m_FRDlg = NULL;
    }
}
开发者ID:Three-DS,项目名称:codeblocks-13.12,代码行数:79,代码来源:cctest_frame.cpp


示例14: if

void SavvyEditor::AppFrame::OnFindDialog(wxFindDialogEvent& a_Event)
{
	wxEventType type = a_Event.GetEventType();

	if (type == wxEVT_FIND || type == wxEVT_FIND_NEXT)
	{
		if (!DoFind(a_Event.GetFindString(), a_Event.GetFlags()))
		{
			wxMessageBox(wxT("No more matches."), DEFAULT_FRAME_TITLE);
		}
	}
	else if (type == wxEVT_FIND_REPLACE)
	{
		if (!DoReplace(a_Event.GetFindString(), a_Event.GetReplaceString(), a_Event.GetFlags()))
		{
			wxMessageBox(wxT("Nothing to replace."), DEFAULT_FRAME_TITLE);
		}
	}
	else if (type == wxEVT_FIND_REPLACE_ALL)
	{
		int numReplaced = DoReplaceAll(a_Event.GetFindString(), a_Event.GetReplaceString(), a_Event.GetFlags());
		if (numReplaced > 0)
		{
			wxString numString = wxString::Format(wxT("%i"), numReplaced);
			numString.Append(" occurrences replaced.");
			wxMessageBox(numString, DEFAULT_FRAME_TITLE);
		}
		else
		{
			wxMessageBox(wxT("Nothing to replace."), DEFAULT_FRAME_TITLE);
		}
	}
	else if (type == wxEVT_FIND_CLOSE)
	{
		wxFindReplaceDialog *dlg = a_Event.GetDialog();

		int idMenu;
		const wxChar *txt;
		if (dlg == m_FindDialog)
		{
			txt = wxT("Find");
			idMenu = ID_FindDialog;
			m_FindDialog = NULL;
		}
		else if (dlg == m_ReplaceDialog)
		{
			txt = wxT("Replace");
			idMenu = ID_ReplaceDialog;
			m_ReplaceDialog = NULL;
		}
		else
		{
			txt = wxT("Unknown");
			idMenu = wxID_ANY;

			wxFAIL_MSG(wxT("unexpected event"));
		}

		if (idMenu != wxID_ANY)
		{
			GetMenuBar()->Check(idMenu, false);
		}

		dlg->Destroy();
	}
	else
	{
		wxLogError(wxT("Unknown find dialog event!"));
	}
}
开发者ID:lotsopa,项目名称:Savvy,代码行数:70,代码来源:SavvyAppFrame.cpp


示例15: OnFindDialog

//----------------------------------------
void CRichTextFrame::OnFindDialog(wxFindDialogEvent& event)
{
    wxEventType type = event.GetEventType();

    if ( type == wxEVT_COMMAND_FIND || type == wxEVT_COMMAND_FIND_NEXT )
    {
      /*
        wxLogMessage(wxT("Find %s'%s' (flags: %s)"),
                     type == wxEVT_COMMAND_FIND_NEXT ? wxT("next ") : wxT(""),
                     event.GetFindString().c_str(),
                     DecodeFindDialogEventFlags(event.GetFlags()).c_str());
        */
        wxString sSearch = event.GetFindString();
        wxString sText = m_textCtrl->GetValue();
        //sText.Replace(wxT( "\n" ), wxT( " \n" ) ) ;
        int iStart = -1;
        long from = m_textCtrl->GetInsertionPoint();
        long to = 0;
        m_textCtrl->GetSelection(&from, &to);
        bool matchCase = ((event.GetFlags() & wxFR_MATCHCASE) == wxFR_MATCHCASE);
        bool down = ((event.GetFlags() & wxFR_DOWN) == wxFR_DOWN);
        if (matchCase)
        {
          if (down)
          {
            from = to + 1;
            iStart =  sText.find (sSearch, from);
          }
          else
          {
            from = from - 1;
            iStart =  sText.rfind (sSearch, from);
          }
        }
        else
        {
          if (down)
          {
            from = to + 1;
            iStart =  CTools::FindNoCase(sText.c_str(), sSearch.c_str(), from);
          }
          else
          {
            from = from - 1;
            iStart =  CTools::RFindNoCase(sText.c_str(), sSearch.c_str(), from);
          }
        }
        if (iStart < 0)
        {
          wxMessageBox(wxString::Format("Cannot find the string '%s'", 
                                        sSearch.c_str()),
                      "Find text...",
                      wxOK | wxICON_EXCLAMATION,
                      this);
          event.GetDialog()->SetFocus();
        }
        else
        {
          int iEnd = iStart + sSearch.Length();
          m_textCtrl->SetFocus();
          m_textCtrl->SetInsertionPoint(iEnd+1);
          m_textCtrl->SetSelection (iStart, iEnd);

        }

    }
    else if ( type == wxEVT_COMMAND_FIND_CLOSE )
    {
        wxFindReplaceDialog *dlg = event.GetDialog();

        if ( dlg == m_dlgFind )
        {
            m_dlgFind = NULL;
        }

        dlg->Destroy();
    }
    else
    {
        //wxLogError(wxT("Unknown find dialog event!"));
    }
}
开发者ID:adakite,项目名称:main,代码行数:83,代码来源:RichTextFrame.cpp


示例16: OnFindReplace

void SCH_EDIT_FRAME::OnFindReplace( wxFindDialogEvent& aEvent )
{
    static int              nextFoundIndex = 0;
    SCH_ITEM*               item;
    SCH_SHEET_PATH*         sheet;
    SCH_SHEET_LIST          schematic( g_RootSheet );
    SCH_FIND_COLLECTOR_DATA data;
    SCH_FIND_REPLACE_DATA   searchCriteria;

    searchCriteria.SetFlags( aEvent.GetFlags() );
    searchCriteria.SetFindString( aEvent.GetFindString() );
    searchCriteria.SetReplaceString( aEvent.GetReplaceString() );
    m_foundItems.SetReplaceString( aEvent.GetReplaceString() );

    if( IsSearchCacheObsolete( searchCriteria ) )
    {
        if( aEvent.GetFlags() & FR_CURRENT_SHEET_ONLY && g_RootSheet->CountSheets() > 1 )
        {
            m_foundItems.Collect( searchCriteria, m_CurrentSheet );
        }
        else
        {
            m_foundItems.Collect( searchCriteria );
        }

        // Restore the next found index on cache refresh.  Prevents single replace events
        // from starting back at the beginning of the cache.
        m_foundItems.SetFoundIndex( nextFoundIndex );
    }

    if( aEvent.GetEventType() == wxEVT_COMMAND_FIND_REPLACE_ALL )
    {
        while( ( item = (SCH_ITEM*) m_foundItems.GetItem( data ) ) != NULL )
        {
            SCH_ITEM* undoItem = data.GetParent();

            // Don't save child items in undo list.
            if( undoItem == NULL )
                undoItem = item;

            SetUndoItem( undoItem );

            sheet = schematic.GetSheetByPath( data.GetSheetPath() );

            wxCHECK_RET( sheet != NULL, wxT( "Could not find sheet path " ) + data.GetSheetPath() );

            if( m_foundItems.ReplaceItem( sheet ) )
            {
                OnModify();
                SaveUndoItemInUndoList( undoItem );
                updateFindReplaceView( aEvent );
            }

            m_foundItems.IncrementIndex();

            if( m_foundItems.PassedEnd() )
                break;
        }
    }
    else
    {
        item = (SCH_ITEM*) m_foundItems.GetItem( data );

        wxCHECK_RET( item != NULL, wxT( "Invalid replace item in find collector list." ) );

        SCH_ITEM* undoItem = data.GetParent();

        if( undoItem == NULL )
            undoItem = item;

        SetUndoItem( undoItem );

        sheet = schematic.GetSheetByPath( data.GetSheetPath() );

        wxCHECK_RET( sheet != NULL, wxT( "Could not find sheet path " ) + data.GetSheetPath() );

        if( m_foundItems.ReplaceItem( sheet ) )
        {
            OnModify();
            SaveUndoItemInUndoList( undoItem );
            updateFindReplaceView( aEvent );
        }

        m_foundItems.IncrementIndex();
        nextFoundIndex = m_foundItems.GetFoundIndex();
    }

    // End the replace if we are at the end if the list.  This prevents an infinite loop if
    // wrap search is selected and all of the items have been replaced with a value that
    // still satisfies the search criteria.
    if( m_foundItems.PassedEnd() )
        aEvent.SetFlags( aEvent.GetFlags() & ~FR_REPLACE_ITEM_FOUND );
}
开发者ID:AlexanderBrevig,项目名称:kicad-source-mirror,代码行数:93,代码来源:find.cpp


示例17: OnFindDialog

void DecisionLogicFrame::OnFindDialog(wxFindDialogEvent& event)
{
    wxEventType type = event.GetEventType();
	bool bMatchCase = (event.GetFlags() & wxFR_MATCHCASE) > 0;
	bool bMatchWholeWord = (event.GetFlags() & wxFR_WHOLEWORD) > 0;

    if ( type == wxEVT_COMMAND_FIND || type == wxEVT_COMMAND_FIND_NEXT )
    {
		if (event.GetFlags() & wxFR_PROJECT)
		{
			if (!m_last_find_pos)
				m_last_find_pos = new wxPoint(0,0);
			bool res = m_gui->FindTextInAnyTable((wstring)event.GetFindString(), m_last_find_pos, m_found_name, m_worker->GetProjectManager(), bMatchCase, bMatchWholeWord);
			if (res == false)
			{
				wxMessageBox(_T("No more matches"));
				m_found_name.clear();
			}
			if (m_last_find_pos->x == -1 && m_last_find_pos->y == -1)
			{
				delete m_last_find_pos; //next find will start a new table
				m_last_find_pos = NULL;
			}
		}
		else
		{
			if (type == wxEVT_COMMAND_FIND || (m_last_find_pos != NULL && (m_last_find_pos->x == -1 && m_last_find_pos->y == -1)))
			{
				if (m_last_find_pos)
				{
					delete m_last_find_pos;
					m_last_find_pos = NULL;
				}
				m_last_find_pos = new wxPoint(0,0);
			}

			//highlight on current open table
			if (!m_last_find_pos)
				m_last_find_pos = new wxPoint(0,0);
			m_gui->FindTextInActiveTable((wstring)event.GetFindString(), m_last_find_pos, bMatchCase, bMatchWholeWord);
			if (m_last_find_pos->x == -1 && m_last_find_pos->y == -1)
			{
				wxMessageBox(_T("Reached the end of the table, no matches"));
				if (m_last_find_pos)
				{
					delete m_last_find_pos;
					m_last_find_pos = NULL;
				}
			}
		}
    }
    else if ( type == wxEVT_COMMAND_FIND_REPLACE ||
                type == wxEVT_COMMAND_FIND_REPLACE_ALL )
    {
		if (type == wxEVT_COMMAND_FIND_REPLACE_ALL)
		{
			if (m_last_find_pos)
			{
				delete m_last_find_pos;
				m_last_find_pos = NULL;
			}
			m_last_find_pos = new wxPoint(0,0);
			do
			{
				m_gui->FindTextInActiveTable((wstring)event.GetFindString(), m_last_find_pos, bMatchCase, bMatchWholeWord, true, (wstring)event.GetReplaceString());
			} while (m_last_find_pos->x != -1 && m_last_find_pos->y != -1);
		}
		else
		{
			if (!m_last_find_pos)
				m_last_find_pos = new wxPoint(0,0);
			m_gui->FindTextInActiveTable((wstring)event.GetFindString(), m_last_find_pos, bMatchCase, bMatchWholeWord, true, (wstring)event.GetReplaceString());
			if (m_last_find_pos->x == -1 && m_last_find_pos->y == -1)
				wxMessageBox(_T("Reached the end of the table, no matches"));
		}
    }
    else if ( type == wxEVT_COMMAND_FIND_CLOSE )
    {
		if (m_last_find_pos)
		{
			delete m_last_find_pos;
			m_last_find_pos = NULL;
		}

		m_dlgReplace->Destroy();
		m_dlgReplace = NULL;
    }
    else
    {
        wxLogError(wxT("Unknown find dialog event!"));
    }
}
开发者ID:e1d1s1,项目名称:Logician,代码行数:92,代码来源:DecisionLogic.cpp


示例18: Send

void wxSTEditorFindReplacePanel::Send(wxFindDialogEvent& event)
{
    // we copy the data to dialog->GetData() as well
    m_findReplaceData->SetFlags(event.GetFlags());

    m_findReplaceData->SetFindString(event.GetFindString());
    if (!event.GetFindString().IsEmpty())
        m_findReplaceData->AddFindString(event.GetFindString());

    if ( HasFlag(wxFR_REPLACEDIALOG) &&
         (event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE ||
          event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE_ALL) )
    {
        m_findReplaceData->SetReplaceString(event.GetReplaceString());
        m_findReplaceData->AddReplaceString(event.GetReplaceString());
    }

    // translate wxEVT_COMMAND_FIND_NEXT to wxEVT_COMMAND_FIND if needed
    if ( event.GetEventType() == wxEVT_COMMAND_FIND_NEXT )
    {
        if ( m_findReplaceData->GetFindString() != m_lastSearch )
        {
            event.SetEventType(wxEVT_COMMAND_FIND);
            m_lastSearch = m_findReplaceData->GetFindString();
        }
    }

    // ExtraLong is the line number pressed in the find all editor
    //  when -1 it means that we want a new find all search
    if (m_findReplaceData->HasFlag(STE_FR_FINDALL) && m_resultEditor &&
        (event.GetExtraLong() == -1) &&
        ((event.GetEventType() == wxEVT_COMMAND_FIND) ||
         (event.GetEventType() == wxEVT_COMMAND_FIND_NEXT)))
    {
        m_findReplaceData->GetFindAllStrings()->Clear();
        m_resultEditor->SetReadOnly(false);
        m_resultEditor->SetText(wxEmptyString);
        m_resultEditor->SetReadOnly(true);
    }

    wxWindow *target = GetTargetWindow();

    // first send event to ourselves then to the target
    if ( !GetEventHandler()->ProcessEvent(event) && target )
    {
        // the event is not propagated upwards to the parent automatically
        // because the dialog is a top level window, so do it manually as
        // in 9 cases of 10 the message must be processed by the dialog
        // owner and not the dialog itself
        (void)target->GetEventHandler()->ProcessEvent(event);
    }

    if (m_findReplaceData->HasFlag(STE_FR_FINDALL) && m_resultEditor &&
        (event.GetExtraLong() == -1) &&
        ((event.GetEventType() == wxEVT_COMMAND_FIND) ||
         (event.GetEventType() == wxEVT_COMMAND_FIND_NEXT)))
    {
        wxSTEditor* edit = GetEditor();
        if (edit)
        {
            m_resultEditor->SetLanguage(edit->GetLanguageId());
        }

        wxArrayString* findAllStrings = m_findReplaceData->GetFindAllStrings();
        size_t n, count = findAllStrings->GetCount();
        wxString str;
        for (n = 0; n < count; n++)
            str += findAllStrings->Item(n).AfterFirst(wxT('|'));

        m_resultEditor->Clear();
        m_resultEditor->ClearAllIndicators();

        m_resultEditor->SetReadOnly(false);
        m_resultEditor->SetText(str);
        m_resultEditor->SetReadOnly(true);
        m_resultEditor->Colourise(0, -1);

        wxSTEditorStyles::GetGlobalEditorStyles().SetEditorStyle( 3, STE_STYLE_STRING,
                                                                m_resultEditor, false);
        wxSTEditorStyles::GetGlobalEditorStyles().SetEditorStyle( 4, STE_STYLE_NUMBER,
                                                                m_resultEditor, false);

        for (n = 0; n < count; n++)
        {
            str = findAllStrings->Item(n).AfterFirst(wxT('|'));
            int pos = m_resultEditor->PositionFromLine(n);
            m_resultEditor->StartStyling(pos, 31);
            int length = str.BeforeFirst(wxT('(')).Length() - 1;
            m_resultEditor->SetStyling(length, 3);

            pos = pos + length + 1;
            m_resultEditor->StartStyling(pos, 31);
            length = str.AfterFirst(wxT('(')).BeforeFirst(wxT(')')).Length() + 2;
            m_resultEditor->SetStyling(length, 4);
        }

        m_resultEditor->IndicateAllStrings(m_findReplaceData->GetFindString(),
                                           m_findReplaceData->GetFlags(),
                                           wxSTC_INDIC0_MASK);
    }
//.........这里部分代码省略.........
开发者ID:Slulego,项目名称:GD,代码行数:101,代码来源:stefindr.cpp


示例19: OnFindDialog

void wxSTEditorNotebook::OnFindDialog(wxFindDialogEvent &event)
{
    wxSTERecursionGuard guard(m_rGuard_OnFindDialog);
    if (guard.IsInside()) return;

    // currently opened page is where the search starts
    wxSTEditor *editor = GetEditor();

    if (!editor)
        return;

    // just search the given page by letting the editor handle it
    if (!STE_HASBIT(event.GetFlags(), STE_FR_ALLDOCS))
    {
        editor->HandleFindDialogEvent(event);
        return;
    }

    wxEventType eventType = event.GetEventType();
    wxString findString   = event.GetFindString();
    long flags            = event.GetFlags();

    editor->SetFindString(findString, true);
    editor->SetFindFlags(flags, true);

    STE_TextPos pos = editor->GetCurrentPos();
    if ((eventType == wxEVT_COMMAND_FIND) && STE_HASBIT(flags, STE_FR_WHOLEDOC))
        pos = -1;

    // we have to move cursor to start of word if last backwards search suceeded
    //   note cmp is ok since regexp doesn't handle searching backwards
    if ((eventType == wxEVT_COMMAND_FIND_NEXT) && !STE_HASBIT(flags, wxFR_DOWN))
    {
        if ((labs(editor->GetSelectionEnd() - editor->GetSelectionStart()) == long(findString.Length()))
            && (editor->GetFindReplaceData()->StringCmp(findString, editor->GetSelectedText(), flags)))
                pos -= (STE_TextPos)findString.Length() + 1; // doesn't matter if it matches or not, skip it
    }


    if (eventType == wxEVT_STEFIND_GOTO)
    {
        wxString findAllString(event.GetString());

        wxString fileName;
        int line_number      = 0;
        int line_start_pos   = 0;
        int string_start_pos = 0;
        int string_length    = 0;
        wxString lineText;

        bool ok = wxSTEditorFindReplaceData::ParseFindAllString(findAllString,
                                                                fileName,
                                                                line_number, line_start_pos,
                                                                string_start_pos, string_length,
                                                                lineText);
        int page = wxNOT_FOUND;

        if (ok)
            page = FindEditorPageByFileName(fileName);

        if (page != wxNOT_FOUND)
        {
            SetSelection(page);
            GetEditor(page)->HandleFindDialogEvent(event);
        }
    }
    else if ((eventType == wxEVT_COMMAND_FIND) || (eventType == wxEVT_COMMAND_FIND_NEXT))
    {
        if (STE_HASBIT(flags, STE_FR_FINDALL|STE_FR_BOOKMARKALL))
        {
            // sum up all of the find strings in all editors
            int n, count = (int)GetPageCount();

            for (n = 0; n < count; n++)
            {
                wxSTEditor* e = GetEditor(n);
                if (e)
                    e->HandleFindDialogEvent(event);
            }
        }
        else
        {
            if ((eventType == wxEVT_COMMAND_FIND) && STE_HASBIT(flags, STE_FR_WHOLEDOC))
                pos = 0;

            pos = FindString(findString, pos, flags, STE_FINDSTRING_SELECT|STE_FINDSTRING_GOTO);

            if (pos >= 0)
            {
                //editor->SetFocus();
            }
            else
            {
                wxBell(); // bell ok to signify no more occurances?
            }
        }
    }
    else if (eventType == wxEVT_COMMAND_FIND_REPLACE)
    {
        if (!editor->GetFindReplaceData()->StringCmp(findString, editor->GetSelectedText(), flags))
//.........这里部分代码省略.........
开发者ID:Abyss116,项目名称:luaplus51-all,代码行数:101,代码来源:stenoteb.cpp


示例20: OnFindDialog

void NyqBench::OnFindDialog(wxFindDialogEvent & e)
{
   wxEventType type = e.GetEventType();

   if (type == wxEVT_COMMAND_FIND_CLOSE) {
      wxFindReplaceDialog *dlg = e.GetDialog();

      dlg->Destroy();

      int flags = mFindData.GetFlags();

      gPrefs->Write(wxT("NyqBench/Find/Down"), (flags & wxFR_DOWN) != 0);
      gPrefs->Write(wxT("NyqBench/Find/Word"), (flags & wxFR_WHOLEWORD) != 0);
      gPrefs->Write(wxT("NyqBench/Find/Case"), (flags & wxFR_MATCHCASE) != 0);

      mFindDlg = NULL;
      mFindText = NULL;

      return;
   }

   wxString text = mFindText->GetValue();

#if defined(__WXMSW__)
   // We cheat on Windows.  We know that the Windows text control
   // uses CRLF for line endings and if we don't account for that,
   // the selection positions will be off.
   //
   // Not sure why I thought I needed this, but it appears not to
   // be.  Leaving just in case.
   //
   // text.Replace(wxT("\n"), wxT("\r\n"));
#endif

   size_t startpos = mFindText->GetInsertionPoint();
   size_t len = mFindText->GetLastPosition();
   size_t pos;

   wxString find = e.GetFindString();
   bool down = (e.GetFlags() & wxFR_DOWN) != 0;
   bool mixed = (e.GetFlags() & wxFR_MATCHCASE) != 0;

   if (!mixed) {
      text.MakeUpper();
      find.MakeUpper();
   }

   if (down) {
      pos = text.find(find, startpos);
      if (type == wxEVT_COMMAND_FIND_NEXT && pos == startpos && pos < len) {
         pos = text.find(find, startpos + 1);
      }
   }
   else {
      pos = text.rfind(find, startpos);
      if (type == wxEVT_COMMAND_FIND_NEXT && pos == startpos && pos > 0) {
         pos = text.rfind(find, startpos - 1);
      }
   }

   if (pos == wxString::npos) {
      AudacityMessageBox(_("No matches found"),
                   _("Nyquist Effect Workbench"),
                   wxOK | wxCENTER,
                   e.GetDialog());

      return;
   }

   mFindText->SetInsertionPoint((long)pos);

#if defined(__WXGTK__)
   // GTK's selection and intertion pointer interact where the insertion
   // pointer winds up after the second parameter, so we reverse them to
   // force the pointer at the beginning of the selection.  Doing so
   // allows reverse find to work properly.
   mFindText->SetSelection((long)(pos + find.Length()), (long)pos);
#else
   mFindText->SetSelection((long)pos, (long)(pos + find.Length()));
#endif

#if defined(__WXMAC__)
   // Doing this coaxes the text control to update the selection.  Without
   // it the selection doesn't appear to change if the found string is withi 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ wxFocusEvent类代码示例发布时间:2022-05-31
下一篇:
C++ wxFileSystemWatcherEvent类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap