KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_track_via_properties.h
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 (C) 2015 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 * @author Maciej Suminski <[email protected]>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
23#include <tools/pcb_selection.h>
24#include <widgets/unit_binder.h>
25#include <optional>
26#include <layer_ids.h>
28
30class PAD;
31class PADSTACK;
32class PCB_VIA;
33
35{
36public:
38
42 DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, PCB_VIA* aStandaloneVia );
43
45
46 bool TransferDataFromWindow() override;
47
48protected:
49 void onViaNotFreeClicked( wxCommandEvent& aEvent ) override;
50 void onWidthSelect( wxCommandEvent& aEvent ) override;
51 void onWidthEdit( wxCommandEvent& aEvent ) override;
52 void onViaSelect( wxCommandEvent& aEvent ) override;
53 void onViaEdit( wxCommandEvent& aEvent ) override;
54 void onTrackEdit( wxCommandEvent& aEvent ) override;
55 void onPadstackModeChanged( wxCommandEvent& aEvent ) override;
56 void onEditLayerChanged( wxCommandEvent& aEvent ) override;
57 void onBackdrillChange( wxCommandEvent& aEvent ) override;
58 void onTopPostMachineChange( wxCommandEvent& aEvent ) override;
59 void onBottomPostMachineChange( wxCommandEvent& aEvent ) override;
60 void onProtectionFeaturesChange( wxCommandEvent& aEvent ) override;
61 void onMachiningEdit( wxCommandEvent& aEvent ) override;
62
63private:
64 void onNetSelector( wxCommandEvent& aEvent );
65
66 void onUnitsChanged( wxCommandEvent& aEvent );
67 void onTeardropsUpdateUi( wxUpdateUIEvent& event ) override;
68
69 bool confirmShortingNets( int aNet, const std::set<int>& shortingNets );
70 bool confirmPadChange( const std::set<PAD*>& connectedPads );
71
72 int getLayerDepth();
74
76 int copperOrdinal( PCB_LAYER_ID aLayer ) const;
77 PCB_LAYER_ID copperLayer( int aOrdinal ) const;
78
80 struct VIA_SPAN
81 {
82 int m_Top;
84 bool m_Through;
87 };
88
89 VIA_SPAN viaSpan() const;
90
93 {
94 wxChoice* m_Mode;
95 wxStaticText* m_ModeLabel;
97 wxStaticText* m_SizeLabel;
99 wxStaticText* m_AngleOrDepthLabel;
100 wxStaticText* m_AngleOrDepthUnits;
101 };
102
104
107 void syncBackdrillControls( bool aFromUserEvent );
108 void syncPostMachineControls( bool aFront, bool aFromUserEvent );
109
111 void updateViaPreview();
112
114 bool TransferDataToWindow() override;
115
116private:
120 const PCB_SELECTION& m_items; // List of items to be modified.
121
123 bool m_standalone = false;
124
125 void commonInit( PCB_BASE_EDIT_FRAME* aParent );
126
131
134
141
147
148 bool m_tracks; // True if dialog displays any track properties.
149 bool m_vias; // True if dialog displays any via properties.
150
152 std::unique_ptr<PADSTACK> m_viaStack;
153
156 std::map<int, PCB_LAYER_ID> m_editLayerCtrlMap;
158
162};
DIALOG_TRACK_VIA_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Track & Via Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU)
void onWidthEdit(wxCommandEvent &aEvent) override
void onUnitsChanged(wxCommandEvent &aEvent)
void onNetSelector(wxCommandEvent &aEvent)
void onWidthSelect(wxCommandEvent &aEvent) override
bool confirmShortingNets(int aNet, const std::set< int > &shortingNets)
int copperOrdinal(PCB_LAYER_ID aLayer) const
Copper layers as ordinals, 0 for the front and the copper count minus one for the back.
void syncBackdrillControls(bool aFromUserEvent)
Enable the fields that depend on a choice, without touching the preview.
bool m_standalone
Dialog was constructed for a standalone via (via stitching.
void syncPostMachineControls(bool aFront, bool aFromUserEvent)
bool m_backdrillFrontLayerMixed
A layer selector cannot hold a mixed state in its value, so the dialog remembers it.
void onTeardropsUpdateUi(wxUpdateUIEvent &event) override
void onPadstackModeChanged(wxCommandEvent &aEvent) override
void onBackdrillChange(wxCommandEvent &aEvent) override
void onViaEdit(wxCommandEvent &aEvent) override
std::map< int, PCB_LAYER_ID > m_editLayerCtrlMap
PCB_LAYER_ID copperLayer(int aOrdinal) const
void onProtectionFeaturesChange(wxCommandEvent &aEvent) override
PCB_LAYER_ID m_editLayer
The currently-shown copper layer of the edited via(s)
void onViaSelect(wxCommandEvent &aEvent) override
bool TransferDataToWindow() override
Get data from the PCB board and display it to dialog.
void onBottomPostMachineChange(wxCommandEvent &aEvent) override
void onEditLayerChanged(wxCommandEvent &aEvent) override
void onTopPostMachineChange(wxCommandEvent &aEvent) override
void onViaNotFreeClicked(wxCommandEvent &aEvent) override
void commonInit(PCB_BASE_EDIT_FRAME *aParent)
DIALOG_TRACK_VIA_PROPERTIES(PCB_BASE_EDIT_FRAME *aParent, const PCB_SELECTION &aItems)
std::unique_ptr< PADSTACK > m_viaStack
Temporary padstack of the edited via(s)
PCB_SELECTION m_viaStandaloneSelection
Used for standalone via mode to flow through the normal update logic.
bool confirmPadChange(const std::set< PAD * > &connectedPads)
POST_MACHINE_CONTROLS postMachineControls(bool aFront)
void onMachiningEdit(wxCommandEvent &aEvent) override
void onTrackEdit(wxCommandEvent &aEvent) override
A PADSTACK defines the characteristics of a single or multi-layer pad, in the IPC sense of the word.
Definition padstack.h:161
Definition pad.h:61
Common, abstract interface for edit frames.
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
The copper layers the edited via spans, as read from the type and layer controls.
bool m_Through
the type control says through, or is mixed
int m_Top
ordinal of the first copper layer
int m_Bottom
ordinal of the last copper layer
bool m_ReachesBack
the span ends on the back copper
bool m_ReachesFront
the span starts on the front copper