Commit 8a0b632a authored by jean-pierre charras's avatar jean-pierre charras

add forgotten files

parent 1f47f8c6
/**
* @file dialog_global_deletion.cpp
*/
#include "fctsys.h"
#include "common.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "dialog_global_deletion.h"
DIALOG_GLOBAL_DELETION::DIALOG_GLOBAL_DELETION( WinEDA_PcbFrame* parent )
: DIALOG_GLOBAL_DELETION_BASE( parent )
{
m_Parent = parent;
SetFocus();
GetSizer()->SetSizeHints(this);
Centre();
}
/********************************************************************/
void WinEDA_PcbFrame::InstallPcbGlobalDeleteFrame( const wxPoint& pos )
/********************************************************************/
{
DIALOG_GLOBAL_DELETION dlg( this );
dlg.ShowModal();
}
/***********************************************************************/
void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
/***********************************************************************/
{
bool gen_rastnest = false;
m_Parent->SetCurItem( NULL );
if( m_DelAlls->GetValue() )
{
m_Parent->Clear_Pcb( true );
}
else
{
if( !IsOK( this, _( "Ok to delete selected items ?" ) ) )
return;
BOARD * pcb = m_Parent->GetBoard();
PICKED_ITEMS_LIST pickersList;
ITEM_PICKER itemPicker( NULL, UR_DELETED );
BOARD_ITEM* item, * nextitem;
if( m_DelZones->GetValue() )
{
gen_rastnest = true;
/* ZEG_ZONE items used in Zone filling selection are now deprecated :
* and are deleted but not put in undo buffer if exist
*/
pcb->m_Zone.DeleteAll();
while( pcb->GetAreaCount() )
{
item = pcb->GetArea( 0 );
itemPicker.m_PickedItem = item;
pickersList.PushItem( itemPicker );
pcb->Remove( item );
}
}
int masque_layer = 0;
if( m_DelDrawings->GetValue() )
masque_layer = (~EDGE_LAYER) & 0x1FFF0000;
if( m_DelBoardEdges->GetValue() )
masque_layer |= EDGE_LAYER;
for( item = pcb->m_Drawings; item != NULL; item = nextitem )
{
nextitem = item->Next();
bool removeme = (g_TabOneLayerMask[ item->GetLayer()] & masque_layer) != 0;
if( ( item->Type() == TYPE_TEXTE ) && m_DelTexts->GetValue() )
removeme = true;
if( removeme )
{
itemPicker.m_PickedItem = item;
pickersList.PushItem( itemPicker );
item->UnLink();
}
}
if( m_DelModules->GetValue() )
{
gen_rastnest = true;
for( item = pcb->m_Modules; item; item = nextitem )
{
nextitem = item->Next();
itemPicker.m_PickedItem = item;
pickersList.PushItem( itemPicker );
item->UnLink();
}
}
if( m_DelTracks->GetValue() )
{
int track_mask_filter = 0;
if( !m_TrackFilterLocked->GetValue() )
track_mask_filter |= SEGM_FIXE;
if( !m_TrackFilterAR->GetValue() )
track_mask_filter |= SEGM_AR;
for( item = pcb->m_Track; item != NULL; item = nextitem )
{
nextitem = item->Next();
if( (item->GetState( SEGM_FIXE | SEGM_AR ) & track_mask_filter) != 0 )
continue;
itemPicker.m_PickedItem = item;
pickersList.PushItem( itemPicker );
item->UnLink();
gen_rastnest = true;
}
}
if( pickersList.GetCount() )
m_Parent->SaveCopyInUndoList( pickersList, UR_DELETED );
if( m_DelMarkers->GetValue() )
pcb->DeleteMARKERs();
if( gen_rastnest )
m_Parent->Compile_Ratsnest( NULL, true );
}
m_Parent->DrawPanel->Refresh();
m_Parent->OnModify();
EndModal( 1 );
}
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_global_deletion.h
/////////////////////////////////////////////////////////////////////////////
#ifndef _DIALOG_GLOBAL_DELETION_H_
#define _DIALOG_GLOBAL_DELETION_H_
#include "dialog_global_deletion_base.h"
class DIALOG_GLOBAL_DELETION: public DIALOG_GLOBAL_DELETION_BASE
{
private:
WinEDA_PcbFrame * m_Parent;
public:
DIALOG_GLOBAL_DELETION( WinEDA_PcbFrame* parent );
private:
void OnOkClick( wxCommandEvent& event )
{
AcceptPcbDelete();
EndModal(wxID_OK);
}
void OnCancelClick( wxCommandEvent& event )
{
EndModal(wxID_CANCEL);
}
void AcceptPcbDelete();
};
#endif
// _DIALOG_GLOBAL_DELETION_H_
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_global_deletion_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_GLOBAL_DELETION_BASE::DIALOG_GLOBAL_DELETION_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbSizerLeft;
sbSizerLeft = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Items to delete") ), wxVERTICAL );
m_DelZones = new wxCheckBox( this, wxID_ANY, _("Delete Zones"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerLeft->Add( m_DelZones, 0, wxALL, 5 );
m_DelTexts = new wxCheckBox( this, wxID_ANY, _("Delete Texts"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerLeft->Add( m_DelTexts, 0, wxALL, 5 );
m_DelBoardEdges = new wxCheckBox( this, wxID_ANY, _("Delete Board Outlines"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerLeft->Add( m_DelBoardEdges, 0, wxALL, 5 );
m_DelDrawings = new wxCheckBox( this, wxID_ANY, _("Delete Drawings"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerLeft->Add( m_DelDrawings, 0, wxALL, 5 );
m_DelModules = new wxCheckBox( this, wxID_ANY, _("Delete Modules"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerLeft->Add( m_DelModules, 0, wxALL, 5 );
m_DelTracks = new wxCheckBox( this, wxID_ANY, _("Delete Tracks"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerLeft->Add( m_DelTracks, 0, wxALL, 5 );
m_DelMarkers = new wxCheckBox( this, wxID_ANY, _("Delete Markers"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerLeft->Add( m_DelMarkers, 0, wxALL, 5 );
m_DelAlls = new wxCheckBox( this, wxID_ANY, _("Clear Board"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerLeft->Add( m_DelAlls, 0, wxALL, 5 );
bSizerMain->Add( sbSizerLeft, 1, wxEXPAND|wxALL, 5 );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerTrackFilter;
sbSizerTrackFilter = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Track Filter") ), wxVERTICAL );
m_TrackFilterAR = new wxCheckBox( this, wxID_ANY, _("Include AutoRouted Tracks"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerTrackFilter->Add( m_TrackFilterAR, 0, wxALL, 5 );
m_TrackFilterLocked = new wxCheckBox( this, wxID_ANY, _("Include Locked Tracks"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerTrackFilter->Add( m_TrackFilterLocked, 0, wxALL, 5 );
bSizer2->Add( sbSizerTrackFilter, 0, wxALL|wxEXPAND, 5 );
bSizer2->Add( 0, 10, 0, 0, 5 );
m_buttonOK = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonOK->SetDefault();
bSizer2->Add( m_buttonOK, 0, wxALL|wxEXPAND, 5 );
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_buttonCancel, 0, wxALL|wxEXPAND, 5 );
bSizerMain->Add( bSizer2, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
this->SetSizer( bSizerMain );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_DELETION_BASE::OnOkClick ), NULL, this );
m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_DELETION_BASE::OnCancelClick ), NULL, this );
}
DIALOG_GLOBAL_DELETION_BASE::~DIALOG_GLOBAL_DELETION_BASE()
{
// Disconnect Events
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_DELETION_BASE::OnOkClick ), NULL, this );
m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_DELETION_BASE::OnCancelClick ), NULL, this );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_global_deletion_base__
#define __dialog_global_deletion_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/checkbox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GLOBAL_DELETION_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_GLOBAL_DELETION_BASE : public wxDialog
{
private:
protected:
wxCheckBox* m_DelZones;
wxCheckBox* m_DelTexts;
wxCheckBox* m_DelBoardEdges;
wxCheckBox* m_DelDrawings;
wxCheckBox* m_DelModules;
wxCheckBox* m_DelTracks;
wxCheckBox* m_DelMarkers;
wxCheckBox* m_DelAlls;
wxCheckBox* m_TrackFilterAR;
wxCheckBox* m_TrackFilterLocked;
wxButton* m_buttonOK;
wxButton* m_buttonCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_GLOBAL_DELETION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 365,242 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GLOBAL_DELETION_BASE();
};
#endif //__dialog_global_deletion_base__
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment