Implement GetMsgPanelInfo for dimensions.

Fixes https://gitlab.com/kicad/code/kicad/issues/5673
This commit is contained in:
Jeff Young 2020-09-24 22:23:16 +01:00
parent dfaf0851fe
commit e16b7626cd
3 changed files with 42 additions and 5 deletions

View File

@ -307,7 +307,35 @@ void DIMENSION::SetEnd( const wxPoint& aEnd )
void DIMENSION::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) void DIMENSION::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{ {
// for now, display only the text within the DIMENSION using class TEXTE_PCB. // for now, display only the text within the DIMENSION using class TEXTE_PCB.
m_text.GetMsgPanelInfo( aFrame, aList ); wxString msg;
wxCHECK_RET( m_Parent != NULL, wxT( "TEXTE_PCB::GetMsgPanelInfo() m_Parent is NULL." ) );
aList.emplace_back( _( "Dimension" ), m_text.GetShownText(), DARKGREEN );
aList.emplace_back( _( "Layer" ), GetLayerName(), BLUE );
aList.emplace_back( _( "Prefix" ), GetPrefix(), BLUE );
if( GetOverrideTextEnabled() )
{
aList.emplace_back( _( "Override Text" ), GetOverrideText(), BLUE );
}
else
{
aList.emplace_back( _( "Value" ), GetValueText(), BLUE );
msg = "%" + wxString::Format( "1.%df", GetPrecision() );
aList.emplace_back( _( "Precision" ), wxString::Format( msg, 0.0 ), BLUE );
}
aList.emplace_back( _( "Suffix" ), GetSuffix(), BLUE );
EDA_UNITS units;
bool useMils;
GetUnits( units, useMils );
aList.emplace_back( _( "Units" ), GetAbbreviatedUnitsLabel( units, useMils ), BLUE );
} }
@ -913,6 +941,16 @@ void LEADER::updateGeometry()
} }
void LEADER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{
wxString msg;
aList.emplace_back( _( "Leader" ), m_text.GetShownText(), DARKGREEN );
aList.emplace_back( _( "Layer" ), GetLayerName(), BLUE );
}
CENTER_DIMENSION::CENTER_DIMENSION( BOARD_ITEM* aParent ) : CENTER_DIMENSION::CENTER_DIMENSION( BOARD_ITEM* aParent ) :
DIMENSION( aParent, PCB_DIM_CENTER_T ) DIMENSION( aParent, PCB_DIM_CENTER_T )
{ {

View File

@ -512,6 +512,8 @@ public:
void SetTextFrame( DIM_TEXT_FRAME aFrame ) { m_textFrame = aFrame; } void SetTextFrame( DIM_TEXT_FRAME aFrame ) { m_textFrame = aFrame; }
DIM_TEXT_FRAME GetTextFrame() const { return m_textFrame; } DIM_TEXT_FRAME GetTextFrame() const { return m_textFrame; }
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
protected: protected:
void updateGeometry() override; void updateGeometry() override;

View File

@ -109,9 +109,6 @@ void TEXTE_PCB::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
wxCHECK_RET( m_Parent != NULL, wxT( "TEXTE_PCB::GetMsgPanelInfo() m_Parent is NULL." ) ); wxCHECK_RET( m_Parent != NULL, wxT( "TEXTE_PCB::GetMsgPanelInfo() m_Parent is NULL." ) );
if( BaseType( m_Parent->Type() ) == PCB_DIMENSION_T )
aList.emplace_back( _( "Dimension" ), GetShownText(), DARKGREEN );
else
aList.emplace_back( _( "PCB Text" ), GetShownText(), DARKGREEN ); aList.emplace_back( _( "PCB Text" ), GetShownText(), DARKGREEN );
aList.emplace_back( _( "Layer" ), GetLayerName(), BLUE ); aList.emplace_back( _( "Layer" ), GetLayerName(), BLUE );