Fixed shift times not affecting video/audio, and default save as path

Originally committed to SVN as r226.
This commit is contained in:
Rodrigo Braz Monteiro 2006-03-14 04:23:00 +00:00
parent 81e86727ff
commit 1723915e3e
3 changed files with 21 additions and 10 deletions

View File

@ -36,6 +36,10 @@
/////////// ///////////
// Headers // Headers
#include <fstream>
#include <algorithm>
#include <string>
#include <wx/filename.h>
#include "dialog_shift_times.h" #include "dialog_shift_times.h"
#include "video_display.h" #include "video_display.h"
#include "vfr.h" #include "vfr.h"
@ -45,10 +49,7 @@
#include "ass_file.h" #include "ass_file.h"
#include "ass_time.h" #include "ass_time.h"
#include "ass_dialogue.h" #include "ass_dialogue.h"
#include <fstream> #include "subs_edit_box.h"
#include <algorithm>
#include <string>
#include <wx/filename.h>
/////////////// ///////////////
@ -262,6 +263,7 @@ void DialogShiftTimes::OnOK(wxCommandEvent &event) {
grid->ass->FlagAsModified(); grid->ass->FlagAsModified();
grid->CommitChanges(); grid->CommitChanges();
grid->UpdateMaps(); grid->UpdateMaps();
grid->editBox->Update();
EndModal(0); EndModal(0);
} }

View File

@ -563,15 +563,23 @@ bool FrameMain::SaveSubtitles(bool saveas,bool withCharset) {
// Failed, ask user // Failed, ask user
if (filename.IsEmpty()) { 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); wxString path = Options.AsText(_T("Last open subtitles path"));
AssFile::top->filename = filename; //fix me, ghetto hack for correct relative path generation in SynchronizeProject() 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 // Actually save
if (!filename.empty()) { 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 // Get charset
wxString charset = _T(""); wxString charset = _T("");
if (withCharset) { if (withCharset) {

View File

@ -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); 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()) { if (!filename.empty()) {
LoadSubtitles(filename); LoadSubtitles(filename);
Options.SetText(_T("Last open subtitles path"), filename); wxFileName filepath(filename);
Options.SetText(_T("Last open subtitles path"), filepath.GetPath());
} }
} }