Added "minimize" buttons to the two "mkvmerge is running" dialogs.

This commit is contained in:
Moritz Bunkus 2004-06-25 13:07:13 +00:00
parent 53779c6e8c
commit 5929b23052
5 changed files with 44 additions and 8 deletions

View File

@ -1,5 +1,8 @@
2004-06-25 Moritz Bunkus <moritz@bunkus.org> 2004-06-25 Moritz Bunkus <moritz@bunkus.org>
* mmg: new feature: Added 'minimize' buttons to the two 'mkvmerge
is running' dialogs.
* mmg: new feature: Added an option for automatically calling * mmg: new feature: Added an option for automatically calling
'File -> new' after a job has been added to the job queue. 'File -> new' after a job has been added to the job queue.

View File

@ -58,6 +58,7 @@ job_run_dialog::job_run_dialog(wxWindow *parent,
wxStaticBoxSizer *siz_sb; wxStaticBoxSizer *siz_sb;
wxBoxSizer *siz_line, *siz_all; wxBoxSizer *siz_line, *siz_all;
wxFlexGridSizer *siz_fg; wxFlexGridSizer *siz_fg;
wxButton *b_minimize;
jobs_to_start = njobs_to_start; jobs_to_start = njobs_to_start;
abort = false; abort = false;
current_job = -1; current_job = -1;
@ -101,6 +102,7 @@ job_run_dialog::job_run_dialog(wxWindow *parent,
b_ok->Enable(false); b_ok->Enable(false);
b_abort = new wxButton(this, ID_JOBS_B_ABORT, wxT("&Abort")); b_abort = new wxButton(this, ID_JOBS_B_ABORT, wxT("&Abort"));
b_abort->SetToolTip(TIP("Abort the muxing process right now")); 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 = new wxBoxSizer(wxHORIZONTAL);
siz_line->Add(1, 0, 1, wxGROW, 0); 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(1, 0, 1, wxGROW, 0);
siz_line->Add(b_abort, 0, 0, 0); siz_line->Add(b_abort, 0, 0, 0);
siz_line->Add(1, 0, 1, wxGROW, 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->Add(siz_line, 0, wxGROW | wxTOP | wxBOTTOM, 10);
siz_all->SetSizeHints(this); siz_all->SetSizeHints(this);
@ -145,6 +149,7 @@ job_run_dialog::start_next_job() {
cb_abort_after_current->Enable(false); cb_abort_after_current->Enable(false);
b_ok->Enable(true); b_ok->Enable(true);
b_ok->SetFocus(); b_ok->SetFocus();
SetTitle(wxT("mkvmerge has finished"));
return; return;
} }
@ -323,6 +328,11 @@ job_run_dialog::add_to_log(wxString text) {
tc_log->ShowPosition(tc_log->GetValue().length()); 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, job_log_dialog::job_log_dialog(wxWindow *parent,
@ -759,6 +769,7 @@ job_dialog::start_jobs(vector<int> &jobs_to_start) {
IMPLEMENT_CLASS(job_run_dialog, wxDialog); IMPLEMENT_CLASS(job_run_dialog, wxDialog);
BEGIN_EVENT_TABLE(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_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_END_PROCESS(1, job_run_dialog::on_end_process)
EVT_IDLE(job_run_dialog::on_idle) EVT_IDLE(job_run_dialog::on_idle)
EVT_TIMER(1, job_run_dialog::on_timer) EVT_TIMER(1, job_run_dialog::on_timer)

View File

@ -38,6 +38,7 @@
#define ID_JOBS_B_VIEW_LOG 17010 #define ID_JOBS_B_VIEW_LOG 17010
#define ID_JOBS_B_SAVE_LOG 17011 #define ID_JOBS_B_SAVE_LOG 17011
#define ID_JOBS_B_DISABLE 17012 #define ID_JOBS_B_DISABLE 17012
#define ID_JOBS_B_MINIMIZE 17013
enum job_status_t { enum job_status_t {
jobs_pending, jobs_pending,
@ -91,6 +92,7 @@ public:
job_run_dialog(wxWindow *parent, vector<int> &njobs_to_start); job_run_dialog(wxWindow *parent, vector<int> &njobs_to_start);
void on_abort(wxCommandEvent &evt); void on_abort(wxCommandEvent &evt);
void on_minimize(wxCommandEvent &evt);
void on_end_process(wxProcessEvent &evt); void on_end_process(wxProcessEvent &evt);
void on_timer(wxTimerEvent &evt); void on_timer(wxTimerEvent &evt);
void on_idle(wxIdleEvent &evt); void on_idle(wxIdleEvent &evt);

View File

@ -58,6 +58,7 @@ mux_dialog::mux_dialog(wxWindow *parent):
char c; char c;
string arg_utf8; string arg_utf8;
long value; long value;
wxButton *b_minimize;
wxString line, tmp; wxString line, tmp;
wxInputStream *out; wxInputStream *out;
wxFile *opt_file; wxFile *opt_file;
@ -107,11 +108,14 @@ mux_dialog::mux_dialog(wxWindow *parent):
b_ok->Enable(false); b_ok->Enable(false);
siz_buttons->Add(b_ok); siz_buttons->Add(b_ok);
siz_buttons->Add(0, 0, 1, wxGROW, 0); 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")); b_save_log = new wxButton(this, ID_B_MUX_SAVELOG, wxT("Save log"));
siz_buttons->Add(b_save_log); siz_buttons->Add(b_save_log);
siz_buttons->Add(0, 0, 1, wxGROW, 0); siz_buttons->Add(0, 0, 1, wxGROW, 0);
b_abort = new wxButton(this, ID_B_MUX_ABORT, wxT("Abort")); b_minimize = new wxButton(this, ID_B_MUX_MINIMIZE, wxT("Minimize"));
siz_buttons->Add(b_abort); siz_buttons->Add(b_minimize);
siz_buttons->Add(0, 0, 1, wxGROW, 0); siz_buttons->Add(0, 0, 1, wxGROW, 0);
siz_all = new wxBoxSizer(wxVERTICAL); siz_all = new wxBoxSizer(wxVERTICAL);
@ -210,19 +214,23 @@ mux_dialog::~mux_dialog() {
wxRemoveFile(opt_file_name); wxRemoveFile(opt_file_name);
} }
void mux_dialog::update_window(wxString text) { void
mux_dialog::update_window(wxString text) {
st_label->SetLabel(text); st_label->SetLabel(text);
} }
void mux_dialog::update_gauge(long value) { void
mux_dialog::update_gauge(long value) {
g_progress->SetValue(value); g_progress->SetValue(value);
} }
void mux_dialog::on_ok(wxCommandEvent &evt) { void
mux_dialog::on_ok(wxCommandEvent &evt) {
Close(true); Close(true);
} }
void mux_dialog::on_save_log(wxCommandEvent &evt) { void
mux_dialog::on_save_log(wxCommandEvent &evt) {
wxFile *file; wxFile *file;
wxString s; wxString s;
wxFileDialog dlg(NULL, wxT("Choose an output file"), last_open_dir, wxT(""), 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) #if defined(SYS_WINDOWS)
wxKill(pid, wxSIGKILL); wxKill(pid, wxSIGKILL);
#else #else
@ -245,12 +254,19 @@ void mux_dialog::on_abort(wxCommandEvent &evt) {
#endif #endif
} }
void
mux_dialog::on_minimize(wxCommandEvent &evt) {
mdlg->Iconize(true);
}
mux_process::mux_process(mux_dialog *mux_dlg): mux_process::mux_process(mux_dialog *mux_dlg):
wxProcess(wxPROCESS_REDIRECT), wxProcess(wxPROCESS_REDIRECT),
dlg(mux_dlg) { dlg(mux_dlg) {
} }
void mux_process::OnTerminate(int pid, int status) { void
mux_process::OnTerminate(int pid,
int status) {
wxString s; wxString s;
s.Printf(wxT("mkvmerge %s with a return code of %d. %s\n"), 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 #endif
: status == 2 ? wxT("There were ERRORs.") : wxT("")); : status == 2 ? wxT("There were ERRORs.") : wxT(""));
dlg->update_window(s); dlg->update_window(s);
dlg->SetTitle(wxT("mkvmerge has finished"));
} }
IMPLEMENT_CLASS(mux_dialog, wxDialog); 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_OK, mux_dialog::on_ok)
EVT_BUTTON(ID_B_MUX_SAVELOG, mux_dialog::on_save_log) 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_ABORT, mux_dialog::on_abort)
EVT_BUTTON(ID_B_MUX_MINIMIZE, mux_dialog::on_minimize)
END_EVENT_TABLE(); END_EVENT_TABLE();

View File

@ -28,6 +28,7 @@
#define ID_B_MUX_OK 17000 #define ID_B_MUX_OK 17000
#define ID_B_MUX_SAVELOG 17001 #define ID_B_MUX_SAVELOG 17001
#define ID_B_MUX_ABORT 17002 #define ID_B_MUX_ABORT 17002
#define ID_B_MUX_MINIMIZE 17003
class mux_dialog: public wxDialog { class mux_dialog: public wxDialog {
DECLARE_CLASS(mux_dialog); DECLARE_CLASS(mux_dialog);
@ -51,6 +52,7 @@ public:
void on_ok(wxCommandEvent &evt); void on_ok(wxCommandEvent &evt);
void on_save_log(wxCommandEvent &evt); void on_save_log(wxCommandEvent &evt);
void on_abort(wxCommandEvent &evt); void on_abort(wxCommandEvent &evt);
void on_minimize(wxCommandEvent &evt);
}; };
class mux_process: public wxProcess { class mux_process: public wxProcess {