Cleanup of PCBNew message panel routines.

Also fixes bugs where invalid netclasses were reported as "Default",
and SMD pads were reported as having "0.0000" drills.
This commit is contained in:
Jeff Young 2020-11-30 14:35:48 +00:00
parent 3a9a6e22bc
commit c66e373119
12 changed files with 196 additions and 310 deletions

View File

@ -314,28 +314,28 @@ void DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
wxCHECK_RET( m_parent != NULL, wxT( "PCB_TEXT::GetMsgPanelInfo() m_Parent is NULL." ) ); wxCHECK_RET( m_parent != NULL, wxT( "PCB_TEXT::GetMsgPanelInfo() m_Parent is NULL." ) );
aList.emplace_back( _( "Dimension" ), m_text.GetShownText(), DARKGREEN ); aList.emplace_back( _( "Dimension" ), m_text.GetShownText() );
aList.emplace_back( _( "Prefix" ), GetPrefix(), BLUE ); aList.emplace_back( _( "Prefix" ), GetPrefix() );
if( GetOverrideTextEnabled() ) if( GetOverrideTextEnabled() )
{ {
aList.emplace_back( _( "Override Text" ), GetOverrideText(), BLUE ); aList.emplace_back( _( "Override Text" ), GetOverrideText() );
} }
else else
{ {
aList.emplace_back( _( "Value" ), GetValueText(), BLUE ); aList.emplace_back( _( "Value" ), GetValueText() );
msg = "%" + wxString::Format( "1.%df", GetPrecision() ); msg = "%" + wxString::Format( "1.%df", GetPrecision() );
aList.emplace_back( _( "Precision" ), wxString::Format( msg, 0.0 ), BLUE ); aList.emplace_back( _( "Precision" ), wxString::Format( msg, 0.0 ) );
} }
aList.emplace_back( _( "Suffix" ), GetSuffix(), BLUE ); aList.emplace_back( _( "Suffix" ), GetSuffix() );
EDA_UNITS units; EDA_UNITS units;
GetUnits( units ); GetUnits( units );
aList.emplace_back( _( "Units" ), GetAbbreviatedUnitsLabel( units ), BLUE ); aList.emplace_back( _( "Units" ), GetAbbreviatedUnitsLabel( units ) );
ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms(); ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms();
units = aFrame->GetUserUnits(); units = aFrame->GetUserUnits();
@ -347,7 +347,7 @@ void DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
MessageTextFromValue( units, startCoord.x ), MessageTextFromValue( units, startCoord.x ),
MessageTextFromValue( units, startCoord.y ) ); MessageTextFromValue( units, startCoord.y ) );
aList.emplace_back( start, wxEmptyString, DARKGREEN ); aList.emplace_back( start, wxEmptyString );
} }
else else
{ {
@ -360,10 +360,10 @@ void DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
MessageTextFromValue( units, endCoord.x ), MessageTextFromValue( units, endCoord.x ),
MessageTextFromValue( units, endCoord.y ) ); MessageTextFromValue( units, endCoord.y ) );
aList.emplace_back( start, end, DARKGREEN ); aList.emplace_back( start, end );
} }
aList.emplace_back( _( "Layer" ), GetLayerName(), DARKBROWN ); aList.emplace_back( _( "Layer" ), GetLayerName() );
} }
@ -954,7 +954,7 @@ void LEADER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM
{ {
wxString msg; wxString msg;
aList.emplace_back( _( "Leader" ), m_text.GetShownText(), DARKGREEN ); aList.emplace_back( _( "Leader" ), m_text.GetShownText() );
ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms(); ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms();
EDA_UNITS units = aFrame->GetUserUnits(); EDA_UNITS units = aFrame->GetUserUnits();
@ -964,9 +964,9 @@ void LEADER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM
MessageTextFromValue( units, startCoord.x ), MessageTextFromValue( units, startCoord.x ),
MessageTextFromValue( units, startCoord.y ) ); MessageTextFromValue( units, startCoord.y ) );
aList.emplace_back( start, wxEmptyString, DARKGREEN ); aList.emplace_back( start, wxEmptyString );
aList.emplace_back( _( "Layer" ), GetLayerName(), BLUE ); aList.emplace_back( _( "Layer" ), GetLayerName() );
} }

View File

@ -728,7 +728,7 @@ void FOOTPRINT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
{ {
wxString msg, msg2; wxString msg, msg2;
aList.emplace_back( m_reference->GetShownText(), m_value->GetShownText(), DARKCYAN ); aList.emplace_back( m_reference->GetShownText(), m_value->GetShownText() );
if( aFrame->IsType( FRAME_FOOTPRINT_VIEWER ) if( aFrame->IsType( FRAME_FOOTPRINT_VIEWER )
|| aFrame->IsType( FRAME_FOOTPRINT_VIEWER_MODAL ) || aFrame->IsType( FRAME_FOOTPRINT_VIEWER_MODAL )
@ -742,12 +742,11 @@ void FOOTPRINT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
else else
msg = _( "Unknown" ); msg = _( "Unknown" );
aList.emplace_back( _( "Last Change" ), msg, BROWN ); aList.emplace_back( _( "Last Change" ), msg );
} }
else if( aFrame->IsType( FRAME_PCB_EDITOR ) ) else if( aFrame->IsType( FRAME_PCB_EDITOR ) )
{ {
aList.emplace_back( _( "Board Side" ), IsFlipped() ? _( "Back (Flipped)" ) aList.emplace_back( _( "Board Side" ), IsFlipped() ? _( "Back (Flipped)" ) : _( "Front" ) );
: _( "Front" ), RED );
} }
auto addToken = []( wxString* aStr, const wxString& aAttr ) auto addToken = []( wxString* aStr, const wxString& aAttr )
@ -776,19 +775,18 @@ void FOOTPRINT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
if( m_attributes & FP_EXCLUDE_FROM_BOM ) if( m_attributes & FP_EXCLUDE_FROM_BOM )
addToken( &attrs, _( "exclude from BOM" ) ); addToken( &attrs, _( "exclude from BOM" ) );
aList.emplace_back( _( "Status: " ) + status, _( "Attributes:" ) + wxS( " " ) + attrs, BROWN ); aList.emplace_back( _( "Status: " ) + status, _( "Attributes:" ) + wxS( " " ) + attrs );
msg.Printf( "%.4g", GetOrientationDegrees() ); aList.emplace_back( _( "Rotation" ), wxString::Format( "%.4g", GetOrientationDegrees() ) );
aList.emplace_back( _( "Rotation" ), msg, BROWN );
msg.Printf( _( "Footprint: %s" ), m_fpid.Format().c_str() ); msg.Printf( _( "Footprint: %s" ), m_fpid.Format().c_str() );
msg2.Printf( _( "3D-Shape: %s" ), msg2.Printf( _( "3D-Shape: %s" ), m_3D_Drawings.empty() ? _( "<none>" )
m_3D_Drawings.empty() ? _( "none" ) : m_3D_Drawings.front().m_Filename ); : m_3D_Drawings.front().m_Filename );
aList.emplace_back( msg, msg2, BLUE ); aList.emplace_back( msg, msg2 );
msg.Printf( _( "Doc: %s" ), m_doc ); msg.Printf( _( "Doc: %s" ), m_doc );
msg2.Printf( _( "Keywords: %s" ), m_keywords ); msg2.Printf( _( "Keywords: %s" ), m_keywords );
aList.emplace_back( msg, msg2, BLACK ); aList.emplace_back( msg, msg2 );
} }

View File

@ -107,21 +107,11 @@ void FP_SHAPE::SetDrawCoord()
} }
// see class_edge_mod.h
void FP_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) void FP_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{ {
wxString msg;
FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_parent ); FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_parent );
if( !fp ) aList.emplace_back( _( "Footprint" ), fp ? fp->GetReference() : _( "<invalid>" ) );
return;
BOARD* board = (BOARD*) fp->GetParent();
if( !board )
return;
aList.emplace_back( _( "Footprint" ), fp->GetReference(), DARKCYAN );
// append the features shared with the base class // append the features shared with the base class
PCB_SHAPE::GetMsgPanelInfo( aFrame, aList ); PCB_SHAPE::GetMsgPanelInfo( aFrame, aList );

View File

@ -270,58 +270,41 @@ double FP_TEXT::GetDrawRotation() const
} }
// see class_text_mod.h
void FP_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) void FP_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{ {
FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent ); FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_parent );
wxString msg;
if( parentFootprint == NULL ) // Happens in footprint editor, and for new texts
return;
wxString msg, Line;
static const wxString text_type_msg[3] = static const wxString text_type_msg[3] =
{ {
_( "Ref." ), _( "Value" ), _( "Text" ) _( "Ref." ), _( "Value" ), _( "Text" )
}; };
Line = parentFootprint->GetReference(); aList.emplace_back( _( "Footprint" ), fp ? fp->GetReference() : _( "<invalid>" ) );
aList.emplace_back( _( "Footprint" ), Line, DARKCYAN );
Line = GetShownText(); aList.emplace_back( _( "Text" ), GetShownText() );
aList.emplace_back( _( "Text" ), Line, BROWN );
wxASSERT( m_Type >= TEXT_is_REFERENCE && m_Type <= TEXT_is_DIVERS ); wxASSERT( m_Type >= TEXT_is_REFERENCE && m_Type <= TEXT_is_DIVERS );
aList.emplace_back( _( "Type" ), text_type_msg[m_Type], DARKGREEN ); aList.emplace_back( _( "Type" ), text_type_msg[m_Type] );
if( !IsVisible() ) aList.emplace_back( _( "Display" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
msg = _( "No" );
else
msg = _( "Yes" );
aList.emplace_back( _( "Display" ), msg, DARKGREEN );
// Display text layer // Display text layer
aList.emplace_back( _( "Layer" ), GetLayerName(), DARKGREEN ); aList.emplace_back( _( "Layer" ), GetLayerName() );
if( IsMirrored() ) aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
msg = _( "Yes" );
else
msg = _( "No" );
aList.emplace_back( _( "Mirror" ), msg, DARKGREEN );
msg.Printf( wxT( "%.1f" ), GetTextAngleDegrees() ); msg.Printf( wxT( "%.1f" ), GetTextAngleDegrees() );
aList.emplace_back( _( "Angle" ), msg, DARKGREEN ); aList.emplace_back( _( "Angle" ), msg );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextThickness() ); msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextThickness() );
aList.emplace_back( _( "Thickness" ), msg, DARKGREEN ); aList.emplace_back( _( "Thickness" ), msg );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() ); msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() );
aList.emplace_back( _( "Width" ), msg, RED ); aList.emplace_back( _( "Width" ), msg );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextHeight() ); msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextHeight() );
aList.emplace_back( _( "Height" ), msg, RED ); aList.emplace_back( _( "Height" ), msg );
} }

View File

@ -70,23 +70,20 @@ void NETINFO_ITEM::SetClass( const NETCLASSPTR& aNetClass )
void NETINFO_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) void NETINFO_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{ {
wxString txt; wxString msg;
double lengthnet = 0.0; // This is the length of tracks on pcb
double lengthPadToDie = 0.0; // this is the length of internal ICs connections
aList.emplace_back( _( "Net Name" ), GetNetname(), RED ); aList.emplace_back( _( "Net Name" ), UnescapeString( GetNetname() ) );
txt.Printf( wxT( "%d" ), GetNet() ); aList.emplace_back( _( "Net Code" ), wxString::Format( "%d", GetNet() ) );
aList.emplace_back( _( "Net Code" ), txt, RED );
// Warning: for netcode == NETINFO_LIST::ORPHANED, the parent or the board // Warning: for netcode == NETINFO_LIST::ORPHANED, the parent or the board can be NULL
// can be NULL
BOARD * board = m_parent ? m_parent->GetBoard() : NULL; BOARD * board = m_parent ? m_parent->GetBoard() : NULL;
if( board == NULL ) if( board )
return; {
int count = 0; int count = 0;
double lengthNet = 0.0; // This is the length of tracks on pcb
double lengthPadToDie = 0.0; // this is the length of internal ICs connections
for( FOOTPRINT* footprint : board->Footprints() ) for( FOOTPRINT* footprint : board->Footprints() )
{ {
@ -100,8 +97,7 @@ void NETINFO_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANE
} }
} }
txt.Printf( wxT( "%d" ), count ); aList.emplace_back( _( "Pads" ), wxString::Format( "%d", count ) );
aList.emplace_back( _( "Pads" ), txt, DARKGREEN );
count = 0; count = 0;
@ -116,22 +112,22 @@ void NETINFO_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANE
if( track->Type() == PCB_TRACE_T ) if( track->Type() == PCB_TRACE_T )
{ {
if( track->GetNetCode() == GetNet() ) if( track->GetNetCode() == GetNet() )
lengthnet += track->GetLength(); lengthNet += track->GetLength();
} }
} }
txt.Printf( wxT( "%d" ), count ); aList.emplace_back( _( "Vias" ), wxString::Format( "%d", count ) );
aList.emplace_back( _( "Vias" ), txt, BLUE );
// Displays the full net length (tracks on pcb + internal ICs connections ): // Displays the full net length (tracks on pcb + internal ICs connections ):
txt = MessageTextFromValue( aFrame->GetUserUnits(), lengthnet + lengthPadToDie ); msg = MessageTextFromValue( aFrame->GetUserUnits(), lengthNet + lengthPadToDie );
aList.emplace_back( _( "Net Length" ), txt, RED ); aList.emplace_back( _( "Net Length" ), msg );
// Displays the net length of tracks only: // Displays the net length of tracks only:
txt = MessageTextFromValue( aFrame->GetUserUnits(), lengthnet ); msg = MessageTextFromValue( aFrame->GetUserUnits(), lengthNet );
aList.emplace_back( _( "On Board" ), txt, RED ); aList.emplace_back( _( "On Board" ), msg );
// Displays the net length of internal ICs connections (wires inside ICs): // Displays the net length of internal ICs connections (wires inside ICs):
txt = MessageTextFromValue( aFrame->GetUserUnits(), lengthPadToDie ); msg = MessageTextFromValue( aFrame->GetUserUnits(), lengthPadToDie );
aList.emplace_back( _( "In Package" ), txt, RED ); aList.emplace_back( _( "In Package" ), msg );
}
} }

View File

@ -803,31 +803,22 @@ int PAD::GetEffectiveThermalGap( wxString* aSource ) const
void PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) void PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{ {
EDA_UNITS units = aFrame->GetUserUnits(); EDA_UNITS units = aFrame->GetUserUnits();
wxString msg, msg2; wxString msg;
BOARD* board = GetBoard();
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent ); FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent );
if( parentFootprint ) if( parentFootprint )
aList.emplace_back( _( "Footprint" ), parentFootprint->GetReference(), DARKCYAN ); aList.emplace_back( _( "Footprint" ), parentFootprint->GetReference() );
aList.emplace_back( _( "Pad" ), m_name, BROWN ); aList.emplace_back( _( "Pad" ), m_name );
if( !GetPinFunction().IsEmpty() ) if( !GetPinFunction().IsEmpty() )
aList.emplace_back( _( "Pin Name" ), GetPinFunction(), BROWN ); aList.emplace_back( _( "Pin Name" ), GetPinFunction() );
aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ), DARKCYAN ); aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ) );
// Display the netclass name (a pad having a netcode = 0 (no net) use the aList.emplace_back( _( "NetClass" ), UnescapeString( GetNetClass()->GetName() ) );
// default netclass for clearance):
if( m_netinfo->GetNet() <= 0 )
msg = bds.GetDefault()->GetName();
else
msg = GetNetClassName();
aList.emplace_back( _( "NetClass" ), msg, CYAN ); aList.emplace_back( _( "Layer" ), layerMaskDescribe() );
aList.emplace_back( _( "Layer" ), layerMaskDescribe(), DARKGREEN );
// Show the pad shape, attribute and property // Show the pad shape, attribute and property
wxString props = ShowPadAttr(); wxString props = ShowPadAttr();
@ -846,21 +837,16 @@ void PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
case PAD_PROP_CASTELLATED: props += _("Castellated" ); break; case PAD_PROP_CASTELLATED: props += _("Castellated" ); break;
} }
aList.emplace_back( ShowPadShape(), props, DARKGREEN ); aList.emplace_back( ShowPadShape(), props );
if( (GetShape() == PAD_SHAPE_CIRCLE || GetShape() == PAD_SHAPE_OVAL ) if( ( GetShape() == PAD_SHAPE_CIRCLE || GetShape() == PAD_SHAPE_OVAL ) && m_size.x == m_size.y )
&& m_size.x == m_size.y )
{ {
msg = MessageTextFromValue( units, m_size.x ); aList.emplace_back( _( "Diameter" ), MessageTextFromValue( units, m_size.x ) );
aList.emplace_back( _( "Diameter" ), msg, RED );
} }
else else
{ {
msg = MessageTextFromValue( units, m_size.x ); aList.emplace_back( _( "Width" ), MessageTextFromValue( units, m_size.x ) );
aList.emplace_back( _( "Width" ), msg, RED ); aList.emplace_back( _( "Height" ), MessageTextFromValue( units, m_size.y ) );
msg = MessageTextFromValue( units, m_size.y );
aList.emplace_back( _( "Height" ), msg, RED );
} }
double fp_orient_degrees = parentFootprint ? parentFootprint->GetOrientationDegrees() : 0; double fp_orient_degrees = parentFootprint ? parentFootprint->GetOrientationDegrees() : 0;
@ -872,34 +858,37 @@ void PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
else else
msg.Printf( wxT( "%.4g" ), GetOrientationDegrees() ); msg.Printf( wxT( "%.4g" ), GetOrientationDegrees() );
aList.push_back( MSG_PANEL_ITEM( _( "Rotation" ), msg, LIGHTBLUE ) ); aList.emplace_back( _( "Rotation" ), msg );
if( GetPadToDieLength() ) if( GetPadToDieLength() )
{ {
msg = MessageTextFromValue(units, GetPadToDieLength() ); msg = MessageTextFromValue(units, GetPadToDieLength() );
aList.emplace_back( _( "Length in Package" ), msg, CYAN ); aList.emplace_back( _( "Length in Package" ), msg );
} }
msg = MessageTextFromValue( units, m_drill.x ); if( m_drill.x > 0 || m_drill.y > 0 )
{
if( GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE ) if( GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
{ {
aList.emplace_back( _( "Drill" ), msg, RED ); aList.emplace_back( _( "Drill" ),
wxString::Format( "%s",
MessageTextFromValue( units, m_drill.x ) ) );
} }
else else
{ {
msg = MessageTextFromValue( units, m_drill.x ) aList.emplace_back( _( "Drill X / Y" ),
+ wxT( "/" ) wxString::Format( "%s / %s",
+ MessageTextFromValue( units, m_drill.y ); MessageTextFromValue( units, m_drill.x ),
aList.emplace_back( _( "Drill X / Y" ), msg, RED ); MessageTextFromValue( units, m_drill.y ) ) );
}
} }
wxString source; wxString source;
int clearance = GetOwnClearance( GetLayer(), &source ); int clearance = GetOwnClearance( GetLayer(), &source );
msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance ) ); aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
msg2.Printf( _( "(from %s)" ), source ); MessageTextFromValue( units, clearance ) ),
aList.emplace_back( msg, msg2, BLACK ); wxString::Format( _( "(from %s)" ), source ) );
} }

View File

@ -286,7 +286,7 @@ wxString PCB_GROUP::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
if( m_name.empty() ) if( m_name.empty() )
{ {
return wxString::Format( _( "Anonymous Group, %zu members" ), return wxString::Format( _( "Unnamed Group, %zu members" ),
m_items.size() ); m_items.size() );
} }
@ -304,9 +304,8 @@ BITMAP_DEF PCB_GROUP::GetMenuImage() const
void PCB_GROUP::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) void PCB_GROUP::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{ {
aList.emplace_back( _( "Group" ), m_name.empty() ? _( "Anonymous" ) : aList.emplace_back( _( "Group" ), m_name.empty() ? _( "<unnamed>" ) : m_name );
wxString::Format( "\"%s\"", m_name ), DARKCYAN ); aList.emplace_back( _( "Members" ), wxString::Format( "%zu", m_items.size() ) );
aList.emplace_back( _( "Members" ), wxString::Format( "%zu", m_items.size() ), BROWN );
} }

View File

@ -90,8 +90,8 @@ PCB_MARKER* PCB_MARKER::Deserialize( const wxString& data )
void PCB_MARKER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) void PCB_MARKER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{ {
aList.emplace_back( _( "Type" ), _( "Marker" ), DARKCYAN ); aList.emplace_back( _( "Type" ), _( "Marker" ) );
aList.emplace_back( _( "Violation" ), m_rcItem->GetErrorMessage(), RED ); aList.emplace_back( _( "Violation" ), m_rcItem->GetErrorMessage() );
wxString mainText; wxString mainText;
wxString auxText; wxString auxText;
@ -110,7 +110,7 @@ void PCB_MARKER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
if( auxItem ) if( auxItem )
auxText = auxItem->GetSelectMenuText( aFrame->GetUserUnits() ); auxText = auxItem->GetSelectMenuText( aFrame->GetUserUnits() );
aList.emplace_back( mainText, auxText, DARKBROWN ); aList.emplace_back( mainText, auxText );
} }

View File

@ -469,78 +469,75 @@ void PCB_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms(); ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms();
wxString msg; wxString msg;
msg = _( "Drawing" ); aList.emplace_back( _( "Type" ), _( "Drawing" ) );
aList.emplace_back( _( "Type" ), msg, DARKCYAN );
wxString shape = _( "Shape" ); wxString shape = _( "Shape" );
switch( m_shape ) switch( m_shape )
{ {
case S_CIRCLE: case S_CIRCLE:
aList.emplace_back( shape, _( "Circle" ), RED ); aList.emplace_back( shape, _( "Circle" ) );
msg = MessageTextFromValue( units, GetLineLength( m_start, m_end ) ); msg = MessageTextFromValue( units, GetLineLength( m_start, m_end ) );
aList.emplace_back( _( "Radius" ), msg, RED ); aList.emplace_back( _( "Radius" ), msg );
break; break;
case S_ARC: case S_ARC:
aList.emplace_back( shape, _( "Arc" ), RED ); aList.emplace_back( shape, _( "Arc" ) );
msg.Printf( wxT( "%.1f" ), m_angle / 10.0 ); msg.Printf( wxT( "%.1f" ), m_angle / 10.0 );
aList.emplace_back( _( "Angle" ), msg, RED ); aList.emplace_back( _( "Angle" ), msg );
msg = MessageTextFromValue( units, GetLineLength( m_start, m_end ) ); msg = MessageTextFromValue( units, GetLineLength( m_start, m_end ) );
aList.emplace_back( _( "Radius" ), msg, RED ); aList.emplace_back( _( "Radius" ), msg );
break; break;
case S_CURVE: case S_CURVE:
aList.emplace_back( shape, _( "Curve" ), RED ); aList.emplace_back( shape, _( "Curve" ) );
msg = MessageTextFromValue( units, GetLength() ); msg = MessageTextFromValue( units, GetLength() );
aList.emplace_back( _( "Length" ), msg, DARKGREEN ); aList.emplace_back( _( "Length" ), msg );
break; break;
case S_POLYGON: case S_POLYGON:
aList.emplace_back( shape, _( "Polygon" ), RED ); aList.emplace_back( shape, _( "Polygon" ) );
msg.Printf( "%d", GetPolyShape().Outline(0).PointCount() ); msg.Printf( "%d", GetPolyShape().Outline(0).PointCount() );
aList.emplace_back( _( "Points" ), msg, DARKGREEN ); aList.emplace_back( _( "Points" ), msg );
break; break;
case S_RECT: case S_RECT:
aList.emplace_back( shape, _( "Rectangle" ), RED ); aList.emplace_back( shape, _( "Rectangle" ) );
msg = MessageTextFromValue( units, std::abs( m_end.x - m_start.x ) ); msg = MessageTextFromValue( units, std::abs( m_end.x - m_start.x ) );
aList.emplace_back( _( "Width" ), msg, DARKGREEN ); aList.emplace_back( _( "Width" ), msg );
msg = MessageTextFromValue( units, std::abs( m_end.y - m_start.y ) ); msg = MessageTextFromValue( units, std::abs( m_end.y - m_start.y ) );
aList.emplace_back( _( "Height" ), msg, DARKGREEN ); aList.emplace_back( _( "Height" ), msg );
break; break;
case S_SEGMENT: case S_SEGMENT:
{ {
aList.emplace_back( shape, _( "Segment" ), RED ); aList.emplace_back( shape, _( "Segment" ) );
msg = MessageTextFromValue( units, GetLineLength( m_start, m_end ) ); msg = MessageTextFromValue( units, GetLineLength( m_start, m_end ) );
aList.emplace_back( _( "Length" ), msg, DARKGREEN ); aList.emplace_back( _( "Length" ), msg );
// angle counter-clockwise from 3'o-clock // angle counter-clockwise from 3'o-clock
const double deg = RAD2DEG( atan2( (double)( m_start.y - m_end.y ), const double deg = RAD2DEG( atan2( (double)( m_start.y - m_end.y ),
(double)( m_end.x - m_start.x ) ) ); (double)( m_end.x - m_start.x ) ) );
msg.Printf( wxT( "%.1f" ), deg ); aList.emplace_back( _( "Angle" ), wxString::Format( "%.1f", deg ) );
aList.emplace_back( _( "Angle" ), msg, DARKGREEN );
} }
break; break;
default: default:
aList.emplace_back( shape, _( "Unrecognized" ), RED ); aList.emplace_back( shape, _( "Unrecognized" ) );
break; break;
} }
aList.emplace_back( _( "Layer" ), GetLayerName(), DARKBROWN ); aList.emplace_back( _( "Layer" ), GetLayerName() );
msg = MessageTextFromValue( units, m_width ); aList.emplace_back( _( "Width" ), MessageTextFromValue( units, m_width ) );
aList.emplace_back( _( "Width" ), msg, DARKCYAN );
} }

View File

@ -106,30 +106,21 @@ void PCB_TEXT::SetTextAngle( double aAngle )
void PCB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) void PCB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{ {
wxString msg; EDA_UNITS units = aFrame->GetUserUnits();
wxCHECK_RET( m_parent != NULL, wxT( "PCB_TEXT::GetMsgPanelInfo() m_Parent is NULL." ) ); wxCHECK_RET( m_parent != NULL, wxT( "PCB_TEXT::GetMsgPanelInfo() m_Parent is NULL." ) );
aList.emplace_back( _( "PCB Text" ), GetShownText(), DARKGREEN ); aList.emplace_back( _( "PCB Text" ), GetShownText() );
aList.emplace_back( _( "Layer" ), GetLayerName(), BLUE ); aList.emplace_back( _( "Layer" ), GetLayerName() );
if( !IsMirrored() ) aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
aList.emplace_back( _( "Mirror" ), _( "No" ), DARKGREEN );
else
aList.emplace_back( _( "Mirror" ), _( "Yes" ), DARKGREEN );
msg.Printf( wxT( "%.1f" ), GetTextAngle() / 10.0 ); aList.emplace_back( _( "Angle" ), wxString::Format( "%.1f", GetTextAngle() / 10.0 ) );
aList.emplace_back( _( "Angle" ), msg, DARKGREEN );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextThickness() ); aList.emplace_back( _( "Thickness" ), MessageTextFromValue( units, GetTextThickness() ) );
aList.emplace_back( _( "Thickness" ), msg, MAGENTA ); aList.emplace_back( _( "Width" ), MessageTextFromValue( units, GetTextWidth() ) );
aList.emplace_back( _( "Height" ), MessageTextFromValue( units, GetTextHeight() ) );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() );
aList.emplace_back( _( "Width" ), msg, RED );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextHeight() );
aList.emplace_back( _( "Height" ), msg, RED );
} }

View File

@ -597,22 +597,15 @@ void TRACK::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>
{ {
EDA_UNITS units = aFrame->GetUserUnits(); EDA_UNITS units = aFrame->GetUserUnits();
wxString msg; wxString msg;
wxString msg2;
wxString source;
BOARD* board = GetBoard(); BOARD* board = GetBoard();
// Display basic infos aList.emplace_back( _( "Type" ), _( "Track" ) );
aList.emplace_back( _( "Type" ), _( "Track" ), DARKCYAN );
GetMsgPanelInfoBase_Common( aFrame, aList ); GetMsgPanelInfoBase_Common( aFrame, aList );
// Display layer aList.emplace_back( _( "Layer" ), layerMaskDescribe() );
aList.emplace_back( _( "Layer" ), layerMaskDescribe(), DARKGREEN );
// Display width aList.emplace_back( _( "Width" ), MessageTextFromValue( units, m_Width ) );
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width );
aList.emplace_back( _( "Width" ), msg, DARKCYAN );
// Display full track length (in Pcbnew) // Display full track length (in Pcbnew)
if( board ) if( board )
@ -623,31 +616,31 @@ void TRACK::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>
std::tie( count, trackLen, lenPadToDie ) = board->GetTrackLength( *this ); std::tie( count, trackLen, lenPadToDie ) = board->GetTrackLength( *this );
msg = MessageTextFromValue( aFrame->GetUserUnits(), trackLen ); aList.emplace_back( _( "Length" ), MessageTextFromValue( units, trackLen ) );
aList.emplace_back( _( "Length" ), msg, DARKCYAN );
if( lenPadToDie != 0 ) if( lenPadToDie != 0 )
{ {
msg = MessageTextFromValue( aFrame->GetUserUnits(), lenPadToDie ); msg = MessageTextFromValue( units, lenPadToDie );
aList.emplace_back( _( "Pad To Die Length" ), msg, DARKCYAN ); aList.emplace_back( _( "Pad To Die Length" ), msg );
msg = MessageTextFromValue( aFrame->GetUserUnits(), trackLen + lenPadToDie ); msg = MessageTextFromValue( units, trackLen + lenPadToDie );
aList.emplace_back( _( "Full Length" ), msg, DARKCYAN ); aList.emplace_back( _( "Full Length" ), msg );
} }
} }
wxString source;
int clearance = GetOwnClearance( GetLayer(), &source ); int clearance = GetOwnClearance( GetLayer(), &source );
msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance ) ); aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
msg2.Printf( _( "(from %s)" ), source ); MessageTextFromValue( units, clearance ) ),
aList.emplace_back( msg, msg2, BLACK ); wxString::Format( _( "(from %s)" ), source ) );
int minWidth, maxWidth; int minWidth, maxWidth;
GetWidthConstraints( &minWidth, &maxWidth, &source ); GetWidthConstraints( &minWidth, &maxWidth, &source );
msg.Printf( _( "Min Width: %s" ), MessageTextFromValue( units, minWidth ) ); aList.emplace_back( wxString::Format( _( "Min Width: %s" ),
msg2.Printf( _( "(from %s)" ), source ); MessageTextFromValue( units, minWidth ) ),
aList.emplace_back( msg, msg2, BLACK ); wxString::Format( _( "(from %s)" ), source ) );
} }
@ -655,10 +648,7 @@ void VIA::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
{ {
EDA_UNITS units = aFrame->GetUserUnits(); EDA_UNITS units = aFrame->GetUserUnits();
wxString msg; wxString msg;
wxString msg2;
wxString source;
// Display basic infos
switch( GetViaType() ) switch( GetViaType() )
{ {
case VIATYPE::MICROVIA: msg = _( "Micro Via" ); break; case VIATYPE::MICROVIA: msg = _( "Micro Via" ); break;
@ -667,35 +657,32 @@ void VIA::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
default: msg = _( "Via" ); break; default: msg = _( "Via" ); break;
} }
aList.emplace_back( _( "Type" ), msg, DARKCYAN ); aList.emplace_back( _( "Type" ), msg );
GetMsgPanelInfoBase_Common( aFrame, aList ); GetMsgPanelInfoBase_Common( aFrame, aList );
// Display layer pair aList.emplace_back( _( "Layer" ), layerMaskDescribe() );
aList.emplace_back( _( "Layer" ), layerMaskDescribe(), DARKGREEN );
// Display width
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width ); msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width );
// Display diameter value: aList.emplace_back( _( "Diameter" ), msg );
aList.emplace_back( _( "Diameter" ), msg, DARKCYAN );
// Display drill value
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetDrillValue() ); msg = MessageTextFromValue( aFrame->GetUserUnits(), GetDrillValue() );
aList.emplace_back( _( "Drill" ), msg, RED ); aList.emplace_back( _( "Drill" ), msg );
wxString source;
int clearance = GetOwnClearance( GetLayer(), &source ); int clearance = GetOwnClearance( GetLayer(), &source );
msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance ) ); aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
msg2.Printf( _( "(from %s)" ), source ); MessageTextFromValue( units, clearance ) ),
aList.emplace_back( msg, msg2, BLACK ); wxString::Format( _( "(from %s)" ), source ) );
int minAnnulus = GetMinAnnulus( GetLayer(), &source ); int minAnnulus = GetMinAnnulus( GetLayer(), &source );
msg.Printf( _( "Min Annular Width: %s" ), MessageTextFromValue( units, minAnnulus ) ); aList.emplace_back( wxString::Format( _( "Min Annular Width: %s" ),
msg2.Printf( _( "(from %s)" ), source ); MessageTextFromValue( units, minAnnulus ) ),
aList.emplace_back( msg, msg2, BLACK ); wxString::Format( _( "(from %s)" ), source ) );
} }
@ -703,31 +690,9 @@ void TRACK::GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector<MSG_
{ {
wxString msg; wxString msg;
// Display Net Name aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ) );
if( GetBoard() )
{
NETINFO_ITEM* net = GetNet();
NETCLASS* netclass = nullptr;
if( net ) aList.emplace_back( _( "NetClass" ), UnescapeString( GetNetClass()->GetName() ) );
{
if( net->GetNet() )
netclass = GetNetClass();
else
netclass = GetBoard()->GetDesignSettings().GetDefault();
msg = UnescapeString( net->GetNetname() );
}
else
{
msg = wxT( "<no name>" );
}
aList.emplace_back( _( "Net" ), msg, RED );
if( netclass )
aList.emplace_back( _( "NetClass" ), netclass->GetName(), DARKMAGENTA );
}
#if 0 // Enable for debugging #if 0 // Enable for debugging
if( GetBoard() ) if( GetBoard() )

View File

@ -543,7 +543,7 @@ bool ZONE::HitTestCutout( const VECTOR2I& aRefPos, int* aOutlineIdx, int* aHoleI
void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{ {
EDA_UNITS units = aFrame->GetUserUnits(); EDA_UNITS units = aFrame->GetUserUnits();
wxString msg, msg2; wxString msg;
if( GetIsRuleArea() ) if( GetIsRuleArea() )
msg = _( "Rule Area" ); msg = _( "Rule Area" );
@ -557,7 +557,7 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 ) if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
msg << wxT( " " ) << _( "Cutout" ); msg << wxT( " " ) << _( "Cutout" );
aList.emplace_back( _( "Type" ), msg, DARKCYAN ); aList.emplace_back( _( "Type" ), msg );
if( GetIsRuleArea() ) if( GetIsRuleArea() )
{ {
@ -583,34 +583,12 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
} }
else if( IsOnCopperLayer() ) else if( IsOnCopperLayer() )
{ {
if( GetNetCode() >= 0 ) aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ) );
{
NETINFO_ITEM* net = GetNet();
NETCLASS* netclass = nullptr;
if( net ) aList.emplace_back( _( "NetClass" ), UnescapeString( GetNetClass()->GetName() ) );
{
if( net->GetNet() )
netclass = GetNetClass();
else
netclass = GetBoard()->GetDesignSettings().GetDefault();
msg = UnescapeString( net->GetNetname() );
}
else
{
msg = wxT( "<no name>" );
}
aList.emplace_back( _( "Net" ), msg, RED );
if( netclass )
aList.emplace_back( _( "NetClass" ), netclass->GetName(), DARKMAGENTA );
}
// Display priority level // Display priority level
msg.Printf( wxT( "%d" ), GetPriority() ); aList.emplace_back( _( "Priority" ), wxString::Format( "%d", GetPriority() ) );
aList.emplace_back( _( "Priority" ), msg, BLUE );
} }
wxString layerDesc; wxString layerDesc;
@ -627,10 +605,10 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
if( count > 1 ) if( count > 1 )
layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 ); layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
aList.emplace_back( _( "Layer" ), layerDesc, DARKGREEN ); aList.emplace_back( _( "Layer" ), layerDesc );
if( !m_zoneName.empty() ) if( !m_zoneName.empty() )
aList.emplace_back( _( "Name" ), m_zoneName, DARKMAGENTA ); aList.emplace_back( _( "Name" ), m_zoneName );
switch( m_fillMode ) switch( m_fillMode )
{ {
@ -639,17 +617,17 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
default: msg = _( "Unknown" ); break; default: msg = _( "Unknown" ); break;
} }
aList.emplace_back( _( "Fill Mode" ), msg, BROWN ); aList.emplace_back( _( "Fill Mode" ), msg );
msg = MessageTextFromValue( units, m_area, true, EDA_DATA_TYPE::AREA ); msg = MessageTextFromValue( units, m_area, true, EDA_DATA_TYPE::AREA );
aList.emplace_back( _( "Filled Area" ), msg, BLUE ); aList.emplace_back( _( "Filled Area" ), msg );
wxString source; wxString source;
int clearance = GetOwnClearance( GetLayer(), &source ); int clearance = GetOwnClearance( GetLayer(), &source );
msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance ) ); aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
msg2.Printf( _( "(from %s)" ), source ); MessageTextFromValue( units, clearance ) ),
aList.emplace_back( msg, msg2, BLACK ); wxString::Format( _( "(from %s)" ), source ) );
// Useful for statistics, especially when zones are complex the number of hatches // Useful for statistics, especially when zones are complex the number of hatches
// and filled polygons can explain the display and DRC calculation time: // and filled polygons can explain the display and DRC calculation time: