KiCad PCB EDA Suite
MICROWAVE_TOOL Class Reference

Class MICROWAVE_TOOL. More...

#include <microwave_tool.h>

Inheritance diagram for MICROWAVE_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

 MICROWAVE_TOOL ()
 
 ~MICROWAVE_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

using ITEM_CREATOR = std::function< std::unique_ptr< BOARD_ITEM >(const TOOL_EVENT &aEvt) >
 Callable that returns a new board item. More...
 

Protected Member Functions

void doInteractiveItemPlacement (ITEM_CREATOR aItemCreator, const wxString &aCommitMessage)
 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
 
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

int addMicrowaveFootprint (const TOOL_EVENT &aEvent)
 

Main interactive tool

More...
 
void createInductorBetween (const VECTOR2I &aStart, const VECTOR2I &aEnd)
 

Create an inductor between the two points

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

Draw a microwave inductor interactively

More...
 

Private Attributes

TOOL_MENU m_menu
 Menu model displayed by the tool. More...
 

Detailed Description

Class MICROWAVE_TOOL.

Tool responsible for adding microwave features to PCBs

Definition at line 37 of file microwave_tool.h.

Member Typedef Documentation

using PCB_TOOL::ITEM_CREATOR = std::function< std::unique_ptr< BOARD_ITEM >( const TOOL_EVENT& aEvt ) >
protectedinherited

Callable that returns a new board item.

The event that triggered it is provided, so you can check modifier keys, position, etc, if required

Definition at line 91 of file pcb_tool.h.

Member Enumeration Documentation

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

MICROWAVE_TOOL::MICROWAVE_TOOL ( )

Definition at line 93 of file microwave_tool.cpp.

93  :
94  PCB_TOOL( "pcbnew.MicrowaveTool" ),
95  m_menu( *this )
96 {
97 }
TOOL_MENU m_menu
Menu model displayed by the tool.
PCB_TOOL(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool.h:52
MICROWAVE_TOOL::~MICROWAVE_TOOL ( )

Definition at line 100 of file microwave_tool.cpp.

101 {}

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(), 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(), MODULE_EDITOR_TOOLS::PlacePad(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), and ROUTER_TOOL::SettingsDialog().

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 MICROWAVE_TOOL::addMicrowaveFootprint ( const TOOL_EVENT aEvent)
private

Main interactive tool

Definition at line 180 of file microwave_tool.cpp.

References PCB_TOOL::board(), PCB_TOOL::doInteractiveItemPlacement(), PCB_TOOL::frame(), getMicrowaveItemCreator(), ID_NO_TOOL_SELECTED, TOOL_EVENT::Parameter(), BOARD::Remove(), and PCB_BASE_FRAME::SetToolID().

Referenced by SetTransitions().

181 {
182  auto& frame = *getEditFrame<PCB_EDIT_FRAME>();
183 
184  const int param = aEvent.Parameter<intptr_t>();
185 
187 
188  // failed to find suitable item info - shouldn't be possible
189  // if all the id's are handled
190  if( !info.name )
191  {
192  wxASSERT_MSG( 0, "Failed to find suitable microwave tool info" );
193  return 0;
194  }
195 
196  frame.SetToolID( info.toolId, wxCURSOR_PENCIL, info.name );
197 
198  ITEM_CREATOR moduleCreator = [this, &info] ( const TOOL_EVENT& aAddingEvent ) {
199  auto module = info.creatorFunc();
200 
201  // Module has been added in the legacy backend,
202  // so we have to remove it before committing the change
203  // @todo LEGACY
204  if( module )
205  {
206  board()->Remove( module.get() );
207  }
208 
209  return module;
210  };
211 
212  doInteractiveItemPlacement( moduleCreator, _( "Place microwave feature" ) );
213 
214  frame.SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );
215 
216  return 0;
217 }
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg) override
Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor.
MICROWAVE_TOOL_INFO getMicrowaveItemCreator(PCB_EDIT_FRAME &frame, int aParam)
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:109
Class TOOL_EVENT.
Definition: tool_event.h:162
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:373
void doInteractiveItemPlacement(ITEM_CREATOR aItemCreator, const wxString &aCommitMessage)
Helper function for performing a common interactive idiom: wait for a left click, place an item there...
Definition: pcb_tool.cpp:39
std::function< std::unique_ptr< BOARD_ITEM >(const TOOL_EVENT &aEvt) > ITEM_CREATOR
Callable that returns a new board item.
Definition: pcb_tool.h:91
void Remove(BOARD_ITEM *aBoardItem) override
>
BOARD * board() const
Definition: pcb_tool.h:110
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
void MICROWAVE_TOOL::createInductorBetween ( const VECTOR2I aStart,
const VECTOR2I aEnd 
)
private

Create an inductor between the two points

Definition at line 220 of file microwave_tool.cpp.

References COMMIT::Add(), PCB_TOOL::board(), MWAVE::CreateMicrowaveInductor(), DisplayError(), PCB_TOOL::frame(), BOARD_DESIGN_SETTINGS::GetCurrentTrackWidth(), BOARD::GetDesignSettings(), MWAVE::INDUCTOR_PATTERN::m_Width, BOARD_COMMIT::Push(), BOARD::Remove(), PCB_BASE_FRAME::SetCurItem(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by drawMicrowaveInductor().

221 {
222  auto& frame = *getEditFrame<PCB_EDIT_FRAME>();
223 
224  MWAVE::INDUCTOR_PATTERN pattern;
225 
227 
228  pattern.m_Start = { aStart.x, aStart.y };
229  pattern.m_End = { aEnd.x, aEnd.y };
230 
231  wxString errorMessage;
232 
233  auto inductorModule = std::unique_ptr<MODULE>(
234  CreateMicrowaveInductor( pattern, &frame, errorMessage )
235  );
236 
237  if( inductorModule )
238  {
239  // legacy mode tools add to the board
240  // so remove it and add it back with the commit object
241  // this has to happen, even if we don't end up storing the module
242  // @todo LEGACY
243  board()->Remove( inductorModule.get() );
244  }
245 
246  // on any error, report if we can
247  if ( !inductorModule || !errorMessage.IsEmpty() )
248  {
249  if ( !errorMessage.IsEmpty() )
250  {
251  DisplayError( &frame, errorMessage );
252  }
253  }
254  else
255  {
256  // at this point, we can save the module
257  frame.SetCurItem( inductorModule.get() );
258 
259  BOARD_COMMIT commit( this );
260  commit.Add( inductorModule.release() );
261  commit.Push( _("Add microwave inductor" ) );
262  }
263 }
Parameters for construction of a microwave inductor.
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:109
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:530
MODULE * CreateMicrowaveInductor(INDUCTOR_PATTERN &aPattern, PCB_EDIT_FRAME *aPcbFrame, wxString &aErrorMessage)
Creates an S-shaped coil footprint for microwave applications.
int GetCurrentTrackWidth() const
Function GetCurrentTrackWidth.
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
void Remove(BOARD_ITEM *aBoardItem) override
>
BOARD * board() const
Definition: pcb_tool.h:110
void PCB_TOOL::doInteractiveItemPlacement ( ITEM_CREATOR  aItemCreator,
const wxString &  aCommitMessage 
)
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 39 of file pcb_tool.cpp.

References TOOL_INTERACTIVE::Activate(), KIGFX::VIEW_GROUP::Add(), SELECTION::Add(), COMMIT::Add(), KIGFX::VIEW::Add(), BUT_LEFT, KIGFX::VIEW_CONTROLS::CaptureCursor(), SELECTION::Clear(), dyn_cast(), PCB_ACTIONS::flip, PCB_TOOL::frame(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_EVT_UTILS::GetEventRotationAngle(), TOOL_BASE::GetManager(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_EVT_UTILS::IsCancelInteractive(), TOOL_EVT_UTILS::IsRotateToolEvt(), PCB_MODULE_T, 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 addMicrowaveFootprint().

41 {
42  using namespace std::placeholders;
43 
44  KIGFX::VIEW& view = *getView();
46  auto& frame = *getEditFrame<PCB_EDIT_FRAME>();
47 
48  std::unique_ptr<BOARD_ITEM> newItem;
49 
50  Activate();
51 
52  BOARD_COMMIT commit( &frame );
53 
55 
56  // do not capture or auto-pan until we start placing an item
57  controls.ShowCursor( true );
58  controls.SetSnapping( true );
59 
60  // Add a VIEW_GROUP that serves as a preview for the new item
61  SELECTION preview;
62  view.Add( &preview );
63 
64  // Main loop: keep receiving events
65  while( OPT_TOOL_EVENT evt = Wait() )
66  {
67  VECTOR2I cursorPos = controls.GetCursorPosition();
68 
70  {
71  if( newItem )
72  {
73  // Delete the old item and have another try
74  newItem = nullptr;
75 
76  preview.Clear();
77 
78  controls.SetAutoPan( false );
79  controls.CaptureCursor( false );
80  controls.ShowCursor( true );
81  }
82  else
83  {
84  break;
85  }
86 
87  if( evt->IsActivate() ) // now finish unconditionally
88  break;
89  }
90 
91  else if( evt->IsClick( BUT_LEFT ) )
92  {
93  if( !newItem )
94  {
95  // create the item if possible
96  newItem = aItemCreator( *evt );
97 
98  // no item created, so wait for another click
99  if( !newItem )
100  continue;
101 
102  controls.CaptureCursor( true );
103  controls.SetAutoPan( true );
104 
105  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
106 
107  preview.Add( newItem.get() );
108 
109  if( newItem->Type() == PCB_MODULE_T )
110  {
111  auto module = dyn_cast<MODULE*>( newItem.get() );
112 
113  // modules have more drawable parts
114  module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
115  }
116  }
117  else
118  {
119  newItem->ClearFlags();
120  preview.Remove( newItem.get() );
121 
122  if( newItem->Type() == PCB_MODULE_T )
123  {
124  auto module = dyn_cast<MODULE*>( newItem.get() );
125  module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Remove, &preview, _1 ) );
126  }
127 
128  commit.Add( newItem.release() );
129  commit.Push( aCommitMessage );
130 
131  controls.CaptureCursor( false );
132  controls.SetAutoPan( false );
133  controls.ShowCursor( true );
134  }
135  }
136 
137  else if( newItem && evt->Category() == TC_COMMAND )
138  {
139  /*
140  * Handle any events that can affect the item as we move
141  * it around, eg rotate and flip
142  */
143 
144  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) )
145  {
146  const auto rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle(
147  frame, *evt );
148  newItem->Rotate( newItem->GetPosition(), rotationAngle );
149  view.Update( &preview );
150  }
151  else if( evt->IsAction( &PCB_ACTIONS::flip ) )
152  {
153  newItem->Flip( newItem->GetPosition() );
154  view.Update( &preview );
155  }
156  }
157 
158  else if( newItem && evt->IsMotion() )
159  {
160  // track the cursor
161  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
162 
163  // Show a preview of the item
164  view.Update( &preview );
165  }
166  }
167 
168  view.Remove( &preview );
169 }
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:108
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
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
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
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:109
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
Definition: view_controls.h:94
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)
Function Update() For dynamic VIEWs, informs the associated VIEW that the graphical representation of...
Definition: view.cpp:1379
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg...
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:36
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:30
static TOOL_ACTION flip
Flipping of selected objects.
Definition: pcb_actions.h:90
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
Class VIEW.
Definition: view.h:58
int GetEventRotationAngle(const PCB_BASE_EDIT_FRAME &aFrame, const TOOL_EVENT &aEvt)
Function getEventRotationAngle()
virtual void Remove(EDA_ITEM *aItem)
Definition: selection.h:76
int MICROWAVE_TOOL::drawMicrowaveInductor ( const TOOL_EVENT aEvent)
private

Draw a microwave inductor interactively

Definition at line 275 of file microwave_tool.cpp.

References TOOL_INTERACTIVE::Activate(), KIGFX::VIEW::Add(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), createInductorBetween(), PCB_TOOL::frame(), KIGFX::GEOMETRY, KIGFX::VIEW_CONTROLS::GetCursorPosition(), KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::GetEnd(), KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::GetOrigin(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), ID_NO_TOOL_SELECTED, ID_PCB_MUWAVE_TOOL_SELF_CMD, inductorAreaFill, inductorAreaStroke, TOOL_EVT_UTILS::IsCancelInteractive(), m_menu, MD_CTRL, KIGFX::VIEW::Remove(), KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::SetAngleSnap(), KIGFX::VIEW_CONTROLS::SetAutoPan(), KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::SetEnd(), KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM::SetFillColor(), KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM::SetLineWidth(), KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::SetOrigin(), KIGFX::VIEW_CONTROLS::SetSnapping(), KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM::SetStrokeColor(), PCB_BASE_FRAME::SetToolID(), KIGFX::VIEW::SetVisible(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), KIGFX::VIEW::Update(), PCB_TOOL::view(), and TOOL_INTERACTIVE::Wait().

Referenced by SetTransitions().

276 {
277  using namespace KIGFX::PREVIEW;
278 
279  KIGFX::VIEW& view = *getView();
280  KIGFX::VIEW_CONTROLS& controls = *getViewControls();
281  auto& frame = *getEditFrame<PCB_EDIT_FRAME>();
282 
283  frame.SetToolID( ID_PCB_MUWAVE_TOOL_SELF_CMD, wxCURSOR_PENCIL, _( "Add Microwave Inductor" ) );
284 
285  Activate();
286 
287  TWO_POINT_GEOMETRY_MANAGER tpGeomMgr;
288 
289  CENTRELINE_RECT_ITEM previewRect( tpGeomMgr, inductorAreaAspect );
290 
291  previewRect.SetFillColor( inductorAreaFill );
292  previewRect.SetStrokeColor( inductorAreaStroke );
293  previewRect.SetLineWidth( inductorAreaStrokeWidth );
294 
295  bool originSet = false;
296 
297  controls.ShowCursor( true );
298  controls.SetSnapping( true );
299 
300  view.Add( &previewRect );
301 
302  while( auto evt = Wait() )
303  {
304  VECTOR2I cursorPos = controls.GetCursorPosition();
305 
307  {
308  // overriding action, or we're cancelling without
309  // an in-progress preview area
310  if ( evt->IsActivate() || !originSet )
311  {
312  break;
313  }
314 
315  // had an in-progress area, so start again but don't
316  // cancel the tool
317  originSet = false;
318  view.SetVisible( &previewRect, false );
319  view.Update( &previewRect, KIGFX::GEOMETRY );
320  }
321 
322  // A click or drag starts
323  else if( !originSet &&
324  ( evt->IsClick( BUT_LEFT ) || evt->IsDrag( BUT_LEFT ) ) )
325  {
326  tpGeomMgr.SetOrigin( cursorPos );
327  tpGeomMgr.SetEnd( cursorPos );
328 
329  originSet = true;
330 
331  controls.CaptureCursor( true );
332  controls.SetAutoPan( true );
333  }
334 
335  // another click after origin set is the end
336  // left up is also the end, as you'll only get that after a drag
337  else if( originSet &&
338  ( evt->IsClick( BUT_LEFT ) || evt->IsMouseUp( BUT_LEFT ) ) )
339  {
340  // second click, we're done:
341  // delegate to the point-to-point inductor creator function
342  createInductorBetween( tpGeomMgr.GetOrigin(), tpGeomMgr.GetEnd() );
343 
344  // start again if needed
345  originSet = false;
346 
347  view.SetVisible( &previewRect, false );
348  view.Update( &previewRect, KIGFX::GEOMETRY );
349  }
350 
351  // any move or drag once the origin was set updates
352  // the end point
353  else if( originSet &&
354  ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) )
355  {
356  tpGeomMgr.SetAngleSnap( evt->Modifier( MD_CTRL ) );
357  tpGeomMgr.SetEnd( cursorPos );
358 
359  view.SetVisible( &previewRect, true );
360  view.Update( &previewRect, KIGFX::GEOMETRY );
361  }
362 
363  else if( evt->IsClick( BUT_RIGHT ) )
364  {
366  }
367  }
368 
369  view.Remove( &previewRect );
370 
371  frame.SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );
372 
373  return 0;
374 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
static const double inductorAreaStrokeWidth
KIGFX::VIEW * view() const
Definition: pcb_tool.h:108
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg) override
Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor.
static const double inductorAreaAspect
Aspect of the preview rectangle - this is hardcoded in the microwave backend for now ...
Class TWO_POINT_GEOMETRY_MANAGER.
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.
static const COLOR4D inductorAreaFill(0.3, 0.3, 0.5, 0.3)
TOOL_MENU m_menu
Menu model displayed by the tool.
void createInductorBetween(const VECTOR2I &aStart, const VECTOR2I &aEnd)
Create an inductor between the two points
static const COLOR4D inductorAreaStroke(0.4, 1.0, 1.0, 1.0)
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:109
void SetOrigin(const VECTOR2I &aOrigin)
Set the origin of the ruler (the fixed end)
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
Definition: view_controls.h:94
bool IsCancelInteractive(const TOOL_EVENT &aEvt)
Function IsCancelInteractive()
void Update(VIEW_ITEM *aItem)
Function Update() For dynamic VIEWs, informs the associated VIEW that the graphical representation of...
Definition: view.cpp:1379
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg...
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:36
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:30
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Function SetVisible() Sets the item visibility.
Definition: view.cpp:1331
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
Class VIEW.
Definition: view.h:58
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:62
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the end that moves with the cursor.
Color has changed.
Definition: view_item.h:57
bool PCB_TOOL::EditingModules ( ) const
inlineinherited

Definition at line 78 of file pcb_tool.h.

References PCB_TOOL::m_editModules.

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

79  {
80  return m_editModules;
81  }
bool m_editModules
Definition: pcb_tool.h:112
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(), PCB_TOOL::doInteractiveItemPlacement(), 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(), PCB_EDITOR_CONTROL::HighlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), EDIT_TOOL::Main(), EDIT_TOOL::MeasureTool(), MODULE_EDITOR_TOOLS::ModuleEdgeOutlines(), MODULE_EDITOR_TOOLS::ModuleTextOutlines(), 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(), MODULE_EDITOR_TOOLS::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(), PNS::TOOL_BASE::updateEndItem(), 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(), PCB_EDITOR_CONTROL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneFillAll(), PCB_EDITOR_CONTROL::ZoneUnfill(), PCB_EDITOR_CONTROL::ZoneUnfillAll(), 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
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(), PAD_TOOL::SetTransitions(), SetTransitions(), POINT_EDITOR::SetTransitions(), COMMON_TOOLS::SetTransitions(), PLACEMENT_TOOL::SetTransitions(), PCBNEW_CONTROL::SetTransitions(), MODULE_EDITOR_TOOLS::SetTransitions(), PICKER_TOOL::SetTransitions(), PCB_EDITOR_CONTROL::SetTransitions(), SELECTION_TOOL::SetTransitions(), EDIT_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 MICROWAVE_TOOL::Init ( )
overridevirtual

Basic initalization

Reimplemented from TOOL_BASE.

Definition at line 109 of file microwave_tool.cpp.

References CONDITIONAL_MENU::AddItem(), TOOL_MENU::AddStandardSubMenus(), ACTIONS::cancelInteractive, TOOL_MENU::GetMenu(), and m_menu.

110 {
111  auto activeToolFunctor = [ this ] ( const SELECTION& aSel ) {
112  return true;
113  };
114 
115  auto& ctxMenu = m_menu.GetMenu();
116 
117  // cancel current goes in main context menu at the top if present
118  ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolFunctor, 1000 );
119  ctxMenu.AddSeparator( activeToolFunctor, 1000 );
120 
121  m_menu.AddStandardSubMenus( *getEditFrame<PCB_BASE_FRAME>() );
122 
123  return true;
124 }
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:49
static TOOL_ACTION cancelInteractive
Definition: actions.h:45
TOOL_MENU m_menu
Menu model displayed by the tool.
void AddStandardSubMenus(EDA_DRAW_FRAME &aFrame)
Function CreateBasicMenu.
Definition: tool_menu.cpp:95
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Function AddItem()
void MICROWAVE_TOOL::Reset ( RESET_REASON  aReason)
overridevirtual

React to model/view changes

Implements TOOL_BASE.

Definition at line 104 of file microwave_tool.cpp.

105 {
106 }
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 73 of file pcb_tool.h.

References PCB_TOOL::m_editModules.

74  {
75  m_editModules = aEnabled;
76  }
bool m_editModules
Definition: pcb_tool.h:112
void MICROWAVE_TOOL::SetTransitions ( )
overridevirtual

Bind handlers to corresponding TOOL_ACTIONs

Reimplemented from TOOL_BASE.

Definition at line 377 of file microwave_tool.cpp.

References addMicrowaveFootprint(), drawMicrowaveInductor(), TOOL_INTERACTIVE::Go(), PCB_ACTIONS::microwaveCreateFunctionShape, PCB_ACTIONS::microwaveCreateGap, PCB_ACTIONS::microwaveCreateLine, PCB_ACTIONS::microwaveCreateStub, and PCB_ACTIONS::microwaveCreateStubArc.

378 {
383 
385 }
static TOOL_ACTION microwaveCreateStubArc
Definition: pcb_actions.h:302
static TOOL_ACTION microwaveCreateLine
Definition: pcb_actions.h:306
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
static TOOL_ACTION microwaveCreateGap
Definition: pcb_actions.h:298
static TOOL_ACTION microwaveCreateStub
Definition: pcb_actions.h:300
int drawMicrowaveInductor(const TOOL_EVENT &aEvent)
Draw a microwave inductor interactively
static TOOL_ACTION microwaveCreateFunctionShape
Definition: pcb_actions.h:304
int addMicrowaveFootprint(const TOOL_EVENT &aEvent)
Main interactive tool
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(), 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(), MODULE_EDITOR_TOOLS::PlacePad(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::runPolygonEventLoop(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectPoint(), ZOOM_TOOL::selectRegion(), and DRAWING_TOOL::SetAnchor().

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

TOOL_MENU MICROWAVE_TOOL::m_menu
private

Menu model displayed by the tool.

Definition at line 64 of file microwave_tool.h.

Referenced by drawMicrowaveInductor(), and Init().

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(), PAD_TOOL::applyPadSettings(), TOOL_BASE::attachManager(), SELECTION_TOOL::clearSelection(), MODULE_EDITOR_TOOLS::CopyItems(), PAD_TOOL::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(), PLACEMENT_TOOL::Init(), PAD_TOOL::Init(), POINT_EDITOR::Init(), PCB_EDITOR_CONTROL::Init(), EDIT_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(), MODULE_EDITOR_TOOLS::PlacePad(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), 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::selectMultiple(), SELECTION_TOOL::selectNet(), SELECTION_TOOL::selectOnSheetFromEeschema(), SELECTION_TOOL::selectSameSheet(), TOOL_INTERACTIVE::SetContextMenu(), SELECTION_TOOL::toggleSelection(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), SELECTION_TOOL::UnselectItem(), PCB_EDITOR_CONTROL::UpdateSelectionRatsnest(), 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: