PCB_TOOL: added convenience methods for accessing current SELECTION

This commit is contained in:
Tomasz Włostowski 2017-11-30 17:21:28 +01:00
parent fa31d5308a
commit 83b020d4da
2 changed files with 17 additions and 0 deletions

View File

@ -214,3 +214,17 @@ PCB_DRAW_PANEL_GAL* PCB_TOOL::canvas() const
{ {
return static_cast<PCB_DRAW_PANEL_GAL*>( frame()->GetGalCanvas() ); 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;
}

View File

@ -47,6 +47,7 @@ class PCB_TOOL;
class PCB_EDIT_FRAME; class PCB_EDIT_FRAME;
class PCB_DISPLAY_OPTIONS; class PCB_DISPLAY_OPTIONS;
class PCB_DRAW_PANEL_GAL; class PCB_DRAW_PANEL_GAL;
class SELECTION;
struct INTERACTIVE_PLACER_BASE struct INTERACTIVE_PLACER_BASE
{ {
@ -135,6 +136,8 @@ protected:
MODULE* module() const { return board()->m_Modules; } MODULE* module() const { return board()->m_Modules; }
PCB_DISPLAY_OPTIONS* displayOptions() const; PCB_DISPLAY_OPTIONS* displayOptions() const;
PCB_DRAW_PANEL_GAL* canvas() const; PCB_DRAW_PANEL_GAL* canvas() const;
const SELECTION& selection() const;
SELECTION& selection();
bool m_editModules; bool m_editModules;
}; };