Fp editor and Fp viewer: fix missing info on msg panel after loading a fp
Fix also duplicate/not used code Fixes #11404 https://gitlab.com/kicad/code/kicad/issues/11404
This commit is contained in:
parent
f80fea6593
commit
b2f6c13b6a
|
@ -1024,20 +1024,22 @@ void FOOTPRINT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
|||
|| aFrame->IsType( FRAME_FOOTPRINT_VIEWER_MODAL )
|
||||
|| aFrame->IsType( FRAME_FOOTPRINT_EDITOR ) )
|
||||
{
|
||||
wxDateTime date( static_cast<time_t>( m_lastEditTime ) );
|
||||
size_t padCount = GetPadCount( DO_NOT_INCLUDE_NPTH );
|
||||
|
||||
// Date format: see http://www.cplusplus.com/reference/ctime/strftime
|
||||
if( m_lastEditTime && date.IsValid() )
|
||||
msg = date.Format( wxT( "%b %d, %Y" ) ); // Abbreviated_month_name Day, Year
|
||||
else
|
||||
msg = _( "Unknown" );
|
||||
aList.emplace_back( _( "Library" ), GetFPID().GetLibNickname().wx_str() );
|
||||
|
||||
aList.emplace_back( _( "Last Change" ), msg );
|
||||
aList.emplace_back( _( "Footprint Name" ), GetFPID().GetLibItemName().wx_str() );
|
||||
|
||||
aList.emplace_back( _( "Pads" ), wxString::Format( wxT( "%zu" ), padCount ) );
|
||||
|
||||
aList.emplace_back( wxString::Format( _( "Doc: %s" ), GetDescription() ),
|
||||
wxString::Format( _( "Keywords: %s" ), GetKeywords() ) );
|
||||
|
||||
return;
|
||||
}
|
||||
else if( aFrame->IsType( FRAME_PCB_EDITOR ) )
|
||||
{
|
||||
|
||||
// aFrame is the board editor:
|
||||
aList.emplace_back( _( "Board Side" ), IsFlipped() ? _( "Back (Flipped)" ) : _( "Front" ) );
|
||||
}
|
||||
|
||||
auto addToken = []( wxString* aStr, const wxString& aAttr )
|
||||
{
|
||||
|
@ -1050,7 +1052,7 @@ void FOOTPRINT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
|||
wxString status;
|
||||
wxString attrs;
|
||||
|
||||
if( aFrame->GetName() == PCB_EDIT_FRAME_NAME && IsLocked() )
|
||||
if( IsLocked() )
|
||||
addToken( &status, _( "Locked" ) );
|
||||
|
||||
if( m_fpStatus & FP_is_PLACED )
|
||||
|
|
|
@ -334,6 +334,21 @@ FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME()
|
|||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::UpdateMsgPanel()
|
||||
{
|
||||
EDA_DRAW_FRAME::UpdateMsgPanel();
|
||||
|
||||
FOOTPRINT* fp = static_cast<FOOTPRINT*>( GetModel() );
|
||||
|
||||
if( fp )
|
||||
{
|
||||
std::vector<MSG_PANEL_ITEM> msgItems;
|
||||
fp->GetMsgPanelInfo( this, msgItems );
|
||||
SetMsgPanel( msgItems );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool FOOTPRINT_EDIT_FRAME::IsContentModified() const
|
||||
{
|
||||
return GetScreen() && GetScreen()->IsContentModified()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
|
@ -103,6 +103,9 @@ public:
|
|||
*/
|
||||
void UpdateUserInterface();
|
||||
|
||||
///< @copydoc EDADRAW_FRAME::UpdateMsgPanel
|
||||
void UpdateMsgPanel() override;
|
||||
|
||||
/**
|
||||
* Refresh the library tree and redraw the window
|
||||
*/
|
||||
|
|
|
@ -370,6 +370,21 @@ SELECTION& FOOTPRINT_VIEWER_FRAME::GetCurrentSelection()
|
|||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::UpdateMsgPanel()
|
||||
{
|
||||
EDA_DRAW_FRAME::UpdateMsgPanel();
|
||||
|
||||
FOOTPRINT* fp = static_cast<FOOTPRINT*>( GetModel() );
|
||||
|
||||
if( fp )
|
||||
{
|
||||
std::vector<MSG_PANEL_ITEM> msgItems;
|
||||
fp->GetMsgPanelInfo( this, msgItems );
|
||||
SetMsgPanel( msgItems );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::setupUIConditions()
|
||||
{
|
||||
PCB_BASE_FRAME::setupUIConditions();
|
||||
|
|
|
@ -72,6 +72,9 @@ public:
|
|||
*/
|
||||
void OnUpdateFootprintButton( wxUpdateUIEvent& aEvent );
|
||||
|
||||
///< @copydoc EDADRAW_FRAME::UpdateMsgPanel
|
||||
void UpdateMsgPanel() override;
|
||||
|
||||
/**
|
||||
* Run the footprint viewer as a modal dialog.
|
||||
*
|
||||
|
|
|
@ -1359,16 +1359,7 @@ int PCB_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
|
|||
if( !pcbFrame )
|
||||
{
|
||||
FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_frame->GetModel() );
|
||||
size_t padCount = fp->GetPadCount( DO_NOT_INCLUDE_NPTH );
|
||||
|
||||
msgItems.emplace_back( _( "Library" ), fp->GetFPID().GetLibNickname().wx_str() );
|
||||
|
||||
msgItems.emplace_back( _( "Footprint Name" ), fp->GetFPID().GetLibItemName().wx_str() );
|
||||
|
||||
msgItems.emplace_back( _( "Pads" ), wxString::Format( wxT( "%zu" ), padCount ) );
|
||||
|
||||
msgItems.emplace_back( wxString::Format( _( "Doc: %s" ), fp->GetDescription() ),
|
||||
wxString::Format( _( "Keywords: %s" ), fp->GetKeywords() ) );
|
||||
fp->GetMsgPanelInfo( m_frame, msgItems );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue