Commit 9dca39f1 authored by dickelbeck's avatar dickelbeck

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

parent 08315e73
......@@ -5,6 +5,13 @@ Please add newer entries at the top, list the date and your name with
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>
================================================================================
+ pcbnew
......
......@@ -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".
......@@ -273,7 +273,6 @@ wxString ReturnPcbLayerName( int layer_number, bool is_filename )
* (not internatinalized, no space)
*/
{
wxString layer_name;
static const wxString layer_name_list[] = {
_( "Copper " ), _( "Inner L1 " ), _( "Inner L2 " ), _( "Inner L3 " ),
_( "Inner L4 " ), _( "Inner L5 " ), _( "Inner L6 " ), _( "Inner L7 " ),
......@@ -285,7 +284,8 @@ wxString ReturnPcbLayerName( int layer_number, bool is_filename )
_( "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[] = {
wxT( "Copper" ), wxT( "InnerL1" ), wxT( "InnerL2" ), wxT( "InnerL3" ),
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( "---" )
};
if( layer_number >= 31 )
if( (unsigned) layer_number >= 31u )
layer_number = 31;
if( is_filename )
layer_name = layer_name_list_for_filename[layer_number];
else
layer_name = layer_name_list[layer_number];
return layer_name;
return omitSpacePadding ?
layer_name_list_for_filename[layer_number] :
layer_name_list[layer_number];
}
......
......@@ -38,7 +38,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
case TYPEMODULE:
text << _( "Footprint" ) << wxT( " " ) << ( (MODULE*) item )->GetReference();
text << wxT( " (" ) << ReturnPcbLayerName( item->m_Layer ) << wxT( ")" );
text << wxT( " (" ) << ReturnPcbLayerName( item->m_Layer ).Trim() << wxT( ")" );
break;
case TYPEPAD:
......@@ -47,7 +47,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
break;
case TYPEDRAWSEGMENT:
text << _( "Pcb Graphic" ) << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ); // @todo: extend text
text << _( "Pcb Graphic" ) << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim(); // @todo: extend text
break;
case TYPETEXTE:
......@@ -56,7 +56,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
text << ( (TEXTE_PCB*) item )->m_Text;
else
text += ( (TEXTE_PCB*) item )->m_Text.Left( 10 ) + wxT( ".." );
text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() );
text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim();
break;
case TYPETEXTEMODULE:
......@@ -130,7 +130,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
{
text << wxT( " [" ) << net->m_Netname << wxT( "]" );
}
text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() );
text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim();
break;
case TYPEZONE:
......@@ -145,16 +145,34 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
{
text << wxT( " [" ) << net->m_Netname << wxT( "]" );
}
text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() );
text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim();
break;
case TYPEVIA:
text << _( "Via" ) << wxT( " " ) << ( (SEGVIA*) item )->m_NetCode;
net = aPcb->FindNet( ( (TRACK*) item )->m_NetCode );
{
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;
case TYPEMARQUEUR:
......@@ -170,7 +188,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
break;
case TYPEEDGEZONE:
text << _( "Edge Zone" ) << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ); // @todo: extend text
text << _( "Edge Zone" ) << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim(); // @todo: extend text
break;
default:
......
......@@ -816,6 +816,7 @@ bool TRACK::HitTest( const wxPoint& ref_pos )
#if defined(DEBUG)
/**
* Function Show
* 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 )
{
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
" shape=\"" << m_Shape << '"' <<
// " shape=\"" << m_Shape << '"' <<
" layer=\"" << m_Layer << '"' <<
" width=\"" << m_Width << '"' <<
" drill=\"" << m_Drill << '"' <<
// " drill=\"" << m_Drill << '"' <<
" netcode=\"" << m_NetCode << "\">" <<
"<start" << m_Start << "/>" <<
"<end" << m_End << "/>";
......@@ -837,6 +838,49 @@ void TRACK::Show( int nestLevel, std::ostream& os )
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
......@@ -146,6 +146,8 @@ public:
return wxT("TRACK");
}
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
......@@ -154,7 +156,7 @@ public:
* @param os The ostream& to output to.
*/
void Show( int nestLevel, std::ostream& os );
#endif
};
......@@ -211,6 +213,19 @@ public:
{
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
};
......
......@@ -51,3 +51,5 @@ understanding by new developers.
*** Implement the graying in/out of "Edit/Undo", "Edit/Redo" menu items,
when Undo/Redo stack is empty/filled.
*** There is no way to truly edit a via, such as changing its layers.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment