diff --git a/Resources/Icons/ThingsMode.png b/Resources/Icons/ThingsMode.png index d0f5e5bc..70773256 100644 Binary files a/Resources/Icons/ThingsMode.png and b/Resources/Icons/ThingsMode.png differ diff --git a/Source/Builder.csproj b/Source/Builder.csproj index bef6761f..79ab1ce9 100644 --- a/Source/Builder.csproj +++ b/Source/Builder.csproj @@ -111,6 +111,7 @@ ImageBrowser.cs + UserControl @@ -263,11 +264,11 @@ + - diff --git a/Source/Interface/ImageBrowser.Designer.cs b/Source/Interface/ImageBrowser.Designer.cs index d7f6cda1..d5d64d23 100644 --- a/Source/Interface/ImageBrowser.Designer.cs +++ b/Source/Interface/ImageBrowser.Designer.cs @@ -60,7 +60,7 @@ namespace CodeImp.DoomBuilder.Interface this.rendertarget.Location = new System.Drawing.Point(0, 0); this.rendertarget.Name = "rendertarget"; this.rendertarget.Size = new System.Drawing.Size(518, 310); - this.rendertarget.TabIndex = 0; + this.rendertarget.TabIndex = 3; this.rendertarget.TabStop = false; // // ImageBrowser diff --git a/Source/Interface/ImageBrowser.cs b/Source/Interface/ImageBrowser.cs index 04518103..66df8164 100644 --- a/Source/Interface/ImageBrowser.cs +++ b/Source/Interface/ImageBrowser.cs @@ -27,6 +27,7 @@ using System.Diagnostics; using CodeImp.DoomBuilder.Controls; using CodeImp.DoomBuilder.Data; using CodeImp.DoomBuilder.Config; +using CodeImp.DoomBuilder.Rendering; #endregion @@ -43,13 +44,18 @@ namespace CodeImp.DoomBuilder.Interface #region ================== Variables - // Number of items horizontally - private int numitemswidth; + // Graphics device for rendering + private D3DDevice graphics; + + // Items list + private List items; #endregion #region ================== Properties + public int Count { get { return items.Count; } } + #endregion #region ================== Constructor / Disposer @@ -57,7 +63,12 @@ namespace CodeImp.DoomBuilder.Interface // Constructor public ImageBrowser() { + // Make graphics device + graphics = new D3DDevice(rendertarget); + graphics.Initialize(); + // Make items list + items = new List(); // Initialize InitializeComponent(); @@ -70,6 +81,8 @@ namespace CodeImp.DoomBuilder.Interface // When resized protected override void OnResize(EventArgs e) { + // Redraw + Redraw(); // Call base base.OnResize(e); @@ -77,19 +90,31 @@ namespace CodeImp.DoomBuilder.Interface #endregion - #region ================== Controls + #region ================== Rendering + // This redraws the list + public void Redraw() + { + int numitemswide; + + // Calculate number of items wide + numitemswide = (int)Math.Floor((float)ClientSize.Width / (float)ITEM_WIDTH); + } + #endregion #region ================== Methods // This adds an item - public void Add(string name, ImageData image, object tag) + public void Add(string text, ImageData image, object tag) { + ImageBrowserItem i; + // Make new item + i = new ImageBrowserItem(text, image, tag); // Add item to list - + items.Add(i); } #endregion diff --git a/Source/Interface/ImageBrowserItem.cs b/Source/Interface/ImageBrowserItem.cs new file mode 100644 index 00000000..72adddaa --- /dev/null +++ b/Source/Interface/ImageBrowserItem.cs @@ -0,0 +1,52 @@ + +#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; +using Microsoft.Win32; +using System.Diagnostics; +using CodeImp.DoomBuilder.Controls; +using CodeImp.DoomBuilder.Data; +using CodeImp.DoomBuilder.Config; +using CodeImp.DoomBuilder.Rendering; + +#endregion + +namespace CodeImp.DoomBuilder.Interface +{ + internal struct ImageBrowserItem + { + // Variables + public string text; + public ImageData image; + public object tag; + + // Constructors + public ImageBrowserItem(string text, ImageData image, object tag) + { + // Initialize + this.text = text; + this.image = image; + this.tag = tag; + } + } +} diff --git a/Source/Interface/MainForm.Designer.cs b/Source/Interface/MainForm.Designer.cs index 08d93195..594d7816 100644 --- a/Source/Interface/MainForm.Designer.cs +++ b/Source/Interface/MainForm.Designer.cs @@ -91,6 +91,7 @@ namespace CodeImp.DoomBuilder.Interface this.linedefinfo = new CodeImp.DoomBuilder.Interface.LinedefInfoPanel(); this.redrawtimer = new System.Windows.Forms.Timer(this.components); this.display = new CodeImp.DoomBuilder.Interface.RenderTargetControl(); + this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator(); @@ -101,7 +102,6 @@ namespace CodeImp.DoomBuilder.Interface this.toolbar.SuspendLayout(); this.statusbar.SuspendLayout(); this.panelinfo.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.display)).BeginInit(); this.SuspendLayout(); // // toolStripMenuItem1 @@ -357,7 +357,8 @@ namespace CodeImp.DoomBuilder.Interface this.buttonverticesmode, this.buttonlinedefsmode, this.buttonsectorsmode, - this.buttonthingsmode}); + this.buttonthingsmode, + this.toolStripSeparator7}); this.toolbar.Location = new System.Drawing.Point(0, 24); this.toolbar.Name = "toolbar"; this.toolbar.Size = new System.Drawing.Size(839, 25); @@ -398,7 +399,7 @@ namespace CodeImp.DoomBuilder.Interface // // toolStripSeparator3 // - this.toolStripSeparator3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.toolStripSeparator3.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25); // @@ -415,7 +416,7 @@ namespace CodeImp.DoomBuilder.Interface // // toolStripSeparator5 // - this.toolStripSeparator5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.toolStripSeparator5.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); this.toolStripSeparator5.Name = "toolStripSeparator5"; this.toolStripSeparator5.Size = new System.Drawing.Size(6, 25); // @@ -678,6 +679,12 @@ namespace CodeImp.DoomBuilder.Interface this.display.MouseUp += new System.Windows.Forms.MouseEventHandler(this.display_MouseUp); this.display.MouseEnter += new System.EventHandler(this.display_MouseEnter); // + // toolStripSeparator7 + // + this.toolStripSeparator7.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); + this.toolStripSeparator7.Name = "toolStripSeparator7"; + this.toolStripSeparator7.Size = new System.Drawing.Size(6, 25); + // // MainForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -708,7 +715,6 @@ namespace CodeImp.DoomBuilder.Interface this.statusbar.ResumeLayout(false); this.statusbar.PerformLayout(); this.panelinfo.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.display)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -771,5 +777,6 @@ namespace CodeImp.DoomBuilder.Interface private VertexInfoPanel vertexinfo; private SectorInfoPanel sectorinfo; private ThingInfoPanel thinginfo; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator7; } } \ No newline at end of file diff --git a/Source/Interface/RenderTargetControl.cs b/Source/Interface/RenderTargetControl.cs index a1d9f6c4..662cc1f8 100644 --- a/Source/Interface/RenderTargetControl.cs +++ b/Source/Interface/RenderTargetControl.cs @@ -32,7 +32,7 @@ using CodeImp.DoomBuilder.Editing; namespace CodeImp.DoomBuilder.Interface { - public class RenderTargetControl : PictureBox + public class RenderTargetControl : Panel { #region ================== Constants @@ -99,7 +99,7 @@ namespace CodeImp.DoomBuilder.Interface { // Set new source image img = srcimg; - this.Image = img; + //this.Image = img; } // This sets up the control to display the splash logo @@ -110,7 +110,7 @@ namespace CodeImp.DoomBuilder.Interface // Change display to show splash logo this.SetStyle(ControlStyles.SupportsTransparentBackColor, false); - this.SetStyle(ControlStyles.ContainerControl, false); + this.SetStyle(ControlStyles.ContainerControl, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); @@ -119,7 +119,7 @@ namespace CodeImp.DoomBuilder.Interface this.BackColor = System.Drawing.SystemColors.AppWorkspace; this.BackgroundImage = global::CodeImp.DoomBuilder.Properties.Resources.Splash2; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; - this.Image = null; + //this.Image = null; } // This sets up the control for manual rendering @@ -128,14 +128,14 @@ namespace CodeImp.DoomBuilder.Interface // Change display for rendering /* this.SetStyle(ControlStyles.SupportsTransparentBackColor, false); - this.SetStyle(ControlStyles.ContainerControl, 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.SetStyle(ControlStyles.SupportsTransparentBackColor, false); - this.SetStyle(ControlStyles.ContainerControl, false); + this.SetStyle(ControlStyles.ContainerControl, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, false); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); @@ -146,7 +146,7 @@ namespace CodeImp.DoomBuilder.Interface this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; //this.BackgroundImage = global::CodeImp.DoomBuilder.Properties.Resources.floor0_3; //this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Tile; - this.Image = img; + //this.Image = img; } #endregion diff --git a/Source/Rendering/D3DDevice.cs b/Source/Rendering/D3DDevice.cs index a42af030..45cc1312 100644 --- a/Source/Rendering/D3DDevice.cs +++ b/Source/Rendering/D3DDevice.cs @@ -239,7 +239,7 @@ namespace CodeImp.DoomBuilder.Rendering //device.DeviceResizing += new CancelEventHandler(CancelResize); // Create shader manager - shaders = new ShaderManager(); + shaders = new ShaderManager(this); // Initialize settings SetupSettings(); diff --git a/Source/Rendering/Renderer2D.cs b/Source/Rendering/Renderer2D.cs index 4f07f195..514b79bf 100644 --- a/Source/Rendering/Renderer2D.cs +++ b/Source/Rendering/Renderer2D.cs @@ -175,7 +175,8 @@ namespace CodeImp.DoomBuilder.Rendering if(thingsfront) PresentThings(1f); // Done - graphics.FinishRendering(true); + graphics.FinishRendering(); + graphics.Present(); } } @@ -637,7 +638,7 @@ namespace CodeImp.DoomBuilder.Rendering public void FinishRendering() { // Stop rendering - graphics.FinishRendering(false); + graphics.FinishRendering(); // Release rendertarget try diff --git a/Source/Resources/ThingsMode.png b/Source/Resources/ThingsMode.png index d0f5e5bc..70773256 100644 Binary files a/Source/Resources/ThingsMode.png and b/Source/Resources/ThingsMode.png differ