2007-08-20 01:20:48 +00:00
|
|
|
/*********************************************/
|
|
|
|
/* Edition des pistes: Routines d'effacement */
|
|
|
|
/* Effacement de segment, piste, net et zone */
|
|
|
|
/*********************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "gerbview.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
/* Routines externes : */
|
|
|
|
|
|
|
|
/* Routines Locales */
|
|
|
|
|
|
|
|
/* Variables locales */
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
void WinEDA_GerberFrame::Delete_DCode_Items( wxDC* DC, int dcode_value, int layer_number )
|
2007-05-28 18:09:49 +00:00
|
|
|
/****************************************************************************************/
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
if( dcode_value < FIRST_DCODE ) // No tool selected
|
|
|
|
return;
|
2009-01-05 05:21:35 +00:00
|
|
|
|
|
|
|
TRACK* next;
|
|
|
|
for( TRACK* track = GetBoard()->m_Track; track; track = next )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
next = track->Next();
|
|
|
|
|
2007-10-13 06:18:44 +00:00
|
|
|
if( dcode_value != track->GetNet() )
|
2007-08-20 01:20:48 +00:00
|
|
|
continue;
|
2009-01-05 05:21:35 +00:00
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
if( layer_number >= 0 && layer_number != track->GetLayer() )
|
2007-08-20 01:20:48 +00:00
|
|
|
continue;
|
2009-01-05 05:21:35 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
Delete_Segment( DC, track );
|
|
|
|
}
|
|
|
|
|
|
|
|
GetScreen()->SetCurItem( NULL );
|
2007-05-28 18:09:49 +00:00
|
|
|
}
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/*****************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
TRACK* WinEDA_GerberFrame::Delete_Segment( wxDC* DC, TRACK* Track )
|
2007-06-05 12:10:51 +00:00
|
|
|
/*****************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Supprime 1 segment de piste.
|
2007-08-20 01:20:48 +00:00
|
|
|
* 2 Cas possibles:
|
|
|
|
* Si On est en trace de nouvelle piste: Effacement du segment en
|
|
|
|
* cours de trace
|
|
|
|
* Sinon : Effacment du segment sous le curseur.
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
if( Track == NULL )
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if( Track->m_Flags & IS_NEW ) // Trace en cours, on peut effacer le dernier segment
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
if( g_CurrentTrackList.GetCount() > 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
// modification du trace
|
2008-12-04 04:28:11 +00:00
|
|
|
delete g_CurrentTrackList.PopBack();
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
if( g_CurrentTrackList.GetCount() && g_CurrentTrackSegment->Type() == TYPE_VIA )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
delete g_CurrentTrackList.PopBack();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
UpdateStatusBar();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
if( g_CurrentTrackList.GetCount() == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
DrawPanel->ManageCurseur = NULL;
|
|
|
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( DrawPanel->ManageCurseur )
|
|
|
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
|
|
|
return g_CurrentTrackSegment;
|
|
|
|
}
|
|
|
|
}
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
return NULL;
|
|
|
|
} // Fin traitement si trace en cours
|
|
|
|
|
|
|
|
|
|
|
|
Trace_Segment( DrawPanel, DC, Track, GR_XOR );
|
|
|
|
|
2009-07-29 13:10:36 +00:00
|
|
|
DLIST<TRACK>* container = (DLIST<TRACK>*) Track->GetList();
|
|
|
|
wxASSERT( container );
|
|
|
|
container->Remove( Track );
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
GetScreen()->SetModify();
|
|
|
|
return NULL;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|