kicad/gerbview/initpcb.cpp

88 lines
1.9 KiB
C++
Raw Normal View History

/****************************************/
/******* initpcb.cpp ********************/
/****************************************/
#include "fctsys.h"
#include "common.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "gerbview.h"
#include "protos.h"
bool WinEDA_GerberFrame::Clear_Pcb( bool query )
{
2007-08-23 04:28:46 +00:00
int layer;
if( GetBoard() == NULL )
2007-08-23 04:28:46 +00:00
return FALSE;
if( query && GetScreen()->IsModify() )
2007-08-23 04:28:46 +00:00
{
if( !IsOK( this, _( "Current data will be lost?" ) ) )
return FALSE;
2007-08-23 04:28:46 +00:00
}
GetBoard()->m_Drawings.DeleteAll();
2007-08-23 04:28:46 +00:00
GetBoard()->m_Track.DeleteAll();
2007-08-23 04:28:46 +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
}
GetBoard()->m_BoundaryBox.SetOrigin( 0, 0 );
GetBoard()->m_BoundaryBox.SetSize( 0, 0 );
GetBoard()->m_Status_Pcb = 0;
GetBoard()->m_NbNodes = 0;
GetBoard()->m_NbNoconnect = 0;
2007-08-23 04:28:46 +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-08-23 04:28:46 +00:00
void WinEDA_GerberFrame::Erase_Current_Layer( bool query )
{
2010-02-04 11:03:31 +00:00
int layer = getActiveLayer();
wxString msg;
2007-08-23 04:28:46 +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) */
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;
pt_segm->DeleteStructure();
2007-08-23 04:28:46 +00:00
}
2007-11-02 10:14:12 +00:00
/* Delete polygons */
SEGZONE* Nextzone;
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();
}
2007-08-23 04:28:46 +00:00
ScreenPcb->SetModify();
ScreenPcb->SetRefreshReq();
}