BOARD::GetLayerName()

This commit is contained in:
dickelbeck 2008-02-19 00:30:10 +00:00
parent 7898af976f
commit ce04867e84
5 changed files with 178 additions and 162 deletions

View File

@ -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 ).Trim() << wxT( ")" );
text << wxT( " (" ) << aPcb->GetLayerName( item->m_Layer ).Trim() << wxT( ")" );
break;
case TYPEPAD:
@ -48,15 +48,15 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
if ( (pad->m_Masque_Layer & ALL_CU_LAYERS) == ALL_CU_LAYERS )
text << _("all copper layers");
else if( (pad->m_Masque_Layer & CUIVRE_LAYER) == CUIVRE_LAYER )
text << _("copper layer");
text << aPcb->GetLayerName( COPPER_LAYER_N ).Trim();
else if( (pad->m_Masque_Layer & CMP_LAYER) == CMP_LAYER )
text << _("cmp layer");
text << aPcb->GetLayerName( LAYER_CMP_N );
else text << _("???");
text << _( ") of " ) << ( (MODULE*) GetParent() )->GetReference();
break;
case TYPEDRAWSEGMENT:
text << _( "Pcb Graphic" ) << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim(); // @todo: extend text
text << _( "Pcb Graphic" ) << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim(); // @todo: extend text
break;
case TYPETEXTE:
@ -65,7 +65,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() ).Trim();
text << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim();
break;
case TYPETEXTEMODULE:
@ -128,7 +128,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
}
text << cp;
text << wxT( " (" ) << ReturnPcbLayerName( ((EDGE_MODULE*) item )->m_Layer ).Trim() << wxT( ")" );
text << wxT( " (" ) << aPcb->GetLayerName( ((EDGE_MODULE*) item )->m_Layer ).Trim() << wxT( ")" );
text << _( " of " )
<< ( (MODULE*) GetParent() )->GetReference();
break;
@ -145,7 +145,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
{
text << wxT( " [" ) << net->m_Netname << wxT( "]" );
}
text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim()
text << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim()
<< wxT(" ") << _("Net:") << ((TRACK*)item)->GetNet()
<< wxT(" ") << _("Length:") << valeur_param( (int) ((TRACK*)item)->GetLength(), txt );
}
@ -154,9 +154,10 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
case TYPEZONE_CONTAINER:
text = _( "Zone Outline" );
{
ZONE_CONTAINER* area = (ZONE_CONTAINER*) this;
int ncont = area->m_Poly->GetContour(area->m_CornerSelection);
if ( ncont ) text << wxT(" ") << _("(Cutout)");
ZONE_CONTAINER* area = (ZONE_CONTAINER*) this;
int ncont = area->m_Poly->GetContour(area->m_CornerSelection);
if( ncont )
text << wxT(" ") << _("(Cutout)");
}
text << wxT( " " );
{
@ -164,7 +165,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
TimeStampText.Printf( wxT( "(%8.8X)" ), item->m_TimeStamp );
text << TimeStampText;
}
if ( ((ZONE_CONTAINER*) item)->GetNet() >= 0 )
if( ((ZONE_CONTAINER*) item)->GetNet() >= 0 )
{
net = aPcb->FindNet( ( (ZONE_CONTAINER*) item )->GetNet() );
if( net )
@ -172,12 +173,12 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
text << wxT( " [" ) << net->m_Netname << wxT( "]" );
}
}
else // A netcode < 0 is an error flag (Netname not found or area not initialised)
else // A netcode < 0 is an error flag (Netname not found or area not initialised)
{
text << wxT( " [" ) << ( (ZONE_CONTAINER*) item )->m_Netname << wxT( "]" );
text << wxT(" <") << _("Not Found") << wxT(">");
}
text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim();
text << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim();
break;
case TYPEZONE:
@ -193,7 +194,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
{
text << wxT( " [" ) << net->m_Netname << wxT( "]" );
}
text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim();
text << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim();
break;
case TYPEVIA:
@ -221,8 +222,8 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
int topLayer;
int botLayer;
via->ReturnLayerPair( &topLayer, &botLayer );
text << _( " on " ) << ReturnPcbLayerName( topLayer).Trim() << wxT(" <-> ")
<< ReturnPcbLayerName( botLayer ).Trim();
text << _( " on " ) << aPcb->GetLayerName( topLayer).Trim() << wxT(" <-> ")
<< aPcb->GetLayerName( botLayer ).Trim();
}
}
break;
@ -238,7 +239,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
case TYPEMIRE:
valeur_param( ((MIREPCB*)item)->m_Size, msg );
text << _( "Target" ) << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim()
text << _( "Target" ) << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim()
<< wxT( " " ) << _( "size" ) << wxT( " " ) << msg
;
break;

View File

@ -278,6 +278,10 @@ void EDGE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
if( !module )
return;
BOARD* board = (BOARD*) module->m_Parent;
if( !board )
return;
frame->MsgPanel->EraseMsgBox();
Affiche_1_Parametre( frame, 1, _( "Seg" ), wxEmptyString, DARKCYAN );
@ -288,10 +292,9 @@ void EDGE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
Affiche_1_Parametre( frame, 24, _( "TimeStamp" ), bufcar, BROWN );
Affiche_1_Parametre( frame, 34, _( "Mod Layer" ), ReturnPcbLayerName( module->GetLayer() ), RED );
Affiche_1_Parametre( frame, 34, _( "Mod Layer" ), board->GetLayerName( module->GetLayer() ), RED );
Affiche_1_Parametre( frame, 44, _( "Seg Layer" ),
ReturnPcbLayerName( module->GetLayer() ), RED );
Affiche_1_Parametre( frame, 44, _( "Seg Layer" ), board->GetLayerName( module->GetLayer() ), RED );
valeur_param( m_Width, bufcar );
Affiche_1_Parametre( frame, 54, _( "Width" ), bufcar, BLUE );
@ -459,12 +462,12 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File,
if( m_Width > MAX_WIDTH )
m_Width = MAX_WIDTH;
// Check for a reasonnable layer:
// m_Layer must be >= FIRST_NON_COPPER_LAYER, but because microwave footprints
// can use the copper layers m_Layer < FIRST_NON_COPPER_LAYER is allowed.
// @todo: changes use of EDGE_MODULE these footprints and allows only m_Layer >= FIRST_NON_COPPER_LAYER
if ( (m_Layer < 0) || (m_Layer > LAST_NON_COPPER_LAYER) )
m_Layer = SILKSCREEN_N_CMP;
// Check for a reasonnable layer:
// m_Layer must be >= FIRST_NON_COPPER_LAYER, but because microwave footprints
// can use the copper layers m_Layer < FIRST_NON_COPPER_LAYER is allowed.
// @todo: changes use of EDGE_MODULE these footprints and allows only m_Layer >= FIRST_NON_COPPER_LAYER
if ( (m_Layer < 0) || (m_Layer > LAST_NON_COPPER_LAYER) )
m_Layer = SILKSCREEN_N_CMP;
return error;
}

View File

@ -142,7 +142,7 @@ void MODULE::Copy( MODULE* Module )
m_CntRot90 = Module->m_CntRot90;
m_CntRot180 = Module->m_CntRot180;
m_LastEdit_Time = Module->m_LastEdit_Time;
m_Path = Module->m_Path; //is this correct behavior?
m_Path = Module->m_Path; //is this correct behavior?
m_TimeStamp = GetTimeStamp();
/* Copy des structures auxiliaires: Reference et value */
@ -388,7 +388,7 @@ bool MODULE::Save( FILE* aFile ) const
}
fprintf( aFile, "Sc %8.8lX\n", m_TimeStamp );
fprintf( aFile, "AR %s\n", CONV_TO_UTF8(m_Path) );
fprintf( aFile, "AR %s\n", CONV_TO_UTF8(m_Path) );
fprintf( aFile, "Op %X %X 0\n", m_CntRot90, m_CntRot180 );
// attributes
@ -658,18 +658,18 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
break;
case 'A':
if(Line[1] == 't'){
/* At = (At)tributs du module */
if( strstr( PtLine, "SMD" ) )
m_Attributs |= MOD_CMS;
if( strstr( PtLine, "VIRTUAL" ) )
m_Attributs |= MOD_VIRTUAL;
}
if(Line[1] == 'R'){
//alternate reference, e.g. /478C2408/478AD1B6
sscanf( PtLine, " %s", BufLine );
m_Path = CONV_FROM_UTF8(BufLine);
}
if(Line[1] == 't'){
/* At = (At)tributs du module */
if( strstr( PtLine, "SMD" ) )
m_Attributs |= MOD_CMS;
if( strstr( PtLine, "VIRTUAL" ) )
m_Attributs |= MOD_VIRTUAL;
}
if(Line[1] == 'R'){
//alternate reference, e.g. /478C2408/478AD1B6
sscanf( PtLine, " %s", BufLine );
m_Path = CONV_FROM_UTF8(BufLine);
}
break;
case 'T': /* lecture des textes modules */
@ -1048,6 +1048,7 @@ void MODULE::Display_Infos( WinEDA_DrawFrame* frame )
int pos;
bool flag = FALSE;
wxString msg;
BOARD* board = (BOARD*) m_Parent;
frame->MsgPanel->EraseMsgBox(); /* Effacement de la zone message */
if( frame->m_Ident != PCB_FRAME )
@ -1076,14 +1077,15 @@ void MODULE::Display_Infos( WinEDA_DrawFrame* frame )
}
pos += 12;
Affiche_1_Parametre( frame, pos, _( "Layer" ), ReturnPcbLayerName( m_Layer ), RED );
Affiche_1_Parametre( frame, pos, _( "Layer" ), board->GetLayerName( m_Layer ), RED );
pos += 6;
EDA_BaseStruct* PtStruct = m_Pads;
nbpad = 0;
while( PtStruct )
{
nbpad++; PtStruct = PtStruct->Pnext;
nbpad++;
PtStruct = PtStruct->Pnext;
}
msg.Printf( wxT( "%d" ), nbpad );
@ -1249,11 +1251,13 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
*/
void MODULE::Show( int nestLevel, std::ostream& os )
{
BOARD* board = (BOARD*) m_Parent;
// for now, make it look like XML, expand on this later.
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
" ref=\"" << m_Reference->m_Text.mb_str() << '"' <<
" value=\"" << m_Value->m_Text.mb_str() << '"' <<
" layer=\"" << ReturnPcbLayerName(m_Layer,true).mb_str() << '"' <<
" layer=\"" << board->GetLayerName(m_Layer).mb_str() << '"' <<
">\n";
NestedSpace( nestLevel+1, os ) <<

View File

@ -853,7 +853,7 @@ void D_PAD::Display_Infos( WinEDA_DrawFrame* frame )
/* Affiche en bas d'ecran les caract de la pastille demandee */
{
int ii;
MODULE* Module;
MODULE* module;
wxString Line;
int pos = 1;
@ -874,10 +874,10 @@ void D_PAD::Display_Infos( WinEDA_DrawFrame* frame )
frame->MsgPanel->EraseMsgBox();
/* Recherche du module correspondant */
Module = (MODULE*) m_Parent;
if( Module )
module = (MODULE*) m_Parent;
if( module )
{
wxString msg = Module->m_Reference->m_Text;
wxString msg = module->GetReference();
Affiche_1_Parametre( frame, pos, _( "Module" ), msg, DARKCYAN );
ReturnStringPadName( Line );
pos += 8;
@ -894,6 +894,7 @@ void D_PAD::Display_Infos( WinEDA_DrawFrame* frame )
#endif
wxString LayerInfo;
ii = 0;
if( m_Masque_Layer & CUIVRE_LAYER )
ii = 2;
@ -1002,7 +1003,7 @@ void D_PAD::Display_Infos( WinEDA_DrawFrame* frame )
}
int module_orient = Module ? Module->m_Orient : 0;
int module_orient = module ? module->m_Orient : 0;
if( module_orient )
Line.Printf( wxT( "%3.1f(+%3.1f)" ),
(float) (m_Orient - module_orient) / 10, (float) module_orient / 10 );

View File

@ -748,8 +748,9 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode )
// see class_track.h
void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
{
wxString msg;
int text_pos;
wxString msg;
int text_pos;
BOARD* board = ((WinEDA_PcbFrame*)frame)->m_Pcb;
#ifdef RATSNET_DEBUG
DbgDisplayTrackInfos( this );
@ -779,11 +780,12 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
/* Display NetName pour les segments de piste type cuivre */
text_pos += 15;
if( Type() == TYPETRACK
|| Type() == TYPEZONE
|| Type() == TYPEVIA )
{
EQUIPOT* equipot = ( (WinEDA_PcbFrame*) frame )->m_Pcb->FindNet( GetNet() );
EQUIPOT* equipot = board->FindNet( GetNet() );
if( equipot )
msg = equipot->m_Netname;
@ -824,11 +826,11 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
int top_layer, bottom_layer;
Via->ReturnLayerPair( &top_layer, &bottom_layer );
msg = ReturnPcbLayerName( top_layer, TRUE ) + wxT( "/" )
+ ReturnPcbLayerName( bottom_layer, TRUE );
msg = board->GetLayerName( top_layer ) + wxT( "/" )
+ board->GetLayerName( bottom_layer );
}
else
msg = ReturnPcbLayerName( m_Layer );
msg = board->GetLayerName( m_Layer );
text_pos += 5;
Affiche_1_Parametre( frame, text_pos, _( "Layer" ), msg, BROWN );
@ -978,13 +980,18 @@ void SEGVIA::Show( int nestLevel, std::ostream& os )
int topLayer;
int botLayer;
BOARD* board = (BOARD*) m_Parent;
ReturnLayerPair( &topLayer, &botLayer );
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
" type=\"" << cp << '"' <<
" layers=\"" << ReturnPcbLayerName( topLayer ).Trim().mb_str() << ","
<< ReturnPcbLayerName( botLayer ).Trim().mb_str() << '"' <<
" type=\"" << cp << '"';
if( board )
os << " layers=\"" << board->GetLayerName( topLayer ).Trim().mb_str() << ","
<< board->GetLayerName( botLayer ).Trim().mb_str() << '"';
os <<
" width=\"" << m_Width << '"' <<
" drill=\"" << GetDrillValue() << '"' <<
" netcode=\"" << GetNet() << "\">" <<