Commit 5748b791 authored by dickelbeck's avatar dickelbeck

added some conditional DEBUG code for showing the pcb object tree in simple XML format

parent 02a2268f
......@@ -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:
......@@ -212,8 +213,8 @@ public:
CHEVELU* m_Ratsnest; // pointeur liste des chevelus
CHEVELU* m_LocalRatsnest; // pointeur liste des chevelus d'un module
EDGE_ZONE* m_CurrentLimitZone;/* pointeur sur la liste des segments
* de delimitation de la zone en cours de trace */
EDGE_ZONE* m_CurrentLimitZone; /* pointeur sur la liste des segments
* de delimitation de la zone en cours de trace */
BOARD( EDA_BaseStruct* StructFather, WinEDA_BasePcbFrame* frame );
~BOARD( void );
......@@ -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
This diff is collapsed.
/*******************************************************/
/* class_module.h : module description (excepted pads) */
/*******************************************************/
/*******************************************************/
/* class_module.h : module description (excepted pads) */
/*******************************************************/
class Pcb3D_GLCanvas;
class Struct3D_Master;
/************************************/
/* Modules (footprints) description */
/* pad are in class_pad.xx */
/************************************/
/************************************/
/* Modules (footprints) description */
/* pad are in class_pad.xx */
/************************************/
/* 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) */
......@@ -34,59 +35,60 @@ enum Mod_Attribut /* Attributs d'un module */
#define MODULE_is_PLACED 0x02 /* In autoplace: module automatically placed */
#define MODULE_to_PLACE 0x04 /* In autoplace: module waiting for autoplace */
class MODULE: public EDA_BaseStruct
class MODULE : public EDA_BaseStruct
{
public:
int m_Layer; // layer number
wxPoint m_Pos; // Real coord on board
D_PAD * m_Pads; /* Pad list (linked list) */
EDA_BaseStruct * m_Drawings; /* Graphic items list (linked list) */
Struct3D_Master * m_3D_Drawings; /* Pointeur sur la liste des elements de trace 3D*/
TEXTE_MODULE * m_Reference; // texte reference du composant (U34, R18..)
TEXTE_MODULE * m_Value; // texte valeur du composant (74LS00, 22K..)
wxString m_LibRef; /* nom du module en librairie */
int m_Attributs; /* Flags bits a bit ( voir enum Mod_Attribut ) */
int m_Orient ; /* orientation en 1/10 degres */
int flag ; /* flag utilise en trace rastnest et routage auto */
int m_ModuleStatus; /* For autoplace: flags (LOCKED, AUTOPLACED) */
EDA_Rect m_BoundaryBox; /* position/taille du cadre de reperage (coord locales)*/
EDA_Rect m_RealBoundaryBox ; /* position/taille du module (coord relles) */
int m_PadNum; // Nombre total de pads
int m_AltPadNum; // en placement auto Nombre de pads actifs pour
// les calculs
int m_CntRot90; // Placement auto: cout ( 0..10 ) de la rotation 90 degre
int m_CntRot180; // Placement auto: cout ( 0..10 ) de la rotation 180 degre
wxSize m_Ext; // marges de "garde": utilise en placement auto.
float m_Surface; // surface du rectangle d'encadrement
unsigned long m_Link; // variable temporaire ( pour editions, ...)
long m_LastEdit_Time; // Date de la derniere modification du module (gestion de librairies)
wxString m_Doc; // Texte de description du module
wxString m_KeyWord; // Liste des mots cles relatifs au module
int m_Layer; // layer number
wxPoint m_Pos; // Real coord on board
D_PAD* m_Pads; /* Pad list (linked list) */
EDA_BaseStruct* m_Drawings; /* Graphic items list (linked list) */
Struct3D_Master* m_3D_Drawings; /* Pointeur sur la liste des elements de trace 3D*/
TEXTE_MODULE* m_Reference; // texte reference du composant (U34, R18..)
TEXTE_MODULE* m_Value; // texte valeur du composant (74LS00, 22K..)
wxString m_LibRef; /* nom du module en librairie */
int m_Attributs; /* Flags bits a bit ( voir enum Mod_Attribut ) */
int m_Orient; /* orientation en 1/10 degres */
int flag; /* flag utilise en trace rastnest et routage auto */
int m_ModuleStatus; /* For autoplace: flags (LOCKED, AUTOPLACED) */
EDA_Rect m_BoundaryBox; /* position/taille du cadre de reperage (coord locales)*/
EDA_Rect m_RealBoundaryBox; /* position/taille du module (coord relles) */
int m_PadNum; // Nombre total de pads
int m_AltPadNum; // en placement auto Nombre de pads actifs pour
// les calculs
int m_CntRot90; // Placement auto: cout ( 0..10 ) de la rotation 90 degre
int m_CntRot180; // Placement auto: cout ( 0..10 ) de la rotation 180 degre
wxSize m_Ext; // marges de "garde": utilise en placement auto.
float m_Surface; // surface du rectangle d'encadrement
unsigned long m_Link; // variable temporaire ( pour editions, ...)
long m_LastEdit_Time; // Date de la derniere modification du module (gestion de librairies)
wxString m_Doc; // Texte de description du module
wxString m_KeyWord; // Liste des mots cles relatifs au module
public:
MODULE(BOARD * parent);
MODULE(MODULE * module);
~MODULE(void);
MODULE( BOARD* parent );
MODULE( MODULE* module );
~MODULE( void );
void Copy( MODULE* Module ); // Copy structure
void Copy(MODULE * Module); // Copy structure
MODULE * Next(void) { return (MODULE *) Pnext; }
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) */
void Set_Rectangle_Encadrement( void );/* mise a jour du rect d'encadrement
* 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 */
void SetRectangleExinscrit( void );/* mise a jour du rect d'encadrement
* et de la surface en coord reelles */
// deplacements
void SetPosition(const wxPoint & newpos);
void SetOrientation(int newangle);
void SetPosition( const wxPoint& newpos );
void SetOrientation( int newangle );
/* supprime du chainage la structure Struct */
void UnLink( void );
void UnLink( void );
/**
......@@ -98,11 +100,11 @@ public:
return (m_ModuleStatus & MODULE_is_LOCKED) != 0;
}
/**
* Function SetLocked
* sets the MODULE_is_LOCKED bit in the m_ModuleStatus
* @param setLocked When true means turn on locked status, else unlock
* @param setLocked When true means turn on locked status, else unlock
*/
void SetLocked( bool setLocked )
{
......@@ -112,23 +114,34 @@ public:
m_ModuleStatus &= ~MODULE_is_LOCKED;
}
/* Readind and writing data on files */
int WriteDescr( FILE * File );
int Write_3D_Descr( FILE * File );
int ReadDescr( FILE * File, int * LineNum = NULL);
int Read_3D_Descr( FILE * File, int * LineNum = NULL);
int WriteDescr( FILE* File );
int Write_3D_Descr( FILE* File );
int ReadDescr( FILE* File, int* LineNum = NULL );
int Read_3D_Descr( FILE* File, int* LineNum = NULL );
/* drawing functions */
void Draw(WinEDA_DrawPanel * panel, wxDC * DC,
const wxPoint & offset, int draw_mode);
void Draw3D(Pcb3D_GLCanvas * glcanvas);
void DrawEdgesOnly(WinEDA_DrawPanel * panel, wxDC * DC,
const wxPoint & offset,int draw_mode);
void DrawAncre(WinEDA_DrawPanel * panel, wxDC * DC,
const wxPoint & offset, int dim_ancre, int draw_mode);
void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int draw_mode );
void Draw3D( Pcb3D_GLCanvas* glcanvas );
void DrawEdgesOnly( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int draw_mode );
void DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int dim_ancre, int draw_mode );
/* miscellaneous */
void Display_Infos(WinEDA_BasePcbFrame * frame);
};
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
};
This diff is collapsed.
This diff is collapsed.
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