Make use of polymorphism for locking/unlocking.
Fixes https://gitlab.com/kicad/code/kicad/issues/6350
This commit is contained in:
parent
13e939ffa0
commit
3a35a5d5f8
|
@ -433,7 +433,7 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow()
|
|||
bool changeLock = m_lockedCbox->Get3StateValue() != wxCHK_UNDETERMINED;
|
||||
bool setLock = m_lockedCbox->Get3StateValue() == wxCHK_CHECKED;
|
||||
|
||||
for( auto item : m_items )
|
||||
for( EDA_ITEM* item : m_items )
|
||||
{
|
||||
m_commit.Modify( item );
|
||||
|
||||
|
|
|
@ -215,14 +215,9 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected, bool isModE
|
|||
copy = static_cast<BOARD_ITEM*>( item->Clone() );
|
||||
}
|
||||
|
||||
auto prepItem = [&]( BOARD_ITEM* titem )
|
||||
auto prepItem = [&]( BOARD_ITEM* aItem )
|
||||
{
|
||||
// locked means "locked in place"; copied items therefore can't
|
||||
// be locked
|
||||
if( MODULE* footprint = dyn_cast<MODULE*>( titem ) )
|
||||
footprint->SetLocked( false );
|
||||
else if( TRACK* track = dyn_cast<TRACK*>( titem ) )
|
||||
track->SetLocked( false );
|
||||
aItem->SetLocked( false );
|
||||
};
|
||||
|
||||
if( copy )
|
||||
|
|
|
@ -1601,29 +1601,6 @@ void PCB_EDIT_FRAME::ProjectChanged()
|
|||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::LockModule( MODULE* aModule, bool aLocked )
|
||||
{
|
||||
const wxString ModulesMaskSelection = wxT( "*" );
|
||||
if( aModule )
|
||||
{
|
||||
aModule->SetLocked( aLocked );
|
||||
SetMsgPanel( aModule );
|
||||
OnModify();
|
||||
}
|
||||
else
|
||||
{
|
||||
for( auto mod : GetBoard()->Modules() )
|
||||
{
|
||||
if( WildCompareString( ModulesMaskSelection, mod->GetReference() ) )
|
||||
{
|
||||
mod->SetLocked( aLocked );
|
||||
OnModify();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ExportBoardToHyperlynx( BOARD* aBoard, const wxFileName& aPath );
|
||||
|
||||
|
||||
|
|
|
@ -850,8 +850,6 @@ public:
|
|||
void ScriptingConsoleEnableDisable();
|
||||
#endif
|
||||
|
||||
void LockModule( MODULE* aModule, bool aLocked );
|
||||
|
||||
/**
|
||||
* Function SendMessageToEESCHEMA
|
||||
* sends a message to the schematic editor so that it may move its cursor
|
||||
|
|
Loading…
Reference in New Issue