Merged 2589 from the 1.0 branch.

This commit is contained in:
Moritz Bunkus 2004-12-18 16:29:20 +00:00
parent 4b49d77e8c
commit 9ec376abc4
8 changed files with 55 additions and 30 deletions

View File

@ -1,3 +1,8 @@
2004-12-18 Moritz Bunkus <moritz@bunkus.org>
* mmg: bug fix: Again the window handling. Hopefully this is
better than the other attempts.
2004-12-15 Moritz Bunkus <moritz@bunkus.org> 2004-12-15 Moritz Bunkus <moritz@bunkus.org>
* mmg: bug fix: One was able to crash mmg by pressing 'ok' in the * mmg: bug fix: One was able to crash mmg by pressing 'ok' in the

View File

@ -47,7 +47,7 @@
job_run_dialog::job_run_dialog(wxWindow *parent, job_run_dialog::job_run_dialog(wxWindow *parent,
vector<int> &njobs_to_start): vector<int> &njobs_to_start):
wxDialog(parent, -1, wxT("mkvmerge is running"), wxDefaultPosition, wxDialog(NULL, -1, wxT("mkvmerge is running"), wxDefaultPosition,
wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER |
wxMINIMIZE_BOX | wxMAXIMIZE_BOX) { wxMINIMIZE_BOX | wxMAXIMIZE_BOX) {
wxStaticBoxSizer *siz_sb; wxStaticBoxSizer *siz_sb;
@ -725,7 +725,7 @@ job_dialog::on_view_log(wxCommandEvent &evt) {
if (log.length() == 0) if (log.length() == 0)
return; return;
dialog = new job_log_dialog(this, log); dialog = new job_log_dialog(this, log);
delete dialog; dialog->Destroy();
} }
void void
@ -736,20 +736,18 @@ job_dialog::on_item_selected(wxListEvent &evt) {
void void
job_dialog::start_jobs(vector<int> &jobs_to_start) { job_dialog::start_jobs(vector<int> &jobs_to_start) {
wxString temp_settings; wxString temp_settings;
job_run_dialog *jrdlg;
int i; int i;
temp_settings.Printf(wxT("%s/jobs/temp.mmg"), wxGetCwd().c_str()); temp_settings = wxGetCwd() + wxT("/jobs/temp.mmg");
mdlg->save(temp_settings, true); mdlg->save(temp_settings, true);
#ifdef SYS_WINDOWS mdlg->Show(false);
mdlg->Iconize(true);
Show(false); Show(false);
#endif jrdlg = new job_run_dialog(this, jobs_to_start);
delete new job_run_dialog(this, jobs_to_start); jrdlg->Destroy();
#ifdef SYS_WINDOWS
Show(true); Show(true);
mdlg->Iconize(false); mdlg->Show(true);
#endif
mdlg->load(temp_settings, true); mdlg->load(temp_settings, true);
wxRemoveFile(temp_settings); wxRemoveFile(temp_settings);

View File

@ -708,6 +708,8 @@ mmg_dialog::mmg_dialog():
SetSize(520, 718); SetSize(520, 718);
#endif #endif
muxing_in_progress = false;
cfg = wxConfigBase::Get(); cfg = wxConfigBase::Get();
cfg->SetPath(wxT("/GUI")); cfg->SetPath(wxT("/GUI"));
if (cfg->Read(wxT("window_position_x"), &window_pos_x) && if (cfg->Read(wxT("window_position_x"), &window_pos_x) &&
@ -956,6 +958,15 @@ mmg_dialog::set_last_chapters_in_menu(wxString name) {
void void
mmg_dialog::on_run(wxCommandEvent &evt) { mmg_dialog::on_run(wxCommandEvent &evt) {
if (muxing_in_progress) {
wxMessageBox(wxT("Another muxing job in still in progress. Please wait "
"until it has finished or abort it manually before "
"starting a new one."),
wxT("Cannot start second muxing job"),
wxOK | wxCENTER | wxICON_ERROR);
return;
}
update_command_line(); update_command_line();
if (tc_output->GetValue().Length() == 0) { if (tc_output->GetValue().Length() == 0) {
@ -978,13 +989,13 @@ mmg_dialog::on_run(wxCommandEvent &evt) {
return; return;
set_on_top(false); set_on_top(false);
#ifdef SYS_WINDOWS muxing_in_progress = true;
Iconize(true); new mux_dialog(this);
#endif }
delete new mux_dialog(this);
#ifdef SYS_WINDOWS void
Iconize(false); mmg_dialog::muxing_has_finished() {
#endif muxing_in_progress = false;
restore_on_top(); restore_on_top();
} }
@ -1701,20 +1712,20 @@ mmg_dialog::on_close(wxCloseEvent &evt) {
} }
void void
set_on_top(bool on_top) { mmg_dialog::set_on_top(bool on_top) {
long style; long style;
style = mdlg->GetWindowStyleFlag(); style = GetWindowStyleFlag();
if (on_top) if (on_top)
style |= wxSTAY_ON_TOP; style |= wxSTAY_ON_TOP;
else else
style &= ~wxSTAY_ON_TOP; style &= ~wxSTAY_ON_TOP;
mdlg->SetWindowStyleFlag(style); SetWindowStyleFlag(style);
} }
void void
restore_on_top() { mmg_dialog::restore_on_top() {
set_on_top(mdlg->settings_page->cb_on_top->IsChecked()); set_on_top(settings_page->cb_on_top->IsChecked());
} }
IMPLEMENT_CLASS(cli_options_dlg, wxDialog); IMPLEMENT_CLASS(cli_options_dlg, wxDialog);

View File

@ -96,8 +96,6 @@ wxString UTFstring_to_wxString(const UTFstring &u);
wxString unescape(const wxString &src); wxString unescape(const wxString &src);
wxString format_date_time(time_t date_time); wxString format_date_time(time_t date_time);
void set_on_top(bool on_top);
void restore_on_top();
wxString create_track_order(); wxString create_track_order();
void wxdie(const wxString &errmsg); void wxdie(const wxString &errmsg);

View File

@ -72,6 +72,7 @@ class tab_chapters;
class tab_global; class tab_global;
class tab_input; class tab_input;
class tab_settings; class tab_settings;
class job_dialog;
class mmg_dialog: public wxFrame { class mmg_dialog: public wxFrame {
DECLARE_CLASS(mmg_dialog); DECLARE_CLASS(mmg_dialog);
@ -103,6 +104,9 @@ public:
int32_t last_job_id; int32_t last_job_id;
bool muxing_in_progress;
job_dialog *jdlg;
public: public:
mmg_dialog(); mmg_dialog();
@ -159,6 +163,11 @@ public:
void load_job_queue(); void load_job_queue();
void save_job_queue(); void save_job_queue();
void set_on_top(bool on_top);
void restore_on_top();
void muxing_has_finished();
}; };
extern mmg_dialog *mdlg; extern mmg_dialog *mdlg;

View File

@ -111,7 +111,6 @@ mux_dialog::mux_dialog(wxWindow *parent):
SetSizer(siz_all); SetSizer(siz_all);
update_window(wxT("Muxing in progress.")); update_window(wxT("Muxing in progress."));
MakeModal(true);
Show(true); Show(true);
process = new mux_process(this); process = new mux_process(this);
@ -184,9 +183,6 @@ mux_dialog::mux_dialog(wxWindow *parent):
if (out->Eof()) if (out->Eof())
break; break;
} }
MakeModal(false);
ShowModal();
} }
mux_dialog::~mux_dialog() { mux_dialog::~mux_dialog() {
@ -236,6 +232,12 @@ mux_dialog::on_abort(wxCommandEvent &evt) {
b_abort->Enable(false); b_abort->Enable(false);
} }
void
mux_dialog::on_close(wxCloseEvent &evt) {
mdlg->muxing_has_finished();
Destroy();
}
void void
mux_dialog::done() { mux_dialog::done() {
SetTitle(wxT("mkvmerge has finished")); SetTitle(wxT("mkvmerge has finished"));
@ -278,4 +280,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_CLOSE(mux_dialog::on_close)
END_EVENT_TABLE(); END_EVENT_TABLE();

View File

@ -47,6 +47,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_close(wxCloseEvent &evt);
void done(); void done();
}; };

View File

@ -177,7 +177,7 @@ tab_settings::on_xyz_selected(wxCommandEvent &evt) {
void void
tab_settings::on_on_top_selected(wxCommandEvent &evt) { tab_settings::on_on_top_selected(wxCommandEvent &evt) {
save_preferences(); save_preferences();
set_on_top(cb_on_top->IsChecked()); mdlg->set_on_top(cb_on_top->IsChecked());
} }
void void
@ -214,7 +214,7 @@ tab_settings::load_preferences() {
if (!cfg->Read(wxT("on_top"), &b)) if (!cfg->Read(wxT("on_top"), &b))
b = false; b = false;
cb_on_top->SetValue(b); cb_on_top->SetValue(b);
set_on_top(b); mdlg->set_on_top(b);
} }
void void