From 15ce684a738c8cbf7a93c23b30c38cd86bc35cbd Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 8 Mar 2004 19:23:13 +0000 Subject: [PATCH] Added parsing of mkvmerge's --capabilities output. Set some options depending on the capabilities. --- src/mmg/mmg.cpp | 224 +++++++++++++-------------- src/mmg/mmg.h | 7 + src/mmg/tab_input.cpp | 316 ++++++++++++++++++++------------------- src/mmg/tab_settings.cpp | 80 ++++++---- src/mmg/tab_settings.h | 2 + 5 files changed, 342 insertions(+), 287 deletions(-) diff --git a/src/mmg/mmg.cpp b/src/mmg/mmg.cpp index 3f5694691..8bb7b4137 100644 --- a/src/mmg/mmg.cpp +++ b/src/mmg/mmg.cpp @@ -55,6 +55,7 @@ wxString mkvmerge_path; vector last_settings; vector last_chapters; vector files; +map capabilities; wxString & break_line(wxString &line, @@ -64,21 +65,22 @@ break_line(wxString &line, for (i = 0, chars = 0; i < line.Length(); i++) { if (chars >= break_after) { - if ((line[i] == ',') || (line[i] == '.') || (line[i] == '-')) { + if ((line[i] == wxC(',')) || (line[i] == wxC('.')) || + (line[i] == wxC('-'))) { broken += line[i]; - broken += "\n"; + broken += wxS("\n"); chars = 0; - } else if (line[i] == ' ') { - broken += "\n"; + } else if (line[i] == wxC(' ')) { + broken += wxS("\n"); chars = 0; - } else if (line[i] == '(') { - broken += "\n("; + } else if (line[i] == wxC('(')) { + broken += wxS("\n("); chars = 0; } else { broken += line[i]; chars++; } - } else if ((chars != 0) || (broken[i] != ' ')) { + } else if ((chars != 0) || (broken[i] != wxC(' '))) { broken += line[i]; chars++; } @@ -93,11 +95,11 @@ extract_language_code(wxString source) { wxString copy; int pos; - if (source.Find("---") == 0) - return "---"; + if (source.Find(wxS("---")) == 0) + return wxS("---"); copy = source; - if ((pos = copy.Find(" (")) >= 0) + if ((pos = copy.Find(wxS(" ("))) >= 0) copy.Remove(pos); return copy; @@ -110,16 +112,16 @@ shell_escape(wxString source) { for (i = 0; i < source.Length(); i++) { #if defined(SYS_UNIX) || defined(SYS_APPLE) - if (source[i] == '"') - escaped += "\\\""; - else if (source[i] == '\\') - escaped += "\\\\"; + if (source[i] == wxC('"')) + escaped += wxS("\\\""); + else if (source[i] == wxC('\\')) + escaped += wxS("\\\\"); #else - if (source[i] == '"') + if (source[i] == wxC('"')) ; #endif - else if ((source[i] == '\n') || (source[i] == '\r')) - escaped += " "; + else if ((source[i] == wxC('\n')) || (source[i] == wxC('\r'))) + escaped += wxS(" "); else escaped += source[i]; } @@ -133,8 +135,8 @@ no_cr(wxString source) { wxString escaped; for (i = 0; i < source.Length(); i++) { - if (source[i] == '\n') - escaped += " "; + if (source[i] == wxC('\n')) + escaped += wxS(" "); else escaped += source[i]; } @@ -335,79 +337,80 @@ mmg_dialog::mmg_dialog(): wxFrame(NULL, -1, "mkvmerge GUI v" VERSION, mdlg = this; file_menu = new wxMenu(); - file_menu->Append(ID_M_FILE_NEW, _T("&New\tCtrl-N"), - _T("Start with empty settings")); - file_menu->Append(ID_M_FILE_LOAD, _T("&Load settings\tCtrl-L"), - _T("Load muxing settings from a file")); - file_menu->Append(ID_M_FILE_SAVE, _T("&Save settings\tCtrl-S"), - _T("Save muxing settings to a file")); + file_menu->Append(ID_M_FILE_NEW, wxS("&New\tCtrl-N"), + wxS("Start with empty settings")); + file_menu->Append(ID_M_FILE_LOAD, wxS("&Load settings\tCtrl-L"), + wxS("Load muxing settings from a file")); + file_menu->Append(ID_M_FILE_SAVE, wxS("&Save settings\tCtrl-S"), + wxS("Save muxing settings to a file")); file_menu->AppendSeparator(); - file_menu->Append(ID_M_FILE_SETOUTPUT, _T("Set &output file"), - _T("Select the file you want to write to")); + file_menu->Append(ID_M_FILE_SETOUTPUT, wxS("Set &output file"), + wxS("Select the file you want to write to")); file_menu->AppendSeparator(); - file_menu->Append(ID_M_FILE_EXIT, _T("&Quit\tCtrl-Q"), - _T("Quit the application")); + file_menu->Append(ID_M_FILE_EXIT, wxS("&Quit\tCtrl-Q"), + wxS("Quit the application")); file_menu_sep = false; update_file_menu(); wxMenu *muxing_menu = new wxMenu(); muxing_menu->Append(ID_M_MUXING_START, - _T("Sta&rt muxing (run mkvmerge)\tCtrl-R"), - _T("Run mkvmerge and start the muxing process")); + wxS("Sta&rt muxing (run mkvmerge)\tCtrl-R"), + wxS("Run mkvmerge and start the muxing process")); muxing_menu->Append(ID_M_MUXING_COPY_CMDLINE, - _T("&Copy command line to clipboard"), - _T("Copy the command line to the clipboard")); + wxS("&Copy command line to clipboard"), + wxS("Copy the command line to the clipboard")); muxing_menu->Append(ID_M_MUXING_SAVE_CMDLINE, - _T("Sa&ve command line"), - _T("Save the command line to a file")); + wxS("Sa&ve command line"), + wxS("Save the command line to a file")); muxing_menu->Append(ID_M_MUXING_CREATE_OPTIONFILE, - _T("Create &option file"), - _T("Save the command line to an option file " - "that can be read by mkvmerge")); + wxS("Create &option file"), + wxS("Save the command line to an option file " + "that can be read by mkvmerge")); chapter_menu = new wxMenu(); - chapter_menu->Append(ID_M_CHAPTERS_NEW, _T("&New chapters"), - _T("Create a new chapter file")); - chapter_menu->Append(ID_M_CHAPTERS_LOAD, _T("&Load"), - _T("Load a chapter file (simple/OGM format or XML " - "format)")); - chapter_menu->Append(ID_M_CHAPTERS_SAVE, _T("&Save"), - _T("Save the current chapters to a XML file")); - chapter_menu->Append(ID_M_CHAPTERS_SAVETOKAX, _T("Save to &Matroska file"), - _T("Save the current chapters to an existing Matroska " - "file")); - chapter_menu->Append(ID_M_CHAPTERS_SAVEAS, _T("Save &as"), - _T("Save the current chapters to a file with another " - "name")); + chapter_menu->Append(ID_M_CHAPTERS_NEW, wxS("&New chapters"), + wxS("Create a new chapter file")); + chapter_menu->Append(ID_M_CHAPTERS_LOAD, wxS("&Load"), + wxS("Load a chapter file (simple/OGM format or XML " + "format)")); + chapter_menu->Append(ID_M_CHAPTERS_SAVE, wxS("&Save"), + wxS("Save the current chapters to a XML file")); + chapter_menu->Append(ID_M_CHAPTERS_SAVETOKAX, wxS("Save to &Matroska file"), + wxS("Save the current chapters to an existing Matroska " + "file")); + chapter_menu->Append(ID_M_CHAPTERS_SAVEAS, wxS("Save &as"), + wxS("Save the current chapters to a file with another " + "name")); chapter_menu->AppendSeparator(); - chapter_menu->Append(ID_M_CHAPTERS_VERIFY, _T("&Verify"), - _T("Verify the current chapter entries to see if there " - "are any errors")); + chapter_menu->Append(ID_M_CHAPTERS_VERIFY, wxS("&Verify"), + wxS("Verify the current chapter entries to see if " + "there are any errors")); chapter_menu->AppendSeparator(); - chapter_menu->Append(ID_M_CHAPTERS_SETDEFAULTS, _T("Set &default values")); + chapter_menu->Append(ID_M_CHAPTERS_SETDEFAULTS, wxS("Set &default values")); chapter_menu_sep = false; update_chapter_menu(); wxMenu *window_menu = new wxMenu(); - window_menu->Append(ID_M_WINDOW_INPUT, _("&Input\tAlt-1")); - window_menu->Append(ID_M_WINDOW_ATTACHMENTS, _("&Attachments\tAlt-2")); - window_menu->Append(ID_M_WINDOW_GLOBAL, _("&Global options\tAlt-3")); - window_menu->Append(ID_M_WINDOW_ADVANCED, _("A&dvanced\tAlt-4")); - window_menu->Append(ID_M_WINDOW_SETTINGS, _("&Settings\tAlt-5")); + window_menu->Append(ID_M_WINDOW_INPUT, wxS("&Input\tAlt-1")); + window_menu->Append(ID_M_WINDOW_ATTACHMENTS, wxS("&Attachments\tAlt-2")); + window_menu->Append(ID_M_WINDOW_GLOBAL, wxS("&Global options\tAlt-3")); + window_menu->Append(ID_M_WINDOW_ADVANCED, wxS("A&dvanced\tAlt-4")); + window_menu->Append(ID_M_WINDOW_SETTINGS, wxS("&Settings\tAlt-5")); window_menu->AppendSeparator(); - window_menu->Append(ID_M_WINDOW_CHAPTEREDITOR, _("&Chapter editor\tAlt-6")); + window_menu->Append(ID_M_WINDOW_CHAPTEREDITOR, + wxS("&Chapter editor\tAlt-6")); wxMenu *help_menu = new wxMenu(); - help_menu->Append(ID_M_HELP_ABOUT, _T("&About\tF1"), - _T("Show program information")); + help_menu->Append(ID_M_HELP_ABOUT, wxS("&About\tF1"), + wxS("Show program information")); wxMenuBar *menu_bar = new wxMenuBar(); - menu_bar->Append(file_menu, _T("&File")); - menu_bar->Append(muxing_menu, _T("&Muxing")); - menu_bar->Append(chapter_menu, _T("&Chapter Editor")); - menu_bar->Append(window_menu, _("&Window")); - menu_bar->Append(help_menu, _T("&Help")); + menu_bar->Append(file_menu, wxS("&File")); + menu_bar->Append(muxing_menu, wxS("&Muxing")); + menu_bar->Append(chapter_menu, wxS("&Chapter Editor")); + menu_bar->Append(window_menu, wxS("&Window")); + menu_bar->Append(help_menu, wxS("&Help")); SetMenuBar(menu_bar); status_bar = new wxStatusBar(this, -1); @@ -423,44 +426,44 @@ mmg_dialog::mmg_dialog(): wxFrame(NULL, -1, "mkvmerge GUI v" VERSION, notebook = new wxNotebook(panel, ID_NOTEBOOK, wxDefaultPosition, wxSize(500, 500), wxNB_TOP); + settings_page = new tab_settings(notebook); input_page = new tab_input(notebook); attachments_page = new tab_attachments(notebook); global_page = new tab_global(notebook); advanced_page = new tab_advanced(notebook); - settings_page = new tab_settings(notebook); chapter_editor_page = new tab_chapters(notebook, chapter_menu); - notebook->AddPage(input_page, _("Input")); - notebook->AddPage(attachments_page, _("Attachments")); - notebook->AddPage(global_page, _("Global")); - notebook->AddPage(advanced_page, _("Advanced")); - notebook->AddPage(settings_page, _("Settings")); - notebook->AddPage(chapter_editor_page, _("Chapter Editor")); + notebook->AddPage(input_page, wxS("Input")); + notebook->AddPage(attachments_page, wxS("Attachments")); + notebook->AddPage(global_page, wxS("Global")); + notebook->AddPage(advanced_page, wxS("Advanced")); + notebook->AddPage(settings_page, wxS("Settings")); + notebook->AddPage(chapter_editor_page, wxS("Chapter Editor")); bs_main->Add(notebook, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT, 5); - wxStaticBox *sb_low = new wxStaticBox(panel, -1, _("Output filename")); + wxStaticBox *sb_low = new wxStaticBox(panel, -1, wxS("Output filename")); wxStaticBoxSizer *sbs_low = new wxStaticBoxSizer(sb_low, wxHORIZONTAL); bs_main->Add(sbs_low, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT, 5); tc_output = - new wxTextCtrl(panel, ID_TC_OUTPUT, _(""), wxDefaultPosition, + new wxTextCtrl(panel, ID_TC_OUTPUT, wxS(""), wxDefaultPosition, wxSize(400, -1), 0); sbs_low->Add(tc_output, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); b_browse_output = - new wxButton(panel, ID_B_BROWSEOUTPUT, _("Browse"), wxDefaultPosition, + new wxButton(panel, ID_B_BROWSEOUTPUT, wxS("Browse"), wxDefaultPosition, wxDefaultSize, 0); sbs_low->Add(b_browse_output, 0, wxALIGN_CENTER_VERTICAL | wxALL, 3); sb_commandline = - new wxStaticBox(panel, -1, _("Command line")); + new wxStaticBox(panel, -1, wxS("Command line")); wxStaticBoxSizer *sbs_low2 = new wxStaticBoxSizer(sb_commandline, wxHORIZONTAL); bs_main->Add(sbs_low2, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT, 5); tc_cmdline = - new wxTextCtrl(panel, ID_TC_CMDLINE, _(""), wxDefaultPosition, + new wxTextCtrl(panel, ID_TC_CMDLINE, wxS(""), wxDefaultPosition, wxSize(490, 50), wxTE_READONLY | wxTE_LINEWRAP | wxTE_MULTILINE); sbs_low2->Add(tc_cmdline, 0, wxALIGN_CENTER_VERTICAL | wxALL, 3); @@ -468,12 +471,12 @@ mmg_dialog::mmg_dialog(): wxFrame(NULL, -1, "mkvmerge GUI v" VERSION, wxBoxSizer *bs_buttons = new wxBoxSizer(wxHORIZONTAL); b_start_muxing = - new wxButton(panel, ID_B_STARTMUXING, _("Sta&rt muxing"), + new wxButton(panel, ID_B_STARTMUXING, wxS("Sta&rt muxing"), wxDefaultPosition, wxSize(130, -1)); bs_buttons->Add(b_start_muxing, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 8); b_copy_to_clipboard = - new wxButton(panel, ID_B_COPYTOCLIPBOARD, _("&Copy to clipboard"), + new wxButton(panel, ID_B_COPYTOCLIPBOARD, wxS("&Copy to clipboard"), wxDefaultPosition, wxSize(130, -1)); bs_buttons->Add(10, 0); bs_buttons->Add(b_copy_to_clipboard, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, @@ -500,12 +503,12 @@ mmg_dialog::mmg_dialog(): wxFrame(NULL, -1, "mkvmerge GUI v" VERSION, "Error loading settings", wxOK | wxCENTER | wxICON_ERROR); else { #ifdef SYS_WINDOWS - if ((file.Length() > 3) && (file.c_str()[1] != ':') && - (file.c_str()[0] != '\\')) - file = wxGetCwd() + "\\" + file; + if ((file.Length() > 3) && (file.c_str()[1] != wxC(':')) && + (file.c_str()[0] != wxC('\\'))) + file = wxGetCwd() + wxS("\\") + file; #else - if ((file.Length() > 0) && (file.c_str()[0] != '/')) - file = wxGetCwd() + "/" + file; + if ((file.Length() > 0) && (file.c_str()[0] != wxC('/'))) + file = wxGetCwd() + wxS("/") + file; #endif load(file); } @@ -516,8 +519,8 @@ void mmg_dialog::on_browse_output(wxCommandEvent &evt) { wxFileDialog dlg(NULL, "Choose an output file", last_open_dir, tc_output->GetValue().AfterLast(PSEP), - _T("Matroska A/V files (*.mka;*.mkv)|*.mka;*.mkv|" - ALLFILES), wxSAVE | wxOVERWRITE_PROMPT); + wxS("Matroska A/V files (*.mka;*.mkv)|*.mka;*.mkv|" + ALLFILES), wxSAVE | wxOVERWRITE_PROMPT); if(dlg.ShowModal() == wxID_OK) { last_open_dir = dlg.GetDirectory(); tc_output->SetValue(dlg.GetPath()); @@ -566,7 +569,7 @@ mmg_dialog::on_file_new(wxCommandEvent &evt) { void mmg_dialog::on_file_load(wxCommandEvent &evt) { wxFileDialog dlg(NULL, "Choose an input file", last_open_dir, "", - _T("mkvmerge GUI settings (*.mmg)|*.mmg|" ALLFILES), + wxS("mkvmerge GUI settings (*.mmg)|*.mmg|" ALLFILES), wxOPEN); if(dlg.ShowModal() == wxID_OK) { if (!wxFileExists(dlg.GetPath()) || wxDirExists(dlg.GetPath())) { @@ -611,7 +614,7 @@ mmg_dialog::load(wxString file_name) { void mmg_dialog::on_file_save(wxCommandEvent &evt) { wxFileDialog dlg(NULL, "Choose an output file", last_open_dir, "", - _T("mkvmerge GUI settings (*.mmg)|*.mmg|" ALLFILES), + wxS("mkvmerge GUI settings (*.mmg)|*.mmg|" ALLFILES), wxSAVE | wxOVERWRITE_PROMPT); if(dlg.ShowModal() == wxID_OK) { last_open_dir = dlg.GetDirectory(); @@ -709,8 +712,8 @@ mmg_dialog::on_run(wxCommandEvent &evt) { update_command_line(); if (tc_output->GetValue().Length() == 0) { - wxMessageBox(_("You have not yet selected an output file."), - _("mkvmerge GUI: error"), wxOK | wxCENTER | wxICON_ERROR); + wxMessageBox(wxS("You have not yet selected an output file."), + wxS("mkvmerge GUI: error"), wxOK | wxCENTER | wxICON_ERROR); return; } @@ -734,19 +737,20 @@ mmg_dialog::on_run(wxCommandEvent &evt) { void mmg_dialog::on_about(wxCommandEvent &evt) { - wxMessageBox(_("mkvmerge GUI v" VERSION "\n" - "This GUI was written by Moritz Bunkus \n" - "Based on mmg by Florian Wagner \n" - "mkvmerge GUI is licensed under the GPL.\n" - "http://www.bunkus.org/videotools/mkvtoolnix/\n" - "\n" - "Help is available in form of tool tips and the HTML " - "documentation\n" - "for mkvmerge, mkvmerge.html. It can also be viewed online " - "at\n" - "http://www.bunkus.org/videotools/mkvtoolnix/doc/" - "mkvmerge.html"), - "About mkvmerge's GUI", wxOK | wxCENTER | wxICON_INFORMATION); + wxMessageBox(wxS("mkvmerge GUI v" VERSION "\n" + "This GUI was written by Moritz Bunkus " + "\nBased on mmg by Florian Wagner \n" + "mkvmerge GUI is licensed under the GPL.\n" + "http://www.bunkus.org/videotools/mkvtoolnix/\n" + "\n" + "Help is available in form of tool tips and the HTML " + "documentation\n" + "for mkvmerge, mkvmerge.html. It can also be viewed online " + "at\n" + "http://www.bunkus.org/videotools/mkvtoolnix/doc/" + "mkvmerge.html"), + wxS("About mkvmerge's GUI"), + wxOK | wxCENTER | wxICON_INFORMATION); } void @@ -1059,7 +1063,7 @@ mmg_dialog::update_command_line() { if (global_page->cob_chap_language->GetValue().Length() > 0) { clargs.Add("--chapter-language"); clargs.Add(extract_language_code(global_page-> - cob_chap_language->GetValue())); + cob_chap_language->GetValue())); } if (global_page->cob_chap_charset->GetValue().Length() > 0) { @@ -1272,7 +1276,8 @@ BEGIN_EVENT_TABLE(mmg_dialog, wxFrame) EVT_MENU(ID_M_WINDOW_CHAPTEREDITOR, mmg_dialog::on_window_selected) END_EVENT_TABLE(); -bool mmg_app::OnInit() { +bool +mmg_app::OnInit() { wxConfigBase *cfg; uint32_t i; wxString k, v; @@ -1305,7 +1310,8 @@ bool mmg_app::OnInit() { return true; } -int mmg_app::OnExit() { +int +mmg_app::OnExit() { wxString s; wxConfigBase *cfg; diff --git a/src/mmg/mmg.h b/src/mmg/mmg.h index fe7eb13dc..7e1da009f 100644 --- a/src/mmg/mmg.h +++ b/src/mmg/mmg.h @@ -22,6 +22,7 @@ #ifndef __MMG_H #define __MMG_H +#include #include #include "os.h" @@ -83,6 +84,11 @@ typedef struct { int style; } mmg_attachment_t; +struct lt_wxString { + bool operator()(const wxString s1, const wxString s2) const { + return s1.Cmp(s2) < 0; + } +}; extern wxString last_open_dir; extern wxString mkvmerge_path; extern vector last_settings; @@ -92,6 +98,7 @@ extern vector attachments; extern wxArrayString sorted_charsets; extern wxArrayString sorted_iso_codes; extern bool title_was_present; +extern map capabilities; wxString &break_line(wxString &line, int break_after = 80); wxString extract_language_code(wxString source); diff --git a/src/mmg/tab_input.cpp b/src/mmg/tab_input.cpp index f832a03cd..f8bdf4339 100644 --- a/src/mmg/tab_input.cpp +++ b/src/mmg/tab_input.cpp @@ -50,68 +50,68 @@ tab_input::tab_input(wxWindow *parent): wxString language; wxArrayString popular_languages; - new wxStaticText(this, wxID_STATIC, _("Input files:"), wxPoint(5, 5), + new wxStaticText(this, wxID_STATIC, wxS("Input files:"), wxPoint(5, 5), wxDefaultSize, 0); lb_input_files = new wxListBox(this, ID_LB_INPUTFILES, wxPoint(5, 24), wxSize(360, 60), 0); b_add_file = - new wxButton(this, ID_B_ADDFILE, _("add"), wxPoint(375, 24), + new wxButton(this, ID_B_ADDFILE, wxS("add"), wxPoint(375, 24), wxSize(50, -1)); b_remove_file = - new wxButton(this, ID_B_REMOVEFILE, _("remove"), wxPoint(375, 56), + new wxButton(this, ID_B_REMOVEFILE, wxS("remove"), wxPoint(375, 56), wxSize(50, -1)); b_remove_file->Enable(false); b_file_up = - new wxButton(this, ID_B_INPUTUP, _("up"), wxPoint(435, 24), + new wxButton(this, ID_B_INPUTUP, wxS("up"), wxPoint(435, 24), wxSize(50, -1)); b_file_up->Enable(false); b_file_down = - new wxButton(this, ID_B_INPUTDOWN, _("down"), wxPoint(435, 56), + new wxButton(this, ID_B_INPUTDOWN, wxS("down"), wxPoint(435, 56), wxSize(50, -1)); b_file_down->Enable(false); - new wxStaticText(this, wxID_STATIC, _("File options:"), wxPoint(5, 90), + new wxStaticText(this, wxID_STATIC, wxS("File options:"), wxPoint(5, 90), wxDefaultSize, 0); cb_no_chapters = - new wxCheckBox(this, ID_CB_NOCHAPTERS, _("No chapters"), + new wxCheckBox(this, ID_CB_NOCHAPTERS, wxS("No chapters"), wxPoint(90, 90 + YOFF2), wxDefaultSize, 0); cb_no_chapters->SetValue(false); - cb_no_chapters->SetToolTip(_("Do not copy chapters from this file. Only " - "applies to Matroska files.")); + cb_no_chapters->SetToolTip(wxS("Do not copy chapters from this file. Only " + "applies to Matroska files.")); cb_no_chapters->Enable(false); cb_no_attachments = - new wxCheckBox(this, ID_CB_NOATTACHMENTS, _("No attachments"), + new wxCheckBox(this, ID_CB_NOATTACHMENTS, wxS("No attachments"), wxPoint(195, 90 + YOFF2), wxDefaultSize, 0); cb_no_attachments->SetValue(false); - cb_no_attachments->SetToolTip(_("Do not copy attachments from this file. " - "Only applies to Matroska files.")); + cb_no_attachments->SetToolTip(wxS("Do not copy attachments from this file. " + "Only applies to Matroska files.")); cb_no_attachments->Enable(false); cb_no_tags = - new wxCheckBox(this, ID_CB_NOTAGS, _("No tags"), wxPoint(315, 90 + YOFF2), - wxDefaultSize, 0); + new wxCheckBox(this, ID_CB_NOTAGS, wxS("No tags"), + wxPoint(315, 90 + YOFF2), wxDefaultSize, 0); cb_no_tags->SetValue(false); - cb_no_tags->SetToolTip(_("Do not copy tags from this file. Only " - "applies to Matroska files.")); + cb_no_tags->SetToolTip(wxS("Do not copy tags from this file. Only " + "applies to Matroska files.")); cb_no_tags->Enable(false); - new wxStaticText(this, wxID_STATIC, _("Tracks:"), wxPoint(5, 110), + new wxStaticText(this, wxID_STATIC, wxS("Tracks:"), wxPoint(5, 110), wxDefaultSize, 0); clb_tracks = new wxCheckListBox(this, ID_CLB_TRACKS, wxPoint(5, 130), wxSize(420, 100), 0, NULL, 0); clb_tracks->Enable(false); b_track_up = - new wxButton(this, ID_B_TRACKUP, _("up"), wxPoint(435, 130), + new wxButton(this, ID_B_TRACKUP, wxS("up"), wxPoint(435, 130), wxSize(50, -1)); b_track_up->Enable(false); b_track_down = - new wxButton(this, ID_B_TRACKDOWN, _("down"), wxPoint(435, 162), + new wxButton(this, ID_B_TRACKDOWN, wxS("down"), wxPoint(435, 162), wxSize(50, -1)); b_track_down->Enable(false); - new wxStaticText(this, wxID_STATIC, _("Track options:"), wxPoint(5, 235), + new wxStaticText(this, wxID_STATIC, wxS("Track options:"), wxPoint(5, 235), wxDefaultSize, 0); - new wxStaticText(this, wxID_STATIC, _("Language:"), wxPoint(5, 255), + new wxStaticText(this, wxID_STATIC, wxS("Language:"), wxPoint(5, 255), wxDefaultSize, 0); if (sorted_iso_codes.Count() == 0) { @@ -149,62 +149,63 @@ tab_input::tab_input(wxWindow *parent): } cob_language = - new wxComboBox(this, ID_CB_LANGUAGE, _(""), wxPoint(90, 255 + YOFF), + new wxComboBox(this, ID_CB_LANGUAGE, wxS(""), wxPoint(90, 255 + YOFF), wxSize(130, -1), 0, NULL, wxCB_DROPDOWN | wxCB_READONLY); - cob_language->SetToolTip(_("Language for this track. Select one of the " - "ISO639-2 language codes.")); - cob_language->Append(_("none")); + cob_language->SetToolTip(wxS("Language for this track. Select one of the " + "ISO639-2 language codes.")); + cob_language->Append(wxS("none")); for (i = 0; i < sorted_iso_codes.Count(); i++) cob_language->Append(sorted_iso_codes[i]); - new wxStaticText(this, wxID_STATIC, _("Delay (in ms):"), + new wxStaticText(this, wxID_STATIC, wxS("Delay (in ms):"), wxPoint(255, 255), wxDefaultSize, 0); tc_delay = - new wxTextCtrl(this, ID_TC_DELAY, _(""), wxPoint(355, 255 + YOFF), + new wxTextCtrl(this, ID_TC_DELAY, wxS(""), wxPoint(355, 255 + YOFF), wxSize(130, -1), 0); - tc_delay->SetToolTip(_("Delay this track by a couple of ms. Can be " - "negative. Only applies to audio and subtitle tracks." - " Some audio formats cannot be delayed at the " - "moment.")); - new wxStaticText(this, wxID_STATIC, _("Track name:"), wxPoint(5, 280), + tc_delay->SetToolTip(wxS("Delay this track by a couple of ms. Can be " + "negative. Only applies to audio and subtitle " + "tracks. Some audio formats cannot be delayed at " + "the moment.")); + new wxStaticText(this, wxID_STATIC, wxS("Track name:"), wxPoint(5, 280), wxDefaultSize, 0); tc_track_name = - new wxTextCtrl(this, ID_TC_TRACKNAME, _(""), wxPoint(90, 280 + YOFF), + new wxTextCtrl(this, ID_TC_TRACKNAME, wxS(""), wxPoint(90, 280 + YOFF), wxSize(130, -1), 0); - tc_track_name->SetToolTip(_("Name for this track, e.g. \"director's " - "comments\".")); - new wxStaticText(this, wxID_STATIC, _("Stretch by:"), wxPoint(255, 280), + tc_track_name->SetToolTip(wxS("Name for this track, e.g. \"director's " + "comments\".")); + new wxStaticText(this, wxID_STATIC, wxS("Stretch by:"), wxPoint(255, 280), wxDefaultSize, 0); tc_stretch = - new wxTextCtrl(this, ID_TC_STRETCH, _(""), wxPoint(355, 280 + YOFF), + new wxTextCtrl(this, ID_TC_STRETCH, wxS(""), wxPoint(355, 280 + YOFF), wxSize(130, -1), 0); - tc_stretch->SetToolTip(_("Stretch the audio or subtitle track by a factor. " - "This should be a positive floating point number. " - "Not all formats can be stretched at the moment.")); - new wxStaticText(this, wxID_STATIC, _("Cues:"), wxPoint(5, 305), + tc_stretch->SetToolTip(wxS("Stretch the audio or subtitle track by a " + "factor. This should be a positive floating " + "point number. Not all formats can be stretched " + "at the moment.")); + new wxStaticText(this, wxID_STATIC, wxS("Cues:"), wxPoint(5, 305), wxDefaultSize, 0); cob_cues = - new wxComboBox(this, ID_CB_CUES, _(""), wxPoint(90, 305 + YOFF), + new wxComboBox(this, ID_CB_CUES, wxS(""), wxPoint(90, 305 + YOFF), wxSize(130, -1), 0, NULL, wxCB_DROPDOWN | wxCB_READONLY); - cob_cues->SetToolTip(_("Selects for which blocks mkvmerge will produce " - "index entries ( = cue entries). \"default\" is a " - "good choice for almost all situations.")); - cob_cues->Append(_("default")); - cob_cues->Append(_("only for I frames")); - cob_cues->Append(_("for all frames")); - cob_cues->Append(_("none")); - new wxStaticText(this, wxID_STATIC, _("Subtitle charset:"), + cob_cues->SetToolTip(wxS("Selects for which blocks mkvmerge will produce " + "index entries ( = cue entries). \"default\" is a " + "good choice for almost all situations.")); + cob_cues->Append(wxS("default")); + cob_cues->Append(wxS("only for I frames")); + cob_cues->Append(wxS("for all frames")); + cob_cues->Append(wxS("none")); + new wxStaticText(this, wxID_STATIC, wxS("Subtitle charset:"), wxPoint(255, 305 + YOFF), wxDefaultSize, 0); cob_sub_charset = - new wxComboBox(this, ID_CB_SUBTITLECHARSET, _(""), + new wxComboBox(this, ID_CB_SUBTITLECHARSET, wxS(""), wxPoint(355, 305 + YOFF), wxSize(130, -1), 0, NULL, wxCB_DROPDOWN | wxCB_READONLY); - cob_sub_charset->SetToolTip(_("Selects the character set a subtitle file " - "was written with. Only needed for non-UTF " - "files that mkvmerge does not detect " - "correctly.")); - cob_sub_charset->Append(_("default")); + cob_sub_charset->SetToolTip(wxS("Selects the character set a subtitle file " + "was written with. Only needed for non-UTF " + "files that mkvmerge does not detect " + "correctly.")); + cob_sub_charset->Append(wxS("default")); if (sorted_charsets.Count() == 0) { for (i = 0; sub_charsets[i] != NULL; i++) @@ -215,42 +216,46 @@ tab_input::tab_input(wxWindow *parent): for (i = 0; i < sorted_charsets.Count(); i++) cob_sub_charset->Append(sorted_charsets[i]); - new wxStaticText(this, -1, _("FourCC:"), wxPoint(5, 330), + new wxStaticText(this, -1, wxS("FourCC:"), wxPoint(5, 330), wxDefaultSize, 0); cob_fourcc = - new wxComboBox(this, ID_CB_FOURCC, _(""), wxPoint(90, 330 + YOFF), + new wxComboBox(this, ID_CB_FOURCC, wxS(""), wxPoint(90, 330 + YOFF), wxSize(130, -1), 0, NULL, wxCB_DROPDOWN); cob_fourcc->Append(""); cob_fourcc->Append("DIVX"); cob_fourcc->Append("DIV3"); cob_fourcc->Append("DX50"); cob_fourcc->Append("XVID"); - cob_fourcc->SetToolTip(_T("Forces the FourCC of the video track to this " - "value. Note that this only works for video " - "tracks that use the AVI compatibility mode " - "or for QuickTime video tracks. This option " - "CANNOT be used to change Matroska's CodecID.")); + cob_fourcc->SetToolTip(wxS("Forces the FourCC of the video track to this " + "value. Note that this only works for video " + "tracks that use the AVI compatibility mode " + "or for QuickTime video tracks. This option " + "CANNOT be used to change Matroska's CodecID.")); - new wxStaticText(this, -1, _("Compression:"), wxPoint(255, 330), + new wxStaticText(this, -1, wxS("Compression:"), wxPoint(255, 330), wxDefaultSize, 0); cob_compression = - new wxComboBox(this, ID_CB_COMPRESSION, _(""), wxPoint(355, 330 + YOFF), + new wxComboBox(this, ID_CB_COMPRESSION, wxS(""), wxPoint(355, 330 + YOFF), wxSize(130, -1), 0, NULL, wxCB_DROPDOWN | wxCB_READONLY); cob_compression->Append(""); cob_compression->Append("none"); cob_compression->Append("zlib"); - cob_compression->SetToolTip(_T("Sets the compression used for VobSub " - "subtitles. If nothing is chosen then the " - "VobSubs will be automatically compressed " - "with zlib. 'none' results is files that " - "are a lot larger.")); + if (capabilities[wxS("BZ2")] == wxS("true")) + cob_compression->Append("bz2"); + if (capabilities[wxS("LZO")] == wxS("true")) + cob_compression->Append("lzo"); + cob_compression->SetToolTip(wxS("Sets the compression used for VobSub " + "subtitles. If nothing is chosen then the " + "VobSubs will be automatically compressed " + "with zlib. 'none' results is files that " + "are a lot larger.")); rb_aspect_ratio = - new wxRadioButton(this, ID_RB_ASPECTRATIO, _("Aspect ratio:"), + new wxRadioButton(this, ID_RB_ASPECTRATIO, wxS("Aspect ratio:"), wxPoint(5, 355), wxDefaultSize, wxRB_GROUP); rb_aspect_ratio->SetValue(true); cob_aspect_ratio = - new wxComboBox(this, ID_CB_ASPECTRATIO, _(""), wxPoint(110, 355 + YOFF), + new wxComboBox(this, ID_CB_ASPECTRATIO, wxS(""), wxPoint(110, 355 + YOFF), wxSize(110, -1), 0, NULL, wxCB_DROPDOWN); cob_aspect_ratio->Append(""); cob_aspect_ratio->Append("4/3"); @@ -260,72 +265,73 @@ tab_input::tab_input(wxWindow *parent): cob_aspect_ratio->Append("2.00"); cob_aspect_ratio->Append("2.21"); cob_aspect_ratio->Append("2.35"); - cob_aspect_ratio->SetToolTip(_T("Sets the display aspect ratio of the track." - " The format can be either 'a/b' in which " - "case both numbers must be integer (e.g. " - "16/9) or just a single floting point " - "number 'f' (e.g. 2.35).")); + cob_aspect_ratio->SetToolTip(wxS("Sets the display aspect ratio of the " + "track. The format can be either 'a/b' in " + "which case both numbers must be integer " + "(e.g. 16/9) or just a single floting " + "point number 'f' (e.g. 2.35).")); - new wxStaticText(this, wxID_STATIC, _("or"), wxPoint(220, 360), + new wxStaticText(this, wxID_STATIC, wxS("or"), wxPoint(220, 360), wxSize(35, -1), wxALIGN_CENTER); rb_display_dimensions = new wxRadioButton(this, ID_RB_DISPLAYDIMENSIONS, - _("Display width/height:"), wxPoint(255, 355), + wxS("Display width/height:"), wxPoint(255, 355), wxDefaultSize); rb_display_dimensions->SetValue(false); tc_display_width = new wxTextCtrl(this, ID_TC_DISPLAYWIDTH, "", wxPoint(405, 355 + YOFF), wxSize(35, -1)); - tc_display_width->SetToolTip(_T("Sets the display width of the track." - "The height must be set as well, or this " - "field will be ignored.")); + tc_display_width->SetToolTip(wxS("Sets the display width of the track." + "The height must be set as well, or this " + "field will be ignored.")); new wxStaticText(this, wxID_STATIC, "x", wxPoint(440, 360), wxSize(10, -1), wxALIGN_CENTER); tc_display_height = new wxTextCtrl(this, ID_TC_DISPLAYHEIGHT, "", wxPoint(450, 355 + YOFF), wxSize(35, -1)); - tc_display_height->SetToolTip(_T("Sets the display height of the track." - "The width must be set as well, or this " - "field will be ignored.")); + tc_display_height->SetToolTip(wxS("Sets the display height of the track." + "The width must be set as well, or this " + "field will be ignored.")); cb_default = - new wxCheckBox(this, ID_CB_MAKEDEFAULT, _("Make default track"), + new wxCheckBox(this, ID_CB_MAKEDEFAULT, wxS("Make default track"), wxPoint(5, 380), wxSize(200, -1), 0); cb_default->SetValue(false); - cb_default->SetToolTip(_("Make this track the default track for its type " - "(audio, video, subtitles). Players should prefer " - "tracks with the default track flag set.")); + cb_default->SetToolTip(wxS("Make this track the default track for its type " + "(audio, video, subtitles). Players should " + "prefer tracks with the default track flag " + "set.")); cb_aac_is_sbr = - new wxCheckBox(this, ID_CB_AACISSBR, _("AAC is SBR/HE-AAC/AAC+"), + new wxCheckBox(this, ID_CB_AACISSBR, wxS("AAC is SBR/HE-AAC/AAC+"), wxPoint(255, 380), wxSize(200, -1), 0); cb_aac_is_sbr->SetValue(false); - cb_aac_is_sbr->SetToolTip(_("This track contains SBR AAC/HE-AAC/AAC+ data. " - "Only needed for AAC input files, because SBR " - "AAC cannot be detected automatically for " - "these files. Not needed for AAC tracks read " - "from MP4 or Matroska files.")); + cb_aac_is_sbr->SetToolTip(wxS("This track contains SBR AAC/HE-AAC/AAC+ data." + " Only needed for AAC input files, because SBR" + " AAC cannot be detected automatically for " + "these files. Not needed for AAC tracks read " + "from MP4 or Matroska files.")); - new wxStaticText(this, wxID_STATIC, _("Tags:"), wxPoint(5, 405), + new wxStaticText(this, wxID_STATIC, wxS("Tags:"), wxPoint(5, 405), wxDefaultSize, 0); tc_tags = - new wxTextCtrl(this, ID_TC_TAGS, _(""), wxPoint(90, 405 + YOFF), + new wxTextCtrl(this, ID_TC_TAGS, wxS(""), wxPoint(90, 405 + YOFF), wxSize(280, -1)); b_browse_tags = - new wxButton(this, ID_B_BROWSETAGS, _("Browse"), wxPoint(390, 405 + YOFF), - wxDefaultSize, 0); + new wxButton(this, ID_B_BROWSETAGS, wxS("Browse"), + wxPoint(390, 405 + YOFF), wxDefaultSize, 0); - new wxStaticText(this, wxID_STATIC, _("Timecodes:"), wxPoint(5, 430), + new wxStaticText(this, wxID_STATIC, wxS("Timecodes:"), wxPoint(5, 430), wxDefaultSize, 0); tc_timecodes = - new wxTextCtrl(this, ID_TC_TIMECODES, _(""), wxPoint(90, 430 + YOFF), + new wxTextCtrl(this, ID_TC_TIMECODES, wxS(""), wxPoint(90, 430 + YOFF), wxSize(280, -1)); tc_timecodes->SetToolTip("mkvmerge can read and use timecodes from an " "external text file. This feature is a very " "advanced feature. Almost all users should leave " "this entry empty."); b_browse_timecodes = - new wxButton(this, ID_B_BROWSE_TIMECODES, _("Browse"), + new wxButton(this, ID_B_BROWSE_TIMECODES, wxS("Browse"), wxPoint(390, 430 + YOFF), wxDefaultSize, 0); b_browse_timecodes->SetToolTip("mkvmerge can read and use timecodes from an " "external text file. This feature is a very " @@ -445,44 +451,46 @@ void tab_input::enable_ar_controls(mmg_track_t *track) { void tab_input::on_add_file(wxCommandEvent &evt) { mmg_file_t file; - wxString file_name, name, command, id, type, exact; + wxString file_name, name, command, id, type, exact, media_files; wxArrayString output, errors; vector args, pair; int result, pos; unsigned int i, k; + media_files = wxS("Media files (*.aac;*.ac3;*.ass;*.avi;*.dts;"); + if (capabilities[wxS("FLAC")] == wxS("true")) + media_files += wxS("*.flac;*.idx;"); + media_files += wxS("*.m4a;*.mp2;*.mp3;*.mka;" + "*.mkv;*.mov;*.mp4;*.ogm;*.ogg;" + "*.ra;*.ram;*.rm;*.rmvb;*.rv;" + "*.srt;*.ssa;" + "*.wav)|" + "*.aac;*.ac3;*.ass;*.avi;*.dts;*.flac;" + "*.idx;*.mp2;*.mp3;*.mka;" + "*.mkv;*.mov;" + "*.mp4;*.ogm;*.ogg;" + "*.ra;*.ram;*.rm;*.rmvb;*.rv;" + "*.srt;*.ssa;*.wav|" + "AAC (Advanced Audio Coding) (*.aac;*.m4a;*.mp4)|" + "*.aac;*.m4a;*.mp4|" + "A/52 (aka AC3) (*.ac3)|*.ac3|" + "AVI (Audio/Video Interleaved) (*.avi)|*.avi|" + "DTS (Digital Theater System) (*.dts)|*.dts|"); + if (capabilities[wxS("FLAC")] == wxS("true")) + media_files += wxS("FLAC (Free Lossless Audio Codec) (*.flac;*.ogg)|" + "*.flac;*.ogg|"); + media_files += wxS("MPEG audio files (*.mp2;*.mp3)|*.mp2;*.mp3|" + "Matroska A/V files (*.mka;*.mkv)|*.mka;*.mkv|" + "QuickTime/MP4 A/V (*.mov;*.mp4)|*.mov;*.mp4|" + "Audio/Video embedded in OGG (*.ogg;*.ogm)|*.ogg;*.ogm|" + "RealMedia Files (*.ra;*.ram;*.rm;*.rmvb;*.rv)|" + "*.ra;*.ram;*.rm;*.rmvb;*.rv|" + "SRT text subtitles (*.srt)|*.srt|" + "SSA/ASS text subtitles (*.ssa;*.ass)|*.ssa;*.ass|" + "VobSub subtitles (*.idx)|*.idx|" + "WAVE (uncompressed PCM) (*.wav)|*.wav|" ALLFILES); wxFileDialog dlg(NULL, "Choose an input file", last_open_dir, "", - _T("Media files (*.aac;*.ac3;*.ass;*.avi;*.dts;" - "*.flac;*.idx;" - "*.m4a;*.mp2;*.mp3;*.mka;" - "*.mkv;*.mov;*.mp4;*.ogm;*.ogg;" - "*.ra;*.ram;*.rm;*.rmvb;*.rv;" - "*.srt;*.ssa;" - "*.wav)|" - "*.aac;*.ac3;*.ass;*.avi;*.dts;*.flac;" - "*.idx;*.mp2;*.mp3;*.mka;" - "*.mkv;*.mov;" - "*.mp4;*.ogm;*.ogg;" - "*.ra;*.ram;*.rm;*.rmvb;*.rv;" - "*.srt;*.ssa;*.wav|" - "AAC (Advanced Audio Coding) (*.aac;*.m4a;*.mp4)|" - "*.aac;*.m4a;*.mp4|" - "A/52 (aka AC3) (*.ac3)|*.ac3|" - "AVI (Audio/Video Interleaved) (*.avi)|*.avi|" - "DTS (Digital Theater System) (*.dts)|*.dts|" - "FLAC (Free Lossless Audio Codec) (*.flac;*.ogg)|*.flac;" - "*.ogg|" - "MPEG audio files (*.mp2;*.mp3)|*.mp2;*.mp3|" - "Matroska A/V files (*.mka;*.mkv)|*.mka;*.mkv|" - "QuickTime/MP4 A/V (*.mov;*.mp4)|*.mov;*.mp4|" - "Audio/Video embedded in OGG (*.ogg;*.ogm)|*.ogg;*.ogm|" - "RealMedia Files (*.ra;*.ram;*.rm;*.rmvb;*.rv)|" - "*.ra;*.ram;*.rm;*.rmvb;*.rv|" - "SRT text subtitles (*.srt)|*.srt|" - "SSA/ASS text subtitles (*.ssa;*.ass)|*.ssa;*.ass|" - "VobSub subtitles (*.idx)|*.idx|" - "WAVE (uncompressed PCM) (*.wav)|*.wav|" ALLFILES), - wxOPEN); + media_files, wxOPEN); if(dlg.ShowModal() == wxID_OK) { last_open_dir = dlg.GetDirectory(); @@ -955,7 +963,7 @@ void tab_input::on_browse_tags(wxCommandEvent &evt) { return; wxFileDialog dlg(NULL, "Choose a tag file", last_open_dir, "", - _T("Tag files (*.xml;*.txt)|*.xml;*.txt|" ALLFILES), + wxS("Tag files (*.xml;*.txt)|*.xml;*.txt|" ALLFILES), wxOPEN); if(dlg.ShowModal() == wxID_OK) { last_open_dir = dlg.GetDirectory(); @@ -969,7 +977,7 @@ void tab_input::on_browse_timecodes_clicked(wxCommandEvent &evt) { return; wxFileDialog dlg(NULL, "Choose a timecodes file", last_open_dir, "", - _T("Tag files (*.txt)|*.txt|" ALLFILES), wxOPEN); + wxS("Tag files (*.txt)|*.txt|" ALLFILES), wxOPEN); if(dlg.ShowModal() == wxID_OK) { last_open_dir = dlg.GetDirectory(); *(*files[selected_file].tracks)[selected_track].timecodes = dlg.GetPath(); @@ -1308,9 +1316,10 @@ bool tab_input::validate_settings() { s = t->delay->c_str(); strip(s); if ((s.length() > 0) && !parse_int(s.c_str(), dummy_i)) { - wxMessageBox(_("The delay setting for track nr. " + sid + " in " - "file '" + *f->file_name + "' is invalid."), - _("mkvmerge GUI: error"), wxOK | wxCENTER | wxICON_ERROR); + wxMessageBox(wxS("The delay setting for track nr. " + sid + " in " + "file '" + *f->file_name + "' is invalid."), + wxS("mkvmerge GUI: error"), + wxOK | wxCENTER | wxICON_ERROR); return false; } @@ -1326,10 +1335,10 @@ bool tab_input::validate_settings() { dot_present = true; i++; } else { - wxMessageBox(_("The stretch setting for track nr. " + sid + " in " - "file '" + *f->file_name + "' is invalid."), - _("mkvmerge GUI: error"), wxOK | wxCENTER | - wxICON_ERROR); + wxMessageBox(wxS("The stretch setting for track nr. ") + sid + + wxS(" in file '") + *f->file_name + + wxS("' is invalid."), wxS("mkvmerge GUI: error"), + wxOK | wxCENTER | wxICON_ERROR); return false; } } @@ -1338,10 +1347,11 @@ bool tab_input::validate_settings() { s = t->fourcc->c_str(); strip(s); if ((s.length() > 0) && (s.length() != 4)) { - wxMessageBox(_("The FourCC setting for track nr. " + sid + " in " - "file '" + *f->file_name + "' is not excatly four " - "characters long."), - _("mkvmerge GUI: error"), wxOK | wxCENTER | wxICON_ERROR); + wxMessageBox(wxS("The FourCC setting for track nr. ") + sid + + wxS(" in file '") + *f->file_name + + wxS("' is not excatly four characters long."), + wxS("mkvmerge GUI: error"), + wxOK | wxCENTER | wxICON_ERROR); return false; } @@ -1381,9 +1391,9 @@ bool tab_input::validate_settings() { } if (!ok) { - wxMessageBox(_("The aspect ratio setting for track nr. " + sid + - " in file '" + *f->file_name + "' is invalid."), - _("mkvmerge GUI: error"), wxOK | wxCENTER | + wxMessageBox(wxS("The aspect ratio setting for track nr. " + sid + + " in file '" + *f->file_name + "' is invalid."), + wxS("mkvmerge GUI: error"), wxOK | wxCENTER | wxICON_ERROR); return false; } @@ -1392,9 +1402,9 @@ bool tab_input::validate_settings() { } if (!tracks_selected) { - wxMessageBox(_("You have not yet selected any input file and/or no " - "tracks."), - _("mkvmerge GUI: error"), wxOK | wxCENTER | wxICON_ERROR); + wxMessageBox(wxS("You have not yet selected any input file and/or no " + "tracks."), + wxS("mkvmerge GUI: error"), wxOK | wxCENTER | wxICON_ERROR); return false; } diff --git a/src/mmg/tab_settings.cpp b/src/mmg/tab_settings.cpp index afa55f1e6..07617337a 100644 --- a/src/mmg/tab_settings.cpp +++ b/src/mmg/tab_settings.cpp @@ -35,76 +35,106 @@ tab_settings::tab_settings(wxWindow *parent): wxPanel(parent, -1, wxDefaultPosition, wxSize(100, 400), wxTAB_TRAVERSAL) { - new wxStaticBox(this, -1, _("mkvmrge executable"), wxPoint(10, 5), + new wxStaticBox(this, -1, wxS("mkvmrge executable"), wxPoint(10, 5), wxSize(475, 50)); tc_mkvmerge = - new wxTextCtrl(this, ID_TC_MKVMERGE, _(""), wxPoint(15, 25), + new wxTextCtrl(this, ID_TC_MKVMERGE, wxS(""), wxPoint(15, 25), wxSize(370, -1), wxTE_READONLY); - new wxButton(this, ID_B_BROWSEMKVMERGE, _("Browse"), wxPoint(395, 25), + new wxButton(this, ID_B_BROWSEMKVMERGE, wxS("Browse"), wxPoint(395, 25), wxDefaultSize, 0); - new wxStaticBox(this, -1, _("About"), wxPoint(10, 350), + new wxStaticBox(this, -1, wxS("About"), wxPoint(10, 350), wxSize(475, 104)); new wxStaticBitmap(this, -1, wxBitmap(matroskalogo_big_xpm), wxPoint(20, 370), wxSize(64,64)); new wxStaticText(this, wxID_STATIC, - _("mkvmerge GUI v" VERSION "\n" - "This GUI was written by Moritz Bunkus \n" - "Based on mmg by Florian Wagner \n" - "mkvmerge GUI is licensed under the GPL.\n" - "http://www.bunkus.org/videotools/mkvtoolnix/"), + wxS("mkvmerge GUI v" VERSION "\n" + "This GUI was written by Moritz Bunkus \n" + "Based on mmg by Florian Wagner \n" + "mkvmerge GUI is licensed under the GPL.\n" + "http://www.bunkus.org/videotools/mkvtoolnix/"), wxPoint(95, 360), wxDefaultSize, 0); load_preferences(); } tab_settings::~tab_settings() { -// delete wxConfigBase::Get(); } -void tab_settings::on_browse(wxCommandEvent &evt) { - wxFileDialog dlg(NULL, "Choose the mkvmerge executable", - tc_mkvmerge->GetValue().BeforeLast(PSEP), "", +void +tab_settings::on_browse(wxCommandEvent &evt) { + wxFileDialog dlg(NULL, wxS("Choose the mkvmerge executable"), + tc_mkvmerge->GetValue().BeforeLast(PSEP), wxS(""), #ifdef SYS_WINDOWS - _T("Executable files (*.exe)|*.exe|" ALLFILES), + wxS("Executable files (*.exe)|*.exe|" ALLFILES), #else - _T("All files (*)|*"), + wxS("All files (*)|*"), #endif wxOPEN); if(dlg.ShowModal() == wxID_OK) { tc_mkvmerge->SetValue(dlg.GetPath()); mkvmerge_path = dlg.GetPath(); save_preferences(); + query_mkvmerge_capabilities(); } } -void tab_settings::load_preferences() { +void +tab_settings::load_preferences() { wxConfig *cfg = (wxConfig *)wxConfigBase::Get(); - cfg->SetPath("/GUI"); - if (!cfg->Read("mkvmerge_executable", &mkvmerge_path)) - mkvmerge_path = "mkvmerge"; + cfg->SetPath(wxS("/GUI")); + if (!cfg->Read(wxS("mkvmerge_executable"), &mkvmerge_path)) + mkvmerge_path = wxS("mkvmerge"); tc_mkvmerge->SetValue(mkvmerge_path); + query_mkvmerge_capabilities(); } -void tab_settings::save_preferences() { +void +tab_settings::save_preferences() { wxConfig *cfg = (wxConfig *)wxConfigBase::Get(); - cfg->Write("/GUI/mkvmerge_executable", tc_mkvmerge->GetValue()); + cfg->Write(wxS("/GUI/mkvmerge_executable"), tc_mkvmerge->GetValue()); cfg->Flush(); } -void tab_settings::save(wxConfigBase *cfg) { +void +tab_settings::save(wxConfigBase *cfg) { } -void tab_settings::load(wxConfigBase *cfg) { +void +tab_settings::load(wxConfigBase *cfg) { } -bool tab_settings::validate_settings() { +bool +tab_settings::validate_settings() { return true; } +void +tab_settings::query_mkvmerge_capabilities() { + wxString tmp; + wxArrayString output, errors; + vector parts; + int result, i; + + tmp = wxS("\"") + mkvmerge_path + wxS("\" --capabilities"); + result = wxExecute(tmp, output, errors); + if (result == 0) { + capabilities.clear(); + for (i = 0; i < output.Count(); i++) { + tmp = output[i]; + strip(tmp); + parts = split(tmp, "=", 2); + if (parts.size() == 1) + capabilities[parts[0]] = "true"; + else + capabilities[parts[0]] = parts[1]; + } + } +} + IMPLEMENT_CLASS(tab_settings, wxPanel); BEGIN_EVENT_TABLE(tab_settings, wxPanel) EVT_BUTTON(ID_B_BROWSEMKVMERGE, tab_settings::on_browse) diff --git a/src/mmg/tab_settings.h b/src/mmg/tab_settings.h index 6746d8732..34b2c72cf 100644 --- a/src/mmg/tab_settings.h +++ b/src/mmg/tab_settings.h @@ -44,6 +44,8 @@ public: void save(wxConfigBase *cfg); void load(wxConfigBase *cfg); bool validate_settings(); + + void query_mkvmerge_capabilities(); }; #endif // __TAB_SETTINGS_H