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
|
2018-01-08 04:05:03 +00:00
|
|
|
* Copyright (C) 1992-2018 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
|
|
|
*/
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <pcbnew.h>
|
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>
|
2017-02-16 05:03:26 +00:00
|
|
|
#include <config_map.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbnew_id.h>
|
2018-05-14 17:34:18 +00:00
|
|
|
#include <panel_pcbnew_display_options.h>
|
2014-04-04 09:56:04 +00:00
|
|
|
#include <class_draw_panel_gal.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>
|
2013-07-17 11:38:56 +00:00
|
|
|
|
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
|
|
|
|
2018-05-14 17:34:18 +00:00
|
|
|
PANEL_PCBNEW_DISPLAY_OPTIONS::PANEL_PCBNEW_DISPLAY_OPTIONS( PCB_EDIT_FRAME* aFrame,
|
2018-07-15 23:15:48 +00:00
|
|
|
PAGED_DIALOG* aParent ) :
|
|
|
|
PANEL_PCBNEW_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 );
|
2017-02-14 05:16:47 +00:00
|
|
|
}
|
|
|
|
|
2017-02-14 10:03:08 +00:00
|
|
|
|
2018-05-14 17:34:18 +00:00
|
|
|
bool PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataToWindow()
|
2017-02-14 05:16:47 +00:00
|
|
|
{
|
2018-05-14 17:34:18 +00:00
|
|
|
const PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*) m_frame->GetDisplayOptions();
|
2017-02-14 05:16:47 +00:00
|
|
|
|
2017-02-16 05:03:26 +00:00
|
|
|
m_OptDisplayTracksClearance->SetSelection( UTIL::GetConfigForVal(
|
|
|
|
traceClearanceSelectMap, displ_opts->m_ShowTrackClearanceMode ) );
|
2017-02-14 05:16:47 +00:00
|
|
|
|
|
|
|
m_OptDisplayPadClearence->SetValue( displ_opts->m_DisplayPadIsol );
|
|
|
|
m_OptDisplayPadNumber->SetValue( displ_opts->m_DisplayPadNum );
|
2018-05-14 17:34:18 +00:00
|
|
|
m_OptDisplayPadNoConn->SetValue( m_frame->IsElementVisible( LAYER_NO_CONNECTS ) );
|
2017-02-14 05:16:47 +00:00
|
|
|
m_ShowNetNamesOption->SetSelection( displ_opts->m_DisplayNetNamesMode );
|
|
|
|
|
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
|
|
|
|
*/
|
2018-05-14 17:34:18 +00:00
|
|
|
bool PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataFromWindow()
|
2009-06-18 17:32:27 +00:00
|
|
|
{
|
2018-05-14 17:34:18 +00:00
|
|
|
PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*) m_frame->GetDisplayOptions();
|
2015-01-10 10:27:49 +00:00
|
|
|
|
2017-02-16 05:03:26 +00:00
|
|
|
displ_opts->m_ShowTrackClearanceMode = UTIL::GetValFromConfig(
|
|
|
|
traceClearanceSelectMap, m_OptDisplayTracksClearance->GetSelection() );
|
2009-06-18 17:32:27 +00:00
|
|
|
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_DisplayPadIsol = m_OptDisplayPadClearence->GetValue();
|
|
|
|
displ_opts->m_DisplayPadNum = m_OptDisplayPadNumber->GetValue();
|
2009-06-18 17:32:27 +00:00
|
|
|
|
2018-05-14 17:34:18 +00:00
|
|
|
m_frame->SetElementVisibility( LAYER_NO_CONNECTS, m_OptDisplayPadNoConn->GetValue() );
|
2009-06-18 17:32:27 +00:00
|
|
|
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_DisplayNetNamesMode = m_ShowNetNamesOption->GetSelection();
|
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
|
2018-05-14 17:34:18 +00:00
|
|
|
KIGFX::VIEW* view = m_frame->GetGalCanvas()->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();
|
2018-07-01 08:24:57 +00:00
|
|
|
settings->LoadDisplayOptions( displ_opts, m_frame->ShowPageLimits() );
|
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
|
|
|
|
2018-05-14 17:34:18 +00:00
|
|
|
m_frame->GetCanvas()->Refresh();
|
2009-06-18 17:32:27 +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
|
|
|
|
|
|
|
|