This commit is contained in:
codeimp 2007-06-25 19:28:03 +00:00
parent f6fe33591f
commit 6900a4cfa7
6 changed files with 42 additions and 5 deletions

View file

@ -49,6 +49,11 @@ namespace CodeImp.DoomBuilder.Controls
// Shortcut key
private int key;
// Shortcut options
private bool allowkeys;
private bool allowmouse;
private bool allowscroll;
// Delegate
private List<ActionDelegate> delegates;
@ -59,18 +64,25 @@ namespace CodeImp.DoomBuilder.Controls
public string Title { get { return title; } }
public string Description { get { return description; } }
public int ShortcutKey { get { return key; } }
public bool AllowKeys { get { return allowkeys; } }
public bool AllowMouse { get { return allowmouse; } }
public bool AllowScroll { get { return allowscroll; } }
#endregion
#region ================== Constructor / Disposer
// Constructor
public Action(string title, string description, int key)
public Action(string title, string description, int key,
bool allowkeys, bool allowmouse, bool allowscroll)
{
// Initialize
this.title = title;
this.description = description;
this.delegates = new List<ActionDelegate>();
this.allowkeys = allowkeys;
this.allowmouse = allowmouse;
this.allowscroll = allowscroll;
this.key = key;
}

View file

@ -92,6 +92,7 @@ namespace CodeImp.DoomBuilder.Controls
StreamReader actionsreader;
Configuration cfg;
string name, title, desc;
bool amouse, akeys, ascroll;
int key;
// Get a stream from the resource
@ -114,9 +115,12 @@ namespace CodeImp.DoomBuilder.Controls
title = cfg.ReadSetting(name + ".title", "[" + name + "]");
desc = cfg.ReadSetting(name + ".description", "");
key = General.Settings.ReadSetting("shortcuts." + name, 0);
akeys = cfg.ReadSetting(name + ".allowkeys", false);
amouse = cfg.ReadSetting(name + ".allowmouse", false);
ascroll = cfg.ReadSetting(name + ".allowscroll", false);
// Create an action
actions.Add(name, new Action(title, desc, key));
actions.Add(name, new Action(title, desc, key, akeys, amouse, ascroll));
}
}

View file

@ -236,6 +236,7 @@ namespace CodeImp.DoomBuilder.Interface
this.Resize += new System.EventHandler(this.MainForm_Resize);
this.Move += new System.EventHandler(this.MainForm_Move);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MainForm_KeyDown);
this.ResizeEnd += new System.EventHandler(this.MainForm_ResizeEnd);
this.Load += new System.EventHandler(this.MainForm_Load);
this.menumain.ResumeLayout(false);

View file

@ -276,6 +276,17 @@ namespace CodeImp.DoomBuilder.Interface
#endregion
#region ================== Input
// When a key is pressed
private void MainForm_KeyDown(object sender, KeyEventArgs e)
{
// Invoke any actions associated with this key
General.Actions.InvokeByKey((int)e.KeyData);
}
#endregion
#region ================== Menus
// Public method to apply shortcut keys

View file

@ -123,12 +123,12 @@
<metadata name="menumain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="toolbar.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="toolbar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>121, 17</value>
</metadata>
<metadata name="toolbar.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="statusbar.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>

View file

@ -9,16 +9,25 @@ newmap
{
title = "File: New Map";
description = "Starts with a new, empty workspace to begin drawing a map from scratch.";
allowkeys = true;
allowmouse = false;
allowscroll = false;
}
openmap
{
title = "File: Open Map";
description = "Opens an existing map from WAD file for viewing or modifying.";
allowkeys = true;
allowmouse = false;
allowscroll = false;
}
closemap
{
title = "File: Close Map";
description = "Closes the current map and the WAD file in which it exits.";
allowkeys = true;
allowmouse = false;
allowscroll = false;
}