Reverted anotak's PR: it causes 'Cancel' button in Edit windows to automatically do undo or something similar, breaking maps completely

This commit is contained in:
ZZYZX 2017-02-07 20:02:31 +02:00
parent 2821149a48
commit 34d1af9446
8 changed files with 726 additions and 816 deletions

View file

@ -64,7 +64,7 @@ namespace CodeImp.DoomBuilder.Actions
#region ================== Properties
internal SortedDictionary<string, string> Categories { get { return categories; } }
internal Action this[string action] { get { if (actions.ContainsKey(action)) return actions[action]; else throw new ArgumentException("There is no such action \"" + action + "\""); } }
internal Action this[string action] { get { if(actions.ContainsKey(action)) return actions[action]; else throw new ArgumentException("There is no such action \"" + action + "\""); } }
public bool IsDisposed { get { return isdisposed; } }
internal bool ExclusiveRequested { get { return exclusiverequested; } }
@ -98,7 +98,7 @@ namespace CodeImp.DoomBuilder.Actions
internal void Dispose()
{
// Not already disposed?
if (!isdisposed)
if(!isdisposed)
{
// Clean up
@ -118,10 +118,10 @@ namespace CodeImp.DoomBuilder.Actions
// Find a resource named Actions.cfg
string[] resnames = asm.GetManifestResourceNames();
foreach (string rn in resnames)
foreach(string rn in resnames)
{
// Found one?
if (rn.EndsWith(ACTIONS_RESOURCE, StringComparison.OrdinalIgnoreCase))
if(rn.EndsWith(ACTIONS_RESOURCE, StringComparison.OrdinalIgnoreCase))
{
// Get a stream from the resource
Stream actionsdata = asm.GetManifestResourceStream(rn);
@ -130,7 +130,7 @@ namespace CodeImp.DoomBuilder.Actions
// Load configuration from stream
Configuration cfg = new Configuration();
cfg.InputConfiguration(actionsreader.ReadToEnd());
if (cfg.ErrorResult)
if(cfg.ErrorResult)
{
string errordesc = "Error in Actions configuration on line " + cfg.ErrorLine + ": " + cfg.ErrorDescription;
General.CancelAutoMapLoad();
@ -142,15 +142,15 @@ namespace CodeImp.DoomBuilder.Actions
{
// Read the categories structure
IDictionary cats = cfg.ReadSetting("categories", new Hashtable());
foreach (DictionaryEntry c in cats)
foreach(DictionaryEntry c in cats)
{
// Make the category if not already added
if (!categories.ContainsKey(c.Key.ToString()))
if(!categories.ContainsKey(c.Key.ToString()))
categories.Add(c.Key.ToString(), c.Value.ToString());
}
// Go for all objects in the configuration
foreach (DictionaryEntry a in cfg.Root)
foreach(DictionaryEntry a in cfg.Root)
{
// Get action properties
string shortname = a.Key.ToString();
@ -158,10 +158,10 @@ namespace CodeImp.DoomBuilder.Actions
bool debugonly = cfg.ReadSetting(a.Key + ".debugonly", false);
// Not the categories structure?
if (shortname.ToLowerInvariant() != "categories")
if(shortname.ToLowerInvariant() != "categories")
{
// Check if action should be included
if (General.DebugBuild || !debugonly)
if(General.DebugBuild || !debugonly)
{
// Create an action
CreateAction(cfg, name, shortname);
@ -181,7 +181,7 @@ namespace CodeImp.DoomBuilder.Actions
private void CreateAction(Configuration cfg, string name, string shortname)
{
// Action does not exist yet?
if (!actions.ContainsKey(name))
if(!actions.ContainsKey(name))
{
// Read the key from configuration
int key = General.Settings.ReadSetting("shortcuts." + name, -1);
@ -213,28 +213,21 @@ namespace CodeImp.DoomBuilder.Actions
// This binds all methods marked with this attribute
private void BindMethods(object obj, Type type)
{
if (obj == null)
if(obj == null)
General.WriteLogLine("Binding static action methods for class " + type.Name + "...");
else
General.WriteLogLine("Binding action methods for " + type.Name + " object...");
// Go for all methods on obj
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
//foreach(MethodInfo m in methods)
int methodsCount = methods.Length;
for (int i = 0; i < methodsCount; i++)
foreach(MethodInfo m in methods)
{
MethodInfo m = methods[i];
// Check if the method has this attribute
ActionAttribute[] attrs = (ActionAttribute[])methods[i].GetCustomAttributes(typeof(BeginActionAttribute), true);
ActionAttribute[] attrs = (ActionAttribute[])m.GetCustomAttributes(typeof(BeginActionAttribute), true);
int attrsCount = attrs.Length;
// Go for all attributes
//foreach(ActionAttribute a in attrs)
for (int j = 0; j < attrsCount; j++)
foreach(ActionAttribute a in attrs)
{
ActionAttribute a = attrs[j];
// Create a delegate for this method
ActionDelegate del = (ActionDelegate)Delegate.CreateDelegate(typeof(ActionDelegate), obj, m);
@ -242,7 +235,7 @@ namespace CodeImp.DoomBuilder.Actions
string actionname = a.GetFullActionName(type.Assembly);
// Bind method to action
if (Exists(actionname))
if(Exists(actionname))
actions[actionname].BindBegin(del);
else
throw new ArgumentException("Could not bind " + m.ReflectedType.Name + "." + m.Name + " to action \"" + actionname + "\", that action does not exist! Refer to, or edit Actions.cfg for all available application actions.");
@ -250,13 +243,10 @@ namespace CodeImp.DoomBuilder.Actions
// Check if the method has this attribute
attrs = (ActionAttribute[])m.GetCustomAttributes(typeof(EndActionAttribute), true);
attrsCount = attrs.Length;
// Go for all attributes
//foreach (ActionAttribute a in attrs)
for (int j = 0; j < attrsCount; j++)
{
ActionAttribute a = attrs[j];
// Go for all attributes
foreach(ActionAttribute a in attrs)
{
// Create a delegate for this method
ActionDelegate del = (ActionDelegate)Delegate.CreateDelegate(typeof(ActionDelegate), obj, m);
@ -264,7 +254,7 @@ namespace CodeImp.DoomBuilder.Actions
string actionname = a.GetFullActionName(type.Assembly);
// Bind method to action
if (Exists(actionname))
if(Exists(actionname))
actions[actionname].BindEnd(del);
else
throw new ArgumentException("Could not bind " + m.ReflectedType.Name + "." + m.Name + " to action \"" + actionname + "\", that action does not exist. Refer to, or edit Actions.cfg for all available application actions.");
@ -279,7 +269,7 @@ namespace CodeImp.DoomBuilder.Actions
string actionname = a.GetFullActionName(asm);
// Bind delegate to action
if (Exists(actionname))
if(Exists(actionname))
actions[actionname].BindBegin(d);
else
General.ErrorLogger.Add(ErrorType.Warning, "Could not bind delegate for " + d.Method.Name + " to action \"" + a.ActionName + "\" (" + actionname + "), that action does not exist. Refer to, or edit Actions.cfg for all available application actions.");
@ -292,7 +282,7 @@ namespace CodeImp.DoomBuilder.Actions
string actionname = a.GetFullActionName(asm);
// Bind delegate to action
if (Exists(actionname))
if(Exists(actionname))
actions[actionname].BindEnd(d);
else
General.ErrorLogger.Add(ErrorType.Warning, "Could not bind delegate for " + d.Method.Name + " to action \"" + a.ActionName + "\" (" + actionname + "), that action does not exist. Refer to, or edit Actions.cfg for all available application actions.");
@ -315,20 +305,20 @@ namespace CodeImp.DoomBuilder.Actions
// This unbinds all methods marked with this attribute
private void UnbindMethods(object obj, Type type)
{
if (obj == null)
if(obj == null)
General.WriteLogLine("Unbinding static action methods for class " + type.Name + "...");
else
General.WriteLogLine("Unbinding action methods for " + type.Name + " object...");
// Go for all methods on obj
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
foreach (MethodInfo m in methods)
foreach(MethodInfo m in methods)
{
// Check if the method has this attribute
ActionAttribute[] attrs = (ActionAttribute[])m.GetCustomAttributes(typeof(BeginActionAttribute), true);
// Go for all attributes
foreach (ActionAttribute a in attrs)
foreach(ActionAttribute a in attrs)
{
// Create a delegate for this method
ActionDelegate del = (ActionDelegate)Delegate.CreateDelegate(typeof(ActionDelegate), obj, m);
@ -344,7 +334,7 @@ namespace CodeImp.DoomBuilder.Actions
attrs = (ActionAttribute[])m.GetCustomAttributes(typeof(EndActionAttribute), true);
// Go for all attributes
foreach (ActionAttribute a in attrs)
foreach(ActionAttribute a in attrs)
{
// Create a delegate for this method
ActionDelegate del = (ActionDelegate)Delegate.CreateDelegate(typeof(ActionDelegate), obj, m);
@ -402,7 +392,7 @@ namespace CodeImp.DoomBuilder.Actions
internal void SaveSettings()
{
// Go for all actions
foreach (KeyValuePair<string, Action> a in actions)
foreach(KeyValuePair<string, Action> a in actions)
{
// Write to configuration
General.Settings.WriteSetting("shortcuts." + a.Key, a.Value.ShortcutKey);
@ -412,7 +402,7 @@ namespace CodeImp.DoomBuilder.Actions
// This invokes the Begin and End of the given action
public bool InvokeAction(string actionname)
{
if (Exists(actionname))
if(Exists(actionname))
{
actions[actionname].Invoke();
return true;
@ -428,18 +418,18 @@ namespace CodeImp.DoomBuilder.Actions
internal void ApplyDefaultShortcutKeys()
{
// Find actions that have no key set
foreach (KeyValuePair<string, Action> a in actions)
foreach(KeyValuePair<string, Action> a in actions)
{
// Key set?
if (a.Value.ShortcutKey == -1)
if(a.Value.ShortcutKey == -1)
{
// Check if the default key is not already used
bool keyused = false;
foreach (KeyValuePair<string, Action> d in actions)
foreach(KeyValuePair<string, Action> d in actions)
{
// Check if the keys are the same
// Note that I use the mask of the source action to check if they match any combination
if ((d.Value.ShortcutKey & a.Value.ShortcutMask) == (a.Value.DefaultShortcutKey & a.Value.ShortcutMask))
if((d.Value.ShortcutKey & a.Value.ShortcutMask) == (a.Value.DefaultShortcutKey & a.Value.ShortcutMask))
{
// No party.
keyused = true;
@ -448,7 +438,7 @@ namespace CodeImp.DoomBuilder.Actions
}
// Party?
if (!keyused)
if(!keyused)
{
// Apply the default key
a.Value.SetShortcutKey(a.Value.DefaultShortcutKey);
@ -465,13 +455,13 @@ namespace CodeImp.DoomBuilder.Actions
// This checks if a given action is active
public bool CheckActionActive(Assembly asm, string actionname)
{
if (asm == null) asm = General.ThisAssembly;
if(asm == null) asm = General.ThisAssembly;
// Find active action
string fullname = asm.GetName().Name.ToLowerInvariant() + "_" + actionname;
foreach (Action a in activeactions)
foreach(Action a in activeactions)
{
if (a.Name == fullname) return true;
if(a.Name == fullname) return true;
}
// No such active action
@ -482,7 +472,7 @@ namespace CodeImp.DoomBuilder.Actions
internal void RemoveShortcutKeys()
{
// Clear all keys
foreach (KeyValuePair<string, Action> a in actions)
foreach(KeyValuePair<string, Action> a in actions)
a.Value.SetShortcutKey(0);
}
@ -491,16 +481,16 @@ namespace CodeImp.DoomBuilder.Actions
internal bool KeyPressed(int key)
{
int strippedkey = key & ~((int)Keys.Alt | (int)Keys.Shift | (int)Keys.Control);
if ((strippedkey == (int)Keys.ShiftKey) || (strippedkey == (int)Keys.ControlKey) || (strippedkey == (int)Keys.Alt)) key = strippedkey;
if((strippedkey == (int)Keys.ShiftKey) || (strippedkey == (int)Keys.ControlKey) || (strippedkey == (int)Keys.Alt)) key = strippedkey;
bool repeat = pressedkeys.Contains(strippedkey);
// Update pressed keys
if (!repeat) pressedkeys.Add(strippedkey);
if(!repeat) pressedkeys.Add(strippedkey);
// Add action to active list
Action[] acts = GetActionsByKey(key);
bool absorbed = acts.Length > 0;
foreach (Action a in acts) if (!activeactions.Contains(a)) activeactions.Add(a);
foreach(Action a in acts) if(!activeactions.Contains(a)) activeactions.Add(a);
// Invoke actions
absorbed |= BeginActionByKey(key, repeat);
@ -515,7 +505,7 @@ namespace CodeImp.DoomBuilder.Actions
int strippedkey = key & ~((int)Keys.Alt | (int)Keys.Shift | (int)Keys.Control);
// Update pressed keys
if (pressedkeys.Contains(strippedkey)) pressedkeys.Remove(strippedkey);
if(pressedkeys.Contains(strippedkey)) pressedkeys.Remove(strippedkey);
// End actions that no longer match
return EndActiveActions();
@ -549,19 +539,19 @@ namespace CodeImp.DoomBuilder.Actions
// Get all actions for which a begin is bound
List<Action> boundactions = new List<Action>(actions.Count);
foreach (KeyValuePair<string, Action> a in actions)
if (a.Value.BeginBound) boundactions.Add(a.Value);
foreach(KeyValuePair<string, Action> a in actions)
if(a.Value.BeginBound) boundactions.Add(a.Value);
// Go for all actions
foreach (Action a in boundactions)
foreach(Action a in boundactions)
{
// This action is associated with this key?
if (a.KeyMatches(key))
if(a.KeyMatches(key))
{
invoked = true;
// Allowed to repeat?
if (a.Repeat || !repeated)
if(a.Repeat || !repeated)
{
// Invoke action
a.Begin();
@ -587,22 +577,22 @@ namespace CodeImp.DoomBuilder.Actions
{
// Go for all active actions
listchanged = false;
for (int i = 0; i < activeactions.Count; i++)
for(int i = 0; i < activeactions.Count; i++)
{
Action a = activeactions[i];
// Go for all pressed keys
bool stillactive = false;
foreach (int k in pressedkeys)
foreach(int k in pressedkeys)
{
if ((k == (int)Keys.ShiftKey) || (k == (int)Keys.ControlKey))
if((k == (int)Keys.ShiftKey) || (k == (int)Keys.ControlKey))
stillactive |= a.KeyMatches(k);
else
stillactive |= a.KeyMatches(k | modifiers);
}
// End the action if no longer matches any of the keys
if (!stillactive)
if(!stillactive)
{
actionsended = true;
activeactions.RemoveAt(i);
@ -612,7 +602,7 @@ namespace CodeImp.DoomBuilder.Actions
}
}
}
while (listchanged);
while(listchanged);
return actionsended;
}
@ -623,10 +613,10 @@ namespace CodeImp.DoomBuilder.Actions
List<string> actionnames = new List<string>();
// Go for all actions
foreach (KeyValuePair<string, Action> a in actions)
foreach(KeyValuePair<string, Action> a in actions)
{
// This action is associated with this key?
if (a.Value.KeyMatches(key))
if(a.Value.KeyMatches(key))
{
// List short name
actionnames.Add(a.Value.ShortName);
@ -643,10 +633,10 @@ namespace CodeImp.DoomBuilder.Actions
List<Action> actionnames = new List<Action>();
// Go for all actions
foreach (KeyValuePair<string, Action> a in actions)
foreach(KeyValuePair<string, Action> a in actions)
{
// This action is associated with this key?
if (a.Value.KeyMatches(key))
if(a.Value.KeyMatches(key))
{
// List short name
actionnames.Add(a.Value);
@ -673,7 +663,7 @@ namespace CodeImp.DoomBuilder.Actions
/// </summary>
public bool RequestExclusiveInvokation()
{
if (exclusiverequested) return false; // Already given out
if(exclusiverequested) return false; // Already given out
// Success
exclusiverequested = true;

View file

@ -107,19 +107,12 @@ namespace CodeImp.DoomBuilder.Controls
}
private void CheckValues()
{
if (blockUpdate)
{
changed = string.IsNullOrEmpty(value1.Text) || string.IsNullOrEmpty(value2.Text);
bReset.Visible = changed;
}
else
{
changed = string.IsNullOrEmpty(value1.Text) || string.IsNullOrEmpty(value2.Text)
|| value1.GetResultFloat(defaultValue, 0) != defaultValue || value2.GetResultFloat(defaultValue, 0) != defaultValue;
bReset.Visible = changed;
if (OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
if(!blockUpdate && OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void UpdateButtons()

View file

@ -627,7 +627,6 @@ namespace CodeImp.DoomBuilder
mainwindow = new MainForm();
mainwindow.SetupInterface();
mainwindow.UpdateInterface();
mainwindow.UpdateSkills(); // ano
mainwindow.UpdateThingsFilters();
if(!delaymainwindow)
@ -1103,7 +1102,6 @@ namespace CodeImp.DoomBuilder
mainwindow.UpdateThingsFilters();
mainwindow.UpdateLinedefColorPresets(); //mxd
mainwindow.UpdateInterface();
mainwindow.UpdateSkills(); // ano
mainwindow.AddHintsDocker(); //mxd
mainwindow.UpdateGZDoomPanel(); //mxd
mainwindow.HideInfo(); //mxd
@ -1178,7 +1176,6 @@ namespace CodeImp.DoomBuilder
mainwindow.RemoveHintsDocker();
mainwindow.UpdateGZDoomPanel();
mainwindow.UpdateInterface();
mainwindow.UpdateSkills(); // ano
mainwindow.DisplayReady();
WriteLogLine("Map unload done");
return true;
@ -1282,7 +1279,6 @@ namespace CodeImp.DoomBuilder
mainwindow.UpdateThingsFilters();
mainwindow.UpdateLinedefColorPresets(); //mxd
mainwindow.UpdateInterface();
mainwindow.UpdateSkills(); // ano
mainwindow.HideInfo();
mainwindow.AddHintsDocker(); //mxd
mainwindow.UpdateGZDoomPanel(); //mxd
@ -1359,7 +1355,6 @@ namespace CodeImp.DoomBuilder
mainwindow.UpdateThingsFilters();
mainwindow.UpdateLinedefColorPresets(); //mxd
mainwindow.UpdateInterface();
mainwindow.UpdateSkills(); // ano
mainwindow.HideInfo();
mainwindow.AddHintsDocker(); //mxd
@ -1428,7 +1423,6 @@ namespace CodeImp.DoomBuilder
// All done
mainwindow.UpdateInterface();
mainwindow.UpdateSkills(); // ano
return result;
}
@ -1451,9 +1445,8 @@ namespace CodeImp.DoomBuilder
// All done
mainwindow.UpdateInterface();
mainwindow.UpdateSkills(); // ano
if (errorlogger.IsErrorAdded)
if(errorlogger.IsErrorAdded)
{
// Show any errors if preferred
mainwindow.DisplayStatus(StatusType.Warning, "There were errors during saving!");
@ -1537,9 +1530,8 @@ namespace CodeImp.DoomBuilder
// All done
mainwindow.UpdateInterface();
mainwindow.UpdateSkills(); // ano
if (errorlogger.IsErrorAdded)
if(errorlogger.IsErrorAdded)
{
// Show any errors if preferred
mainwindow.DisplayStatus(StatusType.Warning, "There were errors during saving!");
@ -1608,9 +1600,8 @@ namespace CodeImp.DoomBuilder
// All done
mainwindow.UpdateInterface();
mainwindow.UpdateSkills(); // ano
if (errorlogger.IsErrorAdded)
if(errorlogger.IsErrorAdded)
{
// Show any errors if preferred
mainwindow.DisplayStatus(StatusType.Warning, "There were errors during saving!");

View file

@ -2393,7 +2393,6 @@ namespace CodeImp.DoomBuilder
General.MainWindow.UpdateThingsFilters();
General.MainWindow.UpdateLinedefColorPresets(); //mxd
General.MainWindow.UpdateInterface();
General.MainWindow.UpdateSkills(); // ano
// Done
General.MainWindow.DisplayReady();

View file

@ -30,6 +30,6 @@ using CodeImp.DoomBuilder;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.3.0.2861")]
[assembly: AssemblyVersion("2.3.0.2859")]
[assembly: NeutralResourcesLanguageAttribute("en")]
[assembly: AssemblyHash("a3ff16c")]
[assembly: AssemblyHash("5a5c6d0")]

View file

@ -131,11 +131,23 @@ namespace CodeImp.DoomBuilder.Windows
#region ================== Constructor
public LinedefEditFormUDMF()
public LinedefEditFormUDMF(bool selectfront, bool selectback)
{
// Initialize
InitializeComponent();
// Widow setup
if(General.Settings.StoreSelectedEditTab)
{
int activetab = General.Settings.ReadSetting("windows." + configname + ".activetab", 0);
// When front or back tab was previously selected, switch to appropriate side (selectfront/selectback are set in BaseVisualGeometrySidedef.OnEditEnd)
if((selectfront || selectback) && (activetab == 1 || activetab == 2))
tabs.SelectTab(selectfront ? 1 : 2);
else
tabs.SelectTab(activetab);
}
// Fill flags lists
foreach(KeyValuePair<string, string> lf in General.Map.Config.LinedefFlags)
flags.Add(lf.Value, lf.Key);
@ -231,21 +243,8 @@ namespace CodeImp.DoomBuilder.Windows
#region ================== Methods
// This sets up the form to edit the given lines
public void Setup(ICollection<Linedef> lines, bool selectfront, bool selectback)
public void Setup(ICollection<Linedef> lines)
{
// Window setup
// ano - moved this here because we don't reinstantiate the thing every time anymore
if (General.Settings.StoreSelectedEditTab)
{
int activetab = General.Settings.ReadSetting("windows." + configname + ".activetab", 0);
// When front or back tab was previously selected, switch to appropriate side (selectfront/selectback are set in BaseVisualGeometrySidedef.OnEditEnd)
if ((selectfront || selectback) && (activetab == 1 || activetab == 2))
tabs.SelectTab(selectfront ? 1 : 2);
else
tabs.SelectTab(activetab);
}
preventchanges = true;
// Keep this list

View file

@ -177,11 +177,6 @@ namespace CodeImp.DoomBuilder.Windows
//mxd. Misc drawing
private Graphics graphics;
//ano, pool for windows
private DelayedForm sectorEditWindow;
private DelayedForm linedefEditWindow;
private DelayedForm thingEditWindow;
#endregion
#region ================== Properties
@ -402,49 +397,6 @@ namespace CodeImp.DoomBuilder.Windows
if(General.Settings.CollapseDockers) dockerspanel.Collapse();
UnlockUpdate();
// ano - create windows on level load instead of whenever you click on something
if (sectorEditWindow != null)
{
sectorEditWindow.Dispose();
}
if (linedefEditWindow != null)
{
linedefEditWindow.Dispose();
}
if (thingEditWindow != null)
{
thingEditWindow.Dispose();
}
if (General.Map.UDMF)
{
SectorEditFormUDMF s = new SectorEditFormUDMF();
s.OnValuesChanged += EditForm_OnValuesChanged;
sectorEditWindow = s;
LinedefEditFormUDMF l = new LinedefEditFormUDMF();
l.OnValuesChanged += EditForm_OnValuesChanged;
linedefEditWindow = l;
ThingEditFormUDMF t = new ThingEditFormUDMF();
t.OnValuesChanged += EditForm_OnValuesChanged;
thingEditWindow = t;
}
else
{
SectorEditForm s = new SectorEditForm();
s.OnValuesChanged += EditForm_OnValuesChanged;
sectorEditWindow = s;
LinedefEditForm l = new LinedefEditForm();
l.OnValuesChanged += EditForm_OnValuesChanged;
linedefEditWindow = l;
ThingEditForm t = new ThingEditForm();
t.OnValuesChanged += EditForm_OnValuesChanged;
thingEditWindow = t;
}
}
else
{
@ -480,7 +432,7 @@ namespace CodeImp.DoomBuilder.Windows
UpdatePrefabsMenu();
UpdateToolsMenu();
UpdateToolbar();
//UpdateSkills(); // ano - moved to places where level is loaded and etc
UpdateSkills();
UpdateHelpMenu();
}
@ -1526,9 +1478,7 @@ namespace CodeImp.DoomBuilder.Windows
#region ================== Toolbar
// This updates the skills list
// ano - made public in order to only call when map/prefs/gameconfigs are changed
// previously was called by undomanager which caused sluggishness
public void UpdateSkills()
private void UpdateSkills()
{
// Clear list
buttontest.DropDownItems.Clear();
@ -1536,15 +1486,12 @@ namespace CodeImp.DoomBuilder.Windows
// Map loaded?
if(General.Map != null)
{
toolbar.SuspendLayout();
// Make the new items list
List<ToolStripItem> items = new List<ToolStripItem>(General.Map.Config.Skills.Count * 2 + General.Map.ConfigSettings.TestEngines.Count + 2);
// Positive skills are with monsters
int skillCount = General.Map.Config.Skills.Count;
for (int i = 0; i < skillCount; i++)
foreach(SkillInfo si in General.Map.Config.Skills)
{
SkillInfo si = General.Map.Config.Skills[i];
ToolStripMenuItem menuitem = new ToolStripMenuItem(si.ToString());
menuitem.Image = Resources.Monster2;
menuitem.Click += TestSkill_Click;
@ -1557,9 +1504,8 @@ namespace CodeImp.DoomBuilder.Windows
items.Add(new ToolStripSeparator { Padding = new Padding(0, 3, 0, 3) });
// Negative skills are without monsters
for (int i = 0; i < skillCount; i++)
foreach(SkillInfo si in General.Map.Config.Skills)
{
SkillInfo si = General.Map.Config.Skills[i];
ToolStripMenuItem menuitem = new ToolStripMenuItem(si.ToString());
menuitem.Image = Resources.Monster3;
menuitem.Click += TestSkill_Click;
@ -1585,7 +1531,6 @@ namespace CodeImp.DoomBuilder.Windows
// Add to list
buttontest.DropDownItems.AddRange(items.ToArray());
toolbar.ResumeLayout(false);
}
}
@ -3371,8 +3316,6 @@ namespace CodeImp.DoomBuilder.Windows
// Update stuff
SetupInterface();
UpdateInterface();
UpdateSkills();
General.Editing.UpdateCurrentEditModes();
General.Plugins.ProgramReconfigure();
@ -3398,7 +3341,6 @@ namespace CodeImp.DoomBuilder.Windows
// Update stuff
SetupInterface();
UpdateInterface();
UpdateSkills();
ApplyShortcutKeys();
General.Colors.CreateCorrectionTable();
General.Plugins.ProgramReconfigure();
@ -3982,20 +3924,7 @@ namespace CodeImp.DoomBuilder.Windows
// Show line edit dialog
if(General.Map.UDMF) //mxd
{
LinedefEditFormUDMF f = (LinedefEditFormUDMF)linedefEditWindow;
f.OnValuesChanged -= EditForm_OnValuesChanged;
DisableProcessing(); //mxd
f.Setup(lines, selectfront, selectback);
EnableProcessing(); //mxd
f.OnValuesChanged += EditForm_OnValuesChanged;
editformopen = true; //mxd
result = f.ShowDialog(this);
editformopen = false; //mxd
}
else
{
LinedefEditForm f = (LinedefEditForm)linedefEditWindow;
f.OnValuesChanged -= EditForm_OnValuesChanged;
LinedefEditFormUDMF f = new LinedefEditFormUDMF(selectfront, selectback);
DisableProcessing(); //mxd
f.Setup(lines);
EnableProcessing(); //mxd
@ -4003,6 +3932,19 @@ namespace CodeImp.DoomBuilder.Windows
editformopen = true; //mxd
result = f.ShowDialog(this);
editformopen = false; //mxd
f.Dispose();
}
else
{
LinedefEditForm f = new LinedefEditForm();
DisableProcessing(); //mxd
f.Setup(lines);
EnableProcessing(); //mxd
f.OnValuesChanged += EditForm_OnValuesChanged;
editformopen = true; //mxd
result = f.ShowDialog(this);
editformopen = false; //mxd
f.Dispose();
}
return result;
@ -4016,9 +3958,7 @@ namespace CodeImp.DoomBuilder.Windows
// Show sector edit dialog
if(General.Map.UDMF) //mxd
{
// ano - preinit sector edit windows to save time
SectorEditFormUDMF f = (SectorEditFormUDMF)sectorEditWindow;
f.OnValuesChanged -= EditForm_OnValuesChanged;
SectorEditFormUDMF f = new SectorEditFormUDMF();
DisableProcessing(); //mxd
f.Setup(sectors);
EnableProcessing(); //mxd
@ -4026,12 +3966,11 @@ namespace CodeImp.DoomBuilder.Windows
editformopen = true; //mxd
result = f.ShowDialog(this);
editformopen = false; //mxd
//f.Dispose();
f.Dispose();
}
else
{
SectorEditForm f = (SectorEditForm)sectorEditWindow;
f.OnValuesChanged -= EditForm_OnValuesChanged;
SectorEditForm f = new SectorEditForm();
DisableProcessing(); //mxd
f.Setup(sectors);
EnableProcessing(); //mxd
@ -4039,7 +3978,7 @@ namespace CodeImp.DoomBuilder.Windows
editformopen = true; //mxd
result = f.ShowDialog(this);
editformopen = false; //mxd
//f.Dispose();
f.Dispose();
}
return result;
@ -4053,8 +3992,7 @@ namespace CodeImp.DoomBuilder.Windows
// Show thing edit dialog
if(General.Map.UDMF)
{
ThingEditFormUDMF f = (ThingEditFormUDMF)thingEditWindow;
f.OnValuesChanged -= EditForm_OnValuesChanged;
ThingEditFormUDMF f = new ThingEditFormUDMF();
DisableProcessing(); //mxd
f.Setup(things);
EnableProcessing(); //mxd
@ -4062,12 +4000,11 @@ namespace CodeImp.DoomBuilder.Windows
editformopen = true; //mxd
result = f.ShowDialog(this);
editformopen = false; //mxd
f.Dispose();
}
else
{
ThingEditForm f = (ThingEditForm)thingEditWindow;
f.OnValuesChanged -= EditForm_OnValuesChanged;
ThingEditForm f = new ThingEditForm();
DisableProcessing(); //mxd
f.Setup(things);
EnableProcessing(); //mxd
@ -4075,6 +4012,7 @@ namespace CodeImp.DoomBuilder.Windows
editformopen = true; //mxd
result = f.ShowDialog(this);
editformopen = false; //mxd
f.Dispose();
}
return result;

View file

@ -29,5 +29,5 @@ using System.Resources;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.3.0.2861")]
[assembly: AssemblyVersion("2.3.0.2859")]
[assembly: NeutralResourcesLanguageAttribute("en")]