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


C++ CodeEditorComponent类代码示例

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


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

示例1: settings

//==============================================================================
AppearanceSettings::AppearanceSettings (bool updateAppWhenChanged)
    : settings ("COLOUR_SCHEME")
{
    IntrojucerLookAndFeel lf;

    for (int i = 0; i < AppearanceColours::numColours; ++i)
        getColourValue (AppearanceColours::colours[i].name) = lf.findColour (AppearanceColours::colours[i].colourID).toString();

    CodeDocument doc;
    CPlusPlusCodeTokeniser tokeniser;
    CodeEditorComponent editor (doc, &tokeniser);

    const CodeEditorComponent::ColourScheme cs (editor.getColourScheme());

    for (int i = cs.types.size(); --i >= 0;)
    {
        CodeEditorComponent::ColourScheme::TokenType& t = cs.types.getReference(i);
        getColourValue (t.name) = t.colour.toString();
    }

    getCodeFontValue() = getDefaultCodeFont().toString();

    if (updateAppWhenChanged)
        settings.addListener (this);
}
开发者ID:Krewn,项目名称:LIOS,代码行数:26,代码来源:jucer_AppearanceSettings.cpp

示例2: draw

    void draw (CodeEditorComponent& owner, Graphics& g, const Font& font,
               float x, const int y, const int baselineOffset, const int lineHeight,
               const Colour& highlightColour) const throw()
    {
        if (highlightColumnStart < highlightColumnEnd)
        {
            g.setColour (highlightColour);
            g.fillRect (roundToInt (x + highlightColumnStart * owner.getCharWidth()), y,
                        roundToInt ((highlightColumnEnd - highlightColumnStart) * owner.getCharWidth()), lineHeight);
        }

        int lastType = INT_MIN;

        for (int i = 0; i < tokens.size(); ++i)
        {
            SyntaxToken* const token = tokens.getUnchecked(i);

            if (lastType != token->tokenType)
            {
                lastType = token->tokenType;
                g.setColour (owner.getColourForTokenType (lastType));
            }

            g.drawSingleLineText (token->text, roundToInt (x), y + baselineOffset);

            if (i < tokens.size() - 1)
            {
                if (token->width < 0)
                    token->width = font.getStringWidthFloat (token->text);

                x += token->width;
            }
        }
    }
开发者ID:alessandropetrolati,项目名称:juced,代码行数:34,代码来源:juce_CodeEditorComponent.cpp

示例3: draw

    void draw (CodeEditorComponent& owner, Graphics& g, const Font& font,
               float x, const int y, const int baselineOffset, const int lineHeight,
               const Colour& highlightColour) const
    {
        if (highlightColumnStart < highlightColumnEnd)
        {
            g.setColour (highlightColour);
            g.fillRect (roundToInt (x + highlightColumnStart * owner.getCharWidth()), y,
                        roundToInt ((highlightColumnEnd - highlightColumnStart) * owner.getCharWidth()), lineHeight);
        }

        int lastType = std::numeric_limits<int>::min();

        for (int i = 0; i < tokens.size(); ++i)
        {
            SyntaxToken& token = tokens.getReference(i);

            if (lastType != token.tokenType)
            {
                lastType = token.tokenType;
                g.setColour (owner.getColourForTokenType (lastType));
            }

            g.drawSingleLineText (token.text, roundToInt (x), y + baselineOffset);

            if (i < tokens.size() - 1)
            {
                if (token.width < 0)
                    token.width = font.getStringWidthFloat (token.text);

                x += token.width;
            }
        }
    }
开发者ID:SonicPotions,项目名称:editor,代码行数:34,代码来源:juce_CodeEditorComponent.cpp

示例4: updatePosition

    void updatePosition (CodeEditorComponent& owner)
    {
        startTimer (400);
        setVisible (true);

        const Rectangle pos (owner.getCharacterBounds (owner.getCaretPos()));
        setBounds (pos.getX(), pos.getY(), 2, pos.getHeight());
    }
开发者ID:alessandropetrolati,项目名称:juced,代码行数:8,代码来源:juce_CodeEditorComponent.cpp

示例5:

void CodeEditorComponent::State::restoreState (CodeEditorComponent& editor) const
{
    editor.selectRegion (CodeDocument::Position (editor.getDocument(), lastSelectionEnd),
                         CodeDocument::Position (editor.getDocument(), lastCaretPos));

    if (lastTopLine > 0 && lastTopLine < editor.getDocument().getNumLines())
        editor.scrollToLine (lastTopLine);
}
开发者ID:grimtraveller,项目名称:mlrVST,代码行数:8,代码来源:juce_CodeEditorComponent.cpp

示例6: lastTopLine

CodeEditorComponent::State::State (const CodeEditorComponent& editor)
    : lastTopLine (editor.getFirstLineOnScreen()),
      lastCaretPos (editor.getCaretPos().getPosition()),
      lastSelectionEnd (lastCaretPos)
{
    const Range<int> selection (editor.getHighlightedRegion());

    if (lastCaretPos == selection.getStart())
        lastSelectionEnd = selection.getEnd();
    else
        lastSelectionEnd = selection.getStart();
}
开发者ID:grimtraveller,项目名称:mlrVST,代码行数:12,代码来源:juce_CodeEditorComponent.cpp

示例7: getMethodManager

void CtrlrLuaMethodEditor::searchResultClicked (const String &methodName, const int lineNumber, const int resultPositionStart, const int resultPositionEnd)
{
//	_DBG("CtrlrLuaMethodEditor::searchResultClicked");
//	_DBG("\t"+methodName+" ln:"+STR(lineNumber)+" s:"+STR(resultPositionStart)+" e:"+STR(resultPositionEnd));

	CtrlrLuaMethod *method = getMethodManager().getMethodByName(methodName);
	if (method != nullptr)
	{
		setEditedMethod (method->getUuid());

		if (method->getCodeEditor())
		{
			CodeEditorComponent *ed = method->getCodeEditor()->getCodeComponent();
			CodeDocument &doc		= method->getCodeEditor()->getCodeDocument();
			if (ed)
			{
				ed->selectRegion (CodeDocument::Position(doc,resultPositionStart), CodeDocument::Position(doc,resultPositionEnd));
			}
		}
	}
}
开发者ID:grimtraveller,项目名称:ctrlr,代码行数:21,代码来源:CtrlrLuaMethodEditor.cpp

示例8: cs

void AppearanceSettings::applyToCodeEditor (CodeEditorComponent& editor) const
{
    CodeEditorComponent::ColourScheme cs (editor.getColourScheme());

    for (int i = cs.types.size(); --i >= 0;)
    {
        CodeEditorComponent::ColourScheme::TokenType& t = cs.types.getReference(i);
        getColour (t.name, t.colour);
    }

    editor.setColourScheme (cs);
    editor.setFont (getCodeFont());

    for (int i = 0; i < AppearanceColours::numColours; ++i)
    {
        if (AppearanceColours::colours[i].applyToEditorOnly)
        {
            Colour col;
            if (getColour (AppearanceColours::colours[i].name, col))
                editor.setColour (AppearanceColours::colours[i].colourID, col);
        }
    }

    editor.setColour (ScrollBar::thumbColourId,
                      IntrojucerLookAndFeel::getScrollbarColourForBackground (editor.findColour (CodeEditorComponent::backgroundColourId)));
}
开发者ID:Krewn,项目名称:LIOS,代码行数:26,代码来源:jucer_AppearanceSettings.cpp

示例9: draw

    void draw (CodeEditorComponent& owner, Graphics& g, const Font& fontToUse,
               const float rightClip, const float x, const int y,
               const int lineH, const float characterWidth) const
    {
        Colour lastColour (0x00000001);

        AttributedString as;
        as.setJustification (Justification::centredLeft);

        int column = 0;

        for (int i = 0; i < tokens.size(); ++i)
        {
            const float tokenX = x + column * characterWidth;
            if (tokenX > rightClip)
                break;

            const SyntaxToken& token = tokens.getReference(i);
            as.append (token.text.removeCharacters ("\r\n"), fontToUse, owner.getColourForTokenType (token.tokenType));
            column += token.length;
        }

        as.draw (g, Rectangle<float> (x, (float) y, 10000.0f, (float) lineH));
    }
开发者ID:grimtraveller,项目名称:mlrVST,代码行数:24,代码来源:juce_CodeEditorComponent.cpp

示例10: layout

LineNumbersDisplay::LineNumbersDisplay(CodeEditorComponent& Editor) : layout(), editor(Editor), last_start_line_num(-1)
{
	setSize(30, Editor.getHeight());
	startTimer(50);
}
开发者ID:hazama-yuinyan,项目名称:OpenBVEEditor,代码行数:5,代码来源:CodeEditor.cpp


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