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];
88 unsigned int maxAscent
;
89 unsigned int maxDescent
;
90 XYPOSITION aveCharWidth
;
91 XYPOSITION spaceWidth
;
93 ForeBackColours selColours
;
94 ColourDesired selAdditionalForeground
;
95 ColourDesired selAdditionalBackground
;
96 ColourDesired selBackground2
;
98 int selAdditionalAlpha
;
100 ForeBackColours whitespaceColours
;
101 int controlCharSymbol
;
102 XYPOSITION controlCharWidth
;
103 ColourDesired selbar
;
104 ColourDesired selbarlight
;
105 ColourOptional foldmarginColour
;
106 ColourOptional foldmarginHighlightColour
;
107 ForeBackColours hotspotColours
;
108 bool hotspotUnderline
;
109 bool hotspotSingleLine
;
110 /// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
111 int leftMarginWidth
; ///< Spacing margin on left of text
112 int rightMarginWidth
; ///< Spacing margin on right of text
113 int maskInLine
; ///< Mask for markers to be put into text because there is nowhere for them to go in margin
114 MarginStyle ms
[SC_MAX_MARGIN
+1];
115 int fixedColumnWidth
; ///< Total width of margins
116 bool marginInside
; ///< true: margin included in text view, false: separate views
117 int textStart
; ///< Starting x position of text within the view
119 WhiteSpaceVisibility viewWhitespace
;
121 IndentView viewIndentationGuides
;
123 ColourDesired caretcolour
;
124 ColourDesired additionalCaretColour
;
125 bool showCaretLineBackground
;
126 bool alwaysShowCaretLineBackground
;
127 ColourDesired caretLineBackground
;
129 ColourDesired edgecolour
;
133 bool someStylesProtected
;
134 bool someStylesForceCase
;
138 int marginStyleOffset
;
139 int annotationVisible
;
140 int annotationStyleOffset
;
141 bool braceHighlightIndicatorSet
;
142 int braceHighlightIndicator
;
143 bool braceBadLightIndicatorSet
;
144 int braceBadLightIndicator
;
146 int marginNumberPadding
; // the right-side padding of the number margin
147 int ctrlCharPadding
; // the padding around control character text blobs
148 int lastSegItalicsOffset
; // the offset so as not to clip italic characters at EOLs
153 int wrapVisualFlagsLocation
;
154 int wrapVisualStartIndent
;
155 int wrapIndentMode
; // SC_WRAPINDENT_FIXED, _SAME, _INDENT
158 ViewStyle(const ViewStyle
&source
);
160 void Init(size_t stylesSize_
=256);
161 void Refresh(Surface
&surface
, int tabInChars
);
162 void ReleaseAllExtendedStyles();
163 int AllocateExtendedStyles(int numberStyles
);
164 void EnsureStyle(size_t index
);
165 void ResetDefaultStyle();
167 void SetStyleFontName(int styleIndex
, const char *name
);
168 bool ProtectionActive() const;
169 int ExternalMarginWidth() const;
170 bool ValidStyle(size_t styleIndex
) const;
171 void CalcLargestMarkerHeight();
172 ColourOptional
Background(int marksOfLine
, bool caretActive
, bool lineContainsCaret
) const;
173 ColourDesired
WrapColour() const;
174 bool SetWrapState(int wrapState_
);
175 bool SetWrapVisualFlags(int wrapVisualFlags_
);
176 bool SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation_
);
177 bool SetWrapVisualStartIndent(int wrapVisualStartIndent_
);
178 bool SetWrapIndentMode(int wrapIndentMode_
);
181 void AllocStyles(size_t sizeNew
);
182 void CreateAndAddFont(const FontSpecification
&fs
);
183 FontRealised
*Find(const FontSpecification
&fs
);
184 void FindMaxAscentDescent();
185 // Private so can only be copied through copy constructor which ensures font names initialised correctly
186 ViewStyle
&operator=(const ViewStyle
&);