Some minor performance enhancements.

This commit is contained in:
Jeff Young 2021-09-28 14:28:35 +01:00
parent fac48ddafb
commit f73042fe24
18 changed files with 133 additions and 192 deletions

View File

@ -111,24 +111,23 @@ void DS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
switch( dataItem->GetType() ) switch( dataItem->GetType() )
{ {
case DS_DATA_ITEM::DS_SEGMENT: case DS_DATA_ITEM::DS_SEGMENT:
aList.push_back( MSG_PANEL_ITEM( _( "Line" ), msg ) ); aList.emplace_back( _( "Line" ), wxEmptyString );
break; break;
case DS_DATA_ITEM::DS_RECT: case DS_DATA_ITEM::DS_RECT:
aList.push_back( MSG_PANEL_ITEM( _( "Rectangle" ), msg ) ); aList.emplace_back( _( "Rectangle" ), wxEmptyString );
break; break;
case DS_DATA_ITEM::DS_TEXT: case DS_DATA_ITEM::DS_TEXT:
msg = static_cast<DS_DRAW_ITEM_TEXT*>( this )->GetShownText(); aList.emplace_back( _( "Text" ), static_cast<DS_DRAW_ITEM_TEXT*>( this )->GetShownText() );
aList.push_back( MSG_PANEL_ITEM( _( "Text" ), msg ) );
break; break;
case DS_DATA_ITEM::DS_POLYPOLYGON: case DS_DATA_ITEM::DS_POLYPOLYGON:
aList.push_back( MSG_PANEL_ITEM( _( "Imported Shape" ), msg ) ); aList.emplace_back( _( "Imported Shape" ), wxEmptyString );
break; break;
case DS_DATA_ITEM::DS_BITMAP: case DS_DATA_ITEM::DS_BITMAP:
aList.push_back( MSG_PANEL_ITEM( _( "Image" ), msg ) ); aList.emplace_back( _( "Image" ), wxEmptyString );
break; break;
} }
@ -139,21 +138,21 @@ void DS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
default: msg = _( "All Pages" ); break; default: msg = _( "All Pages" ); break;
} }
aList.push_back( MSG_PANEL_ITEM( _( "First Page Option" ), msg ) ); aList.emplace_back( _( "First Page Option" ), msg );
msg = MessageTextFromValue( EDA_UNITS::UNSCALED, dataItem->m_RepeatCount ); msg = MessageTextFromValue( EDA_UNITS::UNSCALED, dataItem->m_RepeatCount );
aList.push_back( MSG_PANEL_ITEM( _( "Repeat Count" ), msg ) ); aList.emplace_back( _( "Repeat Count" ), msg );
msg = MessageTextFromValue( EDA_UNITS::UNSCALED, dataItem->m_IncrementLabel ); msg = MessageTextFromValue( EDA_UNITS::UNSCALED, dataItem->m_IncrementLabel );
aList.push_back( MSG_PANEL_ITEM( _( "Repeat Label Increment" ), msg ) ); aList.emplace_back( _( "Repeat Label Increment" ), msg );
msg.Printf( wxT( "(%s, %s)" ), msg.Printf( wxT( "(%s, %s)" ),
MessageTextFromValue( aFrame->GetUserUnits(), dataItem->m_IncrementVector.x ), MessageTextFromValue( aFrame->GetUserUnits(), dataItem->m_IncrementVector.x ),
MessageTextFromValue( aFrame->GetUserUnits(), dataItem->m_IncrementVector.y ) ); MessageTextFromValue( aFrame->GetUserUnits(), dataItem->m_IncrementVector.y ) );
aList.push_back( MSG_PANEL_ITEM( _( "Repeat Position Increment" ), msg ) ); aList.emplace_back( _( "Repeat Position Increment" ), msg );
aList.push_back( MSG_PANEL_ITEM( _( "Comment" ), dataItem->m_Info ) ); aList.emplace_back( _( "Comment" ), dataItem->m_Info );
} }

View File

@ -236,25 +236,21 @@ const EDA_RECT LIB_CIRCLE::GetBoundingBox() const
void LIB_CIRCLE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) void LIB_CIRCLE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{ {
wxString msg;
EDA_RECT bBox = GetBoundingBox(); EDA_RECT bBox = GetBoundingBox();
LIB_ITEM::GetMsgPanelInfo( aFrame, aList ); LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width ); aList.emplace_back( _( "Line Width" ), MessageTextFromValue( aFrame->GetUserUnits(),
m_Width ) );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg ) ); aList.emplace_back( _( "Radius" ), MessageTextFromValue( aFrame->GetUserUnits(),
GetRadius() ) );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetRadius() ); aList.emplace_back( _( "Bounding Box" ), wxString::Format( wxT( "(%d, %d, %d, %d)" ),
aList.push_back( MSG_PANEL_ITEM( _( "Radius" ), msg ) ); bBox.GetOrigin().x,
bBox.GetOrigin().y,
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetEnd().x,
bBox.GetOrigin().x, bBox.GetEnd().y ) );
bBox.GetOrigin().y,
bBox.GetEnd().x,
bBox.GetEnd().y );
aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg ) );
} }

View File

@ -423,19 +423,17 @@ void LIB_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
LIB_ITEM::GetMsgPanelInfo( aFrame, aList ); LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
aList.push_back( MSG_PANEL_ITEM( _( "Field" ), GetName() ) ); aList.emplace_back( _( "Field" ), GetName() );
// Don't use GetShownText() here; we want to show the user the variable references // Don't use GetShownText() here; we want to show the user the variable references
aList.push_back( MSG_PANEL_ITEM( _( "Text" ), UnescapeString( GetText() ) ) ); aList.emplace_back( _( "Text" ), UnescapeString( GetText() ) );
msg = IsVisible() ? _( "Yes" ) : _( "No" ); aList.emplace_back( _( "Visible" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), msg ) );
msg = GetTextStyleName(); aList.emplace_back( _( "Style" ), GetTextStyleName() );
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), msg ) );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() ); aList.emplace_back( _( "Text Size" ), MessageTextFromValue( aFrame->GetUserUnits(),
aList.push_back( MSG_PANEL_ITEM( _( "Text Size" ), msg ) ); GetTextWidth() ) );
switch ( GetHorizJustify() ) switch ( GetHorizJustify() )
{ {
@ -444,7 +442,7 @@ void LIB_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
case GR_TEXT_HJUSTIFY_RIGHT: msg = _( "Right" ); break; case GR_TEXT_HJUSTIFY_RIGHT: msg = _( "Right" ); break;
} }
aList.push_back( MSG_PANEL_ITEM( _( "H Justification" ), msg ) ); aList.emplace_back( _( "H Justification" ), msg );
switch ( GetVertJustify() ) switch ( GetVertJustify() )
{ {
@ -453,7 +451,7 @@ void LIB_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
case GR_TEXT_VJUSTIFY_BOTTOM: msg = _( "Bottom" ); break; case GR_TEXT_VJUSTIFY_BOTTOM: msg = _( "Bottom" ); break;
} }
aList.push_back( MSG_PANEL_ITEM( _( "V Justification" ), msg ) ); aList.emplace_back( _( "V Justification" ), msg );
} }

View File

@ -51,14 +51,14 @@ void LIB_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
{ {
wxString msg; wxString msg;
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), GetTypeName() ) ); aList.emplace_back( _( "Type" ), GetTypeName() );
if( m_unit == 0 ) if( m_unit == 0 )
msg = _( "All" ); msg = _( "All" );
else else
msg.Printf( wxT( "%d" ), m_unit ); msg.Printf( wxT( "%d" ), m_unit );
aList.push_back( MSG_PANEL_ITEM( _( "Unit" ), msg ) ); aList.emplace_back( _( "Unit" ), msg );
if( m_convert == LIB_ITEM::LIB_CONVERT::BASE ) if( m_convert == LIB_ITEM::LIB_CONVERT::BASE )
msg = _( "no" ); msg = _( "no" );
@ -67,7 +67,7 @@ void LIB_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
else else
msg = wxT( "?" ); msg = wxT( "?" );
aList.push_back( MSG_PANEL_ITEM( _( "Converted" ), msg ) ); aList.emplace_back( _( "Converted" ), msg );
} }

View File

@ -1036,30 +1036,24 @@ void LIB_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
{ {
LIB_ITEM::GetMsgPanelInfo( aFrame, aList ); LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), UnescapeString( GetShownName() ) ) ); aList.emplace_back( _( "Name" ), UnescapeString( GetShownName() ) );
aList.push_back( MSG_PANEL_ITEM( _( "Number" ), GetShownNumber() ) ); aList.emplace_back( _( "Number" ), GetShownNumber() );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), ElectricalPinTypeGetText( m_type ) ) ); aList.emplace_back( _( "Type" ), ElectricalPinTypeGetText( m_type ) );
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), PinShapeGetText( m_shape ) ) ); aList.emplace_back( _( "Style" ), PinShapeGetText( m_shape ) );
wxString text = IsVisible() ? _( "Yes" ) : _( "No" ); aList.emplace_back( _( "Style" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), text ) );
// Display pin length // Display pin length
text = StringFromValue( aFrame->GetUserUnits(), m_length ); aList.emplace_back( _( "Length" ), StringFromValue( aFrame->GetUserUnits(), m_length ) );
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), text ) );
text = PinOrientationName( (unsigned) PinOrientationIndex( m_orientation ) ); int i = PinOrientationIndex( m_orientation );
aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), text ) ); aList.emplace_back( _( "Orientation" ), PinOrientationName( (unsigned) i ) );
wxPoint pinpos = GetPosition(); wxPoint pinpos = GetPosition();
pinpos.y = -pinpos.y; // Display coord are top to bottom pinpos.y = -pinpos.y; // Display coords are top to bottom; lib item coords are bottom to top
// lib items coord are bottom to top
text = MessageTextFromValue( aFrame->GetUserUnits(), pinpos.x ); aList.emplace_back( _( "Pos X" ), MessageTextFromValue( aFrame->GetUserUnits(), pinpos.x ) );
aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text ) ); aList.emplace_back( _( "Pos Y" ), MessageTextFromValue( aFrame->GetUserUnits(), pinpos.y ) );
text = MessageTextFromValue( aFrame->GetUserUnits(), pinpos.y );
aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text ) );
} }

View File

@ -330,19 +330,17 @@ void LIB_POLYLINE::DeleteSegment( const wxPoint aPosition )
void LIB_POLYLINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) void LIB_POLYLINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{ {
wxString msg;
EDA_RECT bBox = GetBoundingBox(); EDA_RECT bBox = GetBoundingBox();
LIB_ITEM::GetMsgPanelInfo( aFrame, aList ); LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width ); aList.emplace_back( _( "Line Width" ), MessageTextFromValue( aFrame->GetUserUnits(), m_Width ) );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg ) ); aList.emplace_back( _( "Bounding Box" ), wxString::Format( wxT( "(%d, %d, %d, %d)" ),
bBox.GetOrigin().x,
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); bBox.GetEnd().x,
bBox.GetEnd().y ) );
aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg ) );
} }

View File

@ -185,9 +185,7 @@ void LIB_RECTANGLE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PAN
{ {
LIB_ITEM::GetMsgPanelInfo( aFrame, aList ); LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
wxString msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width ); aList.emplace_back( _( "Line Width" ), MessageTextFromValue( aFrame->GetUserUnits(), m_Width ) );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg ) );
} }

View File

@ -346,13 +346,12 @@ void LIB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
LIB_ITEM::GetMsgPanelInfo( aFrame, aList ); LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
// Don't use GetShownText() here; we want to show the user the variable references // Don't use GetShownText() here; we want to show the user the variable references
aList.push_back( MSG_PANEL_ITEM( _( "Text" ), UnescapeString( GetText() ) ) ); aList.emplace_back( _( "Text" ), UnescapeString( GetText() ) );
msg = GetTextStyleName(); aList.emplace_back( _( "Style" ), GetTextStyleName() );
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), msg ) );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() ); aList.emplace_back( _( "Text Size" ), MessageTextFromValue( aFrame->GetUserUnits(),
aList.push_back( MSG_PANEL_ITEM( _( "Text Size" ), msg ) ); GetTextWidth() ) );
switch ( GetHorizJustify() ) switch ( GetHorizJustify() )
{ {
@ -361,7 +360,7 @@ void LIB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
case GR_TEXT_HJUSTIFY_RIGHT: msg = _( "Right" ); break; case GR_TEXT_HJUSTIFY_RIGHT: msg = _( "Right" ); break;
} }
aList.push_back( MSG_PANEL_ITEM( _( "H Justification" ), msg ) ); aList.emplace_back( _( "H Justification" ), msg );
switch ( GetVertJustify() ) switch ( GetVertJustify() )
{ {
@ -370,7 +369,7 @@ void LIB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
case GR_TEXT_VJUSTIFY_BOTTOM: msg = _( "Bottom" ); break; case GR_TEXT_VJUSTIFY_BOTTOM: msg = _( "Bottom" ); break;
} }
aList.push_back( MSG_PANEL_ITEM( _( "V Justification" ), msg ) ); aList.emplace_back( _( "V Justification" ), msg );
} }

View File

@ -198,12 +198,10 @@ BITMAPS SCH_BITMAP::GetMenuImage() const
void SCH_BITMAP::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) void SCH_BITMAP::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{ {
aList.push_back( MSG_PANEL_ITEM( _( "Bitmap" ), wxEmptyString ) ); aList.emplace_back( _( "Bitmap" ), wxEmptyString );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), MessageTextFromValue( aFrame->GetUserUnits(), aList.emplace_back( _( "Width" ), MessageTextFromValue( aFrame->GetUserUnits(), GetSize().x ) );
GetSize().x ) ) ); aList.emplace_back( _( "Height" ), MessageTextFromValue( aFrame->GetUserUnits(), GetSize().y ) );
aList.push_back( MSG_PANEL_ITEM( _( "Height" ), MessageTextFromValue( aFrame->GetUserUnits(),
GetSize().y ) ) );
} }

View File

@ -490,7 +490,7 @@ void SCH_BUS_ENTRY_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
case LAYER_BUS: msg = _( "Bus" ); break; case LAYER_BUS: msg = _( "Bus" ); break;
} }
aList.push_back( MSG_PANEL_ITEM( _( "Bus Entry Type" ), msg ) ); aList.emplace_back( _( "Bus Entry Type" ), msg );
SCH_CONNECTION* conn = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) ? Connection() : nullptr; SCH_CONNECTION* conn = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) ? Connection() : nullptr;
@ -507,7 +507,7 @@ void SCH_BUS_ENTRY_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
if( netSettings.m_NetClassAssignments.count( netname ) ) if( netSettings.m_NetClassAssignments.count( netname ) )
netclassName = netSettings.m_NetClassAssignments[ netname ]; netclassName = netSettings.m_NetClassAssignments[ netname ];
aList.push_back( MSG_PANEL_ITEM( _( "Assigned Netclass" ), netclassName ) ); aList.emplace_back( _( "Assigned Netclass" ), netclassName );
} }
} }
} }

View File

@ -398,47 +398,40 @@ void SCH_CONNECTION::SetSuffix( const wxString& aSuffix )
void SCH_CONNECTION::AppendInfoToMsgPanel( std::vector<MSG_PANEL_ITEM>& aList ) const void SCH_CONNECTION::AppendInfoToMsgPanel( std::vector<MSG_PANEL_ITEM>& aList ) const
{ {
wxString msg, group_name; wxString msg, group_name, members;
std::vector<wxString> group_members; std::vector<wxString> group_members;
aList.push_back( MSG_PANEL_ITEM( _( "Connection Name" ), UnescapeString( Name() ) ) ); aList.emplace_back( _( "Connection Name" ), UnescapeString( Name() ) );
// NOTE(JE) Disabling this for now, because net codes are generated in the netlist exporter // NOTE(JE) Disabling this for now, because net codes are generated in the netlist exporter
// in order to avoid sort costs. It may make sense to just tear out net codes from the // in order to avoid sort costs. It may make sense to just tear out net codes from the
// CONNECTION_GRAPH entirely in the future, as they are mostly only useful for netlist exports. // CONNECTION_GRAPH entirely in the future, as they are mostly only useful for netlist exports.
#if 0 #if 0
if( !IsBus() ) if( !IsBus() )
{ aList.emplace_back( _( "Net Code" ), wxString::Format( "%d", m_net_code ) );
msg.Printf( "%d", m_net_code );
aList.push_back( MSG_PANEL_ITEM( _( "Net Code" ), msg ) );
}
#endif #endif
if( auto alias = m_graph->GetBusAlias( m_name ) ) if( auto alias = m_graph->GetBusAlias( m_name ) )
{ {
msg.Printf( _( "Bus Alias %s Members" ), m_name ); msg.Printf( _( "Bus Alias %s Members" ), m_name );
wxString members; for( const wxString& member : alias->Members() )
for( const auto& member : alias->Members() )
members << member << " "; members << member << " ";
aList.push_back( MSG_PANEL_ITEM( msg, members ) ); aList.emplace_back( msg, members );
} }
else if( NET_SETTINGS::ParseBusGroup( m_name, &group_name, &group_members ) ) else if( NET_SETTINGS::ParseBusGroup( m_name, &group_name, &group_members ) )
{ {
for( const auto& group_member : group_members ) for( const wxString& group_member : group_members )
{ {
if( auto group_alias = m_graph->GetBusAlias( group_member ) ) if( std::shared_ptr<BUS_ALIAS> group_alias = m_graph->GetBusAlias( group_member ) )
{ {
msg.Printf( _( "Bus Alias %s Members" ), group_alias->GetName() ); msg.Printf( _( "Bus Alias %s Members" ), group_alias->GetName() );
wxString members; for( const wxString& member : group_alias->Members() )
for( const auto& member : group_alias->Members() )
members << member << " "; members << member << " ";
aList.push_back( MSG_PANEL_ITEM( msg, members ) ); aList.emplace_back( msg, members );
} }
} }
} }
@ -450,18 +443,14 @@ void SCH_CONNECTION::AppendInfoToMsgPanel( std::vector<MSG_PANEL_ITEM>& aList )
return; return;
if( IsBus() ) if( IsBus() )
{ aList.emplace_back( "Bus Code", wxString::Format( "%d", m_bus_code ) );
msg.Printf( "%d", m_bus_code );
aList.push_back( MSG_PANEL_ITEM( "Bus Code", msg ) );
}
msg.Printf( "%d", m_subgraph_code ); aList.emplace_back( "Subgraph Code", wxString::Format( "%d", m_subgraph_code ) );
aList.push_back( MSG_PANEL_ITEM( "Subgraph Code", msg ) );
if( auto driver = Driver() ) if( SCH_ITEM* driver = Driver() )
{ {
msg.Printf( "%s at %p", driver->GetSelectMenuText( EDA_UNITS::MILLIMETRES ), driver ); msg.Printf( "%s at %p", driver->GetSelectMenuText( EDA_UNITS::MILLIMETRES ), driver );
aList.push_back( MSG_PANEL_ITEM( "Connection Source", msg ) ); aList.emplace_back( "Connection Source", msg );
} }
#endif #endif
} }

View File

@ -481,19 +481,17 @@ void SCH_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
{ {
wxString msg; wxString msg;
aList.push_back( MSG_PANEL_ITEM( _( "Symbol Field" ), GetName() ) ); aList.emplace_back( _( "Symbol Field" ), GetName() );
// Don't use GetShownText() here; we want to show the user the variable references // Don't use GetShownText() here; we want to show the user the variable references
aList.push_back( MSG_PANEL_ITEM( _( "Text" ), UnescapeString( GetText() ) ) ); aList.emplace_back( _( "Text" ), UnescapeString( GetText() ) );
msg = IsVisible() ? _( "Yes" ) : _( "No" ); aList.emplace_back( _( "Visible" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), msg ) );
msg = GetTextStyleName(); aList.emplace_back( _( "Style" ), GetTextStyleName() );
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), msg ) );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() ); aList.emplace_back( _( "Text Size" ), MessageTextFromValue( aFrame->GetUserUnits(),
aList.push_back( MSG_PANEL_ITEM( _( "Text Size" ), msg ) ); GetTextWidth() ) );
switch ( GetHorizJustify() ) switch ( GetHorizJustify() )
{ {
@ -502,7 +500,7 @@ void SCH_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
case GR_TEXT_HJUSTIFY_RIGHT: msg = _( "Right" ); break; case GR_TEXT_HJUSTIFY_RIGHT: msg = _( "Right" ); break;
} }
aList.push_back( MSG_PANEL_ITEM( _( "H Justification" ), msg ) ); aList.emplace_back( _( "H Justification" ), msg );
switch ( GetVertJustify() ) switch ( GetVertJustify() )
{ {
@ -511,7 +509,7 @@ void SCH_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
case GR_TEXT_VJUSTIFY_BOTTOM: msg = _( "Bottom" ); break; case GR_TEXT_VJUSTIFY_BOTTOM: msg = _( "Bottom" ); break;
} }
aList.push_back( MSG_PANEL_ITEM( _( "V Justification" ), msg ) ); aList.emplace_back( _( "V Justification" ), msg );
} }

View File

@ -881,14 +881,14 @@ void SCH_LINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
default: msg = _( "Graphical" ); break; default: msg = _( "Graphical" ); break;
} }
aList.push_back( MSG_PANEL_ITEM( _( "Line Type" ), msg ) ); aList.emplace_back( _( "Line Type" ), msg );
if( GetLineStyle() != GetEffectiveLineStyle() ) if( GetLineStyle() != GetEffectiveLineStyle() )
msg = _( "from netclass" ); msg = _( "from netclass" );
else else
msg = GetLineStyleName( GetLineStyle() ); msg = GetLineStyleName( GetLineStyle() );
aList.push_back( MSG_PANEL_ITEM( _( "Line Style" ), msg ) ); aList.emplace_back( _( "Line Style" ), msg );
SCH_CONNECTION* conn = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) ? Connection() : nullptr; SCH_CONNECTION* conn = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) ? Connection() : nullptr;
@ -905,7 +905,7 @@ void SCH_LINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
if( netSettings.m_NetClassAssignments.count( netname ) ) if( netSettings.m_NetClassAssignments.count( netname ) )
netclassName = netSettings.m_NetClassAssignments[ netname ]; netclassName = netSettings.m_NetClassAssignments[ netname ];
aList.push_back( MSG_PANEL_ITEM( _( "Assigned Netclass" ), netclassName ) ); aList.emplace_back( _( "Assigned Netclass" ), netclassName );
} }
} }
} }

View File

@ -162,8 +162,7 @@ const EDA_RECT SCH_MARKER::GetBoundingBox() const
void SCH_MARKER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) void SCH_MARKER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{ {
aList.push_back( MSG_PANEL_ITEM( _( "Electrical Rule Check Error" ), aList.emplace_back( _( "Electrical Rule Check Error" ), m_rcItem->GetErrorMessage() );
m_rcItem->GetErrorMessage() ) );
} }

View File

@ -181,14 +181,14 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
{ {
wxString msg; wxString msg;
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), _( "Pin" ) ) ); aList.emplace_back( _( "Type" ), _( "Pin" ) );
if( m_libPin->GetUnit() == 0 ) if( m_libPin->GetUnit() == 0 )
msg = _( "All" ); msg = _( "All" );
else else
msg.Printf( wxT( "%d" ), m_libPin->GetUnit() ); msg.Printf( wxT( "%d" ), m_libPin->GetUnit() );
aList.push_back( MSG_PANEL_ITEM( _( "Unit" ), msg ) ); aList.emplace_back( _( "Unit" ), msg );
if( m_libPin->GetConvert() == LIB_ITEM::LIB_CONVERT::BASE ) if( m_libPin->GetConvert() == LIB_ITEM::LIB_CONVERT::BASE )
msg = _( "no" ); msg = _( "no" );
@ -197,24 +197,19 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
else else
msg = wxT( "?" ); msg = wxT( "?" );
aList.push_back( MSG_PANEL_ITEM( _( "Converted" ), msg ) ); aList.emplace_back( _( "Converted" ), msg );
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), GetShownName() ) ); aList.emplace_back( _( "Name" ), GetShownName() );
aList.push_back( MSG_PANEL_ITEM( _( "Number" ), GetShownNumber() ) ); aList.emplace_back( _( "Number" ), GetShownNumber() );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), ElectricalPinTypeGetText( GetType() ) ) ); aList.emplace_back( _( "Type" ), ElectricalPinTypeGetText( GetType() ) );
aList.emplace_back( _( "Style" ), PinShapeGetText( GetShape() ) );
msg = PinShapeGetText( GetShape() ); aList.emplace_back( _( "Visible" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), msg ) );
msg = IsVisible() ? _( "Yes" ) : _( "No" ); aList.emplace_back( _( "Length" ), StringFromValue( aFrame->GetUserUnits(), GetLength() ) );
aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), msg ) );
// Display pin length int i = PinOrientationIndex( GetOrientation() );
msg = StringFromValue( aFrame->GetUserUnits(), GetLength() ); aList.emplace_back( _( "Orientation" ), PinOrientationName( (unsigned) i ) );
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg ) );
msg = PinOrientationName( (unsigned) PinOrientationIndex( GetOrientation() ) );
aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), msg ) );
SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ); SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( aFrame );
SCH_SHEET_PATH* currentSheet = schframe ? &schframe->GetCurrentSheet() : nullptr; SCH_SHEET_PATH* currentSheet = schframe ? &schframe->GetCurrentSheet() : nullptr;
@ -223,17 +218,13 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
aList.emplace_back( symbol->GetRef( currentSheet ), symbol->GetValue( currentSheet, true ) ); aList.emplace_back( symbol->GetRef( currentSheet ), symbol->GetValue( currentSheet, true ) );
#if defined(DEBUG) #if defined(DEBUG)
if( dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
{
SCH_CONNECTION* conn = Connection();
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ); if( conn )
conn->AppendInfoToMsgPanel( aList );
if( !frame ) }
return;
SCH_CONNECTION* conn = Connection();
if( conn )
conn->AppendInfoToMsgPanel( aList );
#endif #endif
} }

View File

@ -1373,20 +1373,17 @@ void SCH_SYMBOL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
{ {
if( m_part.get() != dummy() ) if( m_part.get() != dummy() )
{ {
aList.push_back( MSG_PANEL_ITEM( _( "Reference" ), GetRef( currentSheet ) ) ); aList.emplace_back( _( "Reference" ), GetRef( currentSheet ) );
msg = m_part->IsPower() ? _( "Power symbol" ) : _( "Value" ); msg = m_part->IsPower() ? _( "Power symbol" ) : _( "Value" );
aList.emplace_back( msg, GetValue( currentSheet, true ) );
aList.push_back( MSG_PANEL_ITEM( msg, GetValue( currentSheet, true ) ) );
#if 0 // Display symbol flags, for debug only #if 0 // Display symbol flags, for debug only
aList.push_back( MSG_PANEL_ITEM( _( "flags" ), aList.emplace_back( _( "flags" ), wxString::Format( "%X", GetEditFlags() ) );
wxString::Format( "%X", GetEditFlags() ) ) );
#endif #endif
// Display symbol reference in library and library // Display symbol reference in library and library
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), aList.emplace_back( _( "Name" ), UnescapeString( GetLibId().GetLibItemName() ) );
UnescapeString( GetLibId().GetLibItemName() ) ) );
if( !m_part->IsRoot() ) if( !m_part->IsRoot() )
{ {
@ -1397,15 +1394,15 @@ void SCH_SYMBOL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
if( parent ) if( parent )
msg = parent->GetName(); msg = parent->GetName();
aList.push_back( MSG_PANEL_ITEM( _( "Alias of" ), UnescapeString( msg ) ) ); aList.emplace_back( _( "Alias of" ), UnescapeString( msg ) );
} }
else if( !m_lib_id.GetLibNickname().empty() ) else if( !m_lib_id.GetLibNickname().empty() )
{ {
aList.push_back( MSG_PANEL_ITEM( _( "Library" ), m_lib_id.GetLibNickname() ) ); aList.emplace_back( _( "Library" ), m_lib_id.GetLibNickname() );
} }
else else
{ {
aList.push_back( MSG_PANEL_ITEM( _( "Library" ), _( "Undefined!!!" ) ) ); aList.emplace_back( _( "Library" ), _( "Undefined!!!" ) );
} }
// Display the current associated footprint, if exists. // Display the current associated footprint, if exists.
@ -1414,32 +1411,28 @@ void SCH_SYMBOL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
if( msg.IsEmpty() ) if( msg.IsEmpty() )
msg = _( "<Unknown>" ); msg = _( "<Unknown>" );
aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), msg ) ); aList.emplace_back( _( "Footprint" ), msg );
// Display description of the symbol, and keywords found in lib // Display description of the symbol, and keywords found in lib
aList.push_back( MSG_PANEL_ITEM( _( "Description" ), m_part->GetDescription(), aList.emplace_back( _( "Description" ), m_part->GetDescription() );
DARKCYAN ) ); aList.emplace_back( _( "Keywords" ), m_part->GetKeyWords() );
aList.push_back( MSG_PANEL_ITEM( _( "Keywords" ), m_part->GetKeyWords() ) );
} }
} }
else else
{ {
aList.push_back( MSG_PANEL_ITEM( _( "Reference" ), GetRef( currentSheet ) ) ); aList.emplace_back( _( "Reference" ), GetRef( currentSheet ) );
aList.push_back( MSG_PANEL_ITEM( _( "Value" ), GetValue( currentSheet, true ) ) ); aList.emplace_back( _( "Value" ), GetValue( currentSheet, true ) );
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), GetLibId().GetLibItemName() ) ); aList.emplace_back( _( "Name" ), GetLibId().GetLibItemName() );
wxString libNickname = GetLibId().GetLibNickname(); wxString libNickname = GetLibId().GetLibNickname();
if( libNickname.empty() ) if( libNickname.empty() )
{ msg = _( "No library defined!" );
aList.push_back( MSG_PANEL_ITEM( _( "Library" ), _( "No library defined!" ) ) );
}
else else
{
msg.Printf( _( "Symbol not found in %s!" ), libNickname ); msg.Printf( _( "Symbol not found in %s!" ), libNickname );
aList.push_back( MSG_PANEL_ITEM( _( "Library" ), msg ) );
} aList.emplace_back( _( "Library" ), msg );
} }
} }

View File

@ -750,14 +750,11 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
} }
// Don't use GetShownText() here; we want to show the user the variable references // Don't use GetShownText() here; we want to show the user the variable references
aList.push_back( MSG_PANEL_ITEM( msg, UnescapeString( GetText() ) ) ); aList.emplace_back( msg, UnescapeString( GetText() ) );
// Display electrical type if it is relevant // Display electrical type if it is relevant
if( Type() == SCH_GLOBAL_LABEL_T || Type() == SCH_HIER_LABEL_T || Type() == SCH_SHEET_PIN_T ) if( Type() == SCH_GLOBAL_LABEL_T || Type() == SCH_HIER_LABEL_T || Type() == SCH_SHEET_PIN_T )
{ aList.emplace_back( _( "Type" ), getElectricalTypeLabel( GetShape() ) );
msg = getElectricalTypeLabel( GetShape() );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg ) );
}
wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) }; wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
int style = 0; int style = 0;
@ -768,11 +765,10 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
if( IsBold() ) if( IsBold() )
style += 2; style += 2;
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), textStyle[style] ) ); aList.emplace_back( _( "Style" ), textStyle[style] );
// Display text size (X or Y value, with are the same value in Eeschema) aList.emplace_back( _( "Text Size" ), MessageTextFromValue( aFrame->GetUserUnits(),
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() ); GetTextWidth() ) );
aList.push_back( MSG_PANEL_ITEM( _( "Text Size" ), msg ) );
switch( GetLabelSpinStyle() ) switch( GetLabelSpinStyle() )
{ {
@ -783,7 +779,7 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
default: msg = wxT( "???" ); break; default: msg = wxT( "???" ); break;
} }
aList.push_back( MSG_PANEL_ITEM( _( "Justification" ), msg ) ); aList.emplace_back( _( "Justification" ), msg );
SCH_CONNECTION* conn = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) ? Connection() : nullptr; SCH_CONNECTION* conn = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) ? Connection() : nullptr;
@ -799,7 +795,7 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
if( netSettings.m_NetClassAssignments.count( netname ) ) if( netSettings.m_NetClassAssignments.count( netname ) )
{ {
const wxString& netclassName = netSettings.m_NetClassAssignments[ netname ]; const wxString& netclassName = netSettings.m_NetClassAssignments[ netname ];
aList.push_back( MSG_PANEL_ITEM( _( "Assigned Netclass" ), netclassName ) ); aList.emplace_back( _( "Assigned Netclass" ), netclassName );
} }
} }
} }

View File

@ -786,23 +786,18 @@ void PCB_TRACK::GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame,
aList.emplace_back( _( "NetClass" ), UnescapeString( GetNetClass()->GetName() ) ); aList.emplace_back( _( "NetClass" ), UnescapeString( GetNetClass()->GetName() ) );
#if 0 // Enable for debugging #if 0 // Enable for debugging
if( GetBoard() ) if( GetBoard() )
{ aList.emplace_back( _( "NetCode" ), wxString::Format( wxT( "%d" ), GetNetCode() ) );
// Display net code:
msg.Printf( wxT( "%d" ), GetNetCode() );
aList.emplace_back( _( "NetCode" ), msg );
}
// Display the flags: aList.emplace_back( wxT( "Flags" ), wxString::Format( wxT( "0x%08X" ), m_flags ) );
msg.Printf( wxT( "0x%08X" ), m_flags );
aList.emplace_back( wxT( "Flags" ), msg );
// Display start and end positions: aList.emplace_back( wxT( "Start pos" ), wxString::Format( wxT( "%d %d" ),
msg.Printf( wxT( "%d %d" ), m_Start.x, m_Start.y ); m_Start.x,
aList.push_back( MSG_PANEL_ITEM( wxT( "Start pos" ), msg ) ); m_Start.y ) );
msg.Printf( wxT( "%d %d" ), m_End.x, m_End.y ); aList.emplace_back( wxT( "End pos" ), wxString::Format( wxT( "%d %d" ),
aList.push_back( MSG_PANEL_ITEM( wxT( "End pos" ), msg ) ); m_End.x,
m_End.y ) );
#endif #endif
// Display the State member // Display the State member