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,12 +400,14 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -399,12 +400,14 @@ 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 ) )
{ {
picker.m_PickedItem = module; if( blockIncludeItemsOnInvisibleLayers || m_Pcb->IsModuleLayerVisible( layer ) )
picker.m_PickedItemType = module->Type(); {
itemsList->PushItem( picker ); picker.m_PickedItem = module;
picker.m_PickedItemType = module->Type();
itemsList->PushItem( picker );
}
} }
} }
} }
...@@ -415,12 +418,14 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -415,12 +418,14 @@ 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() ) )
{ {
picker.m_PickedItem = pt_segm; if( blockIncludeItemsOnInvisibleLayers || m_Pcb->IsLayerVisible( pt_segm->GetLayer() ) )
picker.m_PickedItemType = pt_segm->Type(); {
itemsList->PushItem( picker ); picker.m_PickedItem = pt_segm;
picker.m_PickedItemType = pt_segm->Type();
itemsList->PushItem( picker );
}
} }
} }
} }
...@@ -437,13 +442,13 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -437,13 +442,13 @@ 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() )
{ {
case TYPE_DRAWSEGMENT: case TYPE_DRAWSEGMENT:
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 ) if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
break; break;
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) ) if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
...@@ -461,7 +466,7 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -461,7 +466,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
break; break;
case TYPE_MIRE: case TYPE_MIRE:
if( ( g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer ) == 0 ) if( ( g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer ) == 0 )
break; break;
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) ) if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
...@@ -493,38 +498,19 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -493,38 +498,19 @@ 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() ) )
{ {
BOARD_ITEM* zone_c = (BOARD_ITEM*) area; if( blockIncludeItemsOnInvisibleLayers || m_Pcb->IsLayerVisible( area->GetLayer() ) )
picker.m_PickedItem = zone_c; {
picker.m_PickedItemType = zone_c->Type(); BOARD_ITEM* zone_c = (BOARD_ITEM*) area;
itemsList->PushItem( picker ); picker.m_PickedItem = zone_c;
picker.m_PickedItemType = zone_c->Type();
itemsList->PushItem( picker );
}
} }
} }
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// 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!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_block_options_base__ #ifndef __dialog_block_options_base__
#define __dialog_block_options_base__ #define __dialog_block_options_base__
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
#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/statbox.h> #include <wx/statline.h>
#include <wx/button.h> #include <wx/statbox.h>
#include <wx/dialog.h> #include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_BLOCK_OPTIONS_BASE ///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_BLOCK_OPTIONS_BASE
class DIALOG_BLOCK_OPTIONS_BASE : public wxDialog ///////////////////////////////////////////////////////////////////////////////
{ class DIALOG_BLOCK_OPTIONS_BASE : public wxDialog
private: {
private:
protected:
wxCheckBox* m_Include_Modules; protected:
wxCheckBox* m_Include_PcbTextes; wxCheckBox* m_Include_Modules;
wxCheckBox* m_IncludeLockedModules; wxCheckBox* m_Include_PcbTextes;
wxCheckBox* m_Include_Draw_Items; wxCheckBox* m_IncludeLockedModules;
wxCheckBox* m_Include_Tracks; wxCheckBox* m_Include_Draw_Items;
wxCheckBox* m_Include_Edges_Items; wxCheckBox* m_Include_Tracks;
wxCheckBox* m_Include_Zones; wxCheckBox* m_Include_Edges_Items;
wxCheckBox* m_DrawBlockItems; wxCheckBox* m_Include_Zones;
wxStdDialogButtonSizer* m_sdbSizer1; wxCheckBox* m_DrawBlockItems;
wxButton* m_sdbSizer1OK; wxStaticLine* m_staticline1;
wxButton* m_sdbSizer1Cancel; wxCheckBox* m_checkBoxIncludeInvisible;
wxStdDialogButtonSizer* m_sdbSizer1;
// Virtual event handlers, overide them in your derived class wxButton* m_sdbSizer1OK;
virtual void checkBoxClicked( wxCommandEvent& event ) { event.Skip(); } wxButton* m_sdbSizer1Cancel;
virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); }
virtual void ExecuteCommand( wxCommandEvent& event ) { event.Skip(); } // Virtual event handlers, overide them in your derived class
virtual void checkBoxClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); }
public: virtual void ExecuteCommand( wxCommandEvent& event ) { event.Skip(); }
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(); public:
}; 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();
#endif //__dialog_block_options_base__
};
#endif //__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