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." ) );
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() )
{
aList.emplace_back( _( "Override Text" ), GetOverrideText(), BLUE );
aList.emplace_back( _( "Override Text" ), GetOverrideText() );
}
else
{
aList.emplace_back( _( "Value" ), GetValueText(), BLUE );
aList.emplace_back( _( "Value" ), GetValueText() );
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;
GetUnits( units );
aList.emplace_back( _( "Units" ), GetAbbreviatedUnitsLabel( units ), BLUE );
aList.emplace_back( _( "Units" ), GetAbbreviatedUnitsLabel( units ) );
ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms();
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.y ) );
aList.emplace_back( start, wxEmptyString, DARKGREEN );
aList.emplace_back( start, wxEmptyString );
}
else
{
@ -360,10 +360,10 @@ void DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
MessageTextFromValue( units, endCoord.x ),
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;
aList.emplace_back( _( "Leader" ), m_text.GetShownText(), DARKGREEN );
aList.emplace_back( _( "Leader" ), m_text.GetShownText() );
ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms();
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.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;
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 )
|| aFrame->IsType( FRAME_FOOTPRINT_VIEWER_MODAL )
@ -742,12 +742,11 @@ void FOOTPRINT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
else
msg = _( "Unknown" );
aList.emplace_back( _( "Last Change" ), msg, BROWN );
aList.emplace_back( _( "Last Change" ), msg );
}
else if( aFrame->IsType( FRAME_PCB_EDITOR ) )
{
aList.emplace_back( _( "Board Side" ), IsFlipped() ? _( "Back (Flipped)" )
: _( "Front" ), RED );
aList.emplace_back( _( "Board Side" ), IsFlipped() ? _( "Back (Flipped)" ) : _( "Front" ) );
}
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 )
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" ), msg, BROWN );
aList.emplace_back( _( "Rotation" ), wxString::Format( "%.4g", GetOrientationDegrees() ) );
msg.Printf( _( "Footprint: %s" ), m_fpid.Format().c_str() );
msg2.Printf( _( "3D-Shape: %s" ),
m_3D_Drawings.empty() ? _( "none" ) : m_3D_Drawings.front().m_Filename );
aList.emplace_back( msg, msg2, BLUE );
msg2.Printf( _( "3D-Shape: %s" ), m_3D_Drawings.empty() ? _( "<none>" )
: m_3D_Drawings.front().m_Filename );
aList.emplace_back( msg, msg2 );
msg.Printf( _( "Doc: %s" ), m_doc );
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 )
{
wxString msg;
FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_parent );
if( !fp )
return;
BOARD* board = (BOARD*) fp->GetParent();
if( !board )
return;
aList.emplace_back( _( "Footprint" ), fp->GetReference(), DARKCYAN );
aList.emplace_back( _( "Footprint" ), fp ? fp->GetReference() : _( "<invalid>" ) );
// append the features shared with the base class
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 )
{
FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent );
if( parentFootprint == NULL ) // Happens in footprint editor, and for new texts
return;
wxString msg, Line;
FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_parent );
wxString msg;
static const wxString text_type_msg[3] =
{
_( "Ref." ), _( "Value" ), _( "Text" )
};
Line = parentFootprint->GetReference();
aList.emplace_back( _( "Footprint" ), Line, DARKCYAN );
aList.emplace_back( _( "Footprint" ), fp ? fp->GetReference() : _( "<invalid>" ) );
Line = GetShownText();
aList.emplace_back( _( "Text" ), Line, BROWN );
aList.emplace_back( _( "Text" ), GetShownText() );
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() )
msg = _( "No" );
else
msg = _( "Yes" );
aList.emplace_back( _( "Display" ), msg, DARKGREEN );
aList.emplace_back( _( "Display" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
// Display text layer
aList.emplace_back( _( "Layer" ), GetLayerName(), DARKGREEN );
aList.emplace_back( _( "Layer" ), GetLayerName() );
if( IsMirrored() )
msg = _( "Yes" );
else
msg = _( "No" );
aList.emplace_back( _( "Mirror" ), msg, DARKGREEN );
aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
msg.Printf( wxT( "%.1f" ), GetTextAngleDegrees() );
aList.emplace_back( _( "Angle" ), msg, DARKGREEN );
aList.emplace_back( _( "Angle" ), msg );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextThickness() );
aList.emplace_back( _( "Thickness" ), msg, DARKGREEN );
aList.emplace_back( _( "Thickness" ), msg );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() );
aList.emplace_back( _( "Width" ), msg, RED );
aList.emplace_back( _( "Width" ), msg );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextHeight() );
aList.emplace_back( _( "Height" ), msg, RED );
aList.emplace_back( _( "Height" ), msg );
}

View File

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

View File

@ -802,32 +802,23 @@ int PAD::GetEffectiveThermalGap( wxString* aSource ) const
void PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{
EDA_UNITS units = aFrame->GetUserUnits();
wxString msg, msg2;
BOARD* board = GetBoard();
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent );
EDA_UNITS units = aFrame->GetUserUnits();
wxString msg;
FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent );
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() )
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
// default netclass for clearance):
if( m_netinfo->GetNet() <= 0 )
msg = bds.GetDefault()->GetName();
else
msg = GetNetClassName();
aList.emplace_back( _( "NetClass" ), UnescapeString( GetNetClass()->GetName() ) );
aList.emplace_back( _( "NetClass" ), msg, CYAN );
aList.emplace_back( _( "Layer" ), layerMaskDescribe(), DARKGREEN );
aList.emplace_back( _( "Layer" ), layerMaskDescribe() );
// Show the pad shape, attribute and property
wxString props = ShowPadAttr();
@ -837,30 +828,25 @@ void PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
switch( GetProperty() )
{
case PAD_PROP_NONE: break;
case PAD_PROP_BGA: props += _("BGA" ); break;
case PAD_PROP_FIDUCIAL_GLBL: props += _("Fiducial global" ); break;
case PAD_PROP_FIDUCIAL_LOCAL: props += _("Fiducial local" ); break;
case PAD_PROP_TESTPOINT: props += _("Test point" ); break;
case PAD_PROP_HEATSINK: props += _("Heat sink" ); break;
case PAD_PROP_CASTELLATED: props += _("Castellated" ); break;
case PAD_PROP_NONE: break;
case PAD_PROP_BGA: props += _("BGA" ); break;
case PAD_PROP_FIDUCIAL_GLBL: props += _("Fiducial global" ); break;
case PAD_PROP_FIDUCIAL_LOCAL: props += _("Fiducial local" ); break;
case PAD_PROP_TESTPOINT: props += _("Test point" ); break;
case PAD_PROP_HEATSINK: props += _("Heat sink" ); 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 )
&& m_size.x == m_size.y )
if( ( GetShape() == PAD_SHAPE_CIRCLE || GetShape() == PAD_SHAPE_OVAL ) && m_size.x == m_size.y )
{
msg = MessageTextFromValue( units, m_size.x );
aList.emplace_back( _( "Diameter" ), msg, RED );
aList.emplace_back( _( "Diameter" ), MessageTextFromValue( units, m_size.x ) );
}
else
{
msg = MessageTextFromValue( units, m_size.x );
aList.emplace_back( _( "Width" ), msg, RED );
msg = MessageTextFromValue( units, m_size.y );
aList.emplace_back( _( "Height" ), msg, RED );
aList.emplace_back( _( "Width" ), MessageTextFromValue( units, m_size.x ) );
aList.emplace_back( _( "Height" ), MessageTextFromValue( units, m_size.y ) );
}
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
msg.Printf( wxT( "%.4g" ), GetOrientationDegrees() );
aList.push_back( MSG_PANEL_ITEM( _( "Rotation" ), msg, LIGHTBLUE ) );
aList.emplace_back( _( "Rotation" ), msg );
if( 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( GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
if( m_drill.x > 0 || m_drill.y > 0 )
{
aList.emplace_back( _( "Drill" ), msg, RED );
}
else
{
msg = MessageTextFromValue( units, m_drill.x )
+ wxT( "/" )
+ MessageTextFromValue( units, m_drill.y );
aList.emplace_back( _( "Drill X / Y" ), msg, RED );
if( GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
{
aList.emplace_back( _( "Drill" ),
wxString::Format( "%s",
MessageTextFromValue( units, m_drill.x ) ) );
}
else
{
aList.emplace_back( _( "Drill X / Y" ),
wxString::Format( "%s / %s",
MessageTextFromValue( units, m_drill.x ),
MessageTextFromValue( units, m_drill.y ) ) );
}
}
wxString source;
int clearance = GetOwnClearance( GetLayer(), &source );
msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance ) );
msg2.Printf( _( "(from %s)" ), source );
aList.emplace_back( msg, msg2, BLACK );
aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
MessageTextFromValue( units, clearance ) ),
wxString::Format( _( "(from %s)" ), source ) );
}

View File

@ -286,7 +286,7 @@ wxString PCB_GROUP::GetSelectMenuText( EDA_UNITS aUnits ) const
{
if( m_name.empty() )
{
return wxString::Format( _( "Anonymous Group, %zu members" ),
return wxString::Format( _( "Unnamed Group, %zu members" ),
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 )
{
aList.emplace_back( _( "Group" ), m_name.empty() ? _( "Anonymous" ) :
wxString::Format( "\"%s\"", m_name ), DARKCYAN );
aList.emplace_back( _( "Members" ), wxString::Format( "%zu", m_items.size() ), BROWN );
aList.emplace_back( _( "Group" ), m_name.empty() ? _( "<unnamed>" ) : m_name );
aList.emplace_back( _( "Members" ), wxString::Format( "%zu", m_items.size() ) );
}

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

View File

@ -465,82 +465,79 @@ FOOTPRINT* PCB_SHAPE::GetParentFootprint() const
void PCB_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{
EDA_UNITS units = aFrame->GetUserUnits();
EDA_UNITS units = aFrame->GetUserUnits();
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 )
{
case S_CIRCLE:
aList.emplace_back( shape, _( "Circle" ), RED );
aList.emplace_back( shape, _( "Circle" ) );
msg = MessageTextFromValue( units, GetLineLength( m_start, m_end ) );
aList.emplace_back( _( "Radius" ), msg, RED );
aList.emplace_back( _( "Radius" ), msg );
break;
case S_ARC:
aList.emplace_back( shape, _( "Arc" ), RED );
aList.emplace_back( shape, _( "Arc" ) );
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 ) );
aList.emplace_back( _( "Radius" ), msg, RED );
aList.emplace_back( _( "Radius" ), msg );
break;
case S_CURVE:
aList.emplace_back( shape, _( "Curve" ), RED );
aList.emplace_back( shape, _( "Curve" ) );
msg = MessageTextFromValue( units, GetLength() );
aList.emplace_back( _( "Length" ), msg, DARKGREEN );
aList.emplace_back( _( "Length" ), msg );
break;
case S_POLYGON:
aList.emplace_back( shape, _( "Polygon" ), RED );
aList.emplace_back( shape, _( "Polygon" ) );
msg.Printf( "%d", GetPolyShape().Outline(0).PointCount() );
aList.emplace_back( _( "Points" ), msg, DARKGREEN );
aList.emplace_back( _( "Points" ), msg );
break;
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 ) );
aList.emplace_back( _( "Width" ), msg, DARKGREEN );
aList.emplace_back( _( "Width" ), msg );
msg = MessageTextFromValue( units, std::abs( m_end.y - m_start.y ) );
aList.emplace_back( _( "Height" ), msg, DARKGREEN );
aList.emplace_back( _( "Height" ), msg );
break;
case S_SEGMENT:
{
aList.emplace_back( shape, _( "Segment" ), RED );
aList.emplace_back( shape, _( "Segment" ) );
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
const double deg = RAD2DEG( atan2( (double)( m_start.y - m_end.y ),
(double)( m_end.x - m_start.x ) ) );
msg.Printf( wxT( "%.1f" ), deg );
aList.emplace_back( _( "Angle" ), msg, DARKGREEN );
aList.emplace_back( _( "Angle" ), wxString::Format( "%.1f", deg ) );
}
break;
default:
aList.emplace_back( shape, _( "Unrecognized" ), RED );
aList.emplace_back( shape, _( "Unrecognized" ) );
break;
}
aList.emplace_back( _( "Layer" ), GetLayerName(), DARKBROWN );
aList.emplace_back( _( "Layer" ), GetLayerName() );
msg = MessageTextFromValue( units, m_width );
aList.emplace_back( _( "Width" ), msg, DARKCYAN );
aList.emplace_back( _( "Width" ), MessageTextFromValue( units, m_width ) );
}

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 )
{
wxString msg;
EDA_UNITS units = aFrame->GetUserUnits();
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" ), _( "No" ), DARKGREEN );
else
aList.emplace_back( _( "Mirror" ), _( "Yes" ), DARKGREEN );
aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
msg.Printf( wxT( "%.1f" ), GetTextAngle() / 10.0 );
aList.emplace_back( _( "Angle" ), msg, DARKGREEN );
aList.emplace_back( _( "Angle" ), wxString::Format( "%.1f", GetTextAngle() / 10.0 ) );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextThickness() );
aList.emplace_back( _( "Thickness" ), msg, MAGENTA );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() );
aList.emplace_back( _( "Width" ), msg, RED );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextHeight() );
aList.emplace_back( _( "Height" ), msg, RED );
aList.emplace_back( _( "Thickness" ), MessageTextFromValue( units, GetTextThickness() ) );
aList.emplace_back( _( "Width" ), MessageTextFromValue( units, GetTextWidth() ) );
aList.emplace_back( _( "Height" ), MessageTextFromValue( units, GetTextHeight() ) );
}

View File

@ -597,22 +597,15 @@ void TRACK::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>
{
EDA_UNITS units = aFrame->GetUserUnits();
wxString msg;
wxString msg2;
wxString source;
BOARD* board = GetBoard();
// Display basic infos
aList.emplace_back( _( "Type" ), _( "Track" ), DARKCYAN );
aList.emplace_back( _( "Type" ), _( "Track" ) );
GetMsgPanelInfoBase_Common( aFrame, aList );
// Display layer
aList.emplace_back( _( "Layer" ), layerMaskDescribe(), DARKGREEN );
aList.emplace_back( _( "Layer" ), layerMaskDescribe() );
// Display width
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width );
aList.emplace_back( _( "Width" ), msg, DARKCYAN );
aList.emplace_back( _( "Width" ), MessageTextFromValue( units, m_Width ) );
// Display full track length (in Pcbnew)
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 );
msg = MessageTextFromValue( aFrame->GetUserUnits(), trackLen );
aList.emplace_back( _( "Length" ), msg, DARKCYAN );
aList.emplace_back( _( "Length" ), MessageTextFromValue( units, trackLen ) );
if( lenPadToDie != 0 )
{
msg = MessageTextFromValue( aFrame->GetUserUnits(), lenPadToDie );
aList.emplace_back( _( "Pad To Die Length" ), msg, DARKCYAN );
msg = MessageTextFromValue( units, lenPadToDie );
aList.emplace_back( _( "Pad To Die Length" ), msg );
msg = MessageTextFromValue( aFrame->GetUserUnits(), trackLen + lenPadToDie );
aList.emplace_back( _( "Full Length" ), msg, DARKCYAN );
msg = MessageTextFromValue( units, trackLen + lenPadToDie );
aList.emplace_back( _( "Full Length" ), msg );
}
}
wxString source;
int clearance = GetOwnClearance( GetLayer(), &source );
msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance ) );
msg2.Printf( _( "(from %s)" ), source );
aList.emplace_back( msg, msg2, BLACK );
aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
MessageTextFromValue( units, clearance ) ),
wxString::Format( _( "(from %s)" ), source ) );
int minWidth, maxWidth;
GetWidthConstraints( &minWidth, &maxWidth, &source );
msg.Printf( _( "Min Width: %s" ), MessageTextFromValue( units, minWidth ) );
msg2.Printf( _( "(from %s)" ), source );
aList.emplace_back( msg, msg2, BLACK );
aList.emplace_back( wxString::Format( _( "Min Width: %s" ),
MessageTextFromValue( units, minWidth ) ),
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();
wxString msg;
wxString msg2;
wxString source;
// Display basic infos
switch( GetViaType() )
{
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;
}
aList.emplace_back( _( "Type" ), msg, DARKCYAN );
aList.emplace_back( _( "Type" ), msg );
GetMsgPanelInfoBase_Common( aFrame, aList );
// Display layer pair
aList.emplace_back( _( "Layer" ), layerMaskDescribe(), DARKGREEN );
aList.emplace_back( _( "Layer" ), layerMaskDescribe() );
// Display width
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width );
// Display diameter value:
aList.emplace_back( _( "Diameter" ), msg, DARKCYAN );
aList.emplace_back( _( "Diameter" ), msg );
// Display drill value
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetDrillValue() );
aList.emplace_back( _( "Drill" ), msg, RED );
aList.emplace_back( _( "Drill" ), msg );
wxString source;
int clearance = GetOwnClearance( GetLayer(), &source );
msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance ) );
msg2.Printf( _( "(from %s)" ), source );
aList.emplace_back( msg, msg2, BLACK );
aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
MessageTextFromValue( units, clearance ) ),
wxString::Format( _( "(from %s)" ), source ) );
int minAnnulus = GetMinAnnulus( GetLayer(), &source );
msg.Printf( _( "Min Annular Width: %s" ), MessageTextFromValue( units, minAnnulus ) );
msg2.Printf( _( "(from %s)" ), source );
aList.emplace_back( msg, msg2, BLACK );
aList.emplace_back( wxString::Format( _( "Min Annular Width: %s" ),
MessageTextFromValue( units, minAnnulus ) ),
wxString::Format( _( "(from %s)" ), source ) );
}
@ -703,33 +690,11 @@ void TRACK::GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector<MSG_
{
wxString msg;
// Display Net Name
if( GetBoard() )
{
NETINFO_ITEM* net = GetNet();
NETCLASS* netclass = nullptr;
aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ) );
if( net )
{
if( net->GetNet() )
netclass = GetNetClass();
else
netclass = GetBoard()->GetDesignSettings().GetDefault();
aList.emplace_back( _( "NetClass" ), UnescapeString( GetNetClass()->GetName() ) );
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() )
{
// Display net code:

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 )
{
EDA_UNITS units = aFrame->GetUserUnits();
wxString msg, msg2;
wxString msg;
if( GetIsRuleArea() )
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 )
msg << wxT( " " ) << _( "Cutout" );
aList.emplace_back( _( "Type" ), msg, DARKCYAN );
aList.emplace_back( _( "Type" ), msg );
if( GetIsRuleArea() )
{
@ -583,34 +583,12 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
}
else if( IsOnCopperLayer() )
{
if( GetNetCode() >= 0 )
{
NETINFO_ITEM* net = GetNet();
NETCLASS* netclass = nullptr;
aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ) );
if( net )
{
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 );
}
aList.emplace_back( _( "NetClass" ), UnescapeString( GetNetClass()->GetName() ) );
// Display priority level
msg.Printf( wxT( "%d" ), GetPriority() );
aList.emplace_back( _( "Priority" ), msg, BLUE );
aList.emplace_back( _( "Priority" ), wxString::Format( "%d", GetPriority() ) );
}
wxString layerDesc;
@ -627,10 +605,10 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
if( 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() )
aList.emplace_back( _( "Name" ), m_zoneName, DARKMAGENTA );
aList.emplace_back( _( "Name" ), m_zoneName );
switch( m_fillMode )
{
@ -639,17 +617,17 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
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 );
aList.emplace_back( _( "Filled Area" ), msg, BLUE );
aList.emplace_back( _( "Filled Area" ), msg );
wxString source;
int clearance = GetOwnClearance( GetLayer(), &source );
msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance ) );
msg2.Printf( _( "(from %s)" ), source );
aList.emplace_back( msg, msg2, BLACK );
aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
MessageTextFromValue( units, clearance ) ),
wxString::Format( _( "(from %s)" ), source ) );
// Useful for statistics, especially when zones are complex the number of hatches
// and filled polygons can explain the display and DRC calculation time: