From 77440fd9eb37efdf18b5fcf440e276f41f784266 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 11 Nov 2025 13:13:25 +0000 Subject: [PATCH] CHANGED: default zone props now edited through Board Setup... ... rather than as a side-effect of editing a zone. --- pcbnew/CMakeLists.txt | 4 + pcbnew/dialogs/dialog_board_setup.cpp | 10 +- pcbnew/dialogs/dialog_board_setup.h | 4 +- pcbnew/dialogs/panel_setup_defaults.cpp | 98 +++++ pcbnew/dialogs/panel_setup_defaults.h | 56 +++ pcbnew/dialogs/panel_setup_defaults_base.cpp | 35 ++ pcbnew/dialogs/panel_setup_defaults_base.fbp | 373 ++++++++++++++++++ pcbnew/dialogs/panel_setup_defaults_base.h | 42 ++ pcbnew/dialogs/panel_setup_dimensions.h | 4 +- .../dialogs/panel_setup_dimensions_base.cpp | 2 +- .../dialogs/panel_setup_dimensions_base.fbp | 2 +- .../dialogs/panel_setup_text_and_graphics.cpp | 32 +- .../dialogs/panel_setup_text_and_graphics.h | 15 +- .../panel_setup_text_and_graphics_base.cpp | 3 - .../panel_setup_text_and_graphics_base.fbp | 10 - pcbnew/dialogs/panel_setup_zones.cpp | 66 ++++ pcbnew/dialogs/panel_setup_zones.h | 51 +++ pcbnew/dialogs/panel_setup_zones_base.cpp | 34 ++ pcbnew/dialogs/panel_setup_zones_base.fbp | 197 +++++++++ pcbnew/dialogs/panel_setup_zones_base.h | 44 +++ pcbnew/dialogs/panel_zone_properties.cpp | 20 +- pcbnew/dialogs/panel_zone_properties.h | 5 +- pcbnew/zone_manager/dialog_zone_manager.cpp | 27 +- pcbnew/zone_manager/managed_zone.h | 12 +- pcbnew/zone_settings_bag.cpp | 45 +-- pcbnew/zone_settings_bag.h | 30 +- 26 files changed, 1083 insertions(+), 138 deletions(-) create mode 100644 pcbnew/dialogs/panel_setup_defaults.cpp create mode 100644 pcbnew/dialogs/panel_setup_defaults.h create mode 100644 pcbnew/dialogs/panel_setup_defaults_base.cpp create mode 100644 pcbnew/dialogs/panel_setup_defaults_base.fbp create mode 100644 pcbnew/dialogs/panel_setup_defaults_base.h create mode 100644 pcbnew/dialogs/panel_setup_zones.cpp create mode 100644 pcbnew/dialogs/panel_setup_zones.h create mode 100644 pcbnew/dialogs/panel_setup_zones_base.cpp create mode 100644 pcbnew/dialogs/panel_setup_zones_base.fbp create mode 100644 pcbnew/dialogs/panel_setup_zones_base.h diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 4000370716..d8c5af6abc 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -187,6 +187,8 @@ set( PCBNEW_DIALOGS dialogs/panel_assign_component_classes_base.cpp dialogs/panel_setup_constraints.cpp dialogs/panel_setup_constraints_base.cpp + dialogs/panel_setup_defaults.cpp + dialogs/panel_setup_defaults_base.cpp dialogs/panel_setup_dimensions.cpp dialogs/panel_setup_dimensions_base.cpp dialogs/panel_setup_formatting.cpp @@ -209,6 +211,8 @@ set( PCBNEW_DIALOGS dialogs/panel_setup_tuning_profiles.cpp dialogs/panel_setup_tuning_profile_info_base.cpp dialogs/panel_setup_tuning_profile_info.cpp + dialogs/panel_setup_zones.cpp + dialogs/panel_setup_zones_base.cpp dialogs/panel_setup_zone_hatch_offsets.cpp dialogs/panel_setup_zone_hatch_offsets_base.cpp dialogs/panel_zone_properties.cpp diff --git a/pcbnew/dialogs/dialog_board_setup.cpp b/pcbnew/dialogs/dialog_board_setup.cpp index 8048f4e99f..8586798e0e 100644 --- a/pcbnew/dialogs/dialog_board_setup.cpp +++ b/pcbnew/dialogs/dialog_board_setup.cpp @@ -18,7 +18,7 @@ */ #include #include -#include +#include #include #include #include @@ -71,7 +71,7 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame, wxWindow* aParen m_layersPage( 0 ), m_physicalStackupPage( 0 ), m_boardFinishPage( 0 ), - m_textAndGraphicsPage( 0 ), + m_defaultsPage( 0 ), m_formattingPage( 0 ), m_maskAndPastePage( 0 ), m_zoneHatchOffsetsPage( 0 ), @@ -139,11 +139,11 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame, wxWindow* aParen m_treebook->AddPage( new wxPanel( GetTreebook() ), _( "Text & Graphics" ) ); - m_textAndGraphicsPage = m_treebook->GetPageCount(); + m_defaultsPage = m_treebook->GetPageCount(); m_treebook->AddLazySubPage( [this]( wxWindow* aParent ) -> wxWindow* { - return new PANEL_SETUP_TEXT_AND_GRAPHICS( aParent, m_frame ); + return new PANEL_SETUP_DEFAULTS( aParent, m_frame ); }, _( "Defaults" ) ); m_formattingPage = m_treebook->GetPageCount(); @@ -421,7 +421,7 @@ void DIALOG_BOARD_SETUP::onAuxiliaryAction( wxCommandEvent& aEvent ) } if( importDlg.m_TextAndGraphicsOpt->GetValue() ) - RESOLVE_PAGE( PANEL_SETUP_TEXT_AND_GRAPHICS, m_textAndGraphicsPage )->ImportSettingsFrom( otherBoard ); + RESOLVE_PAGE( PANEL_SETUP_DEFAULTS, m_defaultsPage )->ImportSettingsFrom( otherBoard ); if( importDlg.m_FormattingOpt->GetValue() ) RESOLVE_PAGE( PANEL_SETUP_FORMATTING, m_formattingPage )->ImportSettingsFrom( otherBoard ); diff --git a/pcbnew/dialogs/dialog_board_setup.h b/pcbnew/dialogs/dialog_board_setup.h index b3ca109dab..dc492ec8cd 100644 --- a/pcbnew/dialogs/dialog_board_setup.h +++ b/pcbnew/dialogs/dialog_board_setup.h @@ -26,7 +26,7 @@ class PCB_EDIT_FRAME; class PANEL_SETUP_CONSTRAINTS; class PANEL_SETUP_LAYERS; -class PANEL_SETUP_TEXT_AND_GRAPHICS; +class PANEL_SETUP_DEFAULTS; class PANEL_SETUP_NETCLASSES; class PANEL_SETUP_RULES; class PANEL_SETUP_TRACKS_AND_VIAS; @@ -63,7 +63,7 @@ private: size_t m_layersPage; size_t m_physicalStackupPage; size_t m_boardFinishPage; - size_t m_textAndGraphicsPage; + size_t m_defaultsPage; size_t m_formattingPage; size_t m_maskAndPastePage; size_t m_zoneHatchOffsetsPage; diff --git a/pcbnew/dialogs/panel_setup_defaults.cpp b/pcbnew/dialogs/panel_setup_defaults.cpp new file mode 100644 index 0000000000..9459cb3ef8 --- /dev/null +++ b/pcbnew/dialogs/panel_setup_defaults.cpp @@ -0,0 +1,98 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright The KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "panel_setup_defaults.h" + +#include +#include +#include +#include +#include + +#include + + +PANEL_SETUP_DEFAULTS::PANEL_SETUP_DEFAULTS( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame ) : + PANEL_SETUP_DEFAULTS_BASE( aParentWindow ), + m_Frame( aFrame ), + m_BrdSettings( &m_Frame->GetBoard()->GetDesignSettings() ), + m_textAndGraphicsPanel( new PANEL_SETUP_TEXT_AND_GRAPHICS( m_scrolledWindow, aFrame, m_BrdSettings ) ), + m_dimensionsPanel( new PANEL_SETUP_DIMENSIONS( m_scrolledWindow, *aFrame, *m_BrdSettings ) ), + m_zonesPanel( new PANEL_SETUP_ZONES( m_scrolledWindow, aFrame, *m_BrdSettings ) ) +{ + m_scrollSizer->Add( m_textAndGraphicsPanel, 0, wxEXPAND, 5 ); + m_scrollSizer->AddSpacer( 10 ); + m_scrollSizer->Add( m_dimensionsPanel, 0, wxEXPAND, 5 ); + m_scrollSizer->AddSpacer( 10 ); + m_scrollSizer->Add( m_zonesPanel, 0, wxEXPAND, 5 ); + + Layout(); + GetSizer()->Fit( this ); +} + + +bool PANEL_SETUP_DEFAULTS::TransferDataToWindow() +{ + m_textAndGraphicsPanel->TransferDataToWindow(); + m_dimensionsPanel->TransferDataToWindow(); + m_zonesPanel->TransferDataToWindow(); + + Layout(); + + return true; +} + + +bool PANEL_SETUP_DEFAULTS::TransferDataFromWindow() +{ + if( !m_textAndGraphicsPanel->TransferDataFromWindow() ) + return false; + + if( !m_dimensionsPanel->TransferDataFromWindow() ) + return false; + + if( !m_zonesPanel->TransferDataFromWindow() ) + return false; + + return true; +} + + +void PANEL_SETUP_DEFAULTS::ImportSettingsFrom( BOARD* aBoard ) +{ + if( !m_textAndGraphicsPanel->CommitPendingChanges() ) + return; + + if( !m_dimensionsPanel->CommitPendingChanges() ) + return; + + if( !m_zonesPanel->CommitPendingChanges() ) + return; + + BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings; + + m_BrdSettings = &aBoard->GetDesignSettings(); + TransferDataToWindow(); + + m_BrdSettings = savedSettings; +} diff --git a/pcbnew/dialogs/panel_setup_defaults.h b/pcbnew/dialogs/panel_setup_defaults.h new file mode 100644 index 0000000000..5686919c24 --- /dev/null +++ b/pcbnew/dialogs/panel_setup_defaults.h @@ -0,0 +1,56 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright The KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#pragma once + +#include +#include +#include + + +class BOARD_DESIGN_SETTINGS; +class PANEL_SETUP_TEXT_AND_GRAPHICS; +class PANEL_SETUP_DIMENSIONS; +class PANEL_SETUP_ZONES; +class PCB_EDIT_FRAME; + + +class PANEL_SETUP_DEFAULTS : public PANEL_SETUP_DEFAULTS_BASE +{ +public: + PANEL_SETUP_DEFAULTS( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame ); + ~PANEL_SETUP_DEFAULTS( ) override = default; + + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; + + void ImportSettingsFrom( BOARD* aBoard ); + +private: + PCB_EDIT_FRAME* m_Frame; + BOARD_DESIGN_SETTINGS* m_BrdSettings; + + PANEL_SETUP_TEXT_AND_GRAPHICS* m_textAndGraphicsPanel; + PANEL_SETUP_DIMENSIONS* m_dimensionsPanel; + PANEL_SETUP_ZONES* m_zonesPanel; +}; diff --git a/pcbnew/dialogs/panel_setup_defaults_base.cpp b/pcbnew/dialogs/panel_setup_defaults_base.cpp new file mode 100644 index 0000000000..d6ae1c8717 --- /dev/null +++ b/pcbnew/dialogs/panel_setup_defaults_base.cpp @@ -0,0 +1,35 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "panel_setup_defaults_base.h" + +/////////////////////////////////////////////////////////////////////////// + +PANEL_SETUP_DEFAULTS_BASE::PANEL_SETUP_DEFAULTS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) +{ + wxBoxSizer* mainSizer; + mainSizer = new wxBoxSizer( wxVERTICAL ); + + m_scrolledWindow = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); + m_scrolledWindow->SetScrollRate( 5, 5 ); + m_scrollSizer = new wxBoxSizer( wxVERTICAL ); + + + m_scrolledWindow->SetSizer( m_scrollSizer ); + m_scrolledWindow->Layout(); + m_scrollSizer->Fit( m_scrolledWindow ); + mainSizer->Add( m_scrolledWindow, 1, wxEXPAND | wxALL, 5 ); + + + this->SetSizer( mainSizer ); + this->Layout(); + mainSizer->Fit( this ); +} + +PANEL_SETUP_DEFAULTS_BASE::~PANEL_SETUP_DEFAULTS_BASE() +{ +} diff --git a/pcbnew/dialogs/panel_setup_defaults_base.fbp b/pcbnew/dialogs/panel_setup_defaults_base.fbp new file mode 100644 index 0000000000..c5297a878e --- /dev/null +++ b/pcbnew/dialogs/panel_setup_defaults_base.fbp @@ -0,0 +1,373 @@ + + + + + C++ + + 1 + connect + none + + + 0 + 1 + res + UTF-8 + panel_setup_defaults_base + 1000 + 1 + 1 + UI + panel_setup_defaults_base + . + 0 + source_name + 1 + 0 + source_name + + + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + 1 + 0 + 1 + impl_virtual + + + 0 + wxID_ANY + + + PANEL_SETUP_DEFAULTS_BASE + + -1,-1 + ; forward_declare + + 0 + + + wxTAB_TRAVERSAL + + + mainSizer + wxVERTICAL + none + + 5 + wxEXPAND | wxALL + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_scrolledWindow1 + 1 + + + protected + 1 + + Resizable + 5 + 5 + 1 + + ; ; forward_declare + 0 + + + + wxHSCROLL|wxVSCROLL + + + m_scrollSizer + wxVERTICAL + protected + + 13 + wxEXPAND|wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Default Properties for New Graphics and Text + 0 + + 0 + + + 0 + + 1 + m_staticTextDefProp + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + 5 + + 0 + + 2 + protected + 0 + + + + 5 + wxEXPAND|wxBOTTOM + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline11 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + + + 5 + wxEXPAND + 0 + + 3 + protected + 0 + + + + 5 + wxEXPAND|wxLEFT + 1 + + + bMargins + wxVERTICAL + none + + 15 + wxBOTTOM + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + 0 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_CENTER + 0 + 1 + wxALIGN_CENTER + wxGRID_AUTOSIZE + "Line Thickness" "Text Width" "Text Height" "Text Thickness" "Italic" "Keep Upright" + wxALIGN_CENTER + 6 + 140,140,140,140,80,120 + + 1 + 0 + Dock + 0 + Left + 0 + 0 + 1 + 0 + 0 + 1 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + -1,-1 + 1 + m_grid + 1 + + + protected + 1 + + Resizable + wxALIGN_LEFT + 132 + "Silk Layers" "Copper Layers" "Edge Cuts" "Courtyards" "Fab Layers" "Other Layers" + wxALIGN_CENTER + + 6 + 1 + + WX_GRID; widgets/wx_grid.h; forward_declare + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + diff --git a/pcbnew/dialogs/panel_setup_defaults_base.h b/pcbnew/dialogs/panel_setup_defaults_base.h new file mode 100644 index 0000000000..965f79ae5e --- /dev/null +++ b/pcbnew/dialogs/panel_setup_defaults_base.h @@ -0,0 +1,42 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +/// Class PANEL_SETUP_DEFAULTS_BASE +/////////////////////////////////////////////////////////////////////////////// +class PANEL_SETUP_DEFAULTS_BASE : public wxPanel +{ + private: + + protected: + wxScrolledWindow* m_scrolledWindow; + wxBoxSizer* m_scrollSizer; + + public: + + PANEL_SETUP_DEFAULTS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + + ~PANEL_SETUP_DEFAULTS_BASE(); + +}; + diff --git a/pcbnew/dialogs/panel_setup_dimensions.h b/pcbnew/dialogs/panel_setup_dimensions.h index 58edd33a6c..deead20892 100644 --- a/pcbnew/dialogs/panel_setup_dimensions.h +++ b/pcbnew/dialogs/panel_setup_dimensions.h @@ -21,7 +21,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - #pragma once #include @@ -30,6 +29,7 @@ #include + class BOARD_DESIGN_SETTINGS; @@ -45,6 +45,8 @@ public: void LoadFromSettings( const BOARD_DESIGN_SETTINGS& aBrdSettings ); + bool CommitPendingChanges() { return true; } + private: void onUnitsChanged( wxCommandEvent& aEvent ); diff --git a/pcbnew/dialogs/panel_setup_dimensions_base.cpp b/pcbnew/dialogs/panel_setup_dimensions_base.cpp index 39b1d753c5..2a7dd9e777 100644 --- a/pcbnew/dialogs/panel_setup_dimensions_base.cpp +++ b/pcbnew/dialogs/panel_setup_dimensions_base.cpp @@ -111,7 +111,7 @@ PANEL_SETUP_DIMENSIONS_BASE::PANEL_SETUP_DIMENSIONS_BASE( wxWindow* parent, wxWi gbSizer1->Add( m_dimensionExtensionOffsetUnits, wxGBPosition( 3, 5 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); - mainSizer->Add( gbSizer1, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + mainSizer->Add( gbSizer1, 1, wxEXPAND|wxALL, 5 ); this->SetSizer( mainSizer ); diff --git a/pcbnew/dialogs/panel_setup_dimensions_base.fbp b/pcbnew/dialogs/panel_setup_dimensions_base.fbp index 448dd9570f..8ebe7306f4 100644 --- a/pcbnew/dialogs/panel_setup_dimensions_base.fbp +++ b/pcbnew/dialogs/panel_setup_dimensions_base.fbp @@ -193,7 +193,7 @@ 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT + wxEXPAND|wxALL 1 diff --git a/pcbnew/dialogs/panel_setup_text_and_graphics.cpp b/pcbnew/dialogs/panel_setup_text_and_graphics.cpp index 347fbd58d2..6ae7dfb75f 100644 --- a/pcbnew/dialogs/panel_setup_text_and_graphics.cpp +++ b/pcbnew/dialogs/panel_setup_text_and_graphics.cpp @@ -56,12 +56,11 @@ enum }; -PANEL_SETUP_TEXT_AND_GRAPHICS::PANEL_SETUP_TEXT_AND_GRAPHICS( wxWindow* aParentWindow, - PCB_EDIT_FRAME* aFrame ) : +PANEL_SETUP_TEXT_AND_GRAPHICS::PANEL_SETUP_TEXT_AND_GRAPHICS( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame, + BOARD_DESIGN_SETTINGS* aBrdSettings) : PANEL_SETUP_TEXT_AND_GRAPHICS_BASE( aParentWindow ), m_Frame( aFrame ), - m_BrdSettings( &m_Frame->GetBoard()->GetDesignSettings() ), - m_dimensionsPanel( std::make_unique( this, *aFrame, *m_BrdSettings ) ) + m_BrdSettings( aBrdSettings ) { m_grid->SetUnitsProvider( m_Frame ); m_grid->SetAutoEvalCols( { COL_LINE_THICKNESS, @@ -94,9 +93,6 @@ PANEL_SETUP_TEXT_AND_GRAPHICS::PANEL_SETUP_TEXT_AND_GRAPHICS( wxWindow* aP m_grid->PushEventHandler( new GRID_TRICKS( m_grid ) ); - GetSizer()->Add( m_dimensionsPanel.get(), 0, wxEXPAND, 5 ); - - Layout(); m_mainSizer->Fit( this ); m_Frame->Bind( EDA_EVT_UNITS_CHANGED, &PANEL_SETUP_TEXT_AND_GRAPHICS::onUnitsChanged, this ); @@ -180,10 +176,6 @@ bool PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataToWindow() m_grid->SetRowLabelSize( m_grid->GetVisibleWidth( -1, true, true, true ) ); - Layout(); - - m_dimensionsPanel->TransferDataToWindow(); - return true; } @@ -284,27 +276,17 @@ bool PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataFromWindow() wxGridCellBoolEditor::IsTrueValue( m_grid->GetCellValue( i, COL_TEXT_UPRIGHT ) ); } - m_dimensionsPanel->TransferDataFromWindow(); - if( errorsMsg.IsEmpty() ) return true; - KIDIALOG dlg( wxGetTopLevelParent( this ), errorsMsg, KIDIALOG::KD_ERROR, _( "Parameter error" ) ); + KIDIALOG dlg( wxGetTopLevelParent( m_grid ), errorsMsg, KIDIALOG::KD_ERROR, _( "Parameter error" ) ); dlg.ShowModal(); return false; } -void PANEL_SETUP_TEXT_AND_GRAPHICS::ImportSettingsFrom( BOARD* aBoard ) +bool PANEL_SETUP_TEXT_AND_GRAPHICS::CommitPendingChanges() { - if( !m_grid->CommitPendingChanges() ) - return; - - BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings; - - m_BrdSettings = &aBoard->GetDesignSettings(); - TransferDataToWindow(); - - m_BrdSettings = savedSettings; -} + return m_grid->CommitPendingChanges(); +} \ No newline at end of file diff --git a/pcbnew/dialogs/panel_setup_text_and_graphics.h b/pcbnew/dialogs/panel_setup_text_and_graphics.h index c04e115e37..422ddd6b47 100644 --- a/pcbnew/dialogs/panel_setup_text_and_graphics.h +++ b/pcbnew/dialogs/panel_setup_text_and_graphics.h @@ -24,27 +24,24 @@ #pragma once #include - -#include -#include -#include - #include + class BOARD_DESIGN_SETTINGS; -class PANEL_SETUP_DIMENSIONS; class PCB_EDIT_FRAME; + class PANEL_SETUP_TEXT_AND_GRAPHICS : public PANEL_SETUP_TEXT_AND_GRAPHICS_BASE { public: - PANEL_SETUP_TEXT_AND_GRAPHICS( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame ); + PANEL_SETUP_TEXT_AND_GRAPHICS( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame, + BOARD_DESIGN_SETTINGS* aBrdSettings ); ~PANEL_SETUP_TEXT_AND_GRAPHICS( ) override; bool TransferDataToWindow() override; bool TransferDataFromWindow() override; - void ImportSettingsFrom( BOARD* aBoard ); + bool CommitPendingChanges(); private: void onUnitsChanged( wxCommandEvent& aEvent ); @@ -52,6 +49,4 @@ private: private: PCB_EDIT_FRAME* m_Frame; BOARD_DESIGN_SETTINGS* m_BrdSettings; - - std::unique_ptr m_dimensionsPanel; }; diff --git a/pcbnew/dialogs/panel_setup_text_and_graphics_base.cpp b/pcbnew/dialogs/panel_setup_text_and_graphics_base.cpp index 2e455ab1f3..0fae65b2b2 100644 --- a/pcbnew/dialogs/panel_setup_text_and_graphics_base.cpp +++ b/pcbnew/dialogs/panel_setup_text_and_graphics_base.cpp @@ -81,9 +81,6 @@ PANEL_SETUP_TEXT_AND_GRAPHICS_BASE::PANEL_SETUP_TEXT_AND_GRAPHICS_BASE( wxWindow m_gridSizer->Add( bMargins, 1, wxEXPAND|wxLEFT, 5 ); - m_gridSizer->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); - - m_mainSizer->Add( m_gridSizer, 0, wxEXPAND, 5 ); diff --git a/pcbnew/dialogs/panel_setup_text_and_graphics_base.fbp b/pcbnew/dialogs/panel_setup_text_and_graphics_base.fbp index 3083cf8ce7..807693bc3a 100644 --- a/pcbnew/dialogs/panel_setup_text_and_graphics_base.fbp +++ b/pcbnew/dialogs/panel_setup_text_and_graphics_base.fbp @@ -310,16 +310,6 @@ - - 5 - wxEXPAND|wxTOP|wxBOTTOM - 0 - - 0 - protected - 0 - - diff --git a/pcbnew/dialogs/panel_setup_zones.cpp b/pcbnew/dialogs/panel_setup_zones.cpp new file mode 100644 index 0000000000..82104435f0 --- /dev/null +++ b/pcbnew/dialogs/panel_setup_zones.cpp @@ -0,0 +1,66 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright The KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "panel_setup_zones.h" + +#include +#include +#include + + +PANEL_SETUP_ZONES::PANEL_SETUP_ZONES( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame, + BOARD_DESIGN_SETTINGS& aBrdSettings ) : + PANEL_SETUP_ZONES_BASE( aParentWindow ), + m_brdSettings( aBrdSettings ), + m_zoneSettingsBag( nullptr, &aBrdSettings.GetDefaultZoneSettings() ) +{ + m_panelZoneProperties = new PANEL_ZONE_PROPERTIES( this, aFrame, m_zoneSettingsBag, false ); + m_panelZoneProperties->SetZone( nullptr ); + m_mainSizer->Add( m_panelZoneProperties, 1, 0, 5 ); +} + + +bool PANEL_SETUP_ZONES::TransferDataToWindow() +{ + return m_panelZoneProperties->TransferZoneSettingsToWindow(); +} + + +bool PANEL_SETUP_ZONES::TransferDataFromWindow() +{ + if( m_panelZoneProperties->TransferZoneSettingsFromWindow() ) + { + ZONE_SETTINGS settings = *m_zoneSettingsBag.GetZoneSettings( nullptr ); + settings.m_Netcode = NETINFO_LIST::ORPHANED; + m_brdSettings.SetDefaultZoneSettings( settings ); + return true; + } + + return false; +} + + +bool PANEL_SETUP_ZONES::CommitPendingChanges() +{ + return m_panelZoneProperties->CommitPendingChanges(); +} \ No newline at end of file diff --git a/pcbnew/dialogs/panel_setup_zones.h b/pcbnew/dialogs/panel_setup_zones.h new file mode 100644 index 0000000000..78cb7c26aa --- /dev/null +++ b/pcbnew/dialogs/panel_setup_zones.h @@ -0,0 +1,51 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright The KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + + +#pragma once + +#include +#include +#include + + +class BOARD_DESIGN_SETTINGS; +class PANEL_ZONE_PROPERTIES; + + +class PANEL_SETUP_ZONES : public PANEL_SETUP_ZONES_BASE +{ +public: + PANEL_SETUP_ZONES( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame, BOARD_DESIGN_SETTINGS& aBrdSettings ); + ~PANEL_SETUP_ZONES( ) override = default; + + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; + + bool CommitPendingChanges(); + +private: + BOARD_DESIGN_SETTINGS& m_brdSettings; + ZONE_SETTINGS_BAG m_zoneSettingsBag; + PANEL_ZONE_PROPERTIES* m_panelZoneProperties; +}; diff --git a/pcbnew/dialogs/panel_setup_zones_base.cpp b/pcbnew/dialogs/panel_setup_zones_base.cpp new file mode 100644 index 0000000000..00cf75dd76 --- /dev/null +++ b/pcbnew/dialogs/panel_setup_zones_base.cpp @@ -0,0 +1,34 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "panel_setup_zones_base.h" + +/////////////////////////////////////////////////////////////////////////// + +PANEL_SETUP_ZONES_BASE::PANEL_SETUP_ZONES_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) +{ + m_mainSizer = new wxBoxSizer( wxVERTICAL ); + + m_staticTextDefPropDim = new wxStaticText( this, wxID_ANY, _("Default Properties for New Zones"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextDefPropDim->Wrap( -1 ); + m_mainSizer->Add( m_staticTextDefPropDim, 0, wxTOP|wxRIGHT|wxLEFT, 13 ); + + + m_mainSizer->Add( 0, 2, 0, 0, 5 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + m_mainSizer->Add( m_staticline1, 0, wxEXPAND|wxBOTTOM, 5 ); + + + this->SetSizer( m_mainSizer ); + this->Layout(); + m_mainSizer->Fit( this ); +} + +PANEL_SETUP_ZONES_BASE::~PANEL_SETUP_ZONES_BASE() +{ +} diff --git a/pcbnew/dialogs/panel_setup_zones_base.fbp b/pcbnew/dialogs/panel_setup_zones_base.fbp new file mode 100644 index 0000000000..380f3fbfc7 --- /dev/null +++ b/pcbnew/dialogs/panel_setup_zones_base.fbp @@ -0,0 +1,197 @@ + + + + + C++ + + 1 + connect + none + + + 0 + 1 + res + UTF-8 + panel_setup_zones_base + 1000 + 1 + 1 + UI + panel_setup_zones_base + . + 0 + source_name + 1 + 0 + source_name + + + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + 1 + 0 + 1 + impl_virtual + + + 0 + wxID_ANY + + + PANEL_SETUP_ZONES_BASE + + -1,-1 + ; forward_declare + + 0 + + + wxTAB_TRAVERSAL + + + m_mainSizer + wxVERTICAL + protected + + 13 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Default Properties for New Zones + 0 + + 0 + + + 0 + + 1 + m_staticTextDefPropDim + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + 5 + + 0 + + 2 + protected + 0 + + + + 5 + wxEXPAND|wxBOTTOM + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + + + + + diff --git a/pcbnew/dialogs/panel_setup_zones_base.h b/pcbnew/dialogs/panel_setup_zones_base.h new file mode 100644 index 0000000000..1cbc4db9c9 --- /dev/null +++ b/pcbnew/dialogs/panel_setup_zones_base.h @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +/// Class PANEL_SETUP_ZONES_BASE +/////////////////////////////////////////////////////////////////////////////// +class PANEL_SETUP_ZONES_BASE : public wxPanel +{ + private: + + protected: + wxBoxSizer* m_mainSizer; + wxStaticText* m_staticTextDefPropDim; + wxStaticLine* m_staticline1; + + public: + + PANEL_SETUP_ZONES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + + ~PANEL_SETUP_ZONES_BASE(); + +}; + diff --git a/pcbnew/dialogs/panel_zone_properties.cpp b/pcbnew/dialogs/panel_zone_properties.cpp index fdc45b1a78..ff44c893e9 100644 --- a/pcbnew/dialogs/panel_zone_properties.cpp +++ b/pcbnew/dialogs/panel_zone_properties.cpp @@ -45,7 +45,7 @@ wxDEFINE_EVENT( EVT_ZONE_NAME_UPDATE, wxCommandEvent ); wxDEFINE_EVENT( EVT_ZONE_NET_UPDATE, wxCommandEvent ); PANEL_ZONE_PROPERTIES::PANEL_ZONE_PROPERTIES( wxWindow* aParent, PCB_BASE_FRAME* aFrame, - ZONE_SETTINGS_BAG& aZonesSettingsBag ) : + ZONE_SETTINGS_BAG& aZonesSettingsBag, bool allowNetSpec ) : PANEL_ZONE_PROPERTIES_BASE( aParent ), m_frame( aFrame ), m_zonesSettingsBag( aZonesSettingsBag ), @@ -60,7 +60,15 @@ PANEL_ZONE_PROPERTIES::PANEL_ZONE_PROPERTIES( wxWindow* aParent, PCB_BASE_FRAME* m_gridStyleGap( aFrame, m_staticTextGridGap, m_tcGridStyleGap, m_GridStyleGapUnits ), m_islandThreshold( aFrame, m_islandThresholdLabel, m_tcIslandThreshold, m_islandThresholdUnits ) { - m_netSelector->SetNetInfo( &m_frame->GetBoard()->GetNetInfo() ); + if( allowNetSpec ) + { + m_netSelector->SetNetInfo( &m_frame->GetBoard()->GetNetInfo() ); + } + else + { + m_netLabel->Hide(); + m_netSelector->Hide(); + } m_layerPropsTable = new LAYER_PROPERTIES_GRID_TABLE( m_frame, [&]() -> LSET @@ -245,7 +253,7 @@ void PANEL_ZONE_PROPERTIES::OnZoneNameChanged( wxCommandEvent& aEvent ) bool PANEL_ZONE_PROPERTIES::TransferZoneSettingsFromWindow() { - if( !m_layerSpecificOverrides->CommitPendingChanges() ) + if( !CommitPendingChanges() ) return false; if( !m_settings ) @@ -258,6 +266,12 @@ bool PANEL_ZONE_PROPERTIES::TransferZoneSettingsFromWindow() } +bool PANEL_ZONE_PROPERTIES::CommitPendingChanges() +{ + return m_layerSpecificOverrides->CommitPendingChanges(); +} + + bool PANEL_ZONE_PROPERTIES::AcceptOptions( bool aUseExportableSetupOnly ) { if( !m_clearance.Validate( 0, pcbIUScale.mmToIU( ZONE_CLEARANCE_MAX_VALUE_MM ) ) ) diff --git a/pcbnew/dialogs/panel_zone_properties.h b/pcbnew/dialogs/panel_zone_properties.h index dd6aafa395..d905e156d1 100644 --- a/pcbnew/dialogs/panel_zone_properties.h +++ b/pcbnew/dialogs/panel_zone_properties.h @@ -41,7 +41,8 @@ class ZONE_SETTINGS_BAG; class PANEL_ZONE_PROPERTIES : public PANEL_ZONE_PROPERTIES_BASE { public: - PANEL_ZONE_PROPERTIES( wxWindow* aParent, PCB_BASE_FRAME* aFrame, ZONE_SETTINGS_BAG& aZonesSettingsBag ); + PANEL_ZONE_PROPERTIES( wxWindow* aParent, PCB_BASE_FRAME* aFrame, ZONE_SETTINGS_BAG& aZonesSettingsBag, + bool allowNetSpec = true ); ~PANEL_ZONE_PROPERTIES() override; @@ -53,6 +54,8 @@ public: bool TransferZoneSettingsFromWindow(); bool TransferZoneSettingsToWindow(); + bool CommitPendingChanges(); + private: static constexpr int INVALID_NET_CODE{ 0 }; diff --git a/pcbnew/zone_manager/dialog_zone_manager.cpp b/pcbnew/zone_manager/dialog_zone_manager.cpp index 3cfb214f75..09632a139c 100644 --- a/pcbnew/zone_manager/dialog_zone_manager.cpp +++ b/pcbnew/zone_manager/dialog_zone_manager.cpp @@ -236,7 +236,29 @@ void DIALOG_ZONE_MANAGER::SelectZoneTableItem( wxDataViewItem const& aItem ) void DIALOG_ZONE_MANAGER::OnOk( wxCommandEvent& aEvt ) { m_panelZoneProperties->TransferZoneSettingsFromWindow(); - m_zoneSettingsBag.OnUserConfirmChange(); + + m_zoneSettingsBag.UpdateClonedZones(); + + for( const auto& [ zone, zoneClone ] : m_zoneSettingsBag.GetZonesCloneMap() ) + { + std::map> filled_zone_to_restore; + ZONE* internal_zone = zone; // Duplicate the zone pointer to allow capture on older MacOS (13) + + zone->GetLayerSet().RunOnLayers( + [&]( PCB_LAYER_ID layer ) + { + std::shared_ptr fill = internal_zone->GetFilledPolysList( layer ); + + if( fill ) + filled_zone_to_restore[layer] = fill; + } ); + + *zone = *zoneClone; + + for( const auto& [ layer, fill ] : filled_zone_to_restore ) + zone->SetFilledPolysList( layer, *fill ); + } + aEvt.Skip(); } @@ -346,8 +368,7 @@ void DIALOG_ZONE_MANAGER::OnUpdateDisplayedZonesClick( wxCommandEvent& aEvent ) m_isFillingZones = true; m_panelZoneProperties->TransferZoneSettingsFromWindow(); - m_zoneSettingsBag.FlushZoneSettingsChange(); - m_zoneSettingsBag.FlushPriorityChange(); + m_zoneSettingsBag.UpdateClonedZones(); BOARD* board = m_pcbFrame->GetBoard(); board->IncrementTimeStamp(); diff --git a/pcbnew/zone_manager/managed_zone.h b/pcbnew/zone_manager/managed_zone.h index f9a10e95b1..b6f7c430bb 100644 --- a/pcbnew/zone_manager/managed_zone.h +++ b/pcbnew/zone_manager/managed_zone.h @@ -22,9 +22,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - -#ifndef MANAGED_ZONE_H -#define MANAGED_ZONE_H +#pragma once #include #include @@ -43,8 +41,7 @@ public: m_zone( std::move( aZone ) ), m_initialPriority( aInitialIndex ), m_currentPriority( aInitialIndex ) - { - } + { } MANAGED_ZONE() = delete; @@ -54,10 +51,7 @@ public: unsigned GetCurrentPriority() const { return m_currentPriority; } - void OnUserConfirmChange() { m_zone->SetAssignedPriority( m_currentPriority ); } - ZONE const& GetZone() const { return *m_zone; } - ZONE& GetZone() { return *m_zone; } private: @@ -65,5 +59,3 @@ private: const unsigned m_initialPriority; unsigned m_currentPriority; }; - -#endif \ No newline at end of file diff --git a/pcbnew/zone_settings_bag.cpp b/pcbnew/zone_settings_bag.cpp index c24d58f02c..04509c32a3 100644 --- a/pcbnew/zone_settings_bag.cpp +++ b/pcbnew/zone_settings_bag.cpp @@ -79,50 +79,21 @@ std::shared_ptr ZONE_SETTINGS_BAG::GetZoneSettings( ZONE* aZone ) } -void ZONE_SETTINGS_BAG::OnUserConfirmChange() -{ - FlushZoneSettingsChange(); - FlushPriorityChange(); - - for( const auto& [ zone, zoneClone ] : m_zonesCloneMap ) - { - std::map> filled_zone_to_restore; - ZONE* internal_zone = zone; // Duplicate the zone pointer to allow capture on older MacOS (13) - - zone->GetLayerSet().RunOnLayers( - [&]( PCB_LAYER_ID layer ) - { - std::shared_ptr fill = internal_zone->GetFilledPolysList( layer ); - - if( fill ) - filled_zone_to_restore[layer] = fill; - } ); - - *zone = *zoneClone; - - for( const auto& [ layer, fill ] : filled_zone_to_restore ) - zone->SetFilledPolysList( layer, *fill ); - } -} - - -void ZONE_SETTINGS_BAG::FlushZoneSettingsChange() +void ZONE_SETTINGS_BAG::UpdateClonedZones() { for( const std::shared_ptr& zone : m_managedZones ) { if( auto ll = m_zoneSettings.find( &zone->GetZone() ); ll != m_zoneSettings.end() ) ll->second->ExportSetting( zone->GetZone() ); } -} - -bool ZONE_SETTINGS_BAG::FlushPriorityChange() -{ + // Prevent version-control churn by not updating sparse priorities if their order didn't + // change. bool priorityChanged = false; - for( const std::shared_ptr& c : m_managedZones ) + for( const std::shared_ptr& zone : m_managedZones ) { - if( c->PriorityChanged() ) + if( zone->PriorityChanged() ) { priorityChanged = true; break; @@ -131,9 +102,7 @@ bool ZONE_SETTINGS_BAG::FlushPriorityChange() if( priorityChanged ) { - for( std::shared_ptr& c : m_managedZones ) - c->OnUserConfirmChange(); + for( std::shared_ptr& zone : m_managedZones ) + zone->GetZone().SetAssignedPriority( zone->GetCurrentPriority() ); } - - return priorityChanged; } \ No newline at end of file diff --git a/pcbnew/zone_settings_bag.h b/pcbnew/zone_settings_bag.h index 337f211446..02a2f2f1f5 100644 --- a/pcbnew/zone_settings_bag.h +++ b/pcbnew/zone_settings_bag.h @@ -51,33 +51,13 @@ public: std::shared_ptr GetZoneSettings( ZONE* zone ); /** - * @brief Adapter for the zone filler ,zones are actually managed the smart ptr - * - * @return std::vector& + * The cloned list is the working storage. */ - std::vector& GetClonedZoneList() { return m_clonedZoneList; } + void UpdateClonedZones(); - /** - * @brief Used for restoring the zones in the board after refilling - * - * @return std::vector& - */ - std::vector& GetOriginalZoneList() { return m_originalZoneList; } - - /** - * @brief Flush the zone settings change to the cloned ones - * - */ - void FlushZoneSettingsChange(); - - /** - * @brief Flush the priority change to the cloned ones - * - * @return true if priority changed - */ - bool FlushPriorityChange(); - - void OnUserConfirmChange(); + std::vector& GetOriginalZoneList() { return m_originalZoneList; } + std::vector& GetClonedZoneList() { return m_clonedZoneList; } + std::unordered_map>& GetZonesCloneMap() { return m_zonesCloneMap; } private: std::unordered_map> m_zonesCloneMap;