• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

Kate

kateconfig.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2003 Christoph Cullmann <cullmann@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, USA.
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 //BEGIN KateConfig
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 //END
00080 
00081 //BEGIN KateDocumentConfig
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   // init with defaults from config or really hardcoded ones
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   // This setting is purly a user preference,
00295   // hence, there exists only the global setting.
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 //END
00621 
00622 //BEGIN KateViewConfig
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_view (0)
00641 {
00642   s_global = this;
00643 
00644   // init with defaults from config or really hardcoded ones
00645   KConfigGroup config( KGlobal::config(), "Kate View Defaults");
00646   readConfig (config);
00647 }
00648 
00649 KateViewConfig::KateViewConfig (KateView *view)
00650  :
00651    m_dynWordWrapSet (false),
00652    m_dynWordWrapIndicatorsSet (false),
00653    m_dynWordWrapAlignIndentSet (false),
00654    m_lineNumbersSet (false),
00655    m_scrollBarMarksSet (false),
00656    m_iconBarSet (false),
00657    m_foldingBarSet (false),
00658    m_bookmarkSortSet (false),
00659    m_autoCenterLinesSet (false),
00660    m_searchFlagsSet (false),
00661    m_defaultMarkTypeSet (false),
00662    m_persistentSelectionSet (false),
00663    m_viInputModeSet (false),
00664    m_viInputModeStealKeysSet (false),
00665    m_automaticCompletionInvocationSet (false),
00666    m_view (view)
00667 {
00668 }
00669 
00670 KateViewConfig::~KateViewConfig ()
00671 {
00672 }
00673 
00674 
00675 // TODO Extract more keys to constants for maintainability
00676 static const char * const KEY_SEARCH_REPLACE_FLAGS = "Search/Replace Flags";
00677 static const char * const KEY_PATTERN_HISTORY = "Search Pattern History";
00678 static const char * const KEY_REPLACEMENT_HISTORY = "Replacement Text History";
00679 
00680 
00681 void KateViewConfig::readConfig ( const KConfigGroup &config)
00682 {
00683   configStart ();
00684 
00685   // default off again, until this is usable for large size documents
00686   setDynWordWrap (config.readEntry( "Dynamic Word Wrap", false ));
00687   setDynWordWrapIndicators (config.readEntry( "Dynamic Word Wrap Indicators", 1 ));
00688   setDynWordWrapAlignIndent (config.readEntry( "Dynamic Word Wrap Align Indent", 80 ));
00689 
00690   setLineNumbers (config.readEntry( "Line Numbers",  false));
00691 
00692   setScrollBarMarks (config.readEntry( "Scroll Bar Marks",  false));
00693 
00694   setIconBar (config.readEntry( "Icon Bar", false ));
00695 
00696   setFoldingBar (config.readEntry( "Folding Bar", true));
00697 
00698   setBookmarkSort (config.readEntry( "Bookmark Menu Sorting", 0 ));
00699 
00700   setAutoCenterLines (config.readEntry( "Auto Center Lines", 0 ));
00701 
00702   setSearchFlags(config.readEntry(KEY_SEARCH_REPLACE_FLAGS,
00703       IncFromCursor|PowerMatchCase|PowerModePlainText));
00704 
00705   setDefaultMarkType (config.readEntry( "Default Mark Type", int(KTextEditor::MarkInterface::markType01) ));
00706 
00707   setPersistentSelection (config.readEntry( "Persistent Selection", false ));
00708 
00709   setViInputMode (config.readEntry( "Vi Input Mode", false));
00710   setViInputModeStealKeys (config.readEntry( "Vi Input Mode Steal Keys", false));
00711   setViInputModeHideStatusBar (config.readEntry( "Vi Input Mode Hide Status Bar", false));
00712 
00713   setAutomaticCompletionInvocation (config.readEntry( "Auto Completion", true ));
00714 
00715   if (isGlobal()) {
00716     QStringList empty;
00717 
00718     // Read search pattern history
00719     QStringListModel * const patternHistoryModel = KateHistoryModel::getPatternHistoryModel();
00720     QStringList patternHistory = config.readEntry(KEY_PATTERN_HISTORY, empty);
00721     patternHistoryModel->setStringList(patternHistory);
00722 
00723     // Read replacement text history
00724     QStringListModel * const replacementHistoryModel = KateHistoryModel::getReplacementHistoryModel();
00725     QStringList replacementHistory = config.readEntry(KEY_REPLACEMENT_HISTORY, empty);
00726     replacementHistoryModel->setStringList(replacementHistory);
00727   }
00728 
00729   configEnd ();
00730 }
00731 
00732 void KateViewConfig::writeConfig (KConfigGroup &config)
00733 {
00734   config.writeEntry( "Dynamic Word Wrap", dynWordWrap() );
00735   config.writeEntry( "Dynamic Word Wrap Indicators", dynWordWrapIndicators() );
00736   config.writeEntry( "Dynamic Word Wrap Align Indent", dynWordWrapAlignIndent() );
00737 
00738   config.writeEntry( "Line Numbers", lineNumbers() );
00739 
00740   config.writeEntry( "Scroll Bar Marks", scrollBarMarks() );
00741 
00742   config.writeEntry( "Icon Bar", iconBar() );
00743 
00744   config.writeEntry( "Folding Bar", foldingBar() );
00745 
00746   config.writeEntry( "Bookmark Menu Sorting", bookmarkSort() );
00747 
00748   config.writeEntry( "Auto Center Lines", autoCenterLines() );
00749 
00750   config.writeEntry(KEY_SEARCH_REPLACE_FLAGS, int(searchFlags()));
00751 
00752   config.writeEntry("Default Mark Type", defaultMarkType());
00753 
00754   config.writeEntry("Persistent Selection", persistentSelection());
00755 
00756   config.writeEntry( "Auto Completion", automaticCompletionInvocation());
00757 
00758   config.writeEntry( "Vi Input Mode", viInputMode());
00759 
00760   config.writeEntry( "Vi Input Mode Steal Keys", viInputModeStealKeys());
00761 
00762   config.writeEntry( "Vi Input Mode Hide Status Bar", viInputModeHideStatusBar());
00763 
00764   if (isGlobal()) {
00765     // Write search pattern history
00766     QStringListModel * const patternHistoryModel = KateHistoryModel::getPatternHistoryModel();
00767     config.writeEntry(KEY_PATTERN_HISTORY, patternHistoryModel->stringList());
00768 
00769     // Write replacement text history
00770     QStringListModel * const replacementHistoryModel = KateHistoryModel::getReplacementHistoryModel();
00771     config.writeEntry(KEY_REPLACEMENT_HISTORY, replacementHistoryModel->stringList());
00772   }
00773 }
00774 
00775 void KateViewConfig::updateConfig ()
00776 {
00777   if (m_view)
00778   {
00779     m_view->updateConfig ();
00780     return;
00781   }
00782 
00783   if (isGlobal())
00784   {
00785     for (int z=0; z < KateGlobal::self()->views().size(); ++z)
00786       (KateGlobal::self()->views())[z]->updateConfig ();
00787   }
00788 }
00789 
00790 bool KateViewConfig::dynWordWrap () const
00791 {
00792   if (m_dynWordWrapSet || isGlobal())
00793     return m_dynWordWrap;
00794 
00795   return s_global->dynWordWrap();
00796 }
00797 
00798 void KateViewConfig::setDynWordWrap (bool wrap)
00799 {
00800   configStart ();
00801 
00802   m_dynWordWrapSet = true;
00803   m_dynWordWrap = wrap;
00804 
00805   configEnd ();
00806 }
00807 
00808 int KateViewConfig::dynWordWrapIndicators () const
00809 {
00810   if (m_dynWordWrapIndicatorsSet || isGlobal())
00811     return m_dynWordWrapIndicators;
00812 
00813   return s_global->dynWordWrapIndicators();
00814 }
00815 
00816 void KateViewConfig::setDynWordWrapIndicators (int mode)
00817 {
00818   configStart ();
00819 
00820   m_dynWordWrapIndicatorsSet = true;
00821   m_dynWordWrapIndicators = qBound(0, mode, 80);
00822 
00823   configEnd ();
00824 }
00825 
00826 int KateViewConfig::dynWordWrapAlignIndent () const
00827 {
00828   if (m_dynWordWrapAlignIndentSet || isGlobal())
00829     return m_dynWordWrapAlignIndent;
00830 
00831   return s_global->dynWordWrapAlignIndent();
00832 }
00833 
00834 void KateViewConfig::setDynWordWrapAlignIndent (int indent)
00835 {
00836   configStart ();
00837 
00838   m_dynWordWrapAlignIndentSet = true;
00839   m_dynWordWrapAlignIndent = indent;
00840 
00841   configEnd ();
00842 }
00843 
00844 bool KateViewConfig::lineNumbers () const
00845 {
00846   if (m_lineNumbersSet || isGlobal())
00847     return m_lineNumbers;
00848 
00849   return s_global->lineNumbers();
00850 }
00851 
00852 void KateViewConfig::setLineNumbers (bool on)
00853 {
00854   configStart ();
00855 
00856   m_lineNumbersSet = true;
00857   m_lineNumbers = on;
00858 
00859   configEnd ();
00860 }
00861 
00862 bool KateViewConfig::scrollBarMarks () const
00863 {
00864   if (m_scrollBarMarksSet || isGlobal())
00865     return m_scrollBarMarks;
00866 
00867   return s_global->scrollBarMarks();
00868 }
00869 
00870 void KateViewConfig::setScrollBarMarks (bool on)
00871 {
00872   configStart ();
00873 
00874   m_scrollBarMarksSet = true;
00875   m_scrollBarMarks = on;
00876 
00877   configEnd ();
00878 }
00879 
00880 bool KateViewConfig::iconBar () const
00881 {
00882   if (m_iconBarSet || isGlobal())
00883     return m_iconBar;
00884 
00885   return s_global->iconBar();
00886 }
00887 
00888 void KateViewConfig::setIconBar (bool on)
00889 {
00890   configStart ();
00891 
00892   m_iconBarSet = true;
00893   m_iconBar = on;
00894 
00895   configEnd ();
00896 }
00897 
00898 bool KateViewConfig::foldingBar () const
00899 {
00900   if (m_foldingBarSet || isGlobal())
00901     return m_foldingBar;
00902 
00903   return s_global->foldingBar();
00904 }
00905 
00906 void KateViewConfig::setFoldingBar (bool on)
00907 {
00908   configStart ();
00909 
00910   m_foldingBarSet = true;
00911   m_foldingBar = on;
00912 
00913   configEnd ();
00914 }
00915 
00916 int KateViewConfig::bookmarkSort () const
00917 {
00918   if (m_bookmarkSortSet || isGlobal())
00919     return m_bookmarkSort;
00920 
00921   return s_global->bookmarkSort();
00922 }
00923 
00924 void KateViewConfig::setBookmarkSort (int mode)
00925 {
00926   configStart ();
00927 
00928   m_bookmarkSortSet = true;
00929   m_bookmarkSort = mode;
00930 
00931   configEnd ();
00932 }
00933 
00934 int KateViewConfig::autoCenterLines () const
00935 {
00936   if (m_autoCenterLinesSet || isGlobal())
00937     return m_autoCenterLines;
00938 
00939   return s_global->autoCenterLines();
00940 }
00941 
00942 void KateViewConfig::setAutoCenterLines (int lines)
00943 {
00944   if (lines < 0)
00945     return;
00946 
00947   configStart ();
00948 
00949   m_autoCenterLinesSet = true;
00950   m_autoCenterLines = lines;
00951 
00952   configEnd ();
00953 }
00954 
00955 long KateViewConfig::searchFlags () const
00956 {
00957   if (m_searchFlagsSet || isGlobal())
00958     return m_searchFlags;
00959 
00960   return s_global->searchFlags();
00961 }
00962 
00963 void KateViewConfig::setSearchFlags (long flags)
00964  {
00965   configStart ();
00966 
00967   m_searchFlagsSet = true;
00968   m_searchFlags = flags;
00969 
00970   configEnd ();
00971 }
00972 
00973 uint KateViewConfig::defaultMarkType () const
00974 {
00975   if (m_defaultMarkTypeSet || isGlobal())
00976     return m_defaultMarkType;
00977 
00978   return s_global->defaultMarkType();
00979 }
00980 
00981 void KateViewConfig::setDefaultMarkType (uint type)
00982 {
00983   configStart ();
00984 
00985   m_defaultMarkTypeSet = true;
00986   m_defaultMarkType = type;
00987 
00988   configEnd ();
00989 }
00990 
00991 bool KateViewConfig::persistentSelection () const
00992 {
00993   if (m_persistentSelectionSet || isGlobal())
00994     return m_persistentSelection;
00995 
00996   return s_global->persistentSelection();
00997 }
00998 
00999 void KateViewConfig::setPersistentSelection (bool on)
01000 {
01001   configStart ();
01002 
01003   m_persistentSelectionSet = true;
01004   m_persistentSelection = on;
01005 
01006   configEnd ();
01007 }
01008 
01009 bool KateViewConfig::viInputMode () const
01010 {
01011   if (m_viInputModeSet || isGlobal())
01012     return m_viInputMode;
01013 
01014   return s_global->viInputMode();
01015 }
01016 
01017 void KateViewConfig::setViInputMode (bool on)
01018 {
01019   configStart ();
01020 
01021   m_viInputModeSet = true;
01022   m_viInputMode = on;
01023 
01024   // update all views and show/hide the status bar
01025   foreach (KateView* view, KateGlobal::self()->views() ) {
01026     if (on && !m_viInputModeHideStatusBar) {
01027       view->showViModeBar();
01028     } else {
01029       view->hideViModeBar();
01030     }
01031   }
01032 
01033   // make sure to turn off edits mergin when leaving vi input mode
01034   if (!on && m_view) {
01035     m_view->doc()->setMergeAllEdits(false);
01036   }
01037 
01038   configEnd ();
01039 }
01040 
01041 bool KateViewConfig::viInputModeStealKeys () const
01042 {
01043   if (m_viInputModeStealKeysSet || isGlobal())
01044     return m_viInputModeStealKeys;
01045 
01046   return s_global->viInputModeStealKeys();
01047 }
01048 
01049 void KateViewConfig::setViInputModeStealKeys (bool on)
01050 {
01051   configStart ();
01052 
01053   m_viInputModeStealKeysSet = true;
01054   m_viInputModeStealKeys = on;
01055 
01056   configEnd ();
01057 }
01058 
01059 bool KateViewConfig::viInputModeHideStatusBar () const
01060 {
01061   if (m_viInputModeHideStatusBarSet || isGlobal())
01062     return m_viInputModeHideStatusBar;
01063 
01064   return s_global->viInputModeHideStatusBar();
01065 }
01066 
01067 void KateViewConfig::setViInputModeHideStatusBar (bool on)
01068 {
01069   configStart ();
01070 
01071   m_viInputModeHideStatusBarSet = true;
01072   m_viInputModeHideStatusBar = on;
01073 
01074   // update all views and show/hide the status bar
01075   foreach (KateView* view, KateGlobal::self()->views() ) {
01076     if (on && m_viInputMode) {
01077       view->hideViModeBar();
01078     } else if (viInputMode()) {
01079       view->showViModeBar();
01080     }
01081   }
01082 
01083   configEnd ();
01084 }
01085 
01086 
01087 bool KateViewConfig::automaticCompletionInvocation () const
01088 {
01089   if (m_automaticCompletionInvocationSet || isGlobal())
01090     return m_automaticCompletionInvocation;
01091 
01092   return s_global->automaticCompletionInvocation();
01093 }
01094 
01095 void KateViewConfig::setAutomaticCompletionInvocation (bool on)
01096 {
01097   configStart ();
01098 
01099   m_automaticCompletionInvocationSet = true;
01100   m_automaticCompletionInvocation = on;
01101 
01102   configEnd ();
01103 }
01104 
01105 //END
01106 
01107 //BEGIN KateRendererConfig
01108 KateRendererConfig::KateRendererConfig ()
01109  : m_fontMetrics(QFont()),
01110    m_lineMarkerColor (KTextEditor::MarkInterface::reservedMarkersCount()),
01111    m_schemaSet (true),
01112    m_fontSet (true),
01113    m_wordWrapMarkerSet (true),
01114    m_showIndentationLinesSet (true),
01115    m_showWholeBracketExpressionSet (true),
01116    m_backgroundColorSet (true),
01117    m_selectionColorSet (true),
01118    m_highlightedLineColorSet (true),
01119    m_highlightedBracketColorSet (true),
01120    m_wordWrapMarkerColorSet (true),
01121    m_tabMarkerColorSet(true),
01122    m_iconBarColorSet (true),
01123    m_lineNumberColorSet (true),
01124    m_templateColorsSet(true),
01125    m_lineMarkerColorSet (m_lineMarkerColor.size()),
01126    m_renderer (0)
01127 {
01128   // init bitarray
01129   m_lineMarkerColorSet.fill (true);
01130 
01131   s_global = this;
01132 
01133   // init with defaults from config or really hardcoded ones
01134   KConfigGroup config(KGlobal::config(), "Kate Renderer Defaults");
01135   readConfig (config);
01136 }
01137 
01138 KateRendererConfig::KateRendererConfig (KateRenderer *renderer)
01139  : m_fontMetrics(QFont()),
01140    m_lineMarkerColor (KTextEditor::MarkInterface::reservedMarkersCount()),
01141    m_schemaSet (false),
01142    m_fontSet (false),
01143    m_wordWrapMarkerSet (false),
01144    m_showIndentationLinesSet (false),
01145    m_showWholeBracketExpressionSet (false),
01146    m_backgroundColorSet (false),
01147    m_selectionColorSet (false),
01148    m_highlightedLineColorSet (false),
01149    m_highlightedBracketColorSet (false),
01150    m_wordWrapMarkerColorSet (false),
01151    m_tabMarkerColorSet(false),
01152    m_iconBarColorSet (false),
01153    m_lineNumberColorSet (false),
01154    m_templateColorsSet(false),
01155    m_lineMarkerColorSet (m_lineMarkerColor.size()),
01156    m_renderer (renderer)
01157 {
01158   // init bitarray
01159   m_lineMarkerColorSet.fill (false);
01160 }
01161 
01162 KateRendererConfig::~KateRendererConfig ()
01163 {
01164 }
01165 
01166 void KateRendererConfig::readConfig (const KConfigGroup &config)
01167 {
01168   configStart ();
01169 
01170   setSchema (config.readEntry("Schema", KateSchemaManager::normalSchema()));
01171 
01172   setWordWrapMarker (config.readEntry("Word Wrap Marker", false ));
01173 
01174   setShowIndentationLines (config.readEntry( "Show Indentation Lines", false));
01175 
01176   setShowWholeBracketExpression (config.readEntry( "Show Whole Bracket Expression", false));
01177 
01178   configEnd ();
01179 }
01180 
01181 void KateRendererConfig::writeConfig (KConfigGroup& config)
01182 {
01183   config.writeEntry ("Schema", schema());
01184 
01185   config.writeEntry("Word Wrap Marker", wordWrapMarker() );
01186 
01187   config.writeEntry("Show Indentation Lines", showIndentationLines());
01188 
01189   config.writeEntry("Show Whole Bracket Expression", showWholeBracketExpression());
01190 }
01191 
01192 void KateRendererConfig::updateConfig ()
01193 {
01194   if (m_renderer)
01195   {
01196     m_renderer->updateConfig ();
01197     return;
01198   }
01199 
01200   if (isGlobal())
01201   {
01202     for (int z=0; z < KateGlobal::self()->views().size(); ++z)
01203       (KateGlobal::self()->views())[z]->renderer()->updateConfig ();
01204   }
01205 }
01206 
01207 const QString &KateRendererConfig::schema () const
01208 {
01209   if (m_schemaSet || isGlobal())
01210     return m_schema;
01211 
01212   return s_global->schema();
01213 }
01214 
01215 void KateRendererConfig::setSchema (const QString &schema)
01216 {
01217   configStart ();
01218   m_schemaSet = true;
01219   m_schema = schema;
01220   setSchemaInternal( schema );
01221   configEnd ();
01222 }
01223 
01224 void KateRendererConfig::reloadSchema()
01225 {
01226   if ( isGlobal() )
01227     foreach (KateView* view, KateGlobal::self()->views() )
01228       view->renderer()->config()->reloadSchema();
01229 
01230   else if ( m_renderer && m_schemaSet )
01231     setSchemaInternal( m_schema );
01232 }
01233 
01234 void KateRendererConfig::setSchemaInternal( const QString &schema )
01235 {
01236   m_schemaSet = true;
01237   m_schema = schema;
01238 
01239   KConfigGroup config = KateGlobal::self()->schemaManager()->schema(KateGlobal::self()->schemaManager()->number(schema));
01240 
01241   // NOTE keep in sync with KateSchemaConfigColorTab::schemaChanged
01242   KColorScheme schemeView(QPalette::Active, KColorScheme::View);
01243   KColorScheme schemeWindow(QPalette::Active, KColorScheme::Window);
01244   KColorScheme schemeSelection(QPalette::Active, KColorScheme::Selection);
01245   QColor tmp0( schemeView.background().color() );
01246   QColor tmp1( schemeSelection.background().color() );
01247   QColor tmp2( schemeView.background(KColorScheme::AlternateBackground).color() );
01248   // using KColorUtils::shade wasn't working really well
01249   qreal bgLuma = KColorUtils::luma( tmp0 );
01250   QColor tmp3( KColorUtils::tint(tmp0, schemeView.decoration(KColorScheme::HoverColor).color()) );
01251   QColor tmp4( KColorUtils::shade( tmp0, bgLuma > 0.3 ? -0.15 : 0.03 ) );
01252   QColor tmp5( KColorUtils::shade( tmp0, bgLuma > 0.7 ? -0.35 : 0.3 ) );
01253   QColor tmp6( schemeWindow.background().color() );
01254   QColor tmp7( schemeWindow.foreground().color() );
01255 
01256   m_backgroundColor = config.readEntry("Color Background", tmp0);
01257   m_backgroundColorSet = true;
01258   m_selectionColor = config.readEntry("Color Selection", tmp1);
01259   m_selectionColorSet = true;
01260   m_highlightedLineColor  = config.readEntry("Color Highlighted Line", tmp2);
01261   m_highlightedLineColorSet = true;
01262   m_highlightedBracketColor = config.readEntry("Color Highlighted Bracket", tmp3);
01263   m_highlightedBracketColorSet = true;
01264   m_wordWrapMarkerColor = config.readEntry("Color Word Wrap Marker", tmp4);
01265   m_wordWrapMarkerColorSet = true;
01266   m_tabMarkerColor = config.readEntry("Color Tab Marker", tmp5);
01267   m_tabMarkerColorSet = true;
01268   m_iconBarColor  = config.readEntry("Color Icon Bar", tmp6);
01269   m_iconBarColorSet = true;
01270   m_lineNumberColor = config.readEntry("Color Line Number", tmp7);
01271   m_lineNumberColorSet = true;
01272 
01273     // same std colors like in KateDocument::markColor
01274   QColor mark[7];
01275   mark[0] = Qt::blue;
01276   mark[1] = Qt::red;
01277   mark[2] = Qt::yellow;
01278   mark[3] = Qt::magenta;
01279   mark[4] = Qt::gray;
01280   mark[5] = Qt::green;
01281   mark[6] = Qt::red;
01282 
01283   for (int i = 1; i <= KTextEditor::MarkInterface::reservedMarkersCount(); i++) {
01284     QColor col = config.readEntry(QString("Color MarkType%1").arg(i), mark[i - 1]);
01285     int index = i-1;
01286     m_lineMarkerColorSet[index] = true;
01287     m_lineMarkerColor[index] = col;
01288   }
01289 
01290   QFont f (KGlobalSettings::fixedFont());
01291 
01292   m_font = config.readEntry("Font", f);
01293   m_fontMetrics = QFontMetrics(m_font);
01294   m_fontSet = true;
01295 
01296   m_templateBackgroundColor=config.readEntry(QString("Color Template Background"),QColor(0xcc,0xcc,0xcc));
01297   m_templateEditablePlaceholderColor = config.readEntry(QString("Color Template Editable Placeholder"),QColor(0xcc,0xff,0xcc));
01298   m_templateFocusedEditablePlaceholderColor=config.readEntry(QString("Color Template Focused Editable Placeholder"),QColor(0x66,0xff,0x66));
01299   m_templateNotEditablePlaceholderColor=config.readEntry(QString("Color Template Not Editable Placeholder"),QColor(0xff,0xcc,0xcc));
01300 
01301   m_templateColorsSet=true;
01302 }
01303 
01304 const QFont& KateRendererConfig::font() const
01305 {
01306   if (m_fontSet || isGlobal())
01307     return m_font;
01308 
01309   return s_global->font();
01310 }
01311 
01312 const QFontMetrics& KateRendererConfig::fontMetrics() const
01313 {
01314   if (m_fontSet || isGlobal())
01315     return m_fontMetrics;
01316 
01317   return s_global->fontMetrics();
01318 }
01319 
01320 void KateRendererConfig::setFont(const QFont &font)
01321 {
01322   configStart ();
01323 
01324   m_fontSet = true;
01325   m_font = font;
01326   m_fontMetrics = QFontMetrics(m_font);
01327 
01328   configEnd ();
01329 }
01330 
01331 bool KateRendererConfig::wordWrapMarker () const
01332 {
01333   if (m_wordWrapMarkerSet || isGlobal())
01334     return m_wordWrapMarker;
01335 
01336   return s_global->wordWrapMarker();
01337 }
01338 
01339 void KateRendererConfig::setWordWrapMarker (bool on)
01340 {
01341   configStart ();
01342 
01343   m_wordWrapMarkerSet = true;
01344   m_wordWrapMarker = on;
01345 
01346   configEnd ();
01347 }
01348 
01349 const QColor& KateRendererConfig::backgroundColor() const
01350 {
01351   if (m_backgroundColorSet || isGlobal())
01352     return m_backgroundColor;
01353 
01354   return s_global->backgroundColor();
01355 }
01356 
01357 void KateRendererConfig::setBackgroundColor (const QColor &col)
01358 {
01359   configStart ();
01360 
01361   m_backgroundColorSet = true;
01362   m_backgroundColor = col;
01363 
01364   configEnd ();
01365 }
01366 
01367 const QColor& KateRendererConfig::selectionColor() const
01368 {
01369   if (m_selectionColorSet || isGlobal())
01370     return m_selectionColor;
01371 
01372   return s_global->selectionColor();
01373 }
01374 
01375 void KateRendererConfig::setSelectionColor (const QColor &col)
01376 {
01377   configStart ();
01378 
01379   m_selectionColorSet = true;
01380   m_selectionColor = col;
01381 
01382   configEnd ();
01383 }
01384 
01385 const QColor& KateRendererConfig::highlightedLineColor() const
01386 {
01387   if (m_highlightedLineColorSet || isGlobal())
01388     return m_highlightedLineColor;
01389 
01390   return s_global->highlightedLineColor();
01391 }
01392 
01393 void KateRendererConfig::setHighlightedLineColor (const QColor &col)
01394 {
01395   configStart ();
01396 
01397   m_highlightedLineColorSet = true;
01398   m_highlightedLineColor = col;
01399 
01400   configEnd ();
01401 }
01402 
01403 const QColor& KateRendererConfig::lineMarkerColor(KTextEditor::MarkInterface::MarkTypes type) const
01404 {
01405   int index = 0;
01406   if (type > 0) { while((type >> index++) ^ 1) {} }
01407   index -= 1;
01408 
01409   if ( index < 0 || index >= KTextEditor::MarkInterface::reservedMarkersCount() )
01410   {
01411     static QColor dummy;
01412     return dummy;
01413   }
01414 
01415   if (m_lineMarkerColorSet[index] || isGlobal())
01416     return m_lineMarkerColor[index];
01417 
01418   return s_global->lineMarkerColor( type );
01419 }
01420 
01421 void KateRendererConfig::setLineMarkerColor (const QColor &col, KTextEditor::MarkInterface::MarkTypes type)
01422 {
01423   int index = static_cast<int>( log(static_cast<double>(type)) / log(2.0) );
01424   Q_ASSERT( index >= 0 && index < KTextEditor::MarkInterface::reservedMarkersCount() );
01425   configStart ();
01426 
01427   m_lineMarkerColorSet[index] = true;
01428   m_lineMarkerColor[index] = col;
01429 
01430   configEnd ();
01431 }
01432 
01433 const QColor& KateRendererConfig::highlightedBracketColor() const
01434 {
01435   if (m_highlightedBracketColorSet || isGlobal())
01436     return m_highlightedBracketColor;
01437 
01438   return s_global->highlightedBracketColor();
01439 }
01440 
01441 void KateRendererConfig::setHighlightedBracketColor (const QColor &col)
01442 {
01443   configStart ();
01444 
01445   m_highlightedBracketColorSet = true;
01446   m_highlightedBracketColor = col;
01447 
01448   configEnd ();
01449 }
01450 
01451 const QColor& KateRendererConfig::wordWrapMarkerColor() const
01452 {
01453   if (m_wordWrapMarkerColorSet || isGlobal())
01454     return m_wordWrapMarkerColor;
01455 
01456   return s_global->wordWrapMarkerColor();
01457 }
01458 
01459 void KateRendererConfig::setWordWrapMarkerColor (const QColor &col)
01460 {
01461   configStart ();
01462 
01463   m_wordWrapMarkerColorSet = true;
01464   m_wordWrapMarkerColor = col;
01465 
01466   configEnd ();
01467 }
01468 
01469 const QColor& KateRendererConfig::tabMarkerColor() const
01470 {
01471   if (m_tabMarkerColorSet || isGlobal())
01472     return m_tabMarkerColor;
01473 
01474   return s_global->tabMarkerColor();
01475 }
01476 
01477 void KateRendererConfig::setTabMarkerColor (const QColor &col)
01478 {
01479   configStart ();
01480 
01481   m_tabMarkerColorSet = true;
01482   m_tabMarkerColor = col;
01483 
01484   configEnd ();
01485 }
01486 
01487 const QColor& KateRendererConfig::iconBarColor() const
01488 {
01489   if (m_iconBarColorSet || isGlobal())
01490     return m_iconBarColor;
01491 
01492   return s_global->iconBarColor();
01493 }
01494 
01495 void KateRendererConfig::setIconBarColor (const QColor &col)
01496 {
01497   configStart ();
01498 
01499   m_iconBarColorSet = true;
01500   m_iconBarColor = col;
01501 
01502   configEnd ();
01503 }
01504 
01505 
01506 const QColor &KateRendererConfig::templateBackgroundColor() const {
01507   if (m_templateColorsSet || isGlobal())
01508     return m_templateBackgroundColor;
01509 
01510   return s_global->templateBackgroundColor();
01511 }
01512 const QColor &KateRendererConfig::templateEditablePlaceholderColor() const {
01513   if (m_templateColorsSet || isGlobal())
01514     return m_templateEditablePlaceholderColor;
01515 
01516   return s_global->templateEditablePlaceholderColor();
01517 }
01518 const QColor &KateRendererConfig::templateFocusedEditablePlaceholderColor() const {
01519   if (m_templateColorsSet || isGlobal())
01520     return m_templateFocusedEditablePlaceholderColor;
01521 
01522   return s_global->templateFocusedEditablePlaceholderColor();
01523 }
01524 const QColor &KateRendererConfig::templateNotEditablePlaceholderColor() const {
01525   if (m_templateColorsSet || isGlobal())
01526     return m_templateNotEditablePlaceholderColor;
01527 
01528   return s_global->templateNotEditablePlaceholderColor();
01529 }
01530 
01531 
01532 const QColor& KateRendererConfig::lineNumberColor() const
01533 {
01534   if (m_lineNumberColorSet || isGlobal())
01535     return m_lineNumberColor;
01536 
01537   return s_global->lineNumberColor();
01538 }
01539 
01540 void KateRendererConfig::setLineNumberColor (const QColor &col)
01541 {
01542   configStart ();
01543 
01544   m_lineNumberColorSet = true;
01545   m_lineNumberColor = col;
01546 
01547   configEnd ();
01548 }
01549 
01550 bool KateRendererConfig::showIndentationLines () const
01551 {
01552   if (m_showIndentationLinesSet || isGlobal())
01553     return m_showIndentationLines;
01554 
01555   return s_global->showIndentationLines();
01556 }
01557 
01558 void KateRendererConfig::setShowIndentationLines (bool on)
01559 {
01560   configStart ();
01561 
01562   m_showIndentationLinesSet = true;
01563   m_showIndentationLines = on;
01564 
01565   configEnd ();
01566 }
01567 
01568 bool KateRendererConfig::showWholeBracketExpression () const
01569 {
01570   if (m_showWholeBracketExpressionSet || isGlobal())
01571     return m_showWholeBracketExpression;
01572 
01573   return s_global->showWholeBracketExpression();
01574 }
01575 
01576 void KateRendererConfig::setShowWholeBracketExpression (bool on)
01577 {
01578   configStart ();
01579 
01580   m_showWholeBracketExpressionSet = true;
01581   m_showWholeBracketExpression = on;
01582 
01583   configEnd ();
01584 }
01585 
01586 //END
01587 
01588 // kate: space-indent on; indent-width 2; replace-tabs on;

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal