aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaDoc.html12
-rw-r--r--doc/ScintillaHistory.html4
-rw-r--r--include/Scintilla.h3
-rw-r--r--include/Scintilla.iface7
-rw-r--r--src/Editor.cxx13
-rw-r--r--src/MarginView.cxx3
-rw-r--r--src/ViewStyle.h1
7 files changed, 41 insertions, 2 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index b348a68b7..3ebf00919 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -3172,6 +3172,8 @@ struct Sci_TextToFind {
cursor)</a><br />
<a class="message" href="#SCI_GETMARGINCURSORN">SCI_GETMARGINCURSORN(int
margin)</a><br />
+ <a class="message" href="#SCI_SETMARGINBACKN">SCI_SETMARGINBACKN(int margin, int colour)</a><br />
+ <a class="message" href="#SCI_GETMARGINBACKN">SCI_GETMARGINBACKN(int margin)</a><br />
<a class="message" href="#SCI_SETMARGINLEFT">SCI_SETMARGINLEFT(&lt;unused&gt;, int
pixels)</a><br />
<a class="message" href="#SCI_GETMARGINLEFT">SCI_GETMARGINLEFT</a><br />
@@ -3201,9 +3203,10 @@ struct Sci_TextToFind {
A margin with application defined text may use <code>SC_MARGIN_TEXT</code> (4) or
<code>SC_MARGIN_RTEXT</code> (5) to right justify the text.
By convention, margin 0 is used for line numbers and the next two are used for symbols. You can
- also use the constants <code>SC_MARGIN_BACK</code> (2) and <code>SC_MARGIN_FORE</code> (3) for
+ also use the constants <code>SC_MARGIN_BACK</code> (2), <code>SC_MARGIN_FORE</code> (3),
+ and <code>SC_MARGIN_COLOUR</code> (6) for
symbol margins that set their background colour to match the STYLE_DEFAULT background and
- foreground colours.</p>
+ foreground colours or a specified colour.</p>
<p><b id="SCI_SETMARGINWIDTHN">SCI_SETMARGINWIDTHN(int margin, int pixelWidth)</b><br />
<b id="SCI_GETMARGINWIDTHN">SCI_GETMARGINWIDTHN(int margin)</b><br />
@@ -3259,6 +3262,11 @@ struct Sci_TextToFind {
reversed arrow with
<code>SCI_SETMARGINCURSORN(margin, SC_CURSORREVERSEARROW)</code>.</p>
+ <p><b id="SCI_SETMARGINBACKN">SCI_SETMARGINBACKN(int margin, int <a class="jump" href="#colour">colour</a>)</b><br />
+ <b id="SCI_GETMARGINBACKN">SCI_GETMARGINBACKN(int margin)</b><br />
+ A margin of type <code>SC_MARGIN_COLOUR</code>
+ may have its colour set with <code>SCI_SETMARGINBACKN</code>.</p>
+
<p><b id="SCI_SETMARGINLEFT">SCI_SETMARGINLEFT(&lt;unused&gt;, int pixels)</b><br />
<b id="SCI_GETMARGINLEFT">SCI_GETMARGINLEFT</b><br />
<b id="SCI_SETMARGINRIGHT">SCI_SETMARGINRIGHT(&lt;unused&gt;, int pixels)</b><br />
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 16cad92ee..96de2872e 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -531,6 +531,10 @@
vertical edges simultaneously.
<li>
<li>
+ Margin type SC_MARGIN_COLOUR added so that the application may
+ choose any colour for a margin with SCI_SETMARGINBACKN.
+ <li>
+ <li>
On Win32, mouse wheel scrolling can be restricted to only occur when the mouse is
within the window.
<li>
diff --git a/include/Scintilla.h b/include/Scintilla.h
index 2d6b06b22..77f4d5c7a 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -167,6 +167,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_MARGIN_FORE 3
#define SC_MARGIN_TEXT 4
#define SC_MARGIN_RTEXT 5
+#define SC_MARGIN_COLOUR 6
#define SCI_SETMARGINTYPEN 2240
#define SCI_GETMARGINTYPEN 2241
#define SCI_SETMARGINWIDTHN 2242
@@ -177,6 +178,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETMARGINSENSITIVEN 2247
#define SCI_SETMARGINCURSORN 2248
#define SCI_GETMARGINCURSORN 2249
+#define SCI_SETMARGINBACKN 2250
+#define SCI_GETMARGINBACKN 2251
#define STYLE_DEFAULT 32
#define STYLE_LINENUMBER 33
#define STYLE_BRACELIGHT 34
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index bee9aeef8..fdc90807e 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -360,6 +360,7 @@ val SC_MARGIN_BACK=2
val SC_MARGIN_FORE=3
val SC_MARGIN_TEXT=4
val SC_MARGIN_RTEXT=5
+val SC_MARGIN_COLOUR=6
# Set a margin to be either numeric or symbolic.
set void SetMarginTypeN=2240(int margin, int marginType)
@@ -391,6 +392,12 @@ set void SetMarginCursorN=2248(int margin, int cursor)
# Retrieve the cursor shown in a margin.
get int GetMarginCursorN=2249(int margin,)
+# Set the background colour of a margin. Only visible for SC_MARGIN_COLOUR.
+set void SetMarginBackN=2250(int margin, colour back)
+
+# Retrieve the background colour of a margin
+get colour GetMarginBackN=2251(int margin,)
+
# Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles.
# Style 39 is for future use.
enu StylesCommon=STYLE_
diff --git a/src/Editor.cxx b/src/Editor.cxx
index ee4d3947f..0e686e101 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -6884,6 +6884,19 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
else
return 0;
+ case SCI_SETMARGINBACKN:
+ if (ValidMargin(wParam)) {
+ vs.ms[wParam].back = ColourDesired(static_cast<long>(lParam));
+ InvalidateStyleRedraw();
+ }
+ break;
+
+ case SCI_GETMARGINBACKN:
+ if (ValidMargin(wParam))
+ return vs.ms[wParam].back.AsLong();
+ else
+ return 0;
+
case SCI_STYLECLEARALL:
vs.ClearStyles();
InvalidateStyleRedraw();
diff --git a/src/MarginView.cxx b/src/MarginView.cxx
index 52a2cb2dd..ab8cbf4f8 100644
--- a/src/MarginView.cxx
+++ b/src/MarginView.cxx
@@ -216,6 +216,9 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect
case SC_MARGIN_FORE:
colour = vs.styles[STYLE_DEFAULT].fore;
break;
+ case SC_MARGIN_COLOUR:
+ colour = vs.ms[margin].back;
+ break;
default:
colour = vs.styles[STYLE_LINENUMBER].back;
break;
diff --git a/src/ViewStyle.h b/src/ViewStyle.h
index be84598f1..7a2c26f63 100644
--- a/src/ViewStyle.h
+++ b/src/ViewStyle.h
@@ -17,6 +17,7 @@ namespace Scintilla {
class MarginStyle {
public:
int style;
+ ColourDesired back;
int width;
int mask;
bool sensitive;