Fix action icons in the log dialog being clipped on High-DPI displays
[TortoiseGit.git] / ext / scintilla / src / ViewStyle.h
blob2f7afe6d994cd6848922eabc6e32fd01b3f8cee4
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();
28 /**
30 class FontNames {
31 private:
32 std::vector<char *> names;
34 // Private so FontNames objects can not be copied
35 FontNames(const FontNames &);
36 public:
37 FontNames();
38 ~FontNames();
39 void Clear();
40 const char *Save(const char *name);
43 class FontRealised : public FontMeasurements {
44 // Private so FontRealised objects can not be copied
45 FontRealised(const FontRealised &);
46 FontRealised &operator=(const FontRealised &);
47 public:
48 Font font;
49 FontRealised();
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, 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 LineMarker markers[MARKER_MAX + 1];
98 int largestMarkerHeight;
99 Indicator indicators[INDIC_MAX + 1];
100 unsigned int indicatorsDynamic;
101 unsigned int 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 bool showCaretLineBackground;
145 bool alwaysShowCaretLineBackground;
146 ColourDesired caretLineBackground;
147 int caretLineAlpha;
148 int caretStyle;
149 int caretWidth;
150 bool someStylesProtected;
151 bool someStylesForceCase;
152 int extraFontFlag;
153 int extraAscent;
154 int extraDescent;
155 int marginStyleOffset;
156 int annotationVisible;
157 int annotationStyleOffset;
158 bool braceHighlightIndicatorSet;
159 int braceHighlightIndicator;
160 bool braceBadLightIndicatorSet;
161 int braceBadLightIndicator;
162 int edgeState;
163 EdgeProperties theEdge;
164 std::vector<EdgeProperties> theMultiEdge;
165 int marginNumberPadding; // the right-side padding of the number margin
166 int ctrlCharPadding; // the padding around control character text blobs
167 int lastSegItalicsOffset; // the offset so as not to clip italic characters at EOLs
169 // Wrapping support
170 WrapMode wrapState;
171 int wrapVisualFlags;
172 int wrapVisualFlagsLocation;
173 int wrapVisualStartIndent;
174 int wrapIndentMode; // SC_WRAPINDENT_FIXED, _SAME, _INDENT
176 ViewStyle();
177 ViewStyle(const ViewStyle &source);
178 ~ViewStyle();
179 void CalculateMarginWidthAndMask();
180 void Init(size_t stylesSize_=256);
181 void Refresh(Surface &surface, int tabInChars);
182 void ReleaseAllExtendedStyles();
183 int AllocateExtendedStyles(int numberStyles);
184 void EnsureStyle(size_t index);
185 void ResetDefaultStyle();
186 void ClearStyles();
187 void SetStyleFontName(int styleIndex, const char *name);
188 bool ProtectionActive() const;
189 int ExternalMarginWidth() const;
190 int MarginFromLocation(Point pt) const;
191 bool ValidStyle(size_t styleIndex) const;
192 void CalcLargestMarkerHeight();
193 ColourOptional Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const;
194 bool SelectionBackgroundDrawn() const;
195 bool WhitespaceBackgroundDrawn() const;
196 ColourDesired WrapColour() const;
198 bool SetWrapState(int wrapState_);
199 bool SetWrapVisualFlags(int wrapVisualFlags_);
200 bool SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation_);
201 bool SetWrapVisualStartIndent(int wrapVisualStartIndent_);
202 bool SetWrapIndentMode(int wrapIndentMode_);
204 bool WhiteSpaceVisible(bool inIndent) const;
206 private:
207 void AllocStyles(size_t sizeNew);
208 void CreateAndAddFont(const FontSpecification &fs);
209 FontRealised *Find(const FontSpecification &fs);
210 void FindMaxAscentDescent();
211 // Private so can only be copied through copy constructor which ensures font names initialised correctly
212 ViewStyle &operator=(const ViewStyle &);
215 #ifdef SCI_NAMESPACE
217 #endif
219 #endif