Update wxSTC code for latest Scintilla

This commit is contained in:
Maarten Bent 2023-01-28 23:45:35 +01:00
parent 2a18a04dee
commit e3622c0f2d
No known key found for this signature in database
GPG key ID: 58AAEE3F4A4FD070
2 changed files with 29 additions and 4 deletions

View file

@ -42,6 +42,7 @@
#include "wx/graphics.h"
#endif
#include <memory>
#include "PlatWX.h"
#include "wx/stc/stc.h"
#include "wx/stc/private.h"
@ -228,6 +229,8 @@ public:
virtual void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) override;
virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource) override;
virtual std::unique_ptr<IScreenLineLayout> Layout(const IScreenLine* screenLine) override;
virtual void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back) override;
virtual void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back) override;
virtual void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore) override;
@ -244,6 +247,7 @@ public:
virtual void SetUnicodeMode(bool unicodeMode_) override;
virtual void SetDBCSMode(int codePage) override;
virtual void SetBidiR2L(bool bidiR2L_) override;
void BrushColour(ColourDesired back);
void SetFont(Font &font_);
@ -607,6 +611,11 @@ void SurfaceImpl::Copy(PRectangle rc, Point from, Surface &surfaceSource) {
wxRound(from.x), wxRound(from.y), wxCOPY);
}
std::unique_ptr<IScreenLineLayout> SurfaceImpl::Layout(const IScreenLine* WXUNUSED(screenLine))
{
return {};
}
void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font, XYPOSITION ybase,
const char *s, int len,
ColourDesired fore, ColourDesired back) {
@ -745,6 +754,10 @@ void SurfaceImpl::SetDBCSMode(int WXUNUSED(codePage)) {
// dbcsMode = codePage == SC_CP_DBCS;
}
void SurfaceImpl::SetBidiR2L(bool WXUNUSED(bidiR2L_))
{
}
} // namespace scintilla
@ -988,6 +1001,8 @@ public:
ColourDesired back) override;
virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource) override;
virtual std::unique_ptr<IScreenLineLayout> Layout(const IScreenLine* screenLine) override;
virtual void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase,
const char *s, int len, ColourDesired fore,
ColourDesired back) override;
@ -1011,6 +1026,7 @@ public:
virtual void SetUnicodeMode(bool unicodeMode_) override;
virtual void SetDBCSMode(int codePage) override;
virtual void SetBidiR2L(bool bidiR2L_) override;
// helpers
void SetFont(Font &font_);
@ -1550,6 +1566,11 @@ void SurfaceD2D::Copy(PRectangle rc, Point from, Surface& surfaceSource)
}
}
std::unique_ptr<IScreenLineLayout> SurfaceD2D::Layout(const IScreenLine* WXUNUSED(screenLine))
{
return {};
}
void SurfaceD2D::DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase,
const char *s, int len, ColourDesired fore,
ColourDesired back)
@ -1764,6 +1785,10 @@ void SurfaceD2D::SetDBCSMode(int WXUNUSED(codePage_))
{
}
void SurfaceD2D::SetBidiR2L(bool WXUNUSED(bidiR2L_))
{
}
void SurfaceD2D::SetFont(Font &font_)
{
FontID id = font_.GetID();
@ -1819,9 +1844,9 @@ void SurfaceD2D::D2DPenColour(ColourDesired fore, int alpha)
wxCHECK( Initialised(), void() );
D2D_COLOR_F col;
col.r = (fore.AsInteger() & 0xff) / 255.0f;
col.g = ((fore.AsInteger() & 0xff00) >> 8) / 255.0f;
col.b = (fore.AsInteger() >> 16) / 255.0f;
col.r = fore.GetRed() / 255.0f;
col.g = fore.GetGreen() / 255.0f;
col.b = fore.GetBlue() / 255.0f;
col.a = alpha / 255.0f;
if ( m_pSolidBrush.get() )
{

View file

@ -1446,7 +1446,7 @@ void ScintillaWX::ImeStartComposition() {
lf.lfFaceName[0] = L'\0';
if (vs.styles[styleHere].fontName) {
const char* fontName = vs.styles[styleHere].fontName;
UTF16FromUTF8(fontName, strlen(fontName)+1, lf.lfFaceName, LF_FACESIZE);
UTF16FromUTF8(fontName, lf.lfFaceName, LF_FACESIZE);
}
::ImmSetCompositionFontW(imc.hIMC, &lf);