From 6c93cccb70691a0c46ca6d74999d383dda57d453 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 1 Jun 2019 23:23:53 +0100 Subject: [PATCH] Implement enable/disable of LibEdit save icon. Fixes: lp:1831314 * https://bugs.launchpad.net/kicad/+bug/1831314 --- eeschema/libedit/toolbars_libedit.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/eeschema/libedit/toolbars_libedit.cpp b/eeschema/libedit/toolbars_libedit.cpp index 921b3c2280..d0073da4d5 100644 --- a/eeschema/libedit/toolbars_libedit.cpp +++ b/eeschema/libedit/toolbars_libedit.cpp @@ -31,7 +31,7 @@ #include #include #include - +#include #include #include @@ -167,6 +167,15 @@ void LIB_EDIT_FRAME::SyncMenusAndToolbars() { KIGFX::GAL_DISPLAY_OPTIONS& galOpts = GetGalDisplayOptions(); + LIB_ID libId = getTargetLibId(); + const wxString& libName = libId.GetLibNickname(); + const wxString& partName = libId.GetLibItemName(); + bool modified = m_libMgr->IsLibraryModified( libName ); + + if( !partName.IsEmpty() && m_libMgr->IsPartModified( partName, libName ) ) + modified = true; + + m_mainToolBar->Toggle( ACTIONS::saveAll, modified ); m_mainToolBar->Toggle( ACTIONS::undo, GetScreen() && GetScreen()->GetUndoCommandCount() > 0 ); m_mainToolBar->Toggle( ACTIONS::redo, GetScreen() && GetScreen()->GetRedoCommandCount() > 0 ); m_mainToolBar->Toggle( ACTIONS::zoomTool, GetToolId() == ID_ZOOM_SELECTION );