Ease translation a bit.

Also improves the SNR and consistency of the menu item text.  For
instance, a position is rarely useful, while relative sizes can be.

Also removes some unnecessary repitition, such as "Graphic Rectangle"
when "Rectangle" communicates the necessary information.
This commit is contained in:
Jeff Young 2020-09-19 17:12:00 +01:00
parent db5de738ae
commit 64fa400b19
25 changed files with 124 additions and 141 deletions

View File

@ -182,10 +182,8 @@ bool WS_DRAW_ITEM_TEXT::HitTest( const EDA_RECT& aRect, bool aContains, int aAcc
wxString WS_DRAW_ITEM_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const wxString WS_DRAW_ITEM_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Text %s at (%s, %s)" ), return wxString::Format( _( "Text \"%s\"" ),
GetShownText(), GetShownText() );
MessageTextFromValue( aUnits, GetTextPos().x ),
MessageTextFromValue( aUnits, GetTextPos().y ) );
} }
@ -288,9 +286,7 @@ bool WS_DRAW_ITEM_POLYPOLYGONS::HitTest( const EDA_RECT& aRect, bool aContained,
wxString WS_DRAW_ITEM_POLYPOLYGONS::GetSelectMenuText( EDA_UNITS aUnits ) const wxString WS_DRAW_ITEM_POLYPOLYGONS::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Imported shape at (%s, %s)" ), return wxString::Format( _( "Imported Shape" ) );
MessageTextFromValue( aUnits, GetPosition().x ),
MessageTextFromValue( aUnits, GetPosition().y ) );
} }
@ -349,11 +345,9 @@ bool WS_DRAW_ITEM_RECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
wxString WS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS aUnits ) const wxString WS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Rectangle from (%s, %s) to (%s, %s)" ), return wxString::Format( _( "Rectangle, width %s height %s" ),
MessageTextFromValue( aUnits, GetStart().x ), MessageTextFromValue( aUnits, std::abs( GetStart().x - GetEnd().x ) ),
MessageTextFromValue( aUnits, GetStart().y ), MessageTextFromValue( aUnits, std::abs( GetStart().y - GetEnd().y ) ) );
MessageTextFromValue( aUnits, GetEnd().x ),
MessageTextFromValue( aUnits, GetEnd().y ) );
} }
@ -384,11 +378,8 @@ bool WS_DRAW_ITEM_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
wxString WS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const wxString WS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Line from (%s, %s) to (%s, %s)" ), return wxString::Format( _( "Line, length %s" ),
MessageTextFromValue( aUnits, GetStart().x ), MessageTextFromValue( aUnits, EuclideanNorm( GetStart() - GetEnd() ) ) );
MessageTextFromValue( aUnits, GetStart().y ),
MessageTextFromValue( aUnits, GetEnd().x ),
MessageTextFromValue( aUnits, GetEnd().y ) );
} }
@ -437,15 +428,13 @@ bool WS_DRAW_ITEM_BITMAP::HitTest( const EDA_RECT& aRect, bool aContains, int aA
wxString WS_DRAW_ITEM_BITMAP::GetSelectMenuText( EDA_UNITS aUnits ) const wxString WS_DRAW_ITEM_BITMAP::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Image at (%s, %s)" ), return wxString::Format( _( "Image" ) );
MessageTextFromValue( aUnits, GetPosition().x ),
MessageTextFromValue( aUnits, GetPosition().y ) );
} }
wxString WS_DRAW_ITEM_PAGE::GetSelectMenuText( EDA_UNITS aUnits ) const wxString WS_DRAW_ITEM_PAGE::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
wxString txt( "Page limits" ); wxString txt( "Page Limits" );
return txt; return txt;
} }

View File

@ -412,9 +412,7 @@ void LIB_ARC::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
wxString LIB_ARC::GetSelectMenuText( EDA_UNITS aUnits ) const wxString LIB_ARC::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Arc center (%s, %s), radius %s" ), return wxString::Format( _( "Arc, radius %s" ),
MessageTextFromValue( aUnits, m_Pos.x ),
MessageTextFromValue( aUnits, m_Pos.y ),
MessageTextFromValue( aUnits, m_Radius ) ); MessageTextFromValue( aUnits, m_Radius ) );
} }

View File

@ -266,9 +266,7 @@ void LIB_CIRCLE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList
wxString LIB_CIRCLE::GetSelectMenuText( EDA_UNITS aUnits ) const wxString LIB_CIRCLE::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Circle center (%s, %s), radius %s" ), return wxString::Format( _( "Circle, radius %s" ),
MessageTextFromValue( aUnits, m_Pos.x ),
MessageTextFromValue( aUnits, m_Pos.y ),
MessageTextFromValue( aUnits, GetRadius() ) ); MessageTextFromValue( aUnits, GetRadius() ) );
} }

View File

@ -405,9 +405,7 @@ void LIB_FIELD::SetName( const wxString& aName )
wxString LIB_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const wxString LIB_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Field %s (%s)" ), return GetName() + " " + ShortenedShownText();
GetName(),
ShortenedShownText() );
} }

View File

@ -1137,11 +1137,22 @@ BITMAP_DEF LIB_PIN::GetMenuImage() const
wxString LIB_PIN::GetSelectMenuText( EDA_UNITS aUnits ) const wxString LIB_PIN::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Pin %s, %s, %s" ), if( !m_name.IsEmpty() )
{
return wxString::Format( _( "Pin %s [%s, %s, %s]" ),
m_number,
m_name,
GetElectricalTypeName(),
PinShapeGetText( m_shape ));
}
else
{
return wxString::Format( _( "Pin %s [%s, %s]" ),
m_number, m_number,
GetElectricalTypeName(), GetElectricalTypeName(),
PinShapeGetText( m_shape )); PinShapeGetText( m_shape ));
} }
}
#if defined(DEBUG) #if defined(DEBUG)

View File

@ -351,9 +351,7 @@ void LIB_POLYLINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aLi
wxString LIB_POLYLINE::GetSelectMenuText( EDA_UNITS aUnits ) const wxString LIB_POLYLINE::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Polyline at (%s, %s) with %d points" ), return wxString::Format( _( "Polyline, %d points" ),
MessageTextFromValue( aUnits, m_PolyPoints[0].x ),
MessageTextFromValue( aUnits, m_PolyPoints[0].y ),
int( m_PolyPoints.size() ) ); int( m_PolyPoints.size() ) );
} }

View File

@ -260,11 +260,9 @@ bool LIB_RECTANGLE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
wxString LIB_RECTANGLE::GetSelectMenuText( EDA_UNITS aUnits ) const wxString LIB_RECTANGLE::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Rectangle from (%s, %s) to (%s, %s)" ), return wxString::Format( _( "Rectangle, width %s height %s" ),
MessageTextFromValue( aUnits, m_Pos.x ), MessageTextFromValue( aUnits, std::abs( m_Pos.x - m_End.x ) ),
MessageTextFromValue( aUnits, m_Pos.y ), MessageTextFromValue( aUnits, std::abs( m_Pos.y - m_End.y ) ) );
MessageTextFromValue( aUnits, m_End.x ),
MessageTextFromValue( aUnits, m_End.y ) );
} }

View File

@ -1585,9 +1585,9 @@ LIB_ITEM* SCH_COMPONENT::GetDrawItem( const wxPoint& aPosition, KICAD_T aType )
wxString SCH_COMPONENT::GetSelectMenuText( EDA_UNITS aUnits ) const wxString SCH_COMPONENT::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Symbol %s, %s" ), return wxString::Format( _( "Symbol %s [%s]" ),
GetLibId().GetLibItemName().wx_str(), GetField( REFERENCE )->GetShownText(),
GetField( REFERENCE )->GetShownText() ); GetLibId().GetLibItemName().wx_str() );
} }

View File

@ -429,7 +429,7 @@ void SCH_FIELD::Rotate( wxPoint aPosition )
wxString SCH_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const wxString SCH_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Field %s (%s)" ), return wxString::Format( "%s \"%s\"",
GetName(), GetName(),
ShortenedShownText() ); ShortenedShownText() );
} }

View File

@ -642,24 +642,35 @@ wxString SCH_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
wxString txtfmt, orient; wxString txtfmt, orient;
if( m_start.x == m_end.x ) if( m_start.x == m_end.x )
orient = _( "Vertical" ); {
else if( m_start.y == m_end.y )
orient = _( "Horizontal" );
switch( m_Layer ) switch( m_Layer )
{ {
case LAYER_NOTES: txtfmt = _( "%s Graphic Line from (%s, %s) to (%s, %s)" ); break; case LAYER_WIRE: txtfmt = _( "Vertical Wire, length %s" ); break;
case LAYER_WIRE: txtfmt = _( "%s Wire from (%s, %s) to (%s, %s)" ); break; case LAYER_BUS: txtfmt = _( "Vertical Bus, length %s" ); break;
case LAYER_BUS: txtfmt = _( "%s Bus from (%s, %s) to (%s, %s)" ); break; default: txtfmt = _( "Vertical Graphic Line, length %s" ); break;
default: txtfmt = _( "%s Line on Unknown Layer from (%s, %s) to (%s, %s)" ); break; }
}
else if( m_start.y == m_end.y )
{
switch( m_Layer )
{
case LAYER_WIRE: txtfmt = _( "Horizontal Wire, length %s" ); break;
case LAYER_BUS: txtfmt = _( "Horizontal Bus, length %s" ); break;
default: txtfmt = _( "Horizontal Graphic Line, length %s" ); break;
}
}
else
{
switch( m_Layer )
{
case LAYER_WIRE: txtfmt = _( "Wire, length %s" ); break;
case LAYER_BUS: txtfmt = _( "Bus, length %s" ); break;
default: txtfmt = _( "Graphic Line, length %s" ); break;
}
} }
return wxString::Format( txtfmt, return wxString::Format( txtfmt,
orient, MessageTextFromValue( aUnits, EuclideanNorm( m_start - m_end ) ) );
MessageTextFromValue( aUnits, m_start.x ),
MessageTextFromValue( aUnits, m_start.y ),
MessageTextFromValue( aUnits, m_end.x ),
MessageTextFromValue( aUnits, m_end.y ) );
} }

View File

@ -906,7 +906,8 @@ SEARCH_RESULT SCH_SHEET::Visit( INSPECTOR aInspector, void* testData, const KICA
wxString SCH_SHEET::GetSelectMenuText( EDA_UNITS aUnits ) const wxString SCH_SHEET::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Hierarchical Sheet %s" ), m_fields[ SHEETNAME ].GetText() ); return wxString::Format( _( "Hierarchical Sheet %s" ),
m_fields[ SHEETNAME ].GetText() );
} }

View File

@ -792,7 +792,7 @@ const EDA_RECT SCH_LABEL::GetBoundingBox() const
wxString SCH_LABEL::GetSelectMenuText( EDA_UNITS aUnits ) const wxString SCH_LABEL::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Label %s" ), ShortenedShownText() ); return wxString::Format( _( "Label \"%s\"" ), ShortenedShownText() );
} }
@ -1034,7 +1034,7 @@ const EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const
wxString SCH_GLOBALLABEL::GetSelectMenuText( EDA_UNITS aUnits ) const wxString SCH_GLOBALLABEL::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Global Label %s" ), ShortenedShownText() ); return wxString::Format( _( "Global Label \"%s\"" ), ShortenedShownText() );
} }
@ -1223,7 +1223,7 @@ wxPoint SCH_HIERLABEL::GetSchematicTextOffset( RENDER_SETTINGS* aSettings ) cons
wxString SCH_HIERLABEL::GetSelectMenuText( EDA_UNITS aUnits ) const wxString SCH_HIERLABEL::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Hierarchical Label %s" ), ShortenedShownText() ); return wxString::Format( _( "Hierarchical Label \"%s\"" ), ShortenedShownText() );
} }

View File

@ -395,7 +395,7 @@ protected:
* Return a string (to be shown to the user) describing a layer mask. * Return a string (to be shown to the user) describing a layer mask.
* The BOARD is needed because layer names are (somewhat) customizable * The BOARD is needed because layer names are (somewhat) customizable
*/ */
static wxString LayerMaskDescribe( const BOARD* aBoard, LSET aMask ); virtual wxString LayerMaskDescribe() const;
}; };
#ifndef SWIG #ifndef SWIG

View File

@ -71,35 +71,32 @@ wxString BOARD_ITEM::GetLayerName() const
} }
wxString BOARD_ITEM::LayerMaskDescribe( const BOARD* aBoard, LSET aMask ) wxString BOARD_ITEM::LayerMaskDescribe() const
{ {
BOARD* board = GetBoard();
LSET layers = GetLayerSet();
// Try to be smart and useful. Check all copper first. // Try to be smart and useful. Check all copper first.
if( aMask[F_Cu] && aMask[B_Cu] ) if( layers[F_Cu] && layers[B_Cu] )
return _( "All copper layers" ); return _( "all copper layers" );
// Check for copper. LSET copperLayers = layers & board->GetEnabledLayers().AllCuMask();
auto layer = aBoard->GetEnabledLayers().AllCuMask() & aMask; LSET techLayers = layers & board->GetEnabledLayers().AllTechMask();
for( int i = 0; i < 3; i++ ) for( LSET testLayers : { copperLayers, techLayers, layers } )
{ {
for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit ) for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
{ {
if( layer[ bit ] ) if( testLayers[ bit ] )
{ {
wxString layerInfo = aBoard->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) ); wxString layerInfo = board->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
if( aMask.count() > 1 ) if( testLayers.count() > 1 )
layerInfo << _( " and others" ); layerInfo << _( " and others" );
return layerInfo; return layerInfo;
} }
} }
// No copper; first, check for technicals and then for all layers.
if( i < 1 ) // first, check for technicals
layer = aBoard->GetEnabledLayers().AllTechMask() & aMask;
else // then check for all other layers
layer = aMask;
} }
// No copper, no technicals: no layer // No copper, no technicals: no layer

View File

@ -402,7 +402,9 @@ const EDA_RECT DIMENSION::GetBoundingBox() const
wxString DIMENSION::GetSelectMenuText( EDA_UNITS aUnits ) const wxString DIMENSION::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Dimension \"%s\" on %s" ), GetText(), GetLayerName() ); return wxString::Format( _( "Dimension \"%s\" on %s" ),
GetText(),
GetLayerName() );
} }

View File

@ -915,7 +915,7 @@ bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
wxString DRAWSEGMENT::GetSelectMenuText( EDA_UNITS aUnits ) const wxString DRAWSEGMENT::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Pcb Graphic %s on %s" ), return wxString::Format( _( "%s on %s" ),
ShowShape( m_Shape ), ShowShape( m_Shape ),
GetLayerName() ); GetLayerName() );
} }

View File

@ -131,9 +131,8 @@ void EDGE_MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL
wxString EDGE_MODULE::GetSelectMenuText( EDA_UNITS aUnits ) const wxString EDGE_MODULE::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Graphic %s of %s on %s" ), return wxString::Format( _( "%s on %s" ),
ShowShape( m_Shape ), ShowShape( m_Shape ),
((MODULE*) GetParent())->GetReference(),
GetLayerName() ); GetLayerName() );
} }

View File

@ -977,7 +977,7 @@ wxString MODULE::GetSelectMenuText( EDA_UNITS aUnits ) const
if( reference.IsEmpty() ) if( reference.IsEmpty() )
reference = _( "<no reference designator>" ); reference = _( "<no reference designator>" );
return wxString::Format( _( "Footprint %s on %s" ), reference, GetLayerName() ); return wxString::Format( _( "Footprint %s" ), reference );
} }

View File

@ -815,7 +815,7 @@ void D_PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>
aList.emplace_back( _( "NetClass" ), msg, CYAN ); aList.emplace_back( _( "NetClass" ), msg, CYAN );
aList.emplace_back( _( "Layer" ), LayerMaskDescribe( board, m_layerMask ), DARKGREEN ); aList.emplace_back( _( "Layer" ), LayerMaskDescribe(), DARKGREEN );
// Show the pad shape, attribute and property // Show the pad shape, attribute and property
wxString props = ShowPadAttr(); wxString props = ShowPadAttr();
@ -1064,14 +1064,14 @@ wxString D_PAD::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Pad of %s on %s" ), return wxString::Format( _( "Pad of %s on %s" ),
GetParent()->GetReference(), GetParent()->GetReference(),
LayerMaskDescribe( GetBoard(), m_layerMask ) ); LayerMaskDescribe() );
} }
else else
{ {
return wxString::Format( _( "Pad %s of %s on %s" ), return wxString::Format( _( "Pad %s of %s on %s" ),
GetName(), GetName(),
GetParent()->GetReference(), GetParent()->GetReference(),
LayerMaskDescribe( GetBoard(), m_layerMask ) ); LayerMaskDescribe() );
} }
} }

View File

@ -272,11 +272,13 @@ wxString PCB_GROUP::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
if( m_name.empty() ) if( m_name.empty() )
{ {
return wxString::Format( _( "Anonymous group %s with %zu members" ), return wxString::Format( _( "Anonymous Group, %zu members" ),
m_Uuid.AsString(), m_items.size() ); m_items.size() );
} }
return wxString::Format( _( "Group \"%s\" with %zu members" ), m_name, m_items.size() ); return wxString::Format( _( "Group \"%s\", %zu members" ),
m_name,
m_items.size() );
} }

View File

@ -119,7 +119,7 @@ const EDA_RECT PCB_TARGET::GetBoundingBox() const
wxString PCB_TARGET::GetSelectMenuText( EDA_UNITS aUnits ) const wxString PCB_TARGET::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
// Targets are on *every* layer by definition // Targets are on *every* layer by definition
return wxString::Format( _( "Target size %s" ), MessageTextFromValue( aUnits, m_Size ) ); return _( "Target" );
} }

View File

@ -216,7 +216,7 @@ void TEXTE_PCB::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
wxString TEXTE_PCB::GetSelectMenuText( EDA_UNITS aUnits ) const wxString TEXTE_PCB::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Pcb Text \"%s\" on %s"), ShortenedShownText(), GetLayerName() ); return wxString::Format( _( "PCB Text \"%s\" on %s"), ShortenedShownText(), GetLayerName() );
} }

View File

@ -339,10 +339,9 @@ wxString TEXTE_MODULE::GetSelectMenuText( EDA_UNITS aUnits ) const
static_cast<MODULE*>( GetParent() )->GetReference() ); static_cast<MODULE*>( GetParent() )->GetReference() );
default: // wrap this one in quotes: default: // wrap this one in quotes:
return wxString::Format( _( "Text \"%s\" of %s on %s" ), return wxString::Format( _( "Footprint Text \"%s\" of %s" ),
ShortenedShownText(), ShortenedShownText(),
static_cast<MODULE*>( GetParent() )->GetReference(), static_cast<MODULE*>( GetParent() )->GetReference() );
GetLayerName() );
} }
} }

View File

@ -94,12 +94,10 @@ wxString VIA::GetSelectMenuText( EDA_UNITS aUnits ) const
LayerPair( &topLayer, &botLayer ); LayerPair( &topLayer, &botLayer );
return wxString::Format( _( "%s %s %s on %s - %s" ), return wxString::Format( _( "%s %s on %s" ),
viaType, viaType,
MessageTextFromValue( aUnits, m_Width ),
GetNetnameMsg(), GetNetnameMsg(),
board ? board->GetLayerName( topLayer ) : wxT( "??" ), LayerMaskDescribe( board, GetLayerSet() ) );
board ? board->GetLayerName( botLayer ) : wxT( "??" ) );
} }
@ -631,10 +629,7 @@ void TRACK::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>
GetMsgPanelInfoBase_Common( aFrame, aList ); GetMsgPanelInfoBase_Common( aFrame, aList );
// Display layer // Display layer
if( board ) aList.emplace_back( _( "Layer" ), LayerMaskDescribe( board, GetLayerSet() ), DARKGREEN );
msg = board->GetLayerName( m_Layer );
else
msg.Printf(wxT("%d"), m_Layer );
// Display width // Display width
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width, true ); msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width, true );
@ -689,24 +684,10 @@ void VIA::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
// Display basic infos // Display basic infos
switch( GetViaType() ) switch( GetViaType() )
{ {
default: case VIATYPE::MICROVIA: msg = _( "Micro Via" ); break;
case VIATYPE::MICROVIA: case VIATYPE::BLIND_BURIED: msg = _( "Blind/Buried Via" ); break;
msg = _( "Micro Via" ); // from external layer (TOP or BOTTOM) from case VIATYPE::THROUGH: msg = _( "Through Via" ); break;
// the near neighbor inner layer only default: msg = _( "Via" ); break;
break;
case VIATYPE::BLIND_BURIED:
msg = _( "Blind/Buried Via" ); // from inner or external to inner
// or external layer (no restriction)
break;
case VIATYPE::THROUGH:
msg = _( "Through Via" ); // Usual via (from TOP to BOTTOM layer only )
break;
case VIATYPE::NOT_DEFINED:
msg = wxT( "???" ); // Not used yet, does not exist currently
break;
} }
aList.emplace_back( _( "Type" ), msg, DARKCYAN ); aList.emplace_back( _( "Type" ), msg, DARKCYAN );
@ -714,16 +695,7 @@ void VIA::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
GetMsgPanelInfoBase_Common( aFrame, aList ); GetMsgPanelInfoBase_Common( aFrame, aList );
// Display layer pair // Display layer pair
PCB_LAYER_ID top_layer, bottom_layer; aList.emplace_back( _( "Layer" ), LayerMaskDescribe( board, GetLayerSet() ), DARKGREEN );
LayerPair( &top_layer, &bottom_layer );
if( board )
msg = board->GetLayerName( top_layer ) + wxT( "/" ) + board->GetLayerName( bottom_layer );
else
msg.Printf( wxT( "%d/%d" ), top_layer, bottom_layer );
aList.emplace_back( _( "Layers" ), msg, BROWN );
// Display width // Display width
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width, true ); msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width, true );
@ -812,6 +784,18 @@ void TRACK::GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector<MSG_
} }
wxString VIA::LayerMaskDescribe()
{
BOARD* board = GetBoard();
PCB_LAYER_ID top_layer;
PCB_LAYER_ID bottom_layer;
LayerPair( &top_layer, &bottom_layer );
return board->GetLayerName( top_layer ) + wxT( " - " ) + board->GetLayerName( bottom_layer );
}
bool TRACK::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool TRACK::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{ {
return TestSegmentHit( aPosition, m_Start, m_End, aAccuracy + ( m_Width / 2 ) ); return TestSegmentHit( aPosition, m_Start, m_End, aAccuracy + ( m_Width / 2 ) );
@ -898,20 +882,15 @@ bool VIA::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
box.Inflate( GetWidth() / 2 ); box.Inflate( GetWidth() / 2 );
if( aContained ) if( aContained )
{
return arect.Contains( box ); return arect.Contains( box );
}
else else
{
return arect.IntersectsCircle( GetStart(), GetWidth() / 2 ); return arect.IntersectsCircle( GetStart(), GetWidth() / 2 );
} }
}
wxString TRACK::GetSelectMenuText( EDA_UNITS aUnits ) const wxString TRACK::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _("Track %s %s on %s, length: %s" ), return wxString::Format( _("Track %s on %s, length %s" ),
MessageTextFromValue( aUnits, m_Width ),
GetNetnameMsg(), GetNetnameMsg(),
GetLayerName(), GetLayerName(),
MessageTextFromValue( aUnits, GetLength() ) ); MessageTextFromValue( aUnits, GetLength() ) );

View File

@ -514,6 +514,9 @@ public:
// @copydoc BOARD_ITEM::GetEffectiveShape // @copydoc BOARD_ITEM::GetEffectiveShape
virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override; virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override;
protected:
wxString LayerMaskDescribe() const override;
private: private:
/// The bottom layer of the via (the top layer is in m_Layer) /// The bottom layer of the via (the top layer is in m_Layer)
PCB_LAYER_ID m_BottomLayer; PCB_LAYER_ID m_BottomLayer;