mirror of https://github.com/odrling/Aegisub
Fixed drag and dropping of timecode files
Originally committed to SVN as r134.
This commit is contained in:
parent
81efd4082f
commit
9f361dca17
|
@ -303,6 +303,11 @@ void AssFile::LoadTXT (wxString _filename,wxString encoding) {
|
||||||
// Reads line
|
// Reads line
|
||||||
wxString value = file.ReadLineFromFile();
|
wxString value = file.ReadLineFromFile();
|
||||||
|
|
||||||
|
// Check if this isn't a timecodes file
|
||||||
|
if (value.Left(10) == _T("# timecode")) {
|
||||||
|
throw _T("File is a timecode file, cannot load as subtitles.");
|
||||||
|
}
|
||||||
|
|
||||||
// Read comment data
|
// Read comment data
|
||||||
isComment = false;
|
isComment = false;
|
||||||
if (comment != _T("") && value.Left(comment.Length()) == comment) {
|
if (comment != _T("") && value.Left(comment.Length()) == comment) {
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
#include "drop.h"
|
#include "drop.h"
|
||||||
#include "hotkeys.h"
|
#include "hotkeys.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "text_file_reader.h"
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
|
@ -489,6 +490,16 @@ void FrameMain::LoadSubtitles (wxString filename,wxString charset) {
|
||||||
if (isFile) {
|
if (isFile) {
|
||||||
wxFileName fileCheck(filename);
|
wxFileName fileCheck(filename);
|
||||||
if (!fileCheck.FileExists()) throw _T("File does not exist.");
|
if (!fileCheck.FileExists()) throw _T("File does not exist.");
|
||||||
|
|
||||||
|
// Make sure that file isn't actually a timecode file
|
||||||
|
TextFileReader testSubs(filename);
|
||||||
|
if (testSubs.HasMoreLines()) {
|
||||||
|
wxString cur = testSubs.ReadLineFromFile();
|
||||||
|
if (cur.Left(10) == _T("# timecode")) {
|
||||||
|
LoadVFR(filename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Proceed into loading
|
// Proceed into loading
|
||||||
|
|
Loading…
Reference in New Issue