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.
31 std::vector
<char *> names
;
33 // Private so FontNames objects can not be copied
34 FontNames(const FontNames
&);
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
&);
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
{
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
{
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
;
91 unsigned int maxAscent
;
92 unsigned int maxDescent
;
93 XYPOSITION aveCharWidth
;
94 XYPOSITION spaceWidth
;
96 ForeBackColours selColours
;
97 ColourDesired selAdditionalForeground
;
98 ColourDesired selAdditionalBackground
;
99 ColourDesired selBackground2
;
101 int selAdditionalAlpha
;
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
122 WhiteSpaceVisibility viewWhitespace
;
124 IndentView viewIndentationGuides
;
126 ColourDesired caretcolour
;
127 ColourDesired additionalCaretColour
;
128 bool showCaretLineBackground
;
129 bool alwaysShowCaretLineBackground
;
130 ColourDesired caretLineBackground
;
132 ColourDesired edgecolour
;
136 bool someStylesProtected
;
137 bool someStylesForceCase
;
141 int marginStyleOffset
;
142 int annotationVisible
;
143 int annotationStyleOffset
;
144 bool braceHighlightIndicatorSet
;
145 int braceHighlightIndicator
;
146 bool braceBadLightIndicatorSet
;
147 int braceBadLightIndicator
;
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
156 int wrapVisualFlagsLocation
;
157 int wrapVisualStartIndent
;
158 int wrapIndentMode
; // SC_WRAPINDENT_FIXED, _SAME, _INDENT
161 ViewStyle(const ViewStyle
&source
);
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();
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_
);
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
&);