当前位置: 首页>>代码示例>>C++>>正文


C++ LEditor::DelAllMarkers方法代码示例

本文整理汇总了C++中LEditor::DelAllMarkers方法的典型用法代码示例。如果您正苦于以下问题:C++ LEditor::DelAllMarkers方法的具体用法?C++ LEditor::DelAllMarkers怎么用?C++ LEditor::DelAllMarkers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LEditor的用法示例。


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

示例1: OnHighlightMatches

void QuickFindBar::OnHighlightMatches(wxFlatButtonEvent& e)
{
    bool checked = e.IsChecked();
    LEditor* editor = dynamic_cast<LEditor*>(m_sci);
    if(checked && editor) {
        int flags = DoGetSearchFlags();
        wxString findwhat = m_findWhat->GetValue();
        if(!m_sci || m_sci->GetLength() == 0 || findwhat.IsEmpty()) return;

        // Do we have at least one match?
        if(m_sci->FindText(0, m_sci->GetLastPosition(), findwhat, flags) == wxNOT_FOUND) return;
        m_sci->ClearSelections();
        m_sci->SetCurrentPos(0);
        m_sci->SetSelectionEnd(0);
        m_sci->SetSelectionStart(0);

        editor->SetFindBookmarksActive(true);
        editor->DelAllMarkers(smt_find_bookmark);

        while(true) {
            m_sci->SearchAnchor();
            if(m_sci->SearchNext(flags, findwhat) != wxNOT_FOUND) {
                int selStart, selEnd;
                m_sci->GetSelection(&selStart, &selEnd);
                m_sci->SetIndicatorCurrent(MARKER_WORD_HIGHLIGHT);
                m_sci->IndicatorFillRange(selStart, selEnd - selStart);
                m_sci->MarkerAdd(m_sci->LineFromPosition(selStart), smt_find_bookmark);

                // Clear the selection so the next 'SearchNext' will search forward
                m_sci->SetCurrentPos(selEnd);
                m_sci->SetSelectionEnd(selEnd);
                m_sci->SetSelectionStart(selEnd);
            } else {
                break;
            }
        }

    } else {
        if(editor) {
            editor->DelAllMarkers(smt_find_bookmark);
            editor->SetFindBookmarksActive(false);
        }
    }

    clMainFrame::Get()->SelectBestEnvSet(); // Updates the statusbar display
}
开发者ID:GaganJotSingh,项目名称:codelite,代码行数:46,代码来源:quickfindbar.cpp

示例2: ProcessCommandEvent

//------------------------------------
// Bookmarks
//------------------------------------
void BookmarkHandler::ProcessCommandEvent(wxWindow *owner, wxCommandEvent &event)
{
    LEditor *editor = dynamic_cast<LEditor*>(owner);
    if ( !editor ) {
        return;
    }

    if (event.GetId() == XRCID("toggle_bookmark")) {
        editor->ToggleMarker();
    } else if (event.GetId() == XRCID("next_bookmark")) {
        editor->FindNextMarker();
    } else if (event.GetId() == XRCID("previous_bookmark")) {
        editor->FindPrevMarker();
    } else if (event.GetId() == XRCID("removeall_current_bookmarks")) {
        editor->DelAllMarkers(0);   //  0 == only the currently-active type
    } else if (event.GetId() == XRCID("removeall_bookmarks")) {
        editor->DelAllMarkers(-1);  // -1 == all types
    }
}
开发者ID:fxj7158,项目名称:codelite,代码行数:22,代码来源:menu_event_handlers.cpp

示例3: OnHighlightMatches

void QuickFindBar::OnHighlightMatches(wxFlatButtonEvent& e)
{
    bool checked = e.IsChecked();
    LEditor* editor = dynamic_cast<LEditor*>(m_sci);
    if(checked && editor) {
        editor->SetFindBookmarksActive(true);
        DoMarkAll();

    } else {
        if(editor) {
            editor->DelAllMarkers(smt_find_bookmark);
            editor->SetFindBookmarksActive(false);
        }
    }

    clMainFrame::Get()->SelectBestEnvSet(); // Updates the statusbar display
}
开发者ID:gahr,项目名称:codelite,代码行数:17,代码来源:quickfindbar.cpp

示例4: DoMarkAll

void QuickFindBar::DoMarkAll(bool useIndicators)
{
    if(!m_sci)
        return;

    LEditor* editor = dynamic_cast<LEditor*>(m_sci);
    if(!editor)
        return;

    wxString findWhat = m_findWhat->GetValue();

    if(findWhat.IsEmpty()) {
        return;
    }

    // Save the caret position
    long savedPos = m_sci->GetCurrentPos();
    size_t flags = DoGetSearchFlags();

    int pos(0);
    int match_len(0);

    // remove reverse search
    flags &= ~wxSD_SEARCH_BACKWARD;
    int offset(0);

    wchar_t* pinput = DoGetSearchStringPtr();
    if(!pinput)
        return;

    int fixed_offset(0);

    // Clear markers
    editor->DelAllMarkers(smt_find_bookmark);

    // set the active indicator to be 1
    editor->SetIndicatorCurrent(1);

    size_t count(0);
    int firstMatchPos(wxNOT_FOUND);
    while(StringFindReplacer::Search(pinput, offset, findWhat.wc_str(), flags, pos, match_len)) {
        int matchStart = fixed_offset + pos;
        int matchEnd = matchStart + match_len;
        if(useIndicators) {
            editor->MarkerAdd(editor->LineFromPosition(fixed_offset + pos), smt_find_bookmark);

            // add indicator as well
            editor->IndicatorFillRange(fixed_offset + pos, match_len);
        } else {
            // Use multiple selections
            if(count) {
                // we already have the main selection, add secondary selections
                editor->AddSelection(matchStart, matchEnd);

            } else {
                // clear and set the first selection
                editor->ClearSelections();
                editor->SetSelection(matchStart, matchEnd);
                firstMatchPos = matchStart;
            }
        }
        ++count;
        offset = pos + match_len;
    }

    // Restore the caret
    if(useIndicators) {
        editor->SetCurrentPos(savedPos);
        editor->EnsureCaretVisible();
    }

    if(firstMatchPos != wxNOT_FOUND) {
        editor->SetMainSelection(0);
        editor->SetLineVisible(editor->LineFromPos(firstMatchPos));
    }

    if(!useIndicators) {
        // Hide the bar
        Show(false);
    }
}
开发者ID:gahr,项目名称:codelite,代码行数:81,代码来源:quickfindbar.cpp


注:本文中的LEditor::DelAllMarkers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。