tastudio makers text popup:

- appears when double-clicking existing marker in tasview
- appears at cursor position when called from tasview (fancy)

this required adding optional position to ShowHawkDialog()
This commit is contained in:
feos 2017-01-19 23:24:41 +03:00
parent 17faf42b6e
commit ae16703ffc
3 changed files with 36 additions and 13 deletions

View File

@ -157,9 +157,14 @@ namespace BizHawk.Client.EmuHawk.WinFormExtensions
/// <summary> /// <summary>
/// Handles EmuHawk specific issues before showing a modal dialog /// Handles EmuHawk specific issues before showing a modal dialog
/// </summary> /// </summary>
public static DialogResult ShowHawkDialog(this Form form, IWin32Window owner = null) public static DialogResult ShowHawkDialog(this Form form, IWin32Window owner = null, Point position = default(Point))
{ {
GlobalWin.Sound.StopSound(); GlobalWin.Sound.StopSound();
if (position != default(Point))
{
form.StartPosition = FormStartPosition.Manual;
form.Location = position;
}
var result = (owner == null ? form.ShowDialog() : form.ShowDialog(owner)); var result = (owner == null ? form.ShowDialog() : form.ShowDialog(owner));
GlobalWin.Sound.StartSound(); GlobalWin.Sound.StartSound();
return result; return result;

View File

@ -55,7 +55,8 @@ namespace BizHawk.Client.EmuHawk
if (prev != null && index == Markers.IndexOf(prev)) if (prev != null && index == Markers.IndexOf(prev))
{ {
color = TAStudio.Marker_FrameCol; // feos: taseditor doesn't have it, so we're free to set arbitrary color scheme. and I prefer consistency
color = TAStudio.CurrentFrame_InputLog;
} }
else if (index < Markers.Count) else if (index < Markers.Count)
{ {
@ -174,7 +175,11 @@ namespace BizHawk.Client.EmuHawk
Markers.PreviousOrCurrent(markerFrame).Message : Markers.PreviousOrCurrent(markerFrame).Message :
"" ""
}; };
var result = i.ShowHawkDialog();
var point = Cursor.Position;
point.Offset(i.Width / -2, i.Height / -2);
var result = i.ShowHawkDialog(position: point);
if (result == DialogResult.OK) if (result == DialogResult.OK)
{ {
Markers.Add(new TasMovieMarker(markerFrame, i.PromptText)); Markers.Add(new TasMovieMarker(markerFrame, i.PromptText));
@ -189,9 +194,10 @@ namespace BizHawk.Client.EmuHawk
Tastudio.RefreshDialog(); Tastudio.RefreshDialog();
} }
public void EditMarkerPopUp(TasMovieMarker marker) public void EditMarkerPopUp(TasMovieMarker marker, bool followCursor = false)
{ {
var markerFrame = marker.Frame; var markerFrame = marker.Frame;
var point = default(Point);
InputPrompt i = new InputPrompt InputPrompt i = new InputPrompt
{ {
Text = "Marker for frame " + markerFrame, Text = "Marker for frame " + markerFrame,
@ -203,7 +209,12 @@ namespace BizHawk.Client.EmuHawk
"" ""
}; };
var result = i.ShowHawkDialog(); if (followCursor)
{
point = Cursor.Position;
point.Offset(i.Width / -2, i.Height / -2);
}
var result = i.ShowHawkDialog(position: point);
if (result == DialogResult.OK) if (result == DialogResult.OK)
{ {

View File

@ -726,21 +726,28 @@ namespace BizHawk.Client.EmuHawk
if (e.Button == MouseButtons.Left) if (e.Button == MouseButtons.Left)
{ {
var buttonName = TasView.CurrentCell.Column.Name;
if (TasView.CurrentCell.RowIndex.HasValue && if (TasView.CurrentCell.RowIndex.HasValue &&
buttonName == FrameColumnName && TasView.CurrentCell.Column.Name == FrameColumnName &&
!FloatEditingMode) !FloatEditingMode)
{ {
if (Settings.EmptyMarkers) var existingMarker = CurrentTasMovie.Markers.FirstOrDefault(m => m.Frame == TasView.CurrentCell.RowIndex.Value);
if (existingMarker != null)
{ {
CurrentTasMovie.Markers.Add(TasView.CurrentCell.RowIndex.Value, string.Empty); MarkerControl.EditMarkerPopUp(existingMarker, true);
RefreshDialog();
} }
else else
{ {
ClearLeftMouseStates(); if (Settings.EmptyMarkers)
MarkerControl.AddMarker(false, TasView.CurrentCell.RowIndex.Value); {
CurrentTasMovie.Markers.Add(TasView.CurrentCell.RowIndex.Value, string.Empty);
RefreshDialog();
}
else
{
ClearLeftMouseStates();
MarkerControl.AddMarker(false, TasView.CurrentCell.RowIndex.Value);
}
} }
} }
} }