You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.8 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2017 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. #include <dialog_push_pad_properties.h>
  24. #include <class_pad.h>
  25. #include <pcb_edit_frame.h>
  26. // Class DIALOG_PUSH_PAD_PROPERTIES static variables
  27. bool DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Shape_Filter = true;
  28. bool DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Layer_Filter = true;
  29. bool DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Orient_Filter = true;
  30. DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES( PCB_BASE_FRAME* aParent ) :
  31. DIALOG_PUSH_PAD_PROPERTIES_BASE( aParent ),
  32. m_parent( aParent )
  33. {
  34. // Pad filter selection.
  35. m_Pad_Shape_Filter_CB->SetValue( m_Pad_Shape_Filter );
  36. m_Pad_Layer_Filter_CB->SetValue( m_Pad_Layer_Filter );
  37. m_Pad_Orient_Filter_CB->SetValue( m_Pad_Orient_Filter );
  38. // We use a sdbSizer to get platform-dependent ordering of the action buttons, but
  39. // that requires us to correct the button labels here.
  40. m_sdbSizer1OK->SetLabel( _( "Change Pads on Current Footprint" ) );
  41. if( aParent->IsType( FRAME_PCB_MODULE_EDITOR ) )
  42. m_sdbSizer1Apply->Show( false );
  43. else
  44. m_sdbSizer1Apply->SetLabel( _( "Change Pads on Identical Footprints" ) );
  45. m_sdbSizer1->Layout();
  46. m_sdbSizer1OK->SetDefault();
  47. FinishDialogSettings();
  48. }
  49. /* Update the parameters for the component being edited.
  50. */
  51. void DIALOG_PUSH_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
  52. {
  53. int returncode = 0;
  54. switch( event.GetId() )
  55. {
  56. case wxID_APPLY:
  57. returncode = 1;
  58. // Fall through
  59. case wxID_OK:
  60. m_Pad_Shape_Filter = m_Pad_Shape_Filter_CB->GetValue();
  61. m_Pad_Layer_Filter = m_Pad_Layer_Filter_CB->GetValue();
  62. m_Pad_Orient_Filter = m_Pad_Orient_Filter_CB->GetValue();
  63. EndModal( returncode );
  64. break;
  65. }
  66. m_parent->OnModify();
  67. }