LuaWriter LineNumbers now work with scrolling, fixed an exception that was happening if a keyword was longer than the length of the line it checked it against.
AutoCompleteView now resizes depending on how many items are in the list. -mightyMar
This commit is contained in:
parent
4701b319be
commit
73de95d65e
|
@ -595,6 +595,9 @@
|
||||||
<Compile Include="tools\Lua\LuaWriterColorConfig.Designer.cs">
|
<Compile Include="tools\Lua\LuaWriterColorConfig.Designer.cs">
|
||||||
<DependentUpon>LuaWriterColorConfig.cs</DependentUpon>
|
<DependentUpon>LuaWriterColorConfig.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="tools\Lua\SyncTextBox.cs">
|
||||||
|
<SubType>Component</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="tools\NES\NameTableViewer.cs">
|
<Compile Include="tools\NES\NameTableViewer.cs">
|
||||||
<SubType>Component</SubType>
|
<SubType>Component</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
|
@ -59,12 +59,12 @@
|
||||||
this.startWithEmptyScriptToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.startWithEmptyScriptToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.restoreSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.restoreSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.MessageLabel = new System.Windows.Forms.Label();
|
this.MessageLabel = new System.Windows.Forms.Label();
|
||||||
this.AutoCompleteView = new System.Windows.Forms.ListView();
|
|
||||||
this.Suggestion = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
|
||||||
this.PositionLabel = new System.Windows.Forms.Label();
|
this.PositionLabel = new System.Windows.Forms.Label();
|
||||||
this.ZoomLabel = new System.Windows.Forms.Label();
|
this.ZoomLabel = new System.Windows.Forms.Label();
|
||||||
this.LuaText = new BizHawk.Client.EmuHawk.LuaWriterBox();
|
this.LuaText = new BizHawk.Client.EmuHawk.LuaWriterBox();
|
||||||
this.LuaLineTextBox = new System.Windows.Forms.RichTextBox();
|
this.LuaLineNumbersRtb = new SyncTextBox();
|
||||||
|
this.AutoCompleteView = new System.Windows.Forms.ListView();
|
||||||
|
this.Suggestion = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
this.configToolStripMenuItem});
|
this.configToolStripMenuItem});
|
||||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.menuStrip1.Name = "menuStrip1";
|
this.menuStrip1.Name = "menuStrip1";
|
||||||
this.menuStrip1.Size = new System.Drawing.Size(846, 24);
|
this.menuStrip1.Size = new System.Drawing.Size(1184, 24);
|
||||||
this.menuStrip1.TabIndex = 1;
|
this.menuStrip1.TabIndex = 1;
|
||||||
this.menuStrip1.Text = "menuStrip1";
|
this.menuStrip1.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
|
@ -306,38 +306,12 @@
|
||||||
//
|
//
|
||||||
this.MessageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.MessageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.MessageLabel.AutoSize = true;
|
this.MessageLabel.AutoSize = true;
|
||||||
this.MessageLabel.Location = new System.Drawing.Point(15, 484);
|
this.MessageLabel.Location = new System.Drawing.Point(15, 642);
|
||||||
this.MessageLabel.Name = "MessageLabel";
|
this.MessageLabel.Name = "MessageLabel";
|
||||||
this.MessageLabel.Size = new System.Drawing.Size(91, 13);
|
this.MessageLabel.Size = new System.Drawing.Size(91, 13);
|
||||||
this.MessageLabel.TabIndex = 2;
|
this.MessageLabel.TabIndex = 2;
|
||||||
this.MessageLabel.Text = " ";
|
this.MessageLabel.Text = " ";
|
||||||
//
|
//
|
||||||
// AutoCompleteView
|
|
||||||
//
|
|
||||||
this.AutoCompleteView.Activation = System.Windows.Forms.ItemActivation.OneClick;
|
|
||||||
this.AutoCompleteView.AllowColumnReorder = true;
|
|
||||||
this.AutoCompleteView.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.AutoCompleteView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
|
||||||
this.Suggestion});
|
|
||||||
this.AutoCompleteView.FullRowSelect = true;
|
|
||||||
this.AutoCompleteView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
|
|
||||||
this.AutoCompleteView.HideSelection = false;
|
|
||||||
this.AutoCompleteView.HoverSelection = true;
|
|
||||||
this.AutoCompleteView.Location = new System.Drawing.Point(696, 382);
|
|
||||||
this.AutoCompleteView.MultiSelect = false;
|
|
||||||
this.AutoCompleteView.Name = "AutoCompleteView";
|
|
||||||
this.AutoCompleteView.Size = new System.Drawing.Size(121, 97);
|
|
||||||
this.AutoCompleteView.TabIndex = 3;
|
|
||||||
this.AutoCompleteView.UseCompatibleStateImageBehavior = false;
|
|
||||||
this.AutoCompleteView.View = System.Windows.Forms.View.Details;
|
|
||||||
this.AutoCompleteView.Visible = false;
|
|
||||||
this.AutoCompleteView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.AutoComplete_KeyDown);
|
|
||||||
this.AutoCompleteView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.AutoCompleteView_MouseDoubleClick);
|
|
||||||
//
|
|
||||||
// Suggestion
|
|
||||||
//
|
|
||||||
this.Suggestion.Width = 114;
|
|
||||||
//
|
|
||||||
// PositionLabel
|
// PositionLabel
|
||||||
//
|
//
|
||||||
this.PositionLabel.AutoSize = true;
|
this.PositionLabel.AutoSize = true;
|
||||||
|
@ -363,48 +337,76 @@
|
||||||
| System.Windows.Forms.AnchorStyles.Left)
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.LuaText.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
this.LuaText.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.LuaText.Buddy = this.LuaLineNumbersRtb;
|
||||||
this.LuaText.EnableAutoDragDrop = true;
|
this.LuaText.EnableAutoDragDrop = true;
|
||||||
this.LuaText.Location = new System.Drawing.Point(63, 50);
|
this.LuaText.Location = new System.Drawing.Point(58, 46);
|
||||||
this.LuaText.Name = "LuaText";
|
this.LuaText.Name = "LuaText";
|
||||||
this.LuaText.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
|
this.LuaText.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedVertical;
|
||||||
this.LuaText.Size = new System.Drawing.Size(768, 429);
|
this.LuaText.Size = new System.Drawing.Size(1126, 609);
|
||||||
this.LuaText.TabIndex = 0;
|
this.LuaText.TabIndex = 0;
|
||||||
this.LuaText.Text = "";
|
this.LuaText.Text = "";
|
||||||
this.LuaText.WordWrap = false;
|
this.LuaText.WordWrap = false;
|
||||||
this.LuaText.SelectionChanged += new System.EventHandler(this.LuaText_SelectionChanged);
|
this.LuaText.SelectionChanged += new System.EventHandler(this.LuaText_SelectionChanged);
|
||||||
this.LuaText.VScroll += new System.EventHandler(this.LuaText_VScroll);
|
|
||||||
this.LuaText.TextChanged += new System.EventHandler(this.LuaText_TextChanged);
|
this.LuaText.TextChanged += new System.EventHandler(this.LuaText_TextChanged);
|
||||||
this.LuaText.KeyDown += new System.Windows.Forms.KeyEventHandler(this.LuaText_KeyDown);
|
this.LuaText.KeyDown += new System.Windows.Forms.KeyEventHandler(this.LuaText_KeyDown);
|
||||||
this.LuaText.KeyUp += new System.Windows.Forms.KeyEventHandler(this.LuaText_KeyUp);
|
this.LuaText.KeyUp += new System.Windows.Forms.KeyEventHandler(this.LuaText_KeyUp);
|
||||||
this.LuaText.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.LuaText_PreviewKeyDown);
|
this.LuaText.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.LuaText_PreviewKeyDown);
|
||||||
//
|
//
|
||||||
// LuaLineTextBox
|
// LuaLineNumbersRtb
|
||||||
//
|
//
|
||||||
this.LuaLineTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
this.LuaLineNumbersRtb.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
| System.Windows.Forms.AnchorStyles.Left)));
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
this.LuaLineTextBox.BackColor = System.Drawing.SystemColors.ScrollBar;
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.LuaLineTextBox.Location = new System.Drawing.Point(0, 50);
|
this.LuaLineNumbersRtb.BackColor = System.Drawing.SystemColors.ButtonShadow;
|
||||||
this.LuaLineTextBox.Name = "LuaLineTextBox";
|
this.LuaLineNumbersRtb.Buddy = this.LuaText;
|
||||||
this.LuaLineTextBox.ReadOnly = true;
|
this.LuaLineNumbersRtb.Location = new System.Drawing.Point(0, 46);
|
||||||
this.LuaLineTextBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
|
this.LuaLineNumbersRtb.Name = "LuaLineNumbersRtb";
|
||||||
this.LuaLineTextBox.Size = new System.Drawing.Size(60, 429);
|
this.LuaLineNumbersRtb.ReadOnly = true;
|
||||||
this.LuaLineTextBox.TabIndex = 6;
|
this.LuaLineNumbersRtb.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedVertical;
|
||||||
this.LuaLineTextBox.Text = "";
|
this.LuaLineNumbersRtb.Size = new System.Drawing.Size(1184, 609);
|
||||||
this.LuaLineTextBox.Visible = false;
|
this.LuaLineNumbersRtb.TabIndex = 7;
|
||||||
|
this.LuaLineNumbersRtb.Text = "";
|
||||||
|
//
|
||||||
|
// AutoCompleteView
|
||||||
|
//
|
||||||
|
this.AutoCompleteView.Activation = System.Windows.Forms.ItemActivation.OneClick;
|
||||||
|
this.AutoCompleteView.AllowColumnReorder = true;
|
||||||
|
this.AutoCompleteView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||||
|
this.Suggestion});
|
||||||
|
this.AutoCompleteView.FullRowSelect = true;
|
||||||
|
this.AutoCompleteView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
|
||||||
|
this.AutoCompleteView.HideSelection = false;
|
||||||
|
this.AutoCompleteView.HoverSelection = true;
|
||||||
|
this.AutoCompleteView.Location = new System.Drawing.Point(208, 153);
|
||||||
|
this.AutoCompleteView.MultiSelect = false;
|
||||||
|
this.AutoCompleteView.Name = "AutoCompleteView";
|
||||||
|
this.AutoCompleteView.Scrollable = false;
|
||||||
|
this.AutoCompleteView.Size = new System.Drawing.Size(150, 182);
|
||||||
|
this.AutoCompleteView.TabIndex = 3;
|
||||||
|
this.AutoCompleteView.UseCompatibleStateImageBehavior = false;
|
||||||
|
this.AutoCompleteView.View = System.Windows.Forms.View.Details;
|
||||||
|
this.AutoCompleteView.Visible = false;
|
||||||
|
this.AutoCompleteView.SelectedIndexChanged += new System.EventHandler(this.AutoCompleteView_SelectedIndexChanged);
|
||||||
|
this.AutoCompleteView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.AutoComplete_KeyDown);
|
||||||
|
this.AutoCompleteView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.AutoCompleteView_MouseDoubleClick);
|
||||||
|
//
|
||||||
|
// Suggestion
|
||||||
|
//
|
||||||
|
this.Suggestion.Width = 100;
|
||||||
//
|
//
|
||||||
// LuaWriter
|
// LuaWriter
|
||||||
//
|
//
|
||||||
this.AllowDrop = true;
|
this.AllowDrop = true;
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(846, 501);
|
this.ClientSize = new System.Drawing.Size(1184, 659);
|
||||||
this.Controls.Add(this.LuaLineTextBox);
|
|
||||||
this.Controls.Add(this.AutoCompleteView);
|
this.Controls.Add(this.AutoCompleteView);
|
||||||
|
this.Controls.Add(this.LuaText);
|
||||||
|
this.Controls.Add(this.menuStrip1);
|
||||||
|
this.Controls.Add(this.LuaLineNumbersRtb);
|
||||||
this.Controls.Add(this.ZoomLabel);
|
this.Controls.Add(this.ZoomLabel);
|
||||||
this.Controls.Add(this.PositionLabel);
|
this.Controls.Add(this.PositionLabel);
|
||||||
this.Controls.Add(this.MessageLabel);
|
this.Controls.Add(this.MessageLabel);
|
||||||
this.Controls.Add(this.LuaText);
|
|
||||||
this.Controls.Add(this.menuStrip1);
|
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
this.MainMenuStrip = this.menuStrip1;
|
this.MainMenuStrip = this.menuStrip1;
|
||||||
this.Name = "LuaWriter";
|
this.Name = "LuaWriter";
|
||||||
|
@ -435,7 +437,6 @@
|
||||||
private System.Windows.Forms.ToolStripMenuItem configToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem configToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem fontToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem fontToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem syntaxHighlightingToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem syntaxHighlightingToolStripMenuItem;
|
||||||
private System.Windows.Forms.ListView AutoCompleteView;
|
|
||||||
private System.Windows.Forms.Label PositionLabel;
|
private System.Windows.Forms.Label PositionLabel;
|
||||||
private System.Windows.Forms.Label ZoomLabel;
|
private System.Windows.Forms.Label ZoomLabel;
|
||||||
private System.Windows.Forms.ToolStripMenuItem restoreSettingsToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem restoreSettingsToolStripMenuItem;
|
||||||
|
@ -455,8 +456,9 @@
|
||||||
private System.Windows.Forms.ToolStripMenuItem startWithEmptyScriptToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem startWithEmptyScriptToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
|
||||||
private System.Windows.Forms.ToolStripMenuItem backgroundColorToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem backgroundColorToolStripMenuItem;
|
||||||
private System.Windows.Forms.ColumnHeader Suggestion;
|
|
||||||
private System.Windows.Forms.RichTextBox LuaLineTextBox;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem lineNumbersToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem lineNumbersToolStripMenuItem;
|
||||||
|
private SyncTextBox LuaLineNumbersRtb;
|
||||||
|
private System.Windows.Forms.ListView AutoCompleteView;
|
||||||
|
private System.Windows.Forms.ColumnHeader Suggestion;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -41,11 +41,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private bool hasChanged;
|
private bool hasChanged;
|
||||||
private bool ProcessingText;
|
private bool ProcessingText;
|
||||||
|
|
||||||
private bool isFirst;
|
|
||||||
private bool DisableEvent;
|
|
||||||
private int lastLineofText;
|
private int lastLineofText;
|
||||||
private int lineIndex;
|
|
||||||
private int previousFirstVisibleChar;
|
|
||||||
|
|
||||||
private readonly char[] Symbols = { '+', '-', '*', '/', '%', '^', '#', '=', '<', '>', '(', ')', '{', '}', '[', ']', ';', ':', ',', '.' };
|
private readonly char[] Symbols = { '+', '-', '*', '/', '%', '^', '#', '=', '<', '>', '(', ')', '{', '}', '[', ']', ';', ':', ',', '.' };
|
||||||
private List<int[]> pos = new List<int[]>();
|
private List<int[]> pos = new List<int[]>();
|
||||||
|
@ -54,7 +50,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public LuaWriter(LuaConsole owner)
|
public LuaWriter(LuaConsole owner)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
isFirst = true;
|
|
||||||
_owner = owner;
|
_owner = owner;
|
||||||
LuaText.MouseWheel += LuaText_MouseWheel;
|
LuaText.MouseWheel += LuaText_MouseWheel;
|
||||||
lineNumbersToolStripMenuItem.Checked = Global.Config.LuaShowLineNumbers;
|
lineNumbersToolStripMenuItem.Checked = Global.Config.LuaShowLineNumbers;
|
||||||
|
@ -76,17 +71,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
ZoomLabel.Text = string.Format("Zoom: {0:0}%", Zoom);
|
ZoomLabel.Text = string.Format("Zoom: {0:0}%", Zoom);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
//UpdateLineTextBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LuaText_VScroll(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
//UpdateLineTextBox();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void timer_Tick(object sender, EventArgs e)
|
private void timer_Tick(object sender, EventArgs e)
|
||||||
|
@ -125,8 +109,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
ProcessingText = false;
|
ProcessingText = false;
|
||||||
LuaText.InhibitPaint = false;
|
LuaText.InhibitPaint = false;
|
||||||
LuaText.Refresh();
|
LuaText.Refresh();
|
||||||
isFirst = false;
|
|
||||||
ShowLuaLineNumbersTextBox();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddNumbers()
|
private void AddNumbers()
|
||||||
|
@ -477,7 +459,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private void LoadFont()
|
private void LoadFont()
|
||||||
{
|
{
|
||||||
LuaText.Font = new Font(Global.Config.LuaWriterFont, Global.Config.LuaWriterFontSize);
|
LuaText.Font = new Font(Global.Config.LuaWriterFont, Global.Config.LuaWriterFontSize);
|
||||||
LuaLineTextBox.Font = new Font(Global.Config.LuaWriterFont, Global.Config.LuaWriterFontSize);
|
LuaLineNumbersRtb.Font = new Font(Global.Config.LuaWriterFont, Global.Config.LuaWriterFontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LuaWriter_Load(object sender, EventArgs e)
|
private void LuaWriter_Load(object sender, EventArgs e)
|
||||||
|
@ -640,7 +622,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void LuaText_TextChanged(object sender, EventArgs e)
|
private void LuaText_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
ShowLuaLineNumbersTextBox();
|
||||||
HasTextChanged();
|
HasTextChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,9 +664,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void AutoComplete_KeyDown(object sender, KeyEventArgs e)
|
private void AutoComplete_KeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
|
int start = LuaText.SelectionStart;
|
||||||
if (e.KeyCode == Keys.Escape || e.KeyCode == Keys.Back)
|
if (e.KeyCode == Keys.Escape || e.KeyCode == Keys.Back)
|
||||||
{
|
{
|
||||||
AutoCompleteView.Visible = false;
|
AutoCompleteView.Visible = false;
|
||||||
|
LuaText.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (e.KeyCode == Keys.Enter)
|
else if (e.KeyCode == Keys.Enter)
|
||||||
|
@ -695,8 +679,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
else if (e.KeyCode >= Keys.A && e.KeyCode <= Keys.Z)
|
else if (e.KeyCode >= Keys.A && e.KeyCode <= Keys.Z)
|
||||||
{
|
{
|
||||||
AutoCompleteView.Visible = false;
|
AutoCompleteView.Visible = false;
|
||||||
|
LuaText.Focus();
|
||||||
e.SuppressKeyPress = true;
|
e.SuppressKeyPress = true;
|
||||||
int start = LuaText.SelectionStart;
|
|
||||||
String letter = e.KeyCode.ToString();
|
String letter = e.KeyCode.ToString();
|
||||||
if (!e.Shift)
|
if (!e.Shift)
|
||||||
{
|
{
|
||||||
|
@ -704,7 +688,30 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
LuaText.Text = LuaText.Text.Insert(start, letter);
|
LuaText.Text = LuaText.Text.Insert(start, letter);
|
||||||
LuaText.Select(start + 1, 0);
|
LuaText.Select(start + 1, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ResizeAutoComplete()
|
||||||
|
{
|
||||||
|
if (AutoCompleteView.Items.Count != 0)
|
||||||
|
{
|
||||||
|
AutoCompleteView.Height = AutoCompleteView.Items.Count * 20;
|
||||||
|
|
||||||
|
int longestItem = AutoCompleteView.Items[0].Text.Length;
|
||||||
|
foreach (ListViewItem item in AutoCompleteView.Items)
|
||||||
|
{
|
||||||
|
if (item.Text.Length > longestItem)
|
||||||
|
{
|
||||||
|
longestItem = item.Text.Length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AutoCompleteView.Width = longestItem * 5 + 20;
|
||||||
|
AutoCompleteView.Columns[0].Width = longestItem * 5 + 20;
|
||||||
|
AutoCompleteView.Visible = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AutoCompleteView.Visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -737,8 +744,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
AutoCompleteView.Items.Add(item);
|
AutoCompleteView.Items.Add(item);
|
||||||
}
|
}
|
||||||
// Show window after it has been positioned and set up
|
// Show window after it has been positioned and set up
|
||||||
|
ResizeAutoComplete();
|
||||||
AutoCompleteView.Visible = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -760,7 +766,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (LuaText.Lines[linenumber].Substring(0 + tabs, Word.Length) == Word)
|
string line = LuaText.Lines[linenumber];
|
||||||
|
//string subString = line.Substring(0 + tabs, Word.Length);
|
||||||
|
if ((Word.Length + tabs) <= line.Length)
|
||||||
|
{
|
||||||
|
if (line.Substring(0 + tabs, Word.Length) == Word)
|
||||||
{
|
{
|
||||||
string str = LuaText.Text.Insert(LuaText.SelectionStart, "\n" + tabsStr + "\t\n" + tabsStr + "end");
|
string str = LuaText.Text.Insert(LuaText.SelectionStart, "\n" + tabsStr + "\t\n" + tabsStr + "end");
|
||||||
LuaText.Text = str;
|
LuaText.Text = str;
|
||||||
|
@ -769,12 +779,18 @@ namespace BizHawk.Client.EmuHawk
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
string tempStr = LuaText.Text.Insert(LuaText.SelectionStart, "\n" + tabsStr);
|
// string tempStr = LuaText.Text.Insert(LuaText.SelectionStart, "\n" + tabsStr);
|
||||||
LuaText.Text = tempStr;
|
LuaText.Text = LuaText.Text.Insert(LuaText.SelectionStart, "\n" + tabsStr);
|
||||||
|
//tempStr;
|
||||||
|
LuaLineNumbersRtb.Select(LuaLineNumbersRtb.GetFirstCharIndexFromLine(linenumber + 1), 0);
|
||||||
|
LuaLineNumbersRtb.ScrollToCaret();
|
||||||
LuaText.Select(LuaText.GetFirstCharIndexFromLine(linenumber + 1) + tabs, 0);
|
LuaText.Select(LuaText.GetFirstCharIndexFromLine(linenumber + 1) + tabs, 0);
|
||||||
|
LuaText.ScrollToCaret();
|
||||||
|
|
||||||
e.SuppressKeyPress = true;
|
e.SuppressKeyPress = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -821,7 +837,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
AutoCompleteView.Items.Add(item);
|
AutoCompleteView.Items.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AutoCompleteView.Visible = true;
|
ResizeAutoComplete();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -838,11 +854,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
AutoCompleteView.Items.Add(item);
|
AutoCompleteView.Items.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AutoCompleteView.Visible = true;
|
ResizeAutoComplete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string CurrentWord()
|
private string CurrentWord()
|
||||||
|
@ -896,7 +911,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
ListView.SelectedIndexCollection indexes = AutoCompleteView.SelectedIndices;
|
ListView.SelectedIndexCollection indexes = AutoCompleteView.SelectedIndices;
|
||||||
if (indexes.Count > 0)
|
if (indexes.Count > 0)
|
||||||
{
|
{
|
||||||
|
LuaText.Focus();
|
||||||
string str = AutoCompleteView.Items[indexes[0]].Text;
|
string str = AutoCompleteView.Items[indexes[0]].Text;
|
||||||
int start = LuaText.SelectionStart;
|
int start = LuaText.SelectionStart;
|
||||||
|
|
||||||
|
@ -919,12 +934,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LuaText_SelectionChanged(object sender, EventArgs e)
|
private void LuaText_SelectionChanged(object sender, EventArgs e)
|
||||||
{
|
|
||||||
if (!DisableEvent && Global.Config.LuaShowLineNumbers && !isFirst)
|
|
||||||
{
|
{
|
||||||
UpdateLineNumber();
|
UpdateLineNumber();
|
||||||
ShowLuaLineNumbersTextBox();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateLineNumber()
|
private void UpdateLineNumber()
|
||||||
|
@ -941,46 +952,30 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void UpdateLineTextBox()
|
private void UpdateLineTextBox()
|
||||||
{
|
{
|
||||||
DisableEvent = true;
|
if (lastLineofText != LuaText.GetLineFromCharIndex(LuaText.TextLength))
|
||||||
int currentLocation = LuaText.SelectionStart;
|
|
||||||
int firstVisibleChar = LuaText.GetCharIndexFromPosition(new Point(0,0));
|
|
||||||
LuaText.Select(firstVisibleChar, 0);
|
|
||||||
|
|
||||||
|
|
||||||
if (lastLineofText != LuaText.GetLineFromCharIndex(LuaText.TextLength) || previousFirstVisibleChar != LuaText.GetCharIndexFromPosition(new Point(0, 0)))
|
|
||||||
{
|
{
|
||||||
previousFirstVisibleChar = firstVisibleChar;
|
|
||||||
lastLineofText = LuaText.GetLineFromCharIndex(LuaText.TextLength);
|
lastLineofText = LuaText.GetLineFromCharIndex(LuaText.TextLength);
|
||||||
lineIndex = LuaText.GetLineFromCharIndex(firstVisibleChar);
|
LuaLineNumbersRtb.Text = String.Empty;
|
||||||
if (LuaText.GetLineFromCharIndex(currentLocation) == lastLineofText)
|
for (int i = 1; i <= LuaText.GetLineFromCharIndex(LuaText.TextLength) + 1; i++)
|
||||||
{
|
|
||||||
lineIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
LuaLineTextBox.Text = String.Empty;
|
|
||||||
for (int i = lineIndex + 1; i <= LuaText.GetLineFromCharIndex(LuaText.TextLength) + 1; i++)
|
|
||||||
{
|
{
|
||||||
if (i < 10)
|
if (i < 10)
|
||||||
{
|
{
|
||||||
LuaLineTextBox.Text += "00" + i;
|
LuaLineNumbersRtb.Text += "00" + i;
|
||||||
}
|
}
|
||||||
else if (i >= 10 && i < 100)
|
else if (i >= 10 && i < 100)
|
||||||
{
|
{
|
||||||
LuaLineTextBox.Text += "0" + i;
|
LuaLineNumbersRtb.Text += "0" + i;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LuaLineTextBox.Text += i;
|
LuaLineNumbersRtb.Text += i;
|
||||||
}
|
}
|
||||||
if (i != LuaText.GetLineFromCharIndex(LuaText.TextLength) + 1)
|
if (i != LuaText.GetLineFromCharIndex(LuaText.TextLength) + 1)
|
||||||
{
|
{
|
||||||
LuaLineTextBox.Text += "\n";
|
LuaLineNumbersRtb.Text += "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
LuaText.Select(currentLocation, 0);
|
|
||||||
DisableEvent = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LuaText_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
|
private void LuaText_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
|
||||||
|
@ -1146,11 +1141,25 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void ShowLuaLineNumbersTextBox()
|
private void ShowLuaLineNumbersTextBox()
|
||||||
{
|
{
|
||||||
LuaLineTextBox.Visible = Global.Config.LuaShowLineNumbers ;
|
LuaLineNumbersRtb.Visible = Global.Config.LuaShowLineNumbers;
|
||||||
if (LuaLineTextBox.Visible)
|
if (LuaLineNumbersRtb.Visible )
|
||||||
{
|
{
|
||||||
UpdateLineTextBox();
|
UpdateLineTextBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AutoCompleteView_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void syncTextBox1_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -123,6 +123,9 @@
|
||||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>97, 17</value>
|
<value>97, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>70</value>
|
||||||
|
</metadata>
|
||||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
<value>
|
<value>
|
||||||
|
|
|
@ -3,7 +3,7 @@ using System.Drawing;
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
class LuaWriterBox : RichTextBox
|
class LuaWriterBox : SyncTextBox
|
||||||
{
|
{
|
||||||
public bool InhibitPaint = false;
|
public bool InhibitPaint = false;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
class SyncTextBox : RichTextBox
|
||||||
|
{
|
||||||
|
public SyncTextBox()
|
||||||
|
{
|
||||||
|
this.Multiline = true;
|
||||||
|
this.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
|
||||||
|
|
||||||
|
}
|
||||||
|
public Control Buddy { get; set; }
|
||||||
|
|
||||||
|
private static bool scrolling; // In case buddy tries to scroll us
|
||||||
|
protected override void WndProc(ref Message m)
|
||||||
|
{
|
||||||
|
base.WndProc(ref m);
|
||||||
|
// Trap WM_VSCROLL message and pass to buddy
|
||||||
|
if ((m.Msg == 0x115 || m.Msg == 0x20a) && !scrolling && Buddy != null && Buddy.IsHandleCreated)
|
||||||
|
{
|
||||||
|
scrolling = true;
|
||||||
|
SendMessage(Buddy.Handle, m.Msg, m.WParam, m.LParam);
|
||||||
|
scrolling = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||||
|
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);
|
||||||
|
}
|
Loading…
Reference in New Issue