### 2024-12-20 星期五更新
------ #### SuperDesign V3.0.2412.2001 - *.[新增]新增程序更新日志设置和自动发布功能。 - *.[修复]修复Post数据格式不正确时双击文本框会导致软件闪退的BUG。
This commit is contained in:
1 parent
03bcb8c5fd
commit
993f1ca1a9
349 files changed
+81977
-13873
No files matched your search
@@ -0,0 +1,49 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
namespace ScintillaDiff.Enumerations
|
||||
{
|
||||
/// <summary>
|
||||
/// An enumeration for the character change type in case the character level comparison is set in the <see cref="ScintillaDiffControl"/>.
|
||||
/// </summary>
|
||||
public enum CharChangedType
|
||||
{
|
||||
/// <summary>
|
||||
/// The character was modified.
|
||||
/// </summary>
|
||||
Modified,
|
||||
|
||||
/// <summary>
|
||||
/// The character was added.
|
||||
/// </summary>
|
||||
Added,
|
||||
|
||||
/// <summary>
|
||||
/// The character was removed.
|
||||
/// </summary>
|
||||
Removed,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using ScintillaNET;
|
||||
|
||||
namespace ScintillaDiff
|
||||
{
|
||||
/// <summary>
|
||||
/// A helper class to highlight words with a given color.
|
||||
/// </summary>
|
||||
public class Highlight
|
||||
{
|
||||
/// <summary>
|
||||
/// Highlights a given range with a given color and given alpha values of the <see cref="Scintilla"/> control.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">The scintilla of which words to highlight.</param>
|
||||
/// <param name="num">The indicator number for the <paramref name="scintilla"/>.Indicators 0-7 could be in use by a lexer so use a higher value.</param>
|
||||
/// <param name="start">The starting position of the highlight area.</param>
|
||||
/// <param name="length">The length of the highlight area.</param>
|
||||
/// <param name="color">The color to use for the highlight.</param>
|
||||
/// <param name="alpha">The transparency value of the indicator.</param>
|
||||
/// <param name="outlineAlpha">The transparency value of the indicator outline.</param>
|
||||
/// <note>(C): https://github.com/jacobslusser/ScintillaNET/wiki/Find-and-Highlight-Words</note>
|
||||
public static void HighlightRange(Scintilla scintilla, int num, int start, int length, Color color, byte alpha = 255, byte outlineAlpha = 255)
|
||||
{
|
||||
// Remove all uses of our indicator
|
||||
scintilla.IndicatorCurrent = num;
|
||||
|
||||
// Update indicator appearance
|
||||
scintilla.Indicators[num].Style = IndicatorStyle.StraightBox;
|
||||
scintilla.Indicators[num].Under = true;
|
||||
scintilla.Indicators[num].ForeColor = color;
|
||||
scintilla.Indicators[num].OutlineAlpha = alpha;
|
||||
scintilla.Indicators[num].Alpha = outlineAlpha;
|
||||
|
||||
// Mark the search position with the current indicator..
|
||||
scintilla.IndicatorFillRange(start, length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Highlights an entire line
|
||||
/// </summary>
|
||||
/// <param name="scintilla">The scintilla of which contains the line to highlight.</param>
|
||||
/// <param name="lineIndex">The index of the line to be highlighted within the scintilla.</param>
|
||||
/// <param name="changeType">The type of change has been made, indicating which color to highlight the line with.</param>
|
||||
public static void HighlightLine(Scintilla scintilla, int lineIndex, int changeType)
|
||||
{
|
||||
int start = scintilla.Lines[lineIndex].Position;
|
||||
int length = scintilla.Lines[lineIndex].Length;
|
||||
|
||||
scintilla.StartStyling(start);
|
||||
scintilla.SetStyling(length, changeType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the given style form a <see cref="Scintilla"/>.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">The scintilla to clear the style from.</param>
|
||||
/// <param name="num">The number of the style to clear.</param>
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
public static void ClearStyle(Scintilla scintilla, int num)
|
||||
{
|
||||
scintilla.IndicatorCurrent = num;
|
||||
scintilla.IndicatorClearRange(0, scintilla.TextLength);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the given styles form a <see cref="Scintilla"/>.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">The scintilla to clear the styles from.</param>
|
||||
/// <param name="numbers">The numbers of the styles to clear.</param>
|
||||
public static void ClearStyle(Scintilla scintilla, params int[] numbers)
|
||||
{
|
||||
foreach (var number in numbers)
|
||||
{
|
||||
ClearStyle(scintilla, number);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the style from a specified area of the <see cref="Scintilla"/> control.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">The scintilla to clear the style from.</param>
|
||||
/// <param name="line">The line from where to clear the style from.</param>
|
||||
/// <param name="pos">The position in the line to clear the style from.</param>
|
||||
/// <param name="length">The length of the text to clear the style from.</param>
|
||||
/// <param name="number">The number of the style to clear.</param>
|
||||
public static void ClearStyleArea(Scintilla scintilla, int line, int pos, int length, int number)
|
||||
{
|
||||
scintilla.IndicatorCurrent = number;
|
||||
scintilla.IndicatorClearRange(scintilla.Lines[line].Position + pos, length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the styles from a specified area of the <see cref="Scintilla"/> control.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">The scintilla to clear the styles from.</param>
|
||||
/// <param name="line">The line from where to clear the styles from.</param>
|
||||
/// <param name="pos">The position in the line to clear the styles from.</param>
|
||||
/// <param name="length">The length of the text to clear the styles from.</param>
|
||||
/// <param name="numbers">The numbers of the styles to clear.</param>
|
||||
public static void ClearStyleArea(Scintilla scintilla, int line, int pos, int length, params int[] numbers)
|
||||
{
|
||||
foreach (var number in numbers)
|
||||
{
|
||||
ClearStyleArea(scintilla, line, pos, length, number);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
+128
@@ -0,0 +1,128 @@
|
||||
using ScintillaNET;
|
||||
|
||||
namespace ScintillaDiff
|
||||
{
|
||||
partial class ScintillaDiffControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.scMain = new System.Windows.Forms.SplitContainer();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.scMain)).BeginInit();
|
||||
this.scMain.Panel1.SuspendLayout();
|
||||
this.scMain.Panel2.SuspendLayout();
|
||||
this.scMain.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// scMain
|
||||
//
|
||||
this.scMain.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.scMain.Location = new System.Drawing.Point(0, 0);
|
||||
this.scMain.Name = "scMain";
|
||||
//
|
||||
// scMain.Panel1
|
||||
//
|
||||
this.scMain.Panel1.Controls.Add(this.panel1);
|
||||
//
|
||||
// scMain.Panel2
|
||||
//
|
||||
this.scMain.Panel2.Controls.Add(this.panel2);
|
||||
this.scMain.Size = new System.Drawing.Size(918, 454);
|
||||
this.scMain.SplitterDistance = 434;
|
||||
this.scMain.TabIndex = 0;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.label1);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(434, 23);
|
||||
this.panel1.TabIndex = 1;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(7, 5);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(35, 12);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "文本1";
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Controls.Add(this.label2);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel2.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(480, 23);
|
||||
this.panel2.TabIndex = 2;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(7, 5);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(35, 12);
|
||||
this.label2.TabIndex = 1;
|
||||
this.label2.Text = "文本2";
|
||||
//
|
||||
// ScintillaDiffControl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.scMain);
|
||||
this.Name = "ScintillaDiffControl";
|
||||
this.Size = new System.Drawing.Size(918, 454);
|
||||
this.Load += new System.EventHandler(this.ScintillaDiffControl_Load);
|
||||
this.SizeChanged += new System.EventHandler(this.ScintillaDiffer_SizeChanged);
|
||||
this.scMain.Panel1.ResumeLayout(false);
|
||||
this.scMain.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.scMain)).EndInit();
|
||||
this.scMain.ResumeLayout(false);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.panel2.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.SplitContainer scMain;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,50 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
namespace ScintillaDiff
|
||||
{
|
||||
/// <summary>
|
||||
/// A class holding enumeration for the diff style.
|
||||
/// </summary>
|
||||
public static class ScintillaDiffStyles
|
||||
{
|
||||
/// <summary>
|
||||
/// An enumeration indicating the diff style used by the <see cref="ScintillaDiffControl"/> control.
|
||||
/// </summary>
|
||||
public enum DiffStyle
|
||||
{
|
||||
/// <summary>
|
||||
/// The difference is displayed as a list.
|
||||
/// </summary>
|
||||
DiffList,
|
||||
|
||||
/// <summary>
|
||||
/// The difference is displayed side by side.
|
||||
/// </summary>
|
||||
DiffSideBySide,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
using ScintillaNET;
|
||||
|
||||
namespace ScintillaDiff
|
||||
{
|
||||
/// <summary>
|
||||
/// An inherited class from the <see cref="Scintilla"/> which can synchronize vertical scroll bar position with another <see cref="Scintilla"/> control.
|
||||
/// Implements the <see cref="ScintillaNET.Scintilla" />
|
||||
/// </summary>
|
||||
/// <seealso cref="ScintillaNET.Scintilla" />
|
||||
public class ScrollSyncScintilla : Scintilla
|
||||
{
|
||||
// ReSharper disable once CommentTypo
|
||||
/// <summary>
|
||||
/// The WM_VSCROLL message is sent to a window when a scroll event occurs in the window's standard vertical scroll bar.
|
||||
/// This message is also sent to the owner of a vertical scroll bar control when a scroll event occurs in the control.
|
||||
/// <remarks>
|
||||
/// https://docs.microsoft.com/en-us/windows/desktop/controls/wm-vscroll
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
// ReSharper disable once InconsistentNaming
|
||||
private const int WM_VSCROLL = 0x115;
|
||||
// ReSharper disable once CommentTypo
|
||||
/// <summary>
|
||||
/// The WM_HSCROLL message is sent to a window when a scroll event occurs in the window's standard horizontal scroll bar.
|
||||
/// This message is also sent to the owner of a horizontal scroll bar control when a scroll event occurs in the control.
|
||||
/// <remarks>
|
||||
/// https://docs.microsoft.com/en-us/windows/desktop/controls/wm-hscroll
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
// ReSharper disable once InconsistentNaming
|
||||
private const int WM_HSCROLL = 0x114;
|
||||
/// <summary>
|
||||
/// The WM_MOUSEWHEEL message is Sent to the focus window when the mouse wheel is rotated.
|
||||
/// <remarks>
|
||||
/// https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-mousewheel
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
// ReSharper disable once InconsistentNaming
|
||||
private const int WM_MOUSEWHEEL = 0x20a;
|
||||
|
||||
/// <summary>
|
||||
/// The SendMessage Win32 function is used to send a specified message to a window or windows.
|
||||
/// <remarks>
|
||||
/// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendmessage
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);
|
||||
|
||||
/// <summary>
|
||||
/// Processes Windows messages.
|
||||
/// </summary>
|
||||
/// <param name="m">The Windows Message to process.</param>
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
if (m.Msg == WM_MOUSEWHEEL)
|
||||
{
|
||||
// two casts to make this work with 32 bit and 64 bit params
|
||||
var wp = new IntPtr((int)(long)m.WParam < 0 ? 1 : 0);
|
||||
SendMessage(this.Handle, WM_VSCROLL, wp, new IntPtr(0));
|
||||
return;
|
||||
}
|
||||
|
||||
base.WndProc(ref m);
|
||||
|
||||
// vertical scrolling
|
||||
if (m.Msg == WM_VSCROLL && ScrollSync != null)
|
||||
{
|
||||
// get the first visible line of this control..
|
||||
int scrollTop = FirstVisibleLine;
|
||||
|
||||
// set the value to the other Scintilla control..
|
||||
ScrollSync.FirstVisibleLine = scrollTop;
|
||||
}
|
||||
|
||||
// horizontal scrolling
|
||||
if (m.Msg == WM_HSCROLL && ScrollSync != null)
|
||||
{
|
||||
// get the leftmost pixel
|
||||
int scrollLeft = XOffset;
|
||||
|
||||
// set the value to the other Scintilla control..
|
||||
ScrollSync.XOffset = scrollLeft;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the <see cref="Scintilla"/> to synchronize the vertical scroll bar with.
|
||||
/// </summary>
|
||||
[Browsable(true)]
|
||||
[Category("Miscellaneous")]
|
||||
[Description("Gets or sets the Scintilla to synchronize the vertical scroll bar with.")]
|
||||
public Scintilla ScrollSync { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ScintillaNET;
|
||||
|
||||
namespace ScintillaDiff
|
||||
{
|
||||
/// <summary>
|
||||
/// A class used by the <see cref="ScintillaDiffControl"/> when external styling update is needed.
|
||||
/// Implements the <see cref="System.EventArgs" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.EventArgs" />
|
||||
public class StyleRefreshEventArgs: EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the scintilla requesting for external style update.
|
||||
/// </summary>
|
||||
public Scintilla Scintilla { get; internal set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaDiff.Enumerations;
|
||||
|
||||
namespace ScintillaDiff.UtilityClasses
|
||||
{
|
||||
/// <summary>
|
||||
/// A class to hold character level change values.
|
||||
/// </summary>
|
||||
public class CharacterChangeType
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the index of the line.
|
||||
/// </summary>
|
||||
/// <value>The index of the line.</value>
|
||||
public int LineIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the position in the <see cref="LineIndex"/>.
|
||||
/// </summary>
|
||||
/// <value>The position in the <see cref="LineIndex"/>.</value>
|
||||
public int Position { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the length of the character change area.
|
||||
/// </summary>
|
||||
/// <value>The length of the character change area.</value>
|
||||
public int Length { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the change within the character area.
|
||||
/// </summary>
|
||||
/// <value>The type of the change within the character area.</value>
|
||||
public CharChangedType ChangeType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
namespace ScintillaDiff.UtilityClasses
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for a generic modifiable pair.
|
||||
/// </summary>
|
||||
/// <typeparam name="TKey">The type of the key.</typeparam>
|
||||
/// <typeparam name="TValue">The type of the value.</typeparam>
|
||||
public class Pair<TKey, TValue>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Pair{TKey, TValue}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
public Pair(TKey key, TValue value)
|
||||
{
|
||||
Key = key;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the key.
|
||||
/// </summary>
|
||||
/// <value>The key.</value>
|
||||
public TKey Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
public TValue Value { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user