Make Footprint Editor save command context-sensitive.

Fixes: lp:1795961
* https://bugs.launchpad.net/kicad/+bug/1795961
This commit is contained in:
Jeff Young 2019-04-01 15:58:42 +01:00
parent 52246121b9
commit ca25f352ce
2 changed files with 19 additions and 5 deletions

View File

@ -637,6 +637,13 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateModuleTargeted( wxUpdateUIEvent& aEvent )
void FOOTPRINT_EDIT_FRAME::OnUpdateSave( wxUpdateUIEvent& aEvent )
{
if( aEvent.GetId() == ID_MODEDIT_SAVE )
{
wxString text = IsCurrentFPFromBoard() ? _( "&Update Footprint on Board" ) : _( "&Save" );
text = AddHotkeyName( text, m_hotkeysDescrList, HK_SAVE );
aEvent.SetText( text );
}
aEvent.Enable( GetBoard()->m_Modules && GetScreen()->IsModify() );
}

View File

@ -63,11 +63,18 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
_( "New footprint using footprint wizard" ) );
#endif
m_mainToolBar->AddTool( ID_MODEDIT_SAVE, wxEmptyString,
KiScaledBitmap( IsCurrentFPFromBoard() ? save_fp_to_board_xpm : save_xpm,
this ),
IsCurrentFPFromBoard() ?
_( "Save changes to board" ) : _( "Save changes to library" ) );
if( IsCurrentFPFromBoard() )
{
m_mainToolBar->AddTool( ID_MODEDIT_SAVE, wxEmptyString,
KiScaledBitmap( save_fp_to_board_xpm, this ),
_( "Update footprint on board" ) );
}
else
{
m_mainToolBar->AddTool( ID_MODEDIT_SAVE, wxEmptyString,
KiScaledBitmap( save_xpm, this ),
_( "Save changes to library" ) );
}
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString,