control extension to center the new dialog on mouse pointer
This commit is contained in:
parent
2211a4186f
commit
28757bd8be
|
@ -79,6 +79,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
return control.PointToScreen(new Point(child.Location.X, child.Location.Y));
|
||||
}
|
||||
|
||||
public static void FollowMousePointer(this Form form)
|
||||
{
|
||||
var point = Cursor.Position;
|
||||
point.Offset(form.Width / -2, form.Height / -2);
|
||||
form.StartPosition = FormStartPosition.Manual;
|
||||
form.Location = point;
|
||||
}
|
||||
|
||||
public static DialogResult ShowDialogOnScreen(this Form form)
|
||||
{
|
||||
var topLeft = new Point(
|
||||
|
|
|
@ -569,12 +569,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
InitialValue = branch.UserText
|
||||
};
|
||||
|
||||
var point = Cursor.Position;
|
||||
point.Offset(i.Width / -2, i.Height / -2);
|
||||
i.StartPosition = FormStartPosition.Manual;
|
||||
i.Location = point;
|
||||
|
||||
if (this.ShowDialogWithTempMute(i).IsOk())
|
||||
i.FollowMousePointer();
|
||||
if (i.ShowDialogOnScreen().IsOk())
|
||||
{
|
||||
branch.UserText = i.PromptText;
|
||||
UpdateTextColumnWidth();
|
||||
|
|
|
@ -175,12 +175,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
""
|
||||
};
|
||||
|
||||
var point = Cursor.Position;
|
||||
point.Offset(i.Width / -2, i.Height / -2);
|
||||
i.StartPosition = FormStartPosition.Manual;
|
||||
i.Location = point;
|
||||
|
||||
if (!this.ShowDialogWithTempMute(i).IsOk()) return;
|
||||
i.FollowMousePointer();
|
||||
if (!i.ShowDialogOnScreen().IsOk()) return;
|
||||
|
||||
UpdateTextColumnWidth();
|
||||
marker = new TasMovieMarker(frame, i.PromptText);
|
||||
|
@ -210,7 +206,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void EditMarkerPopUp(TasMovieMarker marker, bool followCursor = false)
|
||||
public void EditMarkerPopUp(TasMovieMarker marker)
|
||||
{
|
||||
var markerFrame = marker.Frame;
|
||||
var i = new InputPrompt
|
||||
|
@ -224,15 +220,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
: ""
|
||||
};
|
||||
|
||||
if (followCursor)
|
||||
{
|
||||
var point = Cursor.Position;
|
||||
point.Offset(i.Width / -2, i.Height / -2);
|
||||
i.StartPosition = FormStartPosition.Manual;
|
||||
i.Location = point;
|
||||
}
|
||||
|
||||
if (!this.ShowDialogWithTempMute(i).IsOk()) return;
|
||||
i.FollowMousePointer();
|
||||
if (!i.ShowDialogOnScreen().IsOk()) return;
|
||||
|
||||
marker.Message = i.PromptText;
|
||||
UpdateTextColumnWidth();
|
||||
|
@ -252,7 +241,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
: "0",
|
||||
};
|
||||
|
||||
if (!this.ShowDialogWithTempMute(i).IsOk()
|
||||
i.FollowMousePointer();
|
||||
if (!i.ShowDialogOnScreen().IsOk()
|
||||
|| !int.TryParse(i.PromptText, out var promptValue)
|
||||
|| Markers.IsMarker(promptValue)) // don't move to frame with an existing marker
|
||||
{
|
||||
|
|
|
@ -903,7 +903,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (existingMarker != null)
|
||||
{
|
||||
MarkerControl.EditMarkerPopUp(existingMarker, true);
|
||||
MarkerControl.EditMarkerPopUp(existingMarker);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue