kateconfig.h00001
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 };
00183
00184 uint configFlags () const;
00185 void setConfigFlags (KateDocumentConfig::ConfigFlags flag, bool enable);
00186 void setConfigFlags (uint fullFlags);
00187
00188 const QString &encoding () const;
00189 QTextCodec *codec ();
00190
00191 void setEncoding (const QString &encoding);
00192
00193 bool isSetEncoding () const;
00194
00195 enum Eol
00196 {
00197 eolUnix = 0,
00198 eolDos = 1,
00199 eolMac = 2
00200 };
00201
00202 int eol () const;
00203 QString eolString ();
00204
00205 void setEol (int mode);
00206
00207 bool allowEolDetection () const;
00208 void setAllowEolDetection (bool on);
00209
00210 enum BackupFlags
00211 {
00212 LocalFiles=1,
00213 RemoteFiles=2
00214 };
00215
00216 uint backupFlags () const;
00217 void setBackupFlags (uint flags);
00218
00219 const QString &backupPrefix () const;
00220 void setBackupPrefix (const QString &prefix);
00221
00222 const QString &backupSuffix () const;
00223 void setBackupSuffix (const QString &suffix);
00224
00225 bool plugin (uint index) const;
00226 void setPlugin (uint index, bool load);
00227
00233 int searchDirConfigDepth () const;
00234
00235 void setSearchDirConfigDepth (int depth);
00236
00237 private:
00238 int m_tabWidth;
00239 int m_indentationWidth;
00240 uint m_indentationMode;
00241 bool m_wordWrap;
00242 int m_wordWrapAt;
00243 uint m_undoSteps;
00244 bool m_pageUpDownMovesCursor;
00245 uint m_configFlags;
00246 QString m_encoding;
00247 int m_eol;
00248 bool m_allowEolDetection;
00249 uint m_backupFlags;
00250 int m_searchDirConfigDepth;
00251 QString m_backupPrefix;
00252 QString m_backupSuffix;
00253 QBitArray m_plugins;
00254
00255 bool m_tabWidthSet : 1;
00256 bool m_indentationWidthSet : 1;
00257 bool m_indentationModeSet : 1;
00258 bool m_wordWrapSet : 1;
00259 bool m_wordWrapAtSet : 1;
00260 bool m_pageUpDownMovesCursorSet : 1;
00261 bool m_undoStepsSet : 1;
00262 uint m_configFlagsSet;
00263 bool m_encodingSet : 1;
00264 bool m_eolSet : 1;
00265 bool m_allowEolDetectionSet : 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 bool persistentSelection () const;
00354 void setPersistentSelection (bool on);
00355
00356 enum TextToSearch
00357 {
00358 Nowhere = 0,
00359 SelectionOnly = 1,
00360 SelectionWord = 2,
00361 WordOnly = 3,
00362 WordSelection = 4
00363 };
00364
00365 int textToSearchMode () const;
00366 void setTextToSearchMode (int mode);
00367
00368 private:
00369 bool m_dynWordWrap;
00370 int m_dynWordWrapIndicators;
00371 int m_dynWordWrapAlignIndent;
00372 bool m_lineNumbers;
00373 bool m_scrollBarMarks;
00374 bool m_iconBar;
00375 bool m_foldingBar;
00376 int m_bookmarkSort;
00377 int m_autoCenterLines;
00378 long m_searchFlags;
00379 bool m_cmdLine;
00380 uint m_defaultMarkType;
00381 bool m_persistentSelection;
00382 int m_textToSearchMode;
00383
00384 bool m_dynWordWrapSet : 1;
00385 bool m_dynWordWrapIndicatorsSet : 1;
00386 bool m_dynWordWrapAlignIndentSet : 1;
00387 bool m_lineNumbersSet : 1;
00388 bool m_scrollBarMarksSet : 1;
00389 bool m_iconBarSet : 1;
00390 bool m_foldingBarSet : 1;
00391 bool m_bookmarkSortSet : 1;
00392 bool m_autoCenterLinesSet : 1;
00393 bool m_searchFlagsSet : 1;
00394 bool m_cmdLineSet : 1;
00395 bool m_defaultMarkTypeSet : 1;
00396 bool m_persistentSelectionSet : 1;
00397 bool m_textToSearchModeSet : 1;
00398
00399 private:
00400 static KateViewConfig *s_global;
00401 KateView *m_view;
00402 };
00403
00404 class KateRendererConfig : public KateConfig
00405 {
00406 private:
00407 friend class KateFactory;
00408
00412 KateRendererConfig ();
00413
00414
00415 public:
00419 KateRendererConfig (KateRenderer *renderer);
00420
00424 ~KateRendererConfig ();
00425
00426 inline static KateRendererConfig *global () { return s_global; }
00427
00428 inline bool isGlobal () const { return (this == global()); }
00429
00430 public:
00434 void readConfig (KConfig *config);
00435
00439 void writeConfig (KConfig *config);
00440
00441 protected:
00442 void updateConfig ();
00443
00444 public:
00445 uint schema () const;
00446 void setSchema (uint schema);
00452 void reloadSchema();
00453
00454 KateFontStruct *fontStruct ();
00455 QFont *font();
00456 KateFontMetrics *fontMetrics();
00457
00458 void setFont(const QFont &font);
00459
00460 bool wordWrapMarker () const;
00461 void setWordWrapMarker (bool on);
00462
00463 const QColor& backgroundColor() const;
00464 void setBackgroundColor (const QColor &col);
00465
00466 const QColor& selectionColor() const;
00467 void setSelectionColor (const QColor &col);
00468
00469 const QColor& highlightedLineColor() const;
00470 void setHighlightedLineColor (const QColor &col);
00471
00472 const QColor& lineMarkerColor(KTextEditor::MarkInterface::MarkTypes type = KTextEditor::MarkInterface::markType01) const;
00473 void setLineMarkerColor (const QColor &col, KTextEditor::MarkInterface::MarkTypes type = KTextEditor::MarkInterface::markType01);
00474
00475 const QColor& highlightedBracketColor() const;
00476 void setHighlightedBracketColor (const QColor &col);
00477
00478 const QColor& wordWrapMarkerColor() const;
00479 void setWordWrapMarkerColor (const QColor &col);
00480
00481 const QColor& tabMarkerColor() const;
00482 void setTabMarkerColor (const QColor &col);
00483
00484 const QColor& iconBarColor() const;
00485 void setIconBarColor (const QColor &col);
00486
00487
00488
00489 const QColor& lineNumberColor() const;
00490 void setLineNumberColor (const QColor &col);
00491
00492 bool showIndentationLines () const;
00493 void setShowIndentationLines (bool on);
00494
00495 private:
00499 void setSchemaInternal(int schema);
00500
00501 uint m_schema;
00502 KateFontStruct *m_font;
00503 bool m_wordWrapMarker;
00504 bool m_showIndentationLines;
00505 QColor m_backgroundColor;
00506 QColor m_selectionColor;
00507 QColor m_highlightedLineColor;
00508 QColor m_highlightedBracketColor;
00509 QColor m_wordWrapMarkerColor;
00510 QColor m_tabMarkerColor;
00511 QColor m_iconBarColor;
00512 QColor m_lineNumberColor;
00513 QValueVector<QColor> m_lineMarkerColor;
00514
00515 bool m_schemaSet : 1;
00516 bool m_fontSet : 1;
00517 bool m_wordWrapMarkerSet : 1;
00518 bool m_showIndentationLinesSet : 1;
00519 bool m_backgroundColorSet : 1;
00520 bool m_selectionColorSet : 1;
00521 bool m_highlightedLineColorSet : 1;
00522 bool m_highlightedBracketColorSet : 1;
00523 bool m_wordWrapMarkerColorSet : 1;
00524 bool m_tabMarkerColorSet : 1;
00525 bool m_iconBarColorSet : 1;
00526 bool m_lineNumberColorSet : 1;
00527 QBitArray m_lineMarkerColorSet;
00528
00529 private:
00530 static KateRendererConfig *s_global;
00531 KateRenderer *m_renderer;
00532 };
00533
00534 #endif
00535
00536
|