Bubble cancel up from app to kicad manager when closing.
Fixes https://gitlab.com/kicad/code/kicad/issues/5402
This commit is contained in:
parent
8945f8865b
commit
34d069ffd8
|
@ -144,7 +144,9 @@ void EDA_BASE_FRAME::windowClosing( wxCloseEvent& event )
|
|||
quasiModal->Raise();
|
||||
wxBell();
|
||||
|
||||
if( event.CanVeto() )
|
||||
event.Veto();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -170,6 +172,7 @@ void EDA_BASE_FRAME::windowClosing( wxCloseEvent& event )
|
|||
}
|
||||
else
|
||||
{
|
||||
if( event.CanVeto() )
|
||||
event.Veto();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -324,6 +324,27 @@ void KICAD_MANAGER_FRAME::OnSize( wxSizeEvent& event )
|
|||
}
|
||||
|
||||
|
||||
bool KICAD_MANAGER_FRAME::canCloseWindow( wxCloseEvent& aEvent )
|
||||
{
|
||||
KICAD_SETTINGS* settings = kicadSettings();
|
||||
settings->m_OpenProjects = GetSettingsManager()->GetOpenProjects();
|
||||
|
||||
// CloseProject will recursively ask all the open editors if they need to save changes.
|
||||
// If any of them cancel then we need to cancel closing the KICAD_MANAGER_FRAME.
|
||||
if( CloseProject( true ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( aEvent.CanVeto() )
|
||||
aEvent.Veto();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KICAD_MANAGER_FRAME::doCloseWindow()
|
||||
{
|
||||
#ifdef _WINDOWS_
|
||||
|
@ -342,16 +363,9 @@ void KICAD_MANAGER_FRAME::doCloseWindow()
|
|||
}
|
||||
#endif
|
||||
|
||||
// Save the list of open projects before closing the project
|
||||
KICAD_SETTINGS* settings = kicadSettings();
|
||||
settings->m_OpenProjects = GetSettingsManager()->GetOpenProjects();
|
||||
|
||||
if( CloseProject( true ) )
|
||||
{
|
||||
m_leftWin->Show( false );
|
||||
|
||||
Destroy();
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS_
|
||||
lock_close_event = 0; // Reenable event management
|
||||
|
|
|
@ -85,6 +85,7 @@ public:
|
|||
|
||||
void OnIdle( wxIdleEvent& event );
|
||||
|
||||
bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
|
||||
void doCloseWindow() override;
|
||||
void OnSize( wxSizeEvent& event );
|
||||
|
||||
|
|
Loading…
Reference in New Issue