diff options
author | Neil <nyamatongwe@gmail.com> | 2013-08-08 17:59:56 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2013-08-08 17:59:56 +1000 |
commit | feff84c70259ab4faabbf066ba38337646dff9ef (patch) | |
tree | 13297a87356f3dcb5bc6ab415fff9cce9986d06c /src/ViewStyle.cxx | |
parent | 3698dbe9ada24cea2b6a6c4c07428e9a457a6b51 (diff) | |
download | scintilla-mirror-feff84c70259ab4faabbf066ba38337646dff9ef.tar.gz |
Move functionality from Editor to ViewStyle.
controlCharSymbol setting moved along with calculated fields for tab
width and control symbols.
Use of TextSegment simplified and variables made const where possible.
Diffstat (limited to 'src/ViewStyle.cxx')
-rw-r--r-- | src/ViewStyle.cxx | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 8d2a60e14..2c2ac0e66 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -131,6 +131,8 @@ ViewStyle::ViewStyle(const ViewStyle &source) { whitespaceForeground = source.whitespaceForeground; whitespaceBackgroundSet = source.whitespaceBackgroundSet; whitespaceBackground = source.whitespaceBackground; + controlCharSymbol = source.controlCharSymbol; + controlCharWidth = source.controlCharWidth; selbar = source.selbar; selbarlight = source.selbarlight; caretcolour = source.caretcolour; @@ -204,6 +206,7 @@ void ViewStyle::Init(size_t stylesSize_) { maxDescent = 1; aveCharWidth = 8; spaceWidth = 8; + tabWidth = spaceWidth * 8; selforeset = false; selforeground = ColourDesired(0xff, 0, 0); @@ -225,6 +228,8 @@ void ViewStyle::Init(size_t stylesSize_) { whitespaceForeground = ColourDesired(0, 0, 0); whitespaceBackgroundSet = false; whitespaceBackground = ColourDesired(0xff, 0xff, 0xff); + controlCharSymbol = 0; /* Draw the control characters */ + controlCharWidth = 0; selbar = Platform::Chrome(); selbarlight = Platform::ChromeHighlight(); styles[STYLE_LINENUMBER].fore = ColourDesired(0, 0, 0); @@ -286,7 +291,7 @@ void ViewStyle::Init(size_t stylesSize_) { braceBadLightIndicator = 0; } -void ViewStyle::Refresh(Surface &surface) { +void ViewStyle::Refresh(Surface &surface, int tabInChars) { for (FontMap::iterator it = fonts.begin(); it != fonts.end(); ++it) { delete it->second; } @@ -332,6 +337,12 @@ void ViewStyle::Refresh(Surface &surface) { aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth; spaceWidth = styles[STYLE_DEFAULT].spaceWidth; + tabWidth = spaceWidth * tabInChars; + + controlCharWidth = 0.0; + if (controlCharSymbol >= 32) { + controlCharWidth = surface.WidthChar(styles[STYLE_CONTROLCHAR].font, controlCharSymbol); + } fixedColumnWidth = marginInside ? leftMarginWidth : 0; maskInLine = 0xffffffff; @@ -409,6 +420,13 @@ void ViewStyle::CalcLargestMarkerHeight() { } } +ColourDesired ViewStyle::WrapColour() const { + if (whitespaceForegroundSet) + return whitespaceForeground; + else + return styles[STYLE_DEFAULT].fore; +} + void ViewStyle::AllocStyles(size_t sizeNew) { size_t i=styles.size(); styles.resize(sizeNew); |