2012-09-12 17:28:55 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2016-06-11 23:37:43 +00:00
|
|
|
* Copyright (C) 1992-2016 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
|
|
|
|
*/
|
|
|
|
|
2016-06-11 23:37:43 +00:00
|
|
|
/**
|
|
|
|
* @file cvpcb/dialogs/dialog_display_options.cpp
|
|
|
|
*/
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <wxstruct.h>
|
|
|
|
#include <common.h>
|
|
|
|
#include <cvpcb.h>
|
|
|
|
#include <class_drawpanel.h>
|
2016-02-25 09:52:29 +00:00
|
|
|
#include <listview_classes.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_DisplayFootprintsFrame.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
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
|
|
|
{
|
2010-04-16 16:28:35 +00:00
|
|
|
DIALOG_FOOTPRINTS_DISPLAY_OPTIONS* OptionWindow =
|
|
|
|
new DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( this );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
OptionWindow->ShowModal();
|
|
|
|
OptionWindow->Destroy();
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( PCB_BASE_FRAME* parent )
|
|
|
|
: 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();
|
2011-03-25 19:16:05 +00:00
|
|
|
m_sdbSizer1OK->SetDefault();
|
2010-04-16 16:28:35 +00:00
|
|
|
GetSizer()->SetSizeHints( this );
|
2007-06-05 12:10:51 +00:00
|
|
|
Centre();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*!
|
2010-04-16 16:28:35 +00:00
|
|
|
* Control creation for DIALOG_FOOTPRINTS_DISPLAY_OPTIONS
|
2007-06-05 12:10:51 +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
|
|
|
|
2017-10-30 17:21:07 +00:00
|
|
|
auto displ_opts = (PCB_DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();
|
2015-01-10 10:27:49 +00:00
|
|
|
|
2015-02-02 08:06:39 +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 );
|
2013-02-02 19:10:48 +00:00
|
|
|
m_IsZoomNoCenter->SetValue( m_Parent->GetCanvas()->GetEnableZoomNoCenter() );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*!
|
2007-10-07 03:08:24 +00:00
|
|
|
* Update settings related to edges, text strings, and pads
|
2007-06-05 12:10:51 +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
|
|
|
{
|
2017-10-30 17:21:07 +00:00
|
|
|
auto displ_opts = (PCB_DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();
|
2015-01-10 10:27:49 +00:00
|
|
|
|
2015-02-02 08:06:39 +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();
|
2013-02-02 19:10:48 +00:00
|
|
|
m_Parent->GetCanvas()->SetEnableZoomNoCenter( m_IsZoomNoCenter->GetValue() );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_Parent->GetCanvas()->Refresh();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*!
|
2007-10-07 03:08:24 +00:00
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
|
2007-06-05 12:10:51 +00:00
|
|
|
*/
|
|
|
|
|
2010-04-16 16:28:35 +00:00
|
|
|
void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::OnOkClick( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-05 19:26:52 +00:00
|
|
|
UpdateObjectSettings();
|
2007-10-07 03:08:24 +00:00
|
|
|
EndModal( 1 );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*!
|
2007-10-07 03:08:24 +00:00
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
|
2007-06-05 12:10:51 +00:00
|
|
|
*/
|
|
|
|
|
2010-04-16 16:28:35 +00:00
|
|
|
void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::OnCancelClick( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-10-07 03:08:24 +00:00
|
|
|
EndModal( -1 );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*!
|
2007-10-07 03:08:24 +00:00
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_APPLY
|
2007-06-05 12:10:51 +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
|
|
|
}
|