KiCad PCB EDA Suite
BOARD_EDITOR_CONTROL Class Reference

Handle actions specific to the board editor in PcbNew. More...

#include <board_editor_control.h>

Inheritance diagram for BOARD_EDITOR_CONTROL:
PCB_TOOL_BASE TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 Determine the reason of reset for a tool. More...
 

Public Member Functions

 BOARD_EDITOR_CONTROL ()
 
 ~BOARD_EDITOR_CONTROL ()
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
bool Init () override
 Init() is called once upon a registration of the tool. More...
 
int New (const TOOL_EVENT &aEvent)
 
int Open (const TOOL_EVENT &aEvent)
 
int Save (const TOOL_EVENT &aEvent)
 
int SaveAs (const TOOL_EVENT &aEvent)
 
int SaveCopyAs (const TOOL_EVENT &aEvent)
 
int PageSettings (const TOOL_EVENT &aEvent)
 
int Plot (const TOOL_EVENT &aEvent)
 
int Find (const TOOL_EVENT &aEvent)
 
int FindNext (const TOOL_EVENT &aEvent)
 
int BoardSetup (const TOOL_EVENT &aEvent)
 
int ImportNetlist (const TOOL_EVENT &aEvent)
 
int ImportSpecctraSession (const TOOL_EVENT &aEvent)
 
int ExportSpecctraDSN (const TOOL_EVENT &aEvent)
 
int ExportNetlist (const TOOL_EVENT &aEvent)
 
int GenerateDrillFiles (const TOOL_EVENT &aEvent)
 
int GeneratePosFile (const TOOL_EVENT &aEvent)
 
int GenerateFabFiles (const TOOL_EVENT &aEvent)
 
int RepairBoard (const TOOL_EVENT &aEvent)
 
int UpdatePCBFromSchematic (const TOOL_EVENT &aEvent)
 
int UpdateSchematicFromPCB (const TOOL_EVENT &aEvent)
 
int ShowEeschema (const TOOL_EVENT &aEvent)
 
int ToggleLayersManager (const TOOL_EVENT &aEvent)
 
int TogglePythonConsole (const TOOL_EVENT &aEvent)
 
int TrackWidthInc (const TOOL_EVENT &aEvent)
 
int TrackWidthDec (const TOOL_EVENT &aEvent)
 
int ViaSizeInc (const TOOL_EVENT &aEvent)
 
int ViaSizeDec (const TOOL_EVENT &aEvent)
 
int ZoneMerge (const TOOL_EVENT &aEvent)
 Duplicate a zone onto a layer (prompts for new layer) More...
 
int ZoneDuplicate (const TOOL_EVENT &aEvent)
 
int EditFpInFpEditor (const TOOL_EVENT &aEvent)
 
int PlaceTarget (const TOOL_EVENT &aEvent)
 Allow user to place a layer alignment target. More...
 
int PlaceFootprint (const TOOL_EVENT &aEvent)
 Display a dialog to select a footprint to be added and allows the user to set its position. More...
 
bool PlacingFootprint () const
 Re-entrancy checker for above. More...
 
int ToggleLockSelected (const TOOL_EVENT &aEvent)
 Lock selected items. More...
 
int LockSelected (const TOOL_EVENT &aEvent)
 Unlock selected items. More...
 
int UnlockSelected (const TOOL_EVENT &aEvent)
 Run the drill origin tool for setting the origin for drill and pick-and-place files. More...
 
int DrillOrigin (const TOOL_EVENT &aEvent)
 Low-level access (below undo) to setting the drill origin. More...
 
void SetIsFootprintEditor (bool aEnabled)
 Function SetIsFootprintEditor() More...
 
bool IsFootprintEditor () const
 
virtual bool Is45Limited () const
 Should the tool use its 45° mode option? More...
 
void Activate ()
 Run the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Assign a context menu and tells when it should be activated. More...
 
void RunMainStack (std::function< void()> aFunc)
 Call a function using the main stack. More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Define which state (aStateFunc) to go when a certain event arrives (aConditions). More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Suspend execution of the tool until an event specified in aEventList arrives. More...
 
TOOL_TYPE GetType () const
 Return the type of the tool. More...
 
TOOL_ID GetId () const
 Return the unique identifier of the tool. More...
 
const std::string & GetName () const
 Return the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Return the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Static Public Member Functions

static void DoSetDrillOrigin (KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, EDA_ITEM *aItem, const VECTOR2D &aPoint)
 

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
 
FOOTPRINTfootprint () const
 
const PCB_DISPLAY_OPTIONSdisplayOptions () const
 
PCB_DRAW_PANEL_GALcanvas () const
 
const PCB_SELECTIONselection () const
 
PCB_SELECTIONselection ()
 
void attachManager (TOOL_MANAGER *aManager)
 Set the TOOL_MANAGER the tool will belong to. More...
 
KIGFX::VIEWgetView () const
 Returns the instance of #VIEW object used in the application. More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Return the instance of VIEW_CONTROLS object used in the application. More...
 
template<typename T >
T * getEditFrame () const
 Return the application window object, casted to requested user type. More...
 
template<typename T >
T * getModel () const
 Return the model object if it matches the requested type. More...
 

Protected Attributes

bool m_isFootprintEditor
 
TOOL_MENU m_menu
 The functions below are not yet implemented - their interface may change. More...
 
TOOL_TYPE m_type
 Unique identifier for the tool, assigned by a TOOL_MANAGER instance. More...
 
TOOL_ID m_toolId
 Name of the tool. More...
 
std::string m_toolName
 
TOOL_MANAGERm_toolMgr
 

Private Types

enum  MODIFY_MODE { ON, OFF, TOGGLE }
 < How to modify a property for selected items. More...
 

Private Member Functions

int modifyLockSelected (MODIFY_MODE aMode)
 Set up handlers for various events. More...
 
void setTransitions () override
 This method is meant to be overridden in order to specify handlers for events. More...
 

Private Attributes

PCB_EDIT_FRAMEm_frame
 
bool m_inPlaceFootprint
 
bool m_placingFootprint
 
bool m_inPlaceTarget
 
std::unique_ptr< KIGFX::ORIGIN_VIEWITEMm_placeOrigin
 

Static Private Attributes

static const int WIDTH_STEP = 100000
 How does line width change after one -/+ key press. More...
 

Detailed Description

Handle actions specific to the board editor in PcbNew.

Definition at line 42 of file board_editor_control.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.

◆ MODIFY_MODE

< How to modify a property for selected items.

Enumerator
ON 
OFF 
TOGGLE 

Definition at line 128 of file board_editor_control.h.

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

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

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

Constructor & Destructor Documentation

◆ BOARD_EDITOR_CONTROL()

BOARD_EDITOR_CONTROL::BOARD_EDITOR_CONTROL ( )

Definition at line 176 of file board_editor_control.cpp.

176  :
177  PCB_TOOL_BASE( "pcbnew.EditorControl" ),
178  m_frame( nullptr ),
179  m_inPlaceFootprint( false ),
180  m_placingFootprint( false ),
181  m_inPlaceTarget( false )
182 {
183  m_placeOrigin = std::make_unique<KIGFX::ORIGIN_VIEWITEM>( KIGFX::COLOR4D( 0.8, 0.0, 0.0, 1.0 ),
185 }
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_placeOrigin
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool_base.h:77
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References KIGFX::ORIGIN_VIEWITEM::CIRCLE_CROSS, and m_placeOrigin.

◆ ~BOARD_EDITOR_CONTROL()

BOARD_EDITOR_CONTROL::~BOARD_EDITOR_CONTROL ( )

Definition at line 188 of file board_editor_control.cpp.

189 {
190 }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run 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:214
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209
bool InvokeTool(TOOL_ID aToolId)
Call 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(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), DrillOrigin(), PAD_TOOL::EnumeratePads(), PCB_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_TREE::onContextMenu(), PCB_POINT_EDITOR::OnSelectionChange(), GROUP_TOOL::PickNewMember(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Set 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:214

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ board()

BOARD* PCB_TOOL_BASE::board ( ) const
inlineprotectedinherited

Definition at line 165 of file pcb_tool_base.h.

165 { return getModel<BOARD>(); }

Referenced by PCB_CONTROL::AppendBoard(), AUTOPLACE_TOOL::autoplace(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), EDIT_TOOL::ChangeTrackWidth(), ZONE_FILLER_TOOL::CheckAllZones(), BOARD_INSPECTION_TOOL::ClearHighlight(), EDIT_TOOL::copyToClipboard(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), MICROWAVE_TOOL::createInductorBetween(), ROUTER_TOOL::CustomTrackWidthDialog(), PCB_CONTROL::DeleteItemCursor(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), ExportNetlist(), ZONE_FILLER_TOOL::FillAllZones(), EDIT_TOOL::FilletTracks(), PCB_SELECTION_TOOL::filterSelection(), PCB_TOOL_BASE::footprint(), PCB_SELECTION_TOOL::GetBoard(), PCB_SELECTION_TOOL::getCollectorsGuide(), GROUP_TOOL::Group(), ROUTER_TOOL::handleLayerSwitch(), BOARD_INSPECTION_TOOL::highlightNet(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_CONTROL::LayerNext(), PCB_CONTROL::LayerPrev(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EDIT_TOOL::MoveExact(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), PCB_CONTROL::Paste(), PCB_CONTROL::placeBoardItems(), PlaceFootprint(), PAD_TOOL::PlacePad(), PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::recombinePad(), RepairBoard(), FOOTPRINT_EDITOR_CONTROL::RepairFootprint(), PNS::TOOL_BASE::Reset(), PCB_CONTROL::Reset(), PCB_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::selectAllItemsOnNet(), PCB_SELECTION_TOOL::selectAllItemsOnSheet(), PCB_SELECTION_TOOL::selectConnectedTracks(), PCB_SELECTION_TOOL::selectionContains(), PCB_SELECTION_TOOL::selectPoint(), PCB_CONTROL::TrackDisplayMode(), PCB_CONTROL::unfilledZoneCheck(), GROUP_TOOL::Ungroup(), ROUTER_TOOL::UpdateMessagePanel(), PCB_CONTROL::ViaDisplayMode(), PCB_CONTROL::ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

◆ BoardSetup()

int BOARD_EDITOR_CONTROL::BoardSetup ( const TOOL_EVENT aEvent)

Definition at line 394 of file board_editor_control.cpp.

395 {
396  getEditFrame<PCB_EDIT_FRAME>()->ShowBoardSetupDialog();
397  return 0;
398 }

Referenced by setTransitions().

◆ canvas()

◆ controls()

◆ 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 
46  BOARD_COMMIT commit( frame() );
47 
49 
50  Activate();
51  // Must be done after Activate() so that it gets set into the correct context
52  controls()->ShowCursor( true );
53  // do not capture or auto-pan until we start placing an item
54 
55  PCB_GRID_HELPER grid( m_toolMgr, frame()->GetMagneticItemsSettings() );
56 
57  // Add a VIEW_GROUP that serves as a preview for the new item
58  PCB_SELECTION preview;
59  view()->Add( &preview );
60 
61  aPlacer->m_board = board();
62  aPlacer->m_frame = frame();
63  aPlacer->m_modifiers = 0;
64 
65  auto makeNewItem =
66  [&]( VECTOR2I aPosition )
67  {
68  if( frame()->GetModel() )
69  newItem = aPlacer->CreateItem();
70 
71  if( newItem )
72  {
73  newItem->SetPosition( (wxPoint) aPosition );
74  preview.Add( newItem.get() );
75 
76  if( newItem->Type() == PCB_FOOTPRINT_T )
77  {
78  FOOTPRINT* fp = dyn_cast<FOOTPRINT*>( newItem.get() );
79 
80  // footprints have more drawable parts
81  fp->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
82  }
83  }
84  };
85 
86  if( aOptions & IPO_SINGLE_CLICK )
87  makeNewItem( controls()->GetCursorPosition() );
88 
89  auto setCursor =
90  [&]()
91  {
92  if( !newItem )
94  else
96  };
97 
98  // Set initial cursor
99  setCursor();
100 
101  // Main loop: keep receiving events
102  while( TOOL_EVENT* evt = Wait() )
103  {
104  setCursor();
105 
106  grid.SetSnap( false ); // Interactive placement tools need to set their own item snaps
107  grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
108  VECTOR2I cursorPos = grid.BestSnapAnchor( controls()->GetMousePosition(), nullptr );
109 
110  aPlacer->m_modifiers = evt->Modifier();
111 
112  auto cleanup =
113  [&] ()
114  {
115  newItem = nullptr;
116  preview.Clear();
117  view()->Update( &preview );
118  controls()->SetAutoPan( false );
119  controls()->CaptureCursor( false );
120  controls()->ShowCursor( true );
121  };
122 
123  if( evt->IsCancelInteractive() )
124  {
125  if( aOptions & IPO_SINGLE_CLICK )
126  {
127  cleanup();
128  frame()->PopTool( aTool );
129  break;
130  }
131  else if( newItem )
132  {
133  cleanup();
134  }
135  else
136  {
137  frame()->PopTool( aTool );
138  break;
139  }
140  }
141  else if( evt->IsActivate() )
142  {
143  if( newItem )
144  cleanup();
145 
146  if( evt->IsPointEditor() )
147  {
148  // don't exit (the point editor runs in the background)
149  }
150  else if( evt->IsMoveTool() )
151  {
152  // leave ourselves on the stack so we come back after the move
153  break;
154  }
155  else
156  {
157  frame()->PopTool( aTool );
158  break;
159  }
160  }
161  else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
162  {
163  if( !newItem )
164  {
165  // create the item if possible
166  makeNewItem( cursorPos );
167 
168  // no item created, so wait for another click
169  if( !newItem )
170  continue;
171 
172  controls()->CaptureCursor( true );
173  controls()->SetAutoPan( true );
174  }
175  else
176  {
177  auto oldFlags = newItem->GetFlags();
178  newItem->ClearFlags();
179 
180  if( !aPlacer->PlaceItem( newItem.get(), commit ) )
181  {
182  newItem->SetFlags( oldFlags );
183  continue;
184  }
185 
186  preview.Clear();
187  newItem.release();
188  commit.Push( aCommitMessage );
189 
190  controls()->CaptureCursor( false );
191  controls()->SetAutoPan( false );
192  controls()->ShowCursor( true );
193 
194  if( !( aOptions & IPO_REPEAT ) )
195  break;
196 
197  if( aOptions & IPO_SINGLE_CLICK )
198  makeNewItem( controls()->GetCursorPosition() );
199 
200  setCursor();
201  }
202  }
203  else if( evt->IsClick( BUT_RIGHT ) )
204  {
206  }
207  else if( evt->IsAction( &PCB_ACTIONS::trackViaSizeChanged ) )
208  {
210  }
211  else if( newItem && evt->Category() == TC_COMMAND )
212  {
213  /*
214  * Handle any events that can affect the item as we move it around
215  */
216  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) && ( aOptions & IPO_ROTATE ) )
217  {
218  const int rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *frame(), *evt );
219  newItem->Rotate( newItem->GetPosition(), rotationAngle );
220  view()->Update( &preview );
221  }
222  else if( evt->IsAction( &PCB_ACTIONS::flip ) && ( aOptions & IPO_FLIP ) )
223  {
224  newItem->Flip( newItem->GetPosition(), frame()->Settings().m_FlipLeftRight );
225  view()->Update( &preview );
226  }
227  else if( evt->IsAction( &PCB_ACTIONS::properties ) )
228  {
229  frame()->OnEditItemRequest( newItem.get() );
230 
231  // Notify other tools of the changes
233  }
234  else if( evt->IsAction( &ACTIONS::refreshPreview ) )
235  {
236  preview.Clear();
237  newItem.release();
238 
239  makeNewItem( (wxPoint) cursorPos );
240  aPlacer->SnapItem( newItem.get() );
241  view()->Update( &preview );
242  }
243  else
244  {
245  evt->SetPassEvent();
246  }
247  }
248  else if( newItem && evt->IsMotion() )
249  {
250  // track the cursor
251  newItem->SetPosition( (wxPoint) cursorPos );
252  aPlacer->SnapItem( newItem.get() );
253 
254  // Show a preview of the item
255  view()->Update( &preview );
256  }
257  else
258  {
259  evt->SetPassEvent();
260  }
261  }
262 
263  view()->Remove( &preview );
265  controls()->SetAutoPan( false );
266  controls()->CaptureCursor( false );
267 }
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:59
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
virtual void Clear() override
Remove all the stored items from the group.
Definition: selection.h:83
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Suspend execution of the tool until an event specified in aEventList arrives.
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 Add(EDA_ITEM *aItem)
Definition: selection.cpp:32
virtual std::unique_ptr< BOARD_ITEM > CreateItem()=0
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:214
virtual void OnEditItemRequest(BOARD_ITEM *aItem)=0
Install the corresponding dialog editor for the given item.
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
static TOOL_ACTION properties
Activation of the edit tool.
Definition: pcb_actions.h:117
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:299
bool IsRotateToolEvt(const TOOL_EVENT &aEvt)
Function isRotateToolEvt()
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
Definition: pcb_view.cpp:75
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:205
TOOL_MANAGER * GetManager() const
Return 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)
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: pcb_view.cpp:92
const PCB_SELECTION & selection() const
Allow repeat placement of the item.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
Generic, UI-independent tool event.
Definition: tool_event.h:152
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)
Add an item to the group.
Definition: view_group.cpp:57
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
virtual BOARD_ITEM_CONTAINER * GetModel() const =0
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
PCBNEW_SETTINGS & Settings()
void Activate()
Run the tool.
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction) const
Invoke a function on all BOARD_ITEMs that belong to the footprint (pads, drawings,...
Definition: footprint.cpp:1299
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
Definition: pcb_view.cpp:58
PCB_BASE_EDIT_FRAME * m_frame
Definition: pcb_tool_base.h:64
int GetEventRotationAngle(const PCB_BASE_EDIT_FRAME &aFrame, const TOOL_EVENT &aEvt)
Function getEventRotationAngle()
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:59
static TOOL_ACTION refreshPreview
Definition: actions.h:106

References TOOL_INTERACTIVE::Activate(), KIGFX::PCB_VIEW::Add(), KIGFX::VIEW_GROUP::Add(), SELECTION::Add(), ARROW, 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(), TOOL_EVT_UTILS::GetEventRotationAngle(), TOOL_BASE::GetManager(), PCB_BASE_FRAME::GetModel(), TOOL_BASE::getView(), grid, 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_BASE_EDIT_FRAME::OnEditItemRequest(), PCB_FOOTPRINT_T, PENCIL, PLACE, INTERACTIVE_PLACER_BASE::PlaceItem(), TOOLS_HOLDER::PopTool(), TOOL_MANAGER::ProcessEvent(), PCB_ACTIONS::properties, BOARD_COMMIT::Push(), TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, KIGFX::PCB_VIEW::Remove(), TOOL_MANAGER::RunAction(), FOOTPRINT::RunOnChildren(), EVENTS::SelectedItemsModified, 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_TOOL_BASE::view(), and TOOL_INTERACTIVE::Wait().

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

◆ DoSetDrillOrigin()

void BOARD_EDITOR_CONTROL::DoSetDrillOrigin ( KIGFX::VIEW aView,
PCB_BASE_FRAME aFrame,
EDA_ITEM aItem,
const VECTOR2D aPoint 
)
static

Definition at line 1567 of file board_editor_control.cpp.

1569 {
1570  aFrame->GetDesignSettings().SetAuxOrigin( wxPoint( aPosition ) );
1571  originViewItem->SetPosition( (wxPoint) aPosition );
1572  aView->MarkDirty();
1573  aFrame->OnModify();
1574 }
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
void SetAuxOrigin(const wxPoint &aOrigin)
virtual void OnModify()
Must be called after a change in order to set the "modify" flag of the current screen and update the ...
void MarkDirty()
Force redraw of view on the next rendering.
Definition: view.h:633

References PCB_BASE_FRAME::GetDesignSettings(), KIGFX::VIEW::MarkDirty(), PCB_BASE_FRAME::OnModify(), BOARD_DESIGN_SETTINGS::SetAuxOrigin(), and EDA_ITEM::SetPosition().

Referenced by DrillOrigin(), and PCB_BASE_EDIT_FRAME::PutDataInPreviousState().

◆ DrillOrigin()

int BOARD_EDITOR_CONTROL::DrillOrigin ( const TOOL_EVENT aEvent)

Low-level access (below undo) to setting the drill origin.

Definition at line 1577 of file board_editor_control.cpp.

1578 {
1579  std::string tool = aEvent.GetCommandStr().get();
1581 
1582  // Deactivate other tools; particularly important if another PICKER is currently running
1583  Activate();
1584 
1585  picker->SetClickHandler(
1586  [this] ( const VECTOR2D& pt ) -> bool
1587  {
1589  DoSetDrillOrigin( getView(), m_frame, m_placeOrigin.get(), pt );
1590  return false; // drill origin is a one-shot; don't continue with tool
1591  } );
1592 
1593  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
1594 
1595  return 0;
1596 }
void SaveCopyInUndoList(EDA_ITEM *aItemToCopy, UNDO_REDO aTypeCommand) override
Create a new entry in undo list of commands.
Definition: undo_redo.cpp:179
static void DoSetDrillOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, EDA_ITEM *aItem, const VECTOR2D &aPoint)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_placeOrigin
static TOOL_ACTION pickerTool
Definition: actions.h:155
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
Generic tool for picking an item.
void SetClickHandler(CLICK_HANDLER aHandler)
Set a handler for mouse click event.
Definition: picker_tool.h:71
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:460
void Activate()
Run the tool.

References TOOL_INTERACTIVE::Activate(), DoSetDrillOrigin(), DRILLORIGIN, TOOL_EVENT::GetCommandStr(), TOOL_MANAGER::GetTool(), TOOL_BASE::getView(), m_frame, m_placeOrigin, TOOL_BASE::m_toolMgr, ACTIONS::pickerTool, TOOL_MANAGER::RunAction(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), and PICKER_TOOL_BASE::SetClickHandler().

Referenced by setTransitions().

◆ EditFpInFpEditor()

int BOARD_EDITOR_CONTROL::EditFpInFpEditor ( const TOOL_EVENT aEvent)

Definition at line 1535 of file board_editor_control.cpp.

1536 {
1539 
1540  if( selection.Empty() )
1541  return 0;
1542 
1544 
1545  if( !fp )
1546  return 0;
1547 
1548  PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
1549 
1550  auto editor = (FOOTPRINT_EDIT_FRAME*) editFrame->Kiway().Player( FRAME_FOOTPRINT_EDITOR, true );
1551 
1552  if( aEvent.IsAction( &PCB_ACTIONS::editFpInFpEditor ) )
1553  editor->LoadFootprintFromBoard( fp );
1554  else if( aEvent.IsAction( &PCB_ACTIONS::editLibFpInFpEditor ) )
1555  editor->LoadFootprintFromLibrary( fp->GetFPID() );
1556 
1557  editor->Show( true );
1558  editor->Raise(); // Iconize( false );
1559 
1560  if( selection.IsHover() )
1562 
1563  return 0;
1564 }
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:59
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
bool IsHover() const
Definition: selection.h:74
static TOOL_ACTION editFpInFpEditor
Definition: pcb_actions.h:344
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:393
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:88
const PCB_SELECTION & selection() const
const LIB_ID & GetFPID() const
Definition: footprint.h:195
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:98
PCB_SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter, bool aConfirmLockedItems=false)
Return the current selection set, filtered according to aFlags and aClientFilter.
Common, abstract interface for edit frames.
The selection tool: currently supports:
static TOOL_ACTION editLibFpInFpEditor
Definition: pcb_actions.h:345
T * FirstOfKind() const
Definition: selection.h:156
static void FootprintFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector, PCB_SELECTION_TOOL *sTool)
A selection filter which prunes the selection to contain only items of type #PCB_MODULE_T.
Definition: edit_tool.cpp:2256

References PCB_ACTIONS::editFpInFpEditor, PCB_ACTIONS::editLibFpInFpEditor, editor, SELECTION::Empty(), SELECTION::FirstOfKind(), EDIT_TOOL::FootprintFilter(), FRAME_FOOTPRINT_EDITOR, FOOTPRINT::GetFPID(), TOOL_MANAGER::GetTool(), TOOL_EVENT::IsAction(), SELECTION::IsHover(), KIWAY_HOLDER::Kiway(), TOOL_BASE::m_toolMgr, KIWAY::Player(), PCB_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), PCB_TOOL_BASE::selection(), and PCB_ACTIONS::selectionClear.

Referenced by setTransitions().

◆ ExportNetlist()

int BOARD_EDITOR_CONTROL::ExportNetlist ( const TOOL_EVENT aEvent)

Definition at line 459 of file board_editor_control.cpp.

460 {
461  wxCHECK( m_frame, 0 );
462 
463  wxFileName fn = m_frame->Prj().GetProjectFullName();
464 
465  // Use a different file extension for the board netlist so the schematic netlist file
466  // is accidentally overwritten.
467  fn.SetExt( wxT( "pcb_net" ) );
468 
469  wxFileDialog dlg( m_frame, _( "Export Board Netlist" ), fn.GetPath(), fn.GetFullName(),
470  _( "KiCad board netlist files" ) + AddFileExtListToFilter( { "pcb_net" } ),
471  wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
472 
473  dlg.SetExtraControlCreator( &NETLIST_OPTIONS_HELPER::Create );
474 
475  if( dlg.ShowModal() == wxID_CANCEL )
476  return 0;
477 
478  fn = dlg.GetPath();
479 
480  if( !fn.IsDirWritable() )
481  {
482  wxString msg;
483 
484  msg.Printf( _( "Path `%s` is read only." ), fn.GetPath() );
485  wxMessageDialog( m_frame, msg, _( "I/O Error" ), wxOK | wxCENTER | wxICON_EXCLAMATION );
486  return 0;
487  }
488 
489  const NETLIST_OPTIONS_HELPER* noh =
490  dynamic_cast<const NETLIST_OPTIONS_HELPER*>( dlg.GetExtraControl() );
491  wxCHECK( noh, 0 );
492 
494 
495  for( const FOOTPRINT* footprint : board()->Footprints() )
496  {
497  COMPONENT* component = new COMPONENT( footprint->GetFPID(), footprint->GetReference(),
499  { footprint->m_Uuid } );
500 
501  for( const PAD* pad : footprint->Pads() )
502  {
503  const wxString& netname = pad->GetShortNetname();
504 
505  if( !netname.IsEmpty() )
506  {
507  component->AddNet( pad->GetNumber(), netname, pad->GetPinFunction(),
508  pad->GetPinType() );
509  }
510  }
511 
512  netlist.AddComponent( component );
513  }
514 
515  FILE_OUTPUTFORMATTER formatter( fn.GetFullPath() );
516 
517  netlist.Format( "pcb_netlist", &formatter, 0, noh->GetNetlistOptions() );
518 
519  return 0;
520 }
const wxString & GetValue() const
Definition: footprint.h:485
BOARD * board() const
const KIID_PATH & GetPath() const
Definition: footprint.h:204
PADS & Pads()
Definition: footprint.h:169
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition: pcb_netlist.h:206
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
FOOTPRINT * footprint() const
const wxString & GetReference() const
Definition: footprint.h:463
#define _(s)
const LIB_ID & GetFPID() const
Definition: footprint.h:195
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
Definition: project.cpp:116
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:84
const KIID m_Uuid
Definition: eda_item.h:474
void AddNet(const wxString &aPinName, const wxString &aNetName, const wxString &aPinFunction, const wxString &aPinType)
Definition: pcb_netlist.h:103
Used for text file output.
Definition: richio.h:456
static wxWindow * Create(wxWindow *aParent)
Definition: pad.h:57
Helper widget to add controls to a wxFileDialog to set netlist configuration options.
wxString AddFileExtListToFilter(const std::vector< std::string > &aExts)
Build the wildcard extension file dialog wildcard filter to add to the base message dialog.

References _, AddFileExtListToFilter(), COMPONENT::AddNet(), PCB_TOOL_BASE::board(), COMPONENT, NETLIST_OPTIONS_HELPER::Create(), PCB_TOOL_BASE::footprint(), FOOTPRINT::GetFPID(), NETLIST_OPTIONS_HELPER::GetNetlistOptions(), FOOTPRINT::GetPath(), PROJECT::GetProjectFullName(), FOOTPRINT::GetReference(), FOOTPRINT::GetValue(), m_frame, EDA_ITEM::m_Uuid, netlist, pad, FOOTPRINT::Pads(), and KIWAY_HOLDER::Prj().

Referenced by setTransitions().

◆ ExportSpecctraDSN()

int BOARD_EDITOR_CONTROL::ExportSpecctraDSN ( const TOOL_EVENT aEvent)

Definition at line 430 of file board_editor_control.cpp.

431 {
432  wxString fullFileName = m_frame->GetLastPath( LAST_PATH_SPECCTRADSN );
433  wxFileName fn;
434 
435  if( fullFileName.IsEmpty() )
436  {
437  fn = m_frame->GetBoard()->GetFileName();
438  fn.SetExt( SpecctraDsnFileExtension );
439  }
440  else
441  {
442  fn = fullFileName;
443  }
444 
445  fullFileName = wxFileSelector( _( "Specctra DSN File" ), fn.GetPath(), fn.GetFullName(),
447  wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxFD_CHANGE_DIR, frame() );
448 
449  if( !fullFileName.IsEmpty() )
450  {
451  m_frame->SetLastPath( LAST_PATH_SPECCTRADSN, fullFileName );
452  getEditFrame<PCB_EDIT_FRAME>()->ExportSpecctraFile( fullFileName );
453  }
454 
455  return 0;
456 }
const wxString & GetFileName() const
Definition: board.h:229
wxString GetLastPath(LAST_PATH_TYPE aType)
Get the last path for a particular type.
PCB_BASE_EDIT_FRAME * frame() const
#define _(s)
const std::string SpecctraDsnFileExtension
wxString SpecctraDsnFileWildcard()
BOARD * GetBoard() const
void SetLastPath(LAST_PATH_TYPE aType, const wxString &aLastPath)
Set the path of the last file successfully read.

References _, PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetBoard(), BOARD::GetFileName(), PCB_EDIT_FRAME::GetLastPath(), LAST_PATH_SPECCTRADSN, m_frame, PCB_EDIT_FRAME::SetLastPath(), SpecctraDsnFileExtension, and SpecctraDsnFileWildcard().

Referenced by setTransitions().

◆ Find()

int BOARD_EDITOR_CONTROL::Find ( const TOOL_EVENT aEvent)

Definition at line 380 of file board_editor_control.cpp.

381 {
383  return 0;
384 }
void ShowFindDialog()
Show the Find dialog.

References m_frame, and PCB_EDIT_FRAME::ShowFindDialog().

Referenced by setTransitions().

◆ FindNext()

int BOARD_EDITOR_CONTROL::FindNext ( const TOOL_EVENT aEvent)

Definition at line 387 of file board_editor_control.cpp.

388 {
389  m_frame->FindNext();
390  return 0;
391 }
void FindNext()
Find the next item using our existing search parameters.

References PCB_EDIT_FRAME::FindNext(), and m_frame.

Referenced by setTransitions().

◆ footprint()

◆ frame()

PCB_BASE_EDIT_FRAME* PCB_TOOL_BASE::frame ( ) const
inlineprotectedinherited

Definition at line 160 of file pcb_tool_base.h.

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

Referenced by PCB_POINT_EDITOR::addCorner(), AUTOPLACE_TOOL::autoplace(), PCB_TOOL_BASE::canvas(), ZONE_FILLER_TOOL::CheckAllZones(), PNS::TOOL_BASE::checkSnap(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), ROUTER_TOOL::CustomTrackWidthDialog(), FOOTPRINT_EDITOR_CONTROL::DeleteFootprint(), PCB_TOOL_BASE::displayOptions(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), ROUTER_TOOL::DpDimensionsDialog(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EditPad(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), ExportSpecctraDSN(), ZONE_FILLER_TOOL::FillAllZones(), EDIT_TOOL::FilletTracks(), PCB_SELECTION_TOOL::FilterCollectorForFreePads(), ROUTER_TOOL::finishInteractive(), EDIT_TOOL::Flip(), PCB_CONTROL::FlipPcbView(), GLOBAL_EDIT_TOOL::GlobalDeletions(), ROUTER_TOOL::handleLayerSwitch(), BOARD_INSPECTION_TOOL::HighlightItem(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), ImportSpecctraSession(), ROUTER_TOOL::Init(), SCRIPTING_TOOL::Init(), PCB_SELECTION_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_TOOL_BASE::Is45Limited(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::MoveExact(), PCB_POINT_EDITOR::OnSelectionChange(), PCB_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), PCB_CONTROL::placeBoardItems(), PlaceFootprint(), PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PAD_TOOL::pushPadSettings(), PAD_TOOL::recombinePad(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), SCRIPTING_TOOL::reloadPlugins(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), PCB_SELECTION_TOOL::RequestSelection(), PAD_TOOL::Reset(), PNS::TOOL_BASE::Reset(), EDIT_TOOL::Rotate(), ROUTER_TOOL::SelectCopperLayerPair(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), PCB_POINT_EDITOR::setEditedPoint(), ROUTER_TOOL::SettingsDialog(), GLOBAL_EDIT_TOOL::swapBoardItem(), GLOBAL_EDIT_TOOL::SwapLayers(), ROUTER_TOOL::switchLayerOnViaPlacement(), PCB_CONTROL::unfilledZoneCheck(), ROUTER_TOOL::UpdateMessagePanel(), EDIT_TOOL::updateModificationPoint(), UpdateSchematicFromPCB(), ZONE_FILLER_TOOL::ZoneFill(), and ZONE_FILLER_TOOL::ZoneFillAll().

◆ GenerateDrillFiles()

int BOARD_EDITOR_CONTROL::GenerateDrillFiles ( const TOOL_EVENT aEvent)

Definition at line 58 of file dialog_gendrill.cpp.

59 {
60  PCB_EDIT_FRAME* editFrame = getEditFrame<PCB_EDIT_FRAME>();
61  DIALOG_GENDRILL dlg( editFrame, editFrame );
62 
63  dlg.ShowModal();
64  return 0;
65 }
The main frame for Pcbnew.

Referenced by setTransitions().

◆ GenerateFabFiles()

int BOARD_EDITOR_CONTROL::GenerateFabFiles ( const TOOL_EVENT aEvent)

Definition at line 523 of file board_editor_control.cpp.

524 {
525  wxCommandEvent dummy;
526 
527  if( aEvent.IsAction( &PCB_ACTIONS::generateGerbers ) )
529  else if( aEvent.IsAction( &PCB_ACTIONS::generateReportFile ) )
531  else if( aEvent.IsAction( &PCB_ACTIONS::generateD356File ) )
533  else if( aEvent.IsAction( &PCB_ACTIONS::generateBOM ) )
535  else
536  wxFAIL_MSG( wxT( "GenerateFabFiles(): unexpected request" ) );
537 
538  return 0;
539 }
static TOOL_ACTION generateGerbers
Definition: pcb_actions.h:334
void ToPlotter(int aID)
Open a dialog frame to create plot and drill files relative to the current board.
void RecreateBOMFileFromBoard(wxCommandEvent &aEvent)
Create a BOM file from the current loaded board.
static TOOL_ACTION generateReportFile
Definition: pcb_actions.h:337
static TOOL_ACTION generateD356File
Definition: pcb_actions.h:338
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:88
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:72
void GenFootprintsReport(wxCommandEvent &event)
Call DoGenFootprintsReport to create a footprint report file.
static TOOL_ACTION generateBOM
Definition: pcb_actions.h:339
void GenD356File(wxCommandEvent &event)

References dummy(), PCB_EDIT_FRAME::GenD356File(), PCB_ACTIONS::generateBOM, PCB_ACTIONS::generateD356File, PCB_ACTIONS::generateGerbers, PCB_ACTIONS::generateReportFile, PCB_EDIT_FRAME::GenFootprintsReport(), ID_GEN_PLOT_GERBER, TOOL_EVENT::IsAction(), m_frame, PCB_EDIT_FRAME::RecreateBOMFileFromBoard(), and PCB_EDIT_FRAME::ToPlotter().

Referenced by setTransitions().

◆ GeneratePosFile()

int BOARD_EDITOR_CONTROL::GeneratePosFile ( const TOOL_EVENT aEvent)

Definition at line 516 of file gen_footprints_placefile.cpp.

517 {
518  PCB_EDIT_FRAME* editFrame = getEditFrame<PCB_EDIT_FRAME>();
519  DIALOG_GEN_FOOTPRINT_POSITION dlg( editFrame );
520 
521  dlg.ShowModal();
522  return 0;
523 }
The main frame for Pcbnew.
The dialog to create footprint position files and choose options (one or 2 files, units and force all...

Referenced by setTransitions().

◆ getEditFrame()

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

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

Definition at line 184 of file tool_base.h.

185  {
186 #if !defined( QA_TEST ) // Dynamic casts give the linker a seizure in the test framework
187  wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
188 #endif
189  return static_cast<T*>( getToolHolderInt() );
190  }
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

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 120 of file tool_base.h.

121  {
122  return m_toolId;
123  }
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209

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

Return the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER or NULL if there is no associated tool manager.

Definition at line 143 of file tool_base.h.

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

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

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 196 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ GetName()

const std::string& TOOL_BASE::GetName ( void  ) const
inlineinherited

Return the name of the tool.

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

Returns
The name of the tool.

Definition at line 133 of file tool_base.h.

134  {
135  return m_toolName;
136  }
std::string m_toolName
Definition: tool_base.h:213

References TOOL_BASE::m_toolName.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 108 of file tool_base.h.

109  {
110  return m_type;
111  }
TOOL_TYPE m_type
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:206

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

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:283
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214

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::CheckSymbol(), GERBVIEW_CONTROL::ClearAllLayers(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::CollectHits(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::DrawZone(), DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCB_CONTROL::GridResetOrigin(), PCB_CONTROL::GridSetOrigin(), ROUTER_TOOL::handleCommonEvents(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), PL_EDIT_TOOL::moveItem(), SCH_MOVE_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), ROUTER_TOOL::performRouting(), PNS::TOOL_BASE::pickSingleItem(), PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), PlaceTarget(), ROUTER_TOOL::prepareInteractive(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), Reset(), PNS::TOOL_BASE::Reset(), PCB_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), PCB_SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), PCB_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectAll(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), PCB_SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), PCB_SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and PCB_SELECTION_TOOL::~PCB_SELECTION_TOOL().

◆ getViewControls()

KIGFX::VIEW_CONTROLS * TOOL_BASE::getViewControls ( ) const
protectedinherited

Return 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:214
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:285

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

Referenced by EE_POINT_EDITOR::addCorner(), PCB_POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDITOR_CONTROL::AssignNetclass(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), EDIT_TOOL::copyToClipboard(), SCH_DRAWING_TOOLS::createSheetPin(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_DRAWING_TOOLS::GetCanvasFreeAreaPixels(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), PCB_CONTROL::placeBoardItems(), PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), PCB_POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), PCB_SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PCB_PICKER_TOOL::setControls(), PICKER_TOOL::setControls(), PL_POINT_EDITOR::setEditedPoint(), EE_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateItem(), PL_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

Define which state (aStateFunc) to go when a certain event arrives (aConditions).

No conditions means any event.

Definition at line 147 of file tool_interactive.h.

149 {
150  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
151 
152  goInternal( sptr, aConditions );
153 }
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 AUTOPLACE_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), BOARD_REANNOTATE_TOOL::setTransitions(), GERBVIEW_INSPECTION_TOOL::setTransitions(), PCB_PICKER_TOOL::setTransitions(), SCH_NAVIGATE_TOOL::setTransitions(), SYMBOL_EDITOR_PIN_TOOL::setTransitions(), SYMBOL_EDITOR_MOVE_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), PL_POINT_EDITOR::setTransitions(), ROUTER_TOOL::setTransitions(), SCRIPTING_TOOL::setTransitions(), COMMON_CONTROL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), CONVERT_TOOL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), MICROWAVE_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PCB_POINT_EDITOR::setTransitions(), GERBVIEW_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), PAD_TOOL::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), SCH_EDIT_TOOL::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), DRC_TOOL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), PCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), setTransitions(), PICKER_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), PCB_SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), DRAWING_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ ImportNetlist()

int BOARD_EDITOR_CONTROL::ImportNetlist ( const TOOL_EVENT aEvent)

Definition at line 401 of file board_editor_control.cpp.

402 {
403  getEditFrame<PCB_EDIT_FRAME>()->InstallNetlistFrame();
404  return 0;
405 }

Referenced by setTransitions().

◆ ImportSpecctraSession()

int BOARD_EDITOR_CONTROL::ImportSpecctraSession ( const TOOL_EVENT aEvent)

Definition at line 408 of file board_editor_control.cpp.

409 {
410  wxString fullFileName = frame()->GetBoard()->GetFileName();
411  wxString path;
412  wxString name;
413  wxString ext;
414 
415  wxFileName::SplitPath( fullFileName, &path, &name, &ext );
416  name += wxT( "." ) + SpecctraSessionFileExtension;
417 
418  fullFileName = wxFileSelector( _( "Specctra Session File" ), path, name,
419  wxT( "." ) + SpecctraSessionFileExtension,
420  SpecctraSessionFileWildcard(), wxFD_OPEN | wxFD_CHANGE_DIR,
421  frame() );
422 
423  if( !fullFileName.IsEmpty() )
424  getEditFrame<PCB_EDIT_FRAME>()->ImportSpecctraSession( fullFileName );
425 
426  return 0;
427 }
const wxString & GetFileName() const
Definition: board.h:229
PCB_BASE_EDIT_FRAME * frame() const
wxString SpecctraSessionFileWildcard()
#define _(s)
const std::string SpecctraSessionFileExtension
const char * name
Definition: DXF_plotter.cpp:56
BOARD * GetBoard() const

References _, PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetBoard(), BOARD::GetFileName(), name, path, SpecctraSessionFileExtension, and SpecctraSessionFileWildcard().

Referenced by setTransitions().

◆ Init()

bool BOARD_EDITOR_CONTROL::Init ( )
overridevirtual

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

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

Reimplemented from PCB_TOOL_BASE.

Definition at line 206 of file board_editor_control.cpp.

207 {
208  auto activeToolCondition =
209  [this]( const SELECTION& aSel )
210  {
211  return ( !m_frame->ToolStackIsEmpty() );
212  };
213 
214  auto inactiveStateCondition =
215  [this]( const SELECTION& aSel )
216  {
217  return ( m_frame->ToolStackIsEmpty() && aSel.Size() == 0 );
218  };
219 
220  auto placeModuleCondition =
221  [this]( const SELECTION& aSel )
222  {
223  return m_frame->IsCurrentTool( PCB_ACTIONS::placeFootprint ) && aSel.GetSize() == 0;
224  };
225 
226  auto& ctxMenu = m_menu.GetMenu();
227 
228  // "Cancel" goes at the top of the context menu when a tool is active
229  ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolCondition, 1 );
230  ctxMenu.AddSeparator( 1 );
231 
232  // "Get and Place Footprint" should be available for Place Footprint tool
233  ctxMenu.AddItem( PCB_ACTIONS::getAndPlace, placeModuleCondition, 1000 );
234  ctxMenu.AddSeparator( 1000 );
235 
236  // Finally, add the standard zoom & grid items
237  getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus( m_menu );
238 
239  auto zoneMenu = std::make_shared<ZONE_CONTEXT_MENU>();
240  zoneMenu->SetTool( this );
241 
242  auto lockMenu = std::make_shared<LOCK_CONTEXT_MENU>();
243  lockMenu->SetTool( this );
244 
245  // Add the PCB control menus to relevant other tools
246 
248 
249  if( selTool )
250  {
251  auto& toolMenu = selTool->GetToolMenu();
252  auto& menu = toolMenu.GetMenu();
253 
254  // Add "Get and Place Footprint" when Selection tool is in an inactive state
255  menu.AddItem( PCB_ACTIONS::getAndPlace, inactiveStateCondition );
256  menu.AddSeparator();
257 
258  toolMenu.AddSubMenu( zoneMenu );
259  toolMenu.AddSubMenu( lockMenu );
260 
261  menu.AddMenu( lockMenu.get(), SELECTION_CONDITIONS::NotEmpty, 100 );
262 
263  menu.AddMenu( zoneMenu.get(), SELECTION_CONDITIONS::OnlyType( PCB_ZONE_T ), 200 );
264  }
265 
266  DRAWING_TOOL* drawingTool = m_toolMgr->GetTool<DRAWING_TOOL>();
267 
268  if( drawingTool )
269  {
270  auto& toolMenu = drawingTool->GetToolMenu();
271  auto& menu = toolMenu.GetMenu();
272 
273  toolMenu.AddSubMenu( zoneMenu );
274 
275  // Functor to say if the PCB_EDIT_FRAME is in a given mode
276  // Capture the tool pointer and tool mode by value
277  auto toolActiveFunctor =
278  [=]( DRAWING_TOOL::MODE aMode )
279  {
280  return [=]( const SELECTION& sel )
281  {
282  return drawingTool->GetDrawingMode() == aMode;
283  };
284  };
285 
286  menu.AddMenu( zoneMenu.get(), toolActiveFunctor( DRAWING_TOOL::MODE::ZONE ), 200 );
287  }
288 
289  return true;
290 }
bool IsCurrentTool(const TOOL_ACTION &aAction) const
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
static TOOL_ACTION cancelInteractive
Definition: actions.h:62
TOOL_MENU & GetToolMenu()
static TOOL_ACTION getAndPlace
Find an item and start moving.
Definition: pcb_actions.h:468
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
Tool responsible for drawing graphical elements like lines, arcs, circles, etc.
Definition: drawing_tool.h:50
bool ToolStackIsEmpty()
Definition: tools_holder.h:116
class ZONE, a copper pour area
Definition: typeinfo.h:105
static TOOL_ACTION placeFootprint
Definition: pcb_actions.h:157
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Create a functor that tests if the selected items are only of given type.
The selection tool: currently supports:
MODE GetDrawingMode() const
Return the current drawing mode of the DRAWING_TOOL or #MODE::NONE if not currently in any drawing mo...
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.

References CONDITIONAL_MENU::AddItem(), ACTIONS::cancelInteractive, PCB_ACTIONS::getAndPlace, DRAWING_TOOL::GetDrawingMode(), TOOL_MENU::GetMenu(), TOOL_MANAGER::GetTool(), TOOL_INTERACTIVE::GetToolMenu(), TOOLS_HOLDER::IsCurrentTool(), m_frame, TOOL_INTERACTIVE::m_menu, TOOL_BASE::m_toolMgr, SELECTION_CONDITIONS::NotEmpty(), SELECTION_CONDITIONS::OnlyType(), PCB_ZONE_T, PCB_ACTIONS::placeFootprint, TOOLS_HOLDER::ToolStackIsEmpty(), and DRAWING_TOOL::ZONE.

◆ Is45Limited()

bool PCB_TOOL_BASE::Is45Limited ( ) const
virtualinherited

Should the tool use its 45° mode option?

Returns
True if set to use 45°

Definition at line 323 of file pcb_tool_base.cpp.

324 {
325  if( frame()->IsType( FRAME_PCB_EDITOR ) )
327  else
329 }
PCB_BASE_EDIT_FRAME * frame() const
PCBNEW_SETTINGS & Settings()

References PCB_TOOL_BASE::frame(), FRAME_PCB_EDITOR, PCBNEW_SETTINGS::m_FpeditUse45DegreeLimit, PCBNEW_SETTINGS::m_PcbUse45DegreeLimit, and PCB_BASE_FRAME::Settings().

Referenced by DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), and DRAWING_TOOL::DrawZone().

◆ IsFootprintEditor()

◆ 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:214
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209
bool IsToolActive(TOOL_ID aId) const
Return 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::Drag(), ROUTER_TOOL::handleLayerSwitch(), EDIT_TOOL::isRouterActive(), PCB_SELECTION_TOOL::Main(), TrackWidthDec(), and TrackWidthInc().

◆ LockSelected()

int BOARD_EDITOR_CONTROL::LockSelected ( const TOOL_EVENT aEvent)

Unlock selected items.

Definition at line 1185 of file board_editor_control.cpp.

1186 {
1187  return modifyLockSelected( ON );
1188 }
int modifyLockSelected(MODIFY_MODE aMode)
Set up handlers for various events.

References modifyLockSelected(), and ON.

Referenced by setTransitions().

◆ modifyLockSelected()

int BOARD_EDITOR_CONTROL::modifyLockSelected ( MODIFY_MODE  aMode)
private

Set up handlers for various events.

Definition at line 1197 of file board_editor_control.cpp.

1198 {
1200  const PCB_SELECTION& selection = selTool->GetSelection();
1201  BOARD_COMMIT commit( m_frame );
1202 
1203  if( selection.Empty() )
1205 
1206  // Resolve TOGGLE mode
1207  if( aMode == TOGGLE )
1208  {
1209  aMode = ON;
1210 
1211  for( EDA_ITEM* item : selection )
1212  {
1213  BOARD_ITEM* board_item = static_cast<BOARD_ITEM*>( item );
1214 
1215  if( board_item->IsLocked() )
1216  {
1217  aMode = OFF;
1218  break;
1219  }
1220  }
1221  }
1222 
1223  bool modified = false;
1224 
1225  for( EDA_ITEM* item : selection )
1226  {
1227  BOARD_ITEM* board_item = static_cast<BOARD_ITEM*>( item );
1228 
1229  commit.Modify( board_item );
1230 
1231  if( aMode == ON )
1232  {
1233  modified |= !board_item->IsLocked();
1234  board_item->SetLocked( true );
1235  }
1236  else
1237  {
1238  modified |= board_item->IsLocked();
1239  board_item->SetLocked( false );
1240  }
1241  }
1242 
1243  if( modified )
1244  {
1245  commit.Push( aMode == ON ? _( "Lock" ) : _( "Unlock" ) );
1246 
1249  m_frame->OnModify();
1250  }
1251 
1252  return 0;
1253 }
void OnModify() override
Must be called after a board change to set the modified flag.
static const TOOL_EVENT SelectedEvent
Definition: actions.h:200
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
virtual void SetLocked(bool aLocked)
Modify the 'lock' status for of the item.
Definition: board_item.h:218
virtual bool IsLocked() const
Definition: board_item.cpp:64
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
const PCB_SELECTION & selection() const
#define _(s)
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:98
The selection tool: currently supports:
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
Definition: pcb_actions.h:56
virtual void UpdateMsgPanel()
Redraw the message panel.

References _, SELECTION::Empty(), PCB_SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), BOARD_ITEM::IsLocked(), m_frame, TOOL_BASE::m_toolMgr, COMMIT::Modify(), OFF, ON, PCB_EDIT_FRAME::OnModify(), TOOL_MANAGER::PostEvent(), BOARD_COMMIT::Push(), TOOL_MANAGER::RunAction(), EVENTS::SelectedEvent, PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionCursor, BOARD_ITEM::SetLocked(), TOGGLE, and EDA_DRAW_FRAME::UpdateMsgPanel().

Referenced by LockSelected(), ToggleLockSelected(), and UnlockSelected().

◆ New()

int BOARD_EDITOR_CONTROL::New ( const TOOL_EVENT aEvent)

Definition at line 293 of file board_editor_control.cpp.

294 {
296  return 0;
297 }
bool Files_io_from_id(int aId)
Read and write board files according to aId.

References PCB_EDIT_FRAME::Files_io_from_id(), ID_NEW_BOARD, and m_frame.

Referenced by setTransitions().

◆ Open()

int BOARD_EDITOR_CONTROL::Open ( const TOOL_EVENT aEvent)

Definition at line 300 of file board_editor_control.cpp.

301 {
303  return 0;
304 }
bool Files_io_from_id(int aId)
Read and write board files according to aId.

References PCB_EDIT_FRAME::Files_io_from_id(), ID_LOAD_FILE, and m_frame.

Referenced by setTransitions().

◆ PageSettings()

int BOARD_EDITOR_CONTROL::PageSettings ( const TOOL_EVENT aEvent)

Definition at line 328 of file board_editor_control.cpp.

329 {
330  PICKED_ITEMS_LIST undoCmd;
331  DS_PROXY_UNDO_ITEM* undoItem = new DS_PROXY_UNDO_ITEM( m_frame );
332  ITEM_PICKER wrapper( nullptr, undoItem, UNDO_REDO::PAGESETTINGS );
333 
334  undoCmd.PushItem( wrapper );
336 
339  dlg.SetWksFileName( BASE_SCREEN::m_DrawingSheetFileName );
340 
341  if( dlg.ShowModal() == wxID_OK )
342  {
344  [&]( KIGFX::VIEW_ITEM* aItem ) -> bool
345  {
346  BOARD_ITEM* item = dynamic_cast<BOARD_ITEM*>( aItem );
347 
348  if( !item )
349  return false;
350 
351  switch( item->Type() )
352  {
353  case PCB_TEXT_T:
354  case PCB_FP_TEXT_T:
355  return true; // text variables
356 
357  default:
358  return false;
359  }
360  } );
361 
362  m_frame->OnModify();
363  }
364  else
365  {
367  }
368 
369  return 0;
370 }
void RollbackFromUndo()
Perform an undo of the last edit without logging a corresponding redo.
Definition: undo_redo.cpp:576
void OnModify() override
Must be called after a board change to set the modified flag.
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
void SaveCopyInUndoList(EDA_ITEM *aItemToCopy, UNDO_REDO aTypeCommand) override
Create a new entry in undo list of commands.
Definition: undo_redo.cpp:179
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
Definition: view.cpp:1492
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
class PCB_TEXT, text on a layer
Definition: typeinfo.h:91
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:76
Item needs to be redrawn.
Definition: view_item.h:52
#define MAX_PAGE_SIZE_PCBNEW_MILS
Definition: page_info.h:40
A holder to handle information on schematic or board items.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
static wxString m_DrawingSheetFileName
the name of the drawing sheet file, or empty to use the default drawing sheet
Definition: base_screen.h:85
#define IU_PER_MILS
Definition: plotter.cpp:130
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

References PCB_BASE_FRAME::GetCanvas(), PCB_DRAW_PANEL_GAL::GetView(), IU_PER_MILS, BASE_SCREEN::m_DrawingSheetFileName, m_frame, MAX_PAGE_SIZE_PCBNEW_MILS, PCB_EDIT_FRAME::OnModify(), PAGESETTINGS, PCB_FP_TEXT_T, PCB_TEXT_T, PICKED_ITEMS_LIST::PushItem(), KIGFX::REPAINT, PCB_BASE_EDIT_FRAME::RollbackFromUndo(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), DIALOG_PAGES_SETTINGS::SetWksFileName(), EDA_ITEM::Type(), and KIGFX::VIEW::UpdateAllItemsConditionally().

Referenced by setTransitions().

◆ PlaceFootprint()

int BOARD_EDITOR_CONTROL::PlaceFootprint ( const TOOL_EVENT aEvent)

Display a dialog to select a footprint to be added and allows the user to set its position.

Definition at line 984 of file board_editor_control.cpp.

985 {
986  if( m_inPlaceFootprint )
987  return 0;
988 
990 
991  FOOTPRINT* fp = aEvent.Parameter<FOOTPRINT*>();
993  BOARD_COMMIT commit( m_frame );
994  BOARD* board = getModel<BOARD>();
995 
997 
998  std::string tool = aEvent.GetCommandStr().get();
999  m_frame->PushTool( tool );
1000 
1001  auto setCursor =
1002  [&]()
1003  {
1005  };
1006 
1007  Activate();
1008  // Must be done after Activate() so that it gets set into the correct context
1009  controls->ShowCursor( true );
1010  // Set initial cursor
1011  setCursor();
1012 
1013  VECTOR2I cursorPos = controls->GetCursorPosition();
1014  bool reselect = false;
1015  bool fromOtherCommand = fp != nullptr;
1016  bool resetCursor = aEvent.HasPosition(); // Detect if activated from a hotkey.
1017 
1018  // Prime the pump
1019  if( fp )
1020  {
1021  m_placingFootprint = true;
1022  fp->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
1025  }
1026  else if( !aEvent.IsReactivate() )
1027  {
1029  }
1030 
1031  // Main loop: keep receiving events
1032  while( TOOL_EVENT* evt = Wait() )
1033  {
1034  setCursor();
1035  cursorPos = controls->GetCursorPosition( !evt->DisableGridSnapping() );
1036 
1037  if( reselect && fp )
1039 
1040  auto cleanup =
1041  [&] ()
1042  {
1044  commit.Revert();
1045 
1046  if( fromOtherCommand )
1047  {
1049 
1050  if( undo )
1051  {
1053  undo->ClearListAndDeleteItems();
1054  delete undo;
1055  }
1056  }
1057 
1058  fp = nullptr;
1059  m_placingFootprint = false;
1060  };
1061 
1062  if( evt->IsCancelInteractive() )
1063  {
1064  if( fp )
1065  {
1066  cleanup();
1067  }
1068  else
1069  {
1070  m_frame->PopTool( tool );
1071  break;
1072  }
1073  }
1074  else if( evt->IsActivate() )
1075  {
1076  if( fp )
1077  cleanup();
1078 
1079  if( evt->IsMoveTool() )
1080  {
1081  // leave ourselves on the stack so we come back after the move
1082  break;
1083  }
1084  else
1085  {
1086  frame()->PopTool( tool );
1087  break;
1088  }
1089  }
1090  else if( evt->IsClick( BUT_LEFT ) )
1091  {
1092  if( !fp )
1093  {
1094  // Pick the footprint to be placed
1096 
1097  if( fp == nullptr )
1098  continue;
1099 
1100  m_placingFootprint = true;
1101 
1102  fp->SetLink( niluuid );
1103 
1104  fp->SetFlags(IS_NEW ); // whatever
1105 
1106  // Set parent so that clearance can be loaded
1107  fp->SetParent( board );
1108 
1109  for( PAD* pad : fp->Pads() )
1110  {
1111  pad->SetLocalRatsnestVisible( m_frame->GetDisplayOptions().m_ShowGlobalRatsnest );
1112 
1113  // Pads in the library all have orphaned nets. Replace with Default.
1114  pad->SetNetCode( 0 );
1115  }
1116 
1117  // Put it on FRONT layer,
1118  // (Can be stored flipped if the lib is an archive built from a board)
1119  if( fp->IsFlipped() )
1120  fp->Flip( fp->GetPosition(), m_frame->Settings().m_FlipLeftRight );
1121 
1122  fp->SetOrientation( 0 );
1123  fp->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
1124 
1125  commit.Add( fp );
1127 
1128  // Reset cursor to the position before the dialog opened if activated from hotkey
1129  if( resetCursor )
1130  controls->SetCursorPosition( cursorPos, false );
1131 
1132  // Other events must be from hotkeys or mouse clicks, so always reset cursor
1133  resetCursor = true;
1134 
1136  }
1137  else
1138  {
1140  commit.Push( _( "Place a footprint" ) );
1141  fp = nullptr; // to indicate that there is no footprint that we currently modify
1142  m_placingFootprint = false;
1143  }
1144  }
1145  else if( evt->IsClick( BUT_RIGHT ) )
1146  {
1148  }
1149  else if( fp && ( evt->IsMotion() || evt->IsAction( &ACTIONS::refreshPreview ) ) )
1150  {
1151  fp->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
1152  selection().SetReferencePoint( cursorPos );
1153  getView()->Update( &selection() );
1154  getView()->Update( fp );
1155  }
1156  else if( fp && evt->IsAction( &PCB_ACTIONS::properties ) )
1157  {
1158  // Calling 'Properties' action clears the selection, so we need to restore it
1159  reselect = true;
1160  }
1161  else
1162  {
1163  evt->SetPassEvent();
1164  }
1165 
1166  // Enable autopanning and cursor capture only when there is a footprint to be placed
1167  controls->SetAutoPan( fp != nullptr );
1168  controls->CaptureCursor( fp != nullptr );
1169  }
1170 
1171  controls->SetAutoPan( false );
1172  controls->CaptureCursor( false );
1174 
1175  return 0;
1176 }
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:59
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
KIID niluuid(0)
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Suspend execution of the tool until an event specified in aEventList arrives.
BOARD * board() const
#define IS_NEW
New item, just created.
FOOTPRINT * SelectFootprintFromLibTree(LIB_ID aPreselect=LIB_ID())
Open a dialog to select a footprint.
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:214
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
static TOOL_ACTION properties
Activation of the edit tool.
Definition: pcb_actions.h:117
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:152
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Move cursor to the requested position expressed in world coordinates.
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList)
Used in undo or redo command.
Definition: undo_redo.cpp:373
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:115
PADS & Pads()
Definition: footprint.h:169
PCB_BASE_EDIT_FRAME * frame() const
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:192
const PCB_SELECTION & selection() const
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
void SetOrientation(double aNewAngle)
Definition: footprint.cpp:1681
Generic, UI-independent tool event.
Definition: tool_event.h:152
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1491
virtual PICKED_ITEMS_LIST * PopCommandFromUndoList()
Return the last command to undo and remove it from list, nothing is deleted.
An interface for classes handling user events controlling the view behavior such as zooming,...
#define _(s)
A holder to handle information on schematic or board items.
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:460
bool IsFlipped() const
Definition: footprint.h:278
void SetLink(const KIID &aLink)
Definition: footprint.h:576
KIGFX::VIEW_CONTROLS * controls() const
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
Definition: pcb_actions.h:62
PCBNEW_SETTINGS & Settings()
wxPoint GetPosition() const override
Definition: footprint.h:187
bool IsReactivate() const
Definition: tool_event.h:252
void Activate()
Run the tool.
bool HasPosition() const
Definition: tool_event.h:240
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
Definition: pad.h:57
void SetPosition(const wxPoint &aPos) override
Definition: footprint.cpp:1562
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:59
static TOOL_ACTION refreshPreview
Definition: actions.h:106
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
static TOOL_ACTION cursorClick
Definition: actions.h:123
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1570

References _, TOOL_INTERACTIVE::Activate(), COMMIT::Add(), ARROW, PCB_TOOL_BASE::board(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), PCB_TOOL_BASE::controls(), ACTIONS::cursorClick, FOOTPRINT::Flip(), PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetCanvas(), TOOL_EVENT::GetCommandStr(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), PCB_BASE_FRAME::GetDisplayOptions(), FOOTPRINT::GetPosition(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_EVENT::HasPosition(), IS_NEW, FOOTPRINT::IsFlipped(), TOOL_EVENT::IsReactivate(), PCBNEW_SETTINGS::m_FlipLeftRight, m_frame, m_inPlaceFootprint, TOOL_INTERACTIVE::m_menu, m_placingFootprint, PCB_DISPLAY_OPTIONS::m_ShowGlobalRatsnest, TOOL_BASE::m_toolMgr, niluuid, pad, FOOTPRINT::Pads(), TOOL_EVENT::Parameter(), PENCIL, EDA_BASE_FRAME::PopCommandFromUndoList(), TOOLS_HOLDER::PopTool(), PCB_ACTIONS::properties, BOARD_COMMIT::Push(), TOOLS_HOLDER::PushTool(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), ACTIONS::refreshPreview, BOARD_COMMIT::Revert(), TOOL_MANAGER::RunAction(), PCB_BASE_FRAME::SelectFootprintFromLibTree(), PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionClear, PCB_ACTIONS::selectItem, KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), KIGFX::VIEW_CONTROLS::SetCursorPosition(), EDA_ITEM::SetFlags(), FOOTPRINT::SetLink(), FOOTPRINT::SetOrientation(), EDA_ITEM::SetParent(), FOOTPRINT::SetPosition(), SELECTION::SetReferencePoint(), PCB_BASE_FRAME::Settings(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), undo, KIGFX::VIEW::Update(), TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

◆ PlaceTarget()

int BOARD_EDITOR_CONTROL::PlaceTarget ( const TOOL_EVENT aEvent)

Allow user to place a layer alignment target.

Definition at line 1256 of file board_editor_control.cpp.

1257 {
1258  if( m_inPlaceTarget )
1259  return 0;
1260 
1262 
1263  KIGFX::VIEW* view = getView();
1265  BOARD* board = getModel<BOARD>();
1266  PCB_TARGET* target = new PCB_TARGET( board );
1267 
1268  // Init the new item attributes
1269  target->SetLayer( Edge_Cuts );
1271  target->SetSize( Millimeter2iu( 5 ) );
1272  VECTOR2I cursorPos = controls->GetCursorPosition();
1273  target->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
1274 
1275  // Add a VIEW_GROUP that serves as a preview for the new item
1276  KIGFX::VIEW_GROUP preview( view );
1277  preview.Add( target );
1278  view->Add( &preview );
1279 
1281 
1282  std::string tool = aEvent.GetCommandStr().get();
1283  m_frame->PushTool( tool );
1284  Activate();
1285 
1286  auto setCursor =
1287  [&]()
1288  {
1290  };
1291 
1292  // Set initial cursor
1293  setCursor();
1294 
1295  // Main loop: keep receiving events
1296  while( TOOL_EVENT* evt = Wait() )
1297  {
1298  setCursor();
1299  cursorPos = controls->GetCursorPosition( !evt->DisableGridSnapping() );
1300 
1301  if( evt->IsCancelInteractive() )
1302  {
1303  frame()->PopTool( tool );
1304  break;
1305  }
1306  else if( evt->IsActivate() )
1307  {
1308  if( evt->IsMoveTool() )
1309  {
1310  // leave ourselves on the stack so we come back after the move
1311  break;
1312  }
1313  else
1314  {
1315  frame()->PopTool( tool );
1316  break;
1317  }
1318  }
1319  else if( evt->IsAction( &PCB_ACTIONS::incWidth ) )
1320  {
1321  target->SetWidth( target->GetWidth() + WIDTH_STEP );
1322  view->Update( &preview );
1323  }
1324  else if( evt->IsAction( &PCB_ACTIONS::decWidth ) )
1325  {
1326  int width = target->GetWidth();
1327 
1328  if( width > WIDTH_STEP )
1329  {
1330  target->SetWidth( width - WIDTH_STEP );
1331  view->Update( &preview );
1332  }
1333  }
1334  else if( evt->IsClick( BUT_LEFT ) )
1335  {
1336  assert( target->GetSize() > 0 );
1337  assert( target->GetWidth() > 0 );
1338 
1339  BOARD_COMMIT commit( m_frame );
1340  commit.Add( target );
1341  commit.Push( wxT( "Place a layer alignment target" ) );
1342 
1343  preview.Remove( target );
1344 
1345  // Create next PCB_TARGET
1346  target = new PCB_TARGET( *target );
1347  preview.Add( target );
1348  }
1349  else if( evt->IsClick( BUT_RIGHT ) )
1350  {
1352  }
1353  else if( evt->IsMotion() )
1354  {
1355  target->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
1356  view->Update( &preview );
1357  }
1358  else
1359  {
1360  evt->SetPassEvent();
1361  }
1362  }
1363 
1364  preview.Clear();
1365  delete target;
1366  view->Remove( &preview );
1367 
1369 
1370  return 0;
1371 }
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:59
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Suspend execution of the tool until an event specified in aEventList arrives.
BOARD * board() const
static TOOL_ACTION incWidth
Increase width of currently drawn line.
Definition: pcb_actions.h:164
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:164
void SetSize(int aSize)
Definition: pcb_target.h:61
int GetSize() const
Definition: pcb_target.h:62
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:214
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)
Run the specified action.
Definition: tool_manager.h:143
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
Definition: pcb_view.cpp:75
static TOOL_ACTION decWidth
Decrease width of currently drawn line.
Definition: pcb_actions.h:167
PCB_BASE_EDIT_FRAME * frame() const
int GetLineThickness(PCB_LAYER_ID aLayer) const
Return the default graphic segment thickness from the layer class for the given layer.
int GetWidth() const
Definition: pcb_target.h:65
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: pcb_view.cpp:92
const PCB_SELECTION & selection() const
virtual void PopTool(const std::string &actionName)
static const int WIDTH_STEP
How does line width change after one -/+ key press.
void SetPosition(const wxPoint &aPos) override
Definition: pcb_target.h:55
Generic, UI-independent tool event.
Definition: tool_event.h:152
KIGFX::PCB_VIEW * view() const
Extend VIEW_ITEM by possibility of grouping items into a single object.
Definition: view_group.h:46
An interface for classes handling user events controlling the view behavior such as zooming,...
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:460
KIGFX::VIEW_CONTROLS * controls() const
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
void SetWidth(int aWidth)
Definition: pcb_target.h:64
void Activate()
Run the tool.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
Definition: pcb_view.cpp:58
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
static constexpr int Millimeter2iu(double mm)
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:59
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.

References TOOL_INTERACTIVE::Activate(), KIGFX::PCB_VIEW::Add(), KIGFX::VIEW_GROUP::Add(), ARROW, PCB_TOOL_BASE::board(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_GROUP::Clear(), PCB_TOOL_BASE::controls(), PCB_ACTIONS::decWidth, Edge_Cuts, PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetCanvas(), TOOL_EVENT::GetCommandStr(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetLineThickness(), PCB_TARGET::GetSize(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), PCB_TARGET::GetWidth(), PCB_ACTIONS::incWidth, m_frame, m_inPlaceTarget, TOOL_INTERACTIVE::m_menu, TOOL_BASE::m_toolMgr, Millimeter2iu(), TOOLS_HOLDER::PopTool(), TOOLS_HOLDER::PushTool(), KIGFX::PCB_VIEW::Remove(), KIGFX::VIEW_GROUP::Remove(), TOOL_MANAGER::RunAction(), PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionClear, EDA_DRAW_PANEL_GAL::SetCurrentCursor(), BOARD_ITEM::SetLayer(), PCB_TARGET::SetPosition(), PCB_TARGET::SetSize(), PCB_TARGET::SetWidth(), TOOL_MENU::ShowContextMenu(), KIGFX::PCB_VIEW::Update(), PCB_TOOL_BASE::view(), TOOL_INTERACTIVE::Wait(), WIDTH_STEP, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

◆ PlacingFootprint()

bool BOARD_EDITOR_CONTROL::PlacingFootprint ( ) const
inline

Re-entrancy checker for above.

Toggle 'lock' property for selected items.

Definition at line 108 of file board_editor_control.h.

References m_placingFootprint.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), and FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard().

◆ Plot()

int BOARD_EDITOR_CONTROL::Plot ( const TOOL_EVENT aEvent)

Definition at line 373 of file board_editor_control.cpp.

374 {
376  return 0;
377 }
void ToPlotter(int aID)
Open a dialog frame to create plot and drill files relative to the current board.
Definition: id.h:96

References ID_GEN_PLOT, m_frame, and PCB_EDIT_FRAME::ToPlotter().

Referenced by setTransitions().

◆ RepairBoard()

int BOARD_EDITOR_CONTROL::RepairBoard ( const TOOL_EVENT aEvent)

Definition at line 542 of file board_editor_control.cpp.

543 {
544  int errors = 0;
545  wxString details;
546  bool quiet = aEvent.Parameter<bool>();
547 
548  // Repair duplicate IDs and missing nets.
549  std::set<KIID> ids;
550  int duplicates = 0;
551 
552  auto processItem =
553  [&]( EDA_ITEM* aItem )
554  {
555  if( ids.count( aItem->m_Uuid ) )
556  {
557  duplicates++;
558  const_cast<KIID&>( aItem->m_Uuid ) = KIID();
559  }
560 
561  ids.insert( aItem->m_Uuid );
562 
563  BOARD_CONNECTED_ITEM* cItem = dynamic_cast<BOARD_CONNECTED_ITEM*>( aItem );
564 
565  if( cItem && cItem->GetNetCode() )
566  {
567  NETINFO_ITEM* netinfo = cItem->GetNet();
568 
569  if( netinfo && !board()->FindNet( netinfo->GetNetname() ) )
570  {
571  board()->Add( netinfo );
572 
573  details += wxString::Format( _( "Orphaned net %s re-parented.\n" ),
574  netinfo->GetNetname() );
575  errors++;
576  }
577  }
578  };
579 
580  // Footprint IDs are the most important, so give them the first crack at "claiming" a
581  // particular KIID.
582 
583  for( FOOTPRINT* footprint : board()->Footprints() )
584  processItem( footprint );
585 
586  // After that the principal use is for DRC marker pointers, which are most likely to pads
587  // or tracks.
588 
589  for( FOOTPRINT* footprint : board()->Footprints() )
590  {
591  for( PAD* pad : footprint->Pads() )
592  processItem( pad );
593  }
594 
595  for( PCB_TRACK* track : board()->Tracks() )
596  processItem( track );
597 
598  // From here out I don't think order matters much.
599 
600  for( FOOTPRINT* footprint : board()->Footprints() )
601  {
602  processItem( &footprint->Reference() );
603  processItem( &footprint->Value() );
604 
605  for( BOARD_ITEM* item : footprint->GraphicalItems() )
606  processItem( item );
607 
608  for( ZONE* zone : footprint->Zones() )
609  processItem( zone );
610 
611  for( PCB_GROUP* group : footprint->Groups() )
612  processItem( group );
613  }
614 
615  for( BOARD_ITEM* drawing : board()->Drawings() )
616  processItem( drawing );
617 
618  for( ZONE* zone : board()->Zones() )
619  processItem( zone );
620 
621  for( PCB_MARKER* marker : board()->Markers() )
622  processItem( marker );
623 
624  for( PCB_GROUP* group : board()->Groups() )
625  processItem( group );
626 
627  if( duplicates )
628  {
629  errors += duplicates;
630  details += wxString::Format( _( "%d duplicate IDs replaced.\n" ), duplicates );
631  }
632 
633  /*******************************
634  * Your test here
635  */
636 
637  /*******************************
638  * Inform the user
639  */
640 
641  if( errors )
642  {
643  m_frame->OnModify();
644 
645  wxString msg = wxString::Format( _( "%d potential problems repaired." ), errors );
646 
647  if( !quiet )
648  DisplayInfoMessage( m_frame, msg, details );
649  }
650  else if( !quiet )
651  {
652  DisplayInfoMessage( m_frame, _( "No board problems found." ) );
653  }
654 
655  return 0;
656 }
void OnModify() override
Must be called after a board change to set the modified flag.
ZONES & Zones()
Definition: board.h:240
BOARD * board() const
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
NETINFO_ITEM * GetNet() const
Return #NET_INFO object for a given item.
GROUPS & Groups()
The groups must maintain the following invariants.
Definition: board.h:254
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
MARKERS & Markers()
Definition: board.h:243
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
PADS & Pads()
Definition: footprint.h:169
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:499
FP_TEXT & Reference()
Definition: footprint.h:500
FP_ZONES & Zones()
Definition: footprint.h:175
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
Definition: board.cpp:608
Definition: kiid.h:44
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
FOOTPRINTS & Footprints()
Definition: board.h:234
FOOTPRINT * footprint() const
const wxString & GetNetname() const
Definition: netinfo.h:126
#define _(s)
DRAWINGS & GraphicalItems()
Definition: footprint.h:172
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
FP_GROUPS & Groups()
Definition: footprint.h:178
Handle the data for a net.
Definition: netinfo.h:66
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
Definition: pad.h:57
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:307
DRAWINGS & Drawings()
Definition: board.h:237
TRACKS & Tracks()
Definition: board.h:231

References _, BOARD::Add(), PCB_TOOL_BASE::board(), DisplayInfoMessage(), BOARD::Drawings(), PCB_TOOL_BASE::footprint(), BOARD::Footprints(), Format(), BOARD_CONNECTED_ITEM::GetNet(), BOARD_CONNECTED_ITEM::GetNetCode(), NETINFO_ITEM::GetNetname(), FOOTPRINT::GraphicalItems(), group, FOOTPRINT::Groups(), BOARD::Groups(), m_frame, BOARD::Markers(), PCB_EDIT_FRAME::OnModify(), pad, FOOTPRINT::Pads(), TOOL_EVENT::Parameter(), FOOTPRINT::Reference(), BOARD::Tracks(), FOOTPRINT::Value(), FOOTPRINT::Zones(), and BOARD::Zones().

Referenced by setTransitions().

◆ Reset()

void BOARD_EDITOR_CONTROL::Reset ( RESET_REASON  aReason)
overridevirtual

Bring the tool to a known, initial state.

If the tool claimed anything from the model or the view, it must release it when its reset.

Parameters
aReasoncontains information about the reason of tool reset.

Reimplemented from PCB_TOOL_BASE.

Definition at line 193 of file board_editor_control.cpp.

194 {
195  m_frame = getEditFrame<PCB_EDIT_FRAME>();
196 
197  if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
198  {
199  m_placeOrigin->SetPosition( getModel<BOARD>()->GetDesignSettings().GetAuxOrigin() );
200  getView()->Remove( m_placeOrigin.get() );
201  getView()->Add( m_placeOrigin.get() );
202  }
203 }
Model changes (required full reload)
Definition: tool_base.h:80
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:350
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_placeOrigin
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:320
Rendering engine changes.
Definition: tool_base.h:81

References KIGFX::VIEW::Add(), TOOL_BASE::GAL_SWITCH, TOOL_BASE::getView(), m_frame, m_placeOrigin, TOOL_BASE::MODEL_RELOAD, and KIGFX::VIEW::Remove().

◆ RunMainStack()

void TOOL_INTERACTIVE::RunMainStack ( std::function< void()>  aFunc)
inherited

Call 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:214
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)

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

Referenced by DRAWING_TOOL::PlaceText().

◆ Save()

int BOARD_EDITOR_CONTROL::Save ( const TOOL_EVENT aEvent)

Definition at line 307 of file board_editor_control.cpp.

308 {
310  return 0;
311 }
bool Files_io_from_id(int aId)
Read and write board files according to aId.

References PCB_EDIT_FRAME::Files_io_from_id(), ID_SAVE_BOARD, and m_frame.

Referenced by setTransitions().

◆ SaveAs()

int BOARD_EDITOR_CONTROL::SaveAs ( const TOOL_EVENT aEvent)

Definition at line 314 of file board_editor_control.cpp.

315 {
317  return 0;
318 }
bool Files_io_from_id(int aId)
Read and write board files according to aId.

References PCB_EDIT_FRAME::Files_io_from_id(), ID_SAVE_BOARD_AS, and m_frame.

Referenced by setTransitions().

◆ SaveCopyAs()

int BOARD_EDITOR_CONTROL::SaveCopyAs ( const TOOL_EVENT aEvent)

Definition at line 321 of file board_editor_control.cpp.

322 {
324  return 0;
325 }
bool Files_io_from_id(int aId)
Read and write board files according to aId.

References PCB_EDIT_FRAME::Files_io_from_id(), ID_COPY_BOARD_AS, and m_frame.

Referenced by setTransitions().

◆ selection() [1/2]

const PCB_SELECTION & PCB_TOOL_BASE::selection ( ) const
protectedinherited

Definition at line 307 of file pcb_tool_base.cpp.

308 {
310 
311  return selTool->GetSelection();
312 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
The selection tool: currently supports:

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

Referenced by AUTOPLACE_TOOL::autoplaceSelected(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), EDIT_TOOL::ChangeTrackWidth(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), DRC_TOOL::CrossProbe(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), BOARD_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Drag(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawZone(), EDIT_TOOL::Duplicate(), EditFpInFpEditor(), PAD_TOOL::EditPad(), GROUP_TOOL::EnterGroup(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), EDIT_TOOL::FilletTracks(), PCB_SELECTION_TOOL::filterSelection(), EDIT_TOOL::Flip(), DRAWING_TOOL::getSourceZoneForAction(), GROUP_TOOL::Group(), BOARD_INSPECTION_TOOL::highlightNet(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), EDIT_TOOL::Mirror(), modifyLockSelected(), EDIT_TOOL::MoveExact(), PCB_POINT_EDITOR::OnSelectionChange(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), PCB_CONTROL::placeBoardItems(), PlaceFootprint(), DRAWING_TOOL::PlaceImportedGraphics(), PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), BOARD_REANNOTATE_TOOL::ReannotateDuplicatesInSelection(), GROUP_TOOL::RemoveFromGroup(), GLOBAL_EDIT_TOOL::RemoveUnusedPads(), EDIT_TOOL::Rotate(), PCB_SELECTION_TOOL::selectNet(), DRAWING_TOOL::SetAnchor(), TrackWidthDec(), TrackWidthInc(), GROUP_TOOL::Ungroup(), PCB_CONTROL::UpdateMessagePanel(), BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest(), ViaSizeDec(), ViaSizeInc(), ZoneDuplicate(), ZONE_FILLER_TOOL::ZoneFill(), ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfill().

◆ selection() [2/2]

PCB_SELECTION & PCB_TOOL_BASE::selection ( )
protectedinherited

Definition at line 315 of file pcb_tool_base.cpp.

316 {
318 
319  return selTool->GetSelection();
320 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
The selection tool: currently supports:

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

◆ SetContextMenu()

void TOOL_INTERACTIVE::SetContextMenu ( ACTION_MENU aMenu,
CONTEXT_MENU_TRIGGER  aTrigger = CMENU_BUTTON 
)
inherited

Assign 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:214
void SetTool(TOOL_INTERACTIVE *aTool)
Set a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Set behavior 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(), PCB_SELECTION_TOOL::doSelectionMenu(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ SetIsFootprintEditor()

void PCB_TOOL_BASE::SetIsFootprintEditor ( bool  aEnabled)
inlineinherited

Function SetIsFootprintEditor()

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

Parameters
aEnableddecides if the mode should be enabled.

Definition at line 103 of file pcb_tool_base.h.

103 { m_isFootprintEditor = aEnabled; }
bool m_isFootprintEditor

References PCB_TOOL_BASE::m_isFootprintEditor.

◆ setTransitions()

void BOARD_EDITOR_CONTROL::setTransitions ( )
overrideprivatevirtual

This method is meant to be overridden in order to specify handlers for events.

It is called every time tool is reset or finished.

Reimplemented from PCB_TOOL_BASE.

Definition at line 1599 of file board_editor_control.cpp.

1600 {
1601  Go( &BOARD_EDITOR_CONTROL::New, ACTIONS::doNew.MakeEvent() );
1602  Go( &BOARD_EDITOR_CONTROL::Open, ACTIONS::open.MakeEvent() );
1603  Go( &BOARD_EDITOR_CONTROL::Save, ACTIONS::save.MakeEvent() );
1607  Go( &BOARD_EDITOR_CONTROL::Plot, ACTIONS::plot.MakeEvent() );
1608 
1609  Go( &BOARD_EDITOR_CONTROL::Find, ACTIONS::find.MakeEvent() );
1611 
1615  PCB_ACTIONS::importSpecctraSession.MakeEvent() );
1617 
1618  if( ADVANCED_CFG::GetCfg().m_ShowPcbnewExportNetlist && m_frame &&
1621 
1623  PCB_ACTIONS::generateDrillFiles.MakeEvent() );
1627  PCB_ACTIONS::generateReportFile.MakeEvent() );
1630 
1631  // Track & via size control
1636 
1637  // Zone actions
1640 
1641  // Placing tools
1645 
1648 
1649  // Other
1653 
1655  ACTIONS::updatePcbFromSchematic.MakeEvent() );
1657  ACTIONS::updateSchematicFromPcb.MakeEvent() );
1662 }
int Open(const TOOL_EVENT &aEvent)
int LockSelected(const TOOL_EVENT &aEvent)
Unlock selected items.
static TOOL_ACTION toggleLock
Definition: pcb_actions.h:423
int Find(const TOOL_EVENT &aEvent)
int New(const TOOL_EVENT &aEvent)
static TOOL_ACTION unlock
Definition: pcb_actions.h:425
static TOOL_ACTION generateGerbers
Definition: pcb_actions.h:334
int ExportSpecctraDSN(const TOOL_EVENT &aEvent)
static TOOL_ACTION editFpInFpEditor
Definition: pcb_actions.h:344
static TOOL_ACTION pageSettings
Definition: actions.h:56
int TrackWidthInc(const TOOL_EVENT &aEvent)
static TOOL_ACTION drillOrigin
Definition: pcb_actions.h:438
static TOOL_ACTION lock
Definition: pcb_actions.h:424
static TOOL_ACTION viaSizeInc
Definition: pcb_actions.h:296
int Plot(const TOOL_EVENT &aEvent)
int GeneratePosFile(const TOOL_EVENT &aEvent)
static TOOL_ACTION trackWidthDec
Definition: pcb_actions.h:295
static TOOL_ACTION showPythonConsole
Definition: pcb_actions.h:348
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:347
static TOOL_ACTION updatePcbFromSchematic
Definition: actions.h:163
int ImportNetlist(const TOOL_EVENT &aEvent)
static TOOL_ACTION find
Definition: actions.h:76
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
static TOOL_ACTION generateReportFile
Definition: pcb_actions.h:337
int PageSettings(const TOOL_EVENT &aEvent)
static TOOL_ACTION generateD356File
Definition: pcb_actions.h:338
static TOOL_ACTION saveCopyAs
Definition: actions.h:53
static TOOL_ACTION trackWidthInc
Definition: pcb_actions.h:294
int DrillOrigin(const TOOL_EVENT &aEvent)
Low-level access (below undo) to setting the drill origin.
int ZoneDuplicate(const TOOL_EVENT &aEvent)
static TOOL_ACTION updateSchematicFromPcb
Definition: actions.h:164
int EditFpInFpEditor(const TOOL_EVENT &aEvent)
int ViaSizeInc(const TOOL_EVENT &aEvent)
int UpdatePCBFromSchematic(const TOOL_EVENT &aEvent)
static TOOL_ACTION importNetlist
Definition: pcb_actions.h:329
int UnlockSelected(const TOOL_EVENT &aEvent)
Run the drill origin tool for setting the origin for drill and pick-and-place files.
static TOOL_ACTION open
Definition: actions.h:50
static TOOL_ACTION save
Definition: actions.h:51
static TOOL_ACTION doNew
Definition: actions.h:44
int BoardSetup(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoneMerge
Definition: pcb_actions.h:306
int SaveAs(const TOOL_EVENT &aEvent)
int Save(const TOOL_EVENT &aEvent)
static TOOL_ACTION plot
Definition: actions.h:58
int RepairBoard(const TOOL_EVENT &aEvent)
static TOOL_ACTION showEeschema
Definition: pcb_actions.h:441
int FindNext(const TOOL_EVENT &aEvent)
static TOOL_ACTION generatePosFile
Definition: pcb_actions.h:336
static TOOL_ACTION placeTarget
Definition: pcb_actions.h:155
int ShowEeschema(const TOOL_EVENT &aEvent)
static TOOL_ACTION boardSetup
Definition: pcb_actions.h:316
static TOOL_ACTION importSpecctraSession
Definition: pcb_actions.h:331
int ExportNetlist(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoneDuplicate
Duplicate zone onto another layer.
Definition: pcb_actions.h:309
TOOL_ACTION * GetExportNetlistAction()
int ImportSpecctraSession(const TOOL_EVENT &aEvent)
static TOOL_ACTION generateBOM
Definition: pcb_actions.h:339
int ZoneMerge(const TOOL_EVENT &aEvent)
Duplicate a zone onto a layer (prompts for new layer)
static TOOL_ACTION placeFootprint
Definition: pcb_actions.h:157
static TOOL_ACTION exportSpecctraDSN
Definition: pcb_actions.h:332
static TOOL_ACTION saveAs
Definition: actions.h:52
static TOOL_ACTION repairBoard
Definition: pcb_actions.h:444
int PlaceFootprint(const TOOL_EVENT &aEvent)
Display a dialog to select a footprint to be added and allows the user to set its position.
int ToggleLockSelected(const TOOL_EVENT &aEvent)
Lock selected items.
TOOL_EVENT MakeEvent() const
Return the event associated with the action (i.e.
Definition: tool_action.cpp:72
int TogglePythonConsole(const TOOL_EVENT &aEvent)
static TOOL_ACTION editLibFpInFpEditor
Definition: pcb_actions.h:345
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
int GenerateDrillFiles(const TOOL_EVENT &aEvent)
int ToggleLayersManager(const TOOL_EVENT &aEvent)
int ViaSizeDec(const TOOL_EVENT &aEvent)
int GenerateFabFiles(const TOOL_EVENT &aEvent)
int TrackWidthDec(const TOOL_EVENT &aEvent)
static TOOL_ACTION findNext
Definition: actions.h:78
int UpdateSchematicFromPCB(const TOOL_EVENT &aEvent)
static TOOL_ACTION viaSizeDec
Definition: pcb_actions.h:297
int PlaceTarget(const TOOL_EVENT &aEvent)
Allow user to place a layer alignment target.
static TOOL_ACTION generateDrillFiles
Definition: pcb_actions.h:335
int SaveCopyAs(const TOOL_EVENT &aEvent)

References BoardSetup(), PCB_ACTIONS::boardSetup, ACTIONS::doNew, DrillOrigin(), PCB_ACTIONS::drillOrigin, EditFpInFpEditor(), PCB_ACTIONS::editFpInFpEditor, PCB_ACTIONS::editLibFpInFpEditor, ExportNetlist(), ExportSpecctraDSN(), PCB_ACTIONS::exportSpecctraDSN, Find(), ACTIONS::find, FindNext(), ACTIONS::findNext, PCB_ACTIONS::generateBOM, PCB_ACTIONS::generateD356File, GenerateDrillFiles(), PCB_ACTIONS::generateDrillFiles, GenerateFabFiles(), PCB_ACTIONS::generateGerbers, GeneratePosFile(), PCB_ACTIONS::generatePosFile, PCB_ACTIONS::generateReportFile, ADVANCED_CFG::GetCfg(), PCB_EDIT_FRAME::GetExportNetlistAction(), TOOL_INTERACTIVE::Go(), ImportNetlist(), PCB_ACTIONS::importNetlist, ImportSpecctraSession(), PCB_ACTIONS::importSpecctraSession, PCB_ACTIONS::lock, LockSelected(), m_frame, TOOL_ACTION::MakeEvent(), New(), ACTIONS::open, Open(), ACTIONS::pageSettings, PageSettings(), PlaceFootprint(), PCB_ACTIONS::placeFootprint, PlaceTarget(), PCB_ACTIONS::placeTarget, ACTIONS::plot, Plot(), RepairBoard(), PCB_ACTIONS::repairBoard, ACTIONS::save, Save(), ACTIONS::saveAs, SaveAs(), ACTIONS::saveCopyAs, SaveCopyAs(), ShowEeschema(), PCB_ACTIONS::showEeschema, PCB_ACTIONS::showLayersManager, PCB_ACTIONS::showPythonConsole, ToggleLayersManager(), PCB_ACTIONS::toggleLock, ToggleLockSelected(), TogglePythonConsole(), TrackWidthDec(), PCB_ACTIONS::trackWidthDec, TrackWidthInc(), PCB_ACTIONS::trackWidthInc, PCB_ACTIONS::unlock, UnlockSelected(), UpdatePCBFromSchematic(), ACTIONS::updatePcbFromSchematic, UpdateSchematicFromPCB(), ACTIONS::updateSchematicFromPcb, ViaSizeDec(), PCB_ACTIONS::viaSizeDec, ViaSizeInc(), PCB_ACTIONS::viaSizeInc, ZoneDuplicate(), PCB_ACTIONS::zoneDuplicate, ZoneMerge(), and PCB_ACTIONS::zoneMerge.

◆ ShowEeschema()

int BOARD_EDITOR_CONTROL::ShowEeschema ( const TOOL_EVENT aEvent)

Definition at line 696 of file board_editor_control.cpp.

697 {
698  m_frame->RunEeschema();
699  return 0;
700 }

References m_frame, and PCB_EDIT_FRAME::RunEeschema().

Referenced by setTransitions().

◆ ToggleLayersManager()

int BOARD_EDITOR_CONTROL::ToggleLayersManager ( const TOOL_EVENT aEvent)

Definition at line 703 of file board_editor_control.cpp.

704 {
705  getEditFrame<PCB_EDIT_FRAME>()->ToggleLayersManager();
706  return 0;
707 }

Referenced by setTransitions().

◆ ToggleLockSelected()

int BOARD_EDITOR_CONTROL::ToggleLockSelected ( const TOOL_EVENT aEvent)

Lock selected items.

Definition at line 1179 of file board_editor_control.cpp.

1180 {
1181  return modifyLockSelected( TOGGLE );
1182 }
int modifyLockSelected(MODIFY_MODE aMode)
Set up handlers for various events.

References modifyLockSelected(), and TOGGLE.

Referenced by setTransitions().

◆ TogglePythonConsole()

int BOARD_EDITOR_CONTROL::TogglePythonConsole ( const TOOL_EVENT aEvent)

Definition at line 710 of file board_editor_control.cpp.

711 {
713  return 0;
714 }
void ScriptingConsoleEnableDisable()
Toggles the scripting console visibility.

References m_frame, and EDA_DRAW_FRAME::ScriptingConsoleEnableDisable().

Referenced by setTransitions().

◆ TrackWidthDec()

int BOARD_EDITOR_CONTROL::TrackWidthDec ( const TOOL_EVENT aEvent)

Definition at line 798 of file board_editor_control.cpp.

799 {
800  BOARD_DESIGN_SETTINGS& designSettings = getModel<BOARD>()->GetDesignSettings();
801  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
803 
805  {
806  BOARD_COMMIT commit( this );
807 
808  for( EDA_ITEM* item : selection )
809  {
810  if( item->Type() == PCB_TRACE_T )
811  {
812  PCB_TRACK* track = static_cast<PCB_TRACK*>( item );
813 
814  // Note: skip first entry which is the current netclass value
815  for( int i = designSettings.m_TrackWidthList.size() - 1; i >= 1; --i )
816  {
817  int candidate = designSettings.m_TrackWidthList[ i ];
818 
819  if( candidate < track->GetWidth() )
820  {
821  commit.Modify( track );
822  track->SetWidth( candidate );
823  break;
824  }
825  }
826  }
827  }
828 
829  commit.Push( wxT( "Decrease Track Width" ) );
830  return 0;
831  }
832 
833  ROUTER_TOOL* routerTool = m_toolMgr->GetTool<ROUTER_TOOL>();
834 
835  if( routerTool && routerTool->IsToolActive()
836  && routerTool->Router()->Mode() == PNS::PNS_MODE_ROUTE_DIFF_PAIR )
837  {
838  int widthIndex = designSettings.GetDiffPairIndex() - 1;
839 
840  // If we get to the lowest entry start over at the highest
841  if( widthIndex < 0 )
842  widthIndex = designSettings.m_DiffPairDimensionsList.size() - 1;
843 
844  designSettings.SetDiffPairIndex( widthIndex );
845  designSettings.UseCustomDiffPairDimensions( false );
846 
848  }
849  else
850  {
851  int widthIndex = designSettings.GetTrackWidthIndex();
852 
853  if( routerTool && routerTool->IsToolActive()
854  && routerTool->Router()->GetState() == PNS::ROUTER::RouterState::ROUTE_TRACK
855  && designSettings.m_UseConnectedTrackWidth && !designSettings.m_TempOverrideTrackWidth )
856  {
857  designSettings.m_TempOverrideTrackWidth = true;
858  }
859  else
860  {
861  widthIndex--;
862  }
863 
864  // If we get to the lowest entry start over at the highest
865  if( widthIndex < 0 )
866  widthIndex = designSettings.m_TrackWidthList.size() - 1;
867 
868  designSettings.SetTrackWidthIndex( widthIndex );
869  designSettings.UseCustomTrackViaSize( false );
870 
872  }
873 
874  return 0;
875 }
void SetTrackWidthIndex(unsigned aIndex)
Set the current track width list index to aIndex.
std::vector< int > m_TrackWidthList
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Create a functor that tests if the selected items are only of given types.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void UseCustomDiffPairDimensions(bool aEnabled)
Enables/disables custom differential pair dimensions.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:299
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
const PCB_SELECTION & selection() const
unsigned GetTrackWidthIndex() const
bool ToolStackIsEmpty()
Definition: tools_holder.h:116
void SetDiffPairIndex(unsigned aIndex)
void SetWidth(int aWidth)
Definition: pcb_track.h:101
bool IsToolActive() const
Definition: tool_base.cpp:31
The selection tool: currently supports:
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
unsigned GetDiffPairIndex() const
ROUTER * Router() const
ROUTER_MODE Mode() const
Definition: pns_router.h:132
RouterState GetState() const
Definition: pns_router.h:134
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
Container for design settings for a BOARD object.

References EOT, BOARD_DESIGN_SETTINGS::GetDiffPairIndex(), PNS::ROUTER::GetState(), TOOL_MANAGER::GetTool(), BOARD_DESIGN_SETTINGS::GetTrackWidthIndex(), TOOL_BASE::IsToolActive(), BOARD_DESIGN_SETTINGS::m_DiffPairDimensionsList, m_frame, BOARD_DESIGN_SETTINGS::m_TempOverrideTrackWidth, TOOL_BASE::m_toolMgr, BOARD_DESIGN_SETTINGS::m_TrackWidthList, BOARD_DESIGN_SETTINGS::m_UseConnectedTrackWidth, PNS::ROUTER::Mode(), COMMIT::Modify(), SELECTION_CONDITIONS::OnlyTypes(), PCB_TRACE_T, PCB_VIA_T, PNS::PNS_MODE_ROUTE_DIFF_PAIR, BOARD_COMMIT::Push(), PNS::TOOL_BASE::Router(), TOOL_MANAGER::RunAction(), PCB_TOOL_BASE::selection(), BOARD_DESIGN_SETTINGS::SetDiffPairIndex(), BOARD_DESIGN_SETTINGS::SetTrackWidthIndex(), PCB_TRACK::SetWidth(), TOOLS_HOLDER::ToolStackIsEmpty(), PCB_ACTIONS::trackViaSizeChanged, BOARD_DESIGN_SETTINGS::UseCustomDiffPairDimensions(), and BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize().

Referenced by setTransitions().

◆ TrackWidthInc()

int BOARD_EDITOR_CONTROL::TrackWidthInc ( const TOOL_EVENT aEvent)

Definition at line 718 of file board_editor_control.cpp.

719 {
720  BOARD_DESIGN_SETTINGS& designSettings = getModel<BOARD>()->GetDesignSettings();
721  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
723 
725  {
726  BOARD_COMMIT commit( this );
727 
728  for( EDA_ITEM* item : selection )
729  {
730  if( item->Type() == PCB_TRACE_T )
731  {
732  PCB_TRACK* track = static_cast<PCB_TRACK*>( item );
733 
734  // Note: skip first entry which is the current netclass value
735  for( int i = 1; i < (int) designSettings.m_TrackWidthList.size(); ++i )
736  {
737  int candidate = designSettings.m_TrackWidthList[ i ];
738 
739  if( candidate > track->GetWidth() )
740  {
741  commit.Modify( track );
742  track->SetWidth( candidate );
743  break;
744  }
745  }
746  }
747  }
748 
749  commit.Push( wxT( "Increase Track Width" ) );
750  return 0;
751  }
752 
753  ROUTER_TOOL* routerTool = m_toolMgr->GetTool<ROUTER_TOOL>();
754 
755  if( routerTool && routerTool->IsToolActive()
756  && routerTool->Router()->Mode() == PNS::PNS_MODE_ROUTE_DIFF_PAIR )
757  {
758  int widthIndex = designSettings.GetDiffPairIndex() + 1;
759 
760  // If we go past the last track width entry in the list, start over at the beginning
761  if( widthIndex >= (int) designSettings.m_DiffPairDimensionsList.size() )
762  widthIndex = 0;
763 
764  designSettings.SetDiffPairIndex( widthIndex );
765  designSettings.UseCustomDiffPairDimensions( false );
766 
768  }
769  else
770  {
771  int widthIndex = designSettings.GetTrackWidthIndex();
772 
773  if( routerTool && routerTool->IsToolActive()
774  && routerTool->Router()->GetState() == PNS::ROUTER::RouterState::ROUTE_TRACK
775  && designSettings.m_UseConnectedTrackWidth && !designSettings.m_TempOverrideTrackWidth )
776  {
777  designSettings.m_TempOverrideTrackWidth = true;
778  }
779  else
780  {
781  widthIndex++;
782  }
783 
784  // If we go past the last track width entry in the list, start over at the beginning
785  if( widthIndex >= (int) designSettings.m_TrackWidthList.size() )
786  widthIndex = 0;
787 
788  designSettings.SetTrackWidthIndex( widthIndex );
789  designSettings.UseCustomTrackViaSize( false );
790 
792  }
793 
794  return 0;
795 }
void SetTrackWidthIndex(unsigned aIndex)
Set the current track width list index to aIndex.
std::vector< int > m_TrackWidthList
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Create a functor that tests if the selected items are only of given types.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void UseCustomDiffPairDimensions(bool aEnabled)
Enables/disables custom differential pair dimensions.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:299
int GetWidth() const
Definition: pcb_track.h:102
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
const PCB_SELECTION & selection() const
unsigned GetTrackWidthIndex() const
bool ToolStackIsEmpty()
Definition: tools_holder.h:116
void SetDiffPairIndex(unsigned aIndex)
void SetWidth(int aWidth)
Definition: pcb_track.h:101
bool IsToolActive() const
Definition: tool_base.cpp:31
The selection tool: currently supports:
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
unsigned GetDiffPairIndex() const
ROUTER * Router() const
ROUTER_MODE Mode() const
Definition: pns_router.h:132
RouterState GetState() const
Definition: pns_router.h:134
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
Container for design settings for a BOARD object.

References EOT, BOARD_DESIGN_SETTINGS::GetDiffPairIndex(), PNS::ROUTER::GetState(), TOOL_MANAGER::GetTool(), BOARD_DESIGN_SETTINGS::GetTrackWidthIndex(), PCB_TRACK::GetWidth(), TOOL_BASE::IsToolActive(), BOARD_DESIGN_SETTINGS::m_DiffPairDimensionsList, m_frame, BOARD_DESIGN_SETTINGS::m_TempOverrideTrackWidth, TOOL_BASE::m_toolMgr, BOARD_DESIGN_SETTINGS::m_TrackWidthList, BOARD_DESIGN_SETTINGS::m_UseConnectedTrackWidth, PNS::ROUTER::Mode(), COMMIT::Modify(), SELECTION_CONDITIONS::OnlyTypes(), PCB_TRACE_T, PCB_VIA_T, PNS::PNS_MODE_ROUTE_DIFF_PAIR, BOARD_COMMIT::Push(), PNS::TOOL_BASE::Router(), TOOL_MANAGER::RunAction(), PCB_TOOL_BASE::selection(), BOARD_DESIGN_SETTINGS::SetDiffPairIndex(), BOARD_DESIGN_SETTINGS::SetTrackWidthIndex(), PCB_TRACK::SetWidth(), TOOLS_HOLDER::ToolStackIsEmpty(), PCB_ACTIONS::trackViaSizeChanged, BOARD_DESIGN_SETTINGS::UseCustomDiffPairDimensions(), and BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize().

Referenced by setTransitions().

◆ UnlockSelected()

int BOARD_EDITOR_CONTROL::UnlockSelected ( const TOOL_EVENT aEvent)

Run the drill origin tool for setting the origin for drill and pick-and-place files.

Definition at line 1191 of file board_editor_control.cpp.

1192 {
1193  return modifyLockSelected( OFF );
1194 }
int modifyLockSelected(MODIFY_MODE aMode)
Set up handlers for various events.

References modifyLockSelected(), and OFF.

Referenced by setTransitions().

◆ UpdatePCBFromSchematic()

int BOARD_EDITOR_CONTROL::UpdatePCBFromSchematic ( const TOOL_EVENT aEvent)

Definition at line 659 of file board_editor_control.cpp.

660 {
662 
663  if( m_frame->FetchNetlistFromSchematic( netlist, _( "Updating PCB requires a fully annotated "
664  "schematic." ) ) )
665  {
666  DIALOG_UPDATE_PCB updateDialog( m_frame, &netlist );
667  updateDialog.ShowModal();
668  }
669 
670  return 0;
671 }
bool FetchNetlistFromSchematic(NETLIST &aNetlist, const wxString &aAnnotateMessage)
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition: pcb_netlist.h:206
#define _(s)

References _, PCB_EDIT_FRAME::FetchNetlistFromSchematic(), m_frame, and netlist.

Referenced by setTransitions().

◆ UpdateSchematicFromPCB()

int BOARD_EDITOR_CONTROL::UpdateSchematicFromPCB ( const TOOL_EVENT aEvent)

Definition at line 673 of file board_editor_control.cpp.

674 {
675  if( Kiface().IsSingle() )
676  {
677  DisplayErrorMessage( m_frame, _( "Cannot update schematic because Pcbnew is opened in "
678  "stand-alone mode. In order to create or update PCBs "
679  "from schematics, you must launch the KiCad project "
680  "manager and create a project." ) );
681  return 0;
682  }
683 
684  m_frame->RunEeschema();
686 
687  if( frame )
688  {
689  std::string payload;
691  }
692  return 0;
693 }
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:64
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:292
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:393
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:487
PCB_BASE_EDIT_FRAME * frame() const
#define _(s)

References _, DisplayErrorMessage(), KIWAY::ExpressMail(), PCB_TOOL_BASE::frame(), FRAME_SCH, Kiface(), KIWAY_HOLDER::Kiway(), m_frame, MAIL_SCH_UPDATE, KIWAY::Player(), and PCB_EDIT_FRAME::RunEeschema().

Referenced by setTransitions().

◆ ViaSizeDec()

int BOARD_EDITOR_CONTROL::ViaSizeDec ( const TOOL_EVENT aEvent)

Definition at line 927 of file board_editor_control.cpp.

928 {
929  BOARD_DESIGN_SETTINGS& designSettings = getModel<BOARD>()->GetDesignSettings();
930  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
932 
934  {
935  BOARD_COMMIT commit( this );
936 
937  for( EDA_ITEM* item : selection )
938  {
939  if( item->Type() == PCB_VIA_T )
940  {
941  PCB_VIA* via = static_cast<PCB_VIA*>( item );
942 
943  for( int i = designSettings.m_ViasDimensionsList.size() - 1; i >= 0; --i )
944  {
945  VIA_DIMENSION candidate = designSettings.m_ViasDimensionsList[ i ];
946 
947  if( candidate.m_Diameter < via->GetWidth() )
948  {
949  commit.Modify( via );
950  via->SetWidth( candidate.m_Diameter );
951  via->SetDrill( candidate.m_Drill );
952  break;
953  }
954  }
955  }
956  }
957 
958  commit.Push( "Decrease Via Size" );
959  }
960  else
961  {
962  int sizeIndex = 0; // Assume we only have a single via size entry
963 
964  // If there are more, cycle through them backwards
965  if( designSettings.m_ViasDimensionsList.size() > 0 )
966  {
967  sizeIndex = designSettings.GetViaSizeIndex() - 1;
968 
969  // If we get to the lowest entry start over at the highest
970  if( sizeIndex < 0 )
971  sizeIndex = designSettings.m_ViasDimensionsList.size() - 1;
972  }
973 
974  designSettings.SetViaSizeIndex( sizeIndex );
975  designSettings.UseCustomTrackViaSize( false );
976 
978  }
979 
980  return 0;
981 }
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Create a functor that tests if the selected items are only of given types.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:299
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
void SetViaSizeIndex(unsigned aIndex)
Set the current via size list index to aIndex.
const PCB_SELECTION & selection() const
unsigned GetViaSizeIndex() const
bool ToolStackIsEmpty()
Definition: tools_holder.h:116
The selection tool: currently supports:
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
std::vector< VIA_DIMENSION > m_ViasDimensionsList
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
Container for design settings for a BOARD object.

References EOT, TOOL_MANAGER::GetTool(), BOARD_DESIGN_SETTINGS::GetViaSizeIndex(), VIA_DIMENSION::m_Diameter, VIA_DIMENSION::m_Drill, m_frame, TOOL_BASE::m_toolMgr, BOARD_DESIGN_SETTINGS::m_ViasDimensionsList, COMMIT::Modify(), SELECTION_CONDITIONS::OnlyTypes(), PCB_TRACE_T, PCB_VIA_T, BOARD_COMMIT::Push(), TOOL_MANAGER::RunAction(), PCB_TOOL_BASE::selection(), BOARD_DESIGN_SETTINGS::SetViaSizeIndex(), TOOLS_HOLDER::ToolStackIsEmpty(), PCB_ACTIONS::trackViaSizeChanged, BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize(), and via.

Referenced by setTransitions().

◆ ViaSizeInc()

int BOARD_EDITOR_CONTROL::ViaSizeInc ( const TOOL_EVENT aEvent)

Definition at line 878 of file board_editor_control.cpp.

879 {
880  BOARD_DESIGN_SETTINGS& designSettings = getModel<BOARD>()->GetDesignSettings();
881  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
883 
885  {
886  BOARD_COMMIT commit( this );
887 
888  for( EDA_ITEM* item : selection )
889  {
890  if( item->Type() == PCB_VIA_T )
891  {
892  PCB_VIA* via = static_cast<PCB_VIA*>( item );
893 
894  for( VIA_DIMENSION candidate : designSettings.m_ViasDimensionsList )
895  {
896  if( candidate.m_Diameter > via->GetWidth() )
897  {
898  commit.Modify( via );
899  via->SetWidth( candidate.m_Diameter );
900  via->SetDrill( candidate.m_Drill );
901  break;
902  }
903  }
904  }
905  }
906 
907  commit.Push( wxT( "Increase Via Size" ) );
908  }
909  else
910  {
911  int sizeIndex = designSettings.GetViaSizeIndex() + 1;
912 
913  // If we go past the last via entry in the list, start over at the beginning
914  if( sizeIndex >= (int) designSettings.m_ViasDimensionsList.size() )
915  sizeIndex = 0;
916 
917  designSettings.SetViaSizeIndex( sizeIndex );
918  designSettings.UseCustomTrackViaSize( false );
919 
921  }
922 
923  return 0;
924 }
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Create a functor that tests if the selected items are only of given types.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:299
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
void SetViaSizeIndex(unsigned aIndex)
Set the current via size list index to aIndex.
const PCB_SELECTION & selection() const
unsigned GetViaSizeIndex() const
bool ToolStackIsEmpty()
Definition: tools_holder.h:116
The selection tool: currently supports:
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
std::vector< VIA_DIMENSION > m_ViasDimensionsList
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
Container for design settings for a BOARD object.

References EOT, TOOL_MANAGER::GetTool(), BOARD_DESIGN_SETTINGS::GetViaSizeIndex(), VIA_DIMENSION::m_Diameter, VIA_DIMENSION::m_Drill, m_frame, TOOL_BASE::m_toolMgr, BOARD_DESIGN_SETTINGS::m_ViasDimensionsList, COMMIT::Modify(), SELECTION_CONDITIONS::OnlyTypes(), PCB_TRACE_T, PCB_VIA_T, BOARD_COMMIT::Push(), TOOL_MANAGER::RunAction(), PCB_TOOL_BASE::selection(), BOARD_DESIGN_SETTINGS::SetViaSizeIndex(), TOOLS_HOLDER::ToolStackIsEmpty(), PCB_ACTIONS::trackViaSizeChanged, BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize(), and via.

Referenced by setTransitions().

◆ view()

◆ Wait()

TOOL_EVENT * TOOL_INTERACTIVE::Wait ( const TOOL_EVENT_LIST aEventList = TOOL_EVENTTC_ANYTA_ANY ))
inherited

Suspend 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:214
TOOL_EVENT * ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pause 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(), PCB_SELECTION_TOOL::doSelectionMenu(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), ZOOM_TOOL::Main(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), CVPCB_CONTROL::Main(), PL_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), PlaceTarget(), DRAWING_TOOL::PlaceText(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ ZoneDuplicate()

int BOARD_EDITOR_CONTROL::ZoneDuplicate ( const TOOL_EVENT aEvent)

Definition at line 1484 of file board_editor_control.cpp.

1485 {
1487  const PCB_SELECTION& selection = selTool->GetSelection();
1488 
1489  // because this pops up the zone editor, it would be confusing to handle multiple zones,
1490  // so just handle single selections containing exactly one zone
1491  if( selection.Size() != 1 )
1492  return 0;
1493 
1494  ZONE* oldZone = dyn_cast<ZONE*>( selection[0] );
1495 
1496  if( !oldZone )
1497  return 0;
1498 
1499  ZONE_SETTINGS zoneSettings;
1500  zoneSettings << *oldZone;
1501  int dialogResult;
1502 
1503  if( oldZone->GetIsRuleArea() )
1504  dialogResult = InvokeRuleAreaEditor( m_frame, &zoneSettings );
1505  else if( oldZone->IsOnCopperLayer() )
1506  dialogResult = InvokeCopperZonesEditor( m_frame, &zoneSettings );
1507  else
1508  dialogResult = InvokeNonCopperZonesEditor( m_frame, &zoneSettings );
1509 
1510  if( dialogResult != wxID_OK )
1511  return 0;
1512 
1513  // duplicate the zone
1514  BOARD_COMMIT commit( m_frame );
1515 
1516  std::unique_ptr<ZONE> newZone = std::make_unique<ZONE>( *oldZone );
1517  newZone->ClearSelected();
1518  newZone->UnFill();
1519  zoneSettings.ExportSetting( *newZone );
1520 
1521  // If the new zone is on the same layer(s) as the initial zone,
1522  // offset it a bit so it can more easily be picked.
1523  if( oldZone->GetIsRuleArea() && ( oldZone->GetLayerSet() == zoneSettings.m_Layers ) )
1524  newZone->Move( wxPoint( IU_PER_MM, IU_PER_MM ) );
1525  else if( !oldZone->GetIsRuleArea() && zoneSettings.m_Layers.test( oldZone->GetLayer() ) )
1526  newZone->Move( wxPoint( IU_PER_MM, IU_PER_MM ) );
1527 
1528  commit.Add( newZone.release() );
1529  commit.Push( _( "Duplicate zone" ) );
1530 
1531  return 0;
1532 }
static constexpr double IU_PER_MM
Mock up a conversion function.
int InvokeNonCopperZonesEditor(PCB_BASE_FRAME *aParent, ZONE_SETTINGS *aSettings)
Function InvokeNonCopperZonesEditor invokes up a modal dialog window for non-copper zone editing.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
const PCB_SELECTION & selection() const
void ExportSetting(ZONE &aTarget, bool aFullExport=true) const
Function ExportSetting copy settings to a given zone.
#define _(s)
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
int InvokeRuleAreaEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings)
Function InvokeRuleAreaEditor invokes up a modal dialog window for copper zone editing.
ZONE_SETTINGS handles zones parameters.
Definition: zone_settings.h:67
int Size() const
Returns the number of selected parts.
Definition: selection.h:104
The selection tool: currently supports:
int InvokeCopperZonesEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings)
Function InvokeCopperZonesEditor invokes up a modal dialog window for copper zone editing.

References _, COMMIT::Add(), ZONE_SETTINGS::ExportSetting(), PCB_SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), InvokeCopperZonesEditor(), InvokeNonCopperZonesEditor(), InvokeRuleAreaEditor(), IU_PER_MM, m_frame, ZONE_SETTINGS::m_Layers, TOOL_BASE::m_toolMgr, BOARD_COMMIT::Push(), PCB_TOOL_BASE::selection(), and SELECTION::Size().

Referenced by setTransitions().

◆ ZoneMerge()

int BOARD_EDITOR_CONTROL::ZoneMerge ( const TOOL_EVENT aEvent)

Duplicate a zone onto a layer (prompts for new layer)

Definition at line 1411 of file board_editor_control.cpp.

1412 {
1413  const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1414  BOARD* board = getModel<BOARD>();
1415  BOARD_COMMIT commit( m_frame );
1416 
1417  if( selection.Size() < 2 )
1418  return 0;
1419 
1420  int netcode = -1;
1421 
1422  ZONE* firstZone = nullptr;
1423  std::vector<ZONE*> toMerge, merged;
1424 
1425  for( EDA_ITEM* item : selection )
1426  {
1427  ZONE* curr_area = dynamic_cast<ZONE*>( item );
1428 
1429  if( !curr_area )
1430  continue;
1431 
1432  if( !firstZone )
1433  firstZone = curr_area;
1434 
1435  netcode = curr_area->GetNetCode();
1436 
1437  if( firstZone->GetNetCode() != netcode )
1438  {
1439  wxLogMessage( _( "Some zone netcodes did not match and were not merged." ) );
1440  continue;
1441  }
1442 
1443  if( curr_area->GetPriority() != firstZone->GetPriority() )
1444  {
1445  wxLogMessage( _( "Some zone priorities did not match and were not merged." ) );
1446  continue;
1447  }
1448 
1449  if( curr_area->GetIsRuleArea() != firstZone->GetIsRuleArea() )
1450  {
1451  wxLogMessage( _( "Some zones were rule areas and were not merged." ) );
1452  continue;
1453  }
1454 
1455  if( curr_area->GetLayer() != firstZone->GetLayer() )
1456  {
1457  wxLogMessage( _( "Some zone layer sets did not match and were not merged." ) );
1458  continue;
1459  }
1460 
1461  if( !board->TestZoneIntersection( curr_area, firstZone ) )
1462  {
1463  wxLogMessage( _( "Some zones did not intersect and were not merged." ) );
1464  continue;
1465  }
1466 
1467  toMerge.push_back( curr_area );
1468  }
1469 
1471 
1472  if( mergeZones( m_frame, commit, toMerge, merged ) )
1473  {
1474  commit.Push( wxT( "Merge zones" ) );
1475 
1476  for( EDA_ITEM* item : merged )
1478  }
1479 
1480  return 0;
1481 }
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:59
BOARD * board() const
unsigned GetPriority() const
Definition: zone.h:122
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:735
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
static bool mergeZones(EDA_DRAW_FRAME *aFrame, BOARD_COMMIT &aCommit, std::vector< ZONE * > &aOriginZones, std::vector< ZONE * > &aMergedZones)
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
bool TestZoneIntersection(ZONE *aZone1, ZONE *aZone2)
Test for intersection of 2 copper areas.
const PCB_SELECTION & selection() const
virtual PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: zone.cpp:222
#define _(s)
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
Definition: pcb_actions.h:62
int Size() const
Returns the number of selected parts.
Definition: selection.h:104
The selection tool: currently supports:
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99

References _, PCB_TOOL_BASE::board(), ZONE::GetIsRuleArea(), ZONE::GetLayer(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE::GetPriority(), TOOL_MANAGER::GetTool(), m_frame, TOOL_BASE::m_toolMgr, mergeZones(), BOARD_COMMIT::Push(), TOOL_MANAGER::RunAction(), PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionClear, PCB_ACTIONS::selectItem, SELECTION::Size(), and BOARD::TestZoneIntersection().

Referenced by setTransitions().

Member Data Documentation

◆ m_frame

◆ m_inPlaceFootprint

bool BOARD_EDITOR_CONTROL::m_inPlaceFootprint
private

Definition at line 137 of file board_editor_control.h.

Referenced by PlaceFootprint().

◆ m_inPlaceTarget

bool BOARD_EDITOR_CONTROL::m_inPlaceTarget
private

Definition at line 139 of file board_editor_control.h.

Referenced by PlaceTarget().

◆ m_isFootprintEditor

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

The functions below are not yet implemented - their interface may change.

Definition at line 125 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_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(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), PL_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_CONTROL::Init(), PCB_VIEWER_TOOLS::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PL_SELECTION_TOOL::Init(), SCH_DRAWING_TOOLS::Init(), Init(), GERBVIEW_SELECTION_TOOL::Init(), EDA_3D_CONTROLLER::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), PCB_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PCB_TOOL_BASE::Init(), PICKER_TOOL::Init(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_PICKER_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PL_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_placeOrigin

std::unique_ptr<KIGFX::ORIGIN_VIEWITEM> BOARD_EDITOR_CONTROL::m_placeOrigin
private

Definition at line 141 of file board_editor_control.h.

Referenced by BOARD_EDITOR_CONTROL(), DrillOrigin(), and Reset().

◆ m_placingFootprint

bool BOARD_EDITOR_CONTROL::m_placingFootprint
private

Definition at line 138 of file board_editor_control.h.

Referenced by PlaceFootprint(), and PlacingFootprint().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

Names are expected to obey the format application.ToolName (eg. pcbnew.InteractiveSelection).

Definition at line 209 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 214 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), PCB_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SCH_MOVE_TOOL::AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), SCH_EDIT_TOOL::BreakWire(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), BOARD_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), PL_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), PL_EDIT_TOOL::Copy(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), MICROWAVE_TOOL::createInductorBetween(), DRC_TOOL::CrossProbe(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), BOARD_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::Drag(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), EditFpInFpEditor(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editShapeProperties(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), PCB_SELECTION_TOOL::filterSelection(), PCB_SELECTION_TOOL::FindItem(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), 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(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::Group(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PL_EDIT_TOOL::ImportDrawingSheetContent(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), BOARD_REANNOTATE_TOOL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), GROUP_TOOL::Init(), PAD_TOOL::Init(), CONVERT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), GLOBAL_EDIT_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), PL_POINT_EDITOR::Init(), BOARD_INSPECTION_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PCB_POINT_EDITOR::Init(), Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), GROUP_TOOL::LeaveGroup(), SCH_NAVIGATE_TOOL::LeaveSheet(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), CVPCB_CONTROL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), modifyLockSelected(), EDIT_TOOL::MoveExact(), SYMBOL_EDITOR_CONTROL::OnDeMorgan(), PL_SELECTION_TOOL::onDisambiguationExpire(), EE_SELECTION_TOOL::onDisambiguationExpire(), PCB_SELECTION_TOOL::onDisambiguationExpire(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_EDIT_TOOL::PinTable(), PCB_CONTROL::placeBoardItems(), PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_CONTROL::Print(), GERBVIEW_CONTROL::Print(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), SYMBOL_EDITOR_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), GROUP_TOOL::RemoveFromGroup(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), PCB_SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), PCB_SELECTION_TOOL::RequestSelection(), PAD_TOOL::Reset(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC_TOOL::RunTests(), EE_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), PCB_SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::selectPoint(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), EDA_3D_CONTROLLER::SetMaterial(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), EDA_3D_CONTROLLER::ToggleVisibility(), TrackWidthDec(), TrackWidthInc(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), GROUP_TOOL::Ungroup(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), PCB_SELECTION_TOOL::UnselectItems(), PNS::TOOL_BASE::updateEndItem(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCB_CONTROL::UpdateMessagePanel(), EDIT_TOOL::updateModificationPoint(), EE_POINT_EDITOR::updateParentItem(), BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest(), PNS::TOOL_BASE::updateStartItem(), ViaSizeDec(), ViaSizeInc(), TOOL_INTERACTIVE::Wait(), ZoneDuplicate(), and ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 213 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

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

Definition at line 206 of file tool_base.h.

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

◆ WIDTH_STEP

const int BOARD_EDITOR_CONTROL::WIDTH_STEP = 100000
staticprivate

How does line width change after one -/+ key press.

Definition at line 143 of file board_editor_control.h.

Referenced by PlaceTarget().


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