Add library descriptions to component tree.
Fixes: lp:1747547 * https://bugs.launchpad.net/kicad/+bug/1747547
This commit is contained in:
parent
a35cc44bd1
commit
17ce87a7a5
|
@ -256,11 +256,13 @@ void CMP_TREE_NODE_LIB_ID::UpdateScore( EDA_COMBINED_MATCHER& aMatcher )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CMP_TREE_NODE_LIB::CMP_TREE_NODE_LIB( CMP_TREE_NODE* aParent, wxString const& aName )
|
CMP_TREE_NODE_LIB::CMP_TREE_NODE_LIB( CMP_TREE_NODE* aParent,
|
||||||
|
wxString const& aName, wxString const& aDesc )
|
||||||
{
|
{
|
||||||
Type = LIB;
|
Type = LIB;
|
||||||
Name = aName;
|
Name = aName;
|
||||||
MatchName = aName.Lower();
|
MatchName = aName.Lower();
|
||||||
|
Desc = aDesc;
|
||||||
Parent = aParent;
|
Parent = aParent;
|
||||||
LibId.SetLibNickname( aName );
|
LibId.SetLibNickname( aName );
|
||||||
}
|
}
|
||||||
|
@ -292,9 +294,9 @@ CMP_TREE_NODE_ROOT::CMP_TREE_NODE_ROOT()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CMP_TREE_NODE_LIB& CMP_TREE_NODE_ROOT::AddLib( wxString const& aName )
|
CMP_TREE_NODE_LIB& CMP_TREE_NODE_ROOT::AddLib( wxString const& aName, wxString const& aDesc )
|
||||||
{
|
{
|
||||||
CMP_TREE_NODE_LIB* lib = new CMP_TREE_NODE_LIB( this, aName );
|
CMP_TREE_NODE_LIB* lib = new CMP_TREE_NODE_LIB( this, aName, aDesc );
|
||||||
Children.push_back( std::unique_ptr<CMP_TREE_NODE>( lib ) );
|
Children.push_back( std::unique_ptr<CMP_TREE_NODE>( lib ) );
|
||||||
return *lib;
|
return *lib;
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,8 +243,9 @@ public:
|
||||||
*
|
*
|
||||||
* @param aParent parent node, should be a CMP_TREE_NODE_ROOT
|
* @param aParent parent node, should be a CMP_TREE_NODE_ROOT
|
||||||
* @param aName display name of the library
|
* @param aName display name of the library
|
||||||
|
* @param aDesc a description of the library
|
||||||
*/
|
*/
|
||||||
CMP_TREE_NODE_LIB( CMP_TREE_NODE* aParent, wxString const& aName );
|
CMP_TREE_NODE_LIB( CMP_TREE_NODE* aParent, wxString const& aName, wxString const& aDesc );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new alias node, add it to this library, and return it.
|
* Construct a new alias node, add it to this library, and return it.
|
||||||
|
@ -278,7 +279,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Construct an empty library node, add it to the root, and return it.
|
* Construct an empty library node, add it to the root, and return it.
|
||||||
*/
|
*/
|
||||||
CMP_TREE_NODE_LIB& AddLib( wxString const& aName );
|
CMP_TREE_NODE_LIB& AddLib( wxString const& aName, wxString const& aDesc );
|
||||||
|
|
||||||
virtual void UpdateScore( EDA_COMBINED_MATCHER& aMatcher ) override;
|
virtual void UpdateScore( EDA_COMBINED_MATCHER& aMatcher ) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -62,7 +62,7 @@ void CMP_TREE_MODEL_ADAPTER::AddLibrary( wxString const& aLibNickname )
|
||||||
|
|
||||||
if( alias_list.size() > 0 )
|
if( alias_list.size() > 0 )
|
||||||
{
|
{
|
||||||
AddAliasList( aLibNickname, alias_list );
|
AddAliasList( aLibNickname, m_libs->GetDescription( aLibNickname ), alias_list );
|
||||||
m_tree.AssignIntrinsicRanks();
|
m_tree.AssignIntrinsicRanks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,5 +94,5 @@ void CMP_TREE_MODEL_ADAPTER::AddAliasList(
|
||||||
}
|
}
|
||||||
|
|
||||||
if( alias_list.size() > 0 )
|
if( alias_list.size() > 0 )
|
||||||
AddAliasList( aNodeName, alias_list );
|
AddAliasList( aNodeName, m_libs->GetDescription( aNodeName ), alias_list );
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,11 +143,10 @@ void CMP_TREE_MODEL_ADAPTER_BASE::AddLibrariesWithProgress(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CMP_TREE_MODEL_ADAPTER_BASE::AddAliasList(
|
void CMP_TREE_MODEL_ADAPTER_BASE::AddAliasList( wxString const& aNodeName, wxString const& aDesc,
|
||||||
wxString const& aNodeName,
|
|
||||||
std::vector<LIB_ALIAS*> const& aAliasList )
|
std::vector<LIB_ALIAS*> const& aAliasList )
|
||||||
{
|
{
|
||||||
auto& lib_node = m_tree.AddLib( aNodeName );
|
auto& lib_node = m_tree.AddLib( aNodeName, aDesc );
|
||||||
|
|
||||||
for( auto a: aAliasList )
|
for( auto a: aAliasList )
|
||||||
{
|
{
|
||||||
|
|
|
@ -176,10 +176,12 @@ public:
|
||||||
* phase.
|
* phase.
|
||||||
*
|
*
|
||||||
* @param aNodeName the parent node the components will appear under
|
* @param aNodeName the parent node the components will appear under
|
||||||
|
* @param aDesc the description field of the parent node
|
||||||
* @param aAliasList list of aliases
|
* @param aAliasList list of aliases
|
||||||
*/
|
*/
|
||||||
void AddAliasList(
|
void AddAliasList(
|
||||||
wxString const& aNodeName,
|
wxString const& aNodeName,
|
||||||
|
wxString const& aDesc,
|
||||||
std::vector<LIB_ALIAS*> const& aAliasList );
|
std::vector<LIB_ALIAS*> const& aAliasList );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -145,7 +145,7 @@ SCH_BASE_FRAME::COMPONENT_SELECTION SCH_BASE_FRAME::SelectComponentFromLibrary(
|
||||||
history_list.push_back( alias );
|
history_list.push_back( alias );
|
||||||
}
|
}
|
||||||
|
|
||||||
adapter->AddAliasList( "-- " + _( "History" ) + " --", history_list );
|
adapter->AddAliasList( "-- " + _( "History" ) + " --", _( "Recently used items" ), history_list );
|
||||||
adapter->SetPreselectNode( aHistoryList[0].LibId, aHistoryList[0].Unit );
|
adapter->SetPreselectNode( aHistoryList[0].LibId, aHistoryList[0].Unit );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,12 @@ wxArrayString LIB_MANAGER::GetLibraryNames() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SYMBOL_LIB_TABLE_ROW* LIB_MANAGER::GetLibrary( const wxString& aLibrary )
|
||||||
|
{
|
||||||
|
return symTable()->FindRow( aLibrary );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LIB_MANAGER::FlushAll()
|
bool LIB_MANAGER::FlushAll()
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
|
@ -41,6 +41,7 @@ class PART_LIB;
|
||||||
class SCH_PLUGIN;
|
class SCH_PLUGIN;
|
||||||
class LIB_EDIT_FRAME;
|
class LIB_EDIT_FRAME;
|
||||||
class SYMBOL_LIB_TABLE;
|
class SYMBOL_LIB_TABLE;
|
||||||
|
class SYMBOL_LIB_TABLE_ROW;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to handle modifications to the symbol libraries.
|
* Class to handle modifications to the symbol libraries.
|
||||||
|
@ -72,6 +73,11 @@ public:
|
||||||
*/
|
*/
|
||||||
wxArrayString GetLibraryNames() const;
|
wxArrayString GetLibraryNames() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds a single library within the (aggregate) library table.
|
||||||
|
*/
|
||||||
|
SYMBOL_LIB_TABLE_ROW* GetLibrary( const wxString& aLibrary );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a set containing all part names for a specific library.
|
* Returns a set containing all part names for a specific library.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include <lib_manager_adapter.h>
|
#include <lib_manager_adapter.h>
|
||||||
#include <lib_manager.h>
|
#include <lib_manager.h>
|
||||||
|
#include <symbol_lib_table.h>
|
||||||
#include <class_libentry.h>
|
#include <class_libentry.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,7 +105,9 @@ void LIB_MANAGER_ADAPTER::Sync( bool aForce, std::function<void(int, int, const
|
||||||
nextUpdate = wxGetUTCTimeMillis() + PROGRESS_INTERVAL_MILLIS;
|
nextUpdate = wxGetUTCTimeMillis() + PROGRESS_INTERVAL_MILLIS;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& lib_node = m_tree.AddLib( libName );
|
SYMBOL_LIB_TABLE_ROW* library = m_libMgr->GetLibrary( libName );
|
||||||
|
|
||||||
|
auto& lib_node = m_tree.AddLib( libName, library->GetDescr() );
|
||||||
updateLibrary( lib_node );
|
updateLibrary( lib_node );
|
||||||
m_tree.AssignIntrinsicRanks();
|
m_tree.AssignIntrinsicRanks();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue