kicad/gerbview/initpcb.cpp

87 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"
2010-09-28 14:42:05 +00:00
#include "class_gerber_draw_item.h"
#include "class_GERBER.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
}
2010-10-17 16:42:06 +00:00
SetCurItem( NULL );
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] )
{
2008-11-08 06:44:07 +00:00
g_GERBER_List[layer]->InitToolTable();
g_GERBER_List[layer]->ResetDefaultValues();
}
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
SetScreen( ScreenPcb );
GetScreen()->Init();
2010-02-04 11:03:31 +00:00
setActiveLayer(LAYER_N_BACK);
syncLayerBox();
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( _( "Clear layer %d?" ), layer + 1 );
2007-08-23 04:28:46 +00:00
if( query && !IsOK( this, msg ) )
return;
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
}
2010-09-29 09:25:48 +00:00
if( g_GERBER_List[layer] )
{
2010-09-29 09:25:48 +00:00
g_GERBER_List[layer]->InitToolTable();
g_GERBER_List[layer]->ResetDefaultValues();
}
2010-09-29 09:25:48 +00:00
2007-08-23 04:28:46 +00:00
ScreenPcb->SetModify();
DrawPanel->Refresh();
syncLayerBox();
}