Update Tortoise.pot
[TortoiseGit.git] / ext / scintilla / src / ViewStyle.h
blob4b11c84f35c124da2e36f9b4d4b6c92e28760918
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 ColourDesired back;
21 int width;
22 int mask;
23 bool sensitive;
24 int cursor;
25 MarginStyle(int style_= SC_MARGIN_SYMBOL, int width_=0, int mask_=0);
28 /**
30 class FontNames {
31 private:
32 std::vector<UniqueString> names;
33 public:
34 FontNames();
35 // FontNames objects can not be copied.
36 FontNames(const FontNames &) = delete;
37 FontNames &operator=(const FontNames &) = delete;
38 ~FontNames();
39 void Clear();
40 const char *Save(const char *name);
43 class FontRealised : public FontMeasurements {
44 public:
45 Font font;
46 FontRealised();
47 // FontRealised objects can not be copied.
48 FontRealised(const FontRealised &) = delete;
49 FontRealised &operator=(const FontRealised &) = delete;
50 virtual ~FontRealised();
51 void Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs);
54 enum IndentView {ivNone, ivReal, ivLookForward, ivLookBoth};
56 enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterIndent=2, wsVisibleOnlyInIndent=3};
58 enum TabDrawMode {tdLongArrow=0, tdStrikeOut=1};
60 typedef std::map<FontSpecification, std::unique_ptr<FontRealised>> FontMap;
62 enum WrapMode { eWrapNone, eWrapWord, eWrapChar, eWrapWhitespace };
64 class ColourOptional : public ColourDesired {
65 public:
66 bool isSet;
67 ColourOptional(ColourDesired colour_=ColourDesired(0,0,0), bool isSet_=false) : ColourDesired(colour_), isSet(isSet_) {
69 ColourOptional(uptr_t wParam, sptr_t lParam) : ColourDesired(static_cast<long>(lParam)), isSet(wParam != 0) {
73 struct ForeBackColours {
74 ColourOptional fore;
75 ColourOptional back;
78 struct EdgeProperties {
79 int column;
80 ColourDesired colour;
81 EdgeProperties(int column_ = 0, ColourDesired colour_ = ColourDesired(0)) :
82 column(column_), colour(colour_) {
84 EdgeProperties(uptr_t wParam, sptr_t lParam) :
85 column(static_cast<int>(wParam)), colour(static_cast<long>(lParam)) {
89 /**
91 class ViewStyle {
92 FontNames fontNames;
93 FontMap fonts;
94 public:
95 std::vector<Style> styles;
96 size_t nextExtendedStyle;
97 std::vector<LineMarker> markers;
98 int largestMarkerHeight;
99 std::vector<Indicator> indicators;
100 bool indicatorsDynamic;
101 bool indicatorsSetFore;
102 int technology;
103 int lineHeight;
104 int lineOverlap;
105 unsigned int maxAscent;
106 unsigned int maxDescent;
107 XYPOSITION aveCharWidth;
108 XYPOSITION spaceWidth;
109 XYPOSITION tabWidth;
110 ForeBackColours selColours;
111 ColourDesired selAdditionalForeground;
112 ColourDesired selAdditionalBackground;
113 ColourDesired selBackground2;
114 int selAlpha;
115 int selAdditionalAlpha;
116 bool selEOLFilled;
117 ForeBackColours whitespaceColours;
118 int controlCharSymbol;
119 XYPOSITION controlCharWidth;
120 ColourDesired selbar;
121 ColourDesired selbarlight;
122 ColourOptional foldmarginColour;
123 ColourOptional foldmarginHighlightColour;
124 ForeBackColours hotspotColours;
125 bool hotspotUnderline;
126 bool hotspotSingleLine;
127 /// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
128 int leftMarginWidth; ///< Spacing margin on left of text
129 int rightMarginWidth; ///< Spacing margin on right of text
130 int maskInLine; ///< Mask for markers to be put into text because there is nowhere for them to go in margin
131 int maskDrawInText; ///< Mask for markers that always draw in text
132 std::vector<MarginStyle> ms;
133 int fixedColumnWidth; ///< Total width of margins
134 bool marginInside; ///< true: margin included in text view, false: separate views
135 int textStart; ///< Starting x position of text within the view
136 int zoomLevel;
137 WhiteSpaceVisibility viewWhitespace;
138 TabDrawMode tabDrawMode;
139 int whitespaceSize;
140 IndentView viewIndentationGuides;
141 bool viewEOL;
142 ColourDesired caretcolour;
143 ColourDesired additionalCaretColour;
144 int caretLineFrame;
145 bool showCaretLineBackground;
146 bool alwaysShowCaretLineBackground;
147 ColourDesired caretLineBackground;
148 int caretLineAlpha;
149 int caretStyle;
150 int caretWidth;
151 bool someStylesProtected;
152 bool someStylesForceCase;
153 int extraFontFlag;
154 int extraAscent;
155 int extraDescent;
156 int marginStyleOffset;
157 int annotationVisible;
158 int annotationStyleOffset;
159 bool braceHighlightIndicatorSet;
160 int braceHighlightIndicator;
161 bool braceBadLightIndicatorSet;
162 int braceBadLightIndicator;
163 int edgeState;
164 EdgeProperties theEdge;
165 std::vector<EdgeProperties> theMultiEdge;
166 int marginNumberPadding; // the right-side padding of the number margin
167 int ctrlCharPadding; // the padding around control character text blobs
168 int lastSegItalicsOffset; // the offset so as not to clip italic characters at EOLs
170 // Wrapping support
171 WrapMode wrapState;
172 int wrapVisualFlags;
173 int wrapVisualFlagsLocation;
174 int wrapVisualStartIndent;
175 int wrapIndentMode; // SC_WRAPINDENT_FIXED, _SAME, _INDENT
177 ViewStyle();
178 ViewStyle(const ViewStyle &source);
179 // Can only be copied through copy constructor which ensures font names initialised correctly
180 ViewStyle &operator=(const ViewStyle &) = delete;
181 ~ViewStyle();
182 void CalculateMarginWidthAndMask();
183 void Init(size_t stylesSize_=256);
184 void Refresh(Surface &surface, int tabInChars);
185 void ReleaseAllExtendedStyles();
186 int AllocateExtendedStyles(int numberStyles);
187 void EnsureStyle(size_t index);
188 void ResetDefaultStyle();
189 void ClearStyles();
190 void SetStyleFontName(int styleIndex, const char *name);
191 bool ProtectionActive() const;
192 int ExternalMarginWidth() const;
193 int MarginFromLocation(Point pt) const;
194 bool ValidStyle(size_t styleIndex) const;
195 void CalcLargestMarkerHeight();
196 int GetFrameWidth() const;
197 bool IsLineFrameOpaque(bool caretActive, bool lineContainsCaret) const;
198 ColourOptional Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const;
199 bool SelectionBackgroundDrawn() const;
200 bool WhitespaceBackgroundDrawn() const;
201 ColourDesired WrapColour() const;
203 bool SetWrapState(int wrapState_);
204 bool SetWrapVisualFlags(int wrapVisualFlags_);
205 bool SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation_);
206 bool SetWrapVisualStartIndent(int wrapVisualStartIndent_);
207 bool SetWrapIndentMode(int wrapIndentMode_);
209 bool WhiteSpaceVisible(bool inIndent) const;
211 private:
212 void AllocStyles(size_t sizeNew);
213 void CreateAndAddFont(const FontSpecification &fs);
214 FontRealised *Find(const FontSpecification &fs);
215 void FindMaxAscentDescent();
218 #ifdef SCI_NAMESPACE
220 #endif
222 #endif