From 83b020d4da0627bd8b5618cae14d1270eed9e6e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= Date: Thu, 30 Nov 2017 17:21:28 +0100 Subject: [PATCH] PCB_TOOL: added convenience methods for accessing current SELECTION --- pcbnew/tools/pcb_tool.cpp | 14 ++++++++++++++ pcbnew/tools/pcb_tool.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/pcbnew/tools/pcb_tool.cpp b/pcbnew/tools/pcb_tool.cpp index 26640cf31b..0347ca7ece 100644 --- a/pcbnew/tools/pcb_tool.cpp +++ b/pcbnew/tools/pcb_tool.cpp @@ -214,3 +214,17 @@ PCB_DRAW_PANEL_GAL* PCB_TOOL::canvas() const { return static_cast( frame()->GetGalCanvas() ); } + +const SELECTION& PCB_TOOL::selection() const +{ + auto selTool = m_toolMgr->GetTool(); + const auto& selection = selTool->GetSelection(); + return selection; +} + +SELECTION& PCB_TOOL::selection() +{ + auto selTool = m_toolMgr->GetTool(); + auto& selection = selTool->GetSelection(); + return selection; +} diff --git a/pcbnew/tools/pcb_tool.h b/pcbnew/tools/pcb_tool.h index 5306214194..b00ea8b711 100644 --- a/pcbnew/tools/pcb_tool.h +++ b/pcbnew/tools/pcb_tool.h @@ -47,6 +47,7 @@ class PCB_TOOL; class PCB_EDIT_FRAME; class PCB_DISPLAY_OPTIONS; class PCB_DRAW_PANEL_GAL; +class SELECTION; struct INTERACTIVE_PLACER_BASE { @@ -135,6 +136,8 @@ protected: MODULE* module() const { return board()->m_Modules; } PCB_DISPLAY_OPTIONS* displayOptions() const; PCB_DRAW_PANEL_GAL* canvas() const; + const SELECTION& selection() const; + SELECTION& selection(); bool m_editModules; };