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
// Scintilla source code edit control
/** @file ViewStyle.h
** Store information on how the document is to be viewed.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef VIEWSTYLE_H
#define VIEWSTYLE_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
/**
*/
class MarginStyle {
public:
int style;
int width;
int mask;
bool sensitive;
int cursor;
MarginStyle();
};
/**
*/
class FontNames {
private:
std::vector<char *> names;
// Private so FontNames objects can not be copied
FontNames(const FontNames &);
public:
FontNames();
~FontNames();
void Clear();
const char *Save(const char *name);
};
class FontRealised : public FontMeasurements {
// Private so FontRealised objects can not be copied
FontRealised(const FontRealised &);
FontRealised &operator=(const FontRealised &);
public:
Font font;
FontRealised();
virtual ~FontRealised();
void Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs);
};
enum IndentView {ivNone, ivReal, ivLookForward, ivLookBoth};
enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterIndent=2};
typedef std::map<FontSpecification, FontRealised *> FontMap;
enum WrapMode { eWrapNone, eWrapWord, eWrapChar, eWrapWhitespace };
class ColourOptional : public ColourDesired {
public:
bool isSet;
ColourOptional(ColourDesired colour_=ColourDesired(0,0,0), bool isSet_=false) : ColourDesired(colour_), isSet(isSet_) {
}
ColourOptional(uptr_t wParam, sptr_t lParam) : ColourDesired(static_cast<long>(lParam)), isSet(wParam != 0) {
}
};
struct ForeBackColours {
ColourOptional fore;
ColourOptional back;
};
/**
*/
class ViewStyle {
FontNames fontNames;
FontMap fonts;
public:
std::vector<Style> styles;
size_t nextExtendedStyle;
LineMarker markers[MARKER_MAX + 1];
int largestMarkerHeight;
Indicator indicators[INDIC_MAX + 1];
unsigned int indicatorsDynamic;
unsigned int indicatorsSetFore;
int technology;
int lineHeight;
int lineOverlap;
unsigned int maxAscent;
unsigned int maxDescent;
XYPOSITION aveCharWidth;
XYPOSITION spaceWidth;
XYPOSITION tabWidth;
ForeBackColours selColours;
ColourDesired selAdditionalForeground;
ColourDesired selAdditionalBackground;
ColourDesired selBackground2;
int selAlpha;
int selAdditionalAlpha;
bool selEOLFilled;
ForeBackColours whitespaceColours;
int controlCharSymbol;
XYPOSITION controlCharWidth;
ColourDesired selbar;
ColourDesired selbarlight;
ColourOptional foldmarginColour;
ColourOptional foldmarginHighlightColour;
ForeBackColours hotspotColours;
bool hotspotUnderline;
bool hotspotSingleLine;
/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
int leftMarginWidth; ///< Spacing margin on left of text
int rightMarginWidth; ///< Spacing margin on right of text
int maskInLine; ///< Mask for markers to be put into text because there is nowhere for them to go in margin
MarginStyle ms[SC_MAX_MARGIN+1];
int fixedColumnWidth; ///< Total width of margins
bool marginInside; ///< true: margin included in text view, false: separate views
int textStart; ///< Starting x position of text within the view
int zoomLevel;
WhiteSpaceVisibility viewWhitespace;
int whitespaceSize;
IndentView viewIndentationGuides;
bool viewEOL;
ColourDesired caretcolour;
ColourDesired additionalCaretColour;
bool showCaretLineBackground;
bool alwaysShowCaretLineBackground;
ColourDesired caretLineBackground;
int caretLineAlpha;
ColourDesired edgecolour;
int edgeState;
int caretStyle;
int caretWidth;
bool someStylesProtected;
bool someStylesForceCase;
int extraFontFlag;
int extraAscent;
int extraDescent;
int marginStyleOffset;
int annotationVisible;
int annotationStyleOffset;
bool braceHighlightIndicatorSet;
int braceHighlightIndicator;
bool braceBadLightIndicatorSet;
int braceBadLightIndicator;
int theEdge;
int marginNumberPadding; // the right-side padding of the number margin
int ctrlCharPadding; // the padding around control character text blobs
int lastSegItalicsOffset; // the offset so as not to clip italic characters at EOLs
// Wrapping support
WrapMode wrapState;
int wrapVisualFlags;
int wrapVisualFlagsLocation;
int wrapVisualStartIndent;
int wrapIndentMode; // SC_WRAPINDENT_FIXED, _SAME, _INDENT
ViewStyle();
ViewStyle(const ViewStyle &source);
~ViewStyle();
void Init(size_t stylesSize_=256);
void Refresh(Surface &surface, int tabInChars);
void ReleaseAllExtendedStyles();
int AllocateExtendedStyles(int numberStyles);
void EnsureStyle(size_t index);
void ResetDefaultStyle();
void ClearStyles();
void SetStyleFontName(int styleIndex, const char *name);
bool ProtectionActive() const;
int ExternalMarginWidth() const;
bool ValidStyle(size_t styleIndex) const;
void CalcLargestMarkerHeight();
ColourOptional Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const;
bool SelectionBackgroundDrawn() const;
bool WhitespaceBackgroundDrawn() const;
ColourDesired WrapColour() const;
bool SetWrapState(int wrapState_);
bool SetWrapVisualFlags(int wrapVisualFlags_);
bool SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation_);
bool SetWrapVisualStartIndent(int wrapVisualStartIndent_);
bool SetWrapIndentMode(int wrapIndentMode_);
private:
void AllocStyles(size_t sizeNew);
void CreateAndAddFont(const FontSpecification &fs);
FontRealised *Find(const FontSpecification &fs);
void FindMaxAscentDescent();
// Private so can only be copied through copy constructor which ensures font names initialised correctly
ViewStyle &operator=(const ViewStyle &);
};
#ifdef SCI_NAMESPACE
}
#endif
#endif