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.

99 lines
3.0 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 <cvpcb.h>
  26. #include <class_drawpanel.h>
  27. #include <display_footprints_frame.h>
  28. #include <dialog_display_options.h>
  29. void DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay( wxCommandEvent& event )
  30. {
  31. DIALOG_FOOTPRINTS_DISPLAY_OPTIONS OptionWindow( this );
  32. OptionWindow.ShowModal();
  33. }
  34. DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( DISPLAY_FOOTPRINTS_FRAME* parent )
  35. : DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( parent )
  36. {
  37. m_Parent = parent;
  38. initDialog();
  39. m_sdbSizerOK->SetDefault();
  40. FinishDialogSettings();;
  41. }
  42. DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( )
  43. {
  44. }
  45. void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog()
  46. {
  47. /* mandatory to use escape key as cancel under wxGTK. */
  48. SetFocus();
  49. auto displ_opts = (PCB_DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();
  50. m_EdgesDisplayOption->SetValue( not displ_opts->m_DisplayModEdgeFill );
  51. m_TextDisplayOption->SetValue( not displ_opts->m_DisplayModTextFill );
  52. m_ShowPadSketch->SetValue( not displ_opts->m_DisplayPadFill );
  53. m_ShowPadNum->SetValue( displ_opts->m_DisplayPadNum );
  54. m_autoZoomOption->SetValue( m_Parent->GetAutoZoom() );
  55. }
  56. void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void )
  57. {
  58. auto displ_opts = (PCB_DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();
  59. displ_opts->m_DisplayModEdgeFill = not m_EdgesDisplayOption->GetValue();
  60. displ_opts->m_DisplayModTextFill = not m_TextDisplayOption->GetValue();
  61. displ_opts->m_DisplayPadNum = m_ShowPadNum->GetValue();
  62. displ_opts->m_DisplayPadFill = not m_ShowPadSketch->GetValue();
  63. m_Parent->ApplyDisplaySettingsToGAL();
  64. m_Parent->SetAutoZoom( m_autoZoomOption->GetValue() );
  65. }
  66. bool DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::TransferDataFromWindow()
  67. {
  68. UpdateObjectSettings();
  69. return true;
  70. }
  71. void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::OnApplyClick( wxCommandEvent& event )
  72. {
  73. UpdateObjectSettings();
  74. }