diff options
-rw-r--r-- | cocoa/PlatCocoa.h | 4 | ||||
-rw-r--r-- | cocoa/PlatCocoa.mm | 19 | ||||
-rw-r--r-- | gtk/PlatGTK.cxx | 20 | ||||
-rw-r--r-- | include/Platform.h | 23 | ||||
-rw-r--r-- | qt/ScintillaEditBase/PlatQt.cpp | 19 | ||||
-rw-r--r-- | qt/ScintillaEditBase/PlatQt.h | 5 | ||||
-rw-r--r-- | win32/PlatWin.cxx | 41 |
7 files changed, 131 insertions, 0 deletions
diff --git a/cocoa/PlatCocoa.h b/cocoa/PlatCocoa.h index 940de83d5..bc80e9fce 100644 --- a/cocoa/PlatCocoa.h +++ b/cocoa/PlatCocoa.h @@ -98,6 +98,9 @@ public: void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) override; void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) override; void Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSource) override; + size_t PositionFromX(const IScreenLine *screenLine, XYPOSITION xDistance, bool charPosition) override; + XYPOSITION XFromPosition(const IScreenLine *screenLine, size_t caretPosition) override; + std::vector<Interval> FindRangeIntervals(const IScreenLine *screenLine, size_t start, size_t end) override; void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, ColourDesired back) override; void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, @@ -116,6 +119,7 @@ public: void SetUnicodeMode(bool unicodeMode_) override; void SetDBCSMode(int codePage_) override; + void SetBidiR2L(bool bidiR2L_) override; }; // SurfaceImpl class } // Scintilla namespace diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index 7d7eafb42..62a0ba5f0 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -819,6 +819,22 @@ void SurfaceImpl::Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSou //-------------------------------------------------------------------------------------------------- +// Bidirectional text support for Arabic and Hebrew not currently implemented on Cocoa. + +size_t SurfaceImpl::PositionFromX(const IScreenLine *, XYPOSITION, bool) { + return 0; +} + +XYPOSITION SurfaceImpl::XFromPosition(const IScreenLine *, size_t) { + return 0; +} + +std::vector<Interval> SurfaceImpl::FindRangeIntervals(const IScreenLine *, size_t, size_t) { + return std::vector<Interval>(); +} + +//-------------------------------------------------------------------------------------------------- + void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, ColourDesired back) { FillRectangle(rc, back); @@ -1034,6 +1050,9 @@ void SurfaceImpl::SetDBCSMode(int codePage_) { codePage = codePage_; } +void SurfaceImpl::SetBidiR2L(bool) { +} + Surface *Surface::Allocate(int) { return new SurfaceImpl(); } diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 0f5ea58d9..ce0863462 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -166,6 +166,10 @@ public: void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) override; void Copy(PRectangle rc, Point from, Surface &surfaceSource) override; + size_t PositionFromX(const IScreenLine *screenLine, XYPOSITION xDistance, bool charPosition) override; + XYPOSITION XFromPosition(const IScreenLine *screenLine, size_t caretPosition) override; + std::vector<Interval> FindRangeIntervals(const IScreenLine *screenLine, size_t start, size_t end) override; + void DrawTextBase(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore); void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, ColourDesired back) override; void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, ColourDesired back) override; @@ -183,6 +187,7 @@ public: void SetUnicodeMode(bool unicodeMode_) override; void SetDBCSMode(int codePage) override; + void SetBidiR2L(bool bidiR2L_) override; }; } @@ -625,6 +630,18 @@ void SurfaceImpl::Copy(PRectangle rc, Point from, Surface &surfaceSource) { } } +size_t SurfaceImpl::PositionFromX(const IScreenLine *, XYPOSITION, bool) { + return 0; +} + +XYPOSITION SurfaceImpl::XFromPosition(const IScreenLine *, size_t) { + return 0; +} + +std::vector<Interval> SurfaceImpl::FindRangeIntervals(const IScreenLine *, size_t, size_t) { + return std::vector<Interval>(); +} + std::string UTF8FromLatin1(std::string_view text) { std::string utfForm(text.length()*2 + 1, '\0'); size_t lenU = 0; @@ -954,6 +971,9 @@ void SurfaceImpl::SetDBCSMode(int codePage) { et = dbcs; } +void SurfaceImpl::SetBidiR2L(bool) { +} + Surface *Surface::Allocate(int) { return new SurfaceImpl(); } diff --git a/include/Platform.h b/include/Platform.h index e83b8e5e5..9606ecab4 100644 --- a/include/Platform.h +++ b/include/Platform.h @@ -317,6 +317,24 @@ public: friend class SurfaceImpl; }; +class IScreenLine { +public: + virtual std::string_view Text() const = 0; + virtual size_t Length() const = 0; + virtual size_t RepresentationCount() const = 0; + virtual XYPOSITION Width() const = 0; + virtual XYPOSITION Height() const = 0; + virtual XYPOSITION TabWidth() const = 0; + virtual XYPOSITION TabWidthMinimumPixels() const = 0; + virtual const Font *FontOfPosition(size_t position) const = 0; + virtual XYPOSITION RepresentationWidth(size_t position) const = 0; +}; + +struct Interval { + XYPOSITION left; + XYPOSITION right; +}; + /** * A surface abstracts a place to draw. */ @@ -354,6 +372,10 @@ public: virtual void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back)=0; virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0; + virtual size_t PositionFromX(const IScreenLine *screenLine, XYPOSITION xDistance, bool charPosition)=0; + virtual XYPOSITION XFromPosition(const IScreenLine *screenLine, size_t caretPosition)=0; + virtual std::vector<Interval> FindRangeIntervals(const IScreenLine *screenLine, size_t start, size_t end)=0; + virtual void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, ColourDesired back) = 0; virtual void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, ColourDesired back) = 0; virtual void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore) = 0; @@ -370,6 +392,7 @@ public: virtual void SetUnicodeMode(bool unicodeMode_)=0; virtual void SetDBCSMode(int codePage)=0; + virtual void SetBidiR2L(bool bidiR2L_)=0; }; /** diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp index 44082c77a..917f35b3b 100644 --- a/qt/ScintillaEditBase/PlatQt.cpp +++ b/qt/ScintillaEditBase/PlatQt.cpp @@ -408,6 +408,21 @@ void SurfaceImpl::Copy(PRectangle rc, Point from, Surface &surfaceSource) GetPainter()->drawPixmap(rc.left, rc.top, *pixmap, from.x, from.y, -1, -1); } +size_t SurfaceImpl::PositionFromX(const IScreenLine *, XYPOSITION, bool) +{ + return 0; +} + +XYPOSITION SurfaceImpl::XFromPosition(const IScreenLine *, size_t) +{ + return 0; +} + +std::vector<Interval> SurfaceImpl::FindRangeIntervals(const IScreenLine *, size_t, size_t) +{ + return std::vector<Interval>(); +} + void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font, XYPOSITION ybase, @@ -565,6 +580,10 @@ void SurfaceImpl::SetDBCSMode(int codePage_) codePage = codePage_; } +void SurfaceImpl::SetBidiR2L(bool) +{ +} + QPaintDevice *SurfaceImpl::GetPaintDevice() { return device; diff --git a/qt/ScintillaEditBase/PlatQt.h b/qt/ScintillaEditBase/PlatQt.h index 6baa12877..65a5e8be0 100644 --- a/qt/ScintillaEditBase/PlatQt.h +++ b/qt/ScintillaEditBase/PlatQt.h @@ -103,6 +103,10 @@ public: ColourDesired back) override; void Copy(PRectangle rc, Point from, Surface &surfaceSource) override; + size_t PositionFromX(const IScreenLine *screenLine, XYPOSITION xDistance, bool charPosition) override; + XYPOSITION XFromPosition(const IScreenLine *screenLine, size_t caretPosition) override; + std::vector<Interval> FindRangeIntervals(const IScreenLine *screenLine, size_t start, size_t end) override; + void DrawTextNoClip(PRectangle rc, Font &font, XYPOSITION ybase, std::string_view text, ColourDesired fore, ColourDesired back) override; void DrawTextClipped(PRectangle rc, Font &font, XYPOSITION ybase, @@ -123,6 +127,7 @@ public: void SetUnicodeMode(bool unicodeMode_) override; void SetDBCSMode(int codePage_) override; + void SetBidiR2L(bool bidiR2L_) override; void BrushColour(ColourDesired back); void SetCodec(Font &font); diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 81e5b827b..cdaea41e4 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -566,6 +566,10 @@ public: void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) override; void Copy(PRectangle rc, Point from, Surface &surfaceSource) override; + size_t PositionFromX(const IScreenLine *screenLine, XYPOSITION xDistance, bool charPosition) override; + XYPOSITION XFromPosition(const IScreenLine *screenLine, size_t caretPosition) override; + std::vector<Interval> FindRangeIntervals(const IScreenLine *screenLine, size_t start, size_t end) override; + void DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, UINT fuOptions); void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, ColourDesired back) override; void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, ColourDesired back) override; @@ -583,6 +587,7 @@ public: void SetUnicodeMode(bool unicodeMode_) override; void SetDBCSMode(int codePage_) override; + void SetBidiR2L(bool bidiR2L_) override; }; SurfaceGDI::SurfaceGDI() : @@ -919,6 +924,18 @@ void SurfaceGDI::Copy(PRectangle rc, Point from, Surface &surfaceSource) { static_cast<int>(from.x), static_cast<int>(from.y), SRCCOPY); } +size_t SurfaceGDI::PositionFromX(const IScreenLine *, XYPOSITION, bool) { + return 0; +} + +XYPOSITION SurfaceGDI::XFromPosition(const IScreenLine *, size_t) { + return 0; +} + +std::vector<Interval> SurfaceGDI::FindRangeIntervals(const IScreenLine *, size_t, size_t) { + return std::vector<Interval>(); +} + typedef VarBuffer<int, stackBufferLength> TextPositionsI; void SurfaceGDI::DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, UINT fuOptions) { @@ -1072,6 +1089,9 @@ void SurfaceGDI::SetDBCSMode(int codePage_) { codePage = codePage_; } +void SurfaceGDI::SetBidiR2L(bool) { +} + #if defined(USE_D2D) class SurfaceD2D : public Surface { @@ -1136,6 +1156,10 @@ public: void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) override; void Copy(PRectangle rc, Point from, Surface &surfaceSource) override; + size_t PositionFromX(const IScreenLine *screenLine, XYPOSITION xDistance, bool charPosition) override; + XYPOSITION XFromPosition(const IScreenLine *screenLine, size_t caretPosition) override; + std::vector<Interval> FindRangeIntervals(const IScreenLine *screenLine, size_t start, size_t end) override; + void DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, UINT fuOptions); void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, ColourDesired back) override; void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, ColourDesired back) override; @@ -1153,6 +1177,7 @@ public: void SetUnicodeMode(bool unicodeMode_) override; void SetDBCSMode(int codePage_) override; + void SetBidiR2L(bool bidiR2L_) override; }; SurfaceD2D::SurfaceD2D() : @@ -1590,6 +1615,18 @@ void SurfaceD2D::Copy(PRectangle rc, Point from, Surface &surfaceSource) { } } +size_t SurfaceD2D::PositionFromX(const IScreenLine *, XYPOSITION, bool) { + return 0; +} + +XYPOSITION SurfaceD2D::XFromPosition(const IScreenLine *, size_t) { + return 0; +} + +std::vector<Interval> SurfaceD2D::FindRangeIntervals(const IScreenLine *, size_t, size_t) { + return std::vector<Interval>(); +} + void SurfaceD2D::DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, UINT fuOptions) { SetFont(font_); @@ -1806,6 +1843,10 @@ void SurfaceD2D::SetDBCSMode(int codePage_) { // No action on window as automatically handled by system. codePage = codePage_; } + +void SurfaceD2D::SetBidiR2L(bool) { +} + #endif Surface *Surface::Allocate(int technology) { |