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) 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; if (sfnames.empty()) return;
Options.SetText(_T("Last open automation path"), sfnames);
wxFileName sfname(sfnames); wxFileName sfname(sfnames);
if (sfname.FileExists()) { if (sfname.FileExists()) {
@ -162,8 +165,10 @@ void DialogAutomationManager::OnCreate(wxCommandEvent &event)
void DialogAutomationManager::OnAdd(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; if (sfnames.empty()) return;
Options.SetText(_T("Last open automation path"), sfnames);
try { try {
AutomationScriptFile *sfile = AutomationScriptFile::CreateFromFile(sfnames); 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) - 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) - 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) - 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 =========================== = 1.09 beta - 2006.01.16 ===========================

View File

@ -45,7 +45,8 @@
#include "options.h" #include "options.h"
#include "subs_edit_box.h" #include "subs_edit_box.h"
#include "video_display.h" #include "video_display.h"
#include "frame_main.h"
#include "main.h"
/////////////// ///////////////
// Constructor // Constructor
@ -79,7 +80,7 @@ DialogSearchReplace::DialogSearchReplace (wxWindow *parent,bool _hasReplace,wxSt
CheckRegExp->SetValue(Options.AsBool(_T("Find RegExp"))); CheckRegExp->SetValue(Options.AsBool(_T("Find RegExp")));
//CheckRegExp->Enable(false); //CheckRegExp->Enable(false);
CheckUpdateVideo->SetValue(Options.AsBool(_T("Find Update Video"))); 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(CheckMatchCase,0,wxBOTTOM,5);
OptionsSizer->Add(CheckRegExp,0,wxBOTTOM,5); OptionsSizer->Add(CheckRegExp,0,wxBOTTOM,5);
OptionsSizer->Add(CheckUpdateVideo,0,wxBOTTOM,0); OptionsSizer->Add(CheckUpdateVideo,0,wxBOTTOM,0);
@ -133,6 +134,16 @@ DialogSearchReplace::DialogSearchReplace (wxWindow *parent,bool _hasReplace,wxSt
// Destructor // Destructor
DialogSearchReplace::~DialogSearchReplace() { DialogSearchReplace::~DialogSearchReplace() {
// Save options // 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 Match Case"),CheckMatchCase->IsChecked());
Options.SetBool(_T("Find RegExp"),CheckRegExp->IsChecked()); Options.SetBool(_T("Find RegExp"),CheckRegExp->IsChecked());
Options.SetBool(_T("Find Update Video"),CheckUpdateVideo->IsChecked()); Options.SetBool(_T("Find Update Video"),CheckUpdateVideo->IsChecked());
@ -141,7 +152,6 @@ DialogSearchReplace::~DialogSearchReplace() {
Options.Save(); Options.Save();
} }
/////////////// ///////////////
// Event table // Event table
BEGIN_EVENT_TABLE(DialogSearchReplace,wxDialog) BEGIN_EVENT_TABLE(DialogSearchReplace,wxDialog)
@ -149,21 +159,17 @@ BEGIN_EVENT_TABLE(DialogSearchReplace,wxDialog)
EVT_BUTTON(BUTTON_FIND_NEXT,DialogSearchReplace::OnFindNext) EVT_BUTTON(BUTTON_FIND_NEXT,DialogSearchReplace::OnFindNext)
EVT_BUTTON(BUTTON_REPLACE_NEXT,DialogSearchReplace::OnReplaceNext) EVT_BUTTON(BUTTON_REPLACE_NEXT,DialogSearchReplace::OnReplaceNext)
EVT_BUTTON(BUTTON_REPLACE_ALL,DialogSearchReplace::OnReplaceAll) EVT_BUTTON(BUTTON_REPLACE_ALL,DialogSearchReplace::OnReplaceAll)
EVT_SET_FOCUS(DialogSearchReplace::OnSetFocus)
EVT_KILL_FOCUS(DialogSearchReplace::OnKillFocus)
END_EVENT_TABLE() END_EVENT_TABLE()
///////// /////////
// Close // Close
void DialogSearchReplace::OnClose (wxCommandEvent &event) { 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(); Search.OnDialogClose();
// Just hide
// Close Show(false);
if (IsModal()) EndModal(0);
else Destroy();
} }
@ -184,6 +190,12 @@ void DialogSearchReplace::OnFindNext (wxCommandEvent &event) {
Search.field = Field->GetSelection(); Search.field = Field->GetSelection();
Search.FindNext(); Search.FindNext();
if (hasReplace) {
wxString ReplaceWith = ReplaceEdit->GetValue();
Search.ReplaceWith = ReplaceWith;
Options.AddToRecentList(ReplaceWith,_T("Recent replace"));
}
// Add to history // Add to history
Options.AddToRecentList(LookFor,_T("Recent find")); Options.AddToRecentList(LookFor,_T("Recent find"));
UpdateDropDowns(); UpdateDropDowns();
@ -261,6 +273,15 @@ void DialogSearchReplace::UpdateDropDowns() {
} }
void DialogSearchReplace::OnSetFocus (wxFocusEvent &event) {
Search.hasFocus = true;
}
void DialogSearchReplace::OnKillFocus (wxFocusEvent &event) {
Search.hasFocus = false;
}
/////////////////////// SearchReplaceEngine /////////////////////// /////////////////////// SearchReplaceEngine ///////////////////////
/////////////// ///////////////
// Constructor // Constructor
@ -500,11 +521,24 @@ void SearchReplaceEngine::OnDialogClose() {
/////////////// ///////////////
// Open dialog // Open dialog
void SearchReplaceEngine::OpenDialog (bool replace) { void SearchReplaceEngine::OpenDialog (bool replace) {
DialogSearchReplace *diag; static DialogSearchReplace *diag = NULL;
if (replace) diag = new DialogSearchReplace(NULL,true,_("Replace")); wxString title = replace? _("Replace") : _("Find");
else diag = new DialogSearchReplace(NULL,false,_("Find"));
diag->ShowModal(); // already opened
delete diag; 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,6 +57,7 @@ private:
size_t replaceLen; size_t replaceLen;
bool Modified; bool Modified;
bool LastWasFind; bool LastWasFind;
bool hasReplace;
wxString *GetText(int n,int field); wxString *GetText(int n,int field);
@ -66,6 +67,7 @@ public:
bool matchCase; bool matchCase;
bool updateVideo; bool updateVideo;
bool CanContinue; bool CanContinue;
bool hasFocus;
int field; int field;
int affect; int affect;
wxString LookFor; wxString LookFor;
@ -79,6 +81,7 @@ public:
void OnDialogClose(); void OnDialogClose();
SearchReplaceEngine(); SearchReplaceEngine();
friend class DialogSearchReplace;
}; };
// Instance // Instance
@ -103,11 +106,13 @@ private:
void OnFindNext (wxCommandEvent &event); void OnFindNext (wxCommandEvent &event);
void OnReplaceNext (wxCommandEvent &event); void OnReplaceNext (wxCommandEvent &event);
void OnReplaceAll (wxCommandEvent &event); void OnReplaceAll (wxCommandEvent &event);
void OnSetFocus (wxFocusEvent &event);
void OnKillFocus (wxFocusEvent &event);
void UpdateDropDowns(); void UpdateDropDowns();
public: public:
DialogSearchReplace(wxWindow *parent,bool hasReplace,wxString name); DialogSearchReplace(wxWindow *parent,bool hasReplace,wxString name);
~DialogSearchReplace(); ~DialogSearchReplace();
void UpdateSettings();
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@ -467,9 +467,11 @@ void FrameMain::OnSaveProjectAs(wxCommandEvent& WXUNUSED(event)) {
////////////// //////////////
// Open video // Open video
void FrameMain::OnOpenVideo(wxCommandEvent& WXUNUSED(event)) { 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()) { if (!filename.empty()) {
LoadVideo(filename); LoadVideo(filename);
Options.SetText(_T("Last open video path"), filename);
} }
} }
@ -484,9 +486,11 @@ void FrameMain::OnCloseVideo(wxCommandEvent& WXUNUSED(event)) {
////////////// //////////////
// Open Audio // Open Audio
void FrameMain::OnOpenAudio (wxCommandEvent& WXUNUSED(event)) { 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()) { if (!filename.empty()) {
LoadAudio(filename); LoadAudio(filename);
Options.SetText(_T("Last open audio path"), filename);
} }
} }
@ -504,9 +508,11 @@ void FrameMain::OnCloseAudio (wxCommandEvent& WXUNUSED(event)) {
////////////////// //////////////////
// Open subtitles // Open subtitles
void FrameMain::OnOpenSubtitles(wxCommandEvent& WXUNUSED(event)) { 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()) { if (!filename.empty()) {
LoadSubtitles(filename); 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)) { void FrameMain::OnOpenSubtitlesCharset(wxCommandEvent& WXUNUSED(event)) {
// Initialize charsets // Initialize charsets
wxArrayString choices = GetEncodings(); wxArrayString choices = GetEncodings();
wxString path = Options.AsText(_T("Last open subtitles path"));
// Get options and load // 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()) { if (!filename.empty()) {
wxString charset = wxGetSingleChoice(_("Choose charset code:"), _("Charset"),choices,this,-1, -1,true,250,200); wxString charset = wxGetSingleChoice(_("Choose charset code:"), _("Charset"),choices,this,-1, -1,true,250,200);
if (!charset.empty()) { if (!charset.empty()) {
LoadSubtitles(filename,charset); LoadSubtitles(filename,charset);
} }
Options.SetText(_T("Last open subtitles path"), filename);
} }
} }
@ -571,9 +579,11 @@ void FrameMain::OnExportSubtitles(wxCommandEvent & WXUNUSED(event)) {
///////////////// /////////////////
// Open VFR tags // Open VFR tags
void FrameMain::OnOpenVFR(wxCommandEvent &event) { 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()) { if (!filename.empty()) {
LoadVFR(filename); 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&")); SetText(_T("Color Picker Recent"), _T("&H000000& &H0000FF& &H00FFFF& &H00FF00& &HFFFF00& &HFF0000& &HFF00FF& &HFFFFFF&"));
SetInt(_T("Color Picker Mode"), 4); 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 "main.h"
#include "frame_main.h" #include "frame_main.h"
#include "utils.h" #include "utils.h"
#include "dialog_search_replace.h"
/////////////// ///////////////
@ -275,7 +277,11 @@ void SubsEditBox::SetToLine(int n) {
// Set video // Set video
if (video->loaded) { 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(); video->Stop();
AssDialogue *cur = grid->GetDialogue(n); AssDialogue *cur = grid->GetDialogue(n);
if (cur) video->JumpToFrame(VFR_Output.GetFrameAtTime(cur->Start.GetMS(),true)); if (cur) video->JumpToFrame(VFR_Output.GetFrameAtTime(cur->Start.GetMS(),true));