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"
|
2010-09-28 14:42:05 +00:00
|
|
|
#include "class_gerber_draw_item.h"
|
2010-10-06 17:28:07 +00:00
|
|
|
#include "class_GERBER.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
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
|
|
|
}
|
2010-10-17 16:42:06 +00:00
|
|
|
|
|
|
|
SetCurItem( NULL );
|
2009-01-05 05:21:35 +00:00
|
|
|
GetBoard()->m_Drawings.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] )
|
2010-10-06 17:28:07 +00:00
|
|
|
{
|
2008-11-08 06:44:07 +00:00
|
|
|
g_GERBER_List[layer]->InitToolTable();
|
2010-10-06 17:28:07 +00:00
|
|
|
g_GERBER_List[layer]->ResetDefaultValues();
|
|
|
|
}
|
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
|
|
|
|
2011-02-05 02:21:11 +00:00
|
|
|
SetScreen( ScreenPcb );
|
2008-04-17 16:25:29 +00:00
|
|
|
GetScreen()->Init();
|
2010-02-04 11:03:31 +00:00
|
|
|
setActiveLayer(LAYER_N_BACK);
|
2010-11-05 08:14:00 +00:00
|
|
|
syncLayerBox();
|
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
|
|
|
|
2010-11-01 18:33:44 +00:00
|
|
|
msg.Printf( _( "Clear layer %d?" ), layer + 1 );
|
2007-08-23 04:28:46 +00:00
|
|
|
if( query && !IsOK( this, msg ) )
|
|
|
|
return;
|
|
|
|
|
2010-10-10 17:57:54 +00:00
|
|
|
SetCurItem( NULL );
|
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
BOARD_ITEM* item = GetBoard()->m_Drawings;
|
|
|
|
BOARD_ITEM * next;
|
|
|
|
for( ; item; item = next )
|
2007-11-02 10:14:12 +00:00
|
|
|
{
|
2010-09-28 14:42:05 +00:00
|
|
|
next = item->Next();
|
|
|
|
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
|
2010-09-29 09:25:48 +00:00
|
|
|
if( gerb_item->GetLayer() != layer )
|
2007-11-02 10:14:12 +00:00
|
|
|
continue;
|
2010-09-28 14:42:05 +00:00
|
|
|
gerb_item->DeleteStructure();
|
2007-11-02 10:14:12 +00:00
|
|
|
}
|
2009-11-09 14:00:22 +00:00
|
|
|
|
2010-09-29 09:25:48 +00:00
|
|
|
if( g_GERBER_List[layer] )
|
2010-10-06 17:28:07 +00:00
|
|
|
{
|
2010-09-29 09:25:48 +00:00
|
|
|
g_GERBER_List[layer]->InitToolTable();
|
2010-10-06 17:28:07 +00:00
|
|
|
g_GERBER_List[layer]->ResetDefaultValues();
|
|
|
|
}
|
2010-09-29 09:25:48 +00:00
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
ScreenPcb->SetModify();
|
2011-02-21 21:07:00 +00:00
|
|
|
DrawPanel->Refresh();
|
2010-11-05 08:14:00 +00:00
|
|
|
syncLayerBox();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|