Show footprint change/update immediately.
Also, don't deselect selected footprints. Fixes https://gitlab.com/kicad/code/kicad/-/issues/18248
This commit is contained in:
parent
3e480b6f6e
commit
e450258c0f
|
@ -37,6 +37,8 @@
|
||||||
#include <pcbnew_settings.h>
|
#include <pcbnew_settings.h>
|
||||||
#include <widgets/wx_html_report_panel.h>
|
#include <widgets/wx_html_report_panel.h>
|
||||||
#include <widgets/std_bitmap_button.h>
|
#include <widgets/std_bitmap_button.h>
|
||||||
|
#include <tool/tool_manager.h>
|
||||||
|
#include <tools/pcb_selection_tool.h>
|
||||||
|
|
||||||
|
|
||||||
#define ID_MATCH_FP_ALL 4200
|
#define ID_MATCH_FP_ALL 4200
|
||||||
|
@ -297,19 +299,21 @@ void DIALOG_EXCHANGE_FOOTPRINTS::OnMatchIDClicked( wxCommandEvent& event )
|
||||||
|
|
||||||
void DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked( wxCommandEvent& event )
|
void DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxBusyCursor dummy;
|
PCB_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
|
||||||
|
wxBusyCursor dummy;
|
||||||
|
|
||||||
m_MessageWindow->Clear();
|
m_MessageWindow->Clear();
|
||||||
m_MessageWindow->Flush( false );
|
m_MessageWindow->Flush( false );
|
||||||
|
|
||||||
|
m_newFootprints.clear();
|
||||||
processMatchingFootprints();
|
processMatchingFootprints();
|
||||||
|
m_commit.Push( m_updateMode ? _( "Update Footprint" ) : _( "Change Footprint" ) );
|
||||||
m_parent->Compile_Ratsnest( true );
|
selTool->AddItemsToSel( &m_newFootprints );
|
||||||
m_parent->GetCanvas()->Refresh();
|
|
||||||
|
|
||||||
m_MessageWindow->Flush( false );
|
m_MessageWindow->Flush( false );
|
||||||
|
|
||||||
m_commit.Push( wxT( "Changed footprint" ) );
|
WINDOW_THAWER thawer( m_parent );
|
||||||
|
m_parent->GetCanvas()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -394,6 +398,9 @@ void DIALOG_EXCHANGE_FOOTPRINTS::processFootprint( FOOTPRINT* aFootprint, const
|
||||||
if( aFootprint == m_currentFootprint )
|
if( aFootprint == m_currentFootprint )
|
||||||
m_currentFootprint = newFootprint;
|
m_currentFootprint = newFootprint;
|
||||||
|
|
||||||
|
if( newFootprint )
|
||||||
|
m_newFootprints.push_back( newFootprint );
|
||||||
|
|
||||||
if( m_updateMode && !updated )
|
if( m_updateMode && !updated )
|
||||||
{
|
{
|
||||||
msg += _( ": (no changes)" );
|
msg += _( ": (no changes)" );
|
||||||
|
|
|
@ -56,9 +56,11 @@ private:
|
||||||
void processMatchingFootprints();
|
void processMatchingFootprints();
|
||||||
void processFootprint( FOOTPRINT* aFootprint, const LIB_ID& aNewFPID );
|
void processFootprint( FOOTPRINT* aFootprint, const LIB_ID& aNewFPID );
|
||||||
|
|
||||||
|
private:
|
||||||
BOARD_COMMIT m_commit;
|
BOARD_COMMIT m_commit;
|
||||||
PCB_EDIT_FRAME* m_parent;
|
PCB_EDIT_FRAME* m_parent;
|
||||||
FOOTPRINT* m_currentFootprint;
|
FOOTPRINT* m_currentFootprint;
|
||||||
|
EDA_ITEMS m_newFootprints;
|
||||||
bool m_updateMode;
|
bool m_updateMode;
|
||||||
int* m_matchMode;
|
int* m_matchMode;
|
||||||
};
|
};
|
||||||
|
|
|
@ -62,10 +62,11 @@ bool GLOBAL_EDIT_TOOL::Init()
|
||||||
|
|
||||||
int GLOBAL_EDIT_TOOL::ExchangeFootprints( const TOOL_EVENT& aEvent )
|
int GLOBAL_EDIT_TOOL::ExchangeFootprints( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
PCB_SELECTION& selection = m_selectionTool->GetSelection();
|
PCB_EDIT_FRAME* editFrame = getEditFrame<PCB_EDIT_FRAME>();
|
||||||
FOOTPRINT* footprint = nullptr;
|
PCB_SELECTION& selection = m_selectionTool->GetSelection();
|
||||||
bool updateMode = false;
|
FOOTPRINT* footprint = nullptr;
|
||||||
bool currentMode = false;
|
bool updateMode = false;
|
||||||
|
bool currentMode = false;
|
||||||
|
|
||||||
if( aEvent.HasPosition() )
|
if( aEvent.HasPosition() )
|
||||||
selection = m_selectionTool->RequestSelection( EDIT_TOOL::FootprintFilter );
|
selection = m_selectionTool->RequestSelection( EDIT_TOOL::FootprintFilter );
|
||||||
|
@ -98,12 +99,8 @@ int GLOBAL_EDIT_TOOL::ExchangeFootprints( const TOOL_EVENT& aEvent )
|
||||||
wxFAIL_MSG( wxT( "ExchangeFootprints: unexpected action" ) );
|
wxFAIL_MSG( wxT( "ExchangeFootprints: unexpected action" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// invoke the exchange dialog process
|
DIALOG_EXCHANGE_FOOTPRINTS dialog( editFrame, footprint, updateMode, currentMode );
|
||||||
{
|
dialog.ShowQuasiModal();
|
||||||
PCB_EDIT_FRAME* editFrame = getEditFrame<PCB_EDIT_FRAME>();
|
|
||||||
DIALOG_EXCHANGE_FOOTPRINTS dialog( editFrame, footprint, updateMode, currentMode );
|
|
||||||
dialog.ShowQuasiModal();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue