diff --git a/Build/Builder.cfg b/Build/Builder.cfg index cf32d029..486006fa 100644 --- a/Build/Builder.cfg +++ b/Build/Builder.cfg @@ -15,9 +15,9 @@ shortcuts mainwindow { positionx = 124; - windowstate = 2; - positiony = 35; - sizeheight = 572; sizewidth = 739; + windowstate = 2; + sizeheight = 572; + positiony = 35; } diff --git a/Source/Builder.csproj b/Source/Builder.csproj index 019ea5da..abfec404 100644 --- a/Source/Builder.csproj +++ b/Source/Builder.csproj @@ -64,6 +64,9 @@ AboutForm.cs + + Form + Form diff --git a/Source/Interface/AboutForm.cs b/Source/Interface/AboutForm.cs index a0743fbb..def15c4d 100644 --- a/Source/Interface/AboutForm.cs +++ b/Source/Interface/AboutForm.cs @@ -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() diff --git a/Source/Interface/DelayedForm.cs b/Source/Interface/DelayedForm.cs new file mode 100644 index 00000000..eb7750ba --- /dev/null +++ b/Source/Interface/DelayedForm.cs @@ -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 + } +} diff --git a/Source/Interface/MainForm.Designer.cs b/Source/Interface/MainForm.Designer.cs index c8707d94..c27ef8bd 100644 --- a/Source/Interface/MainForm.Designer.cs +++ b/Source/Interface/MainForm.Designer.cs @@ -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); diff --git a/Source/Interface/MainForm.cs b/Source/Interface/MainForm.cs index 667ad138..7650156b 100644 --- a/Source/Interface/MainForm.cs +++ b/Source/Interface/MainForm.cs @@ -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 diff --git a/Source/Interface/MainForm.resx b/Source/Interface/MainForm.resx index 9598dc33..5b98b04e 100644 --- a/Source/Interface/MainForm.resx +++ b/Source/Interface/MainForm.resx @@ -123,12 +123,12 @@ 17, 17 - - 121, 17 - True + + 121, 17 + True diff --git a/Source/Interface/MapOptionsForm.Designer.cs b/Source/Interface/MapOptionsForm.Designer.cs index 410d722a..258ec2f7 100644 --- a/Source/Interface/MapOptionsForm.Designer.cs +++ b/Source/Interface/MapOptionsForm.Designer.cs @@ -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; diff --git a/Source/Interface/MapOptionsForm.cs b/Source/Interface/MapOptionsForm.cs index f81aedf5..477add30 100644 --- a/Source/Interface/MapOptionsForm.cs +++ b/Source/Interface/MapOptionsForm.cs @@ -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; diff --git a/Source/Interface/OpenMapOptionsForm.Designer.cs b/Source/Interface/OpenMapOptionsForm.Designer.cs index 6897f03d..e75bd179 100644 --- a/Source/Interface/OpenMapOptionsForm.Designer.cs +++ b/Source/Interface/OpenMapOptionsForm.Designer.cs @@ -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; diff --git a/Source/Interface/OpenMapOptionsForm.cs b/Source/Interface/OpenMapOptionsForm.cs index 13705921..bf7e0c50 100644 --- a/Source/Interface/OpenMapOptionsForm.cs +++ b/Source/Interface/OpenMapOptionsForm.cs @@ -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; diff --git a/Source/Interface/ResourceOptionsForm.Designer.cs b/Source/Interface/ResourceOptionsForm.Designer.cs index 542528de..2e750a8d 100644 --- a/Source/Interface/ResourceOptionsForm.Designer.cs +++ b/Source/Interface/ResourceOptionsForm.Designer.cs @@ -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; diff --git a/Source/Interface/ResourceOptionsForm.cs b/Source/Interface/ResourceOptionsForm.cs index dbf21a49..7069452c 100644 --- a/Source/Interface/ResourceOptionsForm.cs +++ b/Source/Interface/ResourceOptionsForm.cs @@ -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;