2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
|
|
* This program is released under GNU General Public License
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
using System.Drawing;
|
|
|
|
using System.Windows.Forms;
|
2015-09-17 12:02:39 +00:00
|
|
|
using CodeImp.DoomBuilder.Rendering;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.Controls
|
|
|
|
{
|
2009-08-21 14:11:18 +00:00
|
|
|
public class RenderTargetControl : Panel
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
|
|
|
#region ================== Constants
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Variables
|
|
|
|
|
2016-07-02 22:27:20 +00:00
|
|
|
private ToolTip tooltip; //mxd
|
2015-07-14 09:02:48 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Properties
|
2015-09-17 12:02:39 +00:00
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
public event KeyEventHandler OnKeyReleased; //mxd. Sometimes it's handeled here, not by MainForm
|
2015-09-17 12:02:39 +00:00
|
|
|
public Point LocationAbs { get { return this.PointToScreen(new Point(-(General.MainWindow.Width - General.MainWindow.ClientSize.Width) / 2, 0)); } } //mxd
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Constructor / Disposer
|
|
|
|
|
|
|
|
// Constructor
|
2009-08-21 14:11:18 +00:00
|
|
|
internal RenderTargetControl()
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
|
|
|
// Initialize
|
|
|
|
this.SetStyle(ControlStyles.FixedWidth, true);
|
|
|
|
this.SetStyle(ControlStyles.FixedHeight, true);
|
2015-07-14 09:02:48 +00:00
|
|
|
|
|
|
|
//mxd. Create tooltip
|
2016-07-02 22:27:20 +00:00
|
|
|
tooltip = new ToolTip { UseAnimation = false, UseFading = false, InitialDelay = 0, AutoPopDelay = 9000 };
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
protected override void Dispose(bool disposing)
|
|
|
|
{
|
|
|
|
if(disposing)
|
|
|
|
{
|
|
|
|
tooltip.Dispose();
|
|
|
|
tooltip = null;
|
|
|
|
}
|
|
|
|
base.Dispose(disposing);
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Overrides
|
|
|
|
|
2020-09-13 21:01:38 +00:00
|
|
|
#if MONO_WINFORMS
|
|
|
|
// This workarounds menubar getting the focus all the time
|
|
|
|
protected override bool IsInputChar(char charCode)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
//mxd
|
2014-12-03 23:15:26 +00:00
|
|
|
protected override void OnKeyUp(KeyEventArgs e)
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
if(OnKeyReleased != null) OnKeyReleased(this, e);
|
|
|
|
}
|
2011-07-26 18:16:52 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Methods
|
|
|
|
|
|
|
|
// This sets up the control to display the splash logo
|
|
|
|
public void SetSplashLogoDisplay()
|
|
|
|
{
|
|
|
|
// Change display to show splash logo
|
|
|
|
this.SetStyle(ControlStyles.SupportsTransparentBackColor, false);
|
|
|
|
this.SetStyle(ControlStyles.ContainerControl, true);
|
|
|
|
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
|
|
|
this.SetStyle(ControlStyles.UserPaint, true);
|
|
|
|
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
|
|
|
this.SetStyle(ControlStyles.Opaque, false);
|
|
|
|
this.UpdateStyles();
|
2019-12-24 09:59:58 +00:00
|
|
|
this.BackColor = Color.FromArgb(32, 32, 40);
|
2014-02-21 14:42:12 +00:00
|
|
|
this.BackgroundImage = Properties.Resources.Splash3_trans;
|
|
|
|
this.BackgroundImageLayout = ImageLayout.Center;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// This sets up the control for manual rendering
|
|
|
|
public void SetManualRendering()
|
|
|
|
{
|
|
|
|
// Change display for rendering
|
|
|
|
this.SetStyle(ControlStyles.SupportsTransparentBackColor, false);
|
|
|
|
this.SetStyle(ControlStyles.ContainerControl, true);
|
|
|
|
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, false);
|
|
|
|
this.SetStyle(ControlStyles.UserPaint, true);
|
|
|
|
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
|
|
|
this.SetStyle(ControlStyles.Opaque, true);
|
|
|
|
this.UpdateStyles();
|
|
|
|
this.BackColor = Color.Black;
|
|
|
|
this.BackgroundImage = null;
|
2014-02-21 14:42:12 +00:00
|
|
|
this.BackgroundImageLayout = ImageLayout.None;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
2015-07-14 09:02:48 +00:00
|
|
|
//mxd. This shows tooltip at given position
|
|
|
|
public void ShowToolTip(string title, string text, int x, int y)
|
|
|
|
{
|
2016-07-02 22:27:20 +00:00
|
|
|
tooltip.ToolTipTitle = title;
|
|
|
|
tooltip.Show(text, this, x, y);
|
2015-07-14 09:02:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//mxd. This hides it
|
|
|
|
public void HideToolTip()
|
|
|
|
{
|
2016-07-02 22:27:20 +00:00
|
|
|
tooltip.Hide(this);
|
2015-07-14 09:02:48 +00:00
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|