Mercurial > hg > octave-nkf
comparison gui/src/FileEditorMdiSubWindow.cpp @ 13659:d98c6ef06dff
included some editor setting into the setting dialog
author | ttl <ttl@justmail.de> |
---|---|
date | Sun, 28 Aug 2011 20:53:15 +0200 |
parents | 347dfbea2c8a |
children | c9501268a194 |
comparison
equal
deleted
inserted
replaced
13658:d5b84316610d | 13659:d98c6ef06dff |
---|---|
389 } | 389 } |
390 | 390 |
391 void | 391 void |
392 FileEditorMdiSubWindow::construct () | 392 FileEditorMdiSubWindow::construct () |
393 { | 393 { |
394 QSettings *settings = ResourceManager::instance ()->settings (); | |
394 QStyle *style = QApplication::style (); | 395 QStyle *style = QApplication::style (); |
395 setWidget (new QWidget ()); | 396 setWidget (new QWidget ()); |
396 | 397 |
397 m_menuBar = new QMenuBar (this); | 398 m_menuBar = new QMenuBar (this); |
398 m_toolBar = new QToolBar (this); | 399 m_toolBar = new QToolBar (this); |
405 m_editor->markerDefine(QsciScintilla::RightTriangle,MARKER_BOOKMARK); | 406 m_editor->markerDefine(QsciScintilla::RightTriangle,MARKER_BOOKMARK); |
406 connect(m_editor,SIGNAL(marginClicked(int,int,Qt::KeyboardModifiers)), | 407 connect(m_editor,SIGNAL(marginClicked(int,int,Qt::KeyboardModifiers)), |
407 this,SLOT(handleMarginClicked(int,int,Qt::KeyboardModifiers))); | 408 this,SLOT(handleMarginClicked(int,int,Qt::KeyboardModifiers))); |
408 | 409 |
409 // line numbers | 410 // line numbers |
410 QFont marginFont("Monospace",9); | |
411 m_editor->setMarginsFont(marginFont); | |
412 QFontMetrics metrics(marginFont); | |
413 m_editor->setMarginsForegroundColor(QColor(96,96,96)); | 411 m_editor->setMarginsForegroundColor(QColor(96,96,96)); |
414 m_editor->setMarginsBackgroundColor(QColor(232,232,220)); | 412 m_editor->setMarginsBackgroundColor(QColor(232,232,220)); |
415 m_editor->setMarginType (2, QsciScintilla::TextMargin); | 413 if ( settings->value ("editor/showLineNumbers",true).toBool () ) |
416 m_editor->setMarginWidth(2, metrics.width("99999")); | 414 { |
417 m_editor->setMarginLineNumbers(2, true); | 415 QFont marginFont( settings->value ("editor/fontName","Courier").toString () , |
418 | 416 settings->value ("editor/fontSize",10).toInt () ); |
417 m_editor->setMarginsFont( marginFont ); | |
418 QFontMetrics metrics(marginFont); | |
419 m_editor->setMarginType (2, QsciScintilla::TextMargin); | |
420 m_editor->setMarginWidth(2, metrics.width("99999")); | |
421 m_editor->setMarginLineNumbers(2, true); | |
422 } | |
419 // code folding | 423 // code folding |
420 m_editor->setMarginType (3, QsciScintilla::SymbolMargin); | 424 m_editor->setMarginType (3, QsciScintilla::SymbolMargin); |
421 m_editor->setFolding (QsciScintilla::BoxedTreeFoldStyle , 3); | 425 m_editor->setFolding (QsciScintilla::BoxedTreeFoldStyle , 3); |
422 | 426 // other features |
423 m_editor->setCaretLineVisible(true); | 427 if ( settings->value ("editor/highlightActualLine",true).toBool () ) |
424 m_editor->setCaretLineBackgroundColor(QColor(255,255,200)); | 428 { |
429 m_editor->setCaretLineVisible(true); | |
430 m_editor->setCaretLineBackgroundColor(QColor(255,255,200)); | |
431 } | |
425 m_editor->setBraceMatching (QsciScintilla::SloppyBraceMatch); | 432 m_editor->setBraceMatching (QsciScintilla::SloppyBraceMatch); |
426 m_editor->setAutoIndent (true); | 433 m_editor->setAutoIndent (true); |
427 m_editor->setIndentationWidth (2); | 434 m_editor->setIndentationWidth (2); |
428 m_editor->setIndentationsUseTabs (false); | 435 m_editor->setIndentationsUseTabs (false); |
429 m_editor->autoCompleteFromAll(); | 436 if ( settings->value ("editor/codeCompletion",true).toBool () ) |
430 m_editor->setAutoCompletionSource(QsciScintilla::AcsAPIs); | 437 { |
431 m_editor->setAutoCompletionThreshold (3); | 438 m_editor->autoCompleteFromAll(); |
439 m_editor->setAutoCompletionSource(QsciScintilla::AcsAPIs); | |
440 m_editor->setAutoCompletionThreshold (3); | |
441 } | |
432 m_editor->setUtf8 (true); | 442 m_editor->setUtf8 (true); |
433 | 443 |
434 // The Actions | 444 // The Actions |
435 | 445 |
436 // Theme icons with QStyle icons as fallback | 446 // Theme icons with QStyle icons as fallback |