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