From d985f2d640c6641ec1165a1c2483db93f652333b Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Wed, 3 Oct 2007 15:21:13 +0000 Subject: [PATCH] DeleteStructure() & DeleteStructList() consolidation --- change_log.txt | 10 + common/base_struct.cpp | 17 + common/{svg_print.h => svg_print.h.notused} | 0 cvpcb/displayframe.cpp | 360 +++++------ cvpcb/protos.h | 4 - cvpcb/setvisu.cpp | 89 +-- cvpcb/visumod.cpp | 170 +---- ...atus.cpp => dialog_set_status.cpp.notused} | 0 ...t_status.h => dialog_set_status.h.notused} | 0 ...ionsframe.cpp => optionsframe.cpp.notused} | 0 ...{optionsframe.h => optionsframe.h.notused} | 0 gerbview/block.cpp | 10 +- gerbview/initpcb.cpp | 18 +- gerbview/makefile.include | 3 - gerbview/pcbtexte.cpp | 594 +++++++++--------- gerbview/protos.h | 6 - gerbview/{struct.cpp => struct.cpp.notused} | 4 + gerbview/undelete.cpp | 2 +- include/base_struct.h | 32 +- pcbnew/block.cpp | 17 +- pcbnew/block_module_editor.cpp | 4 +- pcbnew/class_board.cpp | 26 + pcbnew/class_board_item.cpp | 1 + pcbnew/clean.cpp | 10 +- pcbnew/copy_track.cpp | 2 +- pcbnew/cotation.cpp | 4 +- pcbnew/dialog_drc.cpp | 56 +- pcbnew/dialog_drc.h | 5 +- pcbnew/dialog_drc.pjd | 125 +++- pcbnew/edgemod.cpp | 6 +- pcbnew/editedge.cpp | 14 +- pcbnew/edtxtmod.cpp | 2 +- pcbnew/initpcb.cpp | 39 +- pcbnew/makefile.include | 4 +- pcbnew/mirepcb.cpp | 4 +- pcbnew/modules.cpp | 2 +- pcbnew/move-drag_pads.cpp | 2 +- pcbnew/move_copy_track.cpp | 2 +- pcbnew/muonde.cpp | 2 +- pcbnew/pcbtexte.cpp | 4 +- pcbnew/protos.h | 6 - pcbnew/ratsnest.cpp | 2 +- pcbnew/struct.cpp | 164 ----- pcbnew/struct.cpp.notused | 58 ++ pcbnew/tr_modif.cpp | 2 +- pcbnew/undelete.cpp | 2 +- ... win_eda_cleaningoptionsframe.cpp.notused} | 0 ...=> win_eda_cleaningoptionsframe.h.notused} | 0 pcbnew/xchgmod.cpp | 2 +- pcbnew/zones.cpp | 2 +- 50 files changed, 969 insertions(+), 919 deletions(-) rename common/{svg_print.h => svg_print.h.notused} (100%) rename eeschema/{dialog_set_status.cpp => dialog_set_status.cpp.notused} (100%) rename eeschema/{dialog_set_status.h => dialog_set_status.h.notused} (100%) rename eeschema/{optionsframe.cpp => optionsframe.cpp.notused} (100%) rename eeschema/{optionsframe.h => optionsframe.h.notused} (100%) rename gerbview/{struct.cpp => struct.cpp.notused} (99%) delete mode 100644 pcbnew/struct.cpp create mode 100644 pcbnew/struct.cpp.notused rename pcbnew/{win_eda_cleaningoptionsframe.cpp => win_eda_cleaningoptionsframe.cpp.notused} (100%) rename pcbnew/{win_eda_cleaningoptionsframe.h => win_eda_cleaningoptionsframe.h.notused} (100%) diff --git a/change_log.txt b/change_log.txt index c1a563218a..3c2388c9a0 100644 --- a/change_log.txt +++ b/change_log.txt @@ -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 +================================================================================ ++ 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 ================================================================================ + all diff --git a/common/base_struct.cpp b/common/base_struct.cpp index c09e44a55d..f11abbfb0e 100644 --- a/common/base_struct.cpp +++ b/common/base_struct.cpp @@ -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 ) /*********************************************************/ diff --git a/common/svg_print.h b/common/svg_print.h.notused similarity index 100% rename from common/svg_print.h rename to common/svg_print.h.notused diff --git a/cvpcb/displayframe.cpp b/cvpcb/displayframe.cpp index 2a149a77df..541c74ba2e 100644 --- a/cvpcb/displayframe.cpp +++ b/cvpcb/displayframe.cpp @@ -18,80 +18,79 @@ /* Construction de la table des evenements pour WinEDA_DrawFrame */ /*****************************************************************/ -BEGIN_EVENT_TABLE(WinEDA_DisplayFrame, wxFrame) +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) +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_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é + 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); - GetSettings(); - SetSize(m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y); - ReCreateHToolbar(); - ReCreateVToolbar(); - Show(TRUE); + 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 ); + ReCreateHToolbar(); + ReCreateVToolbar(); + 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; + 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(); + size = GetSize(); + pos = GetPosition(); - SaveSettings(); - Destroy(); + SaveSettings(); + Destroy(); } - /************************************************/ void WinEDA_DisplayFrame::ReCreateVToolbar() /************************************************/ @@ -103,36 +102,38 @@ 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); - SetToolBar(m_HToolBar); + m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE ); - m_HToolBar->AddTool(ID_OPTIONS_SETUP, wxEmptyString, - BITMAP(display_options_xpm), - _("Display Options")); + SetToolBar( m_HToolBar ); - m_HToolBar->AddSeparator(); + m_HToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString, + BITMAP( display_options_xpm ), + _( "Display Options" ) ); - m_HToolBar->AddTool(ID_ZOOM_PLUS_BUTT, wxEmptyString, BITMAP(zoom_in_xpm), - _("zoom + (F1)")); + m_HToolBar->AddSeparator(); - m_HToolBar->AddTool(ID_ZOOM_MOINS_BUTT, wxEmptyString, BITMAP(zoom_out_xpm), - _("zoom - (F2)")); + m_HToolBar->AddTool( ID_ZOOM_PLUS_BUTT, wxEmptyString, BITMAP( zoom_in_xpm ), + _( "zoom + (F1)" ) ); - m_HToolBar->AddTool(ID_ZOOM_REDRAW_BUTT, wxEmptyString, BITMAP(repaint_xpm), - _("redraw (F3)")); + m_HToolBar->AddTool( ID_ZOOM_MOINS_BUTT, wxEmptyString, BITMAP( zoom_out_xpm ), + _( "zoom - (F2)" ) ); - m_HToolBar->AddTool(ID_ZOOM_PAGE_BUTT, wxEmptyString, BITMAP(zoom_optimal_xpm), - _("1:1 zoom")); + m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString, BITMAP( repaint_xpm ), + _( "redraw (F3)" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool(ID_CVPCB_SHOW3D_FRAME, wxEmptyString, BITMAP(show_3d_xpm), - _("1:1 zoom")); + m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString, BITMAP( zoom_optimal_xpm ), + _( "1:1 zoom" ) ); - // after adding the buttons to the toolbar, must call Realize() to reflect - // the changes - m_HToolBar->Realize(); + m_HToolBar->AddSeparator(); + 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 + m_HToolBar->Realize(); } @@ -143,145 +144,154 @@ 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); - oldpos = m_CurrentScreen->m_Curseur; + 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; + 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( g_KeyPressed) - { - switch( g_KeyPressed ) - { - case WXK_F1 : - OnZoom(ID_ZOOM_PLUS_KEY); - flagcurseur = 2; - curpos = m_CurrentScreen->m_Curseur; - break; - case WXK_F2 : - OnZoom(ID_ZOOM_MOINS_KEY); - flagcurseur = 2; - curpos = m_CurrentScreen->m_Curseur; - break; - case WXK_F3 : - OnZoom(ID_ZOOM_REDRAW_KEY); - flagcurseur = 2; - break; - case WXK_F4 : - OnZoom(ID_ZOOM_CENTER_KEY); - flagcurseur = 2; - curpos = m_CurrentScreen->m_Curseur; - break; + if( g_KeyPressed ) + { + switch( g_KeyPressed ) + { + case WXK_F1: + OnZoom( ID_ZOOM_PLUS_KEY ); + flagcurseur = 2; + curpos = m_CurrentScreen->m_Curseur; + break; - case ' ': - m_CurrentScreen->m_O_Curseur = m_CurrentScreen->m_Curseur; - break; + case WXK_F2: + OnZoom( ID_ZOOM_MOINS_KEY ); + flagcurseur = 2; + curpos = m_CurrentScreen->m_Curseur; + 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_F3: + OnZoom( ID_ZOOM_REDRAW_KEY ); + flagcurseur = 2; + 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 ; + case WXK_F4: + OnZoom( ID_ZOOM_CENTER_KEY ); + flagcurseur = 2; + curpos = m_CurrentScreen->m_Curseur; + 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_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 ' ': + m_CurrentScreen->m_O_Curseur = m_CurrentScreen->m_Curseur; + break; - /* Recalcul de la position du curseur schema */ - m_CurrentScreen->m_Curseur = curpos; - /* Placement sur la grille generale */ - PutOnGrid( & m_CurrentScreen->m_Curseur); + 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; - if( m_CurrentScreen->IsRefreshReq() ) - { - flagcurseur = 2; - RedrawActiveWindow(DC, TRUE); - } + 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; - if ( (oldpos.x != m_CurrentScreen->m_Curseur.x) || - (oldpos.y != m_CurrentScreen->m_Curseur.y) ) - { - if ( flagcurseur != 2 ) - { - curpos = m_CurrentScreen->m_Curseur; - m_CurrentScreen->m_Curseur = oldpos; - DrawPanel->CursorOff(DC); + 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; - m_CurrentScreen->m_Curseur = curpos; - DrawPanel->CursorOn(DC); - } + 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; + } + } - if(DrawPanel->ManageCurseur) - { - DrawPanel->ManageCurseur(DrawPanel, DC, 0); - } - } + /* Recalcul de la position du curseur schema */ + m_CurrentScreen->m_Curseur = curpos; + /* Placement sur la grille generale */ + PutOnGrid( &m_CurrentScreen->m_Curseur ); - Affiche_Status_Box(); /* Affichage des coord curseur */ + if( m_CurrentScreen->IsRefreshReq() ) + { + flagcurseur = 2; + RedrawActiveWindow( DC, TRUE ); + } + + if( (oldpos.x != m_CurrentScreen->m_Curseur.x) + || (oldpos.y != m_CurrentScreen->m_Curseur.y) ) + { + if( flagcurseur != 2 ) + { + curpos = m_CurrentScreen->m_Curseur; + m_CurrentScreen->m_Curseur = oldpos; + DrawPanel->CursorOff( DC ); + + m_CurrentScreen->m_Curseur = curpos; + DrawPanel->CursorOn( DC ); + } + + if( DrawPanel->ManageCurseur ) + { + 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(); - DrawPanel->PrepareGraphicContext(&dc); + wxClientDC dc( DrawPanel ); - switch ( id ) - { - default: - wxMessageBox( wxT("WinEDA_DisplayFrame::Process_Special_Functions error")); - break; - } + DrawPanel->PrepareGraphicContext( &dc ); - SetToolbars(); + switch( id ) + { + default: + wxMessageBox( wxT( "WinEDA_DisplayFrame::Process_Special_Functions error" ) ); + break; + } + + SetToolbars(); } - diff --git a/cvpcb/protos.h b/cvpcb/protos.h index 24c0952cb1..e5c7330963 100644 --- a/cvpcb/protos.h +++ b/cvpcb/protos.h @@ -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 */ /**************/ diff --git a/cvpcb/setvisu.cpp b/cvpcb/setvisu.cpp index 93b7f88ea1..78b2c123e5 100644 --- a/cvpcb/setvisu.cpp +++ b/cvpcb/setvisu.cpp @@ -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(); + FootprintName = m_FootprintList->GetSelectedFootprint(); - if ( DrawFrame == NULL) - { - DrawFrame = new WinEDA_DisplayFrame(this, m_Parent, _("Module"), - wxPoint(0,0) , wxSize(600,400) ); - IsNew = TRUE; - } - else DrawFrame->Maximize(FALSE); + if( DrawFrame == NULL ) + { + DrawFrame = new WinEDA_DisplayFrame( this, m_Parent, _( "Module" ), + wxPoint( 0, 0 ), wxSize( 600, 400 ) ); - DrawFrame->SetFocus(); /* Active entree clavier */ - DrawFrame->Show(TRUE); + IsNew = TRUE; + } + else + DrawFrame->Maximize( FALSE ); - 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 ) - { - DeleteStructure( DrawFrame->m_Pcb->m_Modules ); - 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_Draw3DFrame->NewDisplay(); - } + DrawFrame->SetFocus(); /* Active entree clavier */ + DrawFrame->Show( TRUE ); - else if ( !IsNew ) - { - DrawFrame->ReDrawPanel(); - if ( DrawFrame->m_Draw3DFrame ) - DrawFrame->m_Draw3DFrame->NewDisplay(); - } + 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 ) + { + // 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_Draw3DFrame->NewDisplay(); + } + else if( !IsNew ) + { + DrawFrame->ReDrawPanel(); + if( DrawFrame->m_Draw3DFrame ) + DrawFrame->m_Draw3DFrame->NewDisplay(); + } } - - diff --git a/cvpcb/visumod.cpp b/cvpcb/visumod.cpp index aaebba73e2..cf6cde017d 100644 --- a/cvpcb/visumod.cpp +++ b/cvpcb/visumod.cpp @@ -1,6 +1,6 @@ - /************************************************/ - /* 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; - -MODULE * Module= m_Pcb->m_Modules; + if( !m_Pcb ) + return; - ActiveScreen = (PCB_SCREEN *) GetScreen(); + MODULE* Module = m_Pcb->m_Modules; - if ( EraseBg ) DrawPanel->EraseScreen(DC); + ActiveScreen = (PCB_SCREEN*) GetScreen(); - DrawPanel->DrawBackGround(DC); + if( EraseBg ) + DrawPanel->EraseScreen( DC ); - if( Module ) - { - Module->Draw(DrawPanel, DC, wxPoint(0,0), GR_COPY); - Module->Display_Infos(this); - } + DrawPanel->DrawBackGround( DC ); - Affiche_Status_Box(); - DrawPanel->Trace_Curseur(DC); + if( Module ) + { + Module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_COPY ); + Module->Display_Infos( this ); + } + + Affiche_Status_Box(); + 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; - } -} - - diff --git a/eeschema/dialog_set_status.cpp b/eeschema/dialog_set_status.cpp.notused similarity index 100% rename from eeschema/dialog_set_status.cpp rename to eeschema/dialog_set_status.cpp.notused diff --git a/eeschema/dialog_set_status.h b/eeschema/dialog_set_status.h.notused similarity index 100% rename from eeschema/dialog_set_status.h rename to eeschema/dialog_set_status.h.notused diff --git a/eeschema/optionsframe.cpp b/eeschema/optionsframe.cpp.notused similarity index 100% rename from eeschema/optionsframe.cpp rename to eeschema/optionsframe.cpp.notused diff --git a/eeschema/optionsframe.h b/eeschema/optionsframe.h.notused similarity index 100% rename from eeschema/optionsframe.h rename to eeschema/optionsframe.h.notused diff --git a/gerbview/block.cpp b/gerbview/block.cpp index 80ef619a20..3fbe0d4171 100644 --- a/gerbview/block.cpp +++ b/gerbview/block.cpp @@ -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(); } } diff --git a/gerbview/initpcb.cpp b/gerbview/initpcb.cpp index fc2325ff43..91ea0e3f0e 100644 --- a/gerbview/initpcb.cpp +++ b/gerbview/initpcb.cpp @@ -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(); diff --git a/gerbview/makefile.include b/gerbview/makefile.include index 042a01ed23..add307ddaa 100644 --- a/gerbview/makefile.include +++ b/gerbview/makefile.include @@ -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) diff --git a/gerbview/pcbtexte.cpp b/gerbview/pcbtexte.cpp index fb80ca4c5c..b1051542ff 100644 --- a/gerbview/pcbtexte.cpp +++ b/gerbview/pcbtexte.cpp @@ -1,6 +1,6 @@ - /****************************************/ - /* traitement des textes sur empreintes */ - /****************************************/ +/****************************************/ +/* traitement des textes sur empreintes */ +/****************************************/ #include "fctsys.h" @@ -14,386 +14,414 @@ /* 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; -static int LocalDimH; -static int LocalDimV; -static int LocalWidth; +static int LocalOrient; +static int LocalDimH; +static int LocalDimV; +static int LocalWidth; -static wxPoint old_pos; // position originelle du texte selecte +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 ) - { - 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) ; - } + if( TextePcb ) + { + 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 ); + } - frame->CurrentScreen->ManageCurseur = NULL; - frame->CurrentScreen->ForceCloseManageCurseur = NULL; - frame->CurrentScreen->m_CurrentPcbItem = NULL; + frame->CurrentScreen->ManageCurseur = NULL; + frame->CurrentScreen->ForceCloseManageCurseur = NULL; + 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) ; - TextePcb->m_Layer = CurrentScreen->m_Active_Layer; - Trace_1_texte_pcb(DrawPanel, DC, TextePcb,0, 0, GR_OR) ; - CurrentScreen->ManageCurseur = NULL; - CurrentScreen->ForceCloseManageCurseur = NULL; - CurrentScreen->m_CurrentPcbItem = NULL; - CurrentScreen->SetModify(); + 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 ); + 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); - CurrentScreen->ManageCurseur = Move_Texte_Pcb; - CurrentScreen->ForceCloseManageCurseur = Exit_Texte_Pcb; - CurrentScreen->m_CurrentPcbItem = TextePcb; + old_pos = TextePcb->m_Pos; + 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 *) - panel->m_Parent->CurrentScreen->m_CurrentPcbItem; + 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) ; + /* effacement du texte : */ - TextePcb->m_Pos = panel->m_Parent->CurrentScreen->m_Curseur; - TextePcb->m_Layer = panel->m_Parent->CurrentScreen->m_Active_Layer; + if( flag == CURSEUR_MOVED ) + Trace_1_texte_pcb( panel, DC, TextePcb, 0, 0, GR_XOR ); - /* Redessin du Texte */ - 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; - - /********************************/ - /* void Delete_Texte_Pcb(COMMAND * Cmd) */ - /********************************/ - -void WinEDA_PcbFrame::Delete_Texte_Pcb(TEXTE_PCB * TextePcb, wxDC * DC) -{ - - if( TextePcb == NULL ) return; - - Trace_1_texte_pcb(DrawPanel, DC, TextePcb,0, 0, GR_XOR); - - /* Suppression du texte en Memoire*/ - DeleteStructure(TextePcb); - CurrentScreen->ManageCurseur = NULL; - CurrentScreen->ForceCloseManageCurseur = NULL; - CurrentScreen->m_CurrentPcbItem = NULL; + /* Redessin du Texte */ + Trace_1_texte_pcb( panel, DC, TextePcb, 0, 0, GR_XOR ); } - /****************************/ - /* void Add_Texte_Pcb(COMMAND * Cmd) */ - /****************************/ +/********************************/ +/* void Delete_Texte_Pcb(COMMAND * Cmd) */ +/********************************/ -TEXTE_PCB * WinEDA_PcbFrame::Create_Texte_Pcb( wxDC * DC) +void WinEDA_PcbFrame::Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) { -char buf_new_texte[256]; -TEXTE_PCB * TextePcb; + if( TextePcb == NULL ) + return; - buf_new_texte[0]= 0 ; - Get_Message("Texte:",buf_new_texte, this); - if(*buf_new_texte <=' ') return NULL; + Trace_1_texte_pcb( DrawPanel, DC, TextePcb, 0, 0, GR_XOR ); - CurrentScreen->SetModify(); - /* placement du texte en memoire */ - 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; - 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; - - 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); - - /* Dessin du Texte */ - Trace_1_texte_pcb(DrawPanel, DC, TextePcb,0, 0, GR_XOR) ; - Affiche_Infos_PCB_Texte(this, TextePcb); - - StartMoveTextePcb(TextePcb, DC); - - return TextePcb; + /* Suppression du texte en Memoire*/ + TextePcb->DeleteStructure(); + CurrentScreen->ManageCurseur = NULL; + CurrentScreen->ForceCloseManageCurseur = NULL; + CurrentScreen->m_CurrentPcbItem = NULL; } - /*******************************/ - /* void Rotate_Texte_Pcb(COMMAND * Cmd) */ - /*******************************/ -void WinEDA_PcbFrame::Rotate_Texte_Pcb(TEXTE_PCB * TextePcb, wxDC * DC) +/****************************/ +/* void Add_Texte_Pcb(COMMAND * Cmd) */ +/****************************/ + +TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC ) { -int angle = 900; -int drawmode = GR_XOR; + char buf_new_texte[256]; + TEXTE_PCB* TextePcb; - if( TextePcb == NULL ) return; + buf_new_texte[0] = 0; + Get_Message( "Texte:", buf_new_texte, this ); + if( *buf_new_texte <=' ' ) + return NULL; - /* effacement du texte : */ - Trace_1_texte_pcb(DrawPanel, DC, TextePcb,0, 0, GR_XOR) ; + CurrentScreen->SetModify(); + /* placement du texte en memoire */ + 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; + pt_pcb->m_Drawings = (EDA_BaseStruct*) TextePcb; - TextePcb->m_Orient += angle; - if(TextePcb->m_Orient >= 3600) TextePcb->m_Orient -= 3600 ; - if(TextePcb->m_Orient < 0) TextePcb->m_Orient += 3600 ; + /* 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; - /* Redessin du Texte */ - Trace_1_texte_pcb(DrawPanel, DC, TextePcb, 0, 0, drawmode); - Affiche_Infos_PCB_Texte(this, TextePcb); + 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; - CurrentScreen->SetModify(); + /* Copie du 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 ); + + StartMoveTextePcb( TextePcb, DC ); + + return TextePcb; } - /***************************************************************/ - /* void Trace_1_texte(char * ptr,int ox,int oy),int mode_color */ - /***************************************************************/ + +/*******************************/ +/* void Rotate_Texte_Pcb(COMMAND * Cmd) */ +/*******************************/ + +void WinEDA_PcbFrame::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) +{ + int angle = 900; + int drawmode = GR_XOR; + + if( TextePcb == NULL ) + return; + + /* effacement du texte : */ + 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; + + /* Redessin du Texte */ + 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 */ +/***************************************************************/ /* - 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.. -*/ + * 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) +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; + 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; + 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 ; - orient = pt_texte->m_Orient; - width = pt_texte->m_Width; - screen_epais = width / zoom; + /* lecture des caracteristiques du texte */ + 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; - if( (DisplayOpt.DisplayDrawItems == FILAIRE) || ( screen_epais < L_MIN_DESSIN) ) - width = 0; + if( (DisplayOpt.DisplayDrawItems == FILAIRE) || ( screen_epais < L_MIN_DESSIN) ) + width = 0; - /* calcul de la position du texte */ - cX = pt_texte->m_Pos.x - ox; - cY = pt_texte->m_Pos.y - oy; + /* calcul de la position du texte */ + 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]; + /* choix de la couleur du texte : */ + gcolor = color_layer[pt_texte->m_Layer]; - ptr = pt_texte->GetText(); /* ptr pointe 1er caractere du texte */ + ptr = pt_texte->GetText(); /* ptr pointe 1er caractere du texte */ - GRSetDrawMode(DC, DrawMode); - /* trace ancre du texte */ - 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); - } + GRSetDrawMode( DC, DrawMode ); + /* trace ancre du texte */ + 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 ); + } - /* trace du texte */ - Display_1_Texte(panel, DC, ptr, strlen(ptr), cX, cY, - size_h, size_v, width, orient, gcolor); + /* trace du texte */ + 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 ) - { - if( TextePcb->Layer == CurrentScreen->Active_Layer ) break; - // le Texte n'est pas sur la couche active - TextePcb = (TEXTE_PCB*) TextePcb->Pnext; - } - } + if( TextePcb == NULL ) + { + TextePcb = (TEXTE_PCB*) pt_pcb->Drawings; + while( ( TextePcb = Locate_Texte_Pcb( TextePcb, CURSEUR_OFF_GRILLE ) ) != 0 ) + { + if( TextePcb->Layer == CurrentScreen->Active_Layer ) + break; - TextePcbEdite = TextePcb; + // le Texte n'est pas sur la couche active + TextePcb = (TEXTE_PCB*) TextePcb->Pnext; + } + } - if( TextePcb == NULL ) - { - DisplayError("Texte non trouve sur cette couche",10); - Cmd->Menu->State = WAIT; DisplayMenu(DC, Cmd->Menu, NULL, ON); - return; - } + TextePcbEdite = TextePcb; - Affiche_Infos_PCB_Texte(Cmd, TextePcb); + if( TextePcb == NULL ) + { + DisplayError( "Texte non trouve sur cette couche", 10 ); + Cmd->Menu->State = WAIT; DisplayMenu( DC, Cmd->Menu, NULL, ON ); + return; + } - if(TextePcb->orient >= 3600) TextePcb->orient -= 3600 ; - if(TextePcb->orient < 0) TextePcb->orient += 3600 ; + Affiche_Infos_PCB_Texte( Cmd, TextePcb ); - /* 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; + if( TextePcb->orient >= 3600 ) + TextePcb->orient -= 3600; + if( TextePcb->orient < 0 ) + TextePcb->orient += 3600; - * (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; + /* 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; - InstallNewList(Cmd); + *(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) ; + /* effacement du texte : */ + Trace_1_texte_pcb( DrawPanel, DC, TextePcb, 0, 0, GR_XOR ); - if( strcmp( TextePcb->GetText(), buf_new_texte) && strlen(buf_new_texte) ) - { - TextePcb->SetText(buf_new_texte); - CurrentScreen->SetModify(); - } + if( strcmp( TextePcb->GetText(), buf_new_texte ) && strlen( 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; - if( CurrentScreen->m_Active_Layer != TextePcb->m_Layer ) - { - TextePcb->m_Layer = CurrentScreen->m_Active_Layer; - CurrentScreen->SetModify(); - } + while( LocalOrient < 0 ) + LocalOrient += 3600; - if( LocalOrient != TextePcb->m_Orient ) - { - TextePcb->m_Orient = LocalOrient; - CurrentScreen->SetModify(); - } + if( CurrentScreen->m_Active_Layer != TextePcb->m_Layer ) + { + TextePcb->m_Layer = CurrentScreen->m_Active_Layer; + CurrentScreen->SetModify(); + } - if( LocalDimV != TextePcb->m_Size.y ) - { - TextePcb->m_Size.y = LocalDimV; - CurrentScreen->SetModify(); - } - - if( LocalDimH != TextePcb->m_Size.x ) - { - TextePcb->m_Size.x = LocalDimH; - CurrentScreen->SetModify(); - } + if( LocalOrient != TextePcb->m_Orient ) + { + TextePcb->m_Orient = LocalOrient; + CurrentScreen->SetModify(); + } - if( LocalWidth != TextePcb->m_Width ) - { - TextePcb->m_Width = LocalWidth; - CurrentScreen->SetModify(); - } + if( LocalDimV != TextePcb->m_Size.y ) + { + TextePcb->m_Size.y = LocalDimV; + CurrentScreen->SetModify(); + } + + if( LocalDimH != TextePcb->m_Size.x ) + { + TextePcb->m_Size.x = LocalDimH; + CurrentScreen->SetModify(); + } + + if( LocalWidth != TextePcb->m_Width ) + { + TextePcb->m_Width = LocalWidth; + CurrentScreen->SetModify(); + } /* if( (Texte_Pcb_Miroir_Item.State == WAIT) && (TextePcb->miroir == 0) ) - { - TextePcb->miroir = 1; - CurrentScreen->SetModify(); - } + * { + * TextePcb->miroir = 1; + * CurrentScreen->SetModify(); + * } + * + * if( (Texte_Pcb_Miroir_Item.State == RUN) && TextePcb->miroir ) + * { + * TextePcb->miroir = 0; + * 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 ); - /* Redessin du Texte */ - Trace_1_texte_pcb(DrawPanel, DC, TextePcb, 0, 0, drawmode); - - Affiche_Infos_PCB_Texte(this, TextePcb); + Affiche_Infos_PCB_Texte( this, TextePcb ); } - diff --git a/gerbview/protos.h b/gerbview/protos.h index 9205bd15ef..aa8bdf2366 100644 --- a/gerbview/protos.h +++ b/gerbview/protos.h @@ -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 */ /*************/ diff --git a/gerbview/struct.cpp b/gerbview/struct.cpp.notused similarity index 99% rename from gerbview/struct.cpp rename to gerbview/struct.cpp.notused index 382460f7e9..e022c34a60 100644 --- a/gerbview/struct.cpp +++ b/gerbview/struct.cpp.notused @@ -10,6 +10,8 @@ /* Variables locales */ +#if 0 + /***************************************************/ void DeleteStructure( EDA_BaseStruct * PtStruct ) /***************************************************/ @@ -91,3 +93,5 @@ EDA_BaseStruct *PtNext; } } + +#endif diff --git a/gerbview/undelete.cpp b/gerbview/undelete.cpp index debfd8b851..dc5b36e9f4 100644 --- a/gerbview/undelete.cpp +++ b/gerbview/undelete.cpp @@ -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]; diff --git a/include/base_struct.h b/include/base_struct.h index 38b9719ca0..353d758af3 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -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; } /** @@ -443,6 +453,24 @@ public: return false; // only MODULEs can be locked at this time. } + + /** + * 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 diff --git a/pcbnew/block.cpp b/pcbnew/block.cpp index 33f0c54d18..ae922ddfc2 100644 --- a/pcbnew/block.cpp +++ b/pcbnew/block.cpp @@ -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(); } } } diff --git a/pcbnew/block_module_editor.cpp b/pcbnew/block_module_editor.cpp index 68bad2cb34..d3527df3ed 100644 --- a/pcbnew/block_module_editor.cpp +++ b/pcbnew/block_module_editor.cpp @@ -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(); } } diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index bfe911ed8a..059c37d737 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -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; } diff --git a/pcbnew/class_board_item.cpp b/pcbnew/class_board_item.cpp index d32663d8a5..21d9bd8958 100644 --- a/pcbnew/class_board_item.cpp +++ b/pcbnew/class_board_item.cpp @@ -279,3 +279,4 @@ const char** BOARD_ITEM::MenuIcon() const return (const char**) xpm; } + diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp index c12ffc9ac0..3b70357c0c 100644 --- a/pcbnew/clean.cpp +++ b/pcbnew/clean.cpp @@ -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(); } } diff --git a/pcbnew/copy_track.cpp b/pcbnew/copy_track.cpp index 98cc06ad7e..4847c7f1f6 100644 --- a/pcbnew/copy_track.cpp +++ b/pcbnew/copy_track.cpp @@ -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 ); } diff --git a/pcbnew/cotation.cpp b/pcbnew/cotation.cpp index 9a022e64cf..7a703e3e81 100644 --- a/pcbnew/cotation.cpp +++ b/pcbnew/cotation.cpp @@ -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(); } diff --git a/pcbnew/dialog_drc.cpp b/pcbnew/dialog_drc.cpp index 4e318054f1..aa9d982e5c 100644 --- a/pcbnew/dialog_drc.cpp +++ b/pcbnew/dialog_drc.cpp @@ -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(this)->wxDialog::ProcessEvent( event ); +// printf("~ProcessEvent\n"); + return ret; + } +} + diff --git a/pcbnew/dialog_drc.h b/pcbnew/dialog_drc.h index e59b5e0054..edd69716b7 100644 --- a/pcbnew/dialog_drc.h +++ b/pcbnew/dialog_drc.h @@ -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 diff --git a/pcbnew/dialog_drc.pjd b/pcbnew/dialog_drc.pjd index 17aec72d92..748e445380 100644 --- a/pcbnew/dialog_drc.pjd +++ b/pcbnew/dialog_drc.pjd @@ -10,8 +10,10 @@ 0 0 0 + 1 1 1 + 1 0 "jean-pierre Charras" "License GNU" @@ -213,6 +215,7 @@ 0 "" 0 + 0 "wxEVT_CLOSE_WINDOW|OnCloseWindow|NONE||" "ID_DIALOG" 10000 @@ -234,9 +237,16 @@ 0 1 "<Any platform>" + "" + "" + "" + "" + "" + "" + "Tiled" 0 1 - 0 + 1 0 1 0 @@ -267,7 +277,7 @@ 400 300 0 - "" + "m_logWindow" "wxBoxSizer V" "dialog-control-document" @@ -356,6 +366,7 @@ "wbStaticTextProxy" "wxID_STATIC" 5105 + "" "wxStaticText" "wxStaticText" 1 @@ -375,6 +386,11 @@ "<Any platform>" "" "" + "" + "" + "" + "" + "" 0 0 0 @@ -420,6 +436,7 @@ "wbTextCtrlProxy" "ID_TEXTCTRL1" 10002 + "" "wxTextCtrl" "wxTextCtrl" 1 @@ -439,6 +456,11 @@ "<Any platform>" "" "" + "" + "" + "" + "" + "" 0 0 0 @@ -454,6 +476,7 @@ 0 0 0 + 0 0 0 0 @@ -555,6 +578,7 @@ "wbCheckBoxProxy" "ID_CHECKBOX_PAD2PAD" 10009 + "" "wxCheckBox" "wxCheckBox" 1 @@ -568,6 +592,11 @@ "" "s_Pad2PadTestOpt" "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + "" + "" "" "" "" @@ -613,6 +642,7 @@ "wbCheckBoxProxy" "ID_CHECKBOX" 10008 + "" "wxCheckBox" "wxCheckBox" 1 @@ -626,6 +656,11 @@ "" "s_UnconnectedTestOpt" "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + "" + "" "" "" "" @@ -671,6 +706,7 @@ "wbCheckBoxProxy" "ID_CHECKBOX_TEST_ZONES" 10007 + "" "wxCheckBox" "wxCheckBox" 1 @@ -684,6 +720,11 @@ "" "s_ZonesTestOpt" "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + "" + "" "" "" "" @@ -729,6 +770,7 @@ "wbCheckBoxProxy" "ID_CHECKBOX_CREATE_FILE" 10012 + "" "wxCheckBox" "wxCheckBox" 1 @@ -742,6 +784,11 @@ "" "s_CreateRptFileOpt" "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + "" + "" "" "" "" @@ -865,6 +912,7 @@ "wxEVT_COMMAND_BUTTON_CLICKED|OnDrcRunClick" "ID_DRC_RUN" 10003 + "" "wxButton" "wxButton" 1 @@ -876,6 +924,13 @@ 0 "" "" + "" + "" + "" + "" + "" + "" + "" "" "CA0000" "" @@ -924,6 +979,7 @@ "wxEVT_COMMAND_BUTTON_CLICKED|OnStopControlDrcClick" "ID_STOP_CONTROL_DRC" 10004 + "" "wxButton" "wxButton" 1 @@ -935,6 +991,13 @@ 0 "" "" + "" + "" + "" + "" + "" + "" + "" "" "008080" "" @@ -1009,6 +1072,7 @@ "wxEVT_COMMAND_BUTTON_CLICKED|OnEraseDrcMarkersClick" "ID_ERASE_DRC_MARKERS" 10005 + "" "wxButton" "wxButton" 1 @@ -1020,6 +1084,13 @@ 0 "" "" + "" + "" + "" + "" + "" + "" + "" "" "008000" "" @@ -1068,6 +1139,7 @@ "wxEVT_COMMAND_BUTTON_CLICKED|OnListUnconnectedPadsClick" "ID_LIST_UNCONNECTED_PADS" 10006 + "" "wxButton" "wxButton" 1 @@ -1079,6 +1151,13 @@ 0 "" "" + "" + "" + "" + "" + "" + "" + "" "" "0000FF" "" @@ -1129,6 +1208,7 @@ "wxEVT_COMMAND_BUTTON_CLICKED|OnCloseClick" "wxID_CLOSE" 5001 + "" "wxButton" "wxButton" 1 @@ -1140,6 +1220,13 @@ 0 "" "" + "" + "" + "" + "" + "" + "" + "" "" "" "" @@ -1222,6 +1309,7 @@ "wxEVT_COMMAND_BUTTON_CLICKED|OnButtonBrowseRptFileClick|NONE||" "ID_BUTTON_BROWSE_RPT_FILE" 10011 + "" "wxButton" "wxButton" 1 @@ -1233,6 +1321,13 @@ 0 "" "" + "" + "" + "" + "" + "" + "" + "" "" "008080" "" @@ -1280,6 +1375,7 @@ "wbTextCtrlProxy" "ID_TEXTCTRL_GET_RPT_FILENAME" 10010 + "" "wxTextCtrl" "wxTextCtrl" 1 @@ -1299,6 +1395,11 @@ "<Any platform>" "" "" + "" + "" + "" + "" + "" 0 0 0 @@ -1314,6 +1415,7 @@ 0 0 0 + 0 0 0 0 @@ -1358,6 +1460,7 @@ "wbStaticTextProxy" "wxID_STATIC" 5105 + "" "wxStaticText" "wxStaticText" 1 @@ -1377,6 +1480,11 @@ "<Any platform>" "" "" + "" + "" + "" + "" + "" 0 0 0 @@ -1422,6 +1530,7 @@ "wbTextCtrlProxy" "ID_TEXTCTRL" 10001 + "" "wxTextCtrl" "wxTextCtrl" 1 @@ -1441,6 +1550,11 @@ "<Any platform>" "" "" + "" + "" + "" + "" + "" 1 0 0 @@ -1453,9 +1567,10 @@ 0 0 0 - 0 + 1 0 0 + 0 0 0 0 @@ -1464,12 +1579,12 @@ 0 0 0 - 0 + 1 "" -1 -1 -1 - 200 + 300 "Expand" "Expand" 0 diff --git a/pcbnew/edgemod.cpp b/pcbnew/edgemod.cpp index c8ed202aff..fbd9d3e682 100644 --- a/pcbnew/edgemod.cpp +++ b/pcbnew/edgemod.cpp @@ -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; diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index 16009225b0..53d214d00b 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -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 { diff --git a/pcbnew/edtxtmod.cpp b/pcbnew/edtxtmod.cpp index 0f06b49a93..3a40a3cd00 100644 --- a/pcbnew/edtxtmod.cpp +++ b/pcbnew/edtxtmod.cpp @@ -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 ); } diff --git a/pcbnew/initpcb.cpp b/pcbnew/initpcb.cpp index 2f695759ee..02d721fbbe 100644 --- a/pcbnew/initpcb.cpp +++ b/pcbnew/initpcb.cpp @@ -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: @@ -280,8 +281,8 @@ void WinEDA_PcbFrame::Erase_Pistes( wxDC* DC, int masque_type, bool query ) * Si un des bits est a 1, il n'y a pas effacement du segment de meme bit a 1 */ { - TRACK* pt_segm; - EDA_BaseStruct* PtNext; + TRACK* pt_segm; + 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(); diff --git a/pcbnew/makefile.include b/pcbnew/makefile.include index 026ff6a796..176e1965a8 100644 --- a/pcbnew/makefile.include +++ b/pcbnew/makefile.include @@ -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) diff --git a/pcbnew/mirepcb.cpp b/pcbnew/mirepcb.cpp index 01c6166270..658622dd35 100644 --- a/pcbnew/mirepcb.cpp +++ b/pcbnew/mirepcb.cpp @@ -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 */ diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index 994aa8a4a5..6a2813546c 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -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(); diff --git a/pcbnew/move-drag_pads.cpp b/pcbnew/move-drag_pads.cpp index f880c3f3d6..ceeea0f577 100644 --- a/pcbnew/move-drag_pads.cpp +++ b/pcbnew/move-drag_pads.cpp @@ -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); diff --git a/pcbnew/move_copy_track.cpp b/pcbnew/move_copy_track.cpp index 6a9ada0837..e3a0eb9b45 100644 --- a/pcbnew/move_copy_track.cpp +++ b/pcbnew/move_copy_track.cpp @@ -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 ); diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp index 229c07cebe..96df042c3a 100644 --- a/pcbnew/muonde.cpp +++ b/pcbnew/muonde.cpp @@ -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 { diff --git a/pcbnew/pcbtexte.cpp b/pcbnew/pcbtexte.cpp index b859293cfc..23e0a47e47 100644 --- a/pcbnew/pcbtexte.cpp +++ b/pcbnew/pcbtexte.cpp @@ -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 diff --git a/pcbnew/protos.h b/pcbnew/protos.h index bfd62328a3..0bc6c811d4 100644 --- a/pcbnew/protos.h +++ b/pcbnew/protos.h @@ -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 */ diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp index 6fab12f784..c3199f1b5b 100644 --- a/pcbnew/ratsnest.cpp +++ b/pcbnew/ratsnest.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; } diff --git a/pcbnew/struct.cpp b/pcbnew/struct.cpp deleted file mode 100644 index 6f06c10a55..0000000000 --- a/pcbnew/struct.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/***********************************************/ -/* 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; - } -} diff --git a/pcbnew/struct.cpp.notused b/pcbnew/struct.cpp.notused new file mode 100644 index 0000000000..573cf4b3b8 --- /dev/null +++ b/pcbnew/struct.cpp.notused @@ -0,0 +1,58 @@ +/***********************************************/ +/* 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 diff --git a/pcbnew/tr_modif.cpp b/pcbnew/tr_modif.cpp index 82e69fd9c4..c604fae91b 100644 --- a/pcbnew/tr_modif.cpp +++ b/pcbnew/tr_modif.cpp @@ -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) diff --git a/pcbnew/undelete.cpp b/pcbnew/undelete.cpp index 71dad628ba..fa2fd36764 100644 --- a/pcbnew/undelete.cpp +++ b/pcbnew/undelete.cpp @@ -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]; diff --git a/pcbnew/win_eda_cleaningoptionsframe.cpp b/pcbnew/win_eda_cleaningoptionsframe.cpp.notused similarity index 100% rename from pcbnew/win_eda_cleaningoptionsframe.cpp rename to pcbnew/win_eda_cleaningoptionsframe.cpp.notused diff --git a/pcbnew/win_eda_cleaningoptionsframe.h b/pcbnew/win_eda_cleaningoptionsframe.h.notused similarity index 100% rename from pcbnew/win_eda_cleaningoptionsframe.h rename to pcbnew/win_eda_cleaningoptionsframe.h.notused diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp index 67b8687101..7b26870e56 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/xchgmod.cpp @@ -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; diff --git a/pcbnew/zones.cpp b/pcbnew/zones.cpp index 1541270d20..5bc27fe052 100644 --- a/pcbnew/zones.cpp +++ b/pcbnew/zones.cpp @@ -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(); } }