aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2001-05-22 01:33:04 +0000
committernyamatongwe <unknown>2001-05-22 01:33:04 +0000
commit6c1e837c5ebb40996f9a65dfa925774d5b10a109 (patch)
treed1ea38fe6c47b29083918d7429c9d630d6b83c19 /src
parentd729c7673bc2e71477dcc029ce31f7478f97894a (diff)
downloadscintilla-mirror-6c1e837c5ebb40996f9a65dfa925774d5b10a109.tar.gz
Support for forced upper and lower case styles.
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx10
-rw-r--r--src/Style.cxx27
-rw-r--r--src/Style.h6
-rw-r--r--src/ViewStyle.cxx28
4 files changed, 47 insertions, 24 deletions
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();