presentation panel - pass in dependencies
This commit is contained in:
parent
640e4260cd
commit
ed45318a75
|
@ -269,7 +269,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
// TODO GL - a lot of disorganized wiring-up here
|
// TODO GL - a lot of disorganized wiring-up here
|
||||||
// installed separately on Unix (via package manager or from https://developer.nvidia.com/cg-toolkit-download), look in $PATH
|
// installed separately on Unix (via package manager or from https://developer.nvidia.com/cg-toolkit-download), look in $PATH
|
||||||
CGC.CGCBinPath = OSTailoredCode.IsUnixHost ? "cgc" : Path.Combine(PathManager.GetDllDirectory(), "cgc.exe");
|
CGC.CGCBinPath = OSTailoredCode.IsUnixHost ? "cgc" : Path.Combine(PathManager.GetDllDirectory(), "cgc.exe");
|
||||||
PresentationPanel = new PresentationPanel
|
PresentationPanel = new PresentationPanel(this, Config, GlobalWin.GL)
|
||||||
{
|
{
|
||||||
GraphicsControl = { MainWindow = true }
|
GraphicsControl = { MainWindow = true }
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,11 +11,15 @@ namespace BizHawk.Client.EmuHawk
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PresentationPanel
|
public class PresentationPanel
|
||||||
{
|
{
|
||||||
public PresentationPanel()
|
private readonly MainForm _mainForm;
|
||||||
{
|
private readonly Config _config;
|
||||||
GL = GlobalWin.GL;
|
|
||||||
|
|
||||||
GraphicsControl = new GraphicsControl(GL)
|
public PresentationPanel(MainForm mainForm, Config config, IGL gl)
|
||||||
|
{
|
||||||
|
_mainForm = mainForm;
|
||||||
|
_config = config;
|
||||||
|
|
||||||
|
GraphicsControl = new GraphicsControl(gl)
|
||||||
{
|
{
|
||||||
Dock = DockStyle.Fill,
|
Dock = DockStyle.Fill,
|
||||||
BackColor = Color.Black
|
BackColor = Color.Black
|
||||||
|
@ -24,9 +28,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
// pass through these events to the form. we might need a more scalable solution for mousedown etc. for zapper and whatnot.
|
// pass through these events to the form. we might need a more scalable solution for mousedown etc. for zapper and whatnot.
|
||||||
// http://stackoverflow.com/questions/547172/pass-through-mouse-events-to-parent-control (HTTRANSPARENT)
|
// http://stackoverflow.com/questions/547172/pass-through-mouse-events-to-parent-control (HTTRANSPARENT)
|
||||||
GraphicsControl.MouseDoubleClick += HandleFullscreenToggle;
|
GraphicsControl.MouseDoubleClick += HandleFullscreenToggle;
|
||||||
GraphicsControl.MouseClick += (o, e) => GlobalWin.MainForm.MainForm_MouseClick(o, e);
|
GraphicsControl.MouseClick += (o, e) => _mainForm.MainForm_MouseClick(o, e);
|
||||||
GraphicsControl.MouseMove += (o, e) => GlobalWin.MainForm.MainForm_MouseMove(o, e);
|
GraphicsControl.MouseMove += (o, e) => _mainForm.MainForm_MouseMove(o, e);
|
||||||
GraphicsControl.MouseWheel += (o, e) => GlobalWin.MainForm.MainForm_MouseWheel(o, e);
|
GraphicsControl.MouseWheel += (o, e) => _mainForm.MainForm_MouseWheel(o, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _isDisposed;
|
private bool _isDisposed;
|
||||||
|
@ -38,7 +42,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
//graphics resources
|
//graphics resources
|
||||||
IGL GL;
|
|
||||||
public GraphicsControl GraphicsControl;
|
public GraphicsControl GraphicsControl;
|
||||||
|
|
||||||
public Control Control => GraphicsControl;
|
public Control Control => GraphicsControl;
|
||||||
|
@ -50,9 +53,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
// allow suppression of the toggle.. but if shift is pressed, always do the toggle
|
// allow suppression of the toggle.. but if shift is pressed, always do the toggle
|
||||||
bool allowSuppress = Control.ModifierKeys != Keys.Shift;
|
bool allowSuppress = Control.ModifierKeys != Keys.Shift;
|
||||||
if (Global.Config.DispChrome_AllowDoubleClickFullscreen || !allowSuppress)
|
if (_config.DispChrome_AllowDoubleClickFullscreen || !allowSuppress)
|
||||||
{
|
{
|
||||||
GlobalWin.MainForm.ToggleFullscreen(allowSuppress);
|
_mainForm.ToggleFullscreen(allowSuppress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue