Fix ReadNetList and UpdatePCB issues with new footprints.
Make sure the view is rebuilt before selecting the new footprints so that they're shown only in the selection overlay. Don't start the drag until the dialog is closed so we don't have a bunch of extraneous mouse warping. Fixes: lp:1775265 * https://bugs.launchpad.net/kicad/+bug/1775265
This commit is contained in:
parent
d3a67e255d
commit
f0c0f04348
|
@ -39,7 +39,7 @@
|
|||
#include <netlist_reader.h>
|
||||
#include <reporter.h>
|
||||
#include <bitmaps.h>
|
||||
|
||||
#include <tool/tool_manager.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
|
@ -80,7 +80,8 @@ void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC )
|
|||
DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, const wxString & aNetlistFullFilename )
|
||||
: DIALOG_NETLIST_BASE( aParent ),
|
||||
m_parent( aParent ),
|
||||
m_initialized( false )
|
||||
m_initialized( false ),
|
||||
m_runDragCommand( false )
|
||||
{
|
||||
m_config = Kiface().KifaceSettings();
|
||||
|
||||
|
@ -116,6 +117,9 @@ DIALOG_NETLIST::~DIALOG_NETLIST()
|
|||
m_config->Write( NETLIST_DELETEEXTRAFOOTPRINTS_KEY, m_cbDeleteExtraFootprints->GetValue() );
|
||||
m_config->Write( NETLIST_DELETESINGLEPADNETS_KEY, m_cbDeleteSinglePadNets->GetValue() );
|
||||
m_config->Write( NETLIST_FILTER_MESSAGES_KEY, (long) m_MessageWindow->GetVisibleSeverities() );
|
||||
|
||||
if( m_runDragCommand )
|
||||
m_parent->GetToolManager()->InvokeTool( "pcbnew.InteractiveEdit" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -455,7 +459,7 @@ void DIALOG_NETLIST::loadNetlist( bool aDryRun )
|
|||
m_cbDeleteExtraFootprints->GetValue(),
|
||||
m_matchByTimestamp->GetSelection() == 0,
|
||||
m_cbDeleteSinglePadNets->GetValue(),
|
||||
aDryRun );
|
||||
aDryRun, &m_runDragCommand );
|
||||
|
||||
// The creation of the report was made without window update: the full page must be displayed
|
||||
m_MessageWindow->Flush( true );
|
||||
|
|
|
@ -41,6 +41,7 @@ private:
|
|||
PCB_EDIT_FRAME* m_parent;
|
||||
wxConfigBase* m_config;
|
||||
bool m_initialized;
|
||||
bool m_runDragCommand;
|
||||
|
||||
public:
|
||||
DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, const wxString & aNetlistFullFilename );
|
||||
|
|
|
@ -91,6 +91,9 @@ DIALOG_UPDATE_PCB::~DIALOG_UPDATE_PCB()
|
|||
m_config->Write( NETLIST_DELETEEXTRAFOOTPRINTS_KEY, m_cbDeleteExtraFootprints->GetValue() );
|
||||
m_config->Write( NETLIST_DELETESINGLEPADNETS_KEY, m_cbDeleteSinglePadNets->GetValue() );
|
||||
m_config->Write( NETLIST_FILTER_MESSAGES_KEY, (long) m_messagePanel->GetVisibleSeverities() );
|
||||
|
||||
if( m_runDragCommand )
|
||||
m_frame->GetToolManager()->InvokeTool( "pcbnew.InteractiveEdit" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -107,6 +110,7 @@ void DIALOG_UPDATE_PCB::PerformUpdate( bool aDryRun )
|
|||
EDA_RECT bbox = board->GetBoundingBox();
|
||||
|
||||
toolManager->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
m_runDragCommand = false;
|
||||
|
||||
m_netlist->SetDeleteExtraFootprints( m_cbDeleteExtraFootprints->GetValue() );
|
||||
m_netlist->SetFindByTimeStamp( m_matchByTimestamp->GetSelection() == 0 );
|
||||
|
@ -153,11 +157,13 @@ void DIALOG_UPDATE_PCB::PerformUpdate( bool aDryRun )
|
|||
|
||||
if( m_frame->IsGalCanvasActive() )
|
||||
{
|
||||
// Start move and place the new modules command
|
||||
// Start drag command for new modules
|
||||
if( !newFootprints.empty() )
|
||||
{
|
||||
for( MODULE* footprint : newFootprints )
|
||||
toolManager->RunAction( PCB_ACTIONS::selectItem, true, footprint );
|
||||
|
||||
m_runDragCommand = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ private:
|
|||
NETLIST* m_netlist;
|
||||
wxConfigBase* m_config;
|
||||
bool m_initialized;
|
||||
bool m_runDragCommand;
|
||||
|
||||
public:
|
||||
DIALOG_UPDATE_PCB( PCB_EDIT_FRAME* aParent, NETLIST *aNetlist );
|
||||
|
|
|
@ -63,7 +63,8 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName,
|
|||
bool aDeleteExtraFootprints,
|
||||
bool aSelectByTimeStamp,
|
||||
bool aDeleteSinglePadNets,
|
||||
bool aIsDryRun )
|
||||
bool aIsDryRun,
|
||||
bool* runDragCommand )
|
||||
{
|
||||
wxString msg;
|
||||
NETLIST netlist;
|
||||
|
@ -110,13 +111,12 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName,
|
|||
{
|
||||
// Remove old modules
|
||||
for( MODULE* module = board->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
view->Remove( module );
|
||||
}
|
||||
}
|
||||
|
||||
// Clear selection, just in case a selected item has to be removed
|
||||
m_toolManager->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
*runDragCommand = false;
|
||||
|
||||
netlist.SortByReference();
|
||||
board->ReplaceNetlist( netlist, aDeleteSinglePadNets, &newFootprints, aReporter );
|
||||
|
@ -125,41 +125,38 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName,
|
|||
if( netlist.IsDryRun() )
|
||||
return;
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
{
|
||||
SpreadFootprints( &newFootprints, false, false, GetCrossHairPosition() );
|
||||
wxPoint placementAreaPosition = GetCrossHairPosition();
|
||||
|
||||
if( !newFootprints.empty() )
|
||||
{
|
||||
for( MODULE* footprint : newFootprints )
|
||||
{
|
||||
m_toolManager->RunAction( PCB_ACTIONS::selectItem, true, footprint );
|
||||
}
|
||||
m_toolManager->InvokeTool( "pcbnew.InteractiveEdit" );
|
||||
}
|
||||
}
|
||||
else
|
||||
if( !IsGalCanvasActive() )
|
||||
{
|
||||
wxPoint placementAreaPosition;
|
||||
|
||||
// Place area to the left side of the board.
|
||||
// In legacy mode place area to the left side of the board.
|
||||
// if the board is empty, the bbox position is (0,0)
|
||||
placementAreaPosition.x = bbox.GetEnd().x + Millimeter2iu( 10 );
|
||||
placementAreaPosition.y = bbox.GetOrigin().y;
|
||||
}
|
||||
|
||||
SpreadFootprints( &newFootprints, false, false, placementAreaPosition );
|
||||
SpreadFootprints( &newFootprints, false, false, placementAreaPosition );
|
||||
|
||||
// Reload modules
|
||||
for( MODULE* module = board->m_Modules; module; module = module->Next() )
|
||||
view->Add( module );
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
{
|
||||
// Start drag command for new modules
|
||||
if( !newFootprints.empty() )
|
||||
{
|
||||
for( MODULE* footprint : newFootprints )
|
||||
m_toolManager->RunAction( PCB_ACTIONS::selectItem, true, footprint );
|
||||
|
||||
*runDragCommand = true;
|
||||
}
|
||||
}
|
||||
|
||||
OnModify();
|
||||
|
||||
SetCurItem( NULL );
|
||||
|
||||
// Reload modules
|
||||
for( MODULE* module = board->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
view->Add( module );
|
||||
}
|
||||
|
||||
if( aDeleteUnconnectedTracks && board->m_Track )
|
||||
{
|
||||
// Remove erroneous tracks. This should probably pushed down to the #BOARD object.
|
||||
|
|
|
@ -1556,6 +1556,7 @@ public:
|
|||
* @param aDeleteSinglePadNets if true, remove nets counting only one pad
|
||||
* and set net code to 0 for these pads
|
||||
* @param aIsDryRun performs a dry run without making any changes if true.
|
||||
* @param runDragCommand indicates that a selection was created which should be dragged.
|
||||
*/
|
||||
void ReadPcbNetlist( const wxString& aNetlistFileName,
|
||||
const wxString& aCmpFileName,
|
||||
|
@ -1565,7 +1566,8 @@ public:
|
|||
bool aDeleteExtraFootprints,
|
||||
bool aSelectByTimestamp,
|
||||
bool aDeleteSinglePadNets,
|
||||
bool aIsDryRun );
|
||||
bool aIsDryRun,
|
||||
bool* runDragCommand );
|
||||
|
||||
/**
|
||||
* Function RemoveMisConnectedTracks
|
||||
|
|
Loading…
Reference in New Issue