Properties: don't rebuild the panel when closing an editor

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12984
This commit is contained in:
Jon Evans 2022-11-27 14:28:59 -05:00
parent c0ab2258a4
commit 5bbe21f540
3 changed files with 17 additions and 1 deletions

View File

@ -37,7 +37,8 @@ extern APIIMPORT wxPGGlobalVarsClass* wxPGGlobalVars;
PROPERTIES_PANEL::PROPERTIES_PANEL( wxWindow* aParent, EDA_BASE_FRAME* aFrame ) :
wxPanel( aParent ),
m_frame( aFrame ),
m_splitter_key_proportion( -1 )
m_splitter_key_proportion( -1 ),
m_skipNextUpdate( false )
{
wxBoxSizer* mainSizer = new wxBoxSizer( wxVERTICAL );
@ -88,6 +89,15 @@ PROPERTIES_PANEL::PROPERTIES_PANEL( wxWindow* aParent, EDA_BASE_FRAME* aFrame )
void PROPERTIES_PANEL::update( const SELECTION& aSelection )
{
if( m_skipNextUpdate )
{
m_skipNextUpdate = false;
return;
}
if( m_grid->IsEditorFocused() )
m_grid->CommitChangesFromEditor();
m_grid->Clear();
m_displayed.clear();

View File

@ -78,6 +78,9 @@ protected:
/// Proportion of the grid column splitter that is used for the key column (0.0 - 1.0)
float m_splitter_key_proportion;
/// Skips one call to update()
bool m_skipNextUpdate;
};
#endif /* PROPERTIES_PANEL_H */

View File

@ -115,6 +115,9 @@ void PCB_PROPERTIES_PANEL::valueChanged( wxPropertyGridEvent& aEvent )
item->Set( property, newValue );
}
// Pushing the commit will result in a SelectedItemsModified event, which we want to skip
m_skipNextUpdate = true;
changes.Push( _( "Change property" ) );
m_frame->Refresh();
}