aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2000-05-15 14:19:52 +0000
committernyamatongwe <unknown>2000-05-15 14:19:52 +0000
commit02e0afd5a9d78f997df5e498550e5b2832ca5aa0 (patch)
treeb5e3048d8416aefd2a461149fbb755f71fc49f39
parente149d7bf98c013bad08a5c7aeb0e652e83042ce2 (diff)
downloadscintilla-mirror-02e0afd5a9d78f997df5e498550e5b2832ca5aa0.tar.gz
Support for different character sets for each style.
-rw-r--r--gtk/PlatGTK.cxx3
-rw-r--r--include/Platform.h2
-rw-r--r--include/Scintilla.h8
-rw-r--r--include/Scintilla.iface8
-rw-r--r--src/CallTip.cxx3
-rw-r--r--src/Editor.cxx16
-rw-r--r--src/Style.cxx18
-rw-r--r--src/Style.h3
-rw-r--r--src/ViewStyle.cxx4
-rw-r--r--win32/PlatWin.cxx4
10 files changed, 55 insertions, 14 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx
index 57004f19f..9c56126a7 100644
--- a/gtk/PlatGTK.cxx
+++ b/gtk/PlatGTK.cxx
@@ -143,7 +143,8 @@ Font::Font() : id(0) {}
Font::~Font() {}
-void Font::Create(const char *faceName, int size, bool bold, bool italic) {
+void Font::Create(const char *faceName, int characterSet, int size, bool bold, bool italic) {
+ // TODO: take notice of characterSet
Release();
char fontspec[300];
fontspec[0] = '\0';
diff --git a/include/Platform.h b/include/Platform.h
index 24c6b8854..5a87c64fe 100644
--- a/include/Platform.h
+++ b/include/Platform.h
@@ -210,7 +210,7 @@ public:
Font();
~Font();
- void Create(const char *faceName, int size, bool bold=false, bool italic=false);
+ void Create(const char *faceName, int characterSet, int size, bool bold, bool italic);
void Release();
FontID GetID() { return id; }
diff --git a/include/Scintilla.h b/include/Scintilla.h
index 2a7f51613..8e52ba59e 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -160,6 +160,10 @@ extern "C" {
#define STYLE_CONTROLCHAR 36
#define STYLE_MAX 127
+#define SC_CHARSET_ANSI 0
+#define SC_CHARSET_DEFAULT 1
+#define SC_CHARSET_RUSSIAN 204
+
#define SCI_STYLECLEARALL SCI_START + 50
#define SCI_STYLESETFORE SCI_START + 51
#define SCI_STYLESETBACK SCI_START + 52
@@ -170,6 +174,7 @@ extern "C" {
#define SCI_STYLESETEOLFILLED SCI_START + 57
#define SCI_STYLERESETDEFAULT SCI_START + 58
#define SCI_STYLESETUNDERLINE SCI_START + 59
+#define SCI_STYLESETCHARACTERSET SCI_START + 66
#define SCI_SETSELFORE SCI_START + 67
#define SCI_SETSELBACK SCI_START + 68
@@ -344,6 +349,9 @@ extern "C" {
#define SCI_SETZOOM SCI_START + 373
#define SCI_GETZOOM SCI_START + 374
+#define SCI_ADDREFDOC SCI_START + 375
+#define SCI_RELEASEDOC SCI_START + 376
+
// GTK+ Specific
#define SCI_GRABFOCUS SCI_START + 400
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index af4a9583b..5187070c5 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -280,6 +280,9 @@ fun void StyleResetDefault=2058(,)
# Set a style to be underlined or not.
set void StyleSetUnderline=2059(int style, bool underline)
+# Set the character set of the font in a style.
+set void StyleSetCharacterSet=2066(int style, int characterSet)
+
# Set the foreground colour of the selection and whether to use this setting.
fun void SetSelFore=2067(bool useSetting, colour fore)
@@ -701,6 +704,11 @@ set void SetZoom=2373(int zoom,)
# Retrieve the zoom level.
get int GetZoom=2374(,)
+# Extend life of document.
+fun void AddRefDoc=2375(, int doc)
+# Release a reference to the document, deleting document if it fades to black.
+fun void ReleaseDoc=2376(, int doc)
+
# Set the focus to this Scintilla widget.
fun void GrabFocus=2400(,)
diff --git a/src/CallTip.cxx b/src/CallTip.cxx
index ad6740208..d22a96364 100644
--- a/src/CallTip.cxx
+++ b/src/CallTip.cxx
@@ -8,6 +8,7 @@
#include "Platform.h"
+#include "Scintilla.h"
#include "CallTip.h"
CallTip::CallTip() {
@@ -117,7 +118,7 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
Surface surfaceMeasure;
surfaceMeasure.Init();
int deviceHeight = (size * surfaceMeasure.LogPixelsY()) / 72;
- font.Create(faceName, deviceHeight);
+ font.Create(faceName, SC_CHARSET_DEFAULT, deviceHeight, false, false);
if (val)
delete []val;
val = new char[strlen(defn) + 1];
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 37400f9ba..ad8bab8c5 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -3591,12 +3591,18 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
vs.styles[wParam].underline = lParam;
InvalidateStyleRedraw();
}
+ break;
+ case SCI_STYLESETCHARACTERSET:
+ if (wParam <= STYLE_MAX) {
+ vs.styles[wParam].characterSet = lParam;
+ InvalidateStyleRedraw();
+ }
+ break;
case SCI_STYLERESETDEFAULT:
vs.ResetDefaultStyle();
InvalidateStyleRedraw();
break;
-
case SCI_SETSTYLEBITS:
pdoc->SetStylingBits(wParam);
break;
@@ -3883,6 +3889,14 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
SetDocPointer(reinterpret_cast<Document *>(lParam));
return 0;
+ case SCI_ADDREFDOC:
+ (reinterpret_cast<Document *>(lParam))->AddRef();
+ break;
+
+ case SCI_RELEASEDOC:
+ (reinterpret_cast<Document *>(lParam))->Release();
+ break;
+
case SCI_SETMODEVENTMASK:
modEventMask = wParam;
return 0;
diff --git a/src/Style.cxx b/src/Style.cxx
index 2fea6898d..7aa44c0eb 100644
--- a/src/Style.cxx
+++ b/src/Style.cxx
@@ -7,21 +7,23 @@
#include "Platform.h"
+#include "Scintilla.h"
#include "Style.h"
Style::Style() {
aliasOfDefaultFont = true;
Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
- Platform::DefaultFontSize(), 0,
+ Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT,
false, false, false, false);
}
Style::Style(const Style &source) {
Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
- 0, 0,
+ 0, 0, 0,
false, false, false, false);
fore.desired = source.fore.desired;
back.desired = source.back.desired;
+ characterSet = source.characterSet;
bold = source.bold;
italic = source.italic;
size = source.size;
@@ -41,10 +43,11 @@ Style &Style::operator=(const Style &source) {
if (this == &source)
return *this;
Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
- 0, 0,
+ 0, 0, SC_CHARSET_DEFAULT,
false, false, false, false);
fore.desired = source.fore.desired;
back.desired = source.back.desired;
+ characterSet = source.characterSet;
bold = source.bold;
italic = source.italic;
size = source.size;
@@ -53,10 +56,12 @@ Style &Style::operator=(const Style &source) {
return *this;
}
-void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_,
+void Style::Clear(Colour fore_, Colour back_, int size_,
+ const char *fontName_, int characterSet_,
bool bold_, bool italic_, bool eolFilled_, bool underline_) {
fore.desired = fore_;
back.desired = back_;
+ characterSet = characterSet_;
bold = bold_;
italic = italic_;
size = size_;
@@ -73,7 +78,8 @@ void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_,
bool Style::EquivalentFontTo(const Style *other) const {
if (bold != other->bold ||
italic != other->italic ||
- size != other->size)
+ size != other->size ||
+ characterSet != other->characterSet)
return false;
if (fontName == other->fontName)
return true;
@@ -99,7 +105,7 @@ void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) {
if (aliasOfDefaultFont) {
font.SetID(defaultStyle->font.GetID());
} else if (fontName) {
- font.Create(fontName, deviceHeight, bold, italic);
+ font.Create(fontName, characterSet, deviceHeight, bold, italic);
} else {
font.SetID(0);
}
diff --git a/src/Style.h b/src/Style.h
index a8a0a859a..dc643d08d 100644
--- a/src/Style.h
+++ b/src/Style.h
@@ -15,6 +15,7 @@ public:
bool italic;
int size;
const char *fontName;
+ int characterSet;
bool eolFilled;
bool underline;
@@ -32,7 +33,7 @@ public:
Style &operator=(const Style &source);
void Clear(Colour fore_, Colour back_,
int size_,
- const char *fontName_,
+ const char *fontName_, int characterSet_,
bool bold_, bool italic_, bool eolFilled_, bool underline_);
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 5fac88cea..580ecc71f 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -201,7 +201,8 @@ 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);
}
@@ -214,6 +215,7 @@ void ViewStyle::ClearStyles() {
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,
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 7bc9fc8c3..e9174e9df 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -128,7 +128,7 @@ Font::Font() {
Font::~Font() {
}
-void Font::Create(const char *faceName, int size, bool bold, bool italic) {
+void Font::Create(const char *faceName, int characterSet, int size, bool bold, bool italic) {
Release();
LOGFONT lf;
@@ -137,7 +137,7 @@ void Font::Create(const char *faceName, int size, bool bold, bool italic) {
lf.lfHeight = -(abs(size));
lf.lfWeight = bold ? FW_BOLD : FW_NORMAL;
lf.lfItalic = static_cast<BYTE>(italic ? 1 : 0);
- lf.lfCharSet = DEFAULT_CHARSET;
+ lf.lfCharSet = characterSet;
strcpy(lf.lfFaceName, faceName);
id = ::CreateFontIndirect(&lf);