forked from mia/Aegisub
Added clone function for better copying of AssEntry and derived classes
Originally committed to SVN as r184.
This commit is contained in:
parent
3c27496b29
commit
2d9574952e
7 changed files with 92 additions and 1 deletions
|
@ -727,6 +727,35 @@ bool AssDialogue::CollidesWith(AssDialogue *target) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////
|
||||||
|
// Clone
|
||||||
|
AssEntry *AssDialogue::Clone() {
|
||||||
|
// Create clone
|
||||||
|
AssDialogue *final = new AssDialogue();
|
||||||
|
|
||||||
|
// Copy data
|
||||||
|
final->group = group;
|
||||||
|
final->StartMS = StartMS;
|
||||||
|
final->Valid = Valid;
|
||||||
|
final->Actor = Actor;
|
||||||
|
final->Comment = Comment;
|
||||||
|
final->Effect = Effect;
|
||||||
|
final->End = End;
|
||||||
|
final->Layer = Layer;
|
||||||
|
final->MarginL = MarginL;
|
||||||
|
final->MarginR = MarginR;
|
||||||
|
final->MarginV = MarginV;
|
||||||
|
final->Start = Start;
|
||||||
|
final->StartMS = final->StartMS;
|
||||||
|
final->Style = Style;
|
||||||
|
final->Text = Text;
|
||||||
|
final->SetEntryData(GetEntryData());
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return final;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////// AssDialogueBlock //////////////////////
|
////////////////////// AssDialogueBlock //////////////////////
|
||||||
///////////////
|
///////////////
|
||||||
// Constructor
|
// Constructor
|
||||||
|
|
|
@ -200,6 +200,8 @@ public:
|
||||||
bool CollidesWith(AssDialogue *target); // Checks if two lines collide
|
bool CollidesWith(AssDialogue *target); // Checks if two lines collide
|
||||||
void ClearBlocks();
|
void ClearBlocks();
|
||||||
|
|
||||||
|
AssEntry *Clone();
|
||||||
|
|
||||||
AssDialogue();
|
AssDialogue();
|
||||||
AssDialogue(wxString data,bool IsSSA=false);
|
AssDialogue(wxString data,bool IsSSA=false);
|
||||||
~AssDialogue();
|
~AssDialogue();
|
||||||
|
|
|
@ -100,3 +100,20 @@ wxString AssEntry::GetSSAText() {
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////
|
||||||
|
// Clone
|
||||||
|
AssEntry *AssEntry::Clone() {
|
||||||
|
// Create clone
|
||||||
|
AssEntry *final = new AssEntry();
|
||||||
|
|
||||||
|
// Copy data
|
||||||
|
final->data = data;
|
||||||
|
final->group = group;
|
||||||
|
final->StartMS = StartMS;
|
||||||
|
final->Valid = Valid;
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return final;
|
||||||
|
}
|
||||||
|
|
|
@ -72,6 +72,8 @@ public:
|
||||||
AssEntry(wxString data);
|
AssEntry(wxString data);
|
||||||
virtual ~AssEntry();
|
virtual ~AssEntry();
|
||||||
|
|
||||||
|
virtual AssEntry *Clone();
|
||||||
|
|
||||||
virtual ASS_EntryType GetType() { return ENTRY_BASE; }
|
virtual ASS_EntryType GetType() { return ENTRY_BASE; }
|
||||||
virtual const wxString GetEntryData() { return data; }
|
virtual const wxString GetEntryData() { return data; }
|
||||||
virtual void SetEntryData(wxString newData) { if (newData.IsEmpty()) data.Clear(); else data = newData; }
|
virtual void SetEntryData(wxString newData) { if (newData.IsEmpty()) data.Clear(); else data = newData; }
|
||||||
|
|
|
@ -473,7 +473,7 @@ AssFile::AssFile (AssFile &from) {
|
||||||
// Copy lines
|
// Copy lines
|
||||||
int lasttime = -1;
|
int lasttime = -1;
|
||||||
for (list<AssEntry*>::iterator cur=from.Line.begin();cur!=from.Line.end();cur++) {
|
for (list<AssEntry*>::iterator cur=from.Line.begin();cur!=from.Line.end();cur++) {
|
||||||
lasttime = AddLine((*cur)->GetEntryData(),(*cur)->group,lasttime,IsSSA);
|
Line.push_back((*cur)->Clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add comments
|
// Add comments
|
||||||
|
|
|
@ -524,3 +524,42 @@ wxString AssStyle::GetSSAText() {
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////
|
||||||
|
// Clone
|
||||||
|
AssEntry *AssStyle::Clone() {
|
||||||
|
// Create clone
|
||||||
|
AssStyle *final = new AssStyle();
|
||||||
|
|
||||||
|
// Copy data
|
||||||
|
final->group = group;
|
||||||
|
final->StartMS = StartMS;
|
||||||
|
final->Valid = Valid;
|
||||||
|
final->alignment = alignment;
|
||||||
|
final->angle = angle;
|
||||||
|
final->bold = bold;
|
||||||
|
final->borderstyle = borderstyle;
|
||||||
|
final->encoding = encoding;
|
||||||
|
final->font = font;
|
||||||
|
final->fontsize = fontsize;
|
||||||
|
final->italic = italic;
|
||||||
|
final->MarginL = MarginL;
|
||||||
|
final->MarginR = MarginR;
|
||||||
|
final->MarginV = MarginV;
|
||||||
|
final->name = name;
|
||||||
|
final->outline = outline;
|
||||||
|
final->outline_w = outline_w;
|
||||||
|
final->primary = primary;
|
||||||
|
final->scalex = scalex;
|
||||||
|
final->scaley = scaley;
|
||||||
|
final->secondary = secondary;
|
||||||
|
final->shadow = shadow;
|
||||||
|
final->spacing = spacing;
|
||||||
|
final->strikeout = strikeout;
|
||||||
|
final->underline = underline;
|
||||||
|
final->SetEntryData(GetEntryData());
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return final;
|
||||||
|
}
|
||||||
|
|
|
@ -102,6 +102,8 @@ public:
|
||||||
wxString GetMarginString(int which); // Returns the margin value as a string (1 = left, 2 = right, 3 = vertical)
|
wxString GetMarginString(int which); // Returns the margin value as a string (1 = left, 2 = right, 3 = vertical)
|
||||||
void SetMarginString(const wxString value,int which); // Sets margin value from a string (1 = left, 2 = right, 3 = vertical)
|
void SetMarginString(const wxString value,int which); // Sets margin value from a string (1 = left, 2 = right, 3 = vertical)
|
||||||
|
|
||||||
|
AssEntry *Clone();
|
||||||
|
|
||||||
AssStyle();
|
AssStyle();
|
||||||
AssStyle(wxString data,bool IsSSA=false);
|
AssStyle(wxString data,bool IsSSA=false);
|
||||||
~AssStyle();
|
~AssStyle();
|
||||||
|
|
Loading…
Reference in a new issue