Commit f8f38438 authored by dickelbeck's avatar dickelbeck
Browse files

search and debug infrastructure, beautification

parent dda28ed6
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -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;
+21 −4
Original line number Diff line number Diff line
@@ -164,7 +164,7 @@ public:
        m_Status = new_status;
    }

    wxString        ReturnClassName( void );
    wxString        ReturnClassName() const;

    /* addition d'une nouvelle struct a la liste chain� */
    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[] );

    
+242 −223
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ public:
    int               m_Ident;
    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 gnrale)
	bool m_AutoPAN_Request;		// TRUE pour auto pan (lorsque auto pan ncessaire)
    bool              m_AutoPAN_Enable;     // TRUE pour autoriser auto pan (autorisation g��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 gnrale)
    bool              m_Block_Enable;       // TRUE pour autoriser Bloc Commandes (autorisation g��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
@@ -49,11 +49,12 @@ public:

    /* 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 force
											de la fonction ManageCurseur */
                                                                                         *  si erase : effacement ancien affichage */
    void              (*ForceCloseManageCurseur)(WinEDA_DrawPanel * panel, wxDC * DC);/* Fonction de fermeture forc
                                                                                       *  de la fonction ManageCurseur */

public:

    // Constructor and destructor
    WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos, const wxSize& size );
    ~WinEDA_DrawPanel( void ) { }
@@ -77,6 +78,7 @@ public:
    void    OnMouseEvent( wxMouseEvent& event );
    void    OnMouseLeaving( wxMouseEvent& event );
    void    OnKeyEvent( wxKeyEvent& event );

    /*************************/

    void    EraseScreen( wxDC* DC );
@@ -116,6 +118,7 @@ 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;

/* codes des differentes commandes sur block: */
@@ -135,20 +138,22 @@ 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 */
                                         *   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 */
                                               *  = last cursor position in move commands
                                               *  = 0,0 in block paste */

public:
    DrawBlockStruct( void );
@@ -170,14 +175,14 @@ 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)
                                       *  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_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;

@@ -194,7 +199,7 @@ public:
    /* Page description */
    Ki_PageDescr*   m_CurrentSheet;
    int             m_SheetNumber, m_NumberOfSheet;/* gestion hierarchie: numero de sousfeuille
								et nombre de feuilles. Root: SheetNumber = 1 */
                                                    *  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 */
@@ -216,7 +221,7 @@ public:
    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_UserGridUnit; /* unit�grille utilisateur (0 = inch, 1 = mm */
    int         m_Diviseur_Grille;
    bool        m_UserGridIsON;
    int*        m_ZoomList;     /* Liste des coefficients standard de zoom */
@@ -246,9 +251,9 @@ public:
    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); }
    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 */
@@ -267,8 +272,22 @@ public:
    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 */
+12 −0
Original line number Diff line number Diff line
@@ -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.
+3 −3
Original line number Diff line number Diff line
@@ -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:
Loading