コード例 #1
0
ScintillaEditor::ScintillaEditor(QWidget* parent) : QsciScintilla(parent) {
/* -setup editor and configurations */
    //set and display line numbers; margin '1' is the default line number maring
    setMarginWidth(1, 55);
    setMarginLineNumbers(1, true);

    //create the lexer manager
    lexerManager = new SyntaxHighlightManager(this);

    //set editor properties/settings
    setAutoIndent(true);
    setTabWidth(4);
    setMarginsBackgroundColor( LeptonConfig::mainSettings->getValueAsColor("editor_theme", "margins_background") );
    setMarginsForegroundColor( LeptonConfig::mainSettings->getValueAsColor("editor_theme", "margins_foreground") );
    setWhitespaceVisibility( LeptonConfig::mainSettings->getWhiteSpaceVisibility() );
    setWhitespaceForegroundColor( LeptonConfig::mainSettings->getValueAsColor("editor_theme", "whitespace_color") );
    setCaretForegroundColor( LeptonConfig::mainSettings->getValueAsColor("editor_theme", "caret_color") );
    setCallTipsHighlightColor( LeptonConfig::mainSettings->getValueAsColor("editor_theme", "highlight_color") );
    setSelectionBackgroundColor( LeptonConfig::mainSettings->getValueAsColor("editor_theme", "selection_background") );
    setSelectionForegroundColor( LeptonConfig::mainSettings->getValueAsColor("editor_theme", "selection_foreground") );
    setIndentationsUseTabs(false);  //use spaces instead of tabs for indentation

    //*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    //$ Stub code used to test Scintilla features                          $$
    //$                                                                    $$

    //$                                                                    $$
    //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/
}
コード例 #2
0
ファイル: ScriptEditor.cpp プロジェクト: spaceyatom/mantid
/**
 * Constructor
 * @param parent :: The parent widget (can be NULL)
 * @param codelexer :: define the syntax highlighting and code completion.
 * @param settingsGroup :: Used when saving settings to persistent store
 */
ScriptEditor::ScriptEditor(QWidget *parent, QsciLexer *codelexer, const QString & settingsGroup) :
  QsciScintilla(parent), m_filename(""), m_progressArrowKey(markerDefine(QsciScintilla::RightArrow)),
  m_currentExecLine(0), m_completer(NULL),m_previousKey(0),
  m_findDialog(new FindReplaceDialog(this)), m_settingsGroup(settingsGroup)
{
  // Older versions of QScintilla still use just CR as the line ending, which is pre-OSX.
  // New versions just use unix-style for everything but Windows.
#if defined(Q_OS_WIN)
  setEolMode(EolWindows);
#else
  setEolMode(EolUnix);
#endif

  //Syntax highlighting and code completion
  setLexer(codelexer);
  readSettings();

  setMarginLineNumbers(1,true);

  //Editor properties
  setAutoIndent(true);
  setFocusPolicy(Qt::StrongFocus);

  emit undoAvailable(isUndoAvailable());
  emit redoAvailable(isRedoAvailable());
}
コード例 #3
0
ファイル: sqleditorwidget.cpp プロジェクト: jempe/sqliteman
SqlEditorWidget::SqlEditorWidget(QWidget * parent)
    : QsciScintilla(parent),
      m_searchText(""),
      m_searchIndicator(9) // see QsciScintilla docs
{
    m_prefs = Preferences::instance();

    setMarginLineNumbers(0, true);
    setBraceMatching(SloppyBraceMatch);
    setAutoIndent(true);

    QsciLexerSQL * lexer = new QsciLexerSQL(this);

    QsciAPIs * api = new QsciAPIs(lexer);
    if (!api->load(":/api/sqlite.api"))
        qDebug("api is not loaded");
    else
    {
        api->prepare();
        lexer->setAPIs(api);
    }
    setAutoCompletionSource(QsciScintilla::AcsAll);
    setAutoCompletionCaseSensitivity(false);
    setAutoCompletionReplaceWord(true);

    setCaretLineVisible(m_prefs->activeHighlighting());
    setCaretLineBackgroundColor(m_prefs->activeHighlightColor());
    setUtf8(true);

    setFolding(QsciScintilla::BoxedFoldStyle);
    lexer->setFoldComments(true);
    lexer->setFoldCompact(false);

    setLexer(lexer);

    // search all occurrences
    // allow indicator painting *under* the text (but it makes editor slower a bit...)
    // It paints a colored box under the text for all occurrences of m_searchText.
    SendScintilla(QsciScintilla::SCI_SETTWOPHASEDRAW, 1);
    SendScintilla(QsciScintilla::SCI_INDICSETSTYLE, m_searchIndicator, QsciScintilla::INDIC_ROUNDBOX);
    // TODO/FIXME: make it configurable
    SendScintilla(QsciScintilla::SCI_INDICSETFORE, m_searchIndicator, QColor(255, 230, 90, 100));
    SendScintilla(QsciScintilla::SCI_INDICSETUNDER, m_searchIndicator, 1);
    // end of search all occurrences

    connect(this, SIGNAL(linesChanged()),
            this, SLOT(linesChanged()));
    connect(this, SIGNAL(cursorPositionChanged(int, int)),
            this, SLOT(cursorPositionChanged(int, int)));

    setCursorPosition(0, 0);
    linesChanged();
    prefsChanged();
}
コード例 #4
0
ファイル: sourceeditor.cpp プロジェクト: olegwtf/wside
SourceEditor::SourceEditor(QWidget *parent) :
    QsciScintilla(parent)
{
    setLexer(new QsciLexerPerl(this)); // only Perl for now :(
    setAutoIndent(true);
    setMarginLineNumbers(NumberMargin, true);
    setMarginWidth(NumberMargin, "3 ");
    setBraceMatching(SloppyBraceMatch);
    setUtf8(true);

    m_marginWidth = 1;
    connect(this, SIGNAL(linesChanged()), this, SLOT(linesCountChanged()));
}
コード例 #5
0
ファイル: mdichild.cpp プロジェクト: manasdas17/uve
MdiChild::MdiChild()
{
    setAttribute(Qt::WA_DeleteOnClose);
    isUntitled = true;
    forceClose = false;
    saveAndClose = false;
    lexer = 0;

    setAutoIndent(true);
    setMarginLineNumbers(1,true);
    setFolding(QsciScintilla::BoxedFoldStyle);
    setMarginType(1, QsciScintilla::NumberMargin);
    setMarginWidth(1,"00000");
    setAutoCompletionSource(QsciScintilla::AcsDocument);
    setAutoCompletionThreshold(2);
}
コード例 #6
0
ファイル: ScriptEditor.cpp プロジェクト: jkrueger1/mantid
/**
 * Constructor
 * @param parent :: The parent widget (can be NULL)
 * @param codelexer :: define the syntax highlighting and code completion.
 * @param settingsGroup :: Used when saving settings to persistent store
 */
ScriptEditor::ScriptEditor(QWidget *parent, QsciLexer *codelexer, const QString & settingsGroup) :
  QsciScintilla(parent), m_filename(""), m_progressArrowKey(markerDefine(QsciScintilla::RightArrow)),
  m_currentExecLine(0), m_completer(NULL),m_previousKey(0),
  m_findDialog(new FindReplaceDialog(this)), m_settingsGroup(settingsGroup)
{
  //Syntax highlighting and code completion
  setLexer(codelexer);
  readSettings();

  setMarginLineNumbers(1,true);

  //Editor properties
  setAutoIndent(true);
  setFocusPolicy(Qt::StrongFocus);

  emit undoAvailable(isUndoAvailable());
  emit redoAvailable(isRedoAvailable());
}
コード例 #7
0
ファイル: qgscodeeditor.cpp プロジェクト: aaime/QGIS
void QgsCodeEditor::setMarginVisible( bool margin )
{
  mMargin = margin;
  if ( margin )
  {
    QFont marginFont( QStringLiteral( "Courier" ), 10 );
    setMarginLineNumbers( 1, true );
    setMarginsFont( marginFont );
    setMarginWidth( 1, QStringLiteral( "00000" ) );
    setMarginsForegroundColor( QColor( 62, 62, 227 ) );
    setMarginsBackgroundColor( QColor( 249, 249, 249 ) );
  }
  else
  {
    setMarginWidth( 0, 0 );
    setMarginWidth( 1, 0 );
    setMarginWidth( 2, 0 );
  }
}
コード例 #8
0
ファイル: qgscodeeditor.cpp プロジェクト: Ariki/QGIS
void QgsCodeEditor::setMarginVisible( bool margin )
{
  mMargin = margin;
  if ( margin )
  {
    QFont marginFont( "Courier", 10 );
    setMarginLineNumbers( 1, true );
    setMarginsFont( marginFont );
    setMarginWidth( 1, "00000" );
    setMarginsForegroundColor( QColor( "#3E3EE3" ) );
    setMarginsBackgroundColor( QColor( "#f9f9f9" ) );
  }
  else
  {
    setMarginWidth( 0, 0 );
    setMarginWidth( 1, 0 );
    setMarginWidth( 2, 0 );
  }
}
コード例 #9
0
ファイル: chanEditorWidget.cpp プロジェクト: ChanJLee/ChanIDE
void chanEditorWidget::init(){
	m_action = new QAction(this);

	m_action->setCheckable(true);

	connect(m_action, SIGNAL(triggered()), this, SLOT(show()));
	connect(m_action, SIGNAL(triggered()), this, SLOT(setFocus()));

	connect(this, SIGNAL(textChanged()), this, SLOT(documentWasModified()));


	QsciLexerCPP* lexer = new QsciLexerCPP(this);

	setLexer(lexer);

	//设置边框行号
	setMarginLineNumbers(1, true);

	//精确的括号匹配
	setBraceMatching(QsciScintilla::BraceMatch::StrictBraceMatch);

	//设置折叠
	setFolding(QsciScintilla::FoldStyle::CircledTreeFoldStyle);

	//设置自动填充有效
	setAutoCompletionFillupsEnabled(true);

	//所有可能的来源
	setAutoCompletionSource(QsciScintilla::AcsAll);

	//补字符号
	setCaretLineVisible(true);

	setAutoIndent(true);

	setUtf8(true);

	setWhitespaceVisibility(QsciScintilla::WsVisible);

	setAttribute(Qt::WA_DeleteOnClose);
}
コード例 #10
0
    RoboScintilla::RoboScintilla(QWidget *parent) : QsciScintilla(parent),
        _ignoreEnterKey(false),
        _ignoreTabKey(false),
        _lineNumberDigitWidth(0),
        _lineNumberMarginWidth(0)
    {
        setAutoIndent(true);
        setIndentationsUseTabs(false);
        setIndentationWidth(indentationWidth);
        setUtf8(true);
        setMarginWidth(1, 0);
        setCaretForegroundColor(caretForegroundColor);
        setMatchedBraceForegroundColor(matchedBraceForegroundColor); //1AB0A6
        setMatchedBraceBackgroundColor(marginsBackgroundColor);
        setContentsMargins(0, 0, 0, 0);
        setViewportMargins(3, 3, 3, 3);
        QFont ourFont = GuiRegistry::instance().font();
        setMarginsFont(ourFont);
        setMarginLineNumbers(0, true);
        setMarginsBackgroundColor(QColor(53, 56, 58));
        setMarginsForegroundColor(QColor(173, 176, 178));

        SendScintilla(QsciScintilla::SCI_STYLESETFONT, 1, ourFont.family().data());
        SendScintilla(QsciScintilla::SCI_SETHSCROLLBAR, 0);

        setWrapMode((QsciScintilla::WrapMode)QsciScintilla::SC_WRAP_NONE);
        setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 
        setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); 

        // Cache width of one digit
#ifdef Q_OS_WIN
        _lineNumberDigitWidth = rowNumberWidth;
#else
        _lineNumberDigitWidth = textWidth(STYLE_LINENUMBER, "0");
#endif
        updateLineNumbersMarginWidth();

        setLineNumbers(AppRegistry::instance().settingsManager()->lineNumbers());
        setUtf8(true);
        VERIFY(connect(this, SIGNAL(linesChanged()), this, SLOT(updateLineNumbersMarginWidth())));
    }
コード例 #11
0
FastoScintilla::FastoScintilla(QWidget* parent)
    : QsciScintilla(parent), lineNumberMarginWidth_(0), showAutoCompletion_(false) {
  setAutoIndent(true);
  setIndentationsUseTabs(false);
  setIndentationWidth(indentationWidth);
  setUtf8(true);
  setMarginWidth(1, 0);

  setCaretForegroundColor(caretForegroundColor);

  setMatchedBraceForegroundColor(matchedBraceForegroundColor);
  setMatchedBraceBackgroundColor(matchedBraceBackgroundColor);

  setSelectionBackgroundColor(selectionBackgroundColor);
  setSelectionForegroundColor(selectionForegroundColor);

  setContentsMargins(0, 0, 0, 0);
  setViewportMargins(3, 3, 3, 3);
  setMarginLineNumbers(0, true);

  // Margins colors
  // line numbers margin
  setMarginsBackgroundColor(marginsBackgroundColor);
  setMarginsForegroundColor(marginsForegroundColor);

  SendScintilla(QsciScintilla::SCI_SETHSCROLLBAR, 0);

  setWrapMode(QsciScintilla::WrapNone);
  setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

  VERIFY(connect(this, &FastoScintilla::linesChanged, this,
                 &FastoScintilla::updateLineNumbersMarginWidth));

  setAutoCompletionThreshold(1);
  setAutoCompletionCaseSensitivity(false);
  setAutoCompletionSource(QsciScintilla::AcsNone);
}
コード例 #12
0
/**
 * Initializes the lexer.
 * @param script
 *      The script file.
 */
void SingleDocument::initLexer(QString script)
{
    (void)script;

    if(lexer() == 0)
    {
        setLexer(new QsciLexerJavaScript(this));
        QsciAPIs* apis = new QsciAPIs(lexer());
        (void)apis;


        setAutoCompletionSource(QsciScintilla::AcsAPIs);
        setAutoCompletionCaseSensitivity(true);
        setAutoCompletionThreshold(3);
        setAutoIndent(true);
        setIndentationWidth(4);
        setTabWidth(4);
        setMarginLineNumbers(0,true);
        setMarginType(0, QsciScintilla::NumberMargin);
        setMarginsForegroundColor(QColor(128, 128, 128));
       }

}
コード例 #13
0
SonicPiScintilla::SonicPiScintilla(SonicPiLexer *lexer, SonicPiTheme *theme)
  : QsciScintilla()
{
  this->theme = theme;
  standardCommands()->clearKeys();
  standardCommands()->clearAlternateKeys();
  QString skey;
  QSettings settings("sonic-pi.net", "Key bindings");

#if defined(Q_OS_MAC)
  int SPi_CTRL = Qt::META;
  int SPi_META = Qt::CTRL;
#else
  int SPi_CTRL = Qt::CTRL;
  int SPi_META = Qt::ALT;
#endif

  // basic navigation
  addKeyBinding(settings, QsciCommand::PageDown, Qt::Key_PageDown);
  addKeyBinding(settings, QsciCommand::PageUp, Qt::Key_PageUp);

  addKeyBinding(settings, QsciCommand::LineDown, Qt::Key_N | SPi_CTRL);
  addOtherKeyBinding(settings, QsciCommand::LineDown, Qt::Key_Down);
  addKeyBinding(settings, QsciCommand::LineDownExtend, Qt::Key_Down | Qt::SHIFT);
  addKeyBinding(settings, QsciCommand::LineUp, Qt::Key_P | SPi_CTRL);
  addOtherKeyBinding(settings, QsciCommand::LineUp, Qt::Key_Up);
  addKeyBinding(settings, QsciCommand::LineUpExtend, Qt::Key_Up | Qt::SHIFT);

  addKeyBinding(settings, QsciCommand::CharRight, Qt::Key_F | SPi_CTRL);
  addOtherKeyBinding(settings, QsciCommand::CharRight, Qt::Key_Right);
  addKeyBinding(settings, QsciCommand::CharRightExtend, Qt::Key_Right | Qt::SHIFT);

  addKeyBinding(settings, QsciCommand::WordRight, Qt::Key_F | SPi_META);
  addOtherKeyBinding(settings, QsciCommand::WordRight, Qt::Key_Right | SPi_CTRL);
  addKeyBinding(settings, QsciCommand::WordRightExtend, Qt::Key_Right | SPi_CTRL | Qt::SHIFT);

  addKeyBinding(settings, QsciCommand::CharLeft, Qt::Key_B | SPi_CTRL);
  addOtherKeyBinding(settings, QsciCommand::CharLeft, Qt::Key_Left);
  addKeyBinding(settings, QsciCommand::CharLeftExtend, Qt::Key_Left | Qt::SHIFT);

  addKeyBinding(settings, QsciCommand::WordLeft, Qt::Key_B | SPi_META);
  addOtherKeyBinding(settings, QsciCommand::WordLeft, Qt::Key_Left | SPi_CTRL);
  addKeyBinding(settings, QsciCommand::WordLeftExtend, Qt::Key_Left | SPi_CTRL | Qt::SHIFT);

  addKeyBinding(settings, QsciCommand::Delete, Qt::Key_D | SPi_CTRL);
  addOtherKeyBinding(settings, QsciCommand::Delete, Qt::Key_Delete);

  addKeyBinding(settings, QsciCommand::DeleteBack, Qt::Key_H | SPi_CTRL);
  addOtherKeyBinding(settings, QsciCommand::DeleteBack, Qt::Key_Backspace);

  addKeyBinding(settings, QsciCommand::Home, Qt::Key_A | SPi_CTRL);
  addKeyBinding(settings, QsciCommand::VCHome, Qt::Key_Home);
  addKeyBinding(settings, QsciCommand::VCHomeExtend, Qt::Key_Home | Qt::SHIFT);
  addKeyBinding(settings, QsciCommand::DocumentStart, Qt::Key_Home | SPi_CTRL);
  addKeyBinding(settings, QsciCommand::DocumentStartExtend, Qt::Key_Home | SPi_CTRL | Qt::SHIFT);

  addKeyBinding(settings, QsciCommand::LineEnd, Qt::Key_E | SPi_CTRL);
  addOtherKeyBinding(settings, QsciCommand::LineEnd, Qt::Key_End);
  addKeyBinding(settings, QsciCommand::LineEndExtend, Qt::Key_End | Qt::SHIFT);
  addKeyBinding(settings, QsciCommand::DocumentEnd, Qt::Key_End | SPi_CTRL);
  addKeyBinding(settings, QsciCommand::DocumentEndExtend, Qt::Key_End | SPi_CTRL | Qt::SHIFT);

  addKeyBinding(settings, QsciCommand::Delete, Qt::Key_D | SPi_CTRL);
  addKeyBinding(settings, QsciCommand::VerticalCentreCaret, Qt::Key_L | SPi_CTRL);

  // tab return
  addKeyBinding(settings, QsciCommand::Newline, Qt::Key_Return);

  addKeyBinding(settings, QsciCommand::Backtab, Qt::Key_Tab | Qt::SHIFT);

  // copy paste
  addKeyBinding(settings, QsciCommand::SelectionCopy, Qt::Key_C | SPi_META);
  addOtherKeyBinding(settings, QsciCommand::SelectionCopy, Qt::Key_C | SPi_CTRL);
  addKeyBinding(settings, QsciCommand::SelectionCut, Qt::Key_X | SPi_META);
  addOtherKeyBinding(settings, QsciCommand::SelectionCut, Qt::Key_X | SPi_CTRL);

  addKeyBinding(settings, QsciCommand::Paste, Qt::Key_V | SPi_META);
  addOtherKeyBinding(settings, QsciCommand::Paste, Qt::Key_Y | SPi_CTRL);
  addKeyBinding(settings, QsciCommand::Undo, Qt::Key_Z | SPi_META);
  addOtherKeyBinding(settings, QsciCommand::Undo, Qt::Key_Z | SPi_CTRL);
  addKeyBinding(settings, QsciCommand::Redo, Qt::Key_Z | Qt::SHIFT | SPi_META);
  addOtherKeyBinding(settings, QsciCommand::Redo, Qt::Key_Z | Qt::SHIFT | SPi_CTRL);
  addKeyBinding(settings, QsciCommand::SelectAll, Qt::Key_A | SPi_META);

  // delete word left and right
  addKeyBinding(settings, QsciCommand::DeleteWordLeft, Qt::Key_Backslash | SPi_META);
  addKeyBinding(settings, QsciCommand::DeleteWordLeft, Qt::Key_Backspace | SPi_META);
  addKeyBinding(settings, QsciCommand::DeleteWordRight, Qt::Key_D | SPi_META);

  standardCommands()->readSettings(settings);

  this->setMatchedBraceBackgroundColor(theme->color("MatchedBraceBackground"));
  this->setMatchedBraceForegroundColor(theme->color("MatchedBraceForeground"));

  setIndentationWidth(2);
  setIndentationGuides(true);
  setIndentationGuidesForegroundColor(theme->color("IndentationGuidesForeground"));
  setBraceMatching( SonicPiScintilla::SloppyBraceMatch);

  //TODO: add preference toggle for this:
  //this->setFolding(SonicPiScintilla::CircledTreeFoldStyle, 2);
  setCaretLineVisible(true);
  setCaretLineBackgroundColor(theme->color("CaretLineBackground"));
  setFoldMarginColors(theme->color("FoldMarginForeground"),theme->color("FoldMarginForeground"));
  setMarginLineNumbers(0, true);

  setMarginsBackgroundColor(theme->color("MarginBackground"));
  setMarginsForegroundColor(theme->color("MarginForeground"));
  setMarginsFont(QFont("Menlo", 15, -1, true));
  setUtf8(true);
  setText("#loading...");
  setLexer((QsciLexer *)lexer);

  markerDefine(RightArrow, 8);
  setMarkerBackgroundColor("deeppink", 8);

  setAutoCompletionThreshold(1);
  setAutoCompletionSource(SonicPiScintilla::AcsAPIs);
  setAutoCompletionCaseSensitivity(false);

  setSelectionBackgroundColor(theme->color("SelectionBackground"));
  setSelectionForegroundColor(theme->color("SelectionForeground"));
  setCaretWidth(5);
  setCaretForegroundColor(theme->color("CaretForeground"));
  setEolMode(EolUnix);

  SendScintilla(SCI_SETWORDCHARS, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:_?!");


}
コード例 #14
0
void SonicPiScintilla::showLineNumbers(){
  setMarginLineNumbers(0, true);
  setMarginWidth(0, "1000");
  SendScintilla(SCI_SHOWLINES);
}
コード例 #15
0
void SonicPiScintilla::hideLineNumbers(){
  setMarginLineNumbers(0, false);
  setMarginWidth(0, "0");
  SendScintilla(SCI_HIDELINES);
}
コード例 #16
0
ファイル: editor.cpp プロジェクト: massimiliano76/mariamole
void Editor::setEditorStyle (void)
{
	//QFont font ("Consolas", 14, QFont::Normal, false);
	QFont font (config.editorFontName, config.editorFontSize, QFont::Normal, false);

	lblCursorPosition->setFont(font);
	QFontMetrics fontMetrics(font);

    //QColor backColor = QColor(22, 30, 32);
	TextStyle style;
	config.GetThemeStyle(config.themeName, "DEFAULT", style);
	QColor backColor = style.backColor;//QColor(config.editorColorName);

    setColor(backColor);
	
	QString css = "color:" + style.foreColor.name() + ";";
	css += "background-color:" + style.backColor.name() + ";";
	css += "border: 1px solid " + style.foreColor.name() + ";";
	lblCursorPosition->setStyleSheet(css);
	
	// margin
	setMarginLineNumbers(100, true);
	setMarginsFont(font);
	config.GetThemeStyle(config.themeName, "MARGIN", style);
	setMarginsBackgroundColor(style.backColor);//QColor(24,32,34));//QColor(20,28,30));
	setMarginsForegroundColor(style.foreColor); //QColor(42,50,52));
	setMarginWidth(0, fontMetrics.width("00000") + 6);	
	
	// General editor things
	setTabWidth(4);	
	ensureCursorVisible();
	setIndicatorForegroundColor (Qt::red, 1);	

	// compile error/warning mark
	markerDefine(QsciScintilla::RightArrow, 1); 
	setMarkerBackgroundColor(Qt::red, 1);	
	markerDefine(QsciScintilla::Circle, 0);
	setMarkerBackgroundColor(Qt::red, 0);
	setMarkerForegroundColor(Qt::white, 0);

	// caret
	setCaretLineVisible(true);
	setCaretWidth(2);
	config.GetThemeStyle(config.themeName, "CARET", style);
	setCaretForegroundColor(style.foreColor);//QColor(220, 200, 200));
	caretLineBackColor = style.backColor;
	setCaretLineBackgroundColor(caretLineBackColor);//QColor(24, 32, 34));
	//setCaretLineBackgroundColor(QColor(255, 0, 0, 100));
	//SendScintilla (SC_TECHNOLOGY_DIRECTWRITE, 1);
	//SendScintilla (SCI_SETBUFFEREDDRAW, 1);
	//SendScintilla (SCI_SETTWOPHASEDRAW, 1);
	//SendScintilla (SCI_SETFONTQUALITY,  SC_EFF_QUALITY_NON_ANTIALIASED);//SC_EFF_QUALITY_DEFAULT);	

	// matched and unmatched braces coloring
	if (config.highlightBraces) {
		setBraceMatching(QsciScintilla::SloppyBraceMatch);
	} else {
		setBraceMatching(QsciScintilla::NoBraceMatch);
	}
	setMatchedBraceBackgroundColor(backColor);
	setMatchedBraceForegroundColor(QColor(220, 220, 50));
	setUnmatchedBraceBackgroundColor(QColor(0,0,0));
	setUnmatchedBraceForegroundColor(QColor(255, 0, 0));

	// selection
	config.GetThemeStyle(config.themeName, "SELECTION", style);
	setSelectionForegroundColor(style.foreColor);//QColor(150, 150, 150));
	setSelectionBackgroundColor(style.backColor);//QColor(52, 60, 62));
	
	// maim cpp styles
	setLexerStyle(-1, "DEFAULT");//QColor (120, 120, 120),backColor);	
	//setLexerStyle(-1, Qt::red, Qt::blue);	
	//setLexerStyle(QsciLexerCPP::Default, Qt::blue, Qt::yellow);
	setLexerStyle(QsciLexerCPP::Default, "DEFAULT");
	//setLexerStyle(QsciLexerCPP::callSTYLE_CALLTIP, QColor (255,0,0), QColor(255,255,255));
	
	setLexerStyle(QsciLexerCPP::Comment, "COMMENT");
	setLexerStyle(QsciLexerCPP::CommentDoc, "COMMENT DOC");		
	setLexerStyle(QsciLexerCPP::CommentLine, "COMMENT LIN E DOC");
	setLexerStyle(QsciLexerCPP::Number, "NUMBER");
	setLexerStyle(QsciLexerCPP::Keyword, "KEYWORD");
	setLexerStyle(QsciLexerCPP::DoubleQuotedString, "DOUBLE QUOTED STRING");
	setLexerStyle(QsciLexerCPP::SingleQuotedString, "SINGLE QUOTED STRING");
	setLexerStyle(QsciLexerCPP::PreProcessor, "PREPROCESSOR");
	setLexerStyle(QsciLexerCPP::Operator, "OPERATOR");
	setLexerStyle(QsciLexerCPP::Identifier, "IDENTIFIER");
	setLexerStyle(QsciLexerCPP::UnclosedString, "UNCLOSED STRING");
	
	// secondary styles
	setLexerStyle(QsciLexerCPP::UUID, "UUID");	
	setLexerStyle(QsciLexerCPP::VerbatimString, "VERBATIM STRING");
	setLexerStyle(QsciLexerCPP::Regex, "REGEX");
	setLexerStyle(QsciLexerCPP::CommentLineDoc, "COMMENT LINE DOC");
	setLexerStyle(QsciLexerCPP::KeywordSet2, "KEYWORD SET 2");
	setLexerStyle(QsciLexerCPP::CommentDocKeyword, "COMMENT DOC KEYWORD");
	setLexerStyle(QsciLexerCPP::CommentDocKeywordError, "COMMENT DOC KEYWORD ERROR");
	setLexerStyle(QsciLexerCPP::GlobalClass, "GLOBAL CLASS");
	setLexerStyle(QsciLexerCPP::RawString, "DOUBLE QUOTED STRING");
	setLexerStyle(QsciLexerCPP::TripleQuotedVerbatimString, "VERBATIM STRING");
	setLexerStyle(QsciLexerCPP::HashQuotedString, "VERBATIM STRING");
	setLexerStyle(QsciLexerCPP::PreProcessorComment, "PREPROCESSOR");
	setLexerStyle(QsciLexerCPP::PreProcessorCommentLineDoc, "PREPROCESSOR"); 		
}
コード例 #17
0
ファイル: pEditor.cpp プロジェクト: pasnox/monkeystudio2
void pEditor::setLineNumbersMarginEnabled( bool b )
{
    setMarginLineNumbers( 0, b );
}