From 5929b2305214431f1fc7c57a630c56e2135f672f Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 25 Jun 2004 13:07:13 +0000 Subject: [PATCH] Added "minimize" buttons to the two "mkvmerge is running" dialogs. --- ChangeLog | 3 +++ src/mmg/jobs.cpp | 11 +++++++++++ src/mmg/jobs.h | 2 ++ src/mmg/mux_dialog.cpp | 34 ++++++++++++++++++++++++++-------- src/mmg/mux_dialog.h | 2 ++ 5 files changed, 44 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 653b7b73d..63f08dbe8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2004-06-25 Moritz Bunkus + * mmg: new feature: Added 'minimize' buttons to the two 'mkvmerge + is running' dialogs. + * mmg: new feature: Added an option for automatically calling 'File -> new' after a job has been added to the job queue. diff --git a/src/mmg/jobs.cpp b/src/mmg/jobs.cpp index d554490ff..888c77e55 100644 --- a/src/mmg/jobs.cpp +++ b/src/mmg/jobs.cpp @@ -58,6 +58,7 @@ job_run_dialog::job_run_dialog(wxWindow *parent, wxStaticBoxSizer *siz_sb; wxBoxSizer *siz_line, *siz_all; wxFlexGridSizer *siz_fg; + wxButton *b_minimize; jobs_to_start = njobs_to_start; abort = false; current_job = -1; @@ -101,6 +102,7 @@ job_run_dialog::job_run_dialog(wxWindow *parent, b_ok->Enable(false); b_abort = new wxButton(this, ID_JOBS_B_ABORT, wxT("&Abort")); b_abort->SetToolTip(TIP("Abort the muxing process right now")); + b_minimize = new wxButton(this, ID_JOBS_B_MINIMIZE, wxT("Minimize")); siz_line = new wxBoxSizer(wxHORIZONTAL); siz_line->Add(1, 0, 1, wxGROW, 0); @@ -108,6 +110,8 @@ job_run_dialog::job_run_dialog(wxWindow *parent, siz_line->Add(1, 0, 1, wxGROW, 0); siz_line->Add(b_abort, 0, 0, 0); siz_line->Add(1, 0, 1, wxGROW, 0); + siz_line->Add(b_minimize, 0, 0, 0); + siz_line->Add(1, 0, 1, wxGROW, 0); siz_all->Add(siz_line, 0, wxGROW | wxTOP | wxBOTTOM, 10); siz_all->SetSizeHints(this); @@ -145,6 +149,7 @@ job_run_dialog::start_next_job() { cb_abort_after_current->Enable(false); b_ok->Enable(true); b_ok->SetFocus(); + SetTitle(wxT("mkvmerge has finished")); return; } @@ -323,6 +328,11 @@ job_run_dialog::add_to_log(wxString text) { tc_log->ShowPosition(tc_log->GetValue().length()); } +void +job_run_dialog::on_minimize(wxCommandEvent &evt) { + mdlg->Iconize(true); +} + // --------------------------------------------------- job_log_dialog::job_log_dialog(wxWindow *parent, @@ -759,6 +769,7 @@ job_dialog::start_jobs(vector &jobs_to_start) { IMPLEMENT_CLASS(job_run_dialog, wxDialog); BEGIN_EVENT_TABLE(job_run_dialog, wxDialog) EVT_BUTTON(ID_JOBS_B_ABORT, job_run_dialog::on_abort) + EVT_BUTTON(ID_JOBS_B_MINIMIZE, job_run_dialog::on_minimize) EVT_END_PROCESS(1, job_run_dialog::on_end_process) EVT_IDLE(job_run_dialog::on_idle) EVT_TIMER(1, job_run_dialog::on_timer) diff --git a/src/mmg/jobs.h b/src/mmg/jobs.h index 49674db95..36c6c70b3 100644 --- a/src/mmg/jobs.h +++ b/src/mmg/jobs.h @@ -38,6 +38,7 @@ #define ID_JOBS_B_VIEW_LOG 17010 #define ID_JOBS_B_SAVE_LOG 17011 #define ID_JOBS_B_DISABLE 17012 +#define ID_JOBS_B_MINIMIZE 17013 enum job_status_t { jobs_pending, @@ -91,6 +92,7 @@ public: job_run_dialog(wxWindow *parent, vector &njobs_to_start); void on_abort(wxCommandEvent &evt); + void on_minimize(wxCommandEvent &evt); void on_end_process(wxProcessEvent &evt); void on_timer(wxTimerEvent &evt); void on_idle(wxIdleEvent &evt); diff --git a/src/mmg/mux_dialog.cpp b/src/mmg/mux_dialog.cpp index 6254f71ad..901ae688a 100644 --- a/src/mmg/mux_dialog.cpp +++ b/src/mmg/mux_dialog.cpp @@ -58,6 +58,7 @@ mux_dialog::mux_dialog(wxWindow *parent): char c; string arg_utf8; long value; + wxButton *b_minimize; wxString line, tmp; wxInputStream *out; wxFile *opt_file; @@ -107,11 +108,14 @@ mux_dialog::mux_dialog(wxWindow *parent): b_ok->Enable(false); siz_buttons->Add(b_ok); siz_buttons->Add(0, 0, 1, wxGROW, 0); + b_abort = new wxButton(this, ID_B_MUX_ABORT, wxT("Abort")); + siz_buttons->Add(b_abort); + siz_buttons->Add(0, 0, 1, wxGROW, 0); b_save_log = new wxButton(this, ID_B_MUX_SAVELOG, wxT("Save log")); siz_buttons->Add(b_save_log); siz_buttons->Add(0, 0, 1, wxGROW, 0); - b_abort = new wxButton(this, ID_B_MUX_ABORT, wxT("Abort")); - siz_buttons->Add(b_abort); + b_minimize = new wxButton(this, ID_B_MUX_MINIMIZE, wxT("Minimize")); + siz_buttons->Add(b_minimize); siz_buttons->Add(0, 0, 1, wxGROW, 0); siz_all = new wxBoxSizer(wxVERTICAL); @@ -210,19 +214,23 @@ mux_dialog::~mux_dialog() { wxRemoveFile(opt_file_name); } -void mux_dialog::update_window(wxString text) { +void +mux_dialog::update_window(wxString text) { st_label->SetLabel(text); } -void mux_dialog::update_gauge(long value) { +void +mux_dialog::update_gauge(long value) { g_progress->SetValue(value); } -void mux_dialog::on_ok(wxCommandEvent &evt) { +void +mux_dialog::on_ok(wxCommandEvent &evt) { Close(true); } -void mux_dialog::on_save_log(wxCommandEvent &evt) { +void +mux_dialog::on_save_log(wxCommandEvent &evt) { wxFile *file; wxString s; wxFileDialog dlg(NULL, wxT("Choose an output file"), last_open_dir, wxT(""), @@ -237,7 +245,8 @@ void mux_dialog::on_save_log(wxCommandEvent &evt) { } } -void mux_dialog::on_abort(wxCommandEvent &evt) { +void +mux_dialog::on_abort(wxCommandEvent &evt) { #if defined(SYS_WINDOWS) wxKill(pid, wxSIGKILL); #else @@ -245,12 +254,19 @@ void mux_dialog::on_abort(wxCommandEvent &evt) { #endif } +void +mux_dialog::on_minimize(wxCommandEvent &evt) { + mdlg->Iconize(true); +} + mux_process::mux_process(mux_dialog *mux_dlg): wxProcess(wxPROCESS_REDIRECT), dlg(mux_dlg) { } -void mux_process::OnTerminate(int pid, int status) { +void +mux_process::OnTerminate(int pid, + int status) { wxString s; s.Printf(wxT("mkvmerge %s with a return code of %d. %s\n"), @@ -265,6 +281,7 @@ void mux_process::OnTerminate(int pid, int status) { #endif : status == 2 ? wxT("There were ERRORs.") : wxT("")); dlg->update_window(s); + dlg->SetTitle(wxT("mkvmerge has finished")); } IMPLEMENT_CLASS(mux_dialog, wxDialog); @@ -272,4 +289,5 @@ BEGIN_EVENT_TABLE(mux_dialog, wxDialog) EVT_BUTTON(ID_B_MUX_OK, mux_dialog::on_ok) EVT_BUTTON(ID_B_MUX_SAVELOG, mux_dialog::on_save_log) EVT_BUTTON(ID_B_MUX_ABORT, mux_dialog::on_abort) + EVT_BUTTON(ID_B_MUX_MINIMIZE, mux_dialog::on_minimize) END_EVENT_TABLE(); diff --git a/src/mmg/mux_dialog.h b/src/mmg/mux_dialog.h index 7e37c3ddd..97936cfee 100644 --- a/src/mmg/mux_dialog.h +++ b/src/mmg/mux_dialog.h @@ -28,6 +28,7 @@ #define ID_B_MUX_OK 17000 #define ID_B_MUX_SAVELOG 17001 #define ID_B_MUX_ABORT 17002 +#define ID_B_MUX_MINIMIZE 17003 class mux_dialog: public wxDialog { DECLARE_CLASS(mux_dialog); @@ -51,6 +52,7 @@ public: void on_ok(wxCommandEvent &evt); void on_save_log(wxCommandEvent &evt); void on_abort(wxCommandEvent &evt); + void on_minimize(wxCommandEvent &evt); }; class mux_process: public wxProcess {