search and debug infrastructure, beautification

This commit is contained in:
dickelbeck 2007-08-07 06:21:19 +00:00
parent dda28ed69a
commit f8f384384a
16 changed files with 1294 additions and 969 deletions

View File

@ -171,7 +171,7 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/*********************************************/
wxString EDA_BaseStruct::ReturnClassName( void )
wxString EDA_BaseStruct::ReturnClassName() const
/*********************************************/
/* Used at run time for diags: return the class name of the item,
@ -202,7 +202,7 @@ wxString EDA_BaseStruct::ReturnClassName( void )
void EDA_BaseStruct::Show( int nestLevel, std::ostream& os )
{
// for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << ReturnClassName().mb_str() << ">\n";
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
EDA_BaseStruct* kid = m_Son;
for( ; kid; kid = kid->Pnext )
@ -210,7 +210,7 @@ void EDA_BaseStruct::Show( int nestLevel, std::ostream& os )
kid->Show( nestLevel+1, os );
}
NestedSpace( nestLevel, os ) << "</" << ReturnClassName().mb_str() << ">\n";
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
}
@ -236,7 +236,7 @@ SEARCH_RESULT EDA_BaseStruct::IterateForward( EDA_BaseStruct* listStart,
EDA_BaseStruct* p = listStart;
for( ; p; p = p->Pnext )
{
if( SEARCH_QUIT == p->Traverse( inspector, testData, scanTypes ) )
if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) )
return SEARCH_QUIT;
}
@ -245,7 +245,7 @@ SEARCH_RESULT EDA_BaseStruct::IterateForward( EDA_BaseStruct* listStart,
// see base_struct.h
SEARCH_RESULT EDA_BaseStruct::Traverse( INSPECTOR* inspector, const void* testData,
SEARCH_RESULT EDA_BaseStruct::Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] )
{
KICAD_T stype;

View File

@ -164,7 +164,7 @@ public:
m_Status = new_status;
}
wxString ReturnClassName( void );
wxString ReturnClassName() const;
/* addition d'une nouvelle struct a la liste chain<69> */
void AddToChain( EDA_BaseStruct* laststruct );
@ -179,6 +179,23 @@ public:
int Color = -1 );
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
virtual wxString GetClass() const
{
// ReturnClassName() is too hard to maintain, coordinating the array
// with the enum. It would be nice to migrate to virtual GetClass()
// away from ReturnClassName(). Over time, derived classes should
// simply return a wxString from their virtual GetClass() function.
// Some classes do that now.
return ReturnClassName();
}
/**
* Function Show
* is used to output the object tree, currently for debugging only.
@ -221,7 +238,7 @@ public:
/**
* Function Traverse
* Function Visit
* should be re-implemented for each derived class in order to handle
* all the types given by its member data. Implementations should call
* inspector->Inspect() on types in scanTypes[], and may use IterateForward()
@ -231,9 +248,9 @@ public:
* @param scanTypes Which KICAD_T types are of interest and the order
* is significant too, terminated by EOT.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
* else SCAN_CONTINUE, and determined by the inspector.
*/
virtual SEARCH_RESULT Traverse( INSPECTOR* inspector, const void* testData,
virtual SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] );

View File

@ -1,11 +1,11 @@
/****************************************************/
/* drawpanel_wxstruct.h: */
/* descriptions des principales classes utilisees: */
/* ici classe: "WinEDA_DrawPanel", "BASE_SCREEN" */
/*****************************************************/
/****************************************************/
/* drawpanel_wxstruct.h: */
/* descriptions des principales classes utilisees: */
/* ici classe: "WinEDA_DrawPanel", "BASE_SCREEN" */
/*****************************************************/
/* Doit etre inclus dans "wxstruch.h"
*/
*/
#ifndef PANEL_WXSTRUCT_H
#define PANEL_WXSTRUCT_H
@ -17,17 +17,17 @@
#include "colors.h"
/****************************************************/
/* classe representant un ecran graphique de dessin */
/****************************************************/
/****************************************************/
/* classe representant un ecran graphique de dessin */
/****************************************************/
class WinEDA_DrawPanel: public EDA_DRAW_PANEL
class WinEDA_DrawPanel : public EDA_DRAW_PANEL
{
public:
int m_Ident;
WinEDA_DrawFrame * m_Parent;
WinEDA_DrawFrame* m_Parent;
EDA_Rect m_ClipBox; /* position et taille de la fenetre de trace
pour les "RePaint" d'ecran */
* pour les "RePaint" d'ecran */
wxPoint m_CursorStartPos; // utile dans controles du mouvement curseur
int m_Scroll_unit; // Valeur de l'unite de scroll en pixels pour les barres de scroll
int m_ScrollButt_unit; // Valeur de l'unite de scroll en pixels pour les boutons de scroll
@ -35,12 +35,12 @@ public:
bool m_AbortRequest; // Flag d'arret de commandes longues
bool m_AbortEnable; // TRUE si menu ou bouton Abort doit etre affiche
bool m_AutoPAN_Enable; // TRUE pour autoriser auto pan (autorisation générale)
bool m_AutoPAN_Request; // TRUE pour auto pan (lorsque auto pan nécessaire)
bool m_AutoPAN_Enable; // TRUE pour autoriser auto pan (autorisation g<><67>ale)
bool m_AutoPAN_Request; // TRUE pour auto pan (lorsque auto pan n<>essaire)
bool m_IgnoreMouseEvents; // TRUE pour ne par traiter les evenements souris
bool m_Block_Enable; // TRUE pour autoriser Bloc Commandes (autorisation générale)
bool m_Block_Enable; // TRUE pour autoriser Bloc Commandes (autorisation g<><67>ale)
int m_CanStartBlock; // >= 0 (ou >= n) si un bloc peut demarrer
// (filtrage des commandes de debut de bloc )
int m_PanelDefaultCursor; // Current mouse cursor default shape id for this window
@ -48,60 +48,62 @@ public:
int m_CursorLevel; // Index for cursor redraw in XOR mode
/* Cursor management (used in editing functions) */
void (*ManageCurseur)(WinEDA_DrawPanel * panel, wxDC * DC, bool erase); /* Fonction d'affichage sur deplacement souris
si erase : effacement ancien affichage */
void (*ForceCloseManageCurseur)(WinEDA_DrawPanel * panel, wxDC * DC); /* Fonction de fermeture forcée
de la fonction ManageCurseur */
void (*ManageCurseur)(WinEDA_DrawPanel * panel, wxDC * DC, bool erase);/* Fonction d'affichage sur deplacement souris
* si erase : effacement ancien affichage */
void (*ForceCloseManageCurseur)(WinEDA_DrawPanel * panel, wxDC * DC);/* Fonction de fermeture forc<72>
* de la fonction ManageCurseur */
public:
// Constructor and destructor
WinEDA_DrawPanel(WinEDA_DrawFrame *parent, int id, const wxPoint& pos, const wxSize& size);
~WinEDA_DrawPanel(void){}
/****************************/
BASE_SCREEN * GetScreen(void) { return m_Parent->m_CurrentScreen; }
void PrepareGraphicContext(wxDC * DC);
wxPoint CalcAbsolutePosition(const wxPoint & rel_pos);
bool IsPointOnDisplay(wxPoint ref_pos);
void OnPaint(wxPaintEvent & event);
void OnSize(wxSizeEvent & event);
void SetBoundaryBox(void);
void ReDraw(wxDC * DC, bool erasebg = TRUE);
void PrintPage(wxDC * DC, bool Print_Sheet_Ref, int PrintMask);
void DrawBackGround(wxDC * DC);
void m_Draw_Auxiliary_Axis(wxDC * DC, int drawmode);
void OnEraseBackground(wxEraseEvent& event);
void OnActivate(wxActivateEvent& event);
// Constructor and destructor
WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos, const wxSize& size );
~WinEDA_DrawPanel( void ) { }
/****************************/
BASE_SCREEN* GetScreen( void ) { return m_Parent->m_CurrentScreen; }
void PrepareGraphicContext( wxDC* DC );
wxPoint CalcAbsolutePosition( const wxPoint& rel_pos );
bool IsPointOnDisplay( wxPoint ref_pos );
void OnPaint( wxPaintEvent& event );
void OnSize( wxSizeEvent& event );
void SetBoundaryBox( void );
void ReDraw( wxDC* DC, bool erasebg = TRUE );
void PrintPage( wxDC* DC, bool Print_Sheet_Ref, int PrintMask );
void DrawBackGround( wxDC* DC );
void m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode );
void OnEraseBackground( wxEraseEvent& event );
void OnActivate( wxActivateEvent& event );
/* Mouse and keys events */
void OnMouseEvent(wxMouseEvent& event);
void OnMouseLeaving(wxMouseEvent& event);
void OnKeyEvent(wxKeyEvent& event);
void OnMouseEvent( wxMouseEvent& event );
void OnMouseLeaving( wxMouseEvent& event );
void OnKeyEvent( wxKeyEvent& event );
/*************************/
void EraseScreen(wxDC * DC);
void OnScrollWin( wxCommandEvent &event );
void OnScroll( wxScrollWinEvent &event );
void EraseScreen( wxDC* DC );
void OnScrollWin( wxCommandEvent& event );
void OnScroll( wxScrollWinEvent& event );
void SetZoom(int mode);
int GetZoom(void);
void SetGrid(const wxSize & size);
wxSize GetGrid(void);
void SetZoom( int mode );
int GetZoom( void );
void SetGrid( const wxSize& size );
wxSize GetGrid( void );
void AddMenuZoom( wxMenu * MasterMenu );
void OnRightClick(wxMouseEvent& event);
void Process_Popup_Zoom( wxCommandEvent &event );
void Process_Special_Functions(wxCommandEvent& event);
wxPoint CursorRealPosition(const wxPoint & ScreenPos);
wxPoint CursorScreenPosition(void);
wxPoint GetScreenCenterRealPosition(void);
void MouseToCursorSchema(void);
void MouseTo(const wxPoint & Mouse);
void AddMenuZoom( wxMenu* MasterMenu );
void OnRightClick( wxMouseEvent& event );
void Process_Popup_Zoom( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event );
wxPoint CursorRealPosition( const wxPoint& ScreenPos );
wxPoint CursorScreenPosition( void );
wxPoint GetScreenCenterRealPosition( void );
void MouseToCursorSchema( void );
void MouseTo( const wxPoint& Mouse );
/* Cursor functions */
void Trace_Curseur(wxDC * DC, int color = WHITE); // Draw the user cursor (grid cursor)
void CursorOff(wxDC * DC); // remove the grid cursor from the display
void CursorOn(wxDC * DC); // display the grid cursor
void Trace_Curseur( wxDC* DC, int color = WHITE ); // Draw the user cursor (grid cursor)
void CursorOff( wxDC* DC ); // remove the grid cursor from the display
void CursorOn( wxDC* DC ); // display the grid cursor
DECLARE_EVENT_TABLE()
};
@ -116,7 +118,8 @@ typedef enum { /* definition de l'etat du block */
STATE_BLOCK_END, /* Block initialise: 2eme point defini */
STATE_BLOCK_MOVE, /* Block en deplacement */
STATE_BLOCK_STOP /* Block fixe (fin de deplacement) */
} BlockState;
} BlockState;
/* codes des differentes commandes sur block: */
typedef enum {
@ -135,33 +138,35 @@ typedef enum {
BLOCK_SELECT_ITEMS_ONLY,
BLOCK_MIRROR_X,
BLOCK_MIRROR_Y
} CmdBlockType;
class DrawBlockStruct: public EDA_BaseStruct, public EDA_Rect
class DrawBlockStruct : public EDA_BaseStruct
, public EDA_Rect
{
public:
BlockState m_State; /* Etat (enum BlockState) du block */
CmdBlockType m_Command; /* Type (enum CmdBlockType) d'operation */
EDA_BaseStruct *m_BlockDrawStruct; /* pointeur sur la structure
selectionnee dans le bloc */
EDA_BaseStruct* m_BlockDrawStruct; /* pointeur sur la structure
* selectionnee dans le bloc */
int m_Color; /* Block Color */
wxPoint m_MoveVector; /* Move distance in move, drag, copy ... command */
wxPoint m_BlockLastCursorPosition; /* Last Mouse position in block command
= last cursor position in move commands
= 0,0 in block paste */
wxPoint m_BlockLastCursorPosition;/* Last Mouse position in block command
* = last cursor position in move commands
* = 0,0 in block paste */
public:
DrawBlockStruct(void);
~DrawBlockStruct(void);
void SetMessageBlock(WinEDA_DrawFrame * frame);
void Draw(WinEDA_DrawPanel * panel, wxDC * DC);
DrawBlockStruct( void );
~DrawBlockStruct( void );
void SetMessageBlock( WinEDA_DrawFrame* frame );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC );
};
/*******************************************************************/
/* Class to handle how to draw a screen (a board, a schematic ...) */
/*******************************************************************/
class BASE_SCREEN: public EDA_BaseStruct
class BASE_SCREEN : public EDA_BaseStruct
{
public:
int m_Type; /* indicateur: type d'ecran */
@ -170,31 +175,31 @@ public:
wxPoint m_MousePosition; /* Mouse cursor coordinate (off grid) in user units. */
wxPoint m_MousePositionInPixels; /* Mouse cursor coordinate (off grid) in pixels. */
wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid) in user units.
(coordinates from last reset position)*/
* (coordinates from last reset position)*/
wxPoint m_ScrollbarPos; // Position effective des Curseurs de scroll
wxSize m_ScrollbarNumber; /* Valeur effective des Nombres de Scrool
c.a.d taille en unites de scroll de la surface totale affichable */
wxPoint m_StartVisu; // Coord absolues du 1er pixel visualisé a l'ecran (en nombre de pixels)
wxSize m_ScrollbarNumber;/* Valeur effective des Nombres de Scrool
* c.a.d taille en unites de scroll de la surface totale affichable */
wxPoint m_StartVisu; // Coord absolues du 1er pixel visualis<69>a l'ecran (en nombre de pixels)
wxSize m_SizeVisu; /* taille en pixels de l'ecran (fenetre de visu
Utile pour recadrer les affichages lors de la
navigation dans la hierarchie */
* Utile pour recadrer les affichages lors de la
* navigation dans la hierarchie */
bool m_Center; // TRUE: coord algebriques, FALSE: coord >= 0
bool m_FirstRedraw;
/* Gestion des editions */
EDA_BaseStruct *EEDrawList; /* Object list (main data) for schematic */
EDA_BaseStruct * m_UndoList; /* Object list for the undo command (old data) */
EDA_BaseStruct * m_RedoList; /* Object list for the redo command (old data) */
EDA_BaseStruct* EEDrawList; /* Object list (main data) for schematic */
EDA_BaseStruct* m_UndoList; /* Object list for the undo command (old data) */
EDA_BaseStruct* m_RedoList; /* Object list for the redo command (old data) */
int m_UndoRedoCountMax; /* undo/Redo command Max depth */
EDA_BaseStruct * m_CurrentItem; /* Current selected object */
EDA_BaseStruct* m_CurrentItem; /* Current selected object */
/* block control */
DrawBlockStruct BlockLocate; /* Bock description for block commands */
/* Page description */
Ki_PageDescr * m_CurrentSheet;
int m_SheetNumber, m_NumberOfSheet; /* gestion hierarchie: numero de sousfeuille
et nombre de feuilles. Root: SheetNumber = 1 */
Ki_PageDescr* m_CurrentSheet;
int m_SheetNumber, m_NumberOfSheet;/* gestion hierarchie: numero de sousfeuille
* et nombre de feuilles. Root: SheetNumber = 1 */
wxString m_FileName;
wxString m_Title; /* titre de la feuille */
wxString m_Date; /* date de mise a jour */
@ -213,62 +218,76 @@ private:
/* Valeurs du pas de grille et du zoom */
public:
wxSize m_Grid ; /* pas de la grille (peut differer en X et Y) */
wxSize * m_GridList; /* Liste des valeurs standard de grille */
wxSize m_Grid; /* pas de la grille (peut differer en X et Y) */
wxSize* m_GridList; /* Liste des valeurs standard de grille */
wxRealPoint m_UserGrid; /* pas de la grille utilisateur */
int m_UserGridUnit; /* unité grille utilisateur (0 = inch, 1 = mm */
int m_Diviseur_Grille ;
int m_UserGridUnit; /* unit<69>grille utilisateur (0 = inch, 1 = mm */
int m_Diviseur_Grille;
bool m_UserGridIsON;
int * m_ZoomList; /* Liste des coefficients standard de zoom */
int m_Zoom ; /* coeff de ZOOM */
int* m_ZoomList; /* Liste des coefficients standard de zoom */
int m_Zoom; /* coeff de ZOOM */
public:
BASE_SCREEN(int idscreen);
~BASE_SCREEN(void);
BASE_SCREEN( int idscreen );
~BASE_SCREEN( void );
void InitDatas(void); /* Inits completes des variables */
wxSize ReturnPageSize(void);
int GetInternalUnits(void);
void InitDatas( void );/* Inits completes des variables */
wxSize ReturnPageSize( void );
int GetInternalUnits( void );
wxPoint CursorRealPosition(const wxPoint & ScreenPos);
wxPoint CursorRealPosition( const wxPoint& ScreenPos );
/* general Undo/Redo command control */
virtual void ClearUndoRedoList(void);
virtual void AddItemToUndoList(EDA_BaseStruct * item);
virtual void AddItemToRedoList(EDA_BaseStruct * item);
virtual EDA_BaseStruct * GetItemFromUndoList(void);
virtual EDA_BaseStruct * GetItemFromRedoList(void);
virtual void ClearUndoRedoList( void );
virtual void AddItemToUndoList( EDA_BaseStruct* item );
virtual void AddItemToRedoList( EDA_BaseStruct* item );
virtual EDA_BaseStruct* GetItemFromUndoList( void );
virtual EDA_BaseStruct* GetItemFromRedoList( void );
/* Manipulation des flags */
void SetRefreshReq(void) { m_FlagRefreshReq = 1; }
void ClrRefreshReq(void) { m_FlagRefreshReq = 0; }
void SetModify(void) { m_FlagModified = 1; m_FlagSave = 0; }
void ClrModify(void) { m_FlagModified = 0; m_FlagSave = 1; }
void SetSave(void) { m_FlagSave = 1; }
void ClrSave(void) { m_FlagSave = 0; }
int IsModify(void) { return (m_FlagModified & 1); }
int IsRefreshReq(void) { return (m_FlagRefreshReq & 1); }
int IsSave(void) { return (m_FlagSave & 1); }
void SetRefreshReq( void ) { m_FlagRefreshReq = 1; }
void ClrRefreshReq( void ) { m_FlagRefreshReq = 0; }
void SetModify( void ) { m_FlagModified = 1; m_FlagSave = 0; }
void ClrModify( void ) { m_FlagModified = 0; m_FlagSave = 1; }
void SetSave( void ) { m_FlagSave = 1; }
void ClrSave( void ) { m_FlagSave = 0; }
int IsModify( void ) { return m_FlagModified & 1; }
int IsRefreshReq( void ) { return m_FlagRefreshReq & 1; }
int IsSave( void ) { return m_FlagSave & 1; }
/* fonctions relatives au zoom */
int GetZoom(void); /* retourne le coeff de zoom */
void SetZoom(int coeff) ; /* ajuste le coeff de zoom a coeff */
void SetZoomList(int * zoomlist); /* init liste des zoom (NULL terminated) */
void SetNextZoom(void); /* ajuste le prochain coeff de zoom */
void SetPreviousZoom(void); /* ajuste le precedent coeff de zoom */
void SetFirstZoom(void); /* ajuste le coeff de zoom a 1*/
void SetLastZoom(void); /* ajuste le coeff de zoom au max */
int GetZoom( void ); /* retourne le coeff de zoom */
void SetZoom( int coeff ); /* ajuste le coeff de zoom a coeff */
void SetZoomList( int* zoomlist ); /* init liste des zoom (NULL terminated) */
void SetNextZoom( void ); /* ajuste le prochain coeff de zoom */
void SetPreviousZoom( void ); /* ajuste le precedent coeff de zoom */
void SetFirstZoom( void ); /* ajuste le coeff de zoom a 1*/
void SetLastZoom( void ); /* ajuste le coeff de zoom au max */
/* fonctions relatives a la grille */
wxSize GetGrid(void); /* retourne la grille */
void SetGrid(const wxSize & size);
void SetGridList(wxSize * sizelist); /* init liste des grilles (NULL terminated) */
void SetNextGrid(void); /* ajuste le prochain coeff de grille */
void SetPreviousGrid(void); /* ajuste le precedent coeff de grille */
void SetFirstGrid(void); /* ajuste la grille au mini*/
void SetLastGrid(void); /* ajuste la grille au max */
wxSize GetGrid( void ); /* retourne la grille */
void SetGrid( const wxSize& size );
void SetGridList( wxSize* sizelist ); /* init liste des grilles (NULL terminated) */
void SetNextGrid( void ); /* ajuste le prochain coeff de grille */
void SetPreviousGrid( void ); /* ajuste le precedent coeff de grille */
void SetFirstGrid( void ); /* ajuste la grille au mini*/
void SetLastGrid( void ); /* ajuste la grille au max */
#if defined (DEBUG)
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
virtual wxString GetClass() const
{
return wxT( "BASE_SCREEN" );
}
#endif
};
#endif /* PANEL_WXSTRUCT_H */

View File

@ -234,6 +234,18 @@ public:
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
virtual wxString GetClass() const
{
return wxT( "BOARD" );
}
/**
* Function Show
* is used to output the object tree, currently for debugging only.

View File

@ -257,6 +257,7 @@ bool BOARD::ComputeBoundaryBox( void )
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
@ -267,7 +268,7 @@ bool BOARD::ComputeBoundaryBox( void )
void BOARD::Show( int nestLevel, std::ostream& os )
{
// for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << ReturnClassName().mb_str() << ">\n";
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
// specialization of the output:
EDA_BaseStruct* p = m_Modules;
@ -284,11 +285,10 @@ void BOARD::Show( int nestLevel, std::ostream& os )
kid->Show( nestLevel+1, os );
}
NestedSpace( nestLevel, os ) << "</" << ReturnClassName().mb_str() << ">\n";
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
}
class ModuleOrPad : public INSPECTOR
{
public:

View File

@ -446,7 +446,7 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File,
void EDGE_MODULE::Show( int nestLevel, std::ostream& os )
{
// for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << ReturnClassName().mb_str() << "/>\n";
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << "/>\n";
}
#endif

View File

@ -43,6 +43,17 @@ public:
void Draw3D( Pcb3D_GLCanvas* glcanvas );
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
virtual wxString GetClass() const
{
return wxT( "POLYLINE" );
// return wxT( "EDGE" ); ?
}
/**
* Function Show
* is used to output the object tree, currently for debugging only.

View File

@ -1158,7 +1158,7 @@ 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() <<
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
// " ref=\"" << m_Reference->m_Text.mb_str() <<
// "\" value=\"" << m_Value->m_Text.mb_str() << '"' <<
">\n";
@ -1173,6 +1173,10 @@ void MODULE::Show( int nestLevel, std::ostream& os )
for( ; p; p = p->Pnext )
p->Show( nestLevel+1, os );
p = m_Pads;
for( ; p; p = p->Pnext )
p->Show( nestLevel+1, os );
p = m_Drawings;
for( ; p; p = p->Pnext )
p->Show( nestLevel+1, os );
@ -1183,12 +1187,12 @@ void MODULE::Show( int nestLevel, std::ostream& os )
p->Show( nestLevel+1, os );
}
NestedSpace( nestLevel, os ) << "</" << ReturnClassName().mb_str() << ">\n";
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
}
// see class_module.h
SEARCH_RESULT MODULE::Traverse( INSPECTOR* inspector, const void* testData,
SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] )
{
KICAD_T stype;
@ -1201,13 +1205,6 @@ SEARCH_RESULT MODULE::Traverse( INSPECTOR* inspector, const void* testData,
if( SEARCH_QUIT == inspector->Inspect( this, testData ) )
return SEARCH_QUIT;
}
else if( stype == TYPEEDGEMODULE )
{
// iterate over m_Drawings
if( SEARCH_QUIT == IterateForward( m_Drawings, inspector,
testData, scanTypes ) )
return SEARCH_QUIT;
}
else if( stype == TYPETEXTEMODULE )
{
// iterate over m_Reference
@ -1220,6 +1217,19 @@ SEARCH_RESULT MODULE::Traverse( INSPECTOR* inspector, const void* testData,
testData, scanTypes ) )
return SEARCH_QUIT;
}
else if( stype == TYPEPAD )
{
if( SEARCH_QUIT == IterateForward( m_Pads, inspector,
testData, scanTypes ) )
return SEARCH_QUIT;
}
else if( stype == TYPEEDGEMODULE )
{
// iterate over m_Drawings
if( SEARCH_QUIT == IterateForward( m_Drawings, inspector,
testData, scanTypes ) )
return SEARCH_QUIT;
}
}
return SEARCH_CONTINUE;

View File

@ -27,9 +27,9 @@ enum Mod_Attribut /* Attributs d'un module */
* fichiers de placement automatique (principalement modules CMS */
MOD_VIRTUAL = 2 /* Module virtuel constitue par un dessin sur circuit
* (connecteur, trou de percage..) */
};
/* flags for autoplace and autoroute (.m_ModuleStatus member) */
#define MODULE_is_LOCKED 0x01 /* module LOCKED: no autoplace allowed */
#define MODULE_is_PLACED 0x02 /* In autoplace: module automatically placed */
@ -56,6 +56,7 @@ public:
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.
@ -82,7 +83,6 @@ public:
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 );
@ -134,6 +134,18 @@ public:
void Display_Infos( WinEDA_BasePcbFrame* frame );
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
virtual wxString GetClass() const
{
return wxT( "MODULE" );
}
/**
* Function Show
* is used to output the object tree, currently for debugging only.
@ -145,8 +157,8 @@ public:
/**
* Function Traverse
* should be re-implemented for each derrived class in order to handle
* Function Visit
* should be re-implemented for each derived class in order to handle
* all the types given by its member data. Implementations should call
* inspector->Inspect() on types in scanTypes[], and may use IterateForward()
* to do so on lists of such data.
@ -157,7 +169,7 @@ public:
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
*/
virtual SEARCH_RESULT Traverse( INSPECTOR* inspector, const void* testData,
virtual SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] );
#endif

File diff suppressed because it is too large Load Diff

View File

@ -74,7 +74,7 @@ public:
/* supprime du chainage la structure Struct */
void UnLink( void );
/* Readind and writing data on files */
/* Reading and writing data on files */
int ReadDescr( FILE* File, int* LineNum = NULL );
int WriteDescr( FILE* File );
@ -83,7 +83,7 @@ public:
void Draw3D( Pcb3D_GLCanvas* glcanvas );
// autres
void SetPadName( const wxString& name ); // Change pade name
void SetPadName( const wxString& name ); // Change pad name
wxString ReturnStringPadName( void ); // Return pad name as string in a wxString
void ReturnStringPadName( wxString& text ); // Return pad name as string in a buffer
void ComputeRayon( void ); // met a jour m_Rayon, rayon du cercle exinscrit
@ -91,6 +91,28 @@ public:
// de la forme (pastilles excentrees)
void Display_Infos( WinEDA_BasePcbFrame* frame );
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
virtual wxString GetClass() const
{
return wxT( "PAD" );
}
/**
* 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
};
typedef class D_PAD * LISTE_PAD;

View File

@ -11,22 +11,25 @@
#include "pcbnew.h"
/*******************/
/* class TEXTE_PCB */
/*******************/
/*******************/
/* class TEXTE_PCB */
/*******************/
TEXTE_PCB::TEXTE_PCB(EDA_BaseStruct * parent):
EDA_BaseStruct(parent, TYPETEXTE), EDA_TextStruct()
TEXTE_PCB::TEXTE_PCB( EDA_BaseStruct* parent ) :
EDA_BaseStruct( parent, TYPETEXTE ),
EDA_TextStruct()
{
}
/* Destructeur */
TEXTE_PCB:: ~TEXTE_PCB(void)
TEXTE_PCB:: ~TEXTE_PCB( void )
{
}
/* copie de stucture */
void TEXTE_PCB::Copy(TEXTE_PCB * source)
void TEXTE_PCB::Copy( TEXTE_PCB* source )
{
m_Parent = source->m_Parent;
Pback = Pnext = NULL;
@ -44,97 +47,126 @@ void TEXTE_PCB::Copy(TEXTE_PCB * source)
m_Text = source->m_Text;
}
void TEXTE_PCB::UnLink( void )
{
/* Modification du chainage arriere */
if( Pback )
{
if( Pback->m_StructType != TYPEPCB)
if( Pback->m_StructType != TYPEPCB )
{
Pback->Pnext = Pnext;
}
else /* Le chainage arriere pointe sur la structure "Pere" */
{
((BOARD*)Pback)->m_Drawings = Pnext;
( (BOARD*) Pback )->m_Drawings = Pnext;
}
}
/* Modification du chainage avant */
if( Pnext) Pnext->Pback = Pback;
if( Pnext )
Pnext->Pback = Pback;
Pnext = Pback = NULL;
}
/****************************************************************/
int TEXTE_PCB::ReadTextePcbDescr(FILE * File, int * LineNum)
int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum )
/****************************************************************/
{
char text[1024], Line[1024];
int dummy;
char text[1024], Line[1024];
int dummy;
while( GetLine(File, Line, LineNum ) != NULL )
while( GetLine( File, Line, LineNum ) != NULL )
{
if(strnicmp(Line,"$EndTEXTPCB",11) == 0) return 0;
if( strncmp(Line,"Te", 2) == 0 ) /* Texte */
if( strnicmp( Line, "$EndTEXTPCB", 11 ) == 0 )
return 0;
if( strncmp( Line, "Te", 2 ) == 0 ) /* Texte */
{
ReadDelimitedText(text, Line+2, sizeof(text) );
m_Text = CONV_FROM_UTF8(text);
ReadDelimitedText( text, Line + 2, sizeof(text) );
m_Text = CONV_FROM_UTF8( text );
continue;
}
if( strncmp(Line,"Po", 2) == 0 )
if( strncmp( Line, "Po", 2 ) == 0 )
{
sscanf( Line+2," %d %d %d %d %d %d",
sscanf( Line + 2, " %d %d %d %d %d %d",
&m_Pos.x, &m_Pos.y, &m_Size.x, &m_Size.y,
&m_Width, &m_Orient);
&m_Width, &m_Orient );
continue;
}
if( strncmp(Line,"De", 2) == 0 )
if( strncmp( Line, "De", 2 ) == 0 )
{
sscanf( Line+2," %d %d %lX %d\n",&m_Layer, &m_Miroir,
&m_TimeStamp, &dummy);
if ( m_Layer < LAYER_CUIVRE_N )
sscanf( Line + 2, " %d %d %lX %d\n", &m_Layer, &m_Miroir,
&m_TimeStamp, &dummy );
if( m_Layer < LAYER_CUIVRE_N )
m_Layer = LAYER_CUIVRE_N;
if ( m_Layer > LAST_NO_COPPER_LAYER )
if( m_Layer > LAST_NO_COPPER_LAYER )
m_Layer = LAST_NO_COPPER_LAYER;
continue;
}
}
return(1);
return 1;
}
/**************************************************/
int TEXTE_PCB::WriteTextePcbDescr(FILE * File)
int TEXTE_PCB::WriteTextePcbDescr( FILE* File )
/**************************************************/
{
if( GetState(DELETED) ) return(0);
if( GetState( DELETED ) )
return 0;
if(m_Text.IsEmpty() ) return(0);
fprintf( File,"$TEXTPCB\n");
fprintf( File,"Te \"%s\"\n",CONV_TO_UTF8(m_Text));
fprintf( File,"Po %d %d %d %d %d %d\n",
if( m_Text.IsEmpty() )
return 0;
fprintf( File, "$TEXTPCB\n" );
fprintf( File, "Te \"%s\"\n", CONV_TO_UTF8( m_Text ) );
fprintf( File, "Po %d %d %d %d %d %d\n",
m_Pos.x, m_Pos.y, m_Size.x, m_Size.y, m_Width, m_Orient );
fprintf( File,"De %d %d %lX %d\n", m_Layer, m_Miroir, m_TimeStamp, 0);
fprintf( File,"$EndTEXTPCB\n");
return(1);
fprintf( File, "De %d %d %lX %d\n", m_Layer, m_Miroir, m_TimeStamp, 0 );
fprintf( File, "$EndTEXTPCB\n" );
return 1;
}
/**********************************************************************/
void TEXTE_PCB::Draw(WinEDA_DrawPanel * panel, wxDC * DC,
const wxPoint & offset, int DrawMode)
void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int DrawMode )
/**********************************************************************/
/*
DrawMode = GR_OR, GR_XOR.., -1 si mode courant.
*/
* DrawMode = GR_OR, GR_XOR.., -1 si mode courant.
*/
{
int color = g_DesignSettings.m_LayerColor[m_Layer];
if(color & ITEM_NOT_SHOW ) return ;
int color = g_DesignSettings.m_LayerColor[m_Layer];
EDA_TextStruct::Draw(panel, DC, offset, color,
if( color & ITEM_NOT_SHOW )
return;
EDA_TextStruct::Draw( panel, DC, offset, color,
DrawMode, DisplayOpt.DisplayDrawItems,
(g_AnchorColor & ITEM_NOT_SHOW) ? -1 : (g_AnchorColor & MASKCOLOR));
(g_AnchorColor & ITEM_NOT_SHOW) ? -1 : (g_AnchorColor & MASKCOLOR) );
}
#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 TEXTE_PCB::Show( int nestLevel, std::ostream& os )
{
// for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
NestedSpace( nestLevel+1, os ) << m_Text.mb_str() << '\n';
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
}
#endif

View File

@ -25,6 +25,28 @@ public:
// File Operations:
int ReadTextePcbDescr(FILE * File, int * LineNum);
int WriteTextePcbDescr(FILE * File);
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
virtual wxString GetClass() const
{
return wxT("PTEXT");
}
/**
* 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
};
#endif // #define CLASS_PCB_TEXT_H

View File

@ -307,10 +307,10 @@ void TEXTE_MODULE::Show( int nestLevel, std::ostream& os )
{
// for now, make it look like XML, expand on this later.
NestedSpace( nestLevel, os ) << '<' << ReturnClassName().mb_str() << ">\n";
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
NestedSpace( nestLevel+1, os ) << m_Text.mb_str() << '\n';
NestedSpace( nestLevel, os ) << "</" << ReturnClassName().mb_str() << ">\n";
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
}
#endif

View File

@ -59,8 +59,17 @@ public:
*/
bool HitTest( const wxPoint& posref );
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
virtual wxString GetClass() const
{
return wxT( "MTEXT" );
}
/**
* Function Show
* is used to output the object tree, currently for debugging only.

View File

@ -675,9 +675,12 @@ D_PAD* Locate_Pads( MODULE* module, const wxPoint& ref_pos, int masque_layer )
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
{
shape_pos = pt_pad->ReturnShapePos();
ux0 = shape_pos.x; uy0 = shape_pos.y; /* pos x,y du centre du pad */
deltaX = ref_pos.x - ux0; deltaY = ref_pos.y - uy0;
ux0 = shape_pos.x;
uy0 = shape_pos.y; /* pos x,y du centre du pad */
deltaX = ref_pos.x - ux0;
deltaY = ref_pos.y - uy0;
/* Test rapide: le point a tester doit etre a l'interieur du cercle
* exinscrit ... */