From b21ce73c371d1e61e1817a1962e56ef530c824f5 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 6 Feb 2014 15:09:38 +0100 Subject: [PATCH] Initial version of the drawing tool. --- pcbnew/CMakeLists.txt | 1 + pcbnew/tools/common_actions.cpp | 4 ++++ pcbnew/tools/common_actions.h | 3 +++ pcbnew/tools/edit_tool.h | 3 +++ pcbnew/tools/pcb_tools.cpp | 3 +++ 5 files changed, 14 insertions(+) diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 8d7a842f55..e697375ec2 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -251,6 +251,7 @@ set( PCBNEW_CLASS_SRCS tools/selection_tool.cpp tools/selection_area.cpp tools/bright_box.cpp + tools/drawing_tool.cpp tools/edit_tool.cpp tools/pcb_tools.cpp tools/common_actions.cpp diff --git a/pcbnew/tools/common_actions.cpp b/pcbnew/tools/common_actions.cpp index f1fb3befd6..464a8ab505 100644 --- a/pcbnew/tools/common_actions.cpp +++ b/pcbnew/tools/common_actions.cpp @@ -56,3 +56,7 @@ TOOL_ACTION COMMON_ACTIONS::remove( "pcbnew.InteractiveEdit.remove", TOOL_ACTION COMMON_ACTIONS::properties( "pcbnew.InteractiveEdit.properties", AS_GLOBAL, 'E', "Properties...", "Displays properties window" ); + +TOOL_ACTION COMMON_ACTIONS::drawingLine( "pcbnew.InteractiveDrawing.line", + AS_GLOBAL, 'D', + "Draw a line", "Draw a line" ); diff --git a/pcbnew/tools/common_actions.h b/pcbnew/tools/common_actions.h index 86aafe5894..42a03b3cb3 100644 --- a/pcbnew/tools/common_actions.h +++ b/pcbnew/tools/common_actions.h @@ -56,4 +56,7 @@ public: /// Deleting a BOARD_ITEM static TOOL_ACTION remove; + + /// Activation of the drawing tool (line) + static TOOL_ACTION drawingLine; }; diff --git a/pcbnew/tools/edit_tool.h b/pcbnew/tools/edit_tool.h index d31b159aa5..49fbe48450 100644 --- a/pcbnew/tools/edit_tool.h +++ b/pcbnew/tools/edit_tool.h @@ -114,6 +114,9 @@ private: m_updateFlag = aFlag; } + ///> Updates ratsnest for selected items. + ///> @param aRedraw says if selected items should be drawn using the simple mode (e.g. one line + ///> per item). void updateRatsnest( bool aRedraw ); ///> Returns the right modification point (e.g. for rotation), depending on the number of diff --git a/pcbnew/tools/pcb_tools.cpp b/pcbnew/tools/pcb_tools.cpp index a4b4f21a24..63c98d5009 100644 --- a/pcbnew/tools/pcb_tools.cpp +++ b/pcbnew/tools/pcb_tools.cpp @@ -36,6 +36,7 @@ #include "selection_tool.h" #include "edit_tool.h" +#include "drawing_tool.h" #include "common_actions.h" #include @@ -54,11 +55,13 @@ void PCB_EDIT_FRAME::setupTools() m_toolManager->RegisterAction( &COMMON_ACTIONS::flip ); m_toolManager->RegisterAction( &COMMON_ACTIONS::remove ); m_toolManager->RegisterAction( &COMMON_ACTIONS::properties ); + m_toolManager->RegisterAction( &COMMON_ACTIONS::drawingLine ); // Register tools m_toolManager->RegisterTool( new SELECTION_TOOL ); m_toolManager->RegisterTool( new ROUTER_TOOL ); m_toolManager->RegisterTool( new EDIT_TOOL ); + m_toolManager->RegisterTool( new DRAWING_TOOL ); m_toolManager->SetEnvironment( NULL, GetGalCanvas()->GetView(), GetGalCanvas()->GetViewControls(), this );