diff options
-rw-r--r-- | include/Scintilla.h | 4 | ||||
-rw-r--r-- | include/Scintilla.iface | 6 | ||||
-rw-r--r-- | src/Editor.cxx | 10 | ||||
-rw-r--r-- | src/Style.cxx | 27 | ||||
-rw-r--r-- | src/Style.h | 6 | ||||
-rw-r--r-- | src/ViewStyle.cxx | 28 |
6 files changed, 57 insertions, 24 deletions
diff --git a/include/Scintilla.h b/include/Scintilla.h index b22482cb7..636428e1f 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -145,6 +145,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_STYLESETEOLFILLED 2057 #define SCI_STYLERESETDEFAULT 2058 #define SCI_STYLESETUNDERLINE 2059 +#define SC_CASE_MIXED 0 +#define SC_CASE_UPPER 1 +#define SC_CASE_LOWER 2 +#define SCI_STYLESETCASE 2060 #define SCI_STYLESETCHARACTERSET 2066 #define SCI_SETSELFORE 2067 #define SCI_SETSELBACK 2068 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 884f7332b..1431095c3 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -327,6 +327,12 @@ fun void StyleResetDefault=2058(,) # Set a style to be underlined or not. set void StyleSetUnderline=2059(int style, bool underline) +val SC_CASE_MIXED=0 +val SC_CASE_UPPER=1 +val SC_CASE_LOWER=2 +# Set a style to be mixed case, or to force upper or lower case. +set void StyleSetCase=2060(int style, int caseForce) + # Set the character set of the font in a style. set void StyleSetCharacterSet=2066(int style, int characterSet) diff --git a/src/Editor.cxx b/src/Editor.cxx index d10a8cee0..b455376ae 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -810,6 +810,10 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou ll.chars[numCharsInLine] = chDoc; ll.styles[numCharsInLine] = static_cast<char>(styleByte & styleMask); ll.indicators[numCharsInLine] = static_cast<char>(styleByte & ~styleMask); + if (vstyle.styles[ll.styles[numCharsInLine]].caseForce == Style::caseUpper) + ll.chars[numCharsInLine] = static_cast<char>(toupper(chDoc)); + else if (vstyle.styles[ll.styles[numCharsInLine]].caseForce == Style::caseLower) + ll.chars[numCharsInLine] = static_cast<char>(tolower(chDoc)); numCharsInLine++; } } @@ -4322,6 +4326,12 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { InvalidateStyleRedraw(); } break; + case SCI_STYLESETCASE: + if (wParam <= STYLE_MAX) { + vs.styles[wParam].caseForce = static_cast<Style::ecaseForced>(lParam); + InvalidateStyleRedraw(); + } + break; case SCI_STYLESETCHARACTERSET: if (wParam <= STYLE_MAX) { vs.styles[wParam].characterSet = lParam; diff --git a/src/Style.cxx b/src/Style.cxx index 6ddf76008..4a3526791 100644 --- a/src/Style.cxx +++ b/src/Style.cxx @@ -16,13 +16,13 @@ Style::Style() { aliasOfDefaultFont = true; Clear(Colour(0, 0, 0), Colour(0xff, 0xff, 0xff), Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT, - false, false, false, false, true); + false, false, false, false, caseMixed, true); } Style::Style(const Style &source) { Clear(Colour(0, 0, 0), Colour(0xff, 0xff, 0xff), 0, 0, 0, - false, false, false, false, true); + false, false, false, false, caseMixed, true); fore.desired = source.fore.desired; back.desired = source.back.desired; characterSet = source.characterSet; @@ -31,6 +31,7 @@ Style::Style(const Style &source) { size = source.size; eolFilled = source.eolFilled; underline = source.underline; + caseForce = source.caseForce; visible = source.visible; } @@ -47,7 +48,7 @@ Style &Style::operator=(const Style &source) { return * this; Clear(Colour(0, 0, 0), Colour(0xff, 0xff, 0xff), 0, 0, SC_CHARSET_DEFAULT, - false, false, false, false, true); + false, false, false, false, caseMixed, true); fore.desired = source.fore.desired; back.desired = source.back.desired; characterSet = source.characterSet; @@ -56,13 +57,15 @@ Style &Style::operator=(const Style &source) { size = source.size; eolFilled = source.eolFilled; underline = source.underline; + caseForce = source.caseForce; visible = source.visible; return *this; } void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_, int characterSet_, - bool bold_, bool italic_, bool eolFilled_, bool underline_, bool visible_) { + bool bold_, bool italic_, bool eolFilled_, + bool underline_, ecaseForced caseForce_, bool visible_) { fore.desired = fore_; back.desired = back_; characterSet = characterSet_; @@ -72,6 +75,7 @@ void Style::Clear(Colour fore_, Colour back_, int size_, fontName = fontName_; eolFilled = eolFilled_; underline = underline_; + caseForce = caseForce_; visible = visible_; if (aliasOfDefaultFont) font.SetID(0); @@ -80,6 +84,21 @@ void Style::Clear(Colour fore_, Colour back_, int size_, aliasOfDefaultFont = false; } +void Style::ClearTo(const Style &source) { + Clear( + source.fore.desired, + source.back.desired, + source.size, + source.fontName, + source.characterSet, + source.bold, + source.italic, + source.eolFilled, + source.underline, + source.caseForce, + source.visible); +} + bool Style::EquivalentFontTo(const Style *other) const { if (bold != other->bold || italic != other->italic || diff --git a/src/Style.h b/src/Style.h index 251030990..3600886b3 100644 --- a/src/Style.h +++ b/src/Style.h @@ -22,6 +22,8 @@ public: int characterSet; bool eolFilled; bool underline; + enum ecaseForced {caseMixed, caseUpper, caseLower}; + ecaseForced caseForce; bool visible; Font font; @@ -40,7 +42,9 @@ public: void Clear(Colour fore_, Colour back_, int size_, const char *fontName_, int characterSet_, - bool bold_, bool italic_, bool eolFilled_, bool underline_, bool visible_); + bool bold_, bool italic_, bool eolFilled_, + bool underline_, ecaseForced caseForce_, bool visible_); + void ClearTo(const Style &source); bool EquivalentFontTo(const Style *other) const; void Realise(Surface &surface, int zoomLevel, Style *defaultStyle = 0); }; diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 9d19c418e..4db7e2508 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -15,7 +15,7 @@ #include "Style.h" #include "ViewStyle.h" -MarginStyle::MarginStyle() : +MarginStyle::MarginStyle() : symbol(false), width(16), mask(0xffffffff), sensitive(false) { } @@ -66,7 +66,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) { for (int ind=0;ind<=INDIC_MAX;ind++) { indicators[ind] = source.indicators[ind]; } - + selforeset = source.selforeset; selforeground.desired = source.selforeground.desired; selbackset = source.selbackset; @@ -92,7 +92,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) { viewWhitespace = source.viewWhitespace; viewIndentationGuides = source.viewIndentationGuides; viewEOL = source.viewEOL; - showMarkedLines = source.showMarkedLines; + showMarkedLines = source.showMarkedLines; } ViewStyle::~ViewStyle() { @@ -101,7 +101,7 @@ ViewStyle::~ViewStyle() { void ViewStyle::Init() { fontNames.Clear(); ResetDefaultStyle(); - + indicators[0].style = INDIC_SQUIGGLE; indicators[0].fore = Colour(0, 0x7f, 0); indicators[1].style = INDIC_TT; @@ -130,7 +130,7 @@ void ViewStyle::Init() { edgecolour.desired = Colour(0xc0, 0xc0, 0xc0); edgeState = EDGE_NONE; caretWidth = 1; - + leftMarginWidth = 1; rightMarginWidth = 1; ms[0].symbol = false; @@ -198,7 +198,7 @@ void ViewStyle::Refresh(Surface &surface) { maxDescent = styles[i].descent; } } - + lineHeight = maxAscent + maxDescent; aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth; spaceWidth = styles[STYLE_DEFAULT].spaceWidth; @@ -216,26 +216,16 @@ void ViewStyle::Refresh(Surface &surface) { void ViewStyle::ResetDefaultStyle() { styles[STYLE_DEFAULT].Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), - Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()), + Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()), SC_CHARSET_DEFAULT, - false, false, false, false, true); + false, false, false, false, Style::caseMixed, true); } void ViewStyle::ClearStyles() { // Reset all styles to be like the default style for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) { if (i != STYLE_DEFAULT) { - styles[i].Clear( - styles[STYLE_DEFAULT].fore.desired, - styles[STYLE_DEFAULT].back.desired, - styles[STYLE_DEFAULT].size, - styles[STYLE_DEFAULT].fontName, - styles[STYLE_DEFAULT].characterSet, - styles[STYLE_DEFAULT].bold, - styles[STYLE_DEFAULT].italic, - styles[STYLE_DEFAULT].eolFilled, - styles[STYLE_DEFAULT].underline, - styles[STYLE_DEFAULT].visible); + styles[i].ClearTo(styles[STYLE_DEFAULT]); } } styles[STYLE_LINENUMBER].back.desired = Platform::Chrome(); |