From ca25f352ce2c215cabf481c0d3720ab8388f0a37 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 1 Apr 2019 15:58:42 +0100 Subject: [PATCH] Make Footprint Editor save command context-sensitive. Fixes: lp:1795961 * https://bugs.launchpad.net/kicad/+bug/1795961 --- pcbnew/footprint_edit_frame.cpp | 7 +++++++ pcbnew/tool_footprint_editor.cpp | 17 ++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 3b9de95589..c97fda8718 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -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() ); } diff --git a/pcbnew/tool_footprint_editor.cpp b/pcbnew/tool_footprint_editor.cpp index 783591ece7..cb6a37518d 100644 --- a/pcbnew/tool_footprint_editor.cpp +++ b/pcbnew/tool_footprint_editor.cpp @@ -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,