mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-17 09:32:34 +00:00
Added default start mode option to configuration dialog (see Modes tab)
This commit is contained in:
parent
ee8d88c3dc
commit
85fcc2bd25
14 changed files with 113 additions and 21 deletions
|
@ -60,6 +60,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
private List<ThingsFilter> thingsfilters;
|
||||
private List<DefinedTextureSet> texturesets;
|
||||
private Dictionary<string, bool> editmodes;
|
||||
private string startmode;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -79,6 +80,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
internal ICollection<ThingsFilter> ThingsFilters { get { return thingsfilters; } }
|
||||
public List<DefinedTextureSet> TextureSets { get { return texturesets; } }
|
||||
internal Dictionary<string, bool> EditModes { get { return editmodes; } }
|
||||
public string StartMode { get { return startmode; } internal set { startmode = value; } }
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -104,6 +106,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
this.customparameters = General.Settings.ReadSetting("configurations." + settingskey + ".customparameters", false);
|
||||
this.testskill = General.Settings.ReadSetting("configurations." + settingskey + ".testskill", 3);
|
||||
this.resources = new DataLocationList(General.Settings.Config, "configurations." + settingskey + ".resources");
|
||||
this.startmode = General.Settings.ReadSetting("configurations." + settingskey + ".startmode", "VerticesMode");
|
||||
|
||||
// Make list of things filters
|
||||
thingsfilters = new List<ThingsFilter>();
|
||||
|
@ -160,6 +163,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
General.Settings.WriteSetting("configurations." + settingskey + ".testshortpaths", testshortpaths);
|
||||
General.Settings.WriteSetting("configurations." + settingskey + ".customparameters", customparameters);
|
||||
General.Settings.WriteSetting("configurations." + settingskey + ".testskill", testskill);
|
||||
General.Settings.WriteSetting("configurations." + settingskey + ".startmode", startmode);
|
||||
resources.WriteToConfig(General.Settings.Config, "configurations." + settingskey + ".resources");
|
||||
|
||||
// Write filters to configuration
|
||||
|
@ -213,6 +217,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
ci.testshortpaths = this.testshortpaths;
|
||||
ci.customparameters = this.customparameters;
|
||||
ci.testskill = this.testskill;
|
||||
ci.startmode = this.startmode;
|
||||
ci.texturesets = new List<DefinedTextureSet>();
|
||||
foreach(DefinedTextureSet s in this.texturesets) ci.texturesets.Add(s.Copy());
|
||||
ci.thingsfilters = new List<ThingsFilter>();
|
||||
|
@ -236,6 +241,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
this.testshortpaths = ci.testshortpaths;
|
||||
this.customparameters = ci.customparameters;
|
||||
this.testskill = ci.testskill;
|
||||
this.startmode = ci.startmode;
|
||||
this.texturesets = new List<DefinedTextureSet>();
|
||||
foreach(DefinedTextureSet s in ci.texturesets) this.texturesets.Add(s.Copy());
|
||||
this.thingsfilters = new List<ThingsFilter>();
|
||||
|
|
|
@ -46,6 +46,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
private string displayname = "<unnamed mode>";
|
||||
private bool allowcopypaste = true;
|
||||
private bool usebydefault = false;
|
||||
private bool safestartmode = false;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -106,6 +107,12 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
/// in this mode. Default for this property is true.
|
||||
/// </summary>
|
||||
public bool AllowCopyPaste { get { return allowcopypaste; } set { allowcopypaste = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Set this to true when it is safe to have the editor start in this mode when
|
||||
/// opening a map. The user can then select this as starting mode in the configuration.
|
||||
/// </summary>
|
||||
public bool SafeStartMode { get { return safestartmode; } set { safestartmode = value; } }
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
// String representation
|
||||
public override string ToString()
|
||||
{
|
||||
return type.Name;
|
||||
return attribs.DisplayName;
|
||||
}
|
||||
|
||||
// Compare by button order
|
||||
|
|
|
@ -186,7 +186,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
foreach(EditModeInfo emi in usedmodes)
|
||||
{
|
||||
// Mode matches class name?
|
||||
if(emi.ToString() == editmodename) return emi;
|
||||
if(emi.Type.Name == editmodename) return emi;
|
||||
}
|
||||
|
||||
// No such mode found
|
||||
|
|
|
@ -280,7 +280,7 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// Set defaults
|
||||
this.visualcamera = new VisualCamera();
|
||||
General.Editing.ChangeMode("VerticesMode");
|
||||
General.Editing.ChangeMode(configinfo.StartMode);
|
||||
ClassicMode cmode = (General.Editing.Mode as ClassicMode);
|
||||
if(cmode != null) cmode.SetZoom(0.5f);
|
||||
renderer2d.SetViewMode((ViewMode)General.Settings.DefaultViewMode);
|
||||
|
@ -382,7 +382,7 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// Set defaults
|
||||
this.visualcamera = new VisualCamera();
|
||||
General.Editing.ChangeMode("VerticesMode");
|
||||
General.Editing.ChangeMode(configinfo.StartMode);
|
||||
renderer2d.SetViewMode((ViewMode)General.Settings.DefaultViewMode);
|
||||
General.Settings.SetDefaultThingFlags(config.DefaultThingFlags);
|
||||
|
||||
|
|
28
Source/Core/Windows/ConfigForm.Designer.cs
generated
28
Source/Core/Windows/ConfigForm.Designer.cs
generated
|
@ -69,6 +69,8 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.removetextureset = new System.Windows.Forms.Button();
|
||||
this.addtextureset = new System.Windows.Forms.Button();
|
||||
this.tabmodes = new System.Windows.Forms.TabPage();
|
||||
this.startmode = new System.Windows.Forms.ComboBox();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.listmodes = new System.Windows.Forms.ListView();
|
||||
this.colmodename = new System.Windows.Forms.ColumnHeader();
|
||||
this.colmodeplugin = new System.Windows.Forms.ColumnHeader();
|
||||
|
@ -564,6 +566,8 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
//
|
||||
// tabmodes
|
||||
//
|
||||
this.tabmodes.Controls.Add(this.startmode);
|
||||
this.tabmodes.Controls.Add(this.label11);
|
||||
this.tabmodes.Controls.Add(this.listmodes);
|
||||
this.tabmodes.Controls.Add(label10);
|
||||
this.tabmodes.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
|
@ -574,6 +578,25 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.tabmodes.Text = "Modes";
|
||||
this.tabmodes.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// startmode
|
||||
//
|
||||
this.startmode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.startmode.FormattingEnabled = true;
|
||||
this.startmode.Location = new System.Drawing.Point(239, 288);
|
||||
this.startmode.Name = "startmode";
|
||||
this.startmode.Size = new System.Drawing.Size(218, 22);
|
||||
this.startmode.TabIndex = 27;
|
||||
this.startmode.SelectedIndexChanged += new System.EventHandler(this.startmode_SelectedIndexChanged);
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(12, 291);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(199, 14);
|
||||
this.label11.TabIndex = 26;
|
||||
this.label11.Text = "When opening a map, start in this mode:";
|
||||
//
|
||||
// listmodes
|
||||
//
|
||||
this.listmodes.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
|
@ -589,7 +612,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.listmodes.MultiSelect = false;
|
||||
this.listmodes.Name = "listmodes";
|
||||
this.listmodes.ShowGroups = false;
|
||||
this.listmodes.Size = new System.Drawing.Size(442, 233);
|
||||
this.listmodes.Size = new System.Drawing.Size(442, 202);
|
||||
this.listmodes.Sorting = System.Windows.Forms.SortOrder.Ascending;
|
||||
this.listmodes.TabIndex = 0;
|
||||
this.listmodes.UseCompatibleStateImageBehavior = false;
|
||||
|
@ -669,6 +692,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.tabtesting.PerformLayout();
|
||||
this.tabtextures.ResumeLayout(false);
|
||||
this.tabmodes.ResumeLayout(false);
|
||||
this.tabmodes.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
@ -710,5 +734,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
private System.Windows.Forms.ColumnHeader colmodename;
|
||||
private System.Windows.Forms.ColumnHeader colmodeplugin;
|
||||
private System.Windows.Forms.CheckBox shortpaths;
|
||||
private System.Windows.Forms.ComboBox startmode;
|
||||
private System.Windows.Forms.Label label11;
|
||||
}
|
||||
}
|
|
@ -191,6 +191,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
EditModeInfo emi = (lvi.Tag as EditModeInfo);
|
||||
lvi.Checked = (configinfo.EditModes.ContainsKey(emi.Type.FullName) && configinfo.EditModes[emi.Type.FullName]);
|
||||
}
|
||||
|
||||
// Fill start modes
|
||||
RefillStartModes();
|
||||
|
||||
// Done
|
||||
preventchanges = false;
|
||||
|
@ -537,6 +540,10 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// Remove
|
||||
configinfo.EditModes[emi.Type.FullName] = false;
|
||||
}
|
||||
|
||||
preventchanges = true;
|
||||
RefillStartModes();
|
||||
preventchanges = false;
|
||||
}
|
||||
|
||||
// Help requested
|
||||
|
@ -545,5 +552,45 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
General.ShowHelp("w_gameconfigurations.html");
|
||||
hlpevent.Handled = true;
|
||||
}
|
||||
|
||||
// This refills the start mode cobobox
|
||||
private void RefillStartModes()
|
||||
{
|
||||
// Refill the startmode combobox
|
||||
startmode.Items.Clear();
|
||||
foreach(ListViewItem item in listmodes.Items)
|
||||
{
|
||||
if(item.Checked)
|
||||
{
|
||||
EditModeInfo emi = (item.Tag as EditModeInfo);
|
||||
if(emi.Attributes.SafeStartMode)
|
||||
{
|
||||
int newindex = startmode.Items.Add(emi);
|
||||
if(emi.Type.Name == configinfo.StartMode) startmode.SelectedIndex = newindex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Select the first in the combobox if none are selected
|
||||
if((startmode.SelectedItem == null) && (startmode.Items.Count > 0))
|
||||
{
|
||||
startmode.SelectedIndex = 0;
|
||||
EditModeInfo emi = (startmode.SelectedItem as EditModeInfo);
|
||||
configinfo.StartMode = emi.Type.Name;
|
||||
}
|
||||
}
|
||||
|
||||
// Start mode combobox changed
|
||||
private void startmode_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(preventchanges || (configinfo == null)) return;
|
||||
|
||||
// Apply start mode
|
||||
if(startmode.SelectedItem != null)
|
||||
{
|
||||
EditModeInfo emi = (startmode.SelectedItem as EditModeInfo);
|
||||
configinfo.StartMode = emi.Type.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -313,6 +313,12 @@
|
|||
<metadata name="tabmodes.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="startmode.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label11.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="listmodes.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
|
|
@ -1991,15 +1991,14 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
if(pageindex > -1) cfgform.ShowTab(pageindex);
|
||||
if(cfgform.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
// Update interface
|
||||
// Update stuff
|
||||
UpdateInterface();
|
||||
|
||||
// Let the plugins know
|
||||
General.Editing.UpdateCurrentEditModes();
|
||||
General.Plugins.ProgramReconfigure();
|
||||
|
||||
|
||||
// Reload resources if a map is open
|
||||
if((General.Map != null) && cfgform.ReloadResources) General.Actions.InvokeAction("builder_reloadresources");
|
||||
|
||||
|
||||
// Redraw display
|
||||
RedrawDisplay();
|
||||
}
|
||||
|
@ -2016,15 +2015,11 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
PreferencesForm prefform = new PreferencesForm();
|
||||
if(prefform.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
// Update shortcut keys in menus
|
||||
// Update stuff
|
||||
ApplyShortcutKeys();
|
||||
|
||||
// Generate new color correction table
|
||||
General.Colors.CreateCorrectionTable();
|
||||
|
||||
// Let the plugins know
|
||||
General.Plugins.ProgramReconfigure();
|
||||
|
||||
|
||||
// Map opened?
|
||||
if(General.Map != null)
|
||||
{
|
||||
|
|
|
@ -44,7 +44,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
ButtonOrder = int.MinValue + 201,
|
||||
ButtonGroup = "000_editing",
|
||||
AllowCopyPaste = false,
|
||||
UseByDefault = true)]
|
||||
UseByDefault = true,
|
||||
SafeStartMode = true)]
|
||||
|
||||
public sealed class BrightnessMode : BaseClassicMode
|
||||
{
|
||||
|
|
|
@ -43,7 +43,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
ButtonImage = "LinesMode.png", // Image resource name for the button
|
||||
ButtonOrder = int.MinValue + 100, // Position of the button (lower is more to the left)
|
||||
ButtonGroup = "000_editing",
|
||||
UseByDefault = true)]
|
||||
UseByDefault = true,
|
||||
SafeStartMode = true)]
|
||||
|
||||
public class LinedefsMode : BaseClassicMode
|
||||
{
|
||||
|
|
|
@ -44,7 +44,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
ButtonImage = "SectorsMode.png", // Image resource name for the button
|
||||
ButtonOrder = int.MinValue + 200, // Position of the button (lower is more to the left)
|
||||
ButtonGroup = "000_editing",
|
||||
UseByDefault = true)]
|
||||
UseByDefault = true,
|
||||
SafeStartMode = true)]
|
||||
|
||||
public class SectorsMode : BaseClassicMode
|
||||
{
|
||||
|
|
|
@ -43,7 +43,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
ButtonImage = "ThingsMode.png", // Image resource name for the button
|
||||
ButtonOrder = int.MinValue + 300, // Position of the button (lower is more to the left)
|
||||
ButtonGroup = "000_editing",
|
||||
UseByDefault = true)]
|
||||
UseByDefault = true,
|
||||
SafeStartMode = true)]
|
||||
|
||||
public class ThingsMode : BaseClassicMode
|
||||
{
|
||||
|
|
|
@ -41,7 +41,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
ButtonImage = "VerticesMode.png", // Image resource name for the button
|
||||
ButtonOrder = int.MinValue + 0, // Position of the button (lower is more to the left)
|
||||
ButtonGroup = "000_editing",
|
||||
UseByDefault = true)]
|
||||
UseByDefault = true,
|
||||
SafeStartMode = true)]
|
||||
|
||||
public class VerticesMode : BaseClassicMode
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue