Lua Cosnole - output message at bottom of dialog to show if changes have occured and saved messages (same as other tool dialogs such as ram watch). Better minimize size parameters of dialog.

This commit is contained in:
adelikat 2012-03-26 23:31:21 +00:00
parent cba68551d0
commit 602ee06ffc
2 changed files with 242 additions and 218 deletions

View File

@ -82,6 +82,7 @@
this.clearToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.NumberOfScripts = new System.Windows.Forms.Label();
this.OutputMessages = new System.Windows.Forms.Label();
this.toolStrip1 = new ToolStripEx();
this.openToolStripButton = new System.Windows.Forms.ToolStripButton();
this.copyToolStripButton = new System.Windows.Forms.ToolStripButton();
@ -506,7 +507,7 @@
this.OutputBox.Location = new System.Drawing.Point(6, 17);
this.OutputBox.Name = "OutputBox";
this.OutputBox.ReadOnly = true;
this.OutputBox.Size = new System.Drawing.Size(246, 259);
this.OutputBox.Size = new System.Drawing.Size(246, 283);
this.OutputBox.TabIndex = 2;
this.OutputBox.Text = "";
//
@ -531,7 +532,7 @@
this.groupBox1.Controls.Add(this.OutputBox);
this.groupBox1.Location = new System.Drawing.Point(310, 71);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(258, 280);
this.groupBox1.Size = new System.Drawing.Size(258, 304);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Output";
@ -545,6 +546,16 @@
this.NumberOfScripts.TabIndex = 4;
this.NumberOfScripts.Text = "0 script ";
//
// OutputMessages
//
this.OutputMessages.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.OutputMessages.AutoSize = true;
this.OutputMessages.Location = new System.Drawing.Point(13, 384);
this.OutputMessages.Name = "OutputMessages";
this.OutputMessages.Size = new System.Drawing.Size(106, 13);
this.OutputMessages.TabIndex = 6;
this.OutputMessages.Text = " ";
//
// toolStrip1
//
this.toolStrip1.ClickThrough = true;
@ -666,7 +677,7 @@
this.LuaListView.Location = new System.Drawing.Point(13, 71);
this.LuaListView.Name = "LuaListView";
this.LuaListView.selectedItem = -1;
this.LuaListView.Size = new System.Drawing.Size(291, 280);
this.LuaListView.Size = new System.Drawing.Size(291, 304);
this.LuaListView.TabIndex = 0;
this.LuaListView.UseCompatibleStateImageBehavior = false;
this.LuaListView.View = System.Windows.Forms.View.Details;
@ -688,7 +699,8 @@
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(584, 366);
this.ClientSize = new System.Drawing.Size(584, 402);
this.Controls.Add(this.OutputMessages);
this.Controls.Add(this.toolStrip1);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.NumberOfScripts);
@ -696,7 +708,7 @@
this.Controls.Add(this.LuaListView);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.MinimumSize = new System.Drawing.Size(356, 132);
this.MinimumSize = new System.Drawing.Size(400, 180);
this.Name = "LuaConsole";
this.Text = "Lua Console";
this.Load += new System.EventHandler(this.LuaConsole_Load);
@ -781,5 +793,6 @@
private System.Windows.Forms.ToolStripButton resumePauseButton1;
private System.Windows.Forms.ToolStripMenuItem resumePauseToolStripMenuItem;
public System.Windows.Forms.RichTextBox OutputBox;
private System.Windows.Forms.Label OutputMessages;
}
}

View File

@ -16,6 +16,7 @@ namespace BizHawk.MultiClient
//options - autoload session
//TODO: remember column widths
//TODO: restore column width on restore default settings
//TODO: don't call asksave without looking at the surpress asksave config item
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
int defaultHeight;
@ -54,6 +55,20 @@ namespace BizHawk.MultiClient
LuaListView.VirtualMode = true;
}
private void Changes(bool changesOccured)
{
if (changesOccured)
{
changes = true;
OutputMessages.Text = "* " + Path.GetFileName(currentSessionFile);
}
else
{
changes = false;
OutputMessages.Text = Path.GetFileName(currentSessionFile);
}
}
private void LuaListView_QueryItemBkColor(int index, int column, ref Color color)
{
if (column == 0)
@ -87,25 +102,20 @@ namespace BizHawk.MultiClient
private void StopScript(int x)
{
luaList[x].Stop();
//LuaImp.Close();
//LuaImp = new LuaImplementation(this);
changes = true;
Changes(true);
}
private void StopAllScripts()
{
for (int x = 0; x < luaList.Count; x++)
luaList[x].Enabled = false;
//LuaImp.Close();
//LuaImp = new LuaImplementation(this);
changes = true;
Changes(true);
UpdateNumberOfScripts();
}
public void Restart()
{
StopAllScripts();
//LuaImp = new LuaImplementation(this);
}
private void SaveConfigSettings()
@ -192,7 +202,7 @@ namespace BizHawk.MultiClient
}
else l.Enabled = false;
l.Paused = false;
changes = true;
Changes(true);
}
else
{
@ -203,7 +213,7 @@ namespace BizHawk.MultiClient
luaList[i].Toggle();
RunLuaScripts();
LuaListView.Refresh();
changes = true;
Changes(true);
break;
}
}
@ -276,7 +286,7 @@ namespace BizHawk.MultiClient
}
LuaListView.Refresh();
UpdateNumberOfScripts();
changes = true;
Changes(true);
}
public void RunLuaScripts()
@ -355,7 +365,8 @@ namespace BizHawk.MultiClient
if (changes)
{
SaveSession(currentSessionFile);
AddText('\n' + Path.GetFileName(currentSessionFile) + " saved.");
Changes(false);
OutputMessages.Text = Path.GetFileName(currentSessionFile) + " saved.";
}
}
@ -381,7 +392,7 @@ namespace BizHawk.MultiClient
luaList.Clear();
DisplayLuaList();
UpdateNumberOfScripts();
changes = false;
Changes(false);
}
}
@ -408,7 +419,7 @@ namespace BizHawk.MultiClient
private void RemoveScript()
{
if (luaList.Count == 0) return;
changes = true;
Changes(true);
ListView.SelectedIndexCollection indexes = LuaListView.SelectedIndices;
if (indexes.Count > 0)
{
@ -449,7 +460,7 @@ namespace BizHawk.MultiClient
luaList.Add(f);
DisplayLuaList();
LuaListView.Refresh();
changes = true;
Changes(true);
}
private void insertSeperatorToolStripMenuItem1_Click(object sender, EventArgs e)
@ -470,7 +481,7 @@ namespace BizHawk.MultiClient
//Note: here it will get flagged many times redundantly potentially,
//but this avoids it being flagged falsely when the user did not select an index
changes = true;
Changes(true);
}
List<int> i = new List<int>();
for (int z = 0; z < indexes.Count; z++)
@ -502,7 +513,7 @@ namespace BizHawk.MultiClient
//Note: here it will get flagged many times redundantly potnetially,
//but this avoids it being flagged falsely when the user did not select an index
changes = true;
Changes(true);
}
List<int> i = new List<int>();
@ -778,7 +789,7 @@ namespace BizHawk.MultiClient
}
Global.Config.RecentLuaSession.Add(path);
currentSessionFile = path;
changes = false;
Changes(false);
return true;
}
@ -899,7 +910,7 @@ namespace BizHawk.MultiClient
currentSessionFile = file.FullName;
AddText('\n' + Path.GetFileName(currentSessionFile) + " saved.");
Global.Config.RecentLuaSession.Add(file.FullName);
changes = false;
Changes(false);
}
}
@ -925,7 +936,7 @@ namespace BizHawk.MultiClient
sw.WriteLine(str);
}
changes = false;
Changes(false);
return true;
}
@ -993,7 +1004,7 @@ namespace BizHawk.MultiClient
UpdateNumberOfScripts();
//ClearOutput();
currentSessionFile = file;
changes = false;
Changes(false);
}
}