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


C++ IEditor::GetCtrl方法代码示例

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


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

示例1: OnPreviewClicked

void ZoomNavigator::OnPreviewClicked(wxMouseEvent& e)
{
    IEditor* curEditor = m_mgr->GetActiveEditor();

    // user clicked on the preview
    CHECK_CONDITION(m_startupCompleted);
    CHECK_CONDITION(curEditor);
    CHECK_CONDITION(m_enabled);

    // the first line is taken from the preview
    int pos = m_text->PositionFromPoint(e.GetPosition());
    if(pos == wxSTC_INVALID_POSITION) {
        return;
    }
    int first = m_text->LineFromPosition(pos);
    int nLinesOnScreen = curEditor->GetCtrl()->LinesOnScreen();
    first -= (nLinesOnScreen / 2);
    if(first < 0) first = 0;

    // however, the last line is set according to the actual editor
    int last = nLinesOnScreen + first;

    PatchUpHighlights(first, last);
    curEditor->GetCtrl()->SetFirstVisibleLine(first);
    curEditor->SetCaretAt(curEditor->PosFromLine(first + (nLinesOnScreen / 2)));

    // reset the from/last members to avoid unwanted movements in the 'OnTimer' function
    m_markerFirstLine = curEditor->GetCtrl()->GetFirstVisibleLine();
    m_markerLastLine = m_markerFirstLine + curEditor->GetCtrl()->LinesOnScreen();
}
开发者ID:huan5765,项目名称:codelite-translate2chinese,代码行数:30,代码来源:zoomnavigator.cpp

示例2: CreateHelpPage

void CMakeHelpTab::CreateHelpPage(const wxString& content, const wxString& subject)
{
    wxString text = content;
    text.Replace("<br />", "\n");
    text.Replace("&lt;" , "<");
    text.Replace("&gt;" , ">");
    text.Replace("\r", "");
    text.Replace("\n\n", "\n");
    text.Replace("::\n", "\n\n");
    IManager* manager = ::clGetManager();
    
    // Write the content of the help into a temporary file
    wxFileName fnTemp = wxFileName::CreateTempFileName("cmake");
    wxFileName fnCMakeHelpFile = fnTemp;
    fnCMakeHelpFile.SetFullName("CMakeHelp.cmake");
    
    if(!FileUtils::WriteFileContent(fnCMakeHelpFile, text)) return;
    
    if(manager->OpenFile(fnCMakeHelpFile.GetFullPath())) {
        IEditor* activeEditor = manager->GetActiveEditor();
        if(activeEditor && activeEditor->GetFileName().GetFullPath() == fnCMakeHelpFile.GetFullPath()) {
            activeEditor->GetCtrl()->SetEditable(true);
            activeEditor->ReloadFile();
            activeEditor->GetCtrl()->SetFirstVisibleLine(0);
            activeEditor->GetCtrl()->SetEditable(false);
        }
    }
}
开发者ID:292388900,项目名称:codelite,代码行数:28,代码来源:CMakeHelpTab.cpp

示例3: OnInsertDoxyComment

void PHPEditorContextMenu::OnInsertDoxyComment(wxCommandEvent& e)
{
    IEditor* editor = m_manager->GetActiveEditor();
    if(editor) {
        PHPEntityBase::Ptr_t entry =
            PHPCodeCompletion::Instance()->GetPHPEntityAtPos(editor, editor->GetCurrentPosition());
        if(entry) {
            wxStyledTextCtrl* ctrl = editor->GetCtrl();
            ctrl->BeginUndoAction();
            wxString comment = entry->FormatPhpDoc();

            // Create the whitespace buffer
            int lineStartPos = ctrl->PositionFromLine(ctrl->GetCurrentLine());
            int lineEndPos = lineStartPos + ctrl->LineLength(ctrl->GetCurrentLine());

            // Collect all whitespace from the begining of the line until the first non whitespace
            // character we find
            wxString whitespace;
            for(int i = lineStartPos; lineStartPos < lineEndPos; ++i) {
                if(ctrl->GetCharAt(i) == ' ' || ctrl->GetCharAt(i) == '\t') {
                    whitespace << (wxChar)ctrl->GetCharAt(i);
                } else {
                    break;
                }
            }

            // Prepare the comment block
            wxArrayString lines = ::wxStringTokenize(comment, "\n", wxTOKEN_STRTOK);
            for(size_t i = 0; i < lines.size(); ++i) {
                lines.Item(i).Prepend(whitespace);
            }

            // Glue the lines back together
            wxString doxyBlock = ::wxJoin(lines, '\n');
            doxyBlock << "\n";

            // Insert the text
            ctrl->InsertText(lineStartPos, doxyBlock);

            // Try to place the caret after the @brief
            wxRegEx reBrief("[@\\]brief[ \t]*");
            if(reBrief.IsValid() && reBrief.Matches(doxyBlock)) {
                wxString match = reBrief.GetMatch(doxyBlock);
                // Get the index
                int where = doxyBlock.Find(match);
                if(where != wxNOT_FOUND) {
                    where += match.length();
                    int caretPos = lineStartPos + where;
                    editor->SetCaretAt(caretPos);
                    // Remove the @brief as its non standard in the PHP world
                    editor->GetCtrl()->DeleteRange(caretPos - match.length(), match.length());
                }
            }
            editor->GetCtrl()->EndUndoAction();
        }
    }
}
开发者ID:srini2174,项目名称:codelite,代码行数:57,代码来源:php_editor_context_menu.cpp

示例4: OnContextMenu

// ------------------------------------------------------------
void SpellCheck::OnContextMenu(wxCommandEvent& e)
{
    IEditor* editor = GetEditor();

    if(!editor) {
        e.Skip();
        return;
    }

    wxPoint pt = wxGetMousePosition();
    pt = editor->GetCtrl()->ScreenToClient(pt);
    int pos = editor->GetCtrl()->PositionFromPoint(pt);

    if(editor->GetCtrl()->IndicatorValueAt(3, pos) == 1) {
        wxMenu popUp;
        m_timer.Stop();

        int start = editor->WordStartPos(pos, true);
        editor->SelectText(start, editor->WordEndPos(pos, true) - start);
        wxString sel = editor->GetSelection();
        wxArrayString sugg = m_pEngine->GetSuggestions(sel);

        for(wxUint32 i = 0; i < sugg.GetCount(); i++) {
            popUp.Append(SPC_BASEID + i, sugg[i], "");
        }

        if(sugg.GetCount() == 0)
            popUp.SetTitle(_("No suggestions"));
        else
            popUp.AppendSeparator();

        popUp.Append(SPC_BASEID - 1, _("Ignore"), "");
        popUp.Append(SPC_BASEID - 2, _("Add"), "");

        int index = editor->GetCtrl()->GetPopupMenuSelectionFromUser(popUp);

        if(index != wxID_NONE) {
            if(index >= SPC_BASEID) {
                index -= SPC_BASEID;
                editor->ReplaceSelection(sugg[index]);
            } else {
                if(index == SPC_BASEID - 1)
                    m_pEngine->AddWordToIgnoreList(sel);
                else if(index == SPC_BASEID - 2)
                    m_pEngine->AddWordToUserDict(sel);
            }
        }
        m_timer.Start(PARSE_TIME);
    } else
        e.Skip();
}
开发者ID:nanolion,项目名称:codelite,代码行数:52,代码来源:spellcheck.cpp

示例5: InsertSelectionTemplateFunction

void wxCodeCompletionBoxManager::InsertSelectionTemplateFunction(const wxString& selection)
{
    IManager* manager = ::clGetManager();
    IEditor* editor = manager->GetActiveEditor();
    if(editor) {
        wxStyledTextCtrl* ctrl = editor->GetCtrl();
        // Default behviour: remove the partial text from teh editor and replace it
        // with the selection
        int start = ctrl->WordStartPosition(ctrl->GetCurrentPos(), true);
        int end = ctrl->GetCurrentPos();
        ctrl->SetSelection(start, end);

        wxString entryText = selection;
        if(entryText.Find("(") != wxNOT_FOUND) {
            // a function like
            wxString textToInsert = entryText.BeforeFirst('(');
            textToInsert << "<>()";
            ctrl->ReplaceSelection(textToInsert);
            // Place the caret between the angle brackets
            int caretPos = start + textToInsert.Len() - 3;
            ctrl->SetCurrentPos(caretPos);
            ctrl->SetSelection(caretPos, caretPos);

        } else {
            ctrl->ReplaceSelection(entryText);
        }
    }
}
开发者ID:lpc1996,项目名称:codelite,代码行数:28,代码来源:wxCodeCompletionBoxManager.cpp

示例6: DoUpdateNotebookTheme

void MainBook::DoUpdateNotebookTheme()
{
    size_t initialStyle = m_book->GetStyle();
    size_t style = m_book->GetStyle();
    if(EditorConfigST::Get()->GetOptions()->IsTabColourMatchesTheme()) {
        // Update theme
        IEditor* editor = GetActiveEditor();
        if(editor) {
            wxColour bgColour = editor->GetCtrl()->StyleGetBackground(0);
            if(DrawingUtils::IsDark(bgColour) && !(m_book->GetStyle() & kNotebook_DarkTabs)) {
                style &= ~kNotebook_LightTabs;
                style |= kNotebook_DarkTabs;
            } else if(!DrawingUtils::IsDark(bgColour) && !(m_book->GetStyle() & kNotebook_LightTabs)) {
                style &= ~kNotebook_DarkTabs;
                style |= kNotebook_LightTabs;
            }
        } else {
            style &= ~kNotebook_DarkTabs;
            style |= kNotebook_LightTabs;
        }
    } else {
        style &= ~kNotebook_DarkTabs;
        style |= kNotebook_LightTabs;
    }

    if(!EditorConfigST::Get()->GetOptions()->IsTabHasXButton()) {
        style &= ~(kNotebook_CloseButtonOnActiveTab | kNotebook_CloseButtonOnActiveTabFireEvent);
    } else {
        style |= (kNotebook_CloseButtonOnActiveTab | kNotebook_CloseButtonOnActiveTabFireEvent);
    }
    if(initialStyle != style) {
        m_book->SetStyle(style);
    }
}
开发者ID:fmestrone,项目名称:codelite,代码行数:34,代码来源:mainbook.cpp

示例7: DoUpdate

void ZoomNavigator::DoUpdate()
{
    // sanity tests
    CHECK_CONDITION(m_enabled);
    CHECK_CONDITION(!m_mgr->IsShutdownInProgress());

    IEditor* curEditor = m_mgr->GetActiveEditor();
    if(!curEditor && !m_text->IsEmpty()) {
        DoCleanup();
    }
    CHECK_CONDITION(curEditor);

    wxStyledTextCtrl* stc = curEditor->GetCtrl();
    CHECK_CONDITION(stc);

    if(curEditor->GetFileName().GetFullPath() != m_curfile) {
        SetEditorText(curEditor);
    }

    int first = stc->GetFirstVisibleLine();
    int last = stc->LinesOnScreen() + first;

    if(m_markerFirstLine != first || m_markerLastLine != last) {
        PatchUpHighlights(first, last);
        SetZoomTextScrollPosToMiddle(stc);
    }
}
开发者ID:huan5765,项目名称:codelite-translate2chinese,代码行数:27,代码来源:zoomnavigator.cpp

示例8: OnToggleBreakpoint

void LLDBPlugin::OnToggleBreakpoint(clDebugEvent& event)
{
    // Call Skip() here since we want codelite to manage the breakpoint as well ( in term of serialization in the
    // session file )
    CHECK_IS_LLDB_SESSION();

    // check to see if we are removing a breakpoint or adding one
    LLDBBreakpoint::Ptr_t bp(new LLDBBreakpoint(event.GetFileName(), event.GetInt()));
    IEditor* editor = m_mgr->GetActiveEditor();

    if(editor) {
        // get the marker type set on the line
        int markerType = editor->GetCtrl()->MarkerGet(bp->GetLineNumber() - 1);
        for(size_t type = smt_FIRST_BP_TYPE; type <= smt_LAST_BP_TYPE; ++type) {
            int markerMask = (1 << type);
            if(markerType & markerMask) {
                // removing a breakpoint. "DeleteBreakpoint" will handle the interactive/non-interactive mode
                // of the debugger
                m_connector.MarkBreakpointForDeletion(bp);
                m_connector.DeleteBreakpoints();
                return;
            }
        }

        // if we got here, its a new breakpoint, add it
        // Add the breakpoint to the list of breakpoints
        m_connector.AddBreakpoint(bp->GetFilename(), bp->GetLineNumber());

        // apply it. In case the debugger can not interact with, it will be interrupted and the interrupt reason
        // will be set to ApplyBreakpoints
        m_connector.ApplyBreakpoints();
    }
}
开发者ID:eranif,项目名称:codelite,代码行数:33,代码来源:LLDBPlugin.cpp

示例9: OnCodeComplete

void WebTools::OnCodeComplete(clCodeCompletionEvent& event)
{
    event.Skip();
    IEditor* editor = m_mgr->GetActiveEditor();
    if(editor && m_jsCodeComplete && IsJavaScriptFile(editor)) {
        event.Skip(false);
        if(InsideJSComment(editor) || InsideJSString(editor)) {
            // User the word completion plugin instead
            m_jsCodeComplete->TriggerWordCompletion();
        } else {
            m_jsCodeComplete->CodeComplete(editor);
        }
    } else if(editor && m_xmlCodeComplete && editor->GetCtrl()->GetLexer() == wxSTC_LEX_XML) {
        // an XML file
        event.Skip(false);
        m_xmlCodeComplete->XmlCodeComplete(editor);
    } else if(editor && m_xmlCodeComplete && IsHTMLFile(editor)) {
        // Html code completion
        event.Skip(false);
        m_xmlCodeComplete->HtmlCodeComplete(editor);
    } else if(editor && m_cssCodeComplete && IsCSSFile(editor)) {
        // CSS code completion
        event.Skip(false);
        m_cssCodeComplete->CssCodeComplete(editor);
    }
}
开发者ID:capturePointer,项目名称:codelite,代码行数:26,代码来源:webtools.cpp

示例10: DoGetActiveScintila

wxStyledTextCtrl* PHPEditorContextMenu::DoGetActiveScintila()
{
    IEditor* editor = m_manager->GetActiveEditor();
    if(editor) {
        return editor->GetCtrl();
    }
    return NULL;
}
开发者ID:GaganJotSingh,项目名称:codelite,代码行数:8,代码来源:php_editor_context_menu.cpp

示例11: ColourJavaScript

void WebTools::ColourJavaScript(const JavaScriptSyntaxColourThread::Reply& reply)
{
    IEditor* editor = m_mgr->FindEditor(reply.filename);
    if(editor) {
        wxStyledTextCtrl* ctrl = editor->GetCtrl();
        ctrl->SetKeyWords(1, reply.properties);
        ctrl->SetKeyWords(3, reply.functions);
        m_lastColourUpdate = time(NULL);
    }
}
开发者ID:capturePointer,项目名称:codelite,代码行数:10,代码来源:webtools.cpp

示例12: DoOpenEditorForEntry

void PHPCodeCompletion::DoOpenEditorForEntry(PHPEntityBase::Ptr_t entry)
{
    // Open the file (make sure we use the 'OpenFile' so we will get a browsing record)
    IEditor* editor = m_manager->OpenFile(entry->GetFilename().GetFullPath(), wxEmptyString, entry->GetLine());
    if(editor) {
        // Select the word in the editor (its a new one)
        int selectFromPos = editor->GetCtrl()->PositionFromLine(entry->GetLine());
        DoSelectInEditor(editor, entry->GetShortName(), selectFromPos);
    }
}
开发者ID:anatooly,项目名称:codelite,代码行数:10,代码来源:php_code_completion.cpp

示例13: JumpToLocation

void MemCheckOutputView::JumpToLocation(const wxDataViewItem& item)
{
    // CL_DEBUG1(PLUGIN_PREFIX("MemCheckOutputView::JumpToLocation()"));

    MemCheckErrorLocationReferrer* locationRef =
        dynamic_cast<MemCheckErrorLocationReferrer*>(m_dataViewCtrlErrorsModel->GetClientObject(item));
    if(!locationRef) return;

    int line = locationRef->Get().line - 1;
    wxString fileName = locationRef->Get().getFile();

    if(line < 0 || fileName.IsEmpty()) return;

    if(m_mgr->OpenFile(fileName, wxEmptyString, line)) {
        IEditor* editor = m_mgr->GetActiveEditor();
        if(editor) {
            int posStart = editor->GetCtrl()->PositionFromLine(line);
            int lineLen = editor->GetCtrl()->LineLength(line);
            editor->SelectText(posStart, lineLen - 1);
        }
    }
}
开发者ID:huan5765,项目名称:codelite-translate2chinese,代码行数:22,代码来源:memcheckoutputview.cpp

示例14: OnEditorChanged

void NodeJSBptManager::OnEditorChanged(wxCommandEvent& e)
{
    e.Skip();

    // Apply breakpoints for this editor
    if(clGetManager()) {
        IEditor* editor = clGetManager()->GetActiveEditor();
        if(editor) {
            NodeJSBreakpoint::List_t bps;
            if(GetBreakpointsForFile(editor->GetFileName().GetFullPath(), bps)) {
                NodeJSBreakpoint::List_t::iterator iter = bps.begin();
                for(; iter != bps.end(); ++iter) {
                    int markerMask = editor->GetCtrl()->MarkerGet(iter->GetLine() - 1);
                    if(!(markerMask & mmt_breakpoint)) {
                        // No marker on this line yet
                        // add one
                        editor->GetCtrl()->MarkerAdd(iter->GetLine() - 1, smt_breakpoint);
                    }
                }
            }
        }
    }
}
开发者ID:292388900,项目名称:codelite,代码行数:23,代码来源:NodeJSDebuggerBreakpointManager.cpp

示例15: OnCodeComplete

void XMLCodeCompletion::OnCodeComplete(clCodeCompletionEvent& event)
{
    event.Skip();
    IEditor* editor = dynamic_cast<IEditor*>(event.GetEditor());
    if(editor && editor->GetCtrl()->GetLexer() == wxSTC_LEX_XML) {
        // an XML file
        event.Skip(false);
        XmlCodeComplete(editor);
    } else if(editor && m_plugin->IsHTMLFile(editor)) {
        // Html code completion
        event.Skip(false);
        HtmlCodeComplete(editor);
    }
}
开发者ID:eranif,项目名称:codelite,代码行数:14,代码来源:XMLCodeCompletion.cpp


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