Applied some Pomyk patches

Originally committed to SVN as r209.
This commit is contained in:
Rodrigo Braz Monteiro 2006-03-05 20:42:38 +00:00
parent 564e270e54
commit a7aca18675
7 changed files with 99 additions and 28 deletions

View File

@ -116,8 +116,11 @@ END_EVENT_TABLE()
void DialogAutomationManager::OnCreate(wxCommandEvent &event)
{
wxString sfnames = wxFileSelector(_("Create Automation script"), _T(""), _T("*.lua"), _T("lua"), _T("Automation Lua scripts (*.lua)|*.lua|All files (*.*)|*.*"), wxSAVE|wxOVERWRITE_PROMPT, this);
wxString path = Options.AsText(_T("Last open automation path"));
wxString sfnames = wxFileSelector(_("Create Automation script"), path, _T("*.lua"), _T("lua"), _T("Automation Lua scripts (*.lua)|*.lua|All files (*.*)|*.*"), wxSAVE|wxOVERWRITE_PROMPT, this);
if (sfnames.empty()) return;
Options.SetText(_T("Last open automation path"), sfnames);
wxFileName sfname(sfnames);
if (sfname.FileExists()) {
@ -162,8 +165,10 @@ void DialogAutomationManager::OnCreate(wxCommandEvent &event)
void DialogAutomationManager::OnAdd(wxCommandEvent &event)
{
wxString sfnames = wxFileSelector(_("Load Automation script"), _T(""), _T("*.lua"), _T("lua"), _T("Automation Lua scripts (*.lua)|*.lua|All files (*.*)|*.*"), wxOPEN|wxFILE_MUST_EXIST, this);
wxString path = Options.AsText(_T("Last open automation path"));
wxString sfnames = wxFileSelector(_("Load Automation script"), path, _T("*.lua"), _T("lua"), _T("Automation Lua scripts (*.lua)|*.lua|All files (*.*)|*.*"), wxOPEN|wxFILE_MUST_EXIST, this);
if (sfnames.empty()) return;
Options.SetText(_T("Last open automation path"), sfnames);
try {
AutomationScriptFile *sfile = AutomationScriptFile::CreateFromFile(sfnames);

View File

@ -57,6 +57,11 @@ Please visit http://aegisub.net to download latest version
- Added option ("keep raw dialogue data", default false) that makes Aegisub use less RAM at a small performance cost when set to false. (AMZ)
- The line timing extending in timing post-processor is now governed by the "timing processor adjascent bias" option (1.0 [default] = move end, 0.0 = move start, 0.5 = move to halfway point, etc) (AMZ)
- Middle clicking the video seek bar and audio display will now focus them. (AMZ)
- Search and Replace dialogue made modeless. (Pomyk)
- Fixed bug related to moving elements up and down in File Export dialog. (Pomyk)
- Scrollbar and sliders in audio box can no longer receive focus. (Pomyk)
- Select lines dialog now has an option on how to deal with comment lines. (Pomyk)
- Last folder for all the file selection dialogs are now remembered in config.dat. (Pomyk)
= 1.09 beta - 2006.01.16 ===========================

View File

@ -45,7 +45,8 @@
#include "options.h"
#include "subs_edit_box.h"
#include "video_display.h"
#include "frame_main.h"
#include "main.h"
///////////////
// Constructor
@ -79,7 +80,7 @@ DialogSearchReplace::DialogSearchReplace (wxWindow *parent,bool _hasReplace,wxSt
CheckRegExp->SetValue(Options.AsBool(_T("Find RegExp")));
//CheckRegExp->Enable(false);
CheckUpdateVideo->SetValue(Options.AsBool(_T("Find Update Video")));
CheckUpdateVideo->Enable(Search.grid->video->loaded);
// CheckUpdateVideo->Enable(Search.grid->video->loaded);
OptionsSizer->Add(CheckMatchCase,0,wxBOTTOM,5);
OptionsSizer->Add(CheckRegExp,0,wxBOTTOM,5);
OptionsSizer->Add(CheckUpdateVideo,0,wxBOTTOM,0);
@ -133,14 +134,23 @@ DialogSearchReplace::DialogSearchReplace (wxWindow *parent,bool _hasReplace,wxSt
// Destructor
DialogSearchReplace::~DialogSearchReplace() {
// Save options
UpdateSettings();
}
/////////////////
// Update search
void DialogSearchReplace::UpdateSettings() {
Search.isReg = CheckRegExp->IsChecked() && CheckRegExp->IsEnabled();
Search.matchCase = CheckMatchCase->IsChecked();
Search.updateVideo = CheckUpdateVideo->IsChecked() && CheckUpdateVideo->IsEnabled();
Options.SetBool(_T("Find Match Case"),CheckMatchCase->IsChecked());
Options.SetBool(_T("Find RegExp"),CheckRegExp->IsChecked());
Options.SetBool(_T("Find Update Video"),CheckUpdateVideo->IsChecked());
Options.SetInt(_T("Find Field"),Field->GetSelection());
Options.SetInt(_T("Find Affect"),Affect->GetSelection());
Options.Save();
}
}
///////////////
// Event table
@ -149,21 +159,17 @@ BEGIN_EVENT_TABLE(DialogSearchReplace,wxDialog)
EVT_BUTTON(BUTTON_FIND_NEXT,DialogSearchReplace::OnFindNext)
EVT_BUTTON(BUTTON_REPLACE_NEXT,DialogSearchReplace::OnReplaceNext)
EVT_BUTTON(BUTTON_REPLACE_ALL,DialogSearchReplace::OnReplaceAll)
EVT_SET_FOCUS(DialogSearchReplace::OnSetFocus)
EVT_KILL_FOCUS(DialogSearchReplace::OnKillFocus)
END_EVENT_TABLE()
/////////
// Close
void DialogSearchReplace::OnClose (wxCommandEvent &event) {
// Update search
Search.isReg = CheckRegExp->IsChecked() && CheckRegExp->IsEnabled();
Search.matchCase = CheckMatchCase->IsChecked();
Search.updateVideo = CheckUpdateVideo->IsChecked() && CheckUpdateVideo->IsEnabled();
Search.OnDialogClose();
// Close
if (IsModal()) EndModal(0);
else Destroy();
// Just hide
Show(false);
}
@ -183,6 +189,12 @@ void DialogSearchReplace::OnFindNext (wxCommandEvent &event) {
Search.affect = Affect->GetSelection();
Search.field = Field->GetSelection();
Search.FindNext();
if (hasReplace) {
wxString ReplaceWith = ReplaceEdit->GetValue();
Search.ReplaceWith = ReplaceWith;
Options.AddToRecentList(ReplaceWith,_T("Recent replace"));
}
// Add to history
Options.AddToRecentList(LookFor,_T("Recent find"));
@ -261,6 +273,15 @@ void DialogSearchReplace::UpdateDropDowns() {
}
void DialogSearchReplace::OnSetFocus (wxFocusEvent &event) {
Search.hasFocus = true;
}
void DialogSearchReplace::OnKillFocus (wxFocusEvent &event) {
Search.hasFocus = false;
}
/////////////////////// SearchReplaceEngine ///////////////////////
///////////////
// Constructor
@ -500,11 +521,24 @@ void SearchReplaceEngine::OnDialogClose() {
///////////////
// Open dialog
void SearchReplaceEngine::OpenDialog (bool replace) {
DialogSearchReplace *diag;
if (replace) diag = new DialogSearchReplace(NULL,true,_("Replace"));
else diag = new DialogSearchReplace(NULL,false,_("Find"));
diag->ShowModal();
delete diag;
static DialogSearchReplace *diag = NULL;
wxString title = replace? _("Replace") : _("Find");
// already opened
if (diag) {
// it's the right type so give focus
if(replace == hasReplace) {
diag->Show();
diag->SetFocus(); // is needed?
return;
}
// wrong type - destroy and create the right one
diag->Destroy();
}
// create new one
diag = new DialogSearchReplace(((AegisubApp*)wxTheApp)->frame,replace,title);
diag->Show();
hasReplace = replace;
}

View File

@ -57,15 +57,17 @@ private:
size_t replaceLen;
bool Modified;
bool LastWasFind;
bool hasReplace;
wxString *GetText(int n,int field);
public:
SubtitlesGrid *grid;
bool isReg;
bool matchCase;
bool updateVideo;
bool CanContinue;
bool hasFocus;
int field;
int affect;
wxString LookFor;
@ -79,6 +81,7 @@ public:
void OnDialogClose();
SearchReplaceEngine();
friend class DialogSearchReplace;
};
// Instance
@ -103,11 +106,13 @@ private:
void OnFindNext (wxCommandEvent &event);
void OnReplaceNext (wxCommandEvent &event);
void OnReplaceAll (wxCommandEvent &event);
void OnSetFocus (wxFocusEvent &event);
void OnKillFocus (wxFocusEvent &event);
void UpdateDropDowns();
public:
DialogSearchReplace(wxWindow *parent,bool hasReplace,wxString name);
~DialogSearchReplace();
void UpdateSettings();
DECLARE_EVENT_TABLE()
};

View File

@ -467,9 +467,11 @@ void FrameMain::OnSaveProjectAs(wxCommandEvent& WXUNUSED(event)) {
//////////////
// Open video
void FrameMain::OnOpenVideo(wxCommandEvent& WXUNUSED(event)) {
wxString filename = wxFileSelector(_("Open video file"),_T(""),_T(""),_T(""),_T("Recommended Formats (*.avi,*.avs,*.d2v)|*.avi;*.avs;*.d2v|Other supported formats (*.mkv,*.ogm,*.mp4,*.mpeg,*.mpg,*.vob)|*.mkv;*.ogm;*.mp4;*.mpeg;*.mpg;*.vob|All Files (*.*)|*.*"),wxOPEN | wxFILE_MUST_EXIST);
wxString path = Options.AsText(_T("Last open video path"));
wxString filename = wxFileSelector(_("Open video file"),path,_T(""),_T(""),_T("Recommended Formats (*.avi,*.avs,*.d2v)|*.avi;*.avs;*.d2v|Other supported formats (*.mkv,*.ogm,*.mp4,*.mpeg,*.mpg,*.vob)|*.mkv;*.ogm;*.mp4;*.mpeg;*.mpg;*.vob|All Files (*.*)|*.*"),wxOPEN | wxFILE_MUST_EXIST);
if (!filename.empty()) {
LoadVideo(filename);
Options.SetText(_T("Last open video path"), filename);
}
}
@ -484,9 +486,11 @@ void FrameMain::OnCloseVideo(wxCommandEvent& WXUNUSED(event)) {
//////////////
// Open Audio
void FrameMain::OnOpenAudio (wxCommandEvent& WXUNUSED(event)) {
wxString filename = wxFileSelector(_("Open audio file"),_T(""),_T(""),_T(""),_T("Audio Formats (*.wav,*.mp3,*.ogg,*.flac,*.mp4,*.ac3,*.aac,*.mka)|*.wav;*.mp3;*.ogg;*.flac;*.mp4;*.ac3;*.aac;*.mka|All files (*.*)|*.*"),wxOPEN | wxFILE_MUST_EXIST);
wxString path = Options.AsText(_T("Last open audio path"));
wxString filename = wxFileSelector(_("Open audio file"),path,_T(""),_T(""),_T("Audio Formats (*.wav,*.mp3,*.ogg,*.flac,*.mp4,*.ac3,*.aac,*.mka)|*.wav;*.mp3;*.ogg;*.flac;*.mp4;*.ac3;*.aac;*.mka|All files (*.*)|*.*"),wxOPEN | wxFILE_MUST_EXIST);
if (!filename.empty()) {
LoadAudio(filename);
Options.SetText(_T("Last open audio path"), filename);
}
}
@ -504,9 +508,11 @@ void FrameMain::OnCloseAudio (wxCommandEvent& WXUNUSED(event)) {
//////////////////
// Open subtitles
void FrameMain::OnOpenSubtitles(wxCommandEvent& WXUNUSED(event)) {
wxString filename = wxFileSelector(_("Open subtitles file"),_T(""),_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 path = Options.AsText(_T("Last open subtitles path"));
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);
}
}
@ -516,14 +522,16 @@ void FrameMain::OnOpenSubtitles(wxCommandEvent& WXUNUSED(event)) {
void FrameMain::OnOpenSubtitlesCharset(wxCommandEvent& WXUNUSED(event)) {
// Initialize charsets
wxArrayString choices = GetEncodings();
wxString path = Options.AsText(_T("Last open subtitles path"));
// Get options and load
wxString filename = wxFileSelector(_("Open subtitles file"),_T(""),_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()) {
wxString charset = wxGetSingleChoice(_("Choose charset code:"), _("Charset"),choices,this,-1, -1,true,250,200);
if (!charset.empty()) {
LoadSubtitles(filename,charset);
}
Options.SetText(_T("Last open subtitles path"), filename);
}
}
@ -571,9 +579,11 @@ void FrameMain::OnExportSubtitles(wxCommandEvent & WXUNUSED(event)) {
/////////////////
// Open VFR tags
void FrameMain::OnOpenVFR(wxCommandEvent &event) {
wxString filename = wxFileSelector(_("Open timecodes file"),_T(""),_T(""),_T(""),_T("All Supported Types (*.txt)|*.txt|All Files (*.*)|*.*"),wxOPEN | wxFILE_MUST_EXIST);
wxString path = Options.AsText(_T("Last open timecodes path"));
wxString filename = wxFileSelector(_("Open timecodes file"),path,_T(""),_T(""),_T("All Supported Types (*.txt)|*.txt|All Files (*.*)|*.*"),wxOPEN | wxFILE_MUST_EXIST);
if (!filename.empty()) {
LoadVFR(filename);
Options.SetText(_T("Last open timecodes path"), filename);
}
}

View File

@ -232,6 +232,12 @@ void OptionsManager::LoadDefaults() {
SetText(_T("Color Picker Recent"), _T("&H000000& &H0000FF& &H00FFFF& &H00FF00& &HFFFF00& &HFF0000& &HFF00FF& &HFFFFFF&"));
SetInt(_T("Color Picker Mode"), 4);
SetText(_T("Last open subtitles path"),_T(""));
SetText(_T("Last open video path"),_T(""));
SetText(_T("Last open audio path"),_T(""));
SetText(_T("Last open timecodes path"),_T(""));
SetText(_T("Last open automation path"),_T(""));
}

View File

@ -55,6 +55,8 @@
#include "main.h"
#include "frame_main.h"
#include "utils.h"
#include "dialog_search_replace.h"
///////////////
@ -275,7 +277,11 @@ void SubsEditBox::SetToLine(int n) {
// Set video
if (video->loaded) {
if (Options.AsBool(_T("Sync video with subs")) == true) {
wxString sync;
if (Search.hasFocus) sync = _T("Find update video");
else sync = _T("Sync video with subs");
if (Options.AsBool(sync) == true) {
video->Stop();
AssDialogue *cur = grid->GetDialogue(n);
if (cur) video->JumpToFrame(VFR_Output.GetFrameAtTime(cur->Start.GetMS(),true));