mirror of https://github.com/odrling/Aegisub
Also remove timecodes and keyframes from the MRU lists when they cannot be found. Updates #717.
Originally committed to SVN as r4721.
This commit is contained in:
parent
596ad4d65d
commit
ce97d995b4
|
@ -48,7 +48,6 @@
|
|||
#include "video_context.h"
|
||||
|
||||
std::vector<int> KeyFrameFile::Load(wxString filename) {
|
||||
try {
|
||||
std::vector<int> keyFrames;
|
||||
TextFileReader file(filename,_T("ASCII"));
|
||||
|
||||
|
@ -63,15 +62,6 @@ std::vector<int> KeyFrameFile::Load(wxString filename) {
|
|||
config::mru->Add("Keyframes", STD_STR(filename));
|
||||
return keyFrames;
|
||||
}
|
||||
// Fail
|
||||
catch (const wchar_t *error) {
|
||||
wxMessageBox(error, _T("Error opening keyframes file"), wxOK | wxICON_ERROR, NULL);
|
||||
}
|
||||
catch (...) {
|
||||
wxMessageBox(_T("Unknown error"), _T("Error opening keyframes file"), wxOK | wxICON_ERROR, NULL);
|
||||
}
|
||||
return std::vector<int>();
|
||||
}
|
||||
|
||||
void KeyFrameFile::Save(wxString filename, std::vector<int> const& keyFrames) {
|
||||
TextFileWriter file(filename,_T("ASCII"));
|
||||
|
|
|
@ -471,10 +471,22 @@ void VideoContext::SetAspectRatio(int type, double value) {
|
|||
|
||||
void VideoContext::LoadKeyframes(wxString filename) {
|
||||
if (filename == keyFramesFilename || filename.empty()) return;
|
||||
try {
|
||||
keyFrames = KeyFrameFile::Load(filename);
|
||||
keyFramesFilename = filename;
|
||||
Refresh();
|
||||
}
|
||||
catch (const wchar_t *error) {
|
||||
wxMessageBox(error, _T("Error opening keyframes file"), wxOK | wxICON_ERROR, NULL);
|
||||
}
|
||||
catch (agi::acs::AcsNotFound const&) {
|
||||
wxLogError(L"Could not open file " + filename);
|
||||
config::mru->Remove("Keyframes", STD_STR(filename));
|
||||
}
|
||||
catch (...) {
|
||||
wxMessageBox(_T("Unknown error"), _T("Error opening keyframes file"), wxOK | wxICON_ERROR, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void VideoContext::SaveKeyframes(wxString filename) {
|
||||
KeyFrameFile::Save(filename, GetKeyFrames());
|
||||
|
@ -501,6 +513,7 @@ void VideoContext::LoadTimecodes(wxString filename) {
|
|||
}
|
||||
catch (const agi::acs::AcsError&) {
|
||||
wxLogError(L"Could not open file " + filename);
|
||||
config::mru->Remove("Timecodes", STD_STR(filename));
|
||||
}
|
||||
catch (const agi::vfr::Error& e) {
|
||||
wxLogError(L"Timecode file parse error: %s", e.GetMessage().c_str());
|
||||
|
|
Loading…
Reference in New Issue