From 26b15d3d092bf89844702c887b57c2c1677523a7 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Mon, 20 Feb 2006 21:32:58 +0000 Subject: [PATCH] Implemented redo, and replace == _T("") with .IsEmpty() Originally committed to SVN as r80. --- core/ass_export_filter.cpp | 2 +- core/ass_exporter.cpp | 2 +- core/ass_file.cpp | 94 +++++++++++++++++++++++------- core/ass_file.h | 7 ++- core/ass_style_storage.cpp | 4 +- core/ass_time.cpp | 2 +- core/audio_display.cpp | 2 +- core/audio_karaoke.cpp | 2 +- core/automation.cpp | 2 +- core/base_grid.cpp | 2 +- core/bitmaps/redo.bmp | Bin 0 -> 1318 bytes core/bitmaps/redo_disable.bmp | Bin 0 -> 1318 bytes core/dialog_shift_times.cpp | 4 +- core/dialog_style_manager.cpp | 2 +- core/dialog_styling_assistant.cpp | 2 +- core/dialog_translation.cpp | 2 +- core/export_clean_info.cpp | 2 +- core/frame_main.cpp | 13 +++-- core/frame_main.h | 2 + core/frame_main_events.cpp | 19 ++++-- core/hotkeys.cpp | 2 +- core/options.cpp | 2 +- core/res.rc | 2 + core/subs_edit_box.cpp | 2 +- core/text_file_reader.cpp | 2 +- core/text_file_writer.cpp | 4 +- core/timeedit_ctrl.cpp | 1 - core/utils.cpp | 4 +- core/vfr.cpp | 2 +- core/video_display.cpp | 6 +- core/video_provider.cpp | 2 +- 31 files changed, 132 insertions(+), 62 deletions(-) create mode 100644 core/bitmaps/redo.bmp create mode 100644 core/bitmaps/redo_disable.bmp diff --git a/core/ass_export_filter.cpp b/core/ass_export_filter.cpp index b1ac60bcb..1e096e75e 100644 --- a/core/ass_export_filter.cpp +++ b/core/ass_export_filter.cpp @@ -115,7 +115,7 @@ void AssExportFilter::Unregister () { // Checks if it's registered bool AssExportFilter::IsRegistered() { // Check name - if (RegisterName == _T("")) { + if (RegisterName.IsEmpty()) { return false; } diff --git a/core/ass_exporter.cpp b/core/ass_exporter.cpp index 8222082c4..64c964fb4 100644 --- a/core/ass_exporter.cpp +++ b/core/ass_exporter.cpp @@ -143,7 +143,7 @@ void AssExporter::Export(wxString filename, wxString charset) { if (withCharset) { wxArrayString choices = FrameMain::GetEncodings(); charset = wxGetSingleChoice(_T("Choose charset code:"), _T("Charset"),choices,NULL,-1, -1,true,250,200); - if (charset == _T("")) { + if (charset.IsEmpty()) { delete Subs; return; } diff --git a/core/ass_file.cpp b/core/ass_file.cpp index 836fc0ad7..9778785e7 100644 --- a/core/ass_file.cpp +++ b/core/ass_file.cpp @@ -82,7 +82,7 @@ void AssFile::Load (const wxString _filename,const wxString charset) { // Find file encoding wxString enc; - if (charset == _T("")) enc = TextFileReader::GetEncoding(_filename); + if (charset.IsEmpty()) enc = TextFileReader::GetEncoding(_filename); else enc = charset; TextFileReader::EnsureValid(enc); @@ -228,7 +228,7 @@ void AssFile::LoadSRT (wxString _filename,wxString encoding) { switch (mode) { case 0: // Checks if there is anything to read - if (curline == _T("")) continue; + if (curline.IsEmpty()) continue; // Check if it's a line number if (!curline.IsNumber()) { @@ -258,7 +258,7 @@ void AssFile::LoadSRT (wxString _filename,wxString encoding) { case 2: // Checks if it's done - if (curline == _T("")) { + if (curline.IsEmpty()) { mode = 0; linen++; line->group = _T("[Events]"); @@ -333,7 +333,7 @@ void AssFile::LoadTXT (wxString _filename,wxString encoding) { line->Style = _T("Default"); if (isComment) line->Actor = _T(""); else line->Actor = actor; - if (value == _T("")) { + if (value.IsEmpty()) { line->Actor = _T(""); isComment = true; } @@ -934,6 +934,16 @@ bool AssFile::IsModified() { ///////////////////////// // Flag file as modified void AssFile::FlagAsModified() { + // Clear redo + if (!RedoStack.empty()) { + //StackPush(); + //UndoStack.push_back(new AssFile(*UndoStack.back())); + for (std::list::iterator cur=RedoStack.begin();cur!=RedoStack.end();cur++) { + delete *cur; + } + RedoStack.clear(); + } + Modified = true; StackPush(); } @@ -944,18 +954,18 @@ void AssFile::FlagAsModified() { void AssFile::StackPush() { // Places copy on stack AssFile *curcopy = new AssFile(*top); - SubsStack.push_back(curcopy); + UndoStack.push_back(curcopy); StackModified = true; // Cap depth int n = 0; - for (std::list::iterator cur=SubsStack.begin();cur!=SubsStack.end();cur++) { + for (std::list::iterator cur=UndoStack.begin();cur!=UndoStack.end();cur++) { n++; } int depth = Options.AsInt(_T("Undo levels")); while (n > depth) { - delete SubsStack.front(); - SubsStack.pop_front(); + delete UndoStack.front(); + UndoStack.pop_front(); n--; } } @@ -966,15 +976,16 @@ void AssFile::StackPush() { void AssFile::StackPop() { bool addcopy = false; if (StackModified) { - SubsStack.pop_back(); + UndoStack.pop_back(); StackModified = false; addcopy = true; } - if (!SubsStack.empty()) { - delete top; - top = SubsStack.back(); - SubsStack.pop_back(); + if (!UndoStack.empty()) { + //delete top; + RedoStack.push_back(top); + top = UndoStack.back(); + UndoStack.pop_back(); 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 void AssFile::StackClear() { - for (std::list::iterator cur=SubsStack.begin();cur!=SubsStack.end();cur++) { + // Clear undo + for (std::list::iterator cur=UndoStack.begin();cur!=UndoStack.end();cur++) { delete *cur; } - SubsStack.clear(); + UndoStack.clear(); + + // Clear redo + for (std::list::iterator cur=RedoStack.begin();cur!=RedoStack.end();cur++) { + delete *cur; + } + RedoStack.clear(); + Popping = false; } @@ -1005,18 +1049,26 @@ void AssFile::StackReset() { } -///////////////////////////// -// Returns if stack is empty -bool AssFile::StackEmpty() { - if (StackModified) return (SubsStack.size() <= 1); - else return SubsStack.empty(); +////////////////////////////////// +// Returns if undo stack is empty +bool AssFile::IsUndoStackEmpty() { + if (StackModified) return (UndoStack.size() <= 1); + else return UndoStack.empty(); +} + + +////////////////////////////////// +// Returns if redo stack is empty +bool AssFile::IsRedoStackEmpty() { + return RedoStack.empty(); } ////////// // Global AssFile *AssFile::top; -std::list AssFile::SubsStack; +std::list AssFile::UndoStack; +std::list AssFile::RedoStack; bool AssFile::Popping; bool AssFile::StackModified; diff --git a/core/ass_file.h b/core/ass_file.h index a2157a098..fd53798c4 100644 --- a/core/ass_file.h +++ b/core/ass_file.h @@ -62,7 +62,8 @@ private: bool Modified; // Stack operations - static std::list SubsStack; + static std::list UndoStack; + static std::list RedoStack; static bool StackModified; static void StackClear(); @@ -112,9 +113,11 @@ public: 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 StackRedo(); // Redoes action on stack static void StackPush(); // Puts a copy of 'top' on the stack 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 AssFile *top; // Current script file. It is "above" the stack. }; diff --git a/core/ass_style_storage.cpp b/core/ass_style_storage.cpp index e24aaae7a..8e5cb7128 100644 --- a/core/ass_style_storage.cpp +++ b/core/ass_style_storage.cpp @@ -46,7 +46,7 @@ /////////////////////// // Save styles to disk void AssStyleStorage::Save(wxString name) { - if (name == _T("")) return; + if (name.IsEmpty()) return; using namespace std; ofstream file; @@ -68,7 +68,7 @@ void AssStyleStorage::Save(wxString name) { ///////////////////////// // Load styles from disk void AssStyleStorage::Load(wxString name) { - if (name == _T("")) return; + if (name.IsEmpty()) return; using namespace std; char buffer[65536]; diff --git a/core/ass_time.cpp b/core/ass_time.cpp index f2393c291..f9162ca40 100644 --- a/core/ass_time.cpp +++ b/core/ass_time.cpp @@ -210,7 +210,7 @@ void AssTime::UpdateFromTextCtrl(wxTextCtrl *ctrl) { start++; end++; } - else if (nextChar == _T("")) text.Remove(start-1,1); + else if (nextChar.IsEmpty()) text.Remove(start-1,1); else text.Remove(start,1); } diff --git a/core/audio_display.cpp b/core/audio_display.cpp index a89c2ba56..c068c9611 100644 --- a/core/audio_display.cpp +++ b/core/audio_display.cpp @@ -736,7 +736,7 @@ void AudioDisplay::SetScale(float _scale) { ////////////////// // Load from file void AudioDisplay::SetFile(wxString file) { - if (file == _T("")) { + if (file.IsEmpty()) { if (provider) delete provider; provider = NULL; diff --git a/core/audio_karaoke.cpp b/core/audio_karaoke.cpp index ec8d70d08..7140d92df 100644 --- a/core/audio_karaoke.cpp +++ b/core/audio_karaoke.cpp @@ -252,7 +252,7 @@ bool AudioKaraoke::ParseDialogue(AssDialogue *curDiag) { // Set syllable void AudioKaraoke::SetSyllable(int n) { if (n == -1) n = syllables.size()-1; - if (n >= syllables.size()) n = 0; + if (n >= (signed) syllables.size()) n = 0; curSyllable = n; startClickSyl = n; SetSelection(n); diff --git a/core/automation.cpp b/core/automation.cpp index e1c806026..1728190bd 100644 --- a/core/automation.cpp +++ b/core/automation.cpp @@ -1252,7 +1252,7 @@ void AutomationScript::process_lines(AssFile *input) // not a dialogue/comment event // start checking for a blank line - if (e->data == _T("")) { + if (e->data.IsEmpty()) { lua_newtable(L); L_settable(L, -1, "kind", wxString(_T("blank"))); } else if (e->data[0] == _T(';')) { diff --git a/core/base_grid.cpp b/core/base_grid.cpp index bf204bed9..f7fe6b6f7 100644 --- a/core/base_grid.cpp +++ b/core/base_grid.cpp @@ -64,7 +64,7 @@ BaseGrid::BaseGrid(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wx // Set font wxString fontname = Options.AsText(_T("Font Face")); - if (fontname == _T("")) fontname = _T("Tahoma"); + if (fontname.IsEmpty()) fontname = _T("Tahoma"); font.SetFaceName(fontname); font.SetPointSize(Options.AsInt(_T("Grid font size"))); font.SetWeight(wxFONTWEIGHT_NORMAL); diff --git a/core/bitmaps/redo.bmp b/core/bitmaps/redo.bmp new file mode 100644 index 0000000000000000000000000000000000000000..4dd9fb448574c8ba2249563456440080fde81368 GIT binary patch literal 1318 zcmbu-y=~o442EGExQ5duBd`iQfomdtcHk)AC@ccc!8$Xz;0U)*aq~*F5!gtTNP5n9 zj{c9tZ{NS(+qpbl%pU1|!Drmrr*r@HZ2#8CjLoDCTDsQV)-P?>pU-9=HKQBB!t4T&X$%t8Au3) z#%$SzlYxX#Xv~&mIvGd^g~n{T%E>@NC^TkExtt6nghFGs%-hL8LMXfby4erT6ZbQ_ zotxcmM-QyWE}Dn`UoMw-_jny%j^#M;cJ$-;;p1_3oag^(_tN9Sx0}3s(!UIT1G6km AG5`Po literal 0 HcmV?d00001 diff --git a/core/bitmaps/redo_disable.bmp b/core/bitmaps/redo_disable.bmp new file mode 100644 index 0000000000000000000000000000000000000000..8d76b4f9ea20deeba67f0b94b9e00786dcd9b014 GIT binary patch literal 1318 zcmbu-y=~o442EGENZ@qw2&@86keW!J=1#y-zEM~NnS-@waKRC7pW^0~Xd|$ZDv|V@ z?;QOfiQm3|`Do|z^@G_Xy$5{8oqam@U(fb$jm+3g+MuOt-EIBcc76J3=79tUywDi4 zFgWN$LMSxGEDeqTgA@vld3mmrfrLAzlYxX#Xv}^tIT=U@g~sfsEGGjAq0pH9 z%#v*r;5>0Z zv)j4Z?RNCQdhDXP|NrH3d2^4K;pJG41FuKlkMG|fXUBQ|pLQ=jE_}Vonfilename); wxString filename = assfile.GetFullName(); - if (filename == _T("")) message << _("unsaved, "); + if (filename.IsEmpty()) message << _("unsaved, "); else message << filename << _T(", "); if (byTime) message << ShiftTime->GetValue() << _T(" "); else message << len << _(" frames "); @@ -286,7 +286,7 @@ void DialogShiftTimes::OnRadioFrame(wxCommandEvent &event) { // Appends a line to history void DialogShiftTimes::AppendToHistory(wxString text) { // Open file - if (HistoryFile == _T("")) return; + if (HistoryFile.IsEmpty()) return; using namespace std; ofstream file; file.open(HistoryFile.mb_str(wxConvLocal),ios::out | ios::app); diff --git a/core/dialog_style_manager.cpp b/core/dialog_style_manager.cpp index 15df89d40..ec28231eb 100644 --- a/core/dialog_style_manager.cpp +++ b/core/dialog_style_manager.cpp @@ -174,7 +174,7 @@ void DialogStyleManager::LoadCatalog () { // Set to default if available StorageActions(false); 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); if (opt != wxNOT_FOUND) { CatalogList->SetSelection(opt); diff --git a/core/dialog_styling_assistant.cpp b/core/dialog_styling_assistant.cpp index 199c5f1f6..c9577fbe7 100644 --- a/core/dialog_styling_assistant.cpp +++ b/core/dialog_styling_assistant.cpp @@ -192,7 +192,7 @@ void DialogStyling::JumpToLine(int n) { // Set focus 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()); // Update grid diff --git a/core/dialog_translation.cpp b/core/dialog_translation.cpp index e9e577c42..df865bfc0 100644 --- a/core/dialog_translation.cpp +++ b/core/dialog_translation.cpp @@ -283,7 +283,7 @@ void DialogTranslation::OnTransBoxKey(wxKeyEvent &event) { } // 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); if (ok) { TransText->Clear(); diff --git a/core/export_clean_info.cpp b/core/export_clean_info.cpp index 7e97e3e63..15df20b63 100644 --- a/core/export_clean_info.cpp +++ b/core/export_clean_info.cpp @@ -73,7 +73,7 @@ void AssTransformCleanInfoFilter::ProcessSubs(AssFile *subs) { if (curEntry->group != _T("[Script Info]")) { continue; } - if (curEntry->data == _T("")) { + if (curEntry->data.IsEmpty()) { continue; } if (curEntry->data == _T("[Script Info]")) { diff --git a/core/frame_main.cpp b/core/frame_main.cpp index ad41426c3..49ba37178 100644 --- a/core/frame_main.cpp +++ b/core/frame_main.cpp @@ -229,6 +229,7 @@ void FrameMain::InitMenu() { // Create Edit menu editMenu = new wxMenu(); 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->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")); @@ -508,7 +509,7 @@ void FrameMain::LoadSubtitles (wxString filename,wxString charset) { if (Options.AsBool(_T("Auto backup")) && origfile.FileExists()) { // Get path wxString path = Options.AsText(_T("Auto backup path")); - if (path == _T("")) path = origfile.GetPath(); + if (path.IsEmpty()) path = origfile.GetPath(); wxFileName dstpath(path); if (!dstpath.IsAbsolute()) path = AegisubApp::folderName + path; path += _T("/"); @@ -536,7 +537,7 @@ bool FrameMain::SaveSubtitles(bool saveas,bool withCharset) { if (saveas == false && AssFile::top->IsASS) filename = AssFile::top->filename; // Failed, ask user - if (filename == _T("")) { + if (filename.IsEmpty()) { videoBox->videoDisplay->Stop(); 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() @@ -552,7 +553,7 @@ bool FrameMain::SaveSubtitles(bool saveas,bool withCharset) { if (withCharset) { wxArrayString choices = GetEncodings(); 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 @@ -1073,9 +1074,9 @@ bool FrameMain::LoadList(wxArrayString list) { wxFileName file(List[i]); ext = file.GetExt().Lower(); - if (subs == _T("") && subsList.Index(ext) != wxNOT_FOUND) subs = List[i]; - if (video == _T("") && videoList.Index(ext) != wxNOT_FOUND) video = List[i]; - if (audio == _T("") && audioList.Index(ext) != wxNOT_FOUND) audio = List[i]; + if (subs.IsEmpty() && subsList.Index(ext) != wxNOT_FOUND) subs = List[i]; + if (video.IsEmpty() && videoList.Index(ext) != wxNOT_FOUND) video = List[i]; + if (audio.IsEmpty() && audioList.Index(ext) != wxNOT_FOUND) audio = List[i]; } // Set blocking diff --git a/core/frame_main.h b/core/frame_main.h index 68f82a824..ee81e7675 100644 --- a/core/frame_main.h +++ b/core/frame_main.h @@ -167,6 +167,7 @@ private: void OnViewSubs (wxCommandEvent &event); void OnUndo (wxCommandEvent &event); + void OnRedo (wxCommandEvent &event); void OnCut (wxCommandEvent &event); void OnCopy (wxCommandEvent &event); void OnPaste (wxCommandEvent &event); @@ -280,6 +281,7 @@ enum { Menu_Edit_Select, Menu_Edit_Undo, + Menu_Edit_Redo, Menu_Edit_Find, Menu_Edit_Find_Next, Menu_Edit_Replace, diff --git a/core/frame_main_events.cpp b/core/frame_main_events.cpp index a21674709..d5b5601c6 100644 --- a/core/frame_main_events.cpp +++ b/core/frame_main_events.cpp @@ -142,6 +142,7 @@ BEGIN_EVENT_TABLE(FrameMain, wxFrame) EVT_MENU(Menu_Audio_Close, FrameMain::OnCloseAudio) 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_Copy, FrameMain::OnCopy) EVT_MENU(Menu_Edit_Paste, FrameMain::OnPaste) @@ -317,9 +318,9 @@ void FrameMain::OnMenuOpen (wxMenuEvent &event) { // Edit menu else if (curMenu == editMenu) { - // 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 wxArrayInt sels = SubsBox->GetSelection(); @@ -655,7 +656,7 @@ void FrameMain::OnOpenSpellCheck (wxCommandEvent &event) { wxArrayInt selList = SubsBox->GetSelection(); if (selList.GetCount() == 1){ AssDialogue * a = SubsBox->GetDialogue(selList.Item(0)); - if (a->Text == _T("")){ + if (a->Text.IsEmpty()){ wxMessageDialog Question(this, _T( "You've selected a single row with no text. Instead would you like to check the entire document?"), _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 void FrameMain::OnFind(wxCommandEvent &event) { @@ -1001,7 +1012,7 @@ void FrameMain::OnAutoSave(wxTimerEvent &event) { // Set path wxFileName origfile(AssFile::top->filename); wxString path = Options.AsText(_T("Auto save path")); - if (path == _T("")) path = origfile.GetPath(); + if (path.IsEmpty()) path = origfile.GetPath(); wxFileName dstpath(path); if (!dstpath.IsAbsolute()) path = AegisubApp::folderName + path; path += _T("/"); diff --git a/core/hotkeys.cpp b/core/hotkeys.cpp index f220ad567..75bf8a6b3 100644 --- a/core/hotkeys.cpp +++ b/core/hotkeys.cpp @@ -274,7 +274,7 @@ void HotkeyManager::Load() { while (file.HasMoreLines()) { // Parse line curLine = file.ReadLineFromFile(); - if (curLine == _T("")) continue; + if (curLine.IsEmpty()) continue; size_t pos = curLine.Find(_T("=")); if (pos == wxString::npos) continue; wxString func = curLine.Left(pos); diff --git a/core/options.cpp b/core/options.cpp index 2bb341aa0..dbf295fa1 100644 --- a/core/options.cpp +++ b/core/options.cpp @@ -248,7 +248,7 @@ void OptionsManager::Load() { while (file.HasMoreLines()) { // Parse line curLine = file.ReadLineFromFile(); - if (curLine == _T("")) continue; + if (curLine.IsEmpty()) continue; size_t pos = curLine.Find(_T("=")); if (pos == wxString::npos) continue; wxString key = curLine.Left(pos); diff --git a/core/res.rc b/core/res.rc index 3f6149a6f..1a22140c0 100644 --- a/core/res.rc +++ b/core/res.rc @@ -65,10 +65,12 @@ copy_button BITMAP "bitmaps/copy.bmp" paste_button BITMAP "bitmaps/paste.bmp" cut_button BITMAP "bitmaps/cut.bmp" undo_button BITMAP "bitmaps/undo.bmp" +redo_button BITMAP "bitmaps/redo.bmp" copy_disable_button BITMAP "bitmaps/copy_disable.bmp" paste_disable_button BITMAP "bitmaps/paste_disable.bmp" cut_disable_button BITMAP "bitmaps/cut_disable.bmp" undo_disable_button BITMAP "bitmaps/undo_disable.bmp" +redo_disable_button BITMAP "bitmaps/redo_disable.bmp" irc_button BITMAP "bitmaps/irc.bmp" find_button BITMAP "bitmaps/find.bmp" null_button BITMAP "bitmaps/null_button.bmp" diff --git a/core/subs_edit_box.cpp b/core/subs_edit_box.cpp index 2fe5bc833..fc9506b96 100644 --- a/core/subs_edit_box.cpp +++ b/core/subs_edit_box.cpp @@ -607,7 +607,7 @@ void SubsEditBox::OnActorChange(wxCommandEvent &event) { } // 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) { ActorBox->Append(actor); } diff --git a/core/text_file_reader.cpp b/core/text_file_reader.cpp index 0af109bbe..232a18cc3 100644 --- a/core/text_file_reader.cpp +++ b/core/text_file_reader.cpp @@ -56,7 +56,7 @@ TextFileReader::TextFileReader(wxString _filename,wxString enc,bool _trim) { // Set encoding encoding = enc; - if (encoding == _T("")) encoding = GetEncoding(filename); + if (encoding.IsEmpty()) encoding = GetEncoding(filename); SetEncodingConfiguration(); } diff --git a/core/text_file_writer.cpp b/core/text_file_writer.cpp index a986a989a..c910ffe18 100644 --- a/core/text_file_writer.cpp +++ b/core/text_file_writer.cpp @@ -52,9 +52,9 @@ TextFileWriter::TextFileWriter(wxString _filename,wxString enc) { // Set encoding 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 { - 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"); conv = new wxCSConv(encoding); customConv = true; diff --git a/core/timeedit_ctrl.cpp b/core/timeedit_ctrl.cpp index 056832c38..a8203beec 100644 --- a/core/timeedit_ctrl.cpp +++ b/core/timeedit_ctrl.cpp @@ -82,7 +82,6 @@ void TimeEdit::OnModified(wxCommandEvent &event) { SetBackgroundColour(Options.AsColour(_T("Edit Box Need Enter Background"))); } modified = true; - wxLogMessage(_T("Time modified!")); // Done ready = true; diff --git a/core/utils.cpp b/core/utils.cpp index 3064b6495..24e3b4cf1 100644 --- a/core/utils.cpp +++ b/core/utils.cpp @@ -86,7 +86,7 @@ bool Backup(wxString src,wxString dst) { ///////////////////////////////////// // Make a path relative to reference wxString MakeRelativePath(wxString _path,wxString reference) { - if (_path == _T("")) return _T(""); + if (_path.IsEmpty()) return _T(""); if (_path.Left(1) == _T("?")) return _path; wxFileName path(_path); wxFileName refPath(reference); @@ -98,7 +98,7 @@ wxString MakeRelativePath(wxString _path,wxString reference) { /////////////////////////////////////// // Extract original path from relative wxString DecodeRelativePath(wxString _path,wxString reference) { - if (_path == _T("")) return _T(""); + if (_path.IsEmpty()) return _T(""); if (_path.Left(1) == _T("?")) return _path; wxFileName path(_path); wxFileName refPath(reference); diff --git a/core/vfr.cpp b/core/vfr.cpp index eea4685a0..1f49173ae 100644 --- a/core/vfr.cpp +++ b/core/vfr.cpp @@ -334,7 +334,7 @@ void FrameRate::Load(wxString filename) { file.getline (buffer,65536); wxString wxbuffer (buffer,wxConvUTF8); curline = wxbuffer; - if (curline == _T("")) continue; + if (curline.IsEmpty()) continue; wxString temp; // Get start frame diff --git a/core/video_display.cpp b/core/video_display.cpp index ccce7494a..608135150 100644 --- a/core/video_display.cpp +++ b/core/video_display.cpp @@ -135,7 +135,7 @@ void VideoDisplay::UpdateSize() { /////////////////////// // Sets video filename void VideoDisplay::SetVideo(const wxString &filename) { - if (filename == _T("")) { + if (filename.IsEmpty()) { delete provider; provider = NULL; if (VFR_Output.vfr == NULL) VFR_Output.Unload(); @@ -718,7 +718,7 @@ wxBitmap VideoDisplay::GetFrame(int n) { void VideoDisplay::GetScriptSize(int &sw,int &sh) { // Height wxString temp = grid->ass->GetScriptInfo(_T("PlayResY")); - if (temp == _T("") || !temp.IsNumber()) { + if (temp.IsEmpty() || !temp.IsNumber()) { //sh = orig_h; sh = 384; } @@ -730,7 +730,7 @@ void VideoDisplay::GetScriptSize(int &sw,int &sh) { // Width temp = grid->ass->GetScriptInfo(_T("PlayResX")); - if (temp == _T("") || !temp.IsNumber()) { + if (temp.IsEmpty() || !temp.IsNumber()) { sw = 288; } else { diff --git a/core/video_provider.cpp b/core/video_provider.cpp index 8d977b723..dc79ff9ed 100644 --- a/core/video_provider.cpp +++ b/core/video_provider.cpp @@ -57,7 +57,7 @@ VideoProvider::VideoProvider(wxString _filename, wxString _subfilename, double _ dar = GetSourceWidth()/(double)GetSourceHeight(); - if( _subfilename == _T("") ) SubtitledVideo = RGB32Video; + if( _subfilename.IsEmpty() ) SubtitledVideo = RGB32Video; else SubtitledVideo = ApplySubtitles(subfilename, RGB32Video); /* if( _zoom == 1.0 ) ResizedVideo = SubtitledVideo;