2014-10-27 10:14:39 -04:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2016-10-14 21:07:04 +02:00
|
|
|
* Copyright (C) 2009-2016 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
|
2025-01-01 13:30:11 -08:00
|
|
|
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
2014-10-27 10:14:39 -04: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
|
|
|
|
*/
|
2009-10-30 17:58:15 +00:00
|
|
|
|
2024-07-26 20:49:29 +00:00
|
|
|
#include <algorithm>
|
|
|
|
|
2018-01-29 21:58:58 +01:00
|
|
|
#include <pcb_edit_frame.h>
|
2023-05-06 23:16:58 +01:00
|
|
|
#include <widgets/unit_binder.h>
|
2020-11-12 20:19:22 +00:00
|
|
|
#include <board.h>
|
2021-06-06 15:03:10 -04:00
|
|
|
#include <board_design_settings.h>
|
2021-06-11 22:07:02 +01:00
|
|
|
#include <pcb_track.h>
|
2021-09-04 18:05:57 +01:00
|
|
|
#include <pcb_group.h>
|
2018-10-11 23:17:15 -07:00
|
|
|
#include <connectivity/connectivity_data.h>
|
2018-04-28 16:22:25 +01:00
|
|
|
#include <pcb_layer_box_selector.h>
|
2019-05-29 00:23:58 +01:00
|
|
|
#include <tool/tool_manager.h>
|
2020-12-16 13:31:32 +00:00
|
|
|
#include <tools/pcb_selection_tool.h>
|
2019-06-03 21:06:58 +01:00
|
|
|
#include <tools/global_edit_tool.h>
|
2025-01-02 14:50:22 +00:00
|
|
|
#include "dialog_global_edit_tracks_and_vias.h"
|
2009-10-30 17:58:15 +00:00
|
|
|
|
2021-07-19 19:56:05 -04:00
|
|
|
|
2018-04-28 16:22:25 +01:00
|
|
|
// Columns of netclasses grid
|
|
|
|
enum {
|
|
|
|
GRID_NAME = 0,
|
|
|
|
GRID_TRACKSIZE,
|
|
|
|
GRID_VIASIZE,
|
|
|
|
GRID_VIADRILL,
|
|
|
|
GRID_uVIASIZE,
|
|
|
|
GRID_uVIADRILL,
|
|
|
|
GRID_DIFF_PAIR_WIDTH, // not currently included in grid
|
|
|
|
GRID_DIFF_PAIR_GAP, // not currently included in grid
|
|
|
|
GRID_DIFF_PAIR_VIA_GAP // not currently included in grid
|
|
|
|
};
|
2009-10-30 17:58:15 +00:00
|
|
|
|
|
|
|
|
2018-10-10 18:42:27 +01:00
|
|
|
// Globals to remember control settings during a session
|
|
|
|
static wxString g_netclassFilter;
|
|
|
|
static wxString g_netFilter;
|
|
|
|
|
|
|
|
|
2018-04-28 16:22:25 +01:00
|
|
|
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS( PCB_EDIT_FRAME* aParent ) :
|
2023-05-06 23:16:58 +01:00
|
|
|
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE( aParent ),
|
|
|
|
m_trackWidthFilter( aParent, nullptr, m_trackWidthFilterCtrl, m_trackWidthFilterUnits ),
|
|
|
|
m_viaSizeFilter( aParent, nullptr, m_viaSizeFilterCtrl, m_viaSizeFilterUnits )
|
2018-04-28 16:22:25 +01:00
|
|
|
{
|
2021-12-23 13:11:26 +00:00
|
|
|
m_parent = aParent;
|
2018-04-28 16:22:25 +01:00
|
|
|
m_brd = m_parent->GetBoard();
|
2009-11-02 20:36:20 +00:00
|
|
|
|
2018-04-28 16:22:25 +01:00
|
|
|
buildFilterLists();
|
2009-10-30 17:58:15 +00:00
|
|
|
|
2024-03-12 22:14:15 +00:00
|
|
|
m_parent->UpdateTrackWidthSelectBox( m_trackWidthCtrl, false, false );
|
2023-07-17 18:30:07 +01:00
|
|
|
m_trackWidthCtrl->Append( INDETERMINATE_ACTION );
|
2024-03-12 22:14:15 +00:00
|
|
|
m_parent->UpdateViaSizeSelectBox( m_viaSizesCtrl, false, false );
|
2023-07-17 18:30:07 +01:00
|
|
|
m_viaSizesCtrl->Append( INDETERMINATE_ACTION );
|
2024-08-11 09:22:08 -06:00
|
|
|
m_annularRingsCtrl->Append( INDETERMINATE_ACTION );
|
2016-10-14 21:07:04 +02:00
|
|
|
|
2023-07-17 18:30:07 +01:00
|
|
|
m_layerCtrl->SetBoardFrame( m_parent );
|
|
|
|
m_layerCtrl->SetLayersHotkeys( false );
|
|
|
|
m_layerCtrl->SetNotAllowedLayerSet( LSET::AllNonCuMask() );
|
|
|
|
m_layerCtrl->SetUndefinedLayerName( INDETERMINATE_ACTION );
|
|
|
|
m_layerCtrl->Resync();
|
2016-10-14 21:07:04 +02:00
|
|
|
|
2024-11-17 08:26:18 +01:00
|
|
|
SetupStandardButtons( { { wxID_OK, _( "Apply and Close" ) },
|
|
|
|
{ wxID_CANCEL, _( "Close" ) } } );
|
2009-10-30 17:58:15 +00:00
|
|
|
|
2024-10-27 02:53:25 +08:00
|
|
|
m_netFilter->Connect( FILTERED_ITEM_SELECTED,
|
2021-07-19 19:56:05 -04:00
|
|
|
wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnNetFilterSelect ),
|
|
|
|
nullptr, this );
|
2018-08-19 17:11:58 +01:00
|
|
|
|
2025-08-07 14:16:14 +01:00
|
|
|
m_parent->Bind( EDA_EVT_UNITS_CHANGED, &DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::onUnitsChanged, this );
|
2021-12-23 13:11:26 +00:00
|
|
|
|
2020-11-16 11:16:44 +00:00
|
|
|
finishDialogSettings();
|
2018-04-28 16:22:25 +01:00
|
|
|
}
|
2009-10-30 17:58:15 +00:00
|
|
|
|
2012-01-22 22:33:36 -06:00
|
|
|
|
2018-04-28 16:22:25 +01:00
|
|
|
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS()
|
|
|
|
{
|
2018-10-10 18:42:27 +01:00
|
|
|
g_netclassFilter = m_netclassFilter->GetStringSelection();
|
|
|
|
g_netFilter = m_netFilter->GetSelectedNetname();
|
|
|
|
|
2024-10-27 02:53:25 +08:00
|
|
|
m_netFilter->Disconnect( FILTERED_ITEM_SELECTED,
|
2021-07-19 19:56:05 -04:00
|
|
|
wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnNetFilterSelect ),
|
|
|
|
nullptr, this );
|
2018-08-19 17:11:58 +01:00
|
|
|
|
2025-08-07 14:16:14 +01:00
|
|
|
m_parent->Unbind( EDA_EVT_UNITS_CHANGED, &DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::onUnitsChanged, this );
|
2016-10-14 21:07:04 +02:00
|
|
|
}
|
2009-10-30 17:58:15 +00:00
|
|
|
|
2016-10-14 21:07:04 +02:00
|
|
|
|
2021-12-23 13:11:26 +00:00
|
|
|
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::onUnitsChanged( wxCommandEvent& aEvent )
|
|
|
|
{
|
2023-07-17 18:30:07 +01:00
|
|
|
int trackSel = m_trackWidthCtrl->GetSelection();
|
|
|
|
int viaSel = m_viaSizesCtrl->GetSelection();
|
2021-12-23 13:11:26 +00:00
|
|
|
|
2024-03-12 22:14:15 +00:00
|
|
|
m_parent->UpdateTrackWidthSelectBox( m_trackWidthCtrl, false, false );
|
2023-07-17 18:30:07 +01:00
|
|
|
m_trackWidthCtrl->Append( INDETERMINATE_ACTION );
|
2024-03-12 22:14:15 +00:00
|
|
|
m_parent->UpdateViaSizeSelectBox( m_viaSizesCtrl, false, false );
|
2023-07-17 18:30:07 +01:00
|
|
|
m_viaSizesCtrl->Append( INDETERMINATE_ACTION );
|
2021-12-23 13:11:26 +00:00
|
|
|
|
2023-07-17 18:30:07 +01:00
|
|
|
m_trackWidthCtrl->SetSelection( trackSel );
|
|
|
|
m_viaSizesCtrl->SetSelection( viaSel );
|
2021-12-23 13:11:26 +00:00
|
|
|
|
|
|
|
aEvent.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-04-28 16:22:25 +01:00
|
|
|
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists()
|
2016-10-14 21:07:04 +02:00
|
|
|
{
|
2018-04-28 16:22:25 +01:00
|
|
|
// Populate the net filter list with net names
|
2018-08-19 17:11:58 +01:00
|
|
|
m_netFilter->SetNetInfo( &m_brd->GetNetInfo() );
|
2020-05-24 13:30:23 -04:00
|
|
|
|
|
|
|
if( !m_brd->GetHighLightNetCodes().empty() )
|
|
|
|
m_netFilter->SetSelectedNetcode( *m_brd->GetHighLightNetCodes().begin() );
|
2016-10-14 21:07:04 +02:00
|
|
|
|
2018-04-28 16:22:25 +01:00
|
|
|
// Populate the netclass filter list with netclass names
|
2022-08-14 12:03:18 +01:00
|
|
|
wxArrayString netclassNames;
|
|
|
|
std::shared_ptr<NET_SETTINGS>& settings = m_brd->GetDesignSettings().m_NetSettings;
|
2018-04-28 16:22:25 +01:00
|
|
|
|
2024-07-26 20:49:29 +00:00
|
|
|
netclassNames.push_back( settings->GetDefaultNetclass()->GetName() );
|
2018-04-28 16:22:25 +01:00
|
|
|
|
2024-07-26 20:49:29 +00:00
|
|
|
for( const auto& [name, netclass] : settings->GetNetclasses() )
|
2022-08-14 12:03:18 +01:00
|
|
|
netclassNames.push_back( name );
|
2018-04-28 16:22:25 +01:00
|
|
|
|
2018-08-19 17:11:58 +01:00
|
|
|
m_netclassFilter->Set( netclassNames );
|
|
|
|
m_netclassFilter->SetStringSelection( m_brd->GetDesignSettings().GetCurrentNetClassName() );
|
2016-10-14 21:07:04 +02:00
|
|
|
|
2018-04-28 16:22:25 +01:00
|
|
|
// Populate the layer filter list
|
|
|
|
m_layerFilter->SetBoardFrame( m_parent );
|
|
|
|
m_layerFilter->SetLayersHotkeys( false );
|
|
|
|
m_layerFilter->SetNotAllowedLayerSet( LSET::AllNonCuMask() );
|
|
|
|
m_layerFilter->Resync();
|
2018-08-19 17:11:58 +01:00
|
|
|
m_layerFilter->SetLayerSelection( m_parent->GetActiveLayer() );
|
2009-10-30 17:58:15 +00:00
|
|
|
}
|
|
|
|
|
2018-04-28 16:22:25 +01:00
|
|
|
|
2018-08-19 11:56:18 +01:00
|
|
|
bool DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow()
|
|
|
|
{
|
2025-08-07 14:16:14 +01:00
|
|
|
m_netclassFilter->SetStringSelection( g_netclassFilter );
|
2018-10-10 18:42:27 +01:00
|
|
|
|
2025-08-07 14:16:14 +01:00
|
|
|
if( m_brd->FindNet( g_netFilter ) != nullptr )
|
2018-10-10 18:42:27 +01:00
|
|
|
m_netFilter->SetSelectedNet( g_netFilter );
|
2023-05-06 23:16:58 +01:00
|
|
|
|
2023-07-17 18:30:07 +01:00
|
|
|
m_trackWidthCtrl->SetSelection( (int) m_trackWidthCtrl->GetCount() - 1 );
|
|
|
|
m_viaSizesCtrl->SetSelection( (int) m_viaSizesCtrl->GetCount() - 1 );
|
2024-08-11 09:22:08 -06:00
|
|
|
m_annularRingsCtrl->SetSelection( (int) m_annularRingsCtrl->GetCount() - 1 );
|
2023-07-17 18:30:07 +01:00
|
|
|
m_layerCtrl->SetStringSelection( INDETERMINATE_ACTION );
|
2020-05-05 16:40:18 +01:00
|
|
|
|
2023-07-17 18:30:07 +01:00
|
|
|
wxCommandEvent dummy;
|
|
|
|
onActionButtonChange( dummy );
|
|
|
|
|
2018-08-19 11:56:18 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-07-17 18:30:07 +01:00
|
|
|
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::onActionButtonChange( wxCommandEvent& event )
|
2018-04-28 16:22:25 +01:00
|
|
|
{
|
2021-04-07 17:38:07 +01:00
|
|
|
// Enable the items in the use specified values section
|
2023-07-17 18:30:07 +01:00
|
|
|
bool enable = m_setToSpecifiedValues->GetValue();
|
|
|
|
|
|
|
|
m_trackWidthLabel->Enable( enable );
|
|
|
|
m_trackWidthCtrl->Enable( enable );
|
|
|
|
m_viaSizeLabel->Enable( enable );
|
|
|
|
m_viaSizesCtrl->Enable( enable );
|
2024-08-11 09:22:08 -06:00
|
|
|
m_annularRingsLabel->Enable( enable );
|
|
|
|
m_annularRingsCtrl->Enable( enable );
|
2023-07-17 18:30:07 +01:00
|
|
|
m_layerLabel->Enable( enable );
|
|
|
|
m_layerCtrl->Enable( enable );
|
2016-10-14 21:07:04 +02:00
|
|
|
}
|
|
|
|
|
2009-10-30 17:58:15 +00:00
|
|
|
|
2025-08-07 14:16:14 +01:00
|
|
|
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem( PICKED_ITEMS_LIST* aUndoList, PCB_TRACK* aItem )
|
2009-10-30 17:58:15 +00:00
|
|
|
{
|
2018-04-28 16:22:25 +01:00
|
|
|
BOARD_DESIGN_SETTINGS& brdSettings = m_brd->GetDesignSettings();
|
2020-05-05 16:40:18 +01:00
|
|
|
bool isTrack = aItem->Type() == PCB_TRACE_T;
|
2022-01-10 17:19:11 -08:00
|
|
|
bool isArc = aItem->Type() == PCB_ARC_T;
|
2020-05-05 16:40:18 +01:00
|
|
|
bool isVia = aItem->Type() == PCB_VIA_T;
|
2009-11-02 20:36:20 +00:00
|
|
|
|
2018-04-28 16:22:25 +01:00
|
|
|
if( m_setToSpecifiedValues->GetValue() )
|
2009-10-30 17:58:15 +00:00
|
|
|
{
|
2023-07-17 18:30:07 +01:00
|
|
|
if( ( isArc || isTrack ) && m_trackWidthCtrl->GetStringSelection() != INDETERMINATE_ACTION )
|
2018-08-19 17:11:58 +01:00
|
|
|
{
|
2025-08-13 09:33:57 +01:00
|
|
|
int prevTrackWidthIndex = brdSettings.GetTrackWidthIndex();
|
2023-07-17 18:30:07 +01:00
|
|
|
int trackWidthIndex = m_trackWidthCtrl->GetSelection();
|
2022-01-10 17:19:11 -08:00
|
|
|
|
|
|
|
if( trackWidthIndex >= 0 )
|
2025-08-13 09:33:57 +01:00
|
|
|
brdSettings.SetTrackWidthIndex( trackWidthIndex + 1 );
|
2020-05-05 16:40:18 +01:00
|
|
|
|
2020-08-31 16:50:24 +01:00
|
|
|
m_parent->SetTrackSegmentWidth( aItem, aUndoList, false );
|
2020-05-05 16:40:18 +01:00
|
|
|
|
|
|
|
brdSettings.SetTrackWidthIndex( prevTrackWidthIndex );
|
|
|
|
}
|
2024-08-11 09:22:08 -06:00
|
|
|
|
|
|
|
if( isVia && m_viaSizesCtrl->GetStringSelection() != INDETERMINATE_ACTION )
|
2020-05-05 16:40:18 +01:00
|
|
|
{
|
2025-08-13 09:33:57 +01:00
|
|
|
int prevViaSizeIndex = brdSettings.GetViaSizeIndex();
|
|
|
|
int viaSizeIndex = m_viaSizesCtrl->GetSelection();
|
2022-01-10 17:19:11 -08:00
|
|
|
|
|
|
|
if( viaSizeIndex >= 0 )
|
2025-08-13 09:33:57 +01:00
|
|
|
brdSettings.SetViaSizeIndex( viaSizeIndex + 1 );
|
2018-12-30 19:35:56 +00:00
|
|
|
|
2020-08-31 16:50:24 +01:00
|
|
|
m_parent->SetTrackSegmentWidth( aItem, aUndoList, false );
|
2020-05-05 16:40:18 +01:00
|
|
|
|
|
|
|
brdSettings.SetViaSizeIndex( prevViaSizeIndex );
|
2018-08-19 17:11:58 +01:00
|
|
|
}
|
2018-04-28 16:22:25 +01:00
|
|
|
|
2024-08-11 09:22:08 -06:00
|
|
|
if( isVia && m_annularRingsCtrl->GetStringSelection() != INDETERMINATE_ACTION )
|
|
|
|
{
|
|
|
|
PCB_VIA* v = static_cast<PCB_VIA*>( aItem );
|
|
|
|
|
|
|
|
switch( m_annularRingsCtrl->GetSelection() )
|
|
|
|
{
|
|
|
|
case 0:
|
2025-08-13 09:33:57 +01:00
|
|
|
v->Padstack().SetUnconnectedLayerMode( PADSTACK::UNCONNECTED_LAYER_MODE::KEEP_ALL );
|
2024-08-11 09:22:08 -06:00
|
|
|
break;
|
|
|
|
case 1:
|
2025-08-13 09:33:57 +01:00
|
|
|
v->Padstack().SetUnconnectedLayerMode( PADSTACK::UNCONNECTED_LAYER_MODE::REMOVE_EXCEPT_START_AND_END );
|
2024-08-11 09:22:08 -06:00
|
|
|
break;
|
|
|
|
case 2:
|
2025-08-13 09:33:57 +01:00
|
|
|
v->Padstack().SetUnconnectedLayerMode( PADSTACK::UNCONNECTED_LAYER_MODE::REMOVE_ALL );
|
2024-08-11 09:22:08 -06:00
|
|
|
break;
|
2025-08-07 11:24:36 -07:00
|
|
|
case 3:
|
2025-08-13 09:33:57 +01:00
|
|
|
v->Padstack().SetUnconnectedLayerMode( PADSTACK::UNCONNECTED_LAYER_MODE::START_END_ONLY );
|
2025-08-07 11:24:36 -07:00
|
|
|
break;
|
2024-08-11 09:22:08 -06:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-17 18:30:07 +01:00
|
|
|
if( ( isArc || isTrack ) && m_layerCtrl->GetLayerSelection() != UNDEFINED_LAYER )
|
2009-11-02 20:36:20 +00:00
|
|
|
{
|
2018-04-28 16:22:25 +01:00
|
|
|
if( aUndoList->FindItem( aItem ) < 0 )
|
|
|
|
{
|
2020-08-26 18:04:32 +00:00
|
|
|
ITEM_PICKER picker( nullptr, aItem, UNDO_REDO::CHANGED );
|
2018-04-28 16:22:25 +01:00
|
|
|
picker.SetLink( aItem->Clone() );
|
|
|
|
aUndoList->PushItem( picker );
|
|
|
|
}
|
|
|
|
|
2023-07-17 18:30:07 +01:00
|
|
|
aItem->SetLayer( ToLAYER_ID( m_layerCtrl->GetLayerSelection() ) );
|
2018-04-28 16:22:25 +01:00
|
|
|
m_parent->GetBoard()->GetConnectivity()->Update( aItem );
|
2009-11-02 20:36:20 +00:00
|
|
|
}
|
2018-04-28 16:22:25 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-08-31 16:50:24 +01:00
|
|
|
m_parent->SetTrackSegmentWidth( aItem, aUndoList, true );
|
2018-04-28 16:22:25 +01:00
|
|
|
}
|
2020-04-13 04:29:16 +09:00
|
|
|
|
2022-02-20 20:07:14 +01:00
|
|
|
m_items_changed.push_back( aItem );
|
2018-04-28 16:22:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 22:07:02 +01:00
|
|
|
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem( PICKED_ITEMS_LIST* aUndoList, PCB_TRACK* aItem )
|
2018-04-28 16:22:25 +01:00
|
|
|
{
|
2021-09-04 18:05:57 +01:00
|
|
|
if( m_selectedItemsFilter->GetValue() )
|
|
|
|
{
|
|
|
|
if( !aItem->IsSelected() )
|
|
|
|
{
|
2025-04-01 14:20:03 -04:00
|
|
|
EDA_GROUP* group = aItem->GetParentGroup();
|
2021-09-04 18:05:57 +01:00
|
|
|
|
2025-04-01 14:20:03 -04:00
|
|
|
while( group && !group->AsEdaItem()->IsSelected() )
|
|
|
|
group = group->AsEdaItem()->GetParentGroup();
|
2021-09-04 18:05:57 +01:00
|
|
|
|
|
|
|
if( !group )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-19 17:11:58 +01:00
|
|
|
if( m_netFilterOpt->GetValue() && m_netFilter->GetSelectedNetcode() >= 0 )
|
2018-04-28 16:22:25 +01:00
|
|
|
{
|
2018-08-19 17:11:58 +01:00
|
|
|
if( aItem->GetNetCode() != m_netFilter->GetSelectedNetcode() )
|
2009-11-02 20:36:20 +00:00
|
|
|
return;
|
2018-04-28 16:22:25 +01:00
|
|
|
}
|
2009-11-02 20:36:20 +00:00
|
|
|
|
2018-08-19 17:11:58 +01:00
|
|
|
if( m_netclassFilterOpt->GetValue() && !m_netclassFilter->GetStringSelection().IsEmpty() )
|
2018-04-28 16:22:25 +01:00
|
|
|
{
|
2024-07-26 20:49:29 +00:00
|
|
|
wxString filterNetclass = m_netclassFilter->GetStringSelection();
|
|
|
|
NETCLASS* netclass = aItem->GetEffectiveNetClass();
|
|
|
|
|
|
|
|
if( !netclass->ContainsNetclassWithName( filterNetclass ) )
|
2009-11-02 20:36:20 +00:00
|
|
|
return;
|
2018-04-28 16:22:25 +01:00
|
|
|
}
|
2009-11-02 20:36:20 +00:00
|
|
|
|
2018-04-28 16:22:25 +01:00
|
|
|
if( m_layerFilterOpt->GetValue() && m_layerFilter->GetLayerSelection() != UNDEFINED_LAYER )
|
|
|
|
{
|
|
|
|
if( aItem->GetLayer() != m_layerFilter->GetLayerSelection() )
|
2009-11-02 20:36:20 +00:00
|
|
|
return;
|
2009-10-30 17:58:15 +00:00
|
|
|
}
|
|
|
|
|
2023-05-06 23:16:58 +01:00
|
|
|
if( aItem->Type() == PCB_VIA_T )
|
|
|
|
{
|
|
|
|
if( m_filterByViaSize->GetValue() && aItem->GetWidth() != m_viaSizeFilter.GetValue() )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( m_filterByTrackWidth->GetValue() && aItem->GetWidth() != m_trackWidthFilter.GetValue() )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-04-28 16:22:25 +01:00
|
|
|
processItem( aUndoList, aItem );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow()
|
|
|
|
{
|
|
|
|
PICKED_ITEMS_LIST itemsListPicker;
|
2020-08-31 16:50:24 +01:00
|
|
|
wxBusyCursor dummy;
|
2018-04-28 16:22:25 +01:00
|
|
|
|
|
|
|
// Examine segments
|
2021-11-06 11:28:53 +00:00
|
|
|
for( PCB_TRACK* track : m_brd->Tracks() )
|
2018-04-28 16:22:25 +01:00
|
|
|
{
|
2021-11-06 11:28:53 +00:00
|
|
|
if( m_tracks->GetValue() && track->Type() == PCB_TRACE_T )
|
|
|
|
visitItem( &itemsListPicker, track );
|
2022-01-11 06:08:04 -08:00
|
|
|
else if ( m_tracks->GetValue() && track->Type() == PCB_ARC_T )
|
2021-11-06 11:28:53 +00:00
|
|
|
visitItem( &itemsListPicker, track );
|
2022-01-11 06:08:04 -08:00
|
|
|
else if ( m_vias->GetValue() && track->Type() == PCB_VIA_T )
|
2022-01-10 17:19:11 -08:00
|
|
|
visitItem( &itemsListPicker, track );
|
2018-04-28 16:22:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if( itemsListPicker.GetCount() > 0 )
|
2016-10-14 21:07:04 +02:00
|
|
|
{
|
2020-08-26 18:04:32 +00:00
|
|
|
m_parent->SaveCopyInUndoList( itemsListPicker, UNDO_REDO::CHANGED );
|
2018-04-28 16:22:25 +01:00
|
|
|
|
2021-11-06 11:28:53 +00:00
|
|
|
for( PCB_TRACK* track : m_brd->Tracks() )
|
|
|
|
m_parent->GetCanvas()->GetView()->Update( track );
|
2016-10-14 21:07:04 +02:00
|
|
|
}
|
2009-10-30 17:58:15 +00:00
|
|
|
|
2023-05-06 23:16:58 +01:00
|
|
|
m_parent->GetCanvas()->ForceRefresh();
|
|
|
|
|
2022-02-20 20:07:14 +01:00
|
|
|
if( m_items_changed.size() )
|
|
|
|
{
|
|
|
|
m_brd->OnItemsChanged( m_items_changed );
|
|
|
|
m_parent->OnModify();
|
|
|
|
}
|
|
|
|
|
2020-08-31 16:50:24 +01:00
|
|
|
return true;
|
2018-04-28 16:22:25 +01:00
|
|
|
}
|