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.
This commit is contained in:
parent
0bd83d3096
commit
683a327200
|
@ -110,6 +110,13 @@ bool FOOTPRINT_EDITOR_CONTROL::Init()
|
||||||
return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
|
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::pinLibrary, unpinnedLibSelectedCondition );
|
||||||
ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLibSelectedCondition );
|
ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLibSelectedCondition );
|
||||||
|
|
||||||
|
@ -132,7 +139,7 @@ bool FOOTPRINT_EDITOR_CONTROL::Init()
|
||||||
|
|
||||||
ctxMenu.AddSeparator();
|
ctxMenu.AddSeparator();
|
||||||
ctxMenu.AddItem( PCB_ACTIONS::importFootprint, libInferredCondition );
|
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
|
// If we've got nothing else to show, at least show a hide tree option
|
||||||
ctxMenu.AddItem( PCB_ACTIONS::hideFootprintTree, !libInferredCondition );
|
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 )
|
int FOOTPRINT_EDITOR_CONTROL::ExportFootprint( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
LIB_ID fpID = m_frame->GetTreeFPID();
|
LIB_ID fpID = m_frame->GetTreeFPID();
|
||||||
FOOTPRINT* fp;
|
FOOTPRINT* fp = m_frame->GetBoard()->GetFirstFootprint();
|
||||||
|
|
||||||
if( !fpID.IsValid() )
|
if( fp )
|
||||||
fp = m_frame->GetBoard()->GetFirstFootprint();
|
m_frame->ExportFootprint( fp );
|
||||||
else
|
|
||||||
fp = m_frame->LoadFootprint( fpID );
|
|
||||||
|
|
||||||
m_frame->ExportFootprint( fp );
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -445,7 +445,7 @@ TOOL_ACTION PCB_ACTIONS::importFootprint( "pcbnew.ModuleEditor.importFootprint",
|
||||||
|
|
||||||
TOOL_ACTION PCB_ACTIONS::exportFootprint( "pcbnew.ModuleEditor.exportFootprint",
|
TOOL_ACTION PCB_ACTIONS::exportFootprint( "pcbnew.ModuleEditor.exportFootprint",
|
||||||
AS_GLOBAL, 0, "",
|
AS_GLOBAL, 0, "",
|
||||||
_( "Export Footprint..." ), _( "Export footprint to file" ),
|
_( "Export Current Footprint..." ), _( "Export edited footprint to file" ),
|
||||||
BITMAPS::export_module );
|
BITMAPS::export_module );
|
||||||
|
|
||||||
TOOL_ACTION PCB_ACTIONS::footprintProperties( "pcbnew.ModuleEditor.footprintProperties",
|
TOOL_ACTION PCB_ACTIONS::footprintProperties( "pcbnew.ModuleEditor.footprintProperties",
|
||||||
|
|
Loading…
Reference in New Issue