kate Library API Documentation

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 <qobject.h>
00023 #include <qbitarray.h>
00024 
00025 class KateView;
00026 class KateDocument;
00027 class KateRenderer;
00028 class FontStruct;
00029 
00030 class KConfig;
00031 
00032 class QColor;
00033 class QFont;
00034 class QTextCodec;
00035 class KateFontMetrics;
00036 
00037 class KateConfig
00038 {
00039   public:
00040     KateConfig ();
00041     virtual ~KateConfig ();
00042 
00043   public:
00044      void configStart ();
00045      void configEnd ();
00046 
00047   protected:
00048     virtual void updateConfig () = 0;
00049 
00050   private:
00051     uint configSessionNumber;
00052     bool configIsRunning;
00053 };
00054 
00055 class KateDocumentConfig : public KateConfig
00056 {
00057   private:
00058     friend class KateFactory;
00059   
00063     KateDocumentConfig ();
00064 
00065   public:
00069     KateDocumentConfig (KateDocument *doc);
00070 
00074     ~KateDocumentConfig ();
00075 
00076     inline static KateDocumentConfig *global () { return s_global; }
00077 
00078     inline bool isGlobal () const { return (this == global()); }
00079 
00080   public:
00084     void readConfig (KConfig *config);
00085 
00089     void writeConfig (KConfig *config);
00090 
00091   protected:
00092     void updateConfig ();
00093 
00094   public:
00095     int tabWidth () const;
00096     void setTabWidth (int tabWidth);
00097 
00098     int indentationWidth () const;
00099     void setIndentationWidth (int indentationWidth);
00100 
00101     enum IndentationMode
00102     {
00103       imNormal = 0,
00104       imCStyle = 1,
00105       imPythonStyle = 2
00106     };
00107 
00108     uint indentationMode () const;
00109     void setIndentationMode (uint identationMode);
00110 
00111     bool wordWrap () const;
00112     void setWordWrap (bool on);
00113 
00114     unsigned int wordWrapAt () const;
00115     void setWordWrapAt (unsigned int col);
00116 
00117     uint undoSteps () const;
00118     void setUndoSteps ( uint undoSteps );
00119 
00120     bool pageUpDownMovesCursor () const;
00121     void setPageUpDownMovesCursor (bool on);
00122 
00123     enum ConfigFlags
00124     {
00125       cfAutoIndent= 0x1,
00126       cfBackspaceIndents= 0x2,
00127       cfWordWrap= 0x4,
00128       cfReplaceTabs= 0x8,
00129       cfRemoveSpaces = 0x10,
00130       cfWrapCursor= 0x20,
00131       cfAutoBrackets= 0x40,
00132       cfPersistent= 0x80,
00133       cfKeepSelection= 0x100,
00134       cfTabIndentsMode = 0x200,
00135       cfDelOnInput= 0x400,
00136       cfXorSelect= 0x800,
00137       cfOvr= 0x1000,
00138       cfMark= 0x2000,
00139       cfKeepIndentProfile= 0x8000,
00140       cfKeepExtraSpaces= 0x10000,
00141       cfTabIndents= 0x80000,
00142       cfShowTabs= 0x200000,
00143       cfSpaceIndent= 0x400000,
00144       cfSmartHome = 0x800000,
00145       cfTabInsertsTab = 0x1000000
00146     };
00147 
00148     uint configFlags () const;
00149     void setConfigFlags (KateDocumentConfig::ConfigFlags flag, bool enable);
00150     void setConfigFlags (uint fullFlags);
00151 
00152     const QString &encoding () const;
00153     QTextCodec *codec ();
00154 
00155     void setEncoding (const QString &encoding);
00156 
00157     enum Eol
00158     {
00159       eolUnix = 0,
00160       eolDos = 1,
00161       eolMac = 2
00162     };
00163 
00164     int eol () const;
00165     QString eolString ();
00166 
00167     void setEol (int mode);
00168 
00169     enum BackupFlags
00170     {
00171       LocalFiles=1,
00172       RemoteFiles=2
00173     };
00174 
00175     uint backupFlags () const;
00176     void setBackupFlags (uint flags);
00177 
00178     const QString &backupSuffix () const;
00179     void setBackupSuffix (const QString &suffix);
00180     
00181     bool plugin (uint index) const;
00182     void setPlugin (uint index, bool load);
00183 
00184   private:
00185     int m_tabWidth;
00186     int m_indentationWidth;
00187     uint m_indentationMode;
00188     bool m_wordWrap;
00189     int m_wordWrapAt;
00190     uint m_undoSteps;
00191     bool m_pageUpDownMovesCursor;
00192     uint m_configFlags;
00193     QString m_encoding;
00194     int m_eol;
00195     uint m_backupFlags;
00196     QString m_backupSuffix;
00197     QBitArray m_plugins;
00198 
00199     bool m_tabWidthSet : 1;
00200     bool m_indentationWidthSet : 1;
00201     bool m_indentationModeSet : 1;
00202     bool m_wordWrapSet : 1;
00203     bool m_wordWrapAtSet : 1;
00204     bool m_pageUpDownMovesCursorSet : 1;
00205     bool m_undoStepsSet : 1;
00206     uint m_configFlagsSet;
00207     bool m_encodingSet : 1;
00208     bool m_eolSet : 1;
00209     bool m_backupFlagsSet : 1;
00210     bool m_backupSuffixSet : 1;
00211     bool m_pluginsSet : 1;
00212     
00213   private:
00214     static KateDocumentConfig *s_global;
00215     KateDocument *m_doc;
00216 };
00217 
00218 class KateViewConfig : public KateConfig
00219 {
00220   private:
00221     friend class KateFactory;
00222 
00226     KateViewConfig ();
00227 
00228   public:
00232     KateViewConfig (KateView *view);
00233 
00237     ~KateViewConfig ();
00238 
00239     inline static KateViewConfig *global () { return s_global; }
00240 
00241     inline bool isGlobal () const { return (this == global()); }
00242 
00243   public:
00247     void readConfig (KConfig *config);
00248 
00252     void writeConfig (KConfig *config);
00253 
00254   protected:
00255     void updateConfig ();
00256 
00257   public:
00258     bool dynWordWrap () const;
00259     void setDynWordWrap (bool wrap);
00260 
00261     int dynWordWrapIndicators () const;
00262     void setDynWordWrapIndicators (int mode);
00263 
00264     int dynWordWrapAlignIndent () const;
00265     void setDynWordWrapAlignIndent (int indent);
00266 
00267     bool lineNumbers () const;
00268     void setLineNumbers (bool on);
00269 
00270     bool iconBar () const;
00271     void setIconBar (bool on);
00272 
00273     bool foldingBar () const;
00274     void setFoldingBar (bool on);
00275 
00276     int bookmarkSort () const;
00277     void setBookmarkSort (int mode);
00278 
00279     int autoCenterLines() const;
00280     void setAutoCenterLines (int lines);
00281 
00282     long searchFlags () const;
00283     void setSearchFlags (long flags);
00284 
00285     bool cmdLine () const;
00286     void setCmdLine (bool on);
00287     
00288     uint defaultMarkType () const;
00289     void setDefaultMarkType (uint type);
00290     
00291     enum TextToSearch
00292     {
00293       Nowhere = 0,
00294       SelectionOnly = 1,
00295       SelectionWord = 2,
00296       WordOnly = 3,
00297       WordSelection = 4
00298     };
00299     
00300     int textToSearchMode () const;
00301     void setTextToSearchMode (int mode);
00302 
00303   private:
00304     bool m_dynWordWrap;
00305     int m_dynWordWrapIndicators;
00306     int m_dynWordWrapAlignIndent;
00307     bool m_lineNumbers;
00308     bool m_iconBar;
00309     bool m_foldingBar;
00310     int m_bookmarkSort;
00311     int m_autoCenterLines;
00312     long m_searchFlags;
00313     bool m_cmdLine;
00314     uint m_defaultMarkType;
00315     int m_textToSearchMode;
00316 
00317     bool m_dynWordWrapSet : 1;
00318     bool m_dynWordWrapIndicatorsSet : 1;
00319     bool m_dynWordWrapAlignIndentSet : 1;
00320     bool m_lineNumbersSet : 1;
00321     bool m_iconBarSet : 1;
00322     bool m_foldingBarSet : 1;
00323     bool m_bookmarkSortSet : 1;
00324     bool m_autoCenterLinesSet : 1;
00325     bool m_searchFlagsSet : 1;
00326     bool m_cmdLineSet : 1;
00327     bool m_defaultMarkTypeSet : 1;
00328     bool m_textToSearchModeSet : 1;
00329 
00330   private:
00331     static KateViewConfig *s_global;
00332     KateView *m_view;
00333 };
00334 
00335 class KateRendererConfig : public KateConfig
00336 {
00337   private:
00338     friend class KateFactory;  
00339   
00343     KateRendererConfig ();
00344 
00345   public:
00349     KateRendererConfig (KateRenderer *renderer);
00350 
00354     ~KateRendererConfig ();
00355 
00356     inline static KateRendererConfig *global () { return s_global; }
00357 
00358     inline bool isGlobal () const { return (this == global()); }
00359 
00360   public:
00364     void readConfig (KConfig *config);
00365 
00369     void writeConfig (KConfig *config);
00370 
00371   protected:
00372     void updateConfig ();
00373 
00374   public:
00375     uint schema () const;
00376     void setSchema (uint schema);
00377 
00378     FontStruct *fontStruct ();
00379     QFont *font();
00380     KateFontMetrics *fontMetrics();
00381 
00382     void setFont(const QFont &font);
00383 
00384     bool wordWrapMarker () const;
00385     void setWordWrapMarker (bool on);
00386 
00387     const QColor *backgroundColor() const;
00388     void setBackgroundColor (const QColor &col);
00389 
00390     const QColor *selectionColor() const;
00391     void setSelectionColor (const QColor &col);
00392 
00393     const QColor *highlightedLineColor() const;
00394     void setHighlightedLineColor (const QColor &col);
00395 
00396     const QColor *highlightedBracketColor() const;
00397     void setHighlightedBracketColor (const QColor &col);
00398 
00399     const QColor *wordWrapMarkerColor() const;
00400     void setWordWrapMarkerColor (const QColor &col);
00401 
00402     const QColor *tabMarkerColor() const;
00403     void setTabMarkerColor (const QColor &col);
00404 
00405     const QColor *iconBarColor() const;
00406     void setIconBarColor (const QColor &col);
00407 
00408   private:
00409     uint m_schema;
00410     FontStruct* m_font;
00411     bool m_wordWrapMarker;
00412     QColor *m_backgroundColor;
00413     QColor *m_selectionColor;
00414     QColor *m_highlightedLineColor;
00415     QColor *m_highlightedBracketColor;
00416     QColor *m_wordWrapMarkerColor;
00417     QColor *m_tabMarkerColor;
00418     QColor *m_iconBarColor;
00419 
00420     bool m_schemaSet : 1;
00421     bool m_fontSet : 1;
00422     bool m_wordWrapMarkerSet : 1;
00423     bool m_backgroundColorSet : 1;
00424     bool m_selectionColorSet : 1;
00425     bool m_highlightedLineColorSet : 1;
00426     bool m_highlightedBracketColorSet : 1;
00427     bool m_wordWrapMarkerColorSet : 1;
00428     bool m_tabMarkerColorSet : 1;
00429     bool m_iconBarColorSet : 1;
00430 
00431   private:
00432     static KateRendererConfig *s_global;
00433     KateRenderer *m_renderer;
00434 };
00435 
00436 #endif
KDE Logo
This file is part of the documentation for kate Library Version 3.2.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Feb 4 12:37:40 2004 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2003