1 /*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2017-2021 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, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24
25 #include <dialog_push_pad_properties.h>
26
27 #include <pad.h>
28 #include <macros.h>
29 #include <pcb_edit_frame.h>
30
31
32 // Class DIALOG_PUSH_PAD_PROPERTIES static variables
33 bool DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Shape_Filter = true;
34 bool DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Layer_Filter = true;
35 bool DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Orient_Filter = true;
36 bool DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Type_Filter = true;
37
38
DIALOG_PUSH_PAD_PROPERTIES(PCB_BASE_FRAME * aParent)39 DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES( PCB_BASE_FRAME* aParent ) :
40 DIALOG_PUSH_PAD_PROPERTIES_BASE( aParent ),
41 m_parent( aParent )
42 {
43 // Pad filter selection.
44 m_Pad_Shape_Filter_CB->SetValue( m_Pad_Shape_Filter );
45 m_Pad_Layer_Filter_CB->SetValue( m_Pad_Layer_Filter );
46 m_Pad_Orient_Filter_CB->SetValue( m_Pad_Orient_Filter );
47 m_Pad_Type_Filter_CB->SetValue( m_Pad_Type_Filter );
48
49 // We use a sdbSizer to get platform-dependent ordering of the action buttons, but
50 // that requires us to correct the button labels here.
51 m_sdbSizer1OK->SetLabel( _( "Change Pads on Current Footprint" ) );
52
53 if( aParent->IsType( FRAME_FOOTPRINT_EDITOR ) )
54 m_sdbSizer1Apply->Show( false );
55 else
56 m_sdbSizer1Apply->SetLabel( _( "Change Pads on Identical Footprints" ) );
57
58 m_sdbSizer1->Layout();
59
60 m_sdbSizer1OK->SetDefault();
61
62 finishDialogSettings();
63 }
64
65
PadPropertiesAccept(wxCommandEvent & event)66 void DIALOG_PUSH_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
67 {
68 int returncode = 0;
69
70 switch( event.GetId() )
71 {
72 case wxID_APPLY:
73 returncode = 1;
74 KI_FALLTHROUGH;
75
76 case wxID_OK:
77 m_Pad_Shape_Filter = m_Pad_Shape_Filter_CB->GetValue();
78 m_Pad_Layer_Filter = m_Pad_Layer_Filter_CB->GetValue();
79 m_Pad_Orient_Filter = m_Pad_Orient_Filter_CB->GetValue();
80 m_Pad_Type_Filter = m_Pad_Type_Filter_CB->GetValue();
81
82 if( IsQuasiModal() )
83 EndQuasiModal( returncode );
84 else
85 EndDialog( returncode );
86
87 break;
88 }
89
90 m_parent->OnModify();
91 }
92