mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+ upd: Scintilla Lib v5.0.2
This commit is contained in:
parent
927eb92a4e
commit
7a1d4bc362
@ -120,7 +120,7 @@
|
||||
|
||||
<h1>Scintilla Documentation</h1>
|
||||
|
||||
<p>Last edited 9 April 2021 NH</p>
|
||||
<p>Last edited 20 April 2021 NH</p>
|
||||
|
||||
<p style="background:#90F0C0">Scintilla 5 has moved the lexers from Scintilla into a new
|
||||
<a href="Lexilla.html">Lexilla</a> project.<br />
|
||||
@ -2970,6 +2970,9 @@ struct Sci_TextToFind {
|
||||
<a class="message" href="#SCI_STYLESETHOTSPOT">SCI_STYLESETHOTSPOT(int style, bool
|
||||
hotspot)</a><br />
|
||||
<a class="message" href="#SCI_STYLEGETHOTSPOT">SCI_STYLEGETHOTSPOT(int style) → bool</a><br />
|
||||
<a class="message" href="#SCI_SETFONTLOCALE">SCI_SETFONTLOCALE(<unused>, const char
|
||||
*fontName)</a><br />
|
||||
<a class="message" href="#SCI_GETFONTLOCALE">SCI_GETFONTLOCALE(<unused>, char *fontName) → int</a><br />
|
||||
</code>
|
||||
|
||||
<p><b id="SCI_STYLERESETDEFAULT">SCI_STYLERESETDEFAULT</b><br />
|
||||
@ -3298,6 +3301,15 @@ struct Sci_TextToFind {
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><b id="SCI_SETFONTLOCALE">SCI_SETFONTLOCALE(<unused>, const char *localeName)</b><br />
|
||||
<b id="SCI_GETFONTLOCALE">SCI_GETFONTLOCALE(<unused>, char *localeName NUL-terminated) → int</b><br />
|
||||
These messages set the locale used for font selection with language-dependent glyphs.
|
||||
It may, depending on platform and other circumstances influence the display of text, so setting "zh-Hant" may result in traditional
|
||||
Chinese display and "zh-Hans" may result in simplified Chinese display.
|
||||
It is currently only implemented for Win32 using DirectWrite where the value is passed as the localeName argument to CreateTextFormat.
|
||||
The default value is US English "en-us".
|
||||
</p>
|
||||
|
||||
<h2 id="CaretAndSelectionStyles">Caret, selection, and hotspot styles</h2>
|
||||
|
||||
<p>The selection is shown by changing the foreground and/or background colours. If one of these
|
||||
@ -4121,7 +4133,11 @@ struct Sci_TextToFind {
|
||||
<code>SC_TECHNOLOGY_DIRECTWRITEDC</code> differs from
|
||||
<code>SC_TECHNOLOGY_DIRECTWRITE</code> by using DirectWrite to draw into a GDI DC.
|
||||
Since Direct2D buffers drawing, Scintilla's buffering can be turned off with
|
||||
<code>SCI_SETBUFFEREDDRAW(0)</code>.</p>
|
||||
<code>SCI_SETBUFFEREDDRAW(0)</code>.
|
||||
When using DirectWrite, you can use
|
||||
<a class="message" href="#SCI_SETFONTLOCALE"><code>SCI_SETFONTLOCALE</code></a>
|
||||
to set an appropriate font locale to draw text with expected language-dependent glyphs.
|
||||
</p>
|
||||
|
||||
<p><b id="SCI_SETFONTQUALITY">SCI_SETFONTQUALITY(int fontQuality)</b><br />
|
||||
<b id="SCI_GETFONTQUALITY">SCI_GETFONTQUALITY → int</b><br />
|
||||
|
||||
@ -26,9 +26,9 @@
|
||||
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<font size="4"> <a href="https://www.scintilla.org/scintilla501.zip">
|
||||
<font size="4"> <a href="https://www.scintilla.org/scintilla502.zip">
|
||||
Windows</a>
|
||||
<a href="https://www.scintilla.org/scintilla501.tgz">
|
||||
<a href="https://www.scintilla.org/scintilla502.tgz">
|
||||
GTK/Linux</a>
|
||||
</font>
|
||||
</td>
|
||||
@ -42,7 +42,7 @@
|
||||
containing very few restrictions.
|
||||
</p>
|
||||
<h3>
|
||||
Release 5.0.1
|
||||
Release 5.0.2
|
||||
</h3>
|
||||
<h4>
|
||||
Source Code
|
||||
@ -50,8 +50,8 @@
|
||||
The source code package contains all of the source code for Scintilla but no binary
|
||||
executable code and is available in
|
||||
<ul>
|
||||
<li><a href="https://www.scintilla.org/scintilla501.zip">zip format</a> (1.2M) commonly used on Windows</li>
|
||||
<li><a href="https://www.scintilla.org/scintilla501.tgz">tgz format</a> (1.2M) commonly used on Linux and compatible operating systems</li>
|
||||
<li><a href="https://www.scintilla.org/scintilla502.zip">zip format</a> (1.2M) commonly used on Windows</li>
|
||||
<li><a href="https://www.scintilla.org/scintilla502.tgz">tgz format</a> (1.2M) commonly used on Linux and compatible operating systems</li>
|
||||
</ul>
|
||||
Instructions for building on both Windows and Linux are included in the readme file.
|
||||
<h4>
|
||||
|
||||
@ -571,6 +571,27 @@
|
||||
</li>
|
||||
</ul>
|
||||
<h2>Releases</h2>
|
||||
<h3>
|
||||
<a href="https://www.scintilla.org/scintilla502.zip">Release 5.0.2</a>
|
||||
</h3>
|
||||
<ul>
|
||||
<li>
|
||||
Released 23 April 2021.
|
||||
</li>
|
||||
<li>
|
||||
On Cocoa with macOS 11, use plain style for autocompletion to fix problems with truncating text
|
||||
and padding. This makes autocompletion look the same on macOS 11 as macOS 10.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/2248/">Bug #2248</a>.
|
||||
</li>
|
||||
<li>
|
||||
On Windows, fix encoding used for text display with DirectWrite.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/2246/">Bug #2246</a>.
|
||||
</li>
|
||||
<li>
|
||||
Implement font locale SCI_SETFONTLOCALE. Initially only for DirectWrite on Win32.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/2027/">Bug #2027</a>.
|
||||
</li>
|
||||
</ul>
|
||||
<h3>
|
||||
<a href="https://www.scintilla.org/scintilla501.zip">Release 5.0.1</a>
|
||||
</h3>
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
<meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
|
||||
<meta name="Description"
|
||||
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
|
||||
<meta name="Date.Modified" content="20210409" />
|
||||
<meta name="Date.Modified" content="20210423" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<style type="text/css">
|
||||
#versionlist {
|
||||
@ -56,8 +56,8 @@
|
||||
GTK, and OS X</font>
|
||||
</td>
|
||||
<td width="40%" align="right">
|
||||
<font color="#FFCC99" size="3"> Release version 5.0.1<br />
|
||||
Site last modified April 9 2021</font>
|
||||
<font color="#FFCC99" size="3"> Release version 5.0.2<br />
|
||||
Site last modified April 23 2021</font>
|
||||
</td>
|
||||
<td width="20%">
|
||||
|
||||
@ -72,12 +72,11 @@
|
||||
</tr>
|
||||
</table>
|
||||
<ul id="versionlist">
|
||||
<li>Version 5.0.2 fixes text encoding for display and adds font locale support on Windows.
|
||||
Autocompletion lists improved on macOS 11.</li>
|
||||
<li>Version 5.0.1 has significantly changed the interface between platform layers and platform-independent code
|
||||
with more drawing capabilities. This includes ubiquitous translucency and variable stroke width to better support High DPI displays.</li>
|
||||
<li>Version 5.0.0 is an unstable release with lexers unbundled.</li>
|
||||
<li>Version 4.4.6 fixes building with Xcode 12.</li>
|
||||
<li>Version 4.4.5 fixes bugs with indicators, margin text, and ineffective layout caching.</li>
|
||||
<li>Version 4.4.4 implements end of line annotations.</li>
|
||||
</ul>
|
||||
<ul id="menu">
|
||||
<li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li>
|
||||
|
||||
@ -115,6 +115,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCI_GETNEXTTABSTOP 2677
|
||||
#define SC_CP_UTF8 65001
|
||||
#define SCI_SETCODEPAGE 2037
|
||||
#define SCI_SETFONTLOCALE 2760
|
||||
#define SCI_GETFONTLOCALE 2761
|
||||
#define SC_IME_WINDOWED 0
|
||||
#define SC_IME_INLINE 1
|
||||
#define SCI_GETIMEINTERACTION 2678
|
||||
@ -258,8 +260,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
#define SCI_STYLESETSTRIKE 3501
|
||||
#define SCI_STYLEGETSTRIKE 3502
|
||||
#define SCI_SETFONTLOCALE 3503
|
||||
#define SCI_GETFONTLOCALE 3504
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
#define SC_CASE_MIXED 0
|
||||
#define SC_CASE_UPPER 1
|
||||
|
||||
@ -282,6 +282,12 @@ val SC_CP_UTF8=65001
|
||||
# The SC_CP_UTF8 value can be used to enter Unicode mode.
|
||||
set void SetCodePage=2037(int codePage,)
|
||||
|
||||
# Set the locale for displaying text.
|
||||
set void SetFontLocale=2760(, string localeName)
|
||||
|
||||
# Get the locale for displaying text.
|
||||
get int GetFontLocale=2761(, stringresult localeName)
|
||||
|
||||
enu IMEInteraction=SC_IME_
|
||||
val SC_IME_WINDOWED=0
|
||||
val SC_IME_INLINE=1
|
||||
|
||||
@ -272,7 +272,9 @@ void CallTip::MouseClick(Point pt) noexcept {
|
||||
PRectangle CallTip::CallTipStart(Sci::Position pos, Point pt, int textHeight, const char *defn,
|
||||
const char *faceName, int size,
|
||||
int codePage_, int characterSet,
|
||||
int technology, const Window &wParent) {
|
||||
int technology,
|
||||
const char *localeName,
|
||||
const Window &wParent) {
|
||||
clickPlace = 0;
|
||||
val = defn;
|
||||
codePage = codePage_;
|
||||
@ -283,7 +285,8 @@ PRectangle CallTip::CallTipStart(Sci::Position pos, Point pt, int textHeight, co
|
||||
inCallTipMode = true;
|
||||
posStartCallTip = pos;
|
||||
const XYPOSITION deviceHeight = static_cast<XYPOSITION>(surfaceMeasure->DeviceHeightFont(size));
|
||||
const FontParameters fp(faceName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, SC_WEIGHT_NORMAL, false, 0, technology, characterSet);
|
||||
const FontParameters fp(faceName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, SC_WEIGHT_NORMAL,
|
||||
false, 0, technology, characterSet, localeName);
|
||||
font = Font::Allocate(fp);
|
||||
// Look for multiple lines in the text
|
||||
// Only support \n here - simply means container must avoid \r!
|
||||
|
||||
@ -72,7 +72,8 @@ public:
|
||||
/// Setup the calltip and return a rectangle of the area required.
|
||||
PRectangle CallTipStart(Sci::Position pos, Point pt, int textHeight, const char *defn,
|
||||
const char *faceName, int size, int codePage_,
|
||||
int characterSet, int technology, const Window &wParent);
|
||||
int characterSet, int technology, const char *localeName,
|
||||
const Window &wParent);
|
||||
|
||||
void CallTipCancel();
|
||||
|
||||
|
||||
@ -708,10 +708,6 @@ void Editor::SetSelection(SelectionPosition currentPos_) {
|
||||
QueueIdleWork(WorkItems::updateUI);
|
||||
}
|
||||
|
||||
void Editor::SetSelection(int currentPos_) {
|
||||
SetSelection(SelectionPosition(currentPos_));
|
||||
}
|
||||
|
||||
void Editor::SetEmptySelection(SelectionPosition currentPos_) {
|
||||
const Sci::Line currentLine = pdoc->SciLineFromPosition(currentPos_.Position());
|
||||
SelectionRange rangeNew(ClampPositionIntoDocument(currentPos_));
|
||||
@ -7246,17 +7242,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
InvalidateStyleRedraw();
|
||||
break;
|
||||
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
case SCI_SETFONTLOCALE:
|
||||
if (lParam != 0) {
|
||||
vs.SetFontLocaleName(CharPtrFromSPtr(lParam));
|
||||
}
|
||||
break;
|
||||
|
||||
case SCI_GETFONTLOCALE:
|
||||
return StringResult(lParam, vs.localeName.c_str());
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
|
||||
case SCI_SETELEMENTCOLOUR:
|
||||
vs.elementColours[static_cast<int>(wParam)] = ColourAlpha(static_cast<int>(lParam));
|
||||
break;
|
||||
@ -7274,6 +7259,17 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
case SCI_GETELEMENTALLOWSTRANSLUCENT:
|
||||
return vs.ElementAllowsTranslucent(static_cast<int>(wParam));
|
||||
|
||||
case SCI_SETFONTLOCALE:
|
||||
if (lParam) {
|
||||
vs.SetFontLocaleName(CharPtrFromSPtr(lParam));
|
||||
vs.fontsValid = false;
|
||||
InvalidateStyleRedraw();
|
||||
}
|
||||
break;
|
||||
|
||||
case SCI_GETFONTLOCALE:
|
||||
return StringResult(lParam, vs.localeName.c_str());
|
||||
|
||||
#ifdef INCLUDE_DEPRECATED_FEATURES
|
||||
case SCI_SETSTYLEBITS:
|
||||
vs.EnsureStyle(0xff);
|
||||
|
||||
@ -336,7 +336,6 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
void SetSelection(SelectionPosition currentPos_, SelectionPosition anchor_);
|
||||
void SetSelection(Sci::Position currentPos_, Sci::Position anchor_);
|
||||
void SetSelection(SelectionPosition currentPos_);
|
||||
void SetSelection(int currentPos_);
|
||||
void SetEmptySelection(SelectionPosition currentPos_);
|
||||
void SetEmptySelection(Sci::Position currentPos_);
|
||||
enum class AddNumber { one, each };
|
||||
|
||||
@ -74,17 +74,19 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
|
||||
|
||||
const int width = std::min(4000, static_cast<int>(rcSquiggle.Width()));
|
||||
RGBAImage image(width, 3, 1.0, nullptr);
|
||||
enum { alphaFull = 0xff, alphaSide = 0x2f, alphaSide2=0x5f };
|
||||
constexpr unsigned int alphaFull = 0xff;
|
||||
constexpr unsigned int alphaSide = 0x2f;
|
||||
constexpr unsigned int alphaSide2 = 0x5f;
|
||||
for (int x = 0; x < width; x++) {
|
||||
if (x%2) {
|
||||
// Two halfway columns have a full pixel in middle flanked by light pixels
|
||||
image.SetPixel(x, 0, sacDraw.fore, alphaSide);
|
||||
image.SetPixel(x, 1, sacDraw.fore, alphaFull);
|
||||
image.SetPixel(x, 2, sacDraw.fore, alphaSide);
|
||||
image.SetPixel(x, 0, ColourAlpha(sacDraw.fore, alphaSide));
|
||||
image.SetPixel(x, 1, ColourAlpha(sacDraw.fore, alphaFull));
|
||||
image.SetPixel(x, 2, ColourAlpha(sacDraw.fore, alphaSide));
|
||||
} else {
|
||||
// Extreme columns have a full pixel at bottom or top and a mid-tone pixel in centre
|
||||
image.SetPixel(x, (x % 4) ? 0 : 2, sacDraw.fore, alphaFull);
|
||||
image.SetPixel(x, 1, sacDraw.fore, alphaSide2);
|
||||
image.SetPixel(x, (x % 4) ? 0 : 2, ColourAlpha(sacDraw.fore, alphaFull));
|
||||
image.SetPixel(x, 1, ColourAlpha(sacDraw.fore, alphaSide2));
|
||||
}
|
||||
}
|
||||
surface->DrawRGBAImage(rcSquiggle, image.GetWidth(), image.GetHeight(), image.Pixels());
|
||||
@ -207,13 +209,13 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
|
||||
// Draw horizontal lines top and bottom
|
||||
for (int x=0; x<width; x++) {
|
||||
for (int y = 0; y< height; y += height - 1) {
|
||||
image.SetPixel(x, y, sacDraw.fore, ((x + y) % 2) ? outlineAlpha : fillAlpha);
|
||||
image.SetPixel(x, y, ColourAlpha(sacDraw.fore, ((x + y) % 2) ? outlineAlpha : fillAlpha));
|
||||
}
|
||||
}
|
||||
// Draw vertical lines left and right
|
||||
for (int y = 1; y<height; y++) {
|
||||
for (int x=0; x<width; x += width-1) {
|
||||
image.SetPixel(x, y, sacDraw.fore, ((x + y) % 2) ? outlineAlpha : fillAlpha);
|
||||
image.SetPixel(x, y, ColourAlpha(sacDraw.fore, ((x + y) % 2) ? outlineAlpha : fillAlpha));
|
||||
}
|
||||
}
|
||||
surface->DrawRGBAImage(rcBox, image.GetWidth(), image.GetHeight(), image.Pixels());
|
||||
|
||||
@ -483,6 +483,7 @@ void ScintillaBase::CallTipShow(Point pt, const char *defn) {
|
||||
CodePage(),
|
||||
vs.styles[ctStyle].characterSet,
|
||||
vs.technology,
|
||||
vs.localeName.c_str(),
|
||||
wMain);
|
||||
// If the call-tip window would be out of the client
|
||||
// space
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
#include <cstring>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@ -37,13 +38,12 @@ MarginStyle::MarginStyle(int style_, int width_, int mask_) noexcept :
|
||||
style(style_), width(width_), mask(mask_), sensitive(false), cursor(SC_CURSORREVERSEARROW) {
|
||||
}
|
||||
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
void FontRealised::Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs, const char *localeName) {
|
||||
PLATFORM_ASSERT(fs.fontName);
|
||||
sizeZoomed = GetFontSizeZoomed(fs.size, zoomLevel);
|
||||
const float deviceHeight = static_cast<float>(surface.DeviceHeightFont(sizeZoomed));
|
||||
const FontParameters fp(fs.fontName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, fs.weight, fs.italic, fs.extraFontFlag, technology, fs.characterSet, localeName);
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
const FontParameters fp(fs.fontName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, fs.weight,
|
||||
fs.italic, fs.extraFontFlag, technology, fs.characterSet, localeName);
|
||||
font = Font::Allocate(fp);
|
||||
|
||||
ascent = static_cast<unsigned int>(surface.Ascent(font.get()));
|
||||
@ -146,6 +146,8 @@ ViewStyle::ViewStyle(const ViewStyle &source) : markers(MARKER_MAX + 1), indicat
|
||||
wrapVisualFlagsLocation = source.wrapVisualFlagsLocation;
|
||||
wrapVisualStartIndent = source.wrapVisualStartIndent;
|
||||
wrapIndentMode = source.wrapIndentMode;
|
||||
|
||||
localeName = source.localeName;
|
||||
}
|
||||
|
||||
ViewStyle::~ViewStyle() {
|
||||
@ -282,9 +284,8 @@ void ViewStyle::Init(size_t stylesSize_) {
|
||||
wrapVisualFlagsLocation = 0;
|
||||
wrapVisualStartIndent = 0;
|
||||
wrapIndentMode = SC_WRAPINDENT_FIXED;
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
|
||||
localeName = localeNameDefault;
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
}
|
||||
|
||||
void ViewStyle::Refresh(Surface &surface, int tabInChars) {
|
||||
@ -410,12 +411,10 @@ void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {
|
||||
styles[styleIndex].fontName = fontNames.Save(name);
|
||||
}
|
||||
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
void ViewStyle::SetFontLocaleName(const char *name) {
|
||||
fontsValid = false;
|
||||
localeName = name;
|
||||
}
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
|
||||
bool ViewStyle::ProtectionActive() const noexcept {
|
||||
return someStylesProtected;
|
||||
|
||||
@ -37,9 +37,7 @@ public:
|
||||
FontRealised &operator=(const FontRealised &) = delete;
|
||||
FontRealised &operator=(FontRealised &&) = delete;
|
||||
virtual ~FontRealised() noexcept = default;
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
void Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs, const char *localeName);
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
};
|
||||
|
||||
enum class IndentView {none, real, lookForward, lookBoth};
|
||||
@ -182,9 +180,8 @@ public:
|
||||
int wrapVisualFlagsLocation;
|
||||
int wrapVisualStartIndent;
|
||||
int wrapIndentMode; // SC_WRAPINDENT_FIXED, _SAME, _INDENT
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
|
||||
std::string localeName;
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
|
||||
ViewStyle();
|
||||
ViewStyle(const ViewStyle &source);
|
||||
@ -202,9 +199,7 @@ public:
|
||||
void ResetDefaultStyle();
|
||||
void ClearStyles();
|
||||
void SetStyleFontName(int styleIndex, const char *name);
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
void SetFontLocaleName(const char *name);
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
bool ProtectionActive() const noexcept;
|
||||
int ExternalMarginWidth() const noexcept;
|
||||
int MarginFromLocation(Point pt) const noexcept;
|
||||
|
||||
@ -60,17 +60,17 @@ unsigned int ValueOfHex(const char ch) noexcept {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ColourDesired ColourFromHex(const char *val) noexcept {
|
||||
ColourAlpha ColourFromHex(const char *val) noexcept {
|
||||
const unsigned int r = ValueOfHex(val[0]) * 16 + ValueOfHex(val[1]);
|
||||
const unsigned int g = ValueOfHex(val[2]) * 16 + ValueOfHex(val[3]);
|
||||
const unsigned int b = ValueOfHex(val[4]) * 16 + ValueOfHex(val[5]);
|
||||
return ColourDesired(r, g, b);
|
||||
return ColourAlpha(r, g, b);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
ColourDesired XPM::ColourFromCode(int ch) const noexcept {
|
||||
ColourAlpha XPM::ColourFromCode(int ch) const noexcept {
|
||||
return colourCodeTable[ch];
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ void XPM::Init(const char *const *linesForm) {
|
||||
if (!linesForm)
|
||||
return;
|
||||
|
||||
std::fill(colourCodeTable, std::end(colourCodeTable), ColourDesired(0));
|
||||
std::fill(colourCodeTable, std::end(colourCodeTable), ColourAlpha(0, 0, 0));
|
||||
const char *line0 = linesForm[0];
|
||||
width = atoi(line0);
|
||||
line0 = NextField(line0);
|
||||
@ -133,7 +133,7 @@ void XPM::Init(const char *const *linesForm) {
|
||||
const char *colourDef = linesForm[c+1];
|
||||
const char code = colourDef[0];
|
||||
colourDef += 4;
|
||||
ColourDesired colour(0xff, 0xff, 0xff);
|
||||
ColourAlpha colour(0, 0, 0, 0);
|
||||
if (*colourDef == '#') {
|
||||
colour = ColourFromHex(colourDef+1);
|
||||
} else {
|
||||
@ -172,19 +172,13 @@ void XPM::Draw(Surface *surface, const PRectangle &rc) {
|
||||
}
|
||||
}
|
||||
|
||||
void XPM::PixelAt(int x, int y, ColourDesired &colour, bool &transparent) const noexcept {
|
||||
if (pixels.empty() || (x<0) || (x >= width) || (y<0) || (y >= height)) {
|
||||
colour = ColourDesired(0);
|
||||
transparent = true;
|
||||
return;
|
||||
ColourAlpha XPM::PixelAt(int x, int y) const noexcept {
|
||||
if (pixels.empty() || (x < 0) || (x >= width) || (y < 0) || (y >= height)) {
|
||||
// Out of bounds -> transparent black
|
||||
return ColourAlpha(0, 0, 0, 0);
|
||||
}
|
||||
const int code = pixels[y * width + x];
|
||||
transparent = code == codeTransparent;
|
||||
if (transparent) {
|
||||
colour = ColourDesired(0);
|
||||
} else {
|
||||
colour = ColourFromCode(code);
|
||||
}
|
||||
return ColourFromCode(code);
|
||||
}
|
||||
|
||||
std::vector<const char *> XPM::LinesFormFromTextForm(const char *textForm) {
|
||||
@ -238,10 +232,7 @@ RGBAImage::RGBAImage(const XPM &xpm) {
|
||||
pixelBytes.resize(CountBytes());
|
||||
for (int y=0; y<height; y++) {
|
||||
for (int x=0; x<width; x++) {
|
||||
ColourDesired colour;
|
||||
bool transparent = false;
|
||||
xpm.PixelAt(x, y, colour, transparent);
|
||||
SetPixel(x, y, colour, transparent ? 0 : 255);
|
||||
SetPixel(x, y, xpm.PixelAt(x, y));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -256,13 +247,13 @@ const unsigned char *RGBAImage::Pixels() const noexcept {
|
||||
return &pixelBytes[0];
|
||||
}
|
||||
|
||||
void RGBAImage::SetPixel(int x, int y, ColourDesired colour, int alpha) noexcept {
|
||||
unsigned char *pixel = &pixelBytes[0] + (y*width+x) * 4;
|
||||
void RGBAImage::SetPixel(int x, int y, ColourAlpha colour) noexcept {
|
||||
unsigned char *pixel = &pixelBytes[0] + (y * width + x) * 4;
|
||||
// RGBA
|
||||
pixel[0] = colour.GetRed();
|
||||
pixel[1] = colour.GetGreen();
|
||||
pixel[2] = colour.GetBlue();
|
||||
pixel[3] = static_cast<unsigned char>(alpha);
|
||||
pixel[3] = colour.GetAlpha();
|
||||
}
|
||||
|
||||
// Transform a block of pixels from RGBA to BGRA with premultiplied alpha.
|
||||
|
||||
@ -18,9 +18,9 @@ class XPM {
|
||||
int width=1;
|
||||
int nColours=1;
|
||||
std::vector<unsigned char> pixels;
|
||||
ColourDesired colourCodeTable[256];
|
||||
ColourAlpha colourCodeTable[256];
|
||||
char codeTransparent=' ';
|
||||
ColourDesired ColourFromCode(int ch) const noexcept;
|
||||
ColourAlpha ColourFromCode(int ch) const noexcept;
|
||||
void FillRun(Surface *surface, int code, int startX, int y, int x) const;
|
||||
public:
|
||||
explicit XPM(const char *textForm);
|
||||
@ -36,7 +36,7 @@ public:
|
||||
void Draw(Surface *surface, const PRectangle &rc);
|
||||
int GetHeight() const noexcept { return height; }
|
||||
int GetWidth() const noexcept { return width; }
|
||||
void PixelAt(int x, int y, ColourDesired &colour, bool &transparent) const noexcept;
|
||||
ColourAlpha PixelAt(int x, int y) const noexcept;
|
||||
private:
|
||||
static std::vector<const char *>LinesFormFromTextForm(const char *textForm);
|
||||
};
|
||||
@ -65,7 +65,7 @@ public:
|
||||
float GetScaledWidth() const noexcept { return width / scale; }
|
||||
int CountBytes() const noexcept;
|
||||
const unsigned char *Pixels() const noexcept;
|
||||
void SetPixel(int x, int y, ColourDesired colour, int alpha) noexcept;
|
||||
void SetPixel(int x, int y, ColourAlpha colour) noexcept;
|
||||
static void BGRAFromRGBA(unsigned char *pixelsBGRA, const unsigned char *pixelsRGBA, size_t count) noexcept;
|
||||
};
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
501
|
||||
502
|
||||
|
||||
@ -373,11 +373,11 @@ struct FontDirectWrite : public FontWin {
|
||||
}
|
||||
HRESULT hr = pIDWriteFactory->CreateTextFormat(wsFamily.c_str(), nullptr,
|
||||
weight, style, stretch, fHeight, wsLocale.c_str(), &pTextFormat);
|
||||
|
||||
//HRESULT hr = pIDWriteFactory->CreateTextFormat(wsFace.c_str(), nullptr,
|
||||
// static_cast<DWRITE_FONT_WEIGHT>(fp.weight),
|
||||
// style,
|
||||
// DWRITE_FONT_STRETCH_NORMAL, fHeight, wsLocale.c_str(), &pTextFormat);
|
||||
if (hr == E_INVALIDARG) {
|
||||
// Possibly a bad locale name like "/" so try "en-US".
|
||||
hr = pIDWriteFactory->CreateTextFormat(wsFamily.c_str(), nullptr,
|
||||
weight, style, stretch, fHeight, L"en-US", &pTextFormat);
|
||||
}
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
if (SUCCEEDED(hr)) {
|
||||
pTextFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);
|
||||
@ -1435,9 +1435,7 @@ public:
|
||||
|
||||
std::unique_ptr<IScreenLineLayout> Layout(const IScreenLine *screenLine) override;
|
||||
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
void DrawTextCommon(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, int codePageOverride, UINT fuOptions);
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
|
||||
void DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override;
|
||||
void DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override;
|
||||
@ -2388,13 +2386,11 @@ std::unique_ptr<IScreenLineLayout> SurfaceD2D::Layout(const IScreenLine *screenL
|
||||
return std::make_unique<ScreenLineLayout>(screenLine);
|
||||
}
|
||||
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
void SurfaceD2D::DrawTextCommon(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, int codePageOverride, UINT fuOptions) {
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
SetFont(font_);
|
||||
|
||||
// Use Unicode calls
|
||||
const int codePageDraw = codePageOverride ? codePageOverride : codePageText;
|
||||
const int codePageDraw = codePageOverride ? codePageOverride : codePageText;
|
||||
const TextWide tbuf(text, codePageDraw);
|
||||
if (pRenderTarget && pTextFormat && pBrush) {
|
||||
if (fuOptions & ETO_CLIPPED) {
|
||||
@ -2428,9 +2424,7 @@ void SurfaceD2D::DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION yba
|
||||
if (pRenderTarget) {
|
||||
FillRectangleAligned(rc, back);
|
||||
D2DPenColourAlpha(fore);
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
DrawTextCommon(rc, font_, ybase, text, 0, ETO_OPAQUE);
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
}
|
||||
}
|
||||
|
||||
@ -2439,9 +2433,7 @@ void SurfaceD2D::DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION yb
|
||||
if (pRenderTarget) {
|
||||
FillRectangleAligned(rc, back);
|
||||
D2DPenColourAlpha(fore);
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
DrawTextCommon(rc, font_, ybase, text, 0, ETO_OPAQUE | ETO_CLIPPED);
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
}
|
||||
}
|
||||
|
||||
@ -2452,9 +2444,7 @@ void SurfaceD2D::DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITIO
|
||||
if (ch != ' ') {
|
||||
if (pRenderTarget) {
|
||||
D2DPenColourAlpha(fore);
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
DrawTextCommon(rc, font_, ybase, text, 0, 0);
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -2486,7 +2476,7 @@ void SurfaceD2D::MeasureWidths(const Font *font_, std::string_view text, XYPOSIT
|
||||
return;
|
||||
}
|
||||
// A cluster may be more than one WCHAR, such as for "ffi" which is a ligature in the Candara font
|
||||
FLOAT position = 0.0f;
|
||||
XYPOSITION position = 0.0;
|
||||
int ti=0;
|
||||
for (unsigned int ci=0; ci<count; ci++) {
|
||||
for (unsigned int inCluster=0; inCluster<clusterMetrics[ci].length; inCluster++) {
|
||||
@ -2497,9 +2487,8 @@ void SurfaceD2D::MeasureWidths(const Font *font_, std::string_view text, XYPOSIT
|
||||
PLATFORM_ASSERT(ti == tbuf.tlen);
|
||||
if (mode.codePage == SC_CP_UTF8) {
|
||||
// Map the widths given for UTF-16 characters back onto the UTF-8 input string
|
||||
int ui=0;
|
||||
size_t i=0;
|
||||
while (ui<tbuf.tlen) {
|
||||
size_t i = 0;
|
||||
for (int ui = 0; ui < tbuf.tlen; ui++) {
|
||||
const unsigned char uch = text[i];
|
||||
const unsigned int byteCount = UTF8BytesOfLead[uch];
|
||||
if (byteCount == 4) { // Non-BMP
|
||||
@ -2508,11 +2497,8 @@ void SurfaceD2D::MeasureWidths(const Font *font_, std::string_view text, XYPOSIT
|
||||
for (unsigned int bytePos=0; (bytePos<byteCount) && (i<text.length()) && (ui<tbuf.tlen); bytePos++) {
|
||||
positions[i++] = poses.buffer[ui];
|
||||
}
|
||||
ui++;
|
||||
}
|
||||
XYPOSITION lastPos = 0.0f;
|
||||
if (i > 0)
|
||||
lastPos = positions[i-1];
|
||||
const XYPOSITION lastPos = (i > 0) ? positions[i - 1] : 0.0;
|
||||
while (i<text.length()) {
|
||||
positions[i++] = lastPos;
|
||||
}
|
||||
@ -2617,7 +2603,7 @@ void SurfaceD2D::MeasureWidthsUTF8(const Font *font_, std::string_view text, XYP
|
||||
return;
|
||||
}
|
||||
// A cluster may be more than one WCHAR, such as for "ffi" which is a ligature in the Candara font
|
||||
FLOAT position = 0.0f;
|
||||
XYPOSITION position = 0.0;
|
||||
int ti = 0;
|
||||
for (unsigned int ci = 0; ci < count; ci++) {
|
||||
for (unsigned int inCluster = 0; inCluster < clusterMetrics[ci].length; inCluster++) {
|
||||
@ -2627,22 +2613,19 @@ void SurfaceD2D::MeasureWidthsUTF8(const Font *font_, std::string_view text, XYP
|
||||
}
|
||||
PLATFORM_ASSERT(ti == tbuf.tlen);
|
||||
// Map the widths given for UTF-16 characters back onto the UTF-8 input string
|
||||
int ui = 0;
|
||||
size_t i = 0;
|
||||
while (ui < tbuf.tlen) {
|
||||
for (int ui = 0; ui < tbuf.tlen; ui++) {
|
||||
const unsigned char uch = text[i];
|
||||
const unsigned int byteCount = UTF8BytesOfLead[uch];
|
||||
if (byteCount == 4) { // Non-BMP
|
||||
ui++;
|
||||
PLATFORM_ASSERT(ui < ti);
|
||||
}
|
||||
for (unsigned int bytePos=0; (bytePos<byteCount) && (i<text.length()); bytePos++) {
|
||||
positions[i++] = poses.buffer[ui];
|
||||
}
|
||||
ui++;
|
||||
}
|
||||
XYPOSITION lastPos = 0.0f;
|
||||
if (i > 0)
|
||||
lastPos = positions[i - 1];
|
||||
const XYPOSITION lastPos = (i > 0) ? positions[i - 1] : 0.0;
|
||||
while (i < text.length()) {
|
||||
positions[i++] = lastPos;
|
||||
}
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define VERSION_SCINTILLA "5.0.1"
|
||||
#define VERSION_WORDS 5, 0, 1, 0
|
||||
#define VERSION_SCINTILLA "5.0.2"
|
||||
#define VERSION_WORDS 5, 0, 2, 0
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION VERSION_WORDS
|
||||
|
||||
@ -583,7 +583,12 @@ ScintillaWin::ScintillaWin(HWND hwnd) {
|
||||
Init();
|
||||
}
|
||||
|
||||
ScintillaWin::~ScintillaWin() {}
|
||||
ScintillaWin::~ScintillaWin() {
|
||||
if (sysCaretBitmap) {
|
||||
::DeleteObject(sysCaretBitmap);
|
||||
sysCaretBitmap = {};
|
||||
}
|
||||
}
|
||||
|
||||
void ScintillaWin::Init() {
|
||||
// Initialize COM. If the app has already done this it will have
|
||||
|
||||
Loading…
Reference in New Issue
Block a user