pcbnew: Modify new file to have a better prompt when closing old board
CHANGED: The new file prompt now asks to save the board if needed Fixes: lp:1853338 * https://bugs.launchpad.net/kicad/+bug/1853338
This commit is contained in:
parent
10ccc6da2a
commit
f7ded3040c
|
@ -277,7 +277,23 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id )
|
|||
|
||||
case ID_NEW_BOARD:
|
||||
{
|
||||
if( !Clear_Pcb( true ) )
|
||||
if( GetScreen()->IsModify() && !GetBoard()->IsEmpty() )
|
||||
{
|
||||
wxFileName fileName = GetBoard()->GetFileName();
|
||||
wxString saveMsg =
|
||||
_( "Current board will be closed, save changes to \"%s\" before continuing?" );
|
||||
|
||||
if( !HandleUnsavedChanges( this, wxString::Format( saveMsg, fileName.GetFullName() ),
|
||||
[&]()->bool { return Files_io_from_id( ID_SAVE_BOARD ); } ) )
|
||||
return false;
|
||||
}
|
||||
else if( !GetBoard()->IsEmpty() )
|
||||
{
|
||||
if( !IsOK( this, _( "Current Board will be closed. Continue?" ) ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !Clear_Pcb( false ) )
|
||||
return false;
|
||||
|
||||
wxFileName fn( wxStandardPaths::Get().GetDocumentsDir(), wxT( "noname" ),
|
||||
|
@ -285,10 +301,6 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id )
|
|||
|
||||
Prj().SetProjectFullName( fn.GetFullPath() );
|
||||
|
||||
fn.SetExt( PcbFileExtension );
|
||||
|
||||
GetBoard()->SetFileName( fn.GetFullPath() );
|
||||
|
||||
onBoardLoaded();
|
||||
|
||||
OnModify();
|
||||
|
|
|
@ -44,7 +44,7 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery, bool aFinal )
|
|||
if( aQuery && !GetBoard()->IsEmpty() )
|
||||
{
|
||||
if( !IsOK( this,
|
||||
_( "Current Board will be lost and this operation cannot be undone. Continue ?" ) ) )
|
||||
_( "Current Board will be lost and this operation cannot be undone. Continue?" ) ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue