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];
89 unsigned int maxAscent
;
90 unsigned int maxDescent
;
91 XYPOSITION aveCharWidth
;
92 XYPOSITION spaceWidth
;
94 ForeBackColours selColours
;
95 ColourDesired selAdditionalForeground
;
96 ColourDesired selAdditionalBackground
;
97 ColourDesired selBackground2
;
99 int selAdditionalAlpha
;
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
120 WhiteSpaceVisibility viewWhitespace
;
122 IndentView viewIndentationGuides
;
124 ColourDesired caretcolour
;
125 ColourDesired additionalCaretColour
;
126 bool showCaretLineBackground
;
127 bool alwaysShowCaretLineBackground
;
128 ColourDesired caretLineBackground
;
130 ColourDesired edgecolour
;
134 bool someStylesProtected
;
135 bool someStylesForceCase
;
139 int marginStyleOffset
;
140 int annotationVisible
;
141 int annotationStyleOffset
;
142 bool braceHighlightIndicatorSet
;
143 int braceHighlightIndicator
;
144 bool braceBadLightIndicatorSet
;
145 int braceBadLightIndicator
;
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
154 int wrapVisualFlagsLocation
;
155 int wrapVisualStartIndent
;
156 int wrapIndentMode
; // SC_WRAPINDENT_FIXED, _SAME, _INDENT
159 ViewStyle(const ViewStyle
&source
);
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();
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_
);
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
&);