Esempio n. 1
0
void FindResultsTab::PrevMatch()
{
    // m_sci holds to the selected tab's scintilla editor
    if(m_sci) {
        const MatchInfo& matchInfo = GetMatchInfo(m_book ? m_book->GetSelection() : 0);

        // locate the last match
        int firstLine = m_sci->MarkerPrevious(m_sci->GetLineCount() - 1, 255);
        if(firstLine == wxNOT_FOUND) {
            firstLine = m_sci->GetLineCount();
        }

        // We found the last marker
        for(int i = firstLine - 1; i >= 0; i--) {

            // Find the next match
            MatchInfo::const_iterator iter = matchInfo.find(i);
            if(iter != matchInfo.end()) {
                SearchResult sr = iter->second;

                // open the new searchresult in the editor
                DoOpenSearchResult(sr, m_sci, i);
                return;
            }
        }
        // if we are here, it means we are the top of the search results list, add a status message
        clMainFrame::Get()->GetStatusBar()->SetMessage(_("Reached the start of the 'Find In Files' results"));
    }
}
Esempio n. 2
0
void FindResultsTab::NextMatch()
{
    // locate the last match
    int firstLine = m_sci->MarkerNext(0, 255);
    if(firstLine == wxNOT_FOUND) {
        firstLine = 0;
    }

    // We found the last marker
    for(int i = firstLine + 1; i < m_sci->GetLineCount(); i++) {

        // Find the next match
        MatchInfo_t::const_iterator iter = m_matchInfo.find(i);
        if(iter != m_matchInfo.end()) {
            SearchResult sr = iter->second;

            // open the new searchresult in the editor
            DoOpenSearchResult(sr, m_sci, i);
            return;
        }
    }

    // if we are here, it means we are the end of the search results list, add a status message
    clMainFrame::Get()->GetStatusBar()->SetMessage(_("Reached the end of the 'Find In Files' results"));
}
Esempio n. 3
0
void FindResultsTab::OnMouseDClick(wxStyledTextEvent& e)
{
    long pos = e.GetPosition();
    int line = m_sci->LineFromPosition(pos);
    int style = m_sci->GetStyleAt(pos);

    if(style == LEX_FIF_FILE || style == LEX_FIF_HEADER) {
        m_sci->ToggleFold(line);

    } else {
        MatchInfo_t::const_iterator m = m_matchInfo.find(line);
        if(m != m_matchInfo.end()) {
            DoOpenSearchResult(m->second, m_sci, m->first);
        }
    }
}
Esempio n. 4
0
void FindResultsTab::OnMouseDClick(wxStyledTextEvent& e)
{
    long pos = e.GetPosition();
    int line = m_sci->LineFromPosition(pos);
    int style = m_sci->GetStyleAt(pos);

    if(style == LEX_FIF_FILE || style == LEX_FIF_HEADER) {
        m_sci->ToggleFold(line);

    } else {
        int n = m_book ? m_book->GetSelection() : 0;
        const MatchInfo& matchInfo = GetMatchInfo(n);
        MatchInfo::const_iterator m = matchInfo.find(line);
        if(m != matchInfo.end()) {
            DoOpenSearchResult(m->second, m_sci, m->first);
        }
    }

    m_sci->SetSelection(wxNOT_FOUND, pos);
}