Пример #1
0
void wxSTEditorFindReplacePanel::OnMarginClick( wxStyledTextEvent &event )
{
    if (!m_resultEditor) return; // set after editor is fully created

    if (event.GetEventType() == wxEVT_STE_MARGINDCLICK)
        return;

    wxSTEditor *editor = (wxSTEditor*)event.GetEventObject();
    int pos = event.GetPosition();

    if (event.GetEventType() == wxEVT_STC_DOUBLECLICK) // event pos not set correctly
        pos = editor->GetCurrentPos();

    int line = editor->LineFromPosition(pos);

    if (editor->GetLine(line).Strip(wxString::both).IsEmpty())
        return;

    wxArrayString* findAllStrings = m_findReplaceData->GetFindAllStrings();

    if ((line < 0) || (line >= (int)findAllStrings->GetCount()))
        return;

    editor->MarkerDeleteAll(STE_MARKER_BOOKMARK);
    editor->MarkerAdd(line, STE_MARKER_BOOKMARK);

    wxFindDialogEvent fEvent(wxEVT_COMMAND_FIND_NEXT, GetId());
    fEvent.SetEventObject(this);
    fEvent.SetFindString(m_findCombo->GetValue());
    fEvent.SetFlags(GetFindFlags());
    fEvent.SetExtraLong(line);
    Send(fEvent);
}
Пример #2
0
void PyConsole::OnStcEvent(wxStyledTextEvent& event)
{
    if( event.GetEventType() == wxEVT_STC_DOUBLECLICK )
    {
        wxString word = m_control->GetSelectedText();
        HighlightOccurrences(word, wxSTC_FIND_MATCHCASE | wxSTC_FIND_WORDSTART );
        event.Skip();
    }
}