From 64c6c7ee073a7d23ff5a2076e12ad73542bcad94 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Tue, 19 Jun 2007 04:04:46 +0000 Subject: [PATCH] Added the associations dialogue to the menu and made Aegisub capable of associating sub and ttxt, as well as opening them by command line or drag-drop Originally committed to SVN as r1260. --- aegisub/changelog.txt | 4 +++- aegisub/dialog_associations.cpp | 6 ++++++ aegisub/frame_main.cpp | 6 ++++++ aegisub/frame_main.h | 2 ++ aegisub/frame_main_events.cpp | 10 ++++++++++ aegisub/main.cpp | 4 +++- 6 files changed, 30 insertions(+), 2 deletions(-) diff --git a/aegisub/changelog.txt b/aegisub/changelog.txt index 75d70b0b7..6239f424f 100644 --- a/aegisub/changelog.txt +++ b/aegisub/changelog.txt @@ -83,12 +83,14 @@ Please visit http://aegisub.net to download latest version o Fixed loading of SRT and TXT files, which were causing an empty line to appear at the start of the file. (AMZ) o Added support for reading v4.00++ (ASS2) files. (AMZ) o Added very basic reading support for MPEG-4 Streaming Text (TTXT) subtitles. (AMZ) - o Added full read-write support for MicroDVD subtitles. (AMZ) + o Added full read-write support for MicroDVD subtitles (the most common .sub format). (AMZ) + o Improved saving of SRT files. (AMZ) - Changes to main menu: o There are now new options, and most were moved around to have better organization. (AMZ/jfs) o General tweaks changes, such as better icons, and fixing of flickering and slowness. (AMZ) o Undo and redo now have descriptions. (Dansolo) o Merged the three "Recombine" functions into a single one that autodetects the correct type, and also supports two new cases. (AMZ) + o Added the associations dialogue to the menu. (AMZ) - Subtitles grid changes: o Fixed line selection after pasting. (AMZ) o Plain-text lines can now be pasted into the grid. They will be inserted as default lines with the text as their content. (AMZ) diff --git a/aegisub/dialog_associations.cpp b/aegisub/dialog_associations.cpp index 16d99edd0..c2f7185c6 100644 --- a/aegisub/dialog_associations.cpp +++ b/aegisub/dialog_associations.cpp @@ -50,10 +50,14 @@ DialogAssociations::DialogAssociations (wxWindow *parent) choices.Add(_T("Advanced Substation Alpha (.ass)")); choices.Add(_T("Substation Alpha (.ssa)")); choices.Add(_T("SubRip (.srt)")); + choices.Add(_T("MicroDVD (.sub)")); + choices.Add(_T("MPEG-4 Timed Text (.ttxt)")); ListBox = new wxCheckListBox(this,-1,wxDefaultPosition,wxSize(200,80), choices); ListBox->Check(0,CheckAssociation(_T("ass"))); ListBox->Check(1,CheckAssociation(_T("ssa"))); ListBox->Check(2,CheckAssociation(_T("srt"))); + ListBox->Check(3,CheckAssociation(_T("sub"))); + ListBox->Check(4,CheckAssociation(_T("ttxt"))); // Label and list sizer wxStaticText *label = new wxStaticText(this,-1,_("Please select the formats you want to\nassociate with Aegisub:"),wxDefaultPosition,wxDefaultSize); @@ -125,5 +129,7 @@ void DialogAssociations::OnOK(wxCommandEvent &event) { if (ListBox->IsChecked(0)) AssociateType(_T("ass")); if (ListBox->IsChecked(1)) AssociateType(_T("ssa")); if (ListBox->IsChecked(2)) AssociateType(_T("srt")); + if (ListBox->IsChecked(3)) AssociateType(_T("sub")); + if (ListBox->IsChecked(4)) AssociateType(_T("ttxt")); event.Skip(); } diff --git a/aegisub/frame_main.cpp b/aegisub/frame_main.cpp index aeaf22292..8a5cb8150 100644 --- a/aegisub/frame_main.cpp +++ b/aegisub/frame_main.cpp @@ -415,7 +415,10 @@ void FrameMain::InitMenu() { viewMenu = new wxMenu(); AppendBitmapMenuItem(viewMenu,Menu_View_Language, _T("&Language..."), _("Select Aegisub interface language"), wxBITMAP(blank_button)); AppendBitmapMenuItem(viewMenu,Menu_Tools_Options, _("&Options...") + wxString(_T("\t")) + Hotkeys.GetText(_T("Options")), _("Configure Aegisub"), wxBITMAP(options_button)); + AppendBitmapMenuItem(viewMenu,Menu_View_Associations, _("&Associations..."), _("Associate file types with Aegisub"), wxBITMAP(blank_button)); +#ifdef __WXDEBUG__ AppendBitmapMenuItem(viewMenu,Menu_Tools_Log, _("Lo&g window..."), _("Open log window"), wxBITMAP(blank_button)); +#endif viewMenu->AppendSeparator(); viewMenu->AppendRadioItem(Menu_View_Subs, _("Subs only view"), _("Display subtitles only")); viewMenu->AppendRadioItem(Menu_View_Video, _("Video+Subs view"), _("Display video and subtitles only")); @@ -1265,7 +1268,9 @@ bool FrameMain::LoadList(wxArrayString list) { subsList.Add(_T("ass")); subsList.Add(_T("ssa")); subsList.Add(_T("srt")); + subsList.Add(_T("sub")); subsList.Add(_T("txt")); + subsList.Add(_T("ttxt")); // Audio formats wxArrayString audioList; @@ -1279,6 +1284,7 @@ bool FrameMain::LoadList(wxArrayString list) { audioList.Add(_T("ape")); audioList.Add(_T("flac")); audioList.Add(_T("mka")); + audioList.Add(_T("m4a")); // Scan list wxString audio = _T(""); diff --git a/aegisub/frame_main.h b/aegisub/frame_main.h index d9c0aa266..999896756 100644 --- a/aegisub/frame_main.h +++ b/aegisub/frame_main.h @@ -167,6 +167,7 @@ private: void OnCloseAudio (wxCommandEvent &event); void OnChooseLanguage (wxCommandEvent &event); + void OnPickAssociations (wxCommandEvent &event); void OnViewStandard (wxCommandEvent &event); void OnViewVideo (wxCommandEvent &event); void OnViewAudio (wxCommandEvent &event); @@ -339,6 +340,7 @@ enum { Menu_Edit_Delete, Menu_View_Language, + Menu_View_Associations, Menu_View_Standard, Menu_View_Audio, Menu_View_Video, diff --git a/aegisub/frame_main_events.cpp b/aegisub/frame_main_events.cpp index a236898b4..1dd9605b7 100644 --- a/aegisub/frame_main_events.cpp +++ b/aegisub/frame_main_events.cpp @@ -79,6 +79,7 @@ #include "dialog_detached_video.h" #include "dialog_dummy_video.h" #include "dialog_spellchecker.h" +#include "dialog_associations.h" //////////////////// @@ -180,6 +181,7 @@ BEGIN_EVENT_TABLE(FrameMain, wxFrame) EVT_MENU(Menu_Help_About, FrameMain::OnAbout) EVT_MENU(Menu_View_Language, FrameMain::OnChooseLanguage) + EVT_MENU(Menu_View_Associations, FrameMain::OnPickAssociations) EVT_MENU(Menu_View_Standard, FrameMain::OnViewStandard) EVT_MENU(Menu_View_Audio, FrameMain::OnViewAudio) EVT_MENU(Menu_View_Video, FrameMain::OnViewVideo) @@ -1522,6 +1524,14 @@ void FrameMain::OnChooseLanguage (wxCommandEvent &event) { } +///////////////////// +// Pick associations +void FrameMain::OnPickAssociations(wxCommandEvent &event) { + DialogAssociations diag(NULL); + diag.ShowModal(); +} + + ///////////////// // View standard void FrameMain::OnViewStandard (wxCommandEvent &event) { diff --git a/aegisub/main.cpp b/aegisub/main.cpp index 3b56955ce..d5595a76e 100644 --- a/aegisub/main.cpp +++ b/aegisub/main.cpp @@ -294,7 +294,9 @@ void AegisubApp::RegistryAssociate () { // Check associations if (Options.AsBool(_T("Show associations"))) { - bool gotAll = DialogAssociations::CheckAssociation(_T("ass")) && DialogAssociations::CheckAssociation(_T("ssa")) && DialogAssociations::CheckAssociation(_T("srt")); + bool gotAll = DialogAssociations::CheckAssociation(_T("ass")) && DialogAssociations::CheckAssociation(_T("ssa")) && + DialogAssociations::CheckAssociation(_T("srt")) && DialogAssociations::CheckAssociation(_T("sub")) && + DialogAssociations::CheckAssociation(_T("ttxt")); if (!gotAll) { DialogAssociations diag(NULL); diag.ShowModal();