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.

75 lines
2.6 KiB

  1. /*
  2. * KiRouter - a push-and-(sometimes-)shove PCB router
  3. *
  4. * Copyright (C) 2014 CERN
  5. * Author: Maciej Suminski <maciej.suminski@cern.ch>
  6. *
  7. * This program is free software: you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation, either version 3 of the License, or (at your
  10. * option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program. If not, see <http://www.gnu.or/licenses/>.
  19. */
  20. /**
  21. * Push and Shove router settings dialog.
  22. */
  23. #include "dialog_pns_settings.h"
  24. #include <router/pns_routing_settings.h>
  25. DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS_ROUTING_SETTINGS& aSettings ) :
  26. DIALOG_PNS_SETTINGS_BASE( aParent ), m_settings( aSettings )
  27. {
  28. // "Figure out what's best" is not available yet
  29. m_mode->Enable( RM_Smart, false );
  30. // Load widgets' values from settings
  31. m_mode->SetSelection( m_settings.Mode() );
  32. m_shoveVias->SetValue( m_settings.ShoveVias() );
  33. m_backPressure->SetValue( m_settings.JumpOverObstacles() );
  34. m_removeLoops->SetValue( m_settings.RemoveLoops() );
  35. m_suggestEnding->SetValue( m_settings.SuggestFinish() );
  36. m_autoNeckdown->SetValue( m_settings.SmartPads() );
  37. m_effort->SetValue( m_settings.OptimizerEffort() );
  38. m_smoothDragged->SetValue( m_settings.SmoothDraggedSegments() );
  39. m_violateDrc->SetValue( m_settings.CanViolateDRC() );
  40. }
  41. void DIALOG_PNS_SETTINGS::OnClose( wxCloseEvent& aEvent )
  42. {
  43. // Do nothing, it is result of ESC pressing
  44. EndModal( 0 );
  45. }
  46. void DIALOG_PNS_SETTINGS::OnOkClick( wxCommandEvent& aEvent )
  47. {
  48. // Save widgets' values to settings
  49. m_settings.SetMode( (PNS_MODE) m_mode->GetSelection() );
  50. m_settings.SetShoveVias( m_shoveVias->GetValue() );
  51. m_settings.SetJumpOverObstacles( m_backPressure->GetValue() );
  52. m_settings.SetRemoveLoops( m_removeLoops->GetValue() );
  53. m_settings.SetSuggestFinish ( m_suggestEnding->GetValue() );
  54. m_settings.SetSmartPads( m_autoNeckdown->GetValue() );
  55. m_settings.SetOptimizerEffort( (PNS_OPTIMIZATION_EFFORT) m_effort->GetValue() );
  56. m_settings.SetSmoothDraggedSegments( m_smoothDragged->GetValue() );
  57. m_settings.SetCanViolateDRC( m_violateDrc->GetValue() );
  58. EndModal( 1 );
  59. }
  60. void DIALOG_PNS_SETTINGS::OnCancelClick( wxCommandEvent& aEvent )
  61. {
  62. // Do nothing
  63. EndModal( 0 );
  64. }