KiCad PCB EDA Suite
PAD_TOOL Class Reference

Class PAD_TOOL. More...

#include <pad_tool.h>

Inheritance diagram for PAD_TOOL:
PCB_TOOL TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 PAD_TOOL ()
 
 ~PAD_TOOL ()
 
void Reset (RESET_REASON aReason) override
 

React to model/view changes

More...
 
bool Init () override
 

Basic initalization

More...
 
void SetTransitions () override
 

Bind handlers to corresponding TOOL_ACTIONs

More...
 
void SetEditModules (bool aEnabled)
 Function SetEditModules() More...
 
bool EditingModules () const
 
void Activate ()
 Function Activate() Runs the tool. More...
 
void SetContextMenu (CONTEXT_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Function SetContextMenu() More...
 
void RunMainStack (std::function< void()> aFunc)
 Function RunMainStack() More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Go() More...
 
OPT_TOOL_EVENT Wait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Wait() More...
 
TOOL_TYPE GetType () const
 Function GetType() Returns the type of the tool. More...
 
TOOL_ID GetId () const
 Function GetId() Returns the unique identifier of the tool. More...
 
const std::string & GetName () const
 Function GetName() Returns the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool. More...
 
TOOL_SETTINGSGetSettings ()
 

Protected Types

enum  INTERACTIVE_PLACEMENT_OPTIONS {
  IPO_ROTATE = 1, IPO_FLIP = 2, IPO_PROPERTIES = 4, IPO_SINGLE_CLICK = 8,
  IPO_REPEAT = 16
}
 

Protected Member Functions

void doInteractiveItemPlacement (INTERACTIVE_PLACER_BASE *aPlacer, const wxString &aCommitMessage, int aOptions=IPO_ROTATE|IPO_FLIP|IPO_REPEAT)
 Helper function for performing a common interactive idiom: wait for a left click, place an item there (perhaps with a dialog or other user interaction), then have it move with the mouse and respond to rotate/flip, etc. More...
 
KIGFX::VIEWview () const
 
KIGFX::VIEW_CONTROLScontrols () const
 
PCB_EDIT_FRAMEframe () const
 
BOARDboard () const
 
const TOOL_EVENT evActivate (std::string aToolName="")
 functions below are not yet implemented - their interface may change More...
 
const TOOL_EVENT evCommand (int aCommandId=-1)
 
const TOOL_EVENT evCommand (std::string aCommandStr="")
 
const TOOL_EVENT evMotion ()
 
const TOOL_EVENT evClick (int aButton=BUT_ANY)
 
const TOOL_EVENT evDrag (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonUp (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonDown (int aButton=BUT_ANY)
 
void attachManager (TOOL_MANAGER *aManager)
 Function attachManager() More...
 
KIGFX::VIEWgetView () const
 Function getView() More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Function getViewControls() More...
 
template<typename T >
T * getEditFrame () const
 Function getEditFrame() More...
 
template<typename T >
T * getModel () const
 Function getModel() More...
 

Protected Attributes

bool m_editModules
 
TOOL_TYPE m_type
 

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

Unique identifier for the tool, assigned by a TOOL_MANAGER instance.

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 
TOOL_SETTINGS m_toolSettings
 

Private Member Functions

bool haveFootprints ()
 

Determine if there are any footprints on the board

More...
 
int applyPadSettings (const TOOL_EVENT &aEvent)
 

Apply pad settings from board design settings to a pad

More...
 
int copyPadSettings (const TOOL_EVENT &aEvent)
 

Copy pad settings from a pad to the board design settings

More...
 
int pushPadSettings (const TOOL_EVENT &aEvent)
 

Push pad settings from a pad to other pads on board or module

More...
 

Private Attributes

bool m_padCopied
 

Flag to indicate there are valid settings stored in the Master Pad object

More...
 

Detailed Description

Class PAD_TOOL.

Tools relating to pads and pad settings

Definition at line 37 of file pad_tool.h.

Member Enumeration Documentation

enum PCB_TOOL::INTERACTIVE_PLACEMENT_OPTIONS
protectedinherited
Enumerator
IPO_ROTATE 
IPO_FLIP 
IPO_PROPERTIES 
IPO_SINGLE_CLICK 
IPO_REPEAT 

Definition at line 98 of file pcb_tool.h.

enum TOOL_BASE::RESET_REASON
inherited

Determines the reason of reset for a tool

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 80 of file tool_base.h.

81  {
82  RUN,
83  MODEL_RELOAD,
84  GAL_SWITCH
85  };
Model changes (required full reload)
Definition: tool_base.h:83
Tool is invoked after being inactive.
Definition: tool_base.h:82
Rendering engine changes.
Definition: tool_base.h:84

Constructor & Destructor Documentation

PAD_TOOL::PAD_TOOL ( )

Definition at line 147 of file pad_tool.cpp.

147  :
148  PCB_TOOL( "pcbnew.PadTool" ), m_padCopied( false )
149 {
150 }
bool m_padCopied
Flag to indicate there are valid settings stored in the Master Pad object
Definition: pad_tool.h:66
PCB_TOOL(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool.h:65
PAD_TOOL::~PAD_TOOL ( )

Definition at line 153 of file pad_tool.cpp.

154 {}

Member Function Documentation

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

After activation, the tool starts receiving events until it is finished.

Definition at line 49 of file tool_interactive.cpp.

References TOOL_MANAGER::InvokeTool(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

Referenced by MODULE_EDITOR_TOOLS::CopyItems(), PCBNEW_CONTROL::DeleteItemCursor(), PCB_TOOL::doInteractiveItemPlacement(), ROUTER_TOOL::DpDimensionsDialog(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), MODULE_EDITOR_TOOLS::PasteItems(), DRAWING_TOOL::PlaceDXF(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), ROUTER_TOOL::SettingsDialog(), and PCB_EDITOR_CONTROL::ShowLocalRatsnest().

50 {
52 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:220
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:215
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID...
int PAD_TOOL::applyPadSettings ( const TOOL_EVENT aEvent)
private

Apply pad settings from board design settings to a pad

Definition at line 202 of file pad_tool.cpp.

References PCB_TOOL::frame(), PCB_BASE_FRAME::GetDesignSettings(), SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), D_PAD::ImportSettingsFromMaster(), BOARD_DESIGN_SETTINGS::m_Pad_Master, TOOL_BASE::m_toolMgr, COMMIT::Modify(), PCB_PAD_T, BOARD_COMMIT::Push(), TOOL_MANAGER::RunAction(), and PCB_ACTIONS::selectionModified.

Referenced by SetTransitions().

203 {
204  auto& selTool = *m_toolMgr->GetTool<SELECTION_TOOL>();
205  const auto& selection = selTool.GetSelection();
206 
207  auto& frame = *getEditFrame<PCB_EDIT_FRAME>();
208 
209  const D_PAD& masterPad = frame.GetDesignSettings().m_Pad_Master;
210 
211  BOARD_COMMIT commit( &frame );
212 
213  // for every selected pad, copy global settings
214  for( auto item : selection )
215  {
216  if( item->Type() == PCB_PAD_T )
217  {
218  commit.Modify( item );
219 
220  D_PAD& destPad = static_cast<D_PAD&>( *item );
221  destPad.ImportSettingsFromMaster( masterPad );
222  }
223  }
224 
225  commit.Push( _( "Apply Pad Settings" ) );
226 
228  frame.Refresh();
229 
230  return 0;
231 }
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:220
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
class D_PAD, a pad in a footprint
Definition: typeinfo.h:102
static TOOL_ACTION selectionModified
Modified selection notification.
Definition: pcb_actions.h:105
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:125
SELECTION & GetSelection()
Function GetSelection()
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
void ImportSettingsFromMaster(const D_PAD &aMasterPad)
Imports the pad settings from aMasterPad.
Definition: class_pad.cpp:1284
D_PAD m_Pad_Master
A dummy pad to store all default parameters.
void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

Sets the TOOL_MANAGER the tool will belong to. Called by TOOL_MANAGER::RegisterTool()

Definition at line 54 of file tool_base.cpp.

References TOOL_BASE::m_toolMgr, TOOL_BASE::m_toolSettings, and TOOL_BASE::TOOL_SETTINGS.

Referenced by TOOL_MANAGER::RegisterTool().

55 {
56  m_toolMgr = aManager;
57  m_toolSettings = TOOL_SETTINGS( this );
58 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:220
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:221
friend class TOOL_SETTINGS
Definition: tool_base.h:160
KIGFX::VIEW_CONTROLS* PCB_TOOL::controls ( ) const
inlineprotectedinherited
int PAD_TOOL::copyPadSettings ( const TOOL_EVENT aEvent)
private

Copy pad settings from a pad to the board design settings

Definition at line 234 of file pad_tool.cpp.

References PCB_TOOL::frame(), PCB_BASE_FRAME::GetDesignSettings(), SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), D_PAD::ImportSettingsFromMaster(), BOARD_DESIGN_SETTINGS::m_Pad_Master, m_padCopied, TOOL_BASE::m_toolMgr, and PCB_PAD_T.

Referenced by SetTransitions().

235 {
236  auto& selTool = *m_toolMgr->GetTool<SELECTION_TOOL>();
237  const auto& selection = selTool.GetSelection();
238 
239  auto& frame = *getEditFrame<PCB_EDIT_FRAME>();
240 
241  D_PAD& masterPad = frame.GetDesignSettings().m_Pad_Master;
242 
243  // can only copy from a single pad
244  if( selection.Size() == 1 )
245  {
246  auto item = selection[0];
247 
248  if( item->Type() == PCB_PAD_T )
249  {
250  const auto& selPad = static_cast<const D_PAD&>( *item );
251  masterPad.ImportSettingsFromMaster( selPad );
252  m_padCopied = true;
253  }
254  }
255 
256  return 0;
257 }
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:220
bool m_padCopied
Flag to indicate there are valid settings stored in the Master Pad object
Definition: pad_tool.h:66
class D_PAD, a pad in a footprint
Definition: typeinfo.h:102
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:125
SELECTION & GetSelection()
Function GetSelection()
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
void ImportSettingsFromMaster(const D_PAD &aMasterPad)
Imports the pad settings from aMasterPad.
Definition: class_pad.cpp:1284
D_PAD m_Pad_Master
A dummy pad to store all default parameters.
void PCB_TOOL::doInteractiveItemPlacement ( INTERACTIVE_PLACER_BASE aPlacer,
const wxString &  aCommitMessage,
int  aOptions = IPO_ROTATE | IPO_FLIP | IPO_REPEAT 
)
protectedinherited

Helper function for performing a common interactive idiom: wait for a left click, place an item there (perhaps with a dialog or other user interaction), then have it move with the mouse and respond to rotate/flip, etc.

More complex interactive processes are not supported here, you should implement a customised event loop for those.

Parameters
aItemCreatorthe callable that will attempt to create the item
aCommitMessagethe message used on a successful commit

Definition at line 38 of file pcb_tool.cpp.

References TOOL_INTERACTIVE::Activate(), KIGFX::VIEW_GROUP::Add(), SELECTION::Add(), COMMIT::Add(), KIGFX::VIEW::Add(), PCB_TOOL::board(), BUT_LEFT, KIGFX::VIEW_CONTROLS::CaptureCursor(), SELECTION::Clear(), PCB_TOOL::controls(), INTERACTIVE_PLACER_BASE::CreateItem(), dyn_cast(), PCB_ACTIONS::flip, PCB_TOOL::frame(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_EVT_UTILS::GetEventRotationAngle(), TOOL_BASE::GetManager(), PCB_TOOL::IPO_FLIP, PCB_TOOL::IPO_REPEAT, PCB_TOOL::IPO_ROTATE, PCB_TOOL::IPO_SINGLE_CLICK, TOOL_EVT_UTILS::IsCancelInteractive(), TOOL_EVT_UTILS::IsRotateToolEvt(), INTERACTIVE_PLACER_BASE::m_board, INTERACTIVE_PLACER_BASE::m_frame, PCB_MODULE_T, INTERACTIVE_PLACER_BASE::PlaceItem(), BOARD_COMMIT::Push(), KIGFX::VIEW_GROUP::Remove(), SELECTION::Remove(), KIGFX::VIEW::Remove(), TOOL_MANAGER::RunAction(), MODULE::RunOnChildren(), PCB_ACTIONS::selectionClear, KIGFX::VIEW_CONTROLS::SetAutoPan(), KIGFX::VIEW_CONTROLS::SetSnapping(), KIGFX::VIEW_CONTROLS::ShowCursor(), TC_COMMAND, KIGFX::VIEW::Update(), PCB_TOOL::view(), TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by MICROWAVE_TOOL::addMicrowaveFootprint(), DRAWING_TOOL::DrawVia(), and MODULE_EDITOR_TOOLS::PlacePad().

41 {
42  using namespace std::placeholders;
43  std::unique_ptr<BOARD_ITEM> newItem;
44 
45  Activate();
46 
47  BOARD_COMMIT commit( frame() );
48 
50 
51  // do not capture or auto-pan until we start placing an item
52  controls()->ShowCursor( true );
53  controls()->SetSnapping( true );
54 
55  // Add a VIEW_GROUP that serves as a preview for the new item
56  SELECTION preview;
57  view()->Add( &preview );
58 
59  aPlacer->m_board = board();
60  aPlacer->m_frame = frame();
61 
62  if( aOptions & IPO_SINGLE_CLICK )
63  {
64  VECTOR2I cursorPos = controls()->GetCursorPosition();
65 
66  newItem = aPlacer->CreateItem();
67  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
68 
69  preview.Add( newItem.get() );
70  }
71 
72  // Main loop: keep receiving events
73  while( OPT_TOOL_EVENT evt = Wait() )
74  {
75  VECTOR2I cursorPos = controls()->GetCursorPosition();
76 
78  {
79  if( newItem )
80  {
81  // Delete the old item and have another try
82  newItem = nullptr;
83 
84  preview.Clear();
85 
86  if( aOptions & IPO_SINGLE_CLICK )
87  break;
88 
89  controls()->SetAutoPan( false );
90  controls()->CaptureCursor( false );
91  controls()->ShowCursor( true );
92  }
93  else
94  {
95  break;
96  }
97 
98  if( evt->IsActivate() ) // now finish unconditionally
99  break;
100  }
101 
102  else if( evt->IsClick( BUT_LEFT ) )
103  {
104  if( !newItem )
105  {
106  // create the item if possible
107  newItem = aPlacer->CreateItem();
108 
109  // no item created, so wait for another click
110  if( !newItem )
111  continue;
112 
113  controls()->CaptureCursor( true );
114  controls()->SetAutoPan( true );
115 
116  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
117 
118  preview.Add( newItem.get() );
119 
120  if( newItem->Type() == PCB_MODULE_T )
121  {
122  auto module = dyn_cast<MODULE*>( newItem.get() );
123 
124  // modules have more drawable parts
125  module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
126  }
127  }
128  else
129  {
130  newItem->ClearFlags();
131  preview.Remove( newItem.get() );
132 
133  aPlacer->PlaceItem( newItem.get() );
134 
135  if( newItem->Type() == PCB_MODULE_T )
136  {
137  auto module = dyn_cast<MODULE*>( newItem.get() );
138  module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Remove, &preview, _1 ) );
139  }
140 
141  commit.Add( newItem.release() );
142  commit.Push( aCommitMessage );
143 
144  controls()->CaptureCursor( false );
145  controls()->SetAutoPan( false );
146  controls()->ShowCursor( true );
147 
148  if( !( aOptions & IPO_REPEAT ) )
149  break;
150 
151  if( aOptions & IPO_SINGLE_CLICK )
152  {
154 
155  newItem = aPlacer->CreateItem();
156  newItem->SetPosition( wxPoint( pos.x, pos.y ) );
157 
158  preview.Add( newItem.get() );
159  }
160  }
161  }
162 
163  else if( newItem && evt->Category() == TC_COMMAND )
164  {
165  /*
166  * Handle any events that can affect the item as we move
167  * it around, eg rotate and flip
168  */
169 
170  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) && ( aOptions & IPO_ROTATE ) )
171  {
172  const auto rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle(
173  *frame(), *evt );
174  newItem->Rotate( newItem->GetPosition(), rotationAngle );
175  view()->Update( &preview );
176  }
177  else if( evt->IsAction( &PCB_ACTIONS::flip ) && ( aOptions & IPO_FLIP ) )
178  {
179  newItem->Flip( newItem->GetPosition() );
180  view()->Update( &preview );
181  }
182  }
183 
184  else if( newItem && evt->IsMotion() )
185  {
186  // track the cursor
187  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
188 
189  // Show a preview of the item
190  view()->Update( &preview );
191  }
192  }
193 
194  view()->Remove( &preview );
195 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
KIGFX::VIEW * view() const
Definition: pcb_tool.h:123
void RunOnChildren(std::function< void(BOARD_ITEM *)> aFunction)
Function RunOnChildren.
virtual void Clear() override
Function Clear() Removes all the stored items from the group.
Definition: selection.h:81
virtual bool PlaceItem(BOARD_ITEM *aItem)
Definition: pcb_tool.h:51
virtual std::unique_ptr< BOARD_ITEM > CreateItem()=0
void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:341
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
PCB_EDIT_FRAME * m_frame
Definition: pcb_tool.h:53
bool IsRotateToolEvt(const TOOL_EVENT &aEvt)
Function isRotateToolEvt()
Casted dyn_cast(From aObject)
Function dyn_cast()
Definition: typeinfo.h:73
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:71
KIGFX::VIEW_CONTROLS * controls() const
Definition: pcb_tool.h:124
class MODULE, a footprint
Definition: typeinfo.h:101
virtual VECTOR2D GetCursorPosition() const =0
Function GetCursorPosition() Returns the current cursor position in world coordinates.
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area. ...
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:125
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes an item from the group.
Definition: view_group.cpp:61
bool IsCancelInteractive(const TOOL_EVENT &aEvt)
Function IsCancelInteractive()
virtual void Add(VIEW_ITEM *aItem)
Function Add() Adds an item to the group.
Definition: view_group.cpp:55
void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1385
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg...
static TOOL_ACTION flip
Flipping of selected objects.
Definition: pcb_actions.h:96
TOOL_MANAGER * GetManager() const
Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool...
Definition: tool_base.h:144
void Activate()
Function Activate() Runs the tool.
void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:311
int GetEventRotationAngle(const PCB_BASE_EDIT_FRAME &aFrame, const TOOL_EVENT &aEvt)
Function getEventRotationAngle()
BOARD * board() const
Definition: pcb_tool.h:126
virtual void Remove(EDA_ITEM *aItem)
Definition: selection.h:76
bool PCB_TOOL::EditingModules ( ) const
inlineinherited

Definition at line 91 of file pcb_tool.h.

References PCB_TOOL::m_editModules.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), Init(), and EDIT_TOOL::MeasureTool().

92  {
93  return m_editModules;
94  }
bool m_editModules
Definition: pcb_tool.h:128
const TOOL_EVENT TOOL_INTERACTIVE::evActivate ( std::string  aToolName = "")
protectedinherited

functions below are not yet implemented - their interface may change

const TOOL_EVENT TOOL_INTERACTIVE::evButtonDown ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evButtonUp ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evClick ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( int  aCommandId = -1)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( std::string  aCommandStr = "")
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evDrag ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evMotion ( )
protectedinherited
template<typename T >
T* TOOL_BASE::getEditFrame ( ) const
inlineprotectedinherited

Function getEditFrame()

Returns the application window object, casted to requested user type.

Definition at line 193 of file tool_base.h.

References TOOL_BASE::getEditFrameInt().

Referenced by ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), TOOL_SETTINGS::getConfigBase(), and ZONE_CREATE_HELPER::performZoneCutout().

194  {
195  return static_cast<T*>( getEditFrameInt() );
196  }
T
enum T contains all this lexer's tokens.
wxWindow * getEditFrameInt() const
Definition: tool_base.cpp:42
TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Function GetId() Returns the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 122 of file tool_base.h.

References TOOL_BASE::m_toolId.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::isActive(), TOOL_MANAGER::RegisterTool(), ACTION_MANAGER::RunHotKey(), and TOOL_MANAGER::runTool().

123  {
124  return m_toolId;
125  }
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:215
TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER. If there is no TOOL_MANAGER associated, it returns NULL.

Definition at line 144 of file tool_base.h.

References TOOL_BASE::m_toolMgr.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), PCB_TOOL::doInteractiveItemPlacement(), CONTEXT_MENU::getToolManager(), EDIT_TOOL::MeasureTool(), and CONTEXT_MENU::onMenuEvent().

145  {
146  return m_toolMgr;
147  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:220
template<typename T >
T* TOOL_BASE::getModel ( ) const
inlineprotectedinherited

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 204 of file tool_base.h.

References TOOL_BASE::getModelInt().

Referenced by ZONE_CREATE_HELPER::createNewZone(), ZONE_CREATE_HELPER::createZoneFromExisting(), and ZONE_CREATE_HELPER::performZoneCutout().

205  {
206  EDA_ITEM* m = getModelInt();
207 
208  return static_cast<T*>( m );
209  }
T
enum T contains all this lexer's tokens.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:48
const std::string& TOOL_BASE::GetName ( void  ) const
inlineinherited

Function GetName() Returns the name of the tool.

Tool names are expected to obey the format: application.ToolName (eg. pcbnew.InteractiveSelection).

Returns
The name of the tool.

Definition at line 133 of file tool_base.h.

References TOOL_BASE::m_toolName.

Referenced by TOOL_SETTINGS::getKeyName(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::invokeTool(), and TOOL_MANAGER::RegisterTool().

134  {
135  return m_toolName;
136  }
std::string m_toolName
Name of the tool.
Definition: tool_base.h:219
TOOL_SETTINGS & TOOL_BASE::GetSettings ( )
inherited

Definition at line 72 of file tool_base.cpp.

References TOOL_BASE::m_toolSettings.

Referenced by ROUTER_TOOL::Init(), SELECTION_TOOL::selectable(), and ROUTER_TOOL::~ROUTER_TOOL().

73 {
74  return m_toolSettings;
75 }
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:221
TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 111 of file tool_base.h.

References TOOL_BASE::m_type.

Referenced by TOOL_MANAGER::InvokeTool(), and TOOL_MANAGER::runTool().

112  {
113  return m_type;
114  }
TOOL_TYPE m_type
Stores the type of the tool.
Definition: tool_base.h:212
KIGFX::VIEW * TOOL_BASE::getView ( ) const
protectedinherited

Function getView()

Returns the instance of VIEW object used in the application. It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 30 of file tool_base.cpp.

References TOOL_MANAGER::GetView(), and TOOL_BASE::m_toolMgr.

Referenced by PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), PCBNEW_CONTROL::CursorControl(), SELECTION_TOOL::disambiguationMenu(), MICROWAVE_TOOL::drawMicrowaveInductor(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findCallback(), ROUTER_TOOL::getStartLayer(), PCBNEW_CONTROL::GridSetOrigin(), PCBNEW_CONTROL::HighContrastMode(), PNS::TOOL_BASE::highlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), EDIT_TOOL::Main(), EDIT_TOOL::MeasureTool(), MODULE_EDITOR_TOOLS::ModuleEdgeOutlines(), MODULE_EDITOR_TOOLS::ModuleTextOutlines(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), PCBNEW_CONTROL::PadDisplayMode(), PCBNEW_CONTROL::PanControl(), PNS::TOOL_BASE::pickSingleItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), PCB_EDITOR_CONTROL::Reset(), PCBNEW_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), DRAWING_TOOL::Reset(), SELECTION_TOOL::Reset(), SELECTION_TOOL::selectable(), SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), PCBNEW_CONTROL::TrackDisplayMode(), POINT_EDITOR::updateEditedPoint(), COMMON_TOOLS::updateGrid(), PCBNEW_CONTROL::updateGrid(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), PCBNEW_CONTROL::ViaDisplayMode(), PCB_TOOL::view(), PCBNEW_CONTROL::ZoneDisplayMode(), COMMON_TOOLS::ZoomFitScreen(), SELECTION_TOOL::zoomFitSelection(), COMMON_TOOLS::ZoomInOutCenter(), and SELECTION_TOOL::~SELECTION_TOOL().

31 {
32  return m_toolMgr->GetView();
33 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:220
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:243
KIGFX::VIEW_CONTROLS * TOOL_BASE::getViewControls ( ) const
protectedinherited

Function getViewControls()

Returns the instance of VIEW_CONTROLS object used in the application. It allows tools to read & modify user input and its settings (eg. show cursor, enable snapping to grid, etc.)

Returns
The instance of VIEW_CONTROLS.

Definition at line 36 of file tool_base.cpp.

References TOOL_MANAGER::GetViewControls(), and TOOL_BASE::m_toolMgr.

Referenced by POINT_EDITOR::addCorner(), PCBNEW_CONTROL::AppendBoard(), PCB_TOOL::controls(), MODULE_EDITOR_TOOLS::CopyItems(), PCBNEW_CONTROL::CursorControl(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawZone(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findMove(), EDIT_TOOL::getModificationPoint(), PCB_EDITOR_CONTROL::HighlightNet(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), ROUTER_TOOL::mainLoop(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), MODULE_EDITOR_TOOLS::PasteItems(), ROUTER_TOOL::performDragging(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), PNS::TOOL_BASE::Reset(), DRAWING_TOOL::Reset(), PCBNEW_CONTROL::ResetCoords(), DRAWING_TOOL::runPolygonEventLoop(), SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), PICKER_TOOL::setControls(), POINT_EDITOR::setEditedPoint(), COMMON_TOOLS::ZoomCenter(), and COMMON_TOOLS::ZoomInOut().

37 {
38  return m_toolMgr->GetViewControls();
39 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:220
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:248
template<class T >
void TOOL_INTERACTIVE::Go ( int(T::*)(const TOOL_EVENT &)  aStateFunc,
const TOOL_EVENT_LIST aConditions = TOOL_EVENTTC_ANYTA_ANY ) 
)
inherited

Function Go()

Defines which state (aStateFunc) to go when a certain event arrives (aConditions). No conditions means any event.

Definition at line 122 of file tool_interactive.h.

References TOOL_INTERACTIVE::goInternal().

Referenced by LENGTH_TUNER_TOOL::Reset(), ZOOM_TOOL::SetTransitions(), LENGTH_TUNER_TOOL::SetTransitions(), ROUTER_TOOL::SetTransitions(), SetTransitions(), MICROWAVE_TOOL::SetTransitions(), POINT_EDITOR::SetTransitions(), COMMON_TOOLS::SetTransitions(), ALIGN_DISTRIBUTE_TOOL::SetTransitions(), PCBNEW_CONTROL::SetTransitions(), POSITION_RELATIVE_TOOL::SetTransitions(), MODULE_EDITOR_TOOLS::SetTransitions(), PICKER_TOOL::SetTransitions(), PCB_EDITOR_CONTROL::SetTransitions(), EDIT_TOOL::SetTransitions(), SELECTION_TOOL::SetTransitions(), and DRAWING_TOOL::SetTransitions().

124 {
125  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
126 
127  goInternal( sptr, aConditions );
128 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:59
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)
bool PAD_TOOL::haveFootprints ( )
private

Determine if there are any footprints on the board

Definition at line 163 of file pad_tool.cpp.

References PCB_TOOL::board(), DHEAD::GetCount(), and BOARD::m_Modules.

Referenced by Init().

164 {
165  auto& board = *getModel<BOARD>();
166  return board.m_Modules.GetCount() > 0;
167 }
DLIST< MODULE > m_Modules
Definition: class_board.h:245
unsigned GetCount() const
Function GetCount returns the number of elements in the list.
Definition: dlist.h:126
BOARD * board() const
Definition: pcb_tool.h:126
bool PAD_TOOL::Init ( )
overridevirtual

Basic initalization

Reimplemented from TOOL_BASE.

Definition at line 170 of file pad_tool.cpp.

References SELECTION_CONDITIONS::Count(), PCB_TOOL::EditingModules(), TOOL_MENU::GetMenu(), TOOL_MANAGER::GetTool(), SELECTION_TOOL::GetToolMenu(), SELECTION_CONDITIONS::HasType(), haveFootprints(), m_padCopied, TOOL_BASE::m_toolMgr, and PCB_PAD_T.

171 {
172  auto contextMenu = std::make_shared<PAD_CONTEXT_MENU>( EditingModules(),
173  [this]() { return m_padCopied; } );
174  contextMenu->SetTool( this );
175 
177 
178  if( selTool )
179  {
180  auto& toolMenu = selTool->GetToolMenu();
181  auto& menu = toolMenu.GetMenu();
182 
183  toolMenu.AddSubMenu( contextMenu );
184 
185  SELECTION_CONDITION canShowMenuCond = [this, contextMenu] ( const SELECTION& aSel ) {
186  contextMenu->UpdateAll();
187  return haveFootprints() && contextMenu->HasEnabledItems();
188  };
189 
190  // show menu when there is a footprint, and the menu has any items
191  auto showCond = canShowMenuCond &&
193  || SELECTION_CONDITIONS::Count( 0 ) );
194 
195  menu.AddMenu( contextMenu.get(), false, showCond );
196  }
197 
198  return true;
199 }
Class SELECTION_TOOL.
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:49
TOOL_MENU & GetToolMenu()
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:220
static SELECTION_CONDITION HasType(KICAD_T aType)
Function HasType Creates a functor that tests if among the selected items there is at least one of a ...
bool m_padCopied
Flag to indicate there are valid settings stored in the Master Pad object
Definition: pad_tool.h:66
class D_PAD, a pad in a footprint
Definition: typeinfo.h:102
static SELECTION_CONDITION Count(int aNumber)
Function Count Creates a functor that tests if the number of selected items is equal to the value giv...
std::function< bool(const SELECTION &)> SELECTION_CONDITION
Functor type that checks a specific condition for selected items.
bool EditingModules() const
Definition: pcb_tool.h:91
bool haveFootprints()
Determine if there are any footprints on the board
Definition: pad_tool.cpp:163
int PAD_TOOL::pushPadSettings ( const TOOL_EVENT aEvent)
private

Push pad settings from a pad to other pads on board or module

Definition at line 314 of file pad_tool.cpp.

References PCB_TOOL::frame(), PCB_BASE_FRAME::GetDesignSettings(), BOARD_ITEM::GetParent(), SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), globalChangePadSettings(), DIALOG_GLOBAL_PADS_EDITION::m_Pad_Layer_Filter, BOARD_DESIGN_SETTINGS::m_Pad_Master, DIALOG_GLOBAL_PADS_EDITION::m_Pad_Orient_Filter, DIALOG_GLOBAL_PADS_EDITION::m_Pad_Shape_Filter, TOOL_BASE::m_toolMgr, PCB_PAD_T, BOARD_COMMIT::Push(), TOOL_MANAGER::RunAction(), PCB_ACTIONS::selectionModified, and EDA_DRAW_FRAME::SetMsgPanel().

Referenced by SetTransitions().

315 {
316  auto& selTool = *m_toolMgr->GetTool<SELECTION_TOOL>();
317  const auto& selection = selTool.GetSelection();
318 
319  auto& frame = *getEditFrame<PCB_EDIT_FRAME>();
320 
321  // not const - can be changed in the dialog
322  D_PAD* srcPad = nullptr;
323 
324  // If nothing selected, use the master pad setting,
325  // otherwise, if one pad selected, use the selected pad
326  if( selection.Size() == 0 )
327  {
329  }
330  else if( selection.Size() == 1 )
331  {
332  if( selection[0]->Type() == PCB_PAD_T )
333  {
334  srcPad = static_cast<D_PAD*>( selection[0] );
335  }
336  }
337  else
338  {
339  // multiple selected what to do?
340  // maybe master->selection? same as apply multiple?
341  }
342 
343  // no valid selection, nothing to do
344  if( !srcPad )
345  {
346  return 0;
347  }
348 
349  MODULE* module = srcPad->GetParent();
350 
351  if( module != nullptr )
352  {
353  frame.SetMsgPanel( module );
354  }
355 
356  int dialogRet;
357  {
358  DIALOG_GLOBAL_PADS_EDITION dlg( &frame, srcPad );
359  dialogRet = dlg.ShowModal();
360  }
361 
362  // cancel
363  if( dialogRet == -1 )
364  {
365  return 0;
366  }
367 
368  const bool edit_Same_Modules = (dialogRet == 1);
369 
370  BOARD_COMMIT commit( &frame );
371 
372  globalChangePadSettings( *getModel<BOARD>(), *srcPad, commit,
373  edit_Same_Modules,
377 
378  commit.Push( _( "Apply Pad Settings" ) );
379 
381  frame.Refresh();
382 
383  return 0;
384 }
BOARD_ITEM_CONTAINER * GetParent() const
static void globalChangePadSettings(BOARD &board, const D_PAD &aSrcPad, BOARD_COMMIT &commit, bool aSameFootprints, bool aPadShapeFilter, bool aPadOrientFilter, bool aPadLayerFilter)
Definition: pad_tool.cpp:260
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:220
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
class D_PAD, a pad in a footprint
Definition: typeinfo.h:102
static TOOL_ACTION selectionModified
Modified selection notification.
Definition: pcb_actions.h:105
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:773
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:125
SELECTION & GetSelection()
Function GetSelection()
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
D_PAD m_Pad_Master
A dummy pad to store all default parameters.
void PAD_TOOL::Reset ( RESET_REASON  aReason)
overridevirtual

React to model/view changes

Implements TOOL_BASE.

Definition at line 157 of file pad_tool.cpp.

References m_padCopied.

158 {
159  m_padCopied = false;
160 }
bool m_padCopied
Flag to indicate there are valid settings stored in the Master Pad object
Definition: pad_tool.h:66
void TOOL_INTERACTIVE::RunMainStack ( std::function< void()>  aFunc)
inherited

Function RunMainStack()

Calls a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 78 of file tool_interactive.cpp.

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::RunMainStack().

Referenced by DRAWING_TOOL::PlaceText().

79 {
80  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
81 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:220
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)
void TOOL_INTERACTIVE::SetContextMenu ( CONTEXT_MENU aMenu,
CONTEXT_MENU_TRIGGER  aTrigger = CMENU_BUTTON 
)
inherited

Function SetContextMenu()

Assigns a context menu and tells when it should be activated.

Parameters
aMenuis the menu to be assigned.
aTriggerdetermines conditions upon which the context menu is activated.

Definition at line 67 of file tool_interactive.cpp.

References CMENU_OFF, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ScheduleContextMenu(), and CONTEXT_MENU::SetTool().

Referenced by SELECTION_TOOL::disambiguationMenu(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), and TOOL_MENU::ShowContextMenu().

68 {
69  if( aMenu )
70  aMenu->SetTool( this );
71  else
72  aTrigger = CMENU_OFF;
73 
74  m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
75 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:220
void ScheduleContextMenu(TOOL_BASE *aTool, CONTEXT_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Sets behaviour of the tool's context popup menu.
void SetTool(TOOL_INTERACTIVE *aTool)
Function SetTool() Sets a tool that is the creator of the menu.
void PCB_TOOL::SetEditModules ( bool  aEnabled)
inlineinherited

Function SetEditModules()

Toggles edit module mode. When enabled, one may select parts of modules individually (graphics, pads, etc.), so they can be modified.

Parameters
aEnableddecides if the mode should be enabled.

Definition at line 86 of file pcb_tool.h.

References PCB_TOOL::m_editModules.

87  {
88  m_editModules = aEnabled;
89  }
bool m_editModules
Definition: pcb_tool.h:128
void PAD_TOOL::SetTransitions ( )
overridevirtual

Bind handlers to corresponding TOOL_ACTIONs

Reimplemented from TOOL_BASE.

Definition at line 387 of file pad_tool.cpp.

References applyPadSettings(), PCB_ACTIONS::applyPadSettings, copyPadSettings(), PCB_ACTIONS::copyPadSettings, TOOL_INTERACTIVE::Go(), pushPadSettings(), and PCB_ACTIONS::pushPadSettings.

388 {
392 }
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
static TOOL_ACTION pushPadSettings
Copy the current pad's settings to other pads in the module or on the board.
Definition: pcb_actions.h:309
int pushPadSettings(const TOOL_EVENT &aEvent)
Push pad settings from a pad to other pads on board or module
Definition: pad_tool.cpp:314
static TOOL_ACTION copyPadSettings
Copy the selected pad's settings to the board design settings.
Definition: pcb_actions.h:303
static TOOL_ACTION applyPadSettings
Copy the pad settings in the board design settings to the selected pad.
Definition: pcb_actions.h:306
int applyPadSettings(const TOOL_EVENT &aEvent)
Apply pad settings from board design settings to a pad
Definition: pad_tool.cpp:202
int copyPadSettings(const TOOL_EVENT &aEvent)
Copy pad settings from a pad to the board design settings
Definition: pad_tool.cpp:234
OPT_TOOL_EVENT TOOL_INTERACTIVE::Wait ( const TOOL_EVENT_LIST aEventList = TOOL_EVENTTC_ANYTA_ANY ))
inherited

Function Wait()

Suspends execution of the tool until an event specified in aEventList arrives. No parameters means waiting for any event.

Definition at line 55 of file tool_interactive.cpp.

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::ScheduleWait().

Referenced by MODULE_EDITOR_TOOLS::CopyItems(), PCBNEW_CONTROL::DeleteItemCursor(), SELECTION_TOOL::disambiguationMenu(), PCB_TOOL::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), MODULE_EDITOR_TOOLS::PasteItems(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), DRAWING_TOOL::PlaceDXF(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::runPolygonEventLoop(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), and PCB_EDITOR_CONTROL::ShowLocalRatsnest().

56 {
57  return m_toolMgr->ScheduleWait( this, aEventList );
58 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:220
boost::optional< TOOL_EVENT > ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pauses execution of a given tool until one or more events matching aConditions arrives.

Member Data Documentation

bool PAD_TOOL::m_padCopied
private

Flag to indicate there are valid settings stored in the Master Pad object

Definition at line 66 of file pad_tool.h.

Referenced by copyPadSettings(), Init(), and Reset().

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Unique identifier for the tool, assigned by a TOOL_MANAGER instance.

Definition at line 215 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), TOOL_BASE::GetId(), and EDIT_TOOL::getModificationPoint().

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 220 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PCBNEW_CONTROL::AppendBoard(), applyPadSettings(), TOOL_BASE::attachManager(), SELECTION_TOOL::clearSelection(), MODULE_EDITOR_TOOLS::CopyItems(), copyPadSettings(), PCB_EDITOR_CONTROL::CrossProbePcbToSch(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), PCBNEW_CONTROL::CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), PCBNEW_CONTROL::DeleteItemCursor(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), EDIT_TOOL::Duplicate(), EDIT_TOOL::editFootprintInFpEditor(), MODULE_EDITOR_TOOLS::EnumeratePads(), EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::findCallback(), SELECTION_TOOL::findMove(), EDIT_TOOL::Flip(), TOOL_BASE::getEditFrameInt(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), EDIT_TOOL::getModificationPoint(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), PCBNEW_CONTROL::GridSetOrigin(), PCB_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), Init(), POINT_EDITOR::Init(), PCB_EDITOR_CONTROL::Init(), EDIT_TOOL::Init(), POSITION_RELATIVE_TOOL::Init(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), ZOOM_TOOL::Main(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), MODULE_EDITOR_TOOLS::PasteItems(), DRAWING_TOOL::PlaceDXF(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), pushPadSettings(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), SELECTION_TOOL::RequestSelection(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), SELECTION_TOOL::SanitizeSelection(), SELECTION_TOOL::selectConnection(), SELECTION_TOOL::selectCopper(), SELECTION_TOOL::SelectItem(), SELECTION_TOOL::SelectItems(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), SELECTION_TOOL::selectOnSheetFromEeschema(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), TOOL_INTERACTIVE::SetContextMenu(), PCB_EDITOR_CONTROL::ShowLocalRatsnest(), SELECTION_TOOL::toggleSelection(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), SELECTION_TOOL::UnselectItem(), SELECTION_TOOL::UnselectItems(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), PCB_EDITOR_CONTROL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneMerge(), and PCB_EDITOR_CONTROL::ZoneUnfill().

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

Names are expected to obey the format application.ToolName

(eg. pcbnew.InteractiveSelection).

Definition at line 219 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

TOOL_SETTINGS TOOL_BASE::m_toolSettings
protectedinherited

Definition at line 221 of file tool_base.h.

Referenced by TOOL_BASE::attachManager(), and TOOL_BASE::GetSettings().

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 212 of file tool_base.h.

Referenced by TOOL_BASE::GetType().


The documentation for this class was generated from the following files: