Commit 38a3f1b8 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: Fix a very minor issue in left toolbar. Add option in dialog bloc to...

Pcbnew: Fix a very minor issue in left toolbar. Add option in dialog bloc to move,copy ... items on invisible layers or not.
parent 0785ca80
...@@ -49,6 +49,7 @@ static bool blockIncludeItemsOnTechLayers = true; ...@@ -49,6 +49,7 @@ static bool blockIncludeItemsOnTechLayers = true;
static bool blockIncludeBoardOutlineLayer = true; static bool blockIncludeBoardOutlineLayer = true;
static bool blockIncludePcbTexts = true; static bool blockIncludePcbTexts = true;
static bool blockDrawItems = true; static bool blockDrawItems = true;
static bool blockIncludeItemsOnInvisibleLayers = false;
/************************************/ /************************************/
/* class DIALOG_BLOCK_OPTIONS */ /* class DIALOG_BLOCK_OPTIONS */
...@@ -118,6 +119,7 @@ DIALOG_BLOCK_OPTIONS::DIALOG_BLOCK_OPTIONS( PCB_BASE_FRAME* aParent, const wxStr ...@@ -118,6 +119,7 @@ DIALOG_BLOCK_OPTIONS::DIALOG_BLOCK_OPTIONS( PCB_BASE_FRAME* aParent, const wxStr
m_Include_Edges_Items->SetValue( blockIncludeBoardOutlineLayer ); m_Include_Edges_Items->SetValue( blockIncludeBoardOutlineLayer );
m_Include_PcbTextes->SetValue( blockIncludePcbTexts ); m_Include_PcbTextes->SetValue( blockIncludePcbTexts );
m_DrawBlockItems->SetValue( blockDrawItems ); m_DrawBlockItems->SetValue( blockDrawItems );
m_checkBoxIncludeInvisible->SetValue( blockIncludeItemsOnInvisibleLayers );
m_sdbSizer1OK->SetDefault(); m_sdbSizer1OK->SetDefault();
SetFocus(); SetFocus();
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
...@@ -135,6 +137,7 @@ void DIALOG_BLOCK_OPTIONS::ExecuteCommand( wxCommandEvent& event ) ...@@ -135,6 +137,7 @@ void DIALOG_BLOCK_OPTIONS::ExecuteCommand( wxCommandEvent& event )
blockIncludeBoardOutlineLayer = m_Include_Edges_Items->GetValue(); blockIncludeBoardOutlineLayer = m_Include_Edges_Items->GetValue();
blockIncludePcbTexts = m_Include_PcbTextes->GetValue(); blockIncludePcbTexts = m_Include_PcbTextes->GetValue();
blockDrawItems = m_DrawBlockItems->GetValue(); blockDrawItems = m_DrawBlockItems->GetValue();
blockIncludeItemsOnInvisibleLayers = m_checkBoxIncludeInvisible->GetValue();
EndModal( 0 ); EndModal( 0 );
} }
...@@ -297,8 +300,6 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -297,8 +300,6 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
// Exit if no items found // Exit if no items found
if( !GetScreen()->m_BlockLocate.GetCount() ) if( !GetScreen()->m_BlockLocate.GetCount() )
cancelCmd = true; cancelCmd = true;
// else
// nextcmd = true;
} }
} }
...@@ -399,8 +400,9 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -399,8 +400,9 @@ void PCB_EDIT_FRAME::Block_SelectItems()
int layer = module->GetLayer(); int layer = module->GetLayer();
if( module->HitTest( GetScreen()->m_BlockLocate ) if( module->HitTest( GetScreen()->m_BlockLocate )
&& ( !module->IsLocked() || blockIncludeLockedModules ) && ( !module->IsLocked() || blockIncludeLockedModules ) )
&& m_Pcb->IsModuleLayerVisible( layer ) ) {
if( blockIncludeItemsOnInvisibleLayers || m_Pcb->IsModuleLayerVisible( layer ) )
{ {
picker.m_PickedItem = module; picker.m_PickedItem = module;
picker.m_PickedItemType = module->Type(); picker.m_PickedItemType = module->Type();
...@@ -408,6 +410,7 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -408,6 +410,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
} }
} }
} }
}
// Add tracks and vias // Add tracks and vias
if( blockIncludeTracks ) if( blockIncludeTracks )
...@@ -415,8 +418,9 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -415,8 +418,9 @@ void PCB_EDIT_FRAME::Block_SelectItems()
for( TRACK* pt_segm = m_Pcb->m_Track; pt_segm != NULL; for( TRACK* pt_segm = m_Pcb->m_Track; pt_segm != NULL;
pt_segm = pt_segm->Next() ) pt_segm = pt_segm->Next() )
{ {
if( pt_segm->HitTest( GetScreen()->m_BlockLocate ) if( pt_segm->HitTest( GetScreen()->m_BlockLocate ) )
&& m_Pcb->IsLayerVisible( pt_segm->GetLayer() ) ) {
if( blockIncludeItemsOnInvisibleLayers || m_Pcb->IsLayerVisible( pt_segm->GetLayer() ) )
{ {
picker.m_PickedItem = pt_segm; picker.m_PickedItem = pt_segm;
picker.m_PickedItemType = pt_segm->Type(); picker.m_PickedItemType = pt_segm->Type();
...@@ -424,6 +428,7 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -424,6 +428,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
} }
} }
} }
}
// Add graphic items // Add graphic items
masque_layer = EDGE_LAYER; masque_layer = EDGE_LAYER;
...@@ -437,7 +442,7 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -437,7 +442,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
for( BOARD_ITEM* PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; for( BOARD_ITEM* PtStruct = m_Pcb->m_Drawings; PtStruct != NULL;
PtStruct = PtStruct->Next() ) PtStruct = PtStruct->Next() )
{ {
if( !m_Pcb->IsLayerVisible( PtStruct->GetLayer() ) ) if( !m_Pcb->IsLayerVisible( PtStruct->GetLayer() ) && ! blockIncludeItemsOnInvisibleLayers)
continue; continue;
bool select_me = false; bool select_me = false;
switch( PtStruct->Type() ) switch( PtStruct->Type() )
...@@ -493,33 +498,13 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -493,33 +498,13 @@ void PCB_EDIT_FRAME::Block_SelectItems()
// Add zones // Add zones
if( blockIncludeZones ) if( blockIncludeZones )
{ {
#if 0
/* This section can creates problems if selected:
* m_Pcb->m_Zone can have a *lot* of items (100 000 is easily possible)
* so it is not selected (and TODO: will be removed, one day)
*/
for( SEGZONE* pt_segm = m_Pcb->m_Zone; pt_segm != NULL;
pt_segm = pt_segm->Next() )
{
/* Segments used in Zone filling selection */
if( pt_segm->HitTest( GetScreen()->m_BlockLocate )
&& m_Pcb->IsLayerVisible( pt_segm->GetLayer() ) )
{
picker.m_PickedItem = pt_segm;
picker.m_PickedItemType = pt_segm->Type();
itemsList->PushItem( picker );
}
}
#endif
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ ) for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* area = m_Pcb->GetArea( ii ); ZONE_CONTAINER* area = m_Pcb->GetArea( ii );
if( area->HitTest( GetScreen()->m_BlockLocate ) if( area->HitTest( GetScreen()->m_BlockLocate ) )
&& m_Pcb->IsLayerVisible( area->GetLayer() ) ) {
if( blockIncludeItemsOnInvisibleLayers || m_Pcb->IsLayerVisible( area->GetLayer() ) )
{ {
BOARD_ITEM* zone_c = (BOARD_ITEM*) area; BOARD_ITEM* zone_c = (BOARD_ITEM*) area;
picker.m_PickedItem = zone_c; picker.m_PickedItem = zone_c;
...@@ -528,6 +513,7 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -528,6 +513,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
} }
} }
} }
}
} }
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 18 2010) // C++ code generated with wxFormBuilder (version Nov 17 2010)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -26,6 +26,7 @@ DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent, wxWindow ...@@ -26,6 +26,7 @@ DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent, wxWindow
gSizer1->Add( m_Include_Modules, 0, wxALL, 5 ); gSizer1->Add( m_Include_Modules, 0, wxALL, 5 );
m_Include_PcbTextes = new wxCheckBox( this, wxID_ANY, _("Include text items"), wxDefaultPosition, wxDefaultSize, 0 ); m_Include_PcbTextes = new wxCheckBox( this, wxID_ANY, _("Include text items"), wxDefaultPosition, wxDefaultSize, 0 );
m_Include_PcbTextes->SetValue(true);
gSizer1->Add( m_Include_PcbTextes, 0, wxALL, 5 ); gSizer1->Add( m_Include_PcbTextes, 0, wxALL, 5 );
m_IncludeLockedModules = new wxCheckBox( this, wxID_ANY, _("Include locked modules"), wxDefaultPosition, wxDefaultSize, 0 ); m_IncludeLockedModules = new wxCheckBox( this, wxID_ANY, _("Include locked modules"), wxDefaultPosition, wxDefaultSize, 0 );
...@@ -48,6 +49,12 @@ DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent, wxWindow ...@@ -48,6 +49,12 @@ DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent, wxWindow
sbSizer1->Add( gSizer1, 0, wxEXPAND, 5 ); sbSizer1->Add( gSizer1, 0, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
sbSizer1->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_checkBoxIncludeInvisible = new wxCheckBox( this, wxID_ANY, _("Include items on invisible layers"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer1->Add( m_checkBoxIncludeInvisible, 0, wxALL, 5 );
bSizerMain->Add( sbSizer1, 1, wxALL|wxEXPAND, 5 ); bSizerMain->Add( sbSizer1, 1, wxALL|wxEXPAND, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1 = new wxStdDialogButtonSizer();
...@@ -72,6 +79,7 @@ DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent, wxWindow ...@@ -72,6 +79,7 @@ DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent, wxWindow
m_Include_Edges_Items->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); m_Include_Edges_Items->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this );
m_Include_Zones->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); m_Include_Zones->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this );
m_DrawBlockItems->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); m_DrawBlockItems->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this );
m_checkBoxIncludeInvisible->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::OnCancel ), NULL, this ); m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::OnCancel ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::ExecuteCommand ), NULL, this ); m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::ExecuteCommand ), NULL, this );
} }
...@@ -87,6 +95,7 @@ DIALOG_BLOCK_OPTIONS_BASE::~DIALOG_BLOCK_OPTIONS_BASE() ...@@ -87,6 +95,7 @@ DIALOG_BLOCK_OPTIONS_BASE::~DIALOG_BLOCK_OPTIONS_BASE()
m_Include_Edges_Items->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); m_Include_Edges_Items->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this );
m_Include_Zones->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); m_Include_Zones->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this );
m_DrawBlockItems->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this ); m_DrawBlockItems->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this );
m_checkBoxIncludeInvisible->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::checkBoxClicked ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::OnCancel ), NULL, this ); m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::OnCancel ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::ExecuteCommand ), NULL, this ); m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::ExecuteCommand ), NULL, this );
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 18 2010) // C++ code generated with wxFormBuilder (version Nov 17 2010)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
...@@ -40,6 +41,8 @@ class DIALOG_BLOCK_OPTIONS_BASE : public wxDialog ...@@ -40,6 +41,8 @@ class DIALOG_BLOCK_OPTIONS_BASE : public wxDialog
wxCheckBox* m_Include_Edges_Items; wxCheckBox* m_Include_Edges_Items;
wxCheckBox* m_Include_Zones; wxCheckBox* m_Include_Zones;
wxCheckBox* m_DrawBlockItems; wxCheckBox* m_DrawBlockItems;
wxStaticLine* m_staticline1;
wxCheckBox* m_checkBoxIncludeInvisible;
wxStdDialogButtonSizer* m_sdbSizer1; wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel; wxButton* m_sdbSizer1Cancel;
...@@ -52,7 +55,7 @@ class DIALOG_BLOCK_OPTIONS_BASE : public wxDialog ...@@ -52,7 +55,7 @@ class DIALOG_BLOCK_OPTIONS_BASE : public wxDialog
public: public:
DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 397,171 ), long style = wxDEFAULT_DIALOG_STYLE ); DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 397,226 ), long style = wxDEFAULT_DIALOG_STYLE );
~DIALOG_BLOCK_OPTIONS_BASE(); ~DIALOG_BLOCK_OPTIONS_BASE();
}; };
......
...@@ -228,6 +228,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) ...@@ -228,6 +228,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_UPDATE_UI( ID_TOOLBARH_PCB_SELECT_LAYER, PCB_EDIT_FRAME::OnUpdateLayerSelectBox ) EVT_UPDATE_UI( ID_TOOLBARH_PCB_SELECT_LAYER, PCB_EDIT_FRAME::OnUpdateLayerSelectBox )
EVT_UPDATE_UI( ID_TB_OPTIONS_DRC_OFF, PCB_EDIT_FRAME::OnUpdateDrcEnable ) EVT_UPDATE_UI( ID_TB_OPTIONS_DRC_OFF, PCB_EDIT_FRAME::OnUpdateDrcEnable )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_RATSNEST, PCB_EDIT_FRAME::OnUpdateShowBoardRatsnest ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_RATSNEST, PCB_EDIT_FRAME::OnUpdateShowBoardRatsnest )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST, PCB_EDIT_FRAME::OnUpdateShowModuleRatsnest )
EVT_UPDATE_UI( ID_TB_OPTIONS_AUTO_DEL_TRACK, PCB_EDIT_FRAME::OnUpdateAutoDeleteTrack ) EVT_UPDATE_UI( ID_TB_OPTIONS_AUTO_DEL_TRACK, PCB_EDIT_FRAME::OnUpdateAutoDeleteTrack )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, PCB_EDIT_FRAME::OnUpdateViaDrawMode ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, PCB_EDIT_FRAME::OnUpdateViaDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, PCB_EDIT_FRAME::OnUpdateTraceDrawMode ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, PCB_EDIT_FRAME::OnUpdateTraceDrawMode )
......
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