mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 04:12:12 +00:00
double select-click (lmb) will be the same as a single edit-click (rmb)
This commit is contained in:
parent
5115857b7b
commit
4cbf7e6f0f
5 changed files with 56 additions and 12 deletions
|
@ -28,7 +28,7 @@ using CodeImp.DoomBuilder.IO;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Actions
|
||||
{
|
||||
internal class Action
|
||||
public class Action
|
||||
{
|
||||
#region ================== Variables
|
||||
|
||||
|
@ -80,7 +80,7 @@ namespace CodeImp.DoomBuilder.Actions
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public Action(Configuration cfg, string name, string shortname, int key)
|
||||
internal Action(Configuration cfg, string name, string shortname, int key)
|
||||
{
|
||||
// Initialize
|
||||
this.name = name;
|
||||
|
@ -198,39 +198,46 @@ namespace CodeImp.DoomBuilder.Actions
|
|||
|
||||
#region ================== Methods
|
||||
|
||||
// This invokes the action
|
||||
public void Invoke()
|
||||
{
|
||||
this.Begin();
|
||||
this.End();
|
||||
}
|
||||
|
||||
// This sets a new key for the action
|
||||
public void SetShortcutKey(int key)
|
||||
internal void SetShortcutKey(int key)
|
||||
{
|
||||
// Make it so.
|
||||
this.key = key & keymask;
|
||||
}
|
||||
|
||||
// This binds a delegate to this action
|
||||
public void BindBegin(ActionDelegate method)
|
||||
internal void BindBegin(ActionDelegate method)
|
||||
{
|
||||
begindelegates.Add(method);
|
||||
}
|
||||
|
||||
// This removes a delegate from this action
|
||||
public void UnbindBegin(ActionDelegate method)
|
||||
internal void UnbindBegin(ActionDelegate method)
|
||||
{
|
||||
begindelegates.Remove(method);
|
||||
}
|
||||
|
||||
// This binds a delegate to this action
|
||||
public void BindEnd(ActionDelegate method)
|
||||
internal void BindEnd(ActionDelegate method)
|
||||
{
|
||||
enddelegates.Add(method);
|
||||
}
|
||||
|
||||
// This removes a delegate from this action
|
||||
public void UnbindEnd(ActionDelegate method)
|
||||
internal void UnbindEnd(ActionDelegate method)
|
||||
{
|
||||
enddelegates.Remove(method);
|
||||
}
|
||||
|
||||
// This raises events for this action
|
||||
public void Begin()
|
||||
internal void Begin()
|
||||
{
|
||||
List<ActionDelegate> delegateslist;
|
||||
|
||||
|
@ -246,7 +253,7 @@ namespace CodeImp.DoomBuilder.Actions
|
|||
}
|
||||
|
||||
// This raises events for this action
|
||||
public void End()
|
||||
internal void End()
|
||||
{
|
||||
List<ActionDelegate> delegateslist;
|
||||
|
||||
|
|
|
@ -398,6 +398,12 @@ namespace CodeImp.DoomBuilder.Actions
|
|||
actions.Values.CopyTo(list, 0);
|
||||
return list;
|
||||
}
|
||||
|
||||
// This returns the specified action
|
||||
public Action GetActionByName(string fullname)
|
||||
{
|
||||
return actions[fullname];
|
||||
}
|
||||
|
||||
// This saves the control settings
|
||||
public void SaveSettings()
|
||||
|
@ -415,9 +421,7 @@ namespace CodeImp.DoomBuilder.Actions
|
|||
{
|
||||
if(Exists(actionname))
|
||||
{
|
||||
Action a = actions[actionname];
|
||||
a.Begin();
|
||||
a.End();
|
||||
actions[actionname].Invoke();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -104,6 +104,26 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
General.Editing.ChangeMode(editmode);
|
||||
}
|
||||
|
||||
// Double-clicking
|
||||
public override void OnMouseDoubleClick(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDoubleClick(e);
|
||||
|
||||
int k = 0;
|
||||
if(e.Button == MouseButtons.Left) k = (int)Keys.LButton;
|
||||
if(e.Button == MouseButtons.Middle) k = (int)Keys.MButton;
|
||||
if(e.Button == MouseButtons.Right) k = (int)Keys.RButton;
|
||||
if(e.Button == MouseButtons.XButton1) k = (int)Keys.XButton1;
|
||||
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))
|
||||
{
|
||||
Action a = General.Interface.GetActionByFullName("builder_classicedit");
|
||||
if(a != null) a.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Actions
|
||||
|
|
|
@ -26,6 +26,7 @@ using System.IO;
|
|||
using System.Reflection;
|
||||
using System.Drawing;
|
||||
using System.ComponentModel;
|
||||
using CodeImp.DoomBuilder.Actions;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using SlimDX.Direct3D9;
|
||||
using SlimDX;
|
||||
|
@ -123,6 +124,8 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
/// <param name="e">Unused.</param>
|
||||
void InvokeTaggedAction(object sender, EventArgs e);
|
||||
|
||||
Action GetActionByFullName(string fullname);
|
||||
|
||||
void AddButton(ToolStripItem button);
|
||||
void RemoveButton(ToolStripItem button);
|
||||
}
|
||||
|
|
|
@ -280,6 +280,16 @@ 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
|
||||
|
|
Loading…
Reference in a new issue