- fixed crash in DisengageVolatileMode() when opening a map

- shortcut keys now also displayed for editing modes
This commit is contained in:
codeimp 2008-09-24 16:44:53 +00:00
parent b6aa1ae9ae
commit 90c7beb17d
2 changed files with 16 additions and 5 deletions

View file

@ -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);

View file

@ -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