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
54
55
57{
58 const DRILL_SYMBOL_PROFILE& profile = aSettings.GetDrillSymbolProfile();
59
60 for( size_t row = 0; row < std::size( g_groupKeyRows ); ++row )
61 m_groupByList->Check( row, profile.IsGroupedBy( g_groupKeyRows[row] ) );
62
63 m_markPolicyCtrl->SetSelection( static_cast<int>( profile.GetMarkPolicy() ) );
64 m_symbolSize.SetValue( profile.GetSymbolSize() );
65 m_symbolWidth.SetValue( profile.GetSymbolWidth() );
66 m_freezeAssignments->SetValue( profile.GetFreezeAssignments() );
67
68}
69
70
72{
73 loadSettings( m_frame->GetBoard()->GetDesignSettings() );
74
75 return true;
76}
77
78
80{
81 BOARD_DESIGN_SETTINGS& bds = m_frame->GetBoard()->GetDesignSettings();
83
84 for( size_t row = 0; row < std::size( g_groupKeyRows ); ++row )
85 profile.SetGroupedBy( g_groupKeyRows[row], m_groupByList->IsChecked( row ) );
86
87 profile.SetMarkPolicy( static_cast<DRILL_MARK_POLICY>( m_markPolicyCtrl->GetSelection() ) );
88 profile.SetSymbolSize( m_symbolSize.GetIntValue() );
89 profile.SetSymbolWidth( m_symbolWidth.GetIntValue() );
90 profile.SetFreezeAssignments( m_freezeAssignments->GetValue() );
91
92
93 // Grouping drives both the chart rows and the symbols, so every cached answer keyed on
94 // the profile has to be given a reason to notice
95
96 m_frame->GetBoard()->BumpDrillModelGeneration();
97
98 return true;
99}
100
101
106
107
108
109void PANEL_SETUP_DRILL_CHART::onEditGroups( wxCommandEvent& aEvent )
110{
111 PAGED_DIALOG* dialog = PAGED_DIALOG::GetDialog( this );
112
113 if( !dialog )
114 return;
115
116 // Through the OK button, not EndModal, so every other page still gets its
117 // TransferDataFromWindow
118 wxCommandEvent okEvent( wxEVT_BUTTON, wxID_OK );
119 dialog->GetEventHandler()->ProcessEvent( okEvent );
120
121 // A page that refused to validate leaves the dialog open, and the user is still editing
122 if( dialog->IsShown() )
123 return;
124
125 m_frame->GetToolManager()->PostAction( PCB_ACTIONS::showDrillGroups );
126}
Container for design settings for a BOARD object.
DRILL_SYMBOL_PROFILE & GetDrillSymbolProfile()
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:409
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition board.cpp:1299
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 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.