Fix broken autosave when board is modified.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12700
This commit is contained in:
Wayne Stambaugh 2022-10-22 15:49:03 -04:00
parent 7895b47030
commit d78b41969f
2 changed files with 23 additions and 5 deletions

View File

@ -303,6 +303,13 @@ int EDA_BASE_FRAME::GetAutoSaveInterval() const
void EDA_BASE_FRAME::onAutoSaveTimer( wxTimerEvent& aEvent )
{
// Don't stomp on someone else's timer event.
if( aEvent.GetId() != ID_AUTO_SAVE_TIMER )
{
aEvent.Skip();
return;
}
if( !doAutoSave() )
m_autoSaveTimer->Start( GetAutoSaveInterval() * 1000, wxTIMER_ONE_SHOT );
}
@ -1016,7 +1023,8 @@ void EDA_BASE_FRAME::OnPreferences( wxCommandEvent& event )
book->AddSubPage( CREATE_PANEL( PANEL_SCH_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_ANNO_OPTIONS ), _( "Annotation Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_COLORS ), _( "Colors" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_FIELD_NAME_TEMPLATES ), _( "Field Name Templates" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_FIELD_NAME_TEMPLATES ),
_( "Field Name Templates" ) );
}
catch( ... )
{
@ -1119,6 +1127,7 @@ void EDA_BASE_FRAME::OnPreferences( wxCommandEvent& event )
void EDA_BASE_FRAME::OnDropFiles( wxDropFilesEvent& aEvent )
{
wxString* files = aEvent.GetFiles();
for( int nb = 0; nb < aEvent.GetNumberOfFiles(); nb++ )
{
const wxFileName fn = wxFileName( files[nb] );
@ -1131,6 +1140,7 @@ void EDA_BASE_FRAME::OnDropFiles( wxDropFilesEvent& aEvent )
}
}
}
DoWithAcceptedFiles();
m_AcceptedFiles.clear();
}
@ -1407,8 +1417,10 @@ WXLRESULT EDA_BASE_FRAME::MSWWindowProc( WXUINT message, WXWPARAM wParam, WXLPAR
// This will help avoid the menu keeping focus when the alt key is released
// You can still trigger accelerators as long as you hold down alt
if( message == WM_SYSCOMMAND )
{
if( wParam == SC_KEYMENU && ( lParam >> 16 ) <= 0 )
return 0;
}
return wxFrame::MSWWindowProc( message, wParam, lParam );
}

View File

@ -506,6 +506,13 @@ BOARD_ITEM_CONTAINER* PCB_EDIT_FRAME::GetModel() const
void PCB_EDIT_FRAME::redrawNetnames( wxTimerEvent& aEvent )
{
// Don't stomp on the auto-save timer event.
if( aEvent.GetId() == ID_AUTO_SAVE_TIMER )
{
aEvent.Skip();
return;
}
PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() );
if( !cfg || cfg->m_Display.m_NetNames < 2 )
@ -1177,6 +1184,7 @@ void PCB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
cfg->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
cfg->m_AuiPanels.appearance_panel_tab = m_appearancePanel->GetTabIndex();
cfg->m_AuiPanels.show_properties = m_show_properties;
// ensure m_show_search is up to date (the pane can be closed)
m_show_search = m_auimgr.GetPane( SearchPaneName() ).IsShown();
cfg->m_AuiPanels.show_search = m_show_search;
@ -1784,6 +1792,7 @@ void PCB_EDIT_FRAME::RunEeschema()
if( frame->IsIconized() )
{
frame->Iconize( false );
// If an iconized frame was created by Pcbnew, Iconize( false ) is not enough
// to show the frame at its normal size: Maximize should be called.
frame->Maximize( false );
@ -1865,7 +1874,6 @@ void PCB_EDIT_FRAME::ShowFootprintPropertiesDialog( FOOTPRINT* aFootprint )
editor->Show( true );
editor->Raise(); // Iconize( false );
}
else if( retvalue == DIALOG_FOOTPRINT_PROPERTIES::FP_PROPS_EDIT_LIBRARY_FP )
{
auto editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, true );
@ -1875,12 +1883,10 @@ void PCB_EDIT_FRAME::ShowFootprintPropertiesDialog( FOOTPRINT* aFootprint )
editor->Show( true );
editor->Raise(); // Iconize( false );
}
else if( retvalue == DIALOG_FOOTPRINT_PROPERTIES::FP_PROPS_UPDATE_FP )
{
ShowExchangeFootprintsDialog( aFootprint, true, true );
}
else if( retvalue == DIALOG_FOOTPRINT_PROPERTIES::FP_PROPS_CHANGE_FP )
{
ShowExchangeFootprintsDialog( aFootprint, false, true );
@ -2022,4 +2028,4 @@ void PCB_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
// Skip() is called in the base class.
EDA_DRAW_FRAME::OnSize( aEvent );
}
}