aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaDoc.html45
-rw-r--r--doc/ScintillaHistory.html5
-rw-r--r--include/Scintilla.h4
-rw-r--r--include/Scintilla.iface12
-rw-r--r--scripts/CheckMentioned.py6
-rw-r--r--src/Editor.cxx32
-rw-r--r--src/LineMarker.cxx26
-rw-r--r--src/LineMarker.h7
8 files changed, 107 insertions, 30 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index ea1484501..ccbdf6550 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -252,6 +252,17 @@
</tr>
<tr>
+ <th align="left" id="colouralpha"><code>colouralpha</code></th>
+
+ <td>Colours are set using the RGBA format (Red, Green, Blue, Alpha).
+ This is similar to <a class="seealso" href="#colour">colour</a> but with a byte
+ of <a class="seealso" href="#colour">alpha</a> added. They are combined as:
+ red | (green &lt;&lt; 8) | (blue &lt;&lt; 16) | (alpha &lt;&lt; 24).
+ Fully opaque uses an alpha of 255. SC_ALPHA_NOALPHA is not possible for
+ colouralpha values.</td>
+ </tr>
+
+ <tr>
<th align="left" id="alpha"><code>alpha</code></th>
<td>Translucency is set using an alpha value.
@@ -4051,7 +4062,7 @@ struct Sci_TextToFind {
For example, on Win32, Direct2D supports drawing translucent lines but GDI does not so
<code>SCI_SUPPORTSFEATURE(SC_SUPPORTS_TRANSLUCENT_STROKE)</code>
will return 1 for Direct2D and 0 for GDI. Its possible that translucent line drawing will be implemented in a future
- revision to the GDI platform layer or will be implmented on particular Windows versions.
+ revision to the GDI platform layer or will be implemented on particular Windows versions.
This call allows applications to tailor their settings: perhaps displaying a box with translucent coloured fill on Direct2D but
a hollow box on GDI.</p>
<p>The features that can be queried are:</p>
@@ -4321,12 +4332,15 @@ struct Sci_TextToFind {
<a class="message" href="#SCI_MARKERDEFINERGBAIMAGE">SCI_MARKERDEFINERGBAIMAGE(int markerNumber,
const char *pixels)</a><br />
<a class="message" href="#SCI_MARKERSYMBOLDEFINED">SCI_MARKERSYMBOLDEFINED(int markerNumber) &rarr; int</a><br />
- <a class="message" href="#SCI_MARKERSETFORE">SCI_MARKERSETFORE(int markerNumber, colour
- fore)</a><br />
- <a class="message" href="#SCI_MARKERSETBACK">SCI_MARKERSETBACK(int markerNumber, colour
- back)</a><br />
+ <a class="message" href="#SCI_MARKERSETFORE">SCI_MARKERSETFORE(int markerNumber, colour fore)</a><br />
+ <a class="message" href="#SCI_MARKERSETFORETRANSLUCENT">SCI_MARKERSETFORETRANSLUCENT(int markerNumber, colouralpha fore)</a><br />
+ <a class="message" href="#SCI_MARKERSETBACK">SCI_MARKERSETBACK(int markerNumber, colour back)</a><br />
+ <a class="message" href="#SCI_MARKERSETBACKTRANSLUCENT">SCI_MARKERSETBACKTRANSLUCENT(int markerNumber, colouralpha back)</a><br />
<a class="message" href="#SCI_MARKERSETBACKSELECTED">SCI_MARKERSETBACKSELECTED(int markerNumber, colour
back)</a><br />
+ <a class="message" href="#SCI_MARKERSETBACKSELECTEDTRANSLUCENT">SCI_MARKERSETBACKSELECTEDTRANSLUCENT(int markerNumber, colouralpha
+ back)</a><br />
+ <a class="message" href="#SCI_MARKERSETSTROKEWIDTH">SCI_MARKERSETSTROKEWIDTH(int markerNumber, int hundredths)</a><br />
<a class="message" href="#SCI_MARKERENABLEHIGHLIGHT">SCI_MARKERENABLEHIGHLIGHT(bool enabled)</a><br />
<a class="message" href="#SCI_MARKERSETALPHA">SCI_MARKERSETALPHA(int markerNumber, alpha alpha)</a><br />
<a class="message" href="#SCI_MARKERADD">SCI_MARKERADD(line line, int markerNumber) &rarr; int</a><br />
@@ -4540,18 +4554,30 @@ struct Sci_TextToFind {
or <code>SC_MARK_PIXMAP</code> if defined with <code>SCI_MARKERDEFINEPIXMAP</code>
or <code>SC_MARK_RGBAIMAGE</code> if defined with <code>SCI_MARKERDEFINERGBAIMAGE</code>.</p>
- <p><b id="SCI_MARKERSETFORE">SCI_MARKERSETFORE(int markerNumber, <a class="jump" href="#colour">colour</a> fore)</b><br />
+ <p>
+ <b id="SCI_MARKERSETFORE">SCI_MARKERSETFORE(int markerNumber, <a class="jump" href="#colour">colour</a> fore)</b><br />
+ <b id="SCI_MARKERSETFORETRANSLUCENT">SCI_MARKERSETFORETRANSLUCENT(int markerNumber, <a class="jump" href="#colouralpha">colouralpha</a> fore)</b><br />
<b id="SCI_MARKERSETBACK">SCI_MARKERSETBACK(int markerNumber, <a class="jump" href="#colour">colour</a> back)</b><br />
- These two messages set the foreground and background colour of a marker number.<br />
+ <b id="SCI_MARKERSETBACKTRANSLUCENT">SCI_MARKERSETBACKTRANSLUCENT(int markerNumber, <a class="jump" href="#colouralpha">colouralpha</a> back)</b><br />
+ These messages set the foreground and background colour of a marker number.
+ The <code>TRANSLUCENT</code> variants can define different degrees of opacity.<br />
<b id="SCI_MARKERSETBACKSELECTED">SCI_MARKERSETBACKSELECTED(int markerNumber, <a class="jump" href="#colour">colour</a> back)</b><br />
+ <b id="SCI_MARKERSETBACKSELECTEDTRANSLUCENT">SCI_MARKERSETBACKSELECTEDTRANSLUCENT(int markerNumber, <a class="jump" href="#colouralpha">colouralpha</a> back)</b><br />
This message sets the highlight background colour of a marker number when its folding block is selected. The default colour is #FF0000.</p>
+
+ <p><b id="SCI_MARKERSETSTROKEWIDTH">SCI_MARKERSETSTROKEWIDTH(int markerNumber, int hundredths)</b><br />
+ This message sets the stroke width used to draw the marker in hundredths of a pixel.
+ The default value is 100 indicating a single pixel wide line.</p>
+
<p><b id="SCI_MARKERENABLEHIGHLIGHT">SCI_MARKERENABLEHIGHLIGHT(bool enabled)</b><br />
This message allows to enable/disable the highlight folding block when it is selected. (i.e. block that contains the caret)</p>
+
<p><b id="SCI_MARKERSETALPHA">SCI_MARKERSETALPHA(int markerNumber,
<a class="jump" href="#alpha">alpha</a> alpha)</b><br />
When markers are drawn in the content area, either because there is no margin for them or
they are of <code>SC_MARK_BACKGROUND</code> or <code>SC_MARK_UNDERLINE</code> types, they may be drawn translucently by
- setting an alpha value.</p>
+ setting an alpha value. This is only for the content area - in margins, translucency is achieved through the <code>SCI_MARKERSET&hellip;TRANSLUCENT</code>
+ methods.</p>
<p><b id="SCI_MARKERADD">SCI_MARKERADD(line line, int markerNumber) &rarr; int</b><br />
This message adds marker number <code class="parameter">markerNumber</code> to a line. The message returns -1 if
@@ -5009,8 +5035,7 @@ struct Sci_TextToFind {
<b id="SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE(position start, position lengthFill)</b><br />
<b id="SCI_INDICATORCLEARRANGE">SCI_INDICATORCLEARRANGE(position start, position lengthClear)</b><br />
These two messages fill or clear a range for the current indicator.
- <code>SCI_INDICATORFILLRANGE</code> fills with the
- the current value.
+ <code>SCI_INDICATORFILLRANGE</code> fills with the current value.
</p>
<p>
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 47f16e0ce..614866e30 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -600,6 +600,11 @@
Add SCI_INDICSETSTROKEWIDTH to set stroke width of indicators.
</li>
<li>
+ Add methods to set translucency and stroke width of markers.
+ SCI_MARKERSETFORETRANSLUCENT, SCI_MARKERSETBACKTRANSLUCENT,
+ SCI_MARKERSETBACKSELECTEDTRANSLUCENT, SCI_MARKERSETSTROKEWIDTH.
+ </li>
+ <li>
Change graphics coordinates from float (32-bit) to double (64-bit).
Fixes uneven line heights in large documents on Cocoa.
Increases memory use.
diff --git a/include/Scintilla.h b/include/Scintilla.h
index 69dc2d057..752c105a8 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -161,6 +161,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_MARKERSETFORE 2041
#define SCI_MARKERSETBACK 2042
#define SCI_MARKERSETBACKSELECTED 2292
+#define SCI_MARKERSETFORETRANSLUCENT 2294
+#define SCI_MARKERSETBACKTRANSLUCENT 2295
+#define SCI_MARKERSETBACKSELECTEDTRANSLUCENT 2296
+#define SCI_MARKERSETSTROKEWIDTH 2297
#define SCI_MARKERENABLEHIGHLIGHT 2293
#define SCI_MARKERADD 2043
#define SCI_MARKERDELETE 2044
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index 23938bfd9..333362cc0 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -404,6 +404,18 @@ set void MarkerSetBack=2042(int markerNumber, colour back)
# Set the background colour used for a particular marker number when its folding block is selected.
set void MarkerSetBackSelected=2292(int markerNumber, colour back)
+# Set the foreground colour used for a particular marker number.
+set void MarkerSetForeTranslucent=2294(int markerNumber, colouralpha fore)
+
+# Set the background colour used for a particular marker number.
+set void MarkerSetBackTranslucent=2295(int markerNumber, colouralpha back)
+
+# Set the background colour used for a particular marker number when its folding block is selected.
+set void MarkerSetBackSelectedTranslucent=2296(int markerNumber, colouralpha back)
+
+# Set the width of strokes used in .01 pixels so 50 = 1/2 pixel width.
+set void MarkerSetStrokeWidth=2297(int markerNumber, int hundredths)
+
# Enable/disable highlight for current folding block (smallest one that contains the caret)
fun void MarkerEnableHighlight=2293(bool enabled,)
diff --git a/scripts/CheckMentioned.py b/scripts/CheckMentioned.py
index bcbbaa6c9..cd518ce28 100644
--- a/scripts/CheckMentioned.py
+++ b/scripts/CheckMentioned.py
@@ -144,7 +144,10 @@ def checkDocumentation():
for api, sig in re.findall(dirPattern, docs):
sigApi = re.split('\W+', sig)[0]
sigFlat = flattenSpaces(sig)
+ sigFlat = sigFlat.replace('colouralpha ', 'xxxx ') # Temporary to avoid next line
sigFlat = sigFlat.replace('alpha ', 'int ')
+ sigFlat = sigFlat.replace('xxxx ', 'colouralpha ')
+
sigFlat = sigFlat.replace("document *", "int ")
sigFlat = sigFlat.rstrip()
if '(' in sigFlat or api.startswith("SCI_"):
@@ -170,8 +173,11 @@ def checkDocumentation():
sigFlat = flattenSpaces(sig)
if '<a' in sigFlat : # Remove anchors
sigFlat = re.sub('<a.*>(.+)</a>', '\\1', sigFlat)
+ sigFlat = sigFlat.replace('colouralpha ', 'xxxx ') # Temporary to avoid next line
sigFlat = sigFlat.replace('alpha ', 'int ')
+ sigFlat = sigFlat.replace('xxxx ', 'colouralpha ')
sigFlat = sigFlat.replace("document *", "int ")
+
sigFlat = sigFlat.replace(' NUL-terminated', '')
sigFlat = sigFlat.rstrip()
#~ sigFlat = sigFlat.replace(' NUL-terminated', '')
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 7ad889c23..ad56a8eb8 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -6946,22 +6946,46 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
InvalidateStyleData();
RedrawSelMargin();
break;
+ case SCI_MARKERSETBACK:
+ if (wParam <= MARKER_MAX)
+ vs.markers[wParam].back = ColourDesired(static_cast<int>(lParam));
+ InvalidateStyleData();
+ RedrawSelMargin();
+ break;
case SCI_MARKERSETBACKSELECTED:
if (wParam <= MARKER_MAX)
vs.markers[wParam].backSelected = ColourDesired(static_cast<int>(lParam));
InvalidateStyleData();
RedrawSelMargin();
break;
- case SCI_MARKERENABLEHIGHLIGHT:
- marginView.highlightDelimiter.isEnabled = wParam == 1;
+ case SCI_MARKERSETFORETRANSLUCENT:
+ if (wParam <= MARKER_MAX)
+ vs.markers[wParam].fore = ColourAlpha(static_cast<int>(lParam));
+ InvalidateStyleData();
RedrawSelMargin();
break;
- case SCI_MARKERSETBACK:
+ case SCI_MARKERSETBACKTRANSLUCENT:
if (wParam <= MARKER_MAX)
- vs.markers[wParam].back = ColourDesired(static_cast<int>(lParam));
+ vs.markers[wParam].back = ColourAlpha(static_cast<int>(lParam));
InvalidateStyleData();
RedrawSelMargin();
break;
+ case SCI_MARKERSETBACKSELECTEDTRANSLUCENT:
+ if (wParam <= MARKER_MAX)
+ vs.markers[wParam].backSelected = ColourAlpha(static_cast<int>(lParam));
+ InvalidateStyleData();
+ RedrawSelMargin();
+ break;
+ case SCI_MARKERSETSTROKEWIDTH:
+ if (wParam <= MARKER_MAX)
+ vs.markers[wParam].strokeWidth = lParam / 100.0f;
+ InvalidateStyleData();
+ RedrawSelMargin();
+ break;
+ case SCI_MARKERENABLEHIGHLIGHT:
+ marginView.highlightDelimiter.isEnabled = wParam == 1;
+ RedrawSelMargin();
+ break;
case SCI_MARKERSETALPHA:
if (wParam <= MARKER_MAX)
vs.markers[wParam].alpha = static_cast<int>(lParam);
diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx
index 5acfb7cb3..35cf0ab4c 100644
--- a/src/LineMarker.cxx
+++ b/src/LineMarker.cxx
@@ -34,6 +34,7 @@ LineMarker::LineMarker(const LineMarker &other) {
fore = other.fore;
back = other.back;
backSelected = other.backSelected;
+ strokeWidth = other.strokeWidth;
alpha = other.alpha;
if (other.pxpm)
pxpm = std::make_unique<XPM>(*other.pxpm);
@@ -53,6 +54,7 @@ LineMarker &LineMarker::operator=(const LineMarker &other) {
fore = other.fore;
back = other.back;
backSelected = other.backSelected;
+ strokeWidth = other.strokeWidth;
alpha = other.alpha;
if (other.pxpm)
pxpm = std::make_unique<XPM>(*other.pxpm);
@@ -88,7 +90,7 @@ enum class Expansion { Minus, Plus };
enum class Shape { Square, Circle };
void DrawSymbol(Surface *surface, Shape shape, Expansion expansion, PRectangle rcSymbol, XYPOSITION widthStroke,
- ColourDesired colourFill, ColourDesired colourFrame, ColourDesired colourFrameRight, ColourDesired colourExpansion) {
+ ColourAlpha colourFill, ColourAlpha colourFrame, ColourAlpha colourFrameRight, ColourAlpha colourExpansion) {
const FillStroke fillStroke(colourFill, colourFrame, widthStroke);
const PRectangle rcSymbolLeft = Side(rcSymbol, Edge::left, (rcSymbol.Width() + widthStroke) / 2.0f);
@@ -127,7 +129,7 @@ void DrawSymbol(Surface *surface, Shape shape, Expansion expansion, PRectangle r
}
}
-void DrawTail(Surface *surface, XYPOSITION leftLine, XYPOSITION rightTail, XYPOSITION centreY, XYPOSITION widthSymbolStroke, ColourDesired fill) {
+void DrawTail(Surface *surface, XYPOSITION leftLine, XYPOSITION rightTail, XYPOSITION centreY, XYPOSITION widthSymbolStroke, ColourAlpha fill) {
const XYPOSITION slopeLength = 2.0f + widthSymbolStroke;
const XYPOSITION strokeTop = centreY + slopeLength;
const XYPOSITION halfWidth = widthSymbolStroke / 2.0f;
@@ -147,11 +149,10 @@ void DrawTail(Surface *surface, XYPOSITION leftLine, XYPOSITION rightTail, XYPOS
void LineMarker::DrawFoldingMark(Surface *surface, const PRectangle &rcWhole, FoldPart part) const {
// Assume: edges of rcWhole are integers.
// Code can only really handle integer strokeWidth.
- constexpr XYPOSITION strokeWidth = 1.0f;
- ColourDesired colourHead = back;
- ColourDesired colourBody = back;
- ColourDesired colourTail = back;
+ ColourAlpha colourHead = back;
+ ColourAlpha colourBody = back;
+ ColourAlpha colourTail = back;
switch (part) {
case FoldPart::head:
@@ -249,11 +250,11 @@ void LineMarker::DrawFoldingMark(Surface *surface, const PRectangle &rcWhole, Fo
break;
case SC_MARK_BOXPLUSCONNECTED: {
- const ColourDesired colourBelow = (part == FoldPart::headWithTail) ? colourTail : colourBody;
+ const ColourAlpha colourBelow = (part == FoldPart::headWithTail) ? colourTail : colourBody;
surface->FillRectangle(rcBelowSymbol, colourBelow);
surface->FillRectangle(rcAboveSymbol, colourBody);
- const ColourDesired colourRight = (part == FoldPart::body) ? colourTail : colourHead;
+ const ColourAlpha colourRight = (part == FoldPart::body) ? colourTail : colourHead;
DrawSymbol(surface, Shape::Square, Expansion::Plus, rcSymbol, widthStroke,
fore, colourHead, colourRight, colourTail);
}
@@ -269,7 +270,7 @@ void LineMarker::DrawFoldingMark(Surface *surface, const PRectangle &rcWhole, Fo
surface->FillRectangle(rcBelowSymbol, colourHead);
surface->FillRectangle(rcAboveSymbol, colourBody);
- const ColourDesired colourRight = (part == FoldPart::body) ? colourTail : colourHead;
+ const ColourAlpha colourRight = (part == FoldPart::body) ? colourTail : colourHead;
DrawSymbol(surface, Shape::Square, Expansion::Minus, rcSymbol, widthStroke,
fore, colourHead, colourRight, colourTail);
}
@@ -281,11 +282,11 @@ void LineMarker::DrawFoldingMark(Surface *surface, const PRectangle &rcWhole, Fo
break;
case SC_MARK_CIRCLEPLUSCONNECTED: {
- const ColourDesired colourBelow = (part == FoldPart::headWithTail) ? colourTail : colourBody;
+ const ColourAlpha colourBelow = (part == FoldPart::headWithTail) ? colourTail : colourBody;
surface->FillRectangle(rcBelowSymbol, colourBelow);
surface->FillRectangle(rcAboveSymbol, colourBody);
- const ColourDesired colourRight = (part == FoldPart::body) ? colourTail : colourHead;
+ const ColourAlpha colourRight = (part == FoldPart::body) ? colourTail : colourHead;
DrawSymbol(surface, Shape::Circle, Expansion::Plus, rcSymbol, widthStroke,
fore, colourHead, colourRight, colourTail);
}
@@ -300,7 +301,7 @@ void LineMarker::DrawFoldingMark(Surface *surface, const PRectangle &rcWhole, Fo
case SC_MARK_CIRCLEMINUSCONNECTED: {
surface->FillRectangle(rcBelowSymbol, colourHead);
surface->FillRectangle(rcAboveSymbol, colourBody);
- const ColourDesired colourRight = (part == FoldPart::body) ? colourTail : colourHead;
+ const ColourAlpha colourRight = (part == FoldPart::body) ? colourTail : colourHead;
DrawSymbol(surface, Shape::Circle, Expansion::Minus, rcSymbol, widthStroke,
fore, colourHead, colourRight, colourTail);
}
@@ -311,7 +312,6 @@ void LineMarker::DrawFoldingMark(Surface *surface, const PRectangle &rcWhole, Fo
void LineMarker::Draw(Surface *surface, const PRectangle &rcWhole, const Font *fontForCharacter, FoldPart part, int marginStyle) const {
// This is to satisfy the changed API - eventually the stroke width will be exposed to clients
- constexpr float strokeWidth = 1.0f;
if (customDraw) {
customDraw(surface, rcWhole, fontForCharacter, static_cast<int>(part), marginStyle, this);
diff --git a/src/LineMarker.h b/src/LineMarker.h
index 232a29dbb..b417ec34d 100644
--- a/src/LineMarker.h
+++ b/src/LineMarker.h
@@ -22,10 +22,11 @@ public:
enum class FoldPart { undefined, head, body, tail, headWithTail };
int markType = SC_MARK_CIRCLE;
- ColourDesired fore = ColourDesired(0, 0, 0);
- ColourDesired back = ColourDesired(0xff, 0xff, 0xff);
- ColourDesired backSelected = ColourDesired(0xff, 0x00, 0x00);
+ ColourAlpha fore = ColourAlpha(0, 0, 0);
+ ColourAlpha back = ColourAlpha(0xff, 0xff, 0xff);
+ ColourAlpha backSelected = ColourAlpha(0xff, 0x00, 0x00);
int alpha = SC_ALPHA_NOALPHA;
+ XYPOSITION strokeWidth = 1.0f;
std::unique_ptr<XPM> pxpm;
std::unique_ptr<RGBAImage> image;
/** Some platforms, notably PLAT_CURSES, do not support Scintilla's native