From 9c325d1be4170b4761b101c27dcf7295dbcdb3c8 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sat, 30 Jun 2007 17:21:07 +0000 Subject: [PATCH] Added a buton 'remove all' which removes all input files and tracks leaving all other options as they are. Fix for bug 248. --- ChangeLog | 4 ++++ src/mmg/tab_input.cpp | 38 ++++++++++++++++++++++++++++++++++++++ src/mmg/tab_input.h | 4 +++- 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bd5fb6e75..f3b27ce2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-06-30 Moritz Bunkus + * mmg: new feature: Added a buton 'remove all' which removes all + input files and tracks leaving all other options as they are. Fix + for bug 248. + * mmg: new feature: Added an option for setting the default output directory if the automatic setting of the output file name is turned on. Fix for bug 248. diff --git a/src/mmg/tab_input.cpp b/src/mmg/tab_input.cpp index 8b66f54ba..751b3c4bc 100644 --- a/src/mmg/tab_input.cpp +++ b/src/mmg/tab_input.cpp @@ -108,12 +108,16 @@ tab_input::tab_input(wxWindow *parent): wxDefaultPosition, wxSize(60, -1)); b_append_file->Enable(false); + b_remove_all_files = new wxButton(this, ID_B_REMOVE_ALL_FILES, wxT("rem all"), wxDefaultPosition, wxSize(60, -1)); + b_remove_all_files->Enable(false); + siz_column->Add(b_add_file, 0, wxALL, STDSPACING); siz_column->Add(b_remove_file, 0, wxALL, STDSPACING); siz_line->Add(siz_column); siz_column = new wxBoxSizer(wxVERTICAL); siz_column->Add(b_append_file, 0, wxALL, STDSPACING); + siz_column->Add(b_remove_all_files, 0, wxALL, STDSPACING); siz_line->Add(siz_column); siz_all->Add(siz_line, 0, wxGROW | wxLEFT | wxRIGHT, LEFTRIGHTSPACING); @@ -663,6 +667,7 @@ tab_input::add_file(const wxString &file_name, st_tracks->Enable(true); clb_tracks->Enable(true); b_append_file->Enable(true); + b_remove_all_files->Enable(true); } void @@ -723,6 +728,7 @@ tab_input::on_remove_file(wxCommandEvent &evt) { cb_no_attachments->Enable(-1 != selected_file); cb_no_tags->Enable(-1 != selected_file); b_remove_file->Enable(-1 != selected_file); + b_remove_all_files->Enable(-1 != selected_file); b_append_file->Enable(tracks.size() > 0); b_track_up->Enable(-1 != selected_file); b_track_down->Enable(-1 != selected_file); @@ -738,6 +744,35 @@ tab_input::on_remove_file(wxCommandEvent &evt) { dont_copy_values_now = false; } +void +tab_input::on_remove_all_files(wxCommandEvent &evt) { + dont_copy_values_now = true; + + lb_input_files->Clear(); + clb_tracks->Clear(); + + tracks.clear(); + files.clear(); + + selected_file = -1; + selected_track = -1; + st_tracks->Enable(false); + clb_tracks->Enable(false); + st_file_options->Enable(false); + cb_no_chapters->Enable(false); + cb_no_attachments->Enable(false); + cb_no_tags->Enable(false); + b_remove_file->Enable(false); + b_remove_all_files->Enable(false); + b_append_file->Enable(false); + b_track_up->Enable(false); + b_track_down->Enable(false); + + set_track_mode(NULL); + + dont_copy_values_now = false; +} + void tab_input::on_move_track_up(wxCommandEvent &evt) { wxString s; @@ -1036,6 +1071,7 @@ tab_input::load(wxConfigBase *cfg, selected_file = -1; selected_track = -1; b_remove_file->Enable(false); + b_remove_all_files->Enable(false); b_append_file->Enable(false); files.clear(); @@ -1194,6 +1230,7 @@ tab_input::load(wxConfigBase *cfg, st_tracks->Enable(tracks.size() > 0); clb_tracks->Enable(tracks.size() > 0); b_append_file->Enable(files.size() > 0); + b_remove_all_files->Enable(files.size() > 0); dont_copy_values_now = false; } @@ -1365,6 +1402,7 @@ IMPLEMENT_CLASS(tab_input, wxPanel); BEGIN_EVENT_TABLE(tab_input, wxPanel) EVT_BUTTON(ID_B_ADDFILE, tab_input::on_add_file) EVT_BUTTON(ID_B_REMOVEFILE, tab_input::on_remove_file) + EVT_BUTTON(ID_B_REMOVE_ALL_FILES, tab_input::on_remove_all_files) EVT_BUTTON(ID_B_APPENDFILE, tab_input::on_append_file) EVT_BUTTON(ID_B_TRACKUP, tab_input::on_move_track_up) EVT_BUTTON(ID_B_TRACKDOWN, tab_input::on_move_track_down) diff --git a/src/mmg/tab_input.h b/src/mmg/tab_input.h index 575690e2e..9dae68162 100644 --- a/src/mmg/tab_input.h +++ b/src/mmg/tab_input.h @@ -54,6 +54,7 @@ #define ID_CB_FPS 11033 #define ID_CB_NALU_SIZE_LENGTH 11034 #define ID_TC_USER_DEFINED 11035 +#define ID_B_REMOVE_ALL_FILES 11036 #define ID_NB_OPTIONS 11999 extern const wxChar *predefined_aspect_ratios[]; @@ -158,7 +159,7 @@ public: tab_input_extra *ti_extra; wxListBox *lb_input_files; - wxButton *b_add_file, *b_remove_file; + wxButton *b_add_file, *b_remove_file, *b_remove_all_files; wxButton *b_track_up, *b_track_down, *b_append_file; wxCheckBox *cb_no_chapters, *cb_no_attachments, *cb_no_tags; wxCheckListBox *clb_tracks; @@ -178,6 +179,7 @@ public: void add_file(const wxString &file_name, bool append); void select_file(bool append); void on_remove_file(wxCommandEvent &evt); + void on_remove_all_files(wxCommandEvent &evt); void on_append_file(wxCommandEvent &evt); void on_file_selected(wxCommandEvent &evt); void on_move_track_up(wxCommandEvent &evt);