mainform: volume: Add hotkey
Adds using shift+up and shift+down to raise and lower the current song volume, respectively.
This commit is contained in:
@@ -1823,6 +1823,29 @@ namespace BAKKA_Editor
|
||||
circlePanel.Invalidate();
|
||||
}
|
||||
}
|
||||
private void playbackVolumeChange(bool increase)
|
||||
{
|
||||
int val = trackBarVolume.LargeChange;
|
||||
/* Bounds check. */
|
||||
if (increase && (trackBarVolume.Value + val > trackBarVolume.Maximum))
|
||||
{
|
||||
val = trackBarVolume.Maximum - trackBarVolume.Value;
|
||||
}
|
||||
else if (!increase && (trackBarVolume.Value - val<trackBarVolume.Minimum))
|
||||
{
|
||||
val = trackBarVolume.Value - trackBarVolume.Minimum;
|
||||
}
|
||||
if (!increase)
|
||||
{
|
||||
val *= -1;
|
||||
}
|
||||
/*
|
||||
* Updating the trackbar volume will call the trackBarVolume_Changed
|
||||
* callback, which will update the current song volume.
|
||||
*/
|
||||
trackBarVolume.Value += val;
|
||||
trackBarVolume.Focus();
|
||||
}
|
||||
|
||||
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
||||
{
|
||||
@@ -1867,6 +1890,12 @@ namespace BAKKA_Editor
|
||||
playButton_Click(sender, e);
|
||||
playButton.Focus();
|
||||
return true;
|
||||
case Keys.Up | Keys.Shift:
|
||||
/* Fallthrough */
|
||||
case Keys.Down | Keys.Shift:
|
||||
keyData &= ~Keys.Shift;
|
||||
playbackVolumeChange(keyData == Keys.Up);
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user