Update description in footprint tree when it's edited.

Fixes: lp:1842660
* https://bugs.launchpad.net/kicad/+bug/1842660

(cherry picked from commit 6688e80131)
This commit is contained in:
Jeff Young 2019-09-04 17:18:42 +01:00
parent a79526cad8
commit 0e90c719b0
2 changed files with 23 additions and 4 deletions

View File

@ -826,6 +826,22 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
}
class BASIC_FOOTPRINT_INFO : public FOOTPRINT_INFO
{
public:
BASIC_FOOTPRINT_INFO( MODULE* aModule )
{
m_nickname = aModule->GetFPID().GetLibNickname().wx_str();
m_fpname = aModule->GetFPID().GetLibItemName().wx_str();
m_pad_count = aModule->GetPadCount( DO_NOT_INCLUDE_NPTH );
m_unique_pad_count = aModule->GetUniquePadCount( DO_NOT_INCLUDE_NPTH );
m_keywords = aModule->GetKeywords();
m_doc = aModule->GetDescription();
m_loaded = true;
}
};
void FOOTPRINT_EDIT_FRAME::editFootprintProperties( MODULE* aModule )
{
LIB_ID oldFPID = aModule->GetFPID();
@ -835,6 +851,12 @@ void FOOTPRINT_EDIT_FRAME::editFootprintProperties( MODULE* aModule )
GetScreen()->GetCurItem()->ClearFlags();
// Update library tree
BASIC_FOOTPRINT_INFO footprintInfo( aModule );
wxDataViewItem treeItem = m_adapter->FindItem( oldFPID );
static_cast<LIB_TREE_NODE_LIB_ID*>( treeItem.GetID() )->Update( &footprintInfo );
m_treePane->GetLibTree()->Refresh();
updateTitle(); // in case of a name change...
}

View File

@ -176,10 +176,7 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataViewIte
break;
case 1:
if( node->LibId == m_frame->GetLoadedFPID() && !m_frame->IsCurrentFPFromBoard() )
aVariant = m_frame->GetBoard()->m_Modules->GetDescription();
else
aVariant = node->Desc;
aVariant = node->Desc;
break;
default: // column == -1 is used for default Compare function