Loading pcbnew/moduleframe.cpp +3 −0 Original line number Original line Diff line number Diff line Loading @@ -278,8 +278,11 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_toolManager->RegisterTool( new DRAWING_TOOL ); m_toolManager->RegisterTool( new DRAWING_TOOL ); m_toolManager->RegisterTool( new POINT_EDITOR ); m_toolManager->RegisterTool( new POINT_EDITOR ); m_toolManager->RegisterTool( new PCBNEW_CONTROL ); m_toolManager->RegisterTool( new PCBNEW_CONTROL ); m_toolManager->GetTool<SELECTION_TOOL>()->EditModules( true ); m_toolManager->GetTool<SELECTION_TOOL>()->EditModules( true ); m_toolManager->GetTool<EDIT_TOOL>()->EditModules( true ); m_toolManager->GetTool<DRAWING_TOOL>()->EditModules( true ); m_toolManager->GetTool<DRAWING_TOOL>()->EditModules( true ); m_toolManager->ResetTools( TOOL_BASE::RUN ); m_toolManager->ResetTools( TOOL_BASE::RUN ); m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" ); m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" ); Loading pcbnew/tools/edit_tool.cpp +32 −3 Original line number Original line Diff line number Diff line Loading @@ -40,7 +40,7 @@ #include "edit_tool.h" #include "edit_tool.h" EDIT_TOOL::EDIT_TOOL() : EDIT_TOOL::EDIT_TOOL() : TOOL_INTERACTIVE( "pcbnew.InteractiveEdit" ), m_selectionTool( NULL ) TOOL_INTERACTIVE( "pcbnew.InteractiveEdit" ), m_selectionTool( NULL ), m_editModules( false ) { { } } Loading Loading @@ -448,11 +448,40 @@ void EDIT_TOOL::remove( BOARD_ITEM* aItem ) } } break; break; // These are not supposed to be removed // Default removal procedure case PCB_PAD_T: case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T: { if( m_editModules ) { TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( aItem ); switch( text->GetType() ) { case TEXTE_MODULE::TEXT_is_REFERENCE: DisplayError( getEditFrame<PCB_BASE_FRAME>(), _( "Cannot delete REFERENCE!" ) ); return; case TEXTE_MODULE::TEXT_is_VALUE: DisplayError( getEditFrame<PCB_BASE_FRAME>(), _( "Cannot delete VALUE!" ) ); return; } } } /* no break */ case PCB_PAD_T: case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T: if( m_editModules ) { MODULE* module = static_cast<MODULE*>( aItem->GetParent() ); module->SetLastEditTime(); board->m_Status_Pcb = 0; // it is done in the legacy view aItem->DeleteStructure(); } return; return; break; case PCB_LINE_T: // a segment not on copper layers case PCB_LINE_T: // a segment not on copper layers case PCB_TEXT_T: // a text on a layer case PCB_TEXT_T: // a text on a layer Loading pcbnew/tools/edit_tool.h +14 −0 Original line number Original line Diff line number Diff line Loading @@ -91,6 +91,17 @@ public: */ */ int Remove( TOOL_EVENT& aEvent ); int Remove( TOOL_EVENT& aEvent ); /** * 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; } private: private: ///> Selection tool used for obtaining selected items ///> Selection tool used for obtaining selected items SELECTION_TOOL* m_selectionTool; SELECTION_TOOL* m_selectionTool; Loading @@ -105,6 +116,9 @@ private: ///> of edit reference point). ///> of edit reference point). VECTOR2I m_cursor; VECTOR2I m_cursor; /// Edit module mode flag bool m_editModules; ///> Removes and frees a single BOARD_ITEM. ///> Removes and frees a single BOARD_ITEM. void remove( BOARD_ITEM* aItem ); void remove( BOARD_ITEM* aItem ); Loading Loading
pcbnew/moduleframe.cpp +3 −0 Original line number Original line Diff line number Diff line Loading @@ -278,8 +278,11 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_toolManager->RegisterTool( new DRAWING_TOOL ); m_toolManager->RegisterTool( new DRAWING_TOOL ); m_toolManager->RegisterTool( new POINT_EDITOR ); m_toolManager->RegisterTool( new POINT_EDITOR ); m_toolManager->RegisterTool( new PCBNEW_CONTROL ); m_toolManager->RegisterTool( new PCBNEW_CONTROL ); m_toolManager->GetTool<SELECTION_TOOL>()->EditModules( true ); m_toolManager->GetTool<SELECTION_TOOL>()->EditModules( true ); m_toolManager->GetTool<EDIT_TOOL>()->EditModules( true ); m_toolManager->GetTool<DRAWING_TOOL>()->EditModules( true ); m_toolManager->GetTool<DRAWING_TOOL>()->EditModules( true ); m_toolManager->ResetTools( TOOL_BASE::RUN ); m_toolManager->ResetTools( TOOL_BASE::RUN ); m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" ); m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" ); Loading
pcbnew/tools/edit_tool.cpp +32 −3 Original line number Original line Diff line number Diff line Loading @@ -40,7 +40,7 @@ #include "edit_tool.h" #include "edit_tool.h" EDIT_TOOL::EDIT_TOOL() : EDIT_TOOL::EDIT_TOOL() : TOOL_INTERACTIVE( "pcbnew.InteractiveEdit" ), m_selectionTool( NULL ) TOOL_INTERACTIVE( "pcbnew.InteractiveEdit" ), m_selectionTool( NULL ), m_editModules( false ) { { } } Loading Loading @@ -448,11 +448,40 @@ void EDIT_TOOL::remove( BOARD_ITEM* aItem ) } } break; break; // These are not supposed to be removed // Default removal procedure case PCB_PAD_T: case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T: { if( m_editModules ) { TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( aItem ); switch( text->GetType() ) { case TEXTE_MODULE::TEXT_is_REFERENCE: DisplayError( getEditFrame<PCB_BASE_FRAME>(), _( "Cannot delete REFERENCE!" ) ); return; case TEXTE_MODULE::TEXT_is_VALUE: DisplayError( getEditFrame<PCB_BASE_FRAME>(), _( "Cannot delete VALUE!" ) ); return; } } } /* no break */ case PCB_PAD_T: case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T: if( m_editModules ) { MODULE* module = static_cast<MODULE*>( aItem->GetParent() ); module->SetLastEditTime(); board->m_Status_Pcb = 0; // it is done in the legacy view aItem->DeleteStructure(); } return; return; break; case PCB_LINE_T: // a segment not on copper layers case PCB_LINE_T: // a segment not on copper layers case PCB_TEXT_T: // a text on a layer case PCB_TEXT_T: // a text on a layer Loading
pcbnew/tools/edit_tool.h +14 −0 Original line number Original line Diff line number Diff line Loading @@ -91,6 +91,17 @@ public: */ */ int Remove( TOOL_EVENT& aEvent ); int Remove( TOOL_EVENT& aEvent ); /** * 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; } private: private: ///> Selection tool used for obtaining selected items ///> Selection tool used for obtaining selected items SELECTION_TOOL* m_selectionTool; SELECTION_TOOL* m_selectionTool; Loading @@ -105,6 +116,9 @@ private: ///> of edit reference point). ///> of edit reference point). VECTOR2I m_cursor; VECTOR2I m_cursor; /// Edit module mode flag bool m_editModules; ///> Removes and frees a single BOARD_ITEM. ///> Removes and frees a single BOARD_ITEM. void remove( BOARD_ITEM* aItem ); void remove( BOARD_ITEM* aItem ); Loading