Fix relative project base path when creating a new project
[geany-mirror.git] / scintilla / src / ViewStyle.h
blob4a4ffcdf0ecf0f6cc6c6956e23bd3c7f86722853
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 int lineOverlap;
89 unsigned int maxAscent;
90 unsigned int maxDescent;
91 XYPOSITION aveCharWidth;
92 XYPOSITION spaceWidth;
93 XYPOSITION tabWidth;
94 ForeBackColours selColours;
95 ColourDesired selAdditionalForeground;
96 ColourDesired selAdditionalBackground;
97 ColourDesired selBackground2;
98 int selAlpha;
99 int selAdditionalAlpha;
100 bool selEOLFilled;
101 ForeBackColours whitespaceColours;
102 int controlCharSymbol;
103 XYPOSITION controlCharWidth;
104 ColourDesired selbar;
105 ColourDesired selbarlight;
106 ColourOptional foldmarginColour;
107 ColourOptional foldmarginHighlightColour;
108 ForeBackColours hotspotColours;
109 bool hotspotUnderline;
110 bool hotspotSingleLine;
111 /// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
112 int leftMarginWidth; ///< Spacing margin on left of text
113 int rightMarginWidth; ///< Spacing margin on right of text
114 int maskInLine; ///< Mask for markers to be put into text because there is nowhere for them to go in margin
115 MarginStyle ms[SC_MAX_MARGIN+1];
116 int fixedColumnWidth; ///< Total width of margins
117 bool marginInside; ///< true: margin included in text view, false: separate views
118 int textStart; ///< Starting x position of text within the view
119 int zoomLevel;
120 WhiteSpaceVisibility viewWhitespace;
121 int whitespaceSize;
122 IndentView viewIndentationGuides;
123 bool viewEOL;
124 ColourDesired caretcolour;
125 ColourDesired additionalCaretColour;
126 bool showCaretLineBackground;
127 bool alwaysShowCaretLineBackground;
128 ColourDesired caretLineBackground;
129 int caretLineAlpha;
130 ColourDesired edgecolour;
131 int edgeState;
132 int caretStyle;
133 int caretWidth;
134 bool someStylesProtected;
135 bool someStylesForceCase;
136 int extraFontFlag;
137 int extraAscent;
138 int extraDescent;
139 int marginStyleOffset;
140 int annotationVisible;
141 int annotationStyleOffset;
142 bool braceHighlightIndicatorSet;
143 int braceHighlightIndicator;
144 bool braceBadLightIndicatorSet;
145 int braceBadLightIndicator;
146 int theEdge;
147 int marginNumberPadding; // the right-side padding of the number margin
148 int ctrlCharPadding; // the padding around control character text blobs
149 int lastSegItalicsOffset; // the offset so as not to clip italic characters at EOLs
151 // Wrapping support
152 WrapMode wrapState;
153 int wrapVisualFlags;
154 int wrapVisualFlagsLocation;
155 int wrapVisualStartIndent;
156 int wrapIndentMode; // SC_WRAPINDENT_FIXED, _SAME, _INDENT
158 ViewStyle();
159 ViewStyle(const ViewStyle &source);
160 ~ViewStyle();
161 void Init(size_t stylesSize_=256);
162 void Refresh(Surface &surface, int tabInChars);
163 void ReleaseAllExtendedStyles();
164 int AllocateExtendedStyles(int numberStyles);
165 void EnsureStyle(size_t index);
166 void ResetDefaultStyle();
167 void ClearStyles();
168 void SetStyleFontName(int styleIndex, const char *name);
169 bool ProtectionActive() const;
170 int ExternalMarginWidth() const;
171 bool ValidStyle(size_t styleIndex) const;
172 void CalcLargestMarkerHeight();
173 ColourOptional Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const;
174 bool SelectionBackgroundDrawn() const;
175 bool WhitespaceBackgroundDrawn() const;
176 ColourDesired WrapColour() const;
178 bool SetWrapState(int wrapState_);
179 bool SetWrapVisualFlags(int wrapVisualFlags_);
180 bool SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation_);
181 bool SetWrapVisualStartIndent(int wrapVisualStartIndent_);
182 bool SetWrapIndentMode(int wrapIndentMode_);
184 private:
185 void AllocStyles(size_t sizeNew);
186 void CreateAndAddFont(const FontSpecification &fs);
187 FontRealised *Find(const FontSpecification &fs);
188 void FindMaxAscentDescent();
189 // Private so can only be copied through copy constructor which ensures font names initialised correctly
190 ViewStyle &operator=(const ViewStyle &);
193 #ifdef SCI_NAMESPACE
195 #endif
197 #endif