mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-03-21 17:48:28 -05:00
Add mousewheel event to edge Level/EXP
Scroll up Level once to increase level, scroll down EXP to be 1 exp from level up. Apply the same mousewheel events to Friendship, IVs/EVs/AVs/GVs, with EVs being increments of 4. I don't think it's worth overriding keypress arrow up and down to do the same.
This commit is contained in:
parent
09f0462736
commit
6b7938fea1
|
|
@ -76,6 +76,10 @@ public PKMEditor()
|
|||
// Controls contained in a TabPage are not created until the tab page is shown
|
||||
// Any data bindings in these controls are not activated until the tab page is shown.
|
||||
FlickerInterface();
|
||||
|
||||
TB_EXP.MouseWheel += WinFormsUtil.MouseWheelIncrement1;
|
||||
TB_Level.MouseWheel += WinFormsUtil.MouseWheelIncrement1;
|
||||
TB_Friendship.MouseWheel += WinFormsUtil.MouseWheelIncrement1;
|
||||
}
|
||||
|
||||
private sealed class ValidationRequiredSet(Control[] controls, Func<PKM, bool> shouldCheck, Func<Control, bool> isState)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,15 @@ public StatEditor()
|
|||
|
||||
TB_BST.ResetForeColor();
|
||||
TB_IVTotal.ForeColor = TB_EVTotal.ForeColor = MT_EVs[0].ForeColor;
|
||||
|
||||
foreach (var iv in MT_IVs)
|
||||
iv.MouseWheel += WinFormsUtil.MouseWheelIncrement1;
|
||||
foreach (var ev in MT_EVs)
|
||||
ev.MouseWheel += WinFormsUtil.MouseWheelIncrement4;
|
||||
foreach (var av in MT_AVs)
|
||||
av.MouseWheel += WinFormsUtil.MouseWheelIncrement1;
|
||||
foreach (var gv in MT_GVs)
|
||||
gv.MouseWheel += WinFormsUtil.MouseWheelIncrement1;
|
||||
}
|
||||
|
||||
public Color EVsInvalid { get; set; } = Color.Red;
|
||||
|
|
|
|||
|
|
@ -205,6 +205,22 @@ public static void RemoveDropCB(object? sender, KeyEventArgs e)
|
|||
((ComboBox)sender).DroppedDown = false;
|
||||
}
|
||||
|
||||
public static void MouseWheelIncrement1(object? sender, MouseEventArgs e) => Adjust(sender, e, 1);
|
||||
public static void MouseWheelIncrement4(object? sender, MouseEventArgs e) => Adjust(sender, e, 4);
|
||||
|
||||
private static void Adjust(object? sender, MouseEventArgs e, uint increment)
|
||||
{
|
||||
if (sender is not TextBoxBase tb)
|
||||
return;
|
||||
var text = tb.Text;
|
||||
var value = Util.ToUInt32(text);
|
||||
if (e.Delta > 0)
|
||||
value += increment;
|
||||
else if (value >= increment)
|
||||
value -= increment;
|
||||
tb.Text = value.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Iterates the Control's child controls recursively to obtain all controls of the specified type.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user