diff --git a/Resources/MissingTexture.png b/Resources/MissingTexture.png new file mode 100644 index 00000000..b9c38286 Binary files /dev/null and b/Resources/MissingTexture.png differ diff --git a/Resources/UnknownImage.png b/Resources/UnknownImage.png index 4f1b21ee..bc48f95b 100644 Binary files a/Resources/UnknownImage.png and b/Resources/UnknownImage.png differ diff --git a/Source/Builder.csproj b/Source/Builder.csproj index 1c85a9be..b0e90e08 100644 --- a/Source/Builder.csproj +++ b/Source/Builder.csproj @@ -48,6 +48,7 @@ + @@ -133,19 +134,28 @@ Form + + UserControl + Form GridSetupForm.cs - + UserControl - - ImageBrowser.cs + + ImageBrowserControl.cs + + UserControl + + + ImageSelectorControl.cs + Form @@ -164,6 +174,9 @@ MapOptionsForm.cs + + Component + Form @@ -209,6 +222,9 @@ TextureBrowserForm.cs + + UserControl + UserControl @@ -245,6 +261,7 @@ + @@ -306,6 +323,8 @@ + + @@ -320,7 +339,6 @@ - @@ -362,9 +380,13 @@ Designer GridSetupForm.cs - + Designer - ImageBrowser.cs + ImageBrowserControl.cs + + + Designer + ImageSelectorControl.cs Designer diff --git a/Source/Config/GameConfiguration.cs b/Source/Config/GameConfiguration.cs index e46bba06..400adbb8 100644 --- a/Source/Config/GameConfiguration.cs +++ b/Source/Config/GameConfiguration.cs @@ -67,6 +67,7 @@ namespace CodeImp.DoomBuilder.Config private Dictionary linedefactions; private List sortedlinedefactions; private List actioncategories; + private List linedefactivates; #endregion @@ -97,6 +98,7 @@ namespace CodeImp.DoomBuilder.Config public IDictionary LinedefActions { get { return linedefactions; } } public List SortedLinedefActions { get { return sortedlinedefactions; } } public List ActionCategories { get { return actioncategories; } } + public List LinedefActivates { get { return linedefactivates; } } #endregion @@ -113,6 +115,7 @@ namespace CodeImp.DoomBuilder.Config this.linedefactions = new Dictionary(); this.actioncategories = new List(); this.sortedlinedefactions = new List(); + this.linedefactivates = new List(); // Read general settings defaulttexturescale = cfg.ReadSetting("defaulttexturescale", 1f); @@ -136,6 +139,7 @@ namespace CodeImp.DoomBuilder.Config // Linedefs LoadLinedefFlags(); LoadLinedefActions(); + LoadLinedefActivations(); // We have no destructor GC.SuppressFinalize(this); @@ -184,7 +188,7 @@ namespace CodeImp.DoomBuilder.Config linedefflags.Add(bitvalue, de.Value.ToString()); else General.WriteLogLine("WARNING: Structure 'linedefflags' contains conflicting bit flag keys. Make sure all keys are unique integers and powers of 2!"); - + // Update bit flags checking value bitflagscheck |= bitvalue; } @@ -236,6 +240,7 @@ namespace CodeImp.DoomBuilder.Config // Add action to category and sorted list sortedlinedefactions.Add(ai); + linedefactions.Add(actionnumber, ai); ac.Add(ai); } else @@ -254,6 +259,34 @@ namespace CodeImp.DoomBuilder.Config // Sort the categories list actioncategories.Sort(); } + + // Linedef activates + private void LoadLinedefActivations() + { + IDictionary dic; + int bitvalue; + + // Get linedef activations + dic = cfg.ReadSetting("linedefactivations", new Hashtable()); + foreach(DictionaryEntry de in dic) + { + // Try paring the bit value + if(int.TryParse(de.Key.ToString(), + NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite, + CultureInfo.InvariantCulture, out bitvalue)) + { + // Add to the list + linedefactivates.Add(new LinedefActivateInfo(bitvalue, de.Value.ToString())); + } + else + { + General.WriteLogLine("WARNING: Structure 'linedefactivations' contains invalid keys!"); + } + } + + // Sort the list + linedefactivates.Sort(); + } #endregion diff --git a/Source/Config/LinedefActionInfo.cs b/Source/Config/LinedefActionInfo.cs index d6c17bca..d944f6de 100644 --- a/Source/Config/LinedefActionInfo.cs +++ b/Source/Config/LinedefActionInfo.cs @@ -142,7 +142,7 @@ namespace CodeImp.DoomBuilder.Config // This presents the item as string public override string ToString() { - return index + ": " + prefix + " " + title; + return index + " - " + title; } // This compares against another action info diff --git a/Source/Config/LinedefActivateInfo.cs b/Source/Config/LinedefActivateInfo.cs new file mode 100644 index 00000000..e442a16d --- /dev/null +++ b/Source/Config/LinedefActivateInfo.cs @@ -0,0 +1,89 @@ + +#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; +using System.Collections.Generic; +using System.Globalization; +using System.Text; +using CodeImp.DoomBuilder.IO; +using CodeImp.DoomBuilder.Data; +using System.IO; +using System.Diagnostics; +using System.Windows.Forms; +using CodeImp.DoomBuilder.Map; + +#endregion + +namespace CodeImp.DoomBuilder.Config +{ + public class LinedefActivateInfo : INumberedTitle, IComparable + { + #region ================== Constants + + #endregion + + #region ================== Variables + + // Properties + private int index; + private string title; + + #endregion + + #region ================== Properties + + public int Index { get { return index; } } + public string Title { get { return title; } } + + #endregion + + #region ================== Constructor / Disposer + + // Constructor + public LinedefActivateInfo(int index, string title) + { + // Initialize + this.index = index; + this.title = title; + + // We have no destructor + GC.SuppressFinalize(this); + } + + #endregion + + #region ================== Methods + + // This presents the item as string + public override string ToString() + { + return title; + } + + // This compares against another activate info + public int CompareTo(LinedefActivateInfo other) + { + if(this.index < other.index) return -1; + else if(this.index > other.index) return 1; + else return 0; + } + + #endregion + } +} diff --git a/Source/Data/NullImage.cs b/Source/Data/NullImage.cs index d533146b..ab828dcf 100644 --- a/Source/Data/NullImage.cs +++ b/Source/Data/NullImage.cs @@ -52,7 +52,7 @@ namespace CodeImp.DoomBuilder.Data #region ================== Methods // Dont do anything - public override void LoadImage() { } + public override void LoadImage() { bitmap = CodeImp.DoomBuilder.Properties.Resources.UnknownImage; } public override void CreatePixelData() { } public override void CreateTexture() { } diff --git a/Source/IO/DoomMapSetIO.cs b/Source/IO/DoomMapSetIO.cs index b31e4b8a..3967801d 100644 --- a/Source/IO/DoomMapSetIO.cs +++ b/Source/IO/DoomMapSetIO.cs @@ -452,8 +452,8 @@ namespace CodeImp.DoomBuilder.IO writer.Write((Int16)sd.OffsetX); writer.Write((Int16)sd.OffsetY); writer.Write(Lump.MakeFixedName(sd.HighTexture, WAD.ENCODING)); - writer.Write(Lump.MakeFixedName(sd.MiddleTexture, WAD.ENCODING)); writer.Write(Lump.MakeFixedName(sd.LowTexture, WAD.ENCODING)); + writer.Write(Lump.MakeFixedName(sd.MiddleTexture, WAD.ENCODING)); writer.Write((UInt16)sectorids[sd.Sector]); } diff --git a/Source/Interface/FlatBrowserForm.Designer.cs b/Source/Interface/FlatBrowserForm.Designer.cs index 6ed4b072..f335c16f 100644 --- a/Source/Interface/FlatBrowserForm.Designer.cs +++ b/Source/Interface/FlatBrowserForm.Designer.cs @@ -28,7 +28,7 @@ namespace CodeImp.DoomBuilder.Interface /// private void InitializeComponent() { - this.browser = new CodeImp.DoomBuilder.Interface.ImageBrowser(); + this.browser = new CodeImp.DoomBuilder.Interface.ImageBrowserControl(); this.cancel = new System.Windows.Forms.Button(); this.apply = new System.Windows.Forms.Button(); this.SuspendLayout(); @@ -44,7 +44,7 @@ namespace CodeImp.DoomBuilder.Interface this.browser.Name = "browser"; this.browser.Size = new System.Drawing.Size(689, 457); this.browser.TabIndex = 0; - this.browser.SelectedItemChanged += new CodeImp.DoomBuilder.Interface.ImageBrowser.SelectedItemChangedDelegate(this.browser_SelectedItemChanged); + this.browser.SelectedItemChanged += new CodeImp.DoomBuilder.Interface.ImageBrowserControl.SelectedItemChangedDelegate(this.browser_SelectedItemChanged); // // cancel // @@ -97,7 +97,7 @@ namespace CodeImp.DoomBuilder.Interface #endregion - private ImageBrowser browser; + private ImageBrowserControl browser; private System.Windows.Forms.Button cancel; private System.Windows.Forms.Button apply; } diff --git a/Source/Interface/FlatSelectorControl.cs b/Source/Interface/FlatSelectorControl.cs new file mode 100644 index 00000000..c42aec53 --- /dev/null +++ b/Source/Interface/FlatSelectorControl.cs @@ -0,0 +1,68 @@ + +#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; +using SlimDX.Direct3D9; +using System.Drawing.Imaging; +using System.Drawing.Drawing2D; +using CodeImp.DoomBuilder.Map; + +#endregion + +namespace CodeImp.DoomBuilder.Interface +{ + public class FlatSelectorControl : ImageSelectorControl + { + // This finds the image we need for the given flat name + protected override Image FindImage(string name) + { + // Check if name is a "none" texture + if((name.Length < 1) || (name[0] == '-')) + { + // Flat required! + return CodeImp.DoomBuilder.Properties.Resources.MissingTexture; + } + else + { + // Set the image + return General.Map.Data.GetFlatBitmap(name); + } + } + + // This browses for a flat + protected override string BrowseImage(string name) + { + string result; + + // Browse for texture + result = FlatBrowserForm.Browse(this.ParentForm, name); + if(result != null) return result; else return name; + } + } +} diff --git a/Source/Interface/ImageBrowser.Designer.cs b/Source/Interface/ImageBrowserControl.Designer.cs similarity index 96% rename from Source/Interface/ImageBrowser.Designer.cs rename to Source/Interface/ImageBrowserControl.Designer.cs index 7b272593..40cd7a80 100644 --- a/Source/Interface/ImageBrowser.Designer.cs +++ b/Source/Interface/ImageBrowserControl.Designer.cs @@ -1,6 +1,6 @@ namespace CodeImp.DoomBuilder.Interface { - partial class ImageBrowser + partial class ImageBrowserControl { /// /// Required designer variable. diff --git a/Source/Interface/ImageBrowser.cs b/Source/Interface/ImageBrowserControl.cs similarity index 94% rename from Source/Interface/ImageBrowser.cs rename to Source/Interface/ImageBrowserControl.cs index 2dbabd2a..3570b6fd 100644 --- a/Source/Interface/ImageBrowser.cs +++ b/Source/Interface/ImageBrowserControl.cs @@ -36,7 +36,7 @@ using System.Drawing.Drawing2D; namespace CodeImp.DoomBuilder.Interface { - public partial class ImageBrowser : UserControl + public partial class ImageBrowserControl : UserControl { #region ================== Delegates / Events @@ -66,7 +66,7 @@ namespace CodeImp.DoomBuilder.Interface #region ================== Constructor / Disposer // Constructor - public ImageBrowser() + public ImageBrowserControl() { // Initialize InitializeComponent(); diff --git a/Source/Interface/ImageBrowser.resx b/Source/Interface/ImageBrowserControl.resx similarity index 100% rename from Source/Interface/ImageBrowser.resx rename to Source/Interface/ImageBrowserControl.resx diff --git a/Source/Interface/ImageSelectorControl.Designer.cs b/Source/Interface/ImageSelectorControl.Designer.cs new file mode 100644 index 00000000..183c7fd0 --- /dev/null +++ b/Source/Interface/ImageSelectorControl.Designer.cs @@ -0,0 +1,73 @@ +namespace CodeImp.DoomBuilder.Interface +{ + partial class ImageSelectorControl + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.preview = new System.Windows.Forms.Panel(); + this.name = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // preview + // + this.preview.BackColor = System.Drawing.SystemColors.AppWorkspace; + this.preview.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.preview.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.preview.Location = new System.Drawing.Point(0, 0); + this.preview.Name = "preview"; + this.preview.Size = new System.Drawing.Size(68, 60); + this.preview.TabIndex = 1; + this.preview.Click += new System.EventHandler(this.preview_Click); + // + // name + // + this.name.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; + this.name.Location = new System.Drawing.Point(0, 64); + this.name.Name = "name"; + this.name.Size = new System.Drawing.Size(68, 20); + this.name.TabIndex = 2; + this.name.TextChanged += new System.EventHandler(this.name_TextChanged); + // + // ImageSelectorControl + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.Controls.Add(this.name); + this.Controls.Add(this.preview); + this.Name = "ImageSelectorControl"; + this.Size = new System.Drawing.Size(115, 136); + this.Resize += new System.EventHandler(this.ImageSelectorControl_Resize); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Panel preview; + private System.Windows.Forms.TextBox name; + } +} diff --git a/Source/Interface/ImageSelectorControl.cs b/Source/Interface/ImageSelectorControl.cs new file mode 100644 index 00000000..6a4b27a7 --- /dev/null +++ b/Source/Interface/ImageSelectorControl.cs @@ -0,0 +1,79 @@ + +#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; +using SlimDX.Direct3D9; +using System.Drawing.Imaging; +using System.Drawing.Drawing2D; + +#endregion + +namespace CodeImp.DoomBuilder.Interface +{ + public abstract partial class ImageSelectorControl : UserControl + { + // Events + public event EventHandler ImageClicked; + + // Properties + public string TextureName { get { return name.Text; } set { name.Text = value; } } + + // Constructor + public ImageSelectorControl() + { + // Initialize + InitializeComponent(); + } + + // When resized + private void ImageSelectorControl_Resize(object sender, EventArgs e) + { + // Fixed size + this.ClientSize = new Size(preview.Left + preview.Width, name.Top + name.Height); + } + + // Image clicked + private void preview_Click(object sender, EventArgs e) + { + name.Text = BrowseImage(name.Text); + } + + // Name text changed + private void name_TextChanged(object sender, EventArgs e) + { + General.DisplayZoomedImage(preview, FindImage(name.Text)); + } + + // This must determine and return the image to show + protected abstract Image FindImage(string name); + + // This must show the image browser and return the selected texture name + protected abstract string BrowseImage(string name); + } +} diff --git a/Source/Interface/ImageSelectorControl.resx b/Source/Interface/ImageSelectorControl.resx new file mode 100644 index 00000000..5bcd7d4d --- /dev/null +++ b/Source/Interface/ImageSelectorControl.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + \ No newline at end of file diff --git a/Source/Interface/LinedefEditForm.Designer.cs b/Source/Interface/LinedefEditForm.Designer.cs index 10632af0..79d4fdad 100644 --- a/Source/Interface/LinedefEditForm.Designer.cs +++ b/Source/Interface/LinedefEditForm.Designer.cs @@ -28,23 +28,159 @@ namespace CodeImp.DoomBuilder.Interface /// private void InitializeComponent() { + System.Windows.Forms.Label label2; + System.Windows.Forms.Label label1; + System.Windows.Forms.Label label3; + System.Windows.Forms.Label label4; + System.Windows.Forms.Label label5; + System.Windows.Forms.Label label6; + System.Windows.Forms.Label label7; + System.Windows.Forms.Label label8; + System.Windows.Forms.Label label9; + System.Windows.Forms.Label label10; this.cancel = new System.Windows.Forms.Button(); this.apply = new System.Windows.Forms.Button(); this.actiongroup = new System.Windows.Forms.GroupBox(); + this.newtag = new System.Windows.Forms.Button(); + this.tag = new CodeImp.DoomBuilder.Interface.NumericTextbox(); this.action = new CodeImp.DoomBuilder.Interface.ActionSelectorControl(); this.browseaction = new System.Windows.Forms.Button(); this.settingsgroup = new System.Windows.Forms.GroupBox(); this.flags = new CodeImp.DoomBuilder.Interface.CheckboxArrayControl(); this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.tabs = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.backside = new System.Windows.Forms.CheckBox(); + this.backgroup = new System.Windows.Forms.GroupBox(); + this.backlow = new CodeImp.DoomBuilder.Interface.TextureSelectorControl(); + this.backmid = new CodeImp.DoomBuilder.Interface.TextureSelectorControl(); + this.backhigh = new CodeImp.DoomBuilder.Interface.TextureSelectorControl(); + this.backoffsety = new CodeImp.DoomBuilder.Interface.NumericTextbox(); + this.backoffsetx = new CodeImp.DoomBuilder.Interface.NumericTextbox(); + this.backsector = new System.Windows.Forms.Button(); + this.frontside = new System.Windows.Forms.CheckBox(); + this.frontgroup = new System.Windows.Forms.GroupBox(); + this.frontlow = new CodeImp.DoomBuilder.Interface.TextureSelectorControl(); + this.frontmid = new CodeImp.DoomBuilder.Interface.TextureSelectorControl(); + this.fronthigh = new CodeImp.DoomBuilder.Interface.TextureSelectorControl(); + this.frontoffsety = new CodeImp.DoomBuilder.Interface.NumericTextbox(); + this.frontoffsetx = new CodeImp.DoomBuilder.Interface.NumericTextbox(); + this.frontsector = new System.Windows.Forms.Button(); + label2 = new System.Windows.Forms.Label(); + label1 = new System.Windows.Forms.Label(); + label3 = new System.Windows.Forms.Label(); + label4 = new System.Windows.Forms.Label(); + label5 = new System.Windows.Forms.Label(); + label6 = new System.Windows.Forms.Label(); + label7 = new System.Windows.Forms.Label(); + label8 = new System.Windows.Forms.Label(); + label9 = new System.Windows.Forms.Label(); + label10 = new System.Windows.Forms.Label(); this.actiongroup.SuspendLayout(); this.settingsgroup.SuspendLayout(); + this.tabs.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.backgroup.SuspendLayout(); + this.frontgroup.SuspendLayout(); this.SuspendLayout(); // + // label2 + // + label2.AutoSize = true; + label2.Location = new System.Drawing.Point(15, 30); + label2.Name = "label2"; + label2.Size = new System.Drawing.Size(41, 14); + label2.TabIndex = 9; + label2.Text = "Action:"; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new System.Drawing.Point(28, 78); + label1.Name = "label1"; + label1.Size = new System.Drawing.Size(28, 14); + label1.TabIndex = 6; + label1.Text = "Tag:"; + // + // label3 + // + label3.Location = new System.Drawing.Point(252, 18); + label3.Name = "label3"; + label3.Size = new System.Drawing.Size(68, 16); + label3.TabIndex = 3; + label3.Text = "Upper"; + label3.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // label4 + // + label4.Location = new System.Drawing.Point(334, 18); + label4.Name = "label4"; + label4.Size = new System.Drawing.Size(68, 16); + label4.TabIndex = 4; + label4.Text = "Middle"; + label4.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // label5 + // + label5.Location = new System.Drawing.Point(416, 18); + label5.Name = "label5"; + label5.Size = new System.Drawing.Size(68, 16); + label5.TabIndex = 5; + label5.Text = "Lower"; + label5.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // label6 + // + label6.AutoSize = true; + label6.Location = new System.Drawing.Point(16, 104); + label6.Name = "label6"; + label6.Size = new System.Drawing.Size(81, 14); + label6.TabIndex = 7; + label6.Text = "Texture Offset:"; + // + // label7 + // + label7.AutoSize = true; + label7.Location = new System.Drawing.Point(16, 104); + label7.Name = "label7"; + label7.Size = new System.Drawing.Size(81, 14); + label7.TabIndex = 7; + label7.Text = "Texture Offset:"; + // + // label8 + // + label8.Location = new System.Drawing.Point(416, 18); + label8.Name = "label8"; + label8.Size = new System.Drawing.Size(68, 16); + label8.TabIndex = 5; + label8.Text = "Lower"; + label8.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // label9 + // + label9.Location = new System.Drawing.Point(334, 18); + label9.Name = "label9"; + label9.Size = new System.Drawing.Size(68, 16); + label9.TabIndex = 4; + label9.Text = "Middle"; + label9.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // label10 + // + label10.Location = new System.Drawing.Point(252, 18); + label10.Name = "label10"; + label10.Size = new System.Drawing.Size(68, 16); + label10.TabIndex = 3; + label10.Text = "Upper"; + label10.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // // cancel // this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.cancel.Location = new System.Drawing.Point(399, 387); + this.cancel.Location = new System.Drawing.Point(421, 359); this.cancel.Name = "cancel"; this.cancel.Size = new System.Drawing.Size(112, 25); this.cancel.TabIndex = 17; @@ -54,7 +190,7 @@ namespace CodeImp.DoomBuilder.Interface // apply // this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.apply.Location = new System.Drawing.Point(281, 387); + this.apply.Location = new System.Drawing.Point(302, 359); this.apply.Name = "apply"; this.apply.Size = new System.Drawing.Size(112, 25); this.apply.TabIndex = 16; @@ -63,25 +199,45 @@ namespace CodeImp.DoomBuilder.Interface // // actiongroup // - this.actiongroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + this.actiongroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.actiongroup.Controls.Add(label2); + this.actiongroup.Controls.Add(this.newtag); + this.actiongroup.Controls.Add(this.tag); + this.actiongroup.Controls.Add(label1); this.actiongroup.Controls.Add(this.action); this.actiongroup.Controls.Add(this.browseaction); - this.actiongroup.Location = new System.Drawing.Point(12, 177); + this.actiongroup.Location = new System.Drawing.Point(8, 169); this.actiongroup.Name = "actiongroup"; - this.actiongroup.Size = new System.Drawing.Size(499, 196); + this.actiongroup.Size = new System.Drawing.Size(499, 128); this.actiongroup.TabIndex = 18; this.actiongroup.TabStop = false; this.actiongroup.Text = " Action "; // + // newtag + // + this.newtag.Location = new System.Drawing.Point(136, 74); + this.newtag.Name = "newtag"; + this.newtag.Size = new System.Drawing.Size(76, 23); + this.newtag.TabIndex = 8; + this.newtag.Text = "New Tag"; + this.newtag.UseVisualStyleBackColor = true; + // + // tag + // + this.tag.Location = new System.Drawing.Point(62, 75); + this.tag.Name = "tag"; + this.tag.Size = new System.Drawing.Size(68, 20); + this.tag.TabIndex = 7; + // // action // this.action.BackColor = System.Drawing.SystemColors.Control; this.action.Cursor = System.Windows.Forms.Cursors.Default; this.action.Empty = false; - this.action.Location = new System.Drawing.Point(18, 27); + this.action.Location = new System.Drawing.Point(62, 27); this.action.Name = "action"; - this.action.Size = new System.Drawing.Size(430, 21); + this.action.Size = new System.Drawing.Size(386, 21); this.action.TabIndex = 5; this.action.Value = 402; // @@ -102,7 +258,7 @@ namespace CodeImp.DoomBuilder.Interface this.settingsgroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.settingsgroup.Controls.Add(this.flags); - this.settingsgroup.Location = new System.Drawing.Point(12, 12); + this.settingsgroup.Location = new System.Drawing.Point(8, 8); this.settingsgroup.Name = "settingsgroup"; this.settingsgroup.Size = new System.Drawing.Size(499, 152); this.settingsgroup.TabIndex = 19; @@ -127,12 +283,215 @@ namespace CodeImp.DoomBuilder.Interface this.checkBox1.Text = "checkBox1"; this.checkBox1.UseVisualStyleBackColor = true; // + // tabs + // + this.tabs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabs.Controls.Add(this.tabPage1); + this.tabs.Controls.Add(this.tabPage2); + this.tabs.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.tabs.Location = new System.Drawing.Point(10, 10); + this.tabs.Margin = new System.Windows.Forms.Padding(1); + this.tabs.Name = "tabs"; + this.tabs.SelectedIndex = 0; + this.tabs.Size = new System.Drawing.Size(523, 332); + this.tabs.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; + this.tabs.TabIndex = 20; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.settingsgroup); + this.tabPage1.Controls.Add(this.actiongroup); + this.tabPage1.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.tabPage1.Location = new System.Drawing.Point(4, 23); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(5); + this.tabPage1.Size = new System.Drawing.Size(515, 305); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "Properties"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.backside); + this.tabPage2.Controls.Add(this.backgroup); + this.tabPage2.Controls.Add(this.frontside); + this.tabPage2.Controls.Add(this.frontgroup); + this.tabPage2.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.tabPage2.Location = new System.Drawing.Point(4, 23); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(5); + this.tabPage2.Size = new System.Drawing.Size(515, 305); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Sidedefs"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // backside + // + this.backside.AutoSize = true; + this.backside.Location = new System.Drawing.Point(20, 155); + this.backside.Name = "backside"; + this.backside.Size = new System.Drawing.Size(74, 18); + this.backside.TabIndex = 2; + this.backside.Text = "Back Side"; + this.backside.UseVisualStyleBackColor = true; + // + // backgroup + // + this.backgroup.Controls.Add(this.backlow); + this.backgroup.Controls.Add(this.backmid); + this.backgroup.Controls.Add(this.backhigh); + this.backgroup.Controls.Add(this.backoffsety); + this.backgroup.Controls.Add(this.backoffsetx); + this.backgroup.Controls.Add(label7); + this.backgroup.Controls.Add(this.backsector); + this.backgroup.Controls.Add(label8); + this.backgroup.Controls.Add(label9); + this.backgroup.Controls.Add(label10); + this.backgroup.Location = new System.Drawing.Point(8, 157); + this.backgroup.Name = "backgroup"; + this.backgroup.Size = new System.Drawing.Size(499, 140); + this.backgroup.TabIndex = 1; + this.backgroup.TabStop = false; + this.backgroup.Text = " "; + // + // backlow + // + this.backlow.Location = new System.Drawing.Point(416, 37); + this.backlow.Name = "backlow"; + this.backlow.Required = false; + this.backlow.Size = new System.Drawing.Size(68, 84); + this.backlow.TabIndex = 15; + this.backlow.TextureName = ""; + // + // backmid + // + this.backmid.Location = new System.Drawing.Point(334, 37); + this.backmid.Name = "backmid"; + this.backmid.Required = false; + this.backmid.Size = new System.Drawing.Size(68, 84); + this.backmid.TabIndex = 14; + this.backmid.TextureName = ""; + // + // backhigh + // + this.backhigh.Location = new System.Drawing.Point(252, 37); + this.backhigh.Name = "backhigh"; + this.backhigh.Required = false; + this.backhigh.Size = new System.Drawing.Size(68, 84); + this.backhigh.TabIndex = 13; + this.backhigh.TextureName = ""; + // + // backoffsety + // + this.backoffsety.Location = new System.Drawing.Point(154, 101); + this.backoffsety.Name = "backoffsety"; + this.backoffsety.Size = new System.Drawing.Size(45, 20); + this.backoffsety.TabIndex = 9; + // + // backoffsetx + // + this.backoffsetx.Location = new System.Drawing.Point(103, 101); + this.backoffsetx.Name = "backoffsetx"; + this.backoffsetx.Size = new System.Drawing.Size(45, 20); + this.backoffsetx.TabIndex = 8; + // + // backsector + // + this.backsector.Location = new System.Drawing.Point(103, 37); + this.backsector.Name = "backsector"; + this.backsector.Size = new System.Drawing.Size(96, 24); + this.backsector.TabIndex = 6; + this.backsector.Text = "Select Sector"; + this.backsector.UseVisualStyleBackColor = true; + // + // frontside + // + this.frontside.AutoSize = true; + this.frontside.Location = new System.Drawing.Point(20, 6); + this.frontside.Name = "frontside"; + this.frontside.Size = new System.Drawing.Size(75, 18); + this.frontside.TabIndex = 0; + this.frontside.Text = "Front Side"; + this.frontside.UseVisualStyleBackColor = true; + // + // frontgroup + // + this.frontgroup.Controls.Add(this.frontlow); + this.frontgroup.Controls.Add(this.frontmid); + this.frontgroup.Controls.Add(this.fronthigh); + this.frontgroup.Controls.Add(this.frontoffsety); + this.frontgroup.Controls.Add(this.frontoffsetx); + this.frontgroup.Controls.Add(label6); + this.frontgroup.Controls.Add(this.frontsector); + this.frontgroup.Controls.Add(label5); + this.frontgroup.Controls.Add(label4); + this.frontgroup.Controls.Add(label3); + this.frontgroup.Location = new System.Drawing.Point(8, 8); + this.frontgroup.Name = "frontgroup"; + this.frontgroup.Size = new System.Drawing.Size(499, 140); + this.frontgroup.TabIndex = 0; + this.frontgroup.TabStop = false; + this.frontgroup.Text = " "; + // + // frontlow + // + this.frontlow.Location = new System.Drawing.Point(416, 37); + this.frontlow.Name = "frontlow"; + this.frontlow.Required = false; + this.frontlow.Size = new System.Drawing.Size(68, 84); + this.frontlow.TabIndex = 12; + this.frontlow.TextureName = ""; + // + // frontmid + // + this.frontmid.Location = new System.Drawing.Point(334, 37); + this.frontmid.Name = "frontmid"; + this.frontmid.Required = false; + this.frontmid.Size = new System.Drawing.Size(68, 84); + this.frontmid.TabIndex = 11; + this.frontmid.TextureName = ""; + // + // fronthigh + // + this.fronthigh.Location = new System.Drawing.Point(252, 37); + this.fronthigh.Name = "fronthigh"; + this.fronthigh.Required = false; + this.fronthigh.Size = new System.Drawing.Size(68, 84); + this.fronthigh.TabIndex = 10; + this.fronthigh.TextureName = ""; + // + // frontoffsety + // + this.frontoffsety.Location = new System.Drawing.Point(154, 101); + this.frontoffsety.Name = "frontoffsety"; + this.frontoffsety.Size = new System.Drawing.Size(45, 20); + this.frontoffsety.TabIndex = 9; + // + // frontoffsetx + // + this.frontoffsetx.Location = new System.Drawing.Point(103, 101); + this.frontoffsetx.Name = "frontoffsetx"; + this.frontoffsetx.Size = new System.Drawing.Size(45, 20); + this.frontoffsetx.TabIndex = 8; + // + // frontsector + // + this.frontsector.Location = new System.Drawing.Point(103, 37); + this.frontsector.Name = "frontsector"; + this.frontsector.Size = new System.Drawing.Size(96, 24); + this.frontsector.TabIndex = 6; + this.frontsector.Text = "Select Sector"; + this.frontsector.UseVisualStyleBackColor = true; + // // LinedefEditForm // + this.AcceptButton = this.apply; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; - this.ClientSize = new System.Drawing.Size(523, 422); - this.Controls.Add(this.settingsgroup); - this.Controls.Add(this.actiongroup); + this.CancelButton = this.cancel; + this.ClientSize = new System.Drawing.Size(543, 394); + this.Controls.Add(this.tabs); this.Controls.Add(this.cancel); this.Controls.Add(this.apply); this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -145,7 +504,16 @@ namespace CodeImp.DoomBuilder.Interface this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Edit Linedefs"; this.actiongroup.ResumeLayout(false); + this.actiongroup.PerformLayout(); this.settingsgroup.ResumeLayout(false); + this.tabs.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage2.ResumeLayout(false); + this.tabPage2.PerformLayout(); + this.backgroup.ResumeLayout(false); + this.backgroup.PerformLayout(); + this.frontgroup.ResumeLayout(false); + this.frontgroup.PerformLayout(); this.ResumeLayout(false); } @@ -160,5 +528,26 @@ namespace CodeImp.DoomBuilder.Interface private System.Windows.Forms.CheckBox checkBox1; private System.Windows.Forms.Button browseaction; private ActionSelectorControl action; + private NumericTextbox tag; + private System.Windows.Forms.Button newtag; + private System.Windows.Forms.TabControl tabs; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.GroupBox frontgroup; + private System.Windows.Forms.CheckBox frontside; + private System.Windows.Forms.Button frontsector; + private NumericTextbox frontoffsety; + private NumericTextbox frontoffsetx; + private System.Windows.Forms.CheckBox backside; + private System.Windows.Forms.GroupBox backgroup; + private NumericTextbox backoffsety; + private NumericTextbox backoffsetx; + private System.Windows.Forms.Button backsector; + private TextureSelectorControl frontlow; + private TextureSelectorControl frontmid; + private TextureSelectorControl fronthigh; + private TextureSelectorControl backlow; + private TextureSelectorControl backmid; + private TextureSelectorControl backhigh; } } \ No newline at end of file diff --git a/Source/Interface/LinedefEditForm.resx b/Source/Interface/LinedefEditForm.resx index ff31a6db..410fc85a 100644 --- a/Source/Interface/LinedefEditForm.resx +++ b/Source/Interface/LinedefEditForm.resx @@ -117,4 +117,154 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + True + + + False + + + True + + + False + + + True + + + False + + + True + + + False + + + True + + + False + + + True + + + False + + + True + + + False + + + True + + + False + + + True + + + False + + + True + + + False + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + \ No newline at end of file diff --git a/Source/Interface/LinedefInfoPanel.cs b/Source/Interface/LinedefInfoPanel.cs index 224bf3d1..0ad4275c 100644 --- a/Source/Interface/LinedefInfoPanel.cs +++ b/Source/Interface/LinedefInfoPanel.cs @@ -43,10 +43,18 @@ namespace CodeImp.DoomBuilder.Interface // This shows the info public void ShowInfo(Linedef l) { - // TODO: Get line action information + string actioninfo = ""; + + // Get line action information + if(General.Map.Config.LinedefActions.ContainsKey(l.Action)) + actioninfo = General.Map.Config.LinedefActions[l.Action].ToString(); + else if(l.Action == 0) + actioninfo = l.Action.ToString() + " - None"; + else + actioninfo = l.Action.ToString() + " - Unknown"; // Linedef info - action.Text = l.Action.ToString(); + action.Text = actioninfo; length.Text = l.Length.ToString("0.##"); angle.Text = l.AngleDeg.ToString() + "\u00B0"; tag.Text = l.Tag.ToString(); @@ -59,9 +67,9 @@ namespace CodeImp.DoomBuilder.Interface fronthighname.Text = l.Front.HighTexture; frontmidname.Text = l.Front.MiddleTexture; frontlowname.Text = l.Front.LowTexture; - General.DisplayZoomedImage(fronthightex, General.Map.Data.GetTextureBitmap(l.Front.HighTexture)); - General.DisplayZoomedImage(frontmidtex, General.Map.Data.GetTextureBitmap(l.Front.MiddleTexture)); - General.DisplayZoomedImage(frontlowtex, General.Map.Data.GetTextureBitmap(l.Front.LowTexture)); + DisplaySidedefTexture(fronthightex, l.Front.HighTexture, l.Front.HighRequired()); + DisplaySidedefTexture(frontmidtex, l.Front.MiddleTexture, l.Front.MiddleRequired()); + DisplaySidedefTexture(frontlowtex, l.Front.LowTexture, l.Front.LowRequired()); frontoffsetlabel.Enabled = true; frontoffset.Enabled = true; frontpanel.Enabled = true; @@ -89,9 +97,9 @@ namespace CodeImp.DoomBuilder.Interface backhighname.Text = l.Back.HighTexture; backmidname.Text = l.Back.MiddleTexture; backlowname.Text = l.Back.LowTexture; - General.DisplayZoomedImage(backhightex, General.Map.Data.GetTextureBitmap(l.Back.HighTexture)); - General.DisplayZoomedImage(backmidtex, General.Map.Data.GetTextureBitmap(l.Back.MiddleTexture)); - General.DisplayZoomedImage(backlowtex, General.Map.Data.GetTextureBitmap(l.Back.LowTexture)); + DisplaySidedefTexture(backhightex, l.Back.HighTexture, l.Back.HighRequired()); + DisplaySidedefTexture(backmidtex, l.Back.MiddleTexture, l.Back.MiddleRequired()); + DisplaySidedefTexture(backlowtex, l.Back.LowTexture, l.Back.LowRequired()); backoffsetlabel.Enabled = true; backoffset.Enabled = true; backpanel.Enabled = true; @@ -133,5 +141,41 @@ namespace CodeImp.DoomBuilder.Interface // Call base base.OnVisibleChanged(e); } + + // This shows a sidedef texture in a panel + private void DisplaySidedefTexture(Panel panel, string name, bool required) + { + // Check if name is a "none" texture + if((name.Length < 1) || (name[0] == '-')) + { + // Determine image to show + if(required) + panel.BackgroundImage = CodeImp.DoomBuilder.Properties.Resources.MissingTexture; + else + panel.BackgroundImage = null; + } + else + { + // Set the image + panel.BackgroundImage = General.Map.Data.GetTextureBitmap(name); + } + + // Image not null? + if(panel.BackgroundImage != null) + { + // Small enough to fit in panel? + if((panel.BackgroundImage.Size.Width < panel.ClientRectangle.Width) && + (panel.BackgroundImage.Size.Height < panel.ClientRectangle.Height)) + { + // Display centered + panel.BackgroundImageLayout = ImageLayout.Center; + } + else + { + // Display zoomed + panel.BackgroundImageLayout = ImageLayout.Zoom; + } + } + } } } diff --git a/Source/Interface/NumericTextbox.cs b/Source/Interface/NumericTextbox.cs new file mode 100644 index 00000000..47b5bb46 --- /dev/null +++ b/Source/Interface/NumericTextbox.cs @@ -0,0 +1,71 @@ + +#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.Globalization; +using System.Windows.Forms; +using CodeImp.DoomBuilder.Controls; +using CodeImp.DoomBuilder.Geometry; +using CodeImp.DoomBuilder.Rendering; +using CodeImp.DoomBuilder.Editing; + +#endregion + +namespace CodeImp.DoomBuilder.Interface +{ + internal class NumericTextbox : TextBox + { + #region ================== Constants + + #endregion + + #region ================== Variables + + #endregion + + #region ================== Properties + + #endregion + + #region ================== Constructor / Disposer + + #endregion + + #region ================== Methods + + // When a key is pressed + protected override void OnKeyPress(KeyPressEventArgs e) + { + // Not numeric or control key? + if("-+0123456789\b".IndexOf(e.KeyChar) == -1) + { + // Cancel this + e.Handled = true; + } + + // Call base + base.OnKeyPress(e); + } + + #endregion + } +} diff --git a/Source/Interface/TextureBrowserForm.Designer.cs b/Source/Interface/TextureBrowserForm.Designer.cs index 43cee799..9ef8fda5 100644 --- a/Source/Interface/TextureBrowserForm.Designer.cs +++ b/Source/Interface/TextureBrowserForm.Designer.cs @@ -28,7 +28,7 @@ namespace CodeImp.DoomBuilder.Interface /// private void InitializeComponent() { - this.browser = new CodeImp.DoomBuilder.Interface.ImageBrowser(); + this.browser = new CodeImp.DoomBuilder.Interface.ImageBrowserControl(); this.cancel = new System.Windows.Forms.Button(); this.apply = new System.Windows.Forms.Button(); this.SuspendLayout(); @@ -44,7 +44,7 @@ namespace CodeImp.DoomBuilder.Interface this.browser.Name = "browser"; this.browser.Size = new System.Drawing.Size(689, 457); this.browser.TabIndex = 0; - this.browser.SelectedItemChanged += new CodeImp.DoomBuilder.Interface.ImageBrowser.SelectedItemChangedDelegate(this.browser_SelectedItemChanged); + this.browser.SelectedItemChanged += new CodeImp.DoomBuilder.Interface.ImageBrowserControl.SelectedItemChangedDelegate(this.browser_SelectedItemChanged); // // cancel // @@ -97,7 +97,7 @@ namespace CodeImp.DoomBuilder.Interface #endregion - private ImageBrowser browser; + private ImageBrowserControl browser; private System.Windows.Forms.Button cancel; private System.Windows.Forms.Button apply; } diff --git a/Source/Interface/TextureSelectorControl.cs b/Source/Interface/TextureSelectorControl.cs new file mode 100644 index 00000000..c97589f9 --- /dev/null +++ b/Source/Interface/TextureSelectorControl.cs @@ -0,0 +1,77 @@ + +#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; +using SlimDX.Direct3D9; +using System.Drawing.Imaging; +using System.Drawing.Drawing2D; +using CodeImp.DoomBuilder.Map; + +#endregion + +namespace CodeImp.DoomBuilder.Interface +{ + public class TextureSelectorControl : ImageSelectorControl + { + // Variables + private bool required; + + // Properties + public bool Required { get { return required; } set { required = value; } } + + // This finds the image we need for the given texture name + protected override Image FindImage(string name) + { + // Check if name is a "none" texture + if((name.Length < 1) || (name[0] == '-')) + { + // Determine image to show + if(required) + return CodeImp.DoomBuilder.Properties.Resources.MissingTexture; + else + return null; + } + else + { + // Set the image + return General.Map.Data.GetTextureBitmap(name); + } + } + + // This browses for a texture + protected override string BrowseImage(string name) + { + string result; + + // Browse for texture + result = TextureBrowserForm.Browse(this.ParentForm, name); + if(result != null) return result; else return name; + } + } +} diff --git a/Source/Map/Sidedef.cs b/Source/Map/Sidedef.cs index 9bdeb394..7dd7caa9 100644 --- a/Source/Map/Sidedef.cs +++ b/Source/Map/Sidedef.cs @@ -201,6 +201,47 @@ namespace CodeImp.DoomBuilder.Map #endregion + #region ================== Methods + + // This checks if a texture is required + public bool HighRequired() + { + // Doublesided? + if(Other != null) + { + // Texture is required when ceiling of other side is lower + return (Other.sector.CeilHeight < this.sector.CeilHeight); + } + else + { + return false; + } + } + + // This checks if a texture is required + public bool MiddleRequired() + { + // Texture is required when the line is singlesided + return (Other == null); + } + + // This checks if a texture is required + public bool LowRequired() + { + // Doublesided? + if(Other != null) + { + // Texture is required when floor of other side is higher + return (Other.sector.FloorHeight > this.sector.FloorHeight); + } + else + { + return false; + } + } + + #endregion + #region ================== Changes // This updates all properties diff --git a/Source/Map/SidedefPart.cs b/Source/Map/SidedefPart.cs new file mode 100644 index 00000000..265605c8 --- /dev/null +++ b/Source/Map/SidedefPart.cs @@ -0,0 +1,36 @@ + +#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; +using System.Collections.Generic; +using System.Globalization; +using System.Text; + +#endregion + +namespace CodeImp.DoomBuilder.Map +{ + public enum SidedefPart + { + None = 0, + Upper = 1, + Middle = 2, + Lower = 3 + } +} diff --git a/Source/Properties/Resources.Designer.cs b/Source/Properties/Resources.Designer.cs index 6ccac559..d7f7e828 100644 --- a/Source/Properties/Resources.Designer.cs +++ b/Source/Properties/Resources.Designer.cs @@ -130,6 +130,13 @@ namespace CodeImp.DoomBuilder.Properties { } } + internal static System.Drawing.Bitmap MissingTexture { + get { + object obj = ResourceManager.GetObject("MissingTexture", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + internal static System.Drawing.Bitmap NewMap { get { object obj = ResourceManager.GetObject("NewMap", resourceCulture); diff --git a/Source/Properties/Resources.resx b/Source/Properties/Resources.resx index e1ff729c..b5ff007f 100644 --- a/Source/Properties/Resources.resx +++ b/Source/Properties/Resources.resx @@ -160,9 +160,6 @@ ..\Resources\SectorsMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\UnknownImage.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\Grid2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -199,4 +196,10 @@ ..\Resources\treeview.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\MissingTexture.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\UnknownImage.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Source/Resources/MissingTexture.png b/Source/Resources/MissingTexture.png new file mode 100644 index 00000000..b9c38286 Binary files /dev/null and b/Source/Resources/MissingTexture.png differ diff --git a/Source/Resources/UnknownImage.png b/Source/Resources/UnknownImage.png index 4f1b21ee..bc48f95b 100644 Binary files a/Source/Resources/UnknownImage.png and b/Source/Resources/UnknownImage.png differ