Simplify message panel code.

We've had the colours turned off for two releases now without any
screaming or gnashing of teeth, so it's time to clean up the code.
This commit is contained in:
Jeff Young 2020-11-18 15:36:47 +00:00
parent cb5ec8bce1
commit c1d1c12b41
25 changed files with 137 additions and 161 deletions

View File

@ -601,11 +601,11 @@ void EDA_DRAW_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
}
void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& textUpper, const wxString& textLower,
COLOR4D color, int pad )
void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& aTextUpper, const wxString& aTextLower,
int aPadding )
{
if( m_messagePanel )
m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
m_messagePanel->AppendMessage( aTextUpper, aTextLower, aPadding );
}

View File

@ -111,24 +111,24 @@ void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS
switch( dataItem->GetType() )
{
case WS_DATA_ITEM::WS_SEGMENT:
aList.push_back( MSG_PANEL_ITEM( _( "Line" ), msg, DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Line" ), msg ) );
break;
case WS_DATA_ITEM::WS_RECT:
aList.push_back( MSG_PANEL_ITEM( _( "Rectangle" ), msg, DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Rectangle" ), msg ) );
break;
case WS_DATA_ITEM::WS_TEXT:
msg = static_cast<WS_DRAW_ITEM_TEXT*>( this )->GetShownText();
aList.push_back( MSG_PANEL_ITEM( _( "Text" ), msg, DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Text" ), msg ) );
break;
case WS_DATA_ITEM::WS_POLYPOLYGON:
aList.push_back( MSG_PANEL_ITEM( _( "Imported Shape" ), msg, DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Imported Shape" ), msg ) );
break;
case WS_DATA_ITEM::WS_BITMAP:
aList.push_back( MSG_PANEL_ITEM( _( "Image" ), msg, DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Image" ), msg ) );
break;
}
@ -139,21 +139,21 @@ void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS
default: msg = _( "All Pages" ); break;
}
aList.push_back( MSG_PANEL_ITEM( _( "First Page Option" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "First Page Option" ), msg ) );
msg = MessageTextFromValue( EDA_UNITS::UNSCALED, dataItem->m_RepeatCount );
aList.push_back( MSG_PANEL_ITEM( _( "Repeat Count" ), msg, BLUE ) );
aList.push_back( MSG_PANEL_ITEM( _( "Repeat Count" ), msg ) );
msg = MessageTextFromValue( EDA_UNITS::UNSCALED, dataItem->m_IncrementLabel );
aList.push_back( MSG_PANEL_ITEM( _( "Repeat Label Increment" ), msg, DARKGRAY ) );
aList.push_back( MSG_PANEL_ITEM( _( "Repeat Label Increment" ), msg ) );
msg.Printf( wxT( "(%s, %s)" ),
MessageTextFromValue( aFrame->GetUserUnits(), dataItem->m_IncrementVector.x ),
MessageTextFromValue( aFrame->GetUserUnits(), dataItem->m_IncrementVector.y ) );
aList.push_back( MSG_PANEL_ITEM( _( "Repeat Position Increment" ), msg, RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Repeat Position Increment" ), msg ) );
aList.push_back( MSG_PANEL_ITEM( _( "Comment" ), dataItem->m_Info, MAGENTA ) );
aList.push_back( MSG_PANEL_ITEM( _( "Comment" ), dataItem->m_Info ) );
}

View File

@ -111,15 +111,14 @@ void EDA_MSG_PANEL::OnPaint( wxPaintEvent& aEvent )
}
void EDA_MSG_PANEL::AppendMessage( const wxString& aUpperText,
const wxString& aLowerText,
COLOR4D aColor, int aPad )
void EDA_MSG_PANEL::AppendMessage( const wxString& aUpperText, const wxString& aLowerText,
int aPadding )
{
wxString text;
wxSize drawSize = GetClientSize();
text = ( aUpperText.Len() > aLowerText.Len() ) ? aUpperText : aLowerText;
text.Append( ' ', aPad );
text.Append( ' ', aPadding );
MSG_PANEL_ITEM item;
@ -135,7 +134,6 @@ void EDA_MSG_PANEL::AppendMessage( const wxString& aUpperText,
item.m_UpperText = aUpperText;
item.m_LowerText = aLowerText;
item.m_Color = aColor;
m_Items.push_back( item );
m_last_x += computeTextSize( text ).x;
@ -147,7 +145,7 @@ void EDA_MSG_PANEL::AppendMessage( const wxString& aUpperText,
void EDA_MSG_PANEL::SetMessage( int aXPosition, const wxString& aUpperText,
const wxString& aLowerText, COLOR4D aColor )
const wxString& aLowerText )
{
wxPoint pos;
wxSize drawSize = GetClientSize();
@ -166,7 +164,6 @@ void EDA_MSG_PANEL::SetMessage( int aXPosition, const wxString& aUpperText,
item.m_UpperText = aUpperText;
item.m_LowerText = aLowerText;
item.m_Color = aColor;
int ndx;
@ -190,9 +187,7 @@ void EDA_MSG_PANEL::SetMessage( int aXPosition, const wxString& aUpperText,
}
if( ndx == limit ) // mutually exclusive with two above if tests
{
m_Items.push_back( item );
}
Refresh();
}
@ -200,21 +195,16 @@ void EDA_MSG_PANEL::SetMessage( int aXPosition, const wxString& aUpperText,
void EDA_MSG_PANEL::showItem( wxDC& aDC, const MSG_PANEL_ITEM& aItem )
{
// COLOR4D color = aItem.m_Color;
COLOR4D color = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
aDC.SetTextForeground( color.ToColour() );
if( !aItem.m_UpperText.IsEmpty() )
{
aDC.DrawText( aItem.m_UpperText, aItem.m_X, aItem.m_UpperY );
}
if( !aItem.m_LowerText.IsEmpty() )
{
aDC.DrawText( aItem.m_LowerText, aItem.m_X, aItem.m_LowerY );
}
}
void EDA_MSG_PANEL::EraseMsgBox()

View File

@ -247,10 +247,10 @@ void LIB_CIRCLE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg ) );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetRadius() );
aList.push_back( MSG_PANEL_ITEM( _( "Radius" ), msg, RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Radius" ), msg ) );
msg.Printf( wxT( "(%d, %d, %d, %d)" ),
bBox.GetOrigin().x,
@ -258,7 +258,7 @@ void LIB_CIRCLE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList
bBox.GetEnd().x,
bBox.GetEnd().y );
aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg ) );
}

View File

@ -430,19 +430,19 @@ void LIB_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList
// Display style:
msg = GetTextStyleName();
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), msg, MAGENTA ) );
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), msg ) );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, BLUE ) );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg ) );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextHeight() );
aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, BLUE ) );
aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg ) );
// Display field name (ref, value ...)
aList.push_back( MSG_PANEL_ITEM( _( "Field" ), GetName(), BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Field" ), GetName() ) );
// Display field text:
aList.push_back( MSG_PANEL_ITEM( _( "Value" ), GetShownText(), BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Value" ), GetShownText() ) );
}

View File

@ -51,14 +51,14 @@ void LIB_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
wxString msg;
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), GetTypeName(), CYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), GetTypeName() ) );
if( m_Unit == 0 )
msg = _( "All" );
else
msg.Printf( wxT( "%d" ), m_Unit );
aList.push_back( MSG_PANEL_ITEM( _( "Unit" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Unit" ), msg ) );
if( m_Convert == LIB_ITEM::LIB_CONVERT::BASE )
msg = _( "no" );
@ -67,7 +67,7 @@ void LIB_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
else
msg = wxT( "?" );
aList.push_back( MSG_PANEL_ITEM( _( "Converted" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Converted" ), msg ) );
}

View File

@ -978,32 +978,32 @@ void LIB_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), m_name, DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Number" ), text, DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), ElectricalPinTypeGetText( m_type ), RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), m_name ) );
aList.push_back( MSG_PANEL_ITEM( _( "Number" ), text ) );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), ElectricalPinTypeGetText( m_type ) ) );
text = PinShapeGetText( m_shape );
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), text, BLUE ) );
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), text ) );
text = IsVisible() ? _( "Yes" ) : _( "No" );
aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), text, DARKGREEN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), text ) );
// Display pin length
text = StringFromValue( aFrame->GetUserUnits(), m_length );
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), text, MAGENTA ) );
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), text ) );
text = PinOrientationName( (unsigned) PinOrientationIndex( m_orientation ) );
aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), text, DARKMAGENTA ) );
aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), text ) );
wxPoint pinpos = GetPosition();
pinpos.y = -pinpos.y; // Display coord are top to bottom
// lib items coord are bottom to top
text = MessageTextFromValue( aFrame->GetUserUnits(), pinpos.x );
aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text, DARKMAGENTA ) );
aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text ) );
text = MessageTextFromValue( aFrame->GetUserUnits(), pinpos.y );
aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text ) );
}

View File

@ -337,12 +337,12 @@ void LIB_POLYLINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aLi
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg ) );
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg ) );
}

View File

@ -193,7 +193,7 @@ void LIB_RECTANGLE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aL
wxString msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg ) );
}

View File

@ -349,7 +349,7 @@ void LIB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
wxString msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextThickness() );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg ) );
}

View File

@ -356,10 +356,10 @@ void LIB_VIEW_FRAME::updatePreviewSymbol()
if( parent )
parentName = parent->GetName();
AppendMsgPanel( _( "Name" ), m_previewItem->GetName(), BLUE, 6 );
AppendMsgPanel( _( "Parent" ), parentName, RED, 6 );
AppendMsgPanel( _( "Description" ), m_previewItem->GetDescription(), CYAN, 6 );
AppendMsgPanel( _( "Keywords" ), m_previewItem->GetKeyWords(), DARKDARKGRAY );
AppendMsgPanel( _( "Name" ), m_previewItem->GetName() );
AppendMsgPanel( _( "Parent" ), parentName );
AppendMsgPanel( _( "Description" ), m_previewItem->GetDescription() );
AppendMsgPanel( _( "Keywords" ), m_previewItem->GetKeyWords() );
}
GetCanvas()->ForceRefresh();

View File

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

View File

@ -418,7 +418,7 @@ void SCH_BUS_ENTRY_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEM
case LAYER_BUS: msg = _( "Bus" ); break;
}
aList.push_back( MSG_PANEL_ITEM( _( "Bus Entry Type" ), msg, DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Bus Entry Type" ), msg ) );
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( aFrame );

View File

@ -1352,19 +1352,19 @@ void SCH_COMPONENT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aL
{
if( m_part.get() != dummy() )
{
aList.push_back( MSG_PANEL_ITEM( _( "Reference" ), GetRef( currentSheet ), DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Reference" ), GetRef( currentSheet ) ) );
msg = m_part->IsPower() ? _( "Power symbol" ) : _( "Value" );
aList.push_back( MSG_PANEL_ITEM( msg, GetValue( currentSheet, true ), DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( msg, GetValue( currentSheet, true ) ) );
#if 0 // Display component flags, for debug only
aList.push_back( MSG_PANEL_ITEM( _( "flags" ),
wxString::Format("%X", GetEditFlags()), BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "flags" ), wxString::Format( "%X",
GetEditFlags() ) ) );
#endif
// Display component reference in library and library
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), GetLibId().GetLibItemName(), BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), GetLibId().GetLibItemName() ) );
if( !m_part->IsRoot() )
{
@ -1375,16 +1375,15 @@ void SCH_COMPONENT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aL
if( parent )
msg = parent->GetName();
aList.push_back( MSG_PANEL_ITEM( _( "Alias of" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Alias of" ), msg ) );
}
else if( !m_lib_id.GetLibNickname().empty() )
{
aList.push_back( MSG_PANEL_ITEM( _( "Library" ), m_lib_id.GetLibNickname(),
BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Library" ), m_lib_id.GetLibNickname() ) );
}
else
{
aList.push_back( MSG_PANEL_ITEM( _( "Library" ), _( "Undefined!!!" ), RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Library" ), _( "Undefined!!!" ) ) );
}
// Display the current associated footprint, if exists.
@ -1393,31 +1392,31 @@ void SCH_COMPONENT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aL
if( msg.IsEmpty() )
msg = _( "<Unknown>" );
aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), msg, DARKRED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), msg ) );
// Display description of the component, and keywords found in lib
aList.push_back( MSG_PANEL_ITEM( _( "Description" ), m_part->GetDescription(),
DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Keywords" ), m_part->GetKeyWords(), DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Keywords" ), m_part->GetKeyWords() ) );
}
}
else
{
aList.push_back( MSG_PANEL_ITEM( _( "Reference" ), GetRef( currentSheet ), DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Reference" ), GetRef( currentSheet ) ) );
aList.push_back( MSG_PANEL_ITEM( _( "Value" ), GetValue( currentSheet, true ), DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), GetLibId().GetLibItemName(), BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Value" ), GetValue( currentSheet, true ) ) );
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), GetLibId().GetLibItemName() ) );
wxString libNickname = GetLibId().GetLibNickname();
if( libNickname.empty() )
{
aList.push_back( MSG_PANEL_ITEM( _( "Library" ), _( "No library defined!" ), RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Library" ), _( "No library defined!" ) ) );
}
else
{
msg.Printf( _( "Symbol not found in %s!" ), libNickname );
aList.push_back( MSG_PANEL_ITEM( _( "Library" ), msg , RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Library" ), msg ) );
}
}
}

View File

@ -350,7 +350,7 @@ void SCH_CONNECTION::AppendInfoToMsgPanel( MSG_PANEL_ITEMS& aList ) const
wxString msg, group_name;
std::vector<wxString> group_members;
aList.push_back( MSG_PANEL_ITEM( _( "Connection Name" ), UnescapeString( Name() ), BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Connection Name" ), UnescapeString( Name() ) ) );
// 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
@ -359,7 +359,7 @@ void SCH_CONNECTION::AppendInfoToMsgPanel( MSG_PANEL_ITEMS& aList ) const
if( !IsBus() )
{
msg.Printf( "%d", m_net_code );
aList.push_back( MSG_PANEL_ITEM( _( "Net Code" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Net Code" ), msg ) );
}
#endif
@ -372,7 +372,7 @@ void SCH_CONNECTION::AppendInfoToMsgPanel( MSG_PANEL_ITEMS& aList ) const
for( const auto& member : alias->Members() )
members << member << " ";
aList.push_back( MSG_PANEL_ITEM( msg, members, RED ) );
aList.push_back( MSG_PANEL_ITEM( msg, members ) );
}
else if( NET_SETTINGS::ParseBusGroup( m_name, &group_name, &group_members ) )
{
@ -387,7 +387,7 @@ void SCH_CONNECTION::AppendInfoToMsgPanel( MSG_PANEL_ITEMS& aList ) const
for( const auto& member : group_alias->Members() )
members << member << " ";
aList.push_back( MSG_PANEL_ITEM( msg, members, RED ) );
aList.push_back( MSG_PANEL_ITEM( msg, members ) );
}
}
}
@ -401,16 +401,16 @@ void SCH_CONNECTION::AppendInfoToMsgPanel( MSG_PANEL_ITEMS& aList ) const
if( IsBus() )
{
msg.Printf( "%d", m_bus_code );
aList.push_back( MSG_PANEL_ITEM( "Bus Code", msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( "Bus Code", msg ) );
}
msg.Printf( "%d", m_subgraph_code );
aList.push_back( MSG_PANEL_ITEM( "Subgraph Code", msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( "Subgraph Code", msg ) );
if( auto driver = Driver() )
{
msg.Printf( "%s at %p", driver->GetSelectMenuText( EDA_UNITS::MILLIMETRES ), driver );
aList.push_back( MSG_PANEL_ITEM( "Connection Source", msg, RED ) );
aList.push_back( MSG_PANEL_ITEM( "Connection Source", msg ) );
}
#endif
}

View File

@ -817,14 +817,14 @@ void SCH_LINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
default: msg = _( "Graphical" ); break;
}
aList.push_back( MSG_PANEL_ITEM( _( "Line Type" ), msg, DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Line Type" ), msg ) );
if( GetLineStyle() != GetEffectiveLineStyle() )
msg = _( "from netclass" );
else
msg = GetLineStyleName( GetLineStyle() );
aList.push_back( MSG_PANEL_ITEM( _( "Line Style" ), msg, DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Line Style" ), msg ) );
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( aFrame );
@ -841,7 +841,7 @@ void SCH_LINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
if( netSettings.m_NetClassAssignments.count( netname ) )
netclassName = netSettings.m_NetClassAssignments[ netname ];
aList.push_back( MSG_PANEL_ITEM( _( "Assigned Netclass" ), netclassName, DARKRED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Assigned Netclass" ), netclassName ) );
}
}
}

View File

@ -135,7 +135,7 @@ const EDA_RECT SCH_MARKER::GetBoundingBox() const
void SCH_MARKER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
aList.push_back( MSG_PANEL_ITEM( _( "Electronics Rule Check Error" ),
m_rcItem->GetErrorMessage(), DARKRED ) );
m_rcItem->GetErrorMessage() ) );
}

View File

@ -156,14 +156,14 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
wxString msg;
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), _( "Pin" ), CYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), _( "Pin" ) ) );
if( m_libPin->GetUnit() == 0 )
msg = _( "All" );
else
msg.Printf( wxT( "%d" ), m_libPin->GetUnit() );
aList.push_back( MSG_PANEL_ITEM( _( "Unit" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Unit" ), msg ) );
if( m_libPin->GetConvert() == LIB_ITEM::LIB_CONVERT::BASE )
msg = _( "no" );
@ -172,37 +172,36 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
else
msg = wxT( "?" );
aList.push_back( MSG_PANEL_ITEM( _( "Converted" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Converted" ), msg ) );
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), GetName(), DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Number" ), msg, DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), ElectricalPinTypeGetText( GetType() ), RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), GetName() ) );
aList.push_back( MSG_PANEL_ITEM( _( "Number" ), msg ) );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), ElectricalPinTypeGetText( GetType() ) ) );
msg = PinShapeGetText( GetShape() );
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), msg, BLUE ) );
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), msg ) );
msg = IsVisible() ? _( "Yes" ) : _( "No" );
aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), msg, DARKGREEN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), msg ) );
// Display pin length
msg = StringFromValue( aFrame->GetUserUnits(), GetLength() );
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg, MAGENTA ) );
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg ) );
msg = PinOrientationName( (unsigned) PinOrientationIndex( GetOrientation() ) );
aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), msg, DARKMAGENTA ) );
aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), msg ) );
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_position.x );
aList.emplace_back( _( "Pos X" ), msg, DARKMAGENTA );
aList.emplace_back( _( "Pos X" ), msg );
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_position.y );
aList.emplace_back( _( "Pos Y" ), msg, DARKMAGENTA );
aList.emplace_back( _( "Pos Y" ), msg );
SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( aFrame );
SCH_SHEET_PATH* currentSheet = schframe ? &schframe->GetCurrentSheet() : nullptr;
SCH_COMPONENT* symbol = GetParentSymbol();
aList.emplace_back( symbol->GetRef( currentSheet ), symbol->GetValue( currentSheet, true ),
DARKCYAN );
aList.emplace_back( symbol->GetRef( currentSheet ), symbol->GetValue( currentSheet, true ) );
#if defined(DEBUG)

View File

@ -640,7 +640,7 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
default: return;
}
aList.push_back( MSG_PANEL_ITEM( msg, GetShownText(), DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( msg, GetShownText() ) );
switch( GetLabelSpinStyle() )
{
@ -662,18 +662,18 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
if( IsBold() )
style += 2;
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), textStyle[style], BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), textStyle[style] ) );
// Display electrical type if it is relevant
if( Type() == SCH_GLOBAL_LABEL_T || Type() == SCH_HIER_LABEL_T || Type() == SCH_SHEET_PIN_T )
{
msg = getElectricalTypeLabel( GetShape() );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, BLUE ) );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg ) );
}
// Display text size (X or Y value, with are the same value in Eeschema)
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() );
aList.push_back( MSG_PANEL_ITEM( _( "Size" ), msg, RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Size" ), msg ) );
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( aFrame );
@ -689,7 +689,7 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
if( netSettings.m_NetClassAssignments.count( netname ) )
{
const wxString& netclassName = netSettings.m_NetClassAssignments[ netname ];
aList.push_back( MSG_PANEL_ITEM( _( "Assigned Netclass" ), netclassName, DARKRED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Assigned Netclass" ), netclassName ) );
}
}
}

View File

@ -1145,37 +1145,37 @@ void SYMBOL_EDIT_FRAME::DisplaySymbolDatasheet()
wxString msg = m_my_part->GetName();
AppendMsgPanel( _( "Name" ), msg, BLUE, 8 );
AppendMsgPanel( _( "Name" ), msg, 8 );
if( m_my_part->IsAlias() )
{
PART_SPTR parent = m_my_part->GetParent().lock();
msg = parent ? parent->GetName() : _( "Undefined!" );
AppendMsgPanel( _( "Parent" ), msg, BROWN, 8 );
AppendMsgPanel( _( "Parent" ), msg, 8 );
}
static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
msg = UnitLetter[m_unit];
AppendMsgPanel( _( "Unit" ), msg, BROWN, 8 );
AppendMsgPanel( _( "Unit" ), msg, 8 );
if( m_convert > 1 )
msg = _( "Convert" );
else
msg = _( "Normal" );
AppendMsgPanel( _( "Body" ), msg, GREEN, 8 );
AppendMsgPanel( _( "Body" ), msg, 8 );
if( m_my_part->IsPower() )
msg = _( "Power Symbol" );
else
msg = _( "Symbol" );
AppendMsgPanel( _( "Type" ), msg, MAGENTA, 8 );
AppendMsgPanel( _( "Description" ), m_my_part->GetDescription(), CYAN, 8 );
AppendMsgPanel( _( "Keywords" ), m_my_part->GetKeyWords(), DARKDARKGRAY );
AppendMsgPanel( _( "Datasheet" ), m_my_part->GetDatasheetField().GetText(), DARKDARKGRAY );
AppendMsgPanel( _( "Type" ), msg, 8 );
AppendMsgPanel( _( "Description" ), m_my_part->GetDescription(), 8 );
AppendMsgPanel( _( "Keywords" ), m_my_part->GetKeyWords() );
AppendMsgPanel( _( "Datasheet" ), m_my_part->GetDatasheetField().GetText() );
}

View File

@ -412,13 +412,11 @@ public:
* the frame and appends a message to it using the message panel
* AppendMessage() method.
*
* @param textUpper - The message upper text.
* @param textLower - The message lower text.
* @param color - A color ID from the KiCad color list (see colors.h).
* @param pad - Number of spaces to pad between messages (default = 4).
* @param aTextUpper - The message upper text.
* @param aTextLower - The message lower text.
* @param aPadding - Number of spaces to pad between messages.
*/
void AppendMsgPanel( const wxString& textUpper, const wxString& textLower,
COLOR4D color, int pad = 6 );
void AppendMsgPanel( const wxString& aTextUpper, const wxString& aTextLower, int aPadding = 6 );
/**
* Clear all messages from the message panel.

View File

@ -58,18 +58,16 @@ class MSG_PANEL_ITEM
int m_LowerY;
wxString m_UpperText;
wxString m_LowerText;
COLOR4D m_Color;
int m_Pad;
int m_Padding;
friend class EDA_MSG_PANEL;
public:
MSG_PANEL_ITEM( const wxString& aUpperText, const wxString& aLowerText, COLOR4D aColor,
int aPad = MSG_PANEL_DEFAULT_PAD ) :
MSG_PANEL_ITEM( const wxString& aUpperText, const wxString& aLowerText,
int aPadding = MSG_PANEL_DEFAULT_PAD ) :
m_UpperText( aUpperText ),
m_LowerText( aLowerText ),
m_Color( aColor ),
m_Pad( aPad )
m_Padding( aPadding )
{
m_X = 0;
m_UpperY = 0;
@ -77,13 +75,12 @@ public:
}
MSG_PANEL_ITEM() :
m_Pad( MSG_PANEL_DEFAULT_PAD )
m_Padding( MSG_PANEL_DEFAULT_PAD )
{
m_X = 0;
m_UpperY = 0;
m_LowerY = 0;
m_Color = COLOR4D::UNSPECIFIED;
}
void SetUpperText( const wxString& aUpperText ) { m_UpperText = aUpperText; }
@ -92,17 +89,12 @@ public:
void SetLowerText( const wxString& aLowerText ) { m_LowerText = aLowerText; }
const wxString& GetLowerText() const { return m_LowerText; }
void SetColor( COLOR4D aColor ) { m_Color = aColor; }
COLOR4D GetColor() const { return m_Color; }
void SetPadding( int aPad ) { m_Pad = aPad; }
int GetPadding() const { return m_Pad; }
void SetPadding( int aPadding ) { m_Padding = aPadding; }
int GetPadding() const { return m_Padding; }
};
typedef std::vector<MSG_PANEL_ITEM> MSG_PANEL_ITEMS;
typedef MSG_PANEL_ITEMS::iterator MSG_PANEL_ITEMS_ITER;
typedef MSG_PANEL_ITEMS::const_iterator MSG_PANEL_ITEMS_CITER;
/**
@ -155,10 +147,8 @@ public:
* to set the message using the last message position.
* @param aUpperText The text to be displayed in top line.
* @param aLowerText The text to be displayed in bottom line.
* @param aColor Color of the text to display.
*/
void SetMessage( int aXPosition, const wxString& aUpperText,
const wxString& aLowerText, COLOR4D aColor );
void SetMessage( int aXPosition, const wxString& aUpperText, const wxString& aLowerText );
/**
* Function AppendMessage
@ -171,11 +161,9 @@ public:
*
* @param aUpperText The message upper text.
* @param aLowerText The message lower text.
* @param aColor A color to use for the message text
* @param aPad Number of spaces to pad between messages (default = 4).
* @param aPadding Number of spaces to pad between messages (default = 4).
*/
void AppendMessage( const wxString& aUpperText, const wxString& aLowerText,
COLOR4D aColor, int aPad = 6 );
void AppendMessage( const wxString& aUpperText, const wxString& aLowerText, int aPadding = 6 );
/**
* Function AppendMessage
@ -187,7 +175,7 @@ public:
void AppendMessage( const MSG_PANEL_ITEM& aMessageItem )
{
AppendMessage( aMessageItem.GetUpperText(), aMessageItem.GetLowerText(),
aMessageItem.GetColor(), aMessageItem.GetPadding() );
aMessageItem.GetPadding() );
}
DECLARE_EVENT_TABLE()

View File

@ -1068,7 +1068,7 @@ int PCBNEW_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
MSG_PANEL_ITEMS msgItems;
wxString msg = wxString::Format( wxT( "%d" ), selection.GetSize() );
msgItems.emplace_back( MSG_PANEL_ITEM( _( "Selected Items" ), msg, DARKCYAN ) );
msgItems.emplace_back( MSG_PANEL_ITEM( _( "Selected Items" ), msg ) );
m_frame->SetMsgPanel( msgItems );
}
else if( auto editFrame = dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_frame ) )
@ -1082,10 +1082,10 @@ int PCBNEW_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
wxString msg;
msg = footprint->GetFPID().GetLibNickname().wx_str();
msgItems.emplace_back( MSG_PANEL_ITEM( _( "Library" ), msg, DARKCYAN ) );
msgItems.emplace_back( MSG_PANEL_ITEM( _( "Library" ), msg ) );
msg = footprint->GetFPID().GetLibItemName().wx_str();
msgItems.emplace_back( MSG_PANEL_ITEM( _( "Footprint Name" ), msg, DARKCYAN ) );
msgItems.emplace_back( MSG_PANEL_ITEM( _( "Footprint Name" ), msg ) );
wxDateTime date( static_cast<time_t>( footprint->GetLastEditTime() ) );
@ -1095,15 +1095,15 @@ int PCBNEW_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
else
msg = _( "Unknown" );
msgItems.emplace_back( MSG_PANEL_ITEM( _( "Last Change" ), msg, BROWN ) );
msgItems.emplace_back( MSG_PANEL_ITEM( _( "Last Change" ), msg ) );
msg.Printf( wxT( "%zu" ), (size_t) footprint->GetPadCount( DO_NOT_INCLUDE_NPTH ) );
msgItems.emplace_back( MSG_PANEL_ITEM( _( "Pads" ), msg, BLUE ) );
msgItems.emplace_back( MSG_PANEL_ITEM( _( "Pads" ), msg ) );
wxString doc, keyword;
doc.Printf( _( "Doc: %s" ), footprint->GetDescription() );
keyword.Printf( _( "Keywords: %s" ), footprint->GetKeywords() );
msgItems.emplace_back( MSG_PANEL_ITEM( doc, keyword, BLACK ) );
msgItems.emplace_back( MSG_PANEL_ITEM( doc, keyword ) );
m_frame->SetMsgPanel( msgItems );
}

View File

@ -743,9 +743,9 @@ void TRACK::GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector<MSG_
// Display start and end positions:
msg.Printf( wxT( "%d %d" ), m_Start.x, m_Start.y );
aList.push_back( MSG_PANEL_ITEM( wxT( "Start pos" ), msg, BLUE ) );
aList.push_back( MSG_PANEL_ITEM( wxT( "Start pos" ), msg ) );
msg.Printf( wxT( "%d %d" ), m_End.x, m_End.y );
aList.push_back( MSG_PANEL_ITEM( wxT( "End pos" ), msg, BLUE ) );
aList.push_back( MSG_PANEL_ITEM( wxT( "End pos" ), msg ) );
#endif
// Display the State member
@ -757,7 +757,7 @@ void TRACK::GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector<MSG_
if( GetState( TRACK_AR ) )
msg[2] = 'A';
aList.emplace_back( _( "Status" ), msg, MAGENTA );
aList.emplace_back( _( "Status" ), msg );
}

View File

@ -558,7 +558,7 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
AccumulateDescription( msg, _( "No footprints" ) );
if( !msg.IsEmpty() )
aList.emplace_back( MSG_PANEL_ITEM( _( "Restrictions" ), msg, RED ) );
aList.emplace_back( MSG_PANEL_ITEM( _( "Restrictions" ), msg ) );
}
else if( IsOnCopperLayer() )
{
@ -633,7 +633,7 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
// Useful for statistics, especially when zones are complex the number of hatches
// and filled polygons can explain the display and DRC calculation time:
msg.Printf( wxT( "%d" ), (int) m_borderHatchLines.size() );
aList.emplace_back( MSG_PANEL_ITEM( _( "HatchBorder Lines" ), msg, BLUE ) );
aList.emplace_back( MSG_PANEL_ITEM( _( "HatchBorder Lines" ), msg ) );
PCB_LAYER_ID layer = m_layer;
@ -641,8 +641,10 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
// TODO: Figure out a way for items to know the active layer without the whole edit frame?
#if 0
if( PCB_EDIT_FRAME* pcbframe = dynamic_cast<PCB_EDIT_FRAME*>( aFrame ) )
{
if( m_FilledPolysList.count( pcbframe->GetActiveLayer() ) )
layer = pcbframe->GetActiveLayer();
}
#endif
if( !GetIsRuleArea() )
@ -655,7 +657,7 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
if( layer_it != m_FilledPolysList.end() )
{
msg.Printf( wxT( "%d" ), layer_it->second.TotalVertices() );
aList.emplace_back( MSG_PANEL_ITEM( _( "Corner Count" ), msg, BLUE ) );
aList.emplace_back( MSG_PANEL_ITEM( _( "Corner Count" ), msg ) );
}
}
}