rename MessageOption to MessagePosition
This commit is contained in:
parent
433eff65ec
commit
f5929602ff
|
@ -253,20 +253,20 @@ namespace BizHawk.Client.Common
|
||||||
public bool DispAutoPrescale = true;
|
public bool DispAutoPrescale = true;
|
||||||
public int DispSpeedupFeatures = 2;
|
public int DispSpeedupFeatures = 2;
|
||||||
|
|
||||||
public MessageOption Fps = DefaultMessageOptions.Fps.Clone();
|
public MessagePosition Fps = DefaultMessagePositions.Fps.Clone();
|
||||||
public MessageOption FrameCounter = DefaultMessageOptions.FrameCounter.Clone();
|
public MessagePosition FrameCounter = DefaultMessagePositions.FrameCounter.Clone();
|
||||||
public MessageOption LagCounter = DefaultMessageOptions.LagCounter.Clone();
|
public MessagePosition LagCounter = DefaultMessagePositions.LagCounter.Clone();
|
||||||
public MessageOption InputDisplay = DefaultMessageOptions.InputDisplay.Clone();
|
public MessagePosition InputDisplay = DefaultMessagePositions.InputDisplay.Clone();
|
||||||
public MessageOption ReRecordCounter = DefaultMessageOptions.ReRecordCounter.Clone();
|
public MessagePosition ReRecordCounter = DefaultMessagePositions.ReRecordCounter.Clone();
|
||||||
public MessageOption MultitrackRecorder = DefaultMessageOptions.MultitrackRecorder.Clone();
|
public MessagePosition MultitrackRecorder = DefaultMessagePositions.MultitrackRecorder.Clone();
|
||||||
public MessageOption Messages = DefaultMessageOptions.Messages.Clone();
|
public MessagePosition Messages = DefaultMessagePositions.Messages.Clone();
|
||||||
public MessageOption Autohold = DefaultMessageOptions.Autohold.Clone();
|
public MessagePosition Autohold = DefaultMessagePositions.Autohold.Clone();
|
||||||
public MessageOption RamWatches = DefaultMessageOptions.RamWatches.Clone();
|
public MessagePosition RamWatches = DefaultMessagePositions.RamWatches.Clone();
|
||||||
|
|
||||||
public int MessagesColor = DefaultMessageOptions.MessagesColor;
|
public int MessagesColor = DefaultMessagePositions.MessagesColor;
|
||||||
public int AlertMessageColor = DefaultMessageOptions.AlertMessageColor;
|
public int AlertMessageColor = DefaultMessagePositions.AlertMessageColor;
|
||||||
public int LastInputColor = DefaultMessageOptions.LastInputColor;
|
public int LastInputColor = DefaultMessagePositions.LastInputColor;
|
||||||
public int MovieInput = DefaultMessageOptions.MovieInput;
|
public int MovieInput = DefaultMessagePositions.MovieInput;
|
||||||
|
|
||||||
public int DispPrescale = 1;
|
public int DispPrescale = 1;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace BizHawk.Client.Common
|
namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
public class MessageOption
|
public class MessagePosition
|
||||||
{
|
{
|
||||||
public int X { get; set; }
|
public int X { get; set; }
|
||||||
public int Y { get; set; }
|
public int Y { get; set; }
|
||||||
|
@ -14,38 +14,38 @@
|
||||||
BottomRight = 3
|
BottomRight = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
public MessageOption Clone()
|
public MessagePosition Clone()
|
||||||
{
|
{
|
||||||
return (MessageOption)MemberwiseClone();
|
return (MessagePosition)MemberwiseClone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MessageOptionExtensions
|
public static class MessageOptionExtensions
|
||||||
{
|
{
|
||||||
public static bool IsTop(this MessageOption.AnchorType type)
|
public static bool IsTop(this MessagePosition.AnchorType type)
|
||||||
{
|
{
|
||||||
return type == MessageOption.AnchorType.TopLeft
|
return type == MessagePosition.AnchorType.TopLeft
|
||||||
|| type == MessageOption.AnchorType.TopRight;
|
|| type == MessagePosition.AnchorType.TopRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsLeft(this MessageOption.AnchorType type)
|
public static bool IsLeft(this MessagePosition.AnchorType type)
|
||||||
{
|
{
|
||||||
return type == MessageOption.AnchorType.TopLeft
|
return type == MessagePosition.AnchorType.TopLeft
|
||||||
|| type == MessageOption.AnchorType.BottomLeft;
|
|| type == MessagePosition.AnchorType.BottomLeft;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class DefaultMessageOptions
|
public static class DefaultMessagePositions
|
||||||
{
|
{
|
||||||
public static MessageOption Fps = new MessageOption { X = 0, Y = 0 };
|
public static MessagePosition Fps = new MessagePosition { X = 0, Y = 0 };
|
||||||
public static MessageOption FrameCounter = new MessageOption { X = 0, Y = 14 };
|
public static MessagePosition FrameCounter = new MessagePosition { X = 0, Y = 14 };
|
||||||
public static MessageOption LagCounter = new MessageOption { X = 0, Y = 42 };
|
public static MessagePosition LagCounter = new MessagePosition { X = 0, Y = 42 };
|
||||||
public static MessageOption InputDisplay = new MessageOption { X = 0, Y = 28 };
|
public static MessagePosition InputDisplay = new MessagePosition { X = 0, Y = 28 };
|
||||||
public static MessageOption ReRecordCounter = new MessageOption { X = 0, Y = 56 };
|
public static MessagePosition ReRecordCounter = new MessagePosition { X = 0, Y = 56 };
|
||||||
public static MessageOption MultitrackRecorder = new MessageOption { X = 0, Y = 14, Anchor = MessageOption.AnchorType.TopRight };
|
public static MessagePosition MultitrackRecorder = new MessagePosition { X = 0, Y = 14, Anchor = MessagePosition.AnchorType.TopRight };
|
||||||
public static MessageOption Messages = new MessageOption { X = 0, Y = 0, Anchor = MessageOption.AnchorType.BottomLeft };
|
public static MessagePosition Messages = new MessagePosition { X = 0, Y = 0, Anchor = MessagePosition.AnchorType.BottomLeft };
|
||||||
public static MessageOption Autohold = new MessageOption { X = 0, Y = 0, Anchor = MessageOption.AnchorType.TopRight };
|
public static MessagePosition Autohold = new MessagePosition { X = 0, Y = 0, Anchor = MessagePosition.AnchorType.TopRight };
|
||||||
public static MessageOption RamWatches = new MessageOption { X = 0, Y = 70 };
|
public static MessagePosition RamWatches = new MessagePosition { X = 0, Y = 70 };
|
||||||
|
|
||||||
public const int
|
public const int
|
||||||
MessagesColor = -1,
|
MessagesColor = -1,
|
||||||
|
|
|
@ -491,7 +491,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
x -= Emulator.CoreComm.ScreenLogicalOffsetX;
|
x -= Emulator.CoreComm.ScreenLogicalOffsetX;
|
||||||
y -= Emulator.CoreComm.ScreenLogicalOffsetY;
|
y -= Emulator.CoreComm.ScreenLogicalOffsetY;
|
||||||
}
|
}
|
||||||
GlobalWin.OSD.AddGuiText(message, x, y, Color.Black, forecolor ?? Color.White, (MessageOption.AnchorType)a);
|
GlobalWin.OSD.AddGuiText(message, x, y, Color.Black, forecolor ?? Color.White, (MessagePosition.AnchorType)a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public string Message;
|
public string Message;
|
||||||
public int X;
|
public int X;
|
||||||
public int Y;
|
public int Y;
|
||||||
public MessageOption.AnchorType Anchor;
|
public MessagePosition.AnchorType Anchor;
|
||||||
public Color ForeColor;
|
public Color ForeColor;
|
||||||
public Color BackGround;
|
public Color BackGround;
|
||||||
}
|
}
|
||||||
|
@ -53,16 +53,16 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public Color FixedMessagesColor => Color.FromArgb(Global.Config.MessagesColor);
|
public Color FixedMessagesColor => Color.FromArgb(Global.Config.MessagesColor);
|
||||||
public Color FixedAlertMessageColor => Color.FromArgb(Global.Config.AlertMessageColor);
|
public Color FixedAlertMessageColor => Color.FromArgb(Global.Config.AlertMessageColor);
|
||||||
|
|
||||||
private PointF GetCoordinates(IBlitter g, MessageOption option, string message)
|
private PointF GetCoordinates(IBlitter g, MessagePosition position, string message)
|
||||||
{
|
{
|
||||||
var size = g.MeasureString(message, MessageFont);
|
var size = g.MeasureString(message, MessageFont);
|
||||||
float x = option.Anchor.IsLeft()
|
float x = position.Anchor.IsLeft()
|
||||||
? option.X
|
? position.X
|
||||||
: g.ClipBounds.Width - option.X - size.Width;
|
: g.ClipBounds.Width - position.X - size.Width;
|
||||||
|
|
||||||
float y = option.Anchor.IsTop()
|
float y = position.Anchor.IsTop()
|
||||||
? option.Y
|
? position.Y
|
||||||
: g.ClipBounds.Height - option.Y - size.Height;
|
: g.ClipBounds.Height - position.Y - size.Height;
|
||||||
|
|
||||||
|
|
||||||
return new PointF(x, y);
|
return new PointF(x, y);
|
||||||
|
@ -108,7 +108,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_messages.Add(new UIMessage { Message = message, ExpireAt = DateTime.Now + TimeSpan.FromSeconds(2) });
|
_messages.Add(new UIMessage { Message = message, ExpireAt = DateTime.Now + TimeSpan.FromSeconds(2) });
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddGuiText(string message, int x, int y, Color backGround, Color foreColor, MessageOption.AnchorType anchor)
|
public void AddGuiText(string message, int x, int y, Color backGround, Color foreColor, MessagePosition.AnchorType anchor)
|
||||||
{
|
{
|
||||||
_guiTextList.Add(new UIDisplay
|
_guiTextList.Add(new UIDisplay
|
||||||
{
|
{
|
||||||
|
@ -177,7 +177,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var point = GetCoordinates(g, new MessageOption {X = text.X, Y = text.Y, Anchor = text.Anchor}, text.Message);
|
var point = GetCoordinates(g, new MessagePosition {X = text.X, Y = text.Y, Anchor = text.Anchor}, text.Message);
|
||||||
g.DrawString(text.Message, MessageFont, text.ForeColor, point.X, point.Y);
|
g.DrawString(text.Message, MessageFont, text.ForeColor, point.X, point.Y);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
|
|
|
@ -12,15 +12,15 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
private readonly Config _config;
|
private readonly Config _config;
|
||||||
|
|
||||||
private MessageOption _fps;
|
private MessagePosition _fps;
|
||||||
private MessageOption _frameCounter;
|
private MessagePosition _frameCounter;
|
||||||
private MessageOption _lagCounter;
|
private MessagePosition _lagCounter;
|
||||||
private MessageOption _inputDisplay;
|
private MessagePosition _inputDisplay;
|
||||||
private MessageOption _reRecordCounter;
|
private MessagePosition _reRecordCounter;
|
||||||
private MessageOption _multitrackRecorder;
|
private MessagePosition _multitrackRecorder;
|
||||||
private MessageOption _messages;
|
private MessagePosition _messages;
|
||||||
private MessageOption _autohold;
|
private MessagePosition _autohold;
|
||||||
private MessageOption _ramWatches;
|
private MessagePosition _ramWatches;
|
||||||
|
|
||||||
private int _messageColor;
|
private int _messageColor;
|
||||||
private int _alertColor;
|
private int _alertColor;
|
||||||
|
@ -97,27 +97,27 @@ namespace BizHawk.Client.EmuHawk
|
||||||
MovieInputText.Text = $"{_movieInput:X8}";
|
MovieInputText.Text = $"{_movieInput:X8}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetFromOption(MessageOption option)
|
private void SetFromOption(MessagePosition position)
|
||||||
{
|
{
|
||||||
_programmaticallyChangingValues = true;
|
_programmaticallyChangingValues = true;
|
||||||
XNumeric.Value = option.X;
|
XNumeric.Value = position.X;
|
||||||
YNumeric.Value = option.Y;
|
YNumeric.Value = position.Y;
|
||||||
_px = option.X;
|
_px = position.X;
|
||||||
_py = option.Y;
|
_py = position.Y;
|
||||||
|
|
||||||
switch (option.Anchor)
|
switch (position.Anchor)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case MessageOption.AnchorType.TopLeft:
|
case MessagePosition.AnchorType.TopLeft:
|
||||||
TL.Checked = true;
|
TL.Checked = true;
|
||||||
break;
|
break;
|
||||||
case MessageOption.AnchorType.TopRight:
|
case MessagePosition.AnchorType.TopRight:
|
||||||
TR.Checked = true;
|
TR.Checked = true;
|
||||||
break;
|
break;
|
||||||
case MessageOption.AnchorType.BottomLeft:
|
case MessagePosition.AnchorType.BottomLeft:
|
||||||
BL.Checked = true;
|
BL.Checked = true;
|
||||||
break;
|
break;
|
||||||
case MessageOption.AnchorType.BottomRight:
|
case MessagePosition.AnchorType.BottomRight:
|
||||||
BR.Checked = true;
|
BR.Checked = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -302,10 +302,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetOptionPosition(MessageOption option)
|
private void SetOptionPosition(MessagePosition position)
|
||||||
{
|
{
|
||||||
option.X = _px;
|
position.X = _px;
|
||||||
option.Y = _py;
|
position.Y = _py;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetPositionLabels()
|
private void SetPositionLabels()
|
||||||
|
@ -358,27 +358,27 @@ namespace BizHawk.Client.EmuHawk
|
||||||
AutoholdLabel.Text = ToCoordinateStr(_autohold);
|
AutoholdLabel.Text = ToCoordinateStr(_autohold);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ToCoordinateStr(MessageOption option)
|
private string ToCoordinateStr(MessagePosition position)
|
||||||
{
|
{
|
||||||
return $"{option.X}, {option.Y}";
|
return $"{position.X}, {position.Y}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ResetDefaultsButton_Click(object sender, EventArgs e)
|
private void ResetDefaultsButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_fps = _config.Fps = DefaultMessageOptions.Fps.Clone();
|
_fps = _config.Fps = DefaultMessagePositions.Fps.Clone();
|
||||||
_frameCounter = _config.FrameCounter = DefaultMessageOptions.FrameCounter.Clone();
|
_frameCounter = _config.FrameCounter = DefaultMessagePositions.FrameCounter.Clone();
|
||||||
_lagCounter = _config.LagCounter = DefaultMessageOptions.LagCounter.Clone();
|
_lagCounter = _config.LagCounter = DefaultMessagePositions.LagCounter.Clone();
|
||||||
_inputDisplay = _config.InputDisplay = DefaultMessageOptions.InputDisplay.Clone();
|
_inputDisplay = _config.InputDisplay = DefaultMessagePositions.InputDisplay.Clone();
|
||||||
_reRecordCounter = _config.ReRecordCounter = DefaultMessageOptions.ReRecordCounter.Clone();
|
_reRecordCounter = _config.ReRecordCounter = DefaultMessagePositions.ReRecordCounter.Clone();
|
||||||
_multitrackRecorder = _config.MultitrackRecorder = DefaultMessageOptions.MultitrackRecorder.Clone();
|
_multitrackRecorder = _config.MultitrackRecorder = DefaultMessagePositions.MultitrackRecorder.Clone();
|
||||||
_messages = _config.Messages = DefaultMessageOptions.Messages.Clone();
|
_messages = _config.Messages = DefaultMessagePositions.Messages.Clone();
|
||||||
_autohold = _config.Autohold = DefaultMessageOptions.Autohold.Clone();
|
_autohold = _config.Autohold = DefaultMessagePositions.Autohold.Clone();
|
||||||
_ramWatches = _config.RamWatches = DefaultMessageOptions.RamWatches.Clone();
|
_ramWatches = _config.RamWatches = DefaultMessagePositions.RamWatches.Clone();
|
||||||
|
|
||||||
_messageColor = _config.MessagesColor = DefaultMessageOptions.MessagesColor;
|
_messageColor = _config.MessagesColor = DefaultMessagePositions.MessagesColor;
|
||||||
_alertColor = _config.AlertMessageColor = DefaultMessageOptions.AlertMessageColor;
|
_alertColor = _config.AlertMessageColor = DefaultMessagePositions.AlertMessageColor;
|
||||||
_lastInputColor = _config.LastInputColor = DefaultMessageOptions.LastInputColor;
|
_lastInputColor = _config.LastInputColor = DefaultMessagePositions.LastInputColor;
|
||||||
_movieInput = _config.MovieInput = DefaultMessageOptions.MovieInput;
|
_movieInput = _config.MovieInput = DefaultMessagePositions.MovieInput;
|
||||||
|
|
||||||
MessageColorDialog.Color = Color.FromArgb(_messageColor);
|
MessageColorDialog.Color = Color.FromArgb(_messageColor);
|
||||||
AlertColorDialog.Color = Color.FromArgb(_alertColor);
|
AlertColorDialog.Color = Color.FromArgb(_alertColor);
|
||||||
|
@ -392,7 +392,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
StackMessagesCheckbox.Checked = _config.StackOSDMessages = true;
|
StackMessagesCheckbox.Checked = _config.StackOSDMessages = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetAnchorValue(MessageOption.AnchorType value)
|
private void SetAnchorValue(MessagePosition.AnchorType value)
|
||||||
{
|
{
|
||||||
if (FPSRadio.Checked)
|
if (FPSRadio.Checked)
|
||||||
{
|
{
|
||||||
|
@ -436,7 +436,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (TL.Checked)
|
if (TL.Checked)
|
||||||
{
|
{
|
||||||
SetAnchorValue(MessageOption.AnchorType.TopLeft);
|
SetAnchorValue(MessagePosition.AnchorType.TopLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
PositionPanel.Refresh();
|
PositionPanel.Refresh();
|
||||||
|
@ -446,7 +446,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (TR.Checked)
|
if (TR.Checked)
|
||||||
{
|
{
|
||||||
SetAnchorValue(MessageOption.AnchorType.TopRight);
|
SetAnchorValue(MessagePosition.AnchorType.TopRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
PositionPanel.Refresh();
|
PositionPanel.Refresh();
|
||||||
|
@ -456,7 +456,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (BL.Checked)
|
if (BL.Checked)
|
||||||
{
|
{
|
||||||
SetAnchorValue(MessageOption.AnchorType.BottomLeft);
|
SetAnchorValue(MessagePosition.AnchorType.BottomLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
PositionPanel.Refresh();
|
PositionPanel.Refresh();
|
||||||
|
@ -466,7 +466,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (BR.Checked)
|
if (BR.Checked)
|
||||||
{
|
{
|
||||||
SetAnchorValue(MessageOption.AnchorType.BottomRight);
|
SetAnchorValue(MessagePosition.AnchorType.BottomRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
PositionPanel.Refresh();
|
PositionPanel.Refresh();
|
||||||
|
|
Loading…
Reference in New Issue