2012-09-12 17:28:55 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-01-28 08:51:28 +00:00
|
|
|
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2012-09-12 17:28:55 +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
|
|
|
|
*/
|
|
|
|
|
2018-01-28 08:51:28 +00:00
|
|
|
#include <display_footprints_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialog_display_options.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2010-02-01 21:23:27 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2018-08-06 18:26:37 +00:00
|
|
|
DIALOG_FOOTPRINTS_DISPLAY_OPTIONS OptionWindow( this );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-08-06 18:26:37 +00:00
|
|
|
OptionWindow.ShowModal();
|
2009-11-05 19:26:52 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2018-08-06 18:26:37 +00:00
|
|
|
DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( DISPLAY_FOOTPRINTS_FRAME* parent )
|
2011-03-01 19:26:17 +00:00
|
|
|
: DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( parent )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-05 19:26:52 +00:00
|
|
|
m_Parent = parent;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
initDialog();
|
2018-08-06 18:26:37 +00:00
|
|
|
m_sdbSizerOK->SetDefault();
|
|
|
|
|
|
|
|
FinishDialogSettings();;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2018-09-11 15:28:57 +00:00
|
|
|
|
2010-04-16 16:28:35 +00:00
|
|
|
DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
|
2010-04-16 16:28:35 +00:00
|
|
|
void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-04-16 16:28:35 +00:00
|
|
|
/* mandatory to use escape key as cancel under wxGTK. */
|
|
|
|
SetFocus();
|
2009-11-05 19:26:52 +00:00
|
|
|
|
2019-11-07 14:23:09 +00:00
|
|
|
auto& displ_opts = m_Parent->GetDisplayOptions();
|
2015-01-10 10:27:49 +00:00
|
|
|
|
2019-11-07 14:23:09 +00:00
|
|
|
m_EdgesDisplayOption->SetValue( not displ_opts.m_DisplayModEdgeFill );
|
|
|
|
m_TextDisplayOption->SetValue( not displ_opts.m_DisplayModTextFill );
|
|
|
|
m_ShowPadSketch->SetValue( not displ_opts.m_DisplayPadFill );
|
|
|
|
m_ShowPadNum->SetValue( displ_opts.m_DisplayPadNum );
|
2017-12-30 21:14:41 +00:00
|
|
|
|
2018-09-11 15:28:57 +00:00
|
|
|
m_autoZoomOption->SetValue( m_Parent->GetAutoZoom() );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
|
2010-04-16 16:28:35 +00:00
|
|
|
void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2019-11-07 14:23:09 +00:00
|
|
|
PCB_DISPLAY_OPTIONS displ_opts = m_Parent->GetDisplayOptions();
|
2015-01-10 10:27:49 +00:00
|
|
|
|
2019-11-07 14:23:09 +00:00
|
|
|
displ_opts.m_DisplayModEdgeFill = not m_EdgesDisplayOption->GetValue();
|
|
|
|
displ_opts.m_DisplayModTextFill = not m_TextDisplayOption->GetValue();
|
|
|
|
displ_opts.m_DisplayPadNum = m_ShowPadNum->GetValue();
|
|
|
|
displ_opts.m_DisplayPadFill = not m_ShowPadSketch->GetValue();
|
2018-09-11 15:28:57 +00:00
|
|
|
m_Parent->ApplyDisplaySettingsToGAL();
|
2019-11-07 14:23:09 +00:00
|
|
|
m_Parent->SetDisplayOptions( displ_opts );
|
2017-12-30 21:14:41 +00:00
|
|
|
|
2018-09-11 15:28:57 +00:00
|
|
|
m_Parent->SetAutoZoom( m_autoZoomOption->GetValue() );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
|
2018-08-06 18:26:37 +00:00
|
|
|
bool DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::TransferDataFromWindow()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-05 19:26:52 +00:00
|
|
|
UpdateObjectSettings();
|
2018-08-06 18:26:37 +00:00
|
|
|
return true;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
|
2010-04-16 16:28:35 +00:00
|
|
|
void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::OnApplyClick( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-05 19:26:52 +00:00
|
|
|
UpdateObjectSettings();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|