Make sure Cvpcb doesn't use its own FP_LIB_TABLE.
It's just a vestige of when Cvpcb was a separate app. Fixes: lp:1768251 * https://bugs.launchpad.net/kicad/+bug/1768251
This commit is contained in:
parent
26197c333e
commit
75e91f4cfd
|
@ -406,13 +406,13 @@ FP_LIB_TABLE* PROJECT::PcbFootprintLibs( KIWAY& aKiway )
|
||||||
|
|
||||||
if( !tbl )
|
if( !tbl )
|
||||||
{
|
{
|
||||||
// Stack the project specific FP_LIB_TABLE overlay on top of the global table.
|
// Build a new project specific FP_LIB_TABLE with the global table as a fallback.
|
||||||
// ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may
|
// ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may
|
||||||
// stack this way, all using the same global fallback table.
|
// stack this way, all using the same global fallback table.
|
||||||
KIFACE* kiface = aKiway.KiFACE( KIWAY::FACE_PCB );
|
KIFACE* kiface = aKiway.KiFACE( KIWAY::FACE_PCB );
|
||||||
|
|
||||||
if( kiface )
|
if( kiface )
|
||||||
tbl = (FP_LIB_TABLE*) kiface->IfaceOrAddress( KIFACE_G_FOOTPRINT_TABLE );
|
tbl = (FP_LIB_TABLE*) kiface->IfaceOrAddress( KIFACE_NEW_FOOTPRINT_TABLE );
|
||||||
|
|
||||||
wxASSERT( tbl );
|
wxASSERT( tbl );
|
||||||
SetElem( ELEM_FPTBL, tbl );
|
SetElem( ELEM_FPTBL, tbl );
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <kiway_express.h>
|
#include <kiway_express.h>
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
#include <kiface_i.h>
|
#include <kiface_i.h>
|
||||||
|
#include <kiface_ids.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <eda_dde.h>
|
#include <eda_dde.h>
|
||||||
|
@ -48,7 +49,6 @@
|
||||||
#include <display_footprints_frame.h>
|
#include <display_footprints_frame.h>
|
||||||
#include <cvpcb_id.h>
|
#include <cvpcb_id.h>
|
||||||
|
|
||||||
|
|
||||||
wxSize const FRAME_MIN_SIZE_DU( 350, 250 );
|
wxSize const FRAME_MIN_SIZE_DU( 350, 250 );
|
||||||
wxSize const FRAME_DEFAULT_SIZE_DU( 450, 300 );
|
wxSize const FRAME_DEFAULT_SIZE_DU( 450, 300 );
|
||||||
|
|
||||||
|
@ -438,8 +438,16 @@ bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, i
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
|
void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
bool tableChanged = false;
|
FP_LIB_TABLE* globalTable;
|
||||||
int r = InvokePcbLibTableEditor( this, &GFootprintTable, Prj().PcbFootprintLibs( Kiway() ) );
|
bool tableChanged = false;
|
||||||
|
KIFACE* kiface = Kiway().KiFACE( KIWAY::FACE_PCB );
|
||||||
|
|
||||||
|
if( kiface )
|
||||||
|
globalTable = (FP_LIB_TABLE*) kiface->IfaceOrAddress( KIFACE_GLOBAL_FOOTPRINT_TABLE );
|
||||||
|
else
|
||||||
|
globalTable = &GFootprintTable; // Shouldn't happen now that Cvpcb is integrated
|
||||||
|
|
||||||
|
int r = InvokePcbLibTableEditor( this, globalTable, Prj().PcbFootprintLibs( Kiway() ) );
|
||||||
|
|
||||||
if( r & 1 )
|
if( r & 1 )
|
||||||
{
|
{
|
||||||
|
@ -447,7 +455,7 @@ void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GFootprintTable.Save( fileName );
|
globalTable->Save( fileName );
|
||||||
tableChanged = true;
|
tableChanged = true;
|
||||||
}
|
}
|
||||||
catch( const IO_ERROR& ioe )
|
catch( const IO_ERROR& ioe )
|
||||||
|
|
|
@ -61,10 +61,6 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
|
||||||
// Preferences Menu :
|
// Preferences Menu :
|
||||||
wxMenu* preferencesMenu = new wxMenu;
|
wxMenu* preferencesMenu = new wxMenu;
|
||||||
|
|
||||||
AddMenuItem( preferencesMenu, ID_CVPCB_LIB_TABLE_EDIT,
|
|
||||||
_( "Manage Footprint &Libraries..." ), _( "Manage footprint libraries" ),
|
|
||||||
KiBitmap( library_table_xpm ) );
|
|
||||||
|
|
||||||
// Path configuration edit dialog.
|
// Path configuration edit dialog.
|
||||||
AddMenuItem( preferencesMenu,
|
AddMenuItem( preferencesMenu,
|
||||||
ID_PREFERENCES_CONFIGURE_PATHS,
|
ID_PREFERENCES_CONFIGURE_PATHS,
|
||||||
|
@ -72,6 +68,10 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
|
||||||
_( "Edit path configuration environment variables" ),
|
_( "Edit path configuration environment variables" ),
|
||||||
KiBitmap( editor_xpm ) );
|
KiBitmap( editor_xpm ) );
|
||||||
|
|
||||||
|
AddMenuItem( preferencesMenu, ID_CVPCB_LIB_TABLE_EDIT,
|
||||||
|
_( "Manage Footprint &Libraries..." ), _( "Manage footprint libraries" ),
|
||||||
|
KiBitmap( library_table_xpm ) );
|
||||||
|
|
||||||
preferencesMenu->AppendSeparator();
|
preferencesMenu->AppendSeparator();
|
||||||
AddMenuItem( preferencesMenu, ID_CVPCB_EQUFILES_LIST_EDIT,
|
AddMenuItem( preferencesMenu, ID_CVPCB_EQUFILES_LIST_EDIT,
|
||||||
_( "Footprint &Association Files..." ),
|
_( "Footprint &Association Files..." ),
|
||||||
|
|
|
@ -32,18 +32,25 @@ enum KIFACE_ADDR_ID : int
|
||||||
INVALID,
|
INVALID,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a new instance of FOOTPRINT_LIST from pcbnew.
|
* Return a pointer to the global instance of FOOTPRINT_LIST from pcbnew.
|
||||||
* Type is FOOTPRINT_LIST*
|
* Type is FOOTPRINT_LIST*
|
||||||
* Caller takes ownership
|
* Caller does NOT own.
|
||||||
*/
|
*/
|
||||||
KIFACE_NEW_FOOTPRINT_LIST,
|
KIFACE_FOOTPRINT_LIST,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a new FP_LIB_TABLE copying the global table.
|
* Return a new FP_LIB_TABLE with the global table installed as a fallback.
|
||||||
* Type is FP_LIB_TABLE*
|
* Type is FP_LIB_TABLE*
|
||||||
* Caller takes ownership
|
* Caller takes ownership
|
||||||
*/
|
*/
|
||||||
KIFACE_G_FOOTPRINT_TABLE, ///<
|
KIFACE_NEW_FOOTPRINT_TABLE,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the global FP_LIB_TABLE.
|
||||||
|
* Type is FP_LIB_TABLE*
|
||||||
|
* Caller does NOT own.
|
||||||
|
*/
|
||||||
|
KIFACE_GLOBAL_FOOTPRINT_TABLE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KIFACE_IDS
|
#endif // KIFACE_IDS
|
||||||
|
|
|
@ -159,12 +159,18 @@ static struct IFACE : public KIFACE_I
|
||||||
{
|
{
|
||||||
switch( aDataId )
|
switch( aDataId )
|
||||||
{
|
{
|
||||||
case KIFACE_NEW_FOOTPRINT_LIST:
|
// Return a pointer to the global instance of the footprint list.
|
||||||
|
case KIFACE_FOOTPRINT_LIST:
|
||||||
return (void*) &GFootprintList;
|
return (void*) &GFootprintList;
|
||||||
|
|
||||||
case KIFACE_G_FOOTPRINT_TABLE:
|
// Return a new FP_LIB_TABLE with the global table installed as a fallback.
|
||||||
|
case KIFACE_NEW_FOOTPRINT_TABLE:
|
||||||
return (void*) new FP_LIB_TABLE( &GFootprintTable );
|
return (void*) new FP_LIB_TABLE( &GFootprintTable );
|
||||||
|
|
||||||
|
// Return a pointer to the global instance of the global footprint table.
|
||||||
|
case KIFACE_GLOBAL_FOOTPRINT_TABLE:
|
||||||
|
return (void*) &GFootprintTable;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue