Tastudio - remove marker button
This commit is contained in:
parent
7b8b602f0f
commit
d8216ae0fc
|
@ -76,7 +76,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
var sb = new StringBuilder();
|
||||
foreach (var marker in this)
|
||||
{
|
||||
sb.AppendLine(marker.ToString());
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
private void InitializeComponent()
|
||||
{
|
||||
this.AddBtn = new System.Windows.Forms.Button();
|
||||
this.RemoveBtn = new System.Windows.Forms.Button();
|
||||
this.MarkerView = new BizHawk.Client.EmuHawk.VirtualListView();
|
||||
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
|
@ -45,6 +46,18 @@
|
|||
this.AddBtn.UseVisualStyleBackColor = true;
|
||||
this.AddBtn.Click += new System.EventHandler(this.AddBtn_Click);
|
||||
//
|
||||
// RemoveBtn
|
||||
//
|
||||
this.RemoveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.RemoveBtn.Enabled = false;
|
||||
this.RemoveBtn.Location = new System.Drawing.Point(3, 214);
|
||||
this.RemoveBtn.Name = "RemoveBtn";
|
||||
this.RemoveBtn.Size = new System.Drawing.Size(58, 23);
|
||||
this.RemoveBtn.TabIndex = 7;
|
||||
this.RemoveBtn.Text = "Remove";
|
||||
this.RemoveBtn.UseVisualStyleBackColor = true;
|
||||
this.RemoveBtn.Click += new System.EventHandler(this.RemoveBtn_Click);
|
||||
//
|
||||
// MarkerView
|
||||
//
|
||||
this.MarkerView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
|
@ -69,6 +82,7 @@
|
|||
this.MarkerView.TabStop = false;
|
||||
this.MarkerView.UseCompatibleStateImageBehavior = false;
|
||||
this.MarkerView.View = System.Windows.Forms.View.Details;
|
||||
this.MarkerView.SelectedIndexChanged += new System.EventHandler(this.MarkerView_SelectedIndexChanged);
|
||||
//
|
||||
// columnHeader1
|
||||
//
|
||||
|
@ -84,6 +98,7 @@
|
|||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.RemoveBtn);
|
||||
this.Controls.Add(this.AddBtn);
|
||||
this.Controls.Add(this.MarkerView);
|
||||
this.Name = "MarkerControl";
|
||||
|
@ -99,6 +114,7 @@
|
|||
public System.Windows.Forms.ColumnHeader columnHeader1;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader2;
|
||||
private System.Windows.Forms.Button AddBtn;
|
||||
private System.Windows.Forms.Button RemoveBtn;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,10 +14,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
public partial class MarkerControl : UserControl
|
||||
{
|
||||
public TasMovieMarkerList Markers {get; set; }
|
||||
public Action<int?> AddCallback { get; set; }
|
||||
|
||||
public MarkerControl()
|
||||
private readonly TAStudio _tastudio;
|
||||
|
||||
public MarkerControl(TAStudio tastudio)
|
||||
{
|
||||
_tastudio = tastudio;
|
||||
InitializeComponent();
|
||||
MarkerView.QueryItemBkColor += MarkerView_QueryItemBkColor;
|
||||
MarkerView.QueryItemText += MarkerView_QueryItemText;
|
||||
|
@ -41,7 +43,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (index == Markers.IndexOf(prev))
|
||||
{
|
||||
color = Color.LightGreen;
|
||||
color = Color.FromArgb(0xE0FBE0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +64,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void AddBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
AddCallback(null);
|
||||
_tastudio.CallAddMarkerPopUp();
|
||||
}
|
||||
|
||||
public new void Refresh()
|
||||
|
@ -74,5 +76,35 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
base.Refresh();
|
||||
}
|
||||
|
||||
private void MarkerView_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
RemoveBtn.Enabled = SelectedIndices.Any();
|
||||
}
|
||||
|
||||
private void RemoveBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
SelectedMarkers.ForEach(i => Markers.Remove(i));
|
||||
_tastudio.RefreshDialog();
|
||||
}
|
||||
|
||||
private IEnumerable<int> SelectedIndices
|
||||
{
|
||||
get
|
||||
{
|
||||
return MarkerView.SelectedIndices
|
||||
.OfType<int>();
|
||||
}
|
||||
}
|
||||
|
||||
private List<TasMovieMarker> SelectedMarkers
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelectedIndices
|
||||
.Select(index => Markers[index])
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.MessageStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.SplicerStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.TasPlaybackBox = new BizHawk.Client.EmuHawk.PlaybackBox();
|
||||
this.MarkerControl = new BizHawk.Client.EmuHawk.MarkerControl();
|
||||
this.MarkerControl = new BizHawk.Client.EmuHawk.MarkerControl(this);
|
||||
this.TASMenu.SuspendLayout();
|
||||
this.TasStatusStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
|
@ -740,7 +740,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
//
|
||||
// MarkerControl
|
||||
//
|
||||
this.MarkerControl.AddCallback = null;
|
||||
this.MarkerControl.Location = new System.Drawing.Point(302, 151);
|
||||
this.MarkerControl.Markers = null;
|
||||
this.MarkerControl.Name = "MarkerControl";
|
||||
|
|
|
@ -68,7 +68,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
public TAStudio()
|
||||
{
|
||||
InitializeComponent();
|
||||
MarkerControl.AddCallback = CallAddMarkerPopUp;
|
||||
TasView.QueryItemText += TasView_QueryItemText;
|
||||
TasView.QueryItemBkColor += TasView_QueryItemBkColor;
|
||||
TasView.VirtualMode = true;
|
||||
|
@ -210,7 +209,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void RefreshDialog()
|
||||
public void RefreshDialog()
|
||||
{
|
||||
TasView.ItemCount = _tas.InputLogLength;
|
||||
if (MarkerControl != null)
|
||||
|
@ -327,7 +326,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Owner = Global.Config.TAStudioSettings.FloatingWindow ? null : GlobalWin.MainForm;
|
||||
}
|
||||
|
||||
private void CallAddMarkerPopUp(int? frame = null)
|
||||
public void CallAddMarkerPopUp(int? frame = null)
|
||||
{
|
||||
var markerFrame = frame ?? TasView.LastSelectedIndex ?? Global.Emulator.Frame;
|
||||
InputPrompt i = new InputPrompt
|
||||
|
|
Loading…
Reference in New Issue