Check unsaved preset changes only when presets have been changed in the project

This commit is contained in:
YuSanka 2021-11-19 16:33:15 +01:00
parent 55a555c848
commit 244b66649c
4 changed files with 5 additions and 1 deletions

View file

@ -229,7 +229,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
}
// check unsaved changes only if project wasn't saved
else if (plater()->is_project_dirty() && saved_project == wxID_NO && event.CanVeto() &&
!wxGetApp().check_and_save_current_preset_changes(_L("PrusaSlicer is closing"), _L("Closing PrusaSlicer while some presets are modified."))) {
(plater()->is_presets_dirty() && !wxGetApp().check_and_save_current_preset_changes(_L("PrusaSlicer is closing"), _L("Closing PrusaSlicer while some presets are modified.")))) {
event.Veto();
return;
}

View file

@ -1675,6 +1675,7 @@ struct Plater::priv
~priv();
bool is_project_dirty() const { return dirty_state.is_dirty(); }
bool is_presets_dirty() const { return dirty_state.is_presets_dirty(); }
void update_project_dirty_from_presets() { dirty_state.update_from_presets(); }
int save_project_if_dirty(const wxString& reason) {
int res = wxID_NO;
@ -5016,6 +5017,7 @@ Plater::Plater(wxWindow *parent, MainFrame *main_frame)
}
bool Plater::is_project_dirty() const { return p->is_project_dirty(); }
bool Plater::is_presets_dirty() const { return p->is_presets_dirty(); }
void Plater::update_project_dirty_from_presets() { p->update_project_dirty_from_presets(); }
int Plater::save_project_if_dirty(const wxString& reason) { return p->save_project_if_dirty(reason); }
void Plater::reset_project_dirty_after_save() { p->reset_project_dirty_after_save(); }

View file

@ -140,6 +140,7 @@ public:
~Plater() = default;
bool is_project_dirty() const;
bool is_presets_dirty() const;
void update_project_dirty_from_presets();
int save_project_if_dirty(const wxString& reason);
void reset_project_dirty_after_save();

View file

@ -15,6 +15,7 @@ public:
void reset_initial_presets();
bool is_dirty() const { return m_plater_dirty || m_project_config_dirty || m_presets_dirty; }
bool is_presets_dirty() const { return m_presets_dirty; }
#if ENABLE_PROJECT_DIRTY_STATE_DEBUG_WINDOW
void render_debug_window() const;