Update Scintilla to version 3.4.4
[TortoiseGit.git] / ext / scintilla / src / ViewStyle.h
blobac513c8a02313ccce3d1a18edc80cbac6067eeb0
1 // Scintilla source code edit control
2 /** @file ViewStyle.h
3 ** Store information on how the document is to be viewed.
4 **/
5 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
6 // The License.txt file describes the conditions under which this software may be distributed.
8 #ifndef VIEWSTYLE_H
9 #define VIEWSTYLE_H
11 #ifdef SCI_NAMESPACE
12 namespace Scintilla {
13 #endif
15 /**
17 class MarginStyle {
18 public:
19 int style;
20 int width;
21 int mask;
22 bool sensitive;
23 int cursor;
24 MarginStyle();
27 /**
29 class FontNames {
30 private:
31 std::vector<char *> names;
33 // Private so FontNames objects can not be copied
34 FontNames(const FontNames &);
35 public:
36 FontNames();
37 ~FontNames();
38 void Clear();
39 const char *Save(const char *name);
42 class FontRealised : public FontMeasurements {
43 // Private so FontRealised objects can not be copied
44 FontRealised(const FontRealised &);
45 FontRealised &operator=(const FontRealised &);
46 public:
47 Font font;
48 FontRealised();
49 virtual ~FontRealised();
50 void Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs);
53 enum IndentView {ivNone, ivReal, ivLookForward, ivLookBoth};
55 enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterIndent=2};
57 typedef std::map<FontSpecification, FontRealised *> FontMap;
59 enum WrapMode { eWrapNone, eWrapWord, eWrapChar, eWrapWhitespace };
61 class ColourOptional : public ColourDesired {
62 public:
63 bool isSet;
64 ColourOptional(ColourDesired colour_=ColourDesired(0,0,0), bool isSet_=false) : ColourDesired(colour_), isSet(isSet_) {
66 ColourOptional(uptr_t wParam, sptr_t lParam) : ColourDesired(static_cast<long>(lParam)), isSet(wParam != 0) {
70 struct ForeBackColours {
71 ColourOptional fore;
72 ColourOptional back;
75 /**
77 class ViewStyle {
78 FontNames fontNames;
79 FontMap fonts;
80 public:
81 std::vector<Style> styles;
82 size_t nextExtendedStyle;
83 LineMarker markers[MARKER_MAX + 1];
84 int largestMarkerHeight;
85 Indicator indicators[INDIC_MAX + 1];
86 int technology;
87 int lineHeight;
88 unsigned int maxAscent;
89 unsigned int maxDescent;
90 XYPOSITION aveCharWidth;
91 XYPOSITION spaceWidth;
92 XYPOSITION tabWidth;
93 ForeBackColours selColours;
94 ColourDesired selAdditionalForeground;
95 ColourDesired selAdditionalBackground;
96 ColourDesired selBackground2;
97 int selAlpha;
98 int selAdditionalAlpha;
99 bool selEOLFilled;
100 ForeBackColours whitespaceColours;
101 int controlCharSymbol;
102 XYPOSITION controlCharWidth;
103 ColourDesired selbar;
104 ColourDesired selbarlight;
105 ColourOptional foldmarginColour;
106 ColourOptional foldmarginHighlightColour;
107 ForeBackColours hotspotColours;
108 bool hotspotUnderline;
109 bool hotspotSingleLine;
110 /// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
111 int leftMarginWidth; ///< Spacing margin on left of text
112 int rightMarginWidth; ///< Spacing margin on right of text
113 int maskInLine; ///< Mask for markers to be put into text because there is nowhere for them to go in margin
114 MarginStyle ms[SC_MAX_MARGIN+1];
115 int fixedColumnWidth; ///< Total width of margins
116 bool marginInside; ///< true: margin included in text view, false: separate views
117 int textStart; ///< Starting x position of text within the view
118 int zoomLevel;
119 WhiteSpaceVisibility viewWhitespace;
120 int whitespaceSize;
121 IndentView viewIndentationGuides;
122 bool viewEOL;
123 ColourDesired caretcolour;
124 ColourDesired additionalCaretColour;
125 bool showCaretLineBackground;
126 bool alwaysShowCaretLineBackground;
127 ColourDesired caretLineBackground;
128 int caretLineAlpha;
129 ColourDesired edgecolour;
130 int edgeState;
131 int caretStyle;
132 int caretWidth;
133 bool someStylesProtected;
134 bool someStylesForceCase;
135 int extraFontFlag;
136 int extraAscent;
137 int extraDescent;
138 int marginStyleOffset;
139 int annotationVisible;
140 int annotationStyleOffset;
141 bool braceHighlightIndicatorSet;
142 int braceHighlightIndicator;
143 bool braceBadLightIndicatorSet;
144 int braceBadLightIndicator;
145 int theEdge;
146 int marginNumberPadding; // the right-side padding of the number margin
147 int ctrlCharPadding; // the padding around control character text blobs
148 int lastSegItalicsOffset; // the offset so as not to clip italic characters at EOLs
150 // Wrapping support
151 WrapMode wrapState;
152 int wrapVisualFlags;
153 int wrapVisualFlagsLocation;
154 int wrapVisualStartIndent;
155 int wrapIndentMode; // SC_WRAPINDENT_FIXED, _SAME, _INDENT
157 ViewStyle();
158 ViewStyle(const ViewStyle &source);
159 ~ViewStyle();
160 void Init(size_t stylesSize_=256);
161 void Refresh(Surface &surface, int tabInChars);
162 void ReleaseAllExtendedStyles();
163 int AllocateExtendedStyles(int numberStyles);
164 void EnsureStyle(size_t index);
165 void ResetDefaultStyle();
166 void ClearStyles();
167 void SetStyleFontName(int styleIndex, const char *name);
168 bool ProtectionActive() const;
169 int ExternalMarginWidth() const;
170 bool ValidStyle(size_t styleIndex) const;
171 void CalcLargestMarkerHeight();
172 ColourOptional Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const;
173 ColourDesired WrapColour() const;
174 bool SetWrapState(int wrapState_);
175 bool SetWrapVisualFlags(int wrapVisualFlags_);
176 bool SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation_);
177 bool SetWrapVisualStartIndent(int wrapVisualStartIndent_);
178 bool SetWrapIndentMode(int wrapIndentMode_);
180 private:
181 void AllocStyles(size_t sizeNew);
182 void CreateAndAddFont(const FontSpecification &fs);
183 FontRealised *Find(const FontSpecification &fs);
184 void FindMaxAscentDescent();
185 // Private so can only be copied through copy constructor which ensures font names initialised correctly
186 ViewStyle &operator=(const ViewStyle &);
189 #ifdef SCI_NAMESPACE
191 #endif
193 #endif