mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
added a workaround for slow .NET forms showing
This commit is contained in:
parent
3066b1bf68
commit
7d7cc2363d
13 changed files with 139 additions and 11 deletions
|
@ -15,9 +15,9 @@ shortcuts
|
|||
mainwindow
|
||||
{
|
||||
positionx = 124;
|
||||
windowstate = 2;
|
||||
positiony = 35;
|
||||
sizeheight = 572;
|
||||
sizewidth = 739;
|
||||
windowstate = 2;
|
||||
sizeheight = 572;
|
||||
positiony = 35;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,9 @@
|
|||
<Compile Include="Interface\AboutForm.Designer.cs">
|
||||
<DependentUpon>AboutForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Interface\DelayedForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Interface\MapOptionsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
|
|
@ -27,7 +27,7 @@ using System.Windows.Forms;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class AboutForm : Form
|
||||
public partial class AboutForm : DelayedForm
|
||||
{
|
||||
// Constructor
|
||||
public AboutForm()
|
||||
|
|
76
Source/Interface/DelayedForm.cs
Normal file
76
Source/Interface/DelayedForm.cs
Normal file
|
@ -0,0 +1,76 @@
|
|||
|
||||
#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;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public class DelayedForm : Form
|
||||
{
|
||||
#region ================== Variables
|
||||
|
||||
private Timer formshowtimer;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor
|
||||
|
||||
// Constructor
|
||||
public DelayedForm()
|
||||
{
|
||||
// Create a timer that we need to show the form
|
||||
formshowtimer = new Timer();
|
||||
formshowtimer.Interval = 1;
|
||||
formshowtimer.Tick += new EventHandler(formshowtimer_Tick);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// When form is shown
|
||||
protected override void OnShown(EventArgs e)
|
||||
{
|
||||
// Let the base class know
|
||||
base.OnShown(e);
|
||||
|
||||
// Start the timer to show the form
|
||||
formshowtimer.Enabled = true;
|
||||
}
|
||||
|
||||
// When the form is to be shown
|
||||
void formshowtimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
// Get rid of the timer
|
||||
formshowtimer.Dispose();
|
||||
formshowtimer = null;
|
||||
|
||||
// Make the form visible
|
||||
this.Opacity = 100;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
2
Source/Interface/MainForm.Designer.cs
generated
2
Source/Interface/MainForm.Designer.cs
generated
|
@ -231,11 +231,13 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.KeyPreview = true;
|
||||
this.MainMenuStrip = this.menumain;
|
||||
this.Name = "MainForm";
|
||||
this.Opacity = 0;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||
this.Text = "Doom Builder";
|
||||
this.Resize += new System.EventHandler(this.MainForm_Resize);
|
||||
this.Move += new System.EventHandler(this.MainForm_Move);
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
|
||||
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.MainForm_KeyUp);
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MainForm_KeyDown);
|
||||
this.ResizeEnd += new System.EventHandler(this.MainForm_ResizeEnd);
|
||||
this.Load += new System.EventHandler(this.MainForm_Load);
|
||||
|
|
|
@ -28,7 +28,7 @@ using CodeImp.DoomBuilder.Controls;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
public partial class MainForm : DelayedForm
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
@ -46,6 +46,9 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
// Mouse in display
|
||||
private bool mouseinside;
|
||||
|
||||
// Input
|
||||
private bool shift, ctrl, alt;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
@ -278,13 +281,54 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
|
||||
#region ================== Input
|
||||
|
||||
// When the mouse wheel is changed
|
||||
protected override void OnMouseWheel(MouseEventArgs e)
|
||||
{
|
||||
int mod = 0;
|
||||
|
||||
// Create modifiers
|
||||
if(alt) mod |= (int)Keys.Alt;
|
||||
if(shift) mod |= (int)Keys.Shift;
|
||||
if(ctrl) mod |= (int)Keys.Control;
|
||||
|
||||
// Scrollwheel up?
|
||||
if(e.Delta > 0)
|
||||
{
|
||||
// Invoke actions for scrollwheel
|
||||
General.Actions.InvokeByKey(mod | (int)SpecialKeys.MScrollUp);
|
||||
}
|
||||
// Scrollwheel down?
|
||||
else if(e.Delta < 0)
|
||||
{
|
||||
// Invoke actions for scrollwheel
|
||||
General.Actions.InvokeByKey(mod | (int)SpecialKeys.MScrollDown);
|
||||
}
|
||||
|
||||
// Let the base know
|
||||
base.OnMouseWheel(e);
|
||||
}
|
||||
|
||||
// When a key is pressed
|
||||
private void MainForm_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
// Keep key modifiers
|
||||
alt = e.Alt;
|
||||
shift = e.Shift;
|
||||
ctrl = e.Control;
|
||||
|
||||
// Invoke any actions associated with this key
|
||||
General.Actions.InvokeByKey((int)e.KeyData);
|
||||
}
|
||||
|
||||
// When a key is released
|
||||
private void MainForm_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
// Keep key modifiers
|
||||
alt = e.Alt;
|
||||
shift = e.Shift;
|
||||
ctrl = e.Control;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Menus
|
||||
|
|
|
@ -123,12 +123,12 @@
|
|||
<metadata name="menumain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="toolbar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>121, 17</value>
|
||||
</metadata>
|
||||
<metadata name="toolbar.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="toolbar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>121, 17</value>
|
||||
</metadata>
|
||||
<metadata name="statusbar.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
|
1
Source/Interface/MapOptionsForm.Designer.cs
generated
1
Source/Interface/MapOptionsForm.Designer.cs
generated
|
@ -204,6 +204,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "MapOptionsForm";
|
||||
this.Opacity = 0;
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
|
|
|
@ -28,7 +28,7 @@ using CodeImp.DoomBuilder.Map;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
internal partial class MapOptionsForm : Form
|
||||
internal partial class MapOptionsForm : DelayedForm
|
||||
{
|
||||
// Variables
|
||||
private MapOptions options;
|
||||
|
|
1
Source/Interface/OpenMapOptionsForm.Designer.cs
generated
1
Source/Interface/OpenMapOptionsForm.Designer.cs
generated
|
@ -196,6 +196,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "OpenMapOptionsForm";
|
||||
this.Opacity = 0;
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
|
|
|
@ -32,7 +32,7 @@ using System.Diagnostics;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
internal partial class OpenMapOptionsForm : Form
|
||||
internal partial class OpenMapOptionsForm : DelayedForm
|
||||
{
|
||||
// Variables
|
||||
private Configuration mapsettings;
|
||||
|
|
1
Source/Interface/ResourceOptionsForm.Designer.cs
generated
1
Source/Interface/ResourceOptionsForm.Designer.cs
generated
|
@ -220,6 +220,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "ResourceOptionsForm";
|
||||
this.Opacity = 0;
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
|
|
|
@ -29,7 +29,7 @@ using System.IO;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
internal partial class ResourceOptionsForm : Form
|
||||
internal partial class ResourceOptionsForm : DelayedForm
|
||||
{
|
||||
// Variables
|
||||
private ResourceLocation res;
|
||||
|
|
Loading…
Reference in a new issue