Rationalize select menu texts.

Be consistent with order, formatting, etc.
Remove debug stuff such as zone timestamp and net code.
Clean up misleading pad messages.

(cherry picked from commit 2132109)
This commit is contained in:
Jeff Young 2018-01-31 09:08:57 +00:00
parent a1ef5401f4
commit b99ea159c8
18 changed files with 119 additions and 149 deletions

View File

@ -71,9 +71,9 @@ wxString DRC_ITEM::GetErrorText() const
wxString DRC_ITEM::ShowCoord( const wxPoint& aPos ) wxString DRC_ITEM::ShowCoord( const wxPoint& aPos )
{ {
wxString ret; return wxString::Format( _( "@(%s, %s)" ),
ret << aPos; GetChars( CoordinateToString( aPos.x ) ),
return ret; GetChars( CoordinateToString( aPos.y ) ) );
} }

View File

@ -534,7 +534,7 @@ void LIB_FIELD::SetText( const wxString& aText )
wxString LIB_FIELD::GetSelectMenuText() const wxString LIB_FIELD::GetSelectMenuText() const
{ {
return wxString::Format( _( "Field %s %s" ), return wxString::Format( _( "Field %s \"%s\"" ),
GetChars( GetName() ), GetChars( GetName() ),
GetChars( ShortenedShownText() ) ); GetChars( ShortenedShownText() ) );
} }

View File

@ -360,7 +360,7 @@ void LIB_TEXT::SetText( const wxString& aText )
wxString LIB_TEXT::GetSelectMenuText() const wxString LIB_TEXT::GetSelectMenuText() const
{ {
wxString msg; wxString msg;
msg.Printf( _( "Graphic Text %s" ), GetChars( ShortenedShownText() ) ); msg.Printf( _( "Graphic Text \"%s\"" ), GetChars( ShortenedShownText() ) );
return msg; return msg;
} }

View File

@ -619,19 +619,19 @@ wxString SCH_LINE::GetSelectMenuText() const
switch( m_Layer ) switch( m_Layer )
{ {
case LAYER_NOTES: case LAYER_NOTES:
txtfmt = _( "%s Graphic Line from (%s,%s) to (%s,%s)" ); txtfmt = _( "%s Graphic Line from (%s, %s) to (%s, %s)" );
break; break;
case LAYER_WIRE: case LAYER_WIRE:
txtfmt = _( "%s Wire from (%s,%s) to (%s,%s)" ); txtfmt = _( "%s Wire from (%s, %s) to (%s, %s)" );
break; break;
case LAYER_BUS: case LAYER_BUS:
txtfmt = _( "%s Bus from (%s,%s) to (%s,%s)" ); txtfmt = _( "%s Bus from (%s, %s) to (%s, %s)" );
break; break;
default: default:
txtfmt += _( "%s Line on Unknown Layer from (%s,%s) to (%s,%s)" ); txtfmt += _( "%s Line on Unknown Layer from (%s, %s) to (%s, %s)" );
} }
menuText.Printf( txtfmt, GetChars( orient ), menuText.Printf( txtfmt, GetChars( orient ),

View File

@ -497,7 +497,7 @@ const EDA_RECT SCH_TEXT::GetBoundingBox() const
wxString SCH_TEXT::GetSelectMenuText() const wxString SCH_TEXT::GetSelectMenuText() const
{ {
wxString msg; wxString msg;
msg.Printf( _( "Graphic Text %s" ), GetChars( ShortenedShownText() ) ); msg.Printf( _( "Graphic Text \"%s\"" ), GetChars( ShortenedShownText() ) );
return msg; return msg;
} }

View File

@ -988,8 +988,11 @@ wxString GERBER_DRAW_ITEM::GetSelectMenuText() const
layerName = GERBER_FILE_IMAGE_LIST::GetImagesList().GetDisplayName( GetLayer(), true ); layerName = GERBER_FILE_IMAGE_LIST::GetImagesList().GetDisplayName( GetLayer(), true );
text.Printf( _( "%s (D%d) on layer %d: %s" ), ShowGBRShape(), m_DCode, text.Printf( _( "%s (D%d) on layer %d: %s" ),
GetLayer() + 1, layerName ); ShowGBRShape(),
m_DCode,
GetLayer() + 1,
layerName );
return text; return text;
} }

View File

@ -124,6 +124,26 @@ public:
return m_netinfo->GetNetname(); return m_netinfo->GetNetname();
} }
/**
* Function GetNetnameMsg
* @return wxString - the full netname or "<no net>" in square braces, followed by
* "(Not Found)" if the netcode is undefined.
*/
wxString GetNetnameMsg() const
{
if( !GetBoard() )
return wxT( "[** NO BOARD DEFINED **]" );
wxString netname = GetNetname();
if( !netname.length() )
return wxT( "[<no net>]" );
else if( GetNetCode() < 0 )
return wxT( "[" + netname + "](" + _( "Not Found" ) + ")" );
else
return wxT( "[" + netname + "]" );
}
/** /**
* Function GetShortNetname * Function GetShortNetname
* @return wxString - the short netname * @return wxString - the short netname

View File

@ -489,7 +489,8 @@ wxString DIMENSION::GetSelectMenuText() const
{ {
wxString text; wxString text;
text.Printf( _( "Dimension \"%s\" on %s" ), text.Printf( _( "Dimension \"%s\" on %s" ),
GetChars( GetText() ), GetChars( GetLayerName() ) ); GetChars( GetText() ),
GetChars( GetLayerName() ) );
return text; return text;
} }

View File

@ -724,11 +724,11 @@ bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
wxString DRAWSEGMENT::GetSelectMenuText() const wxString DRAWSEGMENT::GetSelectMenuText() const
{ {
wxString text; wxString text;
wxString temp = ::LengthDoubleToString( GetLength() );
text.Printf( _( "Pcb Graphic: %s, length %s on %s" ), text.Printf( _( "Pcb Graphic %s, length %s on %s" ),
GetChars( ShowShape( m_Shape ) ), GetChars( ShowShape( m_Shape ) ),
GetChars( temp ), GetChars( GetLayerName() ) ); GetChars( ::LengthDoubleToString( GetLength() ) ),
GetChars( GetLayerName() ) );
return text; return text;
} }

View File

@ -262,10 +262,10 @@ void EDGE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
wxString EDGE_MODULE::GetSelectMenuText() const wxString EDGE_MODULE::GetSelectMenuText() const
{ {
wxString text; wxString text;
text.Printf( _( "Graphic (%s) on %s of %s" ), text.Printf( _( "Graphic %s of %s on %s" ),
GetChars( ShowShape( m_Shape ) ), GetChars( ShowShape( m_Shape ) ),
GetChars( GetLayerName() ), GetChars( ((MODULE*) GetParent())->GetReference() ),
GetChars( ((MODULE*) GetParent())->GetReference() ) ); GetChars( GetLayerName() ) );
return text; return text;
} }

View File

@ -34,6 +34,7 @@
#include <trigo.h> #include <trigo.h>
#include <msgpanel.h> #include <msgpanel.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <base_units.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <class_marker_pcb.h> #include <class_marker_pcb.h>
@ -132,10 +133,9 @@ void MARKER_PCB::Flip(const wxPoint& aCentre )
wxString MARKER_PCB::GetSelectMenuText() const wxString MARKER_PCB::GetSelectMenuText() const
{ {
wxString text; return wxString::Format( _( "Marker @(%s, %s)" ),
text.Printf( _( "Marker @(%d,%d)" ), GetPos().x, GetPos().y ); GetChars( CoordinateToString( m_Pos.x ) ),
GetChars( CoordinateToString( m_Pos.y ) ) );
return text;
} }

View File

@ -869,9 +869,15 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR inspector, void* testData, const KICAD_T
wxString MODULE::GetSelectMenuText() const wxString MODULE::GetSelectMenuText() const
{ {
wxString reference = GetReference();
if( reference.IsEmpty() )
reference = _( "<no reference>" );
wxString text; wxString text;
text.Printf( _( "Footprint %s on %s" ), text.Printf( _( "Footprint %s on %s" ),
GetChars ( GetReference() ), GetChars ( reference ),
GetChars ( GetLayerName() ) ); GetChars ( GetLayerName() ) );
return text; return text;

View File

@ -1207,15 +1207,16 @@ wxString D_PAD::GetSelectMenuText() const
if( padname.IsEmpty() ) if( padname.IsEmpty() )
{ {
text.Printf( _( "Pad on %s of %s" ), text.Printf( _( "Pad of %s on %s" ),
GetChars( padlayers ), GetChars( GetParent()->GetReference() ),
GetChars(GetParent()->GetReference() ) ); GetChars( padlayers ) );
} }
else else
{ {
text.Printf( _( "Pad %s on %s of %s" ), text.Printf( _( "Pad %s of %s on %s" ),
GetChars(GetName() ), GetChars( padlayers ), GetChars( GetName() ),
GetChars(GetParent()->GetReference() ) ); GetChars( GetParent()->GetReference() ),
GetChars( padlayers ) );
} }
return text; return text;
@ -1355,38 +1356,31 @@ const BOX2I D_PAD::ViewBBox() const
wxString LayerMaskDescribe( const BOARD *aBoard, LSET aMask ) wxString LayerMaskDescribe( const BOARD *aBoard, LSET aMask )
{ {
// Try the single or no- layer case (easy) // Try to be smart and useful. Check all copper first.
PCB_LAYER_ID layer = aMask.ExtractLayer(); if( aMask[F_Cu] && aMask[B_Cu] )
return wxT( "all copper layers" );
switch( (int) layer ) // Check for single copper.
LSEQ cu = aBoard->GetEnabledLayers().CuStack();
if( cu )
return aBoard->GetLayerName( *cu );
// No copper; check for single techincal.
LSEQ tech = aBoard->GetEnabledLayers().Technicals();
if( tech )
{ {
case UNSELECTED_LAYER: wxString layerInfo = aBoard->GetLayerName( *tech );
return _( "No layers" );
case UNDEFINED_LAYER: if( tech.size() > 1 )
break; layerInfo << _( " & others" );
default: return layerInfo;
return aBoard->GetLayerName( layer );
} }
// Try to be smart and useful, starting with outer copper // No copper, no technicals: no layer
// (which are more important than internal ones) return _( "no layers" );
wxString layerInfo;
if( aMask[F_Cu] )
AccumulateDescription( layerInfo, aBoard->GetLayerName( F_Cu ) );
if( aMask[B_Cu] )
AccumulateDescription( layerInfo, aBoard->GetLayerName( B_Cu ) );
if( ( aMask & LSET::InternalCuMask() ).any() )
AccumulateDescription( layerInfo, _("Internal" ) );
if( ( aMask & LSET::AllNonCuMask() ).any() )
AccumulateDescription( layerInfo, _("Non-copper" ) );
return layerInfo;
} }

View File

@ -183,7 +183,8 @@ wxString TEXTE_PCB::GetSelectMenuText() const
wxString text; wxString text;
text.Printf( _( "Pcb Text \"%s\" on %s"), text.Printf( _( "Pcb Text \"%s\" on %s"),
GetChars ( ShortenedShownText() ), GetChars( GetLayerName() ) ); GetChars ( ShortenedShownText() ),
GetChars( GetLayerName() ) );
return text; return text;
} }

View File

@ -426,12 +426,16 @@ wxString TEXTE_MODULE::GetSelectMenuText() const
break; break;
case TEXT_is_VALUE: case TEXT_is_VALUE:
text.Printf( _( "Value %s of %s" ), GetChars( GetShownText() ), reference ); text.Printf( _( "Value %s of %s" ),
GetChars( GetShownText() ),
reference );
break; break;
default: // wrap this one in quotes: default: // wrap this one in quotes:
text.Printf( _( "Text \"%s\" on %s of %s" ), GetChars( ShortenedShownText() ), text.Printf( _( "Text \"%s\" of %s on %s" ),
GetChars( GetLayerName() ), reference ); GetChars( ShortenedShownText() ),
reference,
GetChars( GetLayerName() ) );
break; break;
} }

View File

@ -129,21 +129,11 @@ EDA_ITEM* SEGZONE::Clone() const
wxString SEGZONE::GetSelectMenuText() const wxString SEGZONE::GetSelectMenuText() const
{ {
wxString text, nettxt; wxString text;
BOARD* board = GetBoard();
if( board ) text.Printf( _( "Zone [%s] on %s" ),
{ GetChars( GetNetnameMsg() ),
nettxt = GetNetname(); GetChars( GetLayerName() ) );
}
else
{
wxFAIL_MSG( wxT( "SEGZONE::GetSelectMenuText: BOARD is NULL" ) );
nettxt = wxT( "???" );
}
text.Printf( _( "Zone (%08lX) [%s] on %s" ),
m_TimeStamp, GetChars( nettxt ), GetChars( GetLayerName() ) );
return text; return text;
} }
@ -179,38 +169,37 @@ wxString VIA::GetSelectMenuText() const
switch( GetViaType() ) switch( GetViaType() )
{ {
case VIA_BLIND_BURIED: case VIA_BLIND_BURIED:
format = _( "Blind/Buried Via %s, net[%s] (%d) on layers %s/%s" ); format = _( "Blind/Buried Via %s %s on %s - %s" );
break; break;
case VIA_MICROVIA: case VIA_MICROVIA:
format = _( "Micro Via %s, Net [%s] (%d) on layers %s/%s" ); format = _( "Micro Via %s %s on %s - %s" );
break; break;
// else say nothing about normal (through) vias // else say nothing about normal (through) vias
default: default:
format = _( "Via %s net [%s] (%d) on layers %s/%s" ); format = _( "Via %s %s on %s - %s" );
break; break;
} }
if( board ) if( board )
{ {
wxString netname = GetNetname();
// say which layers, only two for now // say which layers, only two for now
PCB_LAYER_ID topLayer; PCB_LAYER_ID topLayer;
PCB_LAYER_ID botLayer; PCB_LAYER_ID botLayer;
LayerPair( &topLayer, &botLayer ); LayerPair( &topLayer, &botLayer );
text.Printf( format.GetData(), GetChars( ShowWidth() ), text.Printf( format.GetData(),
GetChars( netname ), GetNetCode(), GetChars( ShowWidth() ),
GetChars( GetNetnameMsg() ),
GetChars( board->GetLayerName( topLayer ) ), GetChars( board->GetLayerName( topLayer ) ),
GetChars( board->GetLayerName( botLayer ) ) ); GetChars( board->GetLayerName( botLayer ) ) );
} }
else else
{ {
wxFAIL_MSG( wxT( "VIA::GetSelectMenuText: BOARD is NULL" ) ); text.Printf( format.GetData(),
text.Printf( format.GetData(), GetChars( ShowWidth() ), GetChars( ShowWidth() ),
wxT( "???" ), 0, GetChars( GetNetnameMsg() ),
wxT( "??" ), wxT( "??" ) ); wxT( "??" ),
wxT( "??" ) );
} }
return text; return text;
@ -1619,30 +1608,11 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
wxString TRACK::GetSelectMenuText() const wxString TRACK::GetSelectMenuText() const
{ {
wxString text; wxString text;
wxString netname;
NETINFO_ITEM* net;
BOARD* board = GetBoard();
// deleting tracks requires all the information we can get to text.Printf( _("Track %s %s on %s, length: %s" ),
// disambiguate all the choices under the cursor! GetChars( ShowWidth() ),
if( board ) GetChars( GetNetnameMsg() ),
{ GetChars( GetLayerName() ),
net = GetNet();
if( net )
netname = net->GetNetname();
else
netname = _("Not found");
}
else
{
wxFAIL_MSG( wxT( "TRACK::GetSelectMenuText: BOARD is NULL" ) );
netname = wxT( "???" );
}
text.Printf( _("Track %s, net [%s] (%d) on layer %s, length: %s" ),
GetChars( ShowWidth() ), GetChars( netname ),
GetNetCode(), GetChars( GetLayerName() ),
GetChars( ::LengthDoubleToString( GetLength() ) ) ); GetChars( ::LengthDoubleToString( GetLength() ) ) );
return text; return text;

View File

@ -1047,48 +1047,20 @@ bool ZONE_CONTAINER::AppendCorner( wxPoint aPosition, int aHoleIdx, bool aAllowD
wxString ZONE_CONTAINER::GetSelectMenuText() const wxString ZONE_CONTAINER::GetSelectMenuText() const
{ {
wxString text; wxString text;
NETINFO_ITEM* net;
BOARD* board = GetBoard();
// Check whether the selected contour is a hole (contour index > 0) // Check whether the selected contour is a hole (contour index > 0)
if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 ) if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
text << wxT( " " ) << _( "(Cutout)" ); text << wxT( " " ) << _( "(Cutout)" );
if( GetIsKeepout() ) if( GetIsKeepout() )
text << wxT( " " ) << _( "(Keepout)" ); text << wxT( " " ) << _( "(Keepout)" );
else
text << wxString::Format( wxT( " (%08lX)" ), m_TimeStamp ); text << GetNetnameMsg();
// Display net name for copper zones
if( !GetIsKeepout() )
{
if( GetNetCode() >= 0 )
{
if( board )
{
net = GetNet();
if( net )
{
text << wxT( " [" ) << net->GetNetname() << wxT( "]" );
}
}
else
{
text << _( "** NO BOARD DEFINED **" );
}
}
else
{ // A netcode < 0 is an error:
// Netname not found or area not initialised
text << wxT( " [" ) << GetNetname() << wxT( "]" );
text << wxT( " <" ) << _( "Not Found" ) << wxT( ">" );
}
}
wxString msg; wxString msg;
msg.Printf( _( "Zone Outline %s on %s" ), GetChars( text ), msg.Printf( _( "Zone Outline %s on %s" ),
GetChars( GetLayerName() ) ); GetChars( text ),
GetChars( GetLayerName() ) );
return msg; return msg;
} }

View File

@ -150,10 +150,9 @@ wxString DRC_ITEM::GetErrorText() const
wxString DRC_ITEM::ShowCoord( const wxPoint& aPos ) wxString DRC_ITEM::ShowCoord( const wxPoint& aPos )
{ {
wxString ret; return wxString::Format( _( "@(%s, %s)" ),
GetChars( CoordinateToString( aPos.x ) ),
ret << aPos; GetChars( CoordinateToString( aPos.y ) ) );
return ret;
} }
@ -186,7 +185,7 @@ wxString DRC_ITEM::ShowHtml() const
// an html fragment for the entire message in the listbox. feel free // an html fragment for the entire message in the listbox. feel free
// to add color if you want: // to add color if you want:
ret.Printf( _( "<b>%s</b><br>&nbsp;&nbsp; %s: %s<br>&nbsp;&nbsp; %s:%s" ), ret.Printf( _( "<b>%s</b><br>&nbsp;&nbsp; %s: %s<br>&nbsp;&nbsp; %s: %s" ),
GetChars( errText ), GetChars( errText ),
GetChars( ShowCoord( m_MainPosition )), GetChars( mainText ), GetChars( ShowCoord( m_MainPosition )), GetChars( mainText ),
GetChars( ShowCoord( m_AuxiliaryPosition )), GetChars( auxText ) ); GetChars( ShowCoord( m_AuxiliaryPosition )), GetChars( auxText ) );