!m_isBoardEditor != m_isFootprintEditor.

(There's also python, cli, etc.)
This commit is contained in:
Jeff Young 2024-01-26 12:47:01 +00:00
parent e99f758447
commit f4e123f57e
2 changed files with 14 additions and 5 deletions

View File

@ -44,28 +44,36 @@ using namespace std::placeholders;
BOARD_COMMIT::BOARD_COMMIT( TOOL_BASE* aTool ) :
m_toolMgr( aTool->GetManager() ),
m_isBoardEditor( false )
m_isBoardEditor( false ),
m_isFootprintEditor( false )
{
if( PCB_TOOL_BASE* pcb_tool = dynamic_cast<PCB_TOOL_BASE*>( aTool ) )
{
m_isBoardEditor = pcb_tool->IsBoardEditor();
m_isFootprintEditor = pcb_tool->IsFootprintEditor();
}
}
BOARD_COMMIT::BOARD_COMMIT( EDA_DRAW_FRAME* aFrame ) :
m_toolMgr( aFrame->GetToolManager() ),
m_isBoardEditor( aFrame->IsType( FRAME_PCB_EDITOR ) )
m_isBoardEditor( aFrame->IsType( FRAME_PCB_EDITOR ) ),
m_isFootprintEditor( aFrame->IsType( FRAME_FOOTPRINT_EDITOR ) )
{
}
BOARD_COMMIT::BOARD_COMMIT( TOOL_MANAGER* aMgr ) :
m_toolMgr( aMgr ),
m_isBoardEditor( false )
m_isBoardEditor( false ),
m_isFootprintEditor( false )
{
EDA_DRAW_FRAME* frame = dynamic_cast<EDA_DRAW_FRAME*>( aMgr->GetToolHolder() );
if( frame && frame->IsType( FRAME_PCB_EDITOR ) )
m_isBoardEditor = true;
else if( frame && frame->IsType( FRAME_FOOTPRINT_EDITOR ) )
m_isFootprintEditor = true;
}
@ -265,7 +273,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
if( !( changeFlags & CHT_DONE ) )
{
if( !m_isBoardEditor && frame ) // frame check incase we are headless drc (cli, python)
if( m_isFootprintEditor )
{
FOOTPRINT* parentFP = board->GetFirstFootprint();
wxCHECK2_MSG( parentFP, continue, "Commit thinks this is footprint editor, but "

View File

@ -75,6 +75,7 @@ private:
private:
TOOL_MANAGER* m_toolMgr;
bool m_isBoardEditor;
bool m_isFootprintEditor;
};
#endif