Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video panning #3

Open
wants to merge 25 commits into
base: mod
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6285e4e
Add video panning
moex3 Nov 23, 2020
4b59099
Add menu item for resetting the video pan
moex3 Nov 23, 2020
51dafe2
Change tab to spaces
moex3 Nov 23, 2020
d78dace
Fix mouse position bug when videoAr > displayAr
moex3 Nov 25, 2020
bb65a63
Fix crosshair drawing
moex3 Nov 25, 2020
41d8819
Change pan values with the zoom level changes
moex3 Nov 25, 2020
da7154b
Respect min. zoom value when changing pan coords
moex3 Nov 25, 2020
b385aa0
Make video zoom different from preview window zoom
moex3 Apr 20, 2021
b953c92
Make zooming center around the cursor position
moex3 Apr 20, 2021
1c3c9e3
Make zooming feel more linear
moex3 Apr 20, 2021
57883bf
Fix a zooming bug on linux
moex3 Apr 20, 2021
b2dd7fe
Add reset hotkey as Ctrl-R
moex3 Jul 16, 2021
e8a19fd
Revert "Add reset hotkey as Ctrl-R" / Not needed
moex3 Mar 2, 2022
66e0a1d
Added option to enable video panning
Sodra Mar 3, 2022
7bdad68
Fix video panning option. Oops teehee ptep~
Sodra Mar 3, 2022
3308161
Fixing zoom when panning is off
Sodra Mar 3, 2022
527b838
Also add Video Pan option on OSX
arch1t3cht Jul 10, 2022
6287089
Add option toggling behaviour of Ctrl+Zoom
arch1t3cht Jul 11, 2022
935d546
Add options to commit or reverse video zoom
arch1t3cht Aug 1, 2022
d673f0a
video zoom: Fix aspect ratio forcing
arch1t3cht Aug 23, 2022
c85e5d2
video zoom: Fix visual tools with DPI scaling
arch1t3cht Oct 11, 2022
7eb7eb7
video zoom: Fix detached video with DPI scaling
arch1t3cht Oct 11, 2022
7ab5bf0
video zoom: Fix crash on windows when making detached video too small
arch1t3cht Nov 2, 2022
1593b9d
Remove "Video Panning" option
arch1t3cht Nov 17, 2022
0d6fc11
video zoom: Fix zoom when script_res != video_res
arch1t3cht Jan 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions src/command/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,17 @@ struct video_opt_autoscroll final : public Command {
}
};

struct video_pan_reset final : public validator_video_loaded {
CMD_NAME("video/pan_reset")
STR_MENU("Reset video pan")
STR_DISP("Reset video pan")
STR_HELP("Reset the video pan to the original value")

void operator()(agi::Context *c) override {
c->videoDisplay->ResetPan();
}
};

struct video_play final : public validator_video_loaded {
CMD_NAME("video/play")
CMD_ICON(button_play)
Expand Down Expand Up @@ -658,7 +669,7 @@ class video_zoom_100: public validator_video_attached {

void operator()(agi::Context *c) override {
c->videoController->Stop();
c->videoDisplay->SetZoom(1.);
c->videoDisplay->SetWindowZoom(1.);
}
};

Expand Down Expand Up @@ -689,7 +700,7 @@ class video_zoom_200: public validator_video_attached {

void operator()(agi::Context *c) override {
c->videoController->Stop();
c->videoDisplay->SetZoom(2.);
c->videoDisplay->SetWindowZoom(2.);
}
};

Expand All @@ -707,7 +718,7 @@ class video_zoom_50: public validator_video_attached {

void operator()(agi::Context *c) override {
c->videoController->Stop();
c->videoDisplay->SetZoom(.5);
c->videoDisplay->SetWindowZoom(.5);
}
};

Expand All @@ -719,7 +730,7 @@ struct video_zoom_in final : public validator_video_attached {
STR_HELP("Zoom video in")

void operator()(agi::Context *c) override {
c->videoDisplay->SetZoom(c->videoDisplay->GetZoom() + .125);
c->videoDisplay->SetWindowZoom(c->videoDisplay->GetZoom() + .125);
}
};

Expand All @@ -731,7 +742,7 @@ struct video_zoom_out final : public validator_video_attached {
STR_HELP("Zoom video out")

void operator()(agi::Context *c) override {
c->videoDisplay->SetZoom(c->videoDisplay->GetZoom() - .125);
c->videoDisplay->SetWindowZoom(c->videoDisplay->GetZoom() - .125);
}
};
}
Expand Down Expand Up @@ -767,6 +778,7 @@ namespace cmd {
reg(agi::make_unique<video_open>());
reg(agi::make_unique<video_open_dummy>());
reg(agi::make_unique<video_opt_autoscroll>());
reg(agi::make_unique<video_pan_reset>());
reg(agi::make_unique<video_play>());
reg(agi::make_unique<video_play_line>());
reg(agi::make_unique<video_show_overscan>());
Expand Down
4 changes: 2 additions & 2 deletions src/frame_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ void FrameMain::OnVideoOpen(AsyncVideoProvider *provider) {
double zoom = context->videoDisplay->GetZoom();
wxSize windowSize = GetSize();
if (vidx*3*zoom > windowSize.GetX()*4 || vidy*4*zoom > windowSize.GetY()*6)
context->videoDisplay->SetZoom(zoom * .25);
context->videoDisplay->SetWindowZoom(zoom * .25);
else if (vidx*3*zoom > windowSize.GetX()*2 || vidy*4*zoom > windowSize.GetY()*3)
context->videoDisplay->SetZoom(zoom * .5);
context->videoDisplay->SetWindowZoom(zoom * .5);

SetDisplayMode(1,-1);

Expand Down
5 changes: 4 additions & 1 deletion src/libresrc/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,8 @@
},

"Video" : {
"Disable Scroll Zoom" : false,
"Reverse Zoom" : false,
"Default Zoom" : 7,
"Detached" : {
"Enabled" : false,
Expand Down Expand Up @@ -619,6 +621,7 @@
"Fast Jump Step" : 10,
"Show Keyframes" : true
},
"Subtitle Sync" : true
"Subtitle Sync" : true,
"Default to Video Zoom": false
}
}
1 change: 1 addition & 0 deletions src/libresrc/default_menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
{ "submenu" : "main/video/set zoom", "text" : "Set &Zoom" },
{ "submenu" : "main/video/override ar", "text" : "Override &AR" },
{ "command" : "video/show_overscan" },
{ "command" : "video/pan_reset" },
{},
{ "command" : "video/jump" },
{ "command" : "video/jump/start" },
Expand Down
5 changes: 4 additions & 1 deletion src/libresrc/osx/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,8 @@
},

"Video" : {
"Disable Scroll Zoom" : false,
"Reverse Zoom" : false,
"Default Zoom" : 7,
"Detached" : {
"Enabled" : false,
Expand Down Expand Up @@ -619,6 +621,7 @@
"Fast Jump Step" : 10,
"Show Keyframes" : true
},
"Subtitle Sync" : true
"Subtitle Sync" : true,
"Default to Video Zoom": false
}
}
7 changes: 6 additions & 1 deletion src/preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ void Video(wxTreebook *book, Preferences *parent) {
p->OptionAdd(general, _("Seek video to line start on selection change"), "Video/Subtitle Sync");
p->CellSkip(general);
p->OptionAdd(general, _("Automatically open audio when opening video"), "Video/Open Audio");
p->CellSkip(general);
p->OptionAdd(general, _("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.");
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);
Expand Down Expand Up @@ -455,6 +459,7 @@ void Advanced_Video(wxTreebook *book, Preferences *parent) {

wxArrayString sp_choice = to_wx(SubtitlesProviderFactory::GetClasses());
p->OptionChoice(expert, _("Subtitles provider"), sp_choice, "Subtitle/Provider");


#ifdef WITH_AVISYNTH
auto avisynth = p->PageSizer("Avisynth");
Expand Down
2 changes: 1 addition & 1 deletion src/project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void Project::LoadUnloadFiles(ProjectProperties properties) {
vc->SetAspectRatio(properties.ar_value);
else
vc->SetAspectRatio(ar_mode);
context->videoDisplay->SetZoom(properties.video_zoom);
context->videoDisplay->SetWindowZoom(properties.video_zoom);
}
}

Expand Down
Loading