aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-03-22 12:56:26 +1100
committerNeil <nyamatongwe@gmail.com>2021-03-22 12:56:26 +1100
commit794c599d481e46dbf9a5251a57fafb528b3fff2d (patch)
tree0d8b286d6139c23ff6fd8f578c626d7295838910
parent240add387904f2630030a8b2665cadb8babf6153 (diff)
downloadscintilla-mirror-794c599d481e46dbf9a5251a57fafb528b3fff2d.tar.gz
Replace multiple mode setting calls on Surface with SetMode as this is
extensible. For CallTip, GTK and Qt hardcode BidiR2L to false as they don't support bidirectional, its the same as current, and the BidiR2L state on EditModel isn't easily accessible.
-rw-r--r--cocoa/ScintillaCocoa.mm6
-rwxr-xr-xgtk/ScintillaGTK.cxx6
-rw-r--r--qt/ScintillaEditBase/ScintillaQt.cpp3
-rw-r--r--src/Editor.h8
-rw-r--r--win32/ScintillaWin.cxx4
5 files changed, 8 insertions, 19 deletions
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm
index 8e7c80260..4a688bdff 100644
--- a/cocoa/ScintillaCocoa.mm
+++ b/cocoa/ScintillaCocoa.mm
@@ -1058,8 +1058,7 @@ void ScintillaCocoa::CTPaint(void *gc, NSRect rc) {
#pragma unused(rc)
std::unique_ptr<Surface> surfaceWindow(Surface::Allocate(SC_TECHNOLOGY_DEFAULT));
surfaceWindow->Init(gc, wMain.GetID());
- surfaceWindow->SetUnicodeMode(SC_CP_UTF8 == ct.codePage);
- surfaceWindow->SetDBCSMode(ct.codePage);
+ surfaceWindow->SetMode(SurfaceMode(ct.codePage, BidirectionalR2L()));
ct.PaintCT(surfaceWindow.get());
surfaceWindow->Release();
}
@@ -1428,8 +1427,7 @@ void ScintillaCocoa::StartDrag() {
SurfaceImpl pixmap;
pixmap.InitPixMap(static_cast<int>(imageRect.Width()), static_cast<int>(imageRect.Height()), NULL, NULL);
- pixmap.SetUnicodeMode(IsUnicodeMode());
- pixmap.SetDBCSMode(CodePage());
+ pixmap.SetMode(SurfaceMode(CodePage(), BidirectionalR2L()));
CGContextRef gc = pixmap.GetContext();
// To make Paint() work on a bitmap, we have to flip our coordinates and translate the origin
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index 50e46ecc8..312ad1f94 100755
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -2980,8 +2980,7 @@ gboolean ScintillaGTK::DrawCT(GtkWidget *widget, cairo_t *cr, CallTip *ctip) {
try {
std::unique_ptr<Surface> surfaceWindow(Surface::Allocate(SC_TECHNOLOGY_DEFAULT));
surfaceWindow->Init(cr, widget);
- surfaceWindow->SetUnicodeMode(SC_CP_UTF8 == ctip->codePage);
- surfaceWindow->SetDBCSMode(ctip->codePage);
+ surfaceWindow->SetMode(SurfaceMode(ctip->codePage, false));
ctip->PaintCT(surfaceWindow.get());
surfaceWindow->Release();
} catch (...) {
@@ -2997,8 +2996,7 @@ gboolean ScintillaGTK::ExposeCT(GtkWidget *widget, GdkEventExpose * /*ose*/, Cal
std::unique_ptr<Surface> surfaceWindow(Surface::Allocate(SC_TECHNOLOGY_DEFAULT));
cairo_t *cr = gdk_cairo_create(WindowFromWidget(widget));
surfaceWindow->Init(cr, widget);
- surfaceWindow->SetUnicodeMode(SC_CP_UTF8 == ctip->codePage);
- surfaceWindow->SetDBCSMode(ctip->codePage);
+ surfaceWindow->SetMode(SurfaceMode(ctip->codePage, false));
ctip->PaintCT(surfaceWindow.get());
surfaceWindow->Release();
cairo_destroy(cr);
diff --git a/qt/ScintillaEditBase/ScintillaQt.cpp b/qt/ScintillaEditBase/ScintillaQt.cpp
index 06314187e..bb6dad410 100644
--- a/qt/ScintillaEditBase/ScintillaQt.cpp
+++ b/qt/ScintillaEditBase/ScintillaQt.cpp
@@ -691,8 +691,7 @@ public:
if (pct->inCallTipMode) {
std::unique_ptr<Surface> surfaceWindow = Surface::Allocate(0);
surfaceWindow->Init(this);
- surfaceWindow->SetUnicodeMode(SC_CP_UTF8 == pct->codePage);
- surfaceWindow->SetDBCSMode(pct->codePage);
+ surfaceWindow->SetMode(SurfaceMode(pct->codePage, false));
pct->PaintCT(surfaceWindow.get());
}
}
diff --git a/src/Editor.h b/src/Editor.h
index d4f997af6..20f2c53a4 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -653,18 +653,14 @@ public:
if (ed->wMain.GetID()) {
surf = Surface::Allocate(technology != -1 ? technology : ed->technology);
surf->Init(ed->wMain.GetID());
- surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage());
- surf->SetDBCSMode(ed->CodePage());
- surf->SetBidiR2L(ed->BidirectionalR2L());
+ surf->SetMode(SurfaceMode(ed->CodePage(), ed->BidirectionalR2L()));
}
}
AutoSurface(SurfaceID sid, Editor *ed, int technology = -1) {
if (ed->wMain.GetID()) {
surf = Surface::Allocate(technology != -1 ? technology : ed->technology);
surf->Init(sid, ed->wMain.GetID());
- surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage());
- surf->SetDBCSMode(ed->CodePage());
- surf->SetBidiR2L(ed->BidirectionalR2L());
+ surf->SetMode(SurfaceMode(ed->CodePage(), ed->BidirectionalR2L()));
}
}
// Deleted so AutoSurface objects can not be copied.
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 44d08af71..4a8d1c5e9 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -3492,9 +3492,7 @@ LRESULT PASCAL ScintillaWin::CTWndProc(
}
#endif
}
- surfaceWindow->SetUnicodeMode(SC_CP_UTF8 == sciThis->ct.codePage);
- surfaceWindow->SetDBCSMode(sciThis->ct.codePage);
- surfaceWindow->SetBidiR2L(sciThis->BidirectionalR2L());
+ surfaceWindow->SetMode(SurfaceMode(sciThis->ct.codePage, sciThis->BidirectionalR2L()));
sciThis->ct.PaintCT(surfaceWindow.get());
#if defined(USE_D2D)
if (pCTRenderTarget)