2014-06-20 11:13:04 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-02-02 08:06:39 +00:00
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
|
2020-06-17 20:45:03 +00:00
|
|
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2014-06-20 11:13:04 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +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 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
2014-06-20 11:13:04 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* 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.
|
2014-06-20 11:13:04 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
2014-06-20 11:13:04 +00:00
|
|
|
*/
|
|
|
|
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2017-10-30 17:21:07 +00:00
|
|
|
#include <pcb_display_options.h>
|
2020-06-28 02:48:48 +00:00
|
|
|
#include <pcbnew_settings.h>
|
2017-02-16 05:03:26 +00:00
|
|
|
#include <config_map.h>
|
2020-06-17 20:45:03 +00:00
|
|
|
#include <panel_display_options.h>
|
2017-10-30 19:17:23 +00:00
|
|
|
#include <pcb_view.h>
|
2013-07-17 11:38:56 +00:00
|
|
|
#include <pcb_painter.h>
|
2018-07-15 23:15:48 +00:00
|
|
|
#include <widgets/paged_dialog.h>
|
2017-03-13 09:42:12 +00:00
|
|
|
#include <widgets/gal_options_panel.h>
|
2011-09-24 18:33:28 +00:00
|
|
|
|
2011-09-30 08:24:10 +00:00
|
|
|
|
2017-10-30 17:21:07 +00:00
|
|
|
static const UTIL::CFG_MAP<PCB_DISPLAY_OPTIONS::TRACE_CLEARANCE_DISPLAY_MODE_T> traceClearanceSelectMap =
|
2017-02-14 05:16:47 +00:00
|
|
|
{
|
2017-10-30 17:21:07 +00:00
|
|
|
{ PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS, 2 }, // Default
|
|
|
|
{ PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE, 0 },
|
|
|
|
{ PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS, 1 },
|
|
|
|
{ PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS, 3 },
|
|
|
|
{ PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_ALWAYS, 4 },
|
2017-02-16 05:03:26 +00:00
|
|
|
};
|
2017-01-11 15:19:58 +00:00
|
|
|
|
2017-02-14 05:16:47 +00:00
|
|
|
|
2020-06-17 20:45:03 +00:00
|
|
|
PANEL_DISPLAY_OPTIONS::PANEL_DISPLAY_OPTIONS( PCB_BASE_FRAME* aFrame,
|
|
|
|
PAGED_DIALOG* aParent ) :
|
|
|
|
PANEL_DISPLAY_OPTIONS_BASE( aParent->GetTreebook() ),
|
2018-05-14 17:34:18 +00:00
|
|
|
m_frame( aFrame )
|
2017-02-14 05:16:47 +00:00
|
|
|
{
|
2018-05-14 17:34:18 +00:00
|
|
|
KIGFX::GAL_DISPLAY_OPTIONS& galOptions = m_frame->GetGalDisplayOptions();
|
2017-03-13 09:42:12 +00:00
|
|
|
m_galOptsPanel = new GAL_OPTIONS_PANEL( this, galOptions );
|
2017-02-14 15:31:21 +00:00
|
|
|
|
2018-05-14 17:34:18 +00:00
|
|
|
m_galOptionsSizer->Add( m_galOptsPanel, 1, wxEXPAND, 0 );
|
2020-06-17 20:45:03 +00:00
|
|
|
|
|
|
|
m_optionsBook->SetSelection( dynamic_cast<PCB_EDIT_FRAME*>( m_frame ) ? 1 : 0 );
|
2017-02-14 05:16:47 +00:00
|
|
|
}
|
|
|
|
|
2017-02-14 10:03:08 +00:00
|
|
|
|
2020-06-17 20:45:03 +00:00
|
|
|
bool PANEL_DISPLAY_OPTIONS::TransferDataToWindow()
|
2017-02-14 05:16:47 +00:00
|
|
|
{
|
2020-06-17 20:45:03 +00:00
|
|
|
PCB_EDIT_FRAME* pcbEdit = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
|
|
|
|
|
|
|
|
if( pcbEdit )
|
|
|
|
{
|
|
|
|
const PCB_DISPLAY_OPTIONS& displ_opts = pcbEdit->GetDisplayOptions();
|
2017-02-14 05:16:47 +00:00
|
|
|
|
2020-06-17 20:45:03 +00:00
|
|
|
m_OptDisplayTracksClearance->SetSelection( UTIL::GetConfigForVal(
|
|
|
|
traceClearanceSelectMap, displ_opts.m_ShowTrackClearanceMode ) );
|
2017-02-14 05:16:47 +00:00
|
|
|
|
2020-06-17 20:45:03 +00:00
|
|
|
m_OptDisplayPadClearence->SetValue( displ_opts.m_DisplayPadIsol );
|
|
|
|
m_OptDisplayPadNumber->SetValue( displ_opts.m_DisplayPadNum );
|
|
|
|
m_OptDisplayPadNoConn->SetValue( pcbEdit->IsElementVisible( LAYER_NO_CONNECTS ) );
|
|
|
|
m_ShowNetNamesOption->SetSelection( displ_opts.m_DisplayNetNamesMode );
|
2020-06-28 02:48:48 +00:00
|
|
|
|
|
|
|
CROSS_PROBING_SETTINGS& crossProbing = pcbEdit->GetPcbNewSettings()->m_CrossProbing;
|
|
|
|
|
|
|
|
m_checkCrossProbeCenter->SetValue( crossProbing.center_on_items );
|
|
|
|
m_checkCrossProbeZoom->SetValue( crossProbing.zoom_to_fit );
|
|
|
|
m_checkCrossProbeAutoHighlight->SetValue( crossProbing.auto_highlight );
|
2020-06-17 20:45:03 +00:00
|
|
|
}
|
2017-02-14 05:16:47 +00:00
|
|
|
|
2017-03-13 09:42:12 +00:00
|
|
|
m_galOptsPanel->TransferDataToWindow();
|
2011-09-24 18:33:28 +00:00
|
|
|
|
2017-03-13 16:13:04 +00:00
|
|
|
return true;
|
2009-06-18 17:32:27 +00:00
|
|
|
}
|
|
|
|
|
2011-09-24 18:33:28 +00:00
|
|
|
|
2017-02-16 05:03:26 +00:00
|
|
|
/*
|
|
|
|
* Update variables with new options
|
|
|
|
*/
|
2020-06-17 20:45:03 +00:00
|
|
|
bool PANEL_DISPLAY_OPTIONS::TransferDataFromWindow()
|
2009-06-18 17:32:27 +00:00
|
|
|
{
|
2017-03-13 09:42:12 +00:00
|
|
|
m_galOptsPanel->TransferDataFromWindow();
|
2016-12-23 15:21:00 +00:00
|
|
|
|
2013-07-17 11:38:56 +00:00
|
|
|
// Apply changes to the GAL
|
2019-06-13 17:28:55 +00:00
|
|
|
KIGFX::VIEW* view = m_frame->GetCanvas()->GetView();
|
2013-10-14 14:13:35 +00:00
|
|
|
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
|
2018-05-14 17:34:18 +00:00
|
|
|
KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
|
2019-06-13 00:32:47 +00:00
|
|
|
|
2020-06-17 20:45:03 +00:00
|
|
|
PCB_EDIT_FRAME* pcbEdit = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
|
|
|
|
|
|
|
|
if( pcbEdit )
|
|
|
|
{
|
|
|
|
PCB_DISPLAY_OPTIONS displ_opts = pcbEdit->GetDisplayOptions();
|
|
|
|
|
|
|
|
displ_opts.m_ShowTrackClearanceMode = UTIL::GetValFromConfig(
|
|
|
|
traceClearanceSelectMap, m_OptDisplayTracksClearance->GetSelection() );
|
|
|
|
|
|
|
|
displ_opts.m_DisplayPadIsol = m_OptDisplayPadClearence->GetValue();
|
|
|
|
displ_opts.m_DisplayPadNum = m_OptDisplayPadNumber->GetValue();
|
|
|
|
|
|
|
|
pcbEdit->SetElementVisibility( LAYER_NO_CONNECTS, m_OptDisplayPadNoConn->GetValue() );
|
|
|
|
|
|
|
|
displ_opts.m_DisplayNetNamesMode = m_ShowNetNamesOption->GetSelection();
|
|
|
|
|
|
|
|
pcbEdit->SetDisplayOptions( displ_opts );
|
|
|
|
settings->LoadDisplayOptions( displ_opts, pcbEdit->ShowPageLimits() );
|
|
|
|
pcbEdit->SetElementVisibility( LAYER_RATSNEST, displ_opts.m_ShowGlobalRatsnest );
|
2020-06-28 02:48:48 +00:00
|
|
|
|
|
|
|
CROSS_PROBING_SETTINGS& crossProbing = pcbEdit->GetPcbNewSettings()->m_CrossProbing;
|
|
|
|
|
|
|
|
crossProbing.center_on_items = m_checkCrossProbeCenter->GetValue();
|
|
|
|
crossProbing.zoom_to_fit = m_checkCrossProbeZoom->GetValue();
|
|
|
|
crossProbing.auto_highlight = m_checkCrossProbeAutoHighlight->GetValue();
|
2020-06-17 20:45:03 +00:00
|
|
|
}
|
2019-06-13 00:32:47 +00:00
|
|
|
|
2016-05-09 15:23:01 +00:00
|
|
|
view->RecacheAllItems();
|
2017-02-13 11:53:58 +00:00
|
|
|
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
|
2013-07-17 11:38:56 +00:00
|
|
|
|
2017-03-13 16:13:04 +00:00
|
|
|
return true;
|
2009-06-18 17:32:27 +00:00
|
|
|
}
|
2018-01-08 04:05:03 +00:00
|
|
|
|
|
|
|
|