1 // Scintilla source code edit control
3 ** Store information on how the document is to be viewed.
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.
32 std::vector
<char *> names
;
34 // Private so FontNames objects can not be copied
35 FontNames(const FontNames
&);
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
&);
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
{
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
{
78 struct EdgeProperties
{
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
)) {
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
;
105 unsigned int maxAscent
;
106 unsigned int maxDescent
;
107 XYPOSITION aveCharWidth
;
108 XYPOSITION spaceWidth
;
110 ForeBackColours selColours
;
111 ColourDesired selAdditionalForeground
;
112 ColourDesired selAdditionalBackground
;
113 ColourDesired selBackground2
;
115 int selAdditionalAlpha
;
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
137 WhiteSpaceVisibility viewWhitespace
;
138 TabDrawMode tabDrawMode
;
140 IndentView viewIndentationGuides
;
142 ColourDesired caretcolour
;
143 ColourDesired additionalCaretColour
;
144 bool showCaretLineBackground
;
145 bool alwaysShowCaretLineBackground
;
146 ColourDesired caretLineBackground
;
150 bool someStylesProtected
;
151 bool someStylesForceCase
;
155 int marginStyleOffset
;
156 int annotationVisible
;
157 int annotationStyleOffset
;
158 bool braceHighlightIndicatorSet
;
159 int braceHighlightIndicator
;
160 bool braceBadLightIndicatorSet
;
161 int braceBadLightIndicator
;
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
172 int wrapVisualFlagsLocation
;
173 int wrapVisualStartIndent
;
174 int wrapIndentMode
; // SC_WRAPINDENT_FIXED, _SAME, _INDENT
177 ViewStyle(const ViewStyle
&source
);
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();
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;
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
&);