Pcbnew: files housekeeping and code cleanup

This commit is contained in:
jean-pierre charras 2010-11-26 21:00:39 +01:00
parent cdd9e8cabe
commit 1f47f8c6ed
16 changed files with 6487 additions and 7976 deletions

View File

@ -27,8 +27,8 @@ set(PCBNEW_DIALOGS
dialogs/dialog_cleaning_options.cpp dialogs/dialog_cleaning_options.cpp
dialogs/dialog_copper_zones.cpp dialogs/dialog_copper_zones.cpp
dialogs/dialog_copper_zones_base.cpp dialogs/dialog_copper_zones_base.cpp
dialog_design_rules.cpp dialogs/dialog_design_rules.cpp
dialog_design_rules_base.cpp dialogs/dialog_design_rules_base.cpp
dialogs/dialog_display_options.cpp dialogs/dialog_display_options.cpp
dialogs/dialog_display_options_base.cpp dialogs/dialog_display_options_base.cpp
dialogs/dialog_drc_base.cpp dialogs/dialog_drc_base.cpp
@ -54,8 +54,10 @@ set(PCBNEW_DIALOGS
dialogs/dialog_graphic_items_options_base.cpp dialogs/dialog_graphic_items_options_base.cpp
dialogs/dialog_graphic_item_properties.cpp dialogs/dialog_graphic_item_properties.cpp
dialogs/dialog_graphic_item_properties_base.cpp dialogs/dialog_graphic_item_properties_base.cpp
dialog_layers_setup.cpp dialogs/dialog_global_deletion.cpp
dialog_layers_setup_base.cpp dialogs/dialog_global_deletion_base.cpp
dialogs/dialog_layers_setup.cpp
dialogs/dialog_layers_setup_base.cpp
dialogs/dialog_netlist.cpp dialogs/dialog_netlist.cpp
dialogs/dialog_netlist_fbp.cpp dialogs/dialog_netlist_fbp.cpp
dialogs/dialog_pcb_text_properties.cpp dialogs/dialog_pcb_text_properties.cpp

View File

@ -1,223 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_initpcb.cpp
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 15/02/2006 21:42:41
// RCS-ID:
// Copyright: License GNU
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 15/02/2006 21:42:41
////@begin includes
////@end includes
#include "dialog_initpcb.h"
////@begin XPM images
////@end XPM images
/*!
* WinEDA_PcbGlobalDeleteFrame type definition
*/
IMPLEMENT_DYNAMIC_CLASS( WinEDA_PcbGlobalDeleteFrame, wxDialog )
/*!
* WinEDA_PcbGlobalDeleteFrame event table definition
*/
BEGIN_EVENT_TABLE( WinEDA_PcbGlobalDeleteFrame, wxDialog )
////@begin WinEDA_PcbGlobalDeleteFrame event table entries
EVT_BUTTON( wxID_OK, WinEDA_PcbGlobalDeleteFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_PcbGlobalDeleteFrame::OnCancelClick )
////@end WinEDA_PcbGlobalDeleteFrame event table entries
END_EVENT_TABLE()
/*!
* WinEDA_PcbGlobalDeleteFrame constructors
*/
WinEDA_PcbGlobalDeleteFrame::WinEDA_PcbGlobalDeleteFrame( )
{
}
WinEDA_PcbGlobalDeleteFrame::WinEDA_PcbGlobalDeleteFrame( WinEDA_PcbFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
m_Parent = parent;
Create(parent, id, caption, pos, size, style);
}
/*!
* WinEDA_PcbGlobalDeleteFrame creator
*/
bool WinEDA_PcbGlobalDeleteFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin WinEDA_PcbGlobalDeleteFrame member initialisation
m_DelZones = NULL;
m_DelTexts = NULL;
m_DelEdges = NULL;
m_DelDrawings = NULL;
m_DelModules = NULL;
m_DelTracks = NULL;
m_DelMarkers = NULL;
m_DelAlls = NULL;
m_TrackFilterAR = NULL;
m_TrackFilterLocked = NULL;
////@end WinEDA_PcbGlobalDeleteFrame member initialisation
////@begin WinEDA_PcbGlobalDeleteFrame creation
SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
Centre();
////@end WinEDA_PcbGlobalDeleteFrame creation
return true;
}
/*!
* Control creation for WinEDA_PcbGlobalDeleteFrame
*/
void WinEDA_PcbGlobalDeleteFrame::CreateControls()
{
////@begin WinEDA_PcbGlobalDeleteFrame content construction
// Generated by DialogBlocks, 15/02/2006 22:10:20 (unregistered)
WinEDA_PcbGlobalDeleteFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
itemDialog1->SetSizer(itemBoxSizer2);
wxStaticBox* itemStaticBoxSizer3Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Items to delete"));
wxStaticBoxSizer* itemStaticBoxSizer3 = new wxStaticBoxSizer(itemStaticBoxSizer3Static, wxVERTICAL);
itemBoxSizer2->Add(itemStaticBoxSizer3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_DelZones = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Delete Zones"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_DelZones->SetValue(false);
itemStaticBoxSizer3->Add(m_DelZones, 0, wxALIGN_LEFT|wxALL, 5);
m_DelTexts = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Delete Texts"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_DelTexts->SetValue(false);
itemStaticBoxSizer3->Add(m_DelTexts, 0, wxALIGN_LEFT|wxALL, 5);
m_DelEdges = new wxCheckBox( itemDialog1, ID_CHECKBOX2, _("Delete Edges"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_DelEdges->SetValue(false);
itemStaticBoxSizer3->Add(m_DelEdges, 0, wxALIGN_LEFT|wxALL, 5);
m_DelDrawings = new wxCheckBox( itemDialog1, ID_CHECKBOX3, _("Delete Drawings"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_DelDrawings->SetValue(false);
itemStaticBoxSizer3->Add(m_DelDrawings, 0, wxALIGN_LEFT|wxALL, 5);
m_DelModules = new wxCheckBox( itemDialog1, ID_CHECKBOX4, _("Delete Modules"), wxDefaultPosition, wxDefaultSize, 0 );
m_DelModules->SetValue(false);
itemStaticBoxSizer3->Add(m_DelModules, 0, wxALIGN_LEFT|wxALL, 5);
m_DelTracks = new wxCheckBox( itemDialog1, ID_CHECKBOX5, _("Delete Tracks"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_DelTracks->SetValue(false);
itemStaticBoxSizer3->Add(m_DelTracks, 0, wxALIGN_LEFT|wxALL, 5);
m_DelMarkers = new wxCheckBox( itemDialog1, ID_CHECKBOX6, _("Delete Markers"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_DelMarkers->SetValue(false);
itemStaticBoxSizer3->Add(m_DelMarkers, 0, wxALIGN_LEFT|wxALL, 5);
m_DelAlls = new wxCheckBox( itemDialog1, ID_CHECKBOX7, _("Clear Board"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_DelAlls->SetValue(false);
itemStaticBoxSizer3->Add(m_DelAlls, 0, wxALIGN_LEFT|wxALL, 5);
wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer2->Add(itemBoxSizer12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxStaticBox* itemStaticBoxSizer13Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Track Filter"));
wxStaticBoxSizer* itemStaticBoxSizer13 = new wxStaticBoxSizer(itemStaticBoxSizer13Static, wxVERTICAL);
itemBoxSizer12->Add(itemStaticBoxSizer13, 0, wxGROW|wxALL, 5);
m_TrackFilterAR = new wxCheckBox( itemDialog1, ID_CHECKBOX8, _("Include AutoRouted Tracks"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_TrackFilterAR->SetValue(false);
itemStaticBoxSizer13->Add(m_TrackFilterAR, 0, wxALIGN_LEFT|wxALL, 5);
m_TrackFilterLocked = new wxCheckBox( itemDialog1, ID_CHECKBOX9, _("Include Locked Tracks"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_TrackFilterLocked->SetValue(false);
itemStaticBoxSizer13->Add(m_TrackFilterLocked, 0, wxALIGN_LEFT|wxALL, 5);
itemBoxSizer12->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxBoxSizer* itemBoxSizer17 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer12->Add(itemBoxSizer17, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxButton* itemButton18 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer17->Add(itemButton18, 0, wxGROW|wxALL, 5);
wxButton* itemButton19 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer17->Add(itemButton19, 0, wxGROW|wxALL, 5);
////@end WinEDA_PcbGlobalDeleteFrame content construction
}
/*!
* Should we show tooltips?
*/
bool WinEDA_PcbGlobalDeleteFrame::ShowToolTips()
{
return true;
}
/*!
* Get bitmap resources
*/
wxBitmap WinEDA_PcbGlobalDeleteFrame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin WinEDA_PcbGlobalDeleteFrame bitmap retrieval
wxUnusedVar(name);
return wxNullBitmap;
////@end WinEDA_PcbGlobalDeleteFrame bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon WinEDA_PcbGlobalDeleteFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin WinEDA_PcbGlobalDeleteFrame icon retrieval
wxUnusedVar(name);
return wxNullIcon;
////@end WinEDA_PcbGlobalDeleteFrame icon retrieval
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/
void WinEDA_PcbGlobalDeleteFrame::OnOkClick( wxCommandEvent& event )
{
AcceptPcbDelete(event);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
void WinEDA_PcbGlobalDeleteFrame::OnCancelClick( wxCommandEvent& event )
{
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PcbGlobalDeleteFrame.
// Before editing this code, remove the block markers.
event.Skip();
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PcbGlobalDeleteFrame.
}

View File

@ -1,123 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_initpcb.h
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 15/02/2006 21:42:41
// RCS-ID:
// Copyright: License GNU
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 15/02/2006 21:42:41
#ifndef _DIALOG_INITPCB_H_
#define _DIALOG_INITPCB_H_
/*!
* Includes
*/
////@begin includes
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_DIALOG 10000
#define SYMBOL_WINEDA_PCBGLOBALDELETEFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_PCBGLOBALDELETEFRAME_TITLE _("Global Delete")
#define SYMBOL_WINEDA_PCBGLOBALDELETEFRAME_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_PCBGLOBALDELETEFRAME_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_PCBGLOBALDELETEFRAME_POSITION wxDefaultPosition
#define ID_CHECKBOX 10001
#define ID_CHECKBOX1 10002
#define ID_CHECKBOX2 10003
#define ID_CHECKBOX3 10004
#define ID_CHECKBOX4 10005
#define ID_CHECKBOX5 10006
#define ID_CHECKBOX6 10007
#define ID_CHECKBOX7 10008
#define ID_CHECKBOX8 10009
#define ID_CHECKBOX9 10010
////@end control identifiers
/*!
* Compatibility
*/
#ifndef wxCLOSE_BOX
#define wxCLOSE_BOX 0x1000
#endif
/*!
* WinEDA_PcbGlobalDeleteFrame class declaration
*/
class WinEDA_PcbGlobalDeleteFrame: public wxDialog
{
DECLARE_DYNAMIC_CLASS( WinEDA_PcbGlobalDeleteFrame )
DECLARE_EVENT_TABLE()
public:
/// Constructors
WinEDA_PcbGlobalDeleteFrame( );
WinEDA_PcbGlobalDeleteFrame( WinEDA_PcbFrame* parent, wxWindowID id = SYMBOL_WINEDA_PCBGLOBALDELETEFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_PCBGLOBALDELETEFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_PCBGLOBALDELETEFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_PCBGLOBALDELETEFRAME_SIZE, long style = SYMBOL_WINEDA_PCBGLOBALDELETEFRAME_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_PCBGLOBALDELETEFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_PCBGLOBALDELETEFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_PCBGLOBALDELETEFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_PCBGLOBALDELETEFRAME_SIZE, long style = SYMBOL_WINEDA_PCBGLOBALDELETEFRAME_STYLE );
/// Creates the controls and sizers
void CreateControls();
////@begin WinEDA_PcbGlobalDeleteFrame event handler declarations
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void OnOkClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void OnCancelClick( wxCommandEvent& event );
////@end WinEDA_PcbGlobalDeleteFrame event handler declarations
////@begin WinEDA_PcbGlobalDeleteFrame member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end WinEDA_PcbGlobalDeleteFrame member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
void AcceptPcbDelete(wxCommandEvent& event);
////@begin WinEDA_PcbGlobalDeleteFrame member variables
wxCheckBox* m_DelZones;
wxCheckBox* m_DelTexts;
wxCheckBox* m_DelEdges;
wxCheckBox* m_DelDrawings;
wxCheckBox* m_DelModules;
wxCheckBox* m_DelTracks;
wxCheckBox* m_DelMarkers;
wxCheckBox* m_DelAlls;
wxCheckBox* m_TrackFilterAR;
wxCheckBox* m_TrackFilterLocked;
////@end WinEDA_PcbGlobalDeleteFrame member variables
WinEDA_PcbFrame * m_Parent;
};
#endif
// _DIALOG_INITPCB_H_

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
#include "wx/msw/wx.rc"

View File

@ -12,132 +12,7 @@
#include "module_editor_frame.h" #include "module_editor_frame.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "protos.h" //#include "protos.h"
/**************************************/
/* dialog WinEDA_PcbGlobalDeleteFrame */
/**************************************/
#include "dialog_initpcb.cpp"
/********************************************************************/
void WinEDA_PcbFrame::InstallPcbGlobalDeleteFrame( const wxPoint& pos )
/********************************************************************/
{
WinEDA_PcbGlobalDeleteFrame* frame =
new WinEDA_PcbGlobalDeleteFrame( this );
frame->ShowModal(); frame->Destroy();
}
/***********************************************************************/
void WinEDA_PcbGlobalDeleteFrame::AcceptPcbDelete( wxCommandEvent& event )
/***********************************************************************/
{
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_DelEdges->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 );
}
/** /**