Commit 4565308d authored by jean-pierre charras's avatar jean-pierre charras

Eeschema: fix bug #919636

Pcbnew: 2 minor enhancements
parent ec307ef6
......@@ -49,6 +49,11 @@
#define HELP_PLACE_GRAPHICLINES _( "Place graphic lines or polygons" )
#define HELP_PLACE_GRAPHICTEXTS _( "Place graphic text (comment)" )
#define HELP_ANNOTATE _( "Annotate the components in the schematic" )
#define HELP_RUN_LIB_EDITOR _( "Library editor - Create and edit components" )
#define HELP_RUN_LIB_VIEWER _( "Library browser - Browse components" )
#define HELP_GENERATE_BOM _( "Generate bill of materials and/or cross references" )
#define HELP_IMPORT_FOOTPRINTS _( "Import footprint selection from CvPcb in components footprint field" )
// Component editor:
#define HELP_ADD_PIN _( "Add pins to the component" )
......
......@@ -458,29 +458,25 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Menu Tools:
wxMenu* toolsMenu = new wxMenu;
// Library viewer
AddMenuItem( toolsMenu,
ID_TO_LIBRARY,
_( "Library &Browser" ),
_( "Library browser" ),
KiBitmap( library_browse_xpm ) );
// Library editor
AddMenuItem( toolsMenu,
ID_TO_LIBRARY,
_( "Library &Editor" ),
_( "Library editor" ),
_( "Library &Editor" ), HELP_RUN_LIB_EDITOR,
KiBitmap( libedit_xpm ) );
// Library viewer
AddMenuItem( toolsMenu,
ID_TO_LIBVIEW,
_( "Library &Browser" ), HELP_RUN_LIB_VIEWER,
KiBitmap( library_browse_xpm ) );
// Separator
toolsMenu->AppendSeparator();
// Annotate
AddMenuItem( toolsMenu,
ID_GET_ANNOTATE,
_( "&Annotate" ),
_( "Annotate the components in the schematic" ),
_( "&Annotate" ), HELP_ANNOTATE,
KiBitmap( annotate_xpm ) );
// ERC
......@@ -501,8 +497,8 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
AddMenuItem( toolsMenu,
ID_GET_TOOLS,
_( "Generate Bill of &Materials" ),
_( "Generate bill of materials" ),
KiBitmap( tools_xpm ) );
HELP_GENERATE_BOM,
KiBitmap( bom_xpm ) );
// Separator
toolsMenu->AppendSeparator();
......@@ -521,6 +517,10 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
_( "Run Pcbnew" ),
KiBitmap( pcbnew_xpm ) );
AddMenuItem( toolsMenu, ID_BACKANNO_ITEMS,
_( "Import Footprint Selection" ),
HELP_IMPORT_FOOTPRINTS,
KiBitmap( import_footprint_names_xpm ) );
// Help Menu:
wxMenu* helpMenu = new wxMenu;
......
......@@ -134,17 +134,17 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->AddTool( ID_TO_LIBRARY, wxEmptyString, KiBitmap( libedit_xpm ),
_( "Library editor - Create and edit components" ) );
HELP_RUN_LIB_EDITOR );
m_mainToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString, KiBitmap( library_browse_xpm ),
_( "Library browser - Browse components" ) );
HELP_RUN_LIB_VIEWER );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString, KiBitmap( annotate_xpm ),
_( "Annotate schematic" ) );
HELP_ANNOTATE );
m_mainToolBar->AddTool( ID_GET_ERC, wxEmptyString, KiBitmap( erc_xpm ),
_( "Perform electric rules check" ) );
......@@ -153,7 +153,7 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
_( "Generate netlist" ) );
m_mainToolBar->AddTool( ID_GET_TOOLS, wxEmptyString, KiBitmap( bom_xpm ),
_( "Generate bill of materials and/or cross references" ) );
HELP_GENERATE_BOM );
m_mainToolBar->AddSeparator();
......@@ -167,7 +167,7 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString,
KiBitmap( import_footprint_names_xpm ),
_( "Back annotate component foot prints" ) );
HELP_IMPORT_FOOTPRINTS );
// set icon paddings
m_mainToolBar->SetToolBorderPadding(3); // padding
......
......@@ -22,6 +22,11 @@ DIALOG_GLOBAL_DELETION::DIALOG_GLOBAL_DELETION( PCB_EDIT_FRAME* parent )
: DIALOG_GLOBAL_DELETION_BASE( parent )
{
m_Parent = parent;
m_currentLayer = 0;
m_TrackFilterAR->Enable( m_DelTracks->GetValue() );
m_TrackFilterLocked->Enable( m_DelTracks->GetValue() );
m_TrackFilterNormal->Enable( m_DelTracks->GetValue() );
m_TrackFilterVias->Enable( m_DelTracks->GetValue() );
SetFocus();
GetSizer()->SetSizeHints(this);
......@@ -32,9 +37,24 @@ DIALOG_GLOBAL_DELETION::DIALOG_GLOBAL_DELETION( PCB_EDIT_FRAME* parent )
void PCB_EDIT_FRAME::InstallPcbGlobalDeleteFrame( const wxPoint& pos )
{
DIALOG_GLOBAL_DELETION dlg( this );
dlg.SetCurrentLayer( getActiveLayer() );
dlg.ShowModal();
}
void DIALOG_GLOBAL_DELETION::SetCurrentLayer( int aLayer )
{
m_currentLayer = aLayer;
m_textCtrlCurrLayer->SetValue( m_Parent->GetBoard()->GetLayerName( aLayer ) );
}
void DIALOG_GLOBAL_DELETION::OnCheckDeleteTracks( wxCommandEvent& event )
{
m_TrackFilterAR->Enable( m_DelTracks->GetValue() );
m_TrackFilterLocked->Enable( m_DelTracks->GetValue() );
m_TrackFilterNormal->Enable( m_DelTracks->GetValue() );
m_TrackFilterVias->Enable( m_DelTracks->GetValue() );
}
void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
{
......@@ -60,7 +80,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
{
gen_rastnest = true;
/* ZEG_ZONE items used in Zone filling selection are now deprecated :
/* SEG_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();
......@@ -75,13 +95,19 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
}
int masque_layer = 0;
int layers_filter = ALL_LAYERS;
if( m_rbLayersOption->GetSelection() != 0 ) // Use current layer only
layers_filter = 1 << m_currentLayer;
if( m_DelDrawings->GetValue() )
masque_layer = (~EDGE_LAYER) & 0x1FFF0000;
masque_layer = (~EDGE_LAYER) & ALL_NO_CU_LAYERS;
if( m_DelBoardEdges->GetValue() )
masque_layer |= EDGE_LAYER;
layers_filter &= layers_filter;
for( item = pcb->m_Drawings; item != NULL; item = nextitem )
{
nextitem = item->Next();
......@@ -121,16 +147,27 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
if( !m_TrackFilterAR->GetValue() )
track_mask_filter |= TRACK_AR;
for( item = pcb->m_Track; item != NULL; item = nextitem )
TRACK * nexttrack;
for( TRACK *track = pcb->m_Track; track != NULL; track = nexttrack )
{
nextitem = item->Next();
nexttrack = track->Next();
if( (item->GetState( TRACK_LOCKED | TRACK_AR ) & track_mask_filter) != 0 )
if( (track->GetState( TRACK_LOCKED | TRACK_AR ) & track_mask_filter) != 0 )
continue;
itemPicker.m_PickedItem = item;
if( (track->GetState( TRACK_LOCKED | TRACK_AR ) == 0) &&
!m_TrackFilterNormal->GetValue() )
continue;
if( (track->Type() == PCB_VIA_T) && !m_TrackFilterVias->GetValue() )
continue;
if( (track->ReturnMaskLayer() & layers_filter) == 0 )
continue;
itemPicker.m_PickedItem = track;
pickersList.PushItem( itemPicker );
item->UnLink();
track->UnLink();
gen_rastnest = true;
}
}
......
......@@ -11,9 +11,11 @@ class DIALOG_GLOBAL_DELETION: public DIALOG_GLOBAL_DELETION_BASE
{
private:
PCB_EDIT_FRAME * m_Parent;
int m_currentLayer;
public:
DIALOG_GLOBAL_DELETION( PCB_EDIT_FRAME* parent );
void SetCurrentLayer( int aLayer );
private:
void OnOkClick( wxCommandEvent& event )
......@@ -27,6 +29,7 @@ private:
}
void AcceptPcbDelete();
void OnCheckDeleteTracks( wxCommandEvent& event );
};
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -14,7 +14,10 @@ DIALOG_GLOBAL_DELETION_BASE::DIALOG_GLOBAL_DELETION_BASE( wxWindow* parent, wxWi
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxHORIZONTAL );
bSizerMain = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerUpper;
bSizerUpper = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbSizerLeft;
sbSizerLeft = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Items to delete") ), wxVERTICAL );
......@@ -43,33 +46,57 @@ DIALOG_GLOBAL_DELETION_BASE::DIALOG_GLOBAL_DELETION_BASE( wxWindow* parent, wxWi
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 );
bSizerUpper->Add( sbSizerLeft, 1, wxEXPAND|wxALL, 5 );
wxBoxSizer* bSizerRight;
bSizerRight = new wxBoxSizer( wxVERTICAL );
sbTrackFilter = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Track Filter") ), wxVERTICAL );
m_TrackFilterAR = new wxCheckBox( this, wxID_ANY, _("AutoRouted Tracks"), wxDefaultPosition, wxDefaultSize, 0 );
m_TrackFilterAR->SetValue(true);
sbTrackFilter->Add( m_TrackFilterAR, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TrackFilterLocked = new wxCheckBox( this, wxID_ANY, _("Locked Tracks"), wxDefaultPosition, wxDefaultSize, 0 );
sbTrackFilter->Add( m_TrackFilterLocked, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxVERTICAL );
m_TrackFilterNormal = new wxCheckBox( this, wxID_ANY, _("Normal Tracks"), wxDefaultPosition, wxDefaultSize, 0 );
m_TrackFilterNormal->SetValue(true);
sbTrackFilter->Add( m_TrackFilterNormal, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxStaticBoxSizer* sbSizerTrackFilter;
sbSizerTrackFilter = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Track Filter") ), wxVERTICAL );
m_TrackFilterVias = new wxCheckBox( this, wxID_ANY, _("Vias"), wxDefaultPosition, wxDefaultSize, 0 );
m_TrackFilterVias->SetValue(true);
sbTrackFilter->Add( m_TrackFilterVias, 0, wxALL, 5 );
m_TrackFilterAR = new wxCheckBox( this, wxID_ANY, _("Include AutoRouted Tracks"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerTrackFilter->Add( m_TrackFilterAR, 0, wxALL, 5 );
bSizerRight->Add( sbTrackFilter, 0, wxALL|wxEXPAND, 5 );
m_TrackFilterLocked = new wxCheckBox( this, wxID_ANY, _("Include Locked Tracks"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerTrackFilter->Add( m_TrackFilterLocked, 0, wxALL, 5 );
wxString m_rbLayersOptionChoices[] = { _("All Layers"), _("Current Layer Only") };
int m_rbLayersOptionNChoices = sizeof( m_rbLayersOptionChoices ) / sizeof( wxString );
m_rbLayersOption = new wxRadioBox( this, wxID_ANY, _("Layers Filter"), wxDefaultPosition, wxDefaultSize, m_rbLayersOptionNChoices, m_rbLayersOptionChoices, 1, wxRA_SPECIFY_COLS );
m_rbLayersOption->SetSelection( 0 );
bSizerRight->Add( m_rbLayersOption, 0, wxALL|wxEXPAND, 5 );
bSizer2->Add( sbSizerTrackFilter, 0, wxALL|wxEXPAND, 5 );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Current layer:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
bSizerRight->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_textCtrlCurrLayer = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
bSizerRight->Add( m_textCtrlCurrLayer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizer2->Add( 0, 10, 0, 0, 5 );
bSizerUpper->Add( bSizerRight, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_buttonOK = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonOK->SetDefault();
bSizer2->Add( m_buttonOK, 0, wxALL|wxEXPAND, 5 );
bSizerMain->Add( bSizerUpper, 0, wxEXPAND, 5 );
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_buttonCancel, 0, wxALL|wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
bSizerMain->Add( bSizer2, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bSizerMain->Add( m_sdbSizer1, 0, wxEXPAND, 5 );
this->SetSizer( bSizerMain );
this->Layout();
......@@ -77,14 +104,16 @@ DIALOG_GLOBAL_DELETION_BASE::DIALOG_GLOBAL_DELETION_BASE( wxWindow* parent, wxWi
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 );
m_DelTracks->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_DELETION_BASE::OnCheckDeleteTracks ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_DELETION_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_DELETION_BASE::OnOkClick ), 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 );
m_DelTracks->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_DELETION_BASE::OnCheckDeleteTracks ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_DELETION_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_DELETION_BASE::OnOkClick ), NULL, this );
}
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_global_deletion_base__
#define __dialog_global_deletion_base__
#ifndef __DIALOG_GLOBAL_DELETION_BASE_H__
#define __DIALOG_GLOBAL_DELETION_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/checkbox.h>
#include <wx/gdicmn.h>
......@@ -18,6 +19,10 @@
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
......@@ -40,22 +45,30 @@ class DIALOG_GLOBAL_DELETION_BASE : public wxDialog
wxCheckBox* m_DelTracks;
wxCheckBox* m_DelMarkers;
wxCheckBox* m_DelAlls;
wxStaticBoxSizer* sbTrackFilter;
wxCheckBox* m_TrackFilterAR;
wxCheckBox* m_TrackFilterLocked;
wxButton* m_buttonOK;
wxButton* m_buttonCancel;
wxCheckBox* m_TrackFilterNormal;
wxCheckBox* m_TrackFilterVias;
wxRadioBox* m_rbLayersOption;
wxStaticText* m_staticText1;
wxTextCtrl* m_textCtrlCurrLayer;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCheckDeleteTracks( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( 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( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 365,292 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GLOBAL_DELETION_BASE();
};
#endif //__dialog_global_deletion_base__
#endif //__DIALOG_GLOBAL_DELETION_BASE_H__
......@@ -508,6 +508,7 @@ void DRC::testUnconnected()
if( m_pcb->GetRatsnestsCount() == 0 )
return;
wxString msg;
for( unsigned ii = 0; ii < m_pcb->GetRatsnestsCount(); ++ii )
{
RATSNEST_ITEM& rat = m_pcb->m_FullRatsnest[ii];
......@@ -518,8 +519,9 @@ void DRC::testUnconnected()
D_PAD* padStart = rat.m_PadStart;
D_PAD* padEnd = rat.m_PadEnd;
msg = padStart->GetSelectMenuText() + wxT( " net " ) + padStart->GetNetname();
DRC_ITEM* uncItem = new DRC_ITEM( DRCE_UNCONNECTED_PADS,
padStart->GetSelectMenuText(),
msg,
padEnd->GetSelectMenuText(),
padStart->GetPosition(), padEnd->GetPosition() );
......
......@@ -97,8 +97,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
/* Flags for cleaning the net. */
for( pt_del = bufStart; pt_del; pt_del = pt_del->Next() )
{
//D( printf( "track %p turning off BUSY | IN_EDIT | IS_LINKED\n", pt_del ); )
D( std::cout<<"track "<<pt_del<<" turning off BUSY | IN_EDIT | IS_LINKED"<<std::endl; )
// D( std::cout<<"track "<<pt_del<<" turning off BUSY | IN_EDIT | IS_LINKED"<<std::endl; )
pt_del->SetState( BUSY | IN_EDIT | IS_LINKED, OFF );
if( pt_del == bufEnd ) // Last segment reached
......
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