aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/Platform.h38
-rw-r--r--include/Scintilla.h4
-rw-r--r--include/Scintilla.iface9
-rw-r--r--src/AutoComplete.cxx4
-rw-r--r--src/AutoComplete.h2
-rw-r--r--src/CallTip.cxx8
-rw-r--r--src/CallTip.h2
-rw-r--r--src/Editor.cxx76
-rw-r--r--src/Editor.h8
-rw-r--r--src/ScintillaBase.cxx3
-rw-r--r--src/ViewStyle.cxx10
-rw-r--r--src/ViewStyle.h3
-rw-r--r--win32/PlatWin.cxx77
-rw-r--r--win32/ScintillaWin.cxx12
14 files changed, 177 insertions, 79 deletions
diff --git a/include/Platform.h b/include/Platform.h
index 6ba87aa7b..499e78e5d 100644
--- a/include/Platform.h
+++ b/include/Platform.h
@@ -291,6 +291,37 @@ public:
/**
* Font management.
*/
+
+struct FontParameters {
+ const char *faceName;
+ float size;
+ int weight;
+ bool italic;
+ int extraFontFlag;
+ int technology;
+ int characterSet;
+
+ FontParameters(
+ const char *faceName_,
+ float size_=10,
+ int weight_=400,
+ bool italic_=false,
+ int extraFontFlag_=0,
+ int technology_=0,
+ int characterSet_=0) :
+
+ faceName(faceName_),
+ size(size_),
+ weight(weight_),
+ italic(italic_),
+ extraFontFlag(extraFontFlag_),
+ technology(technology_),
+ characterSet(characterSet_)
+ {
+ }
+
+};
+
class Font {
protected:
FontID fid;
@@ -304,8 +335,7 @@ public:
Font();
virtual ~Font();
- virtual void Create(const char *faceName, int characterSet, float size,
- int weight, bool italic, int extraFontFlag=0);
+ virtual void Create(const FontParameters &fp);
virtual void Release();
FontID GetID() { return fid; }
@@ -329,7 +359,7 @@ private:
public:
Surface() {}
virtual ~Surface() {}
- static Surface *Allocate();
+ static Surface *Allocate(int technology);
virtual void Init(WindowID wid)=0;
virtual void Init(SurfaceID sid, WindowID wid)=0;
@@ -443,7 +473,7 @@ public:
static ListBox *Allocate();
virtual void SetFont(Font &font)=0;
- virtual void Create(Window &parent, int ctrlID, Point location, int lineHeight_, bool unicodeMode_)=0;
+ virtual void Create(Window &parent, int ctrlID, Point location, int lineHeight_, bool unicodeMode_, int technology_)=0;
virtual void SetAverageCharWidth(int width)=0;
virtual void SetVisibleRows(int rows)=0;
virtual int GetVisibleRows() const=0;
diff --git a/include/Scintilla.h b/include/Scintilla.h
index c7b9944d8..0aec0c8df 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -827,6 +827,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_REGISTERRGBAIMAGE 2627
#define SCI_SCROLLTOSTART 2628
#define SCI_SCROLLTOEND 2629
+#define SC_TECHNOLOGY_DEFAULT 0
+#define SC_TECHNOLOGY_DIRECTWRITE 0
+#define SCI_SETTECHNOLOGY 2630
+#define SCI_GETTECHNOLOGY 2631
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index c604f621a..a578bf3fc 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -2194,6 +2194,15 @@ fun void ScrollToStart=2628(,)
# Scroll to end of document.
fun void ScrollToEnd=2629(,)
+val SC_TECHNOLOGY_DEFAULT=0
+val SC_TECHNOLOGY_DIRECTWRITE=0
+
+# Set the technolgy used.
+set void SetTechnology=2630(int technology,)
+
+# Get the tech.
+get int GetTechnology=2631(,)
+
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
diff --git a/src/AutoComplete.cxx b/src/AutoComplete.cxx
index f6a291fe9..2752ef0c9 100644
--- a/src/AutoComplete.cxx
+++ b/src/AutoComplete.cxx
@@ -50,11 +50,11 @@ bool AutoComplete::Active() const {
void AutoComplete::Start(Window &parent, int ctrlID,
int position, Point location, int startLen_,
- int lineHeight, bool unicodeMode) {
+ int lineHeight, bool unicodeMode, int technology) {
if (active) {
Cancel();
}
- lb->Create(parent, ctrlID, location, lineHeight, unicodeMode);
+ lb->Create(parent, ctrlID, location, lineHeight, unicodeMode, technology);
lb->Clear();
active = true;
startLen = startLen_;
diff --git a/src/AutoComplete.h b/src/AutoComplete.h
index f48cb0551..aefab120a 100644
--- a/src/AutoComplete.h
+++ b/src/AutoComplete.h
@@ -40,7 +40,7 @@ public:
/// Display the auto completion list positioned to be near a character position
void Start(Window &parent, int ctrlID, int position, Point location,
- int startLen_, int lineHeight, bool unicodeMode);
+ int startLen_, int lineHeight, bool unicodeMode, int technology);
/// The stop chars are characters which, when typed, cause the auto completion list to disappear
void SetStopChars(const char *stopChars_);
diff --git a/src/CallTip.cxx b/src/CallTip.cxx
index 6fd11730d..0e1e80cc1 100644
--- a/src/CallTip.cxx
+++ b/src/CallTip.cxx
@@ -255,14 +255,15 @@ void CallTip::MouseClick(Point pt) {
PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
const char *faceName, int size,
- int codePage_, int characterSet, Window &wParent) {
+ int codePage_, int characterSet,
+ int technology, Window &wParent) {
clickPlace = 0;
delete []val;
val = 0;
val = new char[strlen(defn) + 1];
strcpy(val, defn);
codePage = codePage_;
- Surface *surfaceMeasure = Surface::Allocate();
+ Surface *surfaceMeasure = Surface::Allocate(technology);
if (!surfaceMeasure)
return PRectangle();
surfaceMeasure->Init(wParent.GetID());
@@ -273,7 +274,8 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
inCallTipMode = true;
posStartCallTip = pos;
int deviceHeight = surfaceMeasure->DeviceHeightFont(size);
- font.Create(faceName, characterSet, deviceHeight / SC_FONT_SIZE_MULTIPLIER, SC_WEIGHT_NORMAL, false);
+ FontParameters fp(faceName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, SC_WEIGHT_NORMAL, false, 0, technology, characterSet);
+ font.Create(fp);
// Look for multiple lines in the text
// Only support \n here - simply means container must avoid \r!
int numLines = 1;
diff --git a/src/CallTip.h b/src/CallTip.h
index a9ba82eb8..e437f3309 100644
--- a/src/CallTip.h
+++ b/src/CallTip.h
@@ -62,7 +62,7 @@ public:
/// Setup the calltip and return a rectangle of the area required.
PRectangle CallTipStart(int pos, Point pt, const char *defn,
const char *faceName, int size, int codePage_,
- int characterSet, Window &wParent);
+ int characterSet, int technology, Window &wParent);
void CallTipCancel();
diff --git a/src/Editor.cxx b/src/Editor.cxx
index f5649ce11..74698a13d 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -102,7 +102,8 @@ Editor::Editor() {
ctrlID = 0;
stylesValid = false;
-
+ technology = SC_TECHNOLOGY_DEFAULT;
+
printMagnification = 0;
printColourMode = SC_PRINT_NORMAL;
printWrapState = eWrapWord;
@@ -168,11 +169,11 @@ Editor::Editor() {
additionalCaretsVisible = true;
virtualSpaceOptions = SCVS_NONE;
- pixmapLine = Surface::Allocate();
- pixmapSelMargin = Surface::Allocate();
- pixmapSelPattern = Surface::Allocate();
- pixmapIndentGuide = Surface::Allocate();
- pixmapIndentGuideHighlight = Surface::Allocate();
+ pixmapLine = 0;
+ pixmapSelMargin = 0;
+ pixmapSelPattern = 0;
+ pixmapIndentGuide = 0;
+ pixmapIndentGuideHighlight = 0;
targetStart = 0;
targetEnd = 0;
@@ -226,12 +227,7 @@ Editor::~Editor() {
pdoc->RemoveWatcher(this, 0);
pdoc->Release();
pdoc = 0;
- DropGraphics();
- delete pixmapLine;
- delete pixmapSelMargin;
- delete pixmapSelPattern;
- delete pixmapIndentGuide;
- delete pixmapIndentGuideHighlight;
+ DropGraphics(true);
}
void Editor::Finalise() {
@@ -239,17 +235,50 @@ void Editor::Finalise() {
CancelModes();
}
-void Editor::DropGraphics() {
- pixmapLine->Release();
- pixmapSelMargin->Release();
- pixmapSelPattern->Release();
- pixmapIndentGuide->Release();
- pixmapIndentGuideHighlight->Release();
+void Editor::DropGraphics(bool freeObjects) {
+ if (freeObjects) {
+ delete pixmapLine;
+ pixmapLine = 0;
+ delete pixmapSelMargin;
+ pixmapSelMargin = 0;
+ delete pixmapSelPattern;
+ pixmapSelPattern = 0;
+ delete pixmapIndentGuide;
+ pixmapIndentGuide = 0;
+ delete pixmapIndentGuideHighlight;
+ pixmapIndentGuideHighlight = 0;
+ } else {
+ if (pixmapLine)
+ pixmapLine->Release();
+ if (pixmapSelMargin)
+ pixmapSelMargin->Release();
+ if (pixmapSelPattern)
+ pixmapSelPattern->Release();
+ if (pixmapIndentGuide)
+ pixmapIndentGuide->Release();
+ if (pixmapIndentGuideHighlight)
+ pixmapIndentGuideHighlight->Release();
+ }
+}
+
+void Editor::AllocateGraphics() {
+ if (!pixmapLine)
+ pixmapLine = Surface::Allocate(technology);
+ if (!pixmapSelMargin)
+ pixmapSelMargin = Surface::Allocate(technology);
+ if (!pixmapSelPattern)
+ pixmapSelPattern = Surface::Allocate(technology);
+ if (!pixmapIndentGuide)
+ pixmapIndentGuide = Surface::Allocate(technology);
+ if (!pixmapIndentGuideHighlight)
+ pixmapIndentGuideHighlight = Surface::Allocate(technology);
}
void Editor::InvalidateStyleData() {
stylesValid = false;
- DropGraphics();
+ vs.technology = technology;
+ DropGraphics(false);
+ AllocateGraphics();
palette.Release();
llc.Invalidate(LineLayout::llInvalid);
posCache.Clear();
@@ -3926,7 +3955,7 @@ void Editor::SetScrollBars() {
}
void Editor::ChangeSize() {
- DropGraphics();
+ DropGraphics(false);
SetScrollBars();
if (wrapState != eWrapNone) {
PRectangle rcTextArea = GetClientRectangle();
@@ -9218,6 +9247,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_GETIDENTIFIER:
return GetCtrlID();
+ case SCI_SETTECHNOLOGY:
+ // No action by default
+ break;
+
+ case SCI_GETTECHNOLOGY:
+ return technology;
+
default:
return DefWndProc(iMessage, wParam, lParam);
}
diff --git a/src/Editor.h b/src/Editor.h
index f1a500b74..7a30fdf3f 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -131,6 +131,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
* When a style attribute is changed, this cache is flushed. */
bool stylesValid;
ViewStyle vs;
+ int technology;
Point sizeRGBAImage;
Palette palette;
@@ -279,7 +280,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
void InvalidateStyleRedraw();
virtual void RefreshColourPalette(Palette &pal, bool want);
void RefreshStyleData();
- void DropGraphics();
+ void DropGraphics(bool freeObjects);
+ void AllocateGraphics();
virtual PRectangle GetClientRectangle();
PRectangle GetTextRectangle();
@@ -574,7 +576,7 @@ private:
public:
AutoSurface(Editor *ed) : surf(0) {
if (ed->wMain.GetID()) {
- surf = Surface::Allocate();
+ surf = Surface::Allocate(ed->technology);
if (surf) {
surf->Init(ed->wMain.GetID());
surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage());
@@ -584,7 +586,7 @@ public:
}
AutoSurface(SurfaceID sid, Editor *ed) : surf(0) {
if (ed->wMain.GetID()) {
- surf = Surface::Allocate();
+ surf = Surface::Allocate(ed->technology);
if (surf) {
surf->Init(sid, ed->wMain.GetID());
surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage());
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx
index da6b03e0d..247f34c4e 100644
--- a/src/ScintillaBase.cxx
+++ b/src/ScintillaBase.cxx
@@ -222,7 +222,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
}
}
ac.Start(wMain, idAutoComplete, sel.MainCaret(), PointMainCaret(),
- lenEntered, vs.lineHeight, IsUnicodeMode());
+ lenEntered, vs.lineHeight, IsUnicodeMode(), technology);
PRectangle rcClient = GetClientRectangle();
Point pt = LocationFromPosition(sel.MainCaret() - lenEntered);
@@ -419,6 +419,7 @@ void ScintillaBase::CallTipShow(Point pt, const char *defn) {
vs.styles[ctStyle].sizeZoomed,
CodePage(),
vs.styles[ctStyle].characterSet,
+ vs.technology,
wMain);
// If the call-tip window would be out of the client
// space, adjust so it displays above the text.
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index b722f8d02..08164f648 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -86,14 +86,15 @@ FontRealised::~FontRealised() {
frNext = 0;
}
-void FontRealised::Realise(Surface &surface, int zoomLevel) {
+void FontRealised::Realise(Surface &surface, int zoomLevel, int technology) {
PLATFORM_ASSERT(fontName);
sizeZoomed = size + zoomLevel * SC_FONT_SIZE_MULTIPLIER;
if (sizeZoomed <= 2 * SC_FONT_SIZE_MULTIPLIER) // Hangs if sizeZoomed <= 1
sizeZoomed = 2 * SC_FONT_SIZE_MULTIPLIER;
float deviceHeight = surface.DeviceHeightFont(sizeZoomed);
- font.Create(fontName, characterSet, deviceHeight / SC_FONT_SIZE_MULTIPLIER, weight, italic, extraFontFlag);
+ FontParameters fp(fontName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, weight, italic, extraFontFlag, technology, characterSet);
+ font.Create(fp);
ascent = surface.Ascent(font);
descent = surface.Descent(font);
@@ -102,7 +103,7 @@ void FontRealised::Realise(Surface &surface, int zoomLevel) {
aveCharWidth = surface.AverageCharWidth(font);
spaceWidth = surface.WidthChar(font, ' ');
if (frNext) {
- frNext->Realise(surface, zoomLevel);
+ frNext->Realise(surface, zoomLevel, technology);
}
}
@@ -239,6 +240,7 @@ void ViewStyle::Init(size_t stylesSize_) {
indicators[2].under = false;
indicators[2].fore = ColourDesired(0xff, 0, 0);
+ technology = SC_TECHNOLOGY_DEFAULT;
lineHeight = 1;
maxAscent = 1;
maxDescent = 1;
@@ -388,7 +390,7 @@ void ViewStyle::Refresh(Surface &surface) {
CreateFont(styles[j]);
}
- frFirst->Realise(surface, zoomLevel);
+ frFirst->Realise(surface, zoomLevel, technology);
for (unsigned int k=0; k<stylesSize; k++) {
FontRealised *fr = frFirst->Find(styles[k]);
diff --git a/src/ViewStyle.h b/src/ViewStyle.h
index b038a9b54..b15b9163c 100644
--- a/src/ViewStyle.h
+++ b/src/ViewStyle.h
@@ -48,7 +48,7 @@ public:
FontRealised *frNext;
FontRealised(const FontSpecification &fs);
virtual ~FontRealised();
- void Realise(Surface &surface, int zoomLevel);
+ void Realise(Surface &surface, int zoomLevel, int technology);
FontRealised *Find(const FontSpecification &fs);
void FindMaxAscentDescent(unsigned int &maxAscent, unsigned int &maxDescent);
};
@@ -67,6 +67,7 @@ public:
Style *styles;
LineMarker markers[MARKER_MAX + 1];
Indicator indicators[INDIC_MAX + 1];
+ int technology;
int lineHeight;
unsigned int maxAscent;
unsigned int maxDescent;
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 8a198eb4b..6304d2e5e 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -321,14 +321,14 @@ static void SetLogFont(LOGFONTA &lf, const char *faceName, int characterSet, flo
* If one font is the same as another, its hash will be the same, but if the hash is the
* same then they may still be different.
*/
-static int HashFont(const char *faceName, int characterSet, float size, int weight, bool italic, int extraFontFlag) {
+static int HashFont(const FontParameters &fp) {
return
- static_cast<int>(size) ^
- (characterSet << 10) ^
- ((extraFontFlag & SC_EFF_QUALITY_MASK) << 9) ^
- ((weight/100) << 12) ^
- (italic ? 0x20000000 : 0) ^
- faceName[0];
+ static_cast<int>(fp.size) ^
+ (fp.characterSet << 10) ^
+ ((fp.extraFontFlag & SC_EFF_QUALITY_MASK) << 9) ^
+ ((fp.weight/100) << 12) ^
+ (fp.italic ? 0x20000000 : 0) ^
+ fp.faceName[0];
}
class FontCached : Font {
@@ -337,33 +337,33 @@ class FontCached : Font {
float size;
LOGFONTA lf;
int hash;
- FontCached(const char *faceName_, int characterSet_, float size_, int weight_, bool italic_, int extraFontFlag_);
+ FontCached(const FontParameters &fp);
~FontCached() {}
- bool SameAs(const char *faceName_, int characterSet_, float size_, int weight_, bool italic_, int extraFontFlag_);
+ bool SameAs(const FontParameters &fp);
virtual void Release();
static FontCached *first;
public:
- static FontID FindOrCreate(const char *faceName_, int characterSet_, float size_, int weight_, bool italic_, int extraFontFlag_);
+ static FontID FindOrCreate(const FontParameters &fp);
static void ReleaseId(FontID fid_);
};
FontCached *FontCached::first = 0;
-FontCached::FontCached(const char *faceName_, int characterSet_, float size_, int weight_, bool italic_, int extraFontFlag_) :
+FontCached::FontCached(const FontParameters &fp) :
next(0), usage(0), size(1.0), hash(0) {
- SetLogFont(lf, faceName_, characterSet_, size_, weight_, italic_, extraFontFlag_);
- hash = HashFont(faceName_, characterSet_, size_, weight_, italic_, extraFontFlag_);
+ SetLogFont(lf, fp.faceName, fp.characterSet, fp.size, fp.weight, fp.italic, fp.extraFontFlag);
+ hash = HashFont(fp);
fid = 0;
if (pIDWriteFactory) {
IDWriteTextFormat *pTextFormat;
const int faceSize = 200;
WCHAR wszFace[faceSize];
- UTF16FromUTF8(faceName_, strlen(faceName_)+1, wszFace, faceSize);
- FLOAT fHeight = size_;
- DWRITE_FONT_STYLE style = italic_ ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL;
+ UTF16FromUTF8(fp.faceName, strlen(fp.faceName)+1, wszFace, faceSize);
+ FLOAT fHeight = fp.size;
+ DWRITE_FONT_STYLE style = fp.italic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL;
HRESULT hr = pIDWriteFactory->CreateTextFormat(wszFace, NULL,
- static_cast<DWRITE_FONT_WEIGHT>(weight_),
+ static_cast<DWRITE_FONT_WEIGHT>(fp.weight),
style,
DWRITE_FONT_STRETCH_NORMAL, fHeight, L"en-us", &pTextFormat);
if (SUCCEEDED(hr)) {
@@ -385,20 +385,20 @@ FontCached::FontCached(const char *faceName_, int characterSet_, float size_, in
}
pTextLayout->Release();
}
- fid = reinterpret_cast<void *>(new FormatAndMetrics(pTextFormat, extraFontFlag_, yAscent, yDescent));
+ fid = reinterpret_cast<void *>(new FormatAndMetrics(pTextFormat, fp.extraFontFlag, yAscent, yDescent));
}
}
usage = 1;
}
-bool FontCached::SameAs(const char *faceName_, int characterSet_, float size_, int weight_, bool italic_, int extraFontFlag_) {
+bool FontCached::SameAs(const FontParameters &fp) {
return
- (size == size_) &&
- (lf.lfWeight == weight_) &&
- (lf.lfItalic == static_cast<BYTE>(italic_ ? 1 : 0)) &&
- (lf.lfCharSet == characterSet_) &&
- (lf.lfQuality == Win32MapFontQuality(extraFontFlag_)) &&
- 0 == strcmp(lf.lfFaceName,faceName_);
+ (size == fp.size) &&
+ (lf.lfWeight == fp.weight) &&
+ (lf.lfItalic == static_cast<BYTE>(fp.italic ? 1 : 0)) &&
+ (lf.lfCharSet == fp.characterSet) &&
+ (lf.lfQuality == Win32MapFontQuality(fp.extraFontFlag)) &&
+ 0 == strcmp(lf.lfFaceName,fp.faceName);
}
void FontCached::Release() {
@@ -406,19 +406,19 @@ void FontCached::Release() {
fid = 0;
}
-FontID FontCached::FindOrCreate(const char *faceName_, int characterSet_, float size_, int weight_, bool italic_, int extraFontFlag_) {
+FontID FontCached::FindOrCreate(const FontParameters &fp) {
FontID ret = 0;
::EnterCriticalSection(&crPlatformLock);
- int hashFind = HashFont(faceName_, characterSet_, size_, weight_, italic_, extraFontFlag_);
+ int hashFind = HashFont(fp);
for (FontCached *cur=first; cur; cur=cur->next) {
if ((cur->hash == hashFind) &&
- cur->SameAs(faceName_, characterSet_, size_, weight_, italic_, extraFontFlag_)) {
+ cur->SameAs(fp)) {
cur->usage++;
ret = cur->fid;
}
}
if (ret == 0) {
- FontCached *fc = new FontCached(faceName_, characterSet_, size_, weight_, italic_, extraFontFlag_);
+ FontCached *fc = new FontCached(fp);
if (fc) {
fc->next = first;
first = fc;
@@ -457,11 +457,10 @@ Font::~Font() {
#define FONTS_CACHED
-void Font::Create(const char *faceName, int characterSet, float size,
- int weight, bool italic, int extraFontFlag) {
+void Font::Create(const FontParameters &fp) {
Release();
- if (faceName)
- fid = FontCached::FindOrCreate(faceName, characterSet, size, weight, italic, extraFontFlag);
+ if (fp.faceName)
+ fid = FontCached::FindOrCreate(fp);
}
void Font::Release() {
@@ -1203,7 +1202,7 @@ void SurfaceImpl::SetDBCSMode(int codePage_) {
win9xACPSame = !IsNT() && ((unsigned int)codePage == ::GetACP());
}
-Surface *Surface::Allocate() {
+Surface *Surface::Allocate(int /* technology */) {
return new SurfaceImpl;
}
@@ -1514,6 +1513,7 @@ ListBox::~ListBox() {
class ListBoxX : public ListBox {
int lineHeight;
FontID fontCopy;
+ int technology;
RGBAImageSet images;
LineToItem lti;
HWND lb;
@@ -1555,7 +1555,7 @@ class ListBoxX : public ListBox {
static const Point ImageInset; // Padding around image
public:
- ListBoxX() : lineHeight(10), fontCopy(0), lb(0), unicodeMode(false),
+ ListBoxX() : lineHeight(10), fontCopy(0), technology(0), lb(0), unicodeMode(false),
desiredVisibleRows(5), maxItemCharacters(0), aveCharWidth(8),
parent(NULL), ctrlID(0), doubleClickAction(NULL), doubleClickActionData(NULL),
widestItem(NULL), maxCharWidth(1), resizeHit(0) {
@@ -1567,7 +1567,7 @@ public:
}
}
virtual void SetFont(Font &font);
- virtual void Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_);
+ virtual void Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_, int technology_);
virtual void SetAverageCharWidth(int width);
virtual void SetVisibleRows(int rows);
virtual int GetVisibleRows() const;
@@ -1602,12 +1602,13 @@ ListBox *ListBox::Allocate() {
return lb;
}
-void ListBoxX::Create(Window &parent_, int ctrlID_, Point location_, int lineHeight_, bool unicodeMode_) {
+void ListBoxX::Create(Window &parent_, int ctrlID_, Point location_, int lineHeight_, bool unicodeMode_, int technology_) {
parent = &parent_;
ctrlID = ctrlID_;
location = location_;
lineHeight = lineHeight_;
unicodeMode = unicodeMode_;
+ technology = technology_;
HWND hwndParent = reinterpret_cast<HWND>(parent->GetID());
HINSTANCE hinstanceParent = GetWindowInstance(hwndParent);
// Window created as popup so not clipped within parent client area
@@ -1800,7 +1801,7 @@ void ListBoxX::Draw(DRAWITEMSTRUCT *pDrawItem) {
// Draw the image, if any
RGBAImage *pimage = images.Get(pixId);
if (pimage) {
- Surface *surfaceItem = Surface::Allocate();
+ Surface *surfaceItem = Surface::Allocate(technology);
if (surfaceItem) {
if (pD2DFactory) {
D2D1_RENDER_TARGET_PROPERTIES props = D2D1::RenderTargetProperties(
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 28a630246..b3b9d1bb0 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -1127,6 +1127,16 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
case SCI_GETKEYSUNICODE:
return keysAlwaysUnicode;
+
+ case SCI_SETTECHNOLOGY:
+ if ((wParam == SC_TECHNOLOGY_DEFAULT) || (wParam == SC_TECHNOLOGY_DIRECTWRITE)) {
+ if (technology != static_cast<int>(wParam)) {
+ technology = wParam;
+ // Invalidate all cached information including layout.
+ InvalidateStyleRedraw();
+ }
+ }
+ break;
#ifdef SCI_LEXER
case SCI_LOADLEXERLIBRARY:
@@ -2751,7 +2761,7 @@ sptr_t PASCAL ScintillaWin::CTWndProc(
} else if (iMessage == WM_PAINT) {
PAINTSTRUCT ps;
::BeginPaint(hWnd, &ps);
- Surface *surfaceWindow = Surface::Allocate();
+ Surface *surfaceWindow = Surface::Allocate(sciThis->technology);
if (surfaceWindow) {
ID2D1HwndRenderTarget *pCTRenderTarget = 0;
RECT rc;