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.

100 lines
4.1 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2018 KiCad Developers, see change_log.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 <pcb_edit_frame.h>
  25. #include <board_design_settings.h>
  26. #include <panel_setup_feature_constraints.h>
  27. PANEL_SETUP_FEATURE_CONSTRAINTS::PANEL_SETUP_FEATURE_CONSTRAINTS( PAGED_DIALOG* aParent,
  28. PCB_EDIT_FRAME* aFrame ) :
  29. PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( aParent->GetTreebook() ),
  30. m_trackMinWidth( aFrame, m_TrackMinWidthTitle, m_TrackMinWidthCtrl, m_TrackMinWidthUnits, true, 0 ),
  31. m_viaMinSize( aFrame, m_ViaMinTitle, m_SetViasMinSizeCtrl, m_ViaMinUnits, true, 0 ),
  32. m_viaMinDrill( aFrame, m_ViaMinDrillTitle, m_SetViasMinDrillCtrl, m_ViaMinDrillUnits, true, 0 ),
  33. m_uviaMinSize( aFrame, m_uviaMinSizeLabel, m_uviaMinSizeCtrl, m_uviaMinSizeUnits, true, 0 ),
  34. m_uviaMinDrill( aFrame, m_uviaMinDrillLabel, m_uviaMinDrillCtrl, m_uviaMinDrillUnits, true, 0 ),
  35. m_holeToHoleMin( aFrame, m_HoleToHoleTitle, m_SetHoleToHoleCtrl, m_HoleToHoleUnits, true, 0 )
  36. {
  37. m_Frame = aFrame;
  38. m_BrdSettings = &m_Frame->GetBoard()->GetDesignSettings();
  39. }
  40. bool PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataToWindow()
  41. {
  42. m_trackMinWidth.SetValue( m_BrdSettings->m_TrackMinWidth );
  43. m_viaMinSize.SetValue(m_BrdSettings->m_ViasMinSize );
  44. m_viaMinDrill.SetValue( m_BrdSettings->m_ViasMinDrill );
  45. m_OptAllowBlindBuriedVias->SetValue( m_BrdSettings->m_BlindBuriedViaAllowed );
  46. m_OptAllowMicroVias->SetValue( m_BrdSettings->m_MicroViasAllowed );
  47. m_uviaMinSize.SetValue( m_BrdSettings->m_MicroViasMinSize );
  48. m_uviaMinDrill.SetValue( m_BrdSettings->m_MicroViasMinDrill );
  49. m_holeToHoleMin.SetValue( m_BrdSettings->m_HoleToHoleMin );
  50. m_OptRequireCourtyards->SetValue( m_BrdSettings->m_RequireCourtyards );
  51. m_OptOverlappingCourtyards->SetValue( m_BrdSettings->m_ProhibitOverlappingCourtyards );
  52. return true;
  53. }
  54. bool PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataFromWindow()
  55. {
  56. // Update tracks minimum values for DRC
  57. m_BrdSettings->m_TrackMinWidth = m_trackMinWidth.GetValue();
  58. // Update vias minimum values for DRC
  59. m_BrdSettings->m_ViasMinSize = m_viaMinSize.GetValue();
  60. m_BrdSettings->m_ViasMinDrill = m_viaMinDrill.GetValue();
  61. m_BrdSettings->m_BlindBuriedViaAllowed = m_OptAllowBlindBuriedVias->GetValue();
  62. m_BrdSettings->m_MicroViasAllowed = m_OptAllowMicroVias->GetValue();
  63. // Update microvias minimum values for DRC
  64. m_BrdSettings->m_MicroViasMinSize = m_uviaMinSize.GetValue();
  65. m_BrdSettings->m_MicroViasMinDrill = m_uviaMinDrill.GetValue();
  66. m_BrdSettings->SetMinHoleSeparation( m_holeToHoleMin.GetValue() );
  67. m_BrdSettings->SetRequireCourtyardDefinitions( m_OptRequireCourtyards->GetValue() );
  68. m_BrdSettings->SetProhibitOverlappingCourtyards( m_OptOverlappingCourtyards->GetValue() );
  69. return true;
  70. }
  71. void PANEL_SETUP_FEATURE_CONSTRAINTS::ImportSettingsFrom( BOARD* aBoard )
  72. {
  73. BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
  74. m_BrdSettings = &aBoard->GetDesignSettings();
  75. TransferDataToWindow();
  76. m_BrdSettings = savedSettings;
  77. }