KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_setup_drill_chart.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
21
22#include <board.h>
24#include <pcb_edit_frame.h>
25#include <tool/tool_manager.h>
26#include <tools/pcb_actions.h>
28
29
30namespace
31{
32
35const DRILL_GROUP_KEY g_groupKeyRows[] = {
41};
42
43} // namespace
44
45
53
54
56{
57 const DRILL_SYMBOL_PROFILE& profile = aSettings.GetDrillSymbolProfile();
58
59 for( size_t row = 0; row < std::size( g_groupKeyRows ); ++row )
60 m_groupByList->Check( row, profile.IsGroupedBy( g_groupKeyRows[row] ) );
61
62 m_markPolicyCtrl->SetSelection( static_cast<int>( profile.GetMarkPolicy() ) );
63 m_symbolSize.SetValue( profile.GetSymbolSize() );
64 m_symbolWidth.SetValue( profile.GetSymbolWidth() );
65 m_freezeAssignments->SetValue( profile.GetFreezeAssignments() );
66}
67
68
70{
71 loadSettings( m_frame->GetBoard()->GetDesignSettings() );
72
73 return true;
74}
75
76
78{
79 BOARD_DESIGN_SETTINGS& bds = m_frame->GetBoard()->GetDesignSettings();
81
82 for( size_t row = 0; row < std::size( g_groupKeyRows ); ++row )
83 profile.SetGroupedBy( g_groupKeyRows[row], m_groupByList->IsChecked( row ) );
84
85 profile.SetMarkPolicy( static_cast<DRILL_MARK_POLICY>( m_markPolicyCtrl->GetSelection() ) );
86 profile.SetSymbolSize( m_symbolSize.GetIntValue() );
87 profile.SetSymbolWidth( m_symbolWidth.GetIntValue() );
88 profile.SetFreezeAssignments( m_freezeAssignments->GetValue() );
89
90 // Grouping drives both the chart rows and the symbols, so every cached answer keyed on
91 // the profile has to be given a reason to notice
92
93 m_frame->GetBoard()->BumpDrillModelGeneration();
94
95 return true;
96}
97
98
103
104
105
106void PANEL_SETUP_DRILL_CHART::onEditGroups( wxCommandEvent& aEvent )
107{
108 PAGED_DIALOG* dialog = PAGED_DIALOG::GetDialog( this );
109
110 if( !dialog )
111 return;
112
113 // Through the OK button, not EndModal, so every other page still gets its
114 // TransferDataFromWindow
115 wxCommandEvent okEvent( wxEVT_BUTTON, wxID_OK );
116 dialog->GetEventHandler()->ProcessEvent( okEvent );
117
118 // A page that refused to validate leaves the dialog open, and the user is still editing
119 if( dialog->IsShown() )
120 return;
121
122 m_frame->GetToolManager()->PostAction( PCB_ACTIONS::showDrillGroups );
123}
Container for design settings for a BOARD object.
DRILL_SYMBOL_PROFILE & GetDrillSymbolProfile()
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:411
BOARD_DESIGN_SETTINGS & GetDesignSettings()
Definition board.cpp:1290
Grouping rules and symbol assignments, shared by reference so a chart and its map can never disagree ...
void SetSymbolWidth(int aWidth)
bool IsGroupedBy(DRILL_GROUP_KEY aKey) const
void SetFreezeAssignments(bool aFreeze)
void SetGroupedBy(DRILL_GROUP_KEY aKey, bool aOn)
void SetMarkPolicy(DRILL_MARK_POLICY aPolicy)
DRILL_MARK_POLICY GetMarkPolicy() const
static PAGED_DIALOG * GetDialog(wxWindow *aWindow)
PANEL_SETUP_DRILL_CHART_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)
void ImportSettingsFrom(BOARD *aBoard)
void onEditGroups(wxCommandEvent &aEvent) override
void loadSettings(const BOARD_DESIGN_SETTINGS &aSettings)
PANEL_SETUP_DRILL_CHART(wxWindow *aParentWindow, PCB_EDIT_FRAME *aFrame)
static TOOL_ACTION showDrillGroups
The main frame for Pcbnew.
DRILL_MARK_POLICY
DRILL_GROUP_KEY
Which properties split holes into separate chart rows and symbols.