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 <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 imNormal = 0, 00138 imCStyle = 1, 00139 imPythonStyle = 2 00140 }; 00141 00142 uint indentationMode () const; 00143 void setIndentationMode (uint identationMode); 00144 00145 bool wordWrap () const; 00146 void setWordWrap (bool on); 00147 00148 unsigned int wordWrapAt () const; 00149 void setWordWrapAt (unsigned int col); 00150 00151 uint undoSteps () const; 00152 void setUndoSteps ( uint undoSteps ); 00153 00154 bool pageUpDownMovesCursor () const; 00155 void setPageUpDownMovesCursor (bool on); 00156 00157 enum ConfigFlags 00158 { 00159 cfAutoIndent= 0x1, 00160 cfBackspaceIndents= 0x2, 00161 cfWordWrap= 0x4, 00162 cfReplaceTabs= 0x8, 00163 cfRemoveSpaces = 0x10, 00164 cfWrapCursor= 0x20, 00165 cfAutoBrackets= 0x40, 00166 cfPersistent= 0x80, 00167 cfKeepSelection= 0x100, 00168 cfTabIndentsMode = 0x200, 00169 cfDelOnInput= 0x400, 00170 cfXorSelect= 0x800, 00171 cfOvr= 0x1000, 00172 cfMark= 0x2000, 00173 cfKeepIndentProfile= 0x8000, 00174 cfKeepExtraSpaces= 0x10000, 00175 cfTabIndents= 0x80000, 00176 cfShowTabs= 0x200000, 00177 cfSpaceIndent= 0x400000, 00178 cfSmartHome = 0x800000, 00179 cfTabInsertsTab = 0x1000000, 00180 cfReplaceTabsDyn= 0x2000000, 00181 cfRemoveTrailingDyn=0x4000000, 00182 cfDoxygenAutoTyping=0x8000000 // Remove for KDE 4.0 (put in indenters) 00183 }; 00184 00185 uint configFlags () const; 00186 void setConfigFlags (KateDocumentConfig::ConfigFlags flag, bool enable); 00187 void setConfigFlags (uint fullFlags); 00188 00189 const QString &encoding () const; 00190 QTextCodec *codec (); 00191 00192 void setEncoding (const QString &encoding); 00193 00194 enum Eol 00195 { 00196 eolUnix = 0, 00197 eolDos = 1, 00198 eolMac = 2 00199 }; 00200 00201 int eol () const; 00202 QString eolString (); 00203 00204 void setEol (int mode); 00205 00206 enum BackupFlags 00207 { 00208 LocalFiles=1, 00209 RemoteFiles=2 00210 }; 00211 00212 uint backupFlags () const; 00213 void setBackupFlags (uint flags); 00214 00215 const QString &backupPrefix () const; 00216 void setBackupPrefix (const QString &prefix); 00217 00218 const QString &backupSuffix () const; 00219 void setBackupSuffix (const QString &suffix); 00220 00221 bool plugin (uint index) const; 00222 void setPlugin (uint index, bool load); 00223 00224 private: 00225 int m_tabWidth; 00226 int m_indentationWidth; 00227 uint m_indentationMode; 00228 bool m_wordWrap; 00229 int m_wordWrapAt; 00230 uint m_undoSteps; 00231 bool m_pageUpDownMovesCursor; 00232 uint m_configFlags; 00233 QString m_encoding; 00234 int m_eol; 00235 uint m_backupFlags; 00236 QString m_backupPrefix; 00237 QString m_backupSuffix; 00238 QBitArray m_plugins; 00239 00240 bool m_tabWidthSet : 1; 00241 bool m_indentationWidthSet : 1; 00242 bool m_indentationModeSet : 1; 00243 bool m_wordWrapSet : 1; 00244 bool m_wordWrapAtSet : 1; 00245 bool m_pageUpDownMovesCursorSet : 1; 00246 bool m_undoStepsSet : 1; 00247 uint m_configFlagsSet; 00248 bool m_encodingSet : 1; 00249 bool m_eolSet : 1; 00250 bool m_backupFlagsSet : 1; 00251 bool m_backupPrefixSet : 1; 00252 bool m_backupSuffixSet : 1; 00253 QBitArray m_pluginsSet; 00254 00255 private: 00256 static KateDocumentConfig *s_global; 00257 KateDocument *m_doc; 00258 }; 00259 00260 class KateViewConfig : public KateConfig 00261 { 00262 private: 00263 friend class KateFactory; 00264 00268 KateViewConfig (); 00269 00270 public: 00274 KateViewConfig (KateView *view); 00275 00279 ~KateViewConfig (); 00280 00281 inline static KateViewConfig *global () { return s_global; } 00282 00283 inline bool isGlobal () const { return (this == global()); } 00284 00285 public: 00289 void readConfig (KConfig *config); 00290 00294 void writeConfig (KConfig *config); 00295 00296 protected: 00297 void updateConfig (); 00298 00299 public: 00300 bool dynWordWrap () const; 00301 void setDynWordWrap (bool wrap); 00302 00303 int dynWordWrapIndicators () const; 00304 void setDynWordWrapIndicators (int mode); 00305 00306 int dynWordWrapAlignIndent () const; 00307 void setDynWordWrapAlignIndent (int indent); 00308 00309 bool lineNumbers () const; 00310 void setLineNumbers (bool on); 00311 00312 bool scrollBarMarks () const; 00313 void setScrollBarMarks (bool on); 00314 00315 bool iconBar () const; 00316 void setIconBar (bool on); 00317 00318 bool foldingBar () const; 00319 void setFoldingBar (bool on); 00320 00321 int bookmarkSort () const; 00322 void setBookmarkSort (int mode); 00323 00324 int autoCenterLines() const; 00325 void setAutoCenterLines (int lines); 00326 00327 long searchFlags () const; 00328 void setSearchFlags (long flags); 00329 00330 bool cmdLine () const; 00331 void setCmdLine (bool on); 00332 00333 uint defaultMarkType () const; 00334 void setDefaultMarkType (uint type); 00335 00336 enum TextToSearch 00337 { 00338 Nowhere = 0, 00339 SelectionOnly = 1, 00340 SelectionWord = 2, 00341 WordOnly = 3, 00342 WordSelection = 4 00343 }; 00344 00345 int textToSearchMode () const; 00346 void setTextToSearchMode (int mode); 00347 00348 private: 00349 bool m_dynWordWrap; 00350 int m_dynWordWrapIndicators; 00351 int m_dynWordWrapAlignIndent; 00352 bool m_lineNumbers; 00353 bool m_scrollBarMarks; 00354 bool m_iconBar; 00355 bool m_foldingBar; 00356 int m_bookmarkSort; 00357 int m_autoCenterLines; 00358 long m_searchFlags; 00359 bool m_cmdLine; 00360 uint m_defaultMarkType; 00361 int m_textToSearchMode; 00362 00363 bool m_dynWordWrapSet : 1; 00364 bool m_dynWordWrapIndicatorsSet : 1; 00365 bool m_dynWordWrapAlignIndentSet : 1; 00366 bool m_lineNumbersSet : 1; 00367 bool m_scrollBarMarksSet : 1; 00368 bool m_iconBarSet : 1; 00369 bool m_foldingBarSet : 1; 00370 bool m_bookmarkSortSet : 1; 00371 bool m_autoCenterLinesSet : 1; 00372 bool m_searchFlagsSet : 1; 00373 bool m_cmdLineSet : 1; 00374 bool m_defaultMarkTypeSet : 1; 00375 bool m_textToSearchModeSet : 1; 00376 00377 private: 00378 static KateViewConfig *s_global; 00379 KateView *m_view; 00380 }; 00381 00382 class KateRendererConfig : public KateConfig 00383 { 00384 private: 00385 friend class KateFactory; 00386 00390 KateRendererConfig (); 00391 00392 public: 00396 KateRendererConfig (KateRenderer *renderer); 00397 00401 ~KateRendererConfig (); 00402 00403 inline static KateRendererConfig *global () { return s_global; } 00404 00405 inline bool isGlobal () const { return (this == global()); } 00406 00407 public: 00411 void readConfig (KConfig *config); 00412 00416 void writeConfig (KConfig *config); 00417 00418 protected: 00419 void updateConfig (); 00420 00421 public: 00422 uint schema () const; 00423 void setSchema (uint schema); 00424 00425 KateFontStruct *fontStruct (); 00426 QFont *font(); 00427 KateFontMetrics *fontMetrics(); 00428 00429 void setFont(const QFont &font); 00430 00431 bool wordWrapMarker () const; 00432 void setWordWrapMarker (bool on); 00433 00434 const QColor& backgroundColor() const; 00435 void setBackgroundColor (const QColor &col); 00436 00437 const QColor& selectionColor() const; 00438 void setSelectionColor (const QColor &col); 00439 00440 const QColor& highlightedLineColor() const; 00441 void setHighlightedLineColor (const QColor &col); 00442 00443 const QColor& lineMarkerColor(KTextEditor::MarkInterface::MarkTypes type = KTextEditor::MarkInterface::markType01) const; // markType01 == Bookmark 00444 void setLineMarkerColor (const QColor &col, KTextEditor::MarkInterface::MarkTypes type = KTextEditor::MarkInterface::markType01); 00445 00446 const QColor& highlightedBracketColor() const; 00447 void setHighlightedBracketColor (const QColor &col); 00448 00449 const QColor& wordWrapMarkerColor() const; 00450 void setWordWrapMarkerColor (const QColor &col); 00451 00452 const QColor& tabMarkerColor() const; 00453 void setTabMarkerColor (const QColor &col); 00454 00455 const QColor& iconBarColor() const; 00456 void setIconBarColor (const QColor &col); 00457 00458 // the line number color is used for the line numbers on the left bar and 00459 // for vertical separator lines and for code folding lines. 00460 const QColor& lineNumberColor() const; 00461 void setLineNumberColor (const QColor &col); 00462 00463 private: 00464 uint m_schema; 00465 KateFontStruct *m_font; 00466 bool m_wordWrapMarker; 00467 QColor m_backgroundColor; 00468 QColor m_selectionColor; 00469 QColor m_highlightedLineColor; 00470 QColor m_highlightedBracketColor; 00471 QColor m_wordWrapMarkerColor; 00472 QColor m_tabMarkerColor; 00473 QColor m_iconBarColor; 00474 QColor m_lineNumberColor; 00475 QValueVector<QColor> m_lineMarkerColor; 00476 00477 bool m_schemaSet : 1; 00478 bool m_fontSet : 1; 00479 bool m_wordWrapMarkerSet : 1; 00480 bool m_backgroundColorSet : 1; 00481 bool m_selectionColorSet : 1; 00482 bool m_highlightedLineColorSet : 1; 00483 bool m_highlightedBracketColorSet : 1; 00484 bool m_wordWrapMarkerColorSet : 1; 00485 bool m_tabMarkerColorSet : 1; 00486 bool m_iconBarColorSet : 1; 00487 bool m_lineNumberColorSet : 1; 00488 QBitArray m_lineMarkerColorSet; 00489 00490 private: 00491 static KateRendererConfig *s_global; 00492 KateRenderer *m_renderer; 00493 }; 00494 00495 #endif 00496 00497 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE Logo
This file is part of the documentation for kate Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:45:07 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003