diff --git a/Source/Core/Builder.csproj b/Source/Core/Builder.csproj index 1f675192..c478d8ec 100644 --- a/Source/Core/Builder.csproj +++ b/Source/Core/Builder.csproj @@ -528,6 +528,7 @@ + diff --git a/Source/Core/Controls/RenderTargetControl.cs b/Source/Core/Controls/RenderTargetControl.cs index f004c8f5..115592a7 100644 --- a/Source/Core/Controls/RenderTargetControl.cs +++ b/Source/Core/Controls/RenderTargetControl.cs @@ -18,6 +18,7 @@ using System.Drawing; using System.Windows.Forms; +using CodeImp.DoomBuilder.Rendering; #endregion @@ -36,7 +37,10 @@ namespace CodeImp.DoomBuilder.Controls #endregion #region ================== Properties + public event KeyEventHandler OnKeyReleased; //mxd. Sometimes it's handeled here, not by MainForm + public Point LocationAbs { get { return this.PointToScreen(new Point(-(General.MainWindow.Width - General.MainWindow.ClientSize.Width) / 2, 0)); } } //mxd + #endregion #region ================== Constructor / Disposer @@ -65,7 +69,7 @@ namespace CodeImp.DoomBuilder.Controls { // Pass on to base // Do we really want this? - base.RaisePaintEvent(this, pe); + if(!D3DDevice.IsRendering) base.RaisePaintEvent(this, pe); //mxd. Dont raise event when in the middle of rendering } //mxd diff --git a/Source/Core/GZBuilder/Windows/ExceptionDialog.cs b/Source/Core/GZBuilder/Windows/ExceptionDialog.cs index 0514a491..4dd1f256 100644 --- a/Source/Core/GZBuilder/Windows/ExceptionDialog.cs +++ b/Source/Core/GZBuilder/Windows/ExceptionDialog.cs @@ -2,6 +2,7 @@ using System; using System.IO; +using System.Management; using System.Windows.Forms; using System.Threading; @@ -36,12 +37,14 @@ namespace CodeImp.DoomBuilder.GZBuilder.Windows logPath = Path.Combine(General.SettingsPath, @"GZCrash.txt"); errorDescription.Text = "Error in " + e.Exception.Source + ":"; + string sysinfo = GetSystemInfo(); using(StreamWriter sw = File.CreateText(logPath)) { - sw.Write(GetExceptionDescription(e.Exception)); + sw.Write(sysinfo + GetExceptionDescription(e.Exception)); } - errorMessage.Text = e.Exception.Message + Environment.NewLine + e.Exception.StackTrace; + errorMessage.Text = sysinfo + "********EXCEPTION DETAILS********" + Environment.NewLine + + e.Exception.Message + Environment.NewLine + e.Exception.StackTrace; } public void Setup() @@ -114,12 +117,43 @@ namespace CodeImp.DoomBuilder.GZBuilder.Windows "It's CRASHENING!", "W-W-W-WIPEOUT!", "EVERYTHING IS LOST!", - "Your empty is full!", - "Let's see how far this infinite loop goes...", + "Your empty is full!", + "Let's see how far this infinite loop goes...", }; this.Text = titles[new Random().Next(0, titles.Length - 1)]; } + private static string GetSystemInfo() + { + string result = "***********SYSTEM INFO***********" + Environment.NewLine; + + // Get OS name + ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT Caption FROM Win32_OperatingSystem"); + foreach(ManagementObject mo in searcher.Get()) + { + result += "OS: " + mo["Caption"] + Environment.NewLine; + break; + } + + // Get GPU name + searcher = new ManagementObjectSearcher("SELECT * FROM Win32_VideoController"); + foreach(ManagementObject mo in searcher.Get()) + { + PropertyData bpp = mo.Properties["CurrentBitsPerPixel"]; + PropertyData description = mo.Properties["Description"]; + if(bpp != null && description != null && bpp.Value != null) + { + result += "GPU: " + description.Value + Environment.NewLine; + break; + } + } + + // Get GZDB version + result += "GZDB: R" + General.ThisAssembly.GetName().Version.Revision + Environment.NewLine + Environment.NewLine; + + return result; + } + private static string GetExceptionDescription(Exception ex) { //add to error logger diff --git a/Source/Core/GZBuilder/Windows/ExceptionDialog.designer.cs b/Source/Core/GZBuilder/Windows/ExceptionDialog.designer.cs index 8399daa8..79cb1817 100644 --- a/Source/Core/GZBuilder/Windows/ExceptionDialog.designer.cs +++ b/Source/Core/GZBuilder/Windows/ExceptionDialog.designer.cs @@ -41,23 +41,27 @@ // // bQuit // - this.bQuit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.bQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.bQuit.Location = new System.Drawing.Point(537, 195); + this.bQuit.Image = global::CodeImp.DoomBuilder.Properties.Resources.SearchClear; + this.bQuit.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.bQuit.Location = new System.Drawing.Point(537, 212); this.bQuit.Name = "bQuit"; - this.bQuit.Size = new System.Drawing.Size(75, 23); + this.bQuit.Size = new System.Drawing.Size(75, 28); this.bQuit.TabIndex = 0; this.bQuit.Text = "Quit"; + this.bQuit.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.bQuit.UseVisualStyleBackColor = true; // // bContinue // - this.bContinue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bContinue.Location = new System.Drawing.Point(456, 195); + this.bContinue.Image = global::CodeImp.DoomBuilder.Properties.Resources.Test; + this.bContinue.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.bContinue.Location = new System.Drawing.Point(446, 212); this.bContinue.Name = "bContinue"; - this.bContinue.Size = new System.Drawing.Size(75, 23); + this.bContinue.Size = new System.Drawing.Size(85, 28); this.bContinue.TabIndex = 1; this.bContinue.Text = "Continue"; + this.bContinue.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.bContinue.UseVisualStyleBackColor = true; this.bContinue.Click += new System.EventHandler(this.bContinue_Click); // @@ -67,7 +71,7 @@ this.errorMessage.Multiline = true; this.errorMessage.Name = "errorMessage"; this.errorMessage.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.errorMessage.Size = new System.Drawing.Size(535, 119); + this.errorMessage.Size = new System.Drawing.Size(535, 151); this.errorMessage.TabIndex = 3; this.errorMessage.Text = "Stack trace"; // @@ -85,7 +89,7 @@ this.reportLink.AutoSize = true; this.reportLink.LinkArea = new System.Windows.Forms.LinkArea(53, 4); this.reportLink.LinkColor = System.Drawing.SystemColors.HotTrack; - this.reportLink.Location = new System.Drawing.Point(77, 157); + this.reportLink.Location = new System.Drawing.Point(77, 188); this.reportLink.Name = "reportLink"; this.reportLink.Size = new System.Drawing.Size(286, 17); this.reportLink.TabIndex = 5; @@ -99,7 +103,7 @@ this.threadLink.AutoSize = true; this.threadLink.LinkArea = new System.Windows.Forms.LinkArea(101, 28); this.threadLink.LinkColor = System.Drawing.SystemColors.HotTrack; - this.threadLink.Location = new System.Drawing.Point(77, 178); + this.threadLink.Location = new System.Drawing.Point(77, 210); this.threadLink.Name = "threadLink"; this.threadLink.Size = new System.Drawing.Size(349, 30); this.threadLink.TabIndex = 8; @@ -112,9 +116,11 @@ // bToClipboard // this.bToClipboard.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bToClipboard.Location = new System.Drawing.Point(512, 151); + this.bToClipboard.Image = global::CodeImp.DoomBuilder.Properties.Resources.Copy; + this.bToClipboard.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.bToClipboard.Location = new System.Drawing.Point(446, 184); this.bToClipboard.Name = "bToClipboard"; - this.bToClipboard.Size = new System.Drawing.Size(100, 23); + this.bToClipboard.Size = new System.Drawing.Size(166, 24); this.bToClipboard.TabIndex = 9; this.bToClipboard.Text = "Copy to clipboard"; this.bToClipboard.UseVisualStyleBackColor = true; @@ -136,7 +142,7 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.CancelButton = this.bQuit; - this.ClientSize = new System.Drawing.Size(624, 224); + this.ClientSize = new System.Drawing.Size(624, 244); this.Controls.Add(this.reportLink); this.Controls.Add(this.errorDescription); this.Controls.Add(this.bToClipboard); diff --git a/Source/Core/Plugins/Plug.cs b/Source/Core/Plugins/Plug.cs index cb1231cf..d920c9b6 100644 --- a/Source/Core/Plugins/Plug.cs +++ b/Source/Core/Plugins/Plug.cs @@ -33,18 +33,6 @@ namespace CodeImp.DoomBuilder.Plugins // Disposing private bool isdisposed; - //mxd. It's nice to have these avaliable to plugins... - public static Point DisplayLocationAbs { - get { - if (General.MainWindow == null || General.MainWindow.Display == null) - return new Point(); - return new Point(General.MainWindow.Location.X + General.MainWindow.ClientRectangle.X + General.MainWindow.Display.Location.X, General.MainWindow.Location.Y + General.MainWindow.ClientRectangle.Y + General.MainWindow.Display.Location.Y); - } - } - - //mxd. It's nice to have these avaliable to plugins... - public static Size DisplaySize { get { return (General.MainWindow == null || General.MainWindow.Display == null) ? new Size() : General.MainWindow.Display.Size; } } - #endregion #region ================== Properties diff --git a/Source/Core/Rendering/D3DDevice.cs b/Source/Core/Rendering/D3DDevice.cs index 7dacdedf..230e4a15 100644 --- a/Source/Core/Rendering/D3DDevice.cs +++ b/Source/Core/Rendering/D3DDevice.cs @@ -45,6 +45,7 @@ namespace CodeImp.DoomBuilder.Rendering private int adapter; private Filter postfilter; private Filter mipgeneratefilter; + private static bool isrendering; //mxd // Main objects private static Direct3D d3d; @@ -68,6 +69,7 @@ namespace CodeImp.DoomBuilder.Rendering internal Device Device { get { return device; } } public bool IsDisposed { get { return isdisposed; } } + public static bool IsRendering { get { return isrendering; } } //mxd internal RenderTargetControl RenderTarget { get { return rendertarget; } } internal Viewport Viewport { get { return viewport; } } internal ShaderManager Shaders { get { return shaders; } } @@ -110,6 +112,7 @@ namespace CodeImp.DoomBuilder.Rendering if(device != null) device.Dispose(); if(font != null) font.Dispose(); if(fonttexture != null) fonttexture.Dispose(); + isrendering = false; //mxd // Done isdisposed = true; @@ -445,7 +448,7 @@ namespace CodeImp.DoomBuilder.Rendering public bool StartRendering(bool clear, Color4 backcolor, Surface target, Surface depthbuffer) { // Check if we can render - if(CheckAvailability()) + if(CheckAvailability() && !isrendering) //mxd. Added isrendering check { // Set rendertarget device.DepthStencilSurface = depthbuffer; @@ -462,11 +465,13 @@ namespace CodeImp.DoomBuilder.Rendering // Ready to render device.BeginScene(); + isrendering = true; //mxd return true; } else { // Minimized, you cannot see anything + isrendering = false; //mxd return false; } } @@ -491,6 +496,7 @@ namespace CodeImp.DoomBuilder.Rendering { // Done device.EndScene(); + isrendering = false; //mxd } // Errors are not a problem here catch(Exception) { } @@ -502,6 +508,7 @@ namespace CodeImp.DoomBuilder.Rendering try { device.Present(); + isrendering = false; //mxd } // Errors are not a problem here catch(Exception) { } diff --git a/Source/Core/Rendering/IRenderer2D.cs b/Source/Core/Rendering/IRenderer2D.cs index 0819576d..314a89fa 100644 --- a/Source/Core/Rendering/IRenderer2D.cs +++ b/Source/Core/Rendering/IRenderer2D.cs @@ -37,7 +37,6 @@ namespace CodeImp.DoomBuilder.Rendering float Scale { get; } int VertexSize { get; } ViewMode ViewMode { get; } - Size ViewportSize { get; } //mxd // View methods Vector2D DisplayToMap(Vector2D mousepos); diff --git a/Source/Core/Rendering/Renderer.cs b/Source/Core/Rendering/Renderer.cs index ce8eac55..85d8c7f3 100644 --- a/Source/Core/Rendering/Renderer.cs +++ b/Source/Core/Rendering/Renderer.cs @@ -47,7 +47,6 @@ namespace CodeImp.DoomBuilder.Rendering // Disposing public bool IsDisposed { get { return isdisposed; } } public static bool FullBrightness { get { return fullbrightness; } set { fullbrightness = value; } } //mxd - public Size ViewportSize { get { return graphics.RenderTarget.Size; } } //mxd #endregion diff --git a/Source/Core/Windows/MainForm.cs b/Source/Core/Windows/MainForm.cs index 41ed94de..0323444f 100644 --- a/Source/Core/Windows/MainForm.cs +++ b/Source/Core/Windows/MainForm.cs @@ -1075,6 +1075,9 @@ namespace CodeImp.DoomBuilder.Windows // Resizing //if(!displayresized) General.LockWindowUpdate(display.Handle); displayresized = true; + + //mxd. Separators may need updating + UpdateSeparators(); // Request redraw if(!redrawtimer.Enabled) redrawtimer.Enabled = true; diff --git a/Source/Plugins/BuilderEffects/BuilderPlug.cs b/Source/Plugins/BuilderEffects/BuilderPlug.cs index 7fc0aba8..a8a69bfc 100644 --- a/Source/Plugins/BuilderEffects/BuilderPlug.cs +++ b/Source/Plugins/BuilderEffects/BuilderPlug.cs @@ -162,11 +162,11 @@ namespace CodeImp.DoomBuilder.BuilderEffects } //position and show form - if(formLocation.X == 0 && formLocation.Y == 0) + if(formLocation.X == 0 && formLocation.Y == 0) { - Size displaySize = DisplaySize; - Point displayLocation = DisplayLocationAbs; - formLocation = new Point(displayLocation.X + displaySize.Width - form.Width - 16, displayLocation.Y + 32); + Size displaySize = General.Interface.Display.Size; + Point displayLocation = General.Interface.Display.LocationAbs; + formLocation = new Point(displayLocation.X + displaySize.Width - form.Width - 16, displayLocation.Y + 16); } form.Location = formLocation; diff --git a/Source/Plugins/BuilderModes/General/HintLabel.cs b/Source/Plugins/BuilderModes/General/HintLabel.cs index a390fb68..4d945d42 100644 --- a/Source/Plugins/BuilderModes/General/HintLabel.cs +++ b/Source/Plugins/BuilderModes/General/HintLabel.cs @@ -25,8 +25,8 @@ namespace CodeImp.DoomBuilder.BuilderModes this.end = end; // Check if start/end point is on screen... - Vector2D lt = General.Map.Renderer2D.DisplayToMap(new Vector2D(0.0f, General.Map.Renderer2D.ViewportSize.Height)); - Vector2D rb = General.Map.Renderer2D.DisplayToMap(new Vector2D(General.Map.Renderer2D.ViewportSize.Width, 0.0f)); + Vector2D lt = General.Map.Renderer2D.DisplayToMap(new Vector2D(0.0f, General.Interface.Display.Size.Height)); + Vector2D rb = General.Map.Renderer2D.DisplayToMap(new Vector2D(General.Interface.Display.Size.Width, 0.0f)); RectangleF viewport = new RectangleF(lt.x, lt.y, rb.x - lt.x, rb.y - lt.y); bool startvisible = viewport.Contains(start.x, start.y); bool endvisible = viewport.Contains(end.x, end.y); diff --git a/Source/Plugins/BuilderModes/General/LineLengthLabel.cs b/Source/Plugins/BuilderModes/General/LineLengthLabel.cs index b23fea20..5dd4a40c 100644 --- a/Source/Plugins/BuilderModes/General/LineLengthLabel.cs +++ b/Source/Plugins/BuilderModes/General/LineLengthLabel.cs @@ -153,8 +153,8 @@ namespace CodeImp.DoomBuilder.BuilderModes UpdateText(); // Check if start/end point is on screen... - Vector2D lt = General.Map.Renderer2D.DisplayToMap(new Vector2D(0.0f, General.Map.Renderer2D.ViewportSize.Height)); - Vector2D rb = General.Map.Renderer2D.DisplayToMap(new Vector2D(General.Map.Renderer2D.ViewportSize.Width, 0.0f)); + Vector2D lt = General.Map.Renderer2D.DisplayToMap(new Vector2D(0.0f, General.Interface.Display.Size.Height)); + Vector2D rb = General.Map.Renderer2D.DisplayToMap(new Vector2D(General.Interface.Display.Size.Width, 0.0f)); RectangleF viewport = new RectangleF(lt.x, lt.y, rb.x - lt.x, rb.y - lt.y); bool startvisible = viewport.Contains(start.x, start.y); bool endvisible = viewport.Contains(end.x, end.y); diff --git a/Source/Plugins/ColorPicker/BuilderPlug.cs b/Source/Plugins/ColorPicker/BuilderPlug.cs index 34141a5a..909c99c4 100644 --- a/Source/Plugins/ColorPicker/BuilderPlug.cs +++ b/Source/Plugins/ColorPicker/BuilderPlug.cs @@ -142,9 +142,9 @@ namespace CodeImp.DoomBuilder.ColorPicker { if (formLocation.X == 0 && formLocation.Y == 0) { - Size displaySize = DisplaySize; - Point displayLocation = DisplayLocationAbs; - formLocation = new Point(displayLocation.X + displaySize.Width - form.Width - 16, displayLocation.Y + 32); + Size displaySize = General.Interface.Display.Size; + Point displayLocation = General.Interface.Display.LocationAbs; + formLocation = new Point(displayLocation.X + displaySize.Width - form.Width - 16, displayLocation.Y + 16); } form.Location = formLocation; form.FormClosed += form_FormClosed;