2011-12-16 13:32:23 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-01-10 10:27:49 +00:00
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2012-06-08 09:56:42 +00:00
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2015-01-30 18:42:46 +00:00
|
|
|
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
|
2018-05-03 14:03:26 +00:00
|
|
|
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2012-06-08 09:56:42 +00:00
|
|
|
*
|
2011-12-16 13:32:23 +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
|
|
|
|
*/
|
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
/**
|
2018-01-31 16:09:26 +00:00
|
|
|
* @file footprint_editor_options.cpp
|
|
|
|
* @brief footprint editor options (events from left vertical option toolbar).
|
2011-09-30 18:15:37 +00:00
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <class_drawpanel.h>
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbnew.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <footprint_edit_frame.h>
|
2018-02-02 20:57:12 +00:00
|
|
|
#include <board_design_settings.h>
|
2015-01-30 18:42:46 +00:00
|
|
|
#include <layers_id_colors_and_visibility.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbnew_id.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-11-18 12:52:19 +00:00
|
|
|
int id = event.GetId();
|
2017-10-30 17:21:07 +00:00
|
|
|
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
|
2015-01-10 10:27:49 +00:00
|
|
|
bool state = m_optionsToolBar->GetToolToggled( id );
|
2009-11-18 12:52:19 +00:00
|
|
|
|
|
|
|
switch( id )
|
|
|
|
{
|
|
|
|
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_DisplayPadFill = !state;
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh( );
|
2009-11-18 12:52:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_DisplayViaFill = !state;
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh( );
|
2009-11-18 12:52:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
|
2015-02-02 08:06:39 +00:00
|
|
|
displ_opts->m_DisplayModTextFill = state ? SKETCH : FILLED;
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh( );
|
2009-11-18 12:52:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
|
2015-02-02 08:06:39 +00:00
|
|
|
displ_opts->m_DisplayModEdgeFill = state ? SKETCH : FILLED;
|
2015-01-10 10:27:49 +00:00
|
|
|
m_canvas->Refresh( );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
|
|
|
|
displ_opts->m_ContrastModeDisplay = state;
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh( );
|
2009-11-18 12:52:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2015-01-10 10:27:49 +00:00
|
|
|
wxMessageBox( wxT( "FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar error" ) );
|
2009-11-18 12:52:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2015-01-30 18:42:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings()
|
|
|
|
{
|
2017-10-30 17:21:07 +00:00
|
|
|
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
|
2015-01-30 18:42:46 +00:00
|
|
|
BOARD_DESIGN_SETTINGS& settings = GetDesignSettings();
|
|
|
|
|
2015-08-15 14:00:34 +00:00
|
|
|
// Update everything
|
2017-09-10 14:21:56 +00:00
|
|
|
m_configParams.clear(); // boost::ptr_vector destroys the pointers inside
|
2015-08-15 14:00:34 +00:00
|
|
|
|
|
|
|
// Display options:
|
2017-09-10 14:21:56 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorDisplayPolarCoords" ),
|
2015-08-15 14:00:34 +00:00
|
|
|
&displ_opts->m_DisplayPolarCood, false ) );
|
2017-09-10 14:21:56 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ),
|
2015-08-15 14:00:34 +00:00
|
|
|
&displ_opts->m_DisplayPadFill, true ) );
|
2017-09-10 14:21:56 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorGraphicLinesDisplayMode" ),
|
2015-08-15 14:00:34 +00:00
|
|
|
&displ_opts->m_DisplayModEdgeFill, FILLED ) );
|
2017-09-10 14:21:56 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
|
2015-08-15 14:00:34 +00:00
|
|
|
&displ_opts->m_DisplayModTextFill, FILLED ) );
|
2017-09-10 14:21:56 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
|
2015-08-15 14:00:34 +00:00
|
|
|
&displ_opts->m_DisplayModTextFill, FILLED ) );
|
2017-09-10 14:21:56 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorTextsRefDefaultText" ),
|
2015-08-15 14:00:34 +00:00
|
|
|
&settings.m_RefDefaultText, wxT( "REF**" ) ) );
|
|
|
|
|
|
|
|
// design settings
|
2017-09-10 14:21:56 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorGrlineWidth" ),
|
2015-08-15 14:00:34 +00:00
|
|
|
&settings.m_ModuleSegmentWidth,
|
|
|
|
Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ),
|
|
|
|
Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ),
|
|
|
|
NULL, 1/IU_PER_MM ) );
|
2017-09-10 14:21:56 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeH" ),
|
2015-08-15 14:00:34 +00:00
|
|
|
&settings.m_ModuleTextSize.x,
|
|
|
|
Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ),
|
|
|
|
Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ),
|
|
|
|
NULL, 1/IU_PER_MM ) );
|
2017-09-10 14:21:56 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeV" ),
|
2015-08-15 14:00:34 +00:00
|
|
|
&settings.m_ModuleTextSize.y,
|
|
|
|
Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ),
|
|
|
|
Millimeter2iu(0.01), Millimeter2iu( 100.0 ),
|
|
|
|
NULL, 1/IU_PER_MM ) );
|
2017-09-10 14:21:56 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultThickness" ),
|
2015-08-15 14:00:34 +00:00
|
|
|
&settings.m_ModuleTextWidth,
|
|
|
|
Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ),
|
|
|
|
Millimeter2iu( 0.01 ), Millimeter2iu( 20.0 ),
|
|
|
|
NULL, 1/IU_PER_MM ) );
|
|
|
|
|
2017-09-10 14:21:56 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_WXSTRING( true,
|
2015-08-15 14:00:34 +00:00
|
|
|
wxT( "FpEditorRefDefaultText" ),
|
|
|
|
&settings.m_RefDefaultText, wxT( "REF**" ) ) );
|
2017-09-10 14:21:56 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_BOOL( true,
|
2015-08-15 14:00:34 +00:00
|
|
|
wxT( "FpEditorRefDefaultVisibility" ),
|
|
|
|
&settings.m_RefDefaultVisibility, true ) );
|
2017-09-10 14:21:56 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorRefDefaultLayer" ),
|
2015-08-15 14:00:34 +00:00
|
|
|
&settings.m_RefDefaultlayer,
|
|
|
|
int( F_SilkS ), int( F_SilkS ), int( F_Fab ) ) );
|
|
|
|
|
2017-09-10 14:21:56 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorValueDefaultText" ),
|
2015-08-15 14:00:34 +00:00
|
|
|
&settings.m_ValueDefaultText, wxT( "" ) ) );
|
2017-09-10 14:21:56 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_BOOL( true,
|
2015-08-15 14:00:34 +00:00
|
|
|
wxT( "FpEditorValueDefaultVisibility" ),
|
|
|
|
&settings.m_ValueDefaultVisibility, true ) );
|
2017-09-10 14:21:56 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorValueDefaultLayer" ),
|
2015-08-15 14:00:34 +00:00
|
|
|
&settings.m_ValueDefaultlayer,
|
|
|
|
int( F_Fab ), int( F_SilkS ), int( F_Fab ) ) );
|
2015-01-30 18:42:46 +00:00
|
|
|
|
2017-09-10 14:21:56 +00:00
|
|
|
return m_configParams;
|
2015-01-30 18:42:46 +00:00
|
|
|
}
|