Merge branch 'video_panning_option' into feature

This commit is contained in:
arch1t3cht 2022-08-01 21:56:24 +02:00
commit 84d90ce80b
4 changed files with 16 additions and 5 deletions

View file

@ -590,6 +590,8 @@
},
"Video" : {
"Disable Scroll Zoom" : false,
"Reverse Zoom" : false,
"Default Zoom" : 7,
"Detached" : {
"Enabled" : false,
@ -619,6 +621,6 @@
},
"Subtitle Sync" : true,
"Video Pan": false,
"Default to UI Zoom": false
"Default to Video Zoom": false
}
}

View file

@ -589,6 +589,8 @@
},
"Video" : {
"Disable Scroll Zoom" : false,
"Reverse Zoom" : false,
"Default Zoom" : 7,
"Detached" : {
"Enabled" : false,
@ -618,6 +620,6 @@
},
"Subtitle Sync" : true,
"Video Pan": false,
"Default to UI Zoom": false
"Default to Video Zoom": false
}
}

View file

@ -174,6 +174,9 @@ void Video(wxTreebook *book, Preferences *parent) {
p->CellSkip(general);
p->OptionAdd(general, _("Automatically open audio when opening video"), "Video/Open Audio");
p->CellSkip(general);
p->OptionAdd(general, _("Disable zooming with scroll bar"), "Video/Disable Scroll Zoom")
->SetToolTip("Makes the scroll bar not zoom the video. Useful when using a track pad that often scrolls accidentally.");
p->OptionAdd(general, _("Reverse zoom direction"), "Video/Reverse Zoom");
const wxString czoom_arr[24] = { "12.5%", "25%", "37.5%", "50%", "62.5%", "75%", "87.5%", "100%", "112.5%", "125%", "137.5%", "150%", "162.5%", "175%", "187.5%", "200%", "212.5%", "225%", "237.5%", "250%", "262.5%", "275%", "287.5%", "300%" };
wxArrayString choice_zoom(24, czoom_arr);
@ -446,7 +449,8 @@ void Advanced_Video(wxTreebook *book, Preferences *parent) {
p->OptionChoice(expert, _("Subtitles provider"), sp_choice, "Subtitle/Provider");
p->OptionAdd(expert, _("Video Panning"), "Video/Video Pan");
p->OptionAdd(expert, _("Default to UI Zoom"), "Video/Default to UI Zoom");
p->OptionAdd(expert, _("Default to Video Zoom"), "Video/Default to Video Zoom")
->SetToolTip("Reverses the behavior of Ctrl while scrolling the video display. If not set, scrolling will default to UI zoom and Ctrl+scrolling will zoom the video. If set, this will be reversed.");
#ifdef WITH_AVISYNTH

View file

@ -409,8 +409,11 @@ void VideoDisplay::OnMouseLeave(wxMouseEvent& event) {
void VideoDisplay::OnMouseWheel(wxMouseEvent& event) {
bool videoPan = OPT_GET("Video/Video Pan")->GetBool();
if (int wheel = event.GetWheelRotation()) {
if (ForwardMouseWheelEvent(this, event)) {
if (!videoPan || (event.ControlDown() != OPT_GET("Video/Default to UI Zoom")->GetBool())) {
if (ForwardMouseWheelEvent(this, event) && !OPT_GET("Video/Disable Scroll Zoom")->GetBool()) {
if (OPT_GET("Video/Reverse Zoom")->GetBool()) {
wheel = -wheel;
}
if (!videoPan || (event.ControlDown() == OPT_GET("Video/Default to Video Zoom")->GetBool())) {
SetWindowZoom(windowZoomValue + .125 * (wheel / event.GetWheelDelta()));
} else {
SetVideoZoom(wheel / event.GetWheelDelta());