Support legacy Length Tuning Settings workflow.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17748

(cherry picked from commit 978ef352d0)
This commit is contained in:
Jeff Young 2024-04-24 10:51:03 +01:00
parent 9f39420808
commit a39b9b8890
4 changed files with 29 additions and 4 deletions

View File

@ -2280,7 +2280,7 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
if( collector.GetCount() > 0 )
{
double min_dist_sq = std::numeric_limits<double>().max();
double min_dist_sq = std::numeric_limits<double>::max();
for( EDA_ITEM* candidate : collector )
{
@ -2323,8 +2323,8 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
if( dynamic_cast<PCB_TUNING_PATTERN*>( m_pickerItem->GetParentGroup() ) )
{
m_frame->ShowInfoBarWarning(
_( "Unable to tune segments inside other tuning patterns." ) );
m_frame->ShowInfoBarWarning( _( "Unable to tune segments inside other "
"tuning patterns." ) );
}
else
{
@ -2381,6 +2381,10 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
m_tuningPattern->SetSpacing( placer->MeanderSettings().m_spacing );
updateTuningPattern();
}
else
{
m_frame->ShowInfoBarWarning( _( "Select a track to tune first." ) );
}
}
else if( evt->IsAction( &PCB_ACTIONS::amplIncrease )
|| evt->IsAction( &PCB_ACTIONS::amplDecrease ) )
@ -2393,8 +2397,13 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
m_tuningPattern->SetMaxAmplitude( placer->MeanderSettings().m_maxAmplitude );
updateTuningPattern();
}
else
{
m_frame->ShowInfoBarWarning( _( "Select a track to tune first." ) );
}
else if( evt->IsAction( &PCB_ACTIONS::properties ) )
}
else if( evt->IsAction( &PCB_ACTIONS::properties )
|| evt->IsAction( &PCB_ACTIONS::lengthTunerSettings ) )
{
if( m_tuningPattern )
{
@ -2414,6 +2423,10 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
if( dlg.ShowModal() == wxID_OK )
updateTuningPattern();
}
else
{
m_frame->ShowInfoBarWarning( _( "Select a track to tune first." ) );
}
}
// 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.

View File

@ -255,6 +255,7 @@ bool DRAWING_TOOL::Init()
ctxMenu.AddItem( PCB_ACTIONS::spacingDecrease, tuningToolActive, 200 );
ctxMenu.AddItem( PCB_ACTIONS::amplIncrease, tuningToolActive, 200 );
ctxMenu.AddItem( PCB_ACTIONS::amplDecrease, tuningToolActive, 200 );
ctxMenu.AddItem( PCB_ACTIONS::lengthTunerSettings, tuningToolActive, 200 );
ctxMenu.AddCheckItem( PCB_ACTIONS::toggleHV45Mode, !tuningToolActive, 250 );
ctxMenu.AddSeparator( 500 );

View File

@ -2425,6 +2425,16 @@ TOOL_ACTION PCB_ACTIONS::generatorsShowManager( TOOL_ACTION_ARGS()
// LENGTH_TUNER_TOOL
//
TOOL_ACTION PCB_ACTIONS::lengthTunerSettings( TOOL_ACTION_ARGS()
.Name( "pcbnew.LengthTuner.Settings" )
.Scope( AS_CONTEXT )
.DefaultHotkey( MD_CTRL + 'L' )
// Don't be tempted to remove "Modern Toolset only". It's in the legacy property name.
.LegacyHotkeyName( "Length Tuning Settings (Modern Toolset only)" )
.MenuText( _( "Length Tuning Settings..." ) )
.Tooltip( _( "Displays tuning pattern properties dialog" ) )
.Icon( BITMAPS::router_len_tuner_setup ) );
TOOL_ACTION PCB_ACTIONS::ddAppendBoard( TOOL_ACTION_ARGS()
.Name( "pcbnew.Control.DdAppendBoard" )
.Scope( AS_GLOBAL ) );

View File

@ -204,6 +204,7 @@ public:
static TOOL_ACTION spacingDecrease;
static TOOL_ACTION amplIncrease;
static TOOL_ACTION amplDecrease;
static TOOL_ACTION lengthTunerSettings;
static TOOL_ACTION drawAlignedDimension;
static TOOL_ACTION drawCenterDimension;
static TOOL_ACTION drawRadialDimension;