Move PresentationPanel from GlobalWin to Mainform, since it was primarily used there (and the few other places knew about GlobaWin.MainForm anyway)

This commit is contained in:
adelikat 2015-02-22 03:53:07 +00:00
parent e3f9388a17
commit 1514faf300
4 changed files with 21 additions and 20 deletions

View File

@ -12,7 +12,6 @@ namespace BizHawk.Client.EmuHawk
public static Bizware.BizwareGL.Drivers.OpenTK.IGL_TK IGL_GL;
public static GLManager.ContextRef CR_GL;
public static Sound Sound;
public static PresentationPanel PresentationPanel;
public static OSDManager OSD = new OSDManager();
public static DisplayManager DisplayManager;
public static GLManager GLManager;

View File

@ -945,7 +945,7 @@ namespace BizHawk.Client.EmuHawk
Global.Config.VSyncThrottle = false;
if (old)
{
GlobalWin.PresentationPanel.Resized = true;
PresentationPanel.Resized = true;
}
}
@ -963,7 +963,7 @@ namespace BizHawk.Client.EmuHawk
Global.Config.VSyncThrottle = false;
if (old)
{
GlobalWin.PresentationPanel.Resized = true;
PresentationPanel.Resized = true;
}
}
}
@ -971,7 +971,7 @@ namespace BizHawk.Client.EmuHawk
private void VsyncThrottleMenuItem_Click(object sender, EventArgs e)
{
Global.Config.VSyncThrottle ^= true;
GlobalWin.PresentationPanel.Resized = true;
PresentationPanel.Resized = true;
if (Global.Config.VSyncThrottle)
{
Global.Config.ClockThrottle = false;
@ -991,7 +991,7 @@ namespace BizHawk.Client.EmuHawk
Global.Config.VSync ^= true;
if (!Global.Config.VSyncThrottle) // when vsync throttle is on, vsync is forced to on, so no change to make here
{
GlobalWin.PresentationPanel.Resized = true;
PresentationPanel.Resized = true;
}
}
@ -2331,7 +2331,7 @@ namespace BizHawk.Client.EmuHawk
private void MainForm_Resize(object sender, EventArgs e)
{
GlobalWin.PresentationPanel.Resized = true;
PresentationPanel.Resized = true;
}
private void MainForm_Shown(object sender, EventArgs e)

View File

@ -210,10 +210,10 @@ namespace BizHawk.Client.EmuHawk
Database.LoadDatabase(Path.Combine(PathManager.GetExeDirectoryAbsolute(), "gamedb", "gamedb.txt"));
//TODO GL - a lot of disorganized wiring-up here
GlobalWin.PresentationPanel = new PresentationPanel();
GlobalWin.DisplayManager = new DisplayManager(GlobalWin.PresentationPanel);
Controls.Add(GlobalWin.PresentationPanel);
Controls.SetChildIndex(GlobalWin.PresentationPanel, 0);
PresentationPanel = new PresentationPanel();
GlobalWin.DisplayManager = new DisplayManager(PresentationPanel);
Controls.Add(PresentationPanel);
Controls.SetChildIndex(PresentationPanel, 0);
//TODO GL - move these event handlers somewhere less obnoxious line in the On* overrides
Load += (o, e) =>
@ -257,9 +257,9 @@ namespace BizHawk.Client.EmuHawk
_inResizeLoop = false;
SetWindowText();
if (GlobalWin.PresentationPanel != null)
if (PresentationPanel != null)
{
GlobalWin.PresentationPanel.Resized = true;
PresentationPanel.Resized = true;
}
if (GlobalWin.Sound != null)
@ -416,7 +416,7 @@ namespace BizHawk.Client.EmuHawk
SynchChrome();
//TODO POOP
GlobalWin.PresentationPanel.Control.Paint += (o, e) =>
PresentationPanel.Control.Paint += (o, e) =>
{
GlobalWin.DisplayManager.NeedsToPaint = true;
};
@ -913,8 +913,8 @@ namespace BizHawk.Client.EmuHawk
int zoom = Global.Config.TargetZoomFactor;
var area = Screen.FromControl(this).WorkingArea;
int borderWidth = Size.Width - GlobalWin.PresentationPanel.Control.Size.Width;
int borderHeight = Size.Height - GlobalWin.PresentationPanel.Control.Size.Height;
int borderWidth = Size.Width - PresentationPanel.Control.Size.Width;
int borderHeight = Size.Height - PresentationPanel.Control.Size.Height;
// start at target zoom and work way down until we find acceptable zoom
Size lastComputedSize = new Size(1, 1);
@ -932,7 +932,7 @@ namespace BizHawk.Client.EmuHawk
// Change size
Size = new Size((lastComputedSize.Width) + borderWidth, ((lastComputedSize.Height) + borderHeight));
PerformLayout();
GlobalWin.PresentationPanel.Resized = true;
PresentationPanel.Resized = true;
// Is window off the screen at this size?
if (area.Contains(Bounds) == false)
@ -1018,7 +1018,7 @@ namespace BizHawk.Client.EmuHawk
WindowState = FormWindowState.Maximized; //be sure to do this after setting the chrome, otherwise it wont work fully
ResumeLayout();
GlobalWin.PresentationPanel.Resized = true;
PresentationPanel.Resized = true;
}
else
{
@ -1285,6 +1285,8 @@ namespace BizHawk.Client.EmuHawk
// input state which has been destined for client hotkey consumption are colesced here
private readonly InputCoalescer HotkeyCoalescer = new InputCoalescer();
public PresentationPanel PresentationPanel { get; set; }
#endregion
#region Private methods
@ -1307,7 +1309,7 @@ namespace BizHawk.Client.EmuHawk
if (_inResizeLoop)
{
var size = GlobalWin.PresentationPanel.NativeSize;
var size = PresentationPanel.NativeSize;
str = str + string.Format("({0}x{1}) - ", size.Width, size.Height);
}

View File

@ -262,7 +262,7 @@ namespace BizHawk.Client.EmuHawk
)]
public static int ScreenHeight()
{
return GlobalWin.PresentationPanel.NativeSize.Height;
return GlobalWin.MainForm.PresentationPanel.NativeSize.Height;
}
[LuaMethodAttributes(
@ -314,7 +314,7 @@ namespace BizHawk.Client.EmuHawk
)]
public static int ScreenWidth()
{
return GlobalWin.PresentationPanel.NativeSize.Width;
return GlobalWin.MainForm.PresentationPanel.NativeSize.Width;
}
[LuaMethodAttributes(