mirror of https://github.com/odrling/Aegisub
Added option ("keep raw dialogue data", default false) that makes Aegisub use less RAM at a small performance cost when set to false.
Originally committed to SVN as r183.
This commit is contained in:
parent
5f6f39ce3e
commit
3c27496b29
|
@ -47,6 +47,7 @@
|
||||||
#include "FexMovement.h"
|
#include "FexMovement.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
////////////////////// AssDialogue //////////////////////
|
////////////////////// AssDialogue //////////////////////
|
||||||
// Constructs AssDialogue
|
// Constructs AssDialogue
|
||||||
AssDialogue::AssDialogue() {
|
AssDialogue::AssDialogue() {
|
||||||
|
@ -202,9 +203,14 @@ bool AssDialogue::Parse(wxString rawData, bool IsSSA) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////
|
//////////////////
|
||||||
// Update AssDialogue's data line
|
// Keep data flag
|
||||||
void AssDialogue::UpdateData () {
|
bool AssDialogue::keepData = true;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////
|
||||||
|
// Make data
|
||||||
|
wxString AssDialogue::MakeData() {
|
||||||
// Prepare
|
// Prepare
|
||||||
wxString final = _T("");
|
wxString final = _T("");
|
||||||
|
|
||||||
|
@ -233,7 +239,29 @@ void AssDialogue::UpdateData () {
|
||||||
Effect.Replace(_T(","),_T(";"));
|
Effect.Replace(_T(","),_T(";"));
|
||||||
final += Effect + _T(",");
|
final += Effect + _T(",");
|
||||||
final += Text;
|
final += Text;
|
||||||
SetEntryData(final);
|
return final;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////
|
||||||
|
// Update AssDialogue's data line
|
||||||
|
void AssDialogue::UpdateData () {
|
||||||
|
if (keepData) SetEntryData(MakeData());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////
|
||||||
|
// Get entry data
|
||||||
|
const wxString AssDialogue::GetEntryData() {
|
||||||
|
if (keepData) return AssEntry::GetEntryData();
|
||||||
|
return MakeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////
|
||||||
|
// Set entry data
|
||||||
|
void AssDialogue::SetEntryData(wxString newData) {
|
||||||
|
if (keepData) AssEntry::SetEntryData(newData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,12 @@ public:
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// Class for Dialogue and Comment lines
|
// Class for Dialogue and Comment lines
|
||||||
class AssDialogue : public AssEntry {
|
class AssDialogue : public AssEntry {
|
||||||
|
private:
|
||||||
|
wxString MakeData();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static bool keepData;
|
||||||
|
|
||||||
std::vector<AssDialogueBlock*> Blocks; // Contains information about each block of text
|
std::vector<AssDialogueBlock*> Blocks; // Contains information about each block of text
|
||||||
|
|
||||||
bool Comment; // Is this a comment line?
|
bool Comment; // Is this a comment line?
|
||||||
|
@ -179,8 +184,12 @@ public:
|
||||||
bool Parse(wxString data,bool IsSSA=false); // Parses raw ASS data into everything else
|
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
|
||||||
void UpdateText(); // Generates text from the override tags
|
void UpdateText(); // Generates text from the override tags
|
||||||
|
const wxString GetEntryData();
|
||||||
|
void SetEntryData(wxString newData);
|
||||||
|
|
||||||
void ConvertTagsToSRT(); // Converts tags to SRT format
|
void ConvertTagsToSRT(); // Converts tags to SRT format
|
||||||
void StripTags(); // Strips all tags from the text
|
void StripTags(); // Strips all tags from the text
|
||||||
void Clear(); // Wipes all data
|
void Clear(); // Wipes all data
|
||||||
|
|
|
@ -678,10 +678,6 @@ wxArrayString AssFile::GetStyles() {
|
||||||
if (curstyle) {
|
if (curstyle) {
|
||||||
styles.Add(curstyle->name);
|
styles.Add(curstyle->name);
|
||||||
}
|
}
|
||||||
if (!curstyle && (*cur)->GetEntryData().Left(5) == _T("Style")) {
|
|
||||||
wxLogMessage(_T("Style ignored: ") + (*cur)->GetEntryData());
|
|
||||||
curstyle = AssEntry::GetAsStyle(*cur);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (styles.GetCount() == 0) styles.Add(_T("Default"));
|
if (styles.GetCount() == 0) styles.Add(_T("Default"));
|
||||||
return styles;
|
return styles;
|
||||||
|
|
|
@ -1252,14 +1252,15 @@ void AutomationScript::process_lines(AssFile *input)
|
||||||
// not a dialogue/comment event
|
// not a dialogue/comment event
|
||||||
|
|
||||||
// start checking for a blank line
|
// start checking for a blank line
|
||||||
if (e->GetEntryData().IsEmpty()) {
|
wxString entryData = e->GetEntryData();
|
||||||
|
if (entryData.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->GetEntryData()[0] == _T(';')) {
|
} else if (entryData[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->GetEntryData().Mid(1));
|
L_settable(L, -1, "text", entryData.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...
|
||||||
|
@ -1435,11 +1436,11 @@ 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)->GetEntryData() == _T("[Events]")) {
|
wxString temp = (*cur)->GetEntryData();
|
||||||
|
if (temp == _T("[Events]")) {
|
||||||
// skip the section header
|
// skip the section header
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
wxString temp = (*cur)->GetEntryData();
|
|
||||||
if ((*cur)->GetType() != ENTRY_DIALOGUE && temp.Mid(0,1) != _T(";") && temp.Trim() != _T("")) {
|
if ((*cur)->GetType() != ENTRY_DIALOGUE && temp.Mid(0,1) != _T(";") && temp.Trim() != _T("")) {
|
||||||
// skip non-dialogue non-semicolon comment lines (such as Format)
|
// skip non-dialogue non-semicolon comment lines (such as Format)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -52,6 +52,7 @@ Please visit http://aegisub.net to download latest version
|
||||||
- Better error reporting when loading Automation scripts (jfs)
|
- Better error reporting when loading Automation scripts (jfs)
|
||||||
- Attempting to load a file which does not exist no longer unloads previous subtitles. (AMZ)
|
- Attempting to load a file which does not exist no longer unloads previous subtitles. (AMZ)
|
||||||
- Dragging timecode files into the Aegisub window will now work as expected (instead of attempting to load it as subtitles). (AMZ)
|
- Dragging timecode files into the Aegisub window will now work as expected (instead of attempting to load it as subtitles). (AMZ)
|
||||||
|
- Added option ("keep raw dialogue data", default false) that makes Aegisub use less RAM at a small performance cost when set to false. (AMZ)
|
||||||
|
|
||||||
|
|
||||||
= 1.09 beta - 2006.01.16 ===========================
|
= 1.09 beta - 2006.01.16 ===========================
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
#include "export_framerate.h"
|
#include "export_framerate.h"
|
||||||
#include "ass_export_filter.h"
|
#include "ass_export_filter.h"
|
||||||
#include "ass_time.h"
|
#include "ass_time.h"
|
||||||
|
#include "ass_dialogue.h"
|
||||||
#include "subs_grid.h"
|
#include "subs_grid.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,6 +81,7 @@ bool AegisubApp::OnInit() {
|
||||||
Options.SetFile(folderName + _T("/config.dat"));
|
Options.SetFile(folderName + _T("/config.dat"));
|
||||||
Options.Load();
|
Options.Load();
|
||||||
AssTime::UseMSPrecision = Options.AsBool(_T("Use nonstandard Milisecond Times"));
|
AssTime::UseMSPrecision = Options.AsBool(_T("Use nonstandard Milisecond Times"));
|
||||||
|
AssDialogue::keepData = Options.AsBool(_T("Keep raw dialogue data"));
|
||||||
|
|
||||||
// Set hotkeys file
|
// Set hotkeys file
|
||||||
Hotkeys.SetFile(folderName + _T("/hotkeys.dat"));
|
Hotkeys.SetFile(folderName + _T("/hotkeys.dat"));
|
||||||
|
|
|
@ -69,6 +69,7 @@ void OptionsManager::LoadDefaults() {
|
||||||
SetInt(_T("Locale Code"),-1);
|
SetInt(_T("Locale Code"),-1);
|
||||||
SetText(_T("Save Charset"),_T("UTF-8"));
|
SetText(_T("Save Charset"),_T("UTF-8"));
|
||||||
SetBool(_T("Use nonstandard Milisecond Times"),false);
|
SetBool(_T("Use nonstandard Milisecond Times"),false);
|
||||||
|
SetBool(_T("Keep raw dialogue data"),false);
|
||||||
|
|
||||||
SetInt(_T("Undo Levels"),8);
|
SetInt(_T("Undo Levels"),8);
|
||||||
SetInt(_T("Recent sub max"),16);
|
SetInt(_T("Recent sub max"),16);
|
||||||
|
|
Loading…
Reference in New Issue