added some conditional DEBUG code for showing the pcb object tree in simple XML format
This commit is contained in:
parent
02a2268f8a
commit
5748b79107
|
@ -18,8 +18,7 @@
|
|||
|
||||
|
||||
// DrawStructureType names for error messages only:
|
||||
static wxString DrawStructureTypeName[MAX_STRUCT_TYPE_ID + 1]
|
||||
= {
|
||||
static wxString DrawStructureTypeName[MAX_STRUCT_TYPE_ID + 1] = {
|
||||
wxT( "Not init" ),
|
||||
|
||||
wxT( "Pcb" ),
|
||||
|
@ -168,10 +167,9 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
|
|||
*/
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*********************************************/
|
||||
wxString EDA_BaseStruct::ReturnClassName( void )
|
||||
/*********************************************/
|
||||
|
@ -191,6 +189,48 @@ wxString EDA_BaseStruct::ReturnClassName( void )
|
|||
}
|
||||
|
||||
|
||||
|
||||
#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 EDA_BaseStruct::Show( int nestLevel, std::ostream& os )
|
||||
{
|
||||
// for now, make it look like XML:
|
||||
NestedSpace( nestLevel, os ) << '<' << ReturnClassName().mb_str() << ">\n";
|
||||
|
||||
EDA_BaseStruct* kid = m_Son;
|
||||
for( ; kid; kid = kid->Pnext )
|
||||
{
|
||||
kid->Show( nestLevel+1, os );
|
||||
}
|
||||
|
||||
NestedSpace( nestLevel, os ) << "</" << ReturnClassName().mb_str() << ">\n";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function NestedSpace
|
||||
* outputs nested space for pretty indenting.
|
||||
* @param nestLevel The nest count
|
||||
* @param os The ostream&, where to output
|
||||
* @return std::ostream& - for continuation.
|
||||
**/
|
||||
std::ostream& EDA_BaseStruct::NestedSpace( int nestLevel, std::ostream& os )
|
||||
{
|
||||
for( int i=0; i<nestLevel; ++i )
|
||||
os << ' '; // number of spaces here controls indent per nest level
|
||||
return os;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**********************************************************************************************/
|
||||
EDA_BaseLineStruct::EDA_BaseLineStruct( EDA_BaseStruct* StructFather, DrawStructureType idtype ) :
|
||||
EDA_BaseStruct( StructFather, idtype )
|
||||
|
@ -721,3 +761,4 @@ void DrawPickedStruct::DeleteWrapperList( void )
|
|||
delete wrapp_struct;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,11 @@
|
|||
#define BASE_STRUCT_H
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
#include <iostream> // needed for Show()
|
||||
#endif
|
||||
|
||||
|
||||
/* Id for class identification, at run time */
|
||||
enum DrawStructureType {
|
||||
TYPE_NOT_INIT = 0,
|
||||
|
@ -123,8 +128,30 @@ public:
|
|||
const wxPoint& offset,
|
||||
int draw_mode,
|
||||
int Color = -1 );
|
||||
|
||||
#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.
|
||||
*/
|
||||
virtual void Show( int nestLevel, std::ostream& os );
|
||||
|
||||
/**
|
||||
* Function NestedSpace
|
||||
* outputs nested space for pretty indenting.
|
||||
* @param nestLevel The nest count
|
||||
* @param os The ostream&, where to output
|
||||
* @return std::ostream& - for continuation.
|
||||
**/
|
||||
static std::ostream& NestedSpace( int nestLevel, std::ostream& os );
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Text justify:
|
||||
// Values -1,0,1 are used in computations, do not change them
|
||||
typedef enum {
|
||||
|
|
|
@ -176,15 +176,16 @@ public:
|
|||
EDA_BoardDesignSettings( void );
|
||||
};
|
||||
|
||||
|
||||
// Values for m_DisplayViaMode member:
|
||||
enum DisplayViaMode {
|
||||
VIA_HOLE_NOT_SHOW = 0,
|
||||
VIA_SPECIAL_HOLE_SHOW,
|
||||
ALL_VIA_HOLE_SHOW,
|
||||
OPT_VIA_HOLE_END
|
||||
|
||||
};
|
||||
|
||||
|
||||
class BOARD : public EDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
|
@ -230,6 +231,18 @@ public:
|
|||
|
||||
// Calcul du rectangle d'encadrement:
|
||||
bool ComputeBoundaryBox( void );
|
||||
|
||||
|
||||
#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.
|
||||
*/
|
||||
virtual void Show( int nestLevel, std::ostream& os );
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -254,3 +254,36 @@ bool BOARD::ComputeBoundaryBox( void )
|
|||
|
||||
return Has_Items;
|
||||
}
|
||||
|
||||
|
||||
#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 BOARD::Show( int nestLevel, std::ostream& os )
|
||||
{
|
||||
// for now, make it look like XML:
|
||||
NestedSpace( nestLevel, os ) << '<' << ReturnClassName().mb_str() << ">\n";
|
||||
|
||||
// specialization of the output:
|
||||
EDA_BaseStruct* p = m_Modules;
|
||||
for( ; p; p = p->Pnext )
|
||||
p->Show( nestLevel+1, os );
|
||||
|
||||
p = m_Drawings;
|
||||
for( ; p; p = p->Pnext )
|
||||
p->Show( nestLevel+1, os );
|
||||
|
||||
EDA_BaseStruct* kid = m_Son;
|
||||
for( ; kid; kid = kid->Pnext )
|
||||
{
|
||||
kid->Show( nestLevel+1, os );
|
||||
}
|
||||
|
||||
NestedSpace( nestLevel, os ) << "</" << ReturnClassName().mb_str() << ">\n";
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -29,9 +29,10 @@
|
|||
void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int dim_ancre, int draw_mode )
|
||||
/*********************************************************************************/
|
||||
|
||||
/* trace de l'ancre (croix verticale)
|
||||
(doit etre fait apres les pads,
|
||||
car le trace du trou efface tout donc peut etre l'ancre */
|
||||
* (doit etre fait apres les pads,
|
||||
* car le trace du trou efface tout donc peut etre l'ancre */
|
||||
{
|
||||
int zoom = panel->GetZoom();
|
||||
int anchor_size = dim_ancre * zoom;
|
||||
|
@ -78,6 +79,7 @@ MODULE::MODULE(BOARD * parent): EDA_BaseStruct( parent, TYPEMODULE)
|
|||
m_3D_Drawings = new Struct3D_Master( this );
|
||||
}
|
||||
|
||||
|
||||
/* Destructeur */
|
||||
MODULE::~MODULE( void )
|
||||
{
|
||||
|
@ -103,6 +105,7 @@ EDA_BaseStruct * Struct, * NextStruct;
|
|||
for( Struct = m_Drawings; Struct != NULL; Struct = NextStruct )
|
||||
{
|
||||
NextStruct = Struct->Pnext;
|
||||
|
||||
switch( (Struct->m_StructType) )
|
||||
{
|
||||
case TYPEEDGEMODULE:
|
||||
|
@ -121,6 +124,7 @@ EDA_BaseStruct * Struct, * NextStruct;
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*********************************/
|
||||
void MODULE::Copy( MODULE* Module )
|
||||
/*********************************/
|
||||
|
@ -169,6 +173,7 @@ D_PAD * pad,* lastpad;
|
|||
for( ; OldStruct; OldStruct = OldStruct->Pnext )
|
||||
{
|
||||
NewStruct = NULL;
|
||||
|
||||
switch( OldStruct->m_StructType )
|
||||
{
|
||||
case TYPETEXTEMODULE:
|
||||
|
@ -180,11 +185,14 @@ D_PAD * pad,* lastpad;
|
|||
NewStruct = new EDGE_MODULE( this );
|
||||
( (EDGE_MODULE*) NewStruct )->Copy( (EDGE_MODULE*) OldStruct );
|
||||
break;
|
||||
|
||||
default:
|
||||
DisplayError( NULL, wxT( "Internal Err: CopyModule: type indefini" ) );
|
||||
break;
|
||||
}
|
||||
if( NewStruct == NULL) break;
|
||||
|
||||
if( NewStruct == NULL )
|
||||
break;
|
||||
if( m_Drawings == NULL )
|
||||
{
|
||||
NewStruct->Pback = this;
|
||||
|
@ -215,11 +223,11 @@ Struct3D_Master * Struct3D, *NewStruct3D, *CurrStruct3D;
|
|||
/* Copie des elements complementaires */
|
||||
m_Doc = Module->m_Doc;
|
||||
m_KeyWord = Module->m_KeyWord;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* supprime du chainage la structure Struct
|
||||
les structures arrieres et avant sont chainees directement
|
||||
* les structures arrieres et avant sont chainees directement
|
||||
*/
|
||||
void MODULE::UnLink( void )
|
||||
{
|
||||
|
@ -230,19 +238,21 @@ void MODULE::UnLink( void )
|
|||
{
|
||||
Pback->Pnext = Pnext;
|
||||
}
|
||||
|
||||
else /* Le chainage arriere pointe sur la structure "Pere" */
|
||||
{
|
||||
if( GetState( DELETED ) ) // A REVOIR car Pback = NULL si place en undelete
|
||||
{
|
||||
if( g_UnDeleteStack ) g_UnDeleteStack[g_UnDeleteStackPtr-1] = Pnext;
|
||||
if( g_UnDeleteStack )
|
||||
g_UnDeleteStack[g_UnDeleteStackPtr - 1] = Pnext;
|
||||
}
|
||||
else ((BOARD*)Pback)->m_Modules = (MODULE *) Pnext;
|
||||
else
|
||||
( (BOARD*) Pback )->m_Modules = (MODULE*) Pnext;
|
||||
}
|
||||
}
|
||||
|
||||
/* Modification du chainage avant */
|
||||
if( Pnext) Pnext->Pback = Pback;
|
||||
if( Pnext )
|
||||
Pnext->Pback = Pback;
|
||||
|
||||
Pnext = Pback = NULL;
|
||||
}
|
||||
|
@ -252,13 +262,14 @@ void MODULE::UnLink( void )
|
|||
void MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
const wxPoint& offset, int draw_mode )
|
||||
/**********************************************************/
|
||||
|
||||
/* Dessin d'une empreinte sur l'ecran actif:
|
||||
Entree :
|
||||
Module: pointeur sur le module
|
||||
ox, oy = offset de trace
|
||||
draw_mode = mode de trace ( GR_OR, GR_XOR, GR_AND)
|
||||
Utilise par ailleur:
|
||||
Description des parametres de l'empreinte calcules par caract() ;
|
||||
* Entree :
|
||||
* Module: pointeur sur le module
|
||||
* ox, oy = offset de trace
|
||||
* draw_mode = mode de trace ( GR_OR, GR_XOR, GR_AND)
|
||||
* Utilise par ailleur:
|
||||
* Description des parametres de l'empreinte calcules par caract() ;
|
||||
*/
|
||||
{
|
||||
D_PAD* pt_pad;
|
||||
|
@ -269,7 +280,8 @@ TEXTE_MODULE * PtTexte;
|
|||
pt_pad = m_Pads;
|
||||
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
|
||||
{
|
||||
if ( pt_pad->m_Flags & IS_MOVED ) continue;
|
||||
if( pt_pad->m_Flags & IS_MOVED )
|
||||
continue;
|
||||
pt_pad->Draw( panel, DC, offset, draw_mode );
|
||||
}
|
||||
|
||||
|
@ -285,7 +297,8 @@ TEXTE_MODULE * PtTexte;
|
|||
PtStruct = m_Drawings;
|
||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
|
||||
{
|
||||
if ( PtStruct->m_Flags & IS_MOVED ) continue;
|
||||
if( PtStruct->m_Flags & IS_MOVED )
|
||||
continue;
|
||||
|
||||
switch( PtStruct->m_StructType )
|
||||
{
|
||||
|
@ -298,7 +311,8 @@ TEXTE_MODULE * PtTexte;
|
|||
( (EDGE_MODULE*) PtStruct )->Draw( panel, DC, offset, draw_mode );
|
||||
break;
|
||||
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -321,7 +335,8 @@ EDA_BaseStruct * PtStruct;
|
|||
( (EDGE_MODULE*) PtStruct )->Draw( panel, DC, offset, draw_mode );
|
||||
break;
|
||||
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -330,6 +345,7 @@ EDA_BaseStruct * PtStruct;
|
|||
/*************************************/
|
||||
int MODULE::WriteDescr( FILE* File )
|
||||
/*************************************/
|
||||
|
||||
/* Sauvegarde de la description d'un MODULE
|
||||
*/
|
||||
{
|
||||
|
@ -341,7 +357,8 @@ EDA_BaseStruct * PtStruct;
|
|||
int ii, NbLigne = 0;
|
||||
wxString msg;
|
||||
|
||||
if( GetState(DELETED) ) return(NbLigne);
|
||||
if( GetState( DELETED ) )
|
||||
return NbLigne;
|
||||
|
||||
/* Generation du fichier module: */
|
||||
fprintf( File, "$MODULE %s\n", CONV_TO_UTF8( m_LibRef ) );
|
||||
|
@ -351,10 +368,12 @@ wxString msg;
|
|||
memset( StringStat, 0, sizeof(StringStat) );
|
||||
if( m_ModuleStatus & MODULE_is_LOCKED )
|
||||
StringStat[0] = 'F';
|
||||
else StringStat[0] = '~';
|
||||
else
|
||||
StringStat[0] = '~';
|
||||
if( m_ModuleStatus & MODULE_is_PLACED )
|
||||
StringStat[1] = 'P';
|
||||
else StringStat[1] = '~';
|
||||
else
|
||||
StringStat[1] = '~';
|
||||
|
||||
fprintf( File, "Po %d %d %d %d %8.8lX %8.8lX %s\n",
|
||||
m_Pos.x, m_Pos.y,
|
||||
|
@ -387,8 +406,10 @@ wxString msg;
|
|||
if( m_Attributs != MOD_DEFAULT )
|
||||
{
|
||||
fprintf( File, "At " );
|
||||
if( m_Attributs & MOD_CMS ) fprintf(File,"SMD ");
|
||||
if( m_Attributs & MOD_VIRTUAL ) fprintf(File,"VIRTUAL ");
|
||||
if( m_Attributs & MOD_CMS )
|
||||
fprintf( File, "SMD " );
|
||||
if( m_Attributs & MOD_VIRTUAL )
|
||||
fprintf( File, "VIRTUAL " );
|
||||
fprintf( File, "\n" );
|
||||
}
|
||||
|
||||
|
@ -443,7 +464,9 @@ wxString msg;
|
|||
PtStruct->m_StructType );
|
||||
DisplayError( NULL, msg );
|
||||
break;
|
||||
} /* Fin switch gestion des Items draw */
|
||||
}
|
||||
|
||||
/* Fin switch gestion des Items draw */
|
||||
}
|
||||
|
||||
/* Generation de la liste des pads */
|
||||
|
@ -454,18 +477,20 @@ wxString msg;
|
|||
NbLigne += ii;
|
||||
}
|
||||
|
||||
/* Generation des informations de tracé 3D */
|
||||
/* Generation des informations de trac<61>3D */
|
||||
Write_3D_Descr( File );
|
||||
|
||||
/* Fin de description: */
|
||||
fprintf( File, "$EndMODULE %s\n", CONV_TO_UTF8( m_LibRef ) );
|
||||
NbLigne++;
|
||||
return(NbLigne);
|
||||
return NbLigne;
|
||||
}
|
||||
|
||||
|
||||
/***************************************/
|
||||
int MODULE::Write_3D_Descr( FILE* File )
|
||||
/***************************************/
|
||||
|
||||
/* Sauvegarde de la description 3D du MODULE
|
||||
*/
|
||||
{
|
||||
|
@ -505,12 +530,14 @@ Struct3D_Master * Struct3D = m_3D_Drawings;
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************/
|
||||
int MODULE::Read_3D_Descr( FILE* File, int* LineNum )
|
||||
/****************************************************/
|
||||
|
||||
/* Lecture de la description d'un MODULE (format Ascii)
|
||||
la 1ere ligne de descr ($MODULE) est supposee etre deja lue
|
||||
retourne 0 si OK
|
||||
* la 1ere ligne de descr ($MODULE) est supposee etre deja lue
|
||||
* retourne 0 si OK
|
||||
*/
|
||||
{
|
||||
char Line[1024];
|
||||
|
@ -522,6 +549,7 @@ Struct3D_Master * Struct3D = m_3D_Drawings;
|
|||
Struct3D_Master* NewStruct3D;
|
||||
while( Struct3D->Pnext )
|
||||
Struct3D = (Struct3D_Master*) Struct3D->Pnext;
|
||||
|
||||
Struct3D->Pnext = NewStruct3D = new Struct3D_Master( this );
|
||||
NewStruct3D->Pback = Struct3D;
|
||||
Struct3D = NewStruct3D;
|
||||
|
@ -532,7 +560,8 @@ Struct3D_Master * Struct3D = m_3D_Drawings;
|
|||
switch( Line[0] )
|
||||
{
|
||||
case '$': // Fin de description
|
||||
if( Line[1] == 'E' ) return 0;
|
||||
if( Line[1] == 'E' )
|
||||
return 0;
|
||||
return 1;
|
||||
|
||||
case 'N': // Shape File Name
|
||||
|
@ -568,15 +597,18 @@ Struct3D_Master * Struct3D = m_3D_Drawings;
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************/
|
||||
int MODULE::ReadDescr( FILE* File, int* LineNum )
|
||||
/**************************************************/
|
||||
|
||||
/* Lecture de la description d'un MODULE (format Ascii)
|
||||
la 1ere ligne de descr ($MODULE) est supposee etre deja lue
|
||||
retourne 0 si OK
|
||||
* la 1ere ligne de descr ($MODULE) est supposee etre deja lue
|
||||
* retourne 0 si OK
|
||||
*/
|
||||
{
|
||||
D_PAD* LastPad = NULL, * ptpad;
|
||||
|
@ -590,7 +622,8 @@ int itmp1, itmp2;
|
|||
{
|
||||
if( Line[0] == '$' )
|
||||
{
|
||||
if( Line[1] == 'E' ) break;
|
||||
if( Line[1] == 'E' )
|
||||
break;
|
||||
if( Line[1] == 'P' )
|
||||
{
|
||||
ptpad = new D_PAD( this );
|
||||
|
@ -612,12 +645,16 @@ int itmp1, itmp2;
|
|||
LastPad = ptpad;
|
||||
continue;
|
||||
}
|
||||
if( Line[1] == 'S' ) Read_3D_Descr(File, LineNum );
|
||||
if( Line[1] == 'S' )
|
||||
Read_3D_Descr( File, LineNum );
|
||||
}
|
||||
|
||||
|
||||
if ( strlen(Line) < 4 ) continue;
|
||||
PtLine = Line + 3; /* Pointe 1er code utile de la ligne */
|
||||
if( strlen( Line ) < 4 )
|
||||
continue;
|
||||
PtLine = Line + 3;
|
||||
|
||||
/* Pointe 1er code utile de la ligne */
|
||||
switch( Line[0] )
|
||||
{
|
||||
case 'P':
|
||||
|
@ -628,8 +665,10 @@ int itmp1, itmp2;
|
|||
&m_LastEdit_Time, &m_TimeStamp, BufCar1 );
|
||||
|
||||
m_ModuleStatus = 0;
|
||||
if(BufCar1[0] == 'F') m_ModuleStatus |= MODULE_is_LOCKED;
|
||||
if(BufCar1[1] == 'P') m_ModuleStatus |= MODULE_is_PLACED;
|
||||
if( BufCar1[0] == 'F' )
|
||||
m_ModuleStatus |= MODULE_is_LOCKED;
|
||||
if( BufCar1[1] == 'P' )
|
||||
m_ModuleStatus |= MODULE_is_PLACED;
|
||||
break;
|
||||
|
||||
case 'L': /* Li = Lecture du nom librairie du module */
|
||||
|
@ -647,18 +686,23 @@ int itmp1, itmp2;
|
|||
sscanf( PtLine, " %X %X", &itmp1, &itmp2 );
|
||||
|
||||
m_CntRot180 = itmp2 & 0x0F;
|
||||
if( m_CntRot180 > 10 ) m_CntRot180 = 10;
|
||||
if( m_CntRot180 > 10 )
|
||||
m_CntRot180 = 10;
|
||||
|
||||
m_CntRot90 = itmp1 & 0x0F;
|
||||
if( m_CntRot90 > 10 ) m_CntRot90 = 0;
|
||||
if( m_CntRot90 > 10 )
|
||||
m_CntRot90 = 0;
|
||||
itmp1 = (itmp1 >> 4) & 0x0F;
|
||||
if( itmp1 > 10 ) itmp1 = 0;
|
||||
if( itmp1 > 10 )
|
||||
itmp1 = 0;
|
||||
m_CntRot90 |= itmp1 << 4;
|
||||
break;
|
||||
|
||||
case 'A': /* At = (At)tributs du module */
|
||||
if ( strstr(PtLine, "SMD") ) m_Attributs |= MOD_CMS;
|
||||
if ( strstr(PtLine, "VIRTUAL") ) m_Attributs |= MOD_VIRTUAL;
|
||||
if( strstr( PtLine, "SMD" ) )
|
||||
m_Attributs |= MOD_CMS;
|
||||
if( strstr( PtLine, "VIRTUAL" ) )
|
||||
m_Attributs |= MOD_VIRTUAL;
|
||||
break;
|
||||
|
||||
case 'T': /* lecture des textes modules */
|
||||
|
@ -668,7 +712,8 @@ int itmp1, itmp2;
|
|||
else if( itmp1 == TEXT_is_VALUE )
|
||||
DrawText = m_Value;
|
||||
else /* text is a drawing */
|
||||
{DrawText = new TEXTE_MODULE(this);
|
||||
{
|
||||
DrawText = new TEXTE_MODULE( this );
|
||||
if( LastModStruct == NULL )
|
||||
{
|
||||
DrawText->Pback = this;
|
||||
|
@ -691,22 +736,31 @@ int itmp1, itmp2;
|
|||
|
||||
DrawText->m_Type = itmp1;
|
||||
DrawText->m_Orient -= m_Orient; // m_Orient texte relative au module
|
||||
if( BufCar1[0] == 'M') DrawText->m_Miroir = 0;
|
||||
else DrawText->m_Miroir = 1;
|
||||
if( BufCar2[0] == 'I') DrawText->m_NoShow = 1;
|
||||
else DrawText->m_NoShow = 0;
|
||||
if( BufCar1[0] == 'M' )
|
||||
DrawText->m_Miroir = 0;
|
||||
else
|
||||
DrawText->m_Miroir = 1;
|
||||
if( BufCar2[0] == 'I' )
|
||||
DrawText->m_NoShow = 1;
|
||||
else
|
||||
DrawText->m_NoShow = 0;
|
||||
|
||||
if(m_Layer == CUIVRE_N) DrawText->m_Layer = SILKSCREEN_N_CU;
|
||||
if(m_Layer == CMP_N) DrawText->m_Layer = SILKSCREEN_N_CMP;
|
||||
if( m_Layer == CUIVRE_N )
|
||||
DrawText->m_Layer = SILKSCREEN_N_CU;
|
||||
if( m_Layer == CMP_N )
|
||||
DrawText->m_Layer = SILKSCREEN_N_CMP;
|
||||
|
||||
/* calcul de la position vraie */
|
||||
DrawText->SetDrawCoord();
|
||||
/* Lecture de la chaine "text" */
|
||||
ReadDelimitedText( BufLine, Line, sizeof(BufLine) );
|
||||
DrawText->m_Text = CONV_FROM_UTF8( BufLine );
|
||||
|
||||
// Controle d'epaisseur raisonnable:
|
||||
if( DrawText->m_Width <= 1 ) DrawText->m_Width = 1;
|
||||
if( DrawText->m_Width > MAX_WIDTH ) DrawText->m_Width = MAX_WIDTH;
|
||||
if( DrawText->m_Width <= 1 )
|
||||
DrawText->m_Width = 1;
|
||||
if( DrawText->m_Width > MAX_WIDTH )
|
||||
DrawText->m_Width = MAX_WIDTH;
|
||||
break;
|
||||
|
||||
case 'D': /* lecture du contour */
|
||||
|
@ -740,14 +794,17 @@ int itmp1, itmp2;
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Recalcul de l'encadrement */
|
||||
Set_Rectangle_Encadrement();
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************/
|
||||
void MODULE::SetPosition( const wxPoint& newpos )
|
||||
/****************************************************/
|
||||
|
||||
// replace le module en position newpos
|
||||
{
|
||||
int deltaX = newpos.x - m_Pos.x;
|
||||
|
@ -789,7 +846,8 @@ int deltaY = newpos.y - m_Pos.y;
|
|||
break;
|
||||
}
|
||||
|
||||
default: DisplayError(NULL, wxT("Type Draw Indefini")); break;
|
||||
default:
|
||||
DisplayError( NULL, wxT( "Type Draw Indefini" ) ); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -797,10 +855,10 @@ int deltaY = newpos.y - m_Pos.y;
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*********************************************/
|
||||
void MODULE::SetOrientation( int newangle )
|
||||
/*********************************************/
|
||||
|
||||
/* Tourne de newangle (en 0.1 degres) le module
|
||||
*/
|
||||
{
|
||||
|
@ -851,16 +909,18 @@ int px ,py;
|
|||
Set_Rectangle_Encadrement();
|
||||
}
|
||||
|
||||
|
||||
/************************************************/
|
||||
void MODULE::Set_Rectangle_Encadrement( void )
|
||||
/************************************************/
|
||||
|
||||
/* Mise a jour du rectangle d'encadrement du module
|
||||
Entree : pointeur sur module
|
||||
Le rectangle d'encadrement est le rectangle comprenant les contours et les
|
||||
pads.
|
||||
Le rectangle est calcule:
|
||||
pour orient 0
|
||||
en coord relatives / position ancre
|
||||
* Entree : pointeur sur module
|
||||
* Le rectangle d'encadrement est le rectangle comprenant les contours et les
|
||||
* pads.
|
||||
* Le rectangle est calcule:
|
||||
* pour orient 0
|
||||
* en coord relatives / position ancre
|
||||
*/
|
||||
{
|
||||
EDGE_MODULE* pt_edge_mod;
|
||||
|
@ -880,8 +940,10 @@ int xmax, ymax;
|
|||
/* Contours: Recherche des coord min et max et mise a jour du cadre */
|
||||
for( ; pt_edge_mod != NULL; pt_edge_mod = (EDGE_MODULE*) pt_edge_mod->Pnext )
|
||||
{
|
||||
if( pt_edge_mod->m_StructType != TYPEEDGEMODULE) continue;
|
||||
if( pt_edge_mod->m_StructType != TYPEEDGEMODULE )
|
||||
continue;
|
||||
width = pt_edge_mod->m_Width / 2;
|
||||
|
||||
switch( pt_edge_mod->m_Shape )
|
||||
{
|
||||
case S_ARC:
|
||||
|
@ -927,18 +989,16 @@ int xmax, ymax;
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************/
|
||||
void MODULE::SetRectangleExinscrit( void )
|
||||
/****************************************/
|
||||
|
||||
/* Analogue a MODULE::Set_Rectangle_Encadrement() mais en coord reelles:
|
||||
Mise a jour du rectangle d'encadrement reel du module c.a.d en coord PCB
|
||||
Entree : pointeur sur module
|
||||
Le rectangle d'encadrement est le rectangle comprenant les contours et les
|
||||
pads.
|
||||
Met egalement a jour la surface (.m_Surface) du module.
|
||||
* Mise a jour du rectangle d'encadrement reel du module c.a.d en coord PCB
|
||||
* Entree : pointeur sur module
|
||||
* Le rectangle d'encadrement est le rectangle comprenant les contours et les
|
||||
* pads.
|
||||
* Met egalement a jour la surface (.m_Surface) du module.
|
||||
*/
|
||||
{
|
||||
EDGE_MODULE* EdgeMod;
|
||||
|
@ -954,8 +1014,10 @@ int xmax, ymax;
|
|||
EdgeMod = (EDGE_MODULE*) m_Drawings;
|
||||
for( ; EdgeMod != NULL; EdgeMod = (EDGE_MODULE*) EdgeMod->Pnext )
|
||||
{
|
||||
if( EdgeMod->m_StructType != TYPEEDGEMODULE) continue;
|
||||
if( EdgeMod->m_StructType != TYPEEDGEMODULE )
|
||||
continue;
|
||||
width = EdgeMod->m_Width / 2;
|
||||
|
||||
switch( EdgeMod->m_Shape )
|
||||
{
|
||||
case S_ARC:
|
||||
|
@ -995,6 +1057,7 @@ int xmax, ymax;
|
|||
xmax = max( xmax, cx + rayon );
|
||||
ymax = max( ymax, cy + rayon );
|
||||
}
|
||||
|
||||
m_RealBoundaryBox.SetWidth( xmax - m_RealBoundaryBox.m_Pos.x );
|
||||
m_RealBoundaryBox.SetHeight( ymax - m_RealBoundaryBox.m_Pos.y );
|
||||
m_Surface = ABS( (float) m_RealBoundaryBox.GetWidth() * m_RealBoundaryBox.GetHeight() );
|
||||
|
@ -1012,7 +1075,8 @@ bool flag = FALSE;
|
|||
wxString msg;
|
||||
|
||||
frame->MsgPanel->EraseMsgBox(); /* Effacement de la zone message */
|
||||
if ( frame->m_Ident != PCB_FRAME ) flag = TRUE;
|
||||
if( frame->m_Ident != PCB_FRAME )
|
||||
flag = TRUE;
|
||||
pos = 1;
|
||||
Affiche_1_Parametre( frame, pos, m_Reference->m_Text, m_Value->m_Text, DARKCYAN );
|
||||
|
||||
|
@ -1042,14 +1106,20 @@ wxString msg;
|
|||
pos += 6;
|
||||
EDA_BaseStruct* PtStruct = m_Pads;
|
||||
nbpad = 0;
|
||||
while( PtStruct ) { nbpad ++; PtStruct = PtStruct->Pnext; }
|
||||
while( PtStruct )
|
||||
{
|
||||
nbpad++; PtStruct = PtStruct->Pnext;
|
||||
}
|
||||
|
||||
msg.Printf( wxT( "%d" ), nbpad );
|
||||
Affiche_1_Parametre( frame, pos, _( "Pads" ), msg, BLUE );
|
||||
|
||||
pos += 4;
|
||||
msg = wxT( ".." );
|
||||
if( m_ModuleStatus & MODULE_is_LOCKED ) msg[0] = 'F';
|
||||
if( m_ModuleStatus & MODULE_is_PLACED ) msg[1] = 'P';
|
||||
if( m_ModuleStatus & MODULE_is_LOCKED )
|
||||
msg[0] = 'F';
|
||||
if( m_ModuleStatus & MODULE_is_PLACED )
|
||||
msg[1] = 'P';
|
||||
Affiche_1_Parametre( frame, pos, _( "Stat" ), msg, MAGENTA );
|
||||
|
||||
pos += 4;
|
||||
|
@ -1067,6 +1137,38 @@ wxString msg;
|
|||
wxString doc = _( "Doc: " ) + m_Doc;
|
||||
wxString keyword = _( "KeyW: " ) + m_KeyWord;
|
||||
Affiche_1_Parametre( frame, pos, doc, keyword, BLACK );
|
||||
|
||||
}
|
||||
|
||||
|
||||
#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 MODULE::Show( int nestLevel, std::ostream& os )
|
||||
{
|
||||
// for now, make it look like XML, expand on this later.
|
||||
|
||||
NestedSpace( nestLevel, os ) << '<' << ReturnClassName().mb_str() <<
|
||||
" ref=\"" << m_Reference->m_Text.mb_str() <<
|
||||
|
||||
"\" value=\"" << m_Value->m_Text.mb_str() <<
|
||||
"\">\n";
|
||||
|
||||
EDA_BaseStruct* p = m_Drawings;
|
||||
for( ; p; p = p->Pnext )
|
||||
p->Show( nestLevel+1, os );
|
||||
|
||||
EDA_BaseStruct* kid = m_Son;
|
||||
for( ; kid; kid = kid->Pnext )
|
||||
{
|
||||
kid->Show( nestLevel+1, os );
|
||||
}
|
||||
|
||||
NestedSpace( nestLevel, os ) << "</" << ReturnClassName().mb_str() << ">\n";
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -12,10 +12,10 @@ class Struct3D_Master;
|
|||
/************************************/
|
||||
|
||||
/* Format des modules:
|
||||
Description generale
|
||||
Description segments contour
|
||||
Description textes
|
||||
Description pastilles
|
||||
* Description generale
|
||||
* Description segments contour
|
||||
* Description textes
|
||||
* Description pastilles
|
||||
*/
|
||||
|
||||
/* Flags :*/
|
||||
|
@ -24,9 +24,10 @@ enum Mod_Attribut /* Attributs d'un module */
|
|||
{
|
||||
MOD_DEFAULT = 0, /* Type default */
|
||||
MOD_CMS = 1, /* Pour module apparaissant dans les
|
||||
fichiers de placement automatique (principalement modules CMS */
|
||||
* fichiers de placement automatique (principalement modules CMS */
|
||||
MOD_VIRTUAL = 2 /* Module virtuel constitue par un dessin sur circuit
|
||||
(connecteur, trou de percage..) */
|
||||
* (connecteur, trou de percage..) */
|
||||
|
||||
};
|
||||
|
||||
/* flags for autoplace and autoroute (.m_ModuleStatus member) */
|
||||
|
@ -72,13 +73,14 @@ public:
|
|||
~MODULE( void );
|
||||
|
||||
void Copy( MODULE* Module ); // Copy structure
|
||||
|
||||
MODULE* Next( void ) { return (MODULE*) Pnext; }
|
||||
|
||||
void Set_Rectangle_Encadrement( void );/* mise a jour du rect d'encadrement
|
||||
en coord locales (orient 0 et origine = pos module) */
|
||||
* en coord locales (orient 0 et origine = pos module) */
|
||||
|
||||
void SetRectangleExinscrit( void );/* mise a jour du rect d'encadrement
|
||||
et de la surface en coord reelles */
|
||||
* et de la surface en coord reelles */
|
||||
|
||||
|
||||
// deplacements
|
||||
|
@ -130,5 +132,16 @@ public:
|
|||
|
||||
/* miscellaneous */
|
||||
void Display_Infos( WinEDA_BasePcbFrame* frame );
|
||||
};
|
||||
|
||||
#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.
|
||||
*/
|
||||
virtual void Show( int nestLevel, std::ostream& os );
|
||||
#endif
|
||||
|
||||
};
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
/****************************************************/
|
||||
void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
|
||||
/****************************************************/
|
||||
|
||||
/* Gestion generale des commandes de lecture de fichiers
|
||||
*/
|
||||
{
|
||||
|
@ -60,7 +61,8 @@ wxString msg;
|
|||
else
|
||||
{
|
||||
msg = _( "Ok to load Recovery file " ) + filename;
|
||||
if ( ! IsOK (this, msg) ) break;
|
||||
if( !IsOK( this, msg ) )
|
||||
break;
|
||||
}
|
||||
Clear_Pcb( &dc, TRUE );
|
||||
LoadOnePcbFile( filename, &dc, FALSE );
|
||||
|
@ -113,21 +115,21 @@ wxString msg;
|
|||
RecreateCmpFileFromBoard();
|
||||
break;
|
||||
|
||||
default: DisplayError(this, wxT("File_io Internal Error") ); break;
|
||||
default:
|
||||
DisplayError( this, wxT( "File_io Internal Error" ) ); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************************/
|
||||
int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC* DC, bool Append )
|
||||
/******************************************************************************************/
|
||||
|
||||
/*
|
||||
Lecture d'un fichier PCB, le nom etant dans PcbNameBuffer.s
|
||||
retourne:
|
||||
0 si fichier non lu ( annulation de commande ... )
|
||||
1 si OK
|
||||
* Lecture d'un fichier PCB, le nom etant dans PcbNameBuffer.s
|
||||
* retourne:
|
||||
* 0 si fichier non lu ( annulation de commande ... )
|
||||
* 1 si OK
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
|
@ -139,7 +141,7 @@ wxString msg;
|
|||
if( GetScreen()->IsModify() && !Append )
|
||||
{
|
||||
if( !IsOK( this, _( "Board Modified: Continue ?" ) ) )
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
m_SelTrackWidthBox_Changed = TRUE;
|
||||
|
@ -165,11 +167,12 @@ wxString msg;
|
|||
wxFD_OPEN,
|
||||
FALSE
|
||||
);
|
||||
if ( FileName == wxEmptyString ) return FALSE;
|
||||
if( FileName == wxEmptyString )
|
||||
return FALSE;
|
||||
GetScreen()->m_FileName = FileName;
|
||||
}
|
||||
|
||||
else GetScreen()->m_FileName = FullFileName;
|
||||
else
|
||||
GetScreen()->m_FileName = FullFileName;
|
||||
|
||||
/////////////////////////
|
||||
/* Lecture Fichier PCB */
|
||||
|
@ -180,7 +183,7 @@ wxString msg;
|
|||
{
|
||||
msg.Printf( _( "File <%s> not found" ), GetScreen()->m_FileName.GetData() );
|
||||
DisplayError( this, msg );
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -190,7 +193,7 @@ wxString msg;
|
|||
{
|
||||
fclose( source );
|
||||
DisplayError( this, wxT( "Unknown file type" ) );
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SetTitle( GetScreen()->m_FileName );
|
||||
|
@ -198,7 +201,8 @@ wxString msg;
|
|||
|
||||
// Rechargement de la configuration:
|
||||
wxSetWorkingDirectory( wxPathOnly( GetScreen()->m_FileName ) );
|
||||
if( Append ) ReadPcbFile(DC, source, TRUE);
|
||||
if( Append )
|
||||
ReadPcbFile( DC, source, TRUE );
|
||||
else
|
||||
{
|
||||
Read_Config( GetScreen()->m_FileName );
|
||||
|
@ -223,21 +227,27 @@ wxString msg;
|
|||
wxGetCwd().GetData(), DIR_SEP, PcbExtBuffer.GetData() );
|
||||
}
|
||||
|
||||
|
||||
/* liste des pads recalculee avec Affichage des messages d'erreur */
|
||||
build_liste_pads();
|
||||
|
||||
Affiche_Infos_Status_Pcb( this );
|
||||
|
||||
g_SaveTime = time( NULL );
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
// output the board object tree to stdout:
|
||||
m_Pcb->Show( 0, std::cout );
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************/
|
||||
bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName )
|
||||
/************************************************************/
|
||||
|
||||
/* Sauvegarde du fichier PCB en format ASCII
|
||||
*/
|
||||
{
|
||||
|
@ -257,10 +267,12 @@ FILE * dest;
|
|||
wxFD_SAVE,
|
||||
FALSE
|
||||
);
|
||||
if ( FullFileName == wxEmptyString ) return FALSE;
|
||||
if( FullFileName == wxEmptyString )
|
||||
return FALSE;
|
||||
GetScreen()->m_FileName = FullFileName;
|
||||
}
|
||||
else GetScreen()->m_FileName = FileName;
|
||||
else
|
||||
GetScreen()->m_FileName = FileName;
|
||||
|
||||
/* mise a jour date si modifications */
|
||||
if( GetScreen()->IsModify() )
|
||||
|
@ -287,7 +299,6 @@ FILE * dest;
|
|||
saveok = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
old_name = wxEmptyString; saveok = FALSE;
|
||||
|
@ -319,8 +330,10 @@ FILE * dest;
|
|||
Affiche_1_Parametre( this, 1, msg, wxEmptyString, CYAN );
|
||||
}
|
||||
|
||||
if ( dest ) msg = _("Write Board file: ");
|
||||
else msg = _("Failed to create ");
|
||||
if( dest )
|
||||
msg = _( "Write Board file: " );
|
||||
else
|
||||
msg = _( "Failed to create " );
|
||||
msg += FullFileName;
|
||||
|
||||
Affiche_1_Parametre( this, 1, wxEmptyString, msg, CYAN );
|
||||
|
@ -328,4 +341,3 @@ FILE * dest;
|
|||
GetScreen()->ClrModify();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ Nm net_code netname
|
|||
Po posrefX posrefy : position refX,Y (= position orient 0 / ancre)
|
||||
$EndPAD
|
||||
|
||||
******** Structure module ***********
|
||||
****** Structure module ***********
|
||||
|
||||
$MODULE namelib
|
||||
Po ax ay orient layer masquelayer m_TimeCode
|
||||
|
@ -83,10 +83,11 @@ int WinEDA_BasePcbFrame::ReadListeSegmentDescr(wxDC * DC, FILE * File,
|
|||
TRACK* PtSegm, int StructType,
|
||||
int* LineNum, int NumSegm )
|
||||
/**********************************************************************/
|
||||
|
||||
/* Lecture de la description d'une liste de segments (Tracks, zones)
|
||||
Retourne:
|
||||
si ok nombre d'items lus.
|
||||
si pas de fin de block ($..) - nombre.
|
||||
* Retourne:
|
||||
* si ok nombre d'items lus.
|
||||
* si pas de fin de block ($..) - nombre.
|
||||
*/
|
||||
{
|
||||
int shape, width, layer, type, flags, net_code;
|
||||
|
@ -95,6 +96,7 @@ char Line[256];
|
|||
TRACK* NewTrack;
|
||||
|
||||
PerCent = 0; Pas = NumSegm / 99;
|
||||
|
||||
#ifdef PCBNEW
|
||||
switch( StructType )
|
||||
{
|
||||
|
@ -108,23 +110,30 @@ TRACK * NewTrack;
|
|||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
while( GetLine( File, Line, LineNum ) )
|
||||
{
|
||||
if( Line[0] == '$' )
|
||||
{
|
||||
return(ii); /* fin de liste OK */
|
||||
return ii; /* fin de liste OK */
|
||||
}
|
||||
|
||||
switch( StructType )
|
||||
{
|
||||
default:
|
||||
case TYPETRACK: NewTrack = new TRACK( m_Pcb );
|
||||
case TYPETRACK:
|
||||
NewTrack = new TRACK( m_Pcb );
|
||||
break;
|
||||
case TYPEVIA: NewTrack = new SEGVIA( m_Pcb );
|
||||
|
||||
case TYPEVIA:
|
||||
NewTrack = new SEGVIA( m_Pcb );
|
||||
break;
|
||||
case TYPEZONE: NewTrack = new SEGZONE( m_Pcb );
|
||||
|
||||
case TYPEZONE:
|
||||
NewTrack = new SEGZONE( m_Pcb );
|
||||
break;
|
||||
}
|
||||
|
||||
NewTrack->Insert( m_Pcb, PtSegm ); PtSegm = NewTrack;
|
||||
|
||||
int arg_count = sscanf( Line + 2, " %d %d %d %d %d %d %d", &shape,
|
||||
|
@ -133,14 +142,18 @@ TRACK * NewTrack;
|
|||
&PtSegm->m_Drill );
|
||||
|
||||
PtSegm->m_Width = width; PtSegm->m_Shape = shape;
|
||||
if ( arg_count < 7 ) PtSegm->m_Drill = -1;
|
||||
if( arg_count < 7 )
|
||||
PtSegm->m_Drill = -1;
|
||||
|
||||
if( GetLine(File, Line, LineNum ) == NULL ) break;
|
||||
if(Line[0] == '$') break;
|
||||
if( GetLine( File, Line, LineNum ) == NULL )
|
||||
break;
|
||||
if( Line[0] == '$' )
|
||||
break;
|
||||
|
||||
sscanf( Line + 2, " %d %d %d %lX %X", &layer, &type, &net_code,
|
||||
&PtSegm->m_TimeStamp, &flags );
|
||||
if ( type == 1 ) PtSegm->m_StructType = TYPEVIA;
|
||||
if( type == 1 )
|
||||
PtSegm->m_StructType = TYPEVIA;
|
||||
PtSegm->m_Layer = layer;
|
||||
PtSegm->m_NetCode = net_code; PtSegm->SetState( flags, ON );
|
||||
#ifdef PCBNEW
|
||||
|
@ -150,6 +163,7 @@ TRACK * NewTrack;
|
|||
if( ( Pas && (ii % Pas ) == 0) )
|
||||
{
|
||||
PerCent++;
|
||||
|
||||
#ifdef PCBNEW
|
||||
switch( StructType )
|
||||
{
|
||||
|
@ -163,12 +177,13 @@ TRACK * NewTrack;
|
|||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
DisplayError(this, _("Error: Unexpected end of file !") );
|
||||
return(-ii);
|
||||
}
|
||||
|
||||
DisplayError( this, _( "Error: Unexpected end of file !" ) );
|
||||
return -ii;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************************/
|
||||
|
@ -181,20 +196,24 @@ BASE_SCREEN * screen = m_CurrentScreen;
|
|||
while( GetLine( File, Line, LineNum ) != NULL )
|
||||
{
|
||||
data = strtok( Line, " =\n\r" );
|
||||
if(strnicmp(data,"$EndGENERAL",10) == 0) break;
|
||||
if( strnicmp( data, "$EndGENERAL", 10 ) == 0 )
|
||||
break;
|
||||
|
||||
if( strncmp( data, "Ly", 2 ) == 0 ) // Old format for Layer count
|
||||
{
|
||||
int Masque_Layer = 1, ii;
|
||||
data = strtok( NULL, " =\n\r" );
|
||||
sscanf( data, "%X", &Masque_Layer );
|
||||
|
||||
// Setup layer count
|
||||
m_Pcb->m_BoardSettings->m_CopperLayerCount = 0;
|
||||
for( ii = 0; ii < NB_COPPER_LAYERS; ii++ )
|
||||
{
|
||||
if ( Masque_Layer & 1 ) m_Pcb->m_BoardSettings->m_CopperLayerCount++;
|
||||
if( Masque_Layer & 1 )
|
||||
m_Pcb->m_BoardSettings->m_CopperLayerCount++;
|
||||
Masque_Layer >>= 1;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -234,7 +253,8 @@ BASE_SCREEN * screen = m_CurrentScreen;
|
|||
screen->m_Curseur = m_Pcb->m_BoundaryBox.Centre();
|
||||
|
||||
screen->SetZoom( bestzoom );
|
||||
// la position des tracés a changé: mise a jour dans le DC courant
|
||||
|
||||
// la position des trac<61> a chang<6E> mise a jour dans le DC courant
|
||||
wxPoint org;
|
||||
DrawPanel->GetViewStart( &org.x, &org.y );
|
||||
DrawPanel->GetScrollPixelsPerUnit( &ii, &jj );
|
||||
|
@ -284,9 +304,9 @@ BASE_SCREEN * screen = m_CurrentScreen;
|
|||
NbNets = atoi( data );
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
return(1);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -311,7 +331,8 @@ char Line[1024], *data;
|
|||
int gx = 0, gy = 0;
|
||||
gx = atoi( data );
|
||||
data = strtok( NULL, " =\n\r" );
|
||||
if ( data ) gy = atoi(data);
|
||||
if( data )
|
||||
gy = atoi( data );
|
||||
m_Auxiliary_Axis_Position.x = gx; m_Auxiliary_Axis_Position.y = gy;
|
||||
continue;
|
||||
}
|
||||
|
@ -355,8 +376,10 @@ char Line[1024], *data;
|
|||
wxSize Grid;
|
||||
Grid.x = atoi( data );
|
||||
data = strtok( NULL, " =\n\r" );
|
||||
if ( data ) Grid.y = atoi(data);
|
||||
else Grid.y = Grid.x;
|
||||
if( data )
|
||||
Grid.y = atoi( data );
|
||||
else
|
||||
Grid.y = Grid.x;
|
||||
GetScreen()->SetGrid( Grid );
|
||||
continue;
|
||||
}
|
||||
|
@ -375,21 +398,24 @@ char Line[1024], *data;
|
|||
msg = CONV_FROM_UTF8( data );
|
||||
msg.ToDouble( &g_UserGrid.x );
|
||||
}
|
||||
else continue;
|
||||
else
|
||||
continue;
|
||||
data = strtok( NULL, " =\n\r" );
|
||||
if( data )
|
||||
{
|
||||
msg = CONV_FROM_UTF8( data );
|
||||
msg.ToDouble( &g_UserGrid.y );
|
||||
}
|
||||
else g_UserGrid.y = g_UserGrid.x;
|
||||
else
|
||||
g_UserGrid.y = g_UserGrid.x;
|
||||
GetScreen()->m_UserGrid = g_UserGrid;
|
||||
data = strtok( NULL, " =\n\r" );
|
||||
if( data )
|
||||
{
|
||||
if( stricmp( data, "mm" ) == 0 )
|
||||
g_UserGrid_Unit = MILLIMETRE;
|
||||
else g_UserGrid_Unit = INCHES;
|
||||
else
|
||||
g_UserGrid_Unit = INCHES;
|
||||
GetScreen()->m_UserGridUnit = g_UserGrid_Unit;
|
||||
}
|
||||
continue;
|
||||
|
@ -492,7 +518,8 @@ char Line[1024], *data;
|
|||
}
|
||||
#endif
|
||||
}
|
||||
return(1);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -508,7 +535,8 @@ int ii, jj;
|
|||
sprintf( text, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT );
|
||||
fprintf( File, text );
|
||||
|
||||
if ( frame->GetScreen()->m_UserGridIsON ) ii = jj = -1;
|
||||
if( frame->GetScreen()->m_UserGridIsON )
|
||||
ii = jj = -1;
|
||||
else
|
||||
{
|
||||
ii = frame->GetScreen()->GetGrid().x;
|
||||
|
@ -528,10 +556,12 @@ int ii, jj;
|
|||
fprintf( File, "TrackWidth %d\n", g_DesignSettings.m_CurrentTrackWidth );
|
||||
for( ii = 0; ii < HIST0RY_NUMBER; ii++ )
|
||||
{
|
||||
if ( g_DesignSettings.m_TrackWidhtHistory[ii] == 0 ) break;
|
||||
if( g_DesignSettings.m_TrackWidhtHistory[ii] == 0 )
|
||||
break;
|
||||
fprintf( File, "TrackWidthHistory %d\n",
|
||||
g_DesignSettings.m_TrackWidhtHistory[ii] );
|
||||
}
|
||||
|
||||
fprintf( File, "TrackClearence %d\n", g_DesignSettings.m_TrackClearence );
|
||||
fprintf( File, "ZoneClearence %d\n", g_DesignSettings.m_ZoneClearence );
|
||||
|
||||
|
@ -541,9 +571,11 @@ int ii, jj;
|
|||
fprintf( File, "ViaDrill %d\n", g_DesignSettings.m_ViaDrill );
|
||||
for( ii = 0; ii < HIST0RY_NUMBER; ii++ )
|
||||
{
|
||||
if ( g_DesignSettings.m_ViaSizeHistory[ii] == 0 ) break;
|
||||
if( g_DesignSettings.m_ViaSizeHistory[ii] == 0 )
|
||||
break;
|
||||
fprintf( File, "ViaSizeHistory %d\n", g_DesignSettings.m_ViaSizeHistory[ii] );
|
||||
}
|
||||
|
||||
fprintf( File, "TextPcbWidth %d\n", g_DesignSettings.m_PcbTextWidth );
|
||||
fprintf( File, "TextPcbSize %d %d\n",
|
||||
g_DesignSettings.m_PcbTextSize.x, g_DesignSettings.m_PcbTextSize.y );
|
||||
|
@ -552,14 +584,17 @@ int ii, jj;
|
|||
fprintf( File, "TextModWidth %d\n", ModuleTextWidth );
|
||||
fprintf( File, "PadSize %d %d\n", g_Pad_Master.m_Size.x, g_Pad_Master.m_Size.y );
|
||||
fprintf( File, "PadDrill %d\n", g_Pad_Master.m_Drill.x );
|
||||
|
||||
// fprintf(File, "PadDeltaSize %d %d\n", Pad_DeltaSize.x, Pad_DeltaSize.y);
|
||||
// fprintf(File, "PadDrillOffset %d %d\n", Pad_OffsetSize.x, Pad_OffsetSize.y);
|
||||
|
||||
fprintf( File, "AuxiliaryAxisOrg %d %d\n",
|
||||
frame->m_Auxiliary_Axis_Position.x, frame->m_Auxiliary_Axis_Position.y );
|
||||
fprintf( File, "$EndSETUP\n\n" );
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -571,12 +606,14 @@ EDA_BaseStruct * PtStruct = m_Pcb->m_Modules;
|
|||
int NbModules, NbDrawItem, NbLayers;
|
||||
|
||||
/* Calcul du nombre des modules */
|
||||
for( NbModules = 0; PtStruct != NULL; PtStruct = PtStruct->Pnext) NbModules++;
|
||||
for( NbModules = 0; PtStruct != NULL; PtStruct = PtStruct->Pnext )
|
||||
NbModules++;
|
||||
|
||||
/* generation du masque des couches autorisees */
|
||||
NbLayers = m_Pcb->m_BoardSettings->m_CopperLayerCount;
|
||||
fprintf( File, "$GENERAL\n" );
|
||||
fprintf( File, "LayerCount %d\n", NbLayers );
|
||||
|
||||
// Write old format for Layer count (for compatibility with old versions of pcbnew
|
||||
fprintf( File, "Ly %8X\n", g_TabAllCopperLayerMask[NbLayers - 1] | ALL_NO_CU_LAYERS ); // For compatibility with old version of pcbnew
|
||||
fprintf( File, "Links %d\n", m_Pcb->m_NbLinks );
|
||||
|
@ -591,7 +628,8 @@ int NbModules, NbDrawItem, NbLayers;
|
|||
|
||||
/* Generation du nombre de segments type DRAW , TRACT ZONE */
|
||||
PtStruct = m_Pcb->m_Drawings; NbDrawItem = 0;
|
||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext) NbDrawItem++;
|
||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
|
||||
NbDrawItem++;
|
||||
|
||||
fprintf( File, "Ndraw %d\n", NbDrawItem );
|
||||
fprintf( File, "Ntrack %d\n", m_Pcb->GetNumSegmTrack() );
|
||||
|
@ -604,6 +642,7 @@ int NbModules, NbDrawItem, NbLayers;
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************/
|
||||
bool WriteSheetDescr( BASE_SCREEN* screen, FILE* File )
|
||||
/******************************************************/
|
||||
|
@ -637,7 +676,8 @@ char Line[1024], buf[1024], * text;
|
|||
/* Recheche suite et fin de descr */
|
||||
while( GetLine( File, Line, LineNum ) != NULL )
|
||||
{
|
||||
if( strnicmp(Line,"$End",4) == 0 ) return TRUE;
|
||||
if( strnicmp( Line, "$End", 4 ) == 0 )
|
||||
return TRUE;
|
||||
|
||||
if( strnicmp( Line, "Sheet", 4 ) == 0 )
|
||||
{
|
||||
|
@ -653,13 +693,16 @@ char Line[1024], buf[1024], * text;
|
|||
if( sheet == &g_Sheet_user )
|
||||
{
|
||||
text = strtok( NULL, " \t\n\r" );
|
||||
if ( text ) sheet->m_Size.x = atoi(text);
|
||||
if( text )
|
||||
sheet->m_Size.x = atoi( text );
|
||||
text = strtok( NULL, " \t\n\r" );
|
||||
if ( text ) sheet->m_Size.y = atoi(text);
|
||||
if( text )
|
||||
sheet->m_Size.y = atoi( text );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -719,15 +762,18 @@ char Line[1024], buf[1024], * text;
|
|||
continue;
|
||||
}
|
||||
}
|
||||
return(FALSE);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
int WinEDA_PcbFrame::ReadPcbFile( wxDC* DC, FILE* File, bool Append )
|
||||
/********************************************************************/
|
||||
|
||||
/* Lit un fichier PCB .brd
|
||||
Si Append == 0: l'ancien pcb en memoire est supprime
|
||||
Sinon il y a ajout des elements
|
||||
* Si Append == 0: l'ancien pcb en memoire est supprime
|
||||
* Sinon il y a ajout des elements
|
||||
*/
|
||||
{
|
||||
char Line[1024];
|
||||
|
@ -752,24 +798,29 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
|
|||
LastModule = m_Pcb->m_Modules;
|
||||
for( ; LastModule != NULL; LastModule = (MODULE*) LastModule->Pnext )
|
||||
{
|
||||
if ( LastModule->Pnext == NULL ) break;
|
||||
if( LastModule->Pnext == NULL )
|
||||
break;
|
||||
}
|
||||
|
||||
LastStructPcb = m_Pcb->m_Drawings;
|
||||
for( ; LastStructPcb != NULL; LastStructPcb = LastStructPcb->Pnext )
|
||||
{
|
||||
if ( LastStructPcb->Pnext == NULL ) break;
|
||||
if( LastStructPcb->Pnext == NULL )
|
||||
break;
|
||||
}
|
||||
|
||||
LastEquipot = m_Pcb->m_Equipots;
|
||||
for( ; LastEquipot != NULL; LastEquipot = (EQUIPOT*) LastEquipot->Pnext )
|
||||
{
|
||||
if ( LastEquipot->Pnext == NULL ) break;
|
||||
if( LastEquipot->Pnext == NULL )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while( GetLine( File, Line, &LineNum ) != NULL )
|
||||
{
|
||||
|
||||
if(strnicmp(Line,"$EndPCB",6) == 0) break;
|
||||
if( strnicmp( Line, "$EndPCB", 6 ) == 0 )
|
||||
break;
|
||||
|
||||
if( strnicmp( Line, "$GENERAL", 8 ) == 0 )
|
||||
{
|
||||
|
@ -792,7 +843,8 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
|
|||
else
|
||||
{
|
||||
while( GetLine( File, Line, &LineNum ) != NULL )
|
||||
if( strnicmp(Line,"$EndSETUP",6) == 0 ) break;
|
||||
if( strnicmp( Line, "$EndSETUP", 6 ) == 0 )
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -815,13 +867,16 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
|
|||
m_Pcb->m_NbNets++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( Line, "$MODULE", 7 ) == 0 )
|
||||
{
|
||||
float Pas;
|
||||
Pas = 100.0; if( NbMod > 1) Pas /= NbMod;
|
||||
Pas = 100.0; if( NbMod > 1 )
|
||||
Pas /= NbMod;
|
||||
|
||||
Module = new MODULE( m_Pcb );
|
||||
if( Module == NULL ) continue;
|
||||
if( Module == NULL )
|
||||
continue;
|
||||
Module->ReadDescr( File, &LineNum );
|
||||
|
||||
if( LastModule == NULL )
|
||||
|
@ -939,7 +994,8 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
|
|||
{
|
||||
for( ; StartTrack != NULL; StartTrack = (TRACK*) StartTrack->Pnext )
|
||||
{
|
||||
if( StartTrack->Pnext == NULL ) break;
|
||||
if( StartTrack->Pnext == NULL )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -959,7 +1015,8 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
|
|||
{
|
||||
for( ; StartZone != NULL; StartZone = (TRACK*) StartZone->Pnext )
|
||||
{
|
||||
if( StartZone->Pnext == NULL ) break;
|
||||
if( StartZone->Pnext == NULL )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -979,7 +1036,7 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
|
|||
#ifdef PCBNEW
|
||||
Compile_Ratsnest( DC, TRUE );
|
||||
#endif
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -987,10 +1044,11 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
|
|||
/***************************************************/
|
||||
int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* File )
|
||||
/****************************************************/
|
||||
|
||||
/* Routine de sauvegarde du PCB courant sous format ASCII
|
||||
retourne
|
||||
1 si OK
|
||||
0 si sauvegarde non faite
|
||||
* retourne
|
||||
* 1 si OK
|
||||
* 0 si sauvegarde non faite
|
||||
*/
|
||||
{
|
||||
int ii, NbModules, nseg;
|
||||
|
@ -1008,7 +1066,9 @@ MODULE * Module;
|
|||
/* Calcul du nombre des modules */
|
||||
PtStruct = (EDA_BaseStruct*) m_Pcb->m_Modules;
|
||||
NbModules = 0;
|
||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext) NbModules++;
|
||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
|
||||
NbModules++;
|
||||
|
||||
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
|
||||
setlocale( LC_NUMERIC, "C" );
|
||||
/* Ecriture de l'entete PCB : */
|
||||
|
@ -1022,14 +1082,18 @@ MODULE * Module;
|
|||
/* Ecriture des donnes utiles du pcb */
|
||||
|
||||
Equipot = m_Pcb->m_Equipots;
|
||||
Pas = 100.0; if( m_Pcb->m_NbNets) Pas /= m_Pcb->m_NbNets;
|
||||
Pas = 100.0; if( m_Pcb->m_NbNets )
|
||||
Pas /= m_Pcb->m_NbNets;
|
||||
for( ii = 0; Equipot != NULL; ii++, Equipot = (EQUIPOT*) Equipot->Pnext )
|
||||
{
|
||||
Equipot->WriteEquipotDescr( File );
|
||||
DisplayActivity( (int) ( Pas * ii ), wxT( "Equipot:" ) );
|
||||
}
|
||||
|
||||
Pas = 100.0; if(NbModules) Pas /= NbModules;
|
||||
Pas = 100.0;
|
||||
if( NbModules )
|
||||
Pas /= NbModules;
|
||||
|
||||
Module = m_Pcb->m_Modules;
|
||||
for( ii = 1; Module != NULL; Module = Module->Next(), ii++ )
|
||||
{
|
||||
|
@ -1037,7 +1101,6 @@ MODULE * Module;
|
|||
DisplayActivity( (int) (ii * Pas), wxT( "Modules:" ) );
|
||||
}
|
||||
|
||||
|
||||
/* sortie des inscriptions du PCB: */
|
||||
PtStruct = m_Pcb->m_Drawings;
|
||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
|
||||
|
@ -1052,12 +1115,10 @@ MODULE * Module;
|
|||
( (DRAWSEGMENT*) PtStruct )->WriteDrawSegmentDescr( File );
|
||||
break;
|
||||
|
||||
|
||||
case TYPEMIRE:
|
||||
( (MIREPCB*) PtStruct )->WriteMirePcbDescr( File );
|
||||
break;
|
||||
|
||||
|
||||
case TYPECOTATION:
|
||||
( (COTATION*) PtStruct )->WriteCotationDescr( File );
|
||||
break;
|
||||
|
@ -1071,11 +1132,13 @@ MODULE * Module;
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
Pas = 100.0;
|
||||
if( m_Pcb->m_NbSegmTrack) Pas /= (m_Pcb->m_NbSegmTrack);
|
||||
if( m_Pcb->m_NbSegmTrack )
|
||||
Pas /= (m_Pcb->m_NbSegmTrack);
|
||||
|
||||
fprintf( File, "$TRACK\n" );
|
||||
PtSegm = m_Pcb->m_Track;
|
||||
|
||||
DisplayActivity( 0, wxT( "Tracks:" ) );
|
||||
for( nseg = 0, ii = 0; PtSegm != NULL; ii++, PtSegm = (TRACK*) PtSegm->Pnext )
|
||||
{
|
||||
|
@ -1086,13 +1149,19 @@ MODULE * Module;
|
|||
DisplayActivity( nseg, wxT( "Tracks:" ) );
|
||||
}
|
||||
}
|
||||
|
||||
fprintf( File, "$EndTRACK\n" );
|
||||
|
||||
fprintf( File, "$ZONE\n" );
|
||||
PtSegm = (TRACK*) m_Pcb->m_Zone;
|
||||
ii = m_Pcb->m_NbSegmZone;
|
||||
Pas = 100.0; if(ii) Pas /= ii;
|
||||
|
||||
Pas = 100.0;
|
||||
if( ii )
|
||||
Pas /= ii;
|
||||
|
||||
PtSegm = m_Pcb->m_Zone;
|
||||
|
||||
DisplayActivity( 0, wxT( "Zones:" ) );
|
||||
for( nseg = 0, ii = 0; PtSegm != NULL; ii++, PtSegm = (TRACK*) PtSegm->Pnext )
|
||||
{
|
||||
|
@ -1113,5 +1182,5 @@ MODULE * Module;
|
|||
Affiche_Message( wxEmptyString );
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue