From bc465effea1549eea510fa9f6f396d9fa966a4d5 Mon Sep 17 00:00:00 2001 From: codeimp Date: Thu, 27 Nov 2008 12:37:20 +0000 Subject: [PATCH] moo --- Source/BuilderModes/General/BuilderPlug.cs | 7 +-- Source/Editing/EditModeAttribute.cs | 2 +- Source/Plugins/Plug.cs | 14 +++-- Source/Windows/ConfigForm.Designer.cs | 61 +++++++++++----------- Source/Windows/ConfigForm.cs | 41 +++++++++++++-- Source/Windows/ConfigForm.resx | 2 +- Source/Windows/PreferencesForm.cs | 2 +- 7 files changed, 86 insertions(+), 43 deletions(-) diff --git a/Source/BuilderModes/General/BuilderPlug.cs b/Source/BuilderModes/General/BuilderPlug.cs index 47f72e81..95b92751 100644 --- a/Source/BuilderModes/General/BuilderPlug.cs +++ b/Source/BuilderModes/General/BuilderPlug.cs @@ -60,14 +60,15 @@ namespace CodeImp.DoomBuilder.BuilderModes #endregion #region ================== Properties - + + public override string Name { get { return "Doom Builder"; } } public static BuilderPlug Me { get { return me; } } - + public MenusForm MenusForm { get { return menusform; } } public CurveLinedefsForm CurveLinedefsForm { get { return curvelinedefsform; } } public FindReplaceForm FindReplaceForm { get { return findreplaceform; } } public ErrorCheckForm ErrorCheckForm { get { return errorcheckform; } } - + #endregion #region ================== Initialize / Dispose diff --git a/Source/Editing/EditModeAttribute.cs b/Source/Editing/EditModeAttribute.cs index 0541cd1b..d18c0b94 100644 --- a/Source/Editing/EditModeAttribute.cs +++ b/Source/Editing/EditModeAttribute.cs @@ -43,7 +43,7 @@ namespace CodeImp.DoomBuilder.Editing private int buttonorder = 0; private bool optional = false; private bool isvolatile = false; - private string displayname = "Unnamed Mode"; + private string displayname = ""; private bool allowcopypaste = true; #endregion diff --git a/Source/Plugins/Plug.cs b/Source/Plugins/Plug.cs index 4e99f519..803a9164 100644 --- a/Source/Plugins/Plug.cs +++ b/Source/Plugins/Plug.cs @@ -24,7 +24,7 @@ namespace CodeImp.DoomBuilder.Plugins #region ================== Constants #endregion - + #region ================== Variables // Internals @@ -34,9 +34,9 @@ namespace CodeImp.DoomBuilder.Plugins private bool isdisposed = false; #endregion - + #region ================== Properties - + // Internals internal Plugin Plugin { get { return plugin; } set { plugin = value; } } @@ -44,7 +44,13 @@ namespace CodeImp.DoomBuilder.Plugins /// Indicates if the plugin has been disposed. /// public bool IsDisposed { get { return isdisposed; } } - + + /// + /// Override this to return a more descriptive name for your plugin. + /// Default is the library filename without extension. + /// + public virtual string Name { get { return plugin.Name; } } + #endregion #region ================== Constructor / Disposer diff --git a/Source/Windows/ConfigForm.Designer.cs b/Source/Windows/ConfigForm.Designer.cs index 30cefcba..8db9754c 100644 --- a/Source/Windows/ConfigForm.Designer.cs +++ b/Source/Windows/ConfigForm.Designer.cs @@ -68,12 +68,12 @@ 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.listconfigs = new System.Windows.Forms.ListView(); - this.columnname = new System.Windows.Forms.ColumnHeader(); - this.testprogramdialog = new System.Windows.Forms.OpenFileDialog(); this.listmodes = new System.Windows.Forms.ListView(); this.colmodename = new System.Windows.Forms.ColumnHeader(); this.colmodeplugin = new System.Windows.Forms.ColumnHeader(); + this.listconfigs = new System.Windows.Forms.ListView(); + this.columnname = new System.Windows.Forms.ColumnHeader(); + this.testprogramdialog = new System.Windows.Forms.OpenFileDialog(); label5 = new System.Windows.Forms.Label(); label6 = new System.Windows.Forms.Label(); label3 = new System.Windows.Forms.Label(); @@ -558,6 +558,34 @@ namespace CodeImp.DoomBuilder.Windows this.tabmodes.Text = "Modes"; this.tabmodes.UseVisualStyleBackColor = true; // + // listmodes + // + this.listmodes.CheckBoxes = true; + this.listmodes.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.colmodename, + this.colmodeplugin}); + this.listmodes.FullRowSelect = true; + this.listmodes.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.listmodes.Location = new System.Drawing.Point(15, 76); + this.listmodes.MultiSelect = false; + this.listmodes.Name = "listmodes"; + this.listmodes.ShowGroups = false; + this.listmodes.Size = new System.Drawing.Size(442, 226); + this.listmodes.TabIndex = 26; + this.listmodes.UseCompatibleStateImageBehavior = false; + this.listmodes.View = System.Windows.Forms.View.Details; + this.listmodes.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listmodes_ItemChecked); + // + // colmodename + // + this.colmodename.Text = "Editing Mode"; + this.colmodename.Width = 179; + // + // colmodeplugin + // + this.colmodeplugin.Text = "Plugin"; + this.colmodeplugin.Width = 221; + // // listconfigs // this.listconfigs.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { @@ -588,33 +616,6 @@ namespace CodeImp.DoomBuilder.Windows this.testprogramdialog.Filter = "Executable Files (*.exe)|*.exe|Batch Files (*.bat)|*.bat"; this.testprogramdialog.Title = "Browse Test Program"; // - // listmodes - // - this.listmodes.CheckBoxes = true; - this.listmodes.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.colmodename, - this.colmodeplugin}); - this.listmodes.FullRowSelect = true; - this.listmodes.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this.listmodes.Location = new System.Drawing.Point(15, 76); - this.listmodes.MultiSelect = false; - this.listmodes.Name = "listmodes"; - this.listmodes.ShowGroups = false; - this.listmodes.Size = new System.Drawing.Size(442, 226); - this.listmodes.TabIndex = 26; - this.listmodes.UseCompatibleStateImageBehavior = false; - this.listmodes.View = System.Windows.Forms.View.Details; - // - // colmodename - // - this.colmodename.Text = "Editing Mode"; - this.colmodename.Width = 179; - // - // colmodeplugin - // - this.colmodeplugin.Text = "Plugin"; - this.colmodeplugin.Width = 221; - // // ConfigForm // this.AcceptButton = this.apply; diff --git a/Source/Windows/ConfigForm.cs b/Source/Windows/ConfigForm.cs index 76037b2b..3183c55d 100644 --- a/Source/Windows/ConfigForm.cs +++ b/Source/Windows/ConfigForm.cs @@ -49,7 +49,7 @@ namespace CodeImp.DoomBuilder.Windows // Initialize InitializeComponent(); - + // Make list column header full width columnname.Width = listconfigs.ClientRectangle.Width - SystemInformation.VerticalScrollBarWidth - 2; @@ -77,9 +77,16 @@ namespace CodeImp.DoomBuilder.Windows // Fill list of editing modes foreach(EditModeInfo emi in General.Editing.ModesInfo) { + // Is this mode selectable by the user? + if(emi.ButtonImage != null) + { + lvi = listmodes.Items.Add(emi.Attributes.DisplayName); + lvi.Tag = emi; + lvi.SubItems.Add(emi.Plugin.Plug.Name); + } } } - + // This shows a specific page public void ShowTab(int index) { @@ -160,6 +167,13 @@ namespace CodeImp.DoomBuilder.Windows item.ImageIndex = 0; } listtextures.Sort(); + + // Go for all the editing modes in the list + foreach(ListViewItem lvi in listmodes.Items) + { + EditModeInfo emi = (lvi.Tag as EditModeInfo); + lvi.Checked = configinfo.EditModes.Contains(emi.Type.FullName); + } } } @@ -208,7 +222,7 @@ namespace CodeImp.DoomBuilder.Windows { // Leave when no configuration selected if(configinfo == null) return; - + // Apply to selected configuration if(nodebuildersave.SelectedItem != null) configinfo.NodebuilderSave = (nodebuildersave.SelectedItem as NodebuilderInfo).Name; @@ -463,5 +477,26 @@ namespace CodeImp.DoomBuilder.Windows listtextures.Sort(); } } + + // This is called when an editing mode item is checked or unchecked + private void listmodes_ItemChecked(object sender, ItemCheckedEventArgs e) + { + // Leave when no configuration selected + if(configinfo == null) return; + + // Apply changes + EditModeInfo emi = (e.Item.Tag as EditModeInfo); + bool currentstate = configinfo.EditModes.Contains(emi.Type.FullName); + if(e.Item.Checked && !currentstate) + { + // Add + configinfo.EditModes.Add(emi.Type.FullName); + } + else if(!e.Item.Checked && currentstate) + { + // Remove + configinfo.EditModes.Remove(emi.Type.FullName); + } + } } } diff --git a/Source/Windows/ConfigForm.resx b/Source/Windows/ConfigForm.resx index 1112dd4a..b24749d1 100644 --- a/Source/Windows/ConfigForm.resx +++ b/Source/Windows/ConfigForm.resx @@ -184,7 +184,7 @@ False - Here you can select the editing modes that you wish to use in this configuration. This is usefull in case there are plugins with additional editing modes that can be used instead of the original editing modes. + Here you can select the editing modes that you wish to use in this configuration. This is usefull in case there are plugins with additional editing modes that can be used as a replacement for the original editing modes. True diff --git a/Source/Windows/PreferencesForm.cs b/Source/Windows/PreferencesForm.cs index 04ca4d25..bc442867 100644 --- a/Source/Windows/PreferencesForm.cs +++ b/Source/Windows/PreferencesForm.cs @@ -62,7 +62,7 @@ namespace CodeImp.DoomBuilder.Windows fieldofview.Value = General.Settings.VisualFOV / 10; mousespeed.Value = General.Settings.MouseSpeed / 100; movespeed.Value = General.Settings.MoveSpeed / 100; - viewdistance.Value = (int)(General.Settings.ViewDistance / 200.0f); + viewdistance.Value = General.Clamp((int)(General.Settings.ViewDistance / 200.0f), viewdistance.Minimum, viewdistance.Maximum); invertyaxis.Checked = General.Settings.InvertYAxis; fixedaspect.Checked = General.Settings.FixedAspect; scriptfontbold.Checked = General.Settings.ScriptFontBold;