mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Follow up c0a00f4e70 - Check unsaved changes only if project wasn't saved
				
					
				
			This commit is contained in:
		
							parent
							
								
									3605016696
								
							
						
					
					
						commit
						3a2a9d8500
					
				
					 3 changed files with 17 additions and 14 deletions
				
			
		|  | @ -220,15 +220,19 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S | |||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         if (m_plater != nullptr && !m_plater->save_project_if_dirty()) { | ||||
|             event.Veto(); | ||||
|             return; | ||||
|         if (m_plater != nullptr) { | ||||
|             int saved_project = m_plater->save_project_if_dirty(); | ||||
|             if (saved_project == wxID_CANCEL) { | ||||
|                 event.Veto(); | ||||
|                 return; | ||||
|             } | ||||
|             // check unsaved changes only if project wasn't saved
 | ||||
|             else if (saved_project == wxID_NO && event.CanVeto() && !wxGetApp().check_and_save_current_preset_changes()) { | ||||
|                 event.Veto(); | ||||
|                 return; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (event.CanVeto() && !wxGetApp().check_and_save_current_preset_changes()) { | ||||
|             event.Veto(); | ||||
|             return; | ||||
|         } | ||||
|         if (event.CanVeto() && !wxGetApp().check_print_host_queue()) { | ||||
|             event.Veto(); | ||||
|             return; | ||||
|  |  | |||
|  | @ -1576,20 +1576,19 @@ struct Plater::priv | |||
| 
 | ||||
|     bool is_project_dirty() const { return dirty_state.is_dirty(); } | ||||
|     void update_project_dirty_from_presets() { dirty_state.update_from_presets(); } | ||||
|     bool save_project_if_dirty() { | ||||
|     int save_project_if_dirty() { | ||||
|         int res = wxID_NO; | ||||
|         if (dirty_state.is_dirty()) { | ||||
|             MainFrame* mainframe = wxGetApp().mainframe; | ||||
|             if (mainframe->can_save_as()) { | ||||
|                 //wxMessageDialog dlg(mainframe, _L("Do you want to save the changes to the current project ?"), wxString(SLIC3R_APP_NAME), wxYES_NO | wxCANCEL);
 | ||||
|                 MessageDialog dlg(mainframe, _L("Do you want to save the changes to the current project ?"), wxString(SLIC3R_APP_NAME), wxYES_NO | wxCANCEL); | ||||
|                 int res = dlg.ShowModal(); | ||||
|                 res = dlg.ShowModal(); | ||||
|                 if (res == wxID_YES) | ||||
|                     mainframe->save_project_as(wxGetApp().plater()->get_project_filename()); | ||||
|                 else if (res == wxID_CANCEL) | ||||
|                     return false; | ||||
|             } | ||||
|         } | ||||
|         return true; | ||||
|         return res; | ||||
|     } | ||||
|     void reset_project_dirty_after_save() { dirty_state.reset_after_save(); } | ||||
|     void reset_project_dirty_initial_presets() { dirty_state.reset_initial_presets(); } | ||||
|  | @ -4647,7 +4646,7 @@ Plater::Plater(wxWindow *parent, MainFrame *main_frame) | |||
| 
 | ||||
| bool Plater::is_project_dirty() const { return p->is_project_dirty(); } | ||||
| void Plater::update_project_dirty_from_presets() { p->update_project_dirty_from_presets(); } | ||||
| bool Plater::save_project_if_dirty() { return p->save_project_if_dirty(); } | ||||
| int  Plater::save_project_if_dirty() { return p->save_project_if_dirty(); } | ||||
| void Plater::reset_project_dirty_after_save() { p->reset_project_dirty_after_save(); } | ||||
| void Plater::reset_project_dirty_initial_presets() { p->reset_project_dirty_initial_presets(); } | ||||
| #if ENABLE_PROJECT_DIRTY_STATE_DEBUG_WINDOW | ||||
|  |  | |||
|  | @ -140,7 +140,7 @@ public: | |||
| 
 | ||||
|     bool is_project_dirty() const; | ||||
|     void update_project_dirty_from_presets(); | ||||
|     bool save_project_if_dirty(); | ||||
|     int  save_project_if_dirty(); | ||||
|     void reset_project_dirty_after_save(); | ||||
|     void reset_project_dirty_initial_presets(); | ||||
| #if ENABLE_PROJECT_DIRTY_STATE_DEBUG_WINDOW | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 YuSanka
						YuSanka