From b1c6c207145ad9a0e00b5f89cca954d465807741 Mon Sep 17 00:00:00 2001 From: codeimp Date: Wed, 31 Oct 2007 21:33:06 +0000 Subject: [PATCH] my sincere excuses for previous commit, my compiler lied to me and said it all compiled fine. --- Resources/Icons/ThingsMode.png | Bin 618 -> 906 bytes Source/Builder.csproj | 3 +- Source/Interface/ImageBrowser.Designer.cs | 2 +- Source/Interface/ImageBrowser.cs | 35 ++++++++++++--- Source/Interface/ImageBrowserItem.cs | 52 ++++++++++++++++++++++ Source/Interface/MainForm.Designer.cs | 17 ++++--- Source/Interface/RenderTargetControl.cs | 14 +++--- Source/Rendering/D3DDevice.cs | 2 +- Source/Rendering/Renderer2D.cs | 5 ++- Source/Resources/ThingsMode.png | Bin 618 -> 906 bytes 10 files changed, 108 insertions(+), 22 deletions(-) create mode 100644 Source/Interface/ImageBrowserItem.cs diff --git a/Resources/Icons/ThingsMode.png b/Resources/Icons/ThingsMode.png index d0f5e5bccd194259dfaafb0a5b2b4f2873c35a7d..70773256025036ce84ab9ffcf42962c403c9ff09 100644 GIT binary patch delta 876 zcmV-y1C#vf1d0ccD}N5d000id0mpBsWB>pF33NqRbVF}#ZDnqB004<9jRpV!11CvD zK~#90Rg!y1(@_-1k5WlUB)#yD1x57I!hDpb%{ixTrkRt&X#=Tc`=r{qNQQD#putU!vaOz0t{IkkPezpF_d_;TTLKY!ozJ(oj~m7s_U3-NPI z;Y{n8LMxyQHXuTww~$=-ljOx8NKyEj{59?5oAZ!-vg(M#e-&K~imSus{f+2MZUK(A z0S6j@n0tVtbg0v(xObCxemhB2jU4tqT0y*XxWPh724}QEf4KuV`y9x6%HaDzY|U>( zRhki8`V0PdhJO&C{aovw(MX<0^yHOtd(=Saey|1QH(mjmPk@6DfW7r2*j_z=n5qG6 zuIxv&aTwyP26$h53wdEzvs+3T@rtMbMH!*gv;&1NfrKU&x!R1?+HQEAG$E*D5Niy- z;kNH0tgWr#oT7*C_3sGIZA=|CUKPZN2Qyj@C1Soppfv84y=*L0DNo`>;XGa8Y2QjSc38CBn+eio-%@ z*{vVkz$^EuVCqbfRoE6^52UpMTaAMVEgy!5`Vl5foW#2dn(3;5e~FoCh?_{SeT7Fh zH&6-*wtvLd0!hulmKrm{3?rBqo-_^%nmol0BEMKHVPi>(x>p5sET8KHJ32@J7U{D{AFT44Z$M-7egwxjJpMSVPkoF@5UVW#O6}^Y=jXt;>zKdmv zw^^574*BT@`2FA6#TVXUS&|Nm{5PtZfh#GBx+vgW2L)=LnLP8_A-U4Sf0_eqRxSqm zTD@oP&Nphlwyi?04Dc3c<<4YJ|I{D-kQj^YbUWSv0000&A7mVMW@7P!fTH5zK!;2)o*CH_~y-Utiz%U6a*OF@JpE%llrO&*yp0`;coh zAO}gs&<|1+80E3aH_55Shdc*@|4VT7E5!Qm2+_o8^wvehFHa*>HW(8N+n?_*sEffG z1`-qm1yTDEsQZ*UrN}Q($@v2R0Lk&FnGu;2Vd|^hEes6np`1bOWAoE`T7~RDja9nD#{aUC}??%lDqHWd&8iu9hlvj%owk)!Ff{a2VxOvcT?`Jg3`V(#MLoWb+#uQa|cJ^?jD0X zIELcDGeg~e!LM;xFgr3EdkLJ)j||`JTZa{F Y1IqA{#O~GHH~;_u07*qoM6N<$f=DqIEdT%j 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 d0f5e5bccd194259dfaafb0a5b2b4f2873c35a7d..70773256025036ce84ab9ffcf42962c403c9ff09 100644 GIT binary patch delta 876 zcmV-y1C#vf1d0ccD}N5d000id0mpBsWB>pF33NqRbVF}#ZDnqB004<9jRpV!11CvD zK~#90Rg!y1(@_-1k5WlUB)#yD1x57I!hDpb%{ixTrkRt&X#=Tc`=r{qNQQD#putU!vaOz0t{IkkPezpF_d_;TTLKY!ozJ(oj~m7s_U3-NPI z;Y{n8LMxyQHXuTww~$=-ljOx8NKyEj{59?5oAZ!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