diff --git a/eeschema/lib_manager.h b/eeschema/lib_manager.h index 4d9f96b356..cbab69818b 100644 --- a/eeschema/lib_manager.h +++ b/eeschema/lib_manager.h @@ -203,6 +203,38 @@ public: */ CMP_TREE_MODEL_ADAPTER_BASE::PTR& GetAdapter() { return m_adapter; } + /** + * Returns the currently modified library name. + */ + const wxString& GetCurrentLib() const + { + return m_currentLib; + } + + /** + * Sets the currently modified library name. + */ + void SetCurrentLib( const wxString& aLibrary ) + { + m_currentLib = aLibrary; + } + + /** + * Returns the currently modified part name. + */ + const wxString& GetCurrentPart() const + { + return m_currentPart; + } + + /** + * Sets the currently modified part name. + */ + void SetCurrentPart( const wxString& aPart ) + { + m_currentPart = aPart; + } + private: ///> Parent frame LIB_EDIT_FRAME& m_frame; @@ -346,9 +378,15 @@ private: ///> The library buffers std::map m_libs; - // TODO + ///> Symbol Lib Table hash value returned during the last synchronization int m_syncHash; + ///> Currently modified part + wxString m_currentLib; + + ///> Currently modified library + wxString m_currentPart; + LIB_MANAGER_ADAPTER::PTR m_adapter; LIB_MANAGER_ADAPTER* getAdapter() { return static_cast( m_adapter.get() ); } }; diff --git a/eeschema/lib_manager_adapter.cpp b/eeschema/lib_manager_adapter.cpp index 1df471d43d..6c4d4b19b9 100644 --- a/eeschema/lib_manager_adapter.cpp +++ b/eeschema/lib_manager_adapter.cpp @@ -230,6 +230,13 @@ bool LIB_MANAGER_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsigned int aCo case CMP_TREE_NODE::LIB: // mark modified libs with bold font aAttr.SetBold( m_libMgr->IsLibraryModified( node->Name ) ); + + // mark current library with inverted colors + if( node->Name == m_libMgr->GetCurrentLib() ) + { + aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); + aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) ); + } break; case CMP_TREE_NODE::LIBID: @@ -238,6 +245,13 @@ bool LIB_MANAGER_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsigned int aCo // mark aliases with italic font aAttr.SetItalic( !node->IsRoot ); + + // mark current library with inverted colors + if( node->Name == m_libMgr->GetCurrentPart() ) + { + aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); + aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) ); + } break; default: diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index 47f13d0a79..96169f4e08 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -983,6 +983,8 @@ wxString LIB_EDIT_FRAME::SetCurLib( const wxString& aLibNickname ) else Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, aLibNickname ); + m_libMgr->SetCurrentLib( aLibNickname ); + return old; } @@ -997,8 +999,11 @@ void LIB_EDIT_FRAME::SetCurPart( LIB_PART* aPart ) m_my_part = aPart; } + wxString partName = aPart ? aPart->GetName() : wxString(); + m_libMgr->SetCurrentPart( partName ); + // retain in case this wxFrame is re-opened later on the same PROJECT - Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_PART, aPart ? aPart->GetName() : wxString() ); + Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_PART, partName ); }