2013-09-18 17:55:16 +00:00
|
|
|
/*
|
|
|
|
* KiRouter - a push-and-(sometimes-)shove PCB router
|
|
|
|
*
|
2017-01-18 08:04:11 +00:00
|
|
|
* Copyright (C) 2013-2017 CERN
|
2017-01-20 07:29:24 +00:00
|
|
|
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
|
2013-09-18 17:55:16 +00:00
|
|
|
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
2013-09-26 21:53:54 +00:00
|
|
|
*
|
2013-09-18 17:55:16 +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.
|
2013-09-26 21:53:54 +00:00
|
|
|
*
|
2013-09-18 17:55:16 +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.
|
2013-09-26 21:53:54 +00:00
|
|
|
*
|
2013-09-18 17:55:16 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
2014-05-14 13:53:54 +00:00
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
2013-09-18 17:55:16 +00:00
|
|
|
*/
|
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
#include <wx/numdlg.h>
|
2014-05-14 13:53:54 +00:00
|
|
|
|
2017-11-01 11:14:16 +00:00
|
|
|
#include <core/optional.h>
|
2016-06-29 10:23:11 +00:00
|
|
|
#include <functional>
|
|
|
|
using namespace std::placeholders;
|
2013-09-18 17:55:16 +00:00
|
|
|
|
2014-04-04 09:56:04 +00:00
|
|
|
#include "class_draw_panel_gal.h"
|
2013-09-18 17:55:16 +00:00
|
|
|
#include "class_board.h"
|
|
|
|
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2014-02-19 12:51:32 +00:00
|
|
|
#include <id.h>
|
2014-05-14 13:53:54 +00:00
|
|
|
#include <macros.h>
|
2014-04-04 09:50:15 +00:00
|
|
|
#include <pcbnew_id.h>
|
2016-12-02 17:58:12 +00:00
|
|
|
#include <view/view.h>
|
2013-09-18 17:55:16 +00:00
|
|
|
#include <view/view_controls.h>
|
2018-03-16 02:42:38 +00:00
|
|
|
#include <pcb_layer_widget.h>
|
2013-09-18 17:55:16 +00:00
|
|
|
#include <pcb_painter.h>
|
2014-05-14 13:53:54 +00:00
|
|
|
#include <dialogs/dialog_pns_settings.h>
|
2015-02-18 00:29:54 +00:00
|
|
|
#include <dialogs/dialog_pns_diff_pair_dimensions.h>
|
2014-05-14 13:53:54 +00:00
|
|
|
#include <dialogs/dialog_track_via_size.h>
|
|
|
|
#include <base_units.h>
|
2015-05-18 11:48:11 +00:00
|
|
|
#include <hotkeys.h>
|
2015-09-24 09:04:42 +00:00
|
|
|
#include <confirm.h>
|
2017-02-20 12:20:39 +00:00
|
|
|
#include <bitmaps.h>
|
2018-01-05 23:44:37 +00:00
|
|
|
#include <collectors.h>
|
2013-09-18 17:55:16 +00:00
|
|
|
|
|
|
|
#include <tool/context_menu.h>
|
2015-05-05 18:39:41 +00:00
|
|
|
#include <tool/tool_manager.h>
|
2015-07-02 14:09:51 +00:00
|
|
|
#include <tool/tool_settings.h>
|
2017-02-28 03:04:44 +00:00
|
|
|
#include <tool/grid_menu.h>
|
|
|
|
|
|
|
|
#include <tool/zoom_menu.h>
|
2017-02-21 12:42:08 +00:00
|
|
|
#include <tools/pcb_actions.h>
|
2015-11-03 16:19:42 +00:00
|
|
|
#include <tools/selection_tool.h>
|
|
|
|
#include <tools/edit_tool.h>
|
2017-02-06 16:00:51 +00:00
|
|
|
#include <tools/tool_event_utils.h>
|
2013-09-18 17:55:16 +00:00
|
|
|
|
|
|
|
#include "router_tool.h"
|
|
|
|
#include "pns_segment.h"
|
|
|
|
#include "pns_router.h"
|
|
|
|
|
2013-10-14 14:13:35 +00:00
|
|
|
using namespace KIGFX;
|
2017-03-22 16:56:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Flags used by via tool actions
|
|
|
|
*/
|
|
|
|
enum VIA_ACTION_FLAGS
|
|
|
|
{
|
|
|
|
// Via type
|
|
|
|
VIA_MASK = 0x03,
|
|
|
|
VIA = 0x00, ///> Normal via
|
|
|
|
BLIND_VIA = 0x01, ///> blind/buried via
|
|
|
|
MICROVIA = 0x02, ///> Microvia
|
2017-03-16 11:20:18 +00:00
|
|
|
|
|
|
|
// Select layer
|
|
|
|
SELECT_LAYER = VIA_MASK + 1, ///> Ask user to select layer before adding via
|
2017-03-22 16:56:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-02-20 18:10:20 +00:00
|
|
|
TOOL_ACTION PCB_ACTIONS::routerActivateSingle( "pcbnew.InteractiveRouter.SingleTrack",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_NEW_TRACK ),
|
|
|
|
_( "Interactive Router (Single Tracks)" ),
|
|
|
|
_( "Run push & shove router (single tracks)" ), ps_router_xpm, AF_ACTIVATE );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::routerActivateDiffPair( "pcbnew.InteractiveRouter.DiffPair",
|
2018-02-25 18:30:59 +00:00
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTE_DIFF_PAIR ),
|
2017-02-20 18:10:20 +00:00
|
|
|
_( "Interactive Router (Differential Pairs)" ),
|
|
|
|
_( "Run push & shove router (differential pairs)" ), ps_diff_pair_xpm, AF_ACTIVATE );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::routerActivateSettingsDialog( "pcbnew.InteractiveRouter.SettingsDialog",
|
2018-05-13 20:11:11 +00:00
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTING_OPTIONS ),
|
2018-02-09 16:28:33 +00:00
|
|
|
_( "Interactive Router Settings..." ),
|
2018-06-15 15:12:15 +00:00
|
|
|
_( "Open Interactive Router settings" ), tools_xpm );
|
2017-02-20 18:10:20 +00:00
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::routerActivateDpDimensionsDialog( "pcbnew.InteractiveRouter.DpDimensionsDialog",
|
|
|
|
AS_GLOBAL, 0,
|
2018-02-09 16:28:33 +00:00
|
|
|
_( "Differential Pair Dimension Settings..." ),
|
2018-06-15 15:12:15 +00:00
|
|
|
_( "Open Differential Pair Dimension settings" ),
|
|
|
|
ps_diff_pair_gap_xpm );
|
2017-02-20 18:10:20 +00:00
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::routerActivateTuneSingleTrace( "pcbnew.LengthTuner.TuneSingleTrack",
|
2018-02-25 18:30:59 +00:00
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTE_TUNE_SINGLE ),
|
2017-02-20 18:10:20 +00:00
|
|
|
_( "Tune length of a single track" ), "", ps_tune_length_xpm, AF_ACTIVATE );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::routerActivateTuneDiffPair( "pcbnew.LengthTuner.TuneDiffPair",
|
2018-02-25 18:30:59 +00:00
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTE_TUNE_DIFF_PAIR ),
|
2017-02-20 18:10:20 +00:00
|
|
|
_( "Tune length of a differential pair" ), "", NULL, AF_ACTIVATE );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::routerActivateTuneDiffPairSkew( "pcbnew.LengthTuner.TuneDiffPairSkew",
|
2018-02-25 18:30:59 +00:00
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTE_TUNE_SKEW ),
|
2017-02-20 18:10:20 +00:00
|
|
|
_( "Tune skew of a differential pair" ), "", NULL, AF_ACTIVATE );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::routerInlineDrag( "pcbnew.InteractiveRouter.InlineDrag",
|
2017-08-03 15:53:07 +00:00
|
|
|
AS_CONTEXT, 0,
|
2017-02-20 18:10:20 +00:00
|
|
|
_( "Drag Track/Via" ), _( "Drags tracks and vias without breaking connections" ),
|
2017-07-04 15:17:55 +00:00
|
|
|
drag_xpm );
|
2017-02-20 18:10:20 +00:00
|
|
|
|
2018-12-14 03:43:51 +00:00
|
|
|
TOOL_ACTION PCB_ACTIONS::inlineBreakTrack( "pcbnew.InteractiveRouter.InlineBreakTrack",
|
|
|
|
AS_GLOBAL, 0,
|
|
|
|
_( "Break Track" ),
|
|
|
|
_( "Splits the track segment into two segments connected at the cursor position." ),
|
|
|
|
break_line_xpm );
|
|
|
|
|
2017-08-03 15:53:07 +00:00
|
|
|
TOOL_ACTION PCB_ACTIONS::breakTrack( "pcbnew.InteractiveRouter.BreakTrack",
|
|
|
|
AS_GLOBAL, 0,
|
|
|
|
_( "Break Track" ),
|
|
|
|
_( "Splits the track segment into two segments connected at the cursor position." ),
|
|
|
|
break_line_xpm );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::drag45Degree( "pcbnew.InteractiveRouter.Drag45Degree",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DRAG_TRACK_KEEP_SLOPE ),
|
|
|
|
_( "Drag (45 degree mode)" ),
|
2018-04-17 15:59:52 +00:00
|
|
|
_( "Drags the track segment while keeping connected tracks at 45 degrees." ),
|
2017-08-03 15:53:07 +00:00
|
|
|
drag_segment_withslope_xpm );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::dragFreeAngle( "pcbnew.InteractiveRouter.DragFreeAngle",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DRAG_ITEM ),
|
|
|
|
_( "Drag (free angle)" ),
|
2018-04-17 15:59:52 +00:00
|
|
|
_( "Drags the nearest joint in the track without restricting the track angle." ),
|
2017-08-03 15:53:07 +00:00
|
|
|
move_xpm );
|
|
|
|
|
2017-01-18 08:04:11 +00:00
|
|
|
static const TOOL_ACTION ACT_NewTrack( "pcbnew.InteractiveRouter.NewTrack", AS_CONTEXT,
|
2015-05-18 11:48:11 +00:00
|
|
|
TOOL_ACTION::LegacyHotKey( HK_ADD_NEW_TRACK ),
|
2015-04-02 14:09:48 +00:00
|
|
|
_( "New Track" ), _( "Starts laying a new track." ), add_tracks_xpm );
|
2015-04-02 14:09:26 +00:00
|
|
|
|
2017-01-18 08:04:11 +00:00
|
|
|
static const TOOL_ACTION ACT_EndTrack( "pcbnew.InteractiveRouter.EndTrack", AS_CONTEXT, WXK_END,
|
2015-04-02 14:09:48 +00:00
|
|
|
_( "End Track" ), _( "Stops laying the current track." ), checked_ok_xpm );
|
2015-04-02 14:09:26 +00:00
|
|
|
|
2017-01-18 08:04:11 +00:00
|
|
|
static const TOOL_ACTION ACT_AutoEndRoute( "pcbnew.InteractiveRouter.AutoEndRoute", AS_CONTEXT, 'F',
|
2015-04-02 14:09:26 +00:00
|
|
|
_( "Auto-end Track" ), _( "Automagically finishes currently routed track." ) );
|
|
|
|
|
2017-01-18 08:04:11 +00:00
|
|
|
static const TOOL_ACTION ACT_PlaceThroughVia( "pcbnew.InteractiveRouter.PlaceVia",
|
2015-05-18 11:48:11 +00:00
|
|
|
AS_CONTEXT, TOOL_ACTION::LegacyHotKey( HK_ADD_THROUGH_VIA ),
|
2015-05-03 18:43:07 +00:00
|
|
|
_( "Place Through Via" ),
|
|
|
|
_( "Adds a through-hole via at the end of currently routed track." ),
|
2017-03-22 16:56:01 +00:00
|
|
|
via_xpm, AF_NONE,
|
|
|
|
(void*) VIA_ACTION_FLAGS::VIA );
|
2015-05-03 18:43:07 +00:00
|
|
|
|
2017-01-18 08:04:11 +00:00
|
|
|
static const TOOL_ACTION ACT_PlaceBlindVia( "pcbnew.InteractiveRouter.PlaceBlindVia",
|
2015-05-18 11:48:11 +00:00
|
|
|
AS_CONTEXT, TOOL_ACTION::LegacyHotKey( HK_ADD_BLIND_BURIED_VIA ),
|
2015-05-03 18:43:07 +00:00
|
|
|
_( "Place Blind/Buried Via" ),
|
|
|
|
_( "Adds a blind or buried via at the end of currently routed track."),
|
2017-03-22 16:56:01 +00:00
|
|
|
via_buried_xpm, AF_NONE,
|
|
|
|
(void*) VIA_ACTION_FLAGS::BLIND_VIA );
|
2015-05-03 18:43:07 +00:00
|
|
|
|
2017-01-18 08:04:11 +00:00
|
|
|
static const TOOL_ACTION ACT_PlaceMicroVia( "pcbnew.InteractiveRouter.PlaceMicroVia",
|
2015-05-18 11:48:11 +00:00
|
|
|
AS_CONTEXT, TOOL_ACTION::LegacyHotKey( HK_ADD_MICROVIA ),
|
2015-05-03 18:43:07 +00:00
|
|
|
_( "Place Microvia" ), _( "Adds a microvia at the end of currently routed track." ),
|
2017-03-22 16:56:01 +00:00
|
|
|
via_microvia_xpm, AF_NONE,
|
|
|
|
(void*) VIA_ACTION_FLAGS::MICROVIA );
|
2015-05-03 18:43:07 +00:00
|
|
|
|
2017-03-16 11:20:18 +00:00
|
|
|
static const TOOL_ACTION ACT_SelLayerAndPlaceThroughVia(
|
|
|
|
"pcbnew.InteractiveRouter.SelLayerAndPlaceVia",
|
|
|
|
AS_CONTEXT, TOOL_ACTION::LegacyHotKey( HK_SEL_LAYER_AND_ADD_THROUGH_VIA ),
|
2018-02-09 16:28:33 +00:00
|
|
|
_( "Select Layer and Place Through Via..." ),
|
2017-03-16 11:20:18 +00:00
|
|
|
_( "Select a layer, then add a through-hole via at the end of currently routed track." ),
|
|
|
|
select_w_layer_xpm, AF_NONE,
|
|
|
|
(void*) ( VIA_ACTION_FLAGS::VIA | VIA_ACTION_FLAGS::SELECT_LAYER ) );
|
|
|
|
|
|
|
|
static const TOOL_ACTION ACT_SelLayerAndPlaceBlindVia(
|
|
|
|
"pcbnew.InteractiveRouter.SelLayerAndPlaceBlindVia",
|
|
|
|
AS_CONTEXT, TOOL_ACTION::LegacyHotKey( HK_SEL_LAYER_AND_ADD_BLIND_BURIED_VIA ),
|
2018-02-09 16:28:33 +00:00
|
|
|
_( "Select Layer and Place Blind/Buried Via..." ),
|
2017-03-16 11:20:18 +00:00
|
|
|
_( "Select a layer, then add a blind or buried via at the end of currently routed track."),
|
|
|
|
select_w_layer_xpm, AF_NONE,
|
|
|
|
(void*) ( VIA_ACTION_FLAGS::BLIND_VIA | VIA_ACTION_FLAGS::SELECT_LAYER ) );
|
|
|
|
|
2017-01-18 08:04:11 +00:00
|
|
|
static const TOOL_ACTION ACT_CustomTrackWidth( "pcbnew.InteractiveRouter.CustomTrackViaSize",
|
2017-06-30 12:59:16 +00:00
|
|
|
AS_CONTEXT, TOOL_ACTION::LegacyHotKey( HK_CUSTOM_TRACK_WIDTH ),
|
2018-02-09 16:28:33 +00:00
|
|
|
_( "Custom Track/Via Size..." ),
|
2015-05-03 18:43:07 +00:00
|
|
|
_( "Shows a dialog for changing the track width and via size." ),
|
|
|
|
width_track_xpm );
|
2015-04-02 14:09:26 +00:00
|
|
|
|
2017-01-18 08:04:11 +00:00
|
|
|
static const TOOL_ACTION ACT_SwitchPosture( "pcbnew.InteractiveRouter.SwitchPosture", AS_CONTEXT,
|
2015-05-18 11:48:11 +00:00
|
|
|
TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_POSTURE ),
|
2015-05-03 18:43:07 +00:00
|
|
|
_( "Switch Track Posture" ),
|
2016-05-02 14:01:43 +00:00
|
|
|
_( "Switches posture of the currently routed track." ),
|
2015-05-03 18:43:07 +00:00
|
|
|
change_entry_orient_xpm );
|
|
|
|
|
2013-09-18 17:55:16 +00:00
|
|
|
ROUTER_TOOL::ROUTER_TOOL() :
|
2016-08-29 17:31:13 +00:00
|
|
|
TOOL_BASE( "pcbnew.InteractiveRouter" )
|
2015-02-18 16:53:46 +00:00
|
|
|
{
|
2014-05-14 13:53:54 +00:00
|
|
|
}
|
2013-09-26 21:53:54 +00:00
|
|
|
|
2014-05-16 11:37:31 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
class TRACK_WIDTH_MENU: public CONTEXT_MENU
|
2014-05-14 13:53:54 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-04-28 15:22:25 +00:00
|
|
|
TRACK_WIDTH_MENU( PCB_EDIT_FRAME& aFrame ) :
|
|
|
|
m_frame( aFrame )
|
2014-05-14 13:53:54 +00:00
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
SetIcon( width_track_via_xpm );
|
2017-01-23 13:47:49 +00:00
|
|
|
SetTitle( _( "Select Track/Via Width" ) );
|
2014-05-14 13:53:54 +00:00
|
|
|
}
|
2013-10-11 12:26:09 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
protected:
|
|
|
|
CONTEXT_MENU* create() const override
|
2014-05-14 13:53:54 +00:00
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
return new TRACK_WIDTH_MENU( m_frame );
|
|
|
|
}
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
void update() override
|
|
|
|
{
|
2018-06-17 13:50:49 +00:00
|
|
|
EDA_UNITS_T units = m_frame.GetUserUnits();
|
|
|
|
BOARD_DESIGN_SETTINGS& bds = m_frame.GetBoard()->GetDesignSettings();
|
|
|
|
bool useIndex = !bds.m_UseConnectedTrackWidth &&
|
|
|
|
!bds.UseCustomTrackViaSize();
|
|
|
|
wxString msg;
|
2017-01-20 17:33:11 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
Clear();
|
2014-05-14 13:53:54 +00:00
|
|
|
|
2018-02-09 16:28:33 +00:00
|
|
|
Append( ID_POPUP_PCB_SELECT_AUTO_WIDTH, _( "Use Starting Track Width" ),
|
2014-05-16 11:37:31 +00:00
|
|
|
_( "Route using the width of the starting track." ), wxITEM_CHECK );
|
2018-04-28 15:22:25 +00:00
|
|
|
Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH,
|
|
|
|
bds.m_UseConnectedTrackWidth && !bds.UseCustomTrackViaSize() );
|
2014-05-14 13:53:54 +00:00
|
|
|
|
2018-02-09 16:28:33 +00:00
|
|
|
Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES, _( "Use Net Class Values" ),
|
2014-05-16 11:37:31 +00:00
|
|
|
_( "Use track and via sizes from the net class" ), wxITEM_CHECK );
|
2018-04-28 15:22:25 +00:00
|
|
|
Check( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES,
|
|
|
|
useIndex && bds.GetTrackWidthIndex() == 0 && bds.GetViaSizeIndex() == 0 );
|
|
|
|
|
|
|
|
Append( ID_POPUP_PCB_SELECT_CUSTOM_WIDTH, _( "Use Custom Values..." ),
|
|
|
|
_( "Specify custom track and via sizes" ), wxITEM_CHECK );
|
|
|
|
Check( ID_POPUP_PCB_SELECT_CUSTOM_WIDTH, bds.UseCustomTrackViaSize() );
|
2014-05-14 13:53:54 +00:00
|
|
|
|
|
|
|
AppendSeparator();
|
|
|
|
|
2015-07-07 16:36:56 +00:00
|
|
|
// Append the list of tracks & via sizes
|
2018-04-28 15:22:25 +00:00
|
|
|
for( unsigned i = 0; i < bds.m_TrackWidthList.size(); i++ )
|
|
|
|
{
|
|
|
|
int width = bds.m_TrackWidthList[i];
|
2014-05-14 13:53:54 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
if( i == 0 )
|
|
|
|
msg = _( "Track netclass width" );
|
|
|
|
else
|
2018-06-17 13:50:49 +00:00
|
|
|
msg = _( "Track " ) + MessageTextFromValue( units, width, true );
|
2018-04-28 15:22:25 +00:00
|
|
|
|
|
|
|
int menuIdx = ID_POPUP_PCB_SELECT_WIDTH1 + i;
|
|
|
|
Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK );
|
|
|
|
Check( menuIdx, useIndex && bds.GetTrackWidthIndex() == i );
|
|
|
|
}
|
|
|
|
|
|
|
|
AppendSeparator();
|
|
|
|
|
|
|
|
for( unsigned i = 0; i < bds.m_ViasDimensionsList.size(); i++ )
|
|
|
|
{
|
|
|
|
VIA_DIMENSION via = bds.m_ViasDimensionsList[i];
|
|
|
|
|
|
|
|
if( i == 0 )
|
|
|
|
msg = _( "Via netclass values" );
|
|
|
|
else
|
|
|
|
{
|
2018-06-17 13:50:49 +00:00
|
|
|
msg = _( "Via " ) + MessageTextFromValue( units, via.m_Diameter, true );
|
2018-04-28 15:22:25 +00:00
|
|
|
|
|
|
|
if( via.m_Drill > 0 )
|
2018-06-17 13:50:49 +00:00
|
|
|
msg << _(", drill " ) << MessageTextFromValue( units, via.m_Drill, true );
|
2018-04-28 15:22:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int menuIdx = ID_POPUP_PCB_SELECT_VIASIZE1 + i;
|
|
|
|
Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK );
|
|
|
|
Check( menuIdx, useIndex && bds.GetViaSizeIndex() == i );
|
|
|
|
}
|
2017-01-20 17:33:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OPT_TOOL_EVENT eventHandler( const wxMenuEvent& aEvent ) override
|
2014-05-14 13:53:54 +00:00
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
BOARD_DESIGN_SETTINGS &bds = m_frame.GetBoard()->GetDesignSettings();
|
2014-05-14 13:53:54 +00:00
|
|
|
int id = aEvent.GetId();
|
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
// On Windows, this handler can be called with an event ID not existing in any
|
|
|
|
// menuitem, so only set flags when we have an ID match.
|
2014-05-14 13:53:54 +00:00
|
|
|
|
|
|
|
if( id == ID_POPUP_PCB_SELECT_CUSTOM_WIDTH )
|
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
bds.UseCustomTrackViaSize( true );
|
|
|
|
bds.m_UseConnectedTrackWidth = false;
|
|
|
|
m_frame.GetToolManager()->RunAction( ACT_CustomTrackWidth, true );
|
2014-05-14 13:53:54 +00:00
|
|
|
}
|
|
|
|
else if( id == ID_POPUP_PCB_SELECT_AUTO_WIDTH )
|
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
bds.UseCustomTrackViaSize( false );
|
|
|
|
bds.m_UseConnectedTrackWidth = true;
|
2014-05-14 13:53:54 +00:00
|
|
|
}
|
|
|
|
else if( id == ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES )
|
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
bds.UseCustomTrackViaSize( false );
|
|
|
|
bds.m_UseConnectedTrackWidth = false;
|
2014-05-14 13:53:54 +00:00
|
|
|
bds.SetViaSizeIndex( 0 );
|
|
|
|
bds.SetTrackWidthIndex( 0 );
|
|
|
|
}
|
2018-04-28 15:22:25 +00:00
|
|
|
else if( id >= ID_POPUP_PCB_SELECT_VIASIZE1 && id <= ID_POPUP_PCB_SELECT_VIASIZE16 )
|
2014-05-14 13:53:54 +00:00
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
bds.UseCustomTrackViaSize( false );
|
|
|
|
bds.m_UseConnectedTrackWidth = false;
|
2014-05-14 13:53:54 +00:00
|
|
|
bds.SetViaSizeIndex( id - ID_POPUP_PCB_SELECT_VIASIZE1 );
|
|
|
|
}
|
2018-04-28 15:22:25 +00:00
|
|
|
else if( id >= ID_POPUP_PCB_SELECT_WIDTH1 && id <= ID_POPUP_PCB_SELECT_WIDTH16 )
|
2014-05-14 13:53:54 +00:00
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
bds.UseCustomTrackViaSize( false );
|
|
|
|
bds.m_UseConnectedTrackWidth = false;
|
2014-05-14 13:53:54 +00:00
|
|
|
bds.SetTrackWidthIndex( id - ID_POPUP_PCB_SELECT_WIDTH1 );
|
|
|
|
}
|
2018-04-28 15:22:25 +00:00
|
|
|
|
|
|
|
return OPT_TOOL_EVENT( PCB_ACTIONS::trackViaSizeChanged.MakeEvent() );
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
PCB_EDIT_FRAME& m_frame;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class DIFF_PAIR_MENU: public CONTEXT_MENU
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DIFF_PAIR_MENU( PCB_EDIT_FRAME& aFrame ) :
|
|
|
|
m_frame( aFrame )
|
|
|
|
{
|
|
|
|
SetIcon( width_track_via_xpm );
|
|
|
|
SetTitle( _( "Select Differential Pair Dimensions" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
CONTEXT_MENU* create() const override
|
|
|
|
{
|
|
|
|
return new DIFF_PAIR_MENU( m_frame );
|
|
|
|
}
|
|
|
|
|
|
|
|
void update() override
|
|
|
|
{
|
|
|
|
EDA_UNITS_T units = m_frame.GetUserUnits();
|
|
|
|
const BOARD_DESIGN_SETTINGS& bds = m_frame.GetBoard()->GetDesignSettings();
|
|
|
|
|
|
|
|
Clear();
|
|
|
|
|
|
|
|
Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_DIFFPAIR, _( "Use Net Class Values" ),
|
|
|
|
_( "Use differential pair dimensions from the net class" ), wxITEM_CHECK );
|
|
|
|
Check( ID_POPUP_PCB_SELECT_USE_NETCLASS_DIFFPAIR,
|
|
|
|
!bds.UseCustomDiffPairDimensions() && bds.GetDiffPairIndex() == 0 );
|
|
|
|
|
|
|
|
Append( ID_POPUP_PCB_SELECT_CUSTOM_DIFFPAIR, _( "Use Custom Values..." ),
|
|
|
|
_( "Specify custom differential pair dimensions" ), wxITEM_CHECK );
|
|
|
|
Check( ID_POPUP_PCB_SELECT_CUSTOM_DIFFPAIR, bds.UseCustomDiffPairDimensions() );
|
|
|
|
|
|
|
|
AppendSeparator();
|
|
|
|
|
|
|
|
// Append the list of differential pair dimensions
|
|
|
|
|
|
|
|
// Drop index 0 which is the current netclass dimensions (which are handled above)
|
|
|
|
for( unsigned i = 1; i < bds.m_DiffPairDimensionsList.size(); ++i )
|
2017-01-20 07:29:24 +00:00
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
DIFF_PAIR_DIMENSION diffPair = bds.m_DiffPairDimensionsList[i];
|
|
|
|
wxString msg;
|
|
|
|
|
|
|
|
msg << _( "Width " ) << MessageTextFromValue( units, diffPair.m_Width, true );
|
|
|
|
|
|
|
|
if( diffPair.m_Gap > 0 )
|
|
|
|
msg << _( ", gap " ) << MessageTextFromValue( units, diffPair.m_Gap, true );
|
|
|
|
|
|
|
|
if( diffPair.m_ViaGap > 0 )
|
|
|
|
msg << _( ", via gap " ) << MessageTextFromValue( units, diffPair.m_ViaGap, true );
|
|
|
|
|
|
|
|
int menuIdx = ID_POPUP_PCB_SELECT_DIFFPAIR1 + i - 1;
|
|
|
|
Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK );
|
|
|
|
Check( menuIdx, !bds.UseCustomDiffPairDimensions() && bds.GetDiffPairIndex() == i );
|
2017-01-20 07:29:24 +00:00
|
|
|
}
|
2018-04-28 15:22:25 +00:00
|
|
|
}
|
2017-01-20 07:29:24 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
OPT_TOOL_EVENT eventHandler( const wxMenuEvent& aEvent ) override
|
|
|
|
{
|
|
|
|
BOARD_DESIGN_SETTINGS &bds = m_frame.GetBoard()->GetDesignSettings();
|
|
|
|
int id = aEvent.GetId();
|
|
|
|
|
|
|
|
// On Windows, this handler can be called with an event ID not existing in any
|
|
|
|
// menuitem, so only set flags when we have an ID match.
|
|
|
|
|
|
|
|
if( id == ID_POPUP_PCB_SELECT_CUSTOM_DIFFPAIR )
|
|
|
|
{
|
|
|
|
bds.UseCustomDiffPairDimensions( true );
|
|
|
|
TOOL_MANAGER* toolManager = m_frame.GetToolManager();
|
|
|
|
toolManager->RunAction( PCB_ACTIONS::routerActivateDpDimensionsDialog, true );
|
|
|
|
}
|
|
|
|
else if( id == ID_POPUP_PCB_SELECT_USE_NETCLASS_DIFFPAIR )
|
|
|
|
{
|
|
|
|
bds.UseCustomDiffPairDimensions( false );
|
|
|
|
bds.SetDiffPairIndex( 0 );
|
|
|
|
}
|
|
|
|
else if( id >= ID_POPUP_PCB_SELECT_DIFFPAIR1 && id <= ID_POPUP_PCB_SELECT_DIFFPAIR16 )
|
2017-01-20 07:29:24 +00:00
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
bds.UseCustomDiffPairDimensions( false );
|
|
|
|
// remember that the menu doesn't contain index 0 (which is the netclass values)
|
|
|
|
bds.SetDiffPairIndex( id - ID_POPUP_PCB_SELECT_DIFFPAIR1 + 1 );
|
2017-01-20 07:29:24 +00:00
|
|
|
}
|
|
|
|
|
2017-02-21 12:42:08 +00:00
|
|
|
return OPT_TOOL_EVENT( PCB_ACTIONS::trackViaSizeChanged.MakeEvent() );
|
2014-05-14 13:53:54 +00:00
|
|
|
}
|
|
|
|
|
2015-07-07 16:36:56 +00:00
|
|
|
private:
|
2018-04-28 15:22:25 +00:00
|
|
|
PCB_EDIT_FRAME& m_frame;
|
2014-05-14 13:53:54 +00:00
|
|
|
};
|
2013-09-18 17:55:16 +00:00
|
|
|
|
|
|
|
|
2017-01-20 17:33:11 +00:00
|
|
|
class ROUTER_TOOL_MENU : public CONTEXT_MENU
|
2014-05-16 11:37:31 +00:00
|
|
|
{
|
2014-05-14 13:53:54 +00:00
|
|
|
public:
|
2018-04-28 15:22:25 +00:00
|
|
|
ROUTER_TOOL_MENU( PCB_EDIT_FRAME& aFrame, PNS::ROUTER_MODE aMode ) :
|
|
|
|
m_frame( aFrame ), m_mode( aMode ), m_trackViaMenu( aFrame ), m_diffPairMenu( aFrame ),
|
|
|
|
m_zoomMenu( &aFrame ), m_gridMenu( &aFrame )
|
2014-05-14 13:53:54 +00:00
|
|
|
{
|
2015-04-02 14:09:26 +00:00
|
|
|
SetTitle( _( "Interactive Router" ) );
|
2017-02-06 16:00:51 +00:00
|
|
|
|
|
|
|
Add( ACTIONS::cancelInteractive );
|
|
|
|
|
|
|
|
AppendSeparator();
|
|
|
|
|
2014-05-14 13:53:54 +00:00
|
|
|
Add( ACT_NewTrack );
|
|
|
|
Add( ACT_EndTrack );
|
2017-08-03 15:53:07 +00:00
|
|
|
Add( PCB_ACTIONS::breakTrack );
|
|
|
|
|
|
|
|
Add( PCB_ACTIONS::drag45Degree );
|
|
|
|
Add( PCB_ACTIONS::dragFreeAngle );
|
|
|
|
|
2014-05-14 13:53:54 +00:00
|
|
|
// Add( ACT_AutoEndRoute ); // fixme: not implemented yet. Sorry.
|
|
|
|
Add( ACT_PlaceThroughVia );
|
2014-09-30 14:46:19 +00:00
|
|
|
Add( ACT_PlaceBlindVia );
|
|
|
|
Add( ACT_PlaceMicroVia );
|
2017-03-16 11:20:18 +00:00
|
|
|
Add( ACT_SelLayerAndPlaceThroughVia );
|
|
|
|
Add( ACT_SelLayerAndPlaceBlindVia );
|
2014-05-14 13:53:54 +00:00
|
|
|
Add( ACT_SwitchPosture );
|
|
|
|
|
2014-07-09 14:57:01 +00:00
|
|
|
AppendSeparator();
|
2014-08-24 07:05:07 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
Add( &m_trackViaMenu );
|
2015-02-18 16:53:46 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
if( m_mode == PNS::PNS_MODE_ROUTE_DIFF_PAIR )
|
|
|
|
Add( &m_diffPairMenu );
|
2015-02-18 16:53:46 +00:00
|
|
|
|
2018-06-15 15:12:15 +00:00
|
|
|
Add( PCB_ACTIONS::routerActivateSettingsDialog );
|
2017-01-09 13:59:30 +00:00
|
|
|
|
2017-01-20 07:51:12 +00:00
|
|
|
AppendSeparator();
|
2018-04-28 15:22:25 +00:00
|
|
|
|
2017-01-23 13:47:49 +00:00
|
|
|
Add( &m_zoomMenu );
|
|
|
|
Add( &m_gridMenu );
|
2014-05-14 13:53:54 +00:00
|
|
|
}
|
2015-07-24 07:42:46 +00:00
|
|
|
|
|
|
|
private:
|
2017-01-20 17:33:11 +00:00
|
|
|
CONTEXT_MENU* create() const override
|
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
return new ROUTER_TOOL_MENU( m_frame, m_mode );
|
2017-01-20 17:33:11 +00:00
|
|
|
}
|
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
PCB_EDIT_FRAME& m_frame;
|
2017-01-20 17:33:11 +00:00
|
|
|
PNS::ROUTER_MODE m_mode;
|
2018-04-28 15:22:25 +00:00
|
|
|
TRACK_WIDTH_MENU m_trackViaMenu;
|
|
|
|
DIFF_PAIR_MENU m_diffPairMenu;
|
|
|
|
ZOOM_MENU m_zoomMenu;
|
|
|
|
GRID_MENU m_gridMenu;
|
2014-05-14 13:53:54 +00:00
|
|
|
};
|
|
|
|
|
2014-05-16 11:37:31 +00:00
|
|
|
|
2013-09-18 17:55:16 +00:00
|
|
|
ROUTER_TOOL::~ROUTER_TOOL()
|
|
|
|
{
|
2015-07-02 14:09:51 +00:00
|
|
|
m_savedSettings.Save( GetSettings() );
|
|
|
|
}
|
|
|
|
|
2017-01-20 17:33:11 +00:00
|
|
|
|
2015-07-02 14:09:51 +00:00
|
|
|
bool ROUTER_TOOL::Init()
|
|
|
|
{
|
|
|
|
m_savedSettings.Load( GetSettings() );
|
|
|
|
return true;
|
2013-09-18 17:55:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-09 09:42:38 +00:00
|
|
|
void ROUTER_TOOL::Reset( RESET_REASON aReason )
|
2013-09-18 17:55:16 +00:00
|
|
|
{
|
2018-04-24 23:28:13 +00:00
|
|
|
if( aReason == RUN )
|
|
|
|
TOOL_BASE::Reset( aReason );
|
2013-09-18 17:55:16 +00:00
|
|
|
}
|
|
|
|
|
2015-05-18 11:48:11 +00:00
|
|
|
|
2015-02-18 00:29:54 +00:00
|
|
|
void ROUTER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent )
|
2013-09-18 17:55:16 +00:00
|
|
|
{
|
2014-05-14 13:53:54 +00:00
|
|
|
#ifdef DEBUG
|
2014-05-16 11:37:31 +00:00
|
|
|
if( aEvent.IsKeyPressed() )
|
|
|
|
{
|
|
|
|
switch( aEvent.KeyCode() )
|
|
|
|
{
|
2015-10-05 16:28:41 +00:00
|
|
|
case '0':
|
2016-08-17 14:00:21 +00:00
|
|
|
wxLogTrace( "PNS", "saving drag/route log...\n" );
|
2015-10-05 16:28:41 +00:00
|
|
|
m_router->DumpLog();
|
|
|
|
break;
|
2014-05-14 13:53:54 +00:00
|
|
|
}
|
2014-05-16 11:37:31 +00:00
|
|
|
}
|
2014-05-14 13:53:54 +00:00
|
|
|
#endif
|
|
|
|
}
|
2013-09-26 21:53:54 +00:00
|
|
|
|
2015-05-18 11:48:11 +00:00
|
|
|
|
2016-08-29 17:31:13 +00:00
|
|
|
int ROUTER_TOOL::getStartLayer( const PNS::ITEM* aItem )
|
2014-11-14 18:15:58 +00:00
|
|
|
{
|
|
|
|
int tl = getView()->GetTopLayer();
|
2013-09-26 21:53:54 +00:00
|
|
|
|
2014-11-14 19:19:00 +00:00
|
|
|
if( m_startItem )
|
2014-11-14 18:15:58 +00:00
|
|
|
{
|
2016-08-29 17:31:13 +00:00
|
|
|
const LAYER_RANGE& ls = m_startItem->Layers();
|
2014-11-14 18:15:58 +00:00
|
|
|
|
2014-11-14 19:19:00 +00:00
|
|
|
if( ls.Overlaps( tl ) )
|
2014-11-14 18:15:58 +00:00
|
|
|
return tl;
|
|
|
|
else
|
|
|
|
return ls.Start();
|
|
|
|
}
|
2014-11-14 19:19:00 +00:00
|
|
|
|
2014-11-14 18:15:58 +00:00
|
|
|
return tl;
|
|
|
|
}
|
2015-05-18 11:48:11 +00:00
|
|
|
|
|
|
|
|
2014-11-14 18:15:58 +00:00
|
|
|
void ROUTER_TOOL::switchLayerOnViaPlacement()
|
2013-09-18 17:55:16 +00:00
|
|
|
{
|
2017-08-03 15:53:07 +00:00
|
|
|
int al = frame()->GetActiveLayer();
|
2014-11-14 18:15:58 +00:00
|
|
|
int cl = m_router->GetCurrentLayer();
|
2014-11-14 19:19:00 +00:00
|
|
|
|
2014-11-14 18:15:58 +00:00
|
|
|
if( cl != al )
|
|
|
|
{
|
|
|
|
m_router->SwitchLayer( al );
|
|
|
|
}
|
|
|
|
|
2017-11-01 11:14:16 +00:00
|
|
|
OPT<int> newLayer = m_router->Sizes().PairedLayer( cl );
|
2014-11-14 18:15:58 +00:00
|
|
|
|
2015-09-24 16:34:22 +00:00
|
|
|
if( !newLayer )
|
|
|
|
newLayer = m_router->Sizes().GetLayerTop();
|
|
|
|
|
|
|
|
m_router->SwitchLayer( *newLayer );
|
2017-08-03 15:53:07 +00:00
|
|
|
frame()->SetActiveLayer( ToLAYER_ID( *newLayer ) );
|
2014-11-14 18:15:58 +00:00
|
|
|
}
|
|
|
|
|
2015-05-18 11:48:11 +00:00
|
|
|
|
2017-03-22 16:56:01 +00:00
|
|
|
static VIATYPE_T getViaTypeFromFlags( int aFlags )
|
2014-11-14 18:15:58 +00:00
|
|
|
{
|
2017-03-22 16:56:01 +00:00
|
|
|
switch( aFlags & VIA_ACTION_FLAGS::VIA_MASK )
|
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
case VIA_ACTION_FLAGS::VIA: return VIA_THROUGH;
|
|
|
|
case VIA_ACTION_FLAGS::BLIND_VIA: return VIA_BLIND_BURIED;
|
|
|
|
case VIA_ACTION_FLAGS::MICROVIA: return VIA_MICROVIA;
|
2017-03-22 16:56:01 +00:00
|
|
|
default:
|
2017-01-18 08:04:11 +00:00
|
|
|
wxASSERT_MSG( false, "Unhandled via type" );
|
2018-04-28 15:22:25 +00:00
|
|
|
return VIA_THROUGH;
|
2017-03-22 16:56:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int ROUTER_TOOL::onViaCommand( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
const int actViaFlags = aEvent.Parameter<intptr_t>();
|
|
|
|
|
|
|
|
VIATYPE_T viaType = getViaTypeFromFlags( actViaFlags );
|
2017-03-16 11:20:18 +00:00
|
|
|
const bool selectLayer = actViaFlags & VIA_ACTION_FLAGS::SELECT_LAYER;
|
2017-01-18 08:04:11 +00:00
|
|
|
|
2017-08-03 15:53:07 +00:00
|
|
|
BOARD_DESIGN_SETTINGS& bds = board()->GetDesignSettings();
|
2015-02-18 16:53:46 +00:00
|
|
|
|
2014-11-14 18:15:58 +00:00
|
|
|
const int layerCount = bds.GetCopperLayerCount();
|
|
|
|
int currentLayer = m_router->GetCurrentLayer();
|
2017-08-03 15:53:07 +00:00
|
|
|
PCB_LAYER_ID pairTop = frame()->GetScreen()->m_Route_Layer_TOP;
|
|
|
|
PCB_LAYER_ID pairBottom = frame()->GetScreen()->m_Route_Layer_BOTTOM;
|
2014-11-14 18:15:58 +00:00
|
|
|
|
2016-08-29 17:31:13 +00:00
|
|
|
PNS::SIZES_SETTINGS sizes = m_router->Sizes();
|
2014-05-14 13:53:54 +00:00
|
|
|
|
2017-03-16 11:20:18 +00:00
|
|
|
// ask the user for a target layer
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID targetLayer = UNDEFINED_LAYER;
|
2017-03-16 11:20:18 +00:00
|
|
|
|
|
|
|
if( selectLayer )
|
|
|
|
{
|
|
|
|
wxPoint dlgPosition = wxGetMousePosition();
|
|
|
|
|
2017-08-03 15:53:07 +00:00
|
|
|
targetLayer = frame()->SelectLayer( static_cast<PCB_LAYER_ID>( currentLayer ),
|
2017-03-16 11:20:18 +00:00
|
|
|
LSET::AllNonCuMask(), dlgPosition );
|
|
|
|
}
|
|
|
|
|
2015-02-18 00:29:54 +00:00
|
|
|
// fixme: P&S supports more than one fixed layer pair. Update the dialog?
|
2014-11-14 18:15:58 +00:00
|
|
|
sizes.ClearLayerPairs();
|
2013-09-26 21:53:54 +00:00
|
|
|
|
2014-11-14 19:19:00 +00:00
|
|
|
if( !m_router->IsPlacingVia() )
|
2014-11-14 18:15:58 +00:00
|
|
|
{
|
|
|
|
// Cannot place microvias or blind vias if not allowed (obvious)
|
2017-01-18 08:04:11 +00:00
|
|
|
if( ( viaType == VIA_BLIND_BURIED ) && ( !bds.m_BlindBuriedViaAllowed ) )
|
2015-09-24 09:04:42 +00:00
|
|
|
{
|
2017-08-03 15:53:07 +00:00
|
|
|
DisplayError( frame(), _( "Blind/buried vias have to be enabled in the design settings." ) );
|
2014-11-14 18:15:58 +00:00
|
|
|
return false;
|
2015-09-24 09:04:42 +00:00
|
|
|
}
|
2015-05-18 11:48:11 +00:00
|
|
|
|
2017-01-18 08:04:11 +00:00
|
|
|
if( ( viaType == VIA_MICROVIA ) && ( !bds.m_MicroViasAllowed ) )
|
2015-09-24 09:04:42 +00:00
|
|
|
{
|
2017-08-03 15:53:07 +00:00
|
|
|
DisplayError( frame(), _( "Microvias have to be enabled in the design settings." ) );
|
2014-11-14 18:15:58 +00:00
|
|
|
return false;
|
2015-09-24 09:04:42 +00:00
|
|
|
}
|
2014-11-14 19:19:00 +00:00
|
|
|
|
2015-09-24 09:04:42 +00:00
|
|
|
// Can only place through vias on 2-layer boards
|
2017-01-18 08:04:11 +00:00
|
|
|
if( ( viaType != VIA_THROUGH ) && ( layerCount <= 2 ) )
|
2015-09-24 09:04:42 +00:00
|
|
|
{
|
2017-08-03 15:53:07 +00:00
|
|
|
DisplayError( frame(), _( "Only through vias are allowed on 2 layer boards." ) );
|
2014-11-14 18:15:58 +00:00
|
|
|
return false;
|
2015-09-24 09:04:42 +00:00
|
|
|
}
|
2014-11-14 19:19:00 +00:00
|
|
|
|
2015-09-24 09:04:42 +00:00
|
|
|
// Can only place microvias if we're on an outer layer, or directly adjacent to one
|
2017-01-18 08:04:11 +00:00
|
|
|
if( ( viaType == VIA_MICROVIA ) && ( currentLayer > In1_Cu ) && ( currentLayer < layerCount - 2 ) )
|
2015-09-24 09:04:42 +00:00
|
|
|
{
|
2017-08-03 15:53:07 +00:00
|
|
|
DisplayError( frame(), _( "Microvias can be placed only between the outer layers " \
|
2015-09-24 16:34:22 +00:00
|
|
|
"(F.Cu/B.Cu) and the ones directly adjacent to them." ) );
|
2014-11-14 18:15:58 +00:00
|
|
|
return false;
|
2015-09-24 09:04:42 +00:00
|
|
|
}
|
2015-09-24 16:34:22 +00:00
|
|
|
}
|
2014-11-14 19:19:00 +00:00
|
|
|
|
2015-09-24 16:34:22 +00:00
|
|
|
// Convert blind/buried via to a through hole one, if it goes through all layers
|
2017-01-18 08:04:11 +00:00
|
|
|
if( viaType == VIA_BLIND_BURIED && ( ( currentLayer == B_Cu ) || ( currentLayer == F_Cu ) )
|
2015-09-24 16:34:22 +00:00
|
|
|
&& ( ( pairTop == B_Cu && pairBottom == F_Cu )
|
|
|
|
|| ( pairTop == F_Cu && pairBottom == B_Cu ) ) )
|
|
|
|
{
|
2017-01-18 08:04:11 +00:00
|
|
|
viaType = VIA_THROUGH;
|
2014-05-14 13:53:54 +00:00
|
|
|
}
|
2013-09-18 17:55:16 +00:00
|
|
|
|
2017-01-18 08:04:11 +00:00
|
|
|
switch( viaType )
|
2015-06-18 18:22:23 +00:00
|
|
|
{
|
2015-10-05 16:28:41 +00:00
|
|
|
case VIA_THROUGH:
|
|
|
|
sizes.SetViaDiameter( bds.GetCurrentViaSize() );
|
|
|
|
sizes.SetViaDrill( bds.GetCurrentViaDrill() );
|
2017-03-16 11:20:18 +00:00
|
|
|
|
|
|
|
if( targetLayer != UNDEFINED_LAYER )
|
|
|
|
{
|
|
|
|
// go from the current layer to the chosen layer
|
|
|
|
sizes.AddLayerPair( currentLayer, targetLayer );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// use the default layer pair
|
|
|
|
sizes.AddLayerPair( pairTop, pairBottom );
|
|
|
|
}
|
2015-10-05 16:28:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case VIA_MICROVIA:
|
|
|
|
sizes.SetViaDiameter( bds.GetCurrentMicroViaSize() );
|
|
|
|
sizes.SetViaDrill( bds.GetCurrentMicroViaDrill() );
|
|
|
|
|
2017-03-16 11:20:18 +00:00
|
|
|
wxASSERT_MSG( !selectLayer, "Unexpected select layer for microvia (microvia layers are implicit)" );
|
|
|
|
|
2015-10-05 16:28:41 +00:00
|
|
|
if( currentLayer == F_Cu || currentLayer == In1_Cu )
|
2017-03-16 11:20:18 +00:00
|
|
|
{
|
|
|
|
// front-side microvia
|
2015-10-05 16:28:41 +00:00
|
|
|
sizes.AddLayerPair( F_Cu, In1_Cu );
|
2017-03-16 11:20:18 +00:00
|
|
|
}
|
2015-10-05 16:28:41 +00:00
|
|
|
else if( currentLayer == B_Cu || currentLayer == layerCount - 2 )
|
2017-03-16 11:20:18 +00:00
|
|
|
{
|
|
|
|
// back-side microvia
|
2015-10-05 16:28:41 +00:00
|
|
|
sizes.AddLayerPair( B_Cu, layerCount - 2 );
|
2017-03-16 11:20:18 +00:00
|
|
|
}
|
2015-10-05 16:28:41 +00:00
|
|
|
else
|
2017-03-16 11:20:18 +00:00
|
|
|
{
|
|
|
|
wxASSERT_MSG( false, "Invalid layer pair for microvia (must be on or adjacent to an outer layer)" );
|
|
|
|
}
|
2015-10-05 16:28:41 +00:00
|
|
|
break;
|
2015-09-24 16:34:22 +00:00
|
|
|
|
2015-10-05 16:28:41 +00:00
|
|
|
case VIA_BLIND_BURIED:
|
|
|
|
sizes.SetViaDiameter( bds.GetCurrentViaSize() );
|
|
|
|
sizes.SetViaDrill( bds.GetCurrentViaDrill() );
|
2015-09-24 16:34:22 +00:00
|
|
|
|
2017-03-16 11:20:18 +00:00
|
|
|
if( targetLayer != UNDEFINED_LAYER )
|
|
|
|
{
|
|
|
|
// go directly to the user specified layer
|
|
|
|
sizes.AddLayerPair( currentLayer, targetLayer );
|
|
|
|
}
|
2015-10-05 16:28:41 +00:00
|
|
|
else
|
2017-03-16 11:20:18 +00:00
|
|
|
{
|
|
|
|
if( currentLayer == pairTop || currentLayer == pairBottom )
|
|
|
|
{
|
|
|
|
// the current layer is on the defined layer pair,
|
|
|
|
// swap to the other side
|
|
|
|
sizes.AddLayerPair( pairTop, pairBottom );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// the current layer is not part of the current layer pair,
|
|
|
|
// so fallback and swap to the top layer of the pair by default
|
|
|
|
sizes.AddLayerPair( pairTop, currentLayer );
|
|
|
|
}
|
|
|
|
}
|
2015-10-05 16:28:41 +00:00
|
|
|
break;
|
2015-09-24 16:34:22 +00:00
|
|
|
|
2015-10-05 16:28:41 +00:00
|
|
|
default:
|
|
|
|
wxASSERT( false );
|
|
|
|
break;
|
2015-06-18 18:22:23 +00:00
|
|
|
}
|
2015-07-02 14:09:51 +00:00
|
|
|
|
2017-01-18 08:04:11 +00:00
|
|
|
sizes.SetViaType( viaType );
|
2015-09-24 16:34:22 +00:00
|
|
|
|
2014-11-14 18:15:58 +00:00
|
|
|
m_router->UpdateSizes( sizes );
|
2015-06-18 18:22:23 +00:00
|
|
|
m_router->ToggleViaPlacement();
|
2014-11-14 19:19:00 +00:00
|
|
|
|
2018-07-26 22:35:11 +00:00
|
|
|
if( m_router->RoutingInProgress() )
|
|
|
|
updateEndItem( aEvent );
|
|
|
|
else
|
|
|
|
updateStartItem( aEvent );
|
2015-11-18 14:35:17 +00:00
|
|
|
|
2014-11-14 18:15:58 +00:00
|
|
|
m_router->Move( m_endSnapPoint, m_endItem ); // refresh
|
|
|
|
|
2017-01-18 08:04:11 +00:00
|
|
|
return 0;
|
2014-11-14 18:15:58 +00:00
|
|
|
}
|
|
|
|
|
2015-02-18 00:29:54 +00:00
|
|
|
|
|
|
|
bool ROUTER_TOOL::prepareInteractive()
|
2014-11-14 18:15:58 +00:00
|
|
|
{
|
2015-05-18 11:48:11 +00:00
|
|
|
int routingLayer = getStartLayer( m_startItem );
|
2016-11-13 18:02:44 +00:00
|
|
|
|
|
|
|
if( !IsCopperLayer( routingLayer ) )
|
|
|
|
{
|
2017-08-03 15:53:07 +00:00
|
|
|
DisplayError( frame(), _( "Tracks on Copper layers only" ) );
|
2016-11-13 18:02:44 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-08-03 15:53:07 +00:00
|
|
|
frame()->SetActiveLayer( ToLAYER_ID( routingLayer ) );
|
2014-11-14 18:15:58 +00:00
|
|
|
|
2018-03-16 02:42:38 +00:00
|
|
|
// Force layer visible
|
|
|
|
frame()->GetLayerManager()->SetLayerVisible( routingLayer, true );
|
2013-09-18 17:55:16 +00:00
|
|
|
|
2016-08-29 14:38:11 +00:00
|
|
|
// for some reason I don't understand, GetNetclass() may return null sometimes...
|
2016-11-13 18:02:44 +00:00
|
|
|
if( m_startItem && m_startItem->Net() >= 0 &&
|
|
|
|
m_startItem->Parent() && m_startItem->Parent()->GetNetClass() )
|
2014-09-28 14:44:47 +00:00
|
|
|
{
|
2014-05-14 13:53:54 +00:00
|
|
|
highlightNet( true, m_startItem->Net() );
|
2014-09-28 14:44:47 +00:00
|
|
|
// Update track width and via size shown in main toolbar comboboxes
|
2017-08-03 15:53:07 +00:00
|
|
|
frame()->SetCurrentNetClass( m_startItem->Parent()->GetNetClass()->GetName() );
|
2014-09-28 14:44:47 +00:00
|
|
|
}
|
|
|
|
else
|
2017-08-03 15:53:07 +00:00
|
|
|
frame()->SetCurrentNetClass( NETCLASS::Default );
|
2013-09-26 21:53:54 +00:00
|
|
|
|
2017-08-03 15:53:07 +00:00
|
|
|
controls()->ForceCursorPosition( false );
|
|
|
|
controls()->SetAutoPan( true );
|
2013-09-18 17:55:16 +00:00
|
|
|
|
2016-08-29 17:31:13 +00:00
|
|
|
PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
|
2014-11-14 19:19:00 +00:00
|
|
|
|
2017-08-03 15:53:07 +00:00
|
|
|
sizes.Init( board(), m_startItem );
|
|
|
|
sizes.AddLayerPair( frame()->GetScreen()->m_Route_Layer_TOP,
|
|
|
|
frame()->GetScreen()->m_Route_Layer_BOTTOM );
|
2015-02-18 00:29:54 +00:00
|
|
|
m_router->UpdateSizes( sizes );
|
2015-02-18 16:53:46 +00:00
|
|
|
|
2015-05-18 11:48:11 +00:00
|
|
|
if( !m_router->StartRouting( m_startSnapPoint, m_startItem, routingLayer ) )
|
2015-02-18 00:29:54 +00:00
|
|
|
{
|
2017-08-03 15:53:07 +00:00
|
|
|
DisplayError( frame(), m_router->FailureReason() );
|
2015-05-18 11:48:11 +00:00
|
|
|
highlightNet( false );
|
2018-02-16 08:04:22 +00:00
|
|
|
controls()->SetAutoPan( false );
|
2015-02-18 00:29:54 +00:00
|
|
|
return false;
|
|
|
|
}
|
2013-09-18 17:55:16 +00:00
|
|
|
|
|
|
|
m_endItem = NULL;
|
|
|
|
m_endSnapPoint = m_startSnapPoint;
|
|
|
|
|
2017-08-03 15:53:07 +00:00
|
|
|
frame()->UndoRedoBlock( true );
|
2016-08-15 15:16:50 +00:00
|
|
|
|
2015-02-18 00:29:54 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-05-18 11:48:11 +00:00
|
|
|
|
2015-08-04 21:08:13 +00:00
|
|
|
bool ROUTER_TOOL::finishInteractive()
|
2015-02-18 00:29:54 +00:00
|
|
|
{
|
|
|
|
m_router->StopRouting();
|
|
|
|
|
2017-08-03 15:53:07 +00:00
|
|
|
controls()->SetAutoPan( false );
|
|
|
|
controls()->ForceCursorPosition( false );
|
|
|
|
frame()->UndoRedoBlock( false );
|
2015-02-18 00:29:54 +00:00
|
|
|
highlightNet( false );
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-05-18 11:48:11 +00:00
|
|
|
|
2015-02-18 00:29:54 +00:00
|
|
|
void ROUTER_TOOL::performRouting()
|
|
|
|
{
|
2015-07-10 21:42:05 +00:00
|
|
|
if( !prepareInteractive() )
|
2015-02-18 00:29:54 +00:00
|
|
|
return;
|
|
|
|
|
2013-09-18 17:55:16 +00:00
|
|
|
while( OPT_TOOL_EVENT evt = Wait() )
|
|
|
|
{
|
2017-03-07 12:56:44 +00:00
|
|
|
// Don't crash if we missed an operation that cancelled routing.
|
|
|
|
wxCHECK2( m_router->RoutingInProgress(), break );
|
|
|
|
|
2016-09-23 11:58:33 +00:00
|
|
|
if( evt->IsMotion() )
|
2013-09-26 21:53:54 +00:00
|
|
|
{
|
2015-05-18 11:48:11 +00:00
|
|
|
m_router->SetOrthoMode( evt->Modifier( MD_CTRL ) );
|
2015-11-03 16:19:42 +00:00
|
|
|
updateEndItem( *evt );
|
2013-09-26 21:53:54 +00:00
|
|
|
m_router->Move( m_endSnapPoint, m_endItem );
|
|
|
|
}
|
2018-09-04 07:10:15 +00:00
|
|
|
else if( evt->IsClick( BUT_LEFT ) || evt->IsAction( &ACT_NewTrack ) )
|
2013-09-26 21:53:54 +00:00
|
|
|
{
|
2013-09-18 17:55:16 +00:00
|
|
|
updateEndItem( *evt );
|
2014-11-14 18:15:58 +00:00
|
|
|
bool needLayerSwitch = m_router->IsPlacingVia();
|
2018-06-19 17:29:36 +00:00
|
|
|
bool forceFinish = evt->Modifier( MD_SHIFT );
|
2013-09-26 21:53:54 +00:00
|
|
|
|
|
|
|
|
2018-06-19 17:29:36 +00:00
|
|
|
if( m_router->FixRoute( m_endSnapPoint, m_endItem, forceFinish ) )
|
|
|
|
break;
|
2018-09-04 07:10:15 +00:00
|
|
|
|
2014-11-14 19:19:00 +00:00
|
|
|
if( needLayerSwitch )
|
2014-11-14 18:15:58 +00:00
|
|
|
switchLayerOnViaPlacement();
|
|
|
|
|
2014-07-09 14:50:31 +00:00
|
|
|
// Synchronize the indicated layer
|
2017-08-03 15:53:07 +00:00
|
|
|
frame()->SetActiveLayer( ToLAYER_ID( m_router->GetCurrentLayer() ) );
|
2015-11-03 16:19:42 +00:00
|
|
|
updateEndItem( *evt );
|
2013-09-26 21:53:54 +00:00
|
|
|
m_router->Move( m_endSnapPoint, m_endItem );
|
2015-08-18 09:38:17 +00:00
|
|
|
m_startItem = NULL;
|
2014-05-16 11:37:31 +00:00
|
|
|
}
|
2014-05-14 13:53:54 +00:00
|
|
|
else if( evt->IsAction( &ACT_SwitchPosture ) )
|
2013-09-26 21:53:54 +00:00
|
|
|
{
|
2014-05-14 13:53:54 +00:00
|
|
|
m_router->FlipPosture();
|
2015-11-03 16:19:42 +00:00
|
|
|
updateEndItem( *evt );
|
2014-07-09 14:50:31 +00:00
|
|
|
m_router->Move( m_endSnapPoint, m_endItem ); // refresh
|
2014-05-14 13:53:54 +00:00
|
|
|
}
|
2017-02-21 12:42:08 +00:00
|
|
|
else if( evt->IsAction( &PCB_ACTIONS::layerChanged ) )
|
2014-05-14 13:53:54 +00:00
|
|
|
{
|
2017-08-03 15:53:07 +00:00
|
|
|
m_router->SwitchLayer( frame()->GetActiveLayer() );
|
2015-11-03 16:19:42 +00:00
|
|
|
updateEndItem( *evt );
|
2014-07-09 14:50:31 +00:00
|
|
|
m_router->Move( m_endSnapPoint, m_endItem ); // refresh
|
2014-05-14 13:53:54 +00:00
|
|
|
}
|
|
|
|
else if( evt->IsAction( &ACT_EndTrack ) )
|
|
|
|
{
|
2016-02-12 02:26:40 +00:00
|
|
|
bool still_routing = true;
|
2016-02-12 03:26:03 +00:00
|
|
|
while( still_routing )
|
2016-02-12 02:26:40 +00:00
|
|
|
still_routing = m_router->FixRoute( m_endSnapPoint, m_endItem );
|
|
|
|
break;
|
2013-09-26 21:53:54 +00:00
|
|
|
}
|
2017-02-06 16:00:51 +00:00
|
|
|
else if( TOOL_EVT_UTILS::IsCancelInteractive( *evt )
|
2017-03-07 12:56:44 +00:00
|
|
|
|| evt->IsUndoRedo()
|
|
|
|
|| evt->IsAction( &PCB_ACTIONS::routerInlineDrag ) )
|
2016-09-23 11:58:33 +00:00
|
|
|
break;
|
2013-09-18 17:55:16 +00:00
|
|
|
}
|
|
|
|
|
2015-08-04 21:08:13 +00:00
|
|
|
finishInteractive();
|
2015-02-18 00:29:54 +00:00
|
|
|
}
|
2013-09-26 21:53:54 +00:00
|
|
|
|
2015-05-18 11:48:11 +00:00
|
|
|
|
2015-02-18 00:29:54 +00:00
|
|
|
int ROUTER_TOOL::DpDimensionsDialog( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2016-08-29 17:31:13 +00:00
|
|
|
PNS::SIZES_SETTINGS sizes = m_router->Sizes();
|
2017-08-03 15:53:07 +00:00
|
|
|
DIALOG_PNS_DIFF_PAIR_DIMENSIONS settingsDlg( frame(), sizes );
|
2015-02-18 00:29:54 +00:00
|
|
|
|
2018-06-15 15:12:15 +00:00
|
|
|
if( settingsDlg.ShowModal() == wxID_OK )
|
2014-01-30 16:11:40 +00:00
|
|
|
{
|
2015-02-18 00:29:54 +00:00
|
|
|
m_router->UpdateSizes( sizes );
|
|
|
|
m_savedSizes = sizes;
|
2018-07-22 10:16:40 +00:00
|
|
|
|
|
|
|
BOARD_DESIGN_SETTINGS& bds = frame()->GetBoard()->GetDesignSettings();
|
|
|
|
bds.SetCustomDiffPairWidth( sizes.DiffPairWidth() );
|
|
|
|
bds.SetCustomDiffPairGap( sizes.DiffPairGap() );
|
|
|
|
bds.SetCustomDiffPairViaGap( sizes.DiffPairViaGap() );
|
2015-02-18 16:53:46 +00:00
|
|
|
}
|
2015-02-18 00:29:54 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-05-18 11:48:11 +00:00
|
|
|
|
2015-02-18 00:29:54 +00:00
|
|
|
int ROUTER_TOOL::SettingsDialog( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2017-08-03 15:53:07 +00:00
|
|
|
DIALOG_PNS_SETTINGS settingsDlg( frame(), m_router->Settings() );
|
2015-02-18 00:29:54 +00:00
|
|
|
|
2018-06-15 15:12:15 +00:00
|
|
|
if( settingsDlg.ShowModal() == wxID_OK )
|
2015-02-18 00:29:54 +00:00
|
|
|
m_savedSettings = m_router->Settings();
|
2017-01-18 08:04:11 +00:00
|
|
|
|
2015-02-18 00:29:54 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2014-01-30 10:32:08 +00:00
|
|
|
|
2015-02-18 00:29:54 +00:00
|
|
|
|
2017-07-31 12:30:51 +00:00
|
|
|
void ROUTER_TOOL::setTransitions()
|
2017-01-18 08:04:11 +00:00
|
|
|
{
|
2017-02-21 12:42:08 +00:00
|
|
|
Go( &ROUTER_TOOL::RouteSingleTrace, PCB_ACTIONS::routerActivateSingle.MakeEvent() );
|
|
|
|
Go( &ROUTER_TOOL::RouteDiffPair, PCB_ACTIONS::routerActivateDiffPair.MakeEvent() );
|
|
|
|
Go( &ROUTER_TOOL::DpDimensionsDialog, PCB_ACTIONS::routerActivateDpDimensionsDialog.MakeEvent() );
|
|
|
|
Go( &ROUTER_TOOL::SettingsDialog, PCB_ACTIONS::routerActivateSettingsDialog.MakeEvent() );
|
|
|
|
Go( &ROUTER_TOOL::InlineDrag, PCB_ACTIONS::routerInlineDrag.MakeEvent() );
|
2018-12-14 03:43:51 +00:00
|
|
|
Go( &ROUTER_TOOL::InlineBreakTrack, PCB_ACTIONS::inlineBreakTrack.MakeEvent() );
|
2017-01-18 08:04:11 +00:00
|
|
|
|
|
|
|
Go( &ROUTER_TOOL::onViaCommand, ACT_PlaceThroughVia.MakeEvent() );
|
|
|
|
Go( &ROUTER_TOOL::onViaCommand, ACT_PlaceBlindVia.MakeEvent() );
|
|
|
|
Go( &ROUTER_TOOL::onViaCommand, ACT_PlaceMicroVia.MakeEvent() );
|
2017-03-16 11:20:18 +00:00
|
|
|
Go( &ROUTER_TOOL::onViaCommand, ACT_SelLayerAndPlaceThroughVia.MakeEvent() );
|
|
|
|
Go( &ROUTER_TOOL::onViaCommand, ACT_SelLayerAndPlaceBlindVia.MakeEvent() );
|
2017-01-18 08:04:11 +00:00
|
|
|
|
|
|
|
Go( &ROUTER_TOOL::CustomTrackWidthDialog, ACT_CustomTrackWidth.MakeEvent() );
|
2017-02-21 12:42:08 +00:00
|
|
|
Go( &ROUTER_TOOL::onTrackViaSizeChanged, PCB_ACTIONS::trackViaSizeChanged.MakeEvent() );
|
2017-01-18 08:04:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-18 00:29:54 +00:00
|
|
|
int ROUTER_TOOL::RouteSingleTrace( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2017-08-03 15:53:07 +00:00
|
|
|
frame()->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Route Track" ) );
|
2016-08-29 14:38:11 +00:00
|
|
|
return mainLoop( PNS::PNS_MODE_ROUTE_SINGLE );
|
2013-09-18 17:55:16 +00:00
|
|
|
}
|
|
|
|
|
2015-05-18 11:48:11 +00:00
|
|
|
|
2015-02-18 00:29:54 +00:00
|
|
|
int ROUTER_TOOL::RouteDiffPair( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2017-08-03 15:53:07 +00:00
|
|
|
frame()->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Router Differential Pair" ) );
|
2016-08-29 14:38:11 +00:00
|
|
|
return mainLoop( PNS::PNS_MODE_ROUTE_DIFF_PAIR );
|
2015-02-18 00:29:54 +00:00
|
|
|
}
|
2013-09-18 17:55:16 +00:00
|
|
|
|
2018-02-27 03:15:58 +00:00
|
|
|
|
2017-08-03 15:53:07 +00:00
|
|
|
void ROUTER_TOOL::breakTrack()
|
|
|
|
{
|
2018-02-27 03:15:58 +00:00
|
|
|
if( m_startItem && m_startItem->OfKind( PNS::ITEM::SEGMENT_T ) )
|
2017-08-03 15:53:07 +00:00
|
|
|
{
|
|
|
|
m_router->BreakSegment( m_startItem, m_startSnapPoint );
|
|
|
|
}
|
|
|
|
}
|
2015-05-18 11:48:11 +00:00
|
|
|
|
2018-02-27 03:15:58 +00:00
|
|
|
|
2016-08-29 17:31:13 +00:00
|
|
|
int ROUTER_TOOL::mainLoop( PNS::ROUTER_MODE aMode )
|
2013-09-18 17:55:16 +00:00
|
|
|
{
|
2014-11-14 18:15:58 +00:00
|
|
|
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
|
2013-09-18 17:55:16 +00:00
|
|
|
|
2014-05-14 17:15:25 +00:00
|
|
|
// Deselect all items
|
2017-02-21 12:42:08 +00:00
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
2014-05-14 17:15:25 +00:00
|
|
|
|
2015-02-18 00:29:54 +00:00
|
|
|
Activate();
|
2013-09-18 17:55:16 +00:00
|
|
|
|
2015-05-18 11:48:11 +00:00
|
|
|
m_router->SetMode( aMode );
|
2015-02-18 16:53:46 +00:00
|
|
|
|
2018-02-14 16:34:30 +00:00
|
|
|
VIEW_CONTROLS* ctls = getViewControls();
|
|
|
|
ctls->ShowCursor( true );
|
|
|
|
ctls->ForceCursorPosition( false );
|
|
|
|
m_startSnapPoint = ctls->GetCursorPosition();
|
2015-07-07 16:36:45 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
std::unique_ptr<ROUTER_TOOL_MENU> ctxMenu( new ROUTER_TOOL_MENU( *frame, aMode ) );
|
2015-05-18 11:48:11 +00:00
|
|
|
SetContextMenu( ctxMenu.get() );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2013-09-18 17:55:16 +00:00
|
|
|
// Main loop: keep receiving events
|
|
|
|
while( OPT_TOOL_EVENT evt = Wait() )
|
|
|
|
{
|
2017-02-06 16:00:51 +00:00
|
|
|
if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )
|
2016-08-15 15:16:50 +00:00
|
|
|
{
|
2013-09-26 21:53:54 +00:00
|
|
|
break; // Finish
|
2016-08-15 15:16:50 +00:00
|
|
|
}
|
2016-09-23 09:31:36 +00:00
|
|
|
else if( evt->Action() == TA_UNDO_REDO_PRE )
|
|
|
|
{
|
|
|
|
m_router->ClearWorld();
|
|
|
|
}
|
2016-11-28 14:45:37 +00:00
|
|
|
else if( evt->Action() == TA_UNDO_REDO_POST || evt->Action() == TA_MODEL_CHANGE )
|
2016-08-15 15:16:50 +00:00
|
|
|
{
|
|
|
|
m_router->SyncWorld();
|
|
|
|
}
|
2013-09-26 21:53:54 +00:00
|
|
|
else if( evt->IsMotion() )
|
2016-08-15 15:16:50 +00:00
|
|
|
{
|
2013-09-18 17:55:16 +00:00
|
|
|
updateStartItem( *evt );
|
2016-08-15 15:16:50 +00:00
|
|
|
}
|
2017-08-03 15:53:07 +00:00
|
|
|
else if( evt->IsAction( &PCB_ACTIONS::dragFreeAngle ) )
|
|
|
|
{
|
2018-03-16 18:00:57 +00:00
|
|
|
updateStartItem( *evt, true );
|
2017-08-03 15:53:07 +00:00
|
|
|
performDragging( PNS::DM_ANY | PNS::DM_FREE_ANGLE );
|
|
|
|
}
|
|
|
|
else if( evt->IsAction( &PCB_ACTIONS::drag45Degree ) )
|
|
|
|
{
|
2018-03-16 18:00:57 +00:00
|
|
|
updateStartItem( *evt, true );
|
2017-08-03 15:53:07 +00:00
|
|
|
performDragging( PNS::DM_ANY );
|
|
|
|
}
|
|
|
|
else if( evt->IsAction( &PCB_ACTIONS::breakTrack ) )
|
|
|
|
{
|
2018-03-16 18:00:57 +00:00
|
|
|
updateStartItem( *evt, true );
|
2017-08-03 15:53:07 +00:00
|
|
|
breakTrack( );
|
|
|
|
}
|
2014-05-14 13:53:54 +00:00
|
|
|
else if( evt->IsClick( BUT_LEFT ) || evt->IsAction( &ACT_NewTrack ) )
|
2013-09-18 17:55:16 +00:00
|
|
|
{
|
|
|
|
updateStartItem( *evt );
|
|
|
|
|
2014-05-14 13:53:54 +00:00
|
|
|
if( evt->Modifier( MD_CTRL ) )
|
2017-08-03 15:53:07 +00:00
|
|
|
performDragging( PNS::DM_ANY );
|
2014-05-14 13:53:54 +00:00
|
|
|
else
|
|
|
|
performRouting();
|
2014-07-09 11:50:27 +00:00
|
|
|
}
|
2015-09-03 16:25:48 +00:00
|
|
|
else if( evt->IsAction( &ACT_PlaceThroughVia ) )
|
|
|
|
{
|
2017-02-21 12:42:08 +00:00
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::layerToggle, true );
|
2015-09-03 16:25:48 +00:00
|
|
|
}
|
2014-05-14 13:53:54 +00:00
|
|
|
}
|
2013-09-18 17:55:16 +00:00
|
|
|
|
2017-06-12 13:10:43 +00:00
|
|
|
frame->SetNoToolSelected();
|
2017-02-24 11:53:37 +00:00
|
|
|
SetContextMenu( nullptr );
|
2014-02-19 12:51:32 +00:00
|
|
|
|
2014-05-14 16:45:59 +00:00
|
|
|
// Store routing settings till the next invocation
|
2015-02-18 00:29:54 +00:00
|
|
|
m_savedSettings = m_router->Settings();
|
|
|
|
m_savedSizes = m_router->Sizes();
|
2014-05-14 13:53:54 +00:00
|
|
|
|
2013-09-18 17:55:16 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2014-05-14 13:53:54 +00:00
|
|
|
|
2015-05-18 11:48:11 +00:00
|
|
|
|
2017-08-03 15:53:07 +00:00
|
|
|
void ROUTER_TOOL::performDragging( int aMode )
|
2014-05-14 13:53:54 +00:00
|
|
|
{
|
|
|
|
VIEW_CONTROLS* ctls = getViewControls();
|
|
|
|
|
2016-08-15 15:16:53 +00:00
|
|
|
if( m_startItem && m_startItem->IsLocked() )
|
2016-08-15 15:16:50 +00:00
|
|
|
{
|
2018-07-10 14:33:04 +00:00
|
|
|
KIDIALOG dlg( frame(), _( "The selected item is locked." ), _( "Confirmation" ),
|
|
|
|
wxOK | wxCANCEL | wxICON_WARNING );
|
|
|
|
dlg.SetOKLabel( _( "Drag Anyway" ) );
|
2018-08-29 22:37:20 +00:00
|
|
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
2018-07-10 14:33:04 +00:00
|
|
|
|
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
2016-08-15 15:16:50 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-08-03 15:53:07 +00:00
|
|
|
bool dragStarted = m_router->StartDragging( m_startSnapPoint, m_startItem, aMode );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2014-05-16 11:37:31 +00:00
|
|
|
if( !dragStarted )
|
2014-05-14 13:53:54 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if( m_startItem && m_startItem->Net() >= 0 )
|
|
|
|
highlightNet( true, m_startItem->Net() );
|
|
|
|
|
|
|
|
ctls->SetAutoPan( true );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2017-08-03 15:53:07 +00:00
|
|
|
frame()->UndoRedoBlock( true );
|
2016-09-29 16:59:11 +00:00
|
|
|
|
2014-05-14 13:53:54 +00:00
|
|
|
while( OPT_TOOL_EVENT evt = Wait() )
|
|
|
|
{
|
2015-11-03 16:19:42 +00:00
|
|
|
ctls->ForceCursorPosition( false );
|
|
|
|
|
2016-09-23 11:58:33 +00:00
|
|
|
if( evt->IsMotion() )
|
2014-05-14 13:53:54 +00:00
|
|
|
{
|
|
|
|
updateEndItem( *evt );
|
|
|
|
m_router->Move( m_endSnapPoint, m_endItem );
|
|
|
|
}
|
|
|
|
else if( evt->IsClick( BUT_LEFT ) )
|
|
|
|
{
|
|
|
|
if( m_router->FixRoute( m_endSnapPoint, m_endItem ) )
|
|
|
|
break;
|
|
|
|
}
|
2018-11-19 15:54:36 +00:00
|
|
|
else if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) || evt->IsUndoRedo() )
|
|
|
|
{
|
2016-09-23 11:58:33 +00:00
|
|
|
break;
|
2018-11-19 15:54:36 +00:00
|
|
|
}
|
2014-05-16 11:37:31 +00:00
|
|
|
|
|
|
|
handleCommonEvents( *evt );
|
2014-05-14 13:53:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( m_router->RoutingInProgress() )
|
|
|
|
m_router->StopRouting();
|
|
|
|
|
2017-08-29 16:47:55 +00:00
|
|
|
m_startItem = nullptr;
|
2015-08-04 09:37:16 +00:00
|
|
|
|
2017-08-03 15:53:07 +00:00
|
|
|
frame()->UndoRedoBlock( false );
|
2014-05-14 13:53:54 +00:00
|
|
|
ctls->SetAutoPan( false );
|
|
|
|
ctls->ForceCursorPosition( false );
|
|
|
|
highlightNet( false );
|
|
|
|
}
|
2015-02-18 00:29:54 +00:00
|
|
|
|
2015-05-18 11:48:11 +00:00
|
|
|
|
2018-01-05 23:44:37 +00:00
|
|
|
void ROUTER_TOOL::NeighboringSegmentFilter( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
|
|
|
|
{
|
2018-09-23 22:35:37 +00:00
|
|
|
/*
|
|
|
|
* If the collection contains a trivial line corner (two connected segments)
|
2018-01-05 23:44:37 +00:00
|
|
|
* or a non-fanout-via (a via with no more than two connected segments), then
|
|
|
|
* trim the collection down to a single item (which one won't matter since
|
|
|
|
* they're all connected).
|
|
|
|
*/
|
|
|
|
|
|
|
|
// First make sure we've got something that *might* match.
|
|
|
|
int vias = aCollector.CountType( PCB_VIA_T );
|
|
|
|
int traces = aCollector.CountType( PCB_TRACE_T );
|
|
|
|
|
|
|
|
if( vias > 1 || traces > 2 || vias + traces < 1 )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Fetch first TRACK (via or trace) as our reference
|
|
|
|
TRACK* reference = nullptr;
|
|
|
|
|
|
|
|
for( int i = 0; !reference && i < aCollector.GetCount(); i++ )
|
|
|
|
reference = dynamic_cast<TRACK*>( aCollector[i] );
|
|
|
|
|
|
|
|
int refNet = reference->GetNetCode();
|
|
|
|
|
2018-09-23 22:35:37 +00:00
|
|
|
wxPoint refPoint( aPt.x, aPt.y );
|
|
|
|
STATUS_FLAGS flags = reference->IsPointOnEnds( refPoint, -1 );
|
2018-01-05 23:44:37 +00:00
|
|
|
|
|
|
|
if( flags & STARTPOINT )
|
|
|
|
refPoint = reference->GetStart();
|
|
|
|
else if( flags & ENDPOINT )
|
|
|
|
refPoint = reference->GetEnd();
|
|
|
|
|
2018-09-23 22:35:37 +00:00
|
|
|
// Check all items to ensure that any TRACKs are co-terminus with the reference and on
|
|
|
|
// the same net.
|
2018-01-05 23:44:37 +00:00
|
|
|
for( int i = 0; i < aCollector.GetCount(); i++ )
|
|
|
|
{
|
2018-09-23 22:35:37 +00:00
|
|
|
TRACK* neighbor = dynamic_cast<TRACK*>( aCollector[i] );
|
2018-01-05 23:44:37 +00:00
|
|
|
|
2018-09-23 22:35:37 +00:00
|
|
|
if( neighbor && neighbor != reference )
|
|
|
|
{
|
|
|
|
if( neighbor->GetNetCode() != refNet )
|
|
|
|
return;
|
2018-01-05 23:44:37 +00:00
|
|
|
|
2018-09-23 22:35:37 +00:00
|
|
|
if( neighbor->GetStart() != refPoint && neighbor->GetEnd() != refPoint )
|
|
|
|
return;
|
|
|
|
}
|
2018-01-05 23:44:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Selection meets criteria; trim it to the reference item.
|
2018-09-23 22:35:37 +00:00
|
|
|
aCollector.Empty();
|
|
|
|
aCollector.Append( reference );
|
2018-01-05 23:44:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ROUTER_TOOL::CanInlineDrag()
|
|
|
|
{
|
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true, NeighboringSegmentFilter );
|
|
|
|
const auto& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
|
|
|
|
|
|
|
|
if( selection.Size() == 1 )
|
|
|
|
{
|
|
|
|
const BOARD_CONNECTED_ITEM* item = static_cast<const BOARD_CONNECTED_ITEM*>( selection.Front() );
|
2018-02-14 14:33:15 +00:00
|
|
|
|
2018-01-05 23:44:37 +00:00
|
|
|
if( item->Type() == PCB_TRACE_T || item->Type() == PCB_VIA_T )
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-18 11:48:11 +00:00
|
|
|
int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
|
2015-02-18 00:29:54 +00:00
|
|
|
{
|
2017-02-09 11:03:07 +00:00
|
|
|
const auto& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
|
2015-07-02 14:09:56 +00:00
|
|
|
|
2018-02-14 14:33:15 +00:00
|
|
|
if( selection.Empty() )
|
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true, NeighboringSegmentFilter );
|
|
|
|
|
2017-02-09 11:03:07 +00:00
|
|
|
if( selection.Size() != 1 )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
const BOARD_CONNECTED_ITEM* item = static_cast<const BOARD_CONNECTED_ITEM*>( selection.Front() );
|
|
|
|
|
|
|
|
if( item->Type() != PCB_TRACE_T && item->Type() != PCB_VIA_T )
|
|
|
|
return 0;
|
2015-07-02 14:09:56 +00:00
|
|
|
|
|
|
|
Activate();
|
|
|
|
|
2017-02-21 12:42:08 +00:00
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
2015-07-02 14:09:56 +00:00
|
|
|
m_router->SyncWorld();
|
|
|
|
m_startItem = m_router->GetWorld()->FindItemByParent( item );
|
|
|
|
|
2016-08-15 15:16:53 +00:00
|
|
|
if( m_startItem && m_startItem->IsLocked() )
|
2016-08-15 15:16:50 +00:00
|
|
|
{
|
2018-07-10 14:33:04 +00:00
|
|
|
KIDIALOG dlg( frame(), _( "The selected item is locked." ), _( "Confirmation" ),
|
|
|
|
wxOK | wxCANCEL | wxICON_WARNING );
|
|
|
|
dlg.SetOKLabel( _( "Drag Anyway" ) );
|
2018-08-29 22:37:20 +00:00
|
|
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
2018-07-10 14:33:04 +00:00
|
|
|
|
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
|
|
|
return 0;
|
2016-08-15 15:16:50 +00:00
|
|
|
}
|
|
|
|
|
2017-08-03 15:53:07 +00:00
|
|
|
VECTOR2I p0 = controls()->GetCursorPosition();
|
|
|
|
|
|
|
|
int dragMode = aEvent.Parameter<int64_t> ();
|
2015-07-02 14:09:56 +00:00
|
|
|
|
2017-08-03 15:53:07 +00:00
|
|
|
bool dragStarted = m_router->StartDragging( p0, m_startItem, dragMode );
|
2015-07-02 14:09:56 +00:00
|
|
|
|
|
|
|
if( !dragStarted )
|
|
|
|
return 0;
|
|
|
|
|
2017-08-03 15:53:07 +00:00
|
|
|
controls()->ShowCursor( true );
|
|
|
|
controls()->ForceCursorPosition( false );
|
|
|
|
controls()->SetAutoPan( true );
|
|
|
|
frame()->UndoRedoBlock( true );
|
2015-07-02 14:09:56 +00:00
|
|
|
|
|
|
|
while( OPT_TOOL_EVENT evt = Wait() )
|
|
|
|
{
|
|
|
|
if( evt->IsCancel() )
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) )
|
|
|
|
{
|
2016-09-29 16:59:11 +00:00
|
|
|
updateEndItem( *evt );
|
|
|
|
m_router->Move( m_endSnapPoint, m_endItem );
|
2015-07-02 14:09:56 +00:00
|
|
|
}
|
|
|
|
else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
|
|
|
|
{
|
2016-09-29 16:59:11 +00:00
|
|
|
updateEndItem( *evt );
|
|
|
|
m_router->FixRoute( m_endSnapPoint, m_endItem );
|
2015-07-02 14:09:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-10 10:14:27 +00:00
|
|
|
if( m_router->RoutingInProgress() )
|
|
|
|
m_router->StopRouting();
|
|
|
|
|
2018-06-13 04:11:21 +00:00
|
|
|
controls()->SetAutoPan( false );
|
|
|
|
controls()->ForceCursorPosition( false );
|
2017-08-03 15:53:07 +00:00
|
|
|
frame()->UndoRedoBlock( false );
|
2015-07-02 14:09:56 +00:00
|
|
|
|
2015-02-18 00:29:54 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2017-01-18 08:04:11 +00:00
|
|
|
|
|
|
|
|
2018-12-14 03:43:51 +00:00
|
|
|
int ROUTER_TOOL::InlineBreakTrack( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
const auto& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
|
|
|
|
|
|
|
|
if( selection.Size() != 1 )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
const BOARD_CONNECTED_ITEM* item = static_cast<const BOARD_CONNECTED_ITEM*>( selection.Front() );
|
|
|
|
|
|
|
|
if( item->Type() != PCB_TRACE_T )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
Init();
|
|
|
|
Activate();
|
|
|
|
|
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
|
|
|
m_router->SyncWorld();
|
|
|
|
m_startItem = m_router->GetWorld()->FindItemByParent( item );
|
|
|
|
m_startSnapPoint = snapToItem( true, m_startItem, controls()->GetCursorPosition() );
|
|
|
|
|
|
|
|
|
|
|
|
if( m_startItem && m_startItem->IsLocked() )
|
|
|
|
{
|
|
|
|
KIDIALOG dlg( frame(), _( "The selected item is locked." ), _( "Confirmation" ),
|
|
|
|
wxOK | wxCANCEL | wxICON_WARNING );
|
|
|
|
dlg.SetOKLabel( _( "Break Track" ) );
|
|
|
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
|
|
|
|
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
frame()->UndoRedoBlock( true );
|
|
|
|
breakTrack();
|
|
|
|
|
|
|
|
if( m_router->RoutingInProgress() )
|
|
|
|
m_router->StopRouting();
|
|
|
|
|
|
|
|
frame()->UndoRedoBlock( false );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-01-18 08:04:11 +00:00
|
|
|
int ROUTER_TOOL::CustomTrackWidthDialog( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2017-08-03 15:53:07 +00:00
|
|
|
BOARD_DESIGN_SETTINGS& bds = board()->GetDesignSettings();
|
|
|
|
DIALOG_TRACK_VIA_SIZE sizeDlg( frame(), bds );
|
2017-01-18 08:04:11 +00:00
|
|
|
|
|
|
|
if( sizeDlg.ShowModal() )
|
|
|
|
{
|
|
|
|
bds.UseCustomTrackViaSize( true );
|
2017-02-21 12:42:08 +00:00
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::trackViaSizeChanged );
|
2017-01-18 08:04:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int ROUTER_TOOL::onTrackViaSizeChanged( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
|
2017-08-03 15:53:07 +00:00
|
|
|
sizes.ImportCurrent( board()->GetDesignSettings() );
|
2017-01-18 08:04:11 +00:00
|
|
|
m_router->UpdateSizes( sizes );
|
|
|
|
|
2018-11-24 19:50:51 +00:00
|
|
|
//Changing the track width can affect the placement, so call the
|
|
|
|
// move routine without changing the destination
|
|
|
|
m_router->Move( m_endSnapPoint, m_endItem );
|
|
|
|
|
2017-01-18 08:04:11 +00:00
|
|
|
return 0;
|
|
|
|
}
|