2015-08-02 19:27:02 -04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
2016-12-11 14:25:29 -05:00
|
|
|
|
using Mesen.GUI.Controls;
|
2018-02-11 15:58:23 -05:00
|
|
|
|
using Mesen.GUI.Debugger.Controls;
|
2018-03-10 09:58:24 -05:00
|
|
|
|
using Mesen.GUI.Config;
|
2018-03-18 19:57:56 -04:00
|
|
|
|
using System.Globalization;
|
2015-08-02 19:27:02 -04:00
|
|
|
|
|
|
|
|
|
namespace Mesen.GUI.Debugger
|
|
|
|
|
{
|
2016-12-11 14:25:29 -05:00
|
|
|
|
public partial class ctrlScrollableTextbox : BaseControl
|
2015-08-02 19:27:02 -04:00
|
|
|
|
{
|
2016-11-24 19:47:59 -05:00
|
|
|
|
public event EventHandler ScrollPositionChanged;
|
|
|
|
|
|
2018-01-02 11:11:50 -05:00
|
|
|
|
private bool _showScrollbars = true;
|
|
|
|
|
|
2015-08-02 19:27:02 -04:00
|
|
|
|
public new event MouseEventHandler MouseUp
|
|
|
|
|
{
|
|
|
|
|
add { this.ctrlTextbox.MouseUp += value; }
|
|
|
|
|
remove { this.ctrlTextbox.MouseUp -= value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public new event MouseEventHandler MouseMove
|
|
|
|
|
{
|
|
|
|
|
add { this.ctrlTextbox.MouseMove += value; }
|
|
|
|
|
remove { this.ctrlTextbox.MouseMove -= value; }
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-10 00:33:33 -05:00
|
|
|
|
public new event MouseEventHandler MouseDown
|
|
|
|
|
{
|
|
|
|
|
add { this.ctrlTextbox.MouseDown += value; }
|
|
|
|
|
remove { this.ctrlTextbox.MouseDown -= value; }
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-21 22:34:47 -05:00
|
|
|
|
public new event MouseEventHandler MouseDoubleClick
|
|
|
|
|
{
|
|
|
|
|
add { this.ctrlTextbox.MouseDoubleClick += value; }
|
|
|
|
|
remove { this.ctrlTextbox.MouseDoubleClick -= value; }
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-03 09:57:58 -05:00
|
|
|
|
public new event EventHandler MouseLeave
|
|
|
|
|
{
|
|
|
|
|
add { this.ctrlTextbox.MouseLeave += value; }
|
|
|
|
|
remove { this.ctrlTextbox.MouseLeave -= value; }
|
|
|
|
|
}
|
2018-02-11 15:58:23 -05:00
|
|
|
|
|
2018-03-03 10:41:59 -05:00
|
|
|
|
public event EventHandler TextZoomChanged;
|
2016-06-04 14:43:13 -04:00
|
|
|
|
|
2015-08-02 19:27:02 -04:00
|
|
|
|
public ctrlScrollableTextbox()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
2018-03-18 19:57:56 -04:00
|
|
|
|
bool designMode = (LicenseManager.UsageMode == LicenseUsageMode.Designtime);
|
|
|
|
|
if(!designMode) {
|
|
|
|
|
this.panelSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
|
|
|
|
|
this.panelSearch.Location = new System.Drawing.Point(this.Width - this.panelSearch.Width - 20, -1);
|
|
|
|
|
|
|
|
|
|
this.ctrlTextbox.ShowLineNumbers = true;
|
|
|
|
|
this.ctrlTextbox.ShowLineInHex = true;
|
2017-03-24 15:11:38 -04:00
|
|
|
|
|
2018-03-18 19:57:56 -04:00
|
|
|
|
this.hScrollBar.ValueChanged += hScrollBar_ValueChanged;
|
|
|
|
|
this.vScrollBar.ValueChanged += vScrollBar_ValueChanged;
|
|
|
|
|
this.ctrlTextbox.ScrollPositionChanged += ctrlTextbox_ScrollPositionChanged;
|
|
|
|
|
this.ctrlTextbox.SelectedLineChanged += ctrlTextbox_SelectedLineChanged;
|
2015-08-03 21:53:46 -04:00
|
|
|
|
|
2018-03-18 19:57:56 -04:00
|
|
|
|
new ToolTip().SetToolTip(picCloseSearch, "Close");
|
|
|
|
|
new ToolTip().SetToolTip(picSearchNext, "Find Next (F3)");
|
|
|
|
|
new ToolTip().SetToolTip(picSearchPrevious, "Find Previous (Shift-F3)");
|
|
|
|
|
}
|
2015-08-02 19:27:02 -04:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-24 15:11:38 -04:00
|
|
|
|
protected override void OnResize(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnResize(e);
|
2017-09-16 22:02:05 -04:00
|
|
|
|
this.panelSearch.Location = new System.Drawing.Point(this.Width - this.panelSearch.Width - 20, -1);
|
2017-03-24 15:11:38 -04:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-02 11:11:50 -05:00
|
|
|
|
public bool ShowScrollbars
|
|
|
|
|
{
|
2018-02-11 15:58:23 -05:00
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._showScrollbars;
|
|
|
|
|
}
|
2018-01-02 11:11:50 -05:00
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._showScrollbars = value;
|
|
|
|
|
this.hScrollBar.Visible = value;
|
|
|
|
|
this.vScrollBar.Visible = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-11 15:58:23 -05:00
|
|
|
|
public IScrollbarColorProvider ScrollbarColorProvider
|
|
|
|
|
{
|
|
|
|
|
set { this.vScrollBar.ColorProvider = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ctrlTextbox_SelectedLineChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.vScrollBar.Invalidate();
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-03 10:41:59 -05:00
|
|
|
|
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
2018-03-03 11:14:57 -05:00
|
|
|
|
public Font BaseFont
|
2015-08-04 19:50:57 -04:00
|
|
|
|
{
|
2018-03-03 10:41:59 -05:00
|
|
|
|
get { return this.ctrlTextbox.BaseFont; }
|
2015-08-04 19:50:57 -04:00
|
|
|
|
set
|
|
|
|
|
{
|
2018-03-03 10:41:59 -05:00
|
|
|
|
this.ctrlTextbox.BaseFont = value;
|
|
|
|
|
UpdateHorizontalScrollbar();
|
|
|
|
|
this.ctrlTextbox.Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-06-04 14:43:13 -04:00
|
|
|
|
|
2018-03-03 10:41:59 -05:00
|
|
|
|
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
|
|
|
|
public int TextZoom
|
|
|
|
|
{
|
|
|
|
|
get { return this.ctrlTextbox.TextZoom; }
|
|
|
|
|
set {
|
|
|
|
|
if(this.ctrlTextbox.TextZoom != value) {
|
|
|
|
|
this.ctrlTextbox.TextZoom = value;
|
2018-03-03 14:58:33 -05:00
|
|
|
|
UpdateHorizontalScrollbar();
|
2018-03-03 10:41:59 -05:00
|
|
|
|
if(this.TextZoomChanged != null) {
|
|
|
|
|
this.TextZoomChanged(this, null);
|
2016-06-04 14:43:13 -04:00
|
|
|
|
}
|
2015-08-04 19:50:57 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-18 19:57:56 -04:00
|
|
|
|
public string GetWordUnderLocation(Point position)
|
2015-08-02 19:27:02 -04:00
|
|
|
|
{
|
2018-03-18 19:57:56 -04:00
|
|
|
|
return this.ctrlTextbox.GetWordUnderLocation(position);
|
2015-08-02 19:27:02 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ctrlTextbox_ScrollPositionChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.vScrollBar.Value = this.ctrlTextbox.ScrollPosition;
|
2016-11-23 22:57:17 -05:00
|
|
|
|
this.hScrollBar.Value = this.ctrlTextbox.HorizontalScrollPosition;
|
|
|
|
|
UpdateHorizontalScrollbar();
|
2017-08-06 16:23:22 -04:00
|
|
|
|
UpdateVerticalScrollbar();
|
2016-11-24 19:47:59 -05:00
|
|
|
|
|
|
|
|
|
ScrollPositionChanged?.Invoke(null, null);
|
2016-11-23 22:57:17 -05:00
|
|
|
|
}
|
|
|
|
|
|
2017-08-06 16:23:22 -04:00
|
|
|
|
private void UpdateVerticalScrollbar()
|
|
|
|
|
{
|
2018-02-11 15:58:23 -05:00
|
|
|
|
this.vScrollBar.Maximum = this.ctrlTextbox.LineCount;
|
|
|
|
|
this.vScrollBar.VisibleLineCount = this.ctrlTextbox.GetNumberVisibleLines();
|
2017-08-06 16:23:22 -04:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-23 22:57:17 -05:00
|
|
|
|
private void UpdateHorizontalScrollbar()
|
|
|
|
|
{
|
2018-01-02 11:11:50 -05:00
|
|
|
|
this.hScrollBar.Visible = this.ctrlTextbox.HorizontalScrollWidth > 0 && _showScrollbars;
|
2016-11-23 22:57:17 -05:00
|
|
|
|
int newMax = this.ctrlTextbox.HorizontalScrollWidth + this.hScrollBar.LargeChange - 1;
|
|
|
|
|
if(this.hScrollBar.Value > this.ctrlTextbox.HorizontalScrollWidth) {
|
|
|
|
|
this.hScrollBar.Value = this.ctrlTextbox.HorizontalScrollWidth;
|
|
|
|
|
}
|
|
|
|
|
this.hScrollBar.Maximum = newMax;
|
2015-08-02 19:27:02 -04:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-09 23:50:20 -05:00
|
|
|
|
public ctrlTextbox.ILineStyleProvider StyleProvider { set { this.ctrlTextbox.StyleProvider = value; } }
|
2015-08-02 19:27:02 -04:00
|
|
|
|
|
|
|
|
|
public int GetLineIndex(int lineNumber)
|
|
|
|
|
{
|
|
|
|
|
return this.ctrlTextbox.GetLineIndex(lineNumber);
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-10 00:33:33 -05:00
|
|
|
|
public int GetLineIndexAtPosition(int yPos)
|
|
|
|
|
{
|
|
|
|
|
return this.ctrlTextbox.GetLineIndexAtPosition(yPos);
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-18 19:57:56 -04:00
|
|
|
|
public string GetLineNoteAtLineIndex(int lineIndex)
|
|
|
|
|
{
|
|
|
|
|
if(lineIndex >= 0 && lineIndex < this.ctrlTextbox.LineNumberNotes.Length) {
|
|
|
|
|
return this.ctrlTextbox.LineNumberNotes[lineIndex];
|
|
|
|
|
} else {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-02 19:27:02 -04:00
|
|
|
|
public int GetLineNumber(int lineIndex)
|
|
|
|
|
{
|
|
|
|
|
return this.ctrlTextbox.GetLineNumber(lineIndex);
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-10 00:33:33 -05:00
|
|
|
|
public int GetLineNumberAtPosition(int yPos)
|
|
|
|
|
{
|
|
|
|
|
return this.GetLineNumber(this.GetLineIndexAtPosition(yPos));
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-24 23:23:26 -04:00
|
|
|
|
public void ScrollToLineIndex(int lineIndex, eHistoryType historyType = eHistoryType.Always, bool scrollToTop = false, bool forceScroll = false)
|
2015-08-05 20:40:10 -04:00
|
|
|
|
{
|
2018-07-24 23:23:26 -04:00
|
|
|
|
this.ctrlTextbox.ScrollToLineIndex(lineIndex, historyType, scrollToTop, forceScroll);
|
2015-08-05 20:40:10 -04:00
|
|
|
|
}
|
|
|
|
|
|
2018-07-24 23:23:26 -04:00
|
|
|
|
public void ScrollToLineNumber(int lineNumber, eHistoryType historyType = eHistoryType.Always, bool scrollToTop = false, bool forceScroll = false)
|
2015-08-02 19:27:02 -04:00
|
|
|
|
{
|
2018-07-24 23:23:26 -04:00
|
|
|
|
this.ctrlTextbox.ScrollToLineNumber(lineNumber, historyType, scrollToTop, forceScroll);
|
2015-08-02 19:27:02 -04:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-22 18:59:00 -04:00
|
|
|
|
public void CopySelection(bool copyLineNumbers, bool copyContentNotes, bool copyComments)
|
2017-03-11 10:59:26 -05:00
|
|
|
|
{
|
2018-03-22 18:59:00 -04:00
|
|
|
|
this.ctrlTextbox.CopySelection(copyLineNumbers, copyContentNotes, copyComments);
|
2017-03-11 10:59:26 -05:00
|
|
|
|
}
|
|
|
|
|
|
2015-08-02 19:27:02 -04:00
|
|
|
|
public int CurrentLine
|
|
|
|
|
{
|
|
|
|
|
get { return this.ctrlTextbox.CurrentLine; }
|
|
|
|
|
}
|
2018-02-10 21:23:22 -05:00
|
|
|
|
|
|
|
|
|
public int SelectedLine
|
|
|
|
|
{
|
|
|
|
|
get { return this.ctrlTextbox.SelectedLine; }
|
|
|
|
|
}
|
2015-08-02 19:27:02 -04:00
|
|
|
|
|
2017-03-09 20:42:53 -05:00
|
|
|
|
public int LastSelectedLine
|
|
|
|
|
{
|
|
|
|
|
get { return this.ctrlTextbox.LastSelectedLine; }
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-10 00:33:33 -05:00
|
|
|
|
public int CodeMargin
|
|
|
|
|
{
|
|
|
|
|
get { return this.ctrlTextbox.CodeMargin; }
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-02 19:27:02 -04:00
|
|
|
|
protected override void OnMouseWheel(MouseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnMouseWheel(e);
|
|
|
|
|
this.vScrollBar.Value = Math.Min(this.vScrollBar.Maximum, Math.Max(0, this.vScrollBar.Value - e.Delta / 40));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
|
|
|
|
{
|
2015-08-08 22:41:16 -04:00
|
|
|
|
if(!this.cboSearch.Focused) {
|
2018-03-10 09:58:24 -05:00
|
|
|
|
if(keyData == ConfigManager.Config.DebugInfo.Shortcuts.SelectAll) {
|
2018-03-30 19:14:08 -04:00
|
|
|
|
this.SelectAll();
|
2018-03-10 09:58:24 -05:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-08 22:41:16 -04:00
|
|
|
|
switch(keyData) {
|
2017-03-09 20:42:53 -05:00
|
|
|
|
case Keys.Right | Keys.Shift:
|
|
|
|
|
case Keys.Down | Keys.Shift:
|
|
|
|
|
this.ctrlTextbox.MoveSelectionDown();
|
|
|
|
|
return true;
|
|
|
|
|
|
2015-08-08 22:41:16 -04:00
|
|
|
|
case Keys.Down:
|
|
|
|
|
case Keys.Right:
|
2017-08-06 16:23:22 -04:00
|
|
|
|
this.ctrlTextbox.SelectionStart = this.ctrlTextbox.SelectedLine + 1;
|
2017-03-09 20:42:53 -05:00
|
|
|
|
this.ctrlTextbox.SelectionLength = 0;
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
case Keys.Up | Keys.Shift:
|
|
|
|
|
case Keys.Left | Keys.Shift:
|
|
|
|
|
this.ctrlTextbox.MoveSelectionUp();
|
2015-08-08 22:41:16 -04:00
|
|
|
|
return true;
|
2017-03-09 20:42:53 -05:00
|
|
|
|
|
2015-08-08 22:41:16 -04:00
|
|
|
|
case Keys.Up:
|
|
|
|
|
case Keys.Left:
|
2017-08-06 16:23:22 -04:00
|
|
|
|
this.ctrlTextbox.SelectionStart = this.ctrlTextbox.SelectedLine - 1;
|
2017-03-09 20:42:53 -05:00
|
|
|
|
this.ctrlTextbox.SelectionLength = 0;
|
2015-08-08 22:41:16 -04:00
|
|
|
|
return true;
|
|
|
|
|
|
2017-08-06 16:23:22 -04:00
|
|
|
|
case Keys.Home | Keys.Shift:
|
|
|
|
|
this.ctrlTextbox.MoveSelectionUp(this.ctrlTextbox.LineCount);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case Keys.End | Keys.Shift:
|
|
|
|
|
this.ctrlTextbox.MoveSelectionDown(this.ctrlTextbox.LineCount);
|
|
|
|
|
break;
|
|
|
|
|
|
2015-08-08 22:41:16 -04:00
|
|
|
|
case Keys.Home:
|
2017-03-09 20:42:53 -05:00
|
|
|
|
this.ctrlTextbox.SelectionStart = 0;
|
|
|
|
|
this.ctrlTextbox.SelectionLength = 0;
|
2015-08-08 22:41:16 -04:00
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
case Keys.End:
|
2017-03-09 20:42:53 -05:00
|
|
|
|
this.ctrlTextbox.SelectionStart = this.ctrlTextbox.LineCount - 1;
|
|
|
|
|
this.ctrlTextbox.SelectionLength = 0;
|
2015-08-08 22:41:16 -04:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-08-03 21:53:46 -04:00
|
|
|
|
|
2018-03-10 09:58:24 -05:00
|
|
|
|
if(keyData == ConfigManager.Config.DebugInfo.Shortcuts.IncreaseFontSize) {
|
|
|
|
|
this.TextZoom += 10;
|
|
|
|
|
return true;
|
|
|
|
|
} else if(keyData == ConfigManager.Config.DebugInfo.Shortcuts.DecreaseFontSize) {
|
|
|
|
|
this.TextZoom -= 10;
|
|
|
|
|
return true;
|
|
|
|
|
} else if(keyData == ConfigManager.Config.DebugInfo.Shortcuts.ResetFontSize) {
|
|
|
|
|
this.TextZoom = 100;
|
|
|
|
|
return true;
|
|
|
|
|
} else if(keyData == ConfigManager.Config.DebugInfo.Shortcuts.Find) {
|
|
|
|
|
this.OpenSearchBox(true);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-08 22:41:16 -04:00
|
|
|
|
switch(keyData) {
|
2017-03-09 20:42:53 -05:00
|
|
|
|
case Keys.PageUp | Keys.Shift:
|
|
|
|
|
this.ctrlTextbox.MoveSelectionUp(20);
|
|
|
|
|
return true;
|
|
|
|
|
|
2015-08-02 19:27:02 -04:00
|
|
|
|
case Keys.PageUp:
|
2017-03-09 20:42:53 -05:00
|
|
|
|
this.ctrlTextbox.SelectionStart-=20;
|
|
|
|
|
this.ctrlTextbox.SelectionLength = 0;
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
case Keys.PageDown | Keys.Shift:
|
|
|
|
|
this.ctrlTextbox.MoveSelectionDown(20);
|
2015-08-02 19:27:02 -04:00
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
case Keys.PageDown:
|
2017-03-09 20:42:53 -05:00
|
|
|
|
this.ctrlTextbox.SelectionStart+=20;
|
|
|
|
|
this.ctrlTextbox.SelectionLength = 0;
|
2015-08-02 19:27:02 -04:00
|
|
|
|
return true;
|
2015-08-03 21:53:46 -04:00
|
|
|
|
|
|
|
|
|
case Keys.Escape:
|
2018-03-10 09:58:24 -05:00
|
|
|
|
if(this.cboSearch.Focused) {
|
|
|
|
|
this.CloseSearchBox();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2015-08-02 19:27:02 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return base.ProcessCmdKey(ref msg, keyData);
|
|
|
|
|
}
|
2018-03-30 19:14:08 -04:00
|
|
|
|
|
|
|
|
|
public void SelectAll()
|
|
|
|
|
{
|
|
|
|
|
this.ctrlTextbox.SelectionStart = 0;
|
|
|
|
|
this.ctrlTextbox.SelectionLength = this.ctrlTextbox.LineCount;
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-02 19:27:02 -04:00
|
|
|
|
private void vScrollBar_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.ctrlTextbox.ScrollPosition = this.vScrollBar.Value;
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-23 22:57:17 -05:00
|
|
|
|
private void hScrollBar_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.ctrlTextbox.HorizontalScrollPosition = this.hScrollBar.Value;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-09 23:50:20 -05:00
|
|
|
|
public string[] Addressing { set { this.ctrlTextbox.Addressing = value; } }
|
|
|
|
|
public string[] Comments { set { this.ctrlTextbox.Comments = value; } }
|
|
|
|
|
public int[] LineIndentations{ set { this.ctrlTextbox.LineIndentations = value; } }
|
|
|
|
|
|
2015-08-02 19:27:02 -04:00
|
|
|
|
public string[] TextLines
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this.ctrlTextbox.TextLines = value;
|
2017-08-06 16:23:22 -04:00
|
|
|
|
UpdateVerticalScrollbar();
|
2016-11-23 22:57:17 -05:00
|
|
|
|
UpdateHorizontalScrollbar();
|
2015-08-02 19:27:02 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-08-09 18:24:24 -04:00
|
|
|
|
|
2015-08-21 22:42:44 -04:00
|
|
|
|
public string[] TextLineNotes
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this.ctrlTextbox.TextLineNotes = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-09 18:24:24 -04:00
|
|
|
|
public string[] CompareLines
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this.ctrlTextbox.CompareLines = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-08-02 19:27:02 -04:00
|
|
|
|
|
|
|
|
|
public int[] LineNumbers
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
2015-08-21 22:42:44 -04:00
|
|
|
|
this.ctrlTextbox.LineNumbers = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string[] LineNumberNotes
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this.ctrlTextbox.LineNumberNotes = value;
|
2015-08-02 19:27:02 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-08-03 21:53:46 -04:00
|
|
|
|
|
2016-12-04 14:02:22 -05:00
|
|
|
|
public bool ShowSingleContentLineNotes
|
|
|
|
|
{
|
|
|
|
|
get { return this.ctrlTextbox.ShowSingleContentLineNotes; }
|
|
|
|
|
set { this.ctrlTextbox.ShowSingleContentLineNotes = value; }
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-21 22:42:44 -04:00
|
|
|
|
public bool ShowContentNotes
|
|
|
|
|
{
|
|
|
|
|
get { return this.ctrlTextbox.ShowContentNotes; }
|
|
|
|
|
set { this.ctrlTextbox.ShowContentNotes = value; }
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-03 16:26:24 -05:00
|
|
|
|
public bool ShowCompactPrgAddresses { get { return this.ctrlTextbox.ShowCompactPrgAddresses; } set { this.ctrlTextbox.ShowCompactPrgAddresses = value; } }
|
2018-03-03 12:01:16 -05:00
|
|
|
|
|
2015-08-21 22:42:44 -04:00
|
|
|
|
public bool ShowLineNumberNotes
|
|
|
|
|
{
|
|
|
|
|
get { return this.ctrlTextbox.ShowLineNumberNotes; }
|
|
|
|
|
set { this.ctrlTextbox.ShowLineNumberNotes = value; }
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-04 14:02:22 -05:00
|
|
|
|
public bool ShowSingleLineLineNumberNotes
|
|
|
|
|
{
|
|
|
|
|
get { return this.ctrlTextbox.ShowSingleLineLineNumberNotes; }
|
|
|
|
|
set { this.ctrlTextbox.ShowSingleLineLineNumberNotes = value; }
|
|
|
|
|
}
|
2018-02-14 21:09:43 -05:00
|
|
|
|
|
|
|
|
|
public bool ShowMemoryValues
|
|
|
|
|
{
|
|
|
|
|
get { return this.ctrlTextbox.ShowMemoryValues; }
|
|
|
|
|
set { this.ctrlTextbox.ShowMemoryValues = value; }
|
|
|
|
|
}
|
2016-12-04 14:02:22 -05:00
|
|
|
|
|
2018-02-11 15:58:23 -05:00
|
|
|
|
public bool HideSelection
|
|
|
|
|
{
|
|
|
|
|
get { return this.ctrlTextbox.HideSelection; }
|
|
|
|
|
set { this.ctrlTextbox.HideSelection = value; }
|
|
|
|
|
}
|
2018-03-18 19:57:56 -04:00
|
|
|
|
|
|
|
|
|
public bool CodeHighlightingEnabled
|
|
|
|
|
{
|
|
|
|
|
get { return this.ctrlTextbox.CodeHighlightingEnabled; }
|
|
|
|
|
set { this.ctrlTextbox.CodeHighlightingEnabled = value; }
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-06 16:23:22 -04:00
|
|
|
|
public int LineCount { get { return this.ctrlTextbox.LineCount; } }
|
|
|
|
|
public int SelectionStart { get { return this.ctrlTextbox.SelectionStart; } }
|
|
|
|
|
public int SelectionLength { get { return this.ctrlTextbox.SelectionLength; } }
|
|
|
|
|
|
2015-08-05 20:40:10 -04:00
|
|
|
|
public string Header
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this.ctrlTextbox.Header = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-25 19:02:33 -04:00
|
|
|
|
public int MarginWidth { set { this.ctrlTextbox.MarginWidth = value; } }
|
|
|
|
|
|
2015-08-08 22:41:16 -04:00
|
|
|
|
public void OpenSearchBox(bool forceFocus = false)
|
2015-08-03 21:53:46 -04:00
|
|
|
|
{
|
|
|
|
|
bool focus = !this.panelSearch.Visible;
|
|
|
|
|
this.panelSearch.Visible = true;
|
2015-08-08 22:41:16 -04:00
|
|
|
|
if(focus || forceFocus) {
|
2015-08-03 21:53:46 -04:00
|
|
|
|
this.cboSearch.Focus();
|
|
|
|
|
this.cboSearch.SelectAll();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CloseSearchBox()
|
|
|
|
|
{
|
|
|
|
|
this.ctrlTextbox.Search(null, false, false);
|
|
|
|
|
this.panelSearch.Visible = false;
|
|
|
|
|
this.Focus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void FindNext()
|
|
|
|
|
{
|
|
|
|
|
this.OpenSearchBox();
|
|
|
|
|
this.ctrlTextbox.Search(this.cboSearch.Text, false, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void FindPrevious()
|
|
|
|
|
{
|
|
|
|
|
this.OpenSearchBox();
|
|
|
|
|
this.ctrlTextbox.Search(this.cboSearch.Text, true, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void picCloseSearch_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.CloseSearchBox();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void picSearchPrevious_MouseUp(object sender, MouseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.FindPrevious();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void picSearchNext_MouseUp(object sender, MouseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.FindNext();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cboSearch_TextUpdate(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if(!this.ctrlTextbox.Search(this.cboSearch.Text, false, true)) {
|
|
|
|
|
this.cboSearch.BackColor = Color.Coral;
|
|
|
|
|
} else {
|
|
|
|
|
this.cboSearch.BackColor = Color.Empty;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cboSearch_KeyDown(object sender, KeyEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if(e.KeyCode == Keys.Enter) {
|
|
|
|
|
this.FindNext();
|
|
|
|
|
if(this.cboSearch.Items.Contains(this.cboSearch.Text)) {
|
|
|
|
|
this.cboSearch.Items.Remove(this.cboSearch.Text);
|
|
|
|
|
}
|
|
|
|
|
this.cboSearch.Items.Insert(0, this.cboSearch.Text);
|
|
|
|
|
|
|
|
|
|
e.Handled = true;
|
|
|
|
|
e.SuppressKeyPress = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-08-05 20:40:10 -04:00
|
|
|
|
|
|
|
|
|
public void GoToAddress()
|
|
|
|
|
{
|
|
|
|
|
GoToAddress address = new GoToAddress();
|
2016-11-26 20:53:59 -05:00
|
|
|
|
|
|
|
|
|
int currentAddr = this.CurrentLine;
|
2017-03-09 20:42:53 -05:00
|
|
|
|
int lineIndex = this.ctrlTextbox.SelectionStart;
|
2016-11-26 20:53:59 -05:00
|
|
|
|
while(currentAddr < 0) {
|
|
|
|
|
lineIndex++;
|
|
|
|
|
currentAddr = this.ctrlTextbox.GetLineNumber(lineIndex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
address.Address = (UInt32)currentAddr;
|
2015-08-05 20:40:10 -04:00
|
|
|
|
|
2018-03-15 17:14:41 -04:00
|
|
|
|
frmGoToLine frm = new frmGoToLine(address, 4);
|
2015-08-05 20:40:10 -04:00
|
|
|
|
frm.StartPosition = FormStartPosition.Manual;
|
|
|
|
|
Point topLeft = this.PointToScreen(new Point(0, 0));
|
|
|
|
|
frm.Location = new Point(topLeft.X + (this.Width - frm.Width) / 2, topLeft.Y + (this.Height - frm.Height) / 2);
|
|
|
|
|
if(frm.ShowDialog() == DialogResult.OK) {
|
|
|
|
|
this.ctrlTextbox.ScrollToLineNumber((int)address.Address);
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-11-27 10:56:37 -05:00
|
|
|
|
|
2016-12-01 20:45:13 -05:00
|
|
|
|
public List<Tuple<int, int, string>> FindAllOccurrences(string text, bool matchWholeWord, bool matchCase)
|
2016-11-27 10:56:37 -05:00
|
|
|
|
{
|
2016-12-01 20:45:13 -05:00
|
|
|
|
return this.ctrlTextbox.FindAllOccurrences(text, matchWholeWord, matchCase);
|
2016-11-27 10:56:37 -05:00
|
|
|
|
}
|
2016-11-27 12:14:32 -05:00
|
|
|
|
|
|
|
|
|
public void NavigateForward()
|
|
|
|
|
{
|
|
|
|
|
this.ctrlTextbox.NavigateForward();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void NavigateBackward()
|
|
|
|
|
{
|
|
|
|
|
this.ctrlTextbox.NavigateBackward();
|
|
|
|
|
}
|
2018-03-18 19:57:56 -04:00
|
|
|
|
|
|
|
|
|
public bool GetNoteRangeAtLocation(int yPos, out int rangeStart, out int rangeEnd)
|
|
|
|
|
{
|
|
|
|
|
rangeStart = -1;
|
|
|
|
|
rangeEnd = -1;
|
|
|
|
|
int lineIndex = GetLineIndexAtPosition(yPos);
|
|
|
|
|
if(Int32.TryParse(GetLineNoteAtLineIndex(lineIndex), NumberStyles.AllowHexSpecifier, null, out rangeStart)) {
|
|
|
|
|
while(lineIndex < LineCount - 2 && string.IsNullOrWhiteSpace(GetLineNoteAtLineIndex(lineIndex + 1))) {
|
|
|
|
|
lineIndex++;
|
|
|
|
|
}
|
|
|
|
|
if(Int32.TryParse(GetLineNoteAtLineIndex(lineIndex + 1), NumberStyles.AllowHexSpecifier, null, out rangeEnd)) {
|
|
|
|
|
rangeEnd--;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-08-02 19:27:02 -04:00
|
|
|
|
}
|
|
|
|
|
}
|