From 90c7beb17d3f02d96d2f577905b3dfc98053c33d Mon Sep 17 00:00:00 2001 From: codeimp Date: Wed, 24 Sep 2008 16:44:53 +0000 Subject: [PATCH] - fixed crash in DisengageVolatileMode() when opening a map - shortcut keys now also displayed for editing modes --- Source/General/General.cs | 2 +- Source/Windows/MainForm.cs | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Source/General/General.cs b/Source/General/General.cs index cb5d8d2d..9a4f813b 100644 --- a/Source/General/General.cs +++ b/Source/General/General.cs @@ -728,7 +728,7 @@ namespace CodeImp.DoomBuilder public static bool DisengageVolatileMode() { // Volatile mode? - if((map != null) & (map.Mode != null) && map.Mode.Attributes.Volatile) + if((map != null) && (map.Mode != null) && map.Mode.Attributes.Volatile) { // Change back to normal mode map.ChangeMode(map.PreviousStableMode.Name); diff --git a/Source/Windows/MainForm.cs b/Source/Windows/MainForm.cs index 82138502..27634428 100644 --- a/Source/Windows/MainForm.cs +++ b/Source/Windows/MainForm.cs @@ -1259,6 +1259,7 @@ namespace CodeImp.DoomBuilder.Windows item.Enabled = (General.Map != null); menumode.DropDownItems.Insert(index, item); editmodeitems.Add(item); + ApplyShortcutKeys(menumode.DropDownItems); } // This handles edit mode button clicks @@ -1316,12 +1317,22 @@ namespace CodeImp.DoomBuilder.Windows ToolStripMenuItem menuitem = (item as ToolStripMenuItem); // Tag set for this item? - if((menuitem.Tag != null) && (menuitem.Tag is string)) + if(menuitem.Tag is string) { - // Get the action name - string actionname = menuitem.Tag.ToString(); - // Action with this name available? + string actionname = menuitem.Tag.ToString(); + if(General.Actions.Exists(actionname)) + { + // Put the action shortcut key on the menu item + menuitem.ShortcutKeyDisplayString = Action.GetShortcutKeyDesc(General.Actions[actionname].ShortcutKey); + } + } + // Edit mode info set for this item? + else if(menuitem.Tag is EditModeInfo) + { + // Action with this name available? + EditModeInfo modeinfo = (menuitem.Tag as EditModeInfo); + string actionname = modeinfo.SwitchAction.GetFullActionName(modeinfo.Plugin.Assembly); if(General.Actions.Exists(actionname)) { // Put the action shortcut key on the menu item