aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/PlatWin.cxx47
-rw-r--r--win32/makefile9
-rw-r--r--win32/makefile_bor15
-rw-r--r--win32/makefile_vc16
4 files changed, 71 insertions, 16 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index f5a4f98e2..17ca7cc03 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -323,12 +323,20 @@ void Surface::Copy(PRectangle rc, Point from, Surface &surfaceSource) {
surfaceSource.hdc, from.x, from.y, SRCCOPY);
}
+#define ASCII_ONLY 1
+
void Surface::DrawText(PRectangle rc, Font &font_, int ybase, const char *s, int len, Colour fore, Colour back) {
SetFont(font_);
::SetTextColor(hdc, fore.AsLong());
::SetBkColor(hdc, back.AsLong());
RECT rcw = RectFromPRectangle(rc);
+#ifdef ASCII_ONLY
::ExtTextOut(hdc, rc.left, ybase, ETO_OPAQUE, &rcw, s, len, NULL);
+#else
+ wchar_t tbuf[20000];
+ int tlen = MultiByteToWideChar(CP_UTF8, 0, s, len, tbuf, sizeof(tbuf));
+ ::ExtTextOutW(hdc, rc.left, ybase, ETO_OPAQUE, &rcw, tbuf, tlen, NULL);
+#endif
}
void Surface::DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, Colour fore, Colour back) {
@@ -336,13 +344,25 @@ void Surface::DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char
::SetTextColor(hdc, fore.AsLong());
::SetBkColor(hdc, back.AsLong());
RECT rcw = RectFromPRectangle(rc);
+#ifdef ASCII_ONLY
::ExtTextOut(hdc, rc.left, ybase, ETO_OPAQUE | ETO_CLIPPED, &rcw, s, len, NULL);
+#else
+ wchar_t tbuf[20000];
+ int tlen = MultiByteToWideChar(CP_UTF8, 0, s, len, tbuf, sizeof(tbuf));
+ ::ExtTextOutW(hdc, rc.left, ybase, ETO_OPAQUE | ETO_CLIPPED, &rcw, tbuf, tlen, NULL);
+#endif
}
int Surface::WidthText(Font &font_, const char *s, int len) {
SetFont(font_);
SIZE sz;
+#ifdef ASCII_ONLY
::GetTextExtentPoint32(hdc, s, len, &sz);
+#else
+ wchar_t tbuf[20000];
+ int tlen = MultiByteToWideChar(CP_UTF8, 0, s, len, tbuf, sizeof(tbuf));
+ ::GetTextExtentPoint32W(hdc, tbuf, tlen, &sz);
+#endif
return sz.cx;
}
@@ -350,7 +370,34 @@ void Surface::MeasureWidths(Font &font_, const char *s, int len, int *positions)
SetFont(font_);
SIZE sz;
int fit = 0;
+#ifdef ASCII_ONLY
::GetTextExtentExPoint(hdc, s, len, 30000, &fit, positions, &sz);
+#else
+ wchar_t tbuf[20000];
+ int poses[20000];
+ int tlen = MultiByteToWideChar(CP_UTF8, 0, s, len, tbuf, sizeof(tbuf));
+ ::GetTextExtentExPointW(hdc, tbuf, tlen, 30000, &fit, poses, &sz);
+ int ui=0;
+ const unsigned char *us = reinterpret_cast<const unsigned char *>(s);
+ int i=0;
+ while (i<len) {
+ positions[i] = poses[ui];
+ if (us[i] < 128) {
+ ui++;
+ } else if (us[i] < (128 + 64 + 32)) {
+ positions[i+1] = poses[ui];
+ ui++;
+ i++;
+ } else {
+ positions[i+1] = poses[ui];
+ positions[i+2] = poses[ui];
+ ui++;
+ i++;
+ i++;
+ }
+ i++;
+ }
+#endif
}
int Surface::WidthChar(Font &font_, char ch) {
diff --git a/win32/makefile b/win32/makefile
index 9dfb6be57..2fc51baae 100644
--- a/win32/makefile
+++ b/win32/makefile
@@ -24,7 +24,7 @@ CXXFLAGS = -pedantic $(INCLUDEDIRS) -Os -fno-exceptions -fvtable-thunks -fno-rtt
.cxx.o:
$(CC) $(CXXFLAGS) -c $< -o $@
-ALL: $(COMPONENT) $(LEXCOMPONENT) ScintillaWinS.o
+ALL: $(COMPONENT) $(LEXCOMPONENT) ScintillaWinS.o WindowAccessor.o
clean:
del /q *.exe *.o *.obj *.dll *.res *.map
@@ -41,17 +41,17 @@ $(COMPONENT): $(SOBJS)
LOBJS = ScintillaWinL.o ScintillaBaseL.o Editor.o Document.o \
ContractionState.o CellBuffer.o CallTip.o \
ScintRes.o PlatWin.o KeyMap.o Indicator.o LineMarker.o Style.o \
- ViewStyle.o AutoComplete.o KeyWords.o Accessor.o PropSet.o $(LEXOBJS)
+ ViewStyle.o AutoComplete.o KeyWords.o DocumentAccessor.o PropSet.o $(LEXOBJS)
$(LEXCOMPONENT): $(LOBJS)
$(DLLWRAP) --target i386-mingw32 -o $(LEXCOMPONENT) $(LOBJS) $(LDFLAGS) -s --relocatable
-Accessor.o: Accessor.cxx Platform.h PropSet.h Accessor.h Scintilla.h
AutoComplete.o: AutoComplete.cxx Platform.h AutoComplete.h
CallTip.o: CallTip.cxx Platform.h CallTip.h
CellBuffer.o: CellBuffer.cxx Platform.h Scintilla.h CellBuffer.h
ContractionState.o: ContractionState.cxx Platform.h ContractionState.h
Document.o: Document.cxx Platform.h Scintilla.h CellBuffer.h \
Document.h
+DocumentAccessor.o: DocumentAccessor.cxx Platform.h PropSet.h Accessor.h DocumentAccessor.h Scintilla.h
Editor.o: Editor.cxx Platform.h Scintilla.h ContractionState.h \
CellBuffer.h KeyMap.h Indicator.h LineMarker.h Style.h ViewStyle.h \
Document.h Editor.h
@@ -83,7 +83,7 @@ ScintillaBase.o: ScintillaBase.cxx Platform.h Scintilla.h \
ScintillaBaseL.o: ScintillaBase.cxx Platform.h Scintilla.h SciLexer.h \
ContractionState.h CellBuffer.h CallTip.h KeyMap.h Indicator.h \
LineMarker.h Style.h AutoComplete.h ViewStyle.h Document.h Editor.h \
- ScintillaBase.h PropSet.h Accessor.h KeyWords.h
+ ScintillaBase.h PropSet.h Accessor.h DocumentAccessor.h KeyWords.h
ScintillaWin.o: ScintillaWin.cxx Platform.h Scintilla.h \
ContractionState.h CellBuffer.h CallTip.h KeyMap.h Indicator.h \
LineMarker.h Style.h AutoComplete.h ViewStyle.h Document.h Editor.h \
@@ -99,6 +99,7 @@ ScintillaWinS.o: ScintillaWin.cxx Platform.h Scintilla.h \
Style.o: Style.cxx Platform.h Style.h
ViewStyle.o: ViewStyle.cxx Platform.h Scintilla.h Indicator.h \
LineMarker.h Style.h ViewStyle.h
+WindowAccessor.o: DocumentAccessor.cxx Platform.h PropSet.h Accessor.h WindowAccessor.h Scintilla.h
ScintillaBaseL.o:
$(CC) $(CXXFLAGS) -D SCI_LEXER -c $< -o ScintillaBaseL.o
diff --git a/win32/makefile_bor b/win32/makefile_bor
index 51234e092..363f7693f 100644
--- a/win32/makefile_bor
+++ b/win32/makefile_bor
@@ -23,7 +23,7 @@ CXXFLAGS = -P -tW -w -RT- -x- -v
.rc.res:
$(RC) /r $*.rc
-ALL: $(COMPONENT) $(LEXCOMPONENT) ScintillaWinS.obj
+ALL: $(COMPONENT) $(LEXCOMPONENT) ScintillaWinS.obj WindowAccessor.obj
clean:
del /q *.exe *.o *.obj *.dll *.res *.map
@@ -40,13 +40,10 @@ LEXOBJS = LexCPP.obj LexHTML.obj LexOthers.obj LexPerl.obj LexPython.obj LexSQL.
LOBJS = ScintillaWinL.obj ScintillaBaseL.obj Editor.obj Document.obj \
ContractionState.obj CellBuffer.obj CallTip.obj \
PlatWin.obj KeyMap.obj Indicator.obj LineMarker.obj Style.obj \
- ViewStyle.obj AutoComplete.obj KeyWords.obj Accessor.obj PropSet.obj $(LEXOBJS)
+ ViewStyle.obj AutoComplete.obj KeyWords.obj DocumentAccessor.obj PropSet.obj $(LEXOBJS)
$(LEXCOMPONENT): $(LOBJS)
$(LD) -Tpd /c c0d32 $(LOBJS), $(LEXCOMPONENT), ,$(LDFLAGS), , ScintRes.res
-Accessor.obj: ..\src\Accessor.cxx ..\include\Platform.h ..\include\PropSet.h ..\include\Accessor.h ..\include\Scintilla.h
- $(CC) $(INCLUDEDIRS) $(CXXFLAGS) -c ..\src\$*.cxx -o$*
-
AutoComplete.obj: ..\src\AutoComplete.cxx ..\include\Platform.h ..\src\AutoComplete.h
$(CC) $(INCLUDEDIRS) $(CXXFLAGS) -c ..\src\$*.cxx -o$*
@@ -63,6 +60,9 @@ Document.obj: ..\src\Document.cxx ..\include\Platform.h ..\include\Scintilla.h .
..\src\Document.h
$(CC) $(INCLUDEDIRS) $(CXXFLAGS) -c ..\src\$*.cxx -o$*
+DocumentAccessor.obj: ..\src\DocumentAccessor.cxx ..\include\Platform.h ..\include\PropSet.h ..\include\Accessor.h ..\src\DocumentAccessor.h ..\include\Scintilla.h
+ $(CC) $(INCLUDEDIRS) $(CXXFLAGS) -c ..\src\$*.cxx -o$*
+
Editor.obj: ..\src\Editor.cxx ..\include\Platform.h ..\include\Scintilla.h ..\src\ContractionState.h \
..\src\CellBuffer.h ..\src\KeyMap.h ..\src\Indicator.h ..\src\LineMarker.h ..\src\Style.h ..\src\ViewStyle.h \
..\src\Document.h ..\src\Editor.h
@@ -123,7 +123,7 @@ ScintillaBase.obj: ..\src\ScintillaBase.cxx ..\include\Platform.h ..\include\Sci
ScintillaBaseL.obj: ..\src\ScintillaBase.cxx ..\include\Platform.h ..\include\Scintilla.h ..\include\SciLexer.h \
..\src\ContractionState.h ..\src\CellBuffer.h ..\src\CallTip.h ..\src\KeyMap.h ..\src\Indicator.h \
..\src\LineMarker.h ..\src\Style.h ..\src\AutoComplete.h ..\src\ViewStyle.h ..\src\Document.h ..\src\Editor.h \
- ..\src\ScintillaBase.h ..\include\PropSet.h ..\include\Accessor.h ..\include\KeyWords.h
+ ..\src\ScintillaBase.h ..\include\PropSet.h ..\include\Accessor.h ..\src\DocumentAccessor.h ..\include\KeyWords.h
$(CC) $(INCLUDEDIRS) $(CXXFLAGS) /DSCI_LEXER -o$* /c ..\src\ScintillaBase.cxx
ScintillaWin.obj: ScintillaWin.cxx ..\include\Platform.h ..\include\Scintilla.h \
@@ -149,3 +149,6 @@ Style.obj: ..\src\Style.cxx ..\include\Platform.h ..\src\Style.h
ViewStyle.obj: ..\src\ViewStyle.cxx ..\include\Platform.h ..\include\Scintilla.h ..\src\Indicator.h \
..\src\LineMarker.h ..\src\Style.h ..\src\ViewStyle.h
$(CC) $(INCLUDEDIRS) $(CXXFLAGS) -c ..\src\$*.cxx -o$@
+
+WindowAccessor.obj: ..\src\WindowAccessor.cxx ..\include\Platform.h ..\include\PropSet.h ..\include\Accessor.h ..\include\WindowAccessor.h ..\include\Scintilla.h
+ $(CC) $(INCLUDEDIRS) $(CXXFLAGS) -c ..\src\$*.cxx -o$*
diff --git a/win32/makefile_vc b/win32/makefile_vc
index c7a31347f..6070cf7ac 100644
--- a/win32/makefile_vc
+++ b/win32/makefile_vc
@@ -32,7 +32,7 @@ CXXFLAGS=$(CXXFLAGS) /Ox /MD
.rc.res:
$(RC) $*.rc
-ALL: $(COMPONENT) $(LEXCOMPONENT) $(DIR_O)\ScintillaWinS.obj
+ALL: $(COMPONENT) $(LEXCOMPONENT) $(DIR_O)\ScintillaWinS.obj $(DIR_O)\WindowAccessor.obj
clean:
del /q $(DIR_O)\*.obj $(COMPONENT) $(LEXCOMPONENT) $(DIR_O)\*.res $(DIR_BIN)\*.map
@@ -61,7 +61,7 @@ LOBJS = $(DIR_O)\ScintillaWinL.obj $(DIR_O)\ScintillaBaseL.obj \
$(DIR_O)\PlatWin.obj $(DIR_O)\KeyMap.obj $(DIR_O)\Indicator.obj \
$(DIR_O)\LineMarker.obj $(DIR_O)\Style.obj \
$(DIR_O)\ViewStyle.obj $(DIR_O)\AutoComplete.obj \
- $(DIR_O)\KeyWords.obj $(DIR_O)\Accessor.obj \
+ $(DIR_O)\KeyWords.obj $(DIR_O)\DocumentAccessor.obj \
$(DIR_O)\PropSet.obj $(LEXOBJS)
$(DIR_O)\ScintRes.res : ScintRes.rc
@@ -70,9 +70,6 @@ $(DIR_O)\ScintRes.res : ScintRes.rc
$(LEXCOMPONENT): $(LOBJS) $(DIR_O)\ScintRes.res
$(LD) /DLL /OUT:$(LEXCOMPONENT) $(LOBJS) $(DIR_O)\ScintRes.res $(LDFLAGS)
-$(DIR_O)\Accessor.obj: ..\src\Accessor.cxx ..\include\Platform.h ..\include\PropSet.h ..\include\Accessor.h ..\include\Scintilla.h
- $(CC) $(INCLUDEDIRS) $(CXXFLAGS) /Fo$@ /c ..\src\$(@B).cxx
-
$(DIR_O)\AutoComplete.obj: ..\src\AutoComplete.cxx ..\include\Platform.h ..\src\AutoComplete.h
$(CC) $(INCLUDEDIRS) $(CXXFLAGS) /Fo$@ /c ..\src\$(@B).cxx
@@ -89,6 +86,9 @@ $(DIR_O)\Document.obj: ..\src\Document.cxx ..\include\Platform.h ..\include\Scin
..\src\Document.h
$(CC) $(INCLUDEDIRS) $(CXXFLAGS) /Fo$@ /c ..\src\$(@B).cxx
+$(DIR_O)\DocumentAccessor.obj: ..\src\DocumentAccessor.cxx ..\include\Platform.h ..\include\PropSet.h ..\include\Accessor.h ..\src\DocumentAccessor.h ..\include\Scintilla.h
+ $(CC) $(INCLUDEDIRS) $(CXXFLAGS) /Fo$@ /c ..\src\$(@B).cxx
+
$(DIR_O)\Editor.obj: ..\src\Editor.cxx ..\include\Platform.h ..\include\Scintilla.h ..\src\ContractionState.h \
..\src\CellBuffer.h ..\src\KeyMap.h ..\src\Indicator.h ..\src\LineMarker.h ..\src\Style.h ..\src\ViewStyle.h \
..\src\Document.h ..\src\Editor.h
@@ -150,7 +150,7 @@ $(DIR_O)\ScintillaBase.obj: ..\src\ScintillaBase.cxx ..\include\Platform.h ..\in
$(DIR_O)\ScintillaBaseL.obj: ..\src\ScintillaBase.cxx ..\include\Platform.h ..\include\Scintilla.h ..\include\SciLexer.h \
..\src\ContractionState.h ..\src\CellBuffer.h ..\src\CallTip.h ..\src\KeyMap.h ..\src\Indicator.h \
..\src\LineMarker.h ..\src\Style.h ..\src\AutoComplete.h ..\src\ViewStyle.h ..\src\Document.h ..\src\Editor.h \
- ..\src\ScintillaBase.h ..\include\PropSet.h ..\include\Accessor.h ..\include\KeyWords.h
+ ..\src\ScintillaBase.h ..\include\PropSet.h ..\include\Accessor.h ..\src\DocumentAccessor.h ..\include\KeyWords.h
$(CC) $(INCLUDEDIRS) $(CXXFLAGS) /D SCI_LEXER /c ..\src\ScintillaBase.cxx /Fo$@
$(DIR_O)\ScintillaWin.obj: ScintillaWin.cxx ..\include\Platform.h ..\include\Scintilla.h \
@@ -177,3 +177,7 @@ $(DIR_O)\Style.obj: ..\src\Style.cxx ..\include\Platform.h ..\src\Style.h
$(DIR_O)\ViewStyle.obj: ..\src\ViewStyle.cxx ..\include\Platform.h ..\include\Scintilla.h ..\src\Indicator.h \
..\src\LineMarker.h ..\src\Style.h ..\src\ViewStyle.h
$(CC) $(INCLUDEDIRS) $(CXXFLAGS) /Fo$@ /c ..\src\$(@B).cxx
+
+$(DIR_O)\WindowAccessor.obj: ..\src\WindowAccessor.cxx ..\include\Platform.h ..\include\PropSet.h ..\include\Accessor.h ..\include\WindowAccessor.h ..\include\Scintilla.h
+ $(CC) $(INCLUDEDIRS) $(CXXFLAGS) /Fo$@ /c ..\src\$(@B).cxx
+