• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

Kate

kateconfig.h

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 #ifndef __KATE_CONFIG_H__
00020 #define __KATE_CONFIG_H__
00021 
00022 #include "katepartprivate_export.h"
00023 
00024 #include <ktexteditor/markinterface.h>
00025 #include <kencodingprober.h>
00026 
00027 #include <QtCore/QBitRef>
00028 #include <QtGui/QColor>
00029 #include <QtCore/QObject>
00030 #include <QtCore/QVector>
00031 #include <QtGui/QFontMetrics>
00032 #include <QStringListModel>
00033 
00034 class KConfigGroup;
00035 class KateView;
00036 class KateDocument;
00037 class KateRenderer;
00038 
00039 class KConfig;
00040 
00041 class QTextCodec;
00042 
00043 
00047 class KateConfig
00048 {
00049   public:
00053     KateConfig ();
00054 
00058     virtual ~KateConfig ();
00059 
00060   public:
00067      void configStart ();
00068 
00073      void configEnd ();
00074 
00075   protected:
00079     virtual void updateConfig () = 0;
00080 
00081   private:
00085     uint configSessionNumber;
00086 
00090     bool configIsRunning;
00091 };
00092 
00093 class KATEPART_TESTS_EXPORT KateGlobalConfig : public KateConfig
00094 {
00095   private:
00096     friend class KateGlobal;
00097 
00101     KateGlobalConfig ();
00102 
00106     ~KateGlobalConfig ();
00107 
00108   public:
00109     static KateGlobalConfig *global () { return s_global; }
00110 
00111   public:
00115     void readConfig (const KConfigGroup &config);
00116 
00120     void writeConfig (KConfigGroup &config);
00121 
00122   protected:
00123     void updateConfig ();
00124 
00125   public:
00126     KEncodingProber::ProberType proberType () const
00127     {
00128       return m_proberType;
00129     }
00130 
00131     void setProberType (KEncodingProber::ProberType proberType);
00132 
00133     QTextCodec *fallbackCodec () const;
00134     const QString &fallbackEncoding () const;
00135     bool setFallbackEncoding (const QString &encoding);
00136 
00137   private:
00138     KEncodingProber::ProberType m_proberType;
00139     QString m_fallbackEncoding;
00140 
00141   private:
00142     static KateGlobalConfig *s_global;
00143 };
00144 
00145 class KATEPART_TESTS_EXPORT KateDocumentConfig : public KateConfig
00146 {
00147   private:
00148     friend class KateGlobal;
00149 
00150     KateDocumentConfig ();
00151 
00152   public:
00153     KateDocumentConfig (const KConfigGroup &cg);
00154 
00158     KateDocumentConfig (KateDocument *doc);
00159 
00163     ~KateDocumentConfig ();
00164 
00165     inline static KateDocumentConfig *global () { return s_global; }
00166 
00167     inline bool isGlobal () const { return (this == global()); }
00168 
00169   public:
00173     void readConfig (const KConfigGroup &config);
00174 
00178     void writeConfig (KConfigGroup &config);
00179 
00180   protected:
00181     void updateConfig ();
00182 
00183   public:
00184     int tabWidth () const;
00185     void setTabWidth (int tabWidth);
00186 
00187     int indentationWidth () const;
00188     void setIndentationWidth (int indentationWidth);
00189 
00190     const QString &indentationMode () const;
00191     void setIndentationMode (const QString &identationMode);
00192 
00193     enum TabHandling
00194     {
00195       tabInsertsTab = 0,
00196       tabIndents = 1,
00197       tabSmart = 2      
00198     };
00199 
00200     uint tabHandling () const;
00201     void setTabHandling (uint tabHandling);
00202 
00203     bool wordWrap () const;
00204     void setWordWrap (bool on);
00205 
00206     unsigned int wordWrapAt () const;
00207     void setWordWrapAt (unsigned int col);
00208 
00209     bool pageUpDownMovesCursor () const;
00210     void setPageUpDownMovesCursor (bool on);
00211 
00212     void setKeepExtraSpaces (bool on);
00213     bool keepExtraSpaces () const;
00214 
00215     void setIndentPastedText (bool on);
00216     bool indentPastedText () const;
00217 
00218     void setBackspaceIndents (bool on);
00219     bool backspaceIndents () const;
00220 
00221     void setSmartHome (bool on);
00222     bool smartHome () const;
00223 
00224     void setWrapCursor (bool on);
00225     bool wrapCursor () const;
00226 
00227     void setAutoBrackets (bool on);
00228     bool autoBrackets () const;
00229 
00230     void setShowTabs (bool on);
00231     bool showTabs() const;
00232 
00233     void setShowSpaces (bool on);
00234     bool showSpaces() const;
00235 
00236     void setReplaceTabsDyn (bool on);
00237     bool replaceTabsDyn() const;
00238 
00239     void setRemoveTrailingDyn (bool on);
00240     bool removeTrailingDyn() const;
00241 
00242     void setRemoveSpaces (bool on);
00243     bool removeSpaces () const;
00244 
00245     void setOvr (bool on);
00246     bool ovr () const;
00247 
00248     void setTabIndents (bool on);
00249     bool tabIndentsEnabled () const;
00250 
00251     QTextCodec *codec () const;
00252     const QString &encoding () const;
00253     bool setEncoding (const QString &encoding);
00254     bool isSetEncoding () const;
00255 
00256     enum Eol
00257     {
00258       eolUnix = 0,
00259       eolDos = 1,
00260       eolMac = 2
00261     };
00262 
00263     int eol () const;
00264     QString eolString ();
00265 
00266     void setEol (int mode);
00267 
00268     bool bom () const;
00269     void setBom(bool bom);
00270 
00271     bool allowEolDetection () const;
00272     void setAllowEolDetection (bool on);
00273 
00274     bool allowSimpleMode () const;
00275     void setAllowSimpleMode (bool on);
00276 
00277     enum BackupFlags
00278     {
00279       LocalFiles=1,
00280       RemoteFiles=2
00281     };
00282 
00283     uint backupFlags () const;
00284     void setBackupFlags (uint flags);
00285 
00286     const QString &backupPrefix () const;
00287     void setBackupPrefix (const QString &prefix);
00288 
00289     const QString &backupSuffix () const;
00290     void setBackupSuffix (const QString &suffix);
00291 
00292     bool swapFileNoSync() const;
00293     void setSwapFileNoSync(bool on);
00294 
00300     int searchDirConfigDepth () const;
00301 
00302     void setSearchDirConfigDepth (int depth);
00303 
00304     bool onTheFlySpellCheck() const;
00305     void setOnTheFlySpellCheck(bool on);
00306 
00307 
00308   private:
00309     QString m_indentationMode;
00310     int m_indentationWidth;
00311     int m_tabWidth;
00312     uint m_tabHandling;
00313     uint m_configFlags;
00314     int m_wordWrapAt;
00315     bool m_wordWrap;
00316     bool m_pageUpDownMovesCursor;
00317     bool m_allowEolDetection;
00318     bool m_allowSimpleMode;
00319     int m_eol;
00320     bool m_bom;
00321     uint m_backupFlags;
00322     int m_searchDirConfigDepth;
00323     QString m_encoding;
00324     QString m_backupPrefix;
00325     QString m_backupSuffix;
00326     bool m_swapFileNoSync;
00327     bool m_onTheFlySpellCheck;
00328 
00329     bool m_tabWidthSet : 1;
00330     bool m_indentationWidthSet : 1;
00331     bool m_indentationModeSet : 1;
00332     bool m_wordWrapSet : 1;
00333     bool m_wordWrapAtSet : 1;
00334     bool m_pageUpDownMovesCursorSet : 1;
00335 
00336     bool m_keepExtraSpacesSet : 1;
00337     bool m_keepExtraSpaces : 1;
00338     bool m_indentPastedTextSet : 1;
00339     bool m_indentPastedText : 1;
00340     bool m_backspaceIndentsSet : 1;
00341     bool m_backspaceIndents : 1;
00342     bool m_smartHomeSet : 1;
00343     bool m_smartHome : 1;
00344     bool m_wrapCursorSet : 1;
00345     bool m_wrapCursor : 1;
00346     bool m_autoBracketsSet : 1;
00347     bool m_autoBrackets : 1;
00348     bool m_showTabsSet : 1;
00349     bool m_showTabs : 1;
00350     bool m_showSpacesSet : 1;
00351     bool m_showSpaces : 1;
00352     bool m_replaceTabsDynSet : 1;
00353     bool m_replaceTabsDyn : 1;
00354     bool m_removeTrailingDynSet : 1;
00355     bool m_removeTrailingDyn : 1;
00356     bool m_removeSpacesSet : 1;
00357     bool m_removeSpaces : 1;
00358     bool m_overwiteModeSet : 1;
00359     bool m_overwiteMode : 1;
00360     bool m_tabIndentsSet : 1;
00361     bool m_tabIndents : 1;
00362 
00363     bool m_encodingSet : 1;
00364     bool m_eolSet : 1;
00365     bool m_bomSet :1;
00366     bool m_allowEolDetectionSet : 1;
00367     bool m_allowSimpleModeSet : 1;
00368     bool m_backupFlagsSet : 1;
00369     bool m_searchDirConfigDepthSet : 1;
00370     bool m_backupPrefixSet : 1;
00371     bool m_backupSuffixSet : 1;
00372     bool m_swapFileNoSyncSet : 1;
00373     bool m_onTheFlySpellCheckSet : 1;
00374 
00375   private:
00376     static KateDocumentConfig *s_global;
00377     KateDocument *m_doc;
00378 };
00379 
00380 class KATEPART_TESTS_EXPORT KateViewConfig : public KateConfig
00381 {
00382   private:
00383     friend class KateGlobal;
00384 
00388     KateViewConfig ();
00389 
00390   public:
00394     explicit KateViewConfig (KateView *view);
00395 
00399     ~KateViewConfig ();
00400 
00401     inline static KateViewConfig *global () { return s_global; }
00402 
00403     inline bool isGlobal () const { return (this == global()); }
00404 
00405   public:
00409     void readConfig (const KConfigGroup &config);
00410 
00414     void writeConfig (KConfigGroup &config);
00415 
00416   protected:
00417     void updateConfig ();
00418 
00419   public:
00420     bool dynWordWrap () const;
00421     void setDynWordWrap (bool wrap);
00422 
00423     int dynWordWrapIndicators () const;
00424     void setDynWordWrapIndicators (int mode);
00425 
00426     int dynWordWrapAlignIndent () const;
00427     void setDynWordWrapAlignIndent (int indent);
00428 
00429     bool lineNumbers () const;
00430     void setLineNumbers (bool on);
00431 
00432     bool scrollBarMarks () const;
00433     void setScrollBarMarks (bool on);
00434 
00435     bool iconBar () const;
00436     void setIconBar (bool on);
00437 
00438     bool foldingBar () const;
00439     void setFoldingBar (bool on);
00440 
00441     int bookmarkSort () const;
00442     void setBookmarkSort (int mode);
00443 
00444     int autoCenterLines() const;
00445     void setAutoCenterLines (int lines);
00446 
00447     enum SearchFlags {
00448       IncMatchCase = 1 << 0,
00449       IncHighlightAll = 1 << 1,
00450       IncFromCursor = 1 << 2,
00451       PowerMatchCase = 1 << 3,
00452       PowerHighlightAll = 1 << 4,
00453       PowerFromCursor = 1 << 5,
00454       // PowerSelectionOnly = 1 << 6, Better not save to file // Sebastian
00455       PowerModePlainText = 1 << 7,
00456       PowerModeWholeWords = 1 << 8,
00457       PowerModeEscapeSequences = 1 << 9,
00458       PowerModeRegularExpression = 1 << 10,
00459       PowerUsePlaceholders = 1 << 11
00460     };
00461 
00462     long searchFlags () const;
00463     void setSearchFlags (long flags);
00464 
00465     int maxHistorySize() const;
00466 
00467     QStringListModel *patternHistoryModel();
00468     QStringListModel *replacementHistoryModel();
00469 
00470     uint defaultMarkType () const;
00471     void setDefaultMarkType (uint type);
00472     
00473     bool allowMarkMenu () const;
00474     void setAllowMarkMenu (bool allow);
00475 
00476     bool persistentSelection () const;
00477     void setPersistentSelection (bool on);
00478 
00479     bool viInputMode () const;
00480     void setViInputMode (bool on);
00481 
00482     bool viInputModeStealKeys () const;
00483     void setViInputModeStealKeys (bool on);
00484 
00485     bool viInputModeHideStatusBar () const;
00486     void setViInputModeHideStatusBar (bool on);
00487 
00488     // Do we still need the enum and related functions below?
00489     enum TextToSearch
00490     {
00491       Nowhere = 0,
00492       SelectionOnly = 1,
00493       SelectionWord = 2,
00494       WordOnly = 3,
00495       WordSelection = 4
00496     };
00497 
00498     bool automaticCompletionInvocation () const;
00499     void setAutomaticCompletionInvocation (bool on);
00500 
00501     bool wordCompletion () const;
00502     void setWordCompletion (bool on);
00503 
00504     int wordCompletionMinimalWordLength () const;
00505     void setWordCompletionMinimalWordLength (int length);
00506 
00507     bool smartCopyCut() const;
00508     void setSmartCopyCut(bool on);
00509 
00510     bool scrollPastEnd() const;
00511     void setScrollPastEnd(bool on);
00512 
00513   private:
00514     bool m_dynWordWrap;
00515     int m_dynWordWrapIndicators;
00516     int m_dynWordWrapAlignIndent;
00517     bool m_lineNumbers;
00518     bool m_scrollBarMarks;
00519     bool m_iconBar;
00520     bool m_foldingBar;
00521     int m_bookmarkSort;
00522     int m_autoCenterLines;
00523     long m_searchFlags;
00524     int m_maxHistorySize;
00525     QStringListModel m_patternHistoryModel;
00526     QStringListModel m_replacementHistoryModel;
00527     uint m_defaultMarkType;
00528     bool m_persistentSelection;
00529     bool m_viInputMode;
00530     bool m_viInputModeStealKeys;
00531     bool m_viInputModeHideStatusBar;
00532     bool m_automaticCompletionInvocation;
00533     bool m_wordCompletion;
00534     int m_wordCompletionMinimalWordLength;
00535     bool m_smartCopyCut;
00536     bool m_scrollPastEnd;
00537 
00538     bool m_dynWordWrapSet : 1;
00539     bool m_dynWordWrapIndicatorsSet : 1;
00540     bool m_dynWordWrapAlignIndentSet : 1;
00541     bool m_lineNumbersSet : 1;
00542     bool m_scrollBarMarksSet : 1;
00543     bool m_iconBarSet : 1;
00544     bool m_foldingBarSet : 1;
00545     bool m_bookmarkSortSet : 1;
00546     bool m_autoCenterLinesSet : 1;
00547     bool m_searchFlagsSet : 1;
00548     bool m_defaultMarkTypeSet : 1;
00549     bool m_persistentSelectionSet : 1;
00550     bool m_viInputModeSet : 1;
00551     bool m_viInputModeStealKeysSet : 1;
00552     bool m_viInputModeHideStatusBarSet : 1;
00553     bool m_automaticCompletionInvocationSet : 1;
00554     bool m_wordCompletionSet : 1;
00555     bool m_wordCompletionMinimalWordLengthSet : 1;
00556     bool m_smartCopyCutSet : 1;
00557     bool m_scrollPastEndSet : 1;
00558     bool m_allowMarkMenu : 1;
00559 
00560   private:
00561     static KateViewConfig *s_global;
00562     KateView *m_view;
00563 };
00564 
00565 class KateRendererConfig : public KateConfig
00566 {
00567   private:
00568     friend class KateGlobal;
00569 
00573     KateRendererConfig ();
00574 
00575 
00576   public:
00580     KateRendererConfig (KateRenderer *renderer);
00581 
00585     ~KateRendererConfig ();
00586 
00587     inline static KateRendererConfig *global () { return s_global; }
00588 
00589     inline bool isGlobal () const { return (this == global()); }
00590 
00591   public:
00595     void readConfig (const KConfigGroup &config);
00596 
00600     void writeConfig (KConfigGroup &config);
00601 
00602   protected:
00603     void updateConfig ();
00604 
00605   public:
00606     const QString &schema () const;
00607     void setSchema (const QString &schema);
00613     void reloadSchema();
00614 
00615     const QFont& font() const;
00616     const QFontMetrics& fontMetrics() const;
00617     void setFont(const QFont &font);
00618 
00619     bool wordWrapMarker () const;
00620     void setWordWrapMarker (bool on);
00621 
00622     const QColor& backgroundColor() const;
00623     void setBackgroundColor (const QColor &col);
00624 
00625     const QColor& selectionColor() const;
00626     void setSelectionColor (const QColor &col);
00627 
00628     const QColor& highlightedLineColor() const;
00629     void setHighlightedLineColor (const QColor &col);
00630 
00631     const QColor& lineMarkerColor(KTextEditor::MarkInterface::MarkTypes type = KTextEditor::MarkInterface::markType01) const; // markType01 == Bookmark
00632     void setLineMarkerColor (const QColor &col, KTextEditor::MarkInterface::MarkTypes type = KTextEditor::MarkInterface::markType01);
00633 
00634     const QColor& highlightedBracketColor() const;
00635     void setHighlightedBracketColor (const QColor &col);
00636 
00637     const QColor& wordWrapMarkerColor() const;
00638     void setWordWrapMarkerColor (const QColor &col);
00639 
00640     const QColor& tabMarkerColor() const;
00641     void setTabMarkerColor (const QColor &col);
00642 
00643     const QColor& iconBarColor() const;
00644     void setIconBarColor (const QColor &col);
00645 
00646     // the line number color is used for the line numbers on the left bar and
00647     // for vertical separator lines and for code folding lines.
00648     const QColor& lineNumberColor() const;
00649     void setLineNumberColor (const QColor &col);
00650 
00651     const QColor& spellingMistakeLineColor() const;
00652     void setSpellingMistakeKineColor (const QColor &col);
00653 
00654     bool showIndentationLines () const;
00655     void setShowIndentationLines (bool on);
00656 
00657     bool showWholeBracketExpression () const;
00658     void setShowWholeBracketExpression (bool on);
00659 
00660     const QColor &templateBackgroundColor() const;
00661     const QColor &templateEditablePlaceholderColor() const;
00662     const QColor &templateFocusedEditablePlaceholderColor() const;
00663     const QColor &templateNotEditablePlaceholderColor() const;
00664 
00665 
00666   private:
00670     void setSchemaInternal(const QString &schema);
00671 
00672     QString m_schema;
00673     QFont m_font;
00674     QFontMetrics m_fontMetrics;
00675     bool m_wordWrapMarker;
00676     bool m_showIndentationLines;
00677     bool m_showWholeBracketExpression;
00678     QColor m_backgroundColor;
00679     QColor m_selectionColor;
00680     QColor m_highlightedLineColor;
00681     QColor m_highlightedBracketColor;
00682     QColor m_wordWrapMarkerColor;
00683     QColor m_tabMarkerColor;
00684     QColor m_iconBarColor;
00685     QColor m_lineNumberColor;
00686     QColor m_spellingMistakeLineColor;
00687     QVector<QColor> m_lineMarkerColor;
00688 
00689     QColor m_templateBackgroundColor;
00690     QColor m_templateEditablePlaceholderColor;
00691     QColor m_templateFocusedEditablePlaceholderColor;
00692     QColor m_templateNotEditablePlaceholderColor;
00693 
00694 
00695     bool m_schemaSet : 1;
00696     bool m_fontSet : 1;
00697     bool m_wordWrapMarkerSet : 1;
00698     bool m_showIndentationLinesSet : 1;
00699     bool m_showWholeBracketExpressionSet : 1;
00700     bool m_backgroundColorSet : 1;
00701     bool m_selectionColorSet : 1;
00702     bool m_highlightedLineColorSet : 1;
00703     bool m_highlightedBracketColorSet : 1;
00704     bool m_wordWrapMarkerColorSet : 1;
00705     bool m_tabMarkerColorSet : 1;
00706     bool m_iconBarColorSet : 1;
00707     bool m_lineNumberColorSet : 1;
00708     bool m_spellingMistakeLineColorSet : 1;
00709     bool m_templateColorsSet : 1;
00710     QBitArray m_lineMarkerColorSet;
00711 
00712   private:
00713     static KateRendererConfig *s_global;
00714     KateRenderer *m_renderer;
00715 };
00716 
00717 #endif
00718 
00719 // 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
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
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