added ShowShape(), fixed MenuText() for DRAWSEGMENT

This commit is contained in:
dickelbeck 2008-05-05 19:52:09 +00:00
parent 9ed0d8cdda
commit f211a33932
1 changed files with 43 additions and 56 deletions

View File

@ -13,6 +13,29 @@
#include "bitmaps.h" #include "bitmaps.h"
/********************************************************/
wxString BOARD_ITEM::ShowShape( Track_Shapes aShape )
/********************************************************/
{
switch( aShape )
{
case S_SEGMENT: return _( "Line" );
case S_RECT: return _( "Rect" );
case S_ARC: return _( "Arc" );
case S_CIRCLE: return _( "Circle" );
// used in Gerbview:
case S_ARC_RECT: return wxT( "arc_rect" );
case S_SPOT_OVALE: return wxT( "spot_oval" );
case S_SPOT_CIRCLE: return wxT( "spot_circle" );
case S_SPOT_RECT: return wxT( "spot_rect" );
case S_POLYGON: return wxT( "polygon" );
default: return wxT( "??" );
}
}
/********************************************************/ /********************************************************/
wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
/********************************************************/ /********************************************************/
@ -21,10 +44,12 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
* @param aPcb = the parent board * @param aPcb = the parent board
*/ */
{ {
wxString text, msg; wxString text;
const BOARD_ITEM* item = this; wxString msg;
EQUIPOT* net; wxString temp;
D_PAD * pad; const BOARD_ITEM* item = this;
EQUIPOT* net;
D_PAD * pad;
switch( item->Type() ) switch( item->Type() )
{ {
@ -53,7 +78,10 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
break; break;
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
text << _( "Pcb Graphic" ) << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim(); // @todo: extend text text << _( "Pcb Graphic" ) << wxT(": ")
<< ShowShape( (Track_Shapes) ((DRAWSEGMENT*)item)->m_Shape )
<< wxChar(' ') << _("Length:") << valeur_param( (int) ((DRAWSEGMENT*)item)->GetLength(), temp )
<< _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim();
break; break;
case TYPETEXTE: case TYPETEXTE:
@ -86,66 +114,25 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
break; break;
case TYPEEDGEMODULE: case TYPEEDGEMODULE:
{
text << _( "Graphic" ) << wxT( " " ); text << _( "Graphic" ) << wxT( " " );
wxString cp; text << ShowShape( (Track_Shapes) ( (EDGE_MODULE*) item )->m_Shape );
switch( ( (EDGE_MODULE*) item )->m_Shape )
{
case S_SEGMENT:
cp = _( "Line" ); break;
case S_RECT:
cp = _( "Rect" ); break;
case S_ARC:
cp = _( "Arc" ); break;
case S_CIRCLE:
cp = _( "Circle" ); break;
/* used in Gerbview: */
case S_ARC_RECT:
cp = wxT( "arc_rect" ); break;
case S_SPOT_OVALE:
cp = wxT( "spot_oval" ); break;
case S_SPOT_CIRCLE:
cp = wxT( "spot_circle" ); break;
case S_SPOT_RECT:
cp = wxT( "spot_rect" ); break;
case S_POLYGON:
cp = wxT( "polygon" ); break;
default:
cp = wxT( "??EDGE??" ); break;
}
text << cp;
text << wxT( " (" ) << aPcb->GetLayerName( ((EDGE_MODULE*) item )->m_Layer ).Trim() << wxT( ")" ); text << wxT( " (" ) << aPcb->GetLayerName( ((EDGE_MODULE*) item )->m_Layer ).Trim() << wxT( ")" );
text << _( " of " ) text << _( " of " )
<< ( (MODULE*) GetParent() )->GetReference(); << ( (MODULE*) GetParent() )->GetReference();
break; break;
}
case TYPETRACK: case TYPETRACK:
// deleting tracks requires all the information we can get to // deleting tracks requires all the information we can get to
// disambiguate all the crap under the cursor! // disambiguate all the choices under the cursor!
text << _( "Track" ) << wxT( " " ) << ((TRACK*)item)->ShowWidth();
net = aPcb->FindNet( ((TRACK*)item)->GetNet() );
if( net )
{ {
wxString txt; text << wxT( " [" ) << net->m_Netname << wxT( "]" );
text << _( "Track" ) << wxT( " " ) << ((TRACK*)item)->ShowWidth();
net = aPcb->FindNet( ((TRACK*)item)->GetNet() );
if( net )
{
text << wxT( " [" ) << net->m_Netname << wxT( "]" );
}
text << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim()
<< wxT(" ") << _("Net:") << ((TRACK*)item)->GetNet()
<< wxT(" ") << _("Length:") << valeur_param( (int) ((TRACK*)item)->GetLength(), txt );
} }
text << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim()
<< wxT(" ") << _("Net:") << ((TRACK*)item)->GetNet()
<< wxT(" ") << _("Length:") << valeur_param( (int) ((TRACK*)item)->GetLength(), temp );
break; break;
case TYPEZONE_CONTAINER: case TYPEZONE_CONTAINER: