Commit ce04867e authored by dickelbeck's avatar dickelbeck

BOARD::GetLayerName()

parent 7898af97
...@@ -38,7 +38,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const ...@@ -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 ).Trim() << wxT( ")" ); text << wxT( " (" ) << aPcb->GetLayerName( item->m_Layer ).Trim() << wxT( ")" );
break; break;
case TYPEPAD: case TYPEPAD:
...@@ -48,15 +48,15 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const ...@@ -48,15 +48,15 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
if ( (pad->m_Masque_Layer & ALL_CU_LAYERS) == ALL_CU_LAYERS ) if ( (pad->m_Masque_Layer & ALL_CU_LAYERS) == ALL_CU_LAYERS )
text << _("all copper layers"); text << _("all copper layers");
else if( (pad->m_Masque_Layer & CUIVRE_LAYER) == CUIVRE_LAYER ) 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 ) else if( (pad->m_Masque_Layer & CMP_LAYER) == CMP_LAYER )
text << _("cmp layer"); text << aPcb->GetLayerName( LAYER_CMP_N );
else text << _("???"); else text << _("???");
text << _( ") of " ) << ( (MODULE*) GetParent() )->GetReference(); text << _( ") of " ) << ( (MODULE*) GetParent() )->GetReference();
break; break;
case TYPEDRAWSEGMENT: 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; break;
case TYPETEXTE: case TYPETEXTE:
...@@ -65,7 +65,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const ...@@ -65,7 +65,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() ).Trim(); text << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim();
break; break;
case TYPETEXTEMODULE: case TYPETEXTEMODULE:
...@@ -128,7 +128,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const ...@@ -128,7 +128,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
} }
text << cp; 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 " ) text << _( " of " )
<< ( (MODULE*) GetParent() )->GetReference(); << ( (MODULE*) GetParent() )->GetReference();
break; break;
...@@ -145,7 +145,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const ...@@ -145,7 +145,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() ).Trim() text << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim()
<< wxT(" ") << _("Net:") << ((TRACK*)item)->GetNet() << wxT(" ") << _("Net:") << ((TRACK*)item)->GetNet()
<< wxT(" ") << _("Length:") << valeur_param( (int) ((TRACK*)item)->GetLength(), txt ); << wxT(" ") << _("Length:") << valeur_param( (int) ((TRACK*)item)->GetLength(), txt );
} }
...@@ -154,9 +154,10 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const ...@@ -154,9 +154,10 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
case TYPEZONE_CONTAINER: case TYPEZONE_CONTAINER:
text = _( "Zone Outline" ); text = _( "Zone Outline" );
{ {
ZONE_CONTAINER* area = (ZONE_CONTAINER*) this; ZONE_CONTAINER* area = (ZONE_CONTAINER*) this;
int ncont = area->m_Poly->GetContour(area->m_CornerSelection); int ncont = area->m_Poly->GetContour(area->m_CornerSelection);
if ( ncont ) text << wxT(" ") << _("(Cutout)"); if( ncont )
text << wxT(" ") << _("(Cutout)");
} }
text << wxT( " " ); text << wxT( " " );
{ {
...@@ -164,7 +165,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const ...@@ -164,7 +165,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
TimeStampText.Printf( wxT( "(%8.8X)" ), item->m_TimeStamp ); TimeStampText.Printf( wxT( "(%8.8X)" ), item->m_TimeStamp );
text << TimeStampText; text << TimeStampText;
} }
if ( ((ZONE_CONTAINER*) item)->GetNet() >= 0 ) if( ((ZONE_CONTAINER*) item)->GetNet() >= 0 )
{ {
net = aPcb->FindNet( ( (ZONE_CONTAINER*) item )->GetNet() ); net = aPcb->FindNet( ( (ZONE_CONTAINER*) item )->GetNet() );
if( net ) if( net )
...@@ -172,12 +173,12 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const ...@@ -172,12 +173,12 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
text << wxT( " [" ) << net->m_Netname << wxT( "]" ); 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( " [" ) << ( (ZONE_CONTAINER*) item )->m_Netname << wxT( "]" );
text << wxT(" <") << _("Not Found") << wxT(">"); text << wxT(" <") << _("Not Found") << wxT(">");
} }
text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim(); text << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim();
break; break;
case TYPEZONE: case TYPEZONE:
...@@ -193,7 +194,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const ...@@ -193,7 +194,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() ).Trim(); text << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim();
break; break;
case TYPEVIA: case TYPEVIA:
...@@ -221,8 +222,8 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const ...@@ -221,8 +222,8 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
int topLayer; int topLayer;
int botLayer; int botLayer;
via->ReturnLayerPair( &topLayer, &botLayer ); via->ReturnLayerPair( &topLayer, &botLayer );
text << _( " on " ) << ReturnPcbLayerName( topLayer).Trim() << wxT(" <-> ") text << _( " on " ) << aPcb->GetLayerName( topLayer).Trim() << wxT(" <-> ")
<< ReturnPcbLayerName( botLayer ).Trim(); << aPcb->GetLayerName( botLayer ).Trim();
} }
} }
break; break;
...@@ -238,7 +239,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const ...@@ -238,7 +239,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
case TYPEMIRE: case TYPEMIRE:
valeur_param( ((MIREPCB*)item)->m_Size, msg ); 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 << wxT( " " ) << _( "size" ) << wxT( " " ) << msg
; ;
break; break;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
/* class EDGE_MODULE ( contour de module ) */ /* class EDGE_MODULE ( contour de module ) */
/******************************************/ /******************************************/
EDGE_MODULE::EDGE_MODULE( MODULE* parent ) : EDGE_MODULE::EDGE_MODULE( MODULE* parent ) :
BOARD_ITEM( parent, TYPEEDGEMODULE ) BOARD_ITEM( parent, TYPEEDGEMODULE )
{ {
m_Width = 0; m_Width = 0;
...@@ -164,10 +164,10 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -164,10 +164,10 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
zoom = screen->GetZoom(); zoom = screen->GetZoom();
type_trace = m_Shape; type_trace = m_Shape;
ux0 = m_Start.x - offset.x; ux0 = m_Start.x - offset.x;
uy0 = m_Start.y - offset.y; uy0 = m_Start.y - offset.y;
dx = m_End.x - offset.x; dx = m_End.x - offset.x;
dy = m_End.y - offset.y; dy = m_End.y - offset.y;
...@@ -269,7 +269,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -269,7 +269,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
} }
// see class_edge_mod.h // see class_edge_mod.h
void EDGE_MODULE::Display_Infos( WinEDA_DrawFrame* frame ) void EDGE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
{ {
wxString bufcar; wxString bufcar;
...@@ -277,7 +277,11 @@ void EDGE_MODULE::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -277,7 +277,11 @@ void EDGE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
MODULE* module = (MODULE*) m_Parent; MODULE* module = (MODULE*) m_Parent;
if( !module ) if( !module )
return; return;
BOARD* board = (BOARD*) module->m_Parent;
if( !board )
return;
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
Affiche_1_Parametre( frame, 1, _( "Seg" ), wxEmptyString, DARKCYAN ); Affiche_1_Parametre( frame, 1, _( "Seg" ), wxEmptyString, DARKCYAN );
...@@ -288,10 +292,9 @@ void EDGE_MODULE::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -288,10 +292,9 @@ void EDGE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
Affiche_1_Parametre( frame, 24, _( "TimeStamp" ), bufcar, BROWN ); 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" ), Affiche_1_Parametre( frame, 44, _( "Seg Layer" ), board->GetLayerName( module->GetLayer() ), RED );
ReturnPcbLayerName( module->GetLayer() ), RED );
valeur_param( m_Width, bufcar ); valeur_param( m_Width, bufcar );
Affiche_1_Parametre( frame, 54, _( "Width" ), bufcar, BLUE ); Affiche_1_Parametre( frame, 54, _( "Width" ), bufcar, BLUE );
...@@ -334,7 +337,7 @@ bool EDGE_MODULE::Save( FILE* aFile ) const ...@@ -334,7 +337,7 @@ bool EDGE_MODULE::Save( FILE* aFile ) const
m_End0.x, m_End0.y, m_End0.x, m_End0.y,
m_PolyCount, m_PolyCount,
m_Width, m_Layer ); m_Width, m_Layer );
int* pInt; int* pInt;
pInt = m_PolyList; pInt = m_PolyList;
for( int i=0; i<m_PolyCount; ++i, pInt+=2 ) for( int i=0; i<m_PolyCount; ++i, pInt+=2 )
...@@ -343,16 +346,16 @@ bool EDGE_MODULE::Save( FILE* aFile ) const ...@@ -343,16 +346,16 @@ bool EDGE_MODULE::Save( FILE* aFile ) const
default: default:
// future: throw an exception here // future: throw an exception here
#if defined(DEBUG) #if defined(DEBUG)
printf( "EDGE_MODULE::Save(): unexpected m_Shape: %d\n", m_Shape ); printf( "EDGE_MODULE::Save(): unexpected m_Shape: %d\n", m_Shape );
#endif #endif
break; break;
} }
return (ret > 5); return (ret > 5);
} }
/****************************************************************/ /****************************************************************/
...@@ -368,7 +371,7 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File, ...@@ -368,7 +371,7 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File,
* - Segment (line) * - Segment (line)
* - Arc * - Arc
* - Polygon * - Polygon
* *
*/ */
{ {
int ii, * ptr; int ii, * ptr;
...@@ -459,12 +462,12 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File, ...@@ -459,12 +462,12 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File,
if( m_Width > MAX_WIDTH ) if( m_Width > MAX_WIDTH )
m_Width = MAX_WIDTH; m_Width = MAX_WIDTH;
// Check for a reasonnable layer: // Check for a reasonnable layer:
// m_Layer must be >= FIRST_NON_COPPER_LAYER, but because microwave footprints // 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. // 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 // @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) ) if ( (m_Layer < 0) || (m_Layer > LAST_NON_COPPER_LAYER) )
m_Layer = SILKSCREEN_N_CMP; m_Layer = SILKSCREEN_N_CMP;
return error; return error;
} }
...@@ -479,23 +482,23 @@ bool EDGE_MODULE::HitTest( const wxPoint& ref_pos ) ...@@ -479,23 +482,23 @@ bool EDGE_MODULE::HitTest( const wxPoint& ref_pos )
{ {
int uxf, uyf; int uxf, uyf;
int rayon, dist; int rayon, dist;
int dx, dy, spot_cX, spot_cY; int dx, dy, spot_cX, spot_cY;
int ux0, uy0; int ux0, uy0;
ux0 = m_Start.x; ux0 = m_Start.x;
uy0 = m_Start.y; uy0 = m_Start.y;
uxf = m_End.x; uxf = m_End.x;
uyf = m_End.y; uyf = m_End.y;
switch( m_Shape ) switch( m_Shape )
{ {
case S_SEGMENT: case S_SEGMENT:
/* recalcul des coordonnees avec ux0,uy0 = origine des coord. */ /* recalcul des coordonnees avec ux0,uy0 = origine des coord. */
spot_cX = ref_pos.x - ux0; spot_cX = ref_pos.x - ux0;
spot_cY = ref_pos.y - uy0; spot_cY = ref_pos.y - uy0;
dx = uxf - ux0; dx = uxf - ux0;
dy = uyf - uy0; dy = uyf - uy0;
if( DistanceTest( m_Width/2, dx, dy, spot_cX, spot_cY ) ) if( DistanceTest( m_Width/2, dx, dy, spot_cX, spot_cY ) )
return true; return true;
...@@ -522,7 +525,7 @@ bool EDGE_MODULE::HitTest( const wxPoint& ref_pos ) ...@@ -522,7 +525,7 @@ bool EDGE_MODULE::HitTest( const wxPoint& ref_pos )
if( endAngle > 3600 ) if( endAngle > 3600 )
{ {
stAngle -= 3600; stAngle -= 3600;
endAngle -= 3600; endAngle -= 3600;
} }
...@@ -532,7 +535,7 @@ bool EDGE_MODULE::HitTest( const wxPoint& ref_pos ) ...@@ -532,7 +535,7 @@ bool EDGE_MODULE::HitTest( const wxPoint& ref_pos )
break; break;
} }
return false; // an unknown m_Shape also returns false return false; // an unknown m_Shape also returns false
} }
...@@ -540,14 +543,14 @@ bool EDGE_MODULE::HitTest( const wxPoint& ref_pos ) ...@@ -540,14 +543,14 @@ bool EDGE_MODULE::HitTest( const wxPoint& ref_pos )
/** /**
* 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.
* @param nestLevel An aid to prettier tree indenting, and is the level * @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree. * of nesting of this object within the overall tree.
* @param os The ostream& to output to. * @param os The ostream& to output to.
*/ */
void EDGE_MODULE::Show( int nestLevel, std::ostream& os ) void EDGE_MODULE::Show( int nestLevel, std::ostream& os )
{ {
const char* cp; const char* cp;
switch( m_Shape ) switch( m_Shape )
{ {
case S_SEGMENT: cp = "line"; break; case S_SEGMENT: cp = "line"; break;
...@@ -561,14 +564,14 @@ void EDGE_MODULE::Show( int nestLevel, std::ostream& os ) ...@@ -561,14 +564,14 @@ void EDGE_MODULE::Show( int nestLevel, std::ostream& os )
case S_POLYGON: cp = "polygon"; break; case S_POLYGON: cp = "polygon"; break;
default: cp = "??EDGE??"; break; default: cp = "??EDGE??"; break;
} }
// for now, make it look like XML: // for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
" type=\"" << cp << "\">"; " type=\"" << cp << "\">";
os << " <start" << m_Start0 << "/>"; os << " <start" << m_Start0 << "/>";
os << " <end" << m_End0 << "/>"; os << " <end" << m_End0 << "/>";
os << " </" << GetClass().Lower().mb_str() << ">\n"; os << " </" << GetClass().Lower().mb_str() << ">\n";
} }
......
...@@ -58,7 +58,7 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset ...@@ -58,7 +58,7 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset
/*************************************************/ /*************************************************/
/* Constructeur de la classe MODULE */ /* Constructeur de la classe MODULE */
MODULE::MODULE( BOARD* parent ) : MODULE::MODULE( BOARD* parent ) :
BOARD_ITEM( parent, TYPEMODULE ) BOARD_ITEM( parent, TYPEMODULE )
{ {
m_Pads = NULL; m_Pads = NULL;
...@@ -142,7 +142,7 @@ void MODULE::Copy( MODULE* Module ) ...@@ -142,7 +142,7 @@ void MODULE::Copy( MODULE* Module )
m_CntRot90 = Module->m_CntRot90; m_CntRot90 = Module->m_CntRot90;
m_CntRot180 = Module->m_CntRot180; m_CntRot180 = Module->m_CntRot180;
m_LastEdit_Time = Module->m_LastEdit_Time; 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(); m_TimeStamp = GetTimeStamp();
/* Copy des structures auxiliaires: Reference et value */ /* Copy des structures auxiliaires: Reference et value */
...@@ -210,9 +210,9 @@ void MODULE::Copy( MODULE* Module ) ...@@ -210,9 +210,9 @@ void MODULE::Copy( MODULE* Module )
/* Copy des elements complementaires Drawings 3D */ /* Copy des elements complementaires Drawings 3D */
m_3D_Drawings->Copy( Module->m_3D_Drawings ); m_3D_Drawings->Copy( Module->m_3D_Drawings );
Struct3D_Master* Struct3D, * NewStruct3D, * CurrStruct3D; Struct3D_Master* Struct3D, * NewStruct3D, * CurrStruct3D;
Struct3D = (Struct3D_Master*) Module->m_3D_Drawings->Pnext; Struct3D = (Struct3D_Master*) Module->m_3D_Drawings->Pnext;
CurrStruct3D = m_3D_Drawings; CurrStruct3D = m_3D_Drawings;
for( ; Struct3D != NULL; Struct3D = (Struct3D_Master*) Struct3D->Pnext ) for( ; Struct3D != NULL; Struct3D = (Struct3D_Master*) Struct3D->Pnext )
...@@ -350,10 +350,10 @@ bool MODULE::Save( FILE* aFile ) const ...@@ -350,10 +350,10 @@ bool MODULE::Save( FILE* aFile ) const
{ {
char statusTxt[8]; char statusTxt[8];
BOARD_ITEM* item; BOARD_ITEM* item;
if( GetState( DELETED ) ) if( GetState( DELETED ) )
return true; return true;
bool rc = false; bool rc = false;
fprintf( aFile, "$MODULE %s\n", CONV_TO_UTF8( m_LibRef ) ); fprintf( aFile, "$MODULE %s\n", CONV_TO_UTF8( m_LibRef ) );
...@@ -364,7 +364,7 @@ bool MODULE::Save( FILE* aFile ) const ...@@ -364,7 +364,7 @@ bool MODULE::Save( FILE* aFile ) const
statusTxt[0] = 'F'; statusTxt[0] = 'F';
else else
statusTxt[0] = '~'; statusTxt[0] = '~';
if( m_ModuleStatus & MODULE_is_PLACED ) if( m_ModuleStatus & MODULE_is_PLACED )
statusTxt[1] = 'P'; statusTxt[1] = 'P';
else else
...@@ -388,7 +388,7 @@ bool MODULE::Save( FILE* aFile ) const ...@@ -388,7 +388,7 @@ bool MODULE::Save( FILE* aFile ) const
} }
fprintf( aFile, "Sc %8.8lX\n", m_TimeStamp ); 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 ); fprintf( aFile, "Op %X %X 0\n", m_CntRot90, m_CntRot180 );
// attributes // attributes
...@@ -405,7 +405,7 @@ bool MODULE::Save( FILE* aFile ) const ...@@ -405,7 +405,7 @@ bool MODULE::Save( FILE* aFile ) const
// save reference // save reference
if( !m_Reference->Save( aFile ) ) if( !m_Reference->Save( aFile ) )
goto out; goto out;
// save value // save value
if( !m_Value->Save( aFile ) ) if( !m_Value->Save( aFile ) )
goto out; goto out;
...@@ -422,9 +422,9 @@ bool MODULE::Save( FILE* aFile ) const ...@@ -422,9 +422,9 @@ bool MODULE::Save( FILE* aFile ) const
break; break;
default: default:
#if defined(DEBUG) #if defined(DEBUG)
printf( "MODULE::Save() ignoring type %d\n", item->Type() ); printf( "MODULE::Save() ignoring type %d\n", item->Type() );
#endif #endif
break; break;
} }
} }
...@@ -438,12 +438,12 @@ bool MODULE::Save( FILE* aFile ) const ...@@ -438,12 +438,12 @@ bool MODULE::Save( FILE* aFile ) const
Write_3D_Descr( aFile ); Write_3D_Descr( aFile );
fprintf( aFile, "$EndMODULE %s\n", CONV_TO_UTF8( m_LibRef ) ); fprintf( aFile, "$EndMODULE %s\n", CONV_TO_UTF8( m_LibRef ) );
rc = true; rc = true;
out: out:
return rc; return rc;
} }
/***************************************/ /***************************************/
int MODULE::Write_3D_Descr( FILE* File ) const int MODULE::Write_3D_Descr( FILE* File ) const
...@@ -638,7 +638,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) ...@@ -638,7 +638,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
case 'S': case 'S':
sscanf( PtLine, " %lX", &m_TimeStamp ); sscanf( PtLine, " %lX", &m_TimeStamp );
break; break;
case 'O': /* (Op)tions de placement auto */ case 'O': /* (Op)tions de placement auto */
itmp1 = itmp2 = 0; itmp1 = itmp2 = 0;
...@@ -657,19 +657,19 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) ...@@ -657,19 +657,19 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
m_CntRot90 |= itmp1 << 4; m_CntRot90 |= itmp1 << 4;
break; break;
case 'A': case 'A':
if(Line[1] == 't'){ if(Line[1] == 't'){
/* At = (At)tributs du module */ /* At = (At)tributs du module */
if( strstr( PtLine, "SMD" ) ) if( strstr( PtLine, "SMD" ) )
m_Attributs |= MOD_CMS; m_Attributs |= MOD_CMS;
if( strstr( PtLine, "VIRTUAL" ) ) if( strstr( PtLine, "VIRTUAL" ) )
m_Attributs |= MOD_VIRTUAL; m_Attributs |= MOD_VIRTUAL;
} }
if(Line[1] == 'R'){ if(Line[1] == 'R'){
//alternate reference, e.g. /478C2408/478AD1B6 //alternate reference, e.g. /478C2408/478AD1B6
sscanf( PtLine, " %s", BufLine ); sscanf( PtLine, " %s", BufLine );
m_Path = CONV_FROM_UTF8(BufLine); m_Path = CONV_FROM_UTF8(BufLine);
} }
break; break;
case 'T': /* lecture des textes modules */ case 'T': /* lecture des textes modules */
...@@ -718,8 +718,8 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) ...@@ -718,8 +718,8 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
else if( layer == CMP_N ) else if( layer == CMP_N )
layer = SILKSCREEN_N_CMP; layer = SILKSCREEN_N_CMP;
DrawText->SetLayer( layer ); DrawText->SetLayer( layer );
/* calcul de la position vraie */ /* calcul de la position vraie */
DrawText->SetDrawCoord(); DrawText->SetDrawCoord();
/* Lecture de la chaine "text" */ /* Lecture de la chaine "text" */
...@@ -781,22 +781,22 @@ void MODULE::SetPosition( const wxPoint& newpos ) ...@@ -781,22 +781,22 @@ void MODULE::SetPosition( const wxPoint& newpos )
int deltaY = newpos.y - m_Pos.y; int deltaY = newpos.y - m_Pos.y;
/* deplacement de l'ancre */ /* deplacement de l'ancre */
m_Pos.x += deltaX; m_Pos.x += deltaX;
m_Pos.y += deltaY; m_Pos.y += deltaY;
/* deplacement de la reference */ /* deplacement de la reference */
m_Reference->m_Pos.x += deltaX; m_Reference->m_Pos.x += deltaX;
m_Reference->m_Pos.y += deltaY; m_Reference->m_Pos.y += deltaY;
/* deplacement de la Valeur */ /* deplacement de la Valeur */
m_Value->m_Pos.x += deltaX; m_Value->m_Pos.x += deltaX;
m_Value->m_Pos.y += deltaY; m_Value->m_Pos.y += deltaY;
/* deplacement des pastilles */ /* deplacement des pastilles */
D_PAD* pad = m_Pads; D_PAD* pad = m_Pads;
for( ; pad != NULL; pad = (D_PAD*) pad->Pnext ) for( ; pad != NULL; pad = (D_PAD*) pad->Pnext )
{ {
pad->m_Pos.x += deltaX; pad->m_Pos.x += deltaX;
pad->m_Pos.y += deltaY; pad->m_Pos.y += deltaY;
} }
...@@ -816,7 +816,7 @@ void MODULE::SetPosition( const wxPoint& newpos ) ...@@ -816,7 +816,7 @@ void MODULE::SetPosition( const wxPoint& newpos )
case TYPETEXTEMODULE: case TYPETEXTEMODULE:
{ {
TEXTE_MODULE* pt_texte = (TEXTE_MODULE*) PtStruct; TEXTE_MODULE* pt_texte = (TEXTE_MODULE*) PtStruct;
pt_texte->m_Pos.x += deltaX; pt_texte->m_Pos.x += deltaX;
pt_texte->m_Pos.y += deltaY; pt_texte->m_Pos.y += deltaY;
break; break;
} }
...@@ -1048,6 +1048,7 @@ void MODULE::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -1048,6 +1048,7 @@ void MODULE::Display_Infos( WinEDA_DrawFrame* frame )
int pos; int pos;
bool flag = FALSE; bool flag = FALSE;
wxString msg; wxString msg;
BOARD* board = (BOARD*) m_Parent;
frame->MsgPanel->EraseMsgBox(); /* Effacement de la zone message */ frame->MsgPanel->EraseMsgBox(); /* Effacement de la zone message */
if( frame->m_Ident != PCB_FRAME ) if( frame->m_Ident != PCB_FRAME )
...@@ -1076,14 +1077,15 @@ void MODULE::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -1076,14 +1077,15 @@ void MODULE::Display_Infos( WinEDA_DrawFrame* frame )
} }
pos += 12; 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; pos += 6;
EDA_BaseStruct* PtStruct = m_Pads; EDA_BaseStruct* PtStruct = m_Pads;
nbpad = 0; nbpad = 0;
while( PtStruct ) while( PtStruct )
{ {
nbpad++; PtStruct = PtStruct->Pnext; nbpad++;
PtStruct = PtStruct->Pnext;
} }
msg.Printf( wxT( "%d" ), nbpad ); msg.Printf( wxT( "%d" ), nbpad );
...@@ -1126,22 +1128,22 @@ bool MODULE::HitTest( const wxPoint& refPos ) ...@@ -1126,22 +1128,22 @@ bool MODULE::HitTest( const wxPoint& refPos )
/* Calcul des coord souris dans le repere module */ /* Calcul des coord souris dans le repere module */
int spot_cX = refPos.x - m_Pos.x; int spot_cX = refPos.x - m_Pos.x;
int spot_cY = refPos.y - m_Pos.y; int spot_cY = refPos.y - m_Pos.y;
RotatePoint( &spot_cX, &spot_cY, -m_Orient ); RotatePoint( &spot_cX, &spot_cY, -m_Orient );
/* la souris est-elle dans ce rectangle : */ /* la souris est-elle dans ce rectangle : */
if( m_BoundaryBox.Inside( spot_cX, spot_cY ) ) if( m_BoundaryBox.Inside( spot_cX, spot_cY ) )
return true; return true;
/* no /* no
// The GENERAL_COLLECTOR needs these two tests in order to find a MODULE // The GENERAL_COLLECTOR needs these two tests in order to find a MODULE
// when the user clicks on its text. Keep these 2, needed in OnRightClick(). // when the user clicks on its text. Keep these 2, needed in OnRightClick().
if( m_Reference->HitTest( refPos ) ) if( m_Reference->HitTest( refPos ) )
return true; return true;
if( m_Value->HitTest( refPos ) ) if( m_Value->HitTest( refPos ) )
return true; return true;
*/ */
return false; return false;
} }
...@@ -1171,18 +1173,18 @@ bool MODULE::HitTest( EDA_Rect& refArea ) ...@@ -1171,18 +1173,18 @@ bool MODULE::HitTest( EDA_Rect& refArea )
} }
// see class_module.h // see class_module.h
SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] ) const KICAD_T scanTypes[] )
{ {
KICAD_T stype; KICAD_T stype;
SEARCH_RESULT result = SEARCH_CONTINUE; SEARCH_RESULT result = SEARCH_CONTINUE;
const KICAD_T* p = scanTypes; const KICAD_T* p = scanTypes;
bool done = false; bool done = false;
#if 0 && defined(DEBUG) #if 0 && defined(DEBUG)
std::cout << GetClass().mb_str() << ' '; std::cout << GetClass().mb_str() << ' ';
#endif #endif
while( !done ) while( !done )
{ {
...@@ -1193,23 +1195,23 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, ...@@ -1193,23 +1195,23 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
result = inspector->Inspect( this, testData ); // inspect me result = inspector->Inspect( this, testData ); // inspect me
++p; ++p;
break; break;
case TYPEPAD: case TYPEPAD:
result = IterateForward( m_Pads, inspector, testData, p ); result = IterateForward( m_Pads, inspector, testData, p );
++p; ++p;
break; break;
case TYPETEXTEMODULE: case TYPETEXTEMODULE:
result = inspector->Inspect( m_Reference, testData ); result = inspector->Inspect( m_Reference, testData );
if( result == SEARCH_QUIT ) if( result == SEARCH_QUIT )
break; break;
result = inspector->Inspect( m_Value, testData ); result = inspector->Inspect( m_Value, testData );
if( result == SEARCH_QUIT ) if( result == SEARCH_QUIT )
break; break;
// m_Drawings can hold TYPETEXTMODULE also, so fall thru // m_Drawings can hold TYPETEXTMODULE also, so fall thru
case TYPEEDGEMODULE: case TYPEEDGEMODULE:
result = IterateForward( m_Drawings, inspector, testData, p ); result = IterateForward( m_Drawings, inspector, testData, p );
// skip over any types handled in the above call. // skip over any types handled in the above call.
...@@ -1225,17 +1227,17 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, ...@@ -1225,17 +1227,17 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
break; break;
} }
break; break;
default: default:
done = true; done = true;
break; break;
} }
if( result == SEARCH_QUIT ) if( result == SEARCH_QUIT )
break; break;
} }
return result; return result;
} }
...@@ -1243,24 +1245,26 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, ...@@ -1243,24 +1245,26 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
/** /**
* 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.
* @param nestLevel An aid to prettier tree indenting, and is the level * @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree. * of nesting of this object within the overall tree.
* @param os The ostream& to output to. * @param os The ostream& to output to.
*/ */
void MODULE::Show( int nestLevel, std::ostream& os ) void MODULE::Show( int nestLevel, std::ostream& os )
{ {
BOARD* board = (BOARD*) m_Parent;
// for now, make it look like XML, expand on this later. // for now, make it look like XML, expand on this later.
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
" ref=\"" << m_Reference->m_Text.mb_str() << '"' << " ref=\"" << m_Reference->m_Text.mb_str() << '"' <<
" value=\"" << m_Value->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"; ">\n";
NestedSpace( nestLevel+1, os ) << NestedSpace( nestLevel+1, os ) <<
"<boundingBox" << m_BoundaryBox.m_Pos << m_BoundaryBox.m_Size << "/>\n"; "<boundingBox" << m_BoundaryBox.m_Pos << m_BoundaryBox.m_Size << "/>\n";
NestedSpace( nestLevel+1, os ) << "<orientation tenths=\"" << m_Orient << "\"/>\n"; NestedSpace( nestLevel+1, os ) << "<orientation tenths=\"" << m_Orient << "\"/>\n";
EDA_BaseStruct* p; EDA_BaseStruct* p;
NestedSpace( nestLevel+1, os ) << "<mpads>\n"; NestedSpace( nestLevel+1, os ) << "<mpads>\n";
...@@ -1268,19 +1272,19 @@ void MODULE::Show( int nestLevel, std::ostream& os ) ...@@ -1268,19 +1272,19 @@ void MODULE::Show( int nestLevel, std::ostream& os )
for( ; p; p = p->Pnext ) for( ; p; p = p->Pnext )
p->Show( nestLevel+2, os ); p->Show( nestLevel+2, os );
NestedSpace( nestLevel+1, os ) << "</mpads>\n"; NestedSpace( nestLevel+1, os ) << "</mpads>\n";
NestedSpace( nestLevel+1, os ) << "<mdrawings>\n"; NestedSpace( nestLevel+1, os ) << "<mdrawings>\n";
p = m_Drawings; p = m_Drawings;
for( ; p; p = p->Pnext ) for( ; p; p = p->Pnext )
p->Show( nestLevel+2, os ); p->Show( nestLevel+2, os );
NestedSpace( nestLevel+1, os ) << "</mdrawings>\n"; NestedSpace( nestLevel+1, os ) << "</mdrawings>\n";
p = m_Son; p = m_Son;
for( ; p; p = p->Pnext ) for( ; p; p = p->Pnext )
{ {
p->Show( nestLevel+1, os ); p->Show( nestLevel+1, os );
} }
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n"; NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
} }
......
...@@ -241,8 +241,8 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -241,8 +241,8 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
WinEDA_BasePcbFrame* frame = NULL; WinEDA_BasePcbFrame* frame = NULL;
wxPoint shape_pos; wxPoint shape_pos;
PCB_SCREEN* screen = panel ? PCB_SCREEN* screen = panel ?
(PCB_SCREEN*) panel->m_Parent->m_CurrentScreen : (PCB_SCREEN*) panel->m_Parent->m_CurrentScreen :
(PCB_SCREEN*) ActiveScreen; (PCB_SCREEN*) ActiveScreen;
if ( panel ) // Use current frame setting if ( panel ) // Use current frame setting
...@@ -263,7 +263,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -263,7 +263,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
if( m_Masque_Layer & CMP_LAYER ) if( m_Masque_Layer & CMP_LAYER )
color = g_PadCMPColor; color = g_PadCMPColor;
if( m_Masque_Layer & CUIVRE_LAYER ) if( m_Masque_Layer & CUIVRE_LAYER )
color |= g_PadCUColor; color |= g_PadCUColor;
...@@ -330,40 +330,40 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -330,40 +330,40 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
} }
// if PAD_SMD pad and high contrast mode // if PAD_SMD pad and high contrast mode
if( m_Attribut==PAD_SMD && DisplayOpt.ContrastModeDisplay ) if( m_Attribut==PAD_SMD && DisplayOpt.ContrastModeDisplay )
{ {
// when routing tracks // when routing tracks
if( frame && frame->m_ID_current_state == ID_TRACK_BUTT ) if( frame && frame->m_ID_current_state == ID_TRACK_BUTT )
{ {
int routeTop = screen->m_Route_Layer_TOP; int routeTop = screen->m_Route_Layer_TOP;
int routeBot = screen->m_Route_Layer_BOTTOM; int routeBot = screen->m_Route_Layer_BOTTOM;
// if routing between copper and component layers, // if routing between copper and component layers,
// or the current layer is one of said 2 external copper layers, // or the current layer is one of said 2 external copper layers,
// then highlight only the current layer. // then highlight only the current layer.
if( ((1<<routeTop) | (1<<routeBot)) == (CUIVRE_LAYER | CMP_LAYER) if( ((1<<routeTop) | (1<<routeBot)) == (CUIVRE_LAYER | CMP_LAYER)
|| ((1<<screen->m_Active_Layer) & (CUIVRE_LAYER | CMP_LAYER)) ) || ((1<<screen->m_Active_Layer) & (CUIVRE_LAYER | CMP_LAYER)) )
{ {
if( !IsOnLayer( screen->m_Active_Layer ) ) if( !IsOnLayer( screen->m_Active_Layer ) )
{ {
color &= ~MASKCOLOR; color &= ~MASKCOLOR;
color |= DARKDARKGRAY; color |= DARKDARKGRAY;
} }
} }
// else routing between an internal signal layer and some other layer. // else routing between an internal signal layer and some other layer.
// grey out all PAD_SMD pads not on current or the single selected // grey out all PAD_SMD pads not on current or the single selected
// external layer. // external layer.
else if( !IsOnLayer( screen->m_Active_Layer ) else if( !IsOnLayer( screen->m_Active_Layer )
&& !IsOnLayer( routeTop ) && !IsOnLayer( routeTop )
&& !IsOnLayer( routeBot ) ) && !IsOnLayer( routeBot ) )
{ {
color &= ~MASKCOLOR; color &= ~MASKCOLOR;
color |= DARKDARKGRAY; color |= DARKDARKGRAY;
} }
} }
// when not edting tracks, show PAD_SMD components not on active layer as greyed out // when not edting tracks, show PAD_SMD components not on active layer as greyed out
else else
{ {
...@@ -371,7 +371,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -371,7 +371,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
{ {
color &= ~MASKCOLOR; color &= ~MASKCOLOR;
color |= DARKDARKGRAY; color |= DARKDARKGRAY;
} }
} }
} }
...@@ -382,7 +382,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -382,7 +382,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
else else
color |= HIGHT_LIGHT_FLAG; color |= HIGHT_LIGHT_FLAG;
} }
if( color & HIGHT_LIGHT_FLAG ) if( color & HIGHT_LIGHT_FLAG )
color = ColorRefs[color & MASKCOLOR].m_LightColor; color = ColorRefs[color & MASKCOLOR].m_LightColor;
...@@ -401,7 +401,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -401,7 +401,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
dy = dy0 = m_Size.y >> 1; /* demi dim dx et dy */ dy = dy0 = m_Size.y >> 1; /* demi dim dx et dy */
angle = m_Orient; angle = m_Orient;
bool DisplayIsol = DisplayOpt.DisplayPadIsol; bool DisplayIsol = DisplayOpt.DisplayPadIsol;
if( ( m_Masque_Layer & ALL_CU_LAYERS ) == 0 ) if( ( m_Masque_Layer & ALL_CU_LAYERS ) == 0 )
DisplayIsol = FALSE; DisplayIsol = FALSE;
...@@ -430,13 +430,13 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -430,13 +430,13 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
/* calcul de l'entraxe de l'ellipse */ /* calcul de l'entraxe de l'ellipse */
if( dx > dy ) /* ellipse horizontale */ if( dx > dy ) /* ellipse horizontale */
{ {
delta_cx = dx - dy; delta_cx = dx - dy;
delta_cy = 0; delta_cy = 0;
rotdx = m_Size.y; rotdx = m_Size.y;
} }
else /* ellipse verticale */ else /* ellipse verticale */
{ {
delta_cx = 0; delta_cx = 0;
delta_cy = dy - dx; delta_cy = dy - dx;
rotdx = m_Size.x; rotdx = m_Size.x;
} }
...@@ -459,7 +459,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -459,7 +459,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
if( DisplayIsol ) if( DisplayIsol )
{ {
rotdx = rotdx + g_DesignSettings.m_TrackClearence + g_DesignSettings.m_TrackClearence; rotdx = rotdx + g_DesignSettings.m_TrackClearence + g_DesignSettings.m_TrackClearence;
GRCSegm( &panel->m_ClipBox, DC, ux0 + delta_cx, uy0 + delta_cy, GRCSegm( &panel->m_ClipBox, DC, ux0 + delta_cx, uy0 + delta_cy,
ux0 - delta_cx, uy0 - delta_cy, ux0 - delta_cx, uy0 - delta_cy,
rotdx, color ); rotdx, color );
...@@ -496,9 +496,9 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -496,9 +496,9 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
if( DisplayIsol ) if( DisplayIsol )
{ {
dx += g_DesignSettings.m_TrackClearence; dx += g_DesignSettings.m_TrackClearence;
dy += g_DesignSettings.m_TrackClearence; dy += g_DesignSettings.m_TrackClearence;
coord[0].x = -dx - ddy; coord[0].x = -dx - ddy;
coord[0].y = dy + ddx; coord[0].y = dy + ddx;
...@@ -536,7 +536,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -536,7 +536,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
if( fillpad && hole ) if( fillpad && hole )
{ {
color = g_IsPrinting ? WHITE : BLACK; // ou DARKGRAY; color = g_IsPrinting ? WHITE : BLACK; // ou DARKGRAY;
if( draw_mode != GR_XOR ) if( draw_mode != GR_XOR )
GRSetDrawMode( DC, GR_COPY ); GRSetDrawMode( DC, GR_COPY );
else else
...@@ -552,7 +552,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -552,7 +552,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
case PAD_OVAL: case PAD_OVAL:
dx = m_Drill.x >> 1; dx = m_Drill.x >> 1;
dy = m_Drill.y >> 1; /* demi dim dx et dy */ dy = m_Drill.y >> 1; /* demi dim dx et dy */
/* calcul de l'entraxe de l'ellipse */ /* calcul de l'entraxe de l'ellipse */
if( m_Drill.x > m_Drill.y ) /* ellipse horizontale */ if( m_Drill.x > m_Drill.y ) /* ellipse horizontale */
{ {
...@@ -583,7 +583,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -583,7 +583,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
{ {
dx0 = MIN( dx0, dy0 ); dx0 = MIN( dx0, dy0 );
int nc_color = BLUE; int nc_color = BLUE;
if( m_Masque_Layer & CMP_LAYER ) /* Trace forme \ */ if( m_Masque_Layer & CMP_LAYER ) /* Trace forme \ */
GRLine( &panel->m_ClipBox, DC, cx0 - dx0, cy0 - dx0, GRLine( &panel->m_ClipBox, DC, cx0 - dx0, cy0 - dx0,
cx0 + dx0, cy0 + dx0, 0, nc_color ); cx0 + dx0, cy0 + dx0, 0, nc_color );
...@@ -741,7 +741,7 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum ) ...@@ -741,7 +741,7 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum )
int netcode; int netcode;
nn = sscanf( PtLine, "%d", &netcode ); nn = sscanf( PtLine, "%d", &netcode );
SetNet( netcode ); SetNet( netcode );
/* Lecture du netname */ /* Lecture du netname */
ReadDelimitedText( BufLine, PtLine, sizeof(BufLine) ); ReadDelimitedText( BufLine, PtLine, sizeof(BufLine) );
m_Netname = CONV_FROM_UTF8( StrPurge( BufLine ) ); m_Netname = CONV_FROM_UTF8( StrPurge( BufLine ) );
...@@ -799,7 +799,7 @@ bool D_PAD::Save( FILE* aFile ) const ...@@ -799,7 +799,7 @@ bool D_PAD::Save( FILE* aFile ) const
fprintf( aFile, "Sh \"%.4s\" %c %d %d %d %d %d\n", fprintf( aFile, "Sh \"%.4s\" %c %d %d %d %d %d\n",
m_Padname, cshape, m_Size.x, m_Size.y, m_Padname, cshape, m_Size.x, m_Size.y,
m_DeltaSize.x, m_DeltaSize.y, m_Orient ); m_DeltaSize.x, m_DeltaSize.y, m_Orient );
fprintf( aFile, "Dr %d %d %d", m_Drill.x, m_Offset.x, m_Offset.y ); fprintf( aFile, "Dr %d %d %d", m_Drill.x, m_Offset.x, m_Offset.y );
if( m_DrillShape == PAD_OVAL ) if( m_DrillShape == PAD_OVAL )
{ {
...@@ -840,7 +840,7 @@ bool D_PAD::Save( FILE* aFile ) const ...@@ -840,7 +840,7 @@ bool D_PAD::Save( FILE* aFile ) const
goto out; goto out;
rc = true; rc = true;
out: out:
return rc; return rc;
} }
...@@ -853,7 +853,7 @@ void D_PAD::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -853,7 +853,7 @@ void D_PAD::Display_Infos( WinEDA_DrawFrame* frame )
/* Affiche en bas d'ecran les caract de la pastille demandee */ /* Affiche en bas d'ecran les caract de la pastille demandee */
{ {
int ii; int ii;
MODULE* Module; MODULE* module;
wxString Line; wxString Line;
int pos = 1; int pos = 1;
...@@ -874,10 +874,10 @@ void D_PAD::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -874,10 +874,10 @@ void D_PAD::Display_Infos( WinEDA_DrawFrame* frame )
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
/* Recherche du module correspondant */ /* Recherche du module correspondant */
Module = (MODULE*) m_Parent; module = (MODULE*) m_Parent;
if( Module ) if( module )
{ {
wxString msg = Module->m_Reference->m_Text; wxString msg = module->GetReference();
Affiche_1_Parametre( frame, pos, _( "Module" ), msg, DARKCYAN ); Affiche_1_Parametre( frame, pos, _( "Module" ), msg, DARKCYAN );
ReturnStringPadName( Line ); ReturnStringPadName( Line );
pos += 8; pos += 8;
...@@ -894,6 +894,7 @@ void D_PAD::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -894,6 +894,7 @@ void D_PAD::Display_Infos( WinEDA_DrawFrame* frame )
#endif #endif
wxString LayerInfo; wxString LayerInfo;
ii = 0; ii = 0;
if( m_Masque_Layer & CUIVRE_LAYER ) if( m_Masque_Layer & CUIVRE_LAYER )
ii = 2; ii = 2;
...@@ -1002,7 +1003,7 @@ void D_PAD::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -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 ) if( module_orient )
Line.Printf( wxT( "%3.1f(+%3.1f)" ), Line.Printf( wxT( "%3.1f(+%3.1f)" ),
(float) (m_Orient - module_orient) / 10, (float) module_orient / 10 ); (float) (m_Orient - module_orient) / 10, (float) module_orient / 10 );
...@@ -1076,7 +1077,7 @@ bool D_PAD::HitTest( const wxPoint& ref_pos ) ...@@ -1076,7 +1077,7 @@ bool D_PAD::HitTest( const wxPoint& ref_pos )
/************************************************************/ /************************************************************/
int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp ) int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp )
/************************************************************/ /************************************************************/
{ {
int diff; int diff;
...@@ -1096,7 +1097,7 @@ int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp ) ...@@ -1096,7 +1097,7 @@ int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp )
if( (diff = padref->m_DeltaSize.y - padcmp->m_DeltaSize.y) ) if( (diff = padref->m_DeltaSize.y - padcmp->m_DeltaSize.y) )
return diff; return diff;
// @todo check if export_gencad still works: // @todo check if export_gencad still works:
// specctra_export needs this, but maybe export_gencad does not. added on Jan 24 2008 by Dick. // specctra_export needs this, but maybe export_gencad does not. added on Jan 24 2008 by Dick.
if( (diff = padref->m_Masque_Layer - padcmp->m_Masque_Layer) ) if( (diff = padref->m_Masque_Layer - padcmp->m_Masque_Layer) )
return diff; return diff;
......
...@@ -748,8 +748,9 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode ) ...@@ -748,8 +748,9 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode )
// see class_track.h // see class_track.h
void TRACK::Display_Infos( WinEDA_DrawFrame* frame ) void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
{ {
wxString msg; wxString msg;
int text_pos; int text_pos;
BOARD* board = ((WinEDA_PcbFrame*)frame)->m_Pcb;
#ifdef RATSNET_DEBUG #ifdef RATSNET_DEBUG
DbgDisplayTrackInfos( this ); DbgDisplayTrackInfos( this );
...@@ -779,11 +780,12 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -779,11 +780,12 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
/* Display NetName pour les segments de piste type cuivre */ /* Display NetName pour les segments de piste type cuivre */
text_pos += 15; text_pos += 15;
if( Type() == TYPETRACK if( Type() == TYPETRACK
|| Type() == TYPEZONE || Type() == TYPEZONE
|| Type() == TYPEVIA ) || Type() == TYPEVIA )
{ {
EQUIPOT* equipot = ( (WinEDA_PcbFrame*) frame )->m_Pcb->FindNet( GetNet() ); EQUIPOT* equipot = board->FindNet( GetNet() );
if( equipot ) if( equipot )
msg = equipot->m_Netname; msg = equipot->m_Netname;
...@@ -824,11 +826,11 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -824,11 +826,11 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
int top_layer, bottom_layer; int top_layer, bottom_layer;
Via->ReturnLayerPair( &top_layer, &bottom_layer ); Via->ReturnLayerPair( &top_layer, &bottom_layer );
msg = ReturnPcbLayerName( top_layer, TRUE ) + wxT( "/" ) msg = board->GetLayerName( top_layer ) + wxT( "/" )
+ ReturnPcbLayerName( bottom_layer, TRUE ); + board->GetLayerName( bottom_layer );
} }
else else
msg = ReturnPcbLayerName( m_Layer ); msg = board->GetLayerName( m_Layer );
text_pos += 5; text_pos += 5;
Affiche_1_Parametre( frame, text_pos, _( "Layer" ), msg, BROWN ); Affiche_1_Parametre( frame, text_pos, _( "Layer" ), msg, BROWN );
...@@ -978,13 +980,18 @@ void SEGVIA::Show( int nestLevel, std::ostream& os ) ...@@ -978,13 +980,18 @@ void SEGVIA::Show( int nestLevel, std::ostream& os )
int topLayer; int topLayer;
int botLayer; int botLayer;
BOARD* board = (BOARD*) m_Parent;
ReturnLayerPair( &topLayer, &botLayer ); ReturnLayerPair( &topLayer, &botLayer );
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
" type=\"" << cp << '"' << " type=\"" << cp << '"';
" layers=\"" << ReturnPcbLayerName( topLayer ).Trim().mb_str() << ","
<< ReturnPcbLayerName( botLayer ).Trim().mb_str() << '"' << if( board )
os << " layers=\"" << board->GetLayerName( topLayer ).Trim().mb_str() << ","
<< board->GetLayerName( botLayer ).Trim().mb_str() << '"';
os <<
" width=\"" << m_Width << '"' << " width=\"" << m_Width << '"' <<
" drill=\"" << GetDrillValue() << '"' << " drill=\"" << GetDrillValue() << '"' <<
" netcode=\"" << GetNet() << "\">" << " netcode=\"" << GetNet() << "\">" <<
......
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