Browse Source

PCB_TOOL: added convenience methods for accessing current SELECTION

pull/5/merge
Tomasz Włostowski 8 years ago
parent
commit
83b020d4da
  1. 14
      pcbnew/tools/pcb_tool.cpp
  2. 3
      pcbnew/tools/pcb_tool.h

14
pcbnew/tools/pcb_tool.cpp

@ -214,3 +214,17 @@ PCB_DRAW_PANEL_GAL* PCB_TOOL::canvas() const
{
return static_cast<PCB_DRAW_PANEL_GAL*>( frame()->GetGalCanvas() );
}
const SELECTION& PCB_TOOL::selection() const
{
auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const auto& selection = selTool->GetSelection();
return selection;
}
SELECTION& PCB_TOOL::selection()
{
auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
auto& selection = selTool->GetSelection();
return selection;
}

3
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;
};

Loading…
Cancel
Save