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>
* 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,
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 |
wxMINIMIZE_BOX | wxMAXIMIZE_BOX) {
wxStaticBoxSizer *siz_sb;
@ -725,7 +725,7 @@ job_dialog::on_view_log(wxCommandEvent &evt) {
if (log.length() == 0)
return;
dialog = new job_log_dialog(this, log);
delete dialog;
dialog->Destroy();
}
void
@ -736,20 +736,18 @@ job_dialog::on_item_selected(wxListEvent &evt) {
void
job_dialog::start_jobs(vector<int> &jobs_to_start) {
wxString temp_settings;
job_run_dialog *jrdlg;
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);
#ifdef SYS_WINDOWS
mdlg->Iconize(true);
mdlg->Show(false);
Show(false);
#endif
delete new job_run_dialog(this, jobs_to_start);
#ifdef SYS_WINDOWS
jrdlg = new job_run_dialog(this, jobs_to_start);
jrdlg->Destroy();
Show(true);
mdlg->Iconize(false);
#endif
mdlg->Show(true);
mdlg->load(temp_settings, true);
wxRemoveFile(temp_settings);

View File

@ -708,6 +708,8 @@ mmg_dialog::mmg_dialog():
SetSize(520, 718);
#endif
muxing_in_progress = false;
cfg = wxConfigBase::Get();
cfg->SetPath(wxT("/GUI"));
if (cfg->Read(wxT("window_position_x"), &window_pos_x) &&
@ -956,6 +958,15 @@ mmg_dialog::set_last_chapters_in_menu(wxString name) {
void
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();
if (tc_output->GetValue().Length() == 0) {
@ -978,13 +989,13 @@ mmg_dialog::on_run(wxCommandEvent &evt) {
return;
set_on_top(false);
#ifdef SYS_WINDOWS
Iconize(true);
#endif
delete new mux_dialog(this);
#ifdef SYS_WINDOWS
Iconize(false);
#endif
muxing_in_progress = true;
new mux_dialog(this);
}
void
mmg_dialog::muxing_has_finished() {
muxing_in_progress = false;
restore_on_top();
}
@ -1701,20 +1712,20 @@ mmg_dialog::on_close(wxCloseEvent &evt) {
}
void
set_on_top(bool on_top) {
mmg_dialog::set_on_top(bool on_top) {
long style;
style = mdlg->GetWindowStyleFlag();
style = GetWindowStyleFlag();
if (on_top)
style |= wxSTAY_ON_TOP;
else
style &= ~wxSTAY_ON_TOP;
mdlg->SetWindowStyleFlag(style);
SetWindowStyleFlag(style);
}
void
restore_on_top() {
set_on_top(mdlg->settings_page->cb_on_top->IsChecked());
mmg_dialog::restore_on_top() {
set_on_top(settings_page->cb_on_top->IsChecked());
}
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 format_date_time(time_t date_time);
void set_on_top(bool on_top);
void restore_on_top();
wxString create_track_order();
void wxdie(const wxString &errmsg);

View File

@ -72,6 +72,7 @@ class tab_chapters;
class tab_global;
class tab_input;
class tab_settings;
class job_dialog;
class mmg_dialog: public wxFrame {
DECLARE_CLASS(mmg_dialog);
@ -103,6 +104,9 @@ public:
int32_t last_job_id;
bool muxing_in_progress;
job_dialog *jdlg;
public:
mmg_dialog();
@ -159,6 +163,11 @@ public:
void load_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;

View File

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

View File

@ -47,6 +47,7 @@ public:
void on_ok(wxCommandEvent &evt);
void on_save_log(wxCommandEvent &evt);
void on_abort(wxCommandEvent &evt);
void on_close(wxCloseEvent &evt);
void done();
};

View File

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