Skip to content

Commit

Permalink
Centre branch/marker edit dialogs relative to the interacted pane
Browse files Browse the repository at this point in the history
that is, the input roll if the interaction was with the input roll, and
the Markers box if the interaction was with that
see #3714/128c8e621
  • Loading branch information
YoshiRulz committed Nov 27, 2024
1 parent b7945d8 commit d98c04c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ public bool EditBranchTextPopUp(int index)
Message = "Enter a message",
InitialValue = branch.UserText
};

i.CenterOn(this);
if (this.ShowDialogWithTempMute(i).IsOk())
{
branch.UserText = i.PromptText;
Expand Down
10 changes: 5 additions & 5 deletions src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public void UpdateMarkerCount()
MarkerView.RowCount = Markers.Count;
}

public void AddMarker(int frame, bool editText = false)
public void AddMarker(int frame, bool editText = false, Control/*?*/ centerOn = null)
{
TasMovieMarker marker;
if (editText)
Expand All @@ -174,7 +174,7 @@ public void AddMarker(int frame, bool editText = false)
Markers.PreviousOrCurrent(frame).Message :
""
};

i.CenterOn(centerOn ?? this);
if (!this.ShowDialogWithTempMute(i).IsOk()) return;

UpdateTextColumnWidth();
Expand Down Expand Up @@ -205,7 +205,7 @@ public void UpdateTextColumnWidth()
}
}

public void EditMarkerPopUp(TasMovieMarker marker)
public void EditMarkerPopUp(TasMovieMarker marker, Control/*?*/ centerOn = null)
{
var markerFrame = marker.Frame;
var i = new InputPrompt
Expand All @@ -218,7 +218,7 @@ public void EditMarkerPopUp(TasMovieMarker marker)
? Markers.PreviousOrCurrent(markerFrame).Message
: ""
};

i.CenterOn(centerOn ?? this);
if (!this.ShowDialogWithTempMute(i).IsOk()) return;

marker.Message = i.PromptText;
Expand All @@ -238,7 +238,7 @@ public void EditMarkerFramePopUp(TasMovieMarker marker)
? Markers.PreviousOrCurrent(markerFrame).Frame.ToString()
: "0",
};

i.CenterOn(this);
if (!this.ShowDialogWithTempMute(i).IsOk()
|| !int.TryParse(i.PromptText, out var promptValue)
|| Markers.IsMarker(promptValue)) // don't move to frame with an existing marker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ private void TasView_MouseDoubleClick(object sender, MouseEventArgs e)

if (existingMarker != null)
{
MarkerControl.EditMarkerPopUp(existingMarker);
MarkerControl.EditMarkerPopUp(existingMarker, centerOn: TasView);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,10 @@ private void SetMarkersMenuItem_Click(object sender, EventArgs e)

private void SetMarkerWithTextMenuItem_Click(object sender, EventArgs e)
{
MarkerControl.AddMarker(TasView.AnyRowsSelected ? TasView.FirstSelectedRowIndex : 0, true);
MarkerControl.AddMarker(
frame: TasView.AnyRowsSelected ? TasView.FirstSelectedRowIndex : 0,
editText: true,
centerOn: TasView);
}

private void RemoveMarkersMenuItem_Click(object sender, EventArgs e)
Expand Down

0 comments on commit d98c04c

Please sign in to comment.