Implemented redo, and replace == _T("") with .IsEmpty()
Originally committed to SVN as r80.
This commit is contained in:
parent
14e54bce4e
commit
26b15d3d09
|
@ -115,7 +115,7 @@ void AssExportFilter::Unregister () {
|
||||||
// Checks if it's registered
|
// Checks if it's registered
|
||||||
bool AssExportFilter::IsRegistered() {
|
bool AssExportFilter::IsRegistered() {
|
||||||
// Check name
|
// Check name
|
||||||
if (RegisterName == _T("")) {
|
if (RegisterName.IsEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ void AssExporter::Export(wxString filename, wxString charset) {
|
||||||
if (withCharset) {
|
if (withCharset) {
|
||||||
wxArrayString choices = FrameMain::GetEncodings();
|
wxArrayString choices = FrameMain::GetEncodings();
|
||||||
charset = wxGetSingleChoice(_T("Choose charset code:"), _T("Charset"),choices,NULL,-1, -1,true,250,200);
|
charset = wxGetSingleChoice(_T("Choose charset code:"), _T("Charset"),choices,NULL,-1, -1,true,250,200);
|
||||||
if (charset == _T("")) {
|
if (charset.IsEmpty()) {
|
||||||
delete Subs;
|
delete Subs;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ void AssFile::Load (const wxString _filename,const wxString charset) {
|
||||||
|
|
||||||
// Find file encoding
|
// Find file encoding
|
||||||
wxString enc;
|
wxString enc;
|
||||||
if (charset == _T("")) enc = TextFileReader::GetEncoding(_filename);
|
if (charset.IsEmpty()) enc = TextFileReader::GetEncoding(_filename);
|
||||||
else enc = charset;
|
else enc = charset;
|
||||||
TextFileReader::EnsureValid(enc);
|
TextFileReader::EnsureValid(enc);
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ void AssFile::LoadSRT (wxString _filename,wxString encoding) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 0:
|
case 0:
|
||||||
// Checks if there is anything to read
|
// Checks if there is anything to read
|
||||||
if (curline == _T("")) continue;
|
if (curline.IsEmpty()) continue;
|
||||||
|
|
||||||
// Check if it's a line number
|
// Check if it's a line number
|
||||||
if (!curline.IsNumber()) {
|
if (!curline.IsNumber()) {
|
||||||
|
@ -258,7 +258,7 @@ void AssFile::LoadSRT (wxString _filename,wxString encoding) {
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
// Checks if it's done
|
// Checks if it's done
|
||||||
if (curline == _T("")) {
|
if (curline.IsEmpty()) {
|
||||||
mode = 0;
|
mode = 0;
|
||||||
linen++;
|
linen++;
|
||||||
line->group = _T("[Events]");
|
line->group = _T("[Events]");
|
||||||
|
@ -333,7 +333,7 @@ void AssFile::LoadTXT (wxString _filename,wxString encoding) {
|
||||||
line->Style = _T("Default");
|
line->Style = _T("Default");
|
||||||
if (isComment) line->Actor = _T("");
|
if (isComment) line->Actor = _T("");
|
||||||
else line->Actor = actor;
|
else line->Actor = actor;
|
||||||
if (value == _T("")) {
|
if (value.IsEmpty()) {
|
||||||
line->Actor = _T("");
|
line->Actor = _T("");
|
||||||
isComment = true;
|
isComment = true;
|
||||||
}
|
}
|
||||||
|
@ -934,6 +934,16 @@ bool AssFile::IsModified() {
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// Flag file as modified
|
// Flag file as modified
|
||||||
void AssFile::FlagAsModified() {
|
void AssFile::FlagAsModified() {
|
||||||
|
// Clear redo
|
||||||
|
if (!RedoStack.empty()) {
|
||||||
|
//StackPush();
|
||||||
|
//UndoStack.push_back(new AssFile(*UndoStack.back()));
|
||||||
|
for (std::list<AssFile*>::iterator cur=RedoStack.begin();cur!=RedoStack.end();cur++) {
|
||||||
|
delete *cur;
|
||||||
|
}
|
||||||
|
RedoStack.clear();
|
||||||
|
}
|
||||||
|
|
||||||
Modified = true;
|
Modified = true;
|
||||||
StackPush();
|
StackPush();
|
||||||
}
|
}
|
||||||
|
@ -944,18 +954,18 @@ void AssFile::FlagAsModified() {
|
||||||
void AssFile::StackPush() {
|
void AssFile::StackPush() {
|
||||||
// Places copy on stack
|
// Places copy on stack
|
||||||
AssFile *curcopy = new AssFile(*top);
|
AssFile *curcopy = new AssFile(*top);
|
||||||
SubsStack.push_back(curcopy);
|
UndoStack.push_back(curcopy);
|
||||||
StackModified = true;
|
StackModified = true;
|
||||||
|
|
||||||
// Cap depth
|
// Cap depth
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (std::list<AssFile*>::iterator cur=SubsStack.begin();cur!=SubsStack.end();cur++) {
|
for (std::list<AssFile*>::iterator cur=UndoStack.begin();cur!=UndoStack.end();cur++) {
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
int depth = Options.AsInt(_T("Undo levels"));
|
int depth = Options.AsInt(_T("Undo levels"));
|
||||||
while (n > depth) {
|
while (n > depth) {
|
||||||
delete SubsStack.front();
|
delete UndoStack.front();
|
||||||
SubsStack.pop_front();
|
UndoStack.pop_front();
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -966,15 +976,16 @@ void AssFile::StackPush() {
|
||||||
void AssFile::StackPop() {
|
void AssFile::StackPop() {
|
||||||
bool addcopy = false;
|
bool addcopy = false;
|
||||||
if (StackModified) {
|
if (StackModified) {
|
||||||
SubsStack.pop_back();
|
UndoStack.pop_back();
|
||||||
StackModified = false;
|
StackModified = false;
|
||||||
addcopy = true;
|
addcopy = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SubsStack.empty()) {
|
if (!UndoStack.empty()) {
|
||||||
delete top;
|
//delete top;
|
||||||
top = SubsStack.back();
|
RedoStack.push_back(top);
|
||||||
SubsStack.pop_back();
|
top = UndoStack.back();
|
||||||
|
UndoStack.pop_back();
|
||||||
Popping = true;
|
Popping = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -984,13 +995,46 @@ void AssFile::StackPop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////
|
||||||
|
// Stack redo
|
||||||
|
void AssFile::StackRedo() {
|
||||||
|
|
||||||
|
bool addcopy = false;
|
||||||
|
if (StackModified) {
|
||||||
|
UndoStack.pop_back();
|
||||||
|
StackModified = false;
|
||||||
|
addcopy = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!RedoStack.empty()) {
|
||||||
|
UndoStack.push_back(top);
|
||||||
|
top = RedoStack.back();
|
||||||
|
RedoStack.pop_back();
|
||||||
|
Popping = true;
|
||||||
|
//StackModified = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (addcopy) {
|
||||||
|
StackPush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// Stack clear
|
// Stack clear
|
||||||
void AssFile::StackClear() {
|
void AssFile::StackClear() {
|
||||||
for (std::list<AssFile*>::iterator cur=SubsStack.begin();cur!=SubsStack.end();cur++) {
|
// Clear undo
|
||||||
|
for (std::list<AssFile*>::iterator cur=UndoStack.begin();cur!=UndoStack.end();cur++) {
|
||||||
delete *cur;
|
delete *cur;
|
||||||
}
|
}
|
||||||
SubsStack.clear();
|
UndoStack.clear();
|
||||||
|
|
||||||
|
// Clear redo
|
||||||
|
for (std::list<AssFile*>::iterator cur=RedoStack.begin();cur!=RedoStack.end();cur++) {
|
||||||
|
delete *cur;
|
||||||
|
}
|
||||||
|
RedoStack.clear();
|
||||||
|
|
||||||
Popping = false;
|
Popping = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1005,18 +1049,26 @@ void AssFile::StackReset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////
|
//////////////////////////////////
|
||||||
// Returns if stack is empty
|
// Returns if undo stack is empty
|
||||||
bool AssFile::StackEmpty() {
|
bool AssFile::IsUndoStackEmpty() {
|
||||||
if (StackModified) return (SubsStack.size() <= 1);
|
if (StackModified) return (UndoStack.size() <= 1);
|
||||||
else return SubsStack.empty();
|
else return UndoStack.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////
|
||||||
|
// Returns if redo stack is empty
|
||||||
|
bool AssFile::IsRedoStackEmpty() {
|
||||||
|
return RedoStack.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
// Global
|
// Global
|
||||||
AssFile *AssFile::top;
|
AssFile *AssFile::top;
|
||||||
std::list<AssFile*> AssFile::SubsStack;
|
std::list<AssFile*> AssFile::UndoStack;
|
||||||
|
std::list<AssFile*> AssFile::RedoStack;
|
||||||
bool AssFile::Popping;
|
bool AssFile::Popping;
|
||||||
bool AssFile::StackModified;
|
bool AssFile::StackModified;
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,8 @@ private:
|
||||||
bool Modified;
|
bool Modified;
|
||||||
|
|
||||||
// Stack operations
|
// Stack operations
|
||||||
static std::list<AssFile*> SubsStack;
|
static std::list<AssFile*> UndoStack;
|
||||||
|
static std::list<AssFile*> RedoStack;
|
||||||
static bool StackModified;
|
static bool StackModified;
|
||||||
static void StackClear();
|
static void StackClear();
|
||||||
|
|
||||||
|
@ -112,9 +113,11 @@ public:
|
||||||
void AddComment(const wxString comment); // Adds a ";" comment under [Script Info].
|
void AddComment(const wxString comment); // Adds a ";" comment under [Script Info].
|
||||||
|
|
||||||
static void StackPop(); // Pop subs from stack and sets 'top' to it
|
static void StackPop(); // Pop subs from stack and sets 'top' to it
|
||||||
|
static void StackRedo(); // Redoes action on stack
|
||||||
static void StackPush(); // Puts a copy of 'top' on the stack
|
static void StackPush(); // Puts a copy of 'top' on the stack
|
||||||
static void StackReset(); // Resets stack. Do this before loading new subtitles.
|
static void StackReset(); // Resets stack. Do this before loading new subtitles.
|
||||||
static bool StackEmpty(); // Checks if stack is empty
|
static bool IsUndoStackEmpty(); // Checks if undo stack is empty
|
||||||
|
static bool IsRedoStackEmpty(); // Checks if undo stack is empty
|
||||||
static bool Popping; // Flags the stack as popping. You must unset this after popping
|
static bool Popping; // Flags the stack as popping. You must unset this after popping
|
||||||
static AssFile *top; // Current script file. It is "above" the stack.
|
static AssFile *top; // Current script file. It is "above" the stack.
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
///////////////////////
|
///////////////////////
|
||||||
// Save styles to disk
|
// Save styles to disk
|
||||||
void AssStyleStorage::Save(wxString name) {
|
void AssStyleStorage::Save(wxString name) {
|
||||||
if (name == _T("")) return;
|
if (name.IsEmpty()) return;
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
ofstream file;
|
ofstream file;
|
||||||
|
@ -68,7 +68,7 @@ void AssStyleStorage::Save(wxString name) {
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// Load styles from disk
|
// Load styles from disk
|
||||||
void AssStyleStorage::Load(wxString name) {
|
void AssStyleStorage::Load(wxString name) {
|
||||||
if (name == _T("")) return;
|
if (name.IsEmpty()) return;
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
char buffer[65536];
|
char buffer[65536];
|
||||||
|
|
|
@ -210,7 +210,7 @@ void AssTime::UpdateFromTextCtrl(wxTextCtrl *ctrl) {
|
||||||
start++;
|
start++;
|
||||||
end++;
|
end++;
|
||||||
}
|
}
|
||||||
else if (nextChar == _T("")) text.Remove(start-1,1);
|
else if (nextChar.IsEmpty()) text.Remove(start-1,1);
|
||||||
else text.Remove(start,1);
|
else text.Remove(start,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -736,7 +736,7 @@ void AudioDisplay::SetScale(float _scale) {
|
||||||
//////////////////
|
//////////////////
|
||||||
// Load from file
|
// Load from file
|
||||||
void AudioDisplay::SetFile(wxString file) {
|
void AudioDisplay::SetFile(wxString file) {
|
||||||
if (file == _T("")) {
|
if (file.IsEmpty()) {
|
||||||
if (provider)
|
if (provider)
|
||||||
delete provider;
|
delete provider;
|
||||||
provider = NULL;
|
provider = NULL;
|
||||||
|
|
|
@ -252,7 +252,7 @@ bool AudioKaraoke::ParseDialogue(AssDialogue *curDiag) {
|
||||||
// Set syllable
|
// Set syllable
|
||||||
void AudioKaraoke::SetSyllable(int n) {
|
void AudioKaraoke::SetSyllable(int n) {
|
||||||
if (n == -1) n = syllables.size()-1;
|
if (n == -1) n = syllables.size()-1;
|
||||||
if (n >= syllables.size()) n = 0;
|
if (n >= (signed) syllables.size()) n = 0;
|
||||||
curSyllable = n;
|
curSyllable = n;
|
||||||
startClickSyl = n;
|
startClickSyl = n;
|
||||||
SetSelection(n);
|
SetSelection(n);
|
||||||
|
|
|
@ -1252,7 +1252,7 @@ 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->data == _T("")) {
|
if (e->data.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->data[0] == _T(';')) {
|
||||||
|
|
|
@ -64,7 +64,7 @@ BaseGrid::BaseGrid(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wx
|
||||||
|
|
||||||
// Set font
|
// Set font
|
||||||
wxString fontname = Options.AsText(_T("Font Face"));
|
wxString fontname = Options.AsText(_T("Font Face"));
|
||||||
if (fontname == _T("")) fontname = _T("Tahoma");
|
if (fontname.IsEmpty()) fontname = _T("Tahoma");
|
||||||
font.SetFaceName(fontname);
|
font.SetFaceName(fontname);
|
||||||
font.SetPointSize(Options.AsInt(_T("Grid font size")));
|
font.SetPointSize(Options.AsInt(_T("Grid font size")));
|
||||||
font.SetWeight(wxFONTWEIGHT_NORMAL);
|
font.SetWeight(wxFONTWEIGHT_NORMAL);
|
||||||
|
|
BIN
core/bitmaps/redo.bmp
Normal file
BIN
core/bitmaps/redo.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
core/bitmaps/redo_disable.bmp
Normal file
BIN
core/bitmaps/redo_disable.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
|
@ -221,7 +221,7 @@ void DialogShiftTimes::OnOK(wxCommandEvent &event) {
|
||||||
wxString message = _T("");
|
wxString message = _T("");
|
||||||
wxFileName assfile(AssFile::top->filename);
|
wxFileName assfile(AssFile::top->filename);
|
||||||
wxString filename = assfile.GetFullName();
|
wxString filename = assfile.GetFullName();
|
||||||
if (filename == _T("")) message << _("unsaved, ");
|
if (filename.IsEmpty()) message << _("unsaved, ");
|
||||||
else message << filename << _T(", ");
|
else message << filename << _T(", ");
|
||||||
if (byTime) message << ShiftTime->GetValue() << _T(" ");
|
if (byTime) message << ShiftTime->GetValue() << _T(" ");
|
||||||
else message << len << _(" frames ");
|
else message << len << _(" frames ");
|
||||||
|
@ -286,7 +286,7 @@ void DialogShiftTimes::OnRadioFrame(wxCommandEvent &event) {
|
||||||
// Appends a line to history
|
// Appends a line to history
|
||||||
void DialogShiftTimes::AppendToHistory(wxString text) {
|
void DialogShiftTimes::AppendToHistory(wxString text) {
|
||||||
// Open file
|
// Open file
|
||||||
if (HistoryFile == _T("")) return;
|
if (HistoryFile.IsEmpty()) return;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
ofstream file;
|
ofstream file;
|
||||||
file.open(HistoryFile.mb_str(wxConvLocal),ios::out | ios::app);
|
file.open(HistoryFile.mb_str(wxConvLocal),ios::out | ios::app);
|
||||||
|
|
|
@ -174,7 +174,7 @@ void DialogStyleManager::LoadCatalog () {
|
||||||
// Set to default if available
|
// Set to default if available
|
||||||
StorageActions(false);
|
StorageActions(false);
|
||||||
wxString pickStyle = AssFile::top->GetScriptInfo(_T("Last Style Storage"));
|
wxString pickStyle = AssFile::top->GetScriptInfo(_T("Last Style Storage"));
|
||||||
if (pickStyle == _T("")) pickStyle = _T("Default");
|
if (pickStyle.IsEmpty()) pickStyle = _T("Default");
|
||||||
int opt = CatalogList->FindString(pickStyle);
|
int opt = CatalogList->FindString(pickStyle);
|
||||||
if (opt != wxNOT_FOUND) {
|
if (opt != wxNOT_FOUND) {
|
||||||
CatalogList->SetSelection(opt);
|
CatalogList->SetSelection(opt);
|
||||||
|
|
|
@ -192,7 +192,7 @@ void DialogStyling::JumpToLine(int n) {
|
||||||
|
|
||||||
// Set focus
|
// Set focus
|
||||||
TypeBox->SetFocus();
|
TypeBox->SetFocus();
|
||||||
if (TypeBox->GetValue() == _T("")) TypeBox->SetValue(Styles->GetString(0));
|
if (TypeBox->GetValue().IsEmpty()) TypeBox->SetValue(Styles->GetString(0));
|
||||||
TypeBox->SetSelection(0,TypeBox->GetValue().Length());
|
TypeBox->SetSelection(0,TypeBox->GetValue().Length());
|
||||||
|
|
||||||
// Update grid
|
// Update grid
|
||||||
|
|
|
@ -283,7 +283,7 @@ void DialogTranslation::OnTransBoxKey(wxKeyEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next
|
// Next
|
||||||
if (Hotkeys.IsPressed(_T("Translation Assistant Next")) || (Hotkeys.IsPressed(_T("Translation Assistant Accept")) && TransText->GetValue() == _T(""))) {
|
if (Hotkeys.IsPressed(_T("Translation Assistant Next")) || (Hotkeys.IsPressed(_T("Translation Assistant Accept")) && TransText->GetValue().IsEmpty())) {
|
||||||
bool ok = JumpToLine(curline,curblock+1);
|
bool ok = JumpToLine(curline,curblock+1);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
TransText->Clear();
|
TransText->Clear();
|
||||||
|
|
|
@ -73,7 +73,7 @@ void AssTransformCleanInfoFilter::ProcessSubs(AssFile *subs) {
|
||||||
if (curEntry->group != _T("[Script Info]")) {
|
if (curEntry->group != _T("[Script Info]")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (curEntry->data == _T("")) {
|
if (curEntry->data.IsEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (curEntry->data == _T("[Script Info]")) {
|
if (curEntry->data == _T("[Script Info]")) {
|
||||||
|
|
|
@ -229,6 +229,7 @@ void FrameMain::InitMenu() {
|
||||||
// Create Edit menu
|
// Create Edit menu
|
||||||
editMenu = new wxMenu();
|
editMenu = new wxMenu();
|
||||||
AppendBitmapMenuItem (editMenu,Menu_Edit_Undo, _("&Undo\t") + Hotkeys.GetText(_T("Undo")), _("Undoes last action"),wxBITMAP(undo_button));
|
AppendBitmapMenuItem (editMenu,Menu_Edit_Undo, _("&Undo\t") + Hotkeys.GetText(_T("Undo")), _("Undoes last action"),wxBITMAP(undo_button));
|
||||||
|
AppendBitmapMenuItem (editMenu,Menu_Edit_Redo, _("&Redo\t") + Hotkeys.GetText(_T("Redo")), _("Redoes last action"),wxBITMAP(redo_button));
|
||||||
editMenu->AppendSeparator();
|
editMenu->AppendSeparator();
|
||||||
editMenu->Append(Menu_Edit_Select, _("&Select lines...\t") + Hotkeys.GetText(_T("Select lines")), _("Selects lines based on defined criterea"));
|
editMenu->Append(Menu_Edit_Select, _("&Select lines...\t") + Hotkeys.GetText(_T("Select lines")), _("Selects lines based on defined criterea"));
|
||||||
editMenu->Append(Menu_Edit_Shift, _("S&hift times...\t") + Hotkeys.GetText(_T("Shift times")), _("Shift subtitles by time or frames"));
|
editMenu->Append(Menu_Edit_Shift, _("S&hift times...\t") + Hotkeys.GetText(_T("Shift times")), _("Shift subtitles by time or frames"));
|
||||||
|
@ -508,7 +509,7 @@ void FrameMain::LoadSubtitles (wxString filename,wxString charset) {
|
||||||
if (Options.AsBool(_T("Auto backup")) && origfile.FileExists()) {
|
if (Options.AsBool(_T("Auto backup")) && origfile.FileExists()) {
|
||||||
// Get path
|
// Get path
|
||||||
wxString path = Options.AsText(_T("Auto backup path"));
|
wxString path = Options.AsText(_T("Auto backup path"));
|
||||||
if (path == _T("")) path = origfile.GetPath();
|
if (path.IsEmpty()) path = origfile.GetPath();
|
||||||
wxFileName dstpath(path);
|
wxFileName dstpath(path);
|
||||||
if (!dstpath.IsAbsolute()) path = AegisubApp::folderName + path;
|
if (!dstpath.IsAbsolute()) path = AegisubApp::folderName + path;
|
||||||
path += _T("/");
|
path += _T("/");
|
||||||
|
@ -536,7 +537,7 @@ bool FrameMain::SaveSubtitles(bool saveas,bool withCharset) {
|
||||||
if (saveas == false && AssFile::top->IsASS) filename = AssFile::top->filename;
|
if (saveas == false && AssFile::top->IsASS) filename = AssFile::top->filename;
|
||||||
|
|
||||||
// Failed, ask user
|
// Failed, ask user
|
||||||
if (filename == _T("")) {
|
if (filename.IsEmpty()) {
|
||||||
videoBox->videoDisplay->Stop();
|
videoBox->videoDisplay->Stop();
|
||||||
filename = wxFileSelector(_("Save subtitles file"),_T(""),_T(""),_T(""),_T("Advanced Substation Alpha (*.ass)|*.ass"),wxSAVE | wxOVERWRITE_PROMPT,this);
|
filename = wxFileSelector(_("Save subtitles file"),_T(""),_T(""),_T(""),_T("Advanced Substation Alpha (*.ass)|*.ass"),wxSAVE | wxOVERWRITE_PROMPT,this);
|
||||||
AssFile::top->filename = filename; //fix me, ghetto hack for correct relative path generation in SynchronizeProject()
|
AssFile::top->filename = filename; //fix me, ghetto hack for correct relative path generation in SynchronizeProject()
|
||||||
|
@ -552,7 +553,7 @@ bool FrameMain::SaveSubtitles(bool saveas,bool withCharset) {
|
||||||
if (withCharset) {
|
if (withCharset) {
|
||||||
wxArrayString choices = GetEncodings();
|
wxArrayString choices = GetEncodings();
|
||||||
charset = wxGetSingleChoice(_("Choose charset code:"), _T("Charset"),choices,this,-1, -1,true,250,200);
|
charset = wxGetSingleChoice(_("Choose charset code:"), _T("Charset"),choices,this,-1, -1,true,250,200);
|
||||||
if (charset == _T("")) return false;
|
if (charset.IsEmpty()) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
|
@ -1073,9 +1074,9 @@ bool FrameMain::LoadList(wxArrayString list) {
|
||||||
wxFileName file(List[i]);
|
wxFileName file(List[i]);
|
||||||
ext = file.GetExt().Lower();
|
ext = file.GetExt().Lower();
|
||||||
|
|
||||||
if (subs == _T("") && subsList.Index(ext) != wxNOT_FOUND) subs = List[i];
|
if (subs.IsEmpty() && subsList.Index(ext) != wxNOT_FOUND) subs = List[i];
|
||||||
if (video == _T("") && videoList.Index(ext) != wxNOT_FOUND) video = List[i];
|
if (video.IsEmpty() && videoList.Index(ext) != wxNOT_FOUND) video = List[i];
|
||||||
if (audio == _T("") && audioList.Index(ext) != wxNOT_FOUND) audio = List[i];
|
if (audio.IsEmpty() && audioList.Index(ext) != wxNOT_FOUND) audio = List[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set blocking
|
// Set blocking
|
||||||
|
|
|
@ -167,6 +167,7 @@ private:
|
||||||
void OnViewSubs (wxCommandEvent &event);
|
void OnViewSubs (wxCommandEvent &event);
|
||||||
|
|
||||||
void OnUndo (wxCommandEvent &event);
|
void OnUndo (wxCommandEvent &event);
|
||||||
|
void OnRedo (wxCommandEvent &event);
|
||||||
void OnCut (wxCommandEvent &event);
|
void OnCut (wxCommandEvent &event);
|
||||||
void OnCopy (wxCommandEvent &event);
|
void OnCopy (wxCommandEvent &event);
|
||||||
void OnPaste (wxCommandEvent &event);
|
void OnPaste (wxCommandEvent &event);
|
||||||
|
@ -280,6 +281,7 @@ enum {
|
||||||
|
|
||||||
Menu_Edit_Select,
|
Menu_Edit_Select,
|
||||||
Menu_Edit_Undo,
|
Menu_Edit_Undo,
|
||||||
|
Menu_Edit_Redo,
|
||||||
Menu_Edit_Find,
|
Menu_Edit_Find,
|
||||||
Menu_Edit_Find_Next,
|
Menu_Edit_Find_Next,
|
||||||
Menu_Edit_Replace,
|
Menu_Edit_Replace,
|
||||||
|
|
|
@ -142,6 +142,7 @@ BEGIN_EVENT_TABLE(FrameMain, wxFrame)
|
||||||
EVT_MENU(Menu_Audio_Close, FrameMain::OnCloseAudio)
|
EVT_MENU(Menu_Audio_Close, FrameMain::OnCloseAudio)
|
||||||
|
|
||||||
EVT_MENU(Menu_Edit_Undo, FrameMain::OnUndo)
|
EVT_MENU(Menu_Edit_Undo, FrameMain::OnUndo)
|
||||||
|
EVT_MENU(Menu_Edit_Redo, FrameMain::OnRedo)
|
||||||
EVT_MENU(Menu_Edit_Cut, FrameMain::OnCut)
|
EVT_MENU(Menu_Edit_Cut, FrameMain::OnCut)
|
||||||
EVT_MENU(Menu_Edit_Copy, FrameMain::OnCopy)
|
EVT_MENU(Menu_Edit_Copy, FrameMain::OnCopy)
|
||||||
EVT_MENU(Menu_Edit_Paste, FrameMain::OnPaste)
|
EVT_MENU(Menu_Edit_Paste, FrameMain::OnPaste)
|
||||||
|
@ -317,9 +318,9 @@ void FrameMain::OnMenuOpen (wxMenuEvent &event) {
|
||||||
|
|
||||||
// Edit menu
|
// Edit menu
|
||||||
else if (curMenu == editMenu) {
|
else if (curMenu == editMenu) {
|
||||||
|
|
||||||
// Undo state
|
// Undo state
|
||||||
RebuildMenuItem(editMenu,Menu_Edit_Undo,wxBITMAP(undo_button),wxBITMAP(undo_disable_button),!AssFile::StackEmpty());
|
RebuildMenuItem(editMenu,Menu_Edit_Undo,wxBITMAP(undo_button),wxBITMAP(undo_disable_button),!AssFile::IsUndoStackEmpty());
|
||||||
|
RebuildMenuItem(editMenu,Menu_Edit_Redo,wxBITMAP(redo_button),wxBITMAP(redo_disable_button),!AssFile::IsRedoStackEmpty());
|
||||||
|
|
||||||
// Copy/cut/paste
|
// Copy/cut/paste
|
||||||
wxArrayInt sels = SubsBox->GetSelection();
|
wxArrayInt sels = SubsBox->GetSelection();
|
||||||
|
@ -655,7 +656,7 @@ void FrameMain::OnOpenSpellCheck (wxCommandEvent &event) {
|
||||||
wxArrayInt selList = SubsBox->GetSelection();
|
wxArrayInt selList = SubsBox->GetSelection();
|
||||||
if (selList.GetCount() == 1){
|
if (selList.GetCount() == 1){
|
||||||
AssDialogue * a = SubsBox->GetDialogue(selList.Item(0));
|
AssDialogue * a = SubsBox->GetDialogue(selList.Item(0));
|
||||||
if (a->Text == _T("")){
|
if (a->Text.IsEmpty()){
|
||||||
wxMessageDialog Question(this, _T(
|
wxMessageDialog Question(this, _T(
|
||||||
"You've selected a single row with no text. Instead would you like to check the entire document?"),
|
"You've selected a single row with no text. Instead would you like to check the entire document?"),
|
||||||
_T("Single Row Selection"),
|
_T("Single Row Selection"),
|
||||||
|
@ -877,6 +878,16 @@ void FrameMain::OnUndo(wxCommandEvent& WXUNUSED(event)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////
|
||||||
|
// Redo
|
||||||
|
void FrameMain::OnRedo(wxCommandEvent& WXUNUSED(event)) {
|
||||||
|
videoBox->videoDisplay->Stop();
|
||||||
|
AssFile::StackRedo();
|
||||||
|
SubsBox->LoadFromAss(AssFile::top,true);
|
||||||
|
AssFile::Popping = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////
|
////////
|
||||||
// Find
|
// Find
|
||||||
void FrameMain::OnFind(wxCommandEvent &event) {
|
void FrameMain::OnFind(wxCommandEvent &event) {
|
||||||
|
@ -1001,7 +1012,7 @@ void FrameMain::OnAutoSave(wxTimerEvent &event) {
|
||||||
// Set path
|
// Set path
|
||||||
wxFileName origfile(AssFile::top->filename);
|
wxFileName origfile(AssFile::top->filename);
|
||||||
wxString path = Options.AsText(_T("Auto save path"));
|
wxString path = Options.AsText(_T("Auto save path"));
|
||||||
if (path == _T("")) path = origfile.GetPath();
|
if (path.IsEmpty()) path = origfile.GetPath();
|
||||||
wxFileName dstpath(path);
|
wxFileName dstpath(path);
|
||||||
if (!dstpath.IsAbsolute()) path = AegisubApp::folderName + path;
|
if (!dstpath.IsAbsolute()) path = AegisubApp::folderName + path;
|
||||||
path += _T("/");
|
path += _T("/");
|
||||||
|
|
|
@ -274,7 +274,7 @@ void HotkeyManager::Load() {
|
||||||
while (file.HasMoreLines()) {
|
while (file.HasMoreLines()) {
|
||||||
// Parse line
|
// Parse line
|
||||||
curLine = file.ReadLineFromFile();
|
curLine = file.ReadLineFromFile();
|
||||||
if (curLine == _T("")) continue;
|
if (curLine.IsEmpty()) continue;
|
||||||
size_t pos = curLine.Find(_T("="));
|
size_t pos = curLine.Find(_T("="));
|
||||||
if (pos == wxString::npos) continue;
|
if (pos == wxString::npos) continue;
|
||||||
wxString func = curLine.Left(pos);
|
wxString func = curLine.Left(pos);
|
||||||
|
|
|
@ -248,7 +248,7 @@ void OptionsManager::Load() {
|
||||||
while (file.HasMoreLines()) {
|
while (file.HasMoreLines()) {
|
||||||
// Parse line
|
// Parse line
|
||||||
curLine = file.ReadLineFromFile();
|
curLine = file.ReadLineFromFile();
|
||||||
if (curLine == _T("")) continue;
|
if (curLine.IsEmpty()) continue;
|
||||||
size_t pos = curLine.Find(_T("="));
|
size_t pos = curLine.Find(_T("="));
|
||||||
if (pos == wxString::npos) continue;
|
if (pos == wxString::npos) continue;
|
||||||
wxString key = curLine.Left(pos);
|
wxString key = curLine.Left(pos);
|
||||||
|
|
|
@ -65,10 +65,12 @@ copy_button BITMAP "bitmaps/copy.bmp"
|
||||||
paste_button BITMAP "bitmaps/paste.bmp"
|
paste_button BITMAP "bitmaps/paste.bmp"
|
||||||
cut_button BITMAP "bitmaps/cut.bmp"
|
cut_button BITMAP "bitmaps/cut.bmp"
|
||||||
undo_button BITMAP "bitmaps/undo.bmp"
|
undo_button BITMAP "bitmaps/undo.bmp"
|
||||||
|
redo_button BITMAP "bitmaps/redo.bmp"
|
||||||
copy_disable_button BITMAP "bitmaps/copy_disable.bmp"
|
copy_disable_button BITMAP "bitmaps/copy_disable.bmp"
|
||||||
paste_disable_button BITMAP "bitmaps/paste_disable.bmp"
|
paste_disable_button BITMAP "bitmaps/paste_disable.bmp"
|
||||||
cut_disable_button BITMAP "bitmaps/cut_disable.bmp"
|
cut_disable_button BITMAP "bitmaps/cut_disable.bmp"
|
||||||
undo_disable_button BITMAP "bitmaps/undo_disable.bmp"
|
undo_disable_button BITMAP "bitmaps/undo_disable.bmp"
|
||||||
|
redo_disable_button BITMAP "bitmaps/redo_disable.bmp"
|
||||||
irc_button BITMAP "bitmaps/irc.bmp"
|
irc_button BITMAP "bitmaps/irc.bmp"
|
||||||
find_button BITMAP "bitmaps/find.bmp"
|
find_button BITMAP "bitmaps/find.bmp"
|
||||||
null_button BITMAP "bitmaps/null_button.bmp"
|
null_button BITMAP "bitmaps/null_button.bmp"
|
||||||
|
|
|
@ -607,7 +607,7 @@ void SubsEditBox::OnActorChange(wxCommandEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add actor to list
|
// Add actor to list
|
||||||
if (ActorBox->GetString(0) == _T("")) ActorBox->Delete(0);
|
if (ActorBox->GetString(0).IsEmpty()) ActorBox->Delete(0);
|
||||||
if (ActorBox->FindString(actor) == wxNOT_FOUND) {
|
if (ActorBox->FindString(actor) == wxNOT_FOUND) {
|
||||||
ActorBox->Append(actor);
|
ActorBox->Append(actor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ TextFileReader::TextFileReader(wxString _filename,wxString enc,bool _trim) {
|
||||||
|
|
||||||
// Set encoding
|
// Set encoding
|
||||||
encoding = enc;
|
encoding = enc;
|
||||||
if (encoding == _T("")) encoding = GetEncoding(filename);
|
if (encoding.IsEmpty()) encoding = GetEncoding(filename);
|
||||||
SetEncodingConfiguration();
|
SetEncodingConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,9 +52,9 @@ TextFileWriter::TextFileWriter(wxString _filename,wxString enc) {
|
||||||
|
|
||||||
// Set encoding
|
// Set encoding
|
||||||
encoding = enc;
|
encoding = enc;
|
||||||
if (encoding == _T("Local") || (encoding == _T("") && Options.AsText(_T("Save Charset")).Lower() == _T("local"))) conv = &wxConvLocal;
|
if (encoding == _T("Local") || (encoding.IsEmpty() && Options.AsText(_T("Save Charset")).Lower() == _T("local"))) conv = &wxConvLocal;
|
||||||
else {
|
else {
|
||||||
if (encoding == _T("")) encoding = Options.AsText(_T("Save Charset"));
|
if (encoding.IsEmpty()) encoding = Options.AsText(_T("Save Charset"));
|
||||||
if (encoding == _T("US-ASCII")) encoding = _T("ISO-8859-1");
|
if (encoding == _T("US-ASCII")) encoding = _T("ISO-8859-1");
|
||||||
conv = new wxCSConv(encoding);
|
conv = new wxCSConv(encoding);
|
||||||
customConv = true;
|
customConv = true;
|
||||||
|
|
|
@ -82,7 +82,6 @@ void TimeEdit::OnModified(wxCommandEvent &event) {
|
||||||
SetBackgroundColour(Options.AsColour(_T("Edit Box Need Enter Background")));
|
SetBackgroundColour(Options.AsColour(_T("Edit Box Need Enter Background")));
|
||||||
}
|
}
|
||||||
modified = true;
|
modified = true;
|
||||||
wxLogMessage(_T("Time modified!"));
|
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
ready = true;
|
ready = true;
|
||||||
|
|
|
@ -86,7 +86,7 @@ bool Backup(wxString src,wxString dst) {
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Make a path relative to reference
|
// Make a path relative to reference
|
||||||
wxString MakeRelativePath(wxString _path,wxString reference) {
|
wxString MakeRelativePath(wxString _path,wxString reference) {
|
||||||
if (_path == _T("")) return _T("");
|
if (_path.IsEmpty()) return _T("");
|
||||||
if (_path.Left(1) == _T("?")) return _path;
|
if (_path.Left(1) == _T("?")) return _path;
|
||||||
wxFileName path(_path);
|
wxFileName path(_path);
|
||||||
wxFileName refPath(reference);
|
wxFileName refPath(reference);
|
||||||
|
@ -98,7 +98,7 @@ wxString MakeRelativePath(wxString _path,wxString reference) {
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
// Extract original path from relative
|
// Extract original path from relative
|
||||||
wxString DecodeRelativePath(wxString _path,wxString reference) {
|
wxString DecodeRelativePath(wxString _path,wxString reference) {
|
||||||
if (_path == _T("")) return _T("");
|
if (_path.IsEmpty()) return _T("");
|
||||||
if (_path.Left(1) == _T("?")) return _path;
|
if (_path.Left(1) == _T("?")) return _path;
|
||||||
wxFileName path(_path);
|
wxFileName path(_path);
|
||||||
wxFileName refPath(reference);
|
wxFileName refPath(reference);
|
||||||
|
|
|
@ -334,7 +334,7 @@ void FrameRate::Load(wxString filename) {
|
||||||
file.getline (buffer,65536);
|
file.getline (buffer,65536);
|
||||||
wxString wxbuffer (buffer,wxConvUTF8);
|
wxString wxbuffer (buffer,wxConvUTF8);
|
||||||
curline = wxbuffer;
|
curline = wxbuffer;
|
||||||
if (curline == _T("")) continue;
|
if (curline.IsEmpty()) continue;
|
||||||
wxString temp;
|
wxString temp;
|
||||||
|
|
||||||
// Get start frame
|
// Get start frame
|
||||||
|
|
|
@ -135,7 +135,7 @@ void VideoDisplay::UpdateSize() {
|
||||||
///////////////////////
|
///////////////////////
|
||||||
// Sets video filename
|
// Sets video filename
|
||||||
void VideoDisplay::SetVideo(const wxString &filename) {
|
void VideoDisplay::SetVideo(const wxString &filename) {
|
||||||
if (filename == _T("")) {
|
if (filename.IsEmpty()) {
|
||||||
delete provider;
|
delete provider;
|
||||||
provider = NULL;
|
provider = NULL;
|
||||||
if (VFR_Output.vfr == NULL) VFR_Output.Unload();
|
if (VFR_Output.vfr == NULL) VFR_Output.Unload();
|
||||||
|
@ -718,7 +718,7 @@ wxBitmap VideoDisplay::GetFrame(int n) {
|
||||||
void VideoDisplay::GetScriptSize(int &sw,int &sh) {
|
void VideoDisplay::GetScriptSize(int &sw,int &sh) {
|
||||||
// Height
|
// Height
|
||||||
wxString temp = grid->ass->GetScriptInfo(_T("PlayResY"));
|
wxString temp = grid->ass->GetScriptInfo(_T("PlayResY"));
|
||||||
if (temp == _T("") || !temp.IsNumber()) {
|
if (temp.IsEmpty() || !temp.IsNumber()) {
|
||||||
//sh = orig_h;
|
//sh = orig_h;
|
||||||
sh = 384;
|
sh = 384;
|
||||||
}
|
}
|
||||||
|
@ -730,7 +730,7 @@ void VideoDisplay::GetScriptSize(int &sw,int &sh) {
|
||||||
|
|
||||||
// Width
|
// Width
|
||||||
temp = grid->ass->GetScriptInfo(_T("PlayResX"));
|
temp = grid->ass->GetScriptInfo(_T("PlayResX"));
|
||||||
if (temp == _T("") || !temp.IsNumber()) {
|
if (temp.IsEmpty() || !temp.IsNumber()) {
|
||||||
sw = 288;
|
sw = 288;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -57,7 +57,7 @@ VideoProvider::VideoProvider(wxString _filename, wxString _subfilename, double _
|
||||||
|
|
||||||
dar = GetSourceWidth()/(double)GetSourceHeight();
|
dar = GetSourceWidth()/(double)GetSourceHeight();
|
||||||
|
|
||||||
if( _subfilename == _T("") ) SubtitledVideo = RGB32Video;
|
if( _subfilename.IsEmpty() ) SubtitledVideo = RGB32Video;
|
||||||
else SubtitledVideo = ApplySubtitles(subfilename, RGB32Video);
|
else SubtitledVideo = ApplySubtitles(subfilename, RGB32Video);
|
||||||
/*
|
/*
|
||||||
if( _zoom == 1.0 ) ResizedVideo = SubtitledVideo;
|
if( _zoom == 1.0 ) ResizedVideo = SubtitledVideo;
|
||||||
|
|
Loading…
Reference in a new issue