Cvpcb: Reload footprint libraries in CVPCB

CHANGED: Reload footprint libraries in CVPCB when footprint library table(fp-lib-table) is updated
This commit is contained in:
Scott Hanson 2022-09-27 22:58:03 +00:00 committed by Seth Hillbrand
parent 3a7068b346
commit 5b9fcc0ba0
5 changed files with 19 additions and 2 deletions

View File

@ -1040,6 +1040,7 @@ void CVPCB_MAINFRAME::BuildLibrariesListBox()
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs();
std::set<wxString> pinnedMatches;
std::set<wxString> otherMatches;
m_librariesListBox->ClearList();
auto process =
[&]( const wxString& aNickname )
@ -1247,7 +1248,13 @@ void CVPCB_MAINFRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down.
*/
break;
case MAIL_RELOAD_LIB:
m_cannotClose = true;
LoadFootprintFiles();
BuildFootprintsListBox();
BuildLibrariesListBox();
m_cannotClose = false;
break;
default:
; // ignore most
}

View File

@ -129,6 +129,10 @@ void LIBRARY_LISTBOX::Finish()
}
}
void LIBRARY_LISTBOX::ClearList()
{
m_libraryList.clear();
}
BEGIN_EVENT_TABLE( LIBRARY_LISTBOX, ITEMS_LISTBOX_BASE )
EVT_CHAR( LIBRARY_LISTBOX::OnChar )

View File

@ -150,6 +150,7 @@ public:
void SetString( unsigned linecount, const wxString& text );
void AppendLine( const wxString& text );
void Finish();
void ClearList();
wxString GetSelectedLibrary();
wxString OnGetItemText( long item, long column ) const override;

View File

@ -51,7 +51,8 @@ enum MAIL_T
MAIL_PCB_UPDATE_LINKS, // Update the schematic symbol paths in the PCB's footprints
MAIL_SCH_REFRESH, // Tell the schematic editor to refresh the display.
MAIL_LIB_EDIT,
MAIL_FP_EDIT
MAIL_FP_EDIT,
MAIL_RELOAD_LIB //Reload Library List if one was added
};
#endif // MAIL_TYPE_H_

View File

@ -58,6 +58,7 @@
#include <footprint_viewer_frame.h>
#include <footprint_edit_frame.h>
#include <kiway.h>
#include <kiway_express.h>
#include <widgets/grid_readonly_text_helpers.h>
#include <widgets/grid_text_button_helpers.h>
#include <pcbnew_id.h> // For ID_PCBNEW_END_LIST
@ -1136,4 +1137,7 @@ void InvokePcbLibTableEditor( KIWAY* aKiway, wxWindow* aCaller )
if( viewer )
viewer->ReCreateLibraryList();
std::string payload = "";
aKiway->ExpressMail( FRAME_CVPCB, MAIL_RELOAD_LIB, payload );
}