### 2024-12-20 星期五更新

------
#### SuperDesign    V3.0.2412.2001
- *.[新增]新增程序更新日志设置和自动发布功能。
- *.[修复]修复Post数据格式不正确时双击文本框会导致软件闪退的BUG。
This commit is contained in:
zilinsoft committed 2024-12-20 08:15:19 +08:00
1 parent 03bcb8c5fd
commit 993f1ca1a9
349 files changed
+81977 -13873

No files matched your search

@@ -15,7 +15,7 @@ namespace 开发辅助工具.Controls
{
InitializeComponent();
}
public bool IsJsTime { get; set; } = false;
private void BtnOK_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
+2 -2
View File
@@ -32,7 +32,7 @@
this.BtnSave = new ryControls.ButtonEx();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.contextMenuStripRichText1 = new ryProcessManager.hezuo.ContextMenuStripRichText();
this.highlightEditor1 = new ryControls.HighlightEditor();
this.highlightEditor1 = new ScintillaNETV2.Highlight.HighlightEditor();
this.panelEx1.SuspendLayout();
this.SuspendLayout();
//
@@ -114,6 +114,6 @@
private ryControls.ButtonEx BtnSave;
private ryProcessManager.hezuo.ContextMenuStripRichText contextMenuStripRichText1;
public System.Windows.Forms.RichTextBox richTextBox1;
public ryControls.HighlightEditor highlightEditor1;
public ScintillaNETV2.Highlight.HighlightEditor highlightEditor1;
}
}
@@ -34,6 +34,10 @@ namespace ScintillaNET_FindReplaceDialog
/// <summary>
/// 所在行文本
/// </summary>
public string LineText { get; set; } = "";
/// <summary>
/// 所在行文本
/// </summary>
public string RangeText { get; set; } ="";
/// <summary>
/// 选择区域是否是空
@@ -43,6 +47,21 @@ namespace ScintillaNET_FindReplaceDialog
{
return CpMin == CpMax;
}
public override bool Equals(object obj) {
if(obj == null) return false;
if(this == obj) return true;
if(obj is CharacterRange x2) {
if(x2.CpMin== CpMin && x2.CpMax==CpMax) {
return true;
}
else { return false; }
}
return false;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
/// <summary>
/// Specifies a range of characters. If the cpMin and cpMax members are equal, the range is empty.
/// The range includes everything if cpMin is 0 and cpMax is –1.
@@ -46,7 +46,6 @@
this.FindResultsScintilla.TabIndents = true;
this.FindResultsScintilla.TabIndex = 4;
this.FindResultsScintilla.Text = "搜索结果";
this.FindResultsScintilla.UseRightToLeftReadingLayout = false;
this.FindResultsScintilla.WrapMode = ScintillaNET.WrapMode.None;
this.FindResultsScintilla.KeyUp += new System.Windows.Forms.KeyEventHandler(this.FindResultsScintilla_KeyUp);
this.FindResultsScintilla.MouseClick += new System.Windows.Forms.MouseEventHandler(this.FindResultsScintilla_MouseClick);
@@ -96,7 +96,7 @@
//int LinePos = item_range.LinePos;
//int startPosInLine = item_range.CpMin - LinePos;
FindResultsScintilla.IndicatorCurrent = _indicator.Index;
FindResultsScintilla.IndicatorFillRange(lastLineStartPos + resultsLinePrefix.Length, item_file.Value.Result.CpMax - item_file.Value.Result.CpMin);
FindResultsScintilla.IndicatorFillRange(lastLineStartPos + resultsLinePrefix.Length+1, item_file.Value.Result.CpMax - item_file.Value.Result.CpMin);
}
}
FindResultsScintilla.ReadOnly = true;
@@ -158,4 +158,9 @@
#endregion Methods
}
public class FindResult
{
public string Path { get; set; } = "";
public ScintillaNET_FindReplaceDialog.CharacterRange Result { get; set; }
}
}
@@ -8,6 +8,7 @@ namespace ScintillaNET_FindReplaceDialog
using System.Drawing;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
[TypeConverterAttribute(typeof(System.ComponentModel.ExpandableObjectConverter))]
public class FindReplace : Component
@@ -864,14 +865,24 @@ namespace ScintillaNET_FindReplaceDialog
}
}
if (_scintilla.LineFromPosition(_scintilla.Selections[0].Start) != _scintilla.LineFromPosition(_scintilla.Selections[0].End)) //selRange.IsMultiLine)
if (_scintilla.LineFromPosition(_scintilla.Selections[0].Start) != _scintilla.LineFromPosition(_scintilla.Selections[0].End)) //selRange.IsMultiLine)
{
_window.chkSearchSelectionF.Checked = true;
}
_window.chkSearchSelectionR.Checked = true;
}
else if (_scintilla.Selections[0].End > _scintilla.Selections[0].Start)
{
_window.txtFindR.Text = _scintilla.SelectedText;
_window.TxtFileSearchText.Text = _scintilla.SelectedText;
_window.txtFindF.Text = _scintilla.SelectedText;
}
_window.chkSearchSelectionF.Checked = false;
_window.chkSearchSelectionR.Checked = false;
}
else
{
_window.chkSearchSelectionF.Checked = false;
_window.chkSearchSelectionR.Checked = false;
}
if (showTab == 0)
{
_window.tabAll.SelectedTab = _window.tabAll.TabPages["tpgFind"];
@@ -63,6 +63,7 @@ namespace ScintillaNET_FindReplaceDialog
this.cmdRecentReplace = new System.Windows.Forms.Button();
this.cmdRecentFindR = new System.Windows.Forms.Button();
this.tpgFileFind = new System.Windows.Forms.TabPage();
this.BtnBrowser = new System.Windows.Forms.Button();
this.fcFile = new SuperDesign.Controls.Highlight.FindReplace.FindConfig();
this.label2 = new System.Windows.Forms.Label();
this.NumLimitFileSize = new System.Windows.Forms.NumericUpDown();
@@ -167,7 +168,6 @@ namespace ScintillaNET_FindReplaceDialog
this.toolStripMenuItem51 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem50 = new System.Windows.Forms.ToolStripMenuItem();
this.nameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.BtnBrowser = new System.Windows.Forms.Button();
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
this.tabAll.SuspendLayout();
this.tpgFind.SuspendLayout();
@@ -246,6 +246,7 @@ namespace ScintillaNET_FindReplaceDialog
this.txtFindF.Name = "txtFindF";
this.txtFindF.Size = new System.Drawing.Size(408, 21);
this.txtFindF.TabIndex = 15;
this.txtFindF.TextChanged += new System.EventHandler(this.txtFindF_TextChanged);
//
// cmdRecentFindF
//
@@ -436,6 +437,7 @@ namespace ScintillaNET_FindReplaceDialog
this.txtReplace.Name = "txtReplace";
this.txtReplace.Size = new System.Drawing.Size(411, 21);
this.txtReplace.TabIndex = 21;
this.txtReplace.TextChanged += new System.EventHandler(this.txtReplace_TextChanged);
//
// txtFindR
//
@@ -446,6 +448,8 @@ namespace ScintillaNET_FindReplaceDialog
this.txtFindR.Name = "txtFindR";
this.txtFindR.Size = new System.Drawing.Size(411, 21);
this.txtFindR.TabIndex = 20;
this.txtFindR.SelectedIndexChanged += new System.EventHandler(this.txtFindR_SelectedIndexChanged);
this.txtFindR.TextChanged += new System.EventHandler(this.txtFindR_TextChanged);
//
// btnFindNextR
//
@@ -626,6 +630,16 @@ namespace ScintillaNET_FindReplaceDialog
this.tpgFileFind.Text = "文件夹查找";
this.tpgFileFind.UseVisualStyleBackColor = true;
//
// BtnBrowser
//
this.BtnBrowser.Location = new System.Drawing.Point(359, 86);
this.BtnBrowser.Name = "BtnBrowser";
this.BtnBrowser.Size = new System.Drawing.Size(27, 23);
this.BtnBrowser.TabIndex = 40;
this.BtnBrowser.Text = "...";
this.BtnBrowser.UseVisualStyleBackColor = true;
this.BtnBrowser.Click += new System.EventHandler(this.BtnBrowser_Click);
//
// fcFile
//
this.fcFile.FileWholeWord = false;
@@ -761,6 +775,7 @@ namespace ScintillaNET_FindReplaceDialog
this.TxtFileReplaceText.Name = "TxtFileReplaceText";
this.TxtFileReplaceText.Size = new System.Drawing.Size(312, 21);
this.TxtFileReplaceText.TabIndex = 27;
this.TxtFileReplaceText.TextChanged += new System.EventHandler(this.txtFindR_TextChanged);
//
// TxtFileSearchText
//
@@ -771,6 +786,7 @@ namespace ScintillaNET_FindReplaceDialog
this.TxtFileSearchText.Name = "TxtFileSearchText";
this.TxtFileSearchText.Size = new System.Drawing.Size(312, 21);
this.TxtFileSearchText.TabIndex = 26;
this.TxtFileSearchText.TextChanged += new System.EventHandler(this.txtFindF_TextChanged);
//
// TxtSearchPath
//
@@ -791,6 +807,7 @@ namespace ScintillaNET_FindReplaceDialog
this.TxtFileType.Size = new System.Drawing.Size(312, 21);
this.TxtFileType.TabIndex = 24;
this.TxtFileType.Text = "*.*";
this.TxtFileType.SelectedIndexChanged += new System.EventHandler(this.TxtFileType_SelectedIndexChanged);
//
// label5
//
@@ -1498,16 +1515,6 @@ namespace ScintillaNET_FindReplaceDialog
this.nameToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
this.nameToolStripMenuItem.Text = "$(Name) 命名组";
//
// BtnBrowser
//
this.BtnBrowser.Location = new System.Drawing.Point(359, 86);
this.BtnBrowser.Name = "BtnBrowser";
this.BtnBrowser.Size = new System.Drawing.Size(27, 23);
this.BtnBrowser.TabIndex = 40;
this.BtnBrowser.Text = "...";
this.BtnBrowser.UseVisualStyleBackColor = true;
this.BtnBrowser.Click += new System.EventHandler(this.BtnBrowser_Click);
//
// FindReplaceDialog
//
this.AcceptButton = this.btnFindNextF;
@@ -1530,6 +1537,7 @@ namespace ScintillaNET_FindReplaceDialog
this.Activated += new System.EventHandler(this.FindReplaceDialog_Activated);
this.Deactivate += new System.EventHandler(this.FindReplaceDialog_Deactivate);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FindReplaceDialog_FormClosing);
this.Load += new System.EventHandler(this.FindReplaceDialog_Load);
this.tabAll.ResumeLayout(false);
this.tpgFind.ResumeLayout(false);
this.tpgFind.PerformLayout();
@@ -9,6 +9,7 @@ namespace ScintillaNET_FindReplaceDialog
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using static ScintillaNET.Style;
public partial class FindReplaceDialog : Form
{
@@ -38,6 +39,16 @@ namespace ScintillaNET_FindReplaceDialog
_autoPosition = true;
_mruFind = new List<string>();
_mruReplace = new List<string>();
var lst1 = RyFiles.ReadAllLines(Application.StartupPath + "\\UserDb\\mruFind.lst");
if (lst1 != null)
{
_mruFind.AddRange(lst1);
}
var lst2 = RyFiles.ReadAllLines(Application.StartupPath + "\\UserDb\\mruReplace.lst");
if (lst2 != null)
{
_mruReplace.AddRange(lst2);
}
_bindingSourceFind.DataSource = _mruFind;
_bindingSourceReplace.DataSource = _mruReplace;
txtFindF.DataSource = _bindingSourceFind;
@@ -45,15 +56,21 @@ namespace ScintillaNET_FindReplaceDialog
TxtFileSearchText.DataSource = _bindingSourceFind;
txtReplace.DataSource = _bindingSourceReplace;
TxtFileReplaceText.DataSource = _bindingSourceReplace;
ryCommon.Ini ini = new ryCommon.Ini(Application.StartupPath + "\\UserDb\\FindReplace.ini");
TxtFileType.Text = ini.ReadIni("FileFind", "Exts","*.*");
ChkSkipDirName.Checked = ini.ReadIni("FileFind", "SkipDirName_On",true);
CbbSkipDirName.Text = ini.ReadIni("FileFind", "SkipDirName_Text",CbbSkipDirName.Text);
ChkSubDir.Checked = ini.ReadIni("FileFind", "SearchSubDir", false);
ChkIgnoreBinExt.Checked = ini.ReadIni("FileFind", "IgnoreBinExt", true);
ChkHiddenDir.Checked = ini.ReadIni("FileFind", "SearchHiddenDir", false);
ChkLimitFileSize.Checked = ini.ReadIni("FileFind", "LimitFileSize_On", true);
NumLimitFileSize.Value = ini.ReadIni("FileFind", "LimitFileSize_Value",1,1000,20);
if (!DesignMode)
{
try
{
ryCommon.Ini ini = new ryCommon.Ini(Application.StartupPath + "\\UserDb\\FindReplace.ini");
TxtFileType.Text = ini.ReadIni("FileFind", "Exts", "*.*");
ChkSkipDirName.Checked = ini.ReadIni("FileFind", "SkipDirName_On", true);
CbbSkipDirName.Text = ini.ReadIni("FileFind", "SkipDirName_Text", CbbSkipDirName.Text);
ChkSubDir.Checked = ini.ReadIni("FileFind", "SearchSubDir", false);
ChkIgnoreBinExt.Checked = ini.ReadIni("FileFind", "IgnoreBinExt", true);
ChkHiddenDir.Checked = ini.ReadIni("FileFind", "SearchHiddenDir", false);
ChkLimitFileSize.Checked = ini.ReadIni("FileFind", "LimitFileSize_On", true);
NumLimitFileSize.Value = ini.ReadIni("FileFind", "LimitFileSize_Value", 1, 1000, 20); }
catch { }
}
LastTab = tpgFind;
LastFingConfig = fcFind;
}
@@ -136,6 +153,8 @@ namespace ScintillaNET_FindReplaceDialog
e.Cancel = true;
Hide();
}
RyFiles.WriteAllLines(Application.StartupPath + "\\UserDb\\mruFind.lst",_mruFind.ToArray(), System.Text.Encoding.UTF8);
RyFiles.WriteAllLines(Application.StartupPath + "\\UserDb\\mruReplace.lst", _mruReplace.ToArray(), System.Text.Encoding.UTF8);
}
#endregion Form Event Handlers
@@ -334,8 +353,7 @@ namespace ScintillaNET_FindReplaceDialog
else
lblStatus.Text = "搜索匹配换行到文档开头";
}
_scintilla.SetSel(nextRange.CpMin, nextRange.CpMax);
SetSel(nextRange.CpMin, nextRange.CpMax);
MoveFormAwayFromSelection();
}
}
@@ -420,7 +438,6 @@ namespace ScintillaNET_FindReplaceDialog
{
if (tabAll.SelectedTab == tpgFind)
{
txtFindF.Text = txtFindR.Text;
fcFind.LoadConfig(LastFingConfig);
chkWrapF.Checked = chkWrapR.Checked;
chkSearchSelectionF.Checked = chkSearchSelectionR.Checked;
@@ -428,21 +445,19 @@ namespace ScintillaNET_FindReplaceDialog
}
else if (tabAll.SelectedTab == tpgReplace)
{
txtFindR.Text = txtFindF.Text;
fcReplace.LoadConfig(LastFingConfig);
chkWrapR.Checked = chkWrapF.Checked;
chkSearchSelectionR.Checked = chkSearchSelectionF.Checked;
AcceptButton = btnReplaceNext;
}
else if (tabAll.SelectedTab == tpgFileFind)
{
TxtFileSearchText.Text = LastTab==tpgReplace? txtFindR.Text:txtFindF.Text;
fcFile.LoadConfig(LastFingConfig);
chkWrapR.Checked = chkWrapF.Checked;
chkSearchSelectionR.Checked = chkSearchSelectionF.Checked;
AcceptButton = btnReplaceNext;
}
SyncTextUI();
LastTab = tabAll.SelectedTab;
if(tabAll.SelectedTab== tpgFind)
{
@@ -457,7 +472,44 @@ namespace ScintillaNET_FindReplaceDialog
LastFingConfig = fcFile;
}
}
private void SyncTextUI()
{
if(tabAll.SelectedTab==tpgFind)
{
if (LastTab == tpgReplace)
{
txtFindF.Text=txtFindR.Text;
}
else if (LastTab == tpgFileFind)
{
txtFindF.Text = TxtFileSearchText.Text;
}
}
else if (tabAll.SelectedTab == tpgReplace)
{
if (LastTab == tpgFind)
{
txtFindR.Text = txtFindF.Text;
}
else if (LastTab == tpgFileFind)
{
txtFindR.Text = TxtFileSearchText.Text;
txtReplace.Text = TxtFileReplaceText.Text;
}
}
else if (tabAll.SelectedTab == tpgFileFind)
{
if (LastTab == tpgFind)
{
TxtFileSearchText.Text = txtFindF.Text;
}
else if (LastTab == tpgReplace)
{
TxtFileSearchText.Text = txtFindR.Text;
TxtFileReplaceText.Text = txtReplace.Text;
}
}
}
#endregion Event Handlers
#region Methods
@@ -465,7 +517,6 @@ namespace ScintillaNET_FindReplaceDialog
public void FindNext()
{
if (Scintilla == null) { return; }
SyncSearchText();
if (txtFindF.Text == string.Empty)
return;
@@ -498,8 +549,7 @@ namespace ScintillaNET_FindReplaceDialog
else
lblStatus.Text = "搜索匹配换行到文档开头";
}
Scintilla.SetSel(foundRange.CpMin, foundRange.CpMax);
SetSel(foundRange.CpMin, foundRange.CpMax);
MoveFormAwayFromSelection();
}
}
@@ -507,7 +557,6 @@ namespace ScintillaNET_FindReplaceDialog
public void FindPrevious()
{
if (Scintilla == null) { return; }
SyncSearchText();
if (txtFindF.Text == string.Empty)
return;
@@ -538,8 +587,7 @@ namespace ScintillaNET_FindReplaceDialog
else
lblStatus.Text = "搜索匹配换行到文档的结尾";
}
Scintilla.SetSel(foundRange.CpMin, foundRange.CpMax);
SetSel(foundRange.CpMin, foundRange.CpMax);
MoveFormAwayFromSelection();
}
}
@@ -595,7 +643,7 @@ namespace ScintillaNET_FindReplaceDialog
new Point(Location.X, cursorPoint.Y - Height - (lineHeight * 2)));
}
newLocation = Scintilla.PointToScreen(newLocation);
Location = newLocation;
//Location = newLocation;
}
}
@@ -631,26 +679,45 @@ namespace ScintillaNET_FindReplaceDialog
else
lblStatus.Text = "搜索匹配换行到文档开头";
}
Scintilla.SetSel(nextRange.CpMin, nextRange.CpMax);
SetSel(nextRange.CpMin, nextRange.CpMax);
MoveFormAwayFromSelection();
}
}
protected override void OnActivated(EventArgs e)
private void SetSel(int CpMin, int CpMax)
{
if (Scintilla.Selections.Count > 0)
if (_scintilla.GetColumn(CpMin) < _scintilla.GetColumn(CpMax))
{
chkSearchSelectionF.Enabled = true;
chkSearchSelectionR.Enabled = true;
_scintilla.GotoPosition(CpMax);
}
else
{
chkSearchSelectionF.Enabled = false;
chkSearchSelectionR.Enabled = false;
chkSearchSelectionF.Checked = false;
chkSearchSelectionR.Checked = false;
_scintilla.GotoPosition(CpMin);
}
var line=_scintilla.LineFromPosition(CpMax);
//var first_line = _scintilla.FirstVisibleLine;
_scintilla.FirstVisibleLine = line - 2;
_scintilla.SetSel(CpMin, CpMax);
}
protected override void OnActivated(EventArgs e)
{
if(Scintilla==null)
{
base.OnActivated(e);
return;
}
//if (Scintilla.Selections.Count > 0)
//{
// chkSearchSelectionF.Enabled = true;
// chkSearchSelectionR.Enabled = true;
//}
//else
//{
// chkSearchSelectionF.Enabled = false;
// chkSearchSelectionR.Enabled = false;
// chkSearchSelectionF.Checked = false;
// chkSearchSelectionR.Checked = false;
//}
// if they leave the dialog and come back any "Search Selection"
// range they might have had is invalidated
@@ -690,20 +757,41 @@ namespace ScintillaNET_FindReplaceDialog
base.OnKeyDown(e);
}
private void SyncSearchText()
private ComboBox GetFindTextBox()
{
if (tabAll.SelectedTab == tpgFind)
txtFindR.Text = txtFindF.Text;
{
return txtFindF;
}
else if (tabAll.SelectedTab == tpgReplace)
txtFindF.Text = txtFindR.Text;
{
return txtFindR;
}
else if (tabAll.SelectedTab == tpgFileFind)
TxtFileSearchText.Text = txtFindF.Text;
{
return TxtFileSearchText;
}
return null;
}
private ComboBox GetReplaceTextBox()
{
if (tabAll.SelectedTab == tpgFind)
{
return null;
}
else if (tabAll.SelectedTab == tpgReplace)
{
return txtReplace;
}
else if (tabAll.SelectedTab == tpgFileFind)
{
return TxtFileReplaceText;
}
return null;
}
private void AddFindMru()
{
string find = txtFindF.Text;
string find = GetFindTextBox().Text;
_mruFind.Remove(find);
_mruFind.Insert(0, find);
if(_mruFind.Count> _mruMaxCount)
@@ -711,19 +799,21 @@ namespace ScintillaNET_FindReplaceDialog
_mruFind.RemoveAt(_mruFind.Count - 1);
}
_bindingSourceFind.ResetBindings(false);
txtFindF.Text = find;
txtFindR.Text = find;
TxtFileSearchText.Text = find;
}
private void AddReplaceMru()
{
string find = txtFindR.Text;
string find =GetFindTextBox().Text;
_mruFind.Remove(find);
_mruFind.Insert(0, find);
if (_mruFind.Count > _mruMaxCount)
_mruFind.RemoveAt(_mruFind.Count - 1);
string replace = txtReplace.Text;
string replace = GetReplaceTextBox().Text;
if (replace != string.Empty)
{
_mruReplace.Remove(replace);
@@ -733,9 +823,13 @@ namespace ScintillaNET_FindReplaceDialog
if (_mruReplace.Count > _mruMaxCount)
_mruReplace.RemoveAt(_mruReplace.Count - 1);
}
_bindingSourceFind.ResetBindings(false);
_bindingSourceReplace.ResetBindings(false);
TxtFileReplaceText.Text = replace;
txtReplace.Text = replace;
txtFindF.Text = find;
txtFindR.Text = find;
TxtFileSearchText.Text = find;
}
private void ContextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
@@ -969,6 +1063,7 @@ namespace ScintillaNET_FindReplaceDialog
else
{
string textToFind = fcReplace.SearchMode==1 ? FindReplace.Transform(txtFindR.Text) : txtFindR.Text;
var aa = FindReplace.Find(selRange, textToFind, false);
if (selRange.Equals(FindReplace.Find(selRange, textToFind, false)))
{
// If searching up we do the replacement using the range object.
@@ -1026,39 +1121,7 @@ namespace ScintillaNET_FindReplaceDialog
private void BtnFileFindAll_Click(object sender, EventArgs e)
{
var folder = TxtSearchPath.Text;
if(!System.IO.Directory.Exists(folder))
{
MessageBox.Show("目录不存在。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if(TxtFileSearchText.Text.Length==0)
{
MessageBox.Show("待查找文本为空。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
ryCommon.Ini ini = new ryCommon.Ini(Application.StartupPath+"\\UserDb\\FindReplace.ini");
ini.WriteIni("FileFind", "Exts", TxtFileType.Text);
ini.WriteIni("FileFind", "SkipDirName_On", ChkSkipDirName.Checked);
ini.WriteIni("FileFind", "SkipDirName_Text", CbbSkipDirName.Text);
ini.WriteIni("FileFind", "SearchSubDir", ChkSubDir.Checked);
ini.WriteIni("FileFind", "IgnoreBinExt", ChkIgnoreBinExt.Checked);
ini.WriteIni("FileFind", "SearchHiddenDir", ChkHiddenDir.Checked);
ini.WriteIni("FileFind", "LimitFileSize_On", ChkLimitFileSize.Checked);
ini.WriteIni("FileFind", "LimitFileSize_Value", NumLimitFileSize.Value);
FrmFinding frm = new FrmFinding();
frm.SearchConfig.FindText = TxtFileSearchText.Text;
frm.SearchConfig.ReplaceText = TxtFileReplaceText.Text;
frm.SearchConfig.SearchDir= folder;
frm.SearchConfig.Exts = TxtFileType.Text;
frm.SearchConfig.SkipDirName = ChkSkipDirName.Checked ? CbbSkipDirName.Text : "";
frm.SearchConfig.LimitFileSize = ChkLimitFileSize.Checked ? (NumLimitFileSize.Value.ToInt() * 1024 * 1024) : 0;
frm.SearchConfig.SearchSubDir = ChkSubDir.Checked;
frm.SearchConfig.IgnoreBinExt = ChkIgnoreBinExt.Checked;
frm.SearchConfig.SearchHiddenDir = ChkHiddenDir.Checked;
frm.SearchConfig.RegexOptions = fcFile.GetRegexOptions();
frm.SearchConfig.SearchFlags = fcFile.GetSearchFlags();
frm.ShowDialog();
MessageBox.Show("暂不支持。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
public string DefSearchDir { get; set; } = "";
private void ChkCurDir_CheckedChanged(object sender, EventArgs e)
@@ -1075,5 +1138,35 @@ namespace ScintillaNET_FindReplaceDialog
TxtSearchPath.Text = folderBrowserDialog1.SelectedPath;
}
}
private void txtFindF_TextChanged(object sender, EventArgs e)
{
//SyncTextUI();
}
private void txtFindR_TextChanged(object sender, EventArgs e)
{
//SyncTextUI();
}
private void txtReplace_TextChanged(object sender, EventArgs e)
{
//SyncTextUI();
}
private void FindReplaceDialog_Load(object sender, EventArgs e)
{
}
private void txtFindR_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void TxtFileType_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
@@ -1,7 +1,6 @@
using ryCommon;
using ryControls;
using ScintillaNET;
using SuperDesign.Tools.SmartEditor;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -14,7 +13,6 @@ using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using 开发辅助工具.Tools.SmartEditor;
using static ScintillaNET.Style;
using static System.Net.Mime.MediaTypeNames;
@@ -98,8 +96,8 @@ namespace ScintillaNET_FindReplaceDialog
return list;
int start = foundRange.CpMin + all_text.Substring(0, m.Index).Length;
int end = all_text.Substring(m.Index, m.Length).Length;
var LineNum = GetLineNum(start, out var LinePos);
list.Add(new CharacterRange(start, start + end) { LineNum=LineNum, LinePos=LinePos,RangeText=Text.Substring(start,end) });
var LineNum = GetLineNum(start, out var LinePos,out var LineText);
list.Add(new CharacterRange(start, start + end) {LineText= LineText, LineNum=LineNum, LinePos=LinePos,RangeText=Text.Substring(start,end) });
start_i = start+end + 1;
}
else
@@ -147,8 +145,8 @@ namespace ScintillaNET_FindReplaceDialog
}
if (Word_Start && Word_End)
{
var LineNum = GetLineNum(start, out var LinePos);
list.Add(new CharacterRange(start, start + end) { LineNum = LineNum, LinePos = LinePos, RangeText = Text.Substring(start, end) });
var LineNum = GetLineNum(start, out var LinePos, out var LineText);
list.Add(new CharacterRange(start, start + end) { LineText = LineText, LineNum = LineNum, LinePos = LinePos, RangeText = Text.Substring(start, end) });
}
start_i = start+ end + 1;
}
@@ -175,8 +173,8 @@ namespace ScintillaNET_FindReplaceDialog
}
if (Word_Start)
{
var LineNum = GetLineNum(start, out var LinePos);
list.Add(new CharacterRange(start, start + end) { LineNum = LineNum, LinePos = LinePos, RangeText = Text.Substring(start, end) });
var LineNum = GetLineNum(start, out var LinePos, out var LineText);
list.Add(new CharacterRange(start, start + end) { LineText = LineText, LineNum = LineNum, LinePos = LinePos, RangeText = Text.Substring(start, end) });
}
start_i = start+ end + 1;
}
@@ -187,8 +185,8 @@ namespace ScintillaNET_FindReplaceDialog
}
else
{
var LineNum = GetLineNum(start, out var LinePos);
list.Add(new CharacterRange(start, start + end) { LineNum = LineNum, LinePos = LinePos, RangeText = Text.Substring(start, end) });
var LineNum = GetLineNum(start, out var LinePos, out var LineText);
list.Add(new CharacterRange(start, start + end) { LineText = LineText, LineNum = LineNum, LinePos = LinePos, RangeText = Text.Substring(start, end) });
start_i = start+end + 1;
}
}
@@ -208,7 +206,7 @@ namespace ScintillaNET_FindReplaceDialog
}
}
//根据位置来获取该位置所在行
int GetLineNum(int pos,out int LinePos)
int GetLineNum(int pos,out int LinePos,out string LineText)
{
LinePos = -1;
var split_txt = Text.Split('\n');
@@ -218,6 +216,7 @@ namespace ScintillaNET_FindReplaceDialog
if (count+split_txt[i].Length+1>=pos)
{
LinePos = count;
LineText = split_txt[i];
return i;
}
else
@@ -225,6 +224,7 @@ namespace ScintillaNET_FindReplaceDialog
count += split_txt[i].Length+1;
}
}
LineText = "";
return -1;
}
return list;
@@ -227,7 +227,10 @@ namespace ScintillaNET_FindReplaceDialog
ScintillaNET_FindReplaceDialog.CharacterRange r = _findReplace.FindNext(txtFind.Text, true, _findReplace.Window.GetSearchFlags());
if (r.CpMin != r.CpMax)
_scintilla.SetSel(r.CpMin, r.CpMax);
{
_scintilla.GotoPosition(r.CpMin);
_scintilla.SetSel(r.CpMin, r.CpMax);
}
MoveFormAwayFromSelection();
}
@@ -241,7 +244,10 @@ namespace ScintillaNET_FindReplaceDialog
ScintillaNET_FindReplaceDialog.CharacterRange r = _findReplace.FindPrevious(txtFind.Text, true, _findReplace.Window.GetSearchFlags());
if (r.CpMin != r.CpMax)
{
_scintilla.GotoPosition(r.CpMin);
_scintilla.SetSel(r.CpMin, r.CpMax);
}
MoveFormAwayFromSelection();
}
@@ -282,7 +288,10 @@ namespace ScintillaNET_FindReplaceDialog
r = _findReplace.Find(0, pos, txtFind.Text, _findReplace.Window.GetSearchFlags());
if (r.CpMin != r.CpMax)
{
_scintilla.GotoPosition(r.CpMin);
_scintilla.SetSel(r.CpMin, r.CpMax);
}
else
txtFind.BackColor = Color.Tomato;
@@ -15,6 +15,7 @@ using System.Windows.Forms;
using ryCommon;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
using Newtonsoft.Json.Linq;
using DiffPlex.Model;
namespace ryControls
{
@@ -35,6 +36,7 @@ namespace ryControls
Editor.CharAdded += HighlightEditor_CharAdded;
Editor.UpdateUI += HighlightEditor_UpdateUI;
Editor.EolMode = Eol.CrLf;
//Editor.AdditionalCaretForeColor=Color.Red;
//Editor
//base.HandleCreated += HighlightEditor_HandleCreated;
//base.InternalFocusFlag = true;
@@ -44,6 +46,11 @@ namespace ryControls
};
AutoComplete.TargetControlWrapper = new ScintillaWrapper(Editor);
Editor.DoubleClick += Editor_DoubleClick;
var ind_17= Editor.Indicators[17];
ind_17.ForeColor = Color.FromArgb(232, 232, 255);
ind_17.Alpha = 100;
ind_17.Style = IndicatorStyle.RoundBox;
ind_17.Under = true;
_indicator = Editor.Indicators[16];
_indicator.ForeColor = Color.Red;
//_indicator.ForeColor = Color.LawnGreen; //Smart highlight
@@ -53,13 +60,14 @@ namespace ryControls
Editor.IndicatorCurrent = _indicator.Index;
this.LostFocus += HighlightEditor_LostFocus;
Editor.LostFocus += HighlightEditor_LostFocus;
Editor.InternalFocusFlag = false;
//Editor.CaretLineVisibleAlways = false;
Editor.InternalFocusFlag = true;
Editor.CaretLineBackColorAlpha = 60;
Editor.CaretPeriod = 0;
}
private void HighlightEditor_LostFocus(object sender, EventArgs e)
{
//Editor.CaretLineVisibleAlways =false ;
//Editor.AdditionalCaretForeColor
}
#region 属性设置
/// <summary>
@@ -71,10 +79,10 @@ namespace ryControls
get { return Editor.ReadOnly; }
set { Editor.ReadOnly = value; }
}
[DefaultValue(BorderStyle.Fixed3D)]
[DefaultValue(ScintillaNET.BorderStyle.Fixed3D)]
[Category("Appearance")]
[Description("编辑器边框.")]
public BorderStyle BorderStyle
public ScintillaNET.BorderStyle BorderStyle
{
get { return Editor.BorderStyle; }
set { Editor.BorderStyle = value; }
@@ -112,7 +120,7 @@ namespace ryControls
[EditorBrowsable(EditorBrowsableState.Always)]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[DefaultValue(typeof(Font), "Consolas, 12pt")]
[DefaultValue(typeof(Font), "Consolas, 14pt")]
public override Font Font
{
get => base.Font;
@@ -144,7 +152,11 @@ namespace ryControls
/// </summary>
public string SelectedText
{
get { return Editor.SelectedText; }
get {
var text= Editor.SelectedText.TrimEnd('\0');
if (text == "\0") { text = ""; }
return text;
}
set { Editor.ReplaceSelection(value); }
}
/// <summary>
@@ -219,42 +231,51 @@ namespace ryControls
}
return str;
}
private string last_selected = "";
private void HighlightEditor_UpdateUI(object sender, UpdateUIEventArgs e)
{
var selected_text = Editor.SelectedText;
if(selected_text.Length==0)
if (e.Change != UpdateChange.Content)
{
ClearAllMark();
var selected_text = SelectedText;
var sel_start = Editor.SelectionStart;
var a = Editor.BraceMatch(sel_start);
if (a >= 0)
var sel_id= sel_start + "|" + selected_text.Length;
if (sel_id != last_selected)
{
Editor.IndicatorFillRange(a, 1);
Editor.IndicatorFillRange(sel_start, 1);
}
else
{
if (sel_start - 1>=0)
ClearAllMark();
last_selected = sel_id;
if (AutoMark)
{
a = Editor.BraceMatch(sel_start - 1);
if (a >= 0)
MarkText(selected_text);
}
OnSelectedChanged?.Invoke(this, EventArgs.Empty);
}
if (selected_text.Length == 0)
{
var a = Editor.BraceMatch(sel_start);
if (a >= 0)
{
Editor.IndicatorCurrent = _indicator.Index;
Editor.IndicatorFillRange(a, 1);
Editor.IndicatorFillRange(sel_start, 1);
}
else
{
if (sel_start - 1 >= 0)
{
Editor.IndicatorFillRange(a, 1);
Editor.IndicatorFillRange(sel_start -1, 1);
a = Editor.BraceMatch(sel_start - 1);
if (a >= 0)
{
Editor.IndicatorCurrent = _indicator.Index;
Editor.IndicatorFillRange(a, 1);
Editor.IndicatorFillRange(sel_start - 1, 1);
}
}
}
}
}
if (selected_text != lastSelectedText)
{
lastSelectedText = selected_text;
if(AutoMark)
{
ClearAllMark();
MarkText(SelectedText);
}
OnSelectedChanged?.Invoke(this, EventArgs.Empty);
var pos = Editor.CurrentPosition;
var line = Editor.LineFromPosition(pos);
Editor.IndicatorCurrent = 17;
Editor.IndicatorFillRange(Editor.Lines[line].Position, Editor.Lines[line].Length);
}
if (LastProcessedChar != 0)
{
@@ -270,13 +291,44 @@ namespace ryControls
{
if ("{(<[".IndexOfEx(nPrevLineText.Substring(nPrevLineText.Length - 1, 1)) >= 0)
{
Editor.ReplaceSelection(Indent(Editor.Lines[line - 1].Indentation + 4));
if (Editor.Lines[line].Text.Trim().StartsWith("}")) {
Editor.ReplaceSelection(Indent(Editor.Lines[line - 1].Indentation));
}
else {
Editor.ReplaceSelection(Indent(Editor.Lines[line - 1].Indentation + 4));
}
}
else
{
Editor.ReplaceSelection(Indent(Editor.Lines[line - 1].Indentation));
}
}
else
{
for (int i = line - 2; i >0; i--)
{
nPrevLineText = Editor.Lines[i].Text.Trim();
if (nPrevLineText.Length >= 1)
{
if ("{(<[".IndexOfEx(nPrevLineText.Substring(nPrevLineText.Length - 1, 1)) >= 0)
{
if (Editor.Lines[line].Text.Trim().StartsWith("}"))
{
Editor.ReplaceSelection(Indent(Editor.Lines[i].Indentation));
}
else
{
Editor.ReplaceSelection(Indent(Editor.Lines[i].Indentation + 4));
}
}
else
{
Editor.ReplaceSelection(Indent(Editor.Lines[i].Indentation));
}
break;
}
}
}
}
}
LastProcessedChar = 0;
@@ -501,6 +553,7 @@ namespace ryControls
var a= Editor.BraceMatch(Editor.SelectionStart);
if (a >= 0)
{
Editor.IndicatorCurrent = _indicator.Index;
Editor.IndicatorFillRange(a, 1);
Editor.IndicatorFillRange(Editor.SelectionStart, 1);
}
@@ -537,6 +590,7 @@ namespace ryControls
}
}
find_count++;
Editor.IndicatorCurrent = _indicator.Index;
Editor.IndicatorFillRange(pos, search_len);
pos = _text.IndexOf(search_text, pos + search_len);
}
@@ -552,6 +606,8 @@ namespace ryControls
public void ClearAllMark()
{
int currentIndicator = Editor.IndicatorCurrent;
Editor.IndicatorCurrent = 17;
Editor.IndicatorClearRange(0, Editor.TextLength);
Editor.IndicatorCurrent = _indicator.Index;
Editor.IndicatorClearRange(0, Editor.TextLength);
Editor.IndicatorCurrent = currentIndicator;
@@ -559,6 +615,14 @@ namespace ryControls
/// <summary>
/// 设置高亮文本
/// </summary>
/// <param name="format"></param>
public void SetHightlightText(string format)
{
SetHightlightText(this.Text, format);
}
/// <summary>
/// 设置高亮文本
/// </summary>
/// <param name="text"></param>
/// <param name="format"></param>
public void SetHightlightText(string text, string format)
@@ -582,9 +646,10 @@ namespace ryControls
{
Editor.ReadOnly = true;
}
Editor.Font = this.Font;
for (int i = 0; i < Editor.Styles.Count; i++)
{
if (i != CallTip) SetStyleFont(i, Editor.Font);
if (i != CallTip) SetStyleFont(i, this.Font);
}
}
@@ -44,7 +44,7 @@ namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
// DEFAULT, fontStyle = 0, styleId = 0
scintilla.Styles[Style.Css.Default].ForeColor = lexerColors[LexerType.Css, "DefaultFore"];
scintilla.Styles[Style.Css.Default].BackColor = lexerColors[LexerType.Css, "DefaultFore"];
scintilla.Styles[Style.Css.Default].BackColor = lexerColors[LexerType.Css, "DefaultBack"];
// TAG, fontStyle = 0, styleId = 1
scintilla.Styles[Style.Css.Tag].ForeColor = lexerColors[LexerType.Css, "TagFore"];
@@ -54,30 +54,30 @@ namespace VPKSoft.ScintillaLexers.HelperClasses
/// <summary>
/// A list of currently supported lexers by this library.
/// </summary>
public static readonly List<Tuple<LexerEnumerations.LexerType, string, Lexer,string>> LexerTypeNameList = new List<Tuple<LexerEnumerations.LexerType, string, Lexer,string>>(
public static readonly List<Tuple<LexerEnumerations.LexerType, string,string>> LexerTypeNameList = new List<Tuple<LexerEnumerations.LexerType, string,string>>(
new[]
{
Tuple.Create(LexerEnumerations.LexerType.Unknown, "text", Lexer.Null,"Text"),
Tuple.Create(LexerEnumerations.LexerType.Cs, "cs", Lexer.Cpp, "C#"),
Tuple.Create(LexerEnumerations.LexerType.Cpp, "cpp", Lexer.Cpp, "C++"),
Tuple.Create(LexerEnumerations.LexerType.Xml, "xml", Lexer.Xml, "XML"),
Tuple.Create(LexerEnumerations.LexerType.Text, "text", Lexer.Null, "Text"),
Tuple.Create(LexerEnumerations.LexerType.Nsis, "nsis", (Lexer)SCLEX_NSIS, "Nsis"),
Tuple.Create(LexerEnumerations.LexerType.InnoSetup, "inno", (Lexer)SCLEX_INNOSETUP, "InnoSetup"),
Tuple.Create(LexerEnumerations.LexerType.SQL, "sql", Lexer.Xml, "SQL"),
Tuple.Create(LexerEnumerations.LexerType.Batch, "batch", Lexer.Batch, "Batch"),
Tuple.Create(LexerEnumerations.LexerType.Pascal, "pascal", Lexer.Pascal, "Pascal"),
Tuple.Create(LexerEnumerations.LexerType.PHP, "php", Lexer.Html, "PHP"),
Tuple.Create(LexerEnumerations.LexerType.WindowsPowerShell, "powershell", Lexer.PowerShell, "PowerShell"),
Tuple.Create(LexerEnumerations.LexerType.INI, "ini", Lexer.Properties, "INI"),
Tuple.Create(LexerEnumerations.LexerType.Python, "python", Lexer.Python, "Python"),
Tuple.Create(LexerEnumerations.LexerType.YAML, "yaml", (Lexer)SCLEX_YAML, "YAML"),
Tuple.Create(LexerEnumerations.LexerType.Java, "java", Lexer.Cpp, "Java"),
Tuple.Create(LexerEnumerations.LexerType.Css, "css", Lexer.Css, "Css"),
Tuple.Create(LexerEnumerations.LexerType.VbDotNet, "vb", Lexer.Vb, "VB.Net"),
Tuple.Create(LexerEnumerations.LexerType.Json, "json", Lexer.Json, "Json"),
Tuple.Create(LexerEnumerations.LexerType.HTML, "html", Lexer.Html, "HTML"),
Tuple.Create(LexerEnumerations.LexerType.JavaScript, "javascript", Lexer.Cpp, "JavaScript"),
Tuple.Create(LexerEnumerations.LexerType.Unknown, "text","Text"),
Tuple.Create(LexerEnumerations.LexerType.Cs, "cs", "C#"),
Tuple.Create(LexerEnumerations.LexerType.Cpp, "cpp", "C++"),
Tuple.Create(LexerEnumerations.LexerType.Xml, "xml", "XML"),
Tuple.Create(LexerEnumerations.LexerType.Text, "text", "Text"),
Tuple.Create(LexerEnumerations.LexerType.Nsis, "nsis", "Nsis"),
Tuple.Create(LexerEnumerations.LexerType.InnoSetup, "inno", "InnoSetup"),
Tuple.Create(LexerEnumerations.LexerType.SQL, "sql", "SQL"),
Tuple.Create(LexerEnumerations.LexerType.Batch, "batch", "Batch"),
Tuple.Create(LexerEnumerations.LexerType.Pascal, "pascal", "Pascal"),
Tuple.Create(LexerEnumerations.LexerType.PHP, "php", "PHP"),
Tuple.Create(LexerEnumerations.LexerType.WindowsPowerShell, "powershell", "PowerShell"),
Tuple.Create(LexerEnumerations.LexerType.INI, "ini", "INI"),
Tuple.Create(LexerEnumerations.LexerType.Python, "python", "Python"),
Tuple.Create(LexerEnumerations.LexerType.YAML, "yaml", "YAML"),
Tuple.Create(LexerEnumerations.LexerType.Java, "java", "Java"),
Tuple.Create(LexerEnumerations.LexerType.Css, "css", "Css"),
Tuple.Create(LexerEnumerations.LexerType.VbDotNet, "vb", "VB.Net"),
Tuple.Create(LexerEnumerations.LexerType.Json, "json", "Json"),
Tuple.Create(LexerEnumerations.LexerType.HTML, "html", "HTML"),
Tuple.Create(LexerEnumerations.LexerType.JavaScript, "javascript", "JavaScript"),
});
/// <summary>
@@ -90,27 +90,5 @@ namespace VPKSoft.ScintillaLexers.HelperClasses
var result = LexerTypeNameList.FirstOrDefault(f => f.Item1 == lexerType);
return result == null ? "text" : result.Item2;
}
/// <summary>
/// Gets the name of the lexer XML used in Notepad++'s XML style files.
/// </summary>
/// <param name="lexer">The Scintilla lexer enumeration value.</param>
/// <returns>The name of the lexer used in Notepad++'s XML style files if successful; otherwise "text".</returns>
public static string GetLexerXmlName(Lexer lexer)
{
var result = LexerTypeNameList.FirstOrDefault(f => f.Item3 == lexer);
return result == null ? "text" : result.Item2;
}
/// <summary>
/// Gets the type of the lexer by a given <see cref="LexerEnumerations.LexerType"/> enumeration.
/// </summary>
/// <param name="lexerType">Type of the lexer.</param>
/// <returns>A <see cref="Lexer"/> matching the given <see cref="LexerEnumerations.LexerType"/> enumeration.</returns>
public static Lexer GetLexerByLexerType(LexerEnumerations.LexerType lexerType)
{
var result = LexerTypeNameList.FirstOrDefault(f => f.Item1 == lexerType);
return result?.Item3 ?? Lexer.Null;
}
}
}
@@ -156,16 +156,9 @@ namespace VPKSoft.ScintillaLexers
ScintillaNotepadPlusPlusStyles.LoadLexerStyleFromNotepadPlusXml(document, scintilla,
lexerType); // TODO::Font?
var lexerTypeDetected = LexerTypeName.GetLexerByLexerType(lexerType);
var lexerTypeDetected = LexerTypeName.GetLexerXmlName(lexerType);
//scintilla.Lexer = lexerTypeDetected;
if (NativeMethods.NameConstantMap.ContainsKey((int)lexerTypeDetected))
{
scintilla.LexerName = NativeMethods.NameConstantMap[(int)lexerTypeDetected];
}
else
{
scintilla.LexerName = "null";
}
scintilla.LexerName = lexerTypeDetected;
ScintillaKeyWords.SetKeywords(scintilla, lexerType);
LexerFoldProperties.SetFoldProperties(scintilla, lexerType);
@@ -69,6 +69,7 @@ namespace ryPaiban.Model
private void MenuRight_Opening(object sender, CancelEventArgs e)
{
if (SourceContent == null) { return; }
DataProvider mydb = new DataProvider();
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(Itrycn_Db.User_SQLConn) == 1)
@@ -54,12 +54,55 @@ namespace ScintillaDiff
public ScintillaDiffControl()
{
InitializeComponent();
if(!this.DesignMode)
{
//
// scintillaOne
//
scintillaOne = new ScrollSyncScintilla();
this.scintillaOne.AutoCMaxHeight = 9;
this.scintillaOne.BiDirectionality = ScintillaNET.BiDirectionalDisplayType.Disabled;
this.scintillaOne.CaretLineBackColor = System.Drawing.Color.White;
this.scintillaOne.CaretLineVisible = true;
this.scintillaOne.Dock = System.Windows.Forms.DockStyle.Fill;
this.scintillaOne.LexerName = null;
this.scintillaOne.Location = new System.Drawing.Point(0, 23);
this.scintillaOne.ScrollSync = this.scintillaTwo;
this.scintillaOne.ScrollWidth = 1;
this.scintillaOne.Size = new System.Drawing.Size(434, 431);
this.scintillaOne.TabIndents = true;
this.scintillaOne.TabIndex = 0;
this.scintillaOne.UseRightToLeftReadingLayout = false;
this.scintillaOne.WrapMode = ScintillaNET.WrapMode.None;
this.scintillaOne.TextChanged += new System.EventHandler(this.Scintilla_TextChanged);
//
// scintillaTwo
//
scintillaTwo = new ScrollSyncScintilla();
this.scintillaTwo.AutoCMaxHeight = 9;
this.scintillaTwo.BiDirectionality = ScintillaNET.BiDirectionalDisplayType.Disabled;
this.scintillaTwo.CaretLineBackColor = System.Drawing.Color.White;
this.scintillaTwo.CaretLineVisible = true;
this.scintillaTwo.Dock = System.Windows.Forms.DockStyle.Fill;
this.scintillaTwo.LexerName = null;
this.scintillaTwo.Location = new System.Drawing.Point(0, 23);
this.scintillaTwo.ScrollSync = this.scintillaOne;
this.scintillaTwo.ScrollWidth = 1;
this.scintillaTwo.Size = new System.Drawing.Size(480, 431);
this.scintillaTwo.TabIndents = true;
this.scintillaTwo.TabIndex = 0;
this.scintillaTwo.UseRightToLeftReadingLayout = false;
this.scintillaTwo.WrapMode = ScintillaNET.WrapMode.None;
this.scintillaTwo.TextChanged += new System.EventHandler(this.Scintilla_TextChanged);
this.scMain.Panel1.Controls.Add(scintillaOne);
this.scMain.Panel1.Controls.SetChildIndex(scintillaOne, 0);
this.scMain.Panel2.Controls.Add(scintillaTwo);
this.scMain.Panel2.Controls.SetChildIndex(scintillaTwo, 0);
scintillaOne.Tag = -1;
scintillaTwo.Tag = -1;
ReInit();
}
// this tag values are for line number length counting..
scintillaOne.Tag = -1;
scintillaTwo.Tag = -1;
ReInit();
}
public void ReInit()
{
@@ -106,9 +149,11 @@ namespace ScintillaDiff
#endregion
#region PrivateFields
private ScrollSyncScintilla scintillaOne;
private ScrollSyncScintilla scintillaTwo;
private string textLeft = string.Empty;
private string textRight = string.Empty;
private Bitmap imageRowAdded =SuperDesign.Properties.Resources.plus;
private Bitmap imageRowAdded = SuperDesign.Properties.Resources.plus;
private Bitmap imageRowDeleted = SuperDesign.Properties.Resources.minus;
private Bitmap imageRowOk = SuperDesign.Properties.Resources.ok;
private Bitmap imageRowDiff = SuperDesign.Properties.Resources.diff;
@@ -1598,5 +1643,11 @@ namespace ScintillaDiff
return JumpToLine(diffIndex, true);
}
#endregion
private void ScintillaDiffControl_Load(object sender, EventArgs e)
{
ryCommon.Auto.LeftClick(scintillaOne.Handle, 0, 0);
ryCommon.Auto.LeftClick(scintillaTwo.Handle, 0, 0);
}
}
}
@@ -31,11 +31,9 @@ namespace ScintillaDiff
private void InitializeComponent()
{
this.scMain = new System.Windows.Forms.SplitContainer();
this.scintillaOne = new ScintillaDiff.ScrollSyncScintilla();
this.scintillaTwo = new ScintillaDiff.ScrollSyncScintilla();
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = 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();
@@ -53,55 +51,15 @@ namespace ScintillaDiff
//
// scMain.Panel1
//
this.scMain.Panel1.Controls.Add(this.scintillaOne);
this.scMain.Panel1.Controls.Add(this.panel1);
//
// scMain.Panel2
//
this.scMain.Panel2.Controls.Add(this.scintillaTwo);
this.scMain.Panel2.Controls.Add(this.panel2);
this.scMain.Size = new System.Drawing.Size(918, 454);
this.scMain.SplitterDistance = 434;
this.scMain.TabIndex = 0;
//
// scintillaOne
//
this.scintillaOne.AutoCMaxHeight = 9;
this.scintillaOne.BiDirectionality = ScintillaNET.BiDirectionalDisplayType.Disabled;
this.scintillaOne.CaretLineBackColor = System.Drawing.Color.White;
this.scintillaOne.CaretLineVisible = true;
this.scintillaOne.Dock = System.Windows.Forms.DockStyle.Fill;
this.scintillaOne.LexerName = null;
this.scintillaOne.Location = new System.Drawing.Point(0, 23);
this.scintillaOne.Name = "scintillaOne";
this.scintillaOne.ScrollSync = this.scintillaTwo;
this.scintillaOne.ScrollWidth = 1;
this.scintillaOne.Size = new System.Drawing.Size(434, 431);
this.scintillaOne.TabIndents = true;
this.scintillaOne.TabIndex = 0;
this.scintillaOne.UseRightToLeftReadingLayout = false;
this.scintillaOne.WrapMode = ScintillaNET.WrapMode.None;
this.scintillaOne.TextChanged += new System.EventHandler(this.Scintilla_TextChanged);
//
// scintillaTwo
//
this.scintillaTwo.AutoCMaxHeight = 9;
this.scintillaTwo.BiDirectionality = ScintillaNET.BiDirectionalDisplayType.Disabled;
this.scintillaTwo.CaretLineBackColor = System.Drawing.Color.White;
this.scintillaTwo.CaretLineVisible = true;
this.scintillaTwo.Dock = System.Windows.Forms.DockStyle.Fill;
this.scintillaTwo.LexerName = null;
this.scintillaTwo.Location = new System.Drawing.Point(0, 23);
this.scintillaTwo.Name = "scintillaTwo";
this.scintillaTwo.ScrollSync = this.scintillaOne;
this.scintillaTwo.ScrollWidth = 1;
this.scintillaTwo.Size = new System.Drawing.Size(480, 431);
this.scintillaTwo.TabIndents = true;
this.scintillaTwo.TabIndex = 0;
this.scintillaTwo.UseRightToLeftReadingLayout = false;
this.scintillaTwo.WrapMode = ScintillaNET.WrapMode.None;
this.scintillaTwo.TextChanged += new System.EventHandler(this.Scintilla_TextChanged);
//
// panel1
//
this.panel1.Controls.Add(this.label1);
@@ -111,15 +69,6 @@ namespace ScintillaDiff
this.panel1.Size = new System.Drawing.Size(434, 23);
this.panel1.TabIndex = 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;
//
// label1
//
this.label1.AutoSize = true;
@@ -129,6 +78,15 @@ namespace ScintillaDiff
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;
@@ -145,6 +103,7 @@ namespace ScintillaDiff
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);
@@ -161,8 +120,6 @@ namespace ScintillaDiff
#endregion
private System.Windows.Forms.SplitContainer scMain;
private ScrollSyncScintilla scintillaOne;
private ScrollSyncScintilla scintillaTwo;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label1;