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:
Jeff Young 2024-06-22 11:33:31 +01:00
parent 3e480b6f6e
commit e450258c0f
3 changed files with 21 additions and 15 deletions

View File

@ -37,6 +37,8 @@
#include <pcbnew_settings.h>
#include <widgets/wx_html_report_panel.h>
#include <widgets/std_bitmap_button.h>
#include <tool/tool_manager.h>
#include <tools/pcb_selection_tool.h>
#define ID_MATCH_FP_ALL 4200
@ -297,19 +299,21 @@ void DIALOG_EXCHANGE_FOOTPRINTS::OnMatchIDClicked( wxCommandEvent& event )
void DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked( wxCommandEvent& event )
{
PCB_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
wxBusyCursor dummy;
m_MessageWindow->Clear();
m_MessageWindow->Flush( false );
m_newFootprints.clear();
processMatchingFootprints();
m_parent->Compile_Ratsnest( true );
m_parent->GetCanvas()->Refresh();
m_commit.Push( m_updateMode ? _( "Update Footprint" ) : _( "Change Footprint" ) );
selTool->AddItemsToSel( &m_newFootprints );
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 )
m_currentFootprint = newFootprint;
if( newFootprint )
m_newFootprints.push_back( newFootprint );
if( m_updateMode && !updated )
{
msg += _( ": (no changes)" );

View File

@ -56,9 +56,11 @@ private:
void processMatchingFootprints();
void processFootprint( FOOTPRINT* aFootprint, const LIB_ID& aNewFPID );
private:
BOARD_COMMIT m_commit;
PCB_EDIT_FRAME* m_parent;
FOOTPRINT* m_currentFootprint;
EDA_ITEMS m_newFootprints;
bool m_updateMode;
int* m_matchMode;
};

View File

@ -62,6 +62,7 @@ bool GLOBAL_EDIT_TOOL::Init()
int GLOBAL_EDIT_TOOL::ExchangeFootprints( const TOOL_EVENT& aEvent )
{
PCB_EDIT_FRAME* editFrame = getEditFrame<PCB_EDIT_FRAME>();
PCB_SELECTION& selection = m_selectionTool->GetSelection();
FOOTPRINT* footprint = nullptr;
bool updateMode = false;
@ -98,12 +99,8 @@ int GLOBAL_EDIT_TOOL::ExchangeFootprints( const TOOL_EVENT& aEvent )
wxFAIL_MSG( wxT( "ExchangeFootprints: unexpected action" ) );
}
// invoke the exchange dialog process
{
PCB_EDIT_FRAME* editFrame = getEditFrame<PCB_EDIT_FRAME>();
DIALOG_EXCHANGE_FOOTPRINTS dialog( editFrame, footprint, updateMode, currentMode );
dialog.ShowQuasiModal();
}
return 0;
}