00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "kateconfig.h"
00020
00021 #include "kateglobal.h"
00022 #include "katerenderer.h"
00023 #include "kateview.h"
00024 #include "katedocument.h"
00025 #include "kateschema.h"
00026 #include "katehistorymodel.h"
00027
00028 #include <math.h>
00029
00030 #include <kconfig.h>
00031 #include <kglobalsettings.h>
00032 #include <kcolorscheme.h>
00033 #include <kcolorutils.h>
00034 #include <kcharsets.h>
00035 #include <klocale.h>
00036 #include <kfinddialog.h>
00037 #include <kreplacedialog.h>
00038 #include <kcomponentdata.h>
00039 #include <kfind.h>
00040 #include <kdebug.h>
00041
00042 #include <QtCore/QTextCodec>
00043 #include <QStringListModel>
00044
00045
00046 KateConfig::KateConfig ()
00047 : configSessionNumber (0), configIsRunning (false)
00048 {
00049 }
00050
00051 KateConfig::~KateConfig ()
00052 {
00053 }
00054
00055 void KateConfig::configStart ()
00056 {
00057 configSessionNumber++;
00058
00059 if (configSessionNumber > 1)
00060 return;
00061
00062 configIsRunning = true;
00063 }
00064
00065 void KateConfig::configEnd ()
00066 {
00067 if (configSessionNumber == 0)
00068 return;
00069
00070 configSessionNumber--;
00071
00072 if (configSessionNumber > 0)
00073 return;
00074
00075 configIsRunning = false;
00076
00077 updateConfig ();
00078 }
00079
00080
00081
00082 KateDocumentConfig *KateDocumentConfig::s_global = 0;
00083 KateViewConfig *KateViewConfig::s_global = 0;
00084 KateRendererConfig *KateRendererConfig::s_global = 0;
00085
00086 KateDocumentConfig::KateDocumentConfig ()
00087 : m_indentationWidth (2),
00088 m_tabWidth (8),
00089 m_tabHandling (tabSmart),
00090 m_configFlags (0),
00091 m_wordWrapAt (80),
00092 m_proberTypeForEncodingAutoDetection(KEncodingProber::Universal),
00093 m_tabWidthSet (true),
00094 m_indentationWidthSet (true),
00095 m_indentationModeSet (true),
00096 m_wordWrapSet (true),
00097 m_wordWrapAtSet (true),
00098 m_pageUpDownMovesCursorSet (true),
00099 m_configFlagsSet (0xFFFF),
00100 m_encodingSet (true),
00101 m_eolSet (true),
00102 m_allowEolDetectionSet (false),
00103 m_allowSimpleModeSet (false),
00104 m_backupFlagsSet (true),
00105 m_searchDirConfigDepthSet (true),
00106 m_backupPrefixSet (true),
00107 m_backupSuffixSet (true),
00108 m_doc (0)
00109 {
00110 s_global = this;
00111
00112
00113 KConfigGroup cg( KGlobal::config(), "Kate Document Defaults");
00114 readConfig (cg);
00115 }
00116
00117 KateDocumentConfig::KateDocumentConfig (KateDocument *doc)
00118 : m_tabHandling (tabSmart),
00119 m_configFlags (0),
00120 m_tabWidthSet (false),
00121 m_indentationWidthSet (false),
00122 m_indentationModeSet (false),
00123 m_wordWrapSet (false),
00124 m_wordWrapAtSet (false),
00125 m_pageUpDownMovesCursorSet (false),
00126 m_configFlagsSet (0),
00127 m_encodingSet (false),
00128 m_eolSet (false),
00129 m_allowEolDetectionSet (false),
00130 m_allowSimpleModeSet (false),
00131 m_backupFlagsSet (false),
00132 m_searchDirConfigDepthSet (false),
00133 m_backupPrefixSet (false),
00134 m_backupSuffixSet (false),
00135 m_doc (doc)
00136 {
00137 m_proberTypeForEncodingAutoDetection=s_global->encodingProberType();
00138 }
00139
00140 KateDocumentConfig::~KateDocumentConfig ()
00141 {
00142 }
00143
00144 void KateDocumentConfig::readConfig (const KConfigGroup &config)
00145 {
00146 configStart ();
00147
00148 setTabWidth (config.readEntry("Tab Width", 8));
00149
00150 setIndentationWidth (config.readEntry("Indentation Width", 2));
00151
00152 setIndentationMode (config.readEntry("Indentation Mode", ""));
00153
00154 setTabHandling (config.readEntry("Tab Handling", int(KateDocumentConfig::tabSmart)));
00155
00156 setWordWrap (config.readEntry("Word Wrap", false));
00157 setWordWrapAt (config.readEntry("Word Wrap Column", 80));
00158 setPageUpDownMovesCursor (config.readEntry("PageUp/PageDown Moves Cursor", false));
00159
00160 setConfigFlags (config.readEntry("Basic Config Flags", KateDocumentConfig::cfTabIndents
00161 | KateDocumentConfig::cfWrapCursor
00162 | KateDocumentConfig::cfShowTabs
00163 | KateDocumentConfig::cfSmartHome));
00164
00165 setEncoding (config.readEntry("Encoding", ""));
00166 setEncodingProberType ((KEncodingProber::ProberType)config.readEntry("ProberType for Encoding Autodetection", 0));
00167
00168 setEol (config.readEntry("End of Line", 0));
00169 setAllowEolDetection (config.readEntry("Allow End of Line Detection", true));
00170
00171 setAllowSimpleMode (config.readEntry("Allow Simple Mode", true));
00172
00173 setBackupFlags (config.readEntry("Backup Config Flags", 1));
00174
00175 setSearchDirConfigDepth (config.readEntry("Search Dir Config Depth", 3));
00176
00177 setBackupPrefix (config.readEntry("Backup Prefix", QString ("")));
00178
00179 setBackupSuffix (config.readEntry("Backup Suffix", QString ("~")));
00180
00181 configEnd ();
00182 }
00183
00184 void KateDocumentConfig::writeConfig (KConfigGroup &config)
00185 {
00186 config.writeEntry("Tab Width", tabWidth());
00187
00188 config.writeEntry("Indentation Width", indentationWidth());
00189 config.writeEntry("Indentation Mode", indentationMode());
00190
00191 config.writeEntry("Tab Handling", tabHandling());
00192
00193 config.writeEntry("Word Wrap", wordWrap());
00194 config.writeEntry("Word Wrap Column", wordWrapAt());
00195
00196 config.writeEntry("PageUp/PageDown Moves Cursor", pageUpDownMovesCursor());
00197
00198 config.writeEntry("Basic Config Flags", configFlags());
00199
00200 config.writeEntry("Encoding", encoding());
00201 config.writeEntry("ProberType for Encoding Autodetection", (int)encodingProberType());
00202
00203 config.writeEntry("End of Line", eol());
00204 config.writeEntry("Allow End of Line Detection", allowEolDetection());
00205
00206 config.writeEntry("Allow Simple Mode", allowSimpleMode());
00207
00208 config.writeEntry("Backup Config Flags", backupFlags());
00209
00210 config.writeEntry("Search Dir Config Depth", searchDirConfigDepth());
00211
00212 config.writeEntry("Backup Prefix", backupPrefix());
00213
00214 config.writeEntry("Backup Suffix", backupSuffix());
00215 }
00216
00217 void KateDocumentConfig::updateConfig ()
00218 {
00219 if (m_doc)
00220 {
00221 m_doc->updateConfig ();
00222 return;
00223 }
00224
00225 if (isGlobal())
00226 {
00227 for (int z=0; z < KateGlobal::self()->kateDocuments().size(); ++z)
00228 (KateGlobal::self()->kateDocuments())[z]->updateConfig ();
00229 }
00230 }
00231
00232 int KateDocumentConfig::tabWidth () const
00233 {
00234 if (m_tabWidthSet || isGlobal())
00235 return m_tabWidth;
00236
00237 return s_global->tabWidth();
00238 }
00239
00240 void KateDocumentConfig::setTabWidth (int tabWidth)
00241 {
00242 if (tabWidth < 1)
00243 return;
00244
00245 configStart ();
00246
00247 m_tabWidthSet = true;
00248 m_tabWidth = tabWidth;
00249
00250 configEnd ();
00251 }
00252
00253 int KateDocumentConfig::indentationWidth () const
00254 {
00255 if (m_indentationWidthSet || isGlobal())
00256 return m_indentationWidth;
00257
00258 return s_global->indentationWidth();
00259 }
00260
00261 void KateDocumentConfig::setIndentationWidth (int indentationWidth)
00262 {
00263 if (indentationWidth < 1)
00264 return;
00265
00266 configStart ();
00267
00268 m_indentationWidthSet = true;
00269 m_indentationWidth = indentationWidth;
00270
00271 configEnd ();
00272 }
00273
00274 const QString &KateDocumentConfig::indentationMode () const
00275 {
00276 if (m_indentationModeSet || isGlobal())
00277 return m_indentationMode;
00278
00279 return s_global->indentationMode();
00280 }
00281
00282 void KateDocumentConfig::setIndentationMode (const QString &indentationMode)
00283 {
00284 configStart ();
00285
00286 m_indentationModeSet = true;
00287 m_indentationMode = indentationMode;
00288
00289 configEnd ();
00290 }
00291
00292 uint KateDocumentConfig::tabHandling () const
00293 {
00294
00295
00296 if (isGlobal())
00297 return m_tabHandling;
00298
00299 return s_global->tabHandling();
00300 }
00301
00302 void KateDocumentConfig::setTabHandling (uint tabHandling)
00303 {
00304 configStart ();
00305
00306 m_tabHandling = tabHandling;
00307
00308 configEnd ();
00309 }
00310
00311 bool KateDocumentConfig::wordWrap () const
00312 {
00313 if (m_wordWrapSet || isGlobal())
00314 return m_wordWrap;
00315
00316 return s_global->wordWrap();
00317 }
00318
00319 void KateDocumentConfig::setWordWrap (bool on)
00320 {
00321 configStart ();
00322
00323 m_wordWrapSet = true;
00324 m_wordWrap = on;
00325
00326 configEnd ();
00327 }
00328
00329 unsigned int KateDocumentConfig::wordWrapAt () const
00330 {
00331 if (m_wordWrapAtSet || isGlobal())
00332 return m_wordWrapAt;
00333
00334 return s_global->wordWrapAt();
00335 }
00336
00337 void KateDocumentConfig::setWordWrapAt (unsigned int col)
00338 {
00339 if (col < 1)
00340 return;
00341
00342 configStart ();
00343
00344 m_wordWrapAtSet = true;
00345 m_wordWrapAt = col;
00346
00347 configEnd ();
00348 }
00349
00350 bool KateDocumentConfig::pageUpDownMovesCursor () const
00351 {
00352 if (m_pageUpDownMovesCursorSet || isGlobal())
00353 return m_pageUpDownMovesCursor;
00354
00355 return s_global->pageUpDownMovesCursor();
00356 }
00357
00358 void KateDocumentConfig::setPageUpDownMovesCursor (bool on)
00359 {
00360 configStart ();
00361
00362 m_pageUpDownMovesCursorSet = true;
00363 m_pageUpDownMovesCursor = on;
00364
00365 configEnd ();
00366 }
00367
00368 uint KateDocumentConfig::configFlags () const
00369 {
00370 if (isGlobal())
00371 return m_configFlags;
00372
00373 return ((s_global->configFlags() & ~ m_configFlagsSet) | m_configFlags);
00374 }
00375
00376 void KateDocumentConfig::setConfigFlags (KateDocumentConfig::ConfigFlags flag, bool enable)
00377 {
00378 configStart ();
00379
00380 m_configFlagsSet |= flag;
00381
00382 if (enable)
00383 m_configFlags = m_configFlags | flag;
00384 else
00385 m_configFlags = m_configFlags & ~ flag;
00386
00387 configEnd ();
00388 }
00389
00390 void KateDocumentConfig::setConfigFlags (uint fullFlags)
00391 {
00392 configStart ();
00393
00394 m_configFlagsSet = 0xFFFF;
00395 m_configFlags = fullFlags;
00396
00397 configEnd ();
00398 }
00399
00400 const QString &KateDocumentConfig::encoding () const
00401 {
00402 if (m_encodingSet || isGlobal())
00403 return m_encoding;
00404
00405 return s_global->encoding();
00406 }
00407
00408 QTextCodec *KateDocumentConfig::codec () const
00409 {
00410 if (m_encodingSet || isGlobal())
00411 {
00412 if (m_encoding.isEmpty() && isGlobal())
00413 return KGlobal::locale()->codecForEncoding();
00414 else if (m_encoding.isEmpty())
00415 return s_global->codec ();
00416 else
00417 return KGlobal::charsets()->codecForName (m_encoding);
00418 }
00419
00420 return s_global->codec ();
00421 }
00422
00423 bool KateDocumentConfig::setEncoding (const QString &encoding, bool resetDetection)
00424 {
00425 QTextCodec *codec;
00426 bool found = false;
00427 if (encoding.isEmpty())
00428 {
00429 codec = s_global->codec();
00430 #ifdef DECODE_DEBUG
00431 kWarning()<<"defaulting to " << codec->name();
00432 #endif
00433 found=true;
00434 }
00435 else
00436 codec = KGlobal::charsets()->codecForName (encoding, found);
00437
00438 if (!found || !codec)
00439 return false;
00440
00441 configStart ();
00442
00443 if (resetDetection)
00444 {
00445 if (!m_encodingSet || encoding.isEmpty())
00446 m_proberTypeForEncodingAutoDetection=s_global->encodingProberType();
00447 else
00448 m_proberTypeForEncodingAutoDetection = KEncodingProber::None;
00449 }
00450 m_encodingSet = true;
00451 m_encoding = codec->name();
00452
00453 configEnd ();
00454 #ifdef DECODE_DEBUG
00455 kWarning()<<"set to " << codec->name();
00456 #endif
00457 return true;
00458 }
00459
00460 bool KateDocumentConfig::isSetEncoding () const
00461 {
00462 return m_encodingSet;
00463 }
00464
00465 KEncodingProber::ProberType KateDocumentConfig::encodingProberType() const
00466 {
00467 return m_proberTypeForEncodingAutoDetection;
00468 }
00469
00470 void KateDocumentConfig::setEncodingProberType(KEncodingProber::ProberType proberType)
00471 {
00472 configStart ();
00473
00474 m_proberTypeForEncodingAutoDetection=proberType;
00475
00476 configEnd ();
00477
00478 }
00479
00480
00481 int KateDocumentConfig::eol () const
00482 {
00483 if (m_eolSet || isGlobal())
00484 return m_eol;
00485
00486 return s_global->eol();
00487 }
00488
00489 QString KateDocumentConfig::eolString ()
00490 {
00491 if (eol() == KateDocumentConfig::eolUnix)
00492 return QString ("\n");
00493 else if (eol() == KateDocumentConfig::eolDos)
00494 return QString ("\r\n");
00495 else if (eol() == KateDocumentConfig::eolMac)
00496 return QString ("\r");
00497
00498 return QString ("\n");
00499 }
00500
00501 void KateDocumentConfig::setEol (int mode)
00502 {
00503 configStart ();
00504
00505 m_eolSet = true;
00506 m_eol = mode;
00507
00508 configEnd ();
00509 }
00510
00511 bool KateDocumentConfig::allowEolDetection () const
00512 {
00513 if (m_allowEolDetectionSet || isGlobal())
00514 return m_allowEolDetection;
00515
00516 return s_global->allowEolDetection();
00517 }
00518
00519 void KateDocumentConfig::setAllowEolDetection (bool on)
00520 {
00521 configStart ();
00522
00523 m_allowEolDetectionSet = true;
00524 m_allowEolDetection = on;
00525
00526 configEnd ();
00527 }
00528
00529
00530 bool KateDocumentConfig::allowSimpleMode () const
00531 {
00532 if (m_allowSimpleModeSet || isGlobal())
00533 return m_allowSimpleMode;
00534
00535 return s_global->allowSimpleMode();
00536 }
00537
00538 void KateDocumentConfig::setAllowSimpleMode (bool on)
00539 {
00540 configStart ();
00541
00542 m_allowSimpleModeSet = true;
00543 m_allowSimpleMode = on;
00544
00545 configEnd ();
00546 }
00547
00548 uint KateDocumentConfig::backupFlags () const
00549 {
00550 if (m_backupFlagsSet || isGlobal())
00551 return m_backupFlags;
00552
00553 return s_global->backupFlags();
00554 }
00555
00556 void KateDocumentConfig::setBackupFlags (uint flags)
00557 {
00558 configStart ();
00559
00560 m_backupFlagsSet = true;
00561 m_backupFlags = flags;
00562
00563 configEnd ();
00564 }
00565
00566 const QString &KateDocumentConfig::backupPrefix () const
00567 {
00568 if (m_backupPrefixSet || isGlobal())
00569 return m_backupPrefix;
00570
00571 return s_global->backupPrefix();
00572 }
00573
00574 const QString &KateDocumentConfig::backupSuffix () const
00575 {
00576 if (m_backupSuffixSet || isGlobal())
00577 return m_backupSuffix;
00578
00579 return s_global->backupSuffix();
00580 }
00581
00582 void KateDocumentConfig::setBackupPrefix (const QString &prefix)
00583 {
00584 configStart ();
00585
00586 m_backupPrefixSet = true;
00587 m_backupPrefix = prefix;
00588
00589 configEnd ();
00590 }
00591
00592 void KateDocumentConfig::setBackupSuffix (const QString &suffix)
00593 {
00594 configStart ();
00595
00596 m_backupSuffixSet = true;
00597 m_backupSuffix = suffix;
00598
00599 configEnd ();
00600 }
00601
00602 int KateDocumentConfig::searchDirConfigDepth () const
00603 {
00604 if (m_searchDirConfigDepthSet || isGlobal())
00605 return m_searchDirConfigDepth;
00606
00607 return s_global->searchDirConfigDepth ();
00608 }
00609
00610 void KateDocumentConfig::setSearchDirConfigDepth (int depth)
00611 {
00612 configStart ();
00613
00614 m_searchDirConfigDepthSet = true;
00615 m_searchDirConfigDepth = depth;
00616
00617 configEnd ();
00618 }
00619
00620
00621
00622
00623 KateViewConfig::KateViewConfig ()
00624 :
00625 m_dynWordWrapSet (true),
00626 m_dynWordWrapIndicatorsSet (true),
00627 m_dynWordWrapAlignIndentSet (true),
00628 m_lineNumbersSet (true),
00629 m_scrollBarMarksSet (true),
00630 m_iconBarSet (true),
00631 m_foldingBarSet (true),
00632 m_bookmarkSortSet (true),
00633 m_autoCenterLinesSet (true),
00634 m_searchFlagsSet (true),
00635 m_defaultMarkTypeSet (true),
00636 m_persistentSelectionSet (true),
00637 m_viInputModeSet (true),
00638 m_viInputModeStealKeysSet (true),
00639 m_automaticCompletionInvocationSet (true),
00640 m_wordCompletionSet (true),
00641 m_wordCompletionMinimalWordLengthSet (true),
00642 m_view (0)
00643 {
00644 s_global = this;
00645
00646
00647 KConfigGroup config( KGlobal::config(), "Kate View Defaults");
00648 readConfig (config);
00649 }
00650
00651 KateViewConfig::KateViewConfig (KateView *view)
00652 :
00653 m_dynWordWrapSet (false),
00654 m_dynWordWrapIndicatorsSet (false),
00655 m_dynWordWrapAlignIndentSet (false),
00656 m_lineNumbersSet (false),
00657 m_scrollBarMarksSet (false),
00658 m_iconBarSet (false),
00659 m_foldingBarSet (false),
00660 m_bookmarkSortSet (false),
00661 m_autoCenterLinesSet (false),
00662 m_searchFlagsSet (false),
00663 m_defaultMarkTypeSet (false),
00664 m_persistentSelectionSet (false),
00665 m_viInputModeSet (false),
00666 m_viInputModeStealKeysSet (false),
00667 m_automaticCompletionInvocationSet (false),
00668 m_wordCompletionSet (false),
00669 m_wordCompletionMinimalWordLengthSet (false),
00670 m_view (view)
00671 {
00672 }
00673
00674 KateViewConfig::~KateViewConfig ()
00675 {
00676 }
00677
00678
00679
00680 static const char * const KEY_SEARCH_REPLACE_FLAGS = "Search/Replace Flags";
00681 static const char * const KEY_PATTERN_HISTORY = "Search Pattern History";
00682 static const char * const KEY_REPLACEMENT_HISTORY = "Replacement Text History";
00683
00684
00685 void KateViewConfig::readConfig ( const KConfigGroup &config)
00686 {
00687 configStart ();
00688
00689
00690 setDynWordWrap (config.readEntry( "Dynamic Word Wrap", false ));
00691 setDynWordWrapIndicators (config.readEntry( "Dynamic Word Wrap Indicators", 1 ));
00692 setDynWordWrapAlignIndent (config.readEntry( "Dynamic Word Wrap Align Indent", 80 ));
00693
00694 setLineNumbers (config.readEntry( "Line Numbers", false));
00695
00696 setScrollBarMarks (config.readEntry( "Scroll Bar Marks", false));
00697
00698 setIconBar (config.readEntry( "Icon Bar", false ));
00699
00700 setFoldingBar (config.readEntry( "Folding Bar", true));
00701
00702 setBookmarkSort (config.readEntry( "Bookmark Menu Sorting", 0 ));
00703
00704 setAutoCenterLines (config.readEntry( "Auto Center Lines", 0 ));
00705
00706 setSearchFlags(config.readEntry(KEY_SEARCH_REPLACE_FLAGS,
00707 IncFromCursor|PowerMatchCase|PowerModePlainText));
00708
00709 setDefaultMarkType (config.readEntry( "Default Mark Type", int(KTextEditor::MarkInterface::markType01) ));
00710
00711 setPersistentSelection (config.readEntry( "Persistent Selection", false ));
00712
00713 setViInputMode (config.readEntry( "Vi Input Mode", false));
00714 setViInputModeStealKeys (config.readEntry( "Vi Input Mode Steal Keys", false));
00715 setViInputModeHideStatusBar (config.readEntry( "Vi Input Mode Hide Status Bar", false));
00716
00717 setAutomaticCompletionInvocation (config.readEntry( "Auto Completion", true ));
00718 setWordCompletion (config.readEntry( "Word Completion", true ));
00719 setWordCompletionMinimalWordLength (config.readEntry( "Word Completion Minimal Word Length", 3 ));
00720
00721 if (isGlobal()) {
00722 QStringList empty;
00723
00724
00725 QStringListModel * const patternHistoryModel = KateHistoryModel::getPatternHistoryModel();
00726 QStringList patternHistory = config.readEntry(KEY_PATTERN_HISTORY, empty);
00727 patternHistoryModel->setStringList(patternHistory);
00728
00729
00730 QStringListModel * const replacementHistoryModel = KateHistoryModel::getReplacementHistoryModel();
00731 QStringList replacementHistory = config.readEntry(KEY_REPLACEMENT_HISTORY, empty);
00732 replacementHistoryModel->setStringList(replacementHistory);
00733 }
00734
00735 configEnd ();
00736 }
00737
00738 void KateViewConfig::writeConfig (KConfigGroup &config)
00739 {
00740 config.writeEntry( "Dynamic Word Wrap", dynWordWrap() );
00741 config.writeEntry( "Dynamic Word Wrap Indicators", dynWordWrapIndicators() );
00742 config.writeEntry( "Dynamic Word Wrap Align Indent", dynWordWrapAlignIndent() );
00743
00744 config.writeEntry( "Line Numbers", lineNumbers() );
00745
00746 config.writeEntry( "Scroll Bar Marks", scrollBarMarks() );
00747
00748 config.writeEntry( "Icon Bar", iconBar() );
00749
00750 config.writeEntry( "Folding Bar", foldingBar() );
00751
00752 config.writeEntry( "Bookmark Menu Sorting", bookmarkSort() );
00753
00754 config.writeEntry( "Auto Center Lines", autoCenterLines() );
00755
00756 config.writeEntry(KEY_SEARCH_REPLACE_FLAGS, int(searchFlags()));
00757
00758 config.writeEntry("Default Mark Type", defaultMarkType());
00759
00760 config.writeEntry("Persistent Selection", persistentSelection());
00761
00762 config.writeEntry( "Auto Completion", automaticCompletionInvocation());
00763 config.writeEntry( "Word Completion", wordCompletion());
00764 config.writeEntry( "Word Completion Minimal Word Length", wordCompletionMinimalWordLength());
00765
00766 config.writeEntry( "Vi Input Mode", viInputMode());
00767
00768 config.writeEntry( "Vi Input Mode Steal Keys", viInputModeStealKeys());
00769
00770 config.writeEntry( "Vi Input Mode Hide Status Bar", viInputModeHideStatusBar());
00771
00772 if (isGlobal()) {
00773
00774 QStringListModel * const patternHistoryModel = KateHistoryModel::getPatternHistoryModel();
00775 config.writeEntry(KEY_PATTERN_HISTORY, patternHistoryModel->stringList());
00776
00777
00778 QStringListModel * const replacementHistoryModel = KateHistoryModel::getReplacementHistoryModel();
00779 config.writeEntry(KEY_REPLACEMENT_HISTORY, replacementHistoryModel->stringList());
00780 }
00781 }
00782
00783 void KateViewConfig::updateConfig ()
00784 {
00785 if (m_view)
00786 {
00787 m_view->updateConfig ();
00788 return;
00789 }
00790
00791 if (isGlobal())
00792 {
00793 for (int z=0; z < KateGlobal::self()->views().size(); ++z)
00794 (KateGlobal::self()->views())[z]->updateConfig ();
00795 }
00796 }
00797
00798 bool KateViewConfig::dynWordWrap () const
00799 {
00800 if (m_dynWordWrapSet || isGlobal())
00801 return m_dynWordWrap;
00802
00803 return s_global->dynWordWrap();
00804 }
00805
00806 void KateViewConfig::setDynWordWrap (bool wrap)
00807 {
00808 configStart ();
00809
00810 m_dynWordWrapSet = true;
00811 m_dynWordWrap = wrap;
00812
00813 configEnd ();
00814 }
00815
00816 int KateViewConfig::dynWordWrapIndicators () const
00817 {
00818 if (m_dynWordWrapIndicatorsSet || isGlobal())
00819 return m_dynWordWrapIndicators;
00820
00821 return s_global->dynWordWrapIndicators();
00822 }
00823
00824 void KateViewConfig::setDynWordWrapIndicators (int mode)
00825 {
00826 configStart ();
00827
00828 m_dynWordWrapIndicatorsSet = true;
00829 m_dynWordWrapIndicators = qBound(0, mode, 80);
00830
00831 configEnd ();
00832 }
00833
00834 int KateViewConfig::dynWordWrapAlignIndent () const
00835 {
00836 if (m_dynWordWrapAlignIndentSet || isGlobal())
00837 return m_dynWordWrapAlignIndent;
00838
00839 return s_global->dynWordWrapAlignIndent();
00840 }
00841
00842 void KateViewConfig::setDynWordWrapAlignIndent (int indent)
00843 {
00844 configStart ();
00845
00846 m_dynWordWrapAlignIndentSet = true;
00847 m_dynWordWrapAlignIndent = indent;
00848
00849 configEnd ();
00850 }
00851
00852 bool KateViewConfig::lineNumbers () const
00853 {
00854 if (m_lineNumbersSet || isGlobal())
00855 return m_lineNumbers;
00856
00857 return s_global->lineNumbers();
00858 }
00859
00860 void KateViewConfig::setLineNumbers (bool on)
00861 {
00862 configStart ();
00863
00864 m_lineNumbersSet = true;
00865 m_lineNumbers = on;
00866
00867 configEnd ();
00868 }
00869
00870 bool KateViewConfig::scrollBarMarks () const
00871 {
00872 if (m_scrollBarMarksSet || isGlobal())
00873 return m_scrollBarMarks;
00874
00875 return s_global->scrollBarMarks();
00876 }
00877
00878 void KateViewConfig::setScrollBarMarks (bool on)
00879 {
00880 configStart ();
00881
00882 m_scrollBarMarksSet = true;
00883 m_scrollBarMarks = on;
00884
00885 configEnd ();
00886 }
00887
00888 bool KateViewConfig::iconBar () const
00889 {
00890 if (m_iconBarSet || isGlobal())
00891 return m_iconBar;
00892
00893 return s_global->iconBar();
00894 }
00895
00896 void KateViewConfig::setIconBar (bool on)
00897 {
00898 configStart ();
00899
00900 m_iconBarSet = true;
00901 m_iconBar = on;
00902
00903 configEnd ();
00904 }
00905
00906 bool KateViewConfig::foldingBar () const
00907 {
00908 if (m_foldingBarSet || isGlobal())
00909 return m_foldingBar;
00910
00911 return s_global->foldingBar();
00912 }
00913
00914 void KateViewConfig::setFoldingBar (bool on)
00915 {
00916 configStart ();
00917
00918 m_foldingBarSet = true;
00919 m_foldingBar = on;
00920
00921 configEnd ();
00922 }
00923
00924 int KateViewConfig::bookmarkSort () const
00925 {
00926 if (m_bookmarkSortSet || isGlobal())
00927 return m_bookmarkSort;
00928
00929 return s_global->bookmarkSort();
00930 }
00931
00932 void KateViewConfig::setBookmarkSort (int mode)
00933 {
00934 configStart ();
00935
00936 m_bookmarkSortSet = true;
00937 m_bookmarkSort = mode;
00938
00939 configEnd ();
00940 }
00941
00942 int KateViewConfig::autoCenterLines () const
00943 {
00944 if (m_autoCenterLinesSet || isGlobal())
00945 return m_autoCenterLines;
00946
00947 return s_global->autoCenterLines();
00948 }
00949
00950 void KateViewConfig::setAutoCenterLines (int lines)
00951 {
00952 if (lines < 0)
00953 return;
00954
00955 configStart ();
00956
00957 m_autoCenterLinesSet = true;
00958 m_autoCenterLines = lines;
00959
00960 configEnd ();
00961 }
00962
00963 long KateViewConfig::searchFlags () const
00964 {
00965 if (m_searchFlagsSet || isGlobal())
00966 return m_searchFlags;
00967
00968 return s_global->searchFlags();
00969 }
00970
00971 void KateViewConfig::setSearchFlags (long flags)
00972 {
00973 configStart ();
00974
00975 m_searchFlagsSet = true;
00976 m_searchFlags = flags;
00977
00978 configEnd ();
00979 }
00980
00981 uint KateViewConfig::defaultMarkType () const
00982 {
00983 if (m_defaultMarkTypeSet || isGlobal())
00984 return m_defaultMarkType;
00985
00986 return s_global->defaultMarkType();
00987 }
00988
00989 void KateViewConfig::setDefaultMarkType (uint type)
00990 {
00991 configStart ();
00992
00993 m_defaultMarkTypeSet = true;
00994 m_defaultMarkType = type;
00995
00996 configEnd ();
00997 }
00998
00999 bool KateViewConfig::persistentSelection () const
01000 {
01001 if (m_persistentSelectionSet || isGlobal())
01002 return m_persistentSelection;
01003
01004 return s_global->persistentSelection();
01005 }
01006
01007 void KateViewConfig::setPersistentSelection (bool on)
01008 {
01009 configStart ();
01010
01011 m_persistentSelectionSet = true;
01012 m_persistentSelection = on;
01013
01014 configEnd ();
01015 }
01016
01017 bool KateViewConfig::viInputMode () const
01018 {
01019 if (m_viInputModeSet || isGlobal())
01020 return m_viInputMode;
01021
01022 return s_global->viInputMode();
01023 }
01024
01025 void KateViewConfig::setViInputMode (bool on)
01026 {
01027 configStart ();
01028
01029 m_viInputModeSet = true;
01030 m_viInputMode = on;
01031
01032
01033 foreach (KateView* view, KateGlobal::self()->views() ) {
01034 if (on && !m_viInputModeHideStatusBar) {
01035 view->showViModeBar();
01036 } else {
01037 view->hideViModeBar();
01038 }
01039 }
01040
01041
01042 if (!on && m_view) {
01043 m_view->doc()->setMergeAllEdits(false);
01044 }
01045
01046 configEnd ();
01047 }
01048
01049 bool KateViewConfig::viInputModeStealKeys () const
01050 {
01051 if (m_viInputModeStealKeysSet || isGlobal())
01052 return m_viInputModeStealKeys;
01053
01054 return s_global->viInputModeStealKeys();
01055 }
01056
01057 void KateViewConfig::setViInputModeStealKeys (bool on)
01058 {
01059 configStart ();
01060
01061 m_viInputModeStealKeysSet = true;
01062 m_viInputModeStealKeys = on;
01063
01064 configEnd ();
01065 }
01066
01067 bool KateViewConfig::viInputModeHideStatusBar () const
01068 {
01069 if (m_viInputModeHideStatusBarSet || isGlobal())
01070 return m_viInputModeHideStatusBar;
01071
01072 return s_global->viInputModeHideStatusBar();
01073 }
01074
01075 void KateViewConfig::setViInputModeHideStatusBar (bool on)
01076 {
01077 configStart ();
01078
01079 m_viInputModeHideStatusBarSet = true;
01080 m_viInputModeHideStatusBar = on;
01081
01082
01083 foreach (KateView* view, KateGlobal::self()->views() ) {
01084 if (on && m_viInputMode) {
01085 view->hideViModeBar();
01086 } else if (viInputMode()) {
01087 view->showViModeBar();
01088 }
01089 }
01090
01091 configEnd ();
01092 }
01093
01094
01095 bool KateViewConfig::automaticCompletionInvocation () const
01096 {
01097 if (m_automaticCompletionInvocationSet || isGlobal())
01098 return m_automaticCompletionInvocation;
01099
01100 return s_global->automaticCompletionInvocation();
01101 }
01102
01103 void KateViewConfig::setAutomaticCompletionInvocation (bool on)
01104 {
01105 configStart ();
01106
01107 m_automaticCompletionInvocationSet = true;
01108 m_automaticCompletionInvocation = on;
01109
01110 configEnd ();
01111 }
01112
01113 bool KateViewConfig::wordCompletion () const
01114 {
01115 if (m_wordCompletionSet || isGlobal())
01116 return m_wordCompletion;
01117
01118 return s_global->wordCompletion();
01119 }
01120
01121 void KateViewConfig::setWordCompletion (bool on)
01122 {
01123 configStart ();
01124
01125 m_wordCompletionSet = true;
01126 m_wordCompletion = on;
01127
01128 configEnd ();
01129 }
01130
01131 int KateViewConfig::wordCompletionMinimalWordLength () const
01132 {
01133 if (m_wordCompletionMinimalWordLengthSet || isGlobal())
01134 return m_wordCompletionMinimalWordLength;
01135
01136 return s_global->wordCompletionMinimalWordLength();
01137 }
01138
01139 void KateViewConfig::setWordCompletionMinimalWordLength (int length)
01140 {
01141 configStart ();
01142
01143 m_wordCompletionMinimalWordLengthSet = true;
01144 m_wordCompletionMinimalWordLength = length;
01145
01146 configEnd ();
01147 }
01148
01149
01150
01151
01152 KateRendererConfig::KateRendererConfig ()
01153 : m_fontMetrics(QFont()),
01154 m_lineMarkerColor (KTextEditor::MarkInterface::reservedMarkersCount()),
01155 m_schemaSet (true),
01156 m_fontSet (true),
01157 m_wordWrapMarkerSet (true),
01158 m_showIndentationLinesSet (true),
01159 m_showWholeBracketExpressionSet (true),
01160 m_backgroundColorSet (true),
01161 m_selectionColorSet (true),
01162 m_highlightedLineColorSet (true),
01163 m_highlightedBracketColorSet (true),
01164 m_wordWrapMarkerColorSet (true),
01165 m_tabMarkerColorSet(true),
01166 m_iconBarColorSet (true),
01167 m_lineNumberColorSet (true),
01168 m_templateColorsSet(true),
01169 m_lineMarkerColorSet (m_lineMarkerColor.size()),
01170 m_renderer (0)
01171 {
01172
01173 m_lineMarkerColorSet.fill (true);
01174
01175 s_global = this;
01176
01177
01178 KConfigGroup config(KGlobal::config(), "Kate Renderer Defaults");
01179 readConfig (config);
01180 }
01181
01182 KateRendererConfig::KateRendererConfig (KateRenderer *renderer)
01183 : m_fontMetrics(QFont()),
01184 m_lineMarkerColor (KTextEditor::MarkInterface::reservedMarkersCount()),
01185 m_schemaSet (false),
01186 m_fontSet (false),
01187 m_wordWrapMarkerSet (false),
01188 m_showIndentationLinesSet (false),
01189 m_showWholeBracketExpressionSet (false),
01190 m_backgroundColorSet (false),
01191 m_selectionColorSet (false),
01192 m_highlightedLineColorSet (false),
01193 m_highlightedBracketColorSet (false),
01194 m_wordWrapMarkerColorSet (false),
01195 m_tabMarkerColorSet(false),
01196 m_iconBarColorSet (false),
01197 m_lineNumberColorSet (false),
01198 m_templateColorsSet(false),
01199 m_lineMarkerColorSet (m_lineMarkerColor.size()),
01200 m_renderer (renderer)
01201 {
01202
01203 m_lineMarkerColorSet.fill (false);
01204 }
01205
01206 KateRendererConfig::~KateRendererConfig ()
01207 {
01208 }
01209
01210 void KateRendererConfig::readConfig (const KConfigGroup &config)
01211 {
01212 configStart ();
01213
01214 setSchema (config.readEntry("Schema", KateSchemaManager::normalSchema()));
01215
01216 setWordWrapMarker (config.readEntry("Word Wrap Marker", false ));
01217
01218 setShowIndentationLines (config.readEntry( "Show Indentation Lines", false));
01219
01220 setShowWholeBracketExpression (config.readEntry( "Show Whole Bracket Expression", false));
01221
01222 configEnd ();
01223 }
01224
01225 void KateRendererConfig::writeConfig (KConfigGroup& config)
01226 {
01227 config.writeEntry ("Schema", schema());
01228
01229 config.writeEntry("Word Wrap Marker", wordWrapMarker() );
01230
01231 config.writeEntry("Show Indentation Lines", showIndentationLines());
01232
01233 config.writeEntry("Show Whole Bracket Expression", showWholeBracketExpression());
01234 }
01235
01236 void KateRendererConfig::updateConfig ()
01237 {
01238 if (m_renderer)
01239 {
01240 m_renderer->updateConfig ();
01241 return;
01242 }
01243
01244 if (isGlobal())
01245 {
01246 for (int z=0; z < KateGlobal::self()->views().size(); ++z)
01247 (KateGlobal::self()->views())[z]->renderer()->updateConfig ();
01248 }
01249 }
01250
01251 const QString &KateRendererConfig::schema () const
01252 {
01253 if (m_schemaSet || isGlobal())
01254 return m_schema;
01255
01256 return s_global->schema();
01257 }
01258
01259 void KateRendererConfig::setSchema (const QString &schema)
01260 {
01261 configStart ();
01262 m_schemaSet = true;
01263 m_schema = schema;
01264 setSchemaInternal( schema );
01265 configEnd ();
01266 }
01267
01268 void KateRendererConfig::reloadSchema()
01269 {
01270 if ( isGlobal() )
01271 foreach (KateView* view, KateGlobal::self()->views() )
01272 view->renderer()->config()->reloadSchema();
01273
01274 else if ( m_renderer && m_schemaSet )
01275 setSchemaInternal( m_schema );
01276 }
01277
01278 void KateRendererConfig::setSchemaInternal( const QString &schema )
01279 {
01280 m_schemaSet = true;
01281 m_schema = schema;
01282
01283 KConfigGroup config = KateGlobal::self()->schemaManager()->schema(KateGlobal::self()->schemaManager()->number(schema));
01284
01285
01286 KColorScheme schemeView(QPalette::Active, KColorScheme::View);
01287 KColorScheme schemeWindow(QPalette::Active, KColorScheme::Window);
01288 KColorScheme schemeSelection(QPalette::Active, KColorScheme::Selection);
01289 QColor tmp0( schemeView.background().color() );
01290 QColor tmp1( schemeSelection.background().color() );
01291 QColor tmp2( schemeView.background(KColorScheme::AlternateBackground).color() );
01292
01293 qreal bgLuma = KColorUtils::luma( tmp0 );
01294 QColor tmp3( KColorUtils::tint(tmp0, schemeView.decoration(KColorScheme::HoverColor).color()) );
01295 QColor tmp4( KColorUtils::shade( tmp0, bgLuma > 0.3 ? -0.15 : 0.03 ) );
01296 QColor tmp5( KColorUtils::shade( tmp0, bgLuma > 0.7 ? -0.35 : 0.3 ) );
01297 QColor tmp6( schemeWindow.background().color() );
01298 QColor tmp7( schemeWindow.foreground().color() );
01299
01300 m_backgroundColor = config.readEntry("Color Background", tmp0);
01301 m_backgroundColorSet = true;
01302 m_selectionColor = config.readEntry("Color Selection", tmp1);
01303 m_selectionColorSet = true;
01304 m_highlightedLineColor = config.readEntry("Color Highlighted Line", tmp2);
01305 m_highlightedLineColorSet = true;
01306 m_highlightedBracketColor = config.readEntry("Color Highlighted Bracket", tmp3);
01307 m_highlightedBracketColorSet = true;
01308 m_wordWrapMarkerColor = config.readEntry("Color Word Wrap Marker", tmp4);
01309 m_wordWrapMarkerColorSet = true;
01310 m_tabMarkerColor = config.readEntry("Color Tab Marker", tmp5);
01311 m_tabMarkerColorSet = true;
01312 m_iconBarColor = config.readEntry("Color Icon Bar", tmp6);
01313 m_iconBarColorSet = true;
01314 m_lineNumberColor = config.readEntry("Color Line Number", tmp7);
01315 m_lineNumberColorSet = true;
01316
01317
01318 QColor mark[7];
01319 mark[0] = Qt::blue;
01320 mark[1] = Qt::red;
01321 mark[2] = Qt::yellow;
01322 mark[3] = Qt::magenta;
01323 mark[4] = Qt::gray;
01324 mark[5] = Qt::green;
01325 mark[6] = Qt::red;
01326
01327 for (int i = 1; i <= KTextEditor::MarkInterface::reservedMarkersCount(); i++) {
01328 QColor col = config.readEntry(QString("Color MarkType%1").arg(i), mark[i - 1]);
01329 int index = i-1;
01330 m_lineMarkerColorSet[index] = true;
01331 m_lineMarkerColor[index] = col;
01332 }
01333
01334 QFont f (KGlobalSettings::fixedFont());
01335
01336 m_font = config.readEntry("Font", f);
01337 m_fontMetrics = QFontMetrics(m_font);
01338 m_fontSet = true;
01339
01340 m_templateBackgroundColor=config.readEntry(QString("Color Template Background"),QColor(0xcc,0xcc,0xcc));
01341 m_templateEditablePlaceholderColor = config.readEntry(QString("Color Template Editable Placeholder"),QColor(0xcc,0xff,0xcc));
01342 m_templateFocusedEditablePlaceholderColor=config.readEntry(QString("Color Template Focused Editable Placeholder"),QColor(0x66,0xff,0x66));
01343 m_templateNotEditablePlaceholderColor=config.readEntry(QString("Color Template Not Editable Placeholder"),QColor(0xff,0xcc,0xcc));
01344
01345 m_templateColorsSet=true;
01346 }
01347
01348 const QFont& KateRendererConfig::font() const
01349 {
01350 if (m_fontSet || isGlobal())
01351 return m_font;
01352
01353 return s_global->font();
01354 }
01355
01356 const QFontMetrics& KateRendererConfig::fontMetrics() const
01357 {
01358 if (m_fontSet || isGlobal())
01359 return m_fontMetrics;
01360
01361 return s_global->fontMetrics();
01362 }
01363
01364 void KateRendererConfig::setFont(const QFont &font)
01365 {
01366 configStart ();
01367
01368 m_fontSet = true;
01369 m_font = font;
01370 m_fontMetrics = QFontMetrics(m_font);
01371
01372 configEnd ();
01373 }
01374
01375 bool KateRendererConfig::wordWrapMarker () const
01376 {
01377 if (m_wordWrapMarkerSet || isGlobal())
01378 return m_wordWrapMarker;
01379
01380 return s_global->wordWrapMarker();
01381 }
01382
01383 void KateRendererConfig::setWordWrapMarker (bool on)
01384 {
01385 configStart ();
01386
01387 m_wordWrapMarkerSet = true;
01388 m_wordWrapMarker = on;
01389
01390 configEnd ();
01391 }
01392
01393 const QColor& KateRendererConfig::backgroundColor() const
01394 {
01395 if (m_backgroundColorSet || isGlobal())
01396 return m_backgroundColor;
01397
01398 return s_global->backgroundColor();
01399 }
01400
01401 void KateRendererConfig::setBackgroundColor (const QColor &col)
01402 {
01403 configStart ();
01404
01405 m_backgroundColorSet = true;
01406 m_backgroundColor = col;
01407
01408 configEnd ();
01409 }
01410
01411 const QColor& KateRendererConfig::selectionColor() const
01412 {
01413 if (m_selectionColorSet || isGlobal())
01414 return m_selectionColor;
01415
01416 return s_global->selectionColor();
01417 }
01418
01419 void KateRendererConfig::setSelectionColor (const QColor &col)
01420 {
01421 configStart ();
01422
01423 m_selectionColorSet = true;
01424 m_selectionColor = col;
01425
01426 configEnd ();
01427 }
01428
01429 const QColor& KateRendererConfig::highlightedLineColor() const
01430 {
01431 if (m_highlightedLineColorSet || isGlobal())
01432 return m_highlightedLineColor;
01433
01434 return s_global->highlightedLineColor();
01435 }
01436
01437 void KateRendererConfig::setHighlightedLineColor (const QColor &col)
01438 {
01439 configStart ();
01440
01441 m_highlightedLineColorSet = true;
01442 m_highlightedLineColor = col;
01443
01444 configEnd ();
01445 }
01446
01447 const QColor& KateRendererConfig::lineMarkerColor(KTextEditor::MarkInterface::MarkTypes type) const
01448 {
01449 int index = 0;
01450 if (type > 0) { while((type >> index++) ^ 1) {} }
01451 index -= 1;
01452
01453 if ( index < 0 || index >= KTextEditor::MarkInterface::reservedMarkersCount() )
01454 {
01455 static QColor dummy;
01456 return dummy;
01457 }
01458
01459 if (m_lineMarkerColorSet[index] || isGlobal())
01460 return m_lineMarkerColor[index];
01461
01462 return s_global->lineMarkerColor( type );
01463 }
01464
01465 void KateRendererConfig::setLineMarkerColor (const QColor &col, KTextEditor::MarkInterface::MarkTypes type)
01466 {
01467 int index = static_cast<int>( log(static_cast<double>(type)) / log(2.0) );
01468 Q_ASSERT( index >= 0 && index < KTextEditor::MarkInterface::reservedMarkersCount() );
01469 configStart ();
01470
01471 m_lineMarkerColorSet[index] = true;
01472 m_lineMarkerColor[index] = col;
01473
01474 configEnd ();
01475 }
01476
01477 const QColor& KateRendererConfig::highlightedBracketColor() const
01478 {
01479 if (m_highlightedBracketColorSet || isGlobal())
01480 return m_highlightedBracketColor;
01481
01482 return s_global->highlightedBracketColor();
01483 }
01484
01485 void KateRendererConfig::setHighlightedBracketColor (const QColor &col)
01486 {
01487 configStart ();
01488
01489 m_highlightedBracketColorSet = true;
01490 m_highlightedBracketColor = col;
01491
01492 configEnd ();
01493 }
01494
01495 const QColor& KateRendererConfig::wordWrapMarkerColor() const
01496 {
01497 if (m_wordWrapMarkerColorSet || isGlobal())
01498 return m_wordWrapMarkerColor;
01499
01500 return s_global->wordWrapMarkerColor();
01501 }
01502
01503 void KateRendererConfig::setWordWrapMarkerColor (const QColor &col)
01504 {
01505 configStart ();
01506
01507 m_wordWrapMarkerColorSet = true;
01508 m_wordWrapMarkerColor = col;
01509
01510 configEnd ();
01511 }
01512
01513 const QColor& KateRendererConfig::tabMarkerColor() const
01514 {
01515 if (m_tabMarkerColorSet || isGlobal())
01516 return m_tabMarkerColor;
01517
01518 return s_global->tabMarkerColor();
01519 }
01520
01521 void KateRendererConfig::setTabMarkerColor (const QColor &col)
01522 {
01523 configStart ();
01524
01525 m_tabMarkerColorSet = true;
01526 m_tabMarkerColor = col;
01527
01528 configEnd ();
01529 }
01530
01531 const QColor& KateRendererConfig::iconBarColor() const
01532 {
01533 if (m_iconBarColorSet || isGlobal())
01534 return m_iconBarColor;
01535
01536 return s_global->iconBarColor();
01537 }
01538
01539 void KateRendererConfig::setIconBarColor (const QColor &col)
01540 {
01541 configStart ();
01542
01543 m_iconBarColorSet = true;
01544 m_iconBarColor = col;
01545
01546 configEnd ();
01547 }
01548
01549
01550 const QColor &KateRendererConfig::templateBackgroundColor() const {
01551 if (m_templateColorsSet || isGlobal())
01552 return m_templateBackgroundColor;
01553
01554 return s_global->templateBackgroundColor();
01555 }
01556 const QColor &KateRendererConfig::templateEditablePlaceholderColor() const {
01557 if (m_templateColorsSet || isGlobal())
01558 return m_templateEditablePlaceholderColor;
01559
01560 return s_global->templateEditablePlaceholderColor();
01561 }
01562 const QColor &KateRendererConfig::templateFocusedEditablePlaceholderColor() const {
01563 if (m_templateColorsSet || isGlobal())
01564 return m_templateFocusedEditablePlaceholderColor;
01565
01566 return s_global->templateFocusedEditablePlaceholderColor();
01567 }
01568 const QColor &KateRendererConfig::templateNotEditablePlaceholderColor() const {
01569 if (m_templateColorsSet || isGlobal())
01570 return m_templateNotEditablePlaceholderColor;
01571
01572 return s_global->templateNotEditablePlaceholderColor();
01573 }
01574
01575
01576 const QColor& KateRendererConfig::lineNumberColor() const
01577 {
01578 if (m_lineNumberColorSet || isGlobal())
01579 return m_lineNumberColor;
01580
01581 return s_global->lineNumberColor();
01582 }
01583
01584 void KateRendererConfig::setLineNumberColor (const QColor &col)
01585 {
01586 configStart ();
01587
01588 m_lineNumberColorSet = true;
01589 m_lineNumberColor = col;
01590
01591 configEnd ();
01592 }
01593
01594 bool KateRendererConfig::showIndentationLines () const
01595 {
01596 if (m_showIndentationLinesSet || isGlobal())
01597 return m_showIndentationLines;
01598
01599 return s_global->showIndentationLines();
01600 }
01601
01602 void KateRendererConfig::setShowIndentationLines (bool on)
01603 {
01604 configStart ();
01605
01606 m_showIndentationLinesSet = true;
01607 m_showIndentationLines = on;
01608
01609 configEnd ();
01610 }
01611
01612 bool KateRendererConfig::showWholeBracketExpression () const
01613 {
01614 if (m_showWholeBracketExpressionSet || isGlobal())
01615 return m_showWholeBracketExpression;
01616
01617 return s_global->showWholeBracketExpression();
01618 }
01619
01620 void KateRendererConfig::setShowWholeBracketExpression (bool on)
01621 {
01622 configStart ();
01623
01624 m_showWholeBracketExpressionSet = true;
01625 m_showWholeBracketExpression = on;
01626
01627 configEnd ();
01628 }
01629
01630
01631
01632