forked from mia/Aegisub
Made AssEntry::data private
Originally committed to SVN as r182.
This commit is contained in:
parent
39225db7c8
commit
5f6f39ce3e
14 changed files with 102 additions and 100 deletions
|
@ -55,7 +55,6 @@ AssDialogue::AssDialogue() {
|
||||||
Movement = 0;
|
Movement = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Type = ENTRY_DIALOGUE;
|
|
||||||
group = _T("[Events]");
|
group = _T("[Events]");
|
||||||
|
|
||||||
Valid = true;
|
Valid = true;
|
||||||
|
@ -80,10 +79,8 @@ AssDialogue::AssDialogue(wxString _data,bool IsSSA) {
|
||||||
Movement = 0;
|
Movement = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Type = ENTRY_DIALOGUE;
|
|
||||||
group = _T("[Events]");
|
group = _T("[Events]");
|
||||||
data = _data;
|
Valid = Parse(_data,IsSSA);
|
||||||
Valid = Parse(IsSSA);
|
|
||||||
if (!Valid) {
|
if (!Valid) {
|
||||||
throw _T("Failed parsing line.");
|
throw _T("Failed parsing line.");
|
||||||
}
|
}
|
||||||
|
@ -130,21 +127,21 @@ void AssDialogue::ClearBlocks() {
|
||||||
|
|
||||||
//////////////////
|
//////////////////
|
||||||
// Parse ASS Data
|
// Parse ASS Data
|
||||||
bool AssDialogue::Parse(bool IsSSA) {
|
bool AssDialogue::Parse(wxString rawData, bool IsSSA) {
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
wxString temp;
|
wxString temp;
|
||||||
|
|
||||||
// Get type
|
// Get type
|
||||||
if (data.substr(pos,9) == _T("Dialogue:")) {
|
if (rawData.substr(pos,9) == _T("Dialogue:")) {
|
||||||
Comment = false;
|
Comment = false;
|
||||||
pos = 10;
|
pos = 10;
|
||||||
}
|
}
|
||||||
else if (data.substr(pos,8) == _T("Comment:")) {
|
else if (rawData.substr(pos,8) == _T("Comment:")) {
|
||||||
Comment = true;
|
Comment = true;
|
||||||
pos = 9;
|
pos = 9;
|
||||||
}
|
}
|
||||||
else return false;
|
else return false;
|
||||||
wxStringTokenizer tkn(data.Mid(pos),_T(","),wxTOKEN_RET_EMPTY_ALL);
|
wxStringTokenizer tkn(rawData.Mid(pos),_T(","),wxTOKEN_RET_EMPTY_ALL);
|
||||||
|
|
||||||
// Get layer number
|
// Get layer number
|
||||||
if (!tkn.HasMoreTokens()) return false;
|
if (!tkn.HasMoreTokens()) return false;
|
||||||
|
@ -209,33 +206,34 @@ bool AssDialogue::Parse(bool IsSSA) {
|
||||||
// Update AssDialogue's data line
|
// Update AssDialogue's data line
|
||||||
void AssDialogue::UpdateData () {
|
void AssDialogue::UpdateData () {
|
||||||
// Prepare
|
// Prepare
|
||||||
data = _T("");
|
wxString final = _T("");
|
||||||
|
|
||||||
// Write all data
|
// Write all final
|
||||||
if (Comment) data += _T("Comment: ");
|
if (Comment) final += _T("Comment: ");
|
||||||
else data += _T("Dialogue: ");
|
else final += _T("Dialogue: ");
|
||||||
|
|
||||||
data += wxString::Format(_T("%01i"),Layer);
|
final += wxString::Format(_T("%01i"),Layer);
|
||||||
data += _T(",");
|
final += _T(",");
|
||||||
|
|
||||||
data += Start.GetASSFormated() + _T(",");
|
final += Start.GetASSFormated() + _T(",");
|
||||||
data += End.GetASSFormated() + _T(",");
|
final += End.GetASSFormated() + _T(",");
|
||||||
|
|
||||||
Style.Replace(_T(","),_T(";"));
|
Style.Replace(_T(","),_T(";"));
|
||||||
Actor.Replace(_T(","),_T(";"));
|
Actor.Replace(_T(","),_T(";"));
|
||||||
data += Style + _T(",");
|
final += Style + _T(",");
|
||||||
data += Actor + _T(",");
|
final += Actor + _T(",");
|
||||||
|
|
||||||
data += GetMarginString(1);
|
final += GetMarginString(1);
|
||||||
data += _T(",");
|
final += _T(",");
|
||||||
data += GetMarginString(2);
|
final += GetMarginString(2);
|
||||||
data += _T(",");
|
final += _T(",");
|
||||||
data += GetMarginString(3);
|
final += GetMarginString(3);
|
||||||
data += _T(",");
|
final += _T(",");
|
||||||
|
|
||||||
Effect.Replace(_T(","),_T(";"));
|
Effect.Replace(_T(","),_T(";"));
|
||||||
data += Effect + _T(",");
|
final += Effect + _T(",");
|
||||||
data += Text;
|
final += Text;
|
||||||
|
SetEntryData(final);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,9 @@ public:
|
||||||
FexMovement *Movement; // Point tracker generated movement
|
FexMovement *Movement; // Point tracker generated movement
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool Parse(bool IsSSA=false); // Parses raw ASS data into everything else
|
ASS_EntryType GetType() { return ENTRY_DIALOGUE; }
|
||||||
|
|
||||||
|
bool Parse(wxString data,bool IsSSA=false); // Parses raw ASS data into everything else
|
||||||
void ParseASSTags(); // Parses text to generate block information (doesn't update data)
|
void ParseASSTags(); // Parses text to generate block information (doesn't update data)
|
||||||
void ParseSRTTags(); // Converts tags to ass format and calls ParseASSTags+UpdateData
|
void ParseSRTTags(); // Converts tags to ass format and calls ParseASSTags+UpdateData
|
||||||
void UpdateData(); // Updates raw data from current values + text
|
void UpdateData(); // Updates raw data from current values + text
|
||||||
|
|
|
@ -45,13 +45,11 @@
|
||||||
///////////////////////
|
///////////////////////
|
||||||
// Constructs AssEntry
|
// Constructs AssEntry
|
||||||
AssEntry::AssEntry() {
|
AssEntry::AssEntry() {
|
||||||
Type = ENTRY_BASE;
|
|
||||||
Valid = true;
|
Valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AssEntry::AssEntry(wxString _data) {
|
AssEntry::AssEntry(wxString _data) {
|
||||||
data = _data;
|
data = _data;
|
||||||
Type = ENTRY_BASE;
|
|
||||||
Valid = true;
|
Valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +71,7 @@ bool operator < (const AssEntry &t1, const AssEntry &t2) {
|
||||||
// Returns an entry as dialogue if possible, else, returns NULL
|
// Returns an entry as dialogue if possible, else, returns NULL
|
||||||
AssDialogue *AssEntry::GetAsDialogue(AssEntry *base) {
|
AssDialogue *AssEntry::GetAsDialogue(AssEntry *base) {
|
||||||
if (!base) return NULL;
|
if (!base) return NULL;
|
||||||
if (base->Type == ENTRY_DIALOGUE) {
|
if (base->GetType() == ENTRY_DIALOGUE) {
|
||||||
return static_cast<AssDialogue*> (base);
|
return static_cast<AssDialogue*> (base);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -84,7 +82,7 @@ AssDialogue *AssEntry::GetAsDialogue(AssEntry *base) {
|
||||||
// Returns an entry as style if possible, else, returns NULL
|
// Returns an entry as style if possible, else, returns NULL
|
||||||
AssStyle *AssEntry::GetAsStyle(AssEntry *base) {
|
AssStyle *AssEntry::GetAsStyle(AssEntry *base) {
|
||||||
if (!base) return NULL;
|
if (!base) return NULL;
|
||||||
if (base->Type == ENTRY_STYLE) {
|
if (base->GetType() == ENTRY_STYLE) {
|
||||||
return static_cast<AssStyle*> (base);
|
return static_cast<AssStyle*> (base);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -60,17 +60,22 @@ enum ASS_EntryType {
|
||||||
////////////////////////////////////
|
////////////////////////////////////
|
||||||
// Base class for each line in file
|
// Base class for each line in file
|
||||||
class AssEntry {
|
class AssEntry {
|
||||||
|
private:
|
||||||
|
wxString data; // Raw data, exactly the same line that appears on the .ass (note that this will be in ass even if source wasn't)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int StartMS; // This is only stored for sorting issues, in order to keep non-dialogue lines aligned
|
int StartMS; // This is only stored for sorting issues, in order to keep non-dialogue lines aligned
|
||||||
bool Valid; // Flags as valid or not
|
bool Valid; // Flags as valid or not
|
||||||
wxString data; // Raw data, exactly the same line that appears on the .ass (note that this will be in ass even if source wasn't)
|
|
||||||
wxString group; // Group it belongs to, e.g. "[Events]"
|
wxString group; // Group it belongs to, e.g. "[Events]"
|
||||||
ASS_EntryType Type; // Defines if this is a dialogue, style, or unknown line
|
|
||||||
|
|
||||||
AssEntry();
|
AssEntry();
|
||||||
AssEntry(wxString data);
|
AssEntry(wxString data);
|
||||||
virtual ~AssEntry();
|
virtual ~AssEntry();
|
||||||
|
|
||||||
|
virtual ASS_EntryType GetType() { return ENTRY_BASE; }
|
||||||
|
virtual const wxString GetEntryData() { return data; }
|
||||||
|
virtual void SetEntryData(wxString newData) { if (newData.IsEmpty()) data.Clear(); else data = newData; }
|
||||||
|
|
||||||
virtual wxString GetSSAText();
|
virtual wxString GetSSAText();
|
||||||
static AssDialogue *GetAsDialogue(AssEntry *base); // Returns an entry base as a dialogue if it is valid, null otherwise
|
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 AssStyle *GetAsStyle(AssEntry *base); // Returns an entry base as a style if it is valid, null otherwise
|
||||||
|
|
|
@ -193,7 +193,7 @@ void AssFile::SaveASS (wxString _filename,bool setfilename,const wxString encodi
|
||||||
// Write lines
|
// Write lines
|
||||||
using std::list;
|
using std::list;
|
||||||
for (list<AssEntry*>::iterator cur=Line.begin();cur!=Line.end();cur++) {
|
for (list<AssEntry*>::iterator cur=Line.begin();cur!=Line.end();cur++) {
|
||||||
file.WriteLineToFile((*cur)->data);
|
file.WriteLineToFile((*cur)->GetEntryData());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
|
@ -443,14 +443,14 @@ void AssFile::LoadDefault (bool defline) {
|
||||||
AddLine(_T(""),_T("[Script Info]"),-1,IsSSA);
|
AddLine(_T(""),_T("[Script Info]"),-1,IsSSA);
|
||||||
AddLine(_T("[V4+ Styles]"),_T("[V4+ Styles]"),-1,IsSSA);
|
AddLine(_T("[V4+ Styles]"),_T("[V4+ Styles]"),-1,IsSSA);
|
||||||
AddLine(_T("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding"),_T("[V4+ Styles]"),-1,IsSSA);
|
AddLine(_T("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding"),_T("[V4+ Styles]"),-1,IsSSA);
|
||||||
AddLine(defstyle.data,_T("[V4+ Styles]"),-1,IsSSA);
|
AddLine(defstyle.GetEntryData(),_T("[V4+ Styles]"),-1,IsSSA);
|
||||||
AddLine(_T(""),_T("[V4+ Styles]"),-1,IsSSA);
|
AddLine(_T(""),_T("[V4+ Styles]"),-1,IsSSA);
|
||||||
AddLine(_T("[Events]"),_T("[Events]"),-1,IsSSA);
|
AddLine(_T("[Events]"),_T("[Events]"),-1,IsSSA);
|
||||||
AddLine(_T("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"),_T("[Events]"),-1,IsSSA);
|
AddLine(_T("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"),_T("[Events]"),-1,IsSSA);
|
||||||
|
|
||||||
if (defline) {
|
if (defline) {
|
||||||
AssDialogue def;
|
AssDialogue def;
|
||||||
AddLine(def.data,_T("[Events]"),0,IsSSA);
|
AddLine(def.GetEntryData(),_T("[Events]"),0,IsSSA);
|
||||||
}
|
}
|
||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
|
@ -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)->data,(*cur)->group,lasttime,IsSSA);
|
lasttime = AddLine((*cur)->GetEntryData(),(*cur)->group,lasttime,IsSSA);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add comments
|
// Add comments
|
||||||
|
@ -496,7 +496,7 @@ void AssFile::InsertStyle (AssStyle *style) {
|
||||||
// Look for insert position
|
// Look for insert position
|
||||||
for (cur=Line.begin();cur!=Line.end();cur++) {
|
for (cur=Line.begin();cur!=Line.end();cur++) {
|
||||||
curEntry = *cur;
|
curEntry = *cur;
|
||||||
if (curEntry->Type == ENTRY_STYLE || (lastGroup == _T("[V4+ Styles]") && curEntry->data.substr(0,7) == _T("Format:"))) {
|
if (curEntry->GetType() == ENTRY_STYLE || (lastGroup == _T("[V4+ Styles]") && curEntry->GetEntryData().substr(0,7) == _T("Format:"))) {
|
||||||
lastStyle = cur;
|
lastStyle = cur;
|
||||||
}
|
}
|
||||||
lasttime = curEntry->StartMS;
|
lasttime = curEntry->StartMS;
|
||||||
|
@ -553,7 +553,7 @@ wxString AssFile::GetScriptInfo(const wxString _key) {
|
||||||
for (cur=Line.begin();cur!=Line.end();cur++) {
|
for (cur=Line.begin();cur!=Line.end();cur++) {
|
||||||
if ((*cur)->group == _T("[Script Info]")) {
|
if ((*cur)->group == _T("[Script Info]")) {
|
||||||
GotIn = true;
|
GotIn = true;
|
||||||
wxString curText = (*cur)->data;
|
wxString curText = (*cur)->GetEntryData();
|
||||||
curText.Lower();
|
curText.Lower();
|
||||||
|
|
||||||
// Found
|
// Found
|
||||||
|
@ -601,7 +601,7 @@ void AssFile::SetScriptInfo(const wxString _key,const wxString value) {
|
||||||
for (cur=Line.begin();cur!=Line.end();cur++) {
|
for (cur=Line.begin();cur!=Line.end();cur++) {
|
||||||
if ((*cur)->group == _T("[Script Info]")) {
|
if ((*cur)->group == _T("[Script Info]")) {
|
||||||
GotIn = true;
|
GotIn = true;
|
||||||
wxString curText = (*cur)->data;
|
wxString curText = (*cur)->GetEntryData();
|
||||||
curText.Lower();
|
curText.Lower();
|
||||||
|
|
||||||
// Found
|
// Found
|
||||||
|
@ -611,7 +611,7 @@ void AssFile::SetScriptInfo(const wxString _key,const wxString value) {
|
||||||
wxString result = _key;
|
wxString result = _key;
|
||||||
result += _T(": ");
|
result += _T(": ");
|
||||||
result += value;
|
result += value;
|
||||||
(*cur)->data = result;
|
(*cur)->SetEntryData(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove key
|
// Remove key
|
||||||
|
@ -622,7 +622,7 @@ void AssFile::SetScriptInfo(const wxString _key,const wxString value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(*cur)->data.empty()) prev = cur;
|
if (!(*cur)->GetEntryData().empty()) prev = cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add
|
// Add
|
||||||
|
@ -656,7 +656,7 @@ void AssFile::AddComment(const wxString _comment) {
|
||||||
if (step == 0 && (*cur)->group == _T("[Script Info]")) step = 1;
|
if (step == 0 && (*cur)->group == _T("[Script Info]")) step = 1;
|
||||||
|
|
||||||
// First line after a ;
|
// First line after a ;
|
||||||
else if (step == 1 && (*cur)->data.Left(1) != _T(";")) {
|
else if (step == 1 && (*cur)->GetEntryData().Left(1) != _T(";")) {
|
||||||
AssEntry *prev = *cur;
|
AssEntry *prev = *cur;
|
||||||
AssEntry *comm = new AssEntry(comment);
|
AssEntry *comm = new AssEntry(comment);
|
||||||
comm->group = prev->group;
|
comm->group = prev->group;
|
||||||
|
@ -678,8 +678,8 @@ wxArrayString AssFile::GetStyles() {
|
||||||
if (curstyle) {
|
if (curstyle) {
|
||||||
styles.Add(curstyle->name);
|
styles.Add(curstyle->name);
|
||||||
}
|
}
|
||||||
if (!curstyle && (*cur)->data.Left(5) == _T("Style")) {
|
if (!curstyle && (*cur)->GetEntryData().Left(5) == _T("Style")) {
|
||||||
wxLogMessage(_T("Style ignored: ") + (*cur)->data);
|
wxLogMessage(_T("Style ignored: ") + (*cur)->GetEntryData());
|
||||||
curstyle = AssEntry::GetAsStyle(*cur);
|
curstyle = AssEntry::GetAsStyle(*cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -717,7 +717,7 @@ void AssFile::CompressForStack(bool compress) {
|
||||||
diag = AssEntry::GetAsDialogue(*cur);
|
diag = AssEntry::GetAsDialogue(*cur);
|
||||||
if (diag) {
|
if (diag) {
|
||||||
if (compress) {
|
if (compress) {
|
||||||
diag->data.Clear();
|
diag->SetEntryData(_T(""));
|
||||||
diag->ClearBlocks();
|
diag->ClearBlocks();
|
||||||
}
|
}
|
||||||
else diag->UpdateData();
|
else diag->UpdateData();
|
||||||
|
|
|
@ -147,7 +147,6 @@ wxString AssColor::GetSSAFormatted () {
|
||||||
///////////////////////
|
///////////////////////
|
||||||
// Default Constructor
|
// Default Constructor
|
||||||
AssStyle::AssStyle() {
|
AssStyle::AssStyle() {
|
||||||
Type = ENTRY_STYLE;
|
|
||||||
group = _T("[V4+ Styles]");
|
group = _T("[V4+ Styles]");
|
||||||
|
|
||||||
name = _T("Default");
|
name = _T("Default");
|
||||||
|
@ -196,9 +195,7 @@ AssStyle::AssStyle() {
|
||||||
///////////////
|
///////////////
|
||||||
// Constructor
|
// Constructor
|
||||||
AssStyle::AssStyle(wxString _data,bool IsSSA) {
|
AssStyle::AssStyle(wxString _data,bool IsSSA) {
|
||||||
Type = ENTRY_STYLE;
|
Valid = Parse(_data,IsSSA);
|
||||||
data = _data;
|
|
||||||
Valid = Parse(IsSSA);
|
|
||||||
if (!Valid) {
|
if (!Valid) {
|
||||||
throw _T("[Error] Failed parsing line.");
|
throw _T("[Error] Failed parsing line.");
|
||||||
}
|
}
|
||||||
|
@ -214,10 +211,10 @@ AssStyle::~AssStyle() {
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
// Parses value from ASS data
|
// Parses value from ASS data
|
||||||
bool AssStyle::Parse(bool IsSSA) {
|
bool AssStyle::Parse(wxString rawData,bool IsSSA) {
|
||||||
wxString temp;
|
wxString temp;
|
||||||
long templ;
|
long templ;
|
||||||
wxStringTokenizer tkn(data.Mid(6),_T(","),wxTOKEN_RET_EMPTY_ALL);
|
wxStringTokenizer tkn(rawData.Mid(6),_T(","),wxTOKEN_RET_EMPTY_ALL);
|
||||||
|
|
||||||
// Read name
|
// Read name
|
||||||
if (!tkn.HasMoreTokens()) return false;
|
if (!tkn.HasMoreTokens()) return false;
|
||||||
|
@ -408,39 +405,40 @@ bool AssStyle::Parse(bool IsSSA) {
|
||||||
// Writes data back to ASS format
|
// Writes data back to ASS format
|
||||||
void AssStyle::UpdateData() {
|
void AssStyle::UpdateData() {
|
||||||
// Prepare
|
// Prepare
|
||||||
data = _T("Style: ");
|
wxString final = _T("Style: ");
|
||||||
|
|
||||||
// Write all data
|
// Write all final
|
||||||
name.Replace(_T(","),_T(";"));
|
name.Replace(_T(","),_T(";"));
|
||||||
font.Replace(_T(","),_T(";"));
|
font.Replace(_T(","),_T(";"));
|
||||||
data += name + _T(",");
|
final += name + _T(",");
|
||||||
data += font + _T(",");
|
final += font + _T(",");
|
||||||
data += wxString::Format(_T("%i"),fontsize) + _T(",");
|
final += wxString::Format(_T("%i"),fontsize) + _T(",");
|
||||||
|
|
||||||
data += primary.GetASSFormatted(true,false,true) + _T(",");
|
final += primary.GetASSFormatted(true,false,true) + _T(",");
|
||||||
data += secondary.GetASSFormatted(true,false,true) + _T(",");
|
final += secondary.GetASSFormatted(true,false,true) + _T(",");
|
||||||
data += outline.GetASSFormatted(true,false,true) + _T(",");
|
final += outline.GetASSFormatted(true,false,true) + _T(",");
|
||||||
data += shadow.GetASSFormatted(true,false,true) + _T(",");
|
final += shadow.GetASSFormatted(true,false,true) + _T(",");
|
||||||
|
|
||||||
data += wxString::Format(_T("%i"),bold?-1:0) + _T(",");
|
final += wxString::Format(_T("%i"),bold?-1:0) + _T(",");
|
||||||
data += wxString::Format(_T("%i"),italic?-1:0) + _T(",");
|
final += wxString::Format(_T("%i"),italic?-1:0) + _T(",");
|
||||||
data += wxString::Format(_T("%i"),underline?-1:0) + _T(",");
|
final += wxString::Format(_T("%i"),underline?-1:0) + _T(",");
|
||||||
data += wxString::Format(_T("%i"),strikeout?-1:0) + _T(",");
|
final += wxString::Format(_T("%i"),strikeout?-1:0) + _T(",");
|
||||||
|
|
||||||
data += wxString::Format(_T("%i"),scalex) + _T(",");
|
final += wxString::Format(_T("%i"),scalex) + _T(",");
|
||||||
data += wxString::Format(_T("%i"),scaley) + _T(",");
|
final += wxString::Format(_T("%i"),scaley) + _T(",");
|
||||||
data += wxString::Format(_T("%.2f"),spacing) + _T(",");
|
final += wxString::Format(_T("%.2f"),spacing) + _T(",");
|
||||||
|
|
||||||
data += wxString::Format(_T("%.2f"),angle) + _T(",");
|
final += wxString::Format(_T("%.2f"),angle) + _T(",");
|
||||||
data += wxString::Format(_T("%i"),borderstyle) + _T(",");
|
final += wxString::Format(_T("%i"),borderstyle) + _T(",");
|
||||||
data += wxString::Format(_T("%.2f"),outline_w) + _T(",");
|
final += wxString::Format(_T("%.2f"),outline_w) + _T(",");
|
||||||
data += wxString::Format(_T("%.2f"),shadow_w) + _T(",");
|
final += wxString::Format(_T("%.2f"),shadow_w) + _T(",");
|
||||||
|
|
||||||
data += wxString::Format(_T("%i"),alignment) + _T(",");
|
final += wxString::Format(_T("%i"),alignment) + _T(",");
|
||||||
data += wxString::Format(_T("%i"),MarginL) + _T(",");
|
final += wxString::Format(_T("%i"),MarginL) + _T(",");
|
||||||
data += wxString::Format(_T("%i"),MarginR) + _T(",");
|
final += wxString::Format(_T("%i"),MarginR) + _T(",");
|
||||||
data += wxString::Format(_T("%i"),MarginV) + _T(",");
|
final += wxString::Format(_T("%i"),MarginV) + _T(",");
|
||||||
data += wxString::Format(_T("%i"),encoding);
|
final += wxString::Format(_T("%i"),encoding);
|
||||||
|
SetEntryData(final);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,9 @@ public:
|
||||||
int MarginV;
|
int MarginV;
|
||||||
int encoding;
|
int encoding;
|
||||||
|
|
||||||
bool Parse(bool IsSSA=false); // Parses raw ASS/SSA data into everything else
|
ASS_EntryType GetType() { return ENTRY_STYLE; }
|
||||||
|
|
||||||
|
bool Parse(wxString data,bool IsSSA=false); // Parses raw ASS/SSA data into everything else
|
||||||
void UpdateData(); // Updates raw data
|
void UpdateData(); // Updates raw data
|
||||||
wxString GetSSAText(); // Retrieves SSA-formatted style
|
wxString GetSSAText(); // Retrieves SSA-formatted style
|
||||||
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)
|
||||||
|
|
|
@ -58,7 +58,7 @@ void AssStyleStorage::Save(wxString name) {
|
||||||
|
|
||||||
file.open(filename.mb_str(wxConvLocal));
|
file.open(filename.mb_str(wxConvLocal));
|
||||||
for (list<AssStyle*>::iterator cur=style.begin();cur!=style.end();cur++) {
|
for (list<AssStyle*>::iterator cur=style.begin();cur!=style.end();cur++) {
|
||||||
file << (*cur)->data.mb_str(wxConvUTF8) << endl;
|
file << (*cur)->GetEntryData().mb_str(wxConvUTF8) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
|
|
|
@ -97,7 +97,7 @@ bool AudioKaraoke::LoadFromDialogue(AssDialogue *_diag) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Split
|
// Split
|
||||||
workDiag = new AssDialogue(diag->data, false);
|
workDiag = new AssDialogue(diag->GetEntryData(), false);
|
||||||
workDiag->ParseASSTags();
|
workDiag->ParseASSTags();
|
||||||
must_rebuild = false;
|
must_rebuild = false;
|
||||||
bool hasKar = ParseDialogue(workDiag);
|
bool hasKar = ParseDialogue(workDiag);
|
||||||
|
@ -199,7 +199,7 @@ void AudioKaraoke::AutoSplit() {
|
||||||
|
|
||||||
// Load
|
// Load
|
||||||
must_rebuild = true;
|
must_rebuild = true;
|
||||||
AssDialogue newDiag(diag->data);
|
AssDialogue newDiag(diag->GetEntryData());
|
||||||
newDiag.Text = newText;
|
newDiag.Text = newText;
|
||||||
//newDiag.ParseASSTags();
|
//newDiag.ParseASSTags();
|
||||||
ParseDialogue(&newDiag);
|
ParseDialogue(&newDiag);
|
||||||
|
|
|
@ -1201,7 +1201,7 @@ void AutomationScript::process_lines(AssFile *input)
|
||||||
|
|
||||||
if (!e->Valid) continue;
|
if (!e->Valid) continue;
|
||||||
|
|
||||||
if (e->Type == ENTRY_STYLE) {
|
if (e->GetType() == ENTRY_STYLE) {
|
||||||
|
|
||||||
AssStyle *style = e->GetAsStyle(e);
|
AssStyle *style = e->GetAsStyle(e);
|
||||||
|
|
||||||
|
@ -1247,19 +1247,19 @@ void AutomationScript::process_lines(AssFile *input)
|
||||||
|
|
||||||
} else if (e->group == _T("[Events]")) {
|
} else if (e->group == _T("[Events]")) {
|
||||||
|
|
||||||
if (e->Type != ENTRY_DIALOGUE) {
|
if (e->GetType() != ENTRY_DIALOGUE) {
|
||||||
|
|
||||||
// not a dialogue/comment event
|
// not a dialogue/comment event
|
||||||
|
|
||||||
// start checking for a blank line
|
// start checking for a blank line
|
||||||
if (e->data.IsEmpty()) {
|
if (e->GetEntryData().IsEmpty()) {
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
L_settable(L, -1, "kind", wxString(_T("blank")));
|
L_settable(L, -1, "kind", wxString(_T("blank")));
|
||||||
} else if (e->data[0] == _T(';')) {
|
} else if (e->GetEntryData()[0] == _T(';')) {
|
||||||
// semicolon comment
|
// semicolon comment
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
L_settable(L, -1, "kind", wxString(_T("scomment")));
|
L_settable(L, -1, "kind", wxString(_T("scomment")));
|
||||||
L_settable(L, -1, "text", e->data.Mid(1));
|
L_settable(L, -1, "text", e->GetEntryData().Mid(1));
|
||||||
} else {
|
} else {
|
||||||
// not a blank line and not a semicolon comment
|
// not a blank line and not a semicolon comment
|
||||||
// just skip...
|
// just skip...
|
||||||
|
@ -1273,7 +1273,7 @@ void AutomationScript::process_lines(AssFile *input)
|
||||||
|
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
|
|
||||||
assert(e->Type == ENTRY_DIALOGUE);
|
assert(e->GetType() == ENTRY_DIALOGUE);
|
||||||
|
|
||||||
AssDialogue *dia = e->GetAsDialogue(e);
|
AssDialogue *dia = e->GetAsDialogue(e);
|
||||||
|
|
||||||
|
@ -1435,13 +1435,12 @@ void AutomationScript::process_lines(AssFile *input)
|
||||||
while (next != input->Line.end()) {
|
while (next != input->Line.end()) {
|
||||||
cur = next++;
|
cur = next++;
|
||||||
if ((*cur)->group == _T("[Events]")) {
|
if ((*cur)->group == _T("[Events]")) {
|
||||||
if ((*cur)->data == _T("[Events]")) {
|
if ((*cur)->GetEntryData() == _T("[Events]")) {
|
||||||
// skip the section header
|
// skip the section header
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((*cur)->Type != ENTRY_DIALOGUE &&
|
wxString temp = (*cur)->GetEntryData();
|
||||||
(*cur)->data.Mid(0,1) != _T(";") &&
|
if ((*cur)->GetType() != ENTRY_DIALOGUE && temp.Mid(0,1) != _T(";") && temp.Trim() != _T("")) {
|
||||||
(*cur)->data.Trim() != _T("")) {
|
|
||||||
// skip non-dialogue non-semicolon comment lines (such as Format)
|
// skip non-dialogue non-semicolon comment lines (such as Format)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -511,7 +511,7 @@ void DialogStyleManager::OnCurrentCopy (wxCommandEvent &event) {
|
||||||
wxArrayInt selections;
|
wxArrayInt selections;
|
||||||
|
|
||||||
int n = CurrentList->GetSelections(selections);
|
int n = CurrentList->GetSelections(selections);
|
||||||
AssStyle *temp = new AssStyle(styleMap.at(selections[0])->data);
|
AssStyle *temp = new AssStyle(styleMap.at(selections[0])->GetEntryData());
|
||||||
wxString newName = _("Copy of ");
|
wxString newName = _("Copy of ");
|
||||||
newName += temp->name;
|
newName += temp->name;
|
||||||
temp->name = newName;
|
temp->name = newName;
|
||||||
|
|
|
@ -73,17 +73,17 @@ void AssTransformCleanInfoFilter::ProcessSubs(AssFile *subs) {
|
||||||
if (curEntry->group != _T("[Script Info]")) {
|
if (curEntry->group != _T("[Script Info]")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (curEntry->data.IsEmpty()) {
|
if (curEntry->GetEntryData().IsEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (curEntry->data == _T("[Script Info]")) {
|
if (curEntry->GetEntryData() == _T("[Script Info]")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (curEntry->data.Left(1) == _T(";")) {
|
if (curEntry->GetEntryData().Left(1) == _T(";")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString field = curEntry->data.Left(curEntry->data.Find(_T(':')));
|
wxString field = curEntry->GetEntryData().Left(curEntry->GetEntryData().Find(_T(':')));
|
||||||
if (field != _T("ScriptType") &&
|
if (field != _T("ScriptType") &&
|
||||||
field != _T("Collisions") &&
|
field != _T("Collisions") &&
|
||||||
field != _T("PlayResX") &&
|
field != _T("PlayResX") &&
|
||||||
|
|
|
@ -169,7 +169,7 @@ void FrameMain::OnVideoTrackSplitLine(wxCommandEvent &event) {
|
||||||
FexMovementFrame f = curline->Movement->Frames[localframe];
|
FexMovementFrame f = curline->Movement->Frames[localframe];
|
||||||
// f.Pos.x /= videoBox->videoDisplay->GetW
|
// f.Pos.x /= videoBox->videoDisplay->GetW
|
||||||
|
|
||||||
AssDialogue *cur = new AssDialogue( curline->data );
|
AssDialogue *cur = new AssDialogue( curline->GetEntryData() );
|
||||||
cur->Start.SetMS(VFR_Output.GetTimeAtFrame(Frame,true));
|
cur->Start.SetMS(VFR_Output.GetTimeAtFrame(Frame,true));
|
||||||
cur->End.SetMS(VFR_Output.GetTimeAtFrame(Frame,false));
|
cur->End.SetMS(VFR_Output.GetTimeAtFrame(Frame,false));
|
||||||
cur->Text = wxString::Format( _T("{\\pos(%.0f,%.0f)\\fscx%.2f\\fscy%.2f}"), f.Pos.x*sx, f.Pos.y*sy, f.Scale.x*100, f.Scale.y*100 ) + cur->Text;
|
cur->Text = wxString::Format( _T("{\\pos(%.0f,%.0f)\\fscx%.2f\\fscy%.2f}"), f.Pos.x*sx, f.Pos.y*sy, f.Scale.x*100, f.Scale.y*100 ) + cur->Text;
|
||||||
|
|
|
@ -717,7 +717,7 @@ void SubtitlesGrid::CopyLines(wxArrayInt target) {
|
||||||
if (!first) data += _T("\r\n");
|
if (!first) data += _T("\r\n");
|
||||||
first = false;
|
first = false;
|
||||||
cur = GetDialogue(target[i]);
|
cur = GetDialogue(target[i]);
|
||||||
data += cur->data;
|
data += cur->GetEntryData();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send to clipboard
|
// Send to clipboard
|
||||||
|
@ -950,7 +950,7 @@ void SubtitlesGrid::DuplicateLines(int n1,int n2,bool nextFrame) {
|
||||||
// Create
|
// Create
|
||||||
if (i == n2) update = true;
|
if (i == n2) update = true;
|
||||||
//cur = new AssDialogue(GetDialogue(i+step)->data);
|
//cur = new AssDialogue(GetDialogue(i+step)->data);
|
||||||
cur = new AssDialogue(GetDialogue(i)->data);
|
cur = new AssDialogue(GetDialogue(i)->GetEntryData());
|
||||||
|
|
||||||
// Shift to next frame
|
// Shift to next frame
|
||||||
if (nextFrame) {
|
if (nextFrame) {
|
||||||
|
@ -1023,7 +1023,7 @@ void SubtitlesGrid::SplitLine(int n,int pos,int mode) {
|
||||||
// Split
|
// Split
|
||||||
AssDialogue *n1,*n2;
|
AssDialogue *n1,*n2;
|
||||||
n1 = GetDialogue(n);
|
n1 = GetDialogue(n);
|
||||||
n2 = new AssDialogue(n1->data);
|
n2 = new AssDialogue(n1->GetEntryData());
|
||||||
InsertLine(n2,n,true,false);
|
InsertLine(n2,n,true,false);
|
||||||
|
|
||||||
// Modify text
|
// Modify text
|
||||||
|
|
Loading…
Reference in a new issue