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