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.

95 lines
2.9 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 1992-2018 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 <fctsys.h>
  24. #include <common.h>
  25. #include <display_footprints_frame.h>
  26. #include <dialog_display_options.h>
  27. void DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay( wxCommandEvent& event )
  28. {
  29. DIALOG_FOOTPRINTS_DISPLAY_OPTIONS OptionWindow( this );
  30. OptionWindow.ShowModal();
  31. }
  32. DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( DISPLAY_FOOTPRINTS_FRAME* parent )
  33. : DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( parent )
  34. {
  35. m_Parent = parent;
  36. initDialog();
  37. m_sdbSizerOK->SetDefault();
  38. FinishDialogSettings();;
  39. }
  40. DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( )
  41. {
  42. }
  43. void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog()
  44. {
  45. /* mandatory to use escape key as cancel under wxGTK. */
  46. SetFocus();
  47. auto displ_opts = (PCB_DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();
  48. m_EdgesDisplayOption->SetValue( not displ_opts->m_DisplayModEdgeFill );
  49. m_TextDisplayOption->SetValue( not displ_opts->m_DisplayModTextFill );
  50. m_ShowPadSketch->SetValue( not displ_opts->m_DisplayPadFill );
  51. m_ShowPadNum->SetValue( displ_opts->m_DisplayPadNum );
  52. m_autoZoomOption->SetValue( m_Parent->GetAutoZoom() );
  53. }
  54. void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void )
  55. {
  56. auto displ_opts = (PCB_DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();
  57. displ_opts->m_DisplayModEdgeFill = not m_EdgesDisplayOption->GetValue();
  58. displ_opts->m_DisplayModTextFill = not m_TextDisplayOption->GetValue();
  59. displ_opts->m_DisplayPadNum = m_ShowPadNum->GetValue();
  60. displ_opts->m_DisplayPadFill = not m_ShowPadSketch->GetValue();
  61. m_Parent->ApplyDisplaySettingsToGAL();
  62. m_Parent->SetAutoZoom( m_autoZoomOption->GetValue() );
  63. }
  64. bool DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::TransferDataFromWindow()
  65. {
  66. UpdateObjectSettings();
  67. return true;
  68. }
  69. void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::OnApplyClick( wxCommandEvent& event )
  70. {
  71. UpdateObjectSettings();
  72. }