diff --git a/aegisub/src/export_framerate.cpp b/aegisub/src/export_framerate.cpp index 9a7226c0c..7024f6523 100644 --- a/aegisub/src/export_framerate.cpp +++ b/aegisub/src/export_framerate.cpp @@ -55,11 +55,6 @@ #include "utils.h" #include "video_context.h" -/// IDs -enum { - Get_Input_From_Video = 2000 -}; - 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) , Input(0) @@ -79,9 +74,11 @@ wxWindow *AssTransformFramerateFilter::GetConfigDialogWindow(wxWindow *parent) { // Input sizer wxSizer *InputSizer = new wxBoxSizer(wxHORIZONTAL); wxString initialInput; - wxButton *FromVideo = new wxButton(base,Get_Input_From_Video,_("From Video")); - if (Input->IsLoaded()) + wxButton *FromVideo = new wxButton(base,-1,_("From Video")); + if (Input->IsLoaded()) { initialInput = wxString::Format("%2.3f",Input->FPS()); + FromVideo->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &AssTransformFramerateFilter::OnFpsFromVideo, this); + } else { initialInput = "23.976"; FromVideo->Enable(false); @@ -132,6 +129,10 @@ wxWindow *AssTransformFramerateFilter::GetConfigDialogWindow(wxWindow *parent) { return base; } +void AssTransformFramerateFilter::OnFpsFromVideo(wxCommandEvent &) { + InputFramerate->SetValue(wxString::Format("%g", VideoContext::Get()->FPS().FPS())); +} + void AssTransformFramerateFilter::LoadSettings(bool IsDefault) { if (IsDefault) { Input = &VideoContext::Get()->VFR_Input; diff --git a/aegisub/src/export_framerate.h b/aegisub/src/export_framerate.h index 144e1714a..3b81ca9fd 100644 --- a/aegisub/src/export_framerate.h +++ b/aegisub/src/export_framerate.h @@ -85,6 +85,9 @@ class AssTransformFramerateFilter : public AssExportFilter { /// 2. The relative distance between the beginning of the frame which time /// is in and the beginning of the next frame int ConvertTime(int time); + + /// From Video click handler + void OnFpsFromVideo(wxCommandEvent &); public: /// Constructor AssTransformFramerateFilter();