SymbolEditor: Ask to save local edits in schematic on symbol editor window closure
Previously, Asking for save, cancel... was made for a symbol coming from lib but not when the symbol come from the schematic editor. Fixes #6132 https://gitlab.com/kicad/code/kicad/issues/6132
This commit is contained in:
parent
b7c2d64333
commit
db66e16f71
|
@ -28,7 +28,6 @@
|
|||
#include <confirm.h>
|
||||
#include <eeschema_id.h>
|
||||
#include <eeschema_settings.h>
|
||||
//#include <general.h>
|
||||
#include <kiface_i.h>
|
||||
#include <kiplatform/app.h>
|
||||
#include <kiway_express.h>
|
||||
|
@ -457,6 +456,27 @@ bool LIB_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( m_isSymbolFromSchematic && IsContentModified() )
|
||||
{
|
||||
SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) Kiway().Player( FRAME_SCH, false );
|
||||
|
||||
switch( UnsavedChangesDialog( this,
|
||||
_( "Save changes to schematic before closing?" ),
|
||||
nullptr ) )
|
||||
{
|
||||
case wxID_YES:
|
||||
if( schframe && GetCurPart() ) // Should be always the case
|
||||
schframe->UpdateSymbolFromEditor( *GetCurPart() );
|
||||
|
||||
return true;
|
||||
|
||||
case wxID_NO: return true;
|
||||
|
||||
default:
|
||||
case wxID_CANCEL: return false;
|
||||
}
|
||||
}
|
||||
|
||||
if( !saveAllLibraries( true ) )
|
||||
{
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue