Make the "From Video" button in the framerate transform configuration actually do something

Originally committed to SVN as r5261.
This commit is contained in:
Thomas Goyne 2011-01-21 06:09:28 +00:00
parent b851e50092
commit 41f9426634
2 changed files with 11 additions and 7 deletions

View File

@ -55,11 +55,6 @@
#include "utils.h" #include "utils.h"
#include "video_context.h" #include "video_context.h"
/// IDs
enum {
Get_Input_From_Video = 2000
};
AssTransformFramerateFilter::AssTransformFramerateFilter() AssTransformFramerateFilter::AssTransformFramerateFilter()
: AssExportFilter(_("Transform Framerate"), _("Transform subtitle times, including those in override tags, from an input framerate to an output framerate.\n\nThis is useful for converting regular time subtitles to VFRaC time subtitles for hardsubbing.\nIt can also be used to convert subtitles to a different speed video, such as NTSC to PAL speedup."), 1000) : AssExportFilter(_("Transform Framerate"), _("Transform subtitle times, including those in override tags, from an input framerate to an output framerate.\n\nThis is useful for converting regular time subtitles to VFRaC time subtitles for hardsubbing.\nIt can also be used to convert subtitles to a different speed video, such as NTSC to PAL speedup."), 1000)
, Input(0) , Input(0)
@ -79,9 +74,11 @@ wxWindow *AssTransformFramerateFilter::GetConfigDialogWindow(wxWindow *parent) {
// Input sizer // Input sizer
wxSizer *InputSizer = new wxBoxSizer(wxHORIZONTAL); wxSizer *InputSizer = new wxBoxSizer(wxHORIZONTAL);
wxString initialInput; wxString initialInput;
wxButton *FromVideo = new wxButton(base,Get_Input_From_Video,_("From Video")); wxButton *FromVideo = new wxButton(base,-1,_("From Video"));
if (Input->IsLoaded()) if (Input->IsLoaded()) {
initialInput = wxString::Format("%2.3f",Input->FPS()); initialInput = wxString::Format("%2.3f",Input->FPS());
FromVideo->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &AssTransformFramerateFilter::OnFpsFromVideo, this);
}
else { else {
initialInput = "23.976"; initialInput = "23.976";
FromVideo->Enable(false); FromVideo->Enable(false);
@ -132,6 +129,10 @@ wxWindow *AssTransformFramerateFilter::GetConfigDialogWindow(wxWindow *parent) {
return base; return base;
} }
void AssTransformFramerateFilter::OnFpsFromVideo(wxCommandEvent &) {
InputFramerate->SetValue(wxString::Format("%g", VideoContext::Get()->FPS().FPS()));
}
void AssTransformFramerateFilter::LoadSettings(bool IsDefault) { void AssTransformFramerateFilter::LoadSettings(bool IsDefault) {
if (IsDefault) { if (IsDefault) {
Input = &VideoContext::Get()->VFR_Input; Input = &VideoContext::Get()->VFR_Input;

View File

@ -85,6 +85,9 @@ class AssTransformFramerateFilter : public AssExportFilter {
/// 2. The relative distance between the beginning of the frame which time /// 2. The relative distance between the beginning of the frame which time
/// is in and the beginning of the next frame /// is in and the beginning of the next frame
int ConvertTime(int time); int ConvertTime(int time);
/// From Video click handler
void OnFpsFromVideo(wxCommandEvent &);
public: public:
/// Constructor /// Constructor
AssTransformFramerateFilter(); AssTransformFramerateFilter();