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

Add Video Panning Option #150

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion src/libresrc/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@
"Fast Jump Step" : 10,
"Show Keyframes" : true
},
"Subtitle Sync" : true
"Subtitle Sync" : true,
"Video Pan": false
}
}
1 change: 1 addition & 0 deletions src/libresrc/default_menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,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
3 changes: 3 additions & 0 deletions src/preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,9 @@ void Advanced_Video(wxTreebook *book, Preferences *parent) {

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

p->OptionAdd(expert, _("Video Panning"), "Video/Video Pan");


#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 @@ -220,7 +220,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