2018-05-14 17:34:18 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* 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-01-13 01:44:19 +00:00
|
|
|
#include <board_design_settings.h>
|
2018-05-14 17:34:18 +00:00
|
|
|
#include <fctsys.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <footprint_edit_frame.h>
|
2018-05-14 17:34:18 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <pcbnew_settings.h>
|
2018-07-15 23:15:48 +00:00
|
|
|
#include <widgets/paged_dialog.h>
|
2018-05-14 17:34:18 +00:00
|
|
|
|
|
|
|
#include <panel_modedit_settings.h>
|
|
|
|
|
|
|
|
|
|
|
|
PANEL_MODEDIT_SETTINGS::PANEL_MODEDIT_SETTINGS( FOOTPRINT_EDIT_FRAME* aFrame,
|
2018-07-15 23:15:48 +00:00
|
|
|
PAGED_DIALOG* aParent) :
|
|
|
|
PANEL_MODEDIT_SETTINGS_BASE( aParent->GetTreebook() ),
|
2018-05-14 17:34:18 +00:00
|
|
|
m_frame( aFrame )
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
bool PANEL_MODEDIT_SETTINGS::TransferDataToWindow()
|
|
|
|
{
|
|
|
|
// Display options
|
2019-05-17 11:52:38 +00:00
|
|
|
m_PolarDisplay->SetSelection( m_frame->GetShowPolarCoords() ? 1 : 0 );
|
2019-12-20 14:11:39 +00:00
|
|
|
m_UnitsSelection->SetSelection( m_frame->GetUserUnits() == EDA_UNITS::INCHES ? 0 : 1 );
|
2018-05-14 17:34:18 +00:00
|
|
|
|
|
|
|
// Editing options
|
2019-06-26 12:12:32 +00:00
|
|
|
m_Segments_45_Only_Ctrl->SetValue( m_frame->Settings().m_Use45DegreeGraphicSegments );
|
2020-01-13 01:44:19 +00:00
|
|
|
m_MagneticPads->SetValue(
|
|
|
|
m_frame->Settings().m_MagneticPads == MAGNETIC_OPTIONS::CAPTURE_ALWAYS );
|
2018-05-14 17:34:18 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool PANEL_MODEDIT_SETTINGS::TransferDataFromWindow()
|
|
|
|
{
|
|
|
|
// Display options
|
2019-05-17 11:52:38 +00:00
|
|
|
m_frame->SetShowPolarCoords( m_PolarDisplay->GetSelection() != 0 );
|
2019-12-20 14:11:39 +00:00
|
|
|
m_frame->SetUserUnits(
|
|
|
|
m_UnitsSelection->GetSelection() == 0 ? EDA_UNITS::INCHES : EDA_UNITS::MILLIMETRES );
|
2018-05-14 17:34:18 +00:00
|
|
|
|
|
|
|
// Editing options
|
2019-06-26 12:12:32 +00:00
|
|
|
m_frame->Settings().m_Use45DegreeGraphicSegments = m_Segments_45_Only_Ctrl->GetValue();
|
2020-01-13 01:44:19 +00:00
|
|
|
m_frame->Settings().m_MagneticPads = m_MagneticPads->GetValue() ?
|
|
|
|
MAGNETIC_OPTIONS::CAPTURE_ALWAYS : MAGNETIC_OPTIONS::NO_EFFECT;
|
2018-05-14 17:34:18 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|