2018-05-14 17:34:18 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
|
2019-12-30 20:43:10 +00:00
|
|
|
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
2018-05-14 17:34:18 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2020-10-31 01:27:16 +00:00
|
|
|
#include <symbol_edit_frame.h>
|
2018-08-29 18:31:43 +00:00
|
|
|
#include <sch_painter.h>
|
2020-04-12 23:09:17 +00:00
|
|
|
#include <settings/settings_manager.h>
|
2020-10-31 01:27:16 +00:00
|
|
|
#include <symbol_editor/symbol_editor_settings.h>
|
2018-05-14 17:34:18 +00:00
|
|
|
|
2020-10-25 19:24:00 +00:00
|
|
|
#include "panel_sym_editing_options.h"
|
2018-05-14 17:34:18 +00:00
|
|
|
|
|
|
|
|
2020-10-31 01:27:16 +00:00
|
|
|
PANEL_SYM_EDITING_OPTIONS::PANEL_SYM_EDITING_OPTIONS( SYMBOL_EDIT_FRAME* aFrame,
|
|
|
|
wxWindow* aWindow ) :
|
2020-10-25 19:24:00 +00:00
|
|
|
PANEL_SYM_EDITING_OPTIONS_BASE( aWindow ),
|
2020-04-04 20:32:14 +00:00
|
|
|
m_frame( aFrame ),
|
2021-03-12 15:12:49 +00:00
|
|
|
m_lineWidth( aFrame, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits ),
|
|
|
|
m_textSize( aFrame, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
|
|
|
|
m_pinLength( aFrame, m_pinLengthLabel, m_pinLengthCtrl, m_pinLengthUnits ),
|
|
|
|
m_pinNameSize( aFrame, m_pinNameSizeLabel, m_pinNameSizeCtrl, m_pinNameSizeUnits ),
|
|
|
|
m_pinNumberSize( aFrame, m_pinNumSizeLabel, m_pinNumSizeCtrl, m_pinNumSizeUnits ),
|
|
|
|
m_hPitch( aFrame, m_hPitchLabel, m_hPitchCtrl, m_hPitchUnits ),
|
|
|
|
m_vPitch( aFrame, m_vPitchLabel, m_vPitchCtrl, m_vPitchUnits )
|
2018-05-14 17:34:18 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
2020-10-25 19:24:00 +00:00
|
|
|
bool PANEL_SYM_EDITING_OPTIONS::TransferDataToWindow()
|
2018-05-14 17:34:18 +00:00
|
|
|
{
|
2021-06-06 22:36:31 +00:00
|
|
|
SYMBOL_EDITOR_SETTINGS* settings = m_frame->GetSettings();
|
2020-04-12 23:09:17 +00:00
|
|
|
|
2020-05-23 15:50:08 +00:00
|
|
|
m_lineWidth.SetValue( Mils2iu( settings->m_Defaults.line_width ) );
|
|
|
|
m_textSize.SetValue( Mils2iu( settings->m_Defaults.text_size ) );
|
2020-04-12 23:09:17 +00:00
|
|
|
m_pinLength.SetValue( Mils2iu( settings->m_Defaults.pin_length ) );
|
|
|
|
m_pinNumberSize.SetValue( Mils2iu( settings->m_Defaults.pin_num_size ) );
|
|
|
|
m_pinNameSize.SetValue( Mils2iu( settings->m_Defaults.pin_name_size ) );
|
|
|
|
m_hPitch.SetValue( Mils2iu( settings->m_Repeat.x_step ) );
|
|
|
|
m_vPitch.SetValue( Mils2iu( settings->m_Repeat.y_step ) );
|
|
|
|
m_choicePinDisplacement->SetSelection( settings->m_Repeat.pin_step == 50 ? 1 : 0 );
|
|
|
|
m_spinRepeatLabel->SetValue( settings->m_Repeat.label_delta );
|
2018-05-14 17:34:18 +00:00
|
|
|
|
2020-05-22 23:11:04 +00:00
|
|
|
m_cbShowPinElectricalType->SetValue( m_frame->GetRenderSettings()->m_ShowPinsElectricalType );
|
2018-05-14 17:34:18 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-25 19:24:00 +00:00
|
|
|
bool PANEL_SYM_EDITING_OPTIONS::TransferDataFromWindow()
|
2018-05-14 17:34:18 +00:00
|
|
|
{
|
2021-06-06 22:36:31 +00:00
|
|
|
SYMBOL_EDITOR_SETTINGS* settings = m_frame->GetSettings();
|
2020-04-12 23:09:17 +00:00
|
|
|
|
2020-05-23 15:50:08 +00:00
|
|
|
settings->m_Defaults.line_width = Iu2Mils( (int) m_lineWidth.GetValue() );
|
|
|
|
settings->m_Defaults.text_size = Iu2Mils( (int) m_textSize.GetValue() );
|
2020-04-12 23:09:17 +00:00
|
|
|
settings->m_Defaults.pin_length = Iu2Mils( (int) m_pinLength.GetValue() );
|
|
|
|
settings->m_Defaults.pin_num_size = Iu2Mils( (int) m_pinNumberSize.GetValue() );
|
|
|
|
settings->m_Defaults.pin_name_size = Iu2Mils( (int) m_pinNameSize.GetValue() );
|
|
|
|
settings->m_Repeat.x_step = Iu2Mils( (int) m_hPitch.GetValue() );
|
|
|
|
settings->m_Repeat.y_step = Iu2Mils( (int) m_vPitch.GetValue() );
|
|
|
|
settings->m_Repeat.label_delta = m_spinRepeatLabel->GetValue();
|
|
|
|
settings->m_Repeat.pin_step = m_choicePinDisplacement->GetSelection() == 1 ? 50 : 100;
|
2018-05-14 17:34:18 +00:00
|
|
|
|
2020-05-22 23:11:04 +00:00
|
|
|
m_frame->GetRenderSettings()->m_ShowPinsElectricalType = m_cbShowPinElectricalType->GetValue();
|
2018-09-02 20:19:22 +00:00
|
|
|
m_frame->GetCanvas()->Refresh();
|
2018-08-29 18:31:43 +00:00
|
|
|
|
2018-05-14 17:34:18 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|