Add menu item for resetting the video pan

This commit is contained in:
moex3 2020-11-23 20:21:02 +01:00 committed by Sodra
parent e3949cdaa1
commit f3d796a3e3
4 changed files with 21 additions and 0 deletions

View File

@ -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 { struct video_play final : public validator_video_loaded {
CMD_NAME("video/play") CMD_NAME("video/play")
CMD_ICON(button_play) CMD_ICON(button_play)
@ -767,6 +778,7 @@ namespace cmd {
reg(agi::make_unique<video_open>()); reg(agi::make_unique<video_open>());
reg(agi::make_unique<video_open_dummy>()); reg(agi::make_unique<video_open_dummy>());
reg(agi::make_unique<video_opt_autoscroll>()); 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>());
reg(agi::make_unique<video_play_line>()); reg(agi::make_unique<video_play_line>());
reg(agi::make_unique<video_show_overscan>()); reg(agi::make_unique<video_show_overscan>());

View File

@ -156,6 +156,7 @@
{ "submenu" : "main/video/set zoom", "text" : "Set &Zoom" }, { "submenu" : "main/video/set zoom", "text" : "Set &Zoom" },
{ "submenu" : "main/video/override ar", "text" : "Override &AR" }, { "submenu" : "main/video/override ar", "text" : "Override &AR" },
{ "command" : "video/show_overscan" }, { "command" : "video/show_overscan" },
{ "command" : "video/pan_reset" },
{}, {},
{ "command" : "video/jump" }, { "command" : "video/jump" },
{ "command" : "video/jump/start" }, { "command" : "video/jump/start" },

View File

@ -398,6 +398,11 @@ void VideoDisplay::OnKeyDown(wxKeyEvent &event) {
hotkey::check("Video", con, event); hotkey::check("Video", con, event);
} }
void VideoDisplay::ResetPan() {
pan_x = pan_y = 0;
PositionVideo();
}
void VideoDisplay::SetZoom(double value) { void VideoDisplay::SetZoom(double value) {
if (value == 0) return; if (value == 0) return;
zoomValue = std::max(value, .125); zoomValue = std::max(value, .125);

View File

@ -169,6 +169,9 @@ public:
/// @brief Get the current zoom level /// @brief Get the current zoom level
double GetZoom() const { return zoomValue; } double GetZoom() const { return zoomValue; }
/// @brief Reset the video pan
void ResetPan();
/// Get the last seen position of the mouse in script coordinates /// Get the last seen position of the mouse in script coordinates
Vector2D GetMousePosition() const; Vector2D GetMousePosition() const;