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

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
Loading
Loading
Loading
Loading
+28 −42
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ static bool blockIncludeItemsOnTechLayers = true;
static bool blockIncludeBoardOutlineLayer = true;
static bool blockIncludePcbTexts   = true;
static bool blockDrawItems = true;
static bool blockIncludeItemsOnInvisibleLayers = false;

/************************************/
/* class DIALOG_BLOCK_OPTIONS */
@@ -118,6 +119,7 @@ DIALOG_BLOCK_OPTIONS::DIALOG_BLOCK_OPTIONS( PCB_BASE_FRAME* aParent, const wxStr
    m_Include_Edges_Items->SetValue( blockIncludeBoardOutlineLayer );
    m_Include_PcbTextes->SetValue( blockIncludePcbTexts );
    m_DrawBlockItems->SetValue( blockDrawItems );
    m_checkBoxIncludeInvisible->SetValue( blockIncludeItemsOnInvisibleLayers );
    m_sdbSizer1OK->SetDefault();
    SetFocus();
    GetSizer()->SetSizeHints( this );
@@ -135,6 +137,7 @@ void DIALOG_BLOCK_OPTIONS::ExecuteCommand( wxCommandEvent& event )
    blockIncludeBoardOutlineLayer = m_Include_Edges_Items->GetValue();
    blockIncludePcbTexts   = m_Include_PcbTextes->GetValue();
    blockDrawItems = m_DrawBlockItems->GetValue();
    blockIncludeItemsOnInvisibleLayers = m_checkBoxIncludeInvisible->GetValue();

    EndModal( 0 );
}
@@ -297,8 +300,6 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
            // Exit if no items found
            if( !GetScreen()->m_BlockLocate.GetCount() )
                cancelCmd = true;
//            else
//                nextcmd = true;
        }
    }

@@ -399,8 +400,9 @@ void PCB_EDIT_FRAME::Block_SelectItems()
            int layer = module->GetLayer();

            if( module->HitTest( GetScreen()->m_BlockLocate )
                && ( !module->IsLocked() || blockIncludeLockedModules )
                && m_Pcb->IsModuleLayerVisible( layer ) )
                && ( !module->IsLocked() || blockIncludeLockedModules ) )
            {
                if( blockIncludeItemsOnInvisibleLayers || m_Pcb->IsModuleLayerVisible( layer ) )
                {
                    picker.m_PickedItem     = module;
                    picker.m_PickedItemType = module->Type();
@@ -408,6 +410,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
                }
            }
        }
    }

    // Add tracks and vias
    if( blockIncludeTracks )
@@ -415,8 +418,9 @@ void PCB_EDIT_FRAME::Block_SelectItems()
        for( TRACK* pt_segm = m_Pcb->m_Track; pt_segm != NULL;
             pt_segm = pt_segm->Next() )
        {
            if( pt_segm->HitTest( GetScreen()->m_BlockLocate )
                && m_Pcb->IsLayerVisible( pt_segm->GetLayer() ) )
            if( pt_segm->HitTest( GetScreen()->m_BlockLocate ) )
            {
                if( blockIncludeItemsOnInvisibleLayers || m_Pcb->IsLayerVisible( pt_segm->GetLayer() ) )
                {
                    picker.m_PickedItem     = pt_segm;
                    picker.m_PickedItemType = pt_segm->Type();
@@ -424,6 +428,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
                }
            }
        }
    }

    // Add graphic items
    masque_layer = EDGE_LAYER;
@@ -437,7 +442,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
    for( BOARD_ITEM* PtStruct = m_Pcb->m_Drawings; PtStruct != NULL;
         PtStruct = PtStruct->Next() )
    {
        if( !m_Pcb->IsLayerVisible( PtStruct->GetLayer() ) )
        if( !m_Pcb->IsLayerVisible( PtStruct->GetLayer() ) && ! blockIncludeItemsOnInvisibleLayers)
            continue;
        bool select_me = false;
        switch( PtStruct->Type() )
@@ -493,33 +498,13 @@ void PCB_EDIT_FRAME::Block_SelectItems()
    // Add zones
    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++ )
        {
            ZONE_CONTAINER* area = m_Pcb->GetArea( ii );

            if( area->HitTest( GetScreen()->m_BlockLocate )
                && m_Pcb->IsLayerVisible( area->GetLayer() ) )
            if( area->HitTest( GetScreen()->m_BlockLocate ) )
            {
                if( blockIncludeItemsOnInvisibleLayers || m_Pcb->IsLayerVisible( area->GetLayer() ) )
                {
                    BOARD_ITEM* zone_c = (BOARD_ITEM*) area;
                    picker.m_PickedItem     = zone_c;
@@ -529,6 +514,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
            }
        }
    }
}


static void drawPickedItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint aOffset )
+102 −93
Original line number Diff line number Diff line
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 18 2010)
// C++ code generated with wxFormBuilder (version Nov 17 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -26,6 +26,7 @@ DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent, wxWindow
	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->SetValue(true); 
	gSizer1->Add( m_Include_PcbTextes, 0, wxALL, 5 );
	
	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
	
	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 );
	
	m_sdbSizer1 = new wxStdDialogButtonSizer();
@@ -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_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_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_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()
	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_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_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BLOCK_OPTIONS_BASE::ExecuteCommand ), NULL, this );
	
+1020 −853
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@
            <property name="resize">Resizable</property>
            <property name="row"></property>
            <property name="show">1</property>
            <property name="size">397,171</property>
            <property name="size">397,226</property>
            <property name="style">wxDEFAULT_DIALOG_STYLE</property>
            <property name="subclass"></property>
            <property name="title"></property>
@@ -236,7 +236,7 @@
                                        <property name="caption"></property>
                                        <property name="caption_visible">1</property>
                                        <property name="center_pane">0</property>
                                        <property name="checked">0</property>
                                        <property name="checked">1</property>
                                        <property name="close_button">1</property>
                                        <property name="context_help"></property>
                                        <property name="context_menu">1</property>
@@ -819,6 +819,173 @@
                                </object>
                            </object>
                        </object>
                        <object class="sizeritem" expanded="1">
                            <property name="border">5</property>
                            <property name="flag">wxEXPAND | wxALL</property>
                            <property name="proportion">0</property>
                            <object class="wxStaticLine" expanded="1">
                                <property name="BottomDockable">1</property>
                                <property name="LeftDockable">1</property>
                                <property name="RightDockable">1</property>
                                <property name="TopDockable">1</property>
                                <property name="aui_name"></property>
                                <property name="bg"></property>
                                <property name="caption"></property>
                                <property name="caption_visible">1</property>
                                <property name="center_pane">0</property>
                                <property name="close_button">1</property>
                                <property name="context_help"></property>
                                <property name="context_menu">1</property>
                                <property name="default_pane">0</property>
                                <property name="dock">Dock</property>
                                <property name="dock_fixed">0</property>
                                <property name="docking">Left</property>
                                <property name="enabled">1</property>
                                <property name="fg"></property>
                                <property name="floatable">1</property>
                                <property name="font"></property>
                                <property name="gripper">0</property>
                                <property name="hidden">0</property>
                                <property name="id">wxID_ANY</property>
                                <property name="layer"></property>
                                <property name="maximize_button">0</property>
                                <property name="maximum_size"></property>
                                <property name="minimize_button">0</property>
                                <property name="minimum_size"></property>
                                <property name="moveable">1</property>
                                <property name="name">m_staticline1</property>
                                <property name="pane_border">1</property>
                                <property name="pane_position"></property>
                                <property name="pane_size"></property>
                                <property name="permission">protected</property>
                                <property name="pin_button">1</property>
                                <property name="pos"></property>
                                <property name="position"></property>
                                <property name="resize">Resizable</property>
                                <property name="row"></property>
                                <property name="show">1</property>
                                <property name="size"></property>
                                <property name="style">wxLI_HORIZONTAL</property>
                                <property name="subclass"></property>
                                <property name="toolbar_pane">0</property>
                                <property name="tooltip"></property>
                                <property name="validator_data_type"></property>
                                <property name="validator_style">wxFILTER_NONE</property>
                                <property name="validator_type">wxDefaultValidator</property>
                                <property name="validator_variable"></property>
                                <property name="window_extra_style"></property>
                                <property name="window_name"></property>
                                <property name="window_style"></property>
                                <event name="OnChar"></event>
                                <event name="OnEnterWindow"></event>
                                <event name="OnEraseBackground"></event>
                                <event name="OnKeyDown"></event>
                                <event name="OnKeyUp"></event>
                                <event name="OnKillFocus"></event>
                                <event name="OnLeaveWindow"></event>
                                <event name="OnLeftDClick"></event>
                                <event name="OnLeftDown"></event>
                                <event name="OnLeftUp"></event>
                                <event name="OnMiddleDClick"></event>
                                <event name="OnMiddleDown"></event>
                                <event name="OnMiddleUp"></event>
                                <event name="OnMotion"></event>
                                <event name="OnMouseEvents"></event>
                                <event name="OnMouseWheel"></event>
                                <event name="OnPaint"></event>
                                <event name="OnRightDClick"></event>
                                <event name="OnRightDown"></event>
                                <event name="OnRightUp"></event>
                                <event name="OnSetFocus"></event>
                                <event name="OnSize"></event>
                                <event name="OnUpdateUI"></event>
                            </object>
                        </object>
                        <object class="sizeritem" expanded="1">
                            <property name="border">5</property>
                            <property name="flag">wxALL</property>
                            <property name="proportion">0</property>
                            <object class="wxCheckBox" expanded="1">
                                <property name="BottomDockable">1</property>
                                <property name="LeftDockable">1</property>
                                <property name="RightDockable">1</property>
                                <property name="TopDockable">1</property>
                                <property name="aui_name"></property>
                                <property name="bg"></property>
                                <property name="caption"></property>
                                <property name="caption_visible">1</property>
                                <property name="center_pane">0</property>
                                <property name="checked">0</property>
                                <property name="close_button">1</property>
                                <property name="context_help"></property>
                                <property name="context_menu">1</property>
                                <property name="default_pane">0</property>
                                <property name="dock">Dock</property>
                                <property name="dock_fixed">0</property>
                                <property name="docking">Left</property>
                                <property name="enabled">1</property>
                                <property name="fg"></property>
                                <property name="floatable">1</property>
                                <property name="font"></property>
                                <property name="gripper">0</property>
                                <property name="hidden">0</property>
                                <property name="id">wxID_ANY</property>
                                <property name="label">Include items on invisible layers</property>
                                <property name="layer"></property>
                                <property name="maximize_button">0</property>
                                <property name="maximum_size"></property>
                                <property name="minimize_button">0</property>
                                <property name="minimum_size"></property>
                                <property name="moveable">1</property>
                                <property name="name">m_checkBoxIncludeInvisible</property>
                                <property name="pane_border">1</property>
                                <property name="pane_position"></property>
                                <property name="pane_size"></property>
                                <property name="permission">protected</property>
                                <property name="pin_button">1</property>
                                <property name="pos"></property>
                                <property name="position"></property>
                                <property name="resize">Resizable</property>
                                <property name="row"></property>
                                <property name="show">1</property>
                                <property name="size"></property>
                                <property name="style"></property>
                                <property name="subclass"></property>
                                <property name="toolbar_pane">0</property>
                                <property name="tooltip"></property>
                                <property name="validator_data_type"></property>
                                <property name="validator_style">wxFILTER_NONE</property>
                                <property name="validator_type">wxDefaultValidator</property>
                                <property name="validator_variable"></property>
                                <property name="window_extra_style"></property>
                                <property name="window_name"></property>
                                <property name="window_style"></property>
                                <event name="OnChar"></event>
                                <event name="OnCheckBox">checkBoxClicked</event>
                                <event name="OnEnterWindow"></event>
                                <event name="OnEraseBackground"></event>
                                <event name="OnKeyDown"></event>
                                <event name="OnKeyUp"></event>
                                <event name="OnKillFocus"></event>
                                <event name="OnLeaveWindow"></event>
                                <event name="OnLeftDClick"></event>
                                <event name="OnLeftDown"></event>
                                <event name="OnLeftUp"></event>
                                <event name="OnMiddleDClick"></event>
                                <event name="OnMiddleDown"></event>
                                <event name="OnMiddleUp"></event>
                                <event name="OnMotion"></event>
                                <event name="OnMouseEvents"></event>
                                <event name="OnMouseWheel"></event>
                                <event name="OnPaint"></event>
                                <event name="OnRightDClick"></event>
                                <event name="OnRightDown"></event>
                                <event name="OnRightUp"></event>
                                <event name="OnSetFocus"></event>
                                <event name="OnSize"></event>
                                <event name="OnUpdateUI"></event>
                            </object>
                        </object>
                    </object>
                </object>
                <object class="sizeritem" expanded="1">
+63 −60
Original line number Diff line number Diff line
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 18 2010)
// C++ code generated with wxFormBuilder (version Nov 17 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -17,6 +17,7 @@
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/statbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
@@ -40,6 +41,8 @@ class DIALOG_BLOCK_OPTIONS_BASE : public wxDialog
		wxCheckBox* m_Include_Edges_Items;
		wxCheckBox* m_Include_Zones;
		wxCheckBox* m_DrawBlockItems;
		wxStaticLine* m_staticline1;
		wxCheckBox* m_checkBoxIncludeInvisible;
		wxStdDialogButtonSizer* m_sdbSizer1;
		wxButton* m_sdbSizer1OK;
		wxButton* m_sdbSizer1Cancel;
@@ -52,7 +55,7 @@ class DIALOG_BLOCK_OPTIONS_BASE : public wxDialog
	
	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();
	
};
+1 −0
Original line number Diff line number Diff line
@@ -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_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_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_SHOW_VIAS_SKETCH, PCB_EDIT_FRAME::OnUpdateViaDrawMode )
    EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, PCB_EDIT_FRAME::OnUpdateTraceDrawMode )