KiCad PCB EDA Suite
MICROWAVE_TOOL Class Reference

MICROWAVE_TOOL. More...

#include <microwave_tool.h>

Inheritance diagram for MICROWAVE_TOOL:
PCB_TOOL_BASE 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...
 
void setTransitions () override
 

Bind handlers to corresponding TOOL_ACTIONs

More...
 
virtual bool Init () override
 Function Init() Init() is called once upon a registration of the tool. More...
 
void SetEditModules (bool aEnabled)
 Function SetEditModules() More...
 
bool EditingModules () const
 
void Activate ()
 Function Activate() Runs the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_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...
 
TOOL_EVENTWait (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...
 
bool IsToolActive () const
 

Protected Types

enum  INTERACTIVE_PLACEMENT_OPTIONS { IPO_ROTATE = 0x01, IPO_FLIP = 0x02, IPO_SINGLE_CLICK = 0x04, IPO_REPEAT = 0x08 }
 Options for placing items interactively. More...
 

Protected Member Functions

void doInteractiveItemPlacement (const std::string &aTool, 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::PCB_VIEWview () const
 
KIGFX::VIEW_CONTROLScontrols () const
 
PCB_BASE_EDIT_FRAMEframe () const
 
BOARDboard () const
 
MODULEmodule () const
 
const PCB_DISPLAY_OPTIONSdisplayOptions () const
 
PCB_DRAW_PANEL_GALcanvas () const
 
const PCBNEW_SELECTIONselection () const
 
PCBNEW_SELECTIONselection ()
 
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_MENU m_menu
 functions below are not yet implemented - their interface may change More...
 
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
 

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...
 
MODULEcreateFootprint (MICROWAVE_FOOTPRINT_SHAPE aFootprintShape)
 Creates a module "GAP" or "STUB" used in micro wave designs. More...
 
MODULEcreatePolygonShape ()
 
MODULEcreateMicrowaveInductor (MICROWAVE_INDUCTOR_PATTERN &aPattern, wxString &aErrorMessage)
 Creates an S-shaped coil footprint for microwave applications. More...
 
MODULEcreateBaseFootprint (const wxString &aValue, int aTextSize, int aPadCount)
 Create a basic footprint for micro wave applications. More...
 

Detailed Description

MICROWAVE_TOOL.

Tool responsible for adding microwave features to PCBs

Definition at line 58 of file microwave_tool.h.

Member Enumeration Documentation

◆ INTERACTIVE_PLACEMENT_OPTIONS

Options for placing items interactively.

Enumerator
IPO_ROTATE 

Handle the rotate action in the loop by calling the item's rotate method.

IPO_FLIP 

Handle flip action in the loop by calling the item's flip method.

IPO_SINGLE_CLICK 

Create an item immediately on placement starting, otherwise show the pencil cursor until the item is created.

IPO_REPEAT 

Allow repeat placement of the item.

Definition at line 116 of file pcb_tool_base.h.

116  {
118  IPO_ROTATE = 0x01,
119 
121  IPO_FLIP = 0x02,
122 
125  IPO_SINGLE_CLICK = 0x04,
126 
128  IPO_REPEAT = 0x08
129  };
Handle flip action in the loop by calling the item's flip method.
Allow repeat placement of the item.
Create an item immediately on placement starting, otherwise show the pencil cursor until the item is ...
Handle the rotate action in the loop by calling the item's rotate method.

◆ RESET_REASON

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 79 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ MICROWAVE_TOOL()

MICROWAVE_TOOL::MICROWAVE_TOOL ( )

Definition at line 41 of file microwave_tool.cpp.

41  :
42  PCB_TOOL_BASE( "pcbnew.MicrowaveTool" )
43 {
44 }
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool_base.h:75

◆ ~MICROWAVE_TOOL()

MICROWAVE_TOOL::~MICROWAVE_TOOL ( )

Definition at line 47 of file microwave_tool.cpp.

48 {}

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

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

Definition at line 51 of file tool_interactive.cpp.

52 {
54 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID.

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

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), LIB_TREE::onContextMenu(), POINT_EDITOR::OnSelectionChange(), GROUP_TOOL::PickNewMember(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ addMicrowaveFootprint()

int MICROWAVE_TOOL::addMicrowaveFootprint ( const TOOL_EVENT aEvent)
private

Main interactive tool

Definition at line 56 of file microwave_tool.cpp.

57 {
58  struct MICROWAVE_PLACER : public INTERACTIVE_PLACER_BASE
59  {
60  MICROWAVE_PLACER( MICROWAVE_TOOL* aTool, MICROWAVE_FOOTPRINT_SHAPE aType ) :
61  m_tool( aTool ),
62  m_itemType( aType )
63  { };
64 
65  virtual ~MICROWAVE_PLACER()
66  {
67  }
68 
69  std::unique_ptr<BOARD_ITEM> CreateItem() override
70  {
71  switch( m_itemType )
72  {
76  return std::unique_ptr<MODULE>( m_tool->createFootprint( m_itemType ) );
77 
79  return std::unique_ptr<MODULE>( m_tool->createPolygonShape() );
80 
81  default:
82  return std::unique_ptr<MODULE>();
83  };
84  }
85 
86  private:
87  MICROWAVE_TOOL* m_tool;
88  MICROWAVE_FOOTPRINT_SHAPE m_itemType;
89  };
90 
91  MICROWAVE_PLACER placer( this, aEvent.Parameter<MICROWAVE_FOOTPRINT_SHAPE>() );
92 
93  doInteractiveItemPlacement( aEvent.GetCommandStr().get(), &placer,
94  _( "Place microwave feature" ),
96 
97  return 0;
98 }
Handle flip action in the loop by calling the item's flip method.
MICROWAVE_TOOL.
Allow repeat placement of the item.
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
Handle the rotate action in the loop by calling the item's rotate method.
#define _(s)
Definition: 3d_actions.cpp:33
void doInteractiveItemPlacement(const std::string &aTool, 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...
MICROWAVE_FOOTPRINT_SHAPE

References _, PCB_TOOL_BASE::doInteractiveItemPlacement(), FUNCTION_SHAPE, GAP, TOOL_EVENT::GetCommandStr(), PCB_TOOL_BASE::IPO_FLIP, PCB_TOOL_BASE::IPO_REPEAT, PCB_TOOL_BASE::IPO_ROTATE, TOOL_EVENT::Parameter(), STUB, and STUB_ARC.

Referenced by setTransitions().

◆ attachManager()

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 60 of file tool_base.cpp.

61 {
62  m_toolMgr = aManager;
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ board()

BOARD* PCB_TOOL_BASE::board ( ) const
inlineprotectedinherited

Definition at line 166 of file pcb_tool_base.h.

166 { return getModel<BOARD>(); }

Referenced by PCBNEW_CONTROL::AppendBoard(), AUTOPLACE_TOOL::autoplace(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), EDIT_TOOL::ChangeTrackWidth(), ZONE_FILLER_TOOL::CheckAllZones(), PCB_INSPECTION_TOOL::ClearHighlight(), EDIT_TOOL::copyToClipboard(), createInductorBetween(), ROUTER_TOOL::CustomTrackWidthDialog(), PCBNEW_CONTROL::DeleteItemCursor(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), ZONE_FILLER_TOOL::FillAllZones(), SELECTION_TOOL::FilterCollectorForGroups(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::GetBoard(), SELECTION_TOOL::getCollectorsGuide(), PCB_EDITOR_CONTROL::Group(), PCB_INSPECTION_TOOL::highlightNet(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PCB_TOOL_BASE::module(), EDIT_TOOL::MoveExact(), ROUTER_TOOL::onTrackViaSizeChanged(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::Paste(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDITOR_CONTROL::PlaceModule(), PAD_TOOL::PlacePad(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), SELECTION_TOOL::RebuildSelection(), PAD_TOOL::recombinePad(), EDIT_TOOL::Remove(), PCB_EDITOR_CONTROL::RepairBoard(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), SELECTION_TOOL::Selectable(), SELECTION_TOOL::selectAllItemsOnNet(), SELECTION_TOOL::selectAllItemsOnSheet(), SELECTION_TOOL::selectConnectedTracks(), SELECTION_TOOL::selectPoint(), PCBNEW_CONTROL::TrackDisplayMode(), PCBNEW_CONTROL::ViaDisplayMode(), PCBNEW_CONTROL::ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

◆ canvas()

◆ controls()

◆ createBaseFootprint()

MODULE * MICROWAVE_TOOL::createBaseFootprint ( const wxString &  aValue,
int  aTextSize,
int  aPadCount 
)
private

Create a basic footprint for micro wave applications.

The default pad settings are: PAD_ATTRIB_SMD, rectangular, H size = V size = current track width.

Parameters
aValueis the text value
aTextSizeis the size of ref and value texts ( <= 0 to use board default values )
aPadCountis number of pads
Returns
the new module

Definition at line 183 of file microwave_footprint.cpp.

185 {
186  PCB_EDIT_FRAME& editFrame = *getEditFrame<PCB_EDIT_FRAME>();
187 
188  MODULE* module = editFrame.CreateNewModule( aValue );
189 
190  if( aTextSize > 0 )
191  {
192  module->Reference().SetTextSize( wxSize( aTextSize, aTextSize ) );
193  module->Reference().SetTextThickness( aTextSize / 5 );
194  module->Value().SetTextSize( wxSize( aTextSize, aTextSize ) );
195  module->Value().SetTextThickness( aTextSize / 5 );
196  }
197 
198  // Create 2 pads used in gaps and stubs. The gap is between these 2 pads
199  // the stub is the pad 2
200  wxString Line;
201  int pad_num = 1;
202 
203  while( aPadCount-- )
204  {
205  D_PAD* pad = new D_PAD( module );
206 
207  module->Add( pad, ADD_MODE::INSERT );
208 
209  int tw = editFrame.GetDesignSettings().GetCurrentTrackWidth();
210  pad->SetSize( wxSize( tw, tw ) );
211 
212  pad->SetPosition( module->GetPosition() );
213  pad->SetShape( PAD_SHAPE_RECT );
215  pad->SetLayerSet( F_Cu );
216 
217  Line.Printf( wxT( "%d" ), pad_num );
218  pad->SetName( Line );
219  pad_num++;
220  }
221 
222  return module;
223 }
TEXTE_MODULE & Reference()
Definition: class_module.h:492
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project Overloaded in FOOTPRINT_EDIT_FRAME.
int GetCurrentTrackWidth() const
Function GetCurrentTrackWidth.
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:81
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:159
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:238
MODULE * CreateNewModule(const wxString &aModuleName)
Function CreateNewModule Creates a new module or footprint, at position 0,0 The new module contains o...
void SetName(const wxString &aName)
Set the pad name (sometimes called pad number, although it can be an array reference like AA12).
Definition: class_pad.h:131
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:491
void SetSize(const wxSize &aSize)
Definition: class_pad.h:223
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:512
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
MODULE * module() const
PCB_EDIT_FRAME is the main frame for Pcbnew.
void SetShape(PAD_SHAPE_T aShape)
Set the new shape of this pad.
Definition: class_pad.h:148
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.h:158
wxPoint GetPosition() const override
Definition: class_module.h:219
void SetLayerSet(LSET aLayers) override
Definition: class_pad.h:331

References MODULE::Add(), PCB_BASE_FRAME::CreateNewModule(), F_Cu, BOARD_DESIGN_SETTINGS::GetCurrentTrackWidth(), PCB_BASE_FRAME::GetDesignSettings(), MODULE::GetPosition(), INSERT, PCB_TOOL_BASE::module(), PAD_ATTRIB_SMD, PAD_SHAPE_RECT, MODULE::Reference(), D_PAD::SetAttribute(), D_PAD::SetLayerSet(), D_PAD::SetName(), D_PAD::SetPosition(), D_PAD::SetShape(), D_PAD::SetSize(), EDA_TEXT::SetTextSize(), EDA_TEXT::SetTextThickness(), and MODULE::Value().

Referenced by createFootprint(), and createPolygonShape().

◆ createFootprint()

MODULE * MICROWAVE_TOOL::createFootprint ( MICROWAVE_FOOTPRINT_SHAPE  aFootprintShape)
private

Creates a module "GAP" or "STUB" used in micro wave designs.

This module has 2 pads: PAD_ATTRIB_SMD, rectangular, H size = V size = current track width. the "gap" is isolation created between this 2 pads

Parameters
aComponentShapeis the component to create
Returns
the new module

Definition at line 31 of file microwave_footprint.cpp.

32 {
33  int oX;
34  D_PAD* pad;
35  MODULE* module;
36  wxString msg, cmp_name;
37  int pad_count = 2;
38  int angle = 0;
39 
40  PCB_EDIT_FRAME& editFrame = *getEditFrame<PCB_EDIT_FRAME>();
41 
42  // Ref and value text size (O = use board default value.
43  // will be set to a value depending on the footprint size, if possible
44  int text_size = 0;
45 
46  // Enter the size of the gap or stub
47  int gap_size = editFrame.GetDesignSettings().GetCurrentTrackWidth();
48 
49  switch( aFootprintShape )
50  {
52  msg = _( "Gap Size:" );
53  cmp_name = "muwave_gap";
54  text_size = gap_size;
55  break;
56 
58  msg = _( "Stub Size:" );
59  cmp_name = "muwave_stub";
60  text_size = gap_size;
61  pad_count = 2;
62  break;
63 
65  msg = _( "Arc Stub Radius Value:" );
66  cmp_name = "muwave_arcstub";
67  pad_count = 1;
68  break;
69 
70  default:
71  msg = wxT( "???" );
72  break;
73  }
74 
75  wxString value = StringFromValue( editFrame.GetUserUnits(), gap_size );
76  WX_TEXT_ENTRY_DIALOG dlg( &editFrame, msg, _( "Create microwave module" ), value );
77 
78  if( dlg.ShowModal() != wxID_OK )
79  return NULL; // cancelled by user
80 
81  value = dlg.GetValue();
82  gap_size = ValueFromString( editFrame.GetUserUnits(), value );
83 
84  bool abort = false;
85 
86  if( aFootprintShape == MICROWAVE_FOOTPRINT_SHAPE::STUB_ARC )
87  {
88  double fcoeff = 10.0, fval;
89  msg.Printf( wxT( "%3.1f" ), angle / fcoeff );
90  WX_TEXT_ENTRY_DIALOG angledlg( &editFrame, _( "Angle in degrees:" ),
91  _( "Create microwave module" ), msg );
92 
93  if( angledlg.ShowModal() != wxID_OK )
94  return NULL; // cancelled by user
95 
96  msg = angledlg.GetValue();
97 
98  if( !msg.ToDouble( &fval ) )
99  {
100  DisplayError( &editFrame, _( "Incorrect number, abort" ) );
101  abort = true;
102  }
103 
104  angle = std::abs( KiROUND( fval * fcoeff ) );
105 
106  if( angle > 1800 )
107  angle = 1800;
108  }
109 
110  if( abort )
111  return NULL;
112 
113  module = createBaseFootprint( cmp_name, text_size, pad_count );
114  auto it = module->Pads().begin();
115  pad = *it;
116 
117  switch( aFootprintShape )
118  {
119  case MICROWAVE_FOOTPRINT_SHAPE::GAP: //Gap :
120  oX = -( gap_size + pad->GetSize().x ) / 2;
121  pad->SetX0( oX );
122 
123  pad->SetX( pad->GetPos0().x + pad->GetPosition().x );
124 
125  pad = *( it + 1 );
126 
127  pad->SetX0( oX + gap_size + pad->GetSize().x );
128  pad->SetX( pad->GetPos0().x + pad->GetPosition().x );
129  break;
130 
131  case MICROWAVE_FOOTPRINT_SHAPE::STUB: //Stub :
132  pad->SetName( wxT( "1" ) );
133  pad = *( it + 1 );
134  pad->SetY0( -( gap_size + pad->GetSize().y ) / 2 );
135  pad->SetSize( wxSize( pad->GetSize().x, gap_size ) );
136  pad->SetY( pad->GetPos0().y + pad->GetPosition().y );
137  break;
138 
139  case MICROWAVE_FOOTPRINT_SHAPE::STUB_ARC: // Arc Stub created by a polygonal approach:
140  {
141  pad->SetShape( PAD_SHAPE_CUSTOM );
143 
144  int numPoints = (angle / 50) + 3; // Note: angles are in 0.1 degrees
145  std::vector<wxPoint> polyPoints;
146  polyPoints.reserve( numPoints );
147 
148  polyPoints.emplace_back( wxPoint( 0, 0 ) );
149 
150  int theta = -angle / 2;
151 
152  for( int ii = 1; ii < numPoints - 1; ii++ )
153  {
154  wxPoint pt( 0, -gap_size );
155  RotatePoint( &pt.x, &pt.y, theta );
156  polyPoints.push_back( pt );
157 
158  theta += 50;
159 
160  if( theta > angle / 2 )
161  theta = angle / 2;
162  }
163 
164  // Close the polygon:
165  polyPoints.push_back( polyPoints[0] );
166 
167  pad->AddPrimitivePoly( polyPoints, 0 ); // add a polygonal basic shape
168  }
169  break;
170 
171  default:
172  break;
173  }
174 
175  // Update the module and board
177  editFrame.OnModify();
178 
179  return module;
180 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project Overloaded in FOOTPRINT_EDIT_FRAME.
const wxPoint & GetPos0() const
Definition: class_pad.h:218
MODULE * createBaseFootprint(const wxString &aValue, int aTextSize, int aPadCount)
Create a basic footprint for micro wave applications.
int GetCurrentTrackWidth() const
Function GetCurrentTrackWidth.
wxPoint GetPosition() const override
Definition: class_pad.h:165
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
PADS & Pads()
Definition: class_module.h:181
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
void SetY0(int y)
Definition: class_pad.h:220
void SetAnchorPadShape(PAD_SHAPE_T aShape)
Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads.
Definition: class_pad.h:198
#define NULL
void SetName(const wxString &aName)
Set the pad name (sometimes called pad number, although it can be an array reference like AA12).
Definition: class_pad.h:131
void SetSize(const wxSize &aSize)
Definition: class_pad.h:223
void SetY(int y)
Definition: class_pad.h:214
void AddPrimitivePoly(const SHAPE_POLY_SET &aPoly, int aThickness)
Has meaning only for custom shape pads.
MODULE * module() const
#define _(s)
Definition: 3d_actions.cpp:33
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
PCB_EDIT_FRAME is the main frame for Pcbnew.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
void SetShape(PAD_SHAPE_T aShape)
Set the new shape of this pad.
Definition: class_pad.h:148
void SetX0(int x)
Definition: class_pad.h:221
const wxSize & GetSize() const
Definition: class_pad.h:224
void SetX(int x)
Definition: class_pad.h:215
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, bool aUseMils, EDA_DATA_TYPE aType)
Function StringFromValue returns the string from aValue according to units (inch, mm ....
Definition: base_units.cpp:233
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
long long int ValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, bool aUseMils, EDA_DATA_TYPE aType)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application.
Definition: base_units.cpp:471

References _, D_PAD::AddPrimitivePoly(), PNS::angle(), MODULE::CalculateBoundingBox(), createBaseFootprint(), DisplayError(), GAP, BOARD_DESIGN_SETTINGS::GetCurrentTrackWidth(), PCB_BASE_FRAME::GetDesignSettings(), D_PAD::GetPos0(), D_PAD::GetPosition(), D_PAD::GetSize(), EDA_BASE_FRAME::GetUserUnits(), WX_TEXT_ENTRY_DIALOG::GetValue(), KiROUND(), PCB_TOOL_BASE::module(), NULL, PCB_EDIT_FRAME::OnModify(), PAD_SHAPE_CUSTOM, PAD_SHAPE_RECT, MODULE::Pads(), RotatePoint(), D_PAD::SetAnchorPadShape(), D_PAD::SetName(), D_PAD::SetShape(), D_PAD::SetSize(), D_PAD::SetX(), D_PAD::SetX0(), D_PAD::SetY(), D_PAD::SetY0(), StringFromValue(), STUB, STUB_ARC, ValueFromString(), wxPoint::x, and wxPoint::y.

◆ createInductorBetween()

void MICROWAVE_TOOL::createInductorBetween ( const VECTOR2I aStart,
const VECTOR2I aEnd 
)
private

Create an inductor between the two points

Definition at line 293 of file microwave_inductor.cpp.

294 {
295  PCB_EDIT_FRAME& editFrame = *getEditFrame<PCB_EDIT_FRAME>();
296 
298 
300 
301  pattern.m_Start = { aStart.x, aStart.y };
302  pattern.m_End = { aEnd.x, aEnd.y };
303 
304  wxString errorMessage;
305 
306  auto inductorModule = std::unique_ptr<MODULE>( createMicrowaveInductor( pattern,
307  errorMessage ) );
308 
309  // on any error, report if we can
310  if ( !inductorModule || !errorMessage.IsEmpty() )
311  {
312  if ( !errorMessage.IsEmpty() )
313  editFrame.ShowInfoBarError( errorMessage );
314  }
315  else
316  {
317  // at this point, we can save the module
318  m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, inductorModule.get() );
319 
320  BOARD_COMMIT commit( this );
321  commit.Add( inductorModule.release() );
322  commit.Push( _("Add microwave inductor" ) );
323  }
324 }
MODULE * createMicrowaveInductor(MICROWAVE_INDUCTOR_PATTERN &aPattern, wxString &aErrorMessage)
Creates an S-shaped coil footprint for microwave applications.
BOARD * board() const
int GetCurrentTrackWidth() const
Function GetCurrentTrackWidth.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: class_board.h:515
void ShowInfoBarError(const wxString &aErrorMsg)
#define _(s)
Definition: 3d_actions.cpp:33
static TOOL_ACTION selectItem
Selects an item (specified as the event parameter).
Definition: pcb_actions.h:65
PCB_EDIT_FRAME is the main frame for Pcbnew.
Parameters for construction of a microwave inductor.

References _, COMMIT::Add(), PCB_TOOL_BASE::board(), createMicrowaveInductor(), BOARD_DESIGN_SETTINGS::GetCurrentTrackWidth(), BOARD::GetDesignSettings(), MICROWAVE_INDUCTOR_PATTERN::m_End, MICROWAVE_INDUCTOR_PATTERN::m_Start, TOOL_BASE::m_toolMgr, MICROWAVE_INDUCTOR_PATTERN::m_Width, BOARD_COMMIT::Push(), TOOL_MANAGER::RunAction(), PCB_ACTIONS::selectItem, EDA_BASE_FRAME::ShowInfoBarError(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by drawMicrowaveInductor().

◆ createMicrowaveInductor()

MODULE * MICROWAVE_TOOL::createMicrowaveInductor ( MICROWAVE_INDUCTOR_PATTERN aPattern,
wxString &  aErrorMessage 
)
private

Creates an S-shaped coil footprint for microwave applications.

Definition at line 327 of file microwave_inductor.cpp.

329 {
330  /* Build a microwave inductor footprint.
331  * - Length Mself.lng
332  * - Extremities Mself.m_Start and Mself.m_End
333  * We must determine:
334  * Mself.nbrin = number of segments perpendicular to the direction
335  * (The coil nbrin will demicercles + 1 + 2 1 / 4 circle)
336  * Mself.lbrin = length of a strand
337  * Mself.radius = radius of rounded parts of the coil
338  * Mself.delta = segments extremities connection between him and the coil even
339  *
340  * The equations are
341  * Mself.m_Size.x = 2 * Mself.radius + Mself.lbrin
342  * Mself.m_Size.y * Mself.delta = 2 + 2 * Mself.nbrin * Mself.radius
343  * Mself.lng = 2 * Mself.delta / / connections to the coil
344  + (Mself.nbrin-2) * Mself.lbrin / / length of the strands except 1st and last
345  + (Mself.nbrin 1) * (PI * Mself.radius) / / length of rounded
346  * Mself.lbrin + / 2 - Melf.radius * 2) / / length of 1st and last bit
347  *
348  * The constraints are:
349  * Nbrin >= 2
350  * Mself.radius < Mself.m_Size.x
351  * Mself.m_Size.y = Mself.radius * 4 + 2 * Mself.raccord
352  * Mself.lbrin> Mself.radius * 2
353  *
354  * The calculation is conducted in the following way:
355  * Initially:
356  * Nbrin = 2
357  * Radius = 4 * m_Size.x (arbitrarily fixed value)
358  * Then:
359  * Increasing the number of segments to the desired length
360  * (Radius decreases if necessary)
361  */
362 
363  D_PAD* pad;
364  wxString msg;
365 
366  PCB_EDIT_FRAME& editFrame = *getEditFrame<PCB_EDIT_FRAME>();
367 
368  auto pt = aInductorPattern.m_End - aInductorPattern.m_Start;
369  int min_len = KiROUND( EuclideanNorm( pt ) );
370  aInductorPattern.m_length = min_len;
371 
372  // Enter the desired length.
373  msg = StringFromValue( editFrame.GetUserUnits(), aInductorPattern.m_length, true );
374  WX_TEXT_ENTRY_DIALOG dlg( &editFrame, _( "Length of Trace:" ), wxEmptyString, msg );
375 
376  if( dlg.ShowModal() != wxID_OK )
377  return nullptr; // canceled by user
378 
379  msg = dlg.GetValue();
380  aInductorPattern.m_length = ValueFromString( editFrame.GetUserUnits(), msg );
381 
382  // Control values (ii = minimum length)
383  if( aInductorPattern.m_length < min_len )
384  {
385  aErrorMessage = _( "Requested length < minimum length" );
386  return nullptr;
387  }
388 
389  // Calculate the elements.
390  std::vector <wxPoint> buffer;
391  const INDUCTOR_S_SHAPE_RESULT res = BuildCornersList_S_Shape( buffer, aInductorPattern.m_Start,
392  aInductorPattern.m_End, aInductorPattern.m_length, aInductorPattern.m_Width );
393 
394  switch( res )
395  {
397  aErrorMessage = _( "Requested length too large" );
398  return nullptr;
400  aErrorMessage = _( "Requested length too small" );
401  return nullptr;
403  aErrorMessage = _( "Requested length can't be represented" );
404  return nullptr;
406  break;
407  }
408 
409  // Generate footprint. the value is also used as footprint name.
410  msg = "L";
411  WX_TEXT_ENTRY_DIALOG cmpdlg( &editFrame, _( "Component Value:" ), wxEmptyString, msg );
412  cmpdlg.SetTextValidator( MODULE_NAME_CHAR_VALIDATOR( &msg ) );
413 
414  if( ( cmpdlg.ShowModal() != wxID_OK ) || msg.IsEmpty() )
415  return nullptr; // Aborted by user
416 
417  MODULE* module = editFrame.CreateNewModule( msg );
418 
419  module->SetFPID( LIB_ID( wxEmptyString, wxT( "mw_inductor" ) ) );
421  module->ClearFlags();
422  module->SetPosition( aInductorPattern.m_End );
423 
424  // Generate segments
425  for( unsigned jj = 1; jj < buffer.size(); jj++ )
426  {
427  EDGE_MODULE* PtSegm;
428  PtSegm = new EDGE_MODULE( module );
429  PtSegm->SetStart( buffer[jj - 1] );
430  PtSegm->SetEnd( buffer[jj] );
431  PtSegm->SetWidth( aInductorPattern.m_Width );
432  PtSegm->SetLayer( module->GetLayer() );
433  PtSegm->SetShape( S_SEGMENT );
434  PtSegm->SetStart0( PtSegm->GetStart() - module->GetPosition() );
435  PtSegm->SetEnd0( PtSegm->GetEnd() - module->GetPosition() );
436  module->Add( PtSegm );
437  }
438 
439  // Place a pad on each end of coil.
440  pad = new D_PAD( module );
441 
442  module->Add( pad );
443 
444  pad->SetName( "1" );
445  pad->SetPosition( aInductorPattern.m_End );
446  pad->SetPos0( pad->GetPosition() - module->GetPosition() );
447 
448  pad->SetSize( wxSize( aInductorPattern.m_Width, aInductorPattern.m_Width ) );
449 
450  pad->SetLayerSet( LSET( module->GetLayer() ) );
452  pad->SetShape( PAD_SHAPE_CIRCLE );
453 
454  D_PAD* newpad = new D_PAD( *pad );
455  const_cast<KIID&>( newpad->m_Uuid ) = KIID();
456 
457  module->Add( newpad );
458 
459  pad = newpad;
460  pad->SetName( "2" );
461  pad->SetPosition( aInductorPattern.m_Start );
462  pad->SetPos0( pad->GetPosition() - module->GetPosition() );
463 
464  // Modify text positions.
465  wxPoint refPos( ( aInductorPattern.m_Start.x + aInductorPattern.m_End.x ) / 2,
466  ( aInductorPattern.m_Start.y + aInductorPattern.m_End.y ) / 2 );
467 
468  wxPoint valPos = refPos;
469 
470  refPos.y -= module->Reference().GetTextSize().y;
471  module->Reference().SetPosition( refPos );
472  valPos.y += module->Value().GetTextSize().y;
473  module->Value().SetPosition( valPos );
474 
476  return module;
477 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:133
void SetEnd0(const wxPoint &aPoint)
TEXTE_MODULE & Reference()
Definition: class_module.h:492
void SetShape(STROKE_T aShape)
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
wxPoint GetPosition() const override
Definition: class_pad.h:165
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:81
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:159
usual segment : line with rounded ends
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
MODULE * CreateNewModule(const wxString &aModuleName)
Function CreateNewModule Creates a new module or footprint, at position 0,0 The new module contains o...
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
static INDUCTOR_S_SHAPE_RESULT BuildCornersList_S_Shape(std::vector< wxPoint > &aBuffer, const wxPoint &aStartPoint, const wxPoint &aEndPoint, int aLength, int aWidth)
Function BuildCornersList_S_Shape Create a path like a S-shaped coil.
Definition: common.h:68
INDUCTOR_S_SHAPE_RESULT
LSET is a set of PCB_LAYER_IDs.
void SetName(const wxString &aName)
Set the pad name (sometimes called pad number, although it can be an array reference like AA12).
Definition: class_pad.h:131
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:491
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:217
const wxSize & GetTextSize() const
Definition: eda_text.h:239
This class provides a custom wxValidator object for limiting the allowable characters when defining f...
Definition: validators.h:63
void SetSize(const wxSize &aSize)
Definition: class_pad.h:223
virtual void SetPosition(const wxPoint &aPos) override
void SetPosition(const wxPoint &aPos) override
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:512
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
void SetStart(const wxPoint &aStart)
const KIID m_Uuid
Definition: base_struct.h:162
MODULE * module() const
#define _(s)
Definition: 3d_actions.cpp:33
void SetStart0(const wxPoint &aPoint)
PCB_EDIT_FRAME is the main frame for Pcbnew.
Requested length too short.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
void SetShape(PAD_SHAPE_T aShape)
Set the new shape of this pad.
Definition: class_pad.h:148
void SetEnd(const wxPoint &aEnd)
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:233
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
wxPoint GetPosition() const override
Definition: class_module.h:219
Requested length too long.
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
void SetFPID(const LIB_ID &aFPID)
Definition: class_module.h:229
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, bool aUseMils, EDA_DATA_TYPE aType)
Function StringFromValue returns the string from aValue according to units (inch, mm ....
Definition: base_units.cpp:233
void SetLayerSet(LSET aLayers) override
Definition: class_pad.h:331
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
long long int ValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, bool aUseMils, EDA_DATA_TYPE aType)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application.
Definition: base_units.cpp:471
void SetAttributes(int aAttributes)
Definition: class_module.h:270
void SetWidth(int aWidth)

References _, MODULE::Add(), BuildCornersList_S_Shape(), MODULE::CalculateBoundingBox(), EDA_ITEM::ClearFlags(), PCB_BASE_FRAME::CreateNewModule(), EuclideanNorm(), DRAWSEGMENT::GetEnd(), BOARD_ITEM::GetLayer(), D_PAD::GetPosition(), MODULE::GetPosition(), DRAWSEGMENT::GetStart(), EDA_TEXT::GetTextSize(), EDA_BASE_FRAME::GetUserUnits(), KiROUND(), MICROWAVE_INDUCTOR_PATTERN::m_End, MICROWAVE_INDUCTOR_PATTERN::m_length, MICROWAVE_INDUCTOR_PATTERN::m_Start, EDA_ITEM::m_Uuid, MICROWAVE_INDUCTOR_PATTERN::m_Width, MOD_EXCLUDE_FROM_BOM, MOD_EXCLUDE_FROM_POS_FILES, PCB_TOOL_BASE::module(), NO_REPR, OK, PAD_ATTRIB_SMD, PAD_SHAPE_CIRCLE, MODULE::Reference(), S_SEGMENT, D_PAD::SetAttribute(), MODULE::SetAttributes(), DRAWSEGMENT::SetEnd(), EDGE_MODULE::SetEnd0(), MODULE::SetFPID(), BOARD_ITEM::SetLayer(), D_PAD::SetLayerSet(), D_PAD::SetName(), D_PAD::SetPos0(), TEXTE_MODULE::SetPosition(), D_PAD::SetPosition(), MODULE::SetPosition(), DRAWSEGMENT::SetShape(), D_PAD::SetShape(), D_PAD::SetSize(), DRAWSEGMENT::SetStart(), EDGE_MODULE::SetStart0(), WX_TEXT_ENTRY_DIALOG::SetTextValidator(), DRAWSEGMENT::SetWidth(), StringFromValue(), TOO_LONG, TOO_SHORT, MODULE::Value(), ValueFromString(), wxPoint::x, and wxPoint::y.

Referenced by createInductorBetween().

◆ createPolygonShape()

MODULE * MICROWAVE_TOOL::createPolygonShape ( )
private

Definition at line 241 of file microwave_polygon.cpp.

242 {
243  D_PAD* pad1, * pad2;
244  MODULE* module;
245  wxString cmp_name;
246  int pad_count = 2;
247  EDGE_MODULE* edge;
248 
249  PCB_EDIT_FRAME& editFrame = *getEditFrame<PCB_EDIT_FRAME>();
250 
251  MWAVE_POLYGONAL_SHAPE_DLG dlg( &editFrame, wxDefaultPosition );
252 
253  int ret = dlg.ShowModal();
254 
255  if( ret != wxID_OK )
256  {
257  PolyEdges.clear();
258  return NULL;
259  }
260 
261  if( PolyShapeType == 2 ) // mirrored
263 
266 
267  if( ( ShapeSize.x ) == 0 || ( ShapeSize.y == 0 ) )
268  {
269  editFrame.ShowInfoBarError( _( "Shape has a null size!" ) );
270  return NULL;
271  }
272 
273  if( PolyEdges.size() == 0 )
274  {
275  editFrame.ShowInfoBarError( _( "Shape has no points!" ) );
276  return NULL;
277  }
278 
279  cmp_name = wxT( "muwave_polygon" );
280 
281  // Create a footprint with 2 pads, orientation = 0, pos 0
282  module = createBaseFootprint( cmp_name, 0, pad_count );
283 
284  // We try to place the footprint anchor to the middle of the shape len
285  wxPoint offset;
286  offset.x = -ShapeSize.x / 2;
287 
288  auto it = module->Pads().begin();
289 
290  pad1 = *it;
291  pad1->SetX0( offset.x );
292  pad1->SetX( pad1->GetPos0().x );
293 
294  pad2 = *( ++it );
295  pad2->SetX0( offset.x + ShapeSize.x );
296  pad2->SetX( pad2->GetPos0().x );
297 
298  // Add a polygonal edge (corners will be added later) on copper layer
299  edge = new EDGE_MODULE( module );
300  edge->SetShape( S_POLYGON );
301  edge->SetLayer( F_Cu );
302 
303  module->Add( edge, ADD_MODE::INSERT );
304 
305  // Get the corner buffer of the polygonal edge
306  std::vector<wxPoint> polyPoints;
307  polyPoints.reserve( PolyEdges.size() + 2 );
308 
309  // Init start point coord:
310  polyPoints.emplace_back( wxPoint( offset.x, 0 ) );
311 
312  wxPoint last_coordinate;
313 
314  for( wxRealPoint& pt: PolyEdges ) // Copy points
315  {
316  last_coordinate.x = KiROUND( pt.x * ShapeScaleX );
317  last_coordinate.y = -KiROUND( pt.y * ShapeScaleY );
318  last_coordinate += offset;
319  polyPoints.push_back( last_coordinate );
320  }
321 
322  // finish the polygonal shape
323  if( last_coordinate.y != 0 )
324  polyPoints.emplace_back( wxPoint( last_coordinate.x, 0 ) );
325 
326  switch( PolyShapeType )
327  {
328  case 0: // shape from file
329  case 2: // shape from file, mirrored (the mirror is already done)
330  break;
331 
332  case 1: // Symmetric shape: add the symmetric (mirrored) shape
333  for( int ndx = (int) polyPoints.size() - 1; ndx >= 0; --ndx )
334  {
335  wxPoint pt = polyPoints[ndx];
336  pt.y = -pt.y; // mirror about X axis
337  polyPoints.push_back( pt );
338  }
339  break;
340  }
341 
342  edge->SetPolyPoints( polyPoints );
343  // Set the polygon outline thickness to 0, only the polygonal shape is filled
344  // without extra thickness
345  edge->SetWidth( 0 );
346  PolyEdges.clear();
347 
349  editFrame.OnModify();
350  return module;
351 }
void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
void SetShape(STROKE_T aShape)
const wxPoint & GetPos0() const
Definition: class_pad.h:218
MODULE * createBaseFootprint(const wxString &aValue, int aTextSize, int aPadCount)
Create a basic footprint for micro wave applications.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
polygon (not yet used for tracks, but could be in microwave apps)
PADS & Pads()
Definition: class_module.h:181
#define NULL
static double ShapeScaleY
void ShowInfoBarError(const wxString &aErrorMsg)
static int PolyShapeType
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
void SetPolyPoints(const std::vector< wxPoint > &aPoints)
MODULE * module() const
#define _(s)
Definition: 3d_actions.cpp:33
static std::vector< wxRealPoint > PolyEdges
PCB_EDIT_FRAME is the main frame for Pcbnew.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
void SetX0(int x)
Definition: class_pad.h:221
void SetX(int x)
Definition: class_pad.h:215
static double ShapeScaleX
static wxSize ShapeSize
void SetWidth(int aWidth)

References _, MODULE::Add(), MODULE::CalculateBoundingBox(), createBaseFootprint(), F_Cu, D_PAD::GetPos0(), INSERT, KiROUND(), PCB_TOOL_BASE::module(), NULL, PCB_EDIT_FRAME::OnModify(), MODULE::Pads(), PolyEdges, PolyShapeType, S_POLYGON, BOARD_ITEM::SetLayer(), DRAWSEGMENT::SetPolyPoints(), DRAWSEGMENT::SetShape(), DRAWSEGMENT::SetWidth(), D_PAD::SetX(), D_PAD::SetX0(), ShapeScaleX, ShapeScaleY, ShapeSize, EDA_BASE_FRAME::ShowInfoBarError(), wxPoint::x, and wxPoint::y.

◆ displayOptions()

const PCB_DISPLAY_OPTIONS & PCB_TOOL_BASE::displayOptions ( ) const
protectedinherited

◆ doInteractiveItemPlacement()

void PCB_TOOL_BASE::doInteractiveItemPlacement ( const std::string &  aTool,
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 37 of file pcb_tool_base.cpp.

40 {
41  using namespace std::placeholders;
42  std::unique_ptr<BOARD_ITEM> newItem;
43 
44  frame()->PushTool( aTool );
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 
54  // Add a VIEW_GROUP that serves as a preview for the new item
55  PCBNEW_SELECTION preview;
56  view()->Add( &preview );
57 
58  aPlacer->m_board = board();
59  aPlacer->m_frame = frame();
60  aPlacer->m_modifiers = 0;
61 
62  auto makeNewItem = [&] ( VECTOR2I aPosition )
63  {
64  if( frame()->GetModel() )
65  newItem = aPlacer->CreateItem();
66 
67  if( newItem )
68  {
69  newItem->SetPosition( (wxPoint) aPosition );
70  preview.Add( newItem.get() );
71 
72  if( newItem->Type() == PCB_MODULE_T )
73  {
74  auto module = dyn_cast<MODULE*>( newItem.get() );
75 
76  // modules have more drawable parts
77  module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
78  }
79  }
80  };
81 
82  if( aOptions & IPO_SINGLE_CLICK )
83  makeNewItem( controls()->GetCursorPosition() );
84 
85  // Main loop: keep receiving events
86  while( TOOL_EVENT* evt = Wait() )
87  {
88  if( !newItem )
89  frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
90  else
91  frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
92 
93  VECTOR2I cursorPos = controls()->GetCursorPosition();
94  aPlacer->m_modifiers = evt->Modifier();
95 
96  auto cleanup = [&] ()
97  {
98  newItem = nullptr;
99  preview.Clear();
100  view()->Update( &preview );
101  controls()->SetAutoPan( false );
102  controls()->CaptureCursor( false );
103  controls()->ShowCursor( true );
104  };
105 
106  if( evt->IsCancelInteractive() )
107  {
108  if( aOptions & IPO_SINGLE_CLICK )
109  {
110  cleanup();
111  frame()->PopTool( aTool );
112  break;
113  }
114  else if( newItem )
115  cleanup();
116  else
117  {
118  frame()->PopTool( aTool );
119  break;
120  }
121  }
122  else if( evt->IsActivate() )
123  {
124  if( newItem )
125  cleanup();
126 
127  if( evt->IsPointEditor() )
128  {
129  // don't exit (the point editor runs in the background)
130  }
131  else if( evt->IsMoveTool() )
132  {
133  // leave ourselves on the stack so we come back after the move
134  break;
135  }
136  else
137  {
138  frame()->PopTool( aTool );
139  break;
140  }
141  }
142  else if( evt->IsClick( BUT_LEFT ) )
143  {
144  if( !newItem )
145  {
146  // create the item if possible
147  makeNewItem( cursorPos );
148 
149  // no item created, so wait for another click
150  if( !newItem )
151  continue;
152 
153  controls()->CaptureCursor( true );
154  controls()->SetAutoPan( true );
155  }
156  else
157  {
158  auto oldFlags = newItem->GetFlags();
159  newItem->ClearFlags();
160 
161  if( !aPlacer->PlaceItem( newItem.get(), commit ) )
162  {
163  newItem->SetFlags( oldFlags );
164  continue;
165  }
166 
167  preview.Clear();
168  newItem.release();
169  commit.Push( aCommitMessage );
170 
171  controls()->CaptureCursor( false );
172  controls()->SetAutoPan( false );
173  controls()->ShowCursor( true );
174 
175  if( !( aOptions & IPO_REPEAT ) )
176  break;
177 
178  if( aOptions & IPO_SINGLE_CLICK )
179  makeNewItem( controls()->GetCursorPosition() );
180  }
181  }
182  else if( evt->IsClick( BUT_RIGHT ) )
183  {
185  }
186  else if( evt->IsAction( &PCB_ACTIONS::trackViaSizeChanged ) )
187  {
189  }
190  else if( newItem && evt->Category() == TC_COMMAND )
191  {
192  /*
193  * Handle any events that can affect the item as we move it around
194  */
195  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) && ( aOptions & IPO_ROTATE ) )
196  {
197  const int rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *frame(), *evt );
198  newItem->Rotate( newItem->GetPosition(), rotationAngle );
199  view()->Update( &preview );
200  }
201  else if( evt->IsAction( &PCB_ACTIONS::flip ) && ( aOptions & IPO_FLIP ) )
202  {
203  newItem->Flip( newItem->GetPosition(), frame()->Settings().m_FlipLeftRight );
204  view()->Update( &preview );
205  }
206  else if( evt->IsAction( &PCB_ACTIONS::viaSizeInc )
207  || evt->IsAction( &PCB_ACTIONS::viaSizeDec ) )
208  {
209  // Refresh preview after event runs
211  }
212  else if( evt->IsAction( &ACTIONS::refreshPreview ) )
213  {
214  preview.Clear();
215  newItem.release();
216 
217  makeNewItem( (wxPoint) cursorPos );
218  aPlacer->SnapItem( newItem.get() );
219  view()->Update( &preview );
220  }
221  }
222 
223  else if( newItem && evt->IsMotion() )
224  {
225  // track the cursor
226  newItem->SetPosition( (wxPoint) cursorPos );
227  aPlacer->SnapItem( newItem.get() );
228 
229  // Show a preview of the item
230  view()->Update( &preview );
231  }
232 
233  else
234  evt->SetPassEvent();
235  }
236 
237  view()->Remove( &preview );
238 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:62
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
virtual void Clear() override
Function Clear() Removes all the stored items from the group.
Definition: selection.h:95
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction)
Function RunOnChildren.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
virtual bool PlaceItem(BOARD_ITEM *aItem, BOARD_COMMIT &aCommit)
Handle flip action in the loop by calling the item's flip method.
BOARD * board() const
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:93
static TOOL_ACTION viaSizeInc
Definition: pcb_actions.h:290
virtual std::unique_ptr< BOARD_ITEM > CreateItem()=0
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:293
bool IsRotateToolEvt(const TOOL_EVENT &aEvt)
Function isRotateToolEvt()
virtual void Remove(VIEW_ITEM *aItem) override
Function Remove() Removes a VIEW_ITEM from the view.
Definition: pcb_view.cpp:76
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:76
TOOL_MANAGER * GetManager() const
Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool.
Definition: tool_base.h:143
PCB_BASE_EDIT_FRAME * frame() const
virtual void SnapItem(BOARD_ITEM *aItem)
class MODULE, a footprint
Definition: typeinfo.h:89
const PCBNEW_SELECTION & selection() const
Allow repeat placement of the item.
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
TOOL_EVENT.
Definition: tool_event.h:171
KIGFX::PCB_VIEW * view() const
Create an item immediately on placement starting, otherwise show the pencil cursor until the item is ...
virtual void Add(VIEW_ITEM *aItem)
Function Add() Adds an item to the group.
Definition: view_group.cpp:55
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
virtual BOARD_ITEM_CONTAINER * GetModel() const =0
Function GetModel()
static TOOL_ACTION flip
Flipping of selected objects.
Definition: pcb_actions.h:105
Handle the rotate action in the loop by calling the item's rotate method.
KIGFX::VIEW_CONTROLS * controls() const
MODULE * module() const
PCBNEW_SETTINGS & Settings()
void Activate()
Function Activate() Runs the tool.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Function Add() Adds a VIEW_ITEM to the view.
Definition: pcb_view.cpp:59
PCB_BASE_EDIT_FRAME * m_frame
Definition: pcb_tool_base.h:62
int GetEventRotationAngle(const PCB_BASE_EDIT_FRAME &aFrame, const TOOL_EVENT &aEvt)
Function getEventRotationAngle()
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
static TOOL_ACTION viaSizeDec
Definition: pcb_actions.h:291
static TOOL_ACTION refreshPreview
Definition: actions.h:104
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.

References TOOL_INTERACTIVE::Activate(), KIGFX::PCB_VIEW::Add(), KIGFX::VIEW_GROUP::Add(), SELECTION::Add(), PCB_TOOL_BASE::board(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), SELECTION::Clear(), PCB_TOOL_BASE::controls(), INTERACTIVE_PLACER_BASE::CreateItem(), PCB_ACTIONS::flip, PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetCanvas(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_EVT_UTILS::GetEventRotationAngle(), TOOL_BASE::GetManager(), PCB_BASE_FRAME::GetModel(), PCB_TOOL_BASE::IPO_FLIP, PCB_TOOL_BASE::IPO_REPEAT, PCB_TOOL_BASE::IPO_ROTATE, PCB_TOOL_BASE::IPO_SINGLE_CLICK, TOOL_EVT_UTILS::IsRotateToolEvt(), INTERACTIVE_PLACER_BASE::m_board, PCBNEW_SETTINGS::m_FlipLeftRight, INTERACTIVE_PLACER_BASE::m_frame, TOOL_INTERACTIVE::m_menu, INTERACTIVE_PLACER_BASE::m_modifiers, TOOL_BASE::m_toolMgr, PCB_TOOL_BASE::module(), PCB_MODULE_T, INTERACTIVE_PLACER_BASE::PlaceItem(), TOOLS_HOLDER::PopTool(), BOARD_COMMIT::Push(), TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, KIGFX::PCB_VIEW::Remove(), TOOL_MANAGER::RunAction(), MODULE::RunOnChildren(), PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionClear, KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), PCB_BASE_FRAME::Settings(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), INTERACTIVE_PLACER_BASE::SnapItem(), TC_COMMAND, PCB_ACTIONS::trackViaSizeChanged, KIGFX::PCB_VIEW::Update(), PCB_ACTIONS::viaSizeDec, PCB_ACTIONS::viaSizeInc, PCB_TOOL_BASE::view(), and TOOL_INTERACTIVE::Wait().

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

◆ drawMicrowaveInductor()

int MICROWAVE_TOOL::drawMicrowaveInductor ( const TOOL_EVENT aEvent)
private

Draw a microwave inductor interactively

Definition at line 110 of file microwave_tool.cpp.

111 {
112  using namespace KIGFX::PREVIEW;
113 
114  KIGFX::VIEW& view = *getView();
116  PCB_EDIT_FRAME& frame = *getEditFrame<PCB_EDIT_FRAME>();
117 
118  std::string tool = aEvent.GetCommandStr().get();
119  frame.PushTool( tool );
120  Activate();
121 
122  TWO_POINT_GEOMETRY_MANAGER tpGeomMgr;
123 
124  CENTRELINE_RECT_ITEM previewRect( tpGeomMgr, inductorAreaAspect );
125 
126  previewRect.SetFillColor( inductorAreaFill );
127  previewRect.SetStrokeColor( inductorAreaStroke );
128  previewRect.SetLineWidth( inductorAreaStrokeWidth );
129 
130  bool originSet = false;
131 
132  controls.ShowCursor( true );
133  controls.CaptureCursor( false );
134  controls.SetAutoPan( false );
135 
136  view.Add( &previewRect );
137 
138  while( auto evt = Wait() )
139  {
140  frame.GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
141  VECTOR2I cursorPos = controls.GetCursorPosition();
142 
143  auto cleanup = [&] () {
144  originSet = false;
145  controls.CaptureCursor( false );
146  controls.SetAutoPan( false );
147  view.SetVisible( &previewRect, false );
148  view.Update( &previewRect, KIGFX::GEOMETRY );
149  };
150 
151  if( evt->IsCancelInteractive() )
152  {
153  if( originSet )
154  cleanup();
155  else
156  {
157  frame.PopTool( tool );
158  break;
159  }
160  }
161 
162  else if( evt->IsActivate() )
163  {
164  if( originSet )
165  cleanup();
166 
167  if( evt->IsMoveTool() )
168  {
169  // leave ourselves on the stack so we come back after the move
170  break;
171  }
172  else
173  {
174  frame.PopTool( tool );
175  break;
176  }
177  }
178 
179  // A click or drag starts
180  else if( !originSet && ( evt->IsClick( BUT_LEFT ) || evt->IsDrag( BUT_LEFT ) ) )
181  {
182  tpGeomMgr.SetOrigin( cursorPos );
183  tpGeomMgr.SetEnd( cursorPos );
184 
185  originSet = true;
186  controls.CaptureCursor( true );
187  controls.SetAutoPan( true );
188  }
189 
190  // another click after origin set is the end
191  // left up is also the end, as you'll only get that after a drag
192  else if( originSet && ( evt->IsClick( BUT_LEFT ) || evt->IsMouseUp( BUT_LEFT ) ) )
193  {
194  // second click, we're done:
195  // delegate to the point-to-point inductor creator function
196  createInductorBetween( tpGeomMgr.GetOrigin(), tpGeomMgr.GetEnd() );
197 
198  // start again if needed
199  originSet = false;
200  controls.CaptureCursor( false );
201  controls.SetAutoPan( false );
202 
203  view.SetVisible( &previewRect, false );
204  view.Update( &previewRect, KIGFX::GEOMETRY );
205  }
206 
207  // any move or drag once the origin was set updates
208  // the end point
209  else if( originSet && ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) )
210  {
211  tpGeomMgr.SetAngleSnap( evt->Modifier( MD_CTRL ) );
212  tpGeomMgr.SetEnd( cursorPos );
213 
214  view.SetVisible( &previewRect, true );
215  view.Update( &previewRect, KIGFX::GEOMETRY );
216  }
217 
218  else if( evt->IsClick( BUT_RIGHT ) )
219  {
221  }
222 
223  else
224  evt->SetPassEvent();
225  }
226 
227  controls.CaptureCursor( false );
228  controls.SetAutoPan( false );
229  view.Remove( &previewRect );
230  return 0;
231 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
static const double inductorAreaStrokeWidth
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:93
static const double inductorAreaAspect
Aspect of the preview rectangle - this is hardcoded in the microwave backend for now
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
static const COLOR4D inductorAreaFill(0.3, 0.3, 0.5, 0.3)
virtual void Remove(VIEW_ITEM *aItem) override
Function Remove() Removes a VIEW_ITEM from the view.
Definition: pcb_view.cpp:76
PCB_BASE_EDIT_FRAME * frame() const
void createInductorBetween(const VECTOR2I &aStart, const VECTOR2I &aEnd)
Create an inductor between the two points
const PCBNEW_SELECTION & selection() const
static const COLOR4D inductorAreaStroke(0.4, 1.0, 1.0, 1.0)
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
void SetOrigin(const VECTOR2I &aOrigin)
Set the origin of the ruler (the fixed end)
KIGFX::PCB_VIEW * view() const
VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (such a...
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
KIGFX::VIEW_CONTROLS * controls() const
PCB_EDIT_FRAME is the main frame for Pcbnew.
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Sets the item visibility.
Definition: view.cpp:1477
void Activate()
Function Activate() Runs the tool.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Function Add() Adds a VIEW_ITEM to the view.
Definition: pcb_view.cpp:59
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
VIEW.
Definition: view.h:61
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
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:59

References TOOL_INTERACTIVE::Activate(), KIGFX::PCB_VIEW::Add(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), PCB_TOOL_BASE::controls(), createInductorBetween(), PCB_TOOL_BASE::frame(), KIGFX::GEOMETRY, PCB_BASE_FRAME::GetCanvas(), TOOL_EVENT::GetCommandStr(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::GetEnd(), KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::GetOrigin(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), inductorAreaAspect, inductorAreaFill, inductorAreaStroke, inductorAreaStrokeWidth, TOOL_INTERACTIVE::m_menu, MD_CTRL, TOOLS_HOLDER::PopTool(), TOOLS_HOLDER::PushTool(), KIGFX::PCB_VIEW::Remove(), PCB_TOOL_BASE::selection(), KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::SetAngleSnap(), KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), 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::PREVIEW::SIMPLE_OVERLAY_ITEM::SetStrokeColor(), KIGFX::VIEW::SetVisible(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), KIGFX::PCB_VIEW::Update(), PCB_TOOL_BASE::view(), and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

◆ EditingModules()

bool PCB_TOOL_BASE::EditingModules ( ) const
inlineinherited

◆ frame()

PCB_BASE_EDIT_FRAME* PCB_TOOL_BASE::frame ( ) const
inlineprotectedinherited

Definition at line 161 of file pcb_tool_base.h.

162  {
163  return getEditFrame<PCB_BASE_EDIT_FRAME>();
164  }

Referenced by POINT_EDITOR::addCorner(), AUTOPLACE_TOOL::autoplace(), PCB_TOOL_BASE::canvas(), ZONE_FILLER_TOOL::CheckAllZones(), PNS::TOOL_BASE::checkSnap(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), ROUTER_TOOL::CustomTrackWidthDialog(), FOOTPRINT_EDITOR_TOOLS::DeleteFootprint(), PCB_TOOL_BASE::displayOptions(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ROUTER_TOOL::DpDimensionsDialog(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EditPad(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), PCB_EDITOR_CONTROL::ExportSpecctraDSN(), ROUTER_TOOL::finishInteractive(), EDIT_TOOL::Flip(), PCB_EDITOR_CONTROL::FlipPcbView(), GLOBAL_EDIT_TOOL::GlobalDeletions(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PCB_EDITOR_CONTROL::ImportSpecctraSession(), ROUTER_TOOL::Init(), SELECTION_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCBNEW_PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PAD_TOOL::pushPadSettings(), PAD_TOOL::recombinePad(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), PNS::TOOL_BASE::Reset(), ROUTER_TOOL::SelectCopperLayerPair(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), POINT_EDITOR::setEditedPoint(), ROUTER_TOOL::SettingsDialog(), GLOBAL_EDIT_TOOL::swapBoardItem(), GLOBAL_EDIT_TOOL::SwapLayers(), ROUTER_TOOL::switchLayerOnViaPlacement(), PCB_EDITOR_CONTROL::UpdateSchematicFromPCB(), ZONE_FILLER_TOOL::ZoneFill(), and ZONE_FILLER_TOOL::ZoneFillAll().

◆ getEditFrame()

template<typename T >
T* TOOL_BASE::getEditFrame ( ) const
inlineprotectedinherited

Function getEditFrame()

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

Definition at line 187 of file tool_base.h.

188  {
189 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
190  wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
191 #endif
192  return static_cast<T*>( getToolHolderInt() );
193  }
TOOLS_HOLDER * getToolHolderInt() const
Definition: tool_base.cpp:48

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

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 121 of file tool_base.h.

122  {
123  return m_toolId;
124  }
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214

References TOOL_BASE::m_toolId.

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

◆ GetManager()

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 143 of file tool_base.h.

144  {
145  return m_toolMgr;
146  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219

References TOOL_BASE::m_toolMgr.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ACTION_MENU::getToolManager(), LIB_TREE::onContextMenu(), ZONE_CREATE_HELPER::OnFirstPoint(), ACTION_MENU::OnMenuEvent(), and ZONE_CREATE_HELPER::performZoneCutout().

◆ getModel()

template<typename T >
T* TOOL_BASE::getModel ( ) const
inlineprotectedinherited

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 201 of file tool_base.h.

202  {
203  EDA_ITEM* m = getModelInt();
204 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
205  wxASSERT( dynamic_cast<T*>( m ) );
206 #endif
207  return static_cast<T*>( m );
208  }
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:54
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159

References TOOL_BASE::getModelInt().

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

◆ GetName()

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 132 of file tool_base.h.

133  {
134  return m_toolName;
135  }
std::string m_toolName
Name of the tool.
Definition: tool_base.h:218

References TOOL_BASE::m_toolName.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 110 of file tool_base.h.

111  {
112  return m_type;
113  }
TOOL_TYPE m_type
Stores the type of the tool.
Definition: tool_base.h:211

References TOOL_BASE::m_type.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InvokeTool(), TOOL_MANAGER::ResetTools(), TOOL_MANAGER::runTool(), and TOOL_MANAGER::ShutdownTool().

◆ getView()

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 36 of file tool_base.cpp.

37 {
38  return m_toolMgr->GetView();
39 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:289
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219

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

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::checkPart(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), drawMicrowaveInductor(), PL_DRAWING_TOOLS::DrawShape(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindComponentAndItem(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::GuessSelectionCandidates(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCB_INSPECTION_TOOL::highlightNet(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), PL_EDIT_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PNS::TOOL_BASE::pickSingleItem(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), PCB_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), SELECTION_TOOL::Selectable(), SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectAll(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), EE_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), EE_POINT_EDITOR::updateItem(), PL_POINT_EDITOR::updateItem(), POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

◆ getViewControls()

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 42 of file tool_base.cpp.

43 {
44  return m_toolMgr->GetViewControls();
45 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:291

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

Referenced by EE_POINT_EDITOR::addCorner(), POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDITOR_CONTROL::AssignNetclass(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), EDIT_TOOL::copyToClipboard(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), LIB_DRAWING_TOOLS::PlaceAnchor(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCBNEW_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateItem(), LIB_MOVE_TOOL::updateModificationPoint(), PL_EDIT_TOOL::updateModificationPoint(), EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

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 129 of file tool_interactive.h.

131 {
132  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
133 
134  goInternal( sptr, aConditions );
135 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:58
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)

References TOOL_INTERACTIVE::goInternal().

Referenced by ZOOM_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), PCB_REANNOTATE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), LIB_PIN_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), PL_POINT_EDITOR::setTransitions(), COMMON_CONTROL::setTransitions(), LIB_MOVE_TOOL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), CONVERT_TOOL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), DRC_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), POINT_EDITOR::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), SCH_MOVE_TOOL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), LIB_CONTROL::setTransitions(), PL_EDIT_TOOL::setTransitions(), PAD_TOOL::setTransitions(), FOOTPRINT_EDITOR_TOOLS::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), PCB_INSPECTION_TOOL::setTransitions(), PCBNEW_PICKER_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), DRAWING_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ Init()

bool PCB_TOOL_BASE::Init ( void  )
overridevirtualinherited

Function Init() Init() is called once upon a registration of the tool.

Returns
True if the initialization went fine, false - otherwise.

Reimplemented from TOOL_BASE.

Reimplemented in EDIT_TOOL, SELECTION_TOOL, DRAWING_TOOL, POSITION_RELATIVE_TOOL, PCB_EDITOR_CONTROL, POINT_EDITOR, FOOTPRINT_EDITOR_TOOLS, PCB_INSPECTION_TOOL, GLOBAL_EDIT_TOOL, PAD_TOOL, GROUP_TOOL, PCB_REANNOTATE_TOOL, LENGTH_TUNER_TOOL, and ROUTER_TOOL.

Definition at line 241 of file pcb_tool_base.cpp.

242 {
243  // A basic context manu. Many (but not all) tools will choose to override this.
244 
245  auto& ctxMenu = m_menu.GetMenu();
246 
247  // cancel current tool goes in main context menu at the top if present
249  ctxMenu.AddSeparator( 1 );
250 
251  // Finally, add the standard zoom/grid items
252  getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus( m_menu );
253 
254  return true;
255 }
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Adds a menu entry to run a TOOL_ACTION on selected items.

References CONDITIONAL_MENU::AddItem(), ACTIONS::cancelInteractive, TOOL_MENU::GetMenu(), TOOL_INTERACTIVE::m_menu, and SELECTION_CONDITIONS::ShowAlways().

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

32 {
33  return m_toolMgr->IsToolActive( m_toolId );
34 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool IsToolActive(TOOL_ID aId) const
Function IsToolActive() Returns true if a tool with given id is active (executing)

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

Referenced by EDIT_TOOL::isRouterActive(), and ROUTER_TOOL::onViaCommand().

◆ module()

◆ Reset()

void MICROWAVE_TOOL::Reset ( RESET_REASON  aReason)
overridevirtual

React to model/view changes

Reimplemented from PCB_TOOL_BASE.

Definition at line 51 of file microwave_tool.cpp.

52 {
53 }

◆ RunMainStack()

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 87 of file tool_interactive.cpp.

88 {
89  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
90 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)

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

Referenced by DRAWING_TOOL::PlaceText().

◆ selection() [1/2]

const PCBNEW_SELECTION & PCB_TOOL_BASE::selection ( ) const
protectedinherited

Definition at line 279 of file pcb_tool_base.cpp.

280 {
281  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
282  const auto& selection = selTool->GetSelection();
283  return selection;
284 }
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
const PCBNEW_SELECTION & selection() const

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

Referenced by AUTOPLACE_TOOL::autoplaceSelected(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), EDIT_TOOL::ChangeTrackWidth(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), PCB_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawZone(), EDIT_TOOL::Duplicate(), PCB_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), PCB_EDITOR_CONTROL::EnterGroup(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::filterSelection(), EDIT_TOOL::Flip(), DRAWING_TOOL::getSourceZoneForAction(), PCB_EDITOR_CONTROL::Group(), PCB_INSPECTION_TOOL::highlightNet(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::InspectClearance(), PCB_INSPECTION_TOOL::InspectConstraints(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), PCBNEW_CONTROL::placeBoardItems(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), PCB_EDITOR_CONTROL::RemoveFromGroup(), GLOBAL_EDIT_TOOL::RemoveUnusedPads(), EDIT_TOOL::Rotate(), PCB_TOOL_BASE::selection(), SELECTION_TOOL::selectNet(), DRAWING_TOOL::SetAnchor(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), PCB_EDITOR_CONTROL::Ungroup(), PCBNEW_CONTROL::UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), PCB_EDITOR_CONTROL::ZoneDuplicate(), ZONE_FILLER_TOOL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfill().

◆ selection() [2/2]

PCBNEW_SELECTION & PCB_TOOL_BASE::selection ( )
protectedinherited

Definition at line 287 of file pcb_tool_base.cpp.

288 {
289  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
290  auto& selection = selTool->GetSelection();
291  return selection;
292 }
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
const PCBNEW_SELECTION & selection() const

References TOOL_MANAGER::GetTool(), TOOL_BASE::m_toolMgr, and PCB_TOOL_BASE::selection().

◆ SetContextMenu()

void TOOL_INTERACTIVE::SetContextMenu ( ACTION_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 76 of file tool_interactive.cpp.

77 {
78  if( aMenu )
79  aMenu->SetTool( this );
80  else
81  aTrigger = CMENU_OFF;
82 
83  m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
84 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void SetTool(TOOL_INTERACTIVE *aTool)
Sets a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Sets behaviour of the tool's context popup menu.

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ SetEditModules()

void PCB_TOOL_BASE::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 101 of file pcb_tool_base.h.

102  {
103  m_editModules = aEnabled;
104  }

References PCB_TOOL_BASE::m_editModules.

◆ setTransitions()

void MICROWAVE_TOOL::setTransitions ( )
overridevirtual

Bind handlers to corresponding TOOL_ACTIONs

Reimplemented from PCB_TOOL_BASE.

Definition at line 235 of file microwave_tool.cpp.

236 {
241 
243 }
static TOOL_ACTION microwaveCreateStubArc
Definition: pcb_actions.h:400
static TOOL_ACTION microwaveCreateLine
Definition: pcb_actions.h:404
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:396
static TOOL_ACTION microwaveCreateStub
Definition: pcb_actions.h:398
int drawMicrowaveInductor(const TOOL_EVENT &aEvent)
Draw a microwave inductor interactively
static TOOL_ACTION microwaveCreateFunctionShape
Definition: pcb_actions.h:402
int addMicrowaveFootprint(const TOOL_EVENT &aEvent)
Main interactive tool

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

◆ view()

◆ Wait()

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 57 of file tool_interactive.cpp.

58 {
59  return m_toolMgr->ScheduleWait( this, aEventList );
60 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
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.

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_editModules

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

functions below are not yet implemented - their interface may change

Definition at line 108 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), ROUTER_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), PICKER_TOOL::Init(), PL_EDIT_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), SCH_EDIT_TOOL::Init(), LIB_CONTROL::Init(), LIB_DRAWING_TOOLS::Init(), FOOTPRINT_EDITOR_TOOLS::Init(), PCB_VIEWER_TOOLS::Init(), PL_DRAWING_TOOLS::Init(), PCB_EDITOR_CONTROL::Init(), SCH_DRAWING_TOOLS::Init(), EDA_3D_CONTROLLER::Init(), GERBVIEW_SELECTION_TOOL::Init(), PL_SELECTION_TOOL::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PCB_TOOL_BASE::Init(), PL_EDIT_TOOL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

Definition at line 214 of file tool_base.h.

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

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 219 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SELECTION_TOOL::AddItemToSel(), SCH_MOVE_TOOL::AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), PCB_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), SELECTION_TOOL::ClearSelection(), PL_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), createInductorBetween(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), LIB_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), PCB_EDITOR_CONTROL::EditFpInFpEditor(), LIB_EDIT_TOOL::editGraphicProperties(), PAD_TOOL::EditPad(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), PCB_EDITOR_CONTROL::EnterGroup(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindComponentAndItem(), POINT_EDITOR::finishItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getToolHolderInt(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), PCBNEW_CONTROL::GridSetOrigin(), PCB_EDITOR_CONTROL::Group(), GERBVIEW_CONTROL::HighlightControl(), PCB_INSPECTION_TOOL::HighlightItem(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::ImportWorksheetContent(), LIB_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), GROUP_TOOL::Init(), CONVERT_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), LIB_CONTROL::Init(), PAD_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PCB_INSPECTION_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_POINT_EDITOR::Init(), PCB_EDITOR_CONTROL::Init(), POINT_EDITOR::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::InspectClearance(), PCB_INSPECTION_TOOL::InspectConstraints(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), PCB_EDITOR_CONTROL::LeaveGroup(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), LIB_CONTROL::OnDeMorgan(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), LIB_EDIT_TOOL::PinTable(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCBNEW_CONTROL::Print(), GERBVIEW_CONTROL::Print(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), LIB_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), SCH_EDIT_TOOL::RefreshSymbolFromLibrary(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), PCB_EDITOR_CONTROL::RemoveFromGroup(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), LIB_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC_TOOL::RunTests(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::SelectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), EDA_3D_CONTROLLER::SetMaterial(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), EDA_3D_CONTROLLER::ToggleVisibility(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), LIB_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), PCB_EDITOR_CONTROL::Ungroup(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), PNS::TOOL_BASE::updateEndItem(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCBNEW_CONTROL::UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), PNS::TOOL_BASE::updateStartItem(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

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 218 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 211 of file tool_base.h.

Referenced by TOOL_BASE::GetType(), and BOARD_COMMIT::Push().


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