diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index 95c2f6ad6c..9e6dee3cc9 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -1024,21 +1024,23 @@ void FOOTPRINT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorIsType( FRAME_FOOTPRINT_VIEWER_MODAL ) || aFrame->IsType( FRAME_FOOTPRINT_EDITOR ) ) { - wxDateTime date( static_cast( 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 ); - } - else if( aFrame->IsType( FRAME_PCB_EDITOR ) ) - { - aList.emplace_back( _( "Board Side" ), IsFlipped() ? _( "Back (Flipped)" ) : _( "Front" ) ); + 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; } + // aFrame is the board editor: + aList.emplace_back( _( "Board Side" ), IsFlipped() ? _( "Back (Flipped)" ) : _( "Front" ) ); + auto addToken = []( wxString* aStr, const wxString& aAttr ) { if( !aStr->IsEmpty() ) @@ -1050,7 +1052,7 @@ void FOOTPRINT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorGetName() == PCB_EDIT_FRAME_NAME && IsLocked() ) + if( IsLocked() ) addToken( &status, _( "Locked" ) ); if( m_fpStatus & FP_is_PLACED ) diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 0cb5afef4c..e45ca6c2a1 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -334,6 +334,21 @@ FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME() } +void FOOTPRINT_EDIT_FRAME::UpdateMsgPanel() +{ + EDA_DRAW_FRAME::UpdateMsgPanel(); + + FOOTPRINT* fp = static_cast( GetModel() ); + + if( fp ) + { + std::vector msgItems; + fp->GetMsgPanelInfo( this, msgItems ); + SetMsgPanel( msgItems ); + } +} + + bool FOOTPRINT_EDIT_FRAME::IsContentModified() const { return GetScreen() && GetScreen()->IsContentModified() diff --git a/pcbnew/footprint_edit_frame.h b/pcbnew/footprint_edit_frame.h index 0819d00bd9..5d36fe54d0 100644 --- a/pcbnew/footprint_edit_frame.h +++ b/pcbnew/footprint_edit_frame.h @@ -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 */ diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp index be66cc95cb..84149d511d 100644 --- a/pcbnew/footprint_viewer_frame.cpp +++ b/pcbnew/footprint_viewer_frame.cpp @@ -370,6 +370,21 @@ SELECTION& FOOTPRINT_VIEWER_FRAME::GetCurrentSelection() } +void FOOTPRINT_VIEWER_FRAME::UpdateMsgPanel() +{ + EDA_DRAW_FRAME::UpdateMsgPanel(); + + FOOTPRINT* fp = static_cast( GetModel() ); + + if( fp ) + { + std::vector msgItems; + fp->GetMsgPanelInfo( this, msgItems ); + SetMsgPanel( msgItems ); + } +} + + void FOOTPRINT_VIEWER_FRAME::setupUIConditions() { PCB_BASE_FRAME::setupUIConditions(); diff --git a/pcbnew/footprint_viewer_frame.h b/pcbnew/footprint_viewer_frame.h index f66a3db244..e2444c4f71 100644 --- a/pcbnew/footprint_viewer_frame.h +++ b/pcbnew/footprint_viewer_frame.h @@ -72,6 +72,9 @@ public: */ void OnUpdateFootprintButton( wxUpdateUIEvent& aEvent ); + ///< @copydoc EDADRAW_FRAME::UpdateMsgPanel + void UpdateMsgPanel() override; + /** * Run the footprint viewer as a modal dialog. * diff --git a/pcbnew/tools/pcb_control.cpp b/pcbnew/tools/pcb_control.cpp index a8ed957b07..2c722143dd 100644 --- a/pcbnew/tools/pcb_control.cpp +++ b/pcbnew/tools/pcb_control.cpp @@ -1359,16 +1359,7 @@ int PCB_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent ) if( !pcbFrame ) { FOOTPRINT* fp = static_cast( 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 {