From 1723915e3e509b398fcd88102dea1996fc8e3f1a Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Tue, 14 Mar 2006 04:23:00 +0000 Subject: [PATCH] Fixed shift times not affecting video/audio, and default save as path Originally committed to SVN as r226. --- core/dialog_shift_times.cpp | 10 ++++++---- core/frame_main.cpp | 18 +++++++++++++----- core/frame_main_events.cpp | 3 ++- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/core/dialog_shift_times.cpp b/core/dialog_shift_times.cpp index 7b9b341c9..3e3fab31d 100644 --- a/core/dialog_shift_times.cpp +++ b/core/dialog_shift_times.cpp @@ -36,6 +36,10 @@ /////////// // Headers +#include +#include +#include +#include #include "dialog_shift_times.h" #include "video_display.h" #include "vfr.h" @@ -45,10 +49,7 @@ #include "ass_file.h" #include "ass_time.h" #include "ass_dialogue.h" -#include -#include -#include -#include +#include "subs_edit_box.h" /////////////// @@ -262,6 +263,7 @@ void DialogShiftTimes::OnOK(wxCommandEvent &event) { grid->ass->FlagAsModified(); grid->CommitChanges(); grid->UpdateMaps(); + grid->editBox->Update(); EndModal(0); } diff --git a/core/frame_main.cpp b/core/frame_main.cpp index 620b0fe08..d658520a9 100644 --- a/core/frame_main.cpp +++ b/core/frame_main.cpp @@ -563,15 +563,23 @@ bool FrameMain::SaveSubtitles(bool saveas,bool withCharset) { // Failed, ask user 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() + wxString path = Options.AsText(_T("Last open subtitles path")); + wxFileName origPath(AssFile::top->filename); + filename = wxFileSelector(_("Save subtitles file"),path,origPath.GetName() + _T(".ass"),_T("ass"),_T("Advanced Substation Alpha (*.ass)|*.ass"),wxSAVE | wxOVERWRITE_PROMPT,this); } - // Synchronize - SynchronizeProject(); - // Actually save if (!filename.empty()) { + // Store path + wxFileName filepath(filename); + Options.SetText(_T("Last open subtitles path"), filepath.GetPath()); + + // Fix me, ghetto hack for correct relative path generation in SynchronizeProject() + AssFile::top->filename = filename; + + // Synchronize + SynchronizeProject(); + // Get charset wxString charset = _T(""); if (withCharset) { diff --git a/core/frame_main_events.cpp b/core/frame_main_events.cpp index 943494664..5afaff4de 100644 --- a/core/frame_main_events.cpp +++ b/core/frame_main_events.cpp @@ -512,7 +512,8 @@ void FrameMain::OnOpenSubtitles(wxCommandEvent& WXUNUSED(event)) { wxString filename = wxFileSelector(_("Open subtitles file"),path,_T(""),_T(""),_T("All Supported Types (*.ass,*.ssa,*.srt,*.txt)|*.ass;*.ssa;*.srt;*.txt|Advanced Substation Alpha (*.ass)|*.ass|Substation Alpha (*.ssa)|*.ssa|SubRip (*.srt)|*.srt|Plain-text (*.txt)|*.txt"),wxOPEN | wxFILE_MUST_EXIST); if (!filename.empty()) { LoadSubtitles(filename); - Options.SetText(_T("Last open subtitles path"), filename); + wxFileName filepath(filename); + Options.SetText(_T("Last open subtitles path"), filepath.GetPath()); } }