# kate Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kateconfig.h

    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., 59 Temple Place - Suite 330,
    00016    Boston, MA 02111-1307, USA.
    00017 */
    00018
    00019 #ifndef __KATE_CONFIG_H__
    00020 #define __KATE_CONFIG_H__
    00021
    00022 #include <ktexteditor/markinterface.h>
    00023
    00024 #include <qbitarray.h>
    00025 #include <qcolor.h>
    00026 #include <qobject.h>
    00027 #include <qvaluevector.h>
    00028
    00029 class KateView;
    00030 class KateDocument;
    00031 class KateRenderer;
    00032 class KateFontStruct;
    00033 class KateFontMetrics;
    00034
    00035 class KConfig;
    00036
    00037 class QFont;
    00038 class QTextCodec;
    00039
    00043 class KateConfig
    00044 {
    00045   public:
    00049     KateConfig ();
    00050
    00054     virtual ~KateConfig ();
    00055
    00056   public:
    00063      void configStart ();
    00064
    00069      void configEnd ();
    00070
    00071   protected:
    00075     virtual void updateConfig () = 0;
    00076
    00077   private:
    00081     uint configSessionNumber;
    00082
    00086     bool configIsRunning;
    00087 };
    00088
    00089 class KateDocumentConfig : public KateConfig
    00090 {
    00091   private:
    00092     friend class KateFactory;
    00093
    00097     KateDocumentConfig ();
    00098
    00099   public:
    00103     KateDocumentConfig (KateDocument *doc);
    00104
    00108     ~KateDocumentConfig ();
    00109
    00110     inline static KateDocumentConfig *global () { return s_global; }
    00111
    00112     inline bool isGlobal () const { return (this == global()); }
    00113
    00114   public:
    00118     void readConfig (KConfig *config);
    00119
    00123     void writeConfig (KConfig *config);
    00124
    00125   protected:
    00126     void updateConfig ();
    00127
    00128   public:
    00129     int tabWidth () const;
    00130     void setTabWidth (int tabWidth);
    00131
    00132     int indentationWidth () const;
    00133     void setIndentationWidth (int indentationWidth);
    00134
    00135     enum IndentationMode
    00136     {
    00137       imNone = 0,
    00138       imNormal = 1,
    00139       imCStyle = 2,
    00140       imPythonStyle = 3,
    00141       imXmlStyle = 4,
    00142       imCSAndS = 5,
    00143       imVarIndent = 6
    00144     };
    00145
    00146     uint indentationMode () const;
    00147     void setIndentationMode (uint identationMode);
    00148
    00149     bool wordWrap () const;
    00150     void setWordWrap (bool on);
    00151
    00152     unsigned int wordWrapAt () const;
    00153     void setWordWrapAt (unsigned int col);
    00154
    00155     uint undoSteps () const;
    00156     void setUndoSteps ( uint undoSteps );
    00157
    00158     bool pageUpDownMovesCursor () const;
    00159     void setPageUpDownMovesCursor (bool on);
    00160
    00161     enum ConfigFlags
    00162     {
    00163       cfBackspaceIndents= 0x2,
    00164       cfWordWrap= 0x4,
    00165       cfReplaceTabs= 0x8,
    00166       cfRemoveSpaces = 0x10,
    00167       cfWrapCursor= 0x20,
    00168       cfAutoBrackets= 0x40,
    00169       cfPersistent= 0x80,
    00170       cfKeepSelection= 0x100,
    00171       cfTabIndentsMode = 0x200,
    00172       cfDelOnInput= 0x400,
    00173       cfXorSelect= 0x800,
    00174       cfOvr= 0x1000,
    00175       cfMark= 0x2000,
    00176       cfKeepIndentProfile= 0x8000,
    00177       cfKeepExtraSpaces= 0x10000,
    00178       cfTabIndents= 0x80000,
    00179       cfShowTabs= 0x200000,
    00180       cfSpaceIndent= 0x400000,
    00181       cfSmartHome = 0x800000,
    00182       cfTabInsertsTab = 0x1000000,
    00183       cfReplaceTabsDyn=   0x2000000,
    00184       cfRemoveTrailingDyn=0x4000000,
    00185       cfDoxygenAutoTyping=0x8000000 ,    // Remove for KDE 4.0 (put in indenters)
    00186       cfMixedIndent = 0x10000000
    00187     };
    00188
    00189     uint configFlags () const;
    00190     void setConfigFlags (KateDocumentConfig::ConfigFlags flag, bool enable);
    00191     void setConfigFlags (uint fullFlags);
    00192
    00193     const QString &encoding () const;
    00194     QTextCodec *codec ();
    00195
    00196     void setEncoding (const QString &encoding);
    00197
    00198     bool isSetEncoding () const;
    00199
    00200     enum Eol
    00201     {
    00202       eolUnix = 0,
    00203       eolDos = 1,
    00204       eolMac = 2
    00205     };
    00206
    00207     int eol () const;
    00208     QString eolString ();
    00209
    00210     void setEol (int mode);
    00211
    00212     enum BackupFlags
    00213     {
    00214       LocalFiles=1,
    00215       RemoteFiles=2
    00216     };
    00217
    00218     uint backupFlags () const;
    00219     void setBackupFlags (uint flags);
    00220
    00221     const QString &backupPrefix () const;
    00222     void setBackupPrefix (const QString &prefix);
    00223
    00224     const QString &backupSuffix () const;
    00225     void setBackupSuffix (const QString &suffix);
    00226
    00227     bool plugin (uint index) const;
    00228     void setPlugin (uint index, bool load);
    00229
    00235     int searchDirConfigDepth () const;
    00236
    00237     void setSearchDirConfigDepth (int depth);
    00238
    00239   private:
    00240     int m_tabWidth;
    00241     int m_indentationWidth;
    00242     uint m_indentationMode;
    00243     bool m_wordWrap;
    00244     int m_wordWrapAt;
    00245     uint m_undoSteps;
    00246     bool m_pageUpDownMovesCursor;
    00247     uint m_configFlags;
    00248     QString m_encoding;
    00249     int m_eol;
    00250     uint m_backupFlags;
    00251     int m_searchDirConfigDepth;
    00252     QString m_backupPrefix;
    00253     QString m_backupSuffix;
    00254     QBitArray m_plugins;
    00255
    00256     bool m_tabWidthSet : 1;
    00257     bool m_indentationWidthSet : 1;
    00258     bool m_indentationModeSet : 1;
    00259     bool m_wordWrapSet : 1;
    00260     bool m_wordWrapAtSet : 1;
    00261     bool m_pageUpDownMovesCursorSet : 1;
    00262     bool m_undoStepsSet : 1;
    00263     uint m_configFlagsSet;
    00264     bool m_encodingSet : 1;
    00265     bool m_eolSet : 1;
    00266     bool m_backupFlagsSet : 1;
    00267     bool m_searchDirConfigDepthSet : 1;
    00268     bool m_backupPrefixSet : 1;
    00269     bool m_backupSuffixSet : 1;
    00270     QBitArray m_pluginsSet;
    00271
    00272   private:
    00273     static KateDocumentConfig *s_global;
    00274     KateDocument *m_doc;
    00275 };
    00276
    00277 class KateViewConfig : public KateConfig
    00278 {
    00279   private:
    00280     friend class KateFactory;
    00281
    00285     KateViewConfig ();
    00286
    00287   public:
    00291     KateViewConfig (KateView *view);
    00292
    00296     ~KateViewConfig ();
    00297
    00298     inline static KateViewConfig *global () { return s_global; }
    00299
    00300     inline bool isGlobal () const { return (this == global()); }
    00301
    00302   public:
    00306     void readConfig (KConfig *config);
    00307
    00311     void writeConfig (KConfig *config);
    00312
    00313   protected:
    00314     void updateConfig ();
    00315
    00316   public:
    00317     bool dynWordWrap () const;
    00318     void setDynWordWrap (bool wrap);
    00319
    00320     int dynWordWrapIndicators () const;
    00321     void setDynWordWrapIndicators (int mode);
    00322
    00323     int dynWordWrapAlignIndent () const;
    00324     void setDynWordWrapAlignIndent (int indent);
    00325
    00326     bool lineNumbers () const;
    00327     void setLineNumbers (bool on);
    00328
    00329     bool scrollBarMarks () const;
    00330     void setScrollBarMarks (bool on);
    00331
    00332     bool iconBar () const;
    00333     void setIconBar (bool on);
    00334
    00335     bool foldingBar () const;
    00336     void setFoldingBar (bool on);
    00337
    00338     int bookmarkSort () const;
    00339     void setBookmarkSort (int mode);
    00340
    00341     int autoCenterLines() const;
    00342     void setAutoCenterLines (int lines);
    00343
    00344     long searchFlags () const;
    00345     void setSearchFlags (long flags);
    00346
    00347     bool cmdLine () const;
    00348     void setCmdLine (bool on);
    00349
    00350     uint defaultMarkType () const;
    00351     void setDefaultMarkType (uint type);
    00352
    00353     enum TextToSearch
    00354     {
    00355       Nowhere = 0,
    00356       SelectionOnly = 1,
    00357       SelectionWord = 2,
    00358       WordOnly = 3,
    00359       WordSelection = 4
    00360     };
    00361
    00362     int textToSearchMode () const;
    00363     void setTextToSearchMode (int mode);
    00364
    00365   private:
    00366     bool m_dynWordWrap;
    00367     int m_dynWordWrapIndicators;
    00368     int m_dynWordWrapAlignIndent;
    00369     bool m_lineNumbers;
    00370     bool m_scrollBarMarks;
    00371     bool m_iconBar;
    00372     bool m_foldingBar;
    00373     int m_bookmarkSort;
    00374     int m_autoCenterLines;
    00375     long m_searchFlags;
    00376     bool m_cmdLine;
    00377     uint m_defaultMarkType;
    00378     int m_textToSearchMode;
    00379
    00380     bool m_dynWordWrapSet : 1;
    00381     bool m_dynWordWrapIndicatorsSet : 1;
    00382     bool m_dynWordWrapAlignIndentSet : 1;
    00383     bool m_lineNumbersSet : 1;
    00384     bool m_scrollBarMarksSet : 1;
    00385     bool m_iconBarSet : 1;
    00386     bool m_foldingBarSet : 1;
    00387     bool m_bookmarkSortSet : 1;
    00388     bool m_autoCenterLinesSet : 1;
    00389     bool m_searchFlagsSet : 1;
    00390     bool m_cmdLineSet : 1;
    00391     bool m_defaultMarkTypeSet : 1;
    00392     bool m_textToSearchModeSet : 1;
    00393
    00394   private:
    00395     static KateViewConfig *s_global;
    00396     KateView *m_view;
    00397 };
    00398
    00399 class KateRendererConfig : public KateConfig
    00400 {
    00401   private:
    00402     friend class KateFactory;
    00403
    00407     KateRendererConfig ();
    00408
    00409
    00410   public:
    00414     KateRendererConfig (KateRenderer *renderer);
    00415
    00419     ~KateRendererConfig ();
    00420
    00421     inline static KateRendererConfig *global () { return s_global; }
    00422
    00423     inline bool isGlobal () const { return (this == global()); }
    00424
    00425   public:
    00429     void readConfig (KConfig *config);
    00430
    00434     void writeConfig (KConfig *config);
    00435
    00436   protected:
    00437     void updateConfig ();
    00438
    00439   public:
    00440     uint schema () const;
    00441     void setSchema (uint schema);
    00447     void reloadSchema();
    00448
    00449     KateFontStruct *fontStruct ();
    00450     QFont *font();
    00451     KateFontMetrics *fontMetrics();
    00452
    00453     void setFont(const QFont &font);
    00454
    00455     bool wordWrapMarker () const;
    00456     void setWordWrapMarker (bool on);
    00457
    00458     const QColor& backgroundColor() const;
    00459     void setBackgroundColor (const QColor &col);
    00460
    00461     const QColor& selectionColor() const;
    00462     void setSelectionColor (const QColor &col);
    00463
    00464     const QColor& highlightedLineColor() const;
    00465     void setHighlightedLineColor (const QColor &col);
    00466
    00467     const QColor& lineMarkerColor(KTextEditor::MarkInterface::MarkTypes type = KTextEditor::MarkInterface::markType01) const; // markType01 == Bookmark
    00468     void setLineMarkerColor (const QColor &col, KTextEditor::MarkInterface::MarkTypes type = KTextEditor::MarkInterface::markType01);
    00469
    00470     const QColor& highlightedBracketColor() const;
    00471     void setHighlightedBracketColor (const QColor &col);
    00472
    00473     const QColor& wordWrapMarkerColor() const;
    00474     void setWordWrapMarkerColor (const QColor &col);
    00475
    00476     const QColor& tabMarkerColor() const;
    00477     void setTabMarkerColor (const QColor &col);
    00478
    00479     const QColor& iconBarColor() const;
    00480     void setIconBarColor (const QColor &col);
    00481
    00482     // the line number color is used for the line numbers on the left bar and
    00483     // for vertical separator lines and for code folding lines.
    00484     const QColor& lineNumberColor() const;
    00485     void setLineNumberColor (const QColor &col);
    00486
    00487   private:
    00491     void setSchemaInternal(int schema);
    00492
    00493     uint m_schema;
    00494     KateFontStruct *m_font;
    00495     bool m_wordWrapMarker;
    00496     QColor m_backgroundColor;
    00497     QColor m_selectionColor;
    00498     QColor m_highlightedLineColor;
    00499     QColor m_highlightedBracketColor;
    00500     QColor m_wordWrapMarkerColor;
    00501     QColor m_tabMarkerColor;
    00502     QColor m_iconBarColor;
    00503     QColor m_lineNumberColor;
    00504     QValueVector<QColor> m_lineMarkerColor;
    00505
    00506     bool m_schemaSet : 1;
    00507     bool m_fontSet : 1;
    00508     bool m_wordWrapMarkerSet : 1;
    00509     bool m_backgroundColorSet : 1;
    00510     bool m_selectionColorSet : 1;
    00511     bool m_highlightedLineColorSet : 1;
    00512     bool m_highlightedBracketColorSet : 1;
    00513     bool m_wordWrapMarkerColorSet : 1;
    00514     bool m_tabMarkerColorSet : 1;
    00515     bool m_iconBarColorSet : 1;
    00516     bool m_lineNumberColorSet : 1;
    00517     QBitArray m_lineMarkerColorSet;
    00518
    00519   private:
    00520     static KateRendererConfig *s_global;
    00521     KateRenderer *m_renderer;
    00522 };
    00523
    00524 #endif
    00525
    00526 // kate: space-indent on; indent-width 2; replace-tabs on;

This file is part of the documentation for kate Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:36:30 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003