2015-02-18 00:29:54 +00:00
|
|
|
/*
|
|
|
|
* KiRouter - a push-and-(sometimes-)shove PCB router
|
|
|
|
*
|
2017-01-18 08:04:11 +00:00
|
|
|
* Copyright (C) 2013-2017 CERN
|
2022-09-04 20:04:17 +00:00
|
|
|
* Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
2015-02-18 00:29:54 +00:00
|
|
|
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2022-09-04 20:04:17 +00:00
|
|
|
#include <class_draw_panel_gal.h>
|
2015-02-18 00:29:54 +00:00
|
|
|
#include <dialogs/dialog_pns_length_tuning_settings.h>
|
2015-05-05 18:39:41 +00:00
|
|
|
#include <tool/tool_manager.h>
|
2017-02-21 12:42:08 +00:00
|
|
|
#include <tools/pcb_actions.h>
|
2022-11-14 23:39:08 +00:00
|
|
|
#include <tools/zone_filler_tool.h>
|
2015-02-18 00:29:54 +00:00
|
|
|
#include "pns_router.h"
|
|
|
|
#include "pns_meander_placer.h" // fixme: move settings to separate header
|
|
|
|
#include "pns_tune_status_popup.h"
|
|
|
|
|
|
|
|
#include "length_tuner_tool.h"
|
2017-12-14 13:33:20 +00:00
|
|
|
#include <bitmaps.h>
|
2018-08-01 16:58:27 +00:00
|
|
|
#include <tools/tool_event_utils.h>
|
2015-02-18 00:29:54 +00:00
|
|
|
|
|
|
|
using namespace KIGFX;
|
|
|
|
|
2019-06-17 00:34:21 +00:00
|
|
|
// Actions, being statically-defined, require specialized I18N handling. We continue to
|
|
|
|
// use the _() macro so that string harvesting by the I18N framework doesn't have to be
|
|
|
|
// specialized, but we don't translate on initialization and instead do it in the getters.
|
|
|
|
|
|
|
|
#undef _
|
|
|
|
#define _(s) s
|
|
|
|
|
|
|
|
static TOOL_ACTION ACT_StartTuning( "pcbnew.LengthTuner.StartTuning",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_CONTEXT,
|
|
|
|
'X', LEGACY_HK_NAME( "Add New Track" ),
|
|
|
|
_( "New Track" ), _( "Starts laying a new track." ) );
|
|
|
|
|
2019-12-12 08:39:51 +00:00
|
|
|
static TOOL_ACTION ACT_EndTuning( "pcbnew.LengthTuner.EndTuning",
|
2019-06-11 12:58:36 +00:00
|
|
|
AS_CONTEXT,
|
|
|
|
WXK_END, LEGACY_HK_NAME( "Stop laying the current track." ),
|
2019-06-09 21:57:23 +00:00
|
|
|
_( "End Track" ), _( "Stops laying the current meander." ) );
|
|
|
|
|
2019-12-12 08:39:51 +00:00
|
|
|
static TOOL_ACTION ACT_SpacingIncrease( "pcbnew.LengthTuner.SpacingIncrease",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_CONTEXT,
|
|
|
|
'1', LEGACY_HK_NAME( "Increase meander spacing by one step." ),
|
|
|
|
_( "Increase Spacing" ), _( "Increase meander spacing by one step." ),
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS::router_len_tuner_dist_incr );
|
2019-06-09 21:57:23 +00:00
|
|
|
|
2019-12-12 08:39:51 +00:00
|
|
|
static TOOL_ACTION ACT_SpacingDecrease( "pcbnew.LengthTuner.SpacingDecrease",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_CONTEXT,
|
|
|
|
'2', LEGACY_HK_NAME( "Decrease meander spacing by one step." ),
|
|
|
|
_( "Decrease Spacing" ), _( "Decrease meander spacing by one step." ),
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS::router_len_tuner_dist_decr );
|
2019-06-09 21:57:23 +00:00
|
|
|
|
2019-12-12 08:39:51 +00:00
|
|
|
static TOOL_ACTION ACT_AmplIncrease( "pcbnew.LengthTuner.AmplIncrease",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_CONTEXT,
|
|
|
|
'3', LEGACY_HK_NAME( "Increase meander amplitude by one step." ),
|
|
|
|
_( "Increase Amplitude" ), _( "Increase meander amplitude by one step." ),
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS::router_len_tuner_amplitude_incr );
|
2019-06-09 21:57:23 +00:00
|
|
|
|
2019-12-12 08:39:51 +00:00
|
|
|
static TOOL_ACTION ACT_AmplDecrease( "pcbnew.LengthTuner.AmplDecrease",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_CONTEXT,
|
|
|
|
'4', LEGACY_HK_NAME( "Decrease meander amplitude by one step." ),
|
|
|
|
_( "Decrease Amplitude" ), _( "Decrease meander amplitude by one step." ),
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS::router_len_tuner_amplitude_decr );
|
2015-02-18 00:29:54 +00:00
|
|
|
|
2019-06-17 00:34:21 +00:00
|
|
|
#undef _
|
|
|
|
#define _(s) wxGetTranslation((s))
|
|
|
|
|
2015-02-18 00:29:54 +00:00
|
|
|
|
|
|
|
LENGTH_TUNER_TOOL::LENGTH_TUNER_TOOL() :
|
2016-08-29 17:31:13 +00:00
|
|
|
TOOL_BASE( "pcbnew.LengthTuner" )
|
2015-02-18 00:29:54 +00:00
|
|
|
{
|
2021-07-19 23:56:05 +00:00
|
|
|
// set the initial tune mode for the settings dialog,
|
2021-05-11 15:22:42 +00:00
|
|
|
// in case the dialog is opened before the tool is activated the first time
|
|
|
|
m_lastTuneMode = PNS::ROUTER_MODE::PNS_MODE_TUNE_SINGLE;
|
2015-02-18 00:29:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-24 22:48:46 +00:00
|
|
|
LENGTH_TUNER_TOOL::~LENGTH_TUNER_TOOL()
|
2015-02-18 00:29:54 +00:00
|
|
|
{
|
2020-09-24 22:48:46 +00:00
|
|
|
}
|
2015-02-18 16:53:46 +00:00
|
|
|
|
2015-02-18 00:29:54 +00:00
|
|
|
|
2020-09-24 22:48:46 +00:00
|
|
|
bool LENGTH_TUNER_TOOL::Init()
|
|
|
|
{
|
|
|
|
auto& menu = m_menu.GetMenu();
|
2015-02-18 00:29:54 +00:00
|
|
|
|
2020-09-24 22:48:46 +00:00
|
|
|
menu.SetTitle( _( "Length Tuner" ) );
|
2021-03-08 02:59:07 +00:00
|
|
|
menu.SetIcon( BITMAPS::router_len_tuner );
|
2020-09-24 22:48:46 +00:00
|
|
|
menu.DisplayTitle( true );
|
2017-01-20 17:33:11 +00:00
|
|
|
|
2021-05-11 15:22:42 +00:00
|
|
|
menu.AddItem( ACTIONS::cancelInteractive, SELECTION_CONDITIONS::ShowAlways );
|
2015-02-18 00:29:54 +00:00
|
|
|
|
2020-09-24 22:48:46 +00:00
|
|
|
menu.AddSeparator();
|
2015-02-18 00:29:54 +00:00
|
|
|
|
2021-05-11 15:22:42 +00:00
|
|
|
menu.AddItem( ACT_SpacingIncrease, SELECTION_CONDITIONS::ShowAlways );
|
|
|
|
menu.AddItem( ACT_SpacingDecrease, SELECTION_CONDITIONS::ShowAlways );
|
|
|
|
menu.AddItem( ACT_AmplIncrease, SELECTION_CONDITIONS::ShowAlways );
|
|
|
|
menu.AddItem( ACT_AmplDecrease, SELECTION_CONDITIONS::ShowAlways );
|
|
|
|
menu.AddItem( PCB_ACTIONS::lengthTunerSettingsDialog, SELECTION_CONDITIONS::ShowAlways );
|
2015-02-18 00:29:54 +00:00
|
|
|
|
2020-09-24 22:48:46 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-02-18 16:53:46 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2015-02-18 00:29:54 +00:00
|
|
|
void LENGTH_TUNER_TOOL::Reset( RESET_REASON aReason )
|
|
|
|
{
|
2018-04-24 23:28:13 +00:00
|
|
|
if( aReason == RUN )
|
|
|
|
TOOL_BASE::Reset( aReason );
|
2015-02-18 00:29:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-03-05 09:02:29 +00:00
|
|
|
void LENGTH_TUNER_TOOL::updateStatusPopup( PNS_TUNE_STATUS_POPUP& aPopup )
|
|
|
|
{
|
2018-12-23 17:57:40 +00:00
|
|
|
// fixme: wx code not allowed inside tools!
|
2015-03-09 10:06:54 +00:00
|
|
|
wxPoint p = wxGetMousePosition();
|
2015-03-05 09:02:29 +00:00
|
|
|
|
|
|
|
p.x += 20;
|
|
|
|
p.y += 20;
|
|
|
|
|
2015-03-09 10:06:54 +00:00
|
|
|
aPopup.UpdateStatus( m_router );
|
2015-03-05 09:02:29 +00:00
|
|
|
aPopup.Move( p );
|
|
|
|
}
|
2015-02-18 16:53:46 +00:00
|
|
|
|
2017-01-18 08:04:11 +00:00
|
|
|
|
2015-02-18 00:29:54 +00:00
|
|
|
void LENGTH_TUNER_TOOL::performTuning()
|
|
|
|
{
|
2015-02-18 16:53:46 +00:00
|
|
|
if( m_startItem )
|
2015-02-18 00:29:54 +00:00
|
|
|
{
|
2017-08-03 15:53:07 +00:00
|
|
|
frame()->SetActiveLayer( ToLAYER_ID ( m_startItem->Layers().Start() ) );
|
2015-02-18 00:29:54 +00:00
|
|
|
|
|
|
|
if( m_startItem->Net() >= 0 )
|
2022-12-06 02:24:09 +00:00
|
|
|
highlightNets( true, { m_startItem->Net() } );
|
2015-02-18 00:29:54 +00:00
|
|
|
}
|
|
|
|
|
2017-08-03 15:53:07 +00:00
|
|
|
controls()->ForceCursorPosition( false );
|
|
|
|
controls()->SetAutoPan( true );
|
2015-02-18 00:29:54 +00:00
|
|
|
|
2021-04-05 01:51:10 +00:00
|
|
|
int layer = m_startItem ? m_startItem->Layer() : static_cast<int>( frame()->GetActiveLayer() );
|
|
|
|
|
|
|
|
if( !m_router->StartRouting( m_startSnapPoint, m_startItem, layer ) )
|
2015-02-18 00:29:54 +00:00
|
|
|
{
|
2021-01-03 03:14:10 +00:00
|
|
|
frame()->ShowInfoBarMsg( m_router->FailureReason() );
|
2022-12-06 02:24:09 +00:00
|
|
|
highlightNets( false );
|
2015-02-18 00:29:54 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-05-20 13:08:06 +00:00
|
|
|
auto placer = static_cast<PNS::MEANDER_PLACER_BASE*>( m_router->Placer() );
|
2015-03-09 10:06:54 +00:00
|
|
|
|
2015-03-05 09:02:29 +00:00
|
|
|
placer->UpdateSettings( m_savedMeanderSettings );
|
2021-02-08 12:50:29 +00:00
|
|
|
frame()->UndoRedoBlock( true );
|
2015-03-05 09:02:29 +00:00
|
|
|
|
2020-08-08 15:21:14 +00:00
|
|
|
VECTOR2I end = getViewControls()->GetMousePosition();
|
2015-03-05 09:02:29 +00:00
|
|
|
|
2019-12-12 08:39:51 +00:00
|
|
|
// Create an instance of PNS_TUNE_STATUS_POPUP.
|
2020-02-03 14:02:25 +00:00
|
|
|
PNS_TUNE_STATUS_POPUP statusPopup( frame() );
|
|
|
|
statusPopup.Popup();
|
2022-09-04 20:04:17 +00:00
|
|
|
canvas()->SetStatusPopup( statusPopup.GetPanel() );
|
2015-03-04 19:22:33 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
m_router->Move( end, nullptr );
|
2020-02-03 14:02:25 +00:00
|
|
|
updateStatusPopup( statusPopup );
|
2015-02-18 00:29:54 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
auto setCursor =
|
|
|
|
[&]()
|
|
|
|
{
|
2020-10-08 02:47:01 +00:00
|
|
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
|
|
|
};
|
|
|
|
|
|
|
|
// Set initial cursor
|
|
|
|
setCursor();
|
|
|
|
|
2019-06-17 13:43:22 +00:00
|
|
|
while( TOOL_EVENT* evt = Wait() )
|
2015-02-18 00:29:54 +00:00
|
|
|
{
|
2020-10-08 02:47:01 +00:00
|
|
|
setCursor();
|
2019-06-27 21:33:48 +00:00
|
|
|
|
2019-07-01 21:01:33 +00:00
|
|
|
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
2020-09-24 22:48:46 +00:00
|
|
|
{
|
2015-02-18 00:29:54 +00:00
|
|
|
break;
|
2020-09-24 22:48:46 +00:00
|
|
|
}
|
2015-02-18 00:29:54 +00:00
|
|
|
else if( evt->IsMotion() )
|
|
|
|
{
|
|
|
|
end = evt->Position();
|
2021-07-19 23:56:05 +00:00
|
|
|
m_router->Move( end, nullptr );
|
2020-02-03 14:02:25 +00:00
|
|
|
updateStatusPopup( statusPopup );
|
2015-02-18 00:29:54 +00:00
|
|
|
}
|
|
|
|
else if( evt->IsClick( BUT_LEFT ) )
|
|
|
|
{
|
2021-07-19 23:56:05 +00:00
|
|
|
if( m_router->FixRoute( evt->Position(), nullptr ) )
|
2015-02-18 00:29:54 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-09-24 22:48:46 +00:00
|
|
|
else if( evt->IsClick( BUT_RIGHT ) )
|
|
|
|
{
|
|
|
|
m_menu.ShowContextMenu( selection() );
|
|
|
|
}
|
2015-02-18 00:29:54 +00:00
|
|
|
else if( evt->IsAction( &ACT_EndTuning ) )
|
|
|
|
{
|
2021-07-19 23:56:05 +00:00
|
|
|
if( m_router->FixRoute( end, nullptr ) )
|
2015-02-18 00:29:54 +00:00
|
|
|
break;
|
2015-02-18 16:53:46 +00:00
|
|
|
}
|
|
|
|
else if( evt->IsAction( &ACT_AmplDecrease ) )
|
|
|
|
{
|
2015-02-18 00:29:54 +00:00
|
|
|
placer->AmplitudeStep( -1 );
|
2021-07-19 23:56:05 +00:00
|
|
|
m_router->Move( end, nullptr );
|
2020-02-03 14:02:25 +00:00
|
|
|
updateStatusPopup( statusPopup );
|
2015-02-18 16:53:46 +00:00
|
|
|
}
|
|
|
|
else if( evt->IsAction( &ACT_AmplIncrease ) )
|
|
|
|
{
|
2015-02-18 00:29:54 +00:00
|
|
|
placer->AmplitudeStep( 1 );
|
2021-07-19 23:56:05 +00:00
|
|
|
m_router->Move( end, nullptr );
|
2020-02-03 14:02:25 +00:00
|
|
|
updateStatusPopup( statusPopup );
|
2015-02-18 16:53:46 +00:00
|
|
|
}
|
|
|
|
else if(evt->IsAction( &ACT_SpacingDecrease ) )
|
|
|
|
{
|
2015-02-18 00:29:54 +00:00
|
|
|
placer->SpacingStep( -1 );
|
2021-07-19 23:56:05 +00:00
|
|
|
m_router->Move( end, nullptr );
|
2020-02-03 14:02:25 +00:00
|
|
|
updateStatusPopup( statusPopup );
|
2015-02-18 16:53:46 +00:00
|
|
|
}
|
|
|
|
else if( evt->IsAction( &ACT_SpacingIncrease ) )
|
|
|
|
{
|
2015-02-18 00:29:54 +00:00
|
|
|
placer->SpacingStep( 1 );
|
2021-07-19 23:56:05 +00:00
|
|
|
m_router->Move( end, nullptr );
|
2020-02-03 14:02:25 +00:00
|
|
|
updateStatusPopup( statusPopup );
|
2015-02-18 00:29:54 +00:00
|
|
|
}
|
2021-05-11 15:22:42 +00:00
|
|
|
else if( evt->IsAction( &PCB_ACTIONS::lengthTunerSettingsDialog ) )
|
2018-05-20 13:08:06 +00:00
|
|
|
{
|
2020-02-03 14:02:25 +00:00
|
|
|
statusPopup.Hide();
|
2018-05-20 13:08:06 +00:00
|
|
|
TOOL_EVENT dummy;
|
|
|
|
meanderSettingsDialog( dummy );
|
2020-02-03 14:02:25 +00:00
|
|
|
statusPopup.Show();
|
2018-05-20 13:08:06 +00:00
|
|
|
}
|
2022-11-14 23:39:08 +00:00
|
|
|
// TODO: It'd be nice to be able to say "don't allow any non-trivial editing actions",
|
|
|
|
// but we don't at present have that, so we just knock out some of the egregious ones.
|
|
|
|
else if( ZONE_FILLER_TOOL::IsZoneFillAction( evt ) )
|
|
|
|
{
|
|
|
|
wxBell();
|
|
|
|
}
|
2022-09-05 09:56:41 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
evt->SetPassEvent();
|
|
|
|
}
|
2015-02-18 00:29:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_router->StopRouting();
|
2021-02-08 12:50:29 +00:00
|
|
|
frame()->UndoRedoBlock( false );
|
|
|
|
|
2022-09-04 20:04:17 +00:00
|
|
|
canvas()->SetStatusPopup( nullptr );
|
2018-06-13 04:11:21 +00:00
|
|
|
controls()->SetAutoPan( false );
|
|
|
|
controls()->ForceCursorPosition( false );
|
2020-11-19 20:08:58 +00:00
|
|
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
2022-12-06 02:24:09 +00:00
|
|
|
highlightNets( false );
|
2015-02-18 00:29:54 +00:00
|
|
|
}
|
|
|
|
|
2015-02-18 16:53:46 +00:00
|
|
|
|
2017-07-31 12:30:51 +00:00
|
|
|
void LENGTH_TUNER_TOOL::setTransitions()
|
2017-01-18 08:04:11 +00:00
|
|
|
{
|
2021-05-11 15:22:42 +00:00
|
|
|
Go( &LENGTH_TUNER_TOOL::MainLoop, PCB_ACTIONS::routerTuneSingleTrace.MakeEvent() );
|
|
|
|
Go( &LENGTH_TUNER_TOOL::MainLoop, PCB_ACTIONS::routerTuneDiffPair.MakeEvent() );
|
2021-07-19 23:56:05 +00:00
|
|
|
Go( &LENGTH_TUNER_TOOL::MainLoop,
|
|
|
|
PCB_ACTIONS::routerTuneDiffPairSkew.MakeEvent() );
|
2021-05-11 15:22:42 +00:00
|
|
|
|
|
|
|
// in case tool is inactive, otherwise the event is handled in the tool loop
|
2021-07-19 23:56:05 +00:00
|
|
|
Go( &LENGTH_TUNER_TOOL::meanderSettingsDialog,
|
|
|
|
PCB_ACTIONS::lengthTunerSettingsDialog.MakeEvent() );
|
2017-01-18 08:04:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-24 15:27:05 +00:00
|
|
|
int LENGTH_TUNER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
2015-02-18 00:29:54 +00:00
|
|
|
{
|
|
|
|
// Deselect all items
|
2023-06-26 22:16:51 +00:00
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
|
2015-02-18 00:29:54 +00:00
|
|
|
|
2022-09-14 17:31:56 +00:00
|
|
|
frame()->PushTool( aEvent );
|
2015-02-18 00:29:54 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
auto setCursor =
|
|
|
|
[&]()
|
|
|
|
{
|
2020-10-08 02:47:01 +00:00
|
|
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
|
|
|
};
|
|
|
|
|
2021-09-13 12:23:10 +00:00
|
|
|
Activate();
|
|
|
|
// Must be done after Activate() so that it gets set into the correct context
|
|
|
|
controls()->ShowCursor( true );
|
2020-10-08 02:47:01 +00:00
|
|
|
// Set initial cursor
|
|
|
|
setCursor();
|
|
|
|
|
2021-09-14 11:47:53 +00:00
|
|
|
// Router mode must be set after Activate()
|
|
|
|
m_lastTuneMode = aEvent.Parameter<PNS::ROUTER_MODE>();
|
|
|
|
m_router->SetMode( m_lastTuneMode );
|
|
|
|
|
2015-02-18 00:29:54 +00:00
|
|
|
// Main loop: keep receiving events
|
2019-06-17 13:43:22 +00:00
|
|
|
while( TOOL_EVENT* evt = Wait() )
|
2015-02-18 00:29:54 +00:00
|
|
|
{
|
2020-10-08 02:47:01 +00:00
|
|
|
setCursor();
|
2019-06-27 21:33:48 +00:00
|
|
|
|
2019-07-01 21:01:33 +00:00
|
|
|
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
2016-08-15 15:16:50 +00:00
|
|
|
{
|
2015-02-18 00:29:54 +00:00
|
|
|
break; // Finish
|
2016-08-15 15:16:50 +00:00
|
|
|
}
|
2021-04-05 23:58:14 +00:00
|
|
|
else if( evt->Action() == TA_UNDO_REDO_PRE )
|
|
|
|
{
|
|
|
|
m_router->ClearWorld();
|
|
|
|
}
|
|
|
|
else if( evt->Action() == TA_UNDO_REDO_POST || evt->Action() == TA_MODEL_CHANGE )
|
|
|
|
{
|
|
|
|
m_router->SyncWorld();
|
|
|
|
}
|
2015-02-18 00:29:54 +00:00
|
|
|
else if( evt->IsMotion() )
|
2016-08-15 15:16:50 +00:00
|
|
|
{
|
2015-02-18 00:29:54 +00:00
|
|
|
updateStartItem( *evt );
|
2016-08-15 15:16:50 +00:00
|
|
|
}
|
2015-02-18 00:29:54 +00:00
|
|
|
else if( evt->IsClick( BUT_LEFT ) || evt->IsAction( &ACT_StartTuning ) )
|
|
|
|
{
|
|
|
|
updateStartItem( *evt );
|
2015-08-04 21:08:13 +00:00
|
|
|
performTuning();
|
2015-02-18 00:29:54 +00:00
|
|
|
}
|
2021-05-11 15:22:42 +00:00
|
|
|
else if( evt->IsAction( &PCB_ACTIONS::lengthTunerSettingsDialog ) )
|
2018-05-20 13:08:06 +00:00
|
|
|
{
|
|
|
|
TOOL_EVENT dummy;
|
|
|
|
meanderSettingsDialog( dummy );
|
|
|
|
}
|
2020-09-24 22:48:46 +00:00
|
|
|
else if( evt->IsClick( BUT_RIGHT ) )
|
|
|
|
{
|
|
|
|
m_menu.ShowContextMenu( selection() );
|
|
|
|
}
|
2021-02-08 12:50:29 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
evt->SetPassEvent();
|
|
|
|
}
|
2015-02-18 00:29:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Store routing settings till the next invocation
|
|
|
|
m_savedSizes = m_router->Sizes();
|
|
|
|
|
2020-11-19 20:08:58 +00:00
|
|
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
2022-09-14 17:31:56 +00:00
|
|
|
frame()->PopTool( aEvent );
|
2015-02-18 00:29:54 +00:00
|
|
|
return 0;
|
2015-02-18 16:53:46 +00:00
|
|
|
}
|
2017-01-18 08:04:11 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2017-01-18 08:04:11 +00:00
|
|
|
int LENGTH_TUNER_TOOL::meanderSettingsDialog( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
PNS::MEANDER_PLACER_BASE* placer = static_cast<PNS::MEANDER_PLACER_BASE*>( m_router->Placer() );
|
|
|
|
|
2018-05-20 13:08:06 +00:00
|
|
|
PNS::MEANDER_SETTINGS settings = placer ? placer->MeanderSettings() : m_savedMeanderSettings;
|
2021-05-11 15:22:42 +00:00
|
|
|
DIALOG_PNS_LENGTH_TUNING_SETTINGS settingsDlg( frame(), settings, m_lastTuneMode );
|
2017-01-18 08:04:11 +00:00
|
|
|
|
2021-02-08 17:39:40 +00:00
|
|
|
if( settingsDlg.ShowModal() == wxID_OK )
|
2018-05-20 13:08:06 +00:00
|
|
|
{
|
|
|
|
if( placer )
|
|
|
|
placer->UpdateSettings( settings );
|
2017-01-18 08:04:11 +00:00
|
|
|
|
2018-05-20 13:08:06 +00:00
|
|
|
m_savedMeanderSettings = settings;
|
|
|
|
}
|
2017-01-18 08:04:11 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|