2009-04-24 23:35:41 +00:00
|
|
|
// Scintilla source code edit control
|
|
|
|
/** @file ViewStyle.h
|
|
|
|
** Store information on how the document is to be viewed.
|
|
|
|
**/
|
|
|
|
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
|
|
|
// The License.txt file describes the conditions under which this software may be distributed.
|
|
|
|
|
|
|
|
#ifndef VIEWSTYLE_H
|
|
|
|
#define VIEWSTYLE_H
|
|
|
|
|
|
|
|
#ifdef SCI_NAMESPACE
|
|
|
|
namespace Scintilla {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
class MarginStyle {
|
|
|
|
public:
|
|
|
|
int style;
|
|
|
|
int width;
|
|
|
|
int mask;
|
|
|
|
bool sensitive;
|
2011-03-22 00:16:49 +00:00
|
|
|
int cursor;
|
2009-04-24 23:35:41 +00:00
|
|
|
MarginStyle();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
class FontNames {
|
|
|
|
private:
|
2013-08-28 00:44:27 +00:00
|
|
|
std::vector<char *> names;
|
2009-04-24 23:35:41 +00:00
|
|
|
|
2013-08-28 00:44:27 +00:00
|
|
|
// Private so FontNames objects can not be copied
|
|
|
|
FontNames(const FontNames &);
|
2009-04-24 23:35:41 +00:00
|
|
|
public:
|
|
|
|
FontNames();
|
|
|
|
~FontNames();
|
|
|
|
void Clear();
|
|
|
|
const char *Save(const char *name);
|
|
|
|
};
|
|
|
|
|
2013-08-28 00:44:27 +00:00
|
|
|
class FontRealised : public FontMeasurements {
|
2011-07-17 22:30:49 +00:00
|
|
|
// Private so FontRealised objects can not be copied
|
|
|
|
FontRealised(const FontRealised &);
|
|
|
|
FontRealised &operator=(const FontRealised &);
|
|
|
|
public:
|
|
|
|
Font font;
|
2013-08-28 00:44:27 +00:00
|
|
|
FontRealised();
|
2011-07-17 22:30:49 +00:00
|
|
|
virtual ~FontRealised();
|
2013-08-28 00:44:27 +00:00
|
|
|
void Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs);
|
2011-07-17 22:30:49 +00:00
|
|
|
};
|
|
|
|
|
2009-04-24 23:35:41 +00:00
|
|
|
enum IndentView {ivNone, ivReal, ivLookForward, ivLookBoth};
|
|
|
|
|
|
|
|
enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterIndent=2};
|
|
|
|
|
2013-08-28 00:44:27 +00:00
|
|
|
typedef std::map<FontSpecification, FontRealised *> FontMap;
|
|
|
|
|
2015-06-07 21:19:26 +00:00
|
|
|
enum WrapMode { eWrapNone, eWrapWord, eWrapChar, eWrapWhitespace };
|
|
|
|
|
|
|
|
class ColourOptional : public ColourDesired {
|
|
|
|
public:
|
|
|
|
bool isSet;
|
|
|
|
ColourOptional(ColourDesired colour_=ColourDesired(0,0,0), bool isSet_=false) : ColourDesired(colour_), isSet(isSet_) {
|
|
|
|
}
|
|
|
|
ColourOptional(uptr_t wParam, sptr_t lParam) : ColourDesired(static_cast<long>(lParam)), isSet(wParam != 0) {
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ForeBackColours {
|
|
|
|
ColourOptional fore;
|
|
|
|
ColourOptional back;
|
|
|
|
};
|
|
|
|
|
2009-04-24 23:35:41 +00:00
|
|
|
/**
|
|
|
|
*/
|
|
|
|
class ViewStyle {
|
|
|
|
FontNames fontNames;
|
2013-08-28 00:44:27 +00:00
|
|
|
FontMap fonts;
|
|
|
|
public:
|
|
|
|
std::vector<Style> styles;
|
|
|
|
size_t nextExtendedStyle;
|
2009-04-24 23:35:41 +00:00
|
|
|
LineMarker markers[MARKER_MAX + 1];
|
2013-08-28 00:44:27 +00:00
|
|
|
int largestMarkerHeight;
|
2009-04-24 23:35:41 +00:00
|
|
|
Indicator indicators[INDIC_MAX + 1];
|
2015-06-07 21:19:26 +00:00
|
|
|
unsigned int indicatorsDynamic;
|
|
|
|
unsigned int indicatorsSetFore;
|
2013-08-28 00:44:27 +00:00
|
|
|
int technology;
|
2009-04-24 23:35:41 +00:00
|
|
|
int lineHeight;
|
2015-06-07 21:19:26 +00:00
|
|
|
int lineOverlap;
|
2009-04-24 23:35:41 +00:00
|
|
|
unsigned int maxAscent;
|
|
|
|
unsigned int maxDescent;
|
2013-08-28 00:44:27 +00:00
|
|
|
XYPOSITION aveCharWidth;
|
|
|
|
XYPOSITION spaceWidth;
|
2015-06-07 21:19:26 +00:00
|
|
|
XYPOSITION tabWidth;
|
|
|
|
ForeBackColours selColours;
|
2013-08-28 00:44:27 +00:00
|
|
|
ColourDesired selAdditionalForeground;
|
|
|
|
ColourDesired selAdditionalBackground;
|
2015-06-07 21:19:26 +00:00
|
|
|
ColourDesired selBackground2;
|
2009-04-24 23:35:41 +00:00
|
|
|
int selAlpha;
|
2009-08-23 02:24:48 +00:00
|
|
|
int selAdditionalAlpha;
|
2009-04-24 23:35:41 +00:00
|
|
|
bool selEOLFilled;
|
2015-06-07 21:19:26 +00:00
|
|
|
ForeBackColours whitespaceColours;
|
|
|
|
int controlCharSymbol;
|
|
|
|
XYPOSITION controlCharWidth;
|
2013-08-28 00:44:27 +00:00
|
|
|
ColourDesired selbar;
|
|
|
|
ColourDesired selbarlight;
|
2015-06-07 21:19:26 +00:00
|
|
|
ColourOptional foldmarginColour;
|
|
|
|
ColourOptional foldmarginHighlightColour;
|
|
|
|
ForeBackColours hotspotColours;
|
2009-04-24 23:35:41 +00:00
|
|
|
bool hotspotUnderline;
|
|
|
|
bool hotspotSingleLine;
|
|
|
|
/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
|
|
|
|
int leftMarginWidth; ///< Spacing margin on left of text
|
2013-08-28 00:44:27 +00:00
|
|
|
int rightMarginWidth; ///< Spacing margin on right of text
|
2009-04-24 23:35:41 +00:00
|
|
|
int maskInLine; ///< Mask for markers to be put into text because there is nowhere for them to go in margin
|
2013-08-28 00:44:27 +00:00
|
|
|
MarginStyle ms[SC_MAX_MARGIN+1];
|
|
|
|
int fixedColumnWidth; ///< Total width of margins
|
|
|
|
bool marginInside; ///< true: margin included in text view, false: separate views
|
|
|
|
int textStart; ///< Starting x position of text within the view
|
2009-04-24 23:35:41 +00:00
|
|
|
int zoomLevel;
|
|
|
|
WhiteSpaceVisibility viewWhitespace;
|
2010-07-12 22:19:51 +00:00
|
|
|
int whitespaceSize;
|
2009-04-24 23:35:41 +00:00
|
|
|
IndentView viewIndentationGuides;
|
|
|
|
bool viewEOL;
|
2013-08-28 00:44:27 +00:00
|
|
|
ColourDesired caretcolour;
|
|
|
|
ColourDesired additionalCaretColour;
|
2009-04-24 23:35:41 +00:00
|
|
|
bool showCaretLineBackground;
|
2013-08-28 00:44:27 +00:00
|
|
|
bool alwaysShowCaretLineBackground;
|
|
|
|
ColourDesired caretLineBackground;
|
2009-04-24 23:35:41 +00:00
|
|
|
int caretLineAlpha;
|
2013-08-28 00:44:27 +00:00
|
|
|
ColourDesired edgecolour;
|
2009-04-24 23:35:41 +00:00
|
|
|
int edgeState;
|
|
|
|
int caretStyle;
|
|
|
|
int caretWidth;
|
|
|
|
bool someStylesProtected;
|
2011-03-22 00:16:49 +00:00
|
|
|
bool someStylesForceCase;
|
2010-07-12 22:19:51 +00:00
|
|
|
int extraFontFlag;
|
2009-06-24 19:09:31 +00:00
|
|
|
int extraAscent;
|
|
|
|
int extraDescent;
|
|
|
|
int marginStyleOffset;
|
|
|
|
int annotationVisible;
|
|
|
|
int annotationStyleOffset;
|
2011-07-17 22:30:49 +00:00
|
|
|
bool braceHighlightIndicatorSet;
|
|
|
|
int braceHighlightIndicator;
|
|
|
|
bool braceBadLightIndicatorSet;
|
|
|
|
int braceBadLightIndicator;
|
2015-06-07 21:19:26 +00:00
|
|
|
int theEdge;
|
|
|
|
int marginNumberPadding; // the right-side padding of the number margin
|
|
|
|
int ctrlCharPadding; // the padding around control character text blobs
|
|
|
|
int lastSegItalicsOffset; // the offset so as not to clip italic characters at EOLs
|
|
|
|
|
|
|
|
// Wrapping support
|
|
|
|
WrapMode wrapState;
|
|
|
|
int wrapVisualFlags;
|
|
|
|
int wrapVisualFlagsLocation;
|
|
|
|
int wrapVisualStartIndent;
|
|
|
|
int wrapIndentMode; // SC_WRAPINDENT_FIXED, _SAME, _INDENT
|
2009-04-24 23:35:41 +00:00
|
|
|
|
|
|
|
ViewStyle();
|
|
|
|
ViewStyle(const ViewStyle &source);
|
|
|
|
~ViewStyle();
|
2015-06-07 21:19:26 +00:00
|
|
|
void Init(size_t stylesSize_=256);
|
|
|
|
void Refresh(Surface &surface, int tabInChars);
|
2013-08-28 00:44:27 +00:00
|
|
|
void ReleaseAllExtendedStyles();
|
|
|
|
int AllocateExtendedStyles(int numberStyles);
|
2009-04-24 23:35:41 +00:00
|
|
|
void EnsureStyle(size_t index);
|
|
|
|
void ResetDefaultStyle();
|
|
|
|
void ClearStyles();
|
|
|
|
void SetStyleFontName(int styleIndex, const char *name);
|
|
|
|
bool ProtectionActive() const;
|
2015-06-07 21:19:26 +00:00
|
|
|
int ExternalMarginWidth() const;
|
2009-06-24 19:09:31 +00:00
|
|
|
bool ValidStyle(size_t styleIndex) const;
|
2013-08-28 00:44:27 +00:00
|
|
|
void CalcLargestMarkerHeight();
|
2015-06-07 21:19:26 +00:00
|
|
|
ColourOptional Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const;
|
|
|
|
bool SelectionBackgroundDrawn() const;
|
|
|
|
bool WhitespaceBackgroundDrawn() const;
|
|
|
|
ColourDesired WrapColour() const;
|
|
|
|
|
|
|
|
bool SetWrapState(int wrapState_);
|
|
|
|
bool SetWrapVisualFlags(int wrapVisualFlags_);
|
|
|
|
bool SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation_);
|
|
|
|
bool SetWrapVisualStartIndent(int wrapVisualStartIndent_);
|
|
|
|
bool SetWrapIndentMode(int wrapIndentMode_);
|
|
|
|
|
2013-08-28 00:44:27 +00:00
|
|
|
private:
|
|
|
|
void AllocStyles(size_t sizeNew);
|
2015-06-07 21:19:26 +00:00
|
|
|
void CreateAndAddFont(const FontSpecification &fs);
|
2013-08-28 00:44:27 +00:00
|
|
|
FontRealised *Find(const FontSpecification &fs);
|
2015-06-07 21:19:26 +00:00
|
|
|
void FindMaxAscentDescent();
|
2013-08-28 00:44:27 +00:00
|
|
|
// Private so can only be copied through copy constructor which ensures font names initialised correctly
|
|
|
|
ViewStyle &operator=(const ViewStyle &);
|
2009-04-24 23:35:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef SCI_NAMESPACE
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|