Remove BOARD_COMMIT( TOOL_MANAGER ).
It initializes both m_isFootprintEditor and m_isBoardEditor to false, causing all sorts of trouble. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15072
This commit is contained in:
parent
011a8f29a3
commit
9ff33e5ec6
|
@ -42,14 +42,6 @@
|
||||||
using namespace std::placeholders;
|
using namespace std::placeholders;
|
||||||
|
|
||||||
|
|
||||||
BOARD_COMMIT::BOARD_COMMIT( TOOL_MANAGER* aToolMgr ) :
|
|
||||||
m_toolMgr( aToolMgr ),
|
|
||||||
m_isFootprintEditor( false ),
|
|
||||||
m_isBoardEditor( false )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BOARD_COMMIT::BOARD_COMMIT( PCB_TOOL_BASE* aTool )
|
BOARD_COMMIT::BOARD_COMMIT( PCB_TOOL_BASE* aTool )
|
||||||
{
|
{
|
||||||
m_toolMgr = aTool->GetManager();
|
m_toolMgr = aTool->GetManager();
|
||||||
|
|
|
@ -46,7 +46,6 @@ class TOOL_BASE;
|
||||||
class BOARD_COMMIT : public COMMIT
|
class BOARD_COMMIT : public COMMIT
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BOARD_COMMIT( TOOL_MANAGER* aToolMgr );
|
|
||||||
BOARD_COMMIT( EDA_DRAW_FRAME* aFrame );
|
BOARD_COMMIT( EDA_DRAW_FRAME* aFrame );
|
||||||
BOARD_COMMIT( PCB_TOOL_BASE *aTool );
|
BOARD_COMMIT( PCB_TOOL_BASE *aTool );
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ POSITIONING_TOOLS_MENU::POSITIONING_TOOLS_MENU( TOOL_INTERACTIVE* aTool ) :
|
||||||
SetTitle( _( "Positioning Tools" ) );
|
SetTitle( _( "Positioning Tools" ) );
|
||||||
|
|
||||||
auto notMovingCondition =
|
auto notMovingCondition =
|
||||||
[ this ]( const SELECTION& aSelection )
|
[]( const SELECTION& aSelection )
|
||||||
{
|
{
|
||||||
return aSelection.Empty() || !aSelection.Front()->IsMoving();
|
return aSelection.Empty() || !aSelection.Front()->IsMoving();
|
||||||
};
|
};
|
||||||
|
@ -169,7 +169,7 @@ bool EDIT_TOOL::Init()
|
||||||
};
|
};
|
||||||
|
|
||||||
auto notMovingCondition =
|
auto notMovingCondition =
|
||||||
[ this ]( const SELECTION& aSelection )
|
[]( const SELECTION& aSelection )
|
||||||
{
|
{
|
||||||
return aSelection.Empty() || !aSelection.Front()->IsMoving();
|
return aSelection.Empty() || !aSelection.Front()->IsMoving();
|
||||||
};
|
};
|
||||||
|
|
|
@ -873,7 +873,7 @@ int PCB_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
||||||
if( isFootprintEditor && ( !board() || !footprint() ) )
|
if( isFootprintEditor && ( !board() || !footprint() ) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
BOARD_COMMIT commit( m_toolMgr );
|
BOARD_COMMIT commit( frame() );
|
||||||
bool cancelled = false;
|
bool cancelled = false;
|
||||||
|
|
||||||
switch( clipItem->Type() )
|
switch( clipItem->Type() )
|
||||||
|
@ -1203,7 +1203,7 @@ bool PCB_CONTROL::placeBoardItems( BOARD_COMMIT* aCommit, std::vector<BOARD_ITEM
|
||||||
int PCB_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName )
|
int PCB_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName )
|
||||||
{
|
{
|
||||||
PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
|
PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
|
||||||
BOARD_COMMIT commit( m_toolMgr );
|
BOARD_COMMIT commit( editFrame );
|
||||||
|
|
||||||
if( !editFrame )
|
if( !editFrame )
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -109,7 +109,10 @@ void FillZones( BOARD* m_board )
|
||||||
TOOL_MANAGER toolMgr;
|
TOOL_MANAGER toolMgr;
|
||||||
toolMgr.SetEnvironment( m_board, nullptr, nullptr, nullptr, nullptr );
|
toolMgr.SetEnvironment( m_board, nullptr, nullptr, nullptr, nullptr );
|
||||||
|
|
||||||
BOARD_COMMIT commit( &toolMgr );
|
KI_TEST::DUMMY_TOOL* dummyTool = new KI_TEST::DUMMY_TOOL();
|
||||||
|
toolMgr.RegisterTool( dummyTool );
|
||||||
|
|
||||||
|
BOARD_COMMIT commit( dummyTool );
|
||||||
ZONE_FILLER filler( m_board, &commit );
|
ZONE_FILLER filler( m_board, &commit );
|
||||||
std::vector<ZONE*> toFill;
|
std::vector<ZONE*> toFill;
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <reporter.h>
|
#include <reporter.h>
|
||||||
|
#include <tools/pcb_tool_base.h>
|
||||||
|
|
||||||
class BOARD;
|
class BOARD;
|
||||||
class BOARD_ITEM;
|
class BOARD_ITEM;
|
||||||
|
@ -45,6 +46,15 @@ class SETTINGS_MANAGER;
|
||||||
|
|
||||||
namespace KI_TEST
|
namespace KI_TEST
|
||||||
{
|
{
|
||||||
|
class DUMMY_TOOL : public PCB_TOOL_BASE
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DUMMY_TOOL() :
|
||||||
|
PCB_TOOL_BASE( "testframework.dummytool" )
|
||||||
|
{};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper that contains logic to assist in dumping boards to
|
* A helper that contains logic to assist in dumping boards to
|
||||||
* disk depending on some environment variables.
|
* disk depending on some environment variables.
|
||||||
|
|
|
@ -83,7 +83,10 @@ BOOST_FIXTURE_TEST_CASE( FailedToCleanRegressionTests, TRACK_CLEANER_TEST_FIXTUR
|
||||||
TOOL_MANAGER toolMgr;
|
TOOL_MANAGER toolMgr;
|
||||||
toolMgr.SetEnvironment( m_board.get(), nullptr, nullptr, nullptr, nullptr );
|
toolMgr.SetEnvironment( m_board.get(), nullptr, nullptr, nullptr, nullptr );
|
||||||
|
|
||||||
BOARD_COMMIT commit( &toolMgr );
|
KI_TEST::DUMMY_TOOL* dummyTool = new KI_TEST::DUMMY_TOOL();
|
||||||
|
toolMgr.RegisterTool( dummyTool );
|
||||||
|
|
||||||
|
BOARD_COMMIT commit( dummyTool );
|
||||||
TRACKS_CLEANER cleaner( m_board.get(), commit );
|
TRACKS_CLEANER cleaner( m_board.get(), commit );
|
||||||
std::vector< std::shared_ptr<CLEANUP_ITEM> > dryRunItems;
|
std::vector< std::shared_ptr<CLEANUP_ITEM> > dryRunItems;
|
||||||
std::vector< std::shared_ptr<CLEANUP_ITEM> > realRunItems;
|
std::vector< std::shared_ptr<CLEANUP_ITEM> > realRunItems;
|
||||||
|
@ -152,7 +155,10 @@ BOOST_FIXTURE_TEST_CASE( TrackCleanerRegressionTests, TRACK_CLEANER_TEST_FIXTURE
|
||||||
TOOL_MANAGER toolMgr;
|
TOOL_MANAGER toolMgr;
|
||||||
toolMgr.SetEnvironment( m_board.get(), nullptr, nullptr, nullptr, nullptr );
|
toolMgr.SetEnvironment( m_board.get(), nullptr, nullptr, nullptr, nullptr );
|
||||||
|
|
||||||
BOARD_COMMIT commit( &toolMgr );
|
KI_TEST::DUMMY_TOOL* dummyTool = new KI_TEST::DUMMY_TOOL();
|
||||||
|
toolMgr.RegisterTool( dummyTool );
|
||||||
|
|
||||||
|
BOARD_COMMIT commit( dummyTool );
|
||||||
TRACKS_CLEANER cleaner( m_board.get(), commit );
|
TRACKS_CLEANER cleaner( m_board.get(), commit );
|
||||||
std::vector< std::shared_ptr<CLEANUP_ITEM> > dryRunItems;
|
std::vector< std::shared_ptr<CLEANUP_ITEM> > dryRunItems;
|
||||||
std::vector< std::shared_ptr<CLEANUP_ITEM> > realRunItems;
|
std::vector< std::shared_ptr<CLEANUP_ITEM> > realRunItems;
|
||||||
|
|
Loading…
Reference in New Issue