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;
|
|
|
|
|
|
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-13 14:13:20 +00:00
|
|
|
|
public TasMovieMarkerList Markers {get; set; }
|
|
|
|
|
|
2014-07-16 02:17:19 +00:00
|
|
|
|
private readonly TAStudio _tastudio;
|
|
|
|
|
|
|
|
|
|
public MarkerControl(TAStudio tastudio)
|
2013-12-15 19:16:52 +00:00
|
|
|
|
{
|
2014-07-16 02:17:19 +00:00
|
|
|
|
_tastudio = tastudio;
|
2013-12-15 19:16:52 +00:00
|
|
|
|
InitializeComponent();
|
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)
|
|
|
|
|
{
|
2013-12-16 03:23:28 +00:00
|
|
|
|
|
2013-12-15 19:16:52 +00:00
|
|
|
|
}
|
2014-07-13 14:13:20 +00:00
|
|
|
|
|
|
|
|
|
public void UpdateValues()
|
|
|
|
|
{
|
|
|
|
|
Refresh();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MarkerView_QueryItemBkColor(int index, int column, ref Color color)
|
|
|
|
|
{
|
2014-07-15 23:43:17 +00:00
|
|
|
|
var prev = Markers.Previous(Global.Emulator.Frame);
|
|
|
|
|
|
|
|
|
|
if (prev != null)
|
|
|
|
|
{
|
|
|
|
|
if (index == Markers.IndexOf(prev))
|
|
|
|
|
{
|
2014-07-16 02:17:19 +00:00
|
|
|
|
color = Color.FromArgb(0xE0FBE0);
|
2014-07-15 23:43:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-07-13 14:13:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MarkerView_QueryItemText(int index, int column, out string text)
|
|
|
|
|
{
|
|
|
|
|
text = "";
|
|
|
|
|
|
|
|
|
|
if (column == 0)
|
|
|
|
|
{
|
|
|
|
|
text = Markers[index].Frame.ToString();
|
|
|
|
|
}
|
|
|
|
|
else if (column == 1)
|
|
|
|
|
{
|
|
|
|
|
text = Markers[index].Message;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-07-15 23:43:17 +00:00
|
|
|
|
|
|
|
|
|
private void AddBtn_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-07-16 02:17:19 +00:00
|
|
|
|
_tastudio.CallAddMarkerPopUp();
|
2014-07-15 23:43:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public new void Refresh()
|
|
|
|
|
{
|
|
|
|
|
if (MarkerView != null && Markers != null)
|
|
|
|
|
{
|
|
|
|
|
MarkerView.ItemCount = Markers.Count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
base.Refresh();
|
|
|
|
|
}
|
2014-07-16 02:17:19 +00:00
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-12-15 19:16:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|