mirror of
https://github.com/odrling/Aegisub
synced 2025-04-11 22:56:02 +02:00
Allow vertical audio zoom with Shift+Mouse Wheel
This commit is contained in:
parent
bfcd8a3e2c
commit
2234068202
@ -129,7 +129,7 @@ END_EVENT_TABLE()
|
||||
void AudioBox::OnMouseWheel(wxMouseEvent &evt) {
|
||||
if (!ForwardMouseWheelEvent(audioDisplay, evt))
|
||||
return;
|
||||
bool zoom = evt.CmdDown() != OPT_GET("Audio/Wheel Default to Zoom")->GetBool();
|
||||
bool zoom = evt.CmdDown() != OPT_GET("Audio/Wheel Default to Zoom")->GetBool() || evt.ShiftDown();
|
||||
if (!zoom) {
|
||||
int amount = -evt.GetWheelRotation();
|
||||
// If the user did a horizontal scroll the amount should be inverted
|
||||
@ -145,7 +145,11 @@ void AudioBox::OnMouseWheel(wxMouseEvent &evt) {
|
||||
mouse_zoom_accum += evt.GetWheelRotation();
|
||||
int zoom_delta = mouse_zoom_accum / evt.GetWheelDelta();
|
||||
mouse_zoom_accum %= evt.GetWheelDelta();
|
||||
SetHorizontalZoom(audioDisplay->GetZoomLevel() + zoom_delta);
|
||||
if (evt.ShiftDown()) {
|
||||
SetVerticalZoom(OPT_GET("Audio/Zoom/Vertical")->GetInt() + 3 * zoom_delta);
|
||||
} else {
|
||||
SetHorizontalZoom(audioDisplay->GetZoomLevel() + zoom_delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -179,10 +183,15 @@ void AudioBox::SetHorizontalZoom(int new_zoom) {
|
||||
}
|
||||
|
||||
void AudioBox::OnVerticalZoom(wxScrollEvent &event) {
|
||||
int pos = mid(1, event.GetPosition(), 100);
|
||||
SetVerticalZoom(event.GetPosition());
|
||||
}
|
||||
|
||||
void AudioBox::SetVerticalZoom(int new_zoom) {
|
||||
int pos = mid(1, new_zoom, 100);
|
||||
OPT_SET("Audio/Zoom/Vertical")->SetInt(pos);
|
||||
double value = pow(pos / 50.0, 3);
|
||||
audioDisplay->SetAmplitudeScale(value);
|
||||
VerticalZoom->SetValue(pos);
|
||||
if (!VolumeBar->IsEnabled()) {
|
||||
VolumeBar->SetValue(pos);
|
||||
controller->SetVolume(value);
|
||||
|
@ -73,6 +73,7 @@ class AudioBox final : public wxSashWindow {
|
||||
int mouse_zoom_accum = 0;
|
||||
|
||||
void SetHorizontalZoom(int new_zoom);
|
||||
void SetVerticalZoom(int new_zoom);
|
||||
void OnAudioOpen();
|
||||
void OnHorizontalZoom(wxScrollEvent &event);
|
||||
void OnMouseWheel(wxMouseEvent &evt);
|
||||
|
Loading…
x
Reference in New Issue
Block a user