Commit d985f2d6 authored by dickelbeck's avatar dickelbeck

DeleteStructure() & DeleteStructList() consolidation

parent e9921a71
......@@ -5,6 +5,16 @@ Please add newer entries at the top, list the date and your name with
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>
================================================================================
+ all
......
......@@ -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 )
/*********************************************************/
......
......@@ -18,70 +18,70 @@
/* Construction de la table des evenements pour WinEDA_DrawFrame */
/*****************************************************************/
BEGIN_EVENT_TABLE(WinEDA_DisplayFrame, wxFrame)
COMMON_EVENTS_DRAWFRAME
EVT_CLOSE(WinEDA_DisplayFrame::OnCloseWindow)
EVT_SIZE(WinEDA_DrawFrame::OnSize)
EVT_TOOL_RANGE(ID_ZOOM_PLUS_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_DisplayFrame::Process_Zoom)
EVT_TOOL(ID_OPTIONS_SETUP, WinEDA_DisplayFrame::InstallOptionsDisplay)
EVT_TOOL(ID_CVPCB_SHOW3D_FRAME, WinEDA_BasePcbFrame::Show3D_Frame)
BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_DisplayFrame::OnCloseWindow )
EVT_SIZE( WinEDA_DrawFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_PLUS_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_DisplayFrame::Process_Zoom )
EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_DisplayFrame::InstallOptionsDisplay )
EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, WinEDA_BasePcbFrame::Show3D_Frame )
END_EVENT_TABLE()
/*********************************************************************/
/* Constructeur de WinEDA_DisplayFrame: la fenetre de visu du composant */
/*********************************************************************/
/*********************************************************************/
/* Constructeur de WinEDA_DisplayFrame: la fenetre de visu du composant */
/*********************************************************************/
WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow * father, WinEDA_App *parent,
const wxString & title,
const wxPoint& pos, const wxSize& size):
WinEDA_BasePcbFrame(father, parent, CVPCB_DISPLAY_FRAME, title, pos, size)
WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow* father, WinEDA_App* parent,
const wxString& title,
const wxPoint& pos, const wxSize& size ) :
WinEDA_BasePcbFrame( father, parent, CVPCB_DISPLAY_FRAME, title, pos, size )
{
m_FrameName = wxT("CmpFrame");
m_FrameName = wxT( "CmpFrame" );
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee
m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessin
SetIcon(wxIcon( wxT("icon_cvpcb"))); // Give an icon
SetTitle(title);
SetIcon( wxIcon( wxT( "icon_cvpcb" ) ) ); // Give an icon
SetTitle( title );
m_Pcb = new BOARD( NULL, this );
m_CurrentScreen = new PCB_SCREEN( CVPCB_DISPLAY_FRAME );
m_Pcb = new BOARD(NULL, this);
m_CurrentScreen = new PCB_SCREEN(CVPCB_DISPLAY_FRAME);
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();
ReCreateVToolbar();
Show(TRUE);
Show( TRUE );
}
/*****************************************/
/* Fonctions de base de WinEDA_DisplayFrame */
/*****************************************/
/*****************************************/
/* Fonctions de base de WinEDA_DisplayFrame */
/*****************************************/
// Destructeur
WinEDA_DisplayFrame::~WinEDA_DisplayFrame()
{
if ( m_Pcb->m_Modules ) DeleteStructure( m_Pcb->m_Modules );
m_Pcb->m_Modules = NULL;
delete m_CurrentScreen;
delete m_Pcb;
m_Parent->m_CvpcbFrame->DrawFrame = NULL;
}
/************************************************************/
void WinEDA_DisplayFrame::OnCloseWindow(wxCloseEvent& event)
void WinEDA_DisplayFrame::OnCloseWindow( wxCloseEvent& event )
/************************************************************/
/* Fermeture par icone ou systeme
*/
*/
{
wxPoint pos;
wxSize size;
wxPoint pos;
wxSize size;
size = GetSize();
pos = GetPosition();
......@@ -91,7 +91,6 @@ wxSize size;
}
/************************************************/
void WinEDA_DisplayFrame::ReCreateVToolbar()
/************************************************/
......@@ -103,32 +102,34 @@ void WinEDA_DisplayFrame::ReCreateVToolbar()
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,
BITMAP(display_options_xpm),
_("Display Options"));
m_HToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString,
BITMAP( display_options_xpm ),
_( "Display Options" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_ZOOM_PLUS_BUTT, wxEmptyString, BITMAP(zoom_in_xpm),
_("zoom + (F1)"));
m_HToolBar->AddTool( ID_ZOOM_PLUS_BUTT, wxEmptyString, BITMAP( zoom_in_xpm ),
_( "zoom + (F1)" ) );
m_HToolBar->AddTool(ID_ZOOM_MOINS_BUTT, wxEmptyString, BITMAP(zoom_out_xpm),
_("zoom - (F2)"));
m_HToolBar->AddTool( ID_ZOOM_MOINS_BUTT, wxEmptyString, BITMAP( zoom_out_xpm ),
_( "zoom - (F2)" ) );
m_HToolBar->AddTool(ID_ZOOM_REDRAW_BUTT, wxEmptyString, BITMAP(repaint_xpm),
_("redraw (F3)"));
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString, BITMAP( repaint_xpm ),
_( "redraw (F3)" ) );
m_HToolBar->AddTool(ID_ZOOM_PAGE_BUTT, wxEmptyString, BITMAP(zoom_optimal_xpm),
_("1:1 zoom"));
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString, BITMAP( zoom_optimal_xpm ),
_( "1:1 zoom" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_CVPCB_SHOW3D_FRAME, wxEmptyString, BITMAP(show_3d_xpm),
_("1:1 zoom"));
m_HToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString, BITMAP( show_3d_xpm ),
_( "1:1 zoom" ) );
// after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
......@@ -143,56 +144,63 @@ void WinEDA_DisplayFrame::SetToolbars()
}
void WinEDA_DisplayFrame::OnLeftClick(wxDC * DC, const wxPoint& MousePos)
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 )
{
}
/****************************************************************/
void WinEDA_BasePcbFrame::GeneralControle(wxDC *DC, wxPoint Mouse)
void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
/****************************************************************/
{
wxSize delta;
int flagcurseur = 0;
int zoom = m_CurrentScreen->GetZoom();
wxPoint curpos, oldpos;
wxSize delta;
int flagcurseur = 0;
int zoom = m_CurrentScreen->GetZoom();
wxPoint curpos, oldpos;
curpos = DrawPanel->CursorRealPosition(Mouse);
curpos = DrawPanel->CursorRealPosition( Mouse );
oldpos = m_CurrentScreen->m_Curseur;
delta.x = m_CurrentScreen->GetGrid().x / zoom;
delta.y = m_CurrentScreen->GetGrid().y / zoom;
if( delta.x <= 0 ) delta.x = 1;
if( delta.y <= 0 ) delta.y = 1;
if( delta.x <= 0 )
delta.x = 1;
if( delta.y <= 0 )
delta.y = 1;
if( g_KeyPressed)
if( g_KeyPressed )
{
switch( g_KeyPressed )
{
case WXK_F1 :
OnZoom(ID_ZOOM_PLUS_KEY);
case WXK_F1:
OnZoom( ID_ZOOM_PLUS_KEY );
flagcurseur = 2;
curpos = m_CurrentScreen->m_Curseur;
break;
case WXK_F2 :
OnZoom(ID_ZOOM_MOINS_KEY);
case WXK_F2:
OnZoom( ID_ZOOM_MOINS_KEY );
flagcurseur = 2;
curpos = m_CurrentScreen->m_Curseur;
break;
case WXK_F3 :
OnZoom(ID_ZOOM_REDRAW_KEY);
case WXK_F3:
OnZoom( ID_ZOOM_REDRAW_KEY );
flagcurseur = 2;
break;
case WXK_F4 :
OnZoom(ID_ZOOM_CENTER_KEY);
case WXK_F4:
OnZoom( ID_ZOOM_CENTER_KEY );
flagcurseur = 2;
curpos = m_CurrentScreen->m_Curseur;
break;
......@@ -202,86 +210,88 @@ wxPoint curpos, oldpos;
break;
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
case WXK_UP :
DrawPanel->CalcScrolledPosition(Mouse.x, Mouse.y - delta.y,
&Mouse.x, &Mouse.y);
GRMouseWarp(DrawPanel, Mouse);
break ;
case WXK_UP:
DrawPanel->CalcScrolledPosition( Mouse.x, Mouse.y - delta.y,
&Mouse.x, &Mouse.y );
GRMouseWarp( DrawPanel, Mouse );
break;
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
case WXK_DOWN:
DrawPanel->CalcScrolledPosition(Mouse.x, Mouse.y + delta.y,
&Mouse.x, &Mouse.y);
GRMouseWarp(DrawPanel, Mouse);
break ;
DrawPanel->CalcScrolledPosition( Mouse.x, Mouse.y + delta.y,
&Mouse.x, &Mouse.y );
GRMouseWarp( DrawPanel, Mouse );
break;
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
case WXK_LEFT :
DrawPanel->CalcScrolledPosition(Mouse.x - delta.x, Mouse.y,
&Mouse.x, &Mouse.y);
GRMouseWarp(DrawPanel, Mouse);
break ;
case WXK_LEFT:
DrawPanel->CalcScrolledPosition( Mouse.x - delta.x, Mouse.y,
&Mouse.x, &Mouse.y );
GRMouseWarp( DrawPanel, Mouse );
break;
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
case WXK_RIGHT :
DrawPanel->CalcScrolledPosition(Mouse.x + delta.x, Mouse.y,
&Mouse.x, &Mouse.y);
GRMouseWarp(DrawPanel, Mouse);
break ;
case WXK_RIGHT:
DrawPanel->CalcScrolledPosition( Mouse.x + delta.x, Mouse.y,
&Mouse.x, &Mouse.y );
GRMouseWarp( DrawPanel, Mouse );
break;
}
}
/* Recalcul de la position du curseur schema */
m_CurrentScreen->m_Curseur = curpos;
/* Placement sur la grille generale */
PutOnGrid( & m_CurrentScreen->m_Curseur);
PutOnGrid( &m_CurrentScreen->m_Curseur );
if( m_CurrentScreen->IsRefreshReq() )
{
flagcurseur = 2;
RedrawActiveWindow(DC, TRUE);
RedrawActiveWindow( DC, TRUE );
}
if ( (oldpos.x != m_CurrentScreen->m_Curseur.x) ||
(oldpos.y != m_CurrentScreen->m_Curseur.y) )
if( (oldpos.x != m_CurrentScreen->m_Curseur.x)
|| (oldpos.y != m_CurrentScreen->m_Curseur.y) )
{
if ( flagcurseur != 2 )
if( flagcurseur != 2 )
{
curpos = m_CurrentScreen->m_Curseur;
m_CurrentScreen->m_Curseur = oldpos;
DrawPanel->CursorOff(DC);
DrawPanel->CursorOff( DC );
m_CurrentScreen->m_Curseur = curpos;
DrawPanel->CursorOn(DC);
DrawPanel->CursorOn( DC );
}
if(DrawPanel->ManageCurseur)
if( DrawPanel->ManageCurseur )
{
DrawPanel->ManageCurseur(DrawPanel, DC, 0);
DrawPanel->ManageCurseur( DrawPanel, DC, 0 );
}
}
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
*/
*/
{
int id = event.GetId();
wxClientDC dc(DrawPanel);
int id = event.GetId();
wxClientDC dc( DrawPanel );
DrawPanel->PrepareGraphicContext(&dc);
DrawPanel->PrepareGraphicContext( &dc );
switch ( id )
switch( id )
{
default:
wxMessageBox( wxT("WinEDA_DisplayFrame::Process_Special_Functions error"));
wxMessageBox( wxT( "WinEDA_DisplayFrame::Process_Special_Functions error" ) );
break;
}
SetToolbars();
}
......@@ -34,10 +34,6 @@ void Set_Rectangle_Encadrement(MODULE * PtModule);
/* Mise a jour du rectangle d'encadrement du 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 */
/**************/
......
......@@ -16,51 +16,60 @@
/*******************************************/
void WinEDA_CvpcbFrame::CreateScreenCmp()
/*******************************************/
/* Creation de la fenetre d'affichage du composant
*/
*/
{
wxString msg, FootprintName;
bool IsNew = FALSE;
wxString msg, FootprintName;
bool IsNew = FALSE;
FootprintName = m_FootprintList->GetSelectedFootprint();
if ( DrawFrame == NULL)
if( DrawFrame == NULL )
{
DrawFrame = new WinEDA_DisplayFrame(this, m_Parent, _("Module"),
wxPoint(0,0) , wxSize(600,400) );
DrawFrame = new WinEDA_DisplayFrame( this, m_Parent, _( "Module" ),
wxPoint( 0, 0 ), wxSize( 600, 400 ) );
IsNew = TRUE;
}
else DrawFrame->Maximize(FALSE);
else
DrawFrame->Maximize( FALSE );
DrawFrame->SetFocus(); /* Active entree clavier */
DrawFrame->Show(TRUE);
DrawFrame->Show( TRUE );
if( ! FootprintName.IsEmpty() )
if( !FootprintName.IsEmpty() )
{
msg = _("Footprint: ") + FootprintName;
DrawFrame->SetTitle(msg);
STOREMOD * Module = GetModuleDescrByName(FootprintName);
msg = _("Lib: ");
if ( Module ) msg += Module->m_LibName;
else msg += wxT("???");
DrawFrame->SetStatusText(msg, 0);
if ( DrawFrame->m_Pcb->m_Modules )
msg = _( "Footprint: " ) + FootprintName;
DrawFrame->SetTitle( msg );
STOREMOD* Module = GetModuleDescrByName( FootprintName );
msg = _( "Lib: " );
if( Module )
msg += Module->m_LibName;
else
msg += wxT( "???" );
DrawFrame->SetStatusText( msg, 0 );
if( DrawFrame->m_Pcb->m_Modules )
{
DeleteStructure( DrawFrame->m_Pcb->m_Modules );
// there is only one module in the list
DrawFrame->m_Pcb->m_Modules->DeleteStructure();
DrawFrame->m_Pcb->m_Modules = NULL;
}
DrawFrame->m_Pcb->m_Modules = DrawFrame->Get_Module(FootprintName);
DrawFrame->Zoom_Automatique(FALSE);
if ( DrawFrame->m_Draw3DFrame )
DrawFrame->m_Pcb->m_Modules = DrawFrame->Get_Module( FootprintName );
DrawFrame->Zoom_Automatique( FALSE );
if( DrawFrame->m_Draw3DFrame )
DrawFrame->m_Draw3DFrame->NewDisplay();
}
else if ( !IsNew )
else if( !IsNew )
{
DrawFrame->ReDrawPanel();
if ( DrawFrame->m_Draw3DFrame )
if( DrawFrame->m_Draw3DFrame )
DrawFrame->m_Draw3DFrame->NewDisplay();
}
}
/************************************************/
/* Routines de visualisation du module courant */
/************************************************/
/************************************************/
/* Routines de visualisation du module courant */
/************************************************/
#include "fctsys.h"
......@@ -17,160 +17,28 @@
/*******************************************************************/
void WinEDA_DisplayFrame::RedrawActiveWindow(wxDC * DC, bool EraseBg)
void WinEDA_DisplayFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
/*******************************************************************/
/* Affiche le module courant */
{
if (! m_Pcb ) return;
if( !m_Pcb )
return;
MODULE * Module= m_Pcb->m_Modules;
MODULE* Module = m_Pcb->m_Modules;
ActiveScreen = (PCB_SCREEN *) GetScreen();
ActiveScreen = (PCB_SCREEN*) GetScreen();
if ( EraseBg ) DrawPanel->EraseScreen(DC);
if( EraseBg )
DrawPanel->EraseScreen( DC );
DrawPanel->DrawBackGround(DC);
DrawPanel->DrawBackGround( DC );
if( Module )
{
Module->Draw(DrawPanel, DC, wxPoint(0,0), GR_COPY);
Module->Display_Infos(this);
Module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_COPY );
Module->Display_Infos( this );
}
Affiche_Status_Box();
DrawPanel->Trace_Curseur(DC);
DrawPanel->Trace_Curseur( DC );
}
/***********************************************/
void DeleteStructure( void * GenericStructure )
/***********************************************/
/* Supprime de la liste chainee la stucture pointee par GenericStructure
et libere la memoire correspondante
*/
{
EDA_BaseStruct * PtStruct, *PtNext, *PtBack;
int IsDeleted;
int typestruct;
wxString msg;
PtStruct = (EDA_BaseStruct *) GenericStructure;
if( PtStruct == NULL) return ;
typestruct = (int)PtStruct->Type();
IsDeleted = PtStruct->GetState(DELETED);
PtNext = PtStruct->Pnext;
PtBack = PtStruct->Pback;
switch( typestruct )
{
case TYPE_NOT_INIT:
DisplayError(NULL, wxT("DeleteStruct: Type Structure Non Initialise"));
break;
case PCB_EQUIPOT_STRUCT_TYPE:
#undef Struct
#define Struct ((EQUIPOT*)PtStruct)
Struct->UnLink();
delete Struct;
break;
case TYPEMODULE:
#undef Struct
#define Struct ((MODULE*)PtStruct)
Struct->UnLink();
delete Struct;
break;
case TYPEPAD:
#undef Struct
#define Struct ((D_PAD*)PtStruct)
Struct->UnLink();
delete Struct;
break;
case TYPECOTATION:
#undef Struct
#define Struct ((COTATION*)PtStruct)
Struct->UnLink();
delete Struct;
break;
case TYPEMIRE:
#undef Struct
#define Struct ((MIREPCB*)PtStruct)
Struct->UnLink();
delete Struct;
break;
case TYPEDRAWSEGMENT:
#undef Struct
#define Struct ((DRAWSEGMENT*)PtStruct)
Struct->UnLink();
delete Struct;
break;
case TYPETEXTE:
#undef Struct
#define Struct ((TEXTE_PCB*)PtStruct)
Struct->UnLink();
delete Struct;
break;
case TYPETEXTEMODULE:
#undef Struct
#define Struct ((TEXTE_MODULE*)PtStruct)
Struct->UnLink();
delete Struct;
break;
case TYPEEDGEMODULE:
#undef Struct
#define Struct ((EDGE_MODULE*)PtStruct)
Struct->UnLink();
delete Struct;
break;
case TYPETRACK:
#undef Struct
#define Struct ((TRACK*)PtStruct)
Struct->UnLink();
delete Struct;
break;
case TYPEVIA:
#undef Struct
#define Struct ((SEGVIA*)PtStruct)
Struct->UnLink();
delete Struct;
break;
case TYPEZONE:
#undef Struct
#define Struct ((SEGZONE*)PtStruct)
Struct->UnLink();
delete Struct;
break;
case TYPEMARQUEUR:
#undef Struct
#define Struct ((MARQUEUR*)PtStruct)
Struct->UnLink();
delete Struct;
break;
case TYPEPCB:
default:
msg.Printf( wxT(" DeleteStructure: Type %d Inattendu"),
PtStruct->Type());
DisplayError(NULL, msg);
break;
}
}
......@@ -277,9 +277,10 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
{
NextS = pt_segm->Next();
if( IsSegmentInBox( GetScreen()->BlockLocate, pt_segm ) )
{ /* la piste est ici bonne a etre efface */
{
/* la piste est ici bonne a etre efface */
pt_segm->Draw( DrawPanel, DC, GR_XOR );
DeleteStructure( pt_segm );
pt_segm->DeleteStructure();
}
}
......@@ -288,9 +289,10 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
{
NextS = pt_segm->Next();
if( IsSegmentInBox( GetScreen()->BlockLocate, pt_segm ) )
{ /* la piste est ici bonne a etre efface */
{
/* la piste est ici bonne a etre efface */
pt_segm->Draw( DrawPanel, DC, GR_XOR );
DeleteStructure( pt_segm );
pt_segm->DeleteStructure();
}
}
......
......@@ -36,21 +36,21 @@ bool WinEDA_GerberFrame::Clear_Pcb( wxDC* DC, bool query )
}
}
DeleteStructList( m_Pcb->m_Drawings );
m_Pcb->m_Drawings->DeleteStructList();
m_Pcb->m_Drawings = NULL;
DeleteStructList( m_Pcb->m_Track );
m_Pcb->m_Track->DeleteStructList();
m_Pcb->m_Track = NULL;
m_Pcb->m_NbSegmTrack = 0;
DeleteStructList( m_Pcb->m_Zone );
m_Pcb->m_Zone->DeleteStructList();
m_Pcb->m_Zone = NULL;
m_Pcb->m_NbSegmZone = 0;
for( ; g_UnDeleteStackPtr != 0; )
{
g_UnDeleteStackPtr--;
DeleteStructList( g_UnDeleteStack[ g_UnDeleteStackPtr] );
g_UnDeleteStack[ g_UnDeleteStackPtr]->DeleteStructList();
}
/* init pointeurs et variables */
......@@ -90,7 +90,7 @@ void WinEDA_GerberFrame::Erase_Zones( wxDC* DC, bool query )
if( m_Pcb->m_Zone )
{
DeleteStructList( m_Pcb->m_Zone );
m_Pcb->m_Zone->DeleteStructList( );
m_Pcb->m_Zone = NULL;
m_Pcb->m_NbSegmZone = 0;
}
......@@ -122,7 +122,7 @@ void WinEDA_GerberFrame::Erase_Segments_Pcb( wxDC* DC,
case TYPECOTATION:
case TYPEMIRE:
if( PtStruct->GetLayer() == layer || layer < 0 )
DeleteStructure( PtStruct );
PtStruct->DeleteStructure();
break;
default:
......@@ -158,7 +158,7 @@ void WinEDA_GerberFrame::Erase_Pistes( wxDC* DC, int masque_type,
PtNext = pt_segm->Next();
if( pt_segm->GetState( SEGM_FIXE | SEGM_AR ) & masque_type )
continue;
DeleteStructure( pt_segm );
pt_segm->DeleteStructure();
}
ScreenPcb->SetModify();
......@@ -180,7 +180,7 @@ void WinEDA_GerberFrame::Erase_Textes_Pcb( wxDC* DC, bool query )
{
PtNext = PtStruct->Next();
if( PtStruct->Type() == TYPETEXTE )
DeleteStructure( PtStruct );
PtStruct->DeleteStructure();
}
ScreenPcb->SetModify();
......@@ -206,7 +206,7 @@ void WinEDA_GerberFrame::Erase_Current_Layer( wxDC* DC, bool query )
PtNext = pt_segm->Next();
if( pt_segm->GetLayer() != layer )
continue;
DeleteStructure( pt_segm );
pt_segm->DeleteStructure();
}
ScreenPcb->SetModify();
......
......@@ -41,7 +41,6 @@ OBJECTS= \
dcode.o\
undelete.o\
infospgm.o \
struct.o \
files.o\
block.o\
controle.o\
......@@ -173,8 +172,6 @@ ioascii.o: ioascii.cpp $(COMMON)
chrono.o: chrono.cpp pcbnew.h
struct.o: struct.cpp $(COMMON)
coordbox.o: coordbox.cpp $(COMMON)
mirepcb.o: mirepcb.cpp $(COMMON)
......
/****************************************/
/* traitement des textes sur empreintes */
/****************************************/
/****************************************/
/* traitement des textes sur empreintes */
/****************************************/
#include "fctsys.h"
......@@ -14,11 +14,11 @@
/* Fonctions externe: */
/* Routines Locales */
static void Move_Texte_Pcb(WinEDA_DrawPanel * panel, wxDC * DC, int flag) ;
static void Exit_Texte_Pcb(WinEDA_DrawFrame * frame, wxDC *DC) ;
static void Move_Texte_Pcb( WinEDA_DrawPanel* panel, wxDC* DC, int flag );
static void Exit_Texte_Pcb( WinEDA_DrawFrame* frame, wxDC* DC );
/* variables exportees */
int Angle_Rot_Fin = 50; /* Valeur par defaut de l'angle de rotation fine */
int Angle_Rot_Fin = 50;/* Valeur par defaut de l'angle de rotation fine */
/* Variables locales : */
static int LocalOrient;
......@@ -29,25 +29,25 @@ static int LocalWidth;
static wxPoint old_pos; // position originelle du texte selecte
/**************************************/
/* void Exit_Texte_Pcb(COMMAND * Cmd) */
/**************************************/
/**************************************/
/* void Exit_Texte_Pcb(COMMAND * Cmd) */
/**************************************/
/*
Routine de sortie du menu edit texte Pcb
Si un texte est selectionne, ses coord initiales sont regenerees
*/
void Exit_Texte_Pcb(WinEDA_DrawFrame * frame, wxDC * DC)
* Routine de sortie du menu edit texte Pcb
* Si un texte est selectionne, ses coord initiales sont regenerees
*/
void Exit_Texte_Pcb( WinEDA_DrawFrame* frame, wxDC* DC )
{
TEXTE_PCB * TextePcb;
TEXTE_PCB* TextePcb;
TextePcb = (TEXTE_PCB *) frame->CurrentScreen->m_CurrentPcbItem;
TextePcb = (TEXTE_PCB*) frame->CurrentScreen->m_CurrentPcbItem;
if ( TextePcb )
if( TextePcb )
{
Trace_1_texte_pcb(frame->DrawPanel, DC, TextePcb, 0, 0, GR_XOR) ;
Trace_1_texte_pcb( frame->DrawPanel, DC, TextePcb, 0, 0, GR_XOR );
TextePcb->m_Pos = old_pos;
Trace_1_texte_pcb(frame->DrawPanel, DC, TextePcb, 0, 0, GR_OR) ;
Trace_1_texte_pcb( frame->DrawPanel, DC, TextePcb, 0, 0, GR_OR );
}
frame->CurrentScreen->ManageCurseur = NULL;
......@@ -55,186 +55,200 @@ TEXTE_PCB * TextePcb;
frame->CurrentScreen->m_CurrentPcbItem = NULL;
}
/******************************************/
/* void Place_Texte_Pcb(MTOOL_EDA * Menu) */
/******************************************/
/******************************************/
/* void Place_Texte_Pcb(MTOOL_EDA * Menu) */
/******************************************/
/* Routine de placement du texte en cours de deplacement
*/
void WinEDA_PcbFrame::Place_Texte_Pcb(TEXTE_PCB * TextePcb, wxDC * DC)
*/
void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
{
if( TextePcb == NULL )
return;
if( TextePcb == NULL ) return;
Trace_1_texte_pcb(DrawPanel, DC, TextePcb,0, 0, GR_XOR) ;
Trace_1_texte_pcb( DrawPanel, DC, TextePcb, 0, 0, GR_XOR );
TextePcb->m_Layer = CurrentScreen->m_Active_Layer;
Trace_1_texte_pcb(DrawPanel, DC, TextePcb,0, 0, GR_OR) ;
Trace_1_texte_pcb( DrawPanel, DC, TextePcb, 0, 0, GR_OR );
CurrentScreen->ManageCurseur = NULL;
CurrentScreen->ForceCloseManageCurseur = NULL;
CurrentScreen->m_CurrentPcbItem = NULL;
CurrentScreen->SetModify();
}
/*****************************************/
/* void StartMoveTextePcb(COMMAND * Cmd) */
/*****************************************/
/*****************************************/
/* void StartMoveTextePcb(COMMAND * Cmd) */
/*****************************************/
/* Routine de preparation du deplacement d'un texte
*/
*/
void WinEDA_PcbFrame::StartMoveTextePcb(TEXTE_PCB * TextePcb, wxDC * DC)
void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
{
if( TextePcb == NULL ) return;
if( TextePcb == NULL )
return;
old_pos = TextePcb->m_Pos;
Affiche_Infos_PCB_Texte(this, TextePcb);
Affiche_Infos_PCB_Texte( this, TextePcb );
CurrentScreen->ManageCurseur = Move_Texte_Pcb;
CurrentScreen->ForceCloseManageCurseur = Exit_Texte_Pcb;
CurrentScreen->m_CurrentPcbItem = TextePcb;
}
/*****************************/
/* void Move_Texte_Pcb() */
/*****************************/
/*****************************/
/* void Move_Texte_Pcb() */
/*****************************/
/* Routine deplacant le texte PCB suivant le curseur de la souris */
static void Move_Texte_Pcb(WinEDA_DrawPanel * panel, wxDC *DC, int flag )
static void Move_Texte_Pcb( WinEDA_DrawPanel* panel, wxDC* DC, int flag )
{
TEXTE_PCB * TextePcb = (TEXTE_PCB *)
TEXTE_PCB* TextePcb = (TEXTE_PCB*)
panel->m_Parent->CurrentScreen->m_CurrentPcbItem;
if (TextePcb == NULL ) return ;
if( TextePcb == NULL )
return;
/* effacement du texte : */
if ( flag == CURSEUR_MOVED)
Trace_1_texte_pcb(panel, DC, TextePcb,0, 0, GR_XOR) ;
if( flag == CURSEUR_MOVED )
Trace_1_texte_pcb( panel, DC, TextePcb, 0, 0, GR_XOR );
TextePcb->m_Pos = panel->m_Parent->CurrentScreen->m_Curseur;
TextePcb->m_Layer = panel->m_Parent->CurrentScreen->m_Active_Layer;
/* Redessin du Texte */
Trace_1_texte_pcb(panel, DC, TextePcb,0, 0, GR_XOR) ;
Trace_1_texte_pcb( panel, DC, TextePcb, 0, 0, GR_XOR );
}
/********************************/
/* void Delete_Texte_Pcb(COMMAND * Cmd) */
/********************************/
/********************************/
/* void Delete_Texte_Pcb(COMMAND * Cmd) */
/********************************/
void WinEDA_PcbFrame::Delete_Texte_Pcb(TEXTE_PCB * TextePcb, wxDC * DC)
void WinEDA_PcbFrame::Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
{
if( TextePcb == NULL )
return;
if( TextePcb == NULL ) return;
Trace_1_texte_pcb(DrawPanel, DC, TextePcb,0, 0, GR_XOR);
Trace_1_texte_pcb( DrawPanel, DC, TextePcb, 0, 0, GR_XOR );
/* Suppression du texte en Memoire*/
DeleteStructure(TextePcb);
TextePcb->DeleteStructure();
CurrentScreen->ManageCurseur = NULL;
CurrentScreen->ForceCloseManageCurseur = NULL;
CurrentScreen->m_CurrentPcbItem = NULL;
}
/****************************/
/* void Add_Texte_Pcb(COMMAND * Cmd) */
/****************************/
/****************************/
/* void Add_Texte_Pcb(COMMAND * Cmd) */
/****************************/
TEXTE_PCB * WinEDA_PcbFrame::Create_Texte_Pcb( wxDC * DC)
TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC )
{
char buf_new_texte[256];
TEXTE_PCB * TextePcb;
char buf_new_texte[256];
TEXTE_PCB* TextePcb;
buf_new_texte[0]= 0 ;
Get_Message("Texte:",buf_new_texte, this);
if(*buf_new_texte <=' ') return NULL;
buf_new_texte[0] = 0;
Get_Message( "Texte:", buf_new_texte, this );
if( *buf_new_texte <=' ' )
return NULL;
CurrentScreen->SetModify();
/* placement du texte en memoire */
TextePcb = new TEXTE_PCB(pt_pcb);
TextePcb = new TEXTE_PCB( pt_pcb );
/* Chainage de la nouvelle structure en debut de liste */
TextePcb->Pnext = pt_pcb->m_Drawings;
TextePcb->Pback = (EDA_BaseStruct * )pt_pcb;
if( pt_pcb->m_Drawings) pt_pcb->m_Drawings->Pback = (EDA_BaseStruct*) TextePcb;
TextePcb->Pback = (EDA_BaseStruct*) pt_pcb;
if( pt_pcb->m_Drawings )
pt_pcb->m_Drawings->Pback = (EDA_BaseStruct*) TextePcb;
pt_pcb->m_Drawings = (EDA_BaseStruct*) TextePcb;
/* Mise a jour des caracteristiques */
TextePcb->m_Layer = CurrentScreen->m_Active_Layer;
TextePcb->m_Miroir = 1;
if(CurrentScreen->m_Active_Layer == CUIVRE_N) TextePcb->m_Miroir = 0;
if( CurrentScreen->m_Active_Layer == CUIVRE_N )
TextePcb->m_Miroir = 0;
TextePcb->m_Size.y = Texte_Pcb_DimV ;
TextePcb->m_Size.x = Texte_Pcb_DimH ;
TextePcb->m_Size.y = Texte_Pcb_DimV;
TextePcb->m_Size.x = Texte_Pcb_DimH;
TextePcb->m_Pos = CurrentScreen->m_Curseur;
TextePcb->m_Width = Texte_Segment_Largeur;
TextePcb->m_Layer = CurrentScreen->m_Active_Layer;
/* Copie du texte */
TextePcb->SetText(buf_new_texte);
TextePcb->SetText( buf_new_texte );
/* Dessin du Texte */
Trace_1_texte_pcb(DrawPanel, DC, TextePcb,0, 0, GR_XOR) ;
Affiche_Infos_PCB_Texte(this, TextePcb);
Trace_1_texte_pcb( DrawPanel, DC, TextePcb, 0, 0, GR_XOR );
Affiche_Infos_PCB_Texte( this, TextePcb );
StartMoveTextePcb(TextePcb, DC);
StartMoveTextePcb( TextePcb, DC );
return TextePcb;
}
/*******************************/
/* void Rotate_Texte_Pcb(COMMAND * Cmd) */
/*******************************/
void WinEDA_PcbFrame::Rotate_Texte_Pcb(TEXTE_PCB * TextePcb, wxDC * DC)
/*******************************/
/* void Rotate_Texte_Pcb(COMMAND * Cmd) */
/*******************************/
void WinEDA_PcbFrame::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
{
int angle = 900;
int drawmode = GR_XOR;
int angle = 900;
int drawmode = GR_XOR;
if( TextePcb == NULL ) return;
if( TextePcb == NULL )
return;
/* effacement du texte : */
Trace_1_texte_pcb(DrawPanel, DC, TextePcb,0, 0, GR_XOR) ;
Trace_1_texte_pcb( DrawPanel, DC, TextePcb, 0, 0, GR_XOR );
TextePcb->m_Orient += angle;
if(TextePcb->m_Orient >= 3600) TextePcb->m_Orient -= 3600 ;
if(TextePcb->m_Orient < 0) TextePcb->m_Orient += 3600 ;
if( TextePcb->m_Orient >= 3600 )
TextePcb->m_Orient -= 3600;
if( TextePcb->m_Orient < 0 )
TextePcb->m_Orient += 3600;
/* Redessin du Texte */
Trace_1_texte_pcb(DrawPanel, DC, TextePcb, 0, 0, drawmode);
Affiche_Infos_PCB_Texte(this, TextePcb);
Trace_1_texte_pcb( DrawPanel, DC, TextePcb, 0, 0, drawmode );
Affiche_Infos_PCB_Texte( this, TextePcb );
CurrentScreen->SetModify();
}
/***************************************************************/
/* void Trace_1_texte(char * ptr,int ox,int oy),int mode_color */
/***************************************************************/
/***************************************************************/
/* void Trace_1_texte(char * ptr,int ox,int oy),int mode_color */
/***************************************************************/
/*
Trace de 1 texte :
ptr = pointeur sur le debut de la description du texte
ox, oy = Offsets de trace
mode_color = GR_OR, GR_XOR..
*/
void Trace_1_texte_pcb(WinEDA_DrawPanel * panel, wxDC * DC,
TEXTE_PCB * pt_texte,int ox,int oy, int DrawMode)
* Trace de 1 texte :
* ptr = pointeur sur le debut de la description du texte
* ox, oy = Offsets de trace
* mode_color = GR_OR, GR_XOR..
*/
void Trace_1_texte_pcb( WinEDA_DrawPanel* panel, wxDC* DC,
TEXTE_PCB* pt_texte, int ox, int oy, int DrawMode )
{
int zoom = panel->m_Parent->CurrentScreen->GetZoom();
int cX, cY;
int screen_epais, gcolor ;
int size_h , size_v , width ;
char *ptr;
int orient;
if( pt_texte->GetText() == NULL ) return;
int zoom = panel->m_Parent->CurrentScreen->GetZoom();
int cX, cY;
int screen_epais, gcolor;
int size_h, size_v, width;
char* ptr;
int orient;
if( pt_texte->GetText() == NULL )
return;
/* lecture des caracteristiques du texte */
size_h = pt_texte->m_Size.x; size_v = pt_texte->m_Size.y ;
size_h = pt_texte->m_Size.x; size_v = pt_texte->m_Size.y;
orient = pt_texte->m_Orient;
width = pt_texte->m_Width;
screen_epais = width / zoom;
......@@ -246,44 +260,48 @@ int orient;
cX = pt_texte->m_Pos.x - ox;
cY = pt_texte->m_Pos.y - oy;
if ( pt_texte->m_Miroir == 0 ) size_h = -size_h;
if( pt_texte->m_Miroir == 0 )
size_h = -size_h;
/* choix de la couleur du texte : */
gcolor = color_layer[pt_texte->m_Layer];
ptr = pt_texte->GetText(); /* ptr pointe 1er caractere du texte */
GRSetDrawMode(DC, DrawMode);
GRSetDrawMode( DC, DrawMode );
/* trace ancre du texte */
if((E_ancre_color&ITEM_NON_VISIBLE) == 0 )
if( (E_ancre_color & ITEM_NON_VISIBLE) == 0 )
{
GRLine(panel, DC, cX - (2*zoom), cY,
cX + (2*zoom), cY, E_ancre_color);
GRLine(panel, DC, cX, cY - (2*zoom) ,
cX, cY + (2*zoom) , E_ancre_color);
GRLine( panel, DC, cX - (2 * zoom), cY,
cX + (2 * zoom), cY, E_ancre_color );
GRLine( panel, DC, cX, cY - (2 * zoom),
cX, cY + (2 * zoom), E_ancre_color );
}
/* trace du texte */
Display_1_Texte(panel, DC, ptr, strlen(ptr), cX, cY,
size_h, size_v, width, orient, gcolor);
Display_1_Texte( panel, DC, ptr, strlen( ptr ), cX, cY,
size_h, size_v, width, orient, gcolor );
}
/*********************************************/
/* void InstallEditCaractMenu(COMMAND * Cmd) */
/*********************************************/
static void InstallEditCaractMenu(COMMAND * Cmd)
/*********************************************/
/* void InstallEditCaractMenu(COMMAND * Cmd) */
/*********************************************/
static void InstallEditCaractMenu( COMMAND* Cmd )
{
#if 0
TEXTE_PCB * TextePcb = PtTextePcbSelecte;
wxDC * DC = Cmd->DC;
TEXTE_PCB* TextePcb = PtTextePcbSelecte;
wxDC* DC = Cmd->DC;
if( TextePcb == NULL )
{
TextePcb = (TEXTE_PCB*)pt_pcb->Drawings;
while( (TextePcb = Locate_Texte_Pcb(TextePcb,CURSEUR_OFF_GRILLE)) != 0 )
TextePcb = (TEXTE_PCB*) pt_pcb->Drawings;
while( ( TextePcb = Locate_Texte_Pcb( TextePcb, CURSEUR_OFF_GRILLE ) ) != 0 )
{
if( TextePcb->Layer == CurrentScreen->Active_Layer ) break;
if( TextePcb->Layer == CurrentScreen->Active_Layer )
break;
// le Texte n'est pas sur la couche active
TextePcb = (TEXTE_PCB*) TextePcb->Pnext;
}
......@@ -293,60 +311,71 @@ wxDC * DC = Cmd->DC;
if( TextePcb == NULL )
{
DisplayError("Texte non trouve sur cette couche",10);
Cmd->Menu->State = WAIT; DisplayMenu(DC, Cmd->Menu, NULL, ON);
DisplayError( "Texte non trouve sur cette couche", 10 );
Cmd->Menu->State = WAIT; DisplayMenu( DC, Cmd->Menu, NULL, ON );
return;
}
Affiche_Infos_PCB_Texte(Cmd, TextePcb);
Affiche_Infos_PCB_Texte( Cmd, TextePcb );
if(TextePcb->orient >= 3600) TextePcb->orient -= 3600 ;
if(TextePcb->orient < 0) TextePcb->orient += 3600 ;
if( TextePcb->orient >= 3600 )
TextePcb->orient -= 3600;
if( TextePcb->orient < 0 )
TextePcb->orient += 3600;
/* Init des variables */
strncpy(BufNameTxt.s, TextePcb->GetText(), sizeof(BufNameTxt.s) - 1);
if( TextePcb->miroir ) Texte_Pcb_Miroir_Item.State = WAIT;
else Texte_Pcb_Miroir_Item.State = RUN;
* (int*) Param_OrientText.param = TextePcb->orient;
* (int*) Param_DimHText.param = TextePcb->Size.x;
* (int*) Param_DimVText.param = TextePcb->Size.y;
* (int*) Param_EpaisText.param = TextePcb->width;
InstallNewList(Cmd);
strncpy( BufNameTxt.s, TextePcb->GetText(), sizeof(BufNameTxt.s) - 1 );
if( TextePcb->miroir )
Texte_Pcb_Miroir_Item.State = WAIT;
else
Texte_Pcb_Miroir_Item.State = RUN;
*(int*) Param_OrientText.param = TextePcb->orient;
*(int*) Param_DimHText.param = TextePcb->Size.x;
*(int*) Param_DimVText.param = TextePcb->Size.y;
*(int*) Param_EpaisText.param = TextePcb->width;
InstallNewList( Cmd );
#endif
}
/*****************************************/
/* void ChangeCaractTexte(COMMAND * Cmd) */
/*****************************************/
/*****************************************/
/* void ChangeCaractTexte(COMMAND * Cmd) */
/*****************************************/
/* Change les caracteristiques du texte en cours d'edition
*/
void WinEDA_PcbFrame::EditTextePcb(TEXTE_PCB * TextePcb, wxDC * DC)
*/
void WinEDA_PcbFrame::EditTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
{
int drawmode = GR_OR;
char buf_new_texte[1024];
int drawmode = GR_OR;
char buf_new_texte[1024];
if( TextePcb == NULL) return;
if( TextePcb == NULL )
return;
if( PtTextePcbSelecte ) drawmode = GR_XOR;
if( PtTextePcbSelecte )
drawmode = GR_XOR;
buf_new_texte[0]= 0 ;
Get_Message("Texte:",buf_new_texte, this);
if(*buf_new_texte <=' ') return;
buf_new_texte[0] = 0;
Get_Message( "Texte:", buf_new_texte, this );
if( *buf_new_texte <=' ' )
return;
/* effacement du texte : */
Trace_1_texte_pcb(DrawPanel, DC, TextePcb, 0, 0, GR_XOR) ;
Trace_1_texte_pcb( DrawPanel, DC, TextePcb, 0, 0, GR_XOR );
if( strcmp( TextePcb->GetText(), buf_new_texte) && strlen(buf_new_texte) )
if( strcmp( TextePcb->GetText(), buf_new_texte ) && strlen( buf_new_texte ) )
{
TextePcb->SetText(buf_new_texte);
TextePcb->SetText( buf_new_texte );
CurrentScreen->SetModify();
}
while(LocalOrient >= 3600) LocalOrient -= 3600 ;
while(LocalOrient < 0) LocalOrient += 3600 ;
while( LocalOrient >= 3600 )
LocalOrient -= 3600;
while( LocalOrient < 0 )
LocalOrient += 3600;
if( CurrentScreen->m_Active_Layer != TextePcb->m_Layer )
{
......@@ -379,21 +408,20 @@ char buf_new_texte[1024];
}
/* if( (Texte_Pcb_Miroir_Item.State == WAIT) && (TextePcb->miroir == 0) )
{
TextePcb->miroir = 1;
CurrentScreen->SetModify();
}
if( (Texte_Pcb_Miroir_Item.State == RUN) && TextePcb->miroir )
{
TextePcb->miroir = 0;
CurrentScreen->SetModify();
}
*/
* {
* TextePcb->miroir = 1;
* CurrentScreen->SetModify();
* }
*
* if( (Texte_Pcb_Miroir_Item.State == RUN) && TextePcb->miroir )
* {
* TextePcb->miroir = 0;
* CurrentScreen->SetModify();
* }
*/
/* Redessin du Texte */
Trace_1_texte_pcb(DrawPanel, DC, TextePcb, 0, 0, drawmode);
Trace_1_texte_pcb( DrawPanel, DC, TextePcb, 0, 0, drawmode );
Affiche_Infos_PCB_Texte(this, TextePcb);
Affiche_Infos_PCB_Texte( this, TextePcb );
}
......@@ -126,12 +126,6 @@ void Trace_1_texte_pcb(WinEDA_DrawPanel * panel, wxDC * DC,
void Affiche_DCodes_Pistes(WinEDA_DrawPanel * panel, wxDC * DC,
BOARD * Pcb, int drawmode);
/**************/
/* struct.cpp */
/**************/
void DeleteStructure(EDA_BaseStruct * Struct);
void DeleteStructList( EDA_BaseStruct * Struct);
/*************/
/* dcode.cpp */
/*************/
......
......@@ -10,6 +10,8 @@
/* Variables locales */
#if 0
/***************************************************/
void DeleteStructure( EDA_BaseStruct * PtStruct )
/***************************************************/
......@@ -91,3 +93,5 @@ EDA_BaseStruct *PtNext;
}
}
#endif
......@@ -75,7 +75,7 @@ BOARD_ITEM* SaveItemEfface( BOARD_ITEM* PtItem, int nbitems )
if( g_UnDeleteStackPtr >= UNDELETE_STACK_SIZE )
{
/* Delete last deleted item, and shift stack. */
DeleteStructure( g_UnDeleteStack[0] );
g_UnDeleteStack[0]->DeleteStructure();
for( ii = 0; ii < (g_UnDeleteStackPtr - 1); ii++ )
{
g_UnDeleteStack[ii] = g_UnDeleteStack[ii + 1];
......
......@@ -185,7 +185,10 @@ public:
KICAD_T Type() const { return m_StructType; }
EDA_BaseStruct* Next() const { return Pnext; }
EDA_BaseStruct* Next() const { return (EDA_BaseStruct*) Pnext; }
EDA_BaseStruct* Back() const { return (EDA_BaseStruct*) Pback; }
EDA_BaseStruct* GetParent() const { return (EDA_BaseStruct*) m_Parent; }
/* Gestion de l'etat (status) de la structure (active, deleted..) */
int GetState( int type );
......@@ -284,6 +287,14 @@ public:
}
/**
* Function DeleteStructList
* deletes each item in a linked list of EDA_BaseStructs, starting with
* "this" object.
*/
void DeleteStructList();
#if defined(DEBUG)
/**
......@@ -403,7 +414,6 @@ public:
BOARD_ITEM* Next() const { return (BOARD_ITEM*) Pnext; }
BOARD_ITEM* Back() const { return (BOARD_ITEM*) Pback; }
BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; }
/**
......@@ -444,6 +454,24 @@ public:
}
/**
* Function UnLink
* detaches this object from its owner.
*/
virtual void UnLink() = 0;
/**
* Function DeleteStructure
* deletes this object after UnLink()ing it from its owner.
*/
void DeleteStructure()
{
UnLink();
delete this;
}
/**
* Function MenuText
* returns the text to use in any menu type UI control which must uniquely
......
......@@ -465,7 +465,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
/* le module est ici bon a etre efface */
module->m_Flags = 0;
module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
DeleteStructure( module );
module->DeleteStructure();
m_Pcb->m_Status_Pcb = 0;
}
}
......@@ -483,7 +483,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
{
/* la piste est ici bonne a etre efface */
pt_segm->Draw( DrawPanel, DC, GR_XOR );
DeleteStructure( pt_segm );
pt_segm->DeleteStructure();
}
}
}
......@@ -512,7 +512,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
break;
/* l'element est ici bon a etre efface */
Trace_DrawSegmentPcb( DrawPanel, DC, (DRAWSEGMENT*) PtStruct, GR_XOR );
DeleteStructure( PtStruct );
PtStruct->DeleteStructure();
break;
case TYPETEXTE:
......@@ -523,7 +523,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
/* le texte est ici bon a etre efface */
( (TEXTE_PCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
/* Suppression du texte en Memoire*/
DeleteStructure( PtStruct );
PtStruct->DeleteStructure();
break;
case TYPEMIRE:
......@@ -535,7 +535,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
break;
/* l'element est ici bon a etre efface */
( (MIREPCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
DeleteStructure( PtStruct );
PtStruct->DeleteStructure();
break;
case TYPECOTATION:
......@@ -547,7 +547,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
break;
/* l'element est ici bon a etre efface */
( (COTATION*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
DeleteStructure( PtStruct );
PtStruct->DeleteStructure();
break;
default:
......@@ -565,9 +565,10 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
{
NextS = pt_segm->Next();
if( IsSegmentInBox( GetScreen()->BlockLocate, pt_segm ) )
{ /* la piste est ici bonne a etre efface */
{
/* la piste est ici bonne a etre efface */
pt_segm->Draw( DrawPanel, DC, GR_XOR );
DeleteStructure( pt_segm );
PtStruct->DeleteStructure();
}
}
}
......
......@@ -533,7 +533,7 @@ void DeleteMarkedItems( MODULE* module )
next_pad = pad->Next();
if( pad->m_Selected == 0 )
continue;
DeleteStructure( pad );
pad->DeleteStructure();
}
item = module->m_Drawings;
......@@ -542,7 +542,7 @@ void DeleteMarkedItems( MODULE* module )
next_item = item->Next();
if( item->m_Selected == 0 )
continue;
DeleteStructure( item );
item->DeleteStructure();
}
}
......
......@@ -48,6 +48,32 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
/***************/
BOARD::~BOARD()
{
m_Drawings->DeleteStructList();
m_Drawings = 0;
m_Modules->DeleteStructList();
m_Modules = 0;
m_Equipots->DeleteStructList();
m_Equipots = 0;
m_Track->DeleteStructList();
m_Track = 0;
m_Zone->DeleteStructList();
m_Zone = 0;
m_CurrentLimitZone->DeleteStructList();
m_CurrentLimitZone = 0;
MyFree( m_Pads );
m_Pads = 0;
MyFree( m_Ratsnest );
m_Ratsnest = 0;
MyFree( m_LocalRatsnest );
m_LocalRatsnest = 0;
}
......
......@@ -279,3 +279,4 @@ const char** BOARD_ITEM::MenuIcon() const
return (const char**) xpm;
}
......@@ -300,7 +300,7 @@ static void suppression_piste_non_connectee( WinEDA_PcbFrame* frame, wxDC* DC )
/* Suppression du segment */
PtSegm->Draw( frame->DrawPanel, DC, GR_XOR );
DeleteStructure( PtSegm );
PtSegm->DeleteStructure();
if( NextS == NULL )
break;
}
......@@ -340,7 +340,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
/* Lenght segment = 0; delete it */
PtSegm->Draw( frame->DrawPanel, DC, GR_XOR );
DeleteStructure( PtSegm );
PtSegm->DeleteStructure();
nbpoints_supprimes++;
msg.Printf( wxT( " %d" ), nbpoints_supprimes );
......@@ -402,7 +402,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
{
ii--;
pt_aux->Draw( frame->DrawPanel, DC, GR_OR );
DeleteStructure( pt_aux );
pt_aux->DeleteStructure();
nbpoints_supprimes++;
msg.Printf( wxT( " %d" ), nbpoints_supprimes );
......@@ -482,7 +482,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
if( pt_segm_delete )
{
nbpoints_supprimes++; no_inc = 1;
DeleteStructure( pt_segm_delete );
pt_segm_delete->DeleteStructure();
}
}
......@@ -519,7 +519,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
if( pt_segm_delete )
{
nbpoints_supprimes++; no_inc = 1;
DeleteStructure( pt_segm_delete );
pt_segm_delete->DeleteStructure();
}
}
......
......@@ -128,7 +128,7 @@ wxDC * DC = Cmd->DC;
for ( ; ii > 0; ii --, pt_track = NextS)
{
NextS = (TRACK*) pt_track->Pnext;
DeleteStructure(pt_track);
pt_track->DeleteStructure();
}
test_1_net_connexion(DC, old_net_code );
}
......
......@@ -208,7 +208,7 @@ static void Exit_EditCotation( WinEDA_DrawPanel* Panel, wxDC* DC )
if( Cotation->m_Flags & IS_NEW )
{
Cotation->Draw( Panel, DC, wxPoint( 0, 0 ), GR_XOR );
DeleteStructure( Cotation );
Cotation ->DeleteStructure();
}
else
{
......@@ -378,7 +378,7 @@ void WinEDA_PcbFrame::Delete_Cotation( COTATION* Cotation, wxDC* DC )
if( DC )
Cotation->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
DeleteStructure( Cotation );
Cotation ->DeleteStructure();
m_CurrentScreen->SetModify();
}
......
......@@ -128,7 +128,7 @@ void WinEDA_DrcFrame::CreateControls()
SetFont(*g_DialogFont);
////@begin WinEDA_DrcFrame content construction
// Generated by DialogBlocks, 20/08/2007 08:58:05 (unregistered)
// Generated by DialogBlocks, Tue 02 Oct 2007 16:31:47 CDT (unregistered)
WinEDA_DrcFrame* itemDialog1 = this;
......@@ -215,7 +215,7 @@ void WinEDA_DrcFrame::CreateControls()
wxStaticText* itemStaticText25 = new wxStaticText( itemDialog1, wxID_STATIC, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
m_MainSizer->Add(itemStaticText25, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_logWindow = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(-1, 200), wxTE_MULTILINE|wxTE_READONLY );
m_logWindow = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(-1, 300), wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL|wxFULL_REPAINT_ON_RESIZE );
m_MainSizer->Add(m_logWindow, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
// Set validators
......@@ -228,6 +228,9 @@ void WinEDA_DrcFrame::CreateControls()
AddUnitSymbol(*m_ClearenceTitle);
m_RptFilenameCtrl->SetValue(s_RptFilename);
// capture the text control's events, all of them.
// m_logWindow->PushEventHandler( this );
}
/*!
......@@ -359,3 +362,52 @@ wxString FileName, Mask(wxT("*")), Ext(wxT(".rpt"));
s_RptFilename = FileName;
}
/*!
* Override the event handler so we can direct the m_lowWindows events here initially
*/
bool WinEDA_DrcFrame::ProcessEvent( wxEvent& event )
{
int id = event.GetId();
if( id == ID_TEXTCTRL )
{
//printf("ID_TEXTCTRL\n");
// this does not work yet
if( event.GetEventType() == wxMOUSE_BTN_LEFT )
{
wxMouseEvent& mouseEvent = (wxMouseEvent&) event;
if( mouseEvent.LeftUp() )
{
wxTextCoord col;
wxTextCoord row;
wxPoint pos = mouseEvent.GetPosition();
if( wxTE_HT_UNKNOWN != m_logWindow->HitTest( pos, &col, &row ) )
{
wxString text = m_logWindow->GetLineText( row );
int debug = 1;
}
}
}
return false;
}
else
{
bool ret;
// printf("ProcessEvent(%d)\n", id);
ret = static_cast<wxDialog*>(this)->wxDialog::ProcessEvent( event );
// printf("~ProcessEvent\n");
return ret;
}
}
......@@ -52,7 +52,7 @@ class wxBoxSizer;
#define ID_BUTTON_BROWSE_RPT_FILE 10011
#define ID_TEXTCTRL_GET_RPT_FILENAME 10010
#define ID_TEXTCTRL 10001
#define SYMBOL_WINEDA_DRCFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_DRCFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_WINEDA_DRCFRAME_TITLE _("DRC Control")
#define SYMBOL_WINEDA_DRCFRAME_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_DRCFRAME_SIZE wxSize(400, 300)
......@@ -88,6 +88,9 @@ public:
/// Creates the controls and sizers
void CreateControls();
/// Override the event handler so we can direct the m_lowWindows events here initially
virtual bool ProcessEvent( wxEvent& event );
////@begin WinEDA_DrcFrame event handler declarations
/// wxEVT_CLOSE_WINDOW event handler for ID_DIALOG
......
......@@ -10,8 +10,10 @@
<bool name="convert_images_to_xpm">0</bool>
<bool name="inline_images">0</bool>
<bool name="generate_cpp_for_xrc">0</bool>
<long name="working_mode">1</long>
<bool name="use_help_text_for_tooltips">1</bool>
<bool name="translate_strings">1</bool>
<bool name="make_unicode_strings">1</bool>
<bool name="extract_strings">0</bool>
<string name="user_name">"jean-pierre Charras"</string>
<string name="copyright_string">"License GNU"</string>
......@@ -213,6 +215,7 @@
<bool name="use-id-suffix">0</bool>
<string name="id-suffix">""</string>
<long name="use-xrc">0</long>
<long name="working-mode">0</long>
<string name="event-handler-0">"wxEVT_CLOSE_WINDOW|OnCloseWindow|NONE||"</string>
<string name="proxy-Id name">"ID_DIALOG"</string>
<long name="proxy-Id value">10000</long>
......@@ -234,9 +237,16 @@
<bool name="proxy-Hidden">0</bool>
<bool name="proxy-Enabled">1</bool>
<string name="proxy-Platform">"&lt;Any platform&gt;"</string>
<string name="proxy-Data source">""</string>
<string name="proxy-Data class name">""</string>
<string name="proxy-Data class implementation filename">""</string>
<string name="proxy-Data class header filename">""</string>
<string name="proxy-Data class manager window">""</string>
<string name="proxy-Texture">""</string>
<string name="proxy-Texture style">"Tiled"</string>
<bool name="proxy-wxDEFAULT_DIALOG_STYLE">0</bool>
<bool name="proxy-wxCAPTION">1</bool>
<bool name="proxy-wxRESIZE_BORDER">0</bool>
<bool name="proxy-wxRESIZE_BORDER">1</bool>
<bool name="proxy-wxTHICK_FRAME">0</bool>
<bool name="proxy-wxSYSTEM_MENU">1</bool>
<bool name="proxy-wxSTAY_ON_TOP">0</bool>
......@@ -267,7 +277,7 @@
<long name="proxy-Width">400</long>
<long name="proxy-Height">300</long>
<bool name="proxy-AUI manager">0</bool>
<string name="proxy-Event sources">""</string>
<string name="proxy-Event sources">"m_logWindow"</string>
<document>
<string name="title">"wxBoxSizer V"</string>
<string name="type">"dialog-control-document"</string>
......@@ -356,6 +366,7 @@
<string name="proxy-type">"wbStaticTextProxy"</string>
<string name="proxy-Id name">"wxID_STATIC"</string>
<long name="proxy-Id value">5105</long>
<string name="proxy-Name">""</string>
<string name="proxy-Class">"wxStaticText"</string>
<string name="proxy-Base class">"wxStaticText"</string>
<bool name="proxy-External implementation">1</bool>
......@@ -375,6 +386,11 @@
<string name="proxy-Platform">"&lt;Any platform&gt;"</string>
<string name="proxy-Data variable">""</string>
<string name="proxy-Data validator">""</string>
<string name="proxy-Data source">""</string>
<string name="proxy-Data class name">""</string>
<string name="proxy-Data class implementation filename">""</string>
<string name="proxy-Data class header filename">""</string>
<string name="proxy-Data class manager window">""</string>
<bool name="proxy-wxALIGN_LEFT">0</bool>
<bool name="proxy-wxALIGN_RIGHT">0</bool>
<bool name="proxy-wxALIGN_CENTRE">0</bool>
......@@ -420,6 +436,7 @@
<string name="proxy-type">"wbTextCtrlProxy"</string>
<string name="proxy-Id name">"ID_TEXTCTRL1"</string>
<long name="proxy-Id value">10002</long>
<string name="proxy-Name">""</string>
<string name="proxy-Class">"wxTextCtrl"</string>
<string name="proxy-Base class">"wxTextCtrl"</string>
<bool name="proxy-External implementation">1</bool>
......@@ -439,6 +456,11 @@
<string name="proxy-Platform">"&lt;Any platform&gt;"</string>
<string name="proxy-Data variable">""</string>
<string name="proxy-Data validator">""</string>
<string name="proxy-Data source">""</string>
<string name="proxy-Data class name">""</string>
<string name="proxy-Data class implementation filename">""</string>
<string name="proxy-Data class header filename">""</string>
<string name="proxy-Data class manager window">""</string>
<bool name="proxy-wxTE_MULTILINE">0</bool>
<bool name="proxy-wxTE_PROCESS_ENTER">0</bool>
<bool name="proxy-wxTE_PROCESS_TAB">0</bool>
......@@ -454,6 +476,7 @@
<bool name="proxy-wxHSCROLL">0</bool>
<bool name="proxy-wxTE_CHARWRAP">0</bool>
<bool name="proxy-wxTE_WORDWRAP">0</bool>
<bool name="proxy-wxTE_CAPITALIZE">0</bool>
<bool name="proxy-wxNO_BORDER">0</bool>
<bool name="proxy-wxSIMPLE_BORDER">0</bool>
<bool name="proxy-wxDOUBLE_BORDER">0</bool>
......@@ -555,6 +578,7 @@
<string name="proxy-type">"wbCheckBoxProxy"</string>
<string name="proxy-Id name">"ID_CHECKBOX_PAD2PAD"</string>
<long name="proxy-Id value">10009</long>
<string name="proxy-Name">""</string>
<string name="proxy-Class">"wxCheckBox"</string>
<string name="proxy-Base class">"wxCheckBox"</string>
<bool name="proxy-External implementation">1</bool>
......@@ -568,6 +592,11 @@
<string name="proxy-Tooltip text">""</string>
<string name="proxy-Data variable">"s_Pad2PadTestOpt"</string>
<string name="proxy-Data validator">"wxGenericValidator(&amp; %VARIABLE%)"</string>
<string name="proxy-Data source">""</string>
<string name="proxy-Data class name">""</string>
<string name="proxy-Data class implementation filename">""</string>
<string name="proxy-Data class header filename">""</string>
<string name="proxy-Data class manager window">""</string>
<string name="proxy-Background colour">""</string>
<string name="proxy-Foreground colour">""</string>
<string name="proxy-Font">""</string>
......@@ -613,6 +642,7 @@
<string name="proxy-type">"wbCheckBoxProxy"</string>
<string name="proxy-Id name">"ID_CHECKBOX"</string>
<long name="proxy-Id value">10008</long>
<string name="proxy-Name">""</string>
<string name="proxy-Class">"wxCheckBox"</string>
<string name="proxy-Base class">"wxCheckBox"</string>
<bool name="proxy-External implementation">1</bool>
......@@ -626,6 +656,11 @@
<string name="proxy-Tooltip text">""</string>
<string name="proxy-Data variable">"s_UnconnectedTestOpt"</string>
<string name="proxy-Data validator">"wxGenericValidator(&amp; %VARIABLE%)"</string>
<string name="proxy-Data source">""</string>
<string name="proxy-Data class name">""</string>
<string name="proxy-Data class implementation filename">""</string>
<string name="proxy-Data class header filename">""</string>
<string name="proxy-Data class manager window">""</string>
<string name="proxy-Background colour">""</string>
<string name="proxy-Foreground colour">""</string>
<string name="proxy-Font">""</string>
......@@ -671,6 +706,7 @@
<string name="proxy-type">"wbCheckBoxProxy"</string>
<string name="proxy-Id name">"ID_CHECKBOX_TEST_ZONES"</string>
<long name="proxy-Id value">10007</long>
<string name="proxy-Name">""</string>
<string name="proxy-Class">"wxCheckBox"</string>
<string name="proxy-Base class">"wxCheckBox"</string>
<bool name="proxy-External implementation">1</bool>
......@@ -684,6 +720,11 @@
<string name="proxy-Tooltip text">""</string>
<string name="proxy-Data variable">"s_ZonesTestOpt"</string>
<string name="proxy-Data validator">"wxGenericValidator(&amp; %VARIABLE%)"</string>
<string name="proxy-Data source">""</string>
<string name="proxy-Data class name">""</string>
<string name="proxy-Data class implementation filename">""</string>
<string name="proxy-Data class header filename">""</string>
<string name="proxy-Data class manager window">""</string>
<string name="proxy-Background colour">""</string>
<string name="proxy-Foreground colour">""</string>
<string name="proxy-Font">""</string>
......@@ -729,6 +770,7 @@
<string name="proxy-type">"wbCheckBoxProxy"</string>
<string name="proxy-Id name">"ID_CHECKBOX_CREATE_FILE"</string>
<long name="proxy-Id value">10012</long>
<string name="proxy-Name">""</string>
<string name="proxy-Class">"wxCheckBox"</string>
<string name="proxy-Base class">"wxCheckBox"</string>
<bool name="proxy-External implementation">1</bool>
......@@ -742,6 +784,11 @@
<string name="proxy-Tooltip text">""</string>
<string name="proxy-Data variable">"s_CreateRptFileOpt"</string>
<string name="proxy-Data validator">"wxGenericValidator(&amp; %VARIABLE%)"</string>
<string name="proxy-Data source">""</string>
<string name="proxy-Data class name">""</string>
<string name="proxy-Data class implementation filename">""</string>
<string name="proxy-Data class header filename">""</string>
<string name="proxy-Data class manager window">""</string>
<string name="proxy-Background colour">""</string>
<string name="proxy-Foreground colour">""</string>
<string name="proxy-Font">""</string>
......@@ -865,6 +912,7 @@
<string name="event-handler-0">"wxEVT_COMMAND_BUTTON_CLICKED|OnDrcRunClick"</string>
<string name="proxy-Id name">"ID_DRC_RUN"</string>
<long name="proxy-Id value">10003</long>
<string name="proxy-Name">""</string>
<string name="proxy-Class">"wxButton"</string>
<string name="proxy-Base class">"wxButton"</string>
<bool name="proxy-External implementation">1</bool>
......@@ -876,6 +924,13 @@
<bool name="proxy-Default">0</bool>
<string name="proxy-Help text">""</string>
<string name="proxy-Tooltip text">""</string>
<string name="proxy-Data variable">""</string>
<string name="proxy-Data validator">""</string>
<string name="proxy-Data source">""</string>
<string name="proxy-Data class name">""</string>
<string name="proxy-Data class implementation filename">""</string>
<string name="proxy-Data class header filename">""</string>
<string name="proxy-Data class manager window">""</string>
<string name="proxy-Background colour">""</string>
<string name="proxy-Foreground colour">"CA0000"</string>
<string name="proxy-Font">""</string>
......@@ -924,6 +979,7 @@
<string name="event-handler-0">"wxEVT_COMMAND_BUTTON_CLICKED|OnStopControlDrcClick"</string>
<string name="proxy-Id name">"ID_STOP_CONTROL_DRC"</string>
<long name="proxy-Id value">10004</long>
<string name="proxy-Name">""</string>
<string name="proxy-Class">"wxButton"</string>
<string name="proxy-Base class">"wxButton"</string>
<bool name="proxy-External implementation">1</bool>
......@@ -935,6 +991,13 @@
<bool name="proxy-Default">0</bool>
<string name="proxy-Help text">""</string>
<string name="proxy-Tooltip text">""</string>
<string name="proxy-Data variable">""</string>
<string name="proxy-Data validator">""</string>
<string name="proxy-Data source">""</string>
<string name="proxy-Data class name">""</string>
<string name="proxy-Data class implementation filename">""</string>
<string name="proxy-Data class header filename">""</string>
<string name="proxy-Data class manager window">""</string>
<string name="proxy-Background colour">""</string>
<string name="proxy-Foreground colour">"008080"</string>
<string name="proxy-Font">""</string>
......@@ -1009,6 +1072,7 @@
<string name="event-handler-0">"wxEVT_COMMAND_BUTTON_CLICKED|OnEraseDrcMarkersClick"</string>
<string name="proxy-Id name">"ID_ERASE_DRC_MARKERS"</string>
<long name="proxy-Id value">10005</long>
<string name="proxy-Name">""</string>
<string name="proxy-Class">"wxButton"</string>
<string name="proxy-Base class">"wxButton"</string>
<bool name="proxy-External implementation">1</bool>
......@@ -1020,6 +1084,13 @@
<bool name="proxy-Default">0</bool>
<string name="proxy-Help text">""</string>
<string name="proxy-Tooltip text">""</string>
<string name="proxy-Data variable">""</string>
<string name="proxy-Data validator">""</string>
<string name="proxy-Data source">""</string>
<string name="proxy-Data class name">""</string>
<string name="proxy-Data class implementation filename">""</string>
<string name="proxy-Data class header filename">""</string>
<string name="proxy-Data class manager window">""</string>
<string name="proxy-Background colour">""</string>
<string name="proxy-Foreground colour">"008000"</string>
<string name="proxy-Font">""</string>
......@@ -1068,6 +1139,7 @@
<string name="event-handler-0">"wxEVT_COMMAND_BUTTON_CLICKED|OnListUnconnectedPadsClick"</string>
<string name="proxy-Id name">"ID_LIST_UNCONNECTED_PADS"</string>
<long name="proxy-Id value">10006</long>
<string name="proxy-Name">""</string>
<string name="proxy-Class">"wxButton"</string>
<string name="proxy-Base class">"wxButton"</string>
<bool name="proxy-External implementation">1</bool>
......@@ -1079,6 +1151,13 @@
<bool name="proxy-Default">0</bool>
<string name="proxy-Help text">""</string>
<string name="proxy-Tooltip text">""</string>
<string name="proxy-Data variable">""</string>
<string name="proxy-Data validator">""</string>
<string name="proxy-Data source">""</string>
<string name="proxy-Data class name">""</string>
<string name="proxy-Data class implementation filename">""</string>
<string name="proxy-Data class header filename">""</string>
<string name="proxy-Data class manager window">""</string>
<string name="proxy-Background colour">""</string>
<string name="proxy-Foreground colour">"0000FF"</string>
<string name="proxy-Font">""</string>
......@@ -1129,6 +1208,7 @@
<string name="event-handler-0">"wxEVT_COMMAND_BUTTON_CLICKED|OnCloseClick"</string>
<string name="proxy-Id name">"wxID_CLOSE"</string>
<long name="proxy-Id value">5001</long>
<string name="proxy-Name">""</string>
<string name="proxy-Class">"wxButton"</string>
<string name="proxy-Base class">"wxButton"</string>
<bool name="proxy-External implementation">1</bool>
......@@ -1140,6 +1220,13 @@
<bool name="proxy-Default">0</bool>
<string name="proxy-Help text">""</string>
<string name="proxy-Tooltip text">""</string>
<string name="proxy-Data variable">""</string>
<string name="proxy-Data validator">""</string>
<string name="proxy-Data source">""</string>
<string name="proxy-Data class name">""</string>
<string name="proxy-Data class implementation filename">""</string>
<string name="proxy-Data class header filename">""</string>
<string name="proxy-Data class manager window">""</string>
<string name="proxy-Background colour">""</string>
<string name="proxy-Foreground colour">""</string>
<string name="proxy-Font">""</string>
......@@ -1222,6 +1309,7 @@
<string name="event-handler-0">"wxEVT_COMMAND_BUTTON_CLICKED|OnButtonBrowseRptFileClick|NONE||"</string>
<string name="proxy-Id name">"ID_BUTTON_BROWSE_RPT_FILE"</string>
<long name="proxy-Id value">10011</long>
<string name="proxy-Name">""</string>
<string name="proxy-Class">"wxButton"</string>
<string name="proxy-Base class">"wxButton"</string>
<bool name="proxy-External implementation">1</bool>
......@@ -1233,6 +1321,13 @@
<bool name="proxy-Default">0</bool>
<string name="proxy-Help text">""</string>
<string name="proxy-Tooltip text">""</string>
<string name="proxy-Data variable">""</string>
<string name="proxy-Data validator">""</string>
<string name="proxy-Data source">""</string>
<string name="proxy-Data class name">""</string>
<string name="proxy-Data class implementation filename">""</string>
<string name="proxy-Data class header filename">""</string>
<string name="proxy-Data class manager window">""</string>
<string name="proxy-Background colour">""</string>
<string name="proxy-Foreground colour">"008080"</string>
<string name="proxy-Font">""</string>
......@@ -1280,6 +1375,7 @@
<string name="proxy-type">"wbTextCtrlProxy"</string>
<string name="proxy-Id name">"ID_TEXTCTRL_GET_RPT_FILENAME"</string>
<long name="proxy-Id value">10010</long>
<string name="proxy-Name">""</string>
<string name="proxy-Class">"wxTextCtrl"</string>
<string name="proxy-Base class">"wxTextCtrl"</string>
<bool name="proxy-External implementation">1</bool>
......@@ -1299,6 +1395,11 @@
<string name="proxy-Platform">"&lt;Any platform&gt;"</string>
<string name="proxy-Data variable">""</string>
<string name="proxy-Data validator">""</string>
<string name="proxy-Data source">""</string>
<string name="proxy-Data class name">""</string>
<string name="proxy-Data class implementation filename">""</string>
<string name="proxy-Data class header filename">""</string>
<string name="proxy-Data class manager window">""</string>
<bool name="proxy-wxTE_MULTILINE">0</bool>
<bool name="proxy-wxTE_PROCESS_ENTER">0</bool>
<bool name="proxy-wxTE_PROCESS_TAB">0</bool>
......@@ -1314,6 +1415,7 @@
<bool name="proxy-wxHSCROLL">0</bool>
<bool name="proxy-wxTE_CHARWRAP">0</bool>
<bool name="proxy-wxTE_WORDWRAP">0</bool>
<bool name="proxy-wxTE_CAPITALIZE">0</bool>
<bool name="proxy-wxNO_BORDER">0</bool>
<bool name="proxy-wxSIMPLE_BORDER">0</bool>
<bool name="proxy-wxDOUBLE_BORDER">0</bool>
......@@ -1358,6 +1460,7 @@
<string name="proxy-type">"wbStaticTextProxy"</string>
<string name="proxy-Id name">"wxID_STATIC"</string>
<long name="proxy-Id value">5105</long>
<string name="proxy-Name">""</string>
<string name="proxy-Class">"wxStaticText"</string>
<string name="proxy-Base class">"wxStaticText"</string>
<bool name="proxy-External implementation">1</bool>
......@@ -1377,6 +1480,11 @@
<string name="proxy-Platform">"&lt;Any platform&gt;"</string>
<string name="proxy-Data variable">""</string>
<string name="proxy-Data validator">""</string>
<string name="proxy-Data source">""</string>
<string name="proxy-Data class name">""</string>
<string name="proxy-Data class implementation filename">""</string>
<string name="proxy-Data class header filename">""</string>
<string name="proxy-Data class manager window">""</string>
<bool name="proxy-wxALIGN_LEFT">0</bool>
<bool name="proxy-wxALIGN_RIGHT">0</bool>
<bool name="proxy-wxALIGN_CENTRE">0</bool>
......@@ -1422,6 +1530,7 @@
<string name="proxy-type">"wbTextCtrlProxy"</string>
<string name="proxy-Id name">"ID_TEXTCTRL"</string>
<long name="proxy-Id value">10001</long>
<string name="proxy-Name">""</string>
<string name="proxy-Class">"wxTextCtrl"</string>
<string name="proxy-Base class">"wxTextCtrl"</string>
<bool name="proxy-External implementation">1</bool>
......@@ -1441,6 +1550,11 @@
<string name="proxy-Platform">"&lt;Any platform&gt;"</string>
<string name="proxy-Data variable">""</string>
<string name="proxy-Data validator">""</string>
<string name="proxy-Data source">""</string>
<string name="proxy-Data class name">""</string>
<string name="proxy-Data class implementation filename">""</string>
<string name="proxy-Data class header filename">""</string>
<string name="proxy-Data class manager window">""</string>
<bool name="proxy-wxTE_MULTILINE">1</bool>
<bool name="proxy-wxTE_PROCESS_ENTER">0</bool>
<bool name="proxy-wxTE_PROCESS_TAB">0</bool>
......@@ -1453,9 +1567,10 @@
<bool name="proxy-wxTE_LEFT">0</bool>
<bool name="proxy-wxTE_CENTRE">0</bool>
<bool name="proxy-wxTE_RIGHT">0</bool>
<bool name="proxy-wxHSCROLL">0</bool>
<bool name="proxy-wxHSCROLL">1</bool>
<bool name="proxy-wxTE_CHARWRAP">0</bool>
<bool name="proxy-wxTE_WORDWRAP">0</bool>
<bool name="proxy-wxTE_CAPITALIZE">0</bool>
<bool name="proxy-wxNO_BORDER">0</bool>
<bool name="proxy-wxSIMPLE_BORDER">0</bool>
<bool name="proxy-wxDOUBLE_BORDER">0</bool>
......@@ -1464,12 +1579,12 @@
<bool name="proxy-wxSTATIC_BORDER">0</bool>
<bool name="proxy-wxWANTS_CHARS">0</bool>
<bool name="proxy-wxNO_FULL_REPAINT_ON_RESIZE">0</bool>
<bool name="proxy-wxFULL_REPAINT_ON_RESIZE">0</bool>
<bool name="proxy-wxFULL_REPAINT_ON_RESIZE">1</bool>
<string name="proxy-Custom styles">""</string>
<long name="proxy-X">-1</long>
<long name="proxy-Y">-1</long>
<long name="proxy-Width">-1</long>
<long name="proxy-Height">200</long>
<long name="proxy-Height">300</long>
<string name="proxy-AlignH">"Expand"</string>
<string name="proxy-AlignV">"Expand"</string>
<long name="proxy-Stretch factor">0</long>
......
......@@ -286,7 +286,7 @@ void WinEDA_ModuleEditFrame::Delete_Edge_Module( EDGE_MODULE* Edge, wxDC* DC )
Edge->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
/* suppression d'un segment */
DeleteStructure( Edge );
Edge ->DeleteStructure();
Module->m_LastEdit_Time = time( NULL );
Module->Set_Rectangle_Encadrement();
GetScreen()->SetModify();
......@@ -307,7 +307,7 @@ static void Exit_EditEdge_Module( WinEDA_DrawPanel* Panel, wxDC* DC )
{
MODULE* Module = (MODULE*) Edge->m_Parent;
Edge->Draw( Panel, DC, MoveVector, GR_XOR );
DeleteStructure( Edge );
Edge ->DeleteStructure();
Module->Set_Rectangle_Encadrement();
}
else
......@@ -435,7 +435,7 @@ void WinEDA_ModuleEditFrame::End_Edge_Module( EDGE_MODULE* Edge, wxDC* DC )
if( (Edge->m_Start.x == Edge->m_End.x)
&& (Edge->m_Start.y == Edge->m_End.y) )
{
DeleteStructure( Edge );
Edge ->DeleteStructure();
}
}
Edge->m_Flags = 0;
......
......@@ -109,7 +109,7 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
DisplayOpt.DisplayDrawItems = SKETCH;
Trace_DrawSegmentPcb( DrawPanel, DC, Segment, GR_XOR );
PtStruct = Segment->Pback;
DeleteStructure( Segment );
Segment ->DeleteStructure();
if( PtStruct && (PtStruct->Type() == TYPEDRAWSEGMENT ) )
Segment = (DRAWSEGMENT*) PtStruct;
DisplayOpt.DisplayDrawItems = track_fill_copy;
......@@ -119,7 +119,7 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
{
Trace_DrawSegmentPcb( DrawPanel, DC, (DRAWSEGMENT*) Segment, GR_XOR );
Segment->m_Flags = 0;
DeleteStructure( Segment );
Segment ->DeleteStructure();
SetCurItem( NULL );
GetScreen()->SetModify();
}
......@@ -191,7 +191,7 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC
if( pt_segm->GetLayer() == layer )
{
Trace_DrawSegmentPcb( DrawPanel, DC, pt_segm, GR_XOR );
DeleteStructure( PtStruct );
PtStruct ->DeleteStructure();
}
break;
......@@ -200,7 +200,7 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC
if( pt_txt->GetLayer() == layer )
{
pt_txt->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
DeleteStructure( PtStruct );
PtStruct ->DeleteStructure();
}
break;
......@@ -210,7 +210,7 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC
if( Cotation->GetLayer() == layer )
{
Cotation->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
DeleteStructure( PtStruct );
PtStruct ->DeleteStructure();
}
break;
......@@ -234,7 +234,7 @@ static void Exit_EditEdge( WinEDA_DrawPanel* Panel, wxDC* DC )
if( Segment->m_Flags & IS_NEW )
{
Panel->ManageCurseur( Panel, DC, FALSE );
DeleteStructure( Segment );
Segment ->DeleteStructure();
Segment = NULL;
}
else
......@@ -338,7 +338,7 @@ void WinEDA_PcbFrame::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
/* Effacement si Longueur nulle */
if( (Segment->m_Start.x == Segment->m_End.x)
&& (Segment->m_Start.y == Segment->m_End.y) )
DeleteStructure( Segment );
Segment ->DeleteStructure();
else
{
......
......@@ -110,7 +110,7 @@ void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text, wxDC* DC )
Text->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
/* liberation de la memoire : */
DeleteStructure( Text );
Text ->DeleteStructure();
GetScreen()->SetModify();
Module->m_LastEdit_Time = time( NULL );
}
......
......@@ -129,28 +129,29 @@ bool WinEDA_BasePcbFrame::Clear_Pcb( wxDC* DC, bool query )
}
/* Suppression des listes chainees */
DeleteStructList( m_Pcb->m_Equipots );
m_Pcb->m_Equipots->DeleteStructList();
m_Pcb->m_Equipots = NULL;
DeleteStructList( m_Pcb->m_Drawings );
m_Pcb->m_Drawings->DeleteStructList();
m_Pcb->m_Drawings = NULL;
DeleteStructList( m_Pcb->m_Modules );
m_Pcb->m_Modules->DeleteStructList();
m_Pcb->m_Modules = NULL;
DeleteStructList( m_Pcb->m_Track );
m_Pcb->m_Track->DeleteStructList();
m_Pcb->m_Track = NULL;
m_Pcb->m_NbSegmTrack = 0;
DeleteStructList( m_Pcb->m_Zone );
m_Pcb->m_Zone->DeleteStructList();
m_Pcb->m_Zone = NULL;
m_Pcb->m_NbSegmZone = 0;
DelLimitesZone( DC, FALSE );
for( ; g_UnDeleteStackPtr != 0; )
{
g_UnDeleteStackPtr--;
DeleteStructList( g_UnDeleteStack[g_UnDeleteStackPtr] );
g_UnDeleteStack[g_UnDeleteStackPtr]->DeleteStructList();
}
/* init pointeurs et variables */
......@@ -214,11 +215,11 @@ void WinEDA_PcbFrame::Erase_Zones( wxDC* DC, bool query )
if( m_Pcb->m_Zone )
{
while( m_Pcb->m_Zone )
DeleteStructure( m_Pcb->m_Zone );
m_Pcb->m_Zone->DeleteStructList();
m_Pcb->m_Zone = NULL;
m_Pcb->m_NbSegmZone = 0;
}
DelLimitesZone( DC, FALSE );
GetScreen()->SetModify();
......@@ -257,7 +258,7 @@ void WinEDA_PcbFrame::Erase_Segments_Pcb( wxDC* DC, bool is_edges, bool query )
case TYPECOTATION:
case TYPEMIRE:
if( g_TabOneLayerMask[ PtStruct->GetLayer()] & masque_layer )
DeleteStructure( PtStruct );
PtStruct->DeleteStructure();
break;
default:
......@@ -281,7 +282,7 @@ void WinEDA_PcbFrame::Erase_Pistes( wxDC* DC, int masque_type, bool query )
*/
{
TRACK* pt_segm;
EDA_BaseStruct* PtNext;
TRACK* PtNext;
if( query && !IsOK( this, _( "Delete Tracks?" ) ) )
return;
......@@ -289,10 +290,12 @@ void WinEDA_PcbFrame::Erase_Pistes( wxDC* DC, int masque_type, bool query )
/* Marquage des pistes a effacer */
for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) PtNext )
{
PtNext = pt_segm->Pnext;
PtNext = (TRACK*) pt_segm->Pnext;
if( pt_segm->GetState( SEGM_FIXE | SEGM_AR ) & masque_type )
continue;
DeleteStructure( pt_segm );
pt_segm->DeleteStructure();
}
GetScreen()->SetModify();
......@@ -307,8 +310,8 @@ void WinEDA_PcbFrame::Erase_Modules( wxDC* DC, bool query )
if( query && !IsOK( this, _( "Delete Modules?" ) ) )
return;
while( m_Pcb->m_Modules )
DeleteStructure( m_Pcb->m_Modules );
m_Pcb->m_Modules->DeleteStructList();
m_Pcb->m_Modules = 0;
m_Pcb->m_Status_Pcb = 0;
m_Pcb->m_NbNets = 0;
......@@ -335,7 +338,7 @@ void WinEDA_PcbFrame::Erase_Textes_Pcb( wxDC* DC, bool query )
{
PtNext = PtStruct->Next();
if( PtStruct->Type() == TYPETEXTE )
DeleteStructure( PtStruct );
PtStruct ->DeleteStructure();
}
GetScreen()->SetModify();
......@@ -353,7 +356,7 @@ void WinEDA_PcbFrame::Erase_Marqueurs()
{
PtNext = PtStruct->Next();
if( PtStruct->Type() == TYPEMARQUEUR )
DeleteStructure( PtStruct );
PtStruct ->DeleteStructure();
}
GetScreen()->SetModify();
......
......@@ -86,7 +86,7 @@ OBJECTS= $(TARGET).o classpcb.o\
zones.o undelete.o \
copy_track.o\
move_or_drag_track.o\
ioascii.o struct.o \
ioascii.o \
mirepcb.o xchgmod.o\
plotps.o\
dragsegm.o\
......@@ -282,8 +282,6 @@ copy_track.o: copy_track.cpp $(COMMON)
ioascii.o: ioascii.cpp $(COMMON)
struct.o: struct.cpp $(COMMON)
coordbox.o: coordbox.cpp $(COMMON)
mirepcb.o: mirepcb.cpp $(COMMON)
......
......@@ -168,7 +168,7 @@ void WinEDA_PcbFrame::Delete_Mire( MIREPCB* MirePcb, wxDC* DC )
return;
MirePcb->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
DeleteStructure( MirePcb );
MirePcb ->DeleteStructure();
}
......@@ -190,7 +190,7 @@ static void Exit_EditMire( WinEDA_DrawPanel* Panel, wxDC* DC )
if( MirePcb->m_Flags & IS_NEW )
{
MirePcb->Draw( Panel, DC, wxPoint( 0, 0 ), GR_XOR );
DeleteStructure( MirePcb );
MirePcb ->DeleteStructure();
MirePcb = NULL;
}
else /* Ancienne mire en deplacement: Remise en ancienne position */
......
......@@ -180,7 +180,7 @@ void Exit_Module( WinEDA_DrawPanel* Panel, wxDC* DC )
if( module->m_Flags & IS_NEW )
{
DeleteStructure( module );
module ->DeleteStructure();
module = NULL;
pcbframe->m_Pcb->m_Status_Pcb = 0;
pcbframe->build_liste_pads();
......
......@@ -256,7 +256,7 @@ wxString line;
if ( DC ) Pad->Draw(DrawPanel, DC, wxPoint(0,0),GR_XOR);
DeleteStructure(Pad);
Pad->DeleteStructure();
/* Redessin du module */
if ( DC ) Module->Draw(DrawPanel, DC, wxPoint(0,0),GR_OR);
......
......@@ -390,7 +390,7 @@ void WinEDA_PcbFrame::Place_Dupl_Route( Track* Track, wxDC* DC )
for( ; ii > 0; ii--, pt_track = NextS )
{
NextS = (TRACK*) pt_track->Pnext;
DeleteStructure( pt_track );
pt_track ->DeleteStructure();
}
test_1_net_connexion( DC, old_net_code );
......
......@@ -103,7 +103,7 @@ static void Exit_Muonde( WinEDA_DrawFrame* frame, wxDC* DC )
if( Module->m_Flags & IS_NEW )
{
Module->Draw( frame->DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
DeleteStructure( Module );
Module ->DeleteStructure();
}
else
{
......
......@@ -329,7 +329,7 @@ void WinEDA_PcbFrame::Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
TextePcb->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
/* Suppression du texte en Memoire*/
DeleteStructure( TextePcb );
TextePcb ->DeleteStructure();
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL );
......@@ -365,7 +365,7 @@ TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC )
InstallTextPCBOptionsFrame( TextePcb, DC, TextePcb->m_Pos );
if( TextePcb->m_Text.IsEmpty() )
{
DeleteStructure( TextePcb );
TextePcb ->DeleteStructure();
TextePcb = NULL;
}
else
......
......@@ -372,12 +372,6 @@ TRACK * CreateLockPoint(int *pX, int *pY, TRACK * ptsegm, TRACK * refsegm);
/****************/
void RemoteCommand( const char* cmdline );
/*************/
/* STRUCT.CPP */
/*************/
void DeleteStructure( BOARD_ITEM* Struct );
void DeleteStructList( BOARD_ITEM* Struct );
/***************/
/* AUTOPLACE.CPP */
......
......@@ -801,7 +801,7 @@ void WinEDA_BasePcbFrame::recalcule_pad_net_code()
while( pt_equipot )
{
PtStruct = pt_equipot->Pnext;
DeleteStructure( pt_equipot );
pt_equipot ->DeleteStructure();
pt_equipot = (EQUIPOT*) PtStruct;
}
......
/***********************************************/
/* Routines d'effacement et copie de structures*/
/***********************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
/* Routines Locales */
/* Variables locales */
/**************************************************/
void DeleteStructure( BOARD_ITEM* PtStruct )
/**************************************************/
/* Supprime de la liste chainee la stucture pointee par GenericStructure
* et libere la memoire correspondante
*/
{
BOARD_ITEM* PtNext;
BOARD_ITEM* PtBack;
int IsDeleted;
wxString Line;
if( PtStruct == NULL )
return;
IsDeleted = PtStruct->GetState( DELETED );
PtNext = PtStruct->Next();
PtBack = PtStruct->Back();
KICAD_T typestruct = PtStruct->Type();
switch( typestruct )
{
case TYPE_NOT_INIT:
DisplayError( NULL, wxT( "DeleteStruct: Type Not Init" ) );
break;
case PCB_EQUIPOT_STRUCT_TYPE:
#undef Struct
#define Struct ( (EQUIPOT*) PtStruct )
Struct->UnLink();
delete Struct;
break;
case TYPEMODULE:
#undef Struct
#define Struct ( (MODULE*) PtStruct )
Struct->UnLink();
delete Struct;
break;
case TYPEPAD:
#undef Struct
#define Struct ( (D_PAD*) PtStruct )
Struct->UnLink();
delete Struct;
break;
case TYPECOTATION:
#undef Struct
#define Struct ( (COTATION*) PtStruct )
Struct->UnLink();
delete Struct;
break;
case TYPEMIRE:
#undef Struct
#define Struct ( (MIREPCB*) PtStruct )
Struct->UnLink();
delete Struct;
break;
case TYPEDRAWSEGMENT:
#undef Struct
#define Struct ( (DRAWSEGMENT*) PtStruct )
Struct->UnLink();
delete Struct;
break;
case TYPETEXTE:
#undef Struct
#define Struct ( (TEXTE_PCB*) PtStruct )
Struct->UnLink();
delete Struct;
break;
case TYPETEXTEMODULE:
#undef Struct
#define Struct ( (TEXTE_MODULE*) PtStruct )
Struct->UnLink();
delete Struct;
break;
case TYPEEDGEMODULE:
#undef Struct
#define Struct ( (EDGE_MODULE*) PtStruct )
Struct->UnLink();
delete Struct;
break;
case TYPETRACK:
#undef Struct
#define Struct ( (TRACK*) PtStruct )
Struct->UnLink();
delete Struct;
break;
case TYPEVIA:
#undef Struct
#define Struct ( (SEGVIA*) PtStruct )
Struct->UnLink();
delete Struct;
break;
case TYPEZONE:
#undef Struct
#define Struct ( (SEGZONE*) PtStruct )
Struct->UnLink();
delete Struct;
break;
case TYPEMARQUEUR:
#undef Struct
#define Struct ( (MARQUEUR*) PtStruct )
Struct->UnLink();
delete Struct;
break;
case TYPEPCB:
default:
Line.Printf( wxT( " DeleteStructure: unexpected Type %d" ),
PtStruct->Type() );
DisplayError( NULL, Line );
break;
}
}
/**************************************************/
void DeleteStructList( BOARD_ITEM* PtStruct )
/**************************************************/
/* Supprime la liste chainee pointee par PtStruct
* et libere la memoire correspondante
*/
{
BOARD_ITEM* PtNext;
while( PtStruct )
{
PtNext = PtStruct->Next();
delete PtStruct;
PtStruct = PtNext;
}
}
/***********************************************/
/* Routines d'effacement et copie de structures*/
/***********************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
#if 0
/* Routines Locales */
/* Variables locales */
/***********************************************/
void DeleteStructure( BOARD_ITEM* item )
/***********************************************/
/* Supprime de la liste chainee la stucture pointee par GenericStructure
et libere la memoire correspondante
*/
{
if( !item )
return;
switch( item->Type() )
{
case TYPE_NOT_INIT:
DisplayError(NULL, wxT("DeleteStruct: Type Structure Non Initialise"));
break;
case PCB_EQUIPOT_STRUCT_TYPE:
case TYPEMODULE:
case TYPEPAD:
case TYPECOTATION:
case TYPEMIRE:
case TYPEDRAWSEGMENT:
case TYPETEXTE:
case TYPETEXTEMODULE:
case TYPEEDGEMODULE:
case TYPETRACK:
case TYPEVIA:
case TYPEZONE:
case TYPEMARQUEUR:
item->UnLink();
delete item;
break;
default:
{
wxString msg;
msg.Printf( wxT(" DeleteStructure: Type %d Inattendu"), item->Type() );
DisplayError(NULL, msg);
}
}
}
#endif
......@@ -180,7 +180,7 @@ TRACK * BufDeb, *BufEnd; /* Pointeurs de debut et de fin de la zone
for ( jj = 0; jj < nb_segm; jj++, pt_del = NextS)
{
NextS = (TRACK*) pt_del->Pnext;
DeleteStructure(pt_del);
pt_del->DeleteStructure();
}
/* nettoyage des flags */
for(pt_del = Pcb->m_Track; pt_del != NULL; pt_del = (TRACK*)pt_del->Pnext)
......
......@@ -103,7 +103,7 @@ BOARD_ITEM* WinEDA_PcbFrame::SaveItemEfface( BOARD_ITEM* PtItem, int nbitems )
if( g_UnDeleteStackPtr >= UNDELETE_STACK_SIZE )
{
/* Delete last deleted item, and shift stack. */
DeleteStructList( g_UnDeleteStack[0] );
g_UnDeleteStack[0]->DeleteStructList();
for( ii = 0; ii < (g_UnDeleteStackPtr - 1); ii++ )
{
g_UnDeleteStack[ii] = g_UnDeleteStack[ii + 1];
......
......@@ -573,7 +573,7 @@ MODULE* WinEDA_BasePcbFrame::Exchange_Module( wxWindow* winaff,
}
/* Effacement de l'ancien module */
DeleteStructure( OldModule );
OldModule ->DeleteStructure();
m_Pcb->m_Status_Pcb = 0;
NewModule->m_Flags = 0;
......
......@@ -461,7 +461,7 @@ void WinEDA_PcbFrame::Delete_Zone( wxDC* DC, SEGZONE* Zone )
modify = TRUE;
/* effacement des segments a l'ecran */
Trace_Une_Piste( DrawPanel, DC, pt_segm, nb_segm, GR_XOR );
DeleteStructure( pt_segm );
pt_segm ->DeleteStructure();
}
}
......
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