2009-11-09 14:00:22 +00:00
|
|
|
/****************************************/
|
|
|
|
/******* initpcb.cpp ********************/
|
|
|
|
/****************************************/
|
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"
|
|
|
|
#include "confirm.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"
|
|
|
|
|
|
|
|
|
2007-12-03 06:54:19 +00:00
|
|
|
bool WinEDA_GerberFrame::Clear_Pcb( bool query )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-23 04:28:46 +00:00
|
|
|
int layer;
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
if( GetBoard() == NULL )
|
2007-08-23 04:28:46 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2010-01-08 12:28:13 +00:00
|
|
|
if( query && GetScreen()->IsModify() )
|
2007-08-23 04:28:46 +00:00
|
|
|
{
|
2010-01-08 12:28:13 +00:00
|
|
|
if( !IsOK( this, _( "Current data will be lost?" ) ) )
|
|
|
|
return FALSE;
|
2007-08-23 04:28:46 +00:00
|
|
|
}
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
GetBoard()->m_Drawings.DeleteAll();
|
2007-08-23 04:28:46 +00:00
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
GetBoard()->m_Track.DeleteAll();
|
2007-08-23 04:28:46 +00:00
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
GetBoard()->m_Zone.DeleteAll();
|
2007-08-23 04:28:46 +00:00
|
|
|
|
|
|
|
for( layer = 0; layer < 32; layer++ )
|
|
|
|
{
|
2008-11-08 06:44:07 +00:00
|
|
|
if( g_GERBER_List[layer] )
|
|
|
|
g_GERBER_List[layer]->InitToolTable();
|
2007-08-23 04:28:46 +00:00
|
|
|
}
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
GetBoard()->m_BoundaryBox.SetOrigin( 0, 0 );
|
|
|
|
GetBoard()->m_BoundaryBox.SetSize( 0, 0 );
|
2009-11-09 14:00:22 +00:00
|
|
|
GetBoard()->m_Status_Pcb = 0;
|
2009-01-05 05:21:35 +00:00
|
|
|
GetBoard()->m_NbNodes = 0;
|
|
|
|
GetBoard()->m_NbNoconnect = 0;
|
2007-08-23 04:28:46 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
SetBaseScreen( ActiveScreen = ScreenPcb );
|
|
|
|
GetScreen()->Init();
|
2010-02-04 11:03:31 +00:00
|
|
|
setActiveLayer(LAYER_N_BACK);
|
2007-08-23 04:28:46 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
|
2007-12-03 06:54:19 +00:00
|
|
|
void WinEDA_GerberFrame::Erase_Current_Layer( bool query )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-02-04 11:03:31 +00:00
|
|
|
int layer = getActiveLayer();
|
2009-11-09 14:00:22 +00:00
|
|
|
wxString msg;
|
2007-08-23 04:28:46 +00:00
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
msg.Printf( _( "Delete layer %d?" ), layer + 1 );
|
2007-08-23 04:28:46 +00:00
|
|
|
if( query && !IsOK( this, msg ) )
|
|
|
|
return;
|
|
|
|
|
2007-11-02 10:14:12 +00:00
|
|
|
/* Delete tracks (spots and lines) */
|
2009-11-09 14:00:22 +00:00
|
|
|
TRACK* PtNext;
|
|
|
|
for( TRACK* pt_segm = GetBoard()->m_Track;
|
|
|
|
pt_segm != NULL;
|
|
|
|
pt_segm = (TRACK*) PtNext )
|
2007-08-23 04:28:46 +00:00
|
|
|
{
|
|
|
|
PtNext = pt_segm->Next();
|
|
|
|
if( pt_segm->GetLayer() != layer )
|
|
|
|
continue;
|
2007-10-03 15:21:13 +00:00
|
|
|
pt_segm->DeleteStructure();
|
2007-08-23 04:28:46 +00:00
|
|
|
}
|
|
|
|
|
2007-11-02 10:14:12 +00:00
|
|
|
/* Delete polygons */
|
2009-11-09 14:00:22 +00:00
|
|
|
SEGZONE* Nextzone;
|
2009-01-05 05:21:35 +00:00
|
|
|
for( SEGZONE* zone = GetBoard()->m_Zone; zone != NULL; zone = Nextzone )
|
2007-11-02 10:14:12 +00:00
|
|
|
{
|
|
|
|
Nextzone = zone->Next();
|
|
|
|
if( zone->GetLayer() != layer )
|
|
|
|
continue;
|
|
|
|
zone->DeleteStructure();
|
|
|
|
}
|
2009-11-09 14:00:22 +00:00
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
ScreenPcb->SetModify();
|
|
|
|
ScreenPcb->SetRefreshReq();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|