Kate
kateconfig.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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 imScriptIndent = 7
00145 };
00146
00147 uint indentationMode () const;
00148 void setIndentationMode (uint identationMode);
00149
00150 bool wordWrap () const;
00151 void setWordWrap (bool on);
00152
00153 unsigned int wordWrapAt () const;
00154 void setWordWrapAt (unsigned int col);
00155
00156 uint undoSteps () const;
00157 void setUndoSteps ( uint undoSteps );
00158
00159 bool pageUpDownMovesCursor () const;
00160 void setPageUpDownMovesCursor (bool on);
00161
00162 enum ConfigFlags
00163 {
00164 cfBackspaceIndents= 0x2,
00165 cfWordWrap= 0x4,
00166 cfRemoveSpaces = 0x10,
00167 cfWrapCursor= 0x20,
00168 cfAutoBrackets= 0x40,
00169 cfTabIndentsMode = 0x200,
00170 cfOvr= 0x1000,
00171 cfKeepIndentProfile= 0x8000,
00172 cfKeepExtraSpaces= 0x10000,
00173 cfTabIndents= 0x80000,
00174 cfShowTabs= 0x200000,
00175 cfSpaceIndent= 0x400000,
00176 cfSmartHome = 0x800000,
00177 cfTabInsertsTab = 0x1000000,
00178 cfReplaceTabsDyn= 0x2000000,
00179 cfRemoveTrailingDyn=0x4000000,
00180 cfDoxygenAutoTyping=0x8000000 ,
00181 cfMixedIndent = 0x10000000,
00182 cfIndentPastedText = 0x20000000
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 bool isSetEncoding () const;
00195
00196 enum Eol
00197 {
00198 eolUnix = 0,
00199 eolDos = 1,
00200 eolMac = 2
00201 };
00202
00203 int eol () const;
00204 QString eolString ();
00205
00206 void setEol (int mode);
00207
00208 bool allowEolDetection () const;
00209 void setAllowEolDetection (bool on);
00210
00211 enum BackupFlags
00212 {
00213 LocalFiles=1,
00214 RemoteFiles=2
00215 };
00216
00217 uint backupFlags () const;
00218 void setBackupFlags (uint flags);
00219
00220 const QString &backupPrefix () const;
00221 void setBackupPrefix (const QString &prefix);
00222
00223 const QString &backupSuffix () const;
00224 void setBackupSuffix (const QString &suffix);
00225
00226 bool plugin (uint index) const;
00227 void setPlugin (uint index, bool load);
00228
00234 int searchDirConfigDepth () const;
00235
00236 void setSearchDirConfigDepth (int depth);
00237
00238 private:
00239 int m_tabWidth;
00240 int m_indentationWidth;
00241 uint m_indentationMode;
00242 bool m_wordWrap;
00243 int m_wordWrapAt;
00244 uint m_undoSteps;
00245 bool m_pageUpDownMovesCursor;
00246 uint m_configFlags;
00247 QString m_encoding;
00248 int m_eol;
00249 bool m_allowEolDetection;
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_allowEolDetectionSet : 1;
00267 bool m_backupFlagsSet : 1;
00268 bool m_searchDirConfigDepthSet : 1;
00269 bool m_backupPrefixSet : 1;
00270 bool m_backupSuffixSet : 1;
00271 QBitArray m_pluginsSet;
00272
00273 private:
00274 static KateDocumentConfig *s_global;
00275 KateDocument *m_doc;
00276 };
00277
00278 class KateViewConfig : public KateConfig
00279 {
00280 private:
00281 friend class KateFactory;
00282
00286 KateViewConfig ();
00287
00288 public:
00292 KateViewConfig (KateView *view);
00293
00297 ~KateViewConfig ();
00298
00299 inline static KateViewConfig *global () { return s_global; }
00300
00301 inline bool isGlobal () const { return (this == global()); }
00302
00303 public:
00307 void readConfig (KConfig *config);
00308
00312 void writeConfig (KConfig *config);
00313
00314 protected:
00315 void updateConfig ();
00316
00317 public:
00318 bool dynWordWrap () const;
00319 void setDynWordWrap (bool wrap);
00320
00321 int dynWordWrapIndicators () const;
00322 void setDynWordWrapIndicators (int mode);
00323
00324 int dynWordWrapAlignIndent () const;
00325 void setDynWordWrapAlignIndent (int indent);
00326
00327 bool lineNumbers () const;
00328 void setLineNumbers (bool on);
00329
00330 bool scrollBarMarks () const;
00331 void setScrollBarMarks (bool on);
00332
00333 bool iconBar () const;
00334 void setIconBar (bool on);
00335
00336 bool foldingBar () const;
00337 void setFoldingBar (bool on);
00338
00339 int bookmarkSort () const;
00340 void setBookmarkSort (int mode);
00341
00342 int autoCenterLines() const;
00343 void setAutoCenterLines (int lines);
00344
00345 long searchFlags () const;
00346 void setSearchFlags (long flags);
00347
00348 bool cmdLine () const;
00349 void setCmdLine (bool on);
00350
00351 uint defaultMarkType () const;
00352 void setDefaultMarkType (uint type);
00353
00354 bool persistentSelection () const;
00355 void setPersistentSelection (bool on);
00356
00357 enum TextToSearch
00358 {
00359 Nowhere = 0,
00360 SelectionOnly = 1,
00361 SelectionWord = 2,
00362 WordOnly = 3,
00363 WordSelection = 4
00364 };
00365
00366 int textToSearchMode () const;
00367 void setTextToSearchMode (int mode);
00368
00369 private:
00370 bool m_dynWordWrap;
00371 int m_dynWordWrapIndicators;
00372 int m_dynWordWrapAlignIndent;
00373 bool m_lineNumbers;
00374 bool m_scrollBarMarks;
00375 bool m_iconBar;
00376 bool m_foldingBar;
00377 int m_bookmarkSort;
00378 int m_autoCenterLines;
00379 long m_searchFlags;
00380 bool m_cmdLine;
00381 uint m_defaultMarkType;
00382 bool m_persistentSelection;
00383 int m_textToSearchMode;
00384
00385 bool m_dynWordWrapSet : 1;
00386 bool m_dynWordWrapIndicatorsSet : 1;
00387 bool m_dynWordWrapAlignIndentSet : 1;
00388 bool m_lineNumbersSet : 1;
00389 bool m_scrollBarMarksSet : 1;
00390 bool m_iconBarSet : 1;
00391 bool m_foldingBarSet : 1;
00392 bool m_bookmarkSortSet : 1;
00393 bool m_autoCenterLinesSet : 1;
00394 bool m_searchFlagsSet : 1;
00395 bool m_cmdLineSet : 1;
00396 bool m_defaultMarkTypeSet : 1;
00397 bool m_persistentSelectionSet : 1;
00398 bool m_textToSearchModeSet : 1;
00399
00400 private:
00401 static KateViewConfig *s_global;
00402 KateView *m_view;
00403 };
00404
00405 class KateRendererConfig : public KateConfig
00406 {
00407 private:
00408 friend class KateFactory;
00409
00413 KateRendererConfig ();
00414
00415
00416 public:
00420 KateRendererConfig (KateRenderer *renderer);
00421
00425 ~KateRendererConfig ();
00426
00427 inline static KateRendererConfig *global () { return s_global; }
00428
00429 inline bool isGlobal () const { return (this == global()); }
00430
00431 public:
00435 void readConfig (KConfig *config);
00436
00440 void writeConfig (KConfig *config);
00441
00442 protected:
00443 void updateConfig ();
00444
00445 public:
00446 uint schema () const;
00447 void setSchema (uint schema);
00453 void reloadSchema();
00454
00455 KateFontStruct *fontStruct ();
00456 QFont *font();
00457 KateFontMetrics *fontMetrics();
00458
00459 void setFont(const QFont &font);
00460
00461 bool wordWrapMarker () const;
00462 void setWordWrapMarker (bool on);
00463
00464 const QColor& backgroundColor() const;
00465 void setBackgroundColor (const QColor &col);
00466
00467 const QColor& selectionColor() const;
00468 void setSelectionColor (const QColor &col);
00469
00470 const QColor& highlightedLineColor() const;
00471 void setHighlightedLineColor (const QColor &col);
00472
00473 const QColor& lineMarkerColor(KTextEditor::MarkInterface::MarkTypes type = KTextEditor::MarkInterface::markType01) const;
00474 void setLineMarkerColor (const QColor &col, KTextEditor::MarkInterface::MarkTypes type = KTextEditor::MarkInterface::markType01);
00475
00476 const QColor& highlightedBracketColor() const;
00477 void setHighlightedBracketColor (const QColor &col);
00478
00479 const QColor& wordWrapMarkerColor() const;
00480 void setWordWrapMarkerColor (const QColor &col);
00481
00482 const QColor& tabMarkerColor() const;
00483 void setTabMarkerColor (const QColor &col);
00484
00485 const QColor& iconBarColor() const;
00486 void setIconBarColor (const QColor &col);
00487
00488
00489
00490 const QColor& lineNumberColor() const;
00491 void setLineNumberColor (const QColor &col);
00492
00493 bool showIndentationLines () const;
00494 void setShowIndentationLines (bool on);
00495
00496 private:
00500 void setSchemaInternal(int schema);
00501
00502 uint m_schema;
00503 KateFontStruct *m_font;
00504 bool m_wordWrapMarker;
00505 bool m_showIndentationLines;
00506 QColor m_backgroundColor;
00507 QColor m_selectionColor;
00508 QColor m_highlightedLineColor;
00509 QColor m_highlightedBracketColor;
00510 QColor m_wordWrapMarkerColor;
00511 QColor m_tabMarkerColor;
00512 QColor m_iconBarColor;
00513 QColor m_lineNumberColor;
00514 QValueVector<QColor> m_lineMarkerColor;
00515
00516 bool m_schemaSet : 1;
00517 bool m_fontSet : 1;
00518 bool m_wordWrapMarkerSet : 1;
00519 bool m_showIndentationLinesSet : 1;
00520 bool m_backgroundColorSet : 1;
00521 bool m_selectionColorSet : 1;
00522 bool m_highlightedLineColorSet : 1;
00523 bool m_highlightedBracketColorSet : 1;
00524 bool m_wordWrapMarkerColorSet : 1;
00525 bool m_tabMarkerColorSet : 1;
00526 bool m_iconBarColorSet : 1;
00527 bool m_lineNumberColorSet : 1;
00528 QBitArray m_lineMarkerColorSet;
00529
00530 private:
00531 static KateRendererConfig *s_global;
00532 KateRenderer *m_renderer;
00533 };
00534
00535 #endif
00536
00537