### 2023-02-21更新

------
#### SuperDesign    V3.0.2302.2101
- *.[新增]全新文本编辑器,支持高亮、FTP查看和编辑、目录浏览,历史版本等众多功能。
This commit is contained in:
鑫Intel committed 2023-02-21 09:46:13 +08:00
1 parent c7b33920bd
commit 03bcb8c5fd
406 files changed
+312053 -48889

No files matched your search

@@ -0,0 +1,120 @@
#region Using Directives
using ryCommon;
using ScintillaNET;
using System;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
#endregion Using Directives
namespace ScintillaNET_FindReplaceDialog
{
public class GoTo
{
private Scintilla _scintilla=null;
private GoToDialog _window;
#region Methods
public void Line(int number)
{
if (_scintilla == null) { return; }
_scintilla.Lines[number].Goto();
}
public void Position(int pos)
{
if (_scintilla == null) { return; }
_scintilla.GotoPosition(pos);
}
public void ShowGoToDialog()
{
if (_scintilla == null) { return; }
//GoToDialog gd = new GoToDialog();
GoToDialog gd = _window;
gd.CurrentLineNumber = _scintilla.CurrentLine;
gd.MaximumLineNumber = _scintilla.Lines.Count;
gd.Scintilla = _scintilla;
if (!_window.Visible)
{
var form = _scintilla.FindForm();
if (form != null)
{
if (form is DockContent dc)
{
var parent = dc.DockPanel.FindForm();
_window.StartPosition = FormStartPosition.Manual;
_window.Location = new System.Drawing.Point(parent.Left+(parent.Width - _window.Width) / 2, parent.Top+(parent.Height - _window.Height) / 2);
_window.Show(parent);
}
else
{
_window.Show(form);
}
}
else
{
_window.StartPosition = FormStartPosition.CenterScreen;
_window.Show();
}
}
//_window.ShowDialog(_scintilla.FindForm());
//_window.Show(_scintilla.FindForm());
//if (gd.ShowDialog() == DialogResult.OK)
//Line(gd.GotoLineNumber);
//gd.ShowDialog();
//gd.Show();
_scintilla.Focus();
}
#endregion Methods
#region Constructors
protected virtual GoToDialog CreateWindowInstance()
{
return new GoToDialog();
}
public GoTo(Scintilla scintilla)
{
_scintilla = scintilla;
_window = CreateWindowInstance();
_window.Scintilla = scintilla;
}
public GoTo()
{
_scintilla = null;
_window = CreateWindowInstance();
_window.Scintilla = null;
}
public Scintilla Scintilla
{
get { return _scintilla; }
set {
_scintilla = value;
_window.Scintilla = value;
if (value != null)
{
GoToDialog gd = _window;
gd.CurrentLineNumber = _scintilla.CurrentLine;
gd.MaximumLineNumber = _scintilla.Lines.Count;
gd.Scintilla = _scintilla;
gd.UpdateUI();
}
}
}
#endregion Constructors
}
}
@@ -0,0 +1,163 @@
namespace ScintillaNET_FindReplaceDialog
{
partial class GoToDialog
{
/// <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 Windows Form 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.components = new System.ComponentModel.Container();
this.lblCurrentLine = new System.Windows.Forms.Label();
this.txtCurrentLine = new System.Windows.Forms.TextBox();
this.err = new System.Windows.Forms.ErrorProvider(this.components);
this.txtMaxLine = new System.Windows.Forms.TextBox();
this.lblMaxLine = new System.Windows.Forms.Label();
this.txtGotoLine = new System.Windows.Forms.TextBox();
this.lblGotoLine = new System.Windows.Forms.Label();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.err)).BeginInit();
this.SuspendLayout();
//
// lblCurrentLine
//
this.lblCurrentLine.AutoSize = true;
this.lblCurrentLine.Location = new System.Drawing.Point(9, 13);
this.lblCurrentLine.Name = "lblCurrentLine";
this.lblCurrentLine.Size = new System.Drawing.Size(55, 13);
this.lblCurrentLine.TabIndex = 0;
this.lblCurrentLine.Text = "当前行号";
//
// txtCurrentLine
//
this.txtCurrentLine.Location = new System.Drawing.Point(132, 8);
this.txtCurrentLine.Name = "txtCurrentLine";
this.txtCurrentLine.ReadOnly = true;
this.txtCurrentLine.Size = new System.Drawing.Size(63, 21);
this.txtCurrentLine.TabIndex = 1;
//
// err
//
this.err.ContainerControl = this;
//
// txtMaxLine
//
this.txtMaxLine.Location = new System.Drawing.Point(132, 33);
this.txtMaxLine.Name = "txtMaxLine";
this.txtMaxLine.ReadOnly = true;
this.txtMaxLine.Size = new System.Drawing.Size(63, 21);
this.txtMaxLine.TabIndex = 3;
//
// lblMaxLine
//
this.lblMaxLine.AutoSize = true;
this.lblMaxLine.Location = new System.Drawing.Point(9, 37);
this.lblMaxLine.Name = "lblMaxLine";
this.lblMaxLine.Size = new System.Drawing.Size(55, 13);
this.lblMaxLine.TabIndex = 2;
this.lblMaxLine.Text = "最大行号";
//
// txtGotoLine
//
this.txtGotoLine.Location = new System.Drawing.Point(132, 58);
this.txtGotoLine.Name = "txtGotoLine";
this.txtGotoLine.Size = new System.Drawing.Size(63, 21);
this.txtGotoLine.TabIndex = 5;
//
// lblGotoLine
//
this.lblGotoLine.AutoSize = true;
this.lblGotoLine.Location = new System.Drawing.Point(9, 61);
this.lblGotoLine.Name = "lblGotoLine";
this.lblGotoLine.Size = new System.Drawing.Size(55, 13);
this.lblGotoLine.TabIndex = 4;
this.lblGotoLine.Text = "目标行号";
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(39, 85);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 6;
this.btnOK.Text = "确定";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.BtnOK_Click);
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(120, 85);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 7;
this.btnCancel.Text = "取消";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.BtnCancel_Click);
//
// GoToDialog
//
this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(210, 113);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.txtGotoLine);
this.Controls.Add(this.lblGotoLine);
this.Controls.Add(this.txtMaxLine);
this.Controls.Add(this.lblMaxLine);
this.Controls.Add(this.txtCurrentLine);
this.Controls.Add(this.lblCurrentLine);
this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "GoToDialog";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "行定位";
this.Activated += new System.EventHandler(this.GoToDialog_Activated);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.GoToDialog_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.err)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lblCurrentLine;
private System.Windows.Forms.TextBox txtCurrentLine;
private System.Windows.Forms.ErrorProvider err;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.TextBox txtGotoLine;
private System.Windows.Forms.Label lblGotoLine;
private System.Windows.Forms.TextBox txtMaxLine;
private System.Windows.Forms.Label lblMaxLine;
}
}
@@ -0,0 +1,174 @@
#region Using Directives
using ScintillaNET;
using System;
using System.Drawing;
using System.Windows.Forms;
#endregion Using Directives
namespace ScintillaNET_FindReplaceDialog
{
public partial class GoToDialog : Form
{
#region Fields
private Scintilla _scintilla;
private int _currentLineNumber;
private int _maximumLineNumber;
private int _gotoLineNumber;
#endregion Fields
#region Methods
private void BtnOK_Click(object sender, EventArgs e)
{
if (int.TryParse(txtGotoLine.Text, out _gotoLineNumber))
{
// Line #s are 0 based but the users don't think that way
_gotoLineNumber--;
if (_gotoLineNumber < 0 || _gotoLineNumber >= _maximumLineNumber)
err.SetError(txtGotoLine, "转到行必须大于0且小于 " + (_maximumLineNumber + 1).ToString());
else
{
_scintilla.Lines[_gotoLineNumber].Goto();
//Line(GotoLineNumber);
this.Hide();
//DialogResult = DialogResult.OK;
}
}
else
{
err.SetError(txtGotoLine, "转到行必须是数值");
}
}
// This was taken from FindReplaceDialog. Obviously some refactoring is called for
// since we have common code. However I'm holding off on this because I'm coming
// up with some other ideas for the FindReplaceDialog. Right now every scintilla
// gets its own FindReplaceDialog, but they really need to be sharable across
// multiple scintillas much like how DropMarkers work.
private void MoveFormAwayFromSelection()
{
if (!Visible)
return;
int pos = Scintilla.CurrentPosition;
int x = Scintilla.PointXFromPosition(pos);
int y = Scintilla.PointYFromPosition(pos);
Point cursorPoint = Scintilla.PointToScreen(new Point(x, y));
Rectangle r = new Rectangle(Location, Size);
if (r.Contains(cursorPoint))
{
Point newLocation;
if (cursorPoint.Y < (Screen.PrimaryScreen.Bounds.Height / 2))
{
//TODO - replace lineheight with ScintillaNET command, when added
int SCI_TEXTHEIGHT = 2279;
int lineHeight = Scintilla.DirectMessage(SCI_TEXTHEIGHT, IntPtr.Zero, IntPtr.Zero).ToInt32();
// Top half of the screen
newLocation = Scintilla.PointToClient(
new Point(Location.X, cursorPoint.Y + lineHeight * 2)
);
}
else
{
//TODO - replace lineheight with ScintillaNET command, when added
int SCI_TEXTHEIGHT = 2279;
int lineHeight = Scintilla.DirectMessage(SCI_TEXTHEIGHT, IntPtr.Zero, IntPtr.Zero).ToInt32();
// Bottom half of the screen
newLocation = Scintilla.PointToClient(
new Point(Location.X, cursorPoint.Y - Height - (lineHeight * 2))
);
}
newLocation = Scintilla.PointToScreen(newLocation);
Location = newLocation;
}
}
protected override void OnActivated(EventArgs e)
{
base.OnActivated(e);
MoveFormAwayFromSelection();
}
#endregion Methods
#region Properties
public int CurrentLineNumber
{
get { return _currentLineNumber; }
set
{
_currentLineNumber = value;
}
}
public int GotoLineNumber
{
get { return _gotoLineNumber; }
set
{
_gotoLineNumber = value;
}
}
public int MaximumLineNumber
{
get { return _maximumLineNumber; }
set
{
_maximumLineNumber = value;
}
}
public Scintilla Scintilla
{
get { return _scintilla; }
set { _scintilla = value; }
}
#endregion Properties
#region Constructors
public GoToDialog()
{
InitializeComponent();
}
#endregion Constructors
private void GoToDialog_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
Hide();
}
}
private void GoToDialog_Activated(object sender, EventArgs e)
{
UpdateUI();
}
public void UpdateUI()
{
string displayLine = (_currentLineNumber + 1).ToString();
txtCurrentLine.Text = displayLine;
txtMaxLine.Text = _maximumLineNumber.ToString();
txtGotoLine.Text = displayLine;
txtGotoLine.Select();
}
private void BtnCancel_Click(object sender, EventArgs e)
{
Hide();
}
}
}
@@ -0,0 +1,123 @@
<?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>
<metadata name="err.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>