Loading pcbnew/modedit.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -916,7 +916,7 @@ EDA_COLOR_T FOOTPRINT_EDIT_FRAME::GetGridColor() const } } void FOOTPRINT_EDIT_FRAME::SetActiveLayer( LAYER_NUM aLayer ) void FOOTPRINT_EDIT_FRAME::SetActiveLayer( LAYER_ID aLayer ) { { PCB_BASE_FRAME::SetActiveLayer( aLayer ); PCB_BASE_FRAME::SetActiveLayer( aLayer ); Loading pcbnew/module_editor_frame.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -399,7 +399,7 @@ public: virtual EDA_COLOR_T GetGridColor() const; virtual EDA_COLOR_T GetGridColor() const; ///> @copydoc PCB_BASE_FRAME::SetActiveLayer() ///> @copydoc PCB_BASE_FRAME::SetActiveLayer() void SetActiveLayer( LAYER_NUM aLayer ); void SetActiveLayer( LAYER_ID aLayer ); ///> @copydoc EDA_DRAW_FRAME::UseGalCanvas() ///> @copydoc EDA_DRAW_FRAME::UseGalCanvas() virtual void UseGalCanvas( bool aEnable ); virtual void UseGalCanvas( bool aEnable ); Loading pcbnew/moduleframe.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -271,6 +271,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : drawPanel->SetEventDispatcher( m_toolDispatcher ); drawPanel->SetEventDispatcher( m_toolDispatcher ); m_toolManager->RegisterTool( new SELECTION_TOOL ); m_toolManager->RegisterTool( new SELECTION_TOOL ); m_toolManager->GetTool<SELECTION_TOOL>()->EditModules( true ); m_toolManager->RegisterTool( new EDIT_TOOL ); m_toolManager->RegisterTool( new EDIT_TOOL ); m_toolManager->RegisterTool( new DRAWING_TOOL ); m_toolManager->RegisterTool( new DRAWING_TOOL ); m_toolManager->RegisterTool( new POINT_EDITOR ); m_toolManager->RegisterTool( new POINT_EDITOR ); Loading pcbnew/tools/selection_tool.cpp +12 −6 Original line number Original line Diff line number Diff line Loading @@ -54,7 +54,7 @@ SELECTION_TOOL::SELECTION_TOOL() : SelectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.selected" ), SelectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.selected" ), DeselectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.deselected" ), DeselectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.deselected" ), ClearedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.cleared" ), ClearedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.cleared" ), m_additive( false ), m_multiple( false ) m_additive( false ), m_multiple( false ), m_editModules( false ) { { m_selArea = new SELECTION_AREA; m_selArea = new SELECTION_AREA; m_selection.group = new KIGFX::VIEW_GROUP; m_selection.group = new KIGFX::VIEW_GROUP; Loading Loading @@ -189,6 +189,10 @@ bool SELECTION_TOOL::SelectSingle( const VECTOR2I& aWhere, bool aAllowDisambigua GENERAL_COLLECTOR collector; GENERAL_COLLECTOR collector; const KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, PCB_LINE_T, EOT }; // preferred types const KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, PCB_LINE_T, EOT }; // preferred types if( m_editModules ) collector.Collect( getModel<BOARD>(), GENERAL_COLLECTOR::ModulesAndTheirItems, wxPoint( aWhere.x, aWhere.y ), guide ); else collector.Collect( getModel<BOARD>(), GENERAL_COLLECTOR::AllBoardItems, collector.Collect( getModel<BOARD>(), GENERAL_COLLECTOR::AllBoardItems, wxPoint( aWhere.x, aWhere.y ), guide ); wxPoint( aWhere.x, aWhere.y ), guide ); Loading Loading @@ -532,23 +536,25 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem ) const case PCB_MODULE_T: case PCB_MODULE_T: if( aItem->IsOnLayer( F_Cu ) && board->IsElementVisible( MOD_FR_VISIBLE ) ) if( aItem->IsOnLayer( F_Cu ) && board->IsElementVisible( MOD_FR_VISIBLE ) ) return true; return !m_editModules; if( aItem->IsOnLayer( B_Cu ) && board->IsElementVisible( MOD_BK_VISIBLE ) ) if( aItem->IsOnLayer( B_Cu ) && board->IsElementVisible( MOD_BK_VISIBLE ) ) return true; return !m_editModules; return false; return false; break; break; case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T: if( m_multiple ) if( m_multiple && !m_editModules ) return false; return false; break; break; // These are not selectable // These are not selectable case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T: case PCB_PAD_T: case PCB_PAD_T: return m_editModules; case NOT_USED: case NOT_USED: case TYPE_NOT_INIT: case TYPE_NOT_INIT: return false; return false; Loading pcbnew/tools/selection_tool.h +14 −0 Original line number Original line Diff line number Diff line Loading @@ -139,6 +139,17 @@ public: */ */ void AddMenuItem( const TOOL_ACTION& aAction ); void AddMenuItem( const TOOL_ACTION& aAction ); /** * Function EditModules() * Toggles edit module mode. When enabled, one may select parts of modules individually * (graphics, pads, etc.), so they can be modified. * @param aEnabled decides if the mode should be enabled. */ void EditModules( bool aEnabled ) { m_editModules = aEnabled; } ///> Event sent after an item is selected. ///> Event sent after an item is selected. const TOOL_EVENT SelectedEvent; const TOOL_EVENT SelectedEvent; Loading Loading @@ -260,6 +271,9 @@ private: /// Right click popup menu /// Right click popup menu CONTEXT_MENU m_menu; CONTEXT_MENU m_menu; /// Edit module mode flag bool m_editModules; }; }; #endif #endif Loading
pcbnew/modedit.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -916,7 +916,7 @@ EDA_COLOR_T FOOTPRINT_EDIT_FRAME::GetGridColor() const } } void FOOTPRINT_EDIT_FRAME::SetActiveLayer( LAYER_NUM aLayer ) void FOOTPRINT_EDIT_FRAME::SetActiveLayer( LAYER_ID aLayer ) { { PCB_BASE_FRAME::SetActiveLayer( aLayer ); PCB_BASE_FRAME::SetActiveLayer( aLayer ); Loading
pcbnew/module_editor_frame.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -399,7 +399,7 @@ public: virtual EDA_COLOR_T GetGridColor() const; virtual EDA_COLOR_T GetGridColor() const; ///> @copydoc PCB_BASE_FRAME::SetActiveLayer() ///> @copydoc PCB_BASE_FRAME::SetActiveLayer() void SetActiveLayer( LAYER_NUM aLayer ); void SetActiveLayer( LAYER_ID aLayer ); ///> @copydoc EDA_DRAW_FRAME::UseGalCanvas() ///> @copydoc EDA_DRAW_FRAME::UseGalCanvas() virtual void UseGalCanvas( bool aEnable ); virtual void UseGalCanvas( bool aEnable ); Loading
pcbnew/moduleframe.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -271,6 +271,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : drawPanel->SetEventDispatcher( m_toolDispatcher ); drawPanel->SetEventDispatcher( m_toolDispatcher ); m_toolManager->RegisterTool( new SELECTION_TOOL ); m_toolManager->RegisterTool( new SELECTION_TOOL ); m_toolManager->GetTool<SELECTION_TOOL>()->EditModules( true ); m_toolManager->RegisterTool( new EDIT_TOOL ); m_toolManager->RegisterTool( new EDIT_TOOL ); m_toolManager->RegisterTool( new DRAWING_TOOL ); m_toolManager->RegisterTool( new DRAWING_TOOL ); m_toolManager->RegisterTool( new POINT_EDITOR ); m_toolManager->RegisterTool( new POINT_EDITOR ); Loading
pcbnew/tools/selection_tool.cpp +12 −6 Original line number Original line Diff line number Diff line Loading @@ -54,7 +54,7 @@ SELECTION_TOOL::SELECTION_TOOL() : SelectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.selected" ), SelectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.selected" ), DeselectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.deselected" ), DeselectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.deselected" ), ClearedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.cleared" ), ClearedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.cleared" ), m_additive( false ), m_multiple( false ) m_additive( false ), m_multiple( false ), m_editModules( false ) { { m_selArea = new SELECTION_AREA; m_selArea = new SELECTION_AREA; m_selection.group = new KIGFX::VIEW_GROUP; m_selection.group = new KIGFX::VIEW_GROUP; Loading Loading @@ -189,6 +189,10 @@ bool SELECTION_TOOL::SelectSingle( const VECTOR2I& aWhere, bool aAllowDisambigua GENERAL_COLLECTOR collector; GENERAL_COLLECTOR collector; const KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, PCB_LINE_T, EOT }; // preferred types const KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, PCB_LINE_T, EOT }; // preferred types if( m_editModules ) collector.Collect( getModel<BOARD>(), GENERAL_COLLECTOR::ModulesAndTheirItems, wxPoint( aWhere.x, aWhere.y ), guide ); else collector.Collect( getModel<BOARD>(), GENERAL_COLLECTOR::AllBoardItems, collector.Collect( getModel<BOARD>(), GENERAL_COLLECTOR::AllBoardItems, wxPoint( aWhere.x, aWhere.y ), guide ); wxPoint( aWhere.x, aWhere.y ), guide ); Loading Loading @@ -532,23 +536,25 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem ) const case PCB_MODULE_T: case PCB_MODULE_T: if( aItem->IsOnLayer( F_Cu ) && board->IsElementVisible( MOD_FR_VISIBLE ) ) if( aItem->IsOnLayer( F_Cu ) && board->IsElementVisible( MOD_FR_VISIBLE ) ) return true; return !m_editModules; if( aItem->IsOnLayer( B_Cu ) && board->IsElementVisible( MOD_BK_VISIBLE ) ) if( aItem->IsOnLayer( B_Cu ) && board->IsElementVisible( MOD_BK_VISIBLE ) ) return true; return !m_editModules; return false; return false; break; break; case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T: if( m_multiple ) if( m_multiple && !m_editModules ) return false; return false; break; break; // These are not selectable // These are not selectable case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T: case PCB_PAD_T: case PCB_PAD_T: return m_editModules; case NOT_USED: case NOT_USED: case TYPE_NOT_INIT: case TYPE_NOT_INIT: return false; return false; Loading
pcbnew/tools/selection_tool.h +14 −0 Original line number Original line Diff line number Diff line Loading @@ -139,6 +139,17 @@ public: */ */ void AddMenuItem( const TOOL_ACTION& aAction ); void AddMenuItem( const TOOL_ACTION& aAction ); /** * Function EditModules() * Toggles edit module mode. When enabled, one may select parts of modules individually * (graphics, pads, etc.), so they can be modified. * @param aEnabled decides if the mode should be enabled. */ void EditModules( bool aEnabled ) { m_editModules = aEnabled; } ///> Event sent after an item is selected. ///> Event sent after an item is selected. const TOOL_EVENT SelectedEvent; const TOOL_EVENT SelectedEvent; Loading Loading @@ -260,6 +271,9 @@ private: /// Right click popup menu /// Right click popup menu CONTEXT_MENU m_menu; CONTEXT_MENU m_menu; /// Edit module mode flag bool m_editModules; }; }; #endif #endif