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.

88 lines
3.6 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
  5. * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. #include <fctsys.h>
  25. #include <base_screen.h>
  26. #include <lib_edit_frame.h>
  27. #include <sch_view.h>
  28. #include <sch_painter.h>
  29. #include "panel_libedit_settings.h"
  30. PANEL_LIBEDIT_SETTINGS::PANEL_LIBEDIT_SETTINGS( LIB_EDIT_FRAME* aFrame, wxWindow* aWindow ) :
  31. PANEL_LIBEDIT_SETTINGS_BASE( aWindow ),
  32. m_frame( aFrame )
  33. {}
  34. bool PANEL_LIBEDIT_SETTINGS::TransferDataToWindow()
  35. {
  36. m_lineWidthCtrl->SetValue(
  37. StringFromValue( EDA_UNITS::INCHES, GetDefaultLineThickness(), false, true ) );
  38. m_pinLengthCtrl->SetValue(
  39. StringFromValue( EDA_UNITS::INCHES, m_frame->GetDefaultPinLength(), false, true ) );
  40. m_pinNumSizeCtrl->SetValue(
  41. StringFromValue( EDA_UNITS::INCHES, m_frame->GetPinNumDefaultSize(), false, true ) );
  42. m_pinNameSizeCtrl->SetValue(
  43. StringFromValue( EDA_UNITS::INCHES, m_frame->GetPinNameDefaultSize(), false, true ) );
  44. m_hPitchCtrl->SetValue(
  45. StringFromValue( EDA_UNITS::INCHES, m_frame->GetRepeatStep().x, false, true ) );
  46. m_vPitchCtrl->SetValue(
  47. StringFromValue( EDA_UNITS::INCHES, m_frame->GetRepeatStep().y, false, true ) );
  48. m_choicePinDisplacement->SetSelection( m_frame->GetRepeatPinStep() == Iu2Mils( 50 ) ? 1 : 0 );
  49. m_spinRepeatLabel->SetValue( m_frame->GetRepeatDeltaLabel() );
  50. m_checkShowPinElectricalType->SetValue( m_frame->GetShowElectricalType() );
  51. return true;
  52. }
  53. bool PANEL_LIBEDIT_SETTINGS::TransferDataFromWindow()
  54. {
  55. SetDefaultLineThickness(
  56. ValueFromString( EDA_UNITS::INCHES, m_lineWidthCtrl->GetValue(), true ) );
  57. m_frame->SetDefaultPinLength(
  58. ValueFromString( EDA_UNITS::INCHES, m_pinLengthCtrl->GetValue(), true ) );
  59. m_frame->SetPinNumDefaultSize(
  60. ValueFromString( EDA_UNITS::INCHES, m_pinNumSizeCtrl->GetValue(), true ) );
  61. m_frame->SetPinNameDefaultSize(
  62. ValueFromString( EDA_UNITS::INCHES, m_pinNameSizeCtrl->GetValue(), true ) );
  63. m_frame->SetRepeatStep(
  64. wxPoint( ValueFromString( EDA_UNITS::INCHES, m_hPitchCtrl->GetValue(), true ),
  65. ValueFromString( EDA_UNITS::INCHES, m_vPitchCtrl->GetValue(), true ) ) );
  66. m_frame->SetRepeatPinStep( m_choicePinDisplacement->GetSelection() == 1 ?
  67. Mils2iu( 50 ) : Mils2iu( 100 ) );
  68. m_frame->SetRepeatDeltaLabel( m_spinRepeatLabel->GetValue() );
  69. m_frame->SetShowElectricalType( m_checkShowPinElectricalType->GetValue() );
  70. m_frame->GetRenderSettings()->m_ShowPinsElectricalType = m_frame->GetShowElectricalType();
  71. m_frame->GetCanvas()->Refresh();
  72. return true;
  73. }