2013-12-15 19:16:52 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
2014-07-09 16:35:39 +00:00
|
|
|
|
using BizHawk.Client.Common;
|
2014-12-21 18:25:04 +00:00
|
|
|
|
using BizHawk.Emulation.Common;
|
2014-07-09 16:35:39 +00:00
|
|
|
|
|
2013-12-16 03:23:28 +00:00
|
|
|
|
namespace BizHawk.Client.EmuHawk
|
2013-12-15 19:16:52 +00:00
|
|
|
|
{
|
|
|
|
|
public partial class MarkerControl : UserControl
|
|
|
|
|
{
|
2014-07-16 02:20:14 +00:00
|
|
|
|
public TAStudio Tastudio { get; set; }
|
2014-12-21 18:25:04 +00:00
|
|
|
|
public IEmulator Emulator { get; set; }
|
2014-07-16 02:17:19 +00:00
|
|
|
|
|
2014-07-16 02:20:14 +00:00
|
|
|
|
public MarkerControl()
|
2013-12-15 19:16:52 +00:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2014-09-18 00:23:40 +00:00
|
|
|
|
|
2014-10-12 16:37:45 +00:00
|
|
|
|
MarkerView.AllColumns.AddRange(new InputRoll.RollColumn[]
|
2014-08-23 23:40:01 +00:00
|
|
|
|
{
|
2014-09-18 00:23:40 +00:00
|
|
|
|
new InputRoll.RollColumn
|
|
|
|
|
{
|
|
|
|
|
Name = "FrameColumn",
|
|
|
|
|
Text = "Frame",
|
2014-10-18 16:22:24 +00:00
|
|
|
|
Width = 52
|
2014-09-18 00:23:40 +00:00
|
|
|
|
},
|
|
|
|
|
new InputRoll.RollColumn
|
|
|
|
|
{
|
|
|
|
|
Name = "LabelColumn",
|
2014-10-18 16:22:24 +00:00
|
|
|
|
Text = "",
|
|
|
|
|
Width = 139
|
2014-09-18 00:23:40 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
2014-08-23 23:40:01 +00:00
|
|
|
|
|
2014-07-13 14:13:20 +00:00
|
|
|
|
MarkerView.QueryItemBkColor += MarkerView_QueryItemBkColor;
|
|
|
|
|
MarkerView.QueryItemText += MarkerView_QueryItemText;
|
2013-12-15 19:16:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MarkerControl_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
2015-02-25 21:17:50 +00:00
|
|
|
|
|
2013-12-15 19:16:52 +00:00
|
|
|
|
}
|
2014-07-13 14:13:20 +00:00
|
|
|
|
|
2014-10-25 13:41:23 +00:00
|
|
|
|
public InputRoll MarkerInputRoll { get { return MarkerView; } }
|
|
|
|
|
|
2014-10-13 19:30:59 +00:00
|
|
|
|
private void MarkerView_QueryItemBkColor(int index, InputRoll.RollColumn column, ref Color color)
|
2014-07-13 14:13:20 +00:00
|
|
|
|
{
|
2014-12-22 22:30:22 +00:00
|
|
|
|
var prev = Tastudio.CurrentTasMovie.Markers.PreviousOrCurrent(Global.Emulator.Frame);//Temp fix
|
2014-07-15 23:43:17 +00:00
|
|
|
|
|
2014-10-20 19:04:59 +00:00
|
|
|
|
if (prev != null && index == Tastudio.CurrentTasMovie.Markers.IndexOf(prev))
|
2014-07-15 23:43:17 +00:00
|
|
|
|
{
|
2014-07-21 02:23:47 +00:00
|
|
|
|
color = TAStudio.Marker_FrameCol;
|
|
|
|
|
}
|
2015-03-01 05:47:32 +00:00
|
|
|
|
else if (index < Tastudio.CurrentTasMovie.Markers.Count)
|
2014-07-21 02:23:47 +00:00
|
|
|
|
{
|
2014-10-20 19:04:59 +00:00
|
|
|
|
var marker = Tastudio.CurrentTasMovie.Markers[index];
|
|
|
|
|
var record = Tastudio.CurrentTasMovie[marker.Frame];
|
2014-10-18 16:34:41 +00:00
|
|
|
|
|
|
|
|
|
if (record.Lagged.HasValue)
|
2014-07-15 23:43:17 +00:00
|
|
|
|
{
|
2014-07-21 02:23:47 +00:00
|
|
|
|
if (record.Lagged.Value)
|
|
|
|
|
{
|
2014-10-13 19:30:59 +00:00
|
|
|
|
color = column.Name == "FrameColumn" ? TAStudio.LagZone_FrameCol : TAStudio.LagZone_InputLog;
|
2014-07-21 02:23:47 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-10-13 19:30:59 +00:00
|
|
|
|
color = column.Name == "LabelColumn" ? TAStudio.GreenZone_FrameCol : TAStudio.GreenZone_InputLog;
|
2014-07-21 02:23:47 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
color = Color.White;
|
2014-07-15 23:43:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-03-01 05:47:32 +00:00
|
|
|
|
else
|
|
|
|
|
color = Color.White;
|
2014-07-13 14:13:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-10-13 19:10:11 +00:00
|
|
|
|
private void MarkerView_QueryItemText(int index, InputRoll.RollColumn column, out string text)
|
2014-07-13 14:13:20 +00:00
|
|
|
|
{
|
|
|
|
|
text = "";
|
|
|
|
|
|
2014-10-13 19:10:11 +00:00
|
|
|
|
if (column.Name == "FrameColumn")
|
2014-07-13 14:13:20 +00:00
|
|
|
|
{
|
2014-10-20 19:04:59 +00:00
|
|
|
|
text = Tastudio.CurrentTasMovie.Markers[index].Frame.ToString();
|
2014-07-13 14:13:20 +00:00
|
|
|
|
}
|
2014-10-13 19:10:11 +00:00
|
|
|
|
else if (column.Name == "LabelColumn")
|
2014-07-13 14:13:20 +00:00
|
|
|
|
{
|
2014-10-20 19:04:59 +00:00
|
|
|
|
text = Tastudio.CurrentTasMovie.Markers[index].Message;
|
2014-07-13 14:13:20 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-07-15 23:43:17 +00:00
|
|
|
|
|
|
|
|
|
private void AddBtn_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-07-16 02:20:14 +00:00
|
|
|
|
Tastudio.CallAddMarkerPopUp();
|
2014-08-24 14:41:56 +00:00
|
|
|
|
MarkerView_SelectedIndexChanged(sender, e);
|
2014-07-15 23:43:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-29 00:04:42 +00:00
|
|
|
|
public void UpdateValues()
|
2014-07-15 23:43:17 +00:00
|
|
|
|
{
|
2014-09-28 17:16:00 +00:00
|
|
|
|
if (MarkerView != null &&
|
|
|
|
|
Tastudio != null &&
|
2014-10-20 19:04:59 +00:00
|
|
|
|
Tastudio.CurrentTasMovie != null &&
|
|
|
|
|
Tastudio.CurrentTasMovie.Markers != null)
|
2014-07-15 23:43:17 +00:00
|
|
|
|
{
|
2014-10-20 19:04:59 +00:00
|
|
|
|
MarkerView.RowCount = Tastudio.CurrentTasMovie.Markers.Count;
|
2014-07-15 23:43:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-29 00:04:42 +00:00
|
|
|
|
MarkerView.Refresh();
|
2014-07-15 23:43:17 +00:00
|
|
|
|
}
|
2014-07-16 02:17:19 +00:00
|
|
|
|
|
|
|
|
|
private void MarkerView_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-10-25 14:10:32 +00:00
|
|
|
|
RemoveBtn.Enabled = MarkerView.SelectedRows.Any(i => i < Tastudio.CurrentTasMovie.Markers.Count);
|
2014-07-16 02:17:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void RemoveBtn_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2015-03-01 05:47:32 +00:00
|
|
|
|
SelectedMarkers.ForEach(i => Tastudio.RemoveMarker(i));
|
2015-02-27 19:06:02 +00:00
|
|
|
|
MarkerInputRoll.DeselectAll();
|
2014-07-16 02:20:14 +00:00
|
|
|
|
Tastudio.RefreshDialog();
|
2014-08-24 14:41:56 +00:00
|
|
|
|
MarkerView_SelectedIndexChanged(sender, e);
|
2014-07-16 02:17:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<TasMovieMarker> SelectedMarkers
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2014-10-25 14:10:32 +00:00
|
|
|
|
return MarkerView.SelectedRows
|
2014-10-20 19:04:59 +00:00
|
|
|
|
.Select(index => Tastudio.CurrentTasMovie.Markers[index])
|
2014-07-16 02:17:19 +00:00
|
|
|
|
.ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-07-23 23:04:43 +00:00
|
|
|
|
|
|
|
|
|
private void MarkerView_ItemActivate(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Tastudio.GoToMarker(SelectedMarkers.First());
|
|
|
|
|
}
|
2014-10-20 23:03:39 +00:00
|
|
|
|
|
2015-02-25 21:17:50 +00:00
|
|
|
|
// SuuperW: Marker renaming can be done with a right-click.
|
|
|
|
|
// A much more useful feature would be to easily jump to it.
|
|
|
|
|
private void MarkerView_MouseDoubleClick(object sender, MouseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (MarkerView.CurrentCell != null && MarkerView.CurrentCell.RowIndex.HasValue &&
|
|
|
|
|
MarkerView.CurrentCell.RowIndex < MarkerView.RowCount)
|
|
|
|
|
{
|
|
|
|
|
var marker = Tastudio.CurrentTasMovie.Markers[MarkerView.CurrentCell.RowIndex.Value];
|
|
|
|
|
Tastudio.GoToFrame(marker.Frame);
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-10-25 13:41:23 +00:00
|
|
|
|
|
|
|
|
|
public void EditMarker()
|
|
|
|
|
{
|
|
|
|
|
if (MarkerView.SelectedRows.Any())
|
|
|
|
|
{
|
|
|
|
|
var index = MarkerView.SelectedRows.First();
|
|
|
|
|
var marker = Tastudio.CurrentTasMovie.Markers[index];
|
|
|
|
|
Tastudio.CallEditMarkerPopUp(marker);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddMarker()
|
|
|
|
|
{
|
|
|
|
|
AddBtn_Click(null, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveMarker()
|
|
|
|
|
{
|
|
|
|
|
if (RemoveBtn.Enabled)
|
|
|
|
|
{
|
|
|
|
|
RemoveBtn_Click(null, null);
|
|
|
|
|
}
|
2015-02-25 21:17:50 +00:00
|
|
|
|
}
|
2013-12-15 19:16:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|