mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 04:40:55 +00:00
- controls configuration now shows only available controls and explains why certain controls can't be used
- fixed some dialogs that could be overlapped when binding the same key to two actions that show a dialog
This commit is contained in:
parent
c907d9c3f2
commit
14aef55b7c
10 changed files with 192 additions and 112 deletions
|
@ -362,14 +362,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
ICollection<Linedef> selected = General.Map.Map.GetSelectedLinedefs(true);
|
||||
if(selected.Count > 0)
|
||||
{
|
||||
// Show line edit dialog
|
||||
General.Interface.ShowEditLinedefs(selected);
|
||||
if(General.Interface.HasFocus)
|
||||
{
|
||||
// Show line edit dialog
|
||||
General.Interface.ShowEditLinedefs(selected);
|
||||
|
||||
// When a single line was selected, deselect it now
|
||||
if(selected.Count == 1) General.Map.Map.ClearSelectedLinedefs();
|
||||
// When a single line was selected, deselect it now
|
||||
if(selected.Count == 1) General.Map.Map.ClearSelectedLinedefs();
|
||||
|
||||
// Update entire display
|
||||
General.Interface.RedrawDisplay();
|
||||
// Update entire display
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -448,19 +448,22 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
ICollection<Sector> selected = General.Map.Map.GetSelectedSectors(true);
|
||||
if(selected.Count > 0)
|
||||
{
|
||||
// Show sector edit dialog
|
||||
General.Interface.ShowEditSectors(selected);
|
||||
|
||||
// When a single sector was selected, deselect it now
|
||||
if(selected.Count == 1)
|
||||
if(General.Interface.HasFocus)
|
||||
{
|
||||
orderedselection.Clear();
|
||||
General.Map.Map.ClearSelectedSectors();
|
||||
General.Map.Map.ClearSelectedLinedefs();
|
||||
}
|
||||
// Show sector edit dialog
|
||||
General.Interface.ShowEditSectors(selected);
|
||||
|
||||
// Update entire display
|
||||
General.Interface.RedrawDisplay();
|
||||
// When a single sector was selected, deselect it now
|
||||
if(selected.Count == 1)
|
||||
{
|
||||
orderedselection.Clear();
|
||||
General.Map.Map.ClearSelectedSectors();
|
||||
General.Map.Map.ClearSelectedLinedefs();
|
||||
}
|
||||
|
||||
// Update entire display
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -355,17 +355,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
ICollection<Thing> selected = General.Map.Map.GetSelectedThings(true);
|
||||
if(selected.Count > 0)
|
||||
{
|
||||
// Show thing edit dialog
|
||||
General.Interface.ShowEditThings(selected);
|
||||
if(General.Interface.HasFocus)
|
||||
{
|
||||
// Show thing edit dialog
|
||||
General.Interface.ShowEditThings(selected);
|
||||
|
||||
// When a single thing was selected, deselect it now
|
||||
if(selected.Count == 1) General.Map.Map.ClearSelectedThings();
|
||||
// When a single thing was selected, deselect it now
|
||||
if(selected.Count == 1) General.Map.Map.ClearSelectedThings();
|
||||
|
||||
// Update things filter
|
||||
General.Map.ThingsFilter.Update();
|
||||
|
||||
// Update entire display
|
||||
General.Interface.RedrawDisplay();
|
||||
// Update things filter
|
||||
General.Map.ThingsFilter.Update();
|
||||
|
||||
// Update entire display
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -88,12 +88,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Select texture
|
||||
public virtual void OnSelectTexture()
|
||||
{
|
||||
string oldtexture = GetTextureName();
|
||||
string newtexture = General.Interface.BrowseFlat(General.Interface, oldtexture);
|
||||
if(newtexture != oldtexture)
|
||||
if(General.Interface.HasFocus)
|
||||
{
|
||||
General.Map.UndoRedo.CreateUndo("Change flat " + newtexture);
|
||||
SetTexture(newtexture);
|
||||
string oldtexture = GetTextureName();
|
||||
string newtexture = General.Interface.BrowseFlat(General.Interface, oldtexture);
|
||||
if(newtexture != oldtexture)
|
||||
{
|
||||
General.Map.UndoRedo.CreateUndo("Change flat " + newtexture);
|
||||
SetTexture(newtexture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,10 +118,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Not using any modifier buttons
|
||||
if(!General.Interface.ShiftState && !General.Interface.CtrlState && !General.Interface.AltState)
|
||||
{
|
||||
List<Sector> sectors = new List<Sector>();
|
||||
sectors.Add(this.Sector.Sector);
|
||||
DialogResult result = General.Interface.ShowEditSectors(sectors);
|
||||
if(result == DialogResult.OK) (this.Sector as BaseVisualSector).Rebuild();
|
||||
if(General.Interface.HasFocus)
|
||||
{
|
||||
List<Sector> sectors = new List<Sector>();
|
||||
sectors.Add(this.Sector.Sector);
|
||||
DialogResult result = General.Interface.ShowEditSectors(sectors);
|
||||
if(result == DialogResult.OK) (this.Sector as BaseVisualSector).Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -212,12 +212,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Select texture
|
||||
public virtual void OnSelectTexture()
|
||||
{
|
||||
string oldtexture = GetTextureName();
|
||||
string newtexture = General.Interface.BrowseTexture(General.Interface, oldtexture);
|
||||
if(newtexture != oldtexture)
|
||||
if(General.Interface.HasFocus)
|
||||
{
|
||||
General.Map.UndoRedo.CreateUndo("Change texture " + newtexture);
|
||||
SetTexture(newtexture);
|
||||
string oldtexture = GetTextureName();
|
||||
string newtexture = General.Interface.BrowseTexture(General.Interface, oldtexture);
|
||||
if(newtexture != oldtexture)
|
||||
{
|
||||
General.Map.UndoRedo.CreateUndo("Change texture " + newtexture);
|
||||
SetTexture(newtexture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,10 +276,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Not using any modifier buttons
|
||||
if(!General.Interface.ShiftState && !General.Interface.CtrlState && !General.Interface.AltState)
|
||||
{
|
||||
List<Linedef> lines = new List<Linedef>();
|
||||
lines.Add(this.Sidedef.Line);
|
||||
DialogResult result = General.Interface.ShowEditLinedefs(lines);
|
||||
if(result == DialogResult.OK) (this.Sector as BaseVisualSector).Rebuild();
|
||||
if(General.Interface.HasFocus)
|
||||
{
|
||||
List<Linedef> lines = new List<Linedef>();
|
||||
lines.Add(this.Sidedef.Line);
|
||||
DialogResult result = General.Interface.ShowEditLinedefs(lines);
|
||||
if(result == DialogResult.OK) (this.Sector as BaseVisualSector).Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -358,10 +358,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Not using any modifier buttons
|
||||
if(!General.Interface.ShiftState && !General.Interface.CtrlState && !General.Interface.AltState)
|
||||
{
|
||||
List<Thing> things = new List<Thing>();
|
||||
things.Add(this.Thing);
|
||||
DialogResult result = General.Interface.ShowEditThings(things);
|
||||
if(result == DialogResult.OK) this.Rebuild();
|
||||
if(General.Interface.HasFocus)
|
||||
{
|
||||
List<Thing> things = new List<Thing>();
|
||||
things.Add(this.Thing);
|
||||
DialogResult result = General.Interface.ShowEditThings(things);
|
||||
if(result == DialogResult.OK) this.Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
bool SnapToGrid { get; }
|
||||
bool MouseExclusive { get; }
|
||||
MouseButtons MouseButtons { get; }
|
||||
bool HasFocus { get; }
|
||||
|
||||
// Methods
|
||||
void DisplayReady();
|
||||
|
|
|
@ -147,6 +147,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
public bool MouseExclusive { get { return mouseexclusive; } }
|
||||
new public IntPtr Handle { get { return windowptr; } }
|
||||
public bool IsInfoPanelExpanded { get { return (panelinfo.Height == EXPANDED_INFO_HEIGHT); } }
|
||||
public bool HasFocus { get { return this.Focused; } }
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
70
Source/Windows/PreferencesForm.Designer.cs
generated
70
Source/Windows/PreferencesForm.Designer.cs
generated
|
@ -88,6 +88,8 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.actionkey = new System.Windows.Forms.TextBox();
|
||||
this.actiondescription = new System.Windows.Forms.Label();
|
||||
this.tabcolors = new System.Windows.Forms.TabPage();
|
||||
this.imagebrightness = new Dotnetrix.Controls.TrackBar();
|
||||
this.doublesidedalpha = new Dotnetrix.Controls.TrackBar();
|
||||
this.imagebrightnesslabel = new System.Windows.Forms.Label();
|
||||
this.doublesidedalphalabel = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
|
@ -100,8 +102,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.colorlinenumbers = new CodeImp.DoomBuilder.Controls.ColorControl();
|
||||
this.colorcomments = new CodeImp.DoomBuilder.Controls.ColorControl();
|
||||
this.colorplaintext = new CodeImp.DoomBuilder.Controls.ColorControl();
|
||||
this.doublesidedalpha = new Dotnetrix.Controls.TrackBar();
|
||||
this.imagebrightness = new Dotnetrix.Controls.TrackBar();
|
||||
this.disregardshiftlabel = new System.Windows.Forms.Label();
|
||||
label7 = new System.Windows.Forms.Label();
|
||||
label6 = new System.Windows.Forms.Label();
|
||||
label5 = new System.Windows.Forms.Label();
|
||||
|
@ -121,9 +122,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.tabkeys.SuspendLayout();
|
||||
this.actioncontrolpanel.SuspendLayout();
|
||||
this.tabcolors.SuspendLayout();
|
||||
this.colorsgroup3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.doublesidedalpha)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.imagebrightness)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.doublesidedalpha)).BeginInit();
|
||||
this.colorsgroup3.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label7
|
||||
|
@ -555,7 +556,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.viewdistance.Maximum = 15;
|
||||
this.viewdistance.Minimum = 1;
|
||||
this.viewdistance.Name = "viewdistance";
|
||||
this.viewdistance.Size = new System.Drawing.Size(150, 45);
|
||||
this.viewdistance.Size = new System.Drawing.Size(150, 42);
|
||||
this.viewdistance.TabIndex = 34;
|
||||
this.viewdistance.TickStyle = System.Windows.Forms.TickStyle.Both;
|
||||
this.viewdistance.Value = 1;
|
||||
|
@ -567,7 +568,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.movespeed.Maximum = 20;
|
||||
this.movespeed.Minimum = 1;
|
||||
this.movespeed.Name = "movespeed";
|
||||
this.movespeed.Size = new System.Drawing.Size(150, 45);
|
||||
this.movespeed.Size = new System.Drawing.Size(150, 42);
|
||||
this.movespeed.TabIndex = 33;
|
||||
this.movespeed.TickStyle = System.Windows.Forms.TickStyle.Both;
|
||||
this.movespeed.Value = 1;
|
||||
|
@ -579,7 +580,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.mousespeed.Maximum = 20;
|
||||
this.mousespeed.Minimum = 1;
|
||||
this.mousespeed.Name = "mousespeed";
|
||||
this.mousespeed.Size = new System.Drawing.Size(150, 45);
|
||||
this.mousespeed.Size = new System.Drawing.Size(150, 42);
|
||||
this.mousespeed.TabIndex = 32;
|
||||
this.mousespeed.TickStyle = System.Windows.Forms.TickStyle.Both;
|
||||
this.mousespeed.Value = 1;
|
||||
|
@ -592,7 +593,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.fieldofview.Maximum = 17;
|
||||
this.fieldofview.Minimum = 5;
|
||||
this.fieldofview.Name = "fieldofview";
|
||||
this.fieldofview.Size = new System.Drawing.Size(150, 45);
|
||||
this.fieldofview.Size = new System.Drawing.Size(150, 42);
|
||||
this.fieldofview.TabIndex = 31;
|
||||
this.fieldofview.TickStyle = System.Windows.Forms.TickStyle.Both;
|
||||
this.fieldofview.Value = 5;
|
||||
|
@ -752,6 +753,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
//
|
||||
this.actioncontrolpanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.actioncontrolpanel.Controls.Add(this.disregardshiftlabel);
|
||||
this.actioncontrolpanel.Controls.Add(this.actioncontrol);
|
||||
this.actioncontrolpanel.Controls.Add(label7);
|
||||
this.actioncontrolpanel.Controls.Add(this.actiontitle);
|
||||
|
@ -842,6 +844,26 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.tabcolors.Text = "Colors";
|
||||
this.tabcolors.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// imagebrightness
|
||||
//
|
||||
this.imagebrightness.LargeChange = 3;
|
||||
this.imagebrightness.Location = new System.Drawing.Point(379, 235);
|
||||
this.imagebrightness.Name = "imagebrightness";
|
||||
this.imagebrightness.Size = new System.Drawing.Size(154, 42);
|
||||
this.imagebrightness.TabIndex = 33;
|
||||
this.imagebrightness.TickStyle = System.Windows.Forms.TickStyle.Both;
|
||||
this.imagebrightness.ValueChanged += new System.EventHandler(this.imagebrightness_ValueChanged);
|
||||
//
|
||||
// doublesidedalpha
|
||||
//
|
||||
this.doublesidedalpha.LargeChange = 3;
|
||||
this.doublesidedalpha.Location = new System.Drawing.Point(379, 180);
|
||||
this.doublesidedalpha.Name = "doublesidedalpha";
|
||||
this.doublesidedalpha.Size = new System.Drawing.Size(154, 42);
|
||||
this.doublesidedalpha.TabIndex = 32;
|
||||
this.doublesidedalpha.TickStyle = System.Windows.Forms.TickStyle.Both;
|
||||
this.doublesidedalpha.ValueChanged += new System.EventHandler(this.doublesidedalpha_ValueChanged);
|
||||
//
|
||||
// imagebrightnesslabel
|
||||
//
|
||||
this.imagebrightnesslabel.AutoSize = true;
|
||||
|
@ -980,25 +1002,16 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.colorplaintext.Size = new System.Drawing.Size(150, 23);
|
||||
this.colorplaintext.TabIndex = 12;
|
||||
//
|
||||
// doublesidedalpha
|
||||
// disregardshiftlabel
|
||||
//
|
||||
this.doublesidedalpha.LargeChange = 3;
|
||||
this.doublesidedalpha.Location = new System.Drawing.Point(379, 180);
|
||||
this.doublesidedalpha.Name = "doublesidedalpha";
|
||||
this.doublesidedalpha.Size = new System.Drawing.Size(154, 45);
|
||||
this.doublesidedalpha.TabIndex = 32;
|
||||
this.doublesidedalpha.TickStyle = System.Windows.Forms.TickStyle.Both;
|
||||
this.doublesidedalpha.ValueChanged += new System.EventHandler(this.doublesidedalpha_ValueChanged);
|
||||
//
|
||||
// imagebrightness
|
||||
//
|
||||
this.imagebrightness.LargeChange = 3;
|
||||
this.imagebrightness.Location = new System.Drawing.Point(379, 235);
|
||||
this.imagebrightness.Name = "imagebrightness";
|
||||
this.imagebrightness.Size = new System.Drawing.Size(154, 45);
|
||||
this.imagebrightness.TabIndex = 33;
|
||||
this.imagebrightness.TickStyle = System.Windows.Forms.TickStyle.Both;
|
||||
this.imagebrightness.ValueChanged += new System.EventHandler(this.imagebrightness_ValueChanged);
|
||||
this.disregardshiftlabel.Location = new System.Drawing.Point(20, 263);
|
||||
this.disregardshiftlabel.Name = "disregardshiftlabel";
|
||||
this.disregardshiftlabel.Size = new System.Drawing.Size(229, 73);
|
||||
this.disregardshiftlabel.TabIndex = 9;
|
||||
this.disregardshiftlabel.Text = "The selected actions uses modifier keys (Shift, Alt and Control) to modify it\'s b" +
|
||||
"ehavior. Therefor, no combination with these modifiers can be used for this acti" +
|
||||
"on.";
|
||||
this.disregardshiftlabel.Visible = false;
|
||||
//
|
||||
// PreferencesForm
|
||||
//
|
||||
|
@ -1039,9 +1052,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.actioncontrolpanel.PerformLayout();
|
||||
this.tabcolors.ResumeLayout(false);
|
||||
this.tabcolors.PerformLayout();
|
||||
this.colorsgroup3.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.doublesidedalpha)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.imagebrightness)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.doublesidedalpha)).EndInit();
|
||||
this.colorsgroup3.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
@ -1117,5 +1130,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
private Dotnetrix.Controls.TrackBar viewdistance;
|
||||
private Dotnetrix.Controls.TrackBar doublesidedalpha;
|
||||
private Dotnetrix.Controls.TrackBar imagebrightness;
|
||||
private System.Windows.Forms.Label disregardshiftlabel;
|
||||
}
|
||||
}
|
|
@ -37,6 +37,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
#region ================== Variables
|
||||
|
||||
private bool allowapplycontrol = false;
|
||||
private bool disregardshift = false;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -105,36 +106,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
item.Group = listactions.Groups[a.Category];
|
||||
}
|
||||
|
||||
// Fill combobox with special controls
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.LButton, "LButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.MButton, "MButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.RButton, "RButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton1, "XButton1"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton2, "XButton2"));
|
||||
actioncontrol.Items.Add(new KeyControl(SpecialKeys.MScrollUp, "ScrollUp"));
|
||||
actioncontrol.Items.Add(new KeyControl(SpecialKeys.MScrollDown, "ScrollDown"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.LButton | Keys.Shift, "Shift+LButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.MButton | Keys.Shift, "Shift+MButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.RButton | Keys.Shift, "Shift+RButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton1 | Keys.Shift, "Shift+XButton1"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton2 | Keys.Shift, "Shift+XButton2"));
|
||||
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"));
|
||||
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"));
|
||||
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"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.LButton | Keys.Shift | Keys.Control, "Ctrl+Shift+LButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.MButton | Keys.Shift | Keys.Control, "Ctrl+Shift+MButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.RButton | Keys.Shift | Keys.Control, "Ctrl+Shift+RButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton1 | Keys.Shift | Keys.Control, "Ctrl+Shift+XButton1"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton2 | Keys.Shift | Keys.Control, "Ctrl+Shift+XButton2"));
|
||||
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"));
|
||||
|
||||
// Set the colors
|
||||
// TODO: Make this automated by using the collection
|
||||
colorbackcolor.Color = General.Colors.Background;
|
||||
|
@ -335,7 +306,67 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
#endregion
|
||||
|
||||
#region ================== Controls Panel
|
||||
|
||||
|
||||
// This fills the list of available controls for the specified action
|
||||
private void FillControlsList(Action a)
|
||||
{
|
||||
actioncontrol.Items.Clear();
|
||||
|
||||
// Fill combobox with special controls
|
||||
if(a.AllowMouse)
|
||||
{
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.LButton, "LButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.MButton, "MButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.RButton, "RButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton1, "XButton1"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton2, "XButton2"));
|
||||
}
|
||||
if(a.AllowScroll)
|
||||
{
|
||||
actioncontrol.Items.Add(new KeyControl(SpecialKeys.MScrollUp, "ScrollUp"));
|
||||
actioncontrol.Items.Add(new KeyControl(SpecialKeys.MScrollDown, "ScrollDown"));
|
||||
}
|
||||
if(a.AllowMouse && !a.DisregardShift)
|
||||
{
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.LButton | Keys.Shift, "Shift+LButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.MButton | Keys.Shift, "Shift+MButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.RButton | Keys.Shift, "Shift+RButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton1 | Keys.Shift, "Shift+XButton1"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton2 | Keys.Shift, "Shift+XButton2"));
|
||||
}
|
||||
if(a.AllowScroll && !a.DisregardShift)
|
||||
{
|
||||
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.DisregardShift)
|
||||
{
|
||||
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.DisregardShift)
|
||||
{
|
||||
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.AllowMouse && !a.DisregardShift)
|
||||
{
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.LButton | Keys.Shift | Keys.Control, "Ctrl+Shift+LButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.MButton | Keys.Shift | Keys.Control, "Ctrl+Shift+MButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.RButton | Keys.Shift | Keys.Control, "Ctrl+Shift+RButton"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton1 | Keys.Shift | Keys.Control, "Ctrl+Shift+XButton1"));
|
||||
actioncontrol.Items.Add(new KeyControl(Keys.XButton2 | Keys.Shift | Keys.Control, "Ctrl+Shift+XButton2"));
|
||||
}
|
||||
if(a.AllowScroll && !a.DisregardShift)
|
||||
{
|
||||
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"));
|
||||
}
|
||||
}
|
||||
|
||||
// Item selected
|
||||
private void listactions_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
|
||||
{
|
||||
|
@ -352,14 +383,19 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// Get the selected action
|
||||
action = General.Actions[listactions.SelectedItems[0].Name];
|
||||
key = (int)listactions.SelectedItems[0].SubItems[1].Tag;
|
||||
|
||||
disregardshift = action.DisregardShift;
|
||||
|
||||
// Enable panel
|
||||
actioncontrolpanel.Enabled = true;
|
||||
actiontitle.Text = action.Title;
|
||||
actiondescription.Text = action.Description;
|
||||
actioncontrol.SelectedIndex = -1;
|
||||
actionkey.Text = "";
|
||||
|
||||
disregardshiftlabel.Visible = disregardshift;
|
||||
|
||||
// Fill special controls list
|
||||
FillControlsList(action);
|
||||
|
||||
// See if the key is in the combobox
|
||||
for(int i = 0; i < actioncontrol.Items.Count; i++)
|
||||
{
|
||||
|
@ -392,6 +428,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
actiondescription.Text = "";
|
||||
actionkey.Text = "";
|
||||
actioncontrol.SelectedIndex = -1;
|
||||
disregardshiftlabel.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -418,15 +455,18 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
{
|
||||
// Begin updating
|
||||
allowapplycontrol = false;
|
||||
|
||||
|
||||
// Remove modifier keys from the key if needed
|
||||
if(disregardshift) key &= ~(int)Keys.Modifiers;
|
||||
|
||||
// Deselect anything from the combobox
|
||||
actioncontrol.SelectedIndex = -1;
|
||||
|
||||
|
||||
// Apply the key combination
|
||||
listactions.SelectedItems[0].SubItems[1].Text = Action.GetShortcutKeyDesc(key);
|
||||
listactions.SelectedItems[0].SubItems[1].Tag = key;
|
||||
actionkey.Text = Action.GetShortcutKeyDesc(key);
|
||||
|
||||
|
||||
// Done
|
||||
allowapplycontrol = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue