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 ret;
ret << aPos;
return ret;
return wxString::Format( _( "@(%s, %s)" ),
GetChars( CoordinateToString( aPos.x ) ),
GetChars( CoordinateToString( aPos.y ) ) );
}

View File

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

View File

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

View File

@ -619,19 +619,19 @@ wxString SCH_LINE::GetSelectMenuText() const
switch( m_Layer )
{
case LAYER_NOTES:
txtfmt = _( "%s Graphic Line from (%s,%s) to (%s,%s)" );
txtfmt = _( "%s Graphic Line from (%s, %s) to (%s, %s)" );
break;
case LAYER_WIRE:
txtfmt = _( "%s Wire from (%s,%s) to (%s,%s)" );
txtfmt = _( "%s Wire from (%s, %s) to (%s, %s)" );
break;
case LAYER_BUS:
txtfmt = _( "%s Bus from (%s,%s) to (%s,%s)" );
txtfmt = _( "%s Bus from (%s, %s) to (%s, %s)" );
break;
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 ),

View File

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

View File

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

View File

@ -124,6 +124,26 @@ public:
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
* @return wxString - the short netname

View File

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

View File

@ -724,11 +724,11 @@ bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
wxString DRAWSEGMENT::GetSelectMenuText() const
{
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( temp ), GetChars( GetLayerName() ) );
GetChars( ::LengthDoubleToString( GetLength() ) ),
GetChars( GetLayerName() ) );
return text;
}

View File

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

View File

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

View File

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

View File

@ -1207,15 +1207,16 @@ wxString D_PAD::GetSelectMenuText() const
if( padname.IsEmpty() )
{
text.Printf( _( "Pad on %s of %s" ),
GetChars( padlayers ),
GetChars(GetParent()->GetReference() ) );
text.Printf( _( "Pad of %s on %s" ),
GetChars( GetParent()->GetReference() ),
GetChars( padlayers ) );
}
else
{
text.Printf( _( "Pad %s on %s of %s" ),
GetChars(GetName() ), GetChars( padlayers ),
GetChars(GetParent()->GetReference() ) );
text.Printf( _( "Pad %s of %s on %s" ),
GetChars( GetName() ),
GetChars( GetParent()->GetReference() ),
GetChars( padlayers ) );
}
return text;
@ -1355,38 +1356,31 @@ const BOX2I D_PAD::ViewBBox() const
wxString LayerMaskDescribe( const BOARD *aBoard, LSET aMask )
{
// Try the single or no- layer case (easy)
PCB_LAYER_ID layer = aMask.ExtractLayer();
// Try to be smart and useful. Check all copper first.
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:
return _( "No layers" );
wxString layerInfo = aBoard->GetLayerName( *tech );
case UNDEFINED_LAYER:
break;
if( tech.size() > 1 )
layerInfo << _( " & others" );
default:
return aBoard->GetLayerName( layer );
return layerInfo;
}
// Try to be smart and useful, starting with outer copper
// (which are more important than internal ones)
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;
// No copper, no technicals: no layer
return _( "no layers" );
}

View File

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

View File

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

View File

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

View File

@ -1047,48 +1047,20 @@ bool ZONE_CONTAINER::AppendCorner( wxPoint aPosition, int aHoleIdx, bool aAllowD
wxString ZONE_CONTAINER::GetSelectMenuText() const
{
wxString text;
NETINFO_ITEM* net;
BOARD* board = GetBoard();
// Check whether the selected contour is a hole (contour index > 0)
if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
text << wxT( " " ) << _( "(Cutout)" );
text << wxT( " " ) << _( "(Cutout)" );
if( GetIsKeepout() )
text << wxT( " " ) << _( "(Keepout)" );
text << wxString::Format( wxT( " (%08lX)" ), m_TimeStamp );
// 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( ">" );
}
}
else
text << GetNetnameMsg();
wxString msg;
msg.Printf( _( "Zone Outline %s on %s" ), GetChars( text ),
GetChars( GetLayerName() ) );
msg.Printf( _( "Zone Outline %s on %s" ),
GetChars( text ),
GetChars( GetLayerName() ) );
return msg;
}

View File

@ -150,10 +150,9 @@ wxString DRC_ITEM::GetErrorText() const
wxString DRC_ITEM::ShowCoord( const wxPoint& aPos )
{
wxString ret;
ret << aPos;
return ret;
return wxString::Format( _( "@(%s, %s)" ),
GetChars( CoordinateToString( aPos.x ) ),
GetChars( CoordinateToString( aPos.y ) ) );
}
@ -186,7 +185,7 @@ wxString DRC_ITEM::ShowHtml() const
// an html fragment for the entire message in the listbox. feel free
// 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( ShowCoord( m_MainPosition )), GetChars( mainText ),
GetChars( ShowCoord( m_AuxiliaryPosition )), GetChars( auxText ) );