diff --git a/Build/Builder.cfg b/Build/Builder.cfg
index 9a1bf8f9..987741d6 100644
--- a/Build/Builder.cfg
+++ b/Build/Builder.cfg
@@ -16,8 +16,8 @@ mainwindow
{
positionx = 150;
windowstate = 2;
- sizeheight = 481;
- sizewidth = 777;
positiony = 21;
+ sizeheight = 572;
+ sizewidth = 739;
}
diff --git a/Resources/Icons/File.ico b/Resources/Icons/File.ico
new file mode 100644
index 00000000..c458d1e4
Binary files /dev/null and b/Resources/Icons/File.ico differ
diff --git a/Resources/Icons/FileLocked.ico b/Resources/Icons/FileLocked.ico
new file mode 100644
index 00000000..2a1df5c4
Binary files /dev/null and b/Resources/Icons/FileLocked.ico differ
diff --git a/Resources/Icons/Folder.ico b/Resources/Icons/Folder.ico
new file mode 100644
index 00000000..fae0263c
Binary files /dev/null and b/Resources/Icons/Folder.ico differ
diff --git a/Resources/Icons/FolderLocked.ico b/Resources/Icons/FolderLocked.ico
new file mode 100644
index 00000000..ff72f790
Binary files /dev/null and b/Resources/Icons/FolderLocked.ico differ
diff --git a/Source/Builder.csproj b/Source/Builder.csproj
index 369a5fcc..78c52e0d 100644
--- a/Source/Builder.csproj
+++ b/Source/Builder.csproj
@@ -58,6 +58,7 @@
+
Form
@@ -86,6 +87,15 @@
OpenMapOptionsForm.cs
+
+ Component
+
+
+ UserControl
+
+
+ ResourceListEditor.cs
+
Form
@@ -133,8 +143,10 @@
+
+
@@ -180,6 +192,10 @@
Designer
DelayedForm.cs
+
+ Designer
+ ResourceListEditor.cs
+
diff --git a/Source/Images/ResourceLocationList.cs b/Source/Images/ResourceLocationList.cs
new file mode 100644
index 00000000..8b53a109
--- /dev/null
+++ b/Source/Images/ResourceLocationList.cs
@@ -0,0 +1,88 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using CodeImp.DoomBuilder.IO;
+using System.Collections.Specialized;
+
+namespace CodeImp.DoomBuilder.Images
+{
+ internal class ResourceLocationList : List
+ {
+ #region ================== Constructors
+
+ // This creates a new list
+ public ResourceLocationList()
+ {
+ }
+
+ // This creates a list from a configuration structure
+ public ResourceLocationList(Configuration cfg, string path)
+ {
+ IDictionary resinfo, rlinfo;
+ ResourceLocation res;
+
+ // Go for all items in the map info
+ resinfo = cfg.ReadSetting(path, new ListDictionary());
+ foreach(DictionaryEntry rl in resinfo)
+ {
+ // Item is a structure?
+ if(rl.Value is IDictionary)
+ {
+ // Create resource location
+ rlinfo = (IDictionary)rl.Value;
+ res = new ResourceLocation();
+
+ // Copy information from Configuration to ResourceLocation
+ if(resinfo.Contains("type") && (resinfo["type"] is int)) res.type = (int)resinfo["type"];
+ if(resinfo.Contains("location") && (resinfo["location"] is string)) res.location = (string)resinfo["location"];
+ if(resinfo.Contains("textures") && (resinfo["textures"] is bool)) res.textures = (bool)resinfo["textures"];
+ if(resinfo.Contains("flats") && (resinfo["flats"] is bool)) res.flats = (bool)resinfo["flats"];
+
+ // Add resource
+ Add(res);
+ }
+ }
+ }
+
+ #endregion
+
+ #region ================== Methods
+
+ // This merges two lists together
+ public static ResourceLocationList Combined(ResourceLocationList a, ResourceLocationList b)
+ {
+ ResourceLocationList result = new ResourceLocationList();
+ result.AddRange(a);
+ result.AddRange(b);
+ return result;
+ }
+
+ // This writes the list to configuration
+ public void WriteToConfig(Configuration cfg, string path)
+ {
+ IDictionary resinfo, rlinfo;
+
+ // Fill structure
+ resinfo = new ListDictionary();
+ for(int i = 0; i < this.Count; i++)
+ {
+ // Create structure for resource
+ rlinfo = new ListDictionary();
+ rlinfo.Add("type", this[i].type);
+ rlinfo.Add("location", this[i].location);
+ rlinfo.Add("textures", this[i].textures);
+ rlinfo.Add("flats", this[i].flats);
+
+ // Add structure
+ resinfo.Add("resource" + i.ToString(CultureInfo.InvariantCulture), rlinfo);
+ }
+
+ // Write to config
+ cfg.WriteSetting(path, resinfo);
+ }
+
+ #endregion
+ }
+}
diff --git a/Source/Interface/ConfigForm.Designer.cs b/Source/Interface/ConfigForm.Designer.cs
index df56eee4..44e3a505 100644
--- a/Source/Interface/ConfigForm.Designer.cs
+++ b/Source/Interface/ConfigForm.Designer.cs
@@ -29,18 +29,102 @@ namespace CodeImp.DoomBuilder.Interface
private void InitializeComponent()
{
System.Windows.Forms.Label label1;
+ System.Windows.Forms.GroupBox groupBox1;
+ System.Windows.Forms.Label label4;
+ System.Windows.Forms.Label label3;
+ System.Windows.Forms.Label label2;
+ this.configbuildonsave = new System.Windows.Forms.CheckBox();
+ this.confignodebuilder = new System.Windows.Forms.ComboBox();
this.tabs = new System.Windows.Forms.TabControl();
this.tabinterface = new System.Windows.Forms.TabPage();
this.tabediting = new System.Windows.Forms.TabPage();
this.tabconfigs = new System.Windows.Forms.TabPage();
+ this.listconfigs = new System.Windows.Forms.ListBox();
this.cancel = new System.Windows.Forms.Button();
this.apply = new System.Windows.Forms.Button();
- this.listconfigs = new System.Windows.Forms.ListBox();
label1 = new System.Windows.Forms.Label();
+ groupBox1 = new System.Windows.Forms.GroupBox();
+ label4 = new System.Windows.Forms.Label();
+ label3 = new System.Windows.Forms.Label();
+ label2 = new System.Windows.Forms.Label();
+ groupBox1.SuspendLayout();
this.tabs.SuspendLayout();
this.tabconfigs.SuspendLayout();
this.SuspendLayout();
//
+ // label1
+ //
+ label1.Location = new System.Drawing.Point(16, 25);
+ label1.Name = "label1";
+ label1.Size = new System.Drawing.Size(303, 46);
+ label1.TabIndex = 1;
+ label1.Text = "Select the nodebuilder options to use with this configuration.\r\nThe nodebuilder i" +
+ "s a compiler that builds geometry structures in your map when saved and when usi" +
+ "ng 3D mode.";
+ //
+ // groupBox1
+ //
+ groupBox1.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)));
+ groupBox1.Controls.Add(label4);
+ groupBox1.Controls.Add(label3);
+ groupBox1.Controls.Add(this.configbuildonsave);
+ groupBox1.Controls.Add(label2);
+ groupBox1.Controls.Add(this.confignodebuilder);
+ groupBox1.Controls.Add(label1);
+ groupBox1.Location = new System.Drawing.Point(205, 11);
+ groupBox1.Name = "groupBox1";
+ groupBox1.Size = new System.Drawing.Size(343, 270);
+ groupBox1.TabIndex = 2;
+ groupBox1.TabStop = false;
+ groupBox1.Text = " Configuration Settings ";
+ //
+ // label4
+ //
+ label4.AutoSize = true;
+ label4.Location = new System.Drawing.Point(29, 201);
+ label4.Name = "label4";
+ label4.Size = new System.Drawing.Size(79, 14);
+ label4.TabIndex = 6;
+ label4.Text = "IWAD wad file:";
+ //
+ // label3
+ //
+ label3.Location = new System.Drawing.Point(16, 144);
+ label3.Name = "label3";
+ label3.Size = new System.Drawing.Size(303, 46);
+ label3.TabIndex = 5;
+ label3.Text = "Specify the IWAD wad file to use for this configuration.\r\nThe IWAD should contain" +
+ " all default resources. such as textures and sprites, for the original game.";
+ //
+ // configbuildonsave
+ //
+ this.configbuildonsave.AutoSize = true;
+ this.configbuildonsave.Location = new System.Drawing.Point(102, 111);
+ this.configbuildonsave.Name = "configbuildonsave";
+ this.configbuildonsave.Size = new System.Drawing.Size(201, 18);
+ this.configbuildonsave.TabIndex = 4;
+ this.configbuildonsave.Text = "Build nodes every time when saving";
+ this.configbuildonsave.UseVisualStyleBackColor = true;
+ //
+ // label2
+ //
+ label2.AutoSize = true;
+ label2.Location = new System.Drawing.Point(29, 81);
+ label2.Name = "label2";
+ label2.Size = new System.Drawing.Size(67, 14);
+ label2.TabIndex = 3;
+ label2.Text = "Nodebuilder:";
+ //
+ // confignodebuilder
+ //
+ this.confignodebuilder.FormattingEnabled = true;
+ this.confignodebuilder.Location = new System.Drawing.Point(102, 78);
+ this.confignodebuilder.Name = "confignodebuilder";
+ this.confignodebuilder.Size = new System.Drawing.Size(217, 22);
+ this.confignodebuilder.TabIndex = 2;
+ //
// tabs
//
this.tabs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -54,7 +138,7 @@ namespace CodeImp.DoomBuilder.Interface
this.tabs.Location = new System.Drawing.Point(12, 12);
this.tabs.Name = "tabs";
this.tabs.SelectedIndex = 0;
- this.tabs.Size = new System.Drawing.Size(519, 306);
+ this.tabs.Size = new System.Drawing.Size(566, 320);
this.tabs.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
this.tabs.TabIndex = 0;
//
@@ -64,7 +148,7 @@ namespace CodeImp.DoomBuilder.Interface
this.tabinterface.Location = new System.Drawing.Point(4, 23);
this.tabinterface.Name = "tabinterface";
this.tabinterface.Padding = new System.Windows.Forms.Padding(3);
- this.tabinterface.Size = new System.Drawing.Size(511, 279);
+ this.tabinterface.Size = new System.Drawing.Size(558, 293);
this.tabinterface.TabIndex = 0;
this.tabinterface.Text = "Interface";
this.tabinterface.UseVisualStyleBackColor = true;
@@ -75,28 +159,39 @@ namespace CodeImp.DoomBuilder.Interface
this.tabediting.Location = new System.Drawing.Point(4, 23);
this.tabediting.Name = "tabediting";
this.tabediting.Padding = new System.Windows.Forms.Padding(3);
- this.tabediting.Size = new System.Drawing.Size(511, 279);
+ this.tabediting.Size = new System.Drawing.Size(558, 293);
this.tabediting.TabIndex = 1;
this.tabediting.Text = "Editing";
this.tabediting.UseVisualStyleBackColor = true;
//
// tabconfigs
//
- this.tabconfigs.Controls.Add(label1);
+ this.tabconfigs.Controls.Add(groupBox1);
this.tabconfigs.Controls.Add(this.listconfigs);
this.tabconfigs.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tabconfigs.Location = new System.Drawing.Point(4, 23);
this.tabconfigs.Name = "tabconfigs";
- this.tabconfigs.Size = new System.Drawing.Size(511, 279);
+ this.tabconfigs.Size = new System.Drawing.Size(558, 293);
this.tabconfigs.TabIndex = 2;
this.tabconfigs.Text = "Configurations";
this.tabconfigs.UseVisualStyleBackColor = true;
//
+ // listconfigs
+ //
+ this.listconfigs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)));
+ this.listconfigs.FormattingEnabled = true;
+ this.listconfigs.ItemHeight = 14;
+ this.listconfigs.Location = new System.Drawing.Point(11, 11);
+ this.listconfigs.Name = "listconfigs";
+ this.listconfigs.Size = new System.Drawing.Size(181, 270);
+ this.listconfigs.TabIndex = 0;
+ //
// 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(419, 332);
+ this.cancel.Location = new System.Drawing.Point(466, 346);
this.cancel.Name = "cancel";
this.cancel.Size = new System.Drawing.Size(112, 25);
this.cancel.TabIndex = 17;
@@ -106,39 +201,20 @@ 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(301, 332);
+ this.apply.Location = new System.Drawing.Point(348, 346);
this.apply.Name = "apply";
this.apply.Size = new System.Drawing.Size(112, 25);
this.apply.TabIndex = 16;
this.apply.Text = "OK";
this.apply.UseVisualStyleBackColor = true;
//
- // listconfigs
- //
- this.listconfigs.FormattingEnabled = true;
- this.listconfigs.ItemHeight = 14;
- this.listconfigs.Location = new System.Drawing.Point(11, 11);
- this.listconfigs.Name = "listconfigs";
- this.listconfigs.Size = new System.Drawing.Size(181, 256);
- this.listconfigs.TabIndex = 0;
- //
- // label1
- //
- label1.Location = new System.Drawing.Point(209, 11);
- label1.Name = "label1";
- label1.Size = new System.Drawing.Size(288, 46);
- label1.TabIndex = 1;
- label1.Text = "Select the nodebuilder to use with this configuration. The nodebuilder is a compi" +
- "ler that builds geometry structures in your map when saved and when using 3D mod" +
- "e.";
- //
// ConfigForm
//
this.AcceptButton = this.apply;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 14F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancel;
- this.ClientSize = new System.Drawing.Size(543, 368);
+ this.ClientSize = new System.Drawing.Size(590, 382);
this.Controls.Add(this.cancel);
this.Controls.Add(this.apply);
this.Controls.Add(this.tabs);
@@ -150,6 +226,8 @@ namespace CodeImp.DoomBuilder.Interface
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Configuration";
+ groupBox1.ResumeLayout(false);
+ groupBox1.PerformLayout();
this.tabs.ResumeLayout(false);
this.tabconfigs.ResumeLayout(false);
this.ResumeLayout(false);
@@ -165,5 +243,7 @@ namespace CodeImp.DoomBuilder.Interface
private System.Windows.Forms.Button cancel;
private System.Windows.Forms.Button apply;
private System.Windows.Forms.ListBox listconfigs;
+ private System.Windows.Forms.ComboBox confignodebuilder;
+ private System.Windows.Forms.CheckBox configbuildonsave;
}
}
\ No newline at end of file
diff --git a/Source/Interface/ConfigForm.resx b/Source/Interface/ConfigForm.resx
index ec506200..45a02f7a 100644
--- a/Source/Interface/ConfigForm.resx
+++ b/Source/Interface/ConfigForm.resx
@@ -120,4 +120,16 @@
False
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
\ No newline at end of file
diff --git a/Source/Interface/MapOptionsForm.Designer.cs b/Source/Interface/MapOptionsForm.Designer.cs
index 258ec2f7..3a2fc1b6 100644
--- a/Source/Interface/MapOptionsForm.Designer.cs
+++ b/Source/Interface/MapOptionsForm.Designer.cs
@@ -32,22 +32,20 @@ namespace CodeImp.DoomBuilder.Interface
System.Windows.Forms.Label label2;
System.Windows.Forms.Label label1;
System.Windows.Forms.GroupBox panelsettings;
- System.Windows.Forms.GroupBox panelres;
+ System.Windows.Forms.Label label4;
this.levelname = new System.Windows.Forms.TextBox();
this.config = new System.Windows.Forms.ComboBox();
- this.deleteresource = new System.Windows.Forms.Button();
- this.editresource = new System.Windows.Forms.Button();
- this.addresource = new System.Windows.Forms.Button();
- this.resources = new System.Windows.Forms.ListBox();
this.apply = new System.Windows.Forms.Button();
this.cancel = new System.Windows.Forms.Button();
+ this.panelres = new System.Windows.Forms.GroupBox();
+ this.resourcelocations = new CodeImp.DoomBuilder.Interface.ResourceListEditor();
label3 = new System.Windows.Forms.Label();
label2 = new System.Windows.Forms.Label();
label1 = new System.Windows.Forms.Label();
panelsettings = new System.Windows.Forms.GroupBox();
- panelres = new System.Windows.Forms.GroupBox();
+ label4 = new System.Windows.Forms.Label();
panelsettings.SuspendLayout();
- panelres.SuspendLayout();
+ this.panelres.SuspendLayout();
this.SuspendLayout();
//
// label3
@@ -88,7 +86,7 @@ namespace CodeImp.DoomBuilder.Interface
panelsettings.Controls.Add(label1);
panelsettings.Location = new System.Drawing.Point(12, 12);
panelsettings.Name = "panelsettings";
- panelsettings.Size = new System.Drawing.Size(365, 118);
+ panelsettings.Size = new System.Drawing.Size(367, 118);
panelsettings.TabIndex = 10;
panelsettings.TabStop = false;
panelsettings.Text = " Settings ";
@@ -109,67 +107,10 @@ namespace CodeImp.DoomBuilder.Interface
this.config.Size = new System.Drawing.Size(213, 22);
this.config.TabIndex = 6;
//
- // panelres
- //
- panelres.Controls.Add(this.deleteresource);
- panelres.Controls.Add(this.editresource);
- panelres.Controls.Add(this.addresource);
- panelres.Controls.Add(this.resources);
- panelres.Location = new System.Drawing.Point(12, 145);
- panelres.Name = "panelres";
- panelres.Size = new System.Drawing.Size(365, 165);
- panelres.TabIndex = 11;
- panelres.TabStop = false;
- panelres.Text = " Custom Resources ";
- //
- // deleteresource
- //
- this.deleteresource.Enabled = false;
- this.deleteresource.Location = new System.Drawing.Point(268, 125);
- this.deleteresource.Name = "deleteresource";
- this.deleteresource.Size = new System.Drawing.Size(74, 25);
- this.deleteresource.TabIndex = 13;
- this.deleteresource.Text = "Remove";
- this.deleteresource.UseVisualStyleBackColor = true;
- this.deleteresource.Click += new System.EventHandler(this.deleteresource_Click);
- //
- // editresource
- //
- this.editresource.Enabled = false;
- this.editresource.Location = new System.Drawing.Point(139, 125);
- this.editresource.Name = "editresource";
- this.editresource.Size = new System.Drawing.Size(123, 25);
- this.editresource.TabIndex = 12;
- this.editresource.Text = "Resource Options...";
- this.editresource.UseVisualStyleBackColor = true;
- this.editresource.Click += new System.EventHandler(this.editresource_Click);
- //
- // addresource
- //
- this.addresource.Location = new System.Drawing.Point(21, 125);
- this.addresource.Name = "addresource";
- this.addresource.Size = new System.Drawing.Size(112, 25);
- this.addresource.TabIndex = 11;
- this.addresource.Text = "Add Resource...";
- this.addresource.UseVisualStyleBackColor = true;
- this.addresource.Click += new System.EventHandler(this.addresource_Click);
- //
- // resources
- //
- this.resources.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.resources.FormattingEnabled = true;
- this.resources.ItemHeight = 14;
- this.resources.Location = new System.Drawing.Point(21, 31);
- this.resources.Name = "resources";
- this.resources.Size = new System.Drawing.Size(321, 88);
- this.resources.TabIndex = 10;
- this.resources.DoubleClick += new System.EventHandler(this.resources_DoubleClick);
- this.resources.SelectedIndexChanged += new System.EventHandler(this.resources_SelectedIndexChanged);
- //
// apply
//
- this.apply.Location = new System.Drawing.Point(147, 330);
+ this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.apply.Location = new System.Drawing.Point(149, 355);
this.apply.Name = "apply";
this.apply.Size = new System.Drawing.Size(112, 25);
this.apply.TabIndex = 12;
@@ -179,8 +120,9 @@ namespace CodeImp.DoomBuilder.Interface
//
// 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(265, 330);
+ this.cancel.Location = new System.Drawing.Point(267, 355);
this.cancel.Name = "cancel";
this.cancel.Size = new System.Drawing.Size(112, 25);
this.cancel.TabIndex = 13;
@@ -188,16 +130,45 @@ namespace CodeImp.DoomBuilder.Interface
this.cancel.UseVisualStyleBackColor = true;
this.cancel.Click += new System.EventHandler(this.cancel_Click);
//
+ // panelres
+ //
+ this.panelres.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.panelres.Controls.Add(this.resourcelocations);
+ this.panelres.Controls.Add(label4);
+ this.panelres.Location = new System.Drawing.Point(12, 141);
+ this.panelres.Name = "panelres";
+ this.panelres.Size = new System.Drawing.Size(367, 198);
+ this.panelres.TabIndex = 14;
+ this.panelres.TabStop = false;
+ this.panelres.Text = " Custom Resources ";
+ //
+ // resourcelocations
+ //
+ this.resourcelocations.Location = new System.Drawing.Point(15, 28);
+ this.resourcelocations.Name = "resourcelocations";
+ this.resourcelocations.Size = new System.Drawing.Size(336, 130);
+ this.resourcelocations.TabIndex = 18;
+ //
+ // label4
+ //
+ label4.Location = new System.Drawing.Point(15, 161);
+ label4.Name = "label4";
+ label4.Size = new System.Drawing.Size(336, 34);
+ label4.TabIndex = 17;
+ label4.Text = "Drag items to change order (lower items override higher items). Grayed items are " +
+ "loaded according to the game configuration.";
+ //
// MapOptionsForm
//
this.AcceptButton = this.apply;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 14F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancel;
- this.ClientSize = new System.Drawing.Size(389, 367);
+ this.ClientSize = new System.Drawing.Size(391, 392);
+ this.Controls.Add(this.panelres);
this.Controls.Add(this.cancel);
this.Controls.Add(this.apply);
- this.Controls.Add(panelres);
this.Controls.Add(panelsettings);
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
@@ -211,7 +182,7 @@ namespace CodeImp.DoomBuilder.Interface
this.Text = "Map Options";
panelsettings.ResumeLayout(false);
panelsettings.PerformLayout();
- panelres.ResumeLayout(false);
+ this.panelres.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -220,12 +191,10 @@ namespace CodeImp.DoomBuilder.Interface
private System.Windows.Forms.TextBox levelname;
private System.Windows.Forms.ComboBox config;
- private System.Windows.Forms.Button deleteresource;
- private System.Windows.Forms.Button editresource;
- private System.Windows.Forms.Button addresource;
- private System.Windows.Forms.ListBox resources;
private System.Windows.Forms.Button apply;
private System.Windows.Forms.Button cancel;
+ private System.Windows.Forms.GroupBox panelres;
+ private ResourceListEditor resourcelocations;
}
diff --git a/Source/Interface/MapOptionsForm.cs b/Source/Interface/MapOptionsForm.cs
index 7a4ad2dc..637edc2b 100644
--- a/Source/Interface/MapOptionsForm.cs
+++ b/Source/Interface/MapOptionsForm.cs
@@ -64,8 +64,7 @@ namespace CodeImp.DoomBuilder.Interface
levelname.Text = options.CurrentName;
// Fill the resources list
- foreach(ResourceLocation res in options.Resources)
- resources.Items.Add(res);
+ resourcelocations.EditResourceLocationList(options.Resources);
}
// OK clicked
@@ -93,7 +92,7 @@ namespace CodeImp.DoomBuilder.Interface
options.ClearResources();
options.ConfigFile = General.Configs[config.SelectedIndex].filename;
options.CurrentName = levelname.Text.Trim().ToUpper();
- foreach(ResourceLocation res in resources.Items) options.AddResource(res);
+ options.CopyResources(resourcelocations.GetResources());
// Hide window
this.DialogResult = DialogResult.OK;
@@ -107,73 +106,5 @@ namespace CodeImp.DoomBuilder.Interface
this.DialogResult = DialogResult.Cancel;
this.Hide();
}
-
- // Add Resource clicked
- private void addresource_Click(object sender, EventArgs e)
- {
- ResourceOptionsForm resoptions;
- Point startposition;
-
- // Open resource options dialog
- resoptions = new ResourceOptionsForm(new ResourceLocation(), "Add Resource");
- resoptions.StartPosition = FormStartPosition.Manual;
- startposition = this.Location;
- startposition.Offset(50, 160);
- resoptions.Location = startposition;
- if(resoptions.ShowDialog(this) == DialogResult.OK)
- {
- // Add resource
- resources.Items.Add(resoptions.ResourceLocation);
- }
- }
-
- // Resource Options clicked
- private void editresource_Click(object sender, EventArgs e)
- {
- ResourceOptionsForm resoptions;
- Point startposition;
-
- // Anything selected?
- if(resources.SelectedIndex > -1)
- {
- // Open resource options dialog
- resoptions = new ResourceOptionsForm((ResourceLocation)resources.SelectedItem, "Resource Options");
- resoptions.StartPosition = FormStartPosition.Manual;
- startposition = this.Location;
- startposition.Offset(50, 160);
- resoptions.Location = startposition;
- if(resoptions.ShowDialog(this) == DialogResult.OK)
- {
- // Replace resource
- resources.Items[resources.SelectedIndex] = resoptions.ResourceLocation;
- }
- }
- }
-
- // Remove resource clicked
- private void deleteresource_Click(object sender, EventArgs e)
- {
- // Anything selected?
- if(resources.SelectedIndex > -1)
- {
- // Remove it
- resources.Items.RemoveAt(resources.SelectedIndex);
- }
- }
-
- // Resource selection changes
- private void resources_SelectedIndexChanged(object sender, EventArgs e)
- {
- // Enable/disable buttons
- editresource.Enabled = (resources.SelectedIndex > -1);
- deleteresource.Enabled = (resources.SelectedIndex > -1);
- }
-
- // Resource doubleclicked
- private void resources_DoubleClick(object sender, EventArgs e)
- {
- // Click Edit Resource
- if(resources.SelectedIndex > -1) editresource.PerformClick();
- }
}
}
\ No newline at end of file
diff --git a/Source/Interface/MapOptionsForm.resx b/Source/Interface/MapOptionsForm.resx
index 721df297..17bdcd9f 100644
--- a/Source/Interface/MapOptionsForm.resx
+++ b/Source/Interface/MapOptionsForm.resx
@@ -117,61 +117,19 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- True
-
False
-
- True
-
False
-
- True
-
False
False
-
- True
-
-
- True
-
-
- True
-
-
+
False
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
\ No newline at end of file
diff --git a/Source/Interface/OpenMapOptionsForm.Designer.cs b/Source/Interface/OpenMapOptionsForm.Designer.cs
index e75bd179..31dbb44b 100644
--- a/Source/Interface/OpenMapOptionsForm.Designer.cs
+++ b/Source/Interface/OpenMapOptionsForm.Designer.cs
@@ -29,18 +29,19 @@ namespace CodeImp.DoomBuilder.Interface
private void InitializeComponent()
{
System.Windows.Forms.ColumnHeader columnHeader1;
+ System.Windows.Forms.Label label1;
+ System.Windows.Forms.Label label2;
+ System.Windows.Forms.Label label3;
this.panelres = new System.Windows.Forms.GroupBox();
- this.deleteresource = new System.Windows.Forms.Button();
- this.editresource = new System.Windows.Forms.Button();
- this.addresource = new System.Windows.Forms.Button();
- this.resources = new System.Windows.Forms.ListBox();
- this.label1 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
+ this.resourcelocations = new CodeImp.DoomBuilder.Interface.ResourceListEditor();
this.apply = new System.Windows.Forms.Button();
this.cancel = new System.Windows.Forms.Button();
this.config = new System.Windows.Forms.ComboBox();
this.mapslist = new System.Windows.Forms.ListView();
columnHeader1 = new System.Windows.Forms.ColumnHeader();
+ label1 = new System.Windows.Forms.Label();
+ label2 = new System.Windows.Forms.Label();
+ label3 = new System.Windows.Forms.Label();
this.panelres.SuspendLayout();
this.SuspendLayout();
//
@@ -48,87 +49,57 @@ namespace CodeImp.DoomBuilder.Interface
//
columnHeader1.Text = "Map name";
//
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.Location = new System.Drawing.Point(30, 24);
+ label1.Name = "label1";
+ label1.Size = new System.Drawing.Size(105, 14);
+ label1.TabIndex = 14;
+ label1.Text = "Game Configuration:";
+ //
+ // label2
+ //
+ label2.Location = new System.Drawing.Point(12, 57);
+ label2.Name = "label2";
+ label2.Size = new System.Drawing.Size(365, 30);
+ label2.TabIndex = 16;
+ label2.Text = "With the above selected configuration, the maps shown below were found in the cho" +
+ "sen WAD file. Please select the map to load for editing.";
+ //
+ // label3
+ //
+ label3.Location = new System.Drawing.Point(14, 161);
+ label3.Name = "label3";
+ label3.Size = new System.Drawing.Size(336, 34);
+ label3.TabIndex = 17;
+ label3.Text = "Drag items to change order (lower items override higher items). Grayed items are " +
+ "loaded according to the game configuration.";
+ //
// panelres
//
- this.panelres.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.panelres.Controls.Add(this.deleteresource);
- this.panelres.Controls.Add(this.editresource);
- this.panelres.Controls.Add(this.addresource);
- this.panelres.Controls.Add(this.resources);
+ this.panelres.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.panelres.Controls.Add(this.resourcelocations);
+ this.panelres.Controls.Add(label3);
this.panelres.Location = new System.Drawing.Point(12, 214);
this.panelres.Name = "panelres";
- this.panelres.Size = new System.Drawing.Size(365, 165);
+ this.panelres.Size = new System.Drawing.Size(365, 198);
this.panelres.TabIndex = 11;
this.panelres.TabStop = false;
this.panelres.Text = " Custom Resources ";
//
- // deleteresource
+ // resourcelocations
//
- this.deleteresource.Enabled = false;
- this.deleteresource.Location = new System.Drawing.Point(268, 125);
- this.deleteresource.Name = "deleteresource";
- this.deleteresource.Size = new System.Drawing.Size(74, 25);
- this.deleteresource.TabIndex = 13;
- this.deleteresource.Text = "Remove";
- this.deleteresource.UseVisualStyleBackColor = true;
- this.deleteresource.Click += new System.EventHandler(this.deleteresource_Click);
- //
- // editresource
- //
- this.editresource.Enabled = false;
- this.editresource.Location = new System.Drawing.Point(139, 125);
- this.editresource.Name = "editresource";
- this.editresource.Size = new System.Drawing.Size(123, 25);
- this.editresource.TabIndex = 12;
- this.editresource.Text = "Resource Options...";
- this.editresource.UseVisualStyleBackColor = true;
- this.editresource.Click += new System.EventHandler(this.editresource_Click);
- //
- // addresource
- //
- this.addresource.Location = new System.Drawing.Point(21, 125);
- this.addresource.Name = "addresource";
- this.addresource.Size = new System.Drawing.Size(112, 25);
- this.addresource.TabIndex = 11;
- this.addresource.Text = "Add Resource...";
- this.addresource.UseVisualStyleBackColor = true;
- this.addresource.Click += new System.EventHandler(this.addresource_Click);
- //
- // resources
- //
- this.resources.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.resources.FormattingEnabled = true;
- this.resources.ItemHeight = 14;
- this.resources.Location = new System.Drawing.Point(21, 31);
- this.resources.Name = "resources";
- this.resources.Size = new System.Drawing.Size(321, 88);
- this.resources.TabIndex = 10;
- this.resources.DoubleClick += new System.EventHandler(this.resources_DoubleClick);
- this.resources.SelectedIndexChanged += new System.EventHandler(this.resources_SelectedIndexChanged);
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(30, 24);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(105, 14);
- this.label1.TabIndex = 14;
- this.label1.Text = "Game Configuration:";
- //
- // label2
- //
- this.label2.Location = new System.Drawing.Point(12, 57);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(365, 30);
- this.label2.TabIndex = 16;
- this.label2.Text = "With the above selected configuration, the maps shown below were found in the cho" +
- "sen WAD file. Please select the map to load for editing.";
+ this.resourcelocations.Location = new System.Drawing.Point(14, 26);
+ this.resourcelocations.Name = "resourcelocations";
+ this.resourcelocations.Size = new System.Drawing.Size(336, 127);
+ this.resourcelocations.TabIndex = 18;
//
// 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(147, 399);
+ this.apply.Location = new System.Drawing.Point(147, 428);
this.apply.Name = "apply";
this.apply.Size = new System.Drawing.Size(112, 25);
this.apply.TabIndex = 12;
@@ -140,7 +111,7 @@ namespace CodeImp.DoomBuilder.Interface
//
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(265, 399);
+ this.cancel.Location = new System.Drawing.Point(265, 428);
this.cancel.Name = "cancel";
this.cancel.Size = new System.Drawing.Size(112, 25);
this.cancel.TabIndex = 13;
@@ -160,6 +131,8 @@ namespace CodeImp.DoomBuilder.Interface
//
// mapslist
//
+ this.mapslist.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.mapslist.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
columnHeader1});
this.mapslist.FullRowSelect = true;
@@ -183,11 +156,11 @@ namespace CodeImp.DoomBuilder.Interface
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 14F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancel;
- this.ClientSize = new System.Drawing.Size(389, 436);
+ this.ClientSize = new System.Drawing.Size(389, 465);
this.Controls.Add(this.mapslist);
- this.Controls.Add(this.label2);
+ this.Controls.Add(label2);
this.Controls.Add(this.config);
- this.Controls.Add(this.label1);
+ this.Controls.Add(label1);
this.Controls.Add(this.cancel);
this.Controls.Add(this.apply);
this.Controls.Add(this.panelres);
@@ -210,17 +183,12 @@ namespace CodeImp.DoomBuilder.Interface
#endregion
- private System.Windows.Forms.Button deleteresource;
- private System.Windows.Forms.Button editresource;
- private System.Windows.Forms.Button addresource;
- private System.Windows.Forms.ListBox resources;
private System.Windows.Forms.Button apply;
private System.Windows.Forms.Button cancel;
private System.Windows.Forms.ComboBox config;
private System.Windows.Forms.GroupBox panelres;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.Label label2;
private System.Windows.Forms.ListView mapslist;
+ private ResourceListEditor resourcelocations;
}
diff --git a/Source/Interface/OpenMapOptionsForm.cs b/Source/Interface/OpenMapOptionsForm.cs
index f85421da..c2c283c9 100644
--- a/Source/Interface/OpenMapOptionsForm.cs
+++ b/Source/Interface/OpenMapOptionsForm.cs
@@ -275,7 +275,7 @@ namespace CodeImp.DoomBuilder.Interface
options.ClearResources();
options.ConfigFile = General.Configs[config.SelectedIndex].filename;
options.CurrentName = mapslist.SelectedItems[0].Text;
- foreach(ResourceLocation res in resources.Items) options.AddResource(res);
+ options.CopyResources(resourcelocations.GetResources());
// Hide window
wadfile.Dispose();
@@ -292,67 +292,6 @@ namespace CodeImp.DoomBuilder.Interface
this.Hide();
}
- // Add Resource clicked
- private void addresource_Click(object sender, EventArgs e)
- {
- ResourceOptionsForm resoptions;
- Point startposition;
-
- // Open resource options dialog
- resoptions = new ResourceOptionsForm(new ResourceLocation(), "Add Resource");
- resoptions.StartPosition = FormStartPosition.Manual;
- startposition = this.Location;
- startposition.Offset(50, 230);
- resoptions.Location = startposition;
- if(resoptions.ShowDialog(this) == DialogResult.OK)
- {
- // Add resource
- resources.Items.Add(resoptions.ResourceLocation);
- }
- }
-
- // Resource Options clicked
- private void editresource_Click(object sender, EventArgs e)
- {
- ResourceOptionsForm resoptions;
- Point startposition;
-
- // Anything selected?
- if(resources.SelectedIndex > -1)
- {
- // Open resource options dialog
- resoptions = new ResourceOptionsForm((ResourceLocation)resources.SelectedItem, "Resource Options");
- resoptions.StartPosition = FormStartPosition.Manual;
- startposition = this.Location;
- startposition.Offset(50, 230);
- resoptions.Location = startposition;
- if(resoptions.ShowDialog(this) == DialogResult.OK)
- {
- // Replace resource
- resources.Items[resources.SelectedIndex] = resoptions.ResourceLocation;
- }
- }
- }
-
- // Remove resource clicked
- private void deleteresource_Click(object sender, EventArgs e)
- {
- // Anything selected?
- if(resources.SelectedIndex > -1)
- {
- // Remove it
- resources.Items.RemoveAt(resources.SelectedIndex);
- }
- }
-
- // Resource selection changes
- private void resources_SelectedIndexChanged(object sender, EventArgs e)
- {
- // Enable/disable buttons
- editresource.Enabled = (resources.SelectedIndex > -1);
- deleteresource.Enabled = (resources.SelectedIndex > -1);
- }
-
// Window is shown
private void OpenMapOptionsForm_Shown(object sender, EventArgs e)
{
@@ -370,11 +309,5 @@ namespace CodeImp.DoomBuilder.Interface
if(mapslist.SelectedItems.Count > 0) apply.PerformClick();
}
- // Resource doubeclicked
- private void resources_DoubleClick(object sender, EventArgs e)
- {
- // Click Edit Resource
- if(resources.SelectedIndex > -1) editresource.PerformClick();
- }
}
}
\ No newline at end of file
diff --git a/Source/Interface/OpenMapOptionsForm.resx b/Source/Interface/OpenMapOptionsForm.resx
index 999a0947..3907cb47 100644
--- a/Source/Interface/OpenMapOptionsForm.resx
+++ b/Source/Interface/OpenMapOptionsForm.resx
@@ -120,40 +120,13 @@
False
-
- True
+
+ False
-
- True
+
+ False
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
+
+ False
\ No newline at end of file
diff --git a/Source/Interface/ResourceListEditor.Designer.cs b/Source/Interface/ResourceListEditor.Designer.cs
new file mode 100644
index 00000000..e084aabf
--- /dev/null
+++ b/Source/Interface/ResourceListEditor.Designer.cs
@@ -0,0 +1,223 @@
+namespace CodeImp.DoomBuilder.Interface
+{
+ internal partial class ResourceListEditor
+ {
+ ///
+ /// 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.components = new System.ComponentModel.Container();
+ System.Windows.Forms.SplitContainer buttonsbar2;
+ System.Windows.Forms.SplitContainer buttonsbar1;
+ System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem(new string[] {
+ "C:\\Windows\\Doom\\Doom2.wad"}, 3, System.Drawing.SystemColors.GrayText, System.Drawing.SystemColors.Window, null);
+ System.Windows.Forms.ListViewItem listViewItem2 = new System.Windows.Forms.ListViewItem(new string[] {
+ "C:\\My\\Little\\Textures\\"}, 2, System.Drawing.SystemColors.GrayText, System.Drawing.SystemColors.Window, null);
+ System.Windows.Forms.ListViewItem listViewItem3 = new System.Windows.Forms.ListViewItem("C:\\My\\Little\\Pony.wad", 1);
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ResourceListEditor));
+ this.editresource = new System.Windows.Forms.Button();
+ this.deleteresource = new System.Windows.Forms.Button();
+ this.addresource = new System.Windows.Forms.Button();
+ this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.resourceitems = new CodeImp.DoomBuilder.Interface.ResourceListView();
+ this.column = new System.Windows.Forms.ColumnHeader();
+ this.images = new System.Windows.Forms.ImageList(this.components);
+ buttonsbar2 = new System.Windows.Forms.SplitContainer();
+ buttonsbar1 = new System.Windows.Forms.SplitContainer();
+ buttonsbar2.Panel1.SuspendLayout();
+ buttonsbar2.Panel2.SuspendLayout();
+ buttonsbar2.SuspendLayout();
+ buttonsbar1.Panel1.SuspendLayout();
+ buttonsbar1.Panel2.SuspendLayout();
+ buttonsbar1.SuspendLayout();
+ this.splitContainer1.Panel1.SuspendLayout();
+ this.splitContainer1.Panel2.SuspendLayout();
+ this.splitContainer1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // buttonsbar2
+ //
+ buttonsbar2.Dock = System.Windows.Forms.DockStyle.Fill;
+ buttonsbar2.IsSplitterFixed = true;
+ buttonsbar2.Location = new System.Drawing.Point(0, 0);
+ buttonsbar2.Name = "buttonsbar2";
+ //
+ // buttonsbar2.Panel1
+ //
+ buttonsbar2.Panel1.Controls.Add(this.editresource);
+ //
+ // buttonsbar2.Panel2
+ //
+ buttonsbar2.Panel2.Controls.Add(this.deleteresource);
+ buttonsbar2.Size = new System.Drawing.Size(228, 24);
+ buttonsbar2.SplitterDistance = 136;
+ buttonsbar2.TabIndex = 0;
+ //
+ // editresource
+ //
+ this.editresource.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.editresource.Enabled = false;
+ this.editresource.Location = new System.Drawing.Point(0, 0);
+ this.editresource.Name = "editresource";
+ this.editresource.Size = new System.Drawing.Size(136, 24);
+ this.editresource.TabIndex = 18;
+ this.editresource.Text = "Resource options...";
+ this.editresource.UseVisualStyleBackColor = true;
+ this.editresource.Click += new System.EventHandler(this.editresource_Click);
+ //
+ // deleteresource
+ //
+ this.deleteresource.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.deleteresource.Enabled = false;
+ this.deleteresource.Location = new System.Drawing.Point(0, 0);
+ this.deleteresource.Name = "deleteresource";
+ this.deleteresource.Size = new System.Drawing.Size(88, 24);
+ this.deleteresource.TabIndex = 19;
+ this.deleteresource.Text = "Remove";
+ this.deleteresource.UseVisualStyleBackColor = true;
+ this.deleteresource.Click += new System.EventHandler(this.deleteresource_Click);
+ //
+ // buttonsbar1
+ //
+ buttonsbar1.Dock = System.Windows.Forms.DockStyle.Fill;
+ buttonsbar1.IsSplitterFixed = true;
+ buttonsbar1.Location = new System.Drawing.Point(0, 0);
+ buttonsbar1.Name = "buttonsbar1";
+ //
+ // buttonsbar1.Panel1
+ //
+ buttonsbar1.Panel1.Controls.Add(this.addresource);
+ //
+ // buttonsbar1.Panel2
+ //
+ buttonsbar1.Panel2.Controls.Add(buttonsbar2);
+ buttonsbar1.Size = new System.Drawing.Size(350, 24);
+ buttonsbar1.SplitterDistance = 118;
+ buttonsbar1.TabIndex = 21;
+ //
+ // addresource
+ //
+ this.addresource.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.addresource.Location = new System.Drawing.Point(0, 0);
+ this.addresource.Name = "addresource";
+ this.addresource.Size = new System.Drawing.Size(118, 24);
+ this.addresource.TabIndex = 17;
+ this.addresource.Text = "Add resource...";
+ this.addresource.UseVisualStyleBackColor = true;
+ this.addresource.Click += new System.EventHandler(this.addresource_Click);
+ //
+ // splitContainer1
+ //
+ this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
+ this.splitContainer1.IsSplitterFixed = true;
+ this.splitContainer1.Location = new System.Drawing.Point(0, 0);
+ this.splitContainer1.Name = "splitContainer1";
+ this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
+ //
+ // splitContainer1.Panel1
+ //
+ this.splitContainer1.Panel1.Controls.Add(this.resourceitems);
+ //
+ // splitContainer1.Panel2
+ //
+ this.splitContainer1.Panel2.Controls.Add(buttonsbar1);
+ this.splitContainer1.Panel2MinSize = 24;
+ this.splitContainer1.Size = new System.Drawing.Size(350, 166);
+ this.splitContainer1.SplitterDistance = 138;
+ this.splitContainer1.TabIndex = 22;
+ //
+ // resourceitems
+ //
+ this.resourceitems.AllowDrop = true;
+ this.resourceitems.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.column});
+ this.resourceitems.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.resourceitems.FullRowSelect = true;
+ this.resourceitems.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
+ this.resourceitems.HideSelection = false;
+ this.resourceitems.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
+ listViewItem1,
+ listViewItem2,
+ listViewItem3});
+ this.resourceitems.Location = new System.Drawing.Point(0, 0);
+ this.resourceitems.MultiSelect = false;
+ this.resourceitems.Name = "resourceitems";
+ this.resourceitems.ShowGroups = false;
+ this.resourceitems.ShowItemToolTips = true;
+ this.resourceitems.Size = new System.Drawing.Size(350, 138);
+ this.resourceitems.SmallImageList = this.images;
+ this.resourceitems.TabIndex = 20;
+ this.resourceitems.UseCompatibleStateImageBehavior = false;
+ this.resourceitems.View = System.Windows.Forms.View.Details;
+ this.resourceitems.DoubleClick += new System.EventHandler(this.resourceitems_DoubleClick);
+ this.resourceitems.SizeChanged += new System.EventHandler(this.resources_SizeChanged);
+ this.resourceitems.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.resourceitems_ItemSelectionChanged);
+ //
+ // column
+ //
+ this.column.Text = "Resource location";
+ this.column.Width = 200;
+ //
+ // images
+ //
+ this.images.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("images.ImageStream")));
+ this.images.TransparentColor = System.Drawing.Color.Transparent;
+ this.images.Images.SetKeyName(0, "Folder.ico");
+ this.images.Images.SetKeyName(1, "File.ico");
+ this.images.Images.SetKeyName(2, "FolderLocked.ico");
+ this.images.Images.SetKeyName(3, "FileLocked.ico");
+ //
+ // ResourceListEditor
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.splitContainer1);
+ this.Name = "ResourceListEditor";
+ this.Size = new System.Drawing.Size(350, 166);
+ buttonsbar2.Panel1.ResumeLayout(false);
+ buttonsbar2.Panel2.ResumeLayout(false);
+ buttonsbar2.ResumeLayout(false);
+ buttonsbar1.Panel1.ResumeLayout(false);
+ buttonsbar1.Panel2.ResumeLayout(false);
+ buttonsbar1.ResumeLayout(false);
+ this.splitContainer1.Panel1.ResumeLayout(false);
+ this.splitContainer1.Panel2.ResumeLayout(false);
+ this.splitContainer1.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button deleteresource;
+ private System.Windows.Forms.Button editresource;
+ private System.Windows.Forms.Button addresource;
+ private CodeImp.DoomBuilder.Interface.ResourceListView resourceitems;
+ private System.Windows.Forms.ColumnHeader column;
+ private System.Windows.Forms.SplitContainer splitContainer1;
+ private System.Windows.Forms.ImageList images;
+ }
+}
diff --git a/Source/Interface/ResourceListEditor.cs b/Source/Interface/ResourceListEditor.cs
new file mode 100644
index 00000000..b4810413
--- /dev/null
+++ b/Source/Interface/ResourceListEditor.cs
@@ -0,0 +1,266 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
+using System.Windows.Forms;
+using CodeImp.DoomBuilder.Images;
+
+namespace CodeImp.DoomBuilder.Interface
+{
+ internal partial class ResourceListEditor : UserControl
+ {
+ #region ================== Variables
+
+ #endregion
+
+ #region ================== Constructor / Disposer
+
+ // Constructor
+ public ResourceListEditor()
+ {
+ // Initialize
+ InitializeComponent();
+ ResizeColumnHeader();
+
+ // Start with a clear list
+ resourceitems.Items.Clear();
+ }
+
+ #endregion
+
+ #region ================== Methods
+
+ // This will show a fixed list
+ public void FixedResourceLocationList(ResourceLocationList list)
+ {
+ // Start editing list
+ resourceitems.BeginUpdate();
+
+ // Go for all items
+ for(int i = resourceitems.Items.Count; i >= 0; i--)
+ {
+ // Remove item if fixed
+ if(resourceitems.Items[i].ForeColor != SystemColors.WindowText)
+ resourceitems.Items.RemoveAt(i);
+ }
+
+ // Go for all items
+ for(int i = list.Count; i >= 0; i--)
+ {
+ // Add item as fixed
+ resourceitems.Items.Insert(0, new ListViewItem(list[i].location));
+ resourceitems.Items[0].Tag = list[i];
+
+ // Set icon
+ if(list[i].type == ResourceLocation.RESOURCE_DIRECTORY)
+ resourceitems.Items[0].ImageIndex = 2;
+ else if(list[i].type == ResourceLocation.RESOURCE_WAD)
+ resourceitems.Items[0].ImageIndex = 3;
+
+ // Set disabled
+ resourceitems.Items[0].ForeColor = SystemColors.GrayText;
+ }
+
+ // Done
+ resourceitems.EndUpdate();
+ }
+
+ // This will edit the given list
+ public void EditResourceLocationList(ResourceLocationList list)
+ {
+ // Start editing list
+ resourceitems.BeginUpdate();
+
+ // Go for all items
+ for(int i = resourceitems.Items.Count; i >= 0; i--)
+ {
+ // Remove item unless fixed
+ if(resourceitems.Items[i].ForeColor == SystemColors.WindowText)
+ resourceitems.Items.RemoveAt(i);
+ }
+
+ // Go for all items
+ for(int i = 0; i < list.Count; i++)
+ {
+ // Add item
+ AddItem(list[i]);
+ }
+
+ // Done
+ resourceitems.EndUpdate();
+ }
+
+ // This adds a normal item
+ public void AddItem(ResourceLocation rl)
+ {
+ int index;
+
+ // Start editing list
+ resourceitems.BeginUpdate();
+
+ // Add item
+ index = resourceitems.Items.Count;
+ resourceitems.Items.Add(new ListViewItem(rl.location));
+ resourceitems.Items[index].Tag = rl;
+
+ // Set icon
+ if(rl.type == ResourceLocation.RESOURCE_DIRECTORY)
+ resourceitems.Items[index].ImageIndex = 0;
+ else if(rl.type == ResourceLocation.RESOURCE_WAD)
+ resourceitems.Items[index].ImageIndex = 1;
+
+ // Set normal color
+ resourceitems.Items[index].ForeColor = SystemColors.WindowText;
+
+ // Done
+ resourceitems.EndUpdate();
+ }
+
+ // This fixes the column header in the list
+ private void ResizeColumnHeader()
+ {
+ // Resize column header to full extend
+ column.Width = resourceitems.ClientSize.Width - 2;
+ }
+
+ // When the resources list resizes
+ private void resources_SizeChanged(object sender, EventArgs e)
+ {
+ // Resize column header also
+ ResizeColumnHeader();
+ }
+
+ // Add a resource
+ private void addresource_Click(object sender, EventArgs e)
+ {
+ ResourceOptionsForm resoptions;
+ Rectangle startposition;
+
+ // Open resource options dialog
+ resoptions = new ResourceOptionsForm(new ResourceLocation(), "Add Resource");
+ resoptions.StartPosition = FormStartPosition.Manual;
+ startposition = new Rectangle(40, 20, 1, 1);
+ startposition = this.RectangleToScreen(startposition);
+ resoptions.Location = startposition.Location;
+ if(resoptions.ShowDialog(this) == DialogResult.OK)
+ {
+ // Add resource
+ AddItem(resoptions.ResourceLocation);
+ }
+ }
+
+ // Edit resource
+ private void editresource_Click(object sender, EventArgs e)
+ {
+ ResourceOptionsForm resoptions;
+ Rectangle startposition;
+ ListViewItem selecteditem;
+ ResourceLocation rl;
+
+ // Anything selected?
+ if(resourceitems.SelectedItems.Count > 0)
+ {
+ // Get selected item
+ selecteditem = resourceitems.SelectedItems[0];
+
+ // Open resource options dialog
+ resoptions = new ResourceOptionsForm((ResourceLocation)selecteditem.Tag, "Resource Options");
+ resoptions.StartPosition = FormStartPosition.Manual;
+ startposition = new Rectangle(40, 20, 1, 1);
+ startposition = this.RectangleToScreen(startposition);
+ resoptions.Location = startposition.Location;
+ if(resoptions.ShowDialog(this) == DialogResult.OK)
+ {
+ // Start editing list
+ resourceitems.BeginUpdate();
+
+ // Update item
+ rl = resoptions.ResourceLocation;
+ selecteditem.Text = rl.location;
+ selecteditem.Tag = rl;
+
+ // Set icon
+ if(rl.type == ResourceLocation.RESOURCE_DIRECTORY)
+ selecteditem.ImageIndex = 0;
+ else if(rl.type == ResourceLocation.RESOURCE_WAD)
+ selecteditem.ImageIndex = 1;
+
+ // Done
+ resourceitems.EndUpdate();
+ }
+ }
+ }
+
+ // Remove resource
+ private void deleteresource_Click(object sender, EventArgs e)
+ {
+ // Anything selected?
+ if(resourceitems.SelectedItems.Count > 0)
+ {
+ // Remove it
+ resourceitems.Items.Remove(resourceitems.SelectedItems[0]);
+ }
+ }
+
+ // Item selected
+ private void resourceitems_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
+ {
+ // Anything selected
+ if(resourceitems.SelectedItems.Count > 0)
+ {
+ // Go for all selected items
+ for(int i = resourceitems.SelectedItems.Count - 1; i >= 0; i--)
+ {
+ // Item grayed? Then deselect.
+ if(resourceitems.SelectedItems[i].ForeColor != SystemColors.WindowText)
+ resourceitems.SelectedItems[i].Selected = false;
+ }
+ }
+
+ // Anything selected
+ if(resourceitems.SelectedItems.Count > 0)
+ {
+ // Enable buttons
+ editresource.Enabled = true;
+ deleteresource.Enabled = true;
+ }
+ else
+ {
+ // Disable buttons
+ editresource.Enabled = false;
+ deleteresource.Enabled = false;
+ }
+ }
+
+ // When an item is double clicked
+ private void resourceitems_DoubleClick(object sender, EventArgs e)
+ {
+ // Click the edit resource button
+ if(editresource.Enabled) editresource_Click(sender, e);
+ }
+
+ // Returns a list of the resources
+ public ResourceLocationList GetResources()
+ {
+ ResourceLocationList list = new ResourceLocationList();
+
+ // Go for all items
+ for(int i = 0; i < resourceitems.Items.Count; i++)
+ {
+ // Item not grayed?
+ if(resourceitems.Items[i].ForeColor == SystemColors.WindowText)
+ {
+ // Add item to list
+ list.Add((ResourceLocation)resourceitems.Items[i].Tag);
+ }
+ }
+
+ // Return result
+ return list;
+ }
+
+ #endregion
+ }
+}
diff --git a/Source/Interface/ResourceListEditor.resx b/Source/Interface/ResourceListEditor.resx
new file mode 100644
index 00000000..31314066
--- /dev/null
+++ b/Source/Interface/ResourceListEditor.resx
@@ -0,0 +1,225 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+ False
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ False
+
+
+ True
+
+
+ True
+
+
+ 17, 17
+
+
+
+ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
+ LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
+ ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQ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IB/wMS
+ Af8DEgH/AxIB/wMSAf8DEgH/AxIB/wMSAf8DEgH//wANAAFCAU0BPgcAAT4DAAEoAwABQAMAASADAAEB
+ AQABAQYAAQEWAAP/gQAF/wGBAf8BgQL/AfgBBwH/AYEB+AEBAQABBwHwAQcBAAEBAfABAQEAAQMB4AEH
+ AQABAQHgAQEBAAEDAcABBwEAAQEBwAEBAQABAQHAAQcBAAEBAcABAQEAAQEBwAEHAQABAQHAAQECAAHA
+ AQcCAAHAAQMCAAHAAQcCAAHAAQcCAAHAAQcCAAHAAQcBAAEHAcABBwEAAQcBwAEHAQABBwHAAQcBAAEH
+ AcABBwEAAf8BwAEHAQAB/wHAAQcBgQH/AcABBwGBAf8BwAEHAv8BwAEHAv8BwAEHCP8L
+
+
+
+ True
+
+
\ No newline at end of file
diff --git a/Source/Interface/ResourceListView.cs b/Source/Interface/ResourceListView.cs
new file mode 100644
index 00000000..08fc1769
--- /dev/null
+++ b/Source/Interface/ResourceListView.cs
@@ -0,0 +1,250 @@
+
+#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 ResourceListView : ListView
+ {
+ private const string DRAG_TYPE = "ReorderItems";
+ private List dragitems;
+
+ // Disable sorting
+ public new SortOrder Sorting { get { return SortOrder.None; } set { base.Sorting = SortOrder.None; } }
+
+ // Constructor
+ public ResourceListView(): base()
+ {
+ // List for dragged items
+ dragitems = new List();
+ }
+
+ // When items are dropped
+ protected override void OnDragDrop(DragEventArgs e)
+ {
+ int dropindex, i;
+ ListViewItem insertatitem;
+ Point cp;
+
+ // Pass on to base
+ base.OnDragDrop(e);
+
+ // Leave when no items being dragged
+ if(dragitems.Count == 0) return;
+
+ // Determine where to insert
+ cp = base.PointToClient(new Point(e.X, e.Y));
+ insertatitem = base.GetItemAt(cp.X, cp.Y);
+
+ // Leave when nowhere to insert or same as selected item
+ if((insertatitem == null) || (dragitems.Contains(insertatitem))) return;
+
+ // Leave when item is grayed
+ if(insertatitem.ForeColor != SystemColors.WindowText) return;
+
+ // Determine index where to insert
+ dropindex = insertatitem.Index;
+ if(dropindex > dragitems[0].Index) dropindex++;
+
+ // Deselect items
+ DeselectAll();
+
+ // Insert items
+ for(i = dragitems.Count - 1; i >= 0; i--)
+ {
+ // Insert a copy of the item here
+ base.Items.Insert(dropindex, (ListViewItem)dragitems[i].Clone());
+ base.Items[dropindex].Selected = true;
+ }
+
+ // Remove old items
+ foreach(ListViewItem lvi in dragitems)
+ {
+ // Remove item from list
+ base.Items.Remove(lvi);
+ }
+
+ // Clear the list
+ dragitems.Clear();
+ }
+
+ // When items are dragged over
+ protected override void OnDragOver(DragEventArgs e)
+ {
+ int dropindex, i;
+ ListViewItem insertatitem;
+ Point cp;
+
+ // Check if our data format is present
+ if(!e.Data.GetDataPresent(DataFormats.Text))
+ {
+ e.Effect = DragDropEffects.None;
+ return;
+ }
+
+ // Check if the data matches our data
+ String text = (String)e.Data.GetData(DRAG_TYPE.GetType());
+ if(text.CompareTo(DRAG_TYPE + this.Name) == 0)
+ {
+ // Determine where to insert
+ cp = base.PointToClient(new Point(e.X, e.Y));
+ insertatitem = base.GetItemAt(cp.X, cp.Y);
+ if(insertatitem == null)
+ {
+ // Cannot insert here
+ e.Effect = DragDropEffects.None;
+ return;
+ }
+
+ // Item is one of the items being dragged?
+ if(dragitems.Contains(insertatitem))
+ {
+ // Show move possibility, but dont do anything
+ e.Effect = DragDropEffects.Move;
+ insertatitem.EnsureVisible();
+ return;
+ }
+
+ // Check if item is grayed
+ if(insertatitem.ForeColor != SystemColors.WindowText)
+ {
+ // Cannot insert here
+ e.Effect = DragDropEffects.None;
+ insertatitem.EnsureVisible();
+ return;
+ }
+
+ // Pass on to base
+ base.OnDragOver(e);
+
+ // Can insert here
+ e.Effect = DragDropEffects.Move;
+ insertatitem.EnsureVisible();
+
+ // Determine index where to insert
+ dropindex = insertatitem.Index;
+ if(dropindex > dragitems[0].Index) dropindex++;
+
+ // Deselect items
+ DeselectAll();
+
+ // Insert items
+ for(i = dragitems.Count - 1; i >= 0; i--)
+ {
+ // Insert a copy of the item here
+ base.Items.Insert(dropindex, (ListViewItem)dragitems[i].Clone());
+ base.Items[dropindex].Selected = true;
+ }
+
+ // Remove old items
+ foreach(ListViewItem lvi in dragitems)
+ {
+ // Remove item from list
+ base.Items.Remove(lvi);
+ }
+
+ // Copy selected items to the list
+ dragitems.Clear();
+ foreach(ListViewItem lvi in base.SelectedItems) dragitems.Add(lvi);
+ }
+ else
+ {
+ // Cannot insert here
+ e.Effect = DragDropEffects.None;
+ }
+ }
+
+ // When items are first dragged over
+ protected override void OnDragEnter(DragEventArgs e)
+ {
+ // Pass on to base
+ base.OnDragEnter(e);
+
+ // Check if our data format is present
+ if(!e.Data.GetDataPresent(DataFormats.Text))
+ {
+ // No effect
+ e.Effect = DragDropEffects.None;
+ return;
+ }
+
+ // Check if the data matches our data
+ String text = (String)e.Data.GetData(DRAG_TYPE.GetType());
+ if(text.CompareTo(DRAG_TYPE + base.Name) == 0)
+ {
+ // We're moving these items
+ e.Effect = DragDropEffects.Move;
+ }
+ else
+ {
+ // No effect
+ e.Effect = DragDropEffects.None;
+ }
+ }
+
+ // When items are first dragged
+ protected override void OnItemDrag(ItemDragEventArgs e)
+ {
+ // Pass on to base
+ base.OnItemDrag(e);
+
+ // Anything selected?
+ if(base.SelectedItems.Count > 0)
+ {
+ // Go for all selected items
+ for(int i = base.SelectedItems.Count - 1; i >= 0; i--)
+ {
+ // Item grayed? Then abort!
+ if(base.SelectedItems[i].ForeColor != SystemColors.WindowText)
+ return;
+ }
+
+ // Copy selected items to the list
+ dragitems.Clear();
+ foreach(ListViewItem lvi in base.SelectedItems) dragitems.Add(lvi);
+
+ // Start drag operation
+ base.DoDragDrop(DRAG_TYPE + base.Name, DragDropEffects.Move);
+ }
+ }
+
+ // This deselects all items
+ private void DeselectAll()
+ {
+ // Go for all selected items
+ for(int i = base.SelectedItems.Count - 1; i >= 0; i--)
+ {
+ // Item grayed? Then abort!
+ base.SelectedItems[i].Selected = false;
+ }
+ }
+ }
+}
diff --git a/Source/Map/MapOptions.cs b/Source/Map/MapOptions.cs
index 34ce9016..0dce3069 100644
--- a/Source/Map/MapOptions.cs
+++ b/Source/Map/MapOptions.cs
@@ -45,14 +45,14 @@ namespace CodeImp.DoomBuilder.Map
private string previousname;
// Additional resources
- private List resources;
+ private ResourceLocationList resources;
#endregion
#region ================== Properties
public string ConfigFile { get { return configfile; } set { configfile = value; } }
- public ICollection Resources { get { return resources; } }
+ public ResourceLocationList Resources { get { return resources; } }
public string PreviousName { get { return previousname; } }
public string CurrentName
{
@@ -80,7 +80,7 @@ namespace CodeImp.DoomBuilder.Map
this.previousname = "";
this.currentname = "";
this.configfile = "";
- this.resources = new List();
+ this.resources = new ResourceLocationList();
}
// Constructor to load from Doom Builder Map Settings Configuration
@@ -93,7 +93,7 @@ namespace CodeImp.DoomBuilder.Map
this.previousname = "";
this.currentname = mapname;
this.configfile = cfg.ReadSetting("config", "");
- this.resources = new List();
+ this.resources = new ResourceLocationList();
// Go for all items in the map info
mapinfo = cfg.ReadSetting(mapname, new Hashtable());
@@ -165,6 +165,14 @@ namespace CodeImp.DoomBuilder.Map
resources.RemoveAt(index);
}
+ // This copies resources from a list
+ public void CopyResources(ResourceLocationList fromlist)
+ {
+ // Clear this list
+ resources.Clear();
+ resources.AddRange(fromlist);
+ }
+
// This displays the current map name
public override string ToString()
{