• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kate
 

kate

  • kate
  • part
kateconfig.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 2003 Christoph Cullmann <cullmann@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 
19 #ifndef __KATE_CONFIG_H__
20 #define __KATE_CONFIG_H__
21 
22 #include <tdetexteditor/markinterface.h>
23 
24 #include <tqbitarray.h>
25 #include <tqcolor.h>
26 #include <tqobject.h>
27 #include <tqvaluevector.h>
28 
29 class KateView;
30 class KateDocument;
31 class KateRenderer;
32 class KateFontStruct;
33 class KateFontMetrics;
34 
35 class TDEConfig;
36 
37 class TQFont;
38 class TQTextCodec;
39 
43 class KateConfig
44 {
45  public:
49  KateConfig ();
50 
54  virtual ~KateConfig ();
55 
56  public:
63  void configStart ();
64 
69  void configEnd ();
70 
71  protected:
75  virtual void updateConfig () = 0;
76 
77  private:
81  uint configSessionNumber;
82 
86  bool configIsRunning;
87 };
88 
89 class KateDocumentConfig : public KateConfig
90 {
91  private:
92  friend class KateFactory;
93 
97  KateDocumentConfig ();
98 
99  public:
103  KateDocumentConfig (KateDocument *doc);
104 
108  ~KateDocumentConfig ();
109 
110  inline static KateDocumentConfig *global () { return s_global; }
111 
112  inline bool isGlobal () const { return (this == global()); }
113 
114  public:
118  void readConfig (TDEConfig *config);
119 
123  void writeConfig (TDEConfig *config);
124 
125  protected:
126  void updateConfig ();
127 
128  public:
129  int tabWidth () const;
130  void setTabWidth (int tabWidth);
131 
132  int indentationWidth () const;
133  void setIndentationWidth (int indentationWidth);
134 
135  enum IndentationMode
136  {
137  imNone = 0,
138  imNormal = 1,
139  imCStyle = 2,
140  imPythonStyle = 3,
141  imXmlStyle = 4,
142  imCSAndS = 5,
143  imVarIndent = 6,
144  imScriptIndent = 7
145  };
146 
147  uint indentationMode () const;
148  void setIndentationMode (uint identationMode);
149 
150  bool wordWrap () const;
151  void setWordWrap (bool on);
152 
153  unsigned int wordWrapAt () const;
154  void setWordWrapAt (unsigned int col);
155 
156  uint undoSteps () const;
157  void setUndoSteps ( uint undoSteps );
158 
159  bool pageUpDownMovesCursor () const;
160  void setPageUpDownMovesCursor (bool on);
161 
162  enum ConfigFlags
163  {
164  cfBackspaceIndents= 0x2,
165  cfWordWrap= 0x4,
166  cfRemoveSpaces = 0x10,
167  cfWrapCursor= 0x20,
168  cfAutoBrackets= 0x40,
169  cfTabIndentsMode = 0x200,
170  cfOvr= 0x1000,
171  cfKeepIndentProfile= 0x8000,
172  cfKeepExtraSpaces= 0x10000,
173  cfTabIndents= 0x80000,
174  cfShowTabs= 0x200000,
175  cfSpaceIndent= 0x400000,
176  cfSmartHome = 0x800000,
177  cfTabInsertsTab = 0x1000000,
178  cfReplaceTabsDyn= 0x2000000,
179  cfRemoveTrailingDyn=0x4000000,
180  cfDoxygenAutoTyping=0x8000000 , // Remove for KDE 4.0 (put in indenters)
181  cfMixedIndent = 0x10000000,
182  cfIndentPastedText = 0x20000000
183  };
184 
185  uint configFlags () const;
186  void setConfigFlags (KateDocumentConfig::ConfigFlags flag, bool enable);
187  void setConfigFlags (uint fullFlags);
188 
189  const TQString &encoding () const;
190  TQTextCodec *codec ();
191 
192  void setEncoding (const TQString &encoding);
193 
194  bool isSetEncoding () const;
195 
196  enum Eol
197  {
198  eolUnix = 0,
199  eolDos = 1,
200  eolMac = 2
201  };
202 
203  int eol () const;
204  TQString eolString ();
205 
206  void setEol (int mode);
207 
208  bool allowEolDetection () const;
209  void setAllowEolDetection (bool on);
210 
211  enum BackupFlags
212  {
213  LocalFiles=1,
214  RemoteFiles=2
215  };
216 
217  uint backupFlags () const;
218  void setBackupFlags (uint flags);
219 
220  const TQString &backupPrefix () const;
221  void setBackupPrefix (const TQString &prefix);
222 
223  const TQString &backupSuffix () const;
224  void setBackupSuffix (const TQString &suffix);
225 
226  bool plugin (uint index) const;
227  void setPlugin (uint index, bool load);
228 
234  int searchDirConfigDepth () const;
235 
236  void setSearchDirConfigDepth (int depth);
237 
238  private:
239  int m_tabWidth;
240  int m_indentationWidth;
241  uint m_indentationMode;
242  bool m_wordWrap;
243  int m_wordWrapAt;
244  uint m_undoSteps;
245  bool m_pageUpDownMovesCursor;
246  uint m_configFlags;
247  TQString m_encoding;
248  int m_eol;
249  bool m_allowEolDetection;
250  uint m_backupFlags;
251  int m_searchDirConfigDepth;
252  TQString m_backupPrefix;
253  TQString m_backupSuffix;
254  TQBitArray m_plugins;
255 
256  bool m_tabWidthSet : 1;
257  bool m_indentationWidthSet : 1;
258  bool m_indentationModeSet : 1;
259  bool m_wordWrapSet : 1;
260  bool m_wordWrapAtSet : 1;
261  bool m_pageUpDownMovesCursorSet : 1;
262  bool m_undoStepsSet : 1;
263  uint m_configFlagsSet;
264  bool m_encodingSet : 1;
265  bool m_eolSet : 1;
266  bool m_allowEolDetectionSet : 1;
267  bool m_backupFlagsSet : 1;
268  bool m_searchDirConfigDepthSet : 1;
269  bool m_backupPrefixSet : 1;
270  bool m_backupSuffixSet : 1;
271  TQBitArray m_pluginsSet;
272 
273  private:
274  static KateDocumentConfig *s_global;
275  KateDocument *m_doc;
276 };
277 
278 class KateViewConfig : public KateConfig
279 {
280  private:
281  friend class KateFactory;
282 
286  KateViewConfig ();
287 
288  public:
292  KateViewConfig (KateView *view);
293 
297  ~KateViewConfig ();
298 
299  inline static KateViewConfig *global () { return s_global; }
300 
301  inline bool isGlobal () const { return (this == global()); }
302 
303  public:
307  void readConfig (TDEConfig *config);
308 
312  void writeConfig (TDEConfig *config);
313 
314  protected:
315  void updateConfig ();
316 
317  public:
318  bool dynWordWrap () const;
319  void setDynWordWrap (bool wrap);
320 
321  int dynWordWrapIndicators () const;
322  void setDynWordWrapIndicators (int mode);
323 
324  int dynWordWrapAlignIndent () const;
325  void setDynWordWrapAlignIndent (int indent);
326 
327  bool lineNumbers () const;
328  void setLineNumbers (bool on);
329 
330  bool scrollBarMarks () const;
331  void setScrollBarMarks (bool on);
332 
333  bool iconBar () const;
334  void setIconBar (bool on);
335 
336  bool foldingBar () const;
337  void setFoldingBar (bool on);
338 
339  int bookmarkSort () const;
340  void setBookmarkSort (int mode);
341 
342  int autoCenterLines() const;
343  void setAutoCenterLines (int lines);
344 
345  long searchFlags () const;
346  void setSearchFlags (long flags);
347 
348  bool cmdLine () const;
349  void setCmdLine (bool on);
350 
351  uint defaultMarkType () const;
352  void setDefaultMarkType (uint type);
353 
354  bool persistentSelection () const;
355  void setPersistentSelection (bool on);
356 
357  enum TextToSearch
358  {
359  Nowhere = 0,
360  SelectionOnly = 1,
361  SelectionWord = 2,
362  WordOnly = 3,
363  WordSelection = 4
364  };
365 
366  int textToSearchMode () const;
367  void setTextToSearchMode (int mode);
368 
369  private:
370  bool m_dynWordWrap;
371  int m_dynWordWrapIndicators;
372  int m_dynWordWrapAlignIndent;
373  bool m_lineNumbers;
374  bool m_scrollBarMarks;
375  bool m_iconBar;
376  bool m_foldingBar;
377  int m_bookmarkSort;
378  int m_autoCenterLines;
379  long m_searchFlags;
380  bool m_cmdLine;
381  uint m_defaultMarkType;
382  bool m_persistentSelection;
383  int m_textToSearchMode;
384 
385  bool m_dynWordWrapSet : 1;
386  bool m_dynWordWrapIndicatorsSet : 1;
387  bool m_dynWordWrapAlignIndentSet : 1;
388  bool m_lineNumbersSet : 1;
389  bool m_scrollBarMarksSet : 1;
390  bool m_iconBarSet : 1;
391  bool m_foldingBarSet : 1;
392  bool m_bookmarkSortSet : 1;
393  bool m_autoCenterLinesSet : 1;
394  bool m_searchFlagsSet : 1;
395  bool m_cmdLineSet : 1;
396  bool m_defaultMarkTypeSet : 1;
397  bool m_persistentSelectionSet : 1;
398  bool m_textToSearchModeSet : 1;
399 
400  private:
401  static KateViewConfig *s_global;
402  KateView *m_view;
403 };
404 
405 class KateRendererConfig : public KateConfig
406 {
407  private:
408  friend class KateFactory;
409 
413  KateRendererConfig ();
414 
415 
416  public:
420  KateRendererConfig (KateRenderer *renderer);
421 
425  ~KateRendererConfig ();
426 
427  inline static KateRendererConfig *global () { return s_global; }
428 
429  inline bool isGlobal () const { return (this == global()); }
430 
431  public:
435  void readConfig (TDEConfig *config);
436 
440  void writeConfig (TDEConfig *config);
441 
442  protected:
443  void updateConfig ();
444 
445  public:
446  uint schema () const;
447  void setSchema (uint schema);
453  void reloadSchema();
454 
455  KateFontStruct *fontStruct ();
456  TQFont *font();
457  KateFontMetrics *fontMetrics();
458 
459  void setFont(const TQFont &font);
460 
461  bool wordWrapMarker () const;
462  void setWordWrapMarker (bool on);
463 
464  const TQColor& backgroundColor() const;
465  void setBackgroundColor (const TQColor &col);
466 
467  const TQColor& selectionColor() const;
468  void setSelectionColor (const TQColor &col);
469 
470  const TQColor& highlightedLineColor() const;
471  void setHighlightedLineColor (const TQColor &col);
472 
473  const TQColor& lineMarkerColor(KTextEditor::MarkInterface::MarkTypes type = KTextEditor::MarkInterface::markType01) const; // markType01 == Bookmark
474  void setLineMarkerColor (const TQColor &col, KTextEditor::MarkInterface::MarkTypes type = KTextEditor::MarkInterface::markType01);
475 
476  const TQColor& highlightedBracketColor() const;
477  void setHighlightedBracketColor (const TQColor &col);
478 
479  const TQColor& wordWrapMarkerColor() const;
480  void setWordWrapMarkerColor (const TQColor &col);
481 
482  const TQColor& tabMarkerColor() const;
483  void setTabMarkerColor (const TQColor &col);
484 
485  const TQColor& iconBarColor() const;
486  void setIconBarColor (const TQColor &col);
487 
488  // the line number color is used for the line numbers on the left bar and
489  // for vertical separator lines and for code folding lines.
490  const TQColor& lineNumberColor() const;
491  void setLineNumberColor (const TQColor &col);
492 
493  bool showIndentationLines () const;
494  void setShowIndentationLines (bool on);
495 
496  private:
500  void setSchemaInternal(int schema);
501 
502  uint m_schema;
503  KateFontStruct *m_font;
504  bool m_wordWrapMarker;
505  bool m_showIndentationLines;
506  TQColor m_backgroundColor;
507  TQColor m_selectionColor;
508  TQColor m_highlightedLineColor;
509  TQColor m_highlightedBracketColor;
510  TQColor m_wordWrapMarkerColor;
511  TQColor m_tabMarkerColor;
512  TQColor m_iconBarColor;
513  TQColor m_lineNumberColor;
514  TQValueVector<TQColor> m_lineMarkerColor;
515 
516  bool m_schemaSet : 1;
517  bool m_fontSet : 1;
518  bool m_wordWrapMarkerSet : 1;
519  bool m_showIndentationLinesSet : 1;
520  bool m_backgroundColorSet : 1;
521  bool m_selectionColorSet : 1;
522  bool m_highlightedLineColorSet : 1;
523  bool m_highlightedBracketColorSet : 1;
524  bool m_wordWrapMarkerColorSet : 1;
525  bool m_tabMarkerColorSet : 1;
526  bool m_iconBarColorSet : 1;
527  bool m_lineNumberColorSet : 1;
528  TQBitArray m_lineMarkerColorSet;
529 
530  private:
531  static KateRendererConfig *s_global;
532  KateRenderer *m_renderer;
533 };
534 
535 #endif
TDEConfig
KateConfig
Base Class for the Kate Config Classes.
Definition: kateconfig.h:43
KateConfig::updateConfig
virtual void updateConfig()=0
do the real update
KateConfig::configEnd
void configEnd()
end a config change transaction, update the concerned documents/views/renderers
Definition: kateconfig.cpp:65
KateConfig::configStart
void configStart()
start some config changes this method is needed to init some kind of transaction for config changes...
Definition: kateconfig.cpp:55
KateRenderer
Handles all of the work of rendering the text (used for the views and printing)
Definition: katerenderer.h:42
KateConfig::KateConfig
KateConfig()
Default Constructor.
Definition: kateconfig.cpp:46
KateConfig::~KateConfig
virtual ~KateConfig()
Virtual Destructor.
Definition: kateconfig.cpp:51

kate

Skip menu "kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kate

Skip menu "kate"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for kate by doxygen 1.8.8
This website is maintained by Timothy Pearson.