diff --git a/Source/Actions/ActionManager.cs b/Source/Actions/ActionManager.cs index 0c040336..965aa0a2 100644 --- a/Source/Actions/ActionManager.cs +++ b/Source/Actions/ActionManager.cs @@ -32,7 +32,7 @@ using System.Windows.Forms; namespace CodeImp.DoomBuilder.Actions { - internal class ActionManager + public class ActionManager { #region ================== Constants @@ -62,8 +62,8 @@ namespace CodeImp.DoomBuilder.Actions #region ================== Properties - public SortedDictionary Categories { get { return categories; } } - public Action this[string action] { get { if(actions.ContainsKey(action)) return actions[action]; else throw new ArgumentException("There is no such action \"" + action + "\""); } } + internal SortedDictionary 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 + "\""); } } public bool IsDisposed { get { return isdisposed; } } #endregion @@ -71,7 +71,7 @@ namespace CodeImp.DoomBuilder.Actions #region ================== Constructor / Disposer // Constructor - public ActionManager() + internal ActionManager() { // Initialize General.WriteLogLine("Starting action manager..."); @@ -88,7 +88,7 @@ namespace CodeImp.DoomBuilder.Actions } // Disposer - public void Dispose() + internal void Dispose() { // Not already disposed? if(!isdisposed) @@ -105,7 +105,7 @@ namespace CodeImp.DoomBuilder.Actions #region ================== Actions // This loads all actions from an assembly - public void LoadActions(Assembly asm) + internal void LoadActions(Assembly asm) { Stream actionsdata; StreamReader actionsreader; @@ -392,7 +392,7 @@ namespace CodeImp.DoomBuilder.Actions } // This returns a list of all actions - public Action[] GetAllActions() + internal Action[] GetAllActions() { Action[] list = new Action[actions.Count]; actions.Values.CopyTo(list, 0); @@ -406,7 +406,7 @@ namespace CodeImp.DoomBuilder.Actions } // This saves the control settings - public void SaveSettings() + internal void SaveSettings() { // Go for all actions foreach(KeyValuePair a in actions) @@ -435,7 +435,7 @@ namespace CodeImp.DoomBuilder.Actions #region ================== Shortcut Keys // This applies default keys if they are not already in use - public void ApplyDefaultShortcutKeys() + internal void ApplyDefaultShortcutKeys() { // Find actions that have no key set foreach(KeyValuePair a in actions) @@ -487,7 +487,7 @@ namespace CodeImp.DoomBuilder.Actions } // Removes all shortcut keys - public void RemoveShortcutKeys() + internal void RemoveShortcutKeys() { // Clear all keys foreach(KeyValuePair a in actions) @@ -495,7 +495,7 @@ namespace CodeImp.DoomBuilder.Actions } // This notifies a key has been pressed - public void KeyPressed(int key) + internal void KeyPressed(int key) { int strippedkey = key & ~((int)Keys.Alt | (int)Keys.Shift | (int)Keys.Control); if((strippedkey == (int)Keys.ShiftKey) || (strippedkey == (int)Keys.ControlKey)) key = strippedkey; @@ -513,7 +513,7 @@ namespace CodeImp.DoomBuilder.Actions } // This notifies a key has been released - public void KeyReleased(int key) + internal void KeyReleased(int key) { int strippedkey = key & ~((int)Keys.Alt | (int)Keys.Shift | (int)Keys.Control); List keepactions = new List(); @@ -526,7 +526,7 @@ namespace CodeImp.DoomBuilder.Actions } // This releases all pressed keys - public void ReleaseAllKeys() + internal void ReleaseAllKeys() { // Clear pressed keys pressedkeys.Clear(); @@ -536,7 +536,7 @@ namespace CodeImp.DoomBuilder.Actions } // This updates the modifiers - public void UpdateModifiers(int mods) + internal void UpdateModifiers(int mods) { // Update modifiers modifiers = mods; @@ -546,7 +546,7 @@ namespace CodeImp.DoomBuilder.Actions } // This will call the associated actions for a keypress - private void BeginActionByKey(int key, bool repeated) + internal void BeginActionByKey(int key, bool repeated) { // Get all actions for which a begin is bound List boundactions = new List(actions.Count); diff --git a/Source/BuilderModes/ClassicModes/BaseClassicMode.cs b/Source/BuilderModes/ClassicModes/BaseClassicMode.cs index 574227ee..cda24494 100644 --- a/Source/BuilderModes/ClassicModes/BaseClassicMode.cs +++ b/Source/BuilderModes/ClassicModes/BaseClassicMode.cs @@ -117,9 +117,9 @@ namespace CodeImp.DoomBuilder.BuilderModes if(e.Button == MouseButtons.XButton2) k = (int)Keys.XButton2; // Double select-click? Make that the same as single edit-click - if(General.Interface.GetActionByFullName("builder_classicselect").KeyMatches(k)) + if(General.Actions.GetActionByName("builder_classicselect").KeyMatches(k)) { - Action a = General.Interface.GetActionByFullName("builder_classicedit"); + Action a = General.Actions.GetActionByName("builder_classicedit"); if(a != null) a.Invoke(); } } diff --git a/Source/BuilderModes/ClassicModes/LinedefsMode.cs b/Source/BuilderModes/ClassicModes/LinedefsMode.cs index 32803f49..c16076d7 100644 --- a/Source/BuilderModes/ClassicModes/LinedefsMode.cs +++ b/Source/BuilderModes/ClassicModes/LinedefsMode.cs @@ -408,7 +408,7 @@ namespace CodeImp.DoomBuilder.BuilderModes base.OnDragStart(e); // Edit button used? - if(General.Interface.CheckActionActive(null, "classicedit")) + if(General.Actions.CheckActionActive(null, "classicedit")) { // Anything highlighted? if((highlighted != null) && !highlighted.IsDisposed) diff --git a/Source/BuilderModes/ClassicModes/SectorsMode.cs b/Source/BuilderModes/ClassicModes/SectorsMode.cs index 88aba54f..3cb6a297 100644 --- a/Source/BuilderModes/ClassicModes/SectorsMode.cs +++ b/Source/BuilderModes/ClassicModes/SectorsMode.cs @@ -534,7 +534,7 @@ namespace CodeImp.DoomBuilder.BuilderModes base.OnDragStart(e); // Edit button used? - if(General.Interface.CheckActionActive(null, "classicedit")) + if(General.Actions.CheckActionActive(null, "classicedit")) { // Anything highlighted? if((highlighted != null) && !highlighted.IsDisposed) diff --git a/Source/BuilderModes/ClassicModes/ThingsMode.cs b/Source/BuilderModes/ClassicModes/ThingsMode.cs index 394369cb..1aaeda3e 100644 --- a/Source/BuilderModes/ClassicModes/ThingsMode.cs +++ b/Source/BuilderModes/ClassicModes/ThingsMode.cs @@ -404,7 +404,7 @@ namespace CodeImp.DoomBuilder.BuilderModes base.OnDragStart(e); // Edit button used? - if(General.Interface.CheckActionActive(null, "classicedit")) + if(General.Actions.CheckActionActive(null, "classicedit")) { // Anything highlighted? if((highlighted != null) && !highlighted.IsDisposed) diff --git a/Source/BuilderModes/ClassicModes/VerticesMode.cs b/Source/BuilderModes/ClassicModes/VerticesMode.cs index b28086a4..4fd53ae9 100644 --- a/Source/BuilderModes/ClassicModes/VerticesMode.cs +++ b/Source/BuilderModes/ClassicModes/VerticesMode.cs @@ -349,7 +349,7 @@ namespace CodeImp.DoomBuilder.BuilderModes base.OnDragStart(e); // Edit button used? - if(General.Interface.CheckActionActive(null, "classicedit")) + if(General.Actions.CheckActionActive(null, "classicedit")) { // Anything highlighted? if((highlighted != null) && !highlighted.IsDisposed) diff --git a/Source/BuilderModes/Testing/TriangulatorMode.cs b/Source/BuilderModes/Testing/TriangulatorMode.cs index 006bf7b2..7bce30d8 100644 --- a/Source/BuilderModes/Testing/TriangulatorMode.cs +++ b/Source/BuilderModes/Testing/TriangulatorMode.cs @@ -263,7 +263,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing bool front, back; // Edit button is used? - if(General.Interface.CheckActionActive(null, "classicedit")) + if(General.Actions.CheckActionActive(null, "classicedit")) { // Item highlighted? if((highlighted != null) && !highlighted.IsDisposed) diff --git a/Source/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs b/Source/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs index 2869eb0b..bab338cf 100644 --- a/Source/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs +++ b/Source/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs @@ -291,7 +291,7 @@ namespace CodeImp.DoomBuilder.BuilderModes else { // Select button pressed? - if(General.Interface.CheckActionActive(General.ThisAssembly, "visualselect")) + if(General.Actions.CheckActionActive(General.ThisAssembly, "visualselect")) { // Check if tolerance is exceeded to start UV dragging float deltaxy = mode.CameraAngleXY - dragstartanglexy; diff --git a/Source/General/General.cs b/Source/General/General.cs index d5a2ad56..1ec7d9fd 100644 --- a/Source/General/General.cs +++ b/Source/General/General.cs @@ -167,7 +167,7 @@ namespace CodeImp.DoomBuilder internal static List Compilers { get { return compilers; } } internal static Dictionary ScriptConfigs { get { return scriptconfigs; } } public static MapManager Map { get { return map; } } - internal static ActionManager Actions { get { return actions; } } + public static ActionManager Actions { get { return actions; } } internal static PluginManager Plugins { get { return plugins; } } public static Clock Clock { get { return clock; } } public static bool DebugBuild { get { return debugbuild; } } diff --git a/Source/Windows/IMainForm.cs b/Source/Windows/IMainForm.cs index a26956e8..f70c0214 100644 --- a/Source/Windows/IMainForm.cs +++ b/Source/Windows/IMainForm.cs @@ -70,7 +70,6 @@ namespace CodeImp.DoomBuilder.Windows void StopExclusiveMouseInput(); void BreakExclusiveMouseInput(); void ResumeExclusiveMouseInput(); - bool CheckActionActive(Assembly assembly, string actionname); void SetCursor(Cursor cursor); void DisplayWarning(string warning); void HideWarning(); @@ -124,8 +123,6 @@ namespace CodeImp.DoomBuilder.Windows /// Unused. void InvokeTaggedAction(object sender, EventArgs e); - Action GetActionByFullName(string fullname); - void AddButton(ToolStripItem button); void RemoveButton(ToolStripItem button); } diff --git a/Source/Windows/MainForm.cs b/Source/Windows/MainForm.cs index c19e0c1b..ee82b34e 100644 --- a/Source/Windows/MainForm.cs +++ b/Source/Windows/MainForm.cs @@ -280,16 +280,6 @@ namespace CodeImp.DoomBuilder.Windows this.Update(); } - // This returns the action for a given name - // Returns null when the action does not exists - public Action GetActionByFullName(string fullname) - { - if(General.Actions.Exists(fullname)) - return General.Actions.GetActionByName(fullname); - else - return null; - } - #endregion #region ================== Window @@ -1002,15 +992,6 @@ namespace CodeImp.DoomBuilder.Windows #endregion #region ================== Input - - // This checks if a given action is active - public bool CheckActionActive(Assembly assembly, string actionname) - { - if(assembly == null) - return General.Actions.CheckActionActive(General.ThisAssembly, actionname); - else - return General.Actions.CheckActionActive(assembly, actionname); - } // This is a tool to lock the mouse in exclusive mode private void StartMouseExclusive()