mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 04:40:55 +00:00
Alt key can now be bound to mouse button/scroll wheel combination.
Action descriptions: added "disregardalt" parameter.
This commit is contained in:
parent
47a84ad20f
commit
ae79ed4e19
4 changed files with 78 additions and 19 deletions
|
@ -46,6 +46,7 @@ namespace CodeImp.DoomBuilder.Actions
|
|||
private bool allowscroll;
|
||||
private bool disregardshift;
|
||||
private bool disregardcontrol;
|
||||
private bool disregardalt; //mxd
|
||||
private bool repeat;
|
||||
|
||||
// Delegate
|
||||
|
@ -69,6 +70,7 @@ namespace CodeImp.DoomBuilder.Actions
|
|||
public bool AllowScroll { get { return allowscroll; } }
|
||||
public bool DisregardShift { get { return disregardshift; } }
|
||||
public bool DisregardControl { get { return disregardcontrol; } }
|
||||
public bool DisregardAlt { get { return disregardalt; } } //mxd
|
||||
public bool Repeat { get { return repeat; } }
|
||||
public bool BeginBound { get { return (begindelegates.Count > 0); } }
|
||||
public bool EndBound { get { return (enddelegates.Count > 0); } }
|
||||
|
@ -91,18 +93,15 @@ namespace CodeImp.DoomBuilder.Actions
|
|||
this.allowscroll = cfg.ReadSetting(shortname + ".allowscroll", false);
|
||||
this.disregardshift = cfg.ReadSetting(shortname + ".disregardshift", false);
|
||||
this.disregardcontrol = cfg.ReadSetting(shortname + ".disregardcontrol", false);
|
||||
this.disregardalt = cfg.ReadSetting(shortname + ".disregardalt", false); //mxd
|
||||
this.repeat = cfg.ReadSetting(shortname + ".repeat", false);
|
||||
this.defaultkey = cfg.ReadSetting(shortname + ".default", 0);
|
||||
this.begindelegates = new List<ActionDelegate>();
|
||||
this.enddelegates = new List<ActionDelegate>();
|
||||
|
||||
if(disregardshift)
|
||||
keymask = (int)Keys.Shift;
|
||||
else
|
||||
keymask = 0;
|
||||
|
||||
if(disregardcontrol)
|
||||
keymask |= (int)Keys.Control;
|
||||
keymask = disregardshift ? (int)Keys.Shift : 0;
|
||||
if(disregardcontrol) keymask |= (int)Keys.Control;
|
||||
if(disregardalt) keymask |= (int)Keys.Alt; //mxd
|
||||
|
||||
keymask = ~keymask;
|
||||
|
||||
|
|
|
@ -508,7 +508,7 @@ namespace CodeImp.DoomBuilder.Actions
|
|||
internal bool 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;
|
||||
if((strippedkey == (int)Keys.ShiftKey) || (strippedkey == (int)Keys.ControlKey) || (strippedkey == (int)Keys.Alt)) key = strippedkey;
|
||||
bool repeat = pressedkeys.Contains(strippedkey);
|
||||
|
||||
// Update pressed keys
|
||||
|
|
|
@ -29,6 +29,7 @@ categories
|
|||
// allowscroll: Allows the user to bind the scrollwheel to this action.
|
||||
// disregardshift: This action will trigger regardless if Shift is used.
|
||||
// disregardcontrol: This action will be triggered regardless if Control is used.
|
||||
// disregardalt: This action will be triggered regardless if Alt is used (mxd).
|
||||
// repeat: BeginAction will be called for automatic key repetition.
|
||||
// default: Default key is only used when the action is loaded for the first
|
||||
// time and the default key is not used by any other action.
|
||||
|
@ -225,6 +226,7 @@ classicselect
|
|||
allowscroll = false;
|
||||
disregardshift = true;
|
||||
disregardcontrol = true;
|
||||
disregardalt = true; //mxd
|
||||
}
|
||||
|
||||
classicedit
|
||||
|
@ -237,6 +239,7 @@ classicedit
|
|||
allowscroll = false;
|
||||
disregardshift = true;
|
||||
disregardcontrol = true;
|
||||
disregardalt = true; //mxd
|
||||
}
|
||||
|
||||
scrollwest
|
||||
|
|
|
@ -560,6 +560,35 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
actioncontrol.Items.Add(new KeyControl(SpecialKeys.MScrollUp, "ScrollUp"));
|
||||
actioncontrol.Items.Add(new KeyControl(SpecialKeys.MScrollDown, "ScrollDown"));
|
||||
}
|
||||
|
||||
//mxd. Alt
|
||||
if(a.AllowMouse && !a.DisregardAlt) {
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.LButton | Keys.Alt, "Alt+LButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.MButton | Keys.Alt, "Alt+MButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.RButton | Keys.Alt, "Alt+RButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton1 | Keys.Alt, "Alt+XButton1"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton2 | Keys.Alt, "Alt+XButton2"));
|
||||
}
|
||||
if(a.AllowScroll && !a.DisregardAlt) {
|
||||
actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollUp | (int)Keys.Alt, "Alt+ScrollUp"));
|
||||
actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollDown | (int)Keys.Alt, "Alt+ScrollDown"));
|
||||
}
|
||||
|
||||
//Ctrl
|
||||
if(a.AllowMouse && !a.DisregardControl) {
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.LButton | Keys.Control, "Ctrl+LButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.MButton | Keys.Control, "Ctrl+MButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.RButton | Keys.Control, "Ctrl+RButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton1 | Keys.Control, "Ctrl+XButton1"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton2 | Keys.Control, "Ctrl+XButton2"));
|
||||
}
|
||||
|
||||
if(a.AllowScroll && !a.DisregardControl) {
|
||||
actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollUp | (int)Keys.Control, "Ctrl+ScrollUp"));
|
||||
actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollDown | (int)Keys.Control, "Ctrl+ScrollDown"));
|
||||
}
|
||||
|
||||
//Shift
|
||||
if(a.AllowMouse && !a.DisregardShift)
|
||||
{
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.LButton | Keys.Shift, "Shift+LButton"));
|
||||
|
@ -573,19 +602,34 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollUp | (int)Keys.Shift, "Shift+ScrollUp"));
|
||||
actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollDown | (int)Keys.Shift, "Shift+ScrollDown"));
|
||||
}
|
||||
if(a.AllowMouse && !a.DisregardControl)
|
||||
{
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.LButton | Keys.Control, "Ctrl+LButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.MButton | Keys.Control, "Ctrl+MButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.RButton | Keys.Control, "Ctrl+RButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton1 | Keys.Control, "Ctrl+XButton1"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton2 | Keys.Control, "Ctrl+XButton2"));
|
||||
|
||||
//mxd. Alt-Shift
|
||||
if(a.AllowMouse && !a.DisregardShift && !a.DisregardAlt) {
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.LButton | Keys.Shift | Keys.Alt, "Alt+Shift+LButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.MButton | Keys.Shift | Keys.Alt, "Alt+Shift+MButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.RButton | Keys.Shift | Keys.Alt, "Alt+Shift+RButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton1 | Keys.Shift | Keys.Alt, "Alt+Shift+XButton1"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton2 | Keys.Shift | Keys.Alt, "Alt+Shift+XButton2"));
|
||||
}
|
||||
if(a.AllowScroll && !a.DisregardControl)
|
||||
{
|
||||
actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollUp | (int)Keys.Control, "Ctrl+ScrollUp"));
|
||||
actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollDown | (int)Keys.Control, "Ctrl+ScrollDown"));
|
||||
if(a.AllowScroll && !a.DisregardShift && !a.DisregardAlt) {
|
||||
actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollUp | (int)Keys.Shift | (int)Keys.Alt, "Alt+Shift+ScrollUp"));
|
||||
actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollDown | (int)Keys.Shift | (int)Keys.Alt, "Alt+Shift+ScrollDown"));
|
||||
}
|
||||
|
||||
//mxd. Ctrl-Alt
|
||||
if(a.AllowMouse && !a.DisregardAlt && !a.DisregardControl) {
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.LButton | Keys.Alt | Keys.Control, "Ctrl+Alt+LButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.MButton | Keys.Alt | Keys.Control, "Ctrl+Alt+MButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.RButton | Keys.Alt | Keys.Control, "Ctrl+Alt+RButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton1 | Keys.Alt | Keys.Control, "Ctrl+Alt+XButton1"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton2 | Keys.Alt | Keys.Control, "Ctrl+Alt+XButton2"));
|
||||
}
|
||||
if(a.AllowScroll && !a.DisregardAlt && !a.DisregardControl) {
|
||||
actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollUp | (int)Keys.Shift | (int)Keys.Alt, "Ctrl+Alt+ScrollUp"));
|
||||
actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollDown | (int)Keys.Shift | (int)Keys.Alt, "Ctrl+Alt+ScrollDown"));
|
||||
}
|
||||
|
||||
//Ctrl-Shift
|
||||
if(a.AllowMouse && !a.DisregardShift && !a.DisregardControl)
|
||||
{
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.LButton | Keys.Shift | Keys.Control, "Ctrl+Shift+LButton"));
|
||||
|
@ -599,6 +643,19 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollUp | (int)Keys.Shift | (int)Keys.Control, "Ctrl+Shift+ScrollUp"));
|
||||
actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollDown | (int)Keys.Shift | (int)Keys.Control, "Ctrl+Shift+ScrollDown"));
|
||||
}
|
||||
|
||||
//mxd. Ctrl-Alt-Shift
|
||||
if(a.AllowMouse && !a.DisregardShift && !a.DisregardControl && !a.DisregardAlt) {
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.LButton | Keys.Shift | Keys.Control | Keys.Alt, "Ctrl+Alt+Shift+LButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.MButton | Keys.Shift | Keys.Control | Keys.Alt, "Ctrl+Alt+Shift+MButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.RButton | Keys.Shift | Keys.Control | Keys.Alt, "Ctrl+Alt+Shift+RButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton1 | Keys.Shift | Keys.Control | Keys.Alt, "Ctrl+Alt+Shift+XButton1"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton2 | Keys.Shift | Keys.Control | Keys.Alt, "Ctrl+Alt+Shift+XButton2"));
|
||||
}
|
||||
if(a.AllowScroll && !a.DisregardShift && !a.DisregardControl && !a.DisregardAlt) {
|
||||
actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollUp | (int)Keys.Shift | (int)Keys.Control | (int)Keys.Alt, "Ctrl+Alt+Shift+ScrollUp"));
|
||||
actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollDown | (int)Keys.Shift | (int)Keys.Control | (int)Keys.Alt, "Ctrl+Alt+Shift+ScrollDown"));
|
||||
}
|
||||
}
|
||||
|
||||
// Item selected
|
||||
|
|
Loading…
Reference in a new issue