Skip to content
This repository has been archived by the owner on May 12, 2024. It is now read-only.

Commit

Permalink
Added Zoom Reset for video itself.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ristellise committed Jun 6, 2021
1 parent 5558d04 commit 7b6df2c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/command/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ namespace {
}
};



struct video_reload_subtitles_provider final : public cmd::Command {
CMD_NAME("video/subtitles_provider/reload")
STR_MENU("Reload active subtitles provider")
Expand Down Expand Up @@ -672,6 +674,18 @@ struct video_reload_subtitles_provider final : public cmd::Command {
}
};

struct video_zoom_reset final : public validator_video_attached {
CMD_NAME("video/zoom_video/reset")
STR_MENU("Reset video render zoom")
STR_DISP("Reset video render zoom")
STR_HELP("Reset the video render zoom to the original value")
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)

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

class video_zoom_100 : public validator_video_attached {
public:
CMD_NAME("video/zoom/100")
Expand Down Expand Up @@ -806,5 +820,6 @@ namespace cmd {
reg(agi::make_unique<video_zoom_50>());
reg(agi::make_unique<video_zoom_in>());
reg(agi::make_unique<video_zoom_out>());
reg(agi::make_unique<video_zoom_reset>());
}
}
6 changes: 6 additions & 0 deletions src/video_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,12 @@ VideoDisplay::VideoDisplay(wxToolBar* toolbar, bool freeSize, wxComboBox* zoomBo
UpdateSize();
}

void VideoDisplay::SetRawVideoZoom(double value)
{
videoZoomValue = value;
UpdateSize();
}

void VideoDisplay::SetVideoZoom(int step) {
if (step == 0) return;
double newVideoZoom = videoZoomValue + (.125 * step) * videoZoomValue;
Expand Down
1 change: 1 addition & 0 deletions src/video_display.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ class VideoDisplay final : public wxGLCanvas {
/// @param value The new zoom level
void SetWindowZoom(double value);
void SetVideoZoom(int step);
void SetRawVideoZoom(double value);
/// @brief Get the current zoom level
double GetZoom() const { return windowZoomValue; }

Expand Down

0 comments on commit 7b6df2c

Please sign in to comment.