forked from mia/Aegisub
As we require RTTI anyway, kill AssEntry::GetAsDialogue/Style/Attachment and just use dynamic_cast
Originally committed to SVN as r4308.
This commit is contained in:
parent
2124a1dbd3
commit
008d59d71e
24 changed files with 54 additions and 93 deletions
|
@ -63,42 +63,6 @@ AssEntry::AssEntry(wxString _data) {
|
|||
AssEntry::~AssEntry() {
|
||||
}
|
||||
|
||||
/// @brief Returns an entry as dialogue if possible, else, returns NULL
|
||||
/// @param base
|
||||
/// @return
|
||||
///
|
||||
AssDialogue *AssEntry::GetAsDialogue(AssEntry *base) {
|
||||
if (!base) return NULL;
|
||||
if (base->GetType() == ENTRY_DIALOGUE) {
|
||||
return static_cast<AssDialogue*> (base);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/// @brief Returns an entry as style if possible, else, returns NULL
|
||||
/// @param base
|
||||
/// @return
|
||||
///
|
||||
AssStyle *AssEntry::GetAsStyle(AssEntry *base) {
|
||||
if (!base) return NULL;
|
||||
if (base->GetType() == ENTRY_STYLE) {
|
||||
return static_cast<AssStyle*> (base);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/// @brief Returns an entry as attachment if possible, else, returns NULL
|
||||
/// @param base
|
||||
/// @return
|
||||
///
|
||||
AssAttachment *AssEntry::GetAsAttachment(AssEntry *base) {
|
||||
if (!base) return NULL;
|
||||
if (base->GetType() == ENTRY_ATTACHMENT) {
|
||||
return static_cast<AssAttachment*> (base);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/// @brief Get SSA conversion
|
||||
/// @return
|
||||
///
|
||||
|
|
|
@ -139,7 +139,4 @@ public:
|
|||
virtual void SetEntryData(wxString newData) { if (newData.IsEmpty()) data.Clear(); else data = newData; }
|
||||
|
||||
virtual wxString GetSSAText();
|
||||
static AssDialogue *GetAsDialogue(AssEntry *base); // Returns an entry base as a dialogue if it is valid, null otherwise
|
||||
static AssStyle *GetAsStyle(AssEntry *base); // Returns an entry base as a style if it is valid, null otherwise
|
||||
static AssAttachment *GetAsAttachment(AssEntry *base);// Returns an entry base as an attachment if it is valid, null otherwise
|
||||
};
|
||||
|
|
|
@ -256,17 +256,17 @@ bool AssFile::CanSave() {
|
|||
AssAttachment *attach;
|
||||
for (entryIter cur=Line.begin();cur!=Line.end();cur++) {
|
||||
// Check style, if anything non-default is found, return false
|
||||
curstyle = AssEntry::GetAsStyle(*cur);
|
||||
curstyle = dynamic_cast<AssStyle*>(*cur);
|
||||
if (curstyle) {
|
||||
if (curstyle->GetEntryData() != defstyle.GetEntryData()) return false;
|
||||
}
|
||||
|
||||
// Check for attachments, if any is found, return false
|
||||
attach = AssEntry::GetAsAttachment(*cur);
|
||||
attach = dynamic_cast<AssAttachment*>(*cur);
|
||||
if (attach) return false;
|
||||
|
||||
// Check dialog
|
||||
curdiag = AssEntry::GetAsDialogue(*cur);
|
||||
curdiag = dynamic_cast<AssDialogue*>(*cur);
|
||||
if (curdiag) {
|
||||
// Timed?
|
||||
if (!canTime && (curdiag->Start.GetMS() != 0 || curdiag->End.GetMS() != 0)) return false;
|
||||
|
@ -542,7 +542,7 @@ void AssFile::InsertAttachment (AssAttachment *attach) {
|
|||
std::list<AssEntry*>::iterator insPoint=Line.end(),cur;
|
||||
for (cur=Line.begin();cur!=Line.end();cur++) {
|
||||
// Check if it's another attachment
|
||||
AssAttachment *att = AssEntry::GetAsAttachment(*cur);
|
||||
AssAttachment *att = dynamic_cast<AssAttachment*>(*cur);
|
||||
if (att) {
|
||||
if (attach->group == att->group) insPoint = cur;
|
||||
}
|
||||
|
@ -771,7 +771,7 @@ wxArrayString AssFile::GetStyles() {
|
|||
wxArrayString styles;
|
||||
AssStyle *curstyle;
|
||||
for (entryIter cur=Line.begin();cur!=Line.end();cur++) {
|
||||
curstyle = AssEntry::GetAsStyle(*cur);
|
||||
curstyle = dynamic_cast<AssStyle*>(*cur);
|
||||
if (curstyle) {
|
||||
styles.Add(curstyle->name);
|
||||
}
|
||||
|
@ -785,7 +785,7 @@ wxArrayString AssFile::GetStyles() {
|
|||
AssStyle *AssFile::GetStyle(wxString name) {
|
||||
AssStyle *curstyle;
|
||||
for (entryIter cur=Line.begin();cur!=Line.end();cur++) {
|
||||
curstyle = AssEntry::GetAsStyle(*cur);
|
||||
curstyle = dynamic_cast<AssStyle*>(*cur);
|
||||
if (curstyle) {
|
||||
if (curstyle->name == name) return curstyle;
|
||||
}
|
||||
|
@ -814,7 +814,7 @@ wxString AssFile::GetWildcardList(int mode) {
|
|||
void AssFile::CompressForStack(bool compress) {
|
||||
AssDialogue *diag;
|
||||
for (entryIter cur=Line.begin();cur!=Line.end();cur++) {
|
||||
diag = AssEntry::GetAsDialogue(*cur);
|
||||
diag = dynamic_cast<AssDialogue*>(*cur);
|
||||
if (diag) {
|
||||
if (compress) {
|
||||
diag->SetEntryData(_T(""));
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace Automation4 {
|
|||
lua_pushstring(L, "format");
|
||||
|
||||
} else if (e->GetType() == ENTRY_DIALOGUE) {
|
||||
AssDialogue *dia = e->GetAsDialogue(e);
|
||||
AssDialogue *dia = static_cast<AssDialogue*>(e);
|
||||
|
||||
lua_pushboolean(L, (int)dia->Comment);
|
||||
lua_setfield(L, -2, "comment");
|
||||
|
@ -172,7 +172,7 @@ namespace Automation4 {
|
|||
lua_pushstring(L, "dialogue");
|
||||
|
||||
} else if (e->GetType() == ENTRY_STYLE) {
|
||||
AssStyle *sty = e->GetAsStyle(e);
|
||||
AssStyle *sty = static_cast<AssStyle*>(e);
|
||||
|
||||
lua_pushstring(L, sty->name.mb_str(wxConvUTF8));
|
||||
lua_setfield(L, -2, "name");
|
||||
|
@ -858,14 +858,14 @@ namespace Automation4 {
|
|||
int LuaAssFile::LuaParseKaraokeData(lua_State *L)
|
||||
{
|
||||
AssEntry *e = LuaToAssEntry(L);
|
||||
if (e->GetType() != ENTRY_DIALOGUE) {
|
||||
AssDialogue *dia = dynamic_cast<AssDialogue*>(e);
|
||||
if (!dia) {
|
||||
delete e;
|
||||
lua_pushstring(L, "Attempt to create karaoke table from non-dialogue subtitle line");
|
||||
lua_error(L);
|
||||
return 0;
|
||||
}
|
||||
|
||||
AssDialogue *dia = e->GetAsDialogue(e);
|
||||
dia->ParseASSTags();
|
||||
|
||||
int kcount = 0;
|
||||
|
|
|
@ -929,7 +929,7 @@ void BaseGrid::SetColumnWidths() {
|
|||
if (false && AssFile::top) {
|
||||
AssStyle *curStyle;
|
||||
for (entryIter curIter=AssFile::top->Line.begin();curIter!=AssFile::top->Line.end();curIter++) {
|
||||
curStyle = AssEntry::GetAsStyle(*curIter);
|
||||
curStyle = dynamic_cast<AssStyle*>(*curIter);
|
||||
if (curStyle) {
|
||||
dc.GetTextExtent(curStyle->name, &fw, &fh, NULL, NULL, &font);
|
||||
if (fw > styleLen) styleLen = fw;
|
||||
|
@ -975,7 +975,7 @@ AssDialogue *BaseGrid::GetDialogue(int n) {
|
|||
if ((size_t)n >= diagMap.size()) return NULL;
|
||||
AssEntry *e = *diagMap.at(n);
|
||||
if (e->GetType() != ENTRY_DIALOGUE) return NULL;
|
||||
return AssEntry::GetAsDialogue(e);
|
||||
return dynamic_cast<AssDialogue*>(e);
|
||||
}
|
||||
catch (...) {
|
||||
return NULL;
|
||||
|
@ -1019,7 +1019,7 @@ void BaseGrid::UpdateMaps() {
|
|||
int n = 0;
|
||||
AssDialogue *curdiag;
|
||||
for (entryIter cur=AssFile::top->Line.begin();cur != AssFile::top->Line.end();cur++) {
|
||||
curdiag = AssEntry::GetAsDialogue(*cur);
|
||||
curdiag = dynamic_cast<AssDialogue*>(*cur);
|
||||
if (curdiag) {
|
||||
// Find old pos
|
||||
bool sel = false;
|
||||
|
|
|
@ -110,7 +110,7 @@ void DialogAttachments::UpdateList() {
|
|||
// Fill list
|
||||
AssAttachment *attach;
|
||||
for (std::list<AssEntry*>::iterator cur = AssFile::top->Line.begin();cur != AssFile::top->Line.end();cur++) {
|
||||
attach = AssEntry::GetAsAttachment(*cur);
|
||||
attach = dynamic_cast<AssAttachment*>(*cur);
|
||||
if (attach) {
|
||||
// Add item
|
||||
int row = listView->GetItemCount();
|
||||
|
|
|
@ -447,14 +447,14 @@ void FontsCollectorThread::Collect() {
|
|||
curLine = 0;
|
||||
for (std::list<AssEntry*>::iterator cur=subs->Line.begin();cur!=subs->Line.end();cur++) {
|
||||
// Collect from style
|
||||
curStyle = AssEntry::GetAsStyle(*cur);
|
||||
curStyle = dynamic_cast<AssStyle*>(*cur);
|
||||
if (curStyle) {
|
||||
AddFont(curStyle->font,0);
|
||||
}
|
||||
|
||||
// Collect from dialogue
|
||||
else {
|
||||
curDiag = AssEntry::GetAsDialogue(*cur);
|
||||
curDiag = dynamic_cast<AssDialogue*>(*cur);
|
||||
if (curDiag) {
|
||||
curLine++;
|
||||
curDiag->ParseASSTags();
|
||||
|
|
|
@ -459,7 +459,7 @@ void KaraokeLineMatchDisplay::SetInputData(const AssDialogue *src, const AssDial
|
|||
source_sel_length = 0;
|
||||
if (src)
|
||||
{
|
||||
AssDialogue *varsrc = AssEntry::GetAsDialogue(src->Clone());
|
||||
AssDialogue *varsrc = dynamic_cast<AssDialogue*>(src->Clone());
|
||||
varsrc->ParseASSTags();
|
||||
AssKaraokeVector kara;
|
||||
ParseAssKaraokeTags(varsrc, kara);
|
||||
|
@ -941,7 +941,7 @@ void DialogKanjiTimer::OnClose(wxCommandEvent &event) {
|
|||
while(LinesToChange.empty()==false) {
|
||||
std::pair<entryIter,wxString> p = LinesToChange.back();
|
||||
LinesToChange.pop_back();
|
||||
AssDialogue *line = AssEntry::GetAsDialogue(*p.first);
|
||||
AssDialogue *line = dynamic_cast<AssDialogue*>(*p.first);
|
||||
line->Text = p.second;
|
||||
}
|
||||
if (modified) {
|
||||
|
@ -1101,9 +1101,9 @@ void DialogKanjiTimer::ResetForNewLine()
|
|||
AssDialogue *dst = 0;
|
||||
|
||||
if (currentSourceLine != subs->Line.end())
|
||||
src = AssEntry::GetAsDialogue(*currentSourceLine);
|
||||
src = dynamic_cast<AssDialogue*>(*currentSourceLine);
|
||||
if (currentDestinationLine != subs->Line.end())
|
||||
dst = AssEntry::GetAsDialogue(*currentDestinationLine);
|
||||
dst = dynamic_cast<AssDialogue*>(*currentDestinationLine);
|
||||
|
||||
if (src == 0 || dst == 0)
|
||||
{
|
||||
|
@ -1139,7 +1139,7 @@ entryIter DialogKanjiTimer::FindNextStyleMatch(entryIter search_from, const wxSt
|
|||
|
||||
while (++search_from != subs->Line.end())
|
||||
{
|
||||
AssDialogue *dlg = AssEntry::GetAsDialogue(*search_from);
|
||||
AssDialogue *dlg = dynamic_cast<AssDialogue*>(*search_from);
|
||||
if (dlg && dlg->Style == search_style)
|
||||
break;
|
||||
}
|
||||
|
@ -1158,7 +1158,7 @@ entryIter DialogKanjiTimer::FindPrevStyleMatch(entryIter search_from, const wxSt
|
|||
|
||||
while (--search_from != subs->Line.begin())
|
||||
{
|
||||
AssDialogue *dlg = AssEntry::GetAsDialogue(*search_from);
|
||||
AssDialogue *dlg = dynamic_cast<AssDialogue*>(*search_from);
|
||||
if (dlg && dlg->Style == search_style)
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -264,7 +264,7 @@ void DialogResample::OnResample (wxCommandEvent &event) {
|
|||
AssDialogue *curDiag;
|
||||
for (entryIter cur=subs->Line.begin();cur!=subs->Line.end();cur++) {
|
||||
// Apply to dialogues
|
||||
curDiag = AssEntry::GetAsDialogue(*cur);
|
||||
curDiag = dynamic_cast<AssDialogue*>(*cur);
|
||||
if (curDiag && !(curDiag->Comment && (curDiag->Effect.StartsWith(_T("template")) || curDiag->Effect.StartsWith(_T("code"))))) {
|
||||
try {
|
||||
// Override tags
|
||||
|
@ -302,7 +302,7 @@ void DialogResample::OnResample (wxCommandEvent &event) {
|
|||
}
|
||||
|
||||
// Apply to styles
|
||||
curStyle = AssEntry::GetAsStyle(*cur);
|
||||
curStyle = dynamic_cast<AssStyle*>(*cur);
|
||||
if (curStyle) {
|
||||
curStyle->fontsize = int(curStyle->fontsize * r + 0.5);
|
||||
curStyle->outline_w *= r;
|
||||
|
|
|
@ -288,7 +288,7 @@ void DialogStyleManager::LoadCurrentStyles (AssFile *subs) {
|
|||
styleMap.clear();
|
||||
|
||||
for (list<AssEntry*>::iterator cur=subs->Line.begin();cur!=subs->Line.end();cur++) {
|
||||
style = AssEntry::GetAsStyle(*cur);
|
||||
style = dynamic_cast<AssStyle*>(*cur);
|
||||
if (style && style->Valid) {
|
||||
CurrentList->Append(style->name);
|
||||
styleMap.push_back(style);
|
||||
|
@ -1075,7 +1075,7 @@ void DialogStyleManager::MoveStyles(bool storage, int type) {
|
|||
for (entryIter cur=subs->Line.begin();cur!=subs->Line.end();cur = next) {
|
||||
next = cur;
|
||||
next++;
|
||||
AssStyle *style = AssEntry::GetAsStyle(*cur);
|
||||
AssStyle *style = dynamic_cast<AssStyle*>(*cur);
|
||||
if (style) {
|
||||
subs->Line.insert(cur,styls[curn]);
|
||||
subs->Line.erase(cur);
|
||||
|
|
|
@ -319,7 +319,7 @@ void DialogTimingProcessor::OnApply(wxCommandEvent &event) {
|
|||
AssDialogue *tempDiag;
|
||||
int i = 0;
|
||||
for (std::list<AssEntry*>::iterator cur=grid->ass->Line.begin();cur!=grid->ass->Line.end();cur++) {
|
||||
tempDiag = AssEntry::GetAsDialogue(*cur);
|
||||
tempDiag = dynamic_cast<AssDialogue*>(*cur);
|
||||
if (tempDiag) {
|
||||
i++;
|
||||
if (tempDiag->Start.GetMS() > tempDiag->End.GetMS()) {
|
||||
|
|
|
@ -78,7 +78,7 @@ void AssFixStylesFilter::ProcessSubs(AssFile *subs, wxWindow *export_dialog) {
|
|||
// Process lines
|
||||
entryIter cur;
|
||||
for (cur=subs->Line.begin();cur!=subs->Line.end();cur++) {
|
||||
AssDialogue *diag = AssEntry::GetAsDialogue(*cur);
|
||||
AssDialogue *diag = dynamic_cast<AssDialogue*>(*cur);
|
||||
if (diag) {
|
||||
// Try to find style and match case
|
||||
bool found = false;
|
||||
|
|
|
@ -285,7 +285,7 @@ void AssTransformFramerateFilter::TransformFrameRate(AssFile *subs) {
|
|||
// compensate it AGAIN 20 lines down? I DO NOT GET IT
|
||||
// -Fluff
|
||||
//curEntry->Start.SetMS(Input->GetTimeAtFrame(Output->GetFrameAtTime(curEntry->GetStartMS(),true),true));
|
||||
curDialogue = AssEntry::GetAsDialogue(curEntry);
|
||||
curDialogue = dynamic_cast<AssDialogue*>(curEntry);
|
||||
|
||||
// Update dialogue entries
|
||||
if (curDialogue) {
|
||||
|
|
|
@ -87,7 +87,7 @@ void AssLimitToVisibleFilter::ProcessSubs(AssFile *subs, wxWindow *export_dialog
|
|||
cur = next++;
|
||||
|
||||
// Is dialogue?
|
||||
diag = AssEntry::GetAsDialogue(*cur);
|
||||
diag = dynamic_cast<AssDialogue*>(*cur);
|
||||
if (diag) {
|
||||
int f1 = VFR_Output.GetFrameAtTime(diag->Start.GetMS(),true);
|
||||
int f2 = VFR_Output.GetFrameAtTime(diag->End.GetMS(),false);
|
||||
|
|
|
@ -853,7 +853,7 @@ void SubtitlesGrid::LoadFromAss (AssFile *_ass,bool keepSelection,bool dontModif
|
|||
AssDialogue *curdiag;
|
||||
ready = false;
|
||||
for (entryIter cur=ass->Line.begin();cur != ass->Line.end();cur++) {
|
||||
curdiag = AssEntry::GetAsDialogue(*cur);
|
||||
curdiag = dynamic_cast<AssDialogue*>(*cur);
|
||||
if (curdiag) {
|
||||
diagMap.push_back(cur);
|
||||
diagPtrMap.push_back(curdiag);
|
||||
|
|
|
@ -94,7 +94,7 @@ SubtitlesPreview::~SubtitlesPreview() {
|
|||
///
|
||||
void SubtitlesPreview::SetStyle(AssStyle *_style) {
|
||||
// Prepare style
|
||||
AssStyle *tmpStyle = AssEntry::GetAsStyle(_style->Clone());
|
||||
AssStyle *tmpStyle = dynamic_cast<AssStyle*>(_style->Clone());
|
||||
tmpStyle->name = _T("Preview");
|
||||
tmpStyle->alignment = 5;
|
||||
for (int i=0;i<4;i++) tmpStyle->Margin[i] = 0;
|
||||
|
|
|
@ -421,7 +421,7 @@ void SubtitleFormat::ConvertTags(int format,wxString lineEnd) {
|
|||
using std::list;
|
||||
list<AssEntry*>::iterator next;
|
||||
for (list<AssEntry*>::iterator cur=Line->begin();cur!=Line->end();cur++) {
|
||||
AssDialogue *current = AssEntry::GetAsDialogue(*cur);
|
||||
AssDialogue *current = dynamic_cast<AssDialogue*>(*cur);
|
||||
if (current) {
|
||||
// Strip tags
|
||||
if (format == 1) current->StripTags();
|
||||
|
@ -448,7 +448,7 @@ void SubtitleFormat::StripComments() {
|
|||
next = cur;
|
||||
next++;
|
||||
|
||||
AssDialogue *dlg = AssEntry::GetAsDialogue(*cur);
|
||||
AssDialogue *dlg = dynamic_cast<AssDialogue*>(*cur);
|
||||
if (dlg && (dlg->Comment || dlg->Text.IsEmpty())) {
|
||||
delete *cur;
|
||||
Line->erase(cur);
|
||||
|
@ -468,7 +468,7 @@ void SubtitleFormat::StripNonDialogue() {
|
|||
next = cur;
|
||||
next++;
|
||||
|
||||
if (!AssEntry::GetAsDialogue(*cur)) {
|
||||
if (!dynamic_cast<AssDialogue*>(*cur)) {
|
||||
delete *cur;
|
||||
Line->erase(cur);
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ static void InsertLineSortedIntoList(std::list<AssEntry*> &list, std::list<AssEn
|
|||
std::list<AssEntry*>::iterator insertpos = next;
|
||||
bool inserted = false;
|
||||
while (insertpos != list.end()) {
|
||||
AssDialogue *candidate = AssEntry::GetAsDialogue(*insertpos);
|
||||
AssDialogue *candidate = dynamic_cast<AssDialogue*>(*insertpos);
|
||||
if (candidate && candidate->Start >= newdlg->Start) {
|
||||
list.insert(insertpos, newdlg);
|
||||
inserted = true;
|
||||
|
@ -513,8 +513,8 @@ void SubtitleFormat::RecombineOverlaps() {
|
|||
|
||||
if (next == Line->end()) break;
|
||||
|
||||
AssDialogue *prevdlg = AssEntry::GetAsDialogue(*cur);
|
||||
AssDialogue *curdlg = AssEntry::GetAsDialogue(*next);
|
||||
AssDialogue *prevdlg = dynamic_cast<AssDialogue*>(*cur);
|
||||
AssDialogue *curdlg = dynamic_cast<AssDialogue*>(*next);
|
||||
|
||||
if (curdlg && prevdlg && prevdlg->End > curdlg->Start) {
|
||||
// Use names like in the algorithm description and prepare for erasing
|
||||
|
@ -532,7 +532,7 @@ void SubtitleFormat::RecombineOverlaps() {
|
|||
//Is there an A part before the overlap?
|
||||
if (curdlg->Start > prevdlg->Start) {
|
||||
// Produce new entry with correct values
|
||||
AssDialogue *newdlg = AssEntry::GetAsDialogue(prevdlg->Clone());
|
||||
AssDialogue *newdlg = dynamic_cast<AssDialogue*>(prevdlg->Clone());
|
||||
newdlg->Start = prevdlg->Start;
|
||||
newdlg->End = curdlg->Start;
|
||||
newdlg->Text = prevdlg->Text;
|
||||
|
@ -542,7 +542,7 @@ void SubtitleFormat::RecombineOverlaps() {
|
|||
|
||||
// Overlapping A+B part
|
||||
{
|
||||
AssDialogue *newdlg = AssEntry::GetAsDialogue(prevdlg->Clone());
|
||||
AssDialogue *newdlg = dynamic_cast<AssDialogue*>(prevdlg->Clone());
|
||||
newdlg->Start = curdlg->Start;
|
||||
newdlg->End = (prevdlg->End < curdlg->End) ? prevdlg->End : curdlg->End;
|
||||
// Put an ASS format hard linewrap between lines
|
||||
|
@ -554,7 +554,7 @@ void SubtitleFormat::RecombineOverlaps() {
|
|||
// Is there an A part after the overlap?
|
||||
if (prevdlg->End > curdlg->End) {
|
||||
// Produce new entry with correct values
|
||||
AssDialogue *newdlg = AssEntry::GetAsDialogue(prevdlg->Clone());
|
||||
AssDialogue *newdlg = dynamic_cast<AssDialogue*>(prevdlg->Clone());
|
||||
newdlg->Start = curdlg->End;
|
||||
newdlg->End = prevdlg->End;
|
||||
newdlg->Text = prevdlg->Text;
|
||||
|
@ -565,7 +565,7 @@ void SubtitleFormat::RecombineOverlaps() {
|
|||
// Is there a B part after the overlap?
|
||||
if (curdlg->End > prevdlg->End) {
|
||||
// Produce new entry with correct values
|
||||
AssDialogue *newdlg = AssEntry::GetAsDialogue(prevdlg->Clone());
|
||||
AssDialogue *newdlg = dynamic_cast<AssDialogue*>(prevdlg->Clone());
|
||||
newdlg->Start = prevdlg->End;
|
||||
newdlg->End = curdlg->End;
|
||||
newdlg->Text = curdlg->Text;
|
||||
|
@ -592,8 +592,8 @@ void SubtitleFormat::MergeIdentical() {
|
|||
|
||||
if (next == Line->end()) break;
|
||||
|
||||
AssDialogue *curdlg = AssEntry::GetAsDialogue(*cur);
|
||||
AssDialogue *nextdlg = AssEntry::GetAsDialogue(*next);
|
||||
AssDialogue *curdlg = dynamic_cast<AssDialogue*>(*cur);
|
||||
AssDialogue *nextdlg = dynamic_cast<AssDialogue*>(*next);
|
||||
|
||||
if (curdlg && nextdlg && curdlg->End == nextdlg->Start && curdlg->Text == nextdlg->Text) {
|
||||
// Merge timing
|
||||
|
|
|
@ -106,7 +106,7 @@ void DVDSubtitleFormat::GetSubPictureList(std::vector<SubPicture> &pics) {
|
|||
int count = 0;
|
||||
std::vector<AssDialogue*> diags;
|
||||
for (list<AssEntry*>::iterator cur=Line->begin();cur!=Line->end();cur++) {
|
||||
AssDialogue *current = AssEntry::GetAsDialogue(*cur);
|
||||
AssDialogue *current = dynamic_cast<AssDialogue*>(*cur);
|
||||
if (current) {
|
||||
diags.push_back(current);
|
||||
count++;
|
||||
|
|
|
@ -102,7 +102,7 @@ void EncoreSubtitleFormat::WriteFile(wxString _filename,wxString encoding) {
|
|||
FractionalTime ft(fps_rat.smpte_dropframe ? _T(";") : _T(":"), fps_rat.num, fps_rat.den, fps_rat.smpte_dropframe);
|
||||
|
||||
for (list<AssEntry*>::iterator cur=Line->begin();cur!=Line->end();cur++) {
|
||||
AssDialogue *current = AssEntry::GetAsDialogue(*cur);
|
||||
AssDialogue *current = dynamic_cast<AssDialogue*>(*cur);
|
||||
if (current && !current->Comment) {
|
||||
++i;
|
||||
file.WriteLineToFile(wxString::Format(_T("%i %s %s %s"), i, ft.FromAssTime(current->Start).c_str(), ft.FromAssTime(current->End).c_str(), current->Text.c_str()));
|
||||
|
|
|
@ -219,7 +219,7 @@ void MicroDVDSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
|
|||
// Write lines
|
||||
using std::list;
|
||||
for (list<AssEntry*>::iterator cur=Line->begin();cur!=Line->end();cur++) {
|
||||
AssDialogue *current = AssEntry::GetAsDialogue(*cur);
|
||||
AssDialogue *current = dynamic_cast<AssDialogue*>(*cur);
|
||||
if (current && !current->Comment) {
|
||||
// Prepare data
|
||||
int start = rate->GetFrameAtTime(current->Start.GetMS(),true);
|
||||
|
|
|
@ -215,7 +215,7 @@ void SRTSubtitleFormat::WriteFile(wxString _filename,wxString encoding) {
|
|||
int i=1;
|
||||
using std::list;
|
||||
for (list<AssEntry*>::iterator cur=Line->begin();cur!=Line->end();cur++) {
|
||||
AssDialogue *current = AssEntry::GetAsDialogue(*cur);
|
||||
AssDialogue *current = dynamic_cast<AssDialogue*>(*cur);
|
||||
if (current && !current->Comment) {
|
||||
// Write line
|
||||
file.WriteLineToFile(wxString::Format(_T("%i"),i));
|
||||
|
|
|
@ -108,7 +108,7 @@ void TranStationSubtitleFormat::WriteFile(wxString _filename,wxString encoding)
|
|||
for (list<AssEntry*>::iterator cur=Line->begin();cur!=Line->end();cur++) {
|
||||
if (next)
|
||||
current = next;
|
||||
next = AssEntry::GetAsDialogue(*cur);
|
||||
next = dynamic_cast<AssDialogue*>(*cur);
|
||||
|
||||
if (current && !current->Comment) {
|
||||
// Write text
|
||||
|
|
|
@ -245,7 +245,7 @@ void TTXTSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
|
|||
using std::list;
|
||||
prev = NULL;
|
||||
for (list<AssEntry*>::iterator cur=Line->begin();cur!=Line->end();cur++) {
|
||||
AssDialogue *current = AssEntry::GetAsDialogue(*cur);
|
||||
AssDialogue *current = dynamic_cast<AssDialogue*>(*cur);
|
||||
if (current && !current->Comment) {
|
||||
WriteLine(root,current);
|
||||
i++;
|
||||
|
@ -359,7 +359,7 @@ void TTXTSubtitleFormat::ConvertToTTXT () {
|
|||
// Find last line
|
||||
AssTime lastTime;
|
||||
for (std::list<AssEntry*>::reverse_iterator cur=Line->rbegin();cur!=Line->rend();cur++) {
|
||||
AssDialogue *prev = AssEntry::GetAsDialogue(*cur);
|
||||
AssDialogue *prev = dynamic_cast<AssDialogue*>(*cur);
|
||||
if (prev) {
|
||||
lastTime = prev->End;
|
||||
break;
|
||||
|
|
|
@ -200,7 +200,7 @@ void TXTSubtitleFormat::WriteFile(wxString filename,wxString encoding) { using n
|
|||
|
||||
// Detect number of lines with Actor field filled out
|
||||
for (list<AssEntry*>::iterator l = Line->begin(); l != Line->end(); ++l) {
|
||||
AssDialogue *dia = AssEntry::GetAsDialogue(*l);
|
||||
AssDialogue *dia = dynamic_cast<AssDialogue*>(*l);
|
||||
if (dia && !dia->Comment) {
|
||||
num_dialogue_lines++;
|
||||
if (!dia->Actor.IsEmpty())
|
||||
|
@ -217,7 +217,7 @@ void TXTSubtitleFormat::WriteFile(wxString filename,wxString encoding) { using n
|
|||
|
||||
// Write the file
|
||||
for (list<AssEntry*>::iterator l = Line->begin(); l != Line->end(); ++l) {
|
||||
AssDialogue *dia = AssEntry::GetAsDialogue(*l);
|
||||
AssDialogue *dia = dynamic_cast<AssDialogue*>(*l);
|
||||
|
||||
if (dia) {
|
||||
wxString out_line;
|
||||
|
|
Loading…
Reference in a new issue