mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 12:05:54 +08:00
Handle wxEVT_WINDOW_CLOSE
This commit is contained in:
parent
c68cadbefa
commit
85bfd86bb3
@ -51,17 +51,14 @@ MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& si
|
|||||||
this->Show();
|
this->Show();
|
||||||
this->Layout();
|
this->Layout();
|
||||||
}
|
}
|
||||||
/*
|
// Set up event handlers.
|
||||||
# declare events
|
this->Bind(wxEVT_CLOSE_WINDOW, [=](wxCloseEvent& e) {
|
||||||
EVT_CLOSE($self, sub {
|
if (e.CanVeto()) {
|
||||||
my (undef, $event) = @_;
|
if (!this->plater->prompt_unsaved_changes()) {
|
||||||
|
e.Veto();
|
||||||
if ($event->CanVeto) {
|
|
||||||
if (!$self->{plater}->prompt_unsaved_changes) {
|
|
||||||
$event->Veto;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if ($self->{controller} && $self->{controller}->printing) {
|
if ($self->{controller} && $self->{controller}->printing) {
|
||||||
my $confirm = Wx::MessageDialog->new($self, "You are currently printing. Do you want to stop printing and continue anyway?",
|
my $confirm = Wx::MessageDialog->new($self, "You are currently printing. Do you want to stop printing and continue anyway?",
|
||||||
'Unfinished Print', wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT);
|
'Unfinished Print', wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT);
|
||||||
@ -70,10 +67,21 @@ MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& si
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
// save window size
|
||||||
|
gui_config->save_window_pos(this, "main_frame");
|
||||||
|
|
||||||
|
// Propagate event
|
||||||
|
e.Skip();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
# declare events
|
||||||
|
EVT_CLOSE($self, sub {
|
||||||
|
my (undef, $event) = @_;
|
||||||
|
|
||||||
|
|
||||||
# save window size
|
|
||||||
wxTheApp->save_window_pos($self, "main_frame");
|
|
||||||
|
|
||||||
# propagate event
|
# propagate event
|
||||||
$event->Skip;
|
$event->Skip;
|
||||||
|
@ -35,6 +35,8 @@ public:
|
|||||||
Plater(wxWindow* parent, const wxString& title, std::shared_ptr<Settings> _settings);
|
Plater(wxWindow* parent, const wxString& title, std::shared_ptr<Settings> _settings);
|
||||||
void add();
|
void add();
|
||||||
|
|
||||||
|
/// Ask if there are any unsaved changes.
|
||||||
|
bool prompt_unsaved_changes() { return true; }
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<Slic3r::Print> print {std::make_shared<Print>(Slic3r::Print())};
|
std::shared_ptr<Slic3r::Print> print {std::make_shared<Print>(Slic3r::Print())};
|
||||||
std::shared_ptr<Slic3r::Model> model {std::make_shared<Model>(Slic3r::Model())};
|
std::shared_ptr<Slic3r::Model> model {std::make_shared<Model>(Slic3r::Model())};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user