SEGVIA::Show() & BOARD_ITEM::MenuText()

This commit is contained in:
dickelbeck 2007-10-01 04:14:29 +00:00
parent 08315e7378
commit 9dca39f1d4
7 changed files with 107 additions and 24 deletions

View File

@ -5,6 +5,13 @@ Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Sep-30 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+ pcbnew
Added dedicated Show() function for SEGVIA. Enhanced BOARD_ITEM::MenuText()
for SEGVIA. Added to todo.txt.
2007-Sep-29 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Sep-29 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+ pcbnew + pcbnew

View File

@ -265,7 +265,7 @@ void MyFree( void* pt_mem )
/**************************************************************/ /**************************************************************/
wxString ReturnPcbLayerName( int layer_number, bool is_filename ) wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding )
/**************************************************************/ /**************************************************************/
/* Return the name of the layer number "layer_number". /* Return the name of the layer number "layer_number".
@ -273,7 +273,6 @@ wxString ReturnPcbLayerName( int layer_number, bool is_filename )
* (not internatinalized, no space) * (not internatinalized, no space)
*/ */
{ {
wxString layer_name;
static const wxString layer_name_list[] = { static const wxString layer_name_list[] = {
_( "Copper " ), _( "Inner L1 " ), _( "Inner L2 " ), _( "Inner L3 " ), _( "Copper " ), _( "Inner L1 " ), _( "Inner L2 " ), _( "Inner L3 " ),
_( "Inner L4 " ), _( "Inner L5 " ), _( "Inner L6 " ), _( "Inner L7 " ), _( "Inner L4 " ), _( "Inner L5 " ), _( "Inner L6 " ), _( "Inner L7 " ),
@ -285,7 +284,8 @@ wxString ReturnPcbLayerName( int layer_number, bool is_filename )
_( "Edges Pcb" ), _( "--- " ), _( "--- " ), _( "--- " ) _( "Edges Pcb" ), _( "--- " ), _( "--- " ), _( "--- " )
}; };
// Same as layer_name_list, without space, not internationalized
// Same as layer_name_list, without space, not internationalized
static const wxString layer_name_list_for_filename[] = { static const wxString layer_name_list_for_filename[] = {
wxT( "Copper" ), wxT( "InnerL1" ), wxT( "InnerL2" ), wxT( "InnerL3" ), wxT( "Copper" ), wxT( "InnerL1" ), wxT( "InnerL2" ), wxT( "InnerL3" ),
wxT( "InnerL4" ), wxT( "InnerL5" ), wxT( "InnerL6" ), wxT( "InnerL7" ), wxT( "InnerL4" ), wxT( "InnerL5" ), wxT( "InnerL6" ), wxT( "InnerL7" ),
@ -297,15 +297,12 @@ wxString ReturnPcbLayerName( int layer_number, bool is_filename )
wxT( "EdgesPcb" ), wxT( "---" ), wxT( "---" ), wxT( "---" ) wxT( "EdgesPcb" ), wxT( "---" ), wxT( "---" ), wxT( "---" )
}; };
if( layer_number >= 31 ) if( (unsigned) layer_number >= 31u )
layer_number = 31; layer_number = 31;
if( is_filename ) return omitSpacePadding ?
layer_name = layer_name_list_for_filename[layer_number]; layer_name_list_for_filename[layer_number] :
else layer_name_list[layer_number];
layer_name = layer_name_list[layer_number];
return layer_name;
} }

View File

@ -38,7 +38,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
case TYPEMODULE: case TYPEMODULE:
text << _( "Footprint" ) << wxT( " " ) << ( (MODULE*) item )->GetReference(); text << _( "Footprint" ) << wxT( " " ) << ( (MODULE*) item )->GetReference();
text << wxT( " (" ) << ReturnPcbLayerName( item->m_Layer ) << wxT( ")" ); text << wxT( " (" ) << ReturnPcbLayerName( item->m_Layer ).Trim() << wxT( ")" );
break; break;
case TYPEPAD: case TYPEPAD:
@ -47,7 +47,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
break; break;
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
text << _( "Pcb Graphic" ) << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ); // @todo: extend text text << _( "Pcb Graphic" ) << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim(); // @todo: extend text
break; break;
case TYPETEXTE: case TYPETEXTE:
@ -56,7 +56,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
text << ( (TEXTE_PCB*) item )->m_Text; text << ( (TEXTE_PCB*) item )->m_Text;
else else
text += ( (TEXTE_PCB*) item )->m_Text.Left( 10 ) + wxT( ".." ); text += ( (TEXTE_PCB*) item )->m_Text.Left( 10 ) + wxT( ".." );
text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ); text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim();
break; break;
case TYPETEXTEMODULE: case TYPETEXTEMODULE:
@ -130,7 +130,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
{ {
text << wxT( " [" ) << net->m_Netname << wxT( "]" ); text << wxT( " [" ) << net->m_Netname << wxT( "]" );
} }
text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ); text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim();
break; break;
case TYPEZONE: case TYPEZONE:
@ -145,15 +145,33 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
{ {
text << wxT( " [" ) << net->m_Netname << wxT( "]" ); text << wxT( " [" ) << net->m_Netname << wxT( "]" );
} }
text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ); text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim();
break; break;
case TYPEVIA: case TYPEVIA:
text << _( "Via" ) << wxT( " " ) << ( (SEGVIA*) item )->m_NetCode;
net = aPcb->FindNet( ( (TRACK*) item )->m_NetCode );
if( net )
{ {
text << wxT( " [" ) << net->m_Netname << wxT( "]" ); SEGVIA* via = (SEGVIA*) item;
text << _( "Via" ) << wxT( " " ) << via->m_NetCode;
int shape = via->Shape();
if( shape == VIA_ENTERREE )
text << wxT(" ") << _( "Blind" );
else if( shape == VIA_BORGNE )
text << wxT(" ") << _("Buried");
// else say nothing about normal vias
net = aPcb->FindNet( via->m_NetCode );
if( net )
{
text << wxT( " [" ) << net->m_Netname << wxT( "]" );
}
// say which layers, only two for now
int topLayer;
int botLayer;
via->ReturnLayerPair( &topLayer, &botLayer );
text << _( " on " ) << ReturnPcbLayerName( topLayer).Trim() << wxT(" <-> ")
<< ReturnPcbLayerName( botLayer ).Trim();
} }
break; break;
@ -170,7 +188,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
break; break;
case TYPEEDGEZONE: case TYPEEDGEZONE:
text << _( "Edge Zone" ) << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ); // @todo: extend text text << _( "Edge Zone" ) << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim(); // @todo: extend text
break; break;
default: default:

View File

@ -816,6 +816,7 @@ bool TRACK::HitTest( const wxPoint& ref_pos )
#if defined(DEBUG) #if defined(DEBUG)
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
@ -826,10 +827,10 @@ bool TRACK::HitTest( const wxPoint& ref_pos )
void TRACK::Show( int nestLevel, std::ostream& os ) void TRACK::Show( int nestLevel, std::ostream& os )
{ {
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
" shape=\"" << m_Shape << '"' << // " shape=\"" << m_Shape << '"' <<
" layer=\"" << m_Layer << '"' << " layer=\"" << m_Layer << '"' <<
" width=\"" << m_Width << '"' << " width=\"" << m_Width << '"' <<
" drill=\"" << m_Drill << '"' << // " drill=\"" << m_Drill << '"' <<
" netcode=\"" << m_NetCode << "\">" << " netcode=\"" << m_NetCode << "\">" <<
"<start" << m_Start << "/>" << "<start" << m_Start << "/>" <<
"<end" << m_End << "/>"; "<end" << m_End << "/>";
@ -837,6 +838,49 @@ void TRACK::Show( int nestLevel, std::ostream& os )
os << "</" << GetClass().Lower().mb_str() << ">\n"; os << "</" << GetClass().Lower().mb_str() << ">\n";
} }
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void SEGVIA::Show( int nestLevel, std::ostream& os )
{
const char* cp;
switch( Shape() )
{
case VIA_NORMALE: cp = "through"; break;
case VIA_ENTERREE: cp = "blind"; break;
case VIA_BORGNE: cp = "buried"; break;
default:
case VIA_NOT_DEFINED: cp = "undefined"; break;
}
int topLayer;
int botLayer;
ReturnLayerPair( &topLayer, &botLayer );
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
" type=\"" << cp << '"' <<
" layers=\"" << ReturnPcbLayerName( topLayer).Trim().mb_str() << ","
<< ReturnPcbLayerName( botLayer ).Trim().mb_str() << '"' <<
" width=\"" << m_Width << '"' <<
" drill=\"" << m_Drill << '"' <<
" netcode=\"" << m_NetCode << "\">" <<
"<pos" << m_Start << "/>";
os << "</" << GetClass().Lower().mb_str() << ">\n";
}
#endif #endif

View File

@ -146,6 +146,8 @@ public:
return wxT("TRACK"); return wxT("TRACK");
} }
#if defined(DEBUG)
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
@ -154,7 +156,7 @@ public:
* @param os The ostream& to output to. * @param os The ostream& to output to.
*/ */
void Show( int nestLevel, std::ostream& os ); void Show( int nestLevel, std::ostream& os );
#endif
}; };
@ -211,6 +213,19 @@ public:
{ {
return wxT("VIA"); return wxT("VIA");
} }
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void Show( int nestLevel, std::ostream& os );
#endif
}; };

View File

@ -581,7 +581,7 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
/* Le pad doit faire partie d'un net mais pas de probleme /* Le pad doit faire partie d'un net mais pas de probleme
* si le pad est du meme net */ * si le pad est du meme net */
if( /*pt_pad->m_NetCode &&*/ net_code_ref == pt_pad->m_NetCode ) if( /*pt_pad->m_NetCode &&*/ net_code_ref == pt_pad->m_NetCode )
continue; continue;
/* Test DRC pour les pads */ /* Test DRC pour les pads */

View File

@ -51,3 +51,5 @@ understanding by new developers.
*** Implement the graying in/out of "Edit/Undo", "Edit/Redo" menu items, *** Implement the graying in/out of "Edit/Undo", "Edit/Redo" menu items,
when Undo/Redo stack is empty/filled. when Undo/Redo stack is empty/filled.
*** There is no way to truly edit a via, such as changing its layers.