KiCad PCB EDA Suite
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  * @author Maciej Suminski <maciej.suminski@cern.ch>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
26 #include <wx_unit_binder.h>
27 #include <boost/optional.hpp>
29 
30 class SELECTION;
31 class COMMIT;
32 
33 class PCB_BASE_FRAME;
34 
36 {
37 public:
38  DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParent, const SELECTION& aItems );
39 
41  bool Apply( COMMIT& aCommit );
42 
43 private:
44  void onClose( wxCloseEvent& aEvent ) override;
45  void onTrackNetclassCheck( wxCommandEvent& aEvent ) override;
46  void onViaNetclassCheck( wxCommandEvent& aEvent ) override;
47  void onCancelClick( wxCommandEvent& aEvent ) override;
48  void onOkClick( wxCommandEvent& aEvent ) override;
49  void onViaSelect( wxCommandEvent& aEvent );
50  void onViaEdit( wxCommandEvent& aEvent );
51 
52  void OnInitDlg( wxInitDialogEvent& event ) override
53  {
54  // Call the default wxDialog handler of a wxInitDialogEvent
55  TransferDataToWindow();
56 
57  // Now all widgets have the size fixed, call FinishDialogSettings
59  }
60 
62  bool check() const;
63 
65  template<typename T>
66  void setCommonVal( const boost::optional<T>& aVal, wxTextEntry* aTxtEntry, WX_UNIT_BINDER& aBinder )
67  {
68  if( aVal )
69  aBinder.SetValue( *aVal );
70  else
71  aTxtEntry->SetValue( "<...>" );
72  }
73 
76 
80 
83 
85  bool m_tracks;
86 
88  bool m_vias;
89 
92 };
void onTrackNetclassCheck(wxCommandEvent &aEvent) override
bool check() const
Checks if the dialog values are correct.
const SELECTION & m_items
Selected items to be modified.
bool m_tracks
Flag that determines if the dialog displays track properties.
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
bool m_vias
Flag that determines if the dialog displays via properties.
Class COMMIT.
Definition: commit.h:71
void onCancelClick(wxCommandEvent &aEvent) override
void OnInitDlg(wxInitDialogEvent &event) override
void setCommonVal(const boost::optional< T > &aVal, wxTextEntry *aTxtEntry, WX_UNIT_BINDER &aBinder)
Sets wxTextEntry to the value stored in boost::optional or "<...>" if it is not available...
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
DIALOG_TRACK_VIA_PROPERTIES(PCB_BASE_FRAME *aParent, const SELECTION &aItems)
void onViaSelect(wxCommandEvent &aEvent)
void onViaEdit(wxCommandEvent &aEvent)
void onOkClick(wxCommandEvent &aEvent) override
Board layer functions and definitions.
void onViaNetclassCheck(wxCommandEvent &aEvent) override
void onClose(wxCloseEvent &aEvent) override
Class DIALOG_TRACK_VIA_PROPERTIES_BASE.
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
bool Apply(COMMIT &aCommit)
Applies values from the dialog to the selected items.