Footprint editor: always export the currently loaded footprint.
Previously, it was not always the edited footprint, but a footprint selected from the library tree. It was especially annoying when the footprint was loaded from the board editor: The footprint was not the loaded footprint, but its copy from library. From master branch
This commit is contained in:
parent
80b842a704
commit
9466624f9d
|
@ -110,6 +110,13 @@ bool FOOTPRINT_EDITOR_CONTROL::Init()
|
|||
return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
|
||||
};
|
||||
|
||||
auto fpExportCondition =
|
||||
[ this ]( const SELECTION& aSel )
|
||||
{
|
||||
FOOTPRINT* fp = m_frame->GetBoard()->GetFirstFootprint();
|
||||
return fp != nullptr;
|
||||
};
|
||||
|
||||
ctxMenu.AddItem( ACTIONS::pinLibrary, unpinnedLibSelectedCondition );
|
||||
ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLibSelectedCondition );
|
||||
|
||||
|
@ -132,7 +139,7 @@ bool FOOTPRINT_EDITOR_CONTROL::Init()
|
|||
|
||||
ctxMenu.AddSeparator();
|
||||
ctxMenu.AddItem( PCB_ACTIONS::importFootprint, libInferredCondition );
|
||||
ctxMenu.AddItem( PCB_ACTIONS::exportFootprint, fpSelectedCondition );
|
||||
ctxMenu.AddItem( PCB_ACTIONS::exportFootprint, fpExportCondition );
|
||||
|
||||
// If we've got nothing else to show, at least show a hide tree option
|
||||
ctxMenu.AddItem( PCB_ACTIONS::hideFootprintTree, !libInferredCondition );
|
||||
|
@ -526,14 +533,11 @@ int FOOTPRINT_EDITOR_CONTROL::ImportFootprint( const TOOL_EVENT& aEvent )
|
|||
int FOOTPRINT_EDITOR_CONTROL::ExportFootprint( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
LIB_ID fpID = m_frame->GetTreeFPID();
|
||||
FOOTPRINT* fp;
|
||||
FOOTPRINT* fp = m_frame->GetBoard()->GetFirstFootprint();
|
||||
|
||||
if( !fpID.IsValid() )
|
||||
fp = m_frame->GetBoard()->GetFirstFootprint();
|
||||
else
|
||||
fp = m_frame->LoadFootprint( fpID );
|
||||
if( fp )
|
||||
m_frame->ExportFootprint( fp );
|
||||
|
||||
m_frame->ExportFootprint( fp );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -445,7 +445,7 @@ TOOL_ACTION PCB_ACTIONS::importFootprint( "pcbnew.ModuleEditor.importFootprint",
|
|||
|
||||
TOOL_ACTION PCB_ACTIONS::exportFootprint( "pcbnew.ModuleEditor.exportFootprint",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Export Footprint..." ), _( "Export footprint to file" ),
|
||||
_( "Export Current Footprint..." ), _( "Export edited footprint to file" ),
|
||||
BITMAPS::export_module );
|
||||
|
||||
TOOL_ACTION PCB_ACTIONS::footprintProperties( "pcbnew.ModuleEditor.footprintProperties",
|
||||
|
|
Loading…
Reference in New Issue