Skip to content
This repository was archived by the owner on Dec 22, 2023. It is now read-only.

Commit e7f1d59

Browse files
committed
Updated SciLexer to v3.7.0 and added new features.
MarginCollection.Capacity will now allow an arbitrary number of margins. MarginType.Color and Margin.BackColor can be used to specify custom margin background colors. EdgeMode.MultiLine and Scintilla.MultiEdgeAddLine can be used to add multiple long line indicators. Couldn't get the new MouseWheelCaptures property to work so that is curently commented out.
1 parent 4796997 commit e7f1d59

21 files changed

+144
-13
lines changed

src/ScintillaNET.Signed.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata>
44
<id>jacobslusser.ScintillaNET.Signed</id>
5-
<version>3.5.11</version>
5+
<version>3.6.0</version>
66
<title>ScintillaNET Source Editing Component - Signed</title>
77
<authors>Jacob Slusser</authors>
88
<owners>Jacob Slusser</owners>

src/ScintillaNET.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata>
44
<id>jacobslusser.ScintillaNET</id>
5-
<version>3.5.11</version>
5+
<version>3.6.0</version>
66
<title>ScintillaNET Source Editing Component</title>
77
<authors>Jacob Slusser</authors>
88
<owners>Jacob Slusser</owners>

src/ScintillaNET/EdgeMode.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ public enum EdgeMode
2323
/// <summary>
2424
/// Long lines are indicated with a background color.
2525
/// </summary>
26-
Background = NativeMethods.EDGE_BACKGROUND
26+
Background = NativeMethods.EDGE_BACKGROUND,
27+
28+
/// <summary>
29+
/// Similar to <see cref="Line" /> except allows for multiple vertical lines to be visible using the <see cref="Scintilla.MultiEdgeAddLine" /> method.
30+
/// </summary>
31+
/// <remarks><see cref="Line" /> and <see cref="Scintilla.EdgeColumn" /> are completely independant of this mode.</remarks>
32+
MultiLine = NativeMethods.EDGE_MULTILINE
2733
}
2834
}

src/ScintillaNET/Margin.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Drawing;
34
using System.Linq;
45
using System.Text;
56

@@ -10,8 +11,36 @@ namespace ScintillaNET
1011
/// </summary>
1112
public class Margin
1213
{
14+
#region Fields
15+
1316
private readonly Scintilla scintilla;
1417

18+
#endregion Fields
19+
20+
#region Properties
21+
22+
/// <summary>
23+
/// Gets or sets the background color of the margin when the <see cref="Type" /> property is set to <see cref="MarginType.Color" />.
24+
/// </summary>
25+
/// <returns>A Color object representing the margin background color. The default is Black.</returns>
26+
/// <remarks>Alpha color values are ignored.</remarks>
27+
public Color BackColor
28+
{
29+
get
30+
{
31+
var color = scintilla.DirectMessage(NativeMethods.SCI_GETMARGINBACKN, new IntPtr(Index)).ToInt32();
32+
return ColorTranslator.FromWin32(color);
33+
}
34+
set
35+
{
36+
if (value.IsEmpty)
37+
value = Color.Black;
38+
39+
var color = ColorTranslator.ToWin32(value);
40+
scintilla.DirectMessage(NativeMethods.SCI_SETMARGINBACKN, new IntPtr(Index), new IntPtr(color));
41+
}
42+
}
43+
1544
/// <summary>
1645
/// Gets or sets the mouse cursor style when over the margin.
1746
/// </summary>
@@ -112,6 +141,10 @@ public uint Mask
112141
}
113142
}
114143

144+
#endregion Properties
145+
146+
#region Constructors
147+
115148
/// <summary>
116149
/// Initializes a new instance of the <see cref="Margin" /> class.
117150
/// </summary>
@@ -122,5 +155,7 @@ public Margin(Scintilla scintilla, int index)
122155
this.scintilla = scintilla;
123156
Index = index;
124157
}
158+
159+
#endregion Constructors
125160
}
126161
}

src/ScintillaNET/MarginCollection.cs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,38 @@ IEnumerator IEnumerable.GetEnumerator()
4040
return this.GetEnumerator();
4141
}
4242

43+
/// <summary>
44+
/// Gets or sets the number of margins in the <see cref="MarginCollection" />.
45+
/// </summary>
46+
/// <returns>The number of margins in the collection. The default is 5.</returns>
47+
[DefaultValue(NativeMethods.SC_MAX_MARGIN + 1)]
48+
[Description("The maximum number of margins.")]
49+
public int Capacity
50+
{
51+
get
52+
{
53+
return scintilla.DirectMessage(NativeMethods.SCI_GETMARGINS).ToInt32();
54+
}
55+
set
56+
{
57+
value = Helpers.ClampMin(value, 0);
58+
scintilla.DirectMessage(NativeMethods.SCI_SETMARGINS, new IntPtr(value));
59+
}
60+
}
61+
4362
/// <summary>
4463
/// Gets the number of margins in the <see cref="MarginCollection" />.
4564
/// </summary>
46-
/// <returns>This property always returns 5.</returns>
65+
/// <returns>The number of margins in the collection.</returns>
66+
/// <remarks>This property is kept for convenience. The return value will always be equal to <see cref="Capacity" />.</remarks>
67+
/// <seealso cref="Capacity" />
4768
[Browsable(false)]
4869
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
4970
public int Count
5071
{
5172
get
5273
{
53-
return (NativeMethods.SC_MAX_MARGIN + 1);
74+
return Capacity;
5475
}
5576
}
5677

@@ -73,6 +94,7 @@ public int Left
7394
}
7495
}
7596

97+
// TODO Why is this commented out?
7698
/*
7799
/// <summary>
78100
/// Gets or sets the margin options.

src/ScintillaNET/MarginType.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ public enum MarginType
2121
Number = NativeMethods.SC_MARGIN_NUMBER,
2222

2323
/// <summary>
24-
/// Margin can display symbols and has a background color equivalent to the default style background color.
24+
/// Margin can display symbols and has a background color equivalent to <see cref="Style.Default" /> background color.
2525
/// </summary>
2626
BackColor = NativeMethods.SC_MARGIN_BACK,
2727

2828
/// <summary>
29-
/// Margin can display symbols and has a background color equivalent to the default style foreground color.
29+
/// Margin can display symbols and has a background color equivalent to <see cref="Style.Default"/> foreground color.
3030
/// </summary>
3131
ForeColor = NativeMethods.SC_MARGIN_FORE,
3232

@@ -38,6 +38,11 @@ public enum MarginType
3838
/// <summary>
3939
/// Margin can display application defined text right-justified.
4040
/// </summary>
41-
RightText = NativeMethods.SC_MARGIN_RTEXT
41+
RightText = NativeMethods.SC_MARGIN_RTEXT,
42+
43+
/// <summary>
44+
/// Margin can display symbols and has a background color specified using the <see cref="Margin.BackColor" /> property.
45+
/// </summary>
46+
Color = NativeMethods.SC_MARGIN_COLOUR
4247
}
4348
}

src/ScintillaNET/NativeMethods.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ internal static class NativeMethods
6969
public const int EDGE_NONE = 0;
7070
public const int EDGE_LINE = 1;
7171
public const int EDGE_BACKGROUND = 2;
72+
public const int EDGE_MULTILINE = 3;
7273

7374
// Message-only window
7475
public const int HWND_MESSAGE = (-3);
@@ -179,6 +180,7 @@ internal static class NativeMethods
179180
public const int SC_MARGIN_FORE = 3;
180181
public const int SC_MARGIN_TEXT = 4;
181182
public const int SC_MARGIN_RTEXT = 5;
183+
public const int SC_MARGIN_COLOUR = 6;
182184

183185
public const int SC_MARGINOPTION_NONE = 0;
184186
public const int SC_MARGINOPTION_SUBLINESELECT = 1;
@@ -347,6 +349,10 @@ internal static class NativeMethods
347349
public const int SCI_GETMARGINSENSITIVEN = 2247;
348350
public const int SCI_SETMARGINCURSORN = 2248;
349351
public const int SCI_GETMARGINCURSORN = 2249;
352+
public const int SCI_SETMARGINBACKN = 2250;
353+
public const int SCI_GETMARGINBACKN = 2251;
354+
public const int SCI_SETMARGINS = 2252;
355+
public const int SCI_GETMARGINS = 2253;
350356
public const int SCI_STYLECLEARALL = 2050;
351357
public const int SCI_STYLESETFORE = 2051;
352358
public const int SCI_STYLESETBACK = 2052;
@@ -929,6 +935,10 @@ internal static class NativeMethods
929935
public const int SCI_GETTARGETTEXT = 2687;
930936
public const int SCI_SETIDLESTYLING = 2692;
931937
public const int SCI_GETIDLESTYLING = 2693;
938+
public const int SCI_MULTIEDGEADDLINE = 2694;
939+
public const int SCI_MULTIEDGECLEARALL = 2695;
940+
public const int SCI_SETMOUSEWHEELCAPTURES = 2696;
941+
public const int SCI_GETMOUSEWHEELCAPTURES = 2697;
932942
public const int SCI_STARTRECORD = 3001;
933943
public const int SCI_STOPRECORD = 3002;
934944
public const int SCI_SETLEXER = 4001;

src/ScintillaNET/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
// You can specify all the values or you can default the Build and Revision Numbers
3636
// by using the '*' as shown below:
3737
// [assembly: AssemblyVersion("1.0.*")]
38-
[assembly: AssemblyVersion("3.5.11.0")]
39-
[assembly: AssemblyFileVersion("3.5.11.0")]
40-
[assembly: AssemblyInformationalVersion("3.5.11")]
38+
[assembly: AssemblyVersion("3.6.0.0")]
39+
[assembly: AssemblyFileVersion("3.6.0.0")]
40+
[assembly: AssemblyInformationalVersion("3.6.0")]
4141
[assembly: NeutralResourcesLanguageAttribute("en-US")]
4242

4343
#if (DEBUG)

src/ScintillaNET/Scintilla.cs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,6 +1406,30 @@ public int MarkerLineFromHandle(MarkerHandle markerHandle)
14061406
return DirectMessage(NativeMethods.SCI_MARKERLINEFROMHANDLE, markerHandle.Value).ToInt32();
14071407
}
14081408

1409+
/// <summary>
1410+
/// Specifies the long line indicator column number and color when <see cref="EdgeMode" /> is <see cref="EdgeMode.MultiLine" />.
1411+
/// </summary>
1412+
/// <param name="column">The zero-based column number to indicate.</param>
1413+
/// <param name="edgeColor">The color of the vertical long line indicator.</param>
1414+
/// <remarks>A column is defined as the width of a space character in the <see cref="Style.Default" /> style.</remarks>
1415+
/// <seealso cref="MultiEdgeClearAll" />
1416+
public void MultiEdgeAddLine(int column, Color edgeColor)
1417+
{
1418+
column = Helpers.ClampMin(column, 0);
1419+
var colour = ColorTranslator.ToWin32(edgeColor);
1420+
1421+
DirectMessage(NativeMethods.SCI_MULTIEDGEADDLINE, new IntPtr(column), new IntPtr(colour));
1422+
}
1423+
1424+
/// <summary>
1425+
/// Removes all the long line column indicators specified using <seealso cref="MultiEdgeAddLine" />.
1426+
/// </summary>
1427+
/// <seealso cref="MultiEdgeAddLine" />
1428+
public void MultiEdgeClearAll()
1429+
{
1430+
DirectMessage(NativeMethods.SCI_MULTIEDGECLEARALL);
1431+
}
1432+
14091433
/// <summary>
14101434
/// Searches for all instances of the main selection within the <see cref="TargetStart" /> and <see cref="TargetEnd" />
14111435
/// range and adds any matches to the selection.
@@ -4418,6 +4442,35 @@ public bool MouseSelectionRectangularSwitch
44184442
}
44194443
}
44204444

4445+
// The MouseWheelCaptures property doesn't seem to work correctly in Windows Forms so hiding for now...
4446+
// P.S. I'm avoiding the MouseDownCaptures property (SCI_SETMOUSEDOWNCAPTURES & SCI_GETMOUSEDOWNCAPTURES) for the same reason... I don't expect it to work in Windows Forms.
4447+
4448+
/*
4449+
/// <summary>
4450+
/// Gets or sets whether to respond to mouse wheel messages if the control has focus but the mouse is not currently over the control.
4451+
/// </summary>
4452+
/// <returns>
4453+
/// true to respond to mouse wheel messages even when the mouse is not currently over the control; otherwise, false.
4454+
/// The default is true.
4455+
/// </returns>
4456+
/// <remarks>Scintilla will still react to the mouse wheel if the mouse pointer is over the editor window.</remarks>
4457+
[DefaultValue(true)]
4458+
[Category("Mouse")]
4459+
[Description("Enable or disable mouse wheel support when the mouse is outside the control bounds, but the control still has focus.")]
4460+
public bool MouseWheelCaptures
4461+
{
4462+
get
4463+
{
4464+
return DirectMessage(NativeMethods.SCI_GETMOUSEWHEELCAPTURES) != IntPtr.Zero;
4465+
}
4466+
set
4467+
{
4468+
var mouseWheelCaptures = (value ? new IntPtr(1) : IntPtr.Zero);
4469+
DirectMessage(NativeMethods.SCI_SETMOUSEWHEELCAPTURES, mouseWheelCaptures);
4470+
}
4471+
}
4472+
*/
4473+
44214474
/// <summary>
44224475
/// Gets or sets whether multiple selection is enabled.
44234476
/// </summary>

src/ScintillaNET/x64/SciLexer.dll

25.5 KB
Binary file not shown.

src/ScintillaNET/x64/SciLexer.dll.gz

9.61 KB
Binary file not shown.

src/ScintillaNET/x64/SciLexer.exp

0 Bytes
Binary file not shown.

src/ScintillaNET/x64/SciLexer.lib

0 Bytes
Binary file not shown.

src/ScintillaNET/x64/SciLexer.pdb

392 KB
Binary file not shown.

src/ScintillaNET/x64/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
367
1+
370

src/ScintillaNET/x86/SciLexer.dll

17 KB
Binary file not shown.

src/ScintillaNET/x86/SciLexer.dll.gz

7.99 KB
Binary file not shown.

src/ScintillaNET/x86/SciLexer.exp

0 Bytes
Binary file not shown.

src/ScintillaNET/x86/SciLexer.lib

0 Bytes
Binary file not shown.

src/ScintillaNET/x86/SciLexer.pdb

376 KB
Binary file not shown.

src/ScintillaNET/x86/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
367
1+
370

0 commit comments

Comments
 (0)