From 73ae9e3d2ad7fddbe8945deb0647dd7597d58c0a Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 12 Mar 2022 10:24:52 +1100 Subject: Feature [feature-requests:#1432] Move some surface creation out of headers and make virtual to allow customisation by platform layers. --- src/Editor.cxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/Editor.cxx') diff --git a/src/Editor.cxx b/src/Editor.cxx index f048a5030..bbac4862a 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -5687,6 +5687,26 @@ int Editor::CodePage() const noexcept { return 0; } +std::unique_ptr Editor::CreateMeasurementSurface() const { + if (!wMain.GetID()) { + return {}; + } + std::unique_ptr surf = Surface::Allocate(technology); + surf->Init(wMain.GetID()); + surf->SetMode(CurrentSurfaceMode()); + return surf; +} + +std::unique_ptr Editor::CreateDrawingSurface(SurfaceID sid, std::optional technologyOpt) const { + if (!wMain.GetID()) { + return {}; + } + std::unique_ptr surf = Surface::Allocate(technologyOpt ? *technologyOpt : technology); + surf->Init(sid, wMain.GetID()); + surf->SetMode(CurrentSurfaceMode()); + return surf; +} + Sci::Line Editor::WrapCount(Sci::Line line) { AutoSurface surface(this); std::shared_ptr ll = view.RetrieveLineLayout(line, *this); -- cgit v1.2.3