KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_setup_zones.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#include "panel_setup_zones.h"
21
22#include <pcb_edit_frame.h>
26
27
28PANEL_SETUP_ZONES::PANEL_SETUP_ZONES( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame,
29 BOARD_DESIGN_SETTINGS& aBrdSettings ) :
30 PANEL_SETUP_ZONES_BASE( aParentWindow ),
31 m_brdSettings( aBrdSettings ),
32 m_zoneSettingsBag( nullptr, &aBrdSettings.GetDefaultZoneSettings() )
33{
35 m_panelZoneProperties->SetZone( nullptr );
36 m_scrolledWindow->GetSizer()->Add( m_panelZoneProperties, 1, wxEXPAND, 5 );
37
39 m_scrolledWindow->GetSizer()->AddSpacer( 10 );
40 m_scrolledWindow->GetSizer()->Add( m_panelHatchOffsets, 0, wxEXPAND, 5 );
41}
42
43
45{
46 if( !m_panelZoneProperties->TransferZoneSettingsToWindow() )
47 return false;
48
49 return m_panelHatchOffsets->TransferDataToWindow();
50}
51
52
54{
55 if( m_panelZoneProperties->TransferZoneSettingsFromWindow() )
56 {
57 ZONE_SETTINGS settings = *m_zoneSettingsBag.GetZoneSettings( nullptr );
59 m_brdSettings.SetDefaultZoneSettings( settings );
60
61 return m_panelHatchOffsets->TransferDataFromWindow();
62 }
63
64 return false;
65}
66
67
69{
70 return m_panelZoneProperties->CommitPendingChanges();
71}
72
73
75{
76 // The bag holds a copy of the default zone settings keyed by nullptr.
77 // Overwrite that copy with the other board's defaults and refresh the window.
78 *m_zoneSettingsBag.GetZoneSettings( nullptr ) = aBoard->GetDesignSettings().GetDefaultZoneSettings();
79 m_panelZoneProperties->TransferZoneSettingsToWindow();
80}
81
82
84{
85 m_panelHatchOffsets->ImportSettingsFrom( aBoard );
86}
87
88
89void PANEL_SETUP_ZONES::SyncCopperLayers( int aCopperLayerCount )
90{
91 m_panelHatchOffsets->SyncCopperLayers( aCopperLayerCount );
92 m_scrolledWindow->Layout();
93 m_scrolledWindow->FitInside();
94}
Container for design settings for a BOARD object.
ZONE_SETTINGS & GetDefaultZoneSettings()
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:372
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition board.cpp:1149
static const int ORPHANED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
Definition netinfo.h:260
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)
wxScrolledWindow * m_scrolledWindow
BOARD_DESIGN_SETTINGS & m_brdSettings
ZONE_SETTINGS_BAG m_zoneSettingsBag
void SyncCopperLayers(int aCopperLayerCount)
PANEL_ZONE_PROPERTIES * m_panelZoneProperties
void ImportSettingsFrom(BOARD *aBoard)
void ImportHatchOffsetsFrom(BOARD *aBoard)
bool TransferDataFromWindow() override
PANEL_SETUP_ZONES(wxWindow *aParentWindow, PCB_EDIT_FRAME *aFrame, BOARD_DESIGN_SETTINGS &aBrdSettings)
bool TransferDataToWindow() override
PANEL_SETUP_ZONE_HATCH_OFFSETS * m_panelHatchOffsets
The main frame for Pcbnew.
ZONE_SETTINGS handles zones parameters.