diff --git a/ChangeLog b/ChangeLog index 2e6444f3b..3ef5fd47d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,16 @@ 2004-03-09 Moritz Bunkus + * mmg: new feature: Automatically set the output file name when + the first file is added to the same name but with a '.mkv' + extension if it hasn't been set yet. Can be disabled on the + 'settings' page. + * mkvmerge: bug fix: More of the non-ASCII character fixes (in --tags and --chapters this time). * mkvmerge/mmg: new feature: Made the process priority selectable - and default to 'normal' again (was 'lower' before). + on the 'settings' page and default to 'normal' again (was 'lower' + before). 2004-03-07 Moritz Bunkus diff --git a/src/mmg/mmg.cpp b/src/mmg/mmg.cpp index cd5241464..df5f71b45 100644 --- a/src/mmg/mmg.cpp +++ b/src/mmg/mmg.cpp @@ -1234,12 +1234,25 @@ mmg_dialog::on_window_selected(wxCommandEvent &evt) { } void -mmg_dialog::set_title_maybe(const char *new_title) { - if ((strlen(new_title) > 0) && +mmg_dialog::set_title_maybe(const wxString &new_title) { + if ((new_title.length() > 0) && (global_page->tc_title->GetValue().length() == 0)) global_page->tc_title->SetValue(new_title); } +void +mmg_dialog::set_output_maybe(const wxString &new_output) { + wxString output; + + if (settings_page->cb_autoset_output_filename->IsChecked() && + (new_output.length() > 0) && + (tc_output->GetValue().length() == 0)) { + output = new_output.BeforeLast('.'); + output += ".mkv"; + tc_output->SetValue(output); + } +} + IMPLEMENT_CLASS(mmg_dialog, wxFrame); BEGIN_EVENT_TABLE(mmg_dialog, wxFrame) EVT_BUTTON(ID_B_BROWSEOUTPUT, mmg_dialog::on_browse_output) diff --git a/src/mmg/mmg_dialog.h b/src/mmg/mmg_dialog.h index 30642da96..633e1ae1f 100644 --- a/src/mmg/mmg_dialog.h +++ b/src/mmg/mmg_dialog.h @@ -149,7 +149,8 @@ public: void on_window_selected(wxCommandEvent &evt); - void set_title_maybe(const char *new_title); + void set_title_maybe(const wxString &new_title); + void set_output_maybe(const wxString &new_output); }; extern mmg_dialog *mdlg; diff --git a/src/mmg/tab_input.cpp b/src/mmg/tab_input.cpp index f8bdf4339..779ad838a 100644 --- a/src/mmg/tab_input.cpp +++ b/src/mmg/tab_input.cpp @@ -634,7 +634,8 @@ void tab_input::on_add_file(wxCommandEvent &evt) { lb_input_files->Append(name); file.file_name = new wxString(dlg.GetPath()); - mdlg->set_title_maybe(file.title->c_str()); + mdlg->set_title_maybe(*file.title); + mdlg->set_output_maybe(*file.file_name); files.push_back(file); } } diff --git a/src/mmg/tab_settings.cpp b/src/mmg/tab_settings.cpp index 69538839b..ba88d9471 100644 --- a/src/mmg/tab_settings.cpp +++ b/src/mmg/tab_settings.cpp @@ -45,7 +45,7 @@ tab_settings::tab_settings(wxWindow *parent): wxDefaultSize, 0); new wxStaticBox(this, -1, wxS("Miscellaneous options"), wxPoint(10, 65), - wxSize(475, 50)); + wxSize(475, 75)); new wxStaticText(this, -1, wxS("Process priority:"), wxPoint(15, 85)); cob_priority = new wxComboBox(this, ID_COB_PRIORITY, wxS(""), wxPoint(120, 85 + YOFF), @@ -60,6 +60,16 @@ tab_settings::tab_settings(wxWindow *parent): cob_priority->Append(wxS("lower")); cob_priority->Append(wxS("lowest")); + cb_autoset_output_filename = + new wxCheckBox(this, ID_CB_AUTOSET_OUTPUT_FILENAME, + wxS("Auto-set output filename"), wxPoint(15, 115 + YOFF)); + cb_autoset_output_filename-> + SetToolTip(wxS("If checked mmg will automatically set the output filename " + "if it hasn't been set already. This happens when you add " + "a file. It will be set to the same name as the " + "input file but with the extension '.mkv'. If unset mmg " + "will not touch the output filename.")); + new wxStaticBox(this, -1, wxS("About"), wxPoint(10, 350), wxSize(475, 104)); @@ -100,7 +110,7 @@ tab_settings::on_browse(wxCommandEvent &evt) { } void -tab_settings::on_priority_selected(wxCommandEvent &evt) { +tab_settings::on_xyz_selected(wxCommandEvent &evt) { save_preferences(); } @@ -108,6 +118,7 @@ void tab_settings::load_preferences() { wxConfig *cfg = (wxConfig *)wxConfigBase::Get(); wxString priority; + bool b; int i; cfg->SetPath(wxS("/GUI")); @@ -124,6 +135,10 @@ tab_settings::load_preferences() { cob_priority->SetSelection(i); break; } + + if (!cfg->Read(wxS("autoset_output_filename"), &b)) + b = true; + cb_autoset_output_filename->SetValue(b); } void @@ -132,6 +147,8 @@ tab_settings::save_preferences() { cfg->SetPath(wxS("/GUI")); cfg->Write(wxS("mkvmerge_executable"), tc_mkvmerge->GetValue()); cfg->Write(wxS("process_priority"), cob_priority->GetValue()); + cfg->Write(wxS("autoset_output_filename"), + cb_autoset_output_filename->IsChecked()); cfg->Flush(); } @@ -174,5 +191,6 @@ tab_settings::query_mkvmerge_capabilities() { IMPLEMENT_CLASS(tab_settings, wxPanel); BEGIN_EVENT_TABLE(tab_settings, wxPanel) EVT_BUTTON(ID_B_BROWSEMKVMERGE, tab_settings::on_browse) - EVT_COMBOBOX(ID_COB_PRIORITY, tab_settings::on_priority_selected) + EVT_COMBOBOX(ID_COB_PRIORITY, tab_settings::on_xyz_selected) + EVT_CHECKBOX(ID_CB_AUTOSET_OUTPUT_FILENAME, tab_settings::on_xyz_selected) END_EVENT_TABLE(); diff --git a/src/mmg/tab_settings.h b/src/mmg/tab_settings.h index 3e5780a2b..97b3711c3 100644 --- a/src/mmg/tab_settings.h +++ b/src/mmg/tab_settings.h @@ -25,13 +25,14 @@ #define ID_TC_MKVMERGE 15000 #define ID_B_BROWSEMKVMERGE 15001 #define ID_COB_PRIORITY 15002 +#define ID_CB_AUTOSET_OUTPUT_FILENAME 15003 class tab_settings: public wxPanel { DECLARE_CLASS(tab_settings); DECLARE_EVENT_TABLE(); public: wxTextCtrl *tc_mkvmerge; - wxCheckBox *cb_show_commandline; + wxCheckBox *cb_show_commandline, *cb_autoset_output_filename; wxComboBox *cob_priority; public: @@ -39,7 +40,7 @@ public: virtual ~tab_settings(); void on_browse(wxCommandEvent &evt); - void on_priority_selected(wxCommandEvent &evt); + void on_xyz_selected(wxCommandEvent &evt); void load_preferences(); void save_preferences();