Save change made in zone manager when apply

When clicking on "apply" in the zone manager, the change made should be saved the same way that it's saved when clicking on the "ok" button.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17159
This commit is contained in:
Lucas Dumont
2024-07-06 15:06:20 +00:00
committed by Seth Hillbrand
parent 01a0f80dfb
commit 4f9d0daeef
2 changed files with 21 additions and 11 deletions
+19 -11
View File
@@ -170,6 +170,22 @@ void DIALOG_ZONE_MANAGER::PostProcessZoneViewSelectionChange( wxDataViewItem con
}
void DIALOG_ZONE_MANAGER::SaveChange()
{
for( ZONE_MANAGEMENT_BASE* zone_management :
std::list<ZONE_MANAGEMENT_BASE*>{ m_panelZoneProperties, m_zonesContainer.get() } )
{
zone_management->OnUserConfirmChange();
}
if( m_zoneInfo )
{
if( std::shared_ptr<ZONE_SETTINGS> zone = m_panelZoneProperties->GetZoneSettings() )
*m_zoneInfo = *zone;
}
}
void DIALOG_ZONE_MANAGER::GenericProcessChar( wxKeyEvent& aEvent )
{
aEvent.Skip();
@@ -249,17 +265,7 @@ void DIALOG_ZONE_MANAGER::SelectZoneTableItem( wxDataViewItem const& aItem )
void DIALOG_ZONE_MANAGER::OnOk( wxCommandEvent& aEvt )
{
for( ZONE_MANAGEMENT_BASE* zone_management :
std::list<ZONE_MANAGEMENT_BASE*>{ m_panelZoneProperties, m_zonesContainer.get() } )
{
zone_management->OnUserConfirmChange();
}
if( m_zoneInfo )
{
if( std::shared_ptr<ZONE_SETTINGS> zone = m_panelZoneProperties->GetZoneSettings() )
*m_zoneInfo = *zone;
}
SaveChange();
aEvt.Skip();
}
@@ -375,6 +381,8 @@ void DIALOG_ZONE_MANAGER::OnButtonApplyClick( wxCommandEvent& aEvent )
if( m_isFillingZones )
return;
SaveChange();
m_isFillingZones = true;
m_zonesContainer->FlushZoneSettingsChange();
m_zonesContainer->FlushPriorityChange();
@@ -106,6 +106,8 @@ protected:
void OnTableCharHook( wxKeyEvent& event ) override;
private:
void SaveChange();
void GenericProcessChar( wxKeyEvent& event );
void OnIdle( wxIdleEvent& aEvent );