Commit d985f2d6 authored by dickelbeck's avatar dickelbeck
Browse files

DeleteStructure() & DeleteStructList() consolidation

parent e9921a71
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -5,6 +5,16 @@ Please add newer entries at the top, list the date and your name with
email address.
email address.




2007-Oct-3 UPDATE   Dick Hollenbeck <dick@softplc.com>
================================================================================
+ pcbnew
    made BOARD_ITEM::UnLink() virtual
    added BOARD_ITEM::DeleteStructure().
    added EDA_BaseStruct::DeleteStructList()
    deleted gerbview/struct.cpp, pcbnew/struct.cpp, 
    BOARD::~BOARD() now deletes objects that it owns.
    

2007-Oct-2 UPDATE   Dick Hollenbeck <dick@softplc.com>
2007-Oct-2 UPDATE   Dick Hollenbeck <dick@softplc.com>
================================================================================
================================================================================
+ all
+ all
+17 −0
Original line number Original line Diff line number Diff line
@@ -73,6 +73,23 @@ void EDA_BaseStruct::SetState( int type, int state )
}
}





/***********************************************************/
void EDA_BaseStruct::DeleteStructList()
/***********************************************************/
{
    EDA_BaseStruct* item = this;
    EDA_BaseStruct* next;

    while( item )
    {
        next = item->Next();
        delete item;
        item = next;
    }
}


/*********************************************************/
/*********************************************************/
void EDA_BaseStruct::AddToChain( EDA_BaseStruct* laststruct )
void EDA_BaseStruct::AddToChain( EDA_BaseStruct* laststruct )
/*********************************************************/
/*********************************************************/
+0 −0

File moved.

+199 −189
Original line number Original line Diff line number Diff line
@@ -20,9 +20,7 @@


BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, wxFrame )
BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, wxFrame )


	COMMON_EVENTS_DRAWFRAME
COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_DisplayFrame::OnCloseWindow )

	EVT_CLOSE(WinEDA_DisplayFrame::OnCloseWindow)
EVT_SIZE( WinEDA_DrawFrame::OnSize )
EVT_SIZE( WinEDA_DrawFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_PLUS_BUTT, ID_ZOOM_PAGE_BUTT,
EVT_TOOL_RANGE( ID_ZOOM_PLUS_BUTT, ID_ZOOM_PAGE_BUTT,
                WinEDA_DisplayFrame::Process_Zoom )
                WinEDA_DisplayFrame::Process_Zoom )
@@ -31,8 +29,6 @@ BEGIN_EVENT_TABLE(WinEDA_DisplayFrame, wxFrame)
END_EVENT_TABLE()
END_EVENT_TABLE()






/*********************************************************************/
/*********************************************************************/
/* Constructeur de WinEDA_DisplayFrame: la fenetre de visu du composant */
/* Constructeur de WinEDA_DisplayFrame: la fenetre de visu du composant */
/*********************************************************************/
/*********************************************************************/
@@ -51,7 +47,9 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow * father, WinEDA_App *parent,
    SetTitle( title );
    SetTitle( title );


    m_Pcb = new             BOARD( NULL, this );
    m_Pcb = new             BOARD( NULL, this );

    m_CurrentScreen = new   PCB_SCREEN( CVPCB_DISPLAY_FRAME );
    m_CurrentScreen = new   PCB_SCREEN( CVPCB_DISPLAY_FRAME );

    GetSettings();
    GetSettings();
    SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
    SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
    ReCreateHToolbar();
    ReCreateHToolbar();
@@ -63,13 +61,14 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow * father, WinEDA_App *parent,
/*****************************************/
/*****************************************/
/* Fonctions de base de WinEDA_DisplayFrame */
/* Fonctions de base de WinEDA_DisplayFrame */
/*****************************************/
/*****************************************/

// Destructeur
// Destructeur
WinEDA_DisplayFrame::~WinEDA_DisplayFrame()
WinEDA_DisplayFrame::~WinEDA_DisplayFrame()
{
{
	if ( m_Pcb->m_Modules ) DeleteStructure( m_Pcb->m_Modules );
	m_Pcb->m_Modules = NULL;
    delete m_CurrentScreen;
    delete m_CurrentScreen;
    
    delete m_Pcb;
    delete m_Pcb;
    
    m_Parent->m_CvpcbFrame->DrawFrame = NULL;
    m_Parent->m_CvpcbFrame->DrawFrame = NULL;
}
}


@@ -77,6 +76,7 @@ WinEDA_DisplayFrame::~WinEDA_DisplayFrame()
/************************************************************/
/************************************************************/
void WinEDA_DisplayFrame::OnCloseWindow( wxCloseEvent& event )
void WinEDA_DisplayFrame::OnCloseWindow( wxCloseEvent& event )
/************************************************************/
/************************************************************/

/* Fermeture par icone ou systeme
/* Fermeture par icone ou systeme
 */
 */
{
{
@@ -91,7 +91,6 @@ wxSize size;
}
}





/************************************************/
/************************************************/
void WinEDA_DisplayFrame::ReCreateVToolbar()
void WinEDA_DisplayFrame::ReCreateVToolbar()
/************************************************/
/************************************************/
@@ -103,9 +102,11 @@ void WinEDA_DisplayFrame::ReCreateVToolbar()
void WinEDA_DisplayFrame::ReCreateHToolbar()
void WinEDA_DisplayFrame::ReCreateHToolbar()
/************************************************/
/************************************************/
{
{
	if ( m_HToolBar != NULL ) return;
    if( m_HToolBar != NULL )
        return;


    m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
    m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );

    SetToolBar( m_HToolBar );
    SetToolBar( m_HToolBar );


    m_HToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString,
    m_HToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString,
@@ -147,10 +148,12 @@ void WinEDA_DisplayFrame::OnLeftClick(wxDC * DC, const wxPoint& MousePos)
{
{
}
}



void WinEDA_DisplayFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
void WinEDA_DisplayFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{
{
}
}



void WinEDA_DisplayFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
void WinEDA_DisplayFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
{
{
}
}
@@ -170,8 +173,10 @@ wxPoint curpos, oldpos;


    delta.x = m_CurrentScreen->GetGrid().x / zoom;
    delta.x = m_CurrentScreen->GetGrid().x / zoom;
    delta.y = m_CurrentScreen->GetGrid().y / zoom;
    delta.y = m_CurrentScreen->GetGrid().y / zoom;
	if( delta.x <= 0 ) delta.x = 1;
    if( delta.x <= 0 )
	if( delta.y <= 0 ) delta.y = 1;
        delta.x = 1;
    if( delta.y <= 0 )
        delta.y = 1;


    if( g_KeyPressed )
    if( g_KeyPressed )
    {
    {
@@ -182,15 +187,18 @@ wxPoint curpos, oldpos;
            flagcurseur = 2;
            flagcurseur = 2;
            curpos = m_CurrentScreen->m_Curseur;
            curpos = m_CurrentScreen->m_Curseur;
            break;
            break;

        case WXK_F2:
        case WXK_F2:
            OnZoom( ID_ZOOM_MOINS_KEY );
            OnZoom( ID_ZOOM_MOINS_KEY );
            flagcurseur = 2;
            flagcurseur = 2;
            curpos = m_CurrentScreen->m_Curseur;
            curpos = m_CurrentScreen->m_Curseur;
            break;
            break;

        case WXK_F3:
        case WXK_F3:
            OnZoom( ID_ZOOM_REDRAW_KEY );
            OnZoom( ID_ZOOM_REDRAW_KEY );
            flagcurseur = 2;
            flagcurseur = 2;
            break;
            break;

        case WXK_F4:
        case WXK_F4:
            OnZoom( ID_ZOOM_CENTER_KEY );
            OnZoom( ID_ZOOM_CENTER_KEY );
            flagcurseur = 2;
            flagcurseur = 2;
@@ -242,8 +250,8 @@ wxPoint curpos, oldpos;
        RedrawActiveWindow( DC, TRUE );
        RedrawActiveWindow( DC, TRUE );
    }
    }


	if ( (oldpos.x != m_CurrentScreen->m_Curseur.x) ||
    if( (oldpos.x != m_CurrentScreen->m_Curseur.x)
		 (oldpos.y != m_CurrentScreen->m_Curseur.y) )
       || (oldpos.y != m_CurrentScreen->m_Curseur.y) )
    {
    {
        if( flagcurseur != 2 )
        if( flagcurseur != 2 )
        {
        {
@@ -264,13 +272,16 @@ wxPoint curpos, oldpos;
    Affiche_Status_Box();    /* Affichage des coord curseur */
    Affiche_Status_Box();    /* Affichage des coord curseur */
}
}



/*************************************************************************/
/*************************************************************************/
void WinEDA_DisplayFrame::Process_Special_Functions( wxCommandEvent& event )
void WinEDA_DisplayFrame::Process_Special_Functions( wxCommandEvent& event )
/*************************************************************************/
/*************************************************************************/

/* Traite les selections d'outils et les commandes appelees du menu POPUP
/* Traite les selections d'outils et les commandes appelees du menu POPUP
 */
 */
{
{
    int id = event.GetId();
    int id = event.GetId();

    wxClientDC dc( DrawPanel );
    wxClientDC dc( DrawPanel );


    DrawPanel->PrepareGraphicContext( &dc );
    DrawPanel->PrepareGraphicContext( &dc );
@@ -284,4 +295,3 @@ wxClientDC dc(DrawPanel);


    SetToolbars();
    SetToolbars();
}
}
+0 −4
Original line number Original line Diff line number Diff line
@@ -34,10 +34,6 @@ void Set_Rectangle_Encadrement(MODULE * PtModule);
		/* Mise a jour du rectangle d'encadrement du module
		/* Mise a jour du rectangle d'encadrement du module
			  Entree : pointeur sur module */
			  Entree : pointeur sur module */


void DeleteStructure( void * GenericStructure );
	/* Supprime de la liste chainee la stucture pointee par GenericStructure
	et libere la memoire correspondante */

	/**************/
	/**************/
	/* MEMOIRE.CC */
	/* MEMOIRE.CC */
	/**************/
	/**************/
Loading