Code::Blocks
SVN r11506
include
editorcolourset.h
Go to the documentation of this file.
1
/*
2
* This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
3
* http://www.gnu.org/licenses/lgpl-3.0.html
4
*/
5
6
#ifndef EDITORCOLORSET_H
7
#define EDITORCOLORSET_H
8
9
#include <
wx/dynarray.h
>
10
#include <
wx/hashmap.h
>
11
#include <
wx/intl.h
>
12
#include <
wx/wxscintilla.h
>
// wxSCI_KEYWORDSET_MAX
13
#include "
settings.h
"
14
#include "
globals.h
"
// HighlightLanguage
15
16
#include <set>
17
18
// forward decls
19
class
cbEditor
;
20
class
cbStyledTextCtrl
;
21
22
#define COLORSET_DEFAULT _T("default")
23
24
const
int
cbHIGHLIGHT_LINE
= -98;
// highlight line under caret virtual style
25
const
int
cbSELECTION
= -99;
// selection virtual style
26
27
struct
OptionColour
28
{
29
wxString
name
;
30
int
value
;
31
wxColour
fore
;
32
wxColour
back
;
33
bool
bold
;
34
bool
italics
;
35
bool
underlined
;
36
bool
isStyle
;
37
38
wxColour
originalfore
;
39
wxColour
originalback
;
40
bool
originalbold
;
41
bool
originalitalics
;
42
bool
originalunderlined
;
43
bool
originalisStyle
;
44
};
45
WX_DEFINE_ARRAY
(
OptionColour
*, OptionColours);
46
47
struct
CommentToken
{
48
wxString
lineComment
;
49
wxString
doxygenLineComment
;
50
wxString
streamCommentStart
;
51
wxString
streamCommentEnd
;
52
wxString
doxygenStreamCommentStart
;
53
wxString
doxygenStreamCommentEnd
;
54
wxString
boxCommentStart
;
55
wxString
boxCommentMid
;
56
wxString
boxCommentEnd
;
57
};
58
59
struct
OptionSet
60
{
61
wxString
m_Langs
;
62
OptionColours
m_Colours
;
63
wxString
m_Keywords[
wxSCI_KEYWORDSET_MAX
+ 1];
// wxSCI_KEYWORDSET_MAX+1 keyword sets
64
wxArrayString
m_FileMasks
;
65
int
m_Lexers
;
66
wxString
m_SampleCode
;
67
int
m_BreakLine
;
68
int
m_DebugLine
;
69
int
m_ErrorLine
;
70
71
wxString
m_originalKeywords[
wxSCI_KEYWORDSET_MAX
+ 1];
// wxSCI_KEYWORDSET_MAX+1 keyword sets
72
wxArrayString
m_originalFileMasks
;
73
74
CommentToken
comment
;
75
bool
m_CaseSensitive
;
76
};
77
WX_DECLARE_STRING_HASH_MAP
(
OptionSet
, OptionSetsMap);
78
79
class
DLLIMPORT
EditorColourSet
80
{
81
public
:
82
EditorColourSet
(
const
wxString
& setName =
COLORSET_DEFAULT
);
83
EditorColourSet
(
const
EditorColourSet
& other);
// copy ctor
84
~
EditorColourSet
();
85
86
HighlightLanguage
AddHighlightLanguage(
int
lexer,
const
wxString
&
name
);
87
HighlightLanguage
GetHighlightLanguage(
int
lexer);
// from scintilla lexer (wxSCI_LEX_*)
88
HighlightLanguage
GetHighlightLanguage(
const
wxString
& name);
89
wxArrayString
GetAllHighlightLanguages();
90
91
void
AddOption(
HighlightLanguage
lang,
92
const
wxString
& name,
93
int
value
,
94
wxColour
fore
=
wxNullColour
,
95
wxColour
back
=
wxNullColour
,
96
bool
bold
=
false
,
97
bool
italics
=
false
,
98
bool
underlined
=
false
,
99
bool
isStyle
=
true
);
100
bool
AddOption(
HighlightLanguage
lang,
OptionColour
* option,
bool
checkIfExists =
true
);
101
102
OptionColour
* GetOptionByName(
HighlightLanguage
lang,
const
wxString
& name);
103
OptionColour
* GetOptionByValue(
HighlightLanguage
lang,
int
value);
104
OptionColour
* GetOptionByIndex(
HighlightLanguage
lang,
int
index);
105
106
void
UpdateOptionsWithSameName(
HighlightLanguage
lang,
OptionColour
* base);
107
int
GetOptionCount(
HighlightLanguage
lang);
108
109
HighlightLanguage
GetLanguageForFilename(
const
wxString
& filename);
110
wxString
GetLanguageName(
HighlightLanguage
lang);
111
wxString
GetName
(){
return
m_Name; }
112
void
SetName
(
const
wxString
& name){ m_Name =
name
; }
113
114
HighlightLanguage
Apply(
cbEditor
* editor,
HighlightLanguage
lang,
bool
colourise);
115
void
Apply(
HighlightLanguage
lang,
cbStyledTextCtrl
* control,
bool
isC,
bool
colourise);
116
void
Save();
117
void
Reset(
HighlightLanguage
lang);
118
119
wxString
& GetKeywords(
HighlightLanguage
lang,
int
idx);
120
void
SetKeywords(
HighlightLanguage
lang,
int
idx,
const
wxString
& keywords);
121
122
const
wxArrayString
& GetFileMasks(
HighlightLanguage
lang);
123
void
SetFileMasks(
HighlightLanguage
lang,
const
wxString
& masks,
const
wxString
& =
_
(
","
));
124
125
wxString
GetSampleCode(
HighlightLanguage
lang,
int
* breakLine,
int
* debugLine,
int
* errorLine);
126
void
SetSampleCode(
HighlightLanguage
lang,
const
wxString
& sample,
int
breakLine,
int
debugLine,
int
errorLine);
127
128
CommentToken
GetCommentToken(
HighlightLanguage
lang);
129
void
SetCommentToken(
HighlightLanguage
lang,
CommentToken
token);
130
131
bool
GetCaseSensitivity(
HighlightLanguage
lang);
132
void
SetCaseSensitivity(
HighlightLanguage
lang,
bool
CaseSensitive);
133
void
SetStringLexerStyles(
HighlightLanguage
lang,
const
std::set<int> &styles);
134
void
SetCommentLexerStyles(
HighlightLanguage
lang,
const
std::set<int> &styles);
135
void
SetCharacterLexerStyles(
HighlightLanguage
lang,
const
std::set<int> &styles);
136
void
SetPreprocessorLexerStyles(
HighlightLanguage
lang,
const
std::set<int> &styles);
137
138
private
:
139
void
DoApplyStyle(
cbStyledTextCtrl
* control,
int
value,
OptionColour
* option);
140
void
LoadAvailableSets();
141
void
Load();
142
void
ClearAllOptionColours();
143
144
OptionColour
*
GetDefaultOption
(
HighlightLanguage
lang);
145
146
147
wxString
m_Name
;
148
OptionSetsMap
m_Sets
;
149
152
wxString
m_PlainTextLexerID
;
153
};
154
155
#endif // EDITORCOLORSET_H
156
EditorColourSet
Definition:
editorcolourset.h:79
EditorColourSet::m_Sets
OptionSetsMap m_Sets
Definition:
editorcolourset.h:148
CommentToken::doxygenLineComment
wxString doxygenLineComment
Definition:
editorcolourset.h:49
CommentToken::lineComment
wxString lineComment
Definition:
editorcolourset.h:48
intl.h
OptionColour
Definition:
editorcolourset.h:27
OptionColour::name
wxString name
Definition:
editorcolourset.h:29
OptionColour::originalfore
wxColour originalfore
Definition:
editorcolourset.h:38
OptionColour::back
wxColour back
Definition:
editorcolourset.h:32
OptionSet::m_Colours
OptionColours m_Colours
Definition:
editorcolourset.h:62
COLORSET_DEFAULT
#define COLORSET_DEFAULT
Definition:
editorcolourset.h:22
WX_DEFINE_ARRAY
WX_DEFINE_ARRAY(OptionColour *, OptionColours)
OptionColour::originalunderlined
bool originalunderlined
Definition:
editorcolourset.h:42
OptionColour::originalbold
bool originalbold
Definition:
editorcolourset.h:40
wxNullColour
wxColour wxNullColour
OptionColour::originalitalics
bool originalitalics
Definition:
editorcolourset.h:41
hashmap.h
EditorColourSet::m_PlainTextLexerID
wxString m_PlainTextLexerID
Stores the id of the plain text file lexer (see lexer_plain.xml).
Definition:
editorcolourset.h:152
GetDefaultOption
static OptionColour * GetDefaultOption(OptionSet &mset)
Definition:
editorcolourset.cpp:526
dynarray.h
EditorColourSet::GetName
wxString GetName()
Definition:
editorcolourset.h:111
OptionColour::bold
bool bold
Definition:
editorcolourset.h:33
OptionSet::m_ErrorLine
int m_ErrorLine
Definition:
editorcolourset.h:69
OptionSet::m_SampleCode
wxString m_SampleCode
Definition:
editorcolourset.h:66
EditorColourSet::SetName
void SetName(const wxString &name)
Definition:
editorcolourset.h:112
DLLIMPORT
#define DLLIMPORT
Definition:
settings.h:16
OptionSet::m_BreakLine
int m_BreakLine
Definition:
editorcolourset.h:67
OptionSet::m_DebugLine
int m_DebugLine
Definition:
editorcolourset.h:68
CommentToken::streamCommentStart
wxString streamCommentStart
Definition:
editorcolourset.h:50
EditorColourSet::m_Name
wxString m_Name
Definition:
editorcolourset.h:147
settings.h
wxString
CommentToken
Definition:
editorcolourset.h:47
OptionColour::underlined
bool underlined
Definition:
editorcolourset.h:35
cbStyledTextCtrl
Definition:
cbstyledtextctrl.h:21
CommentToken::boxCommentStart
wxString boxCommentStart
Definition:
editorcolourset.h:54
wxColour
CommentToken::doxygenStreamCommentEnd
wxString doxygenStreamCommentEnd
Definition:
editorcolourset.h:53
CommentToken::boxCommentEnd
wxString boxCommentEnd
Definition:
editorcolourset.h:56
cbHIGHLIGHT_LINE
const int cbHIGHLIGHT_LINE
Definition:
editorcolourset.h:24
_
const wxString & _(const wxString &string)
wxSCI_KEYWORDSET_MAX
#define wxSCI_KEYWORDSET_MAX
Maximum value of keywordSet parameter of SetKeyWords.
Definition:
wxscintilla.h:404
OptionSet::m_originalFileMasks
wxArrayString m_originalFileMasks
Definition:
editorcolourset.h:72
OptionSet::m_CaseSensitive
bool m_CaseSensitive
Definition:
editorcolourset.h:75
OptionColour::fore
wxColour fore
Definition:
editorcolourset.h:31
OptionColour::italics
bool italics
Definition:
editorcolourset.h:34
CommentToken::boxCommentMid
wxString boxCommentMid
Definition:
editorcolourset.h:55
cbEditor
A file editor.
Definition:
cbeditor.h:43
OptionSet
Definition:
editorcolourset.h:59
cbSELECTION
const int cbSELECTION
Definition:
editorcolourset.h:25
OptionColour::isStyle
bool isStyle
Definition:
editorcolourset.h:36
OptionColour::value
int value
Definition:
editorcolourset.h:30
OptionColour::originalback
wxColour originalback
Definition:
editorcolourset.h:39
OptionSet::m_FileMasks
wxArrayString m_FileMasks
Definition:
editorcolourset.h:64
wxArrayString
WX_DECLARE_STRING_HASH_MAP
WX_DECLARE_STRING_HASH_MAP(OptionSet, OptionSetsMap)
wxscintilla.h
OptionColour::originalisStyle
bool originalisStyle
Definition:
editorcolourset.h:43
CommentToken::doxygenStreamCommentStart
wxString doxygenStreamCommentStart
Definition:
editorcolourset.h:52
globals.h
OptionSet::comment
CommentToken comment
Definition:
editorcolourset.h:74
OptionSet::m_Langs
wxString m_Langs
Definition:
editorcolourset.h:61
OptionSet::m_Lexers
int m_Lexers
Definition:
editorcolourset.h:65
CommentToken::streamCommentEnd
wxString streamCommentEnd
Definition:
editorcolourset.h:51
Generated by
1.8.13