KiCad PCB EDA Suite
PCB_EDITOR_CONTROL Class Reference

Class PCB_EDITOR_CONTROL. More...

#include <pcb_editor_control.h>

Inheritance diagram for PCB_EDITOR_CONTROL:
PCB_TOOL_BASE TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 PCB_EDITOR_CONTROL ()
 
 ~PCB_EDITOR_CONTROL ()
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings the tool to a known, initial state. More...
 
bool Init () override
 Function Init() 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 BoardSetup (const TOOL_EVENT &aEvent)
 
int ImportNetlist (const TOOL_EVENT &aEvent)
 
int ImportSpecctraSession (const TOOL_EVENT &aEvent)
 
int ExportSpecctraDSN (const TOOL_EVENT &aEvent)
 
int GenerateDrillFiles (const TOOL_EVENT &aEvent)
 
int GeneratePosFile (const TOOL_EVENT &aEvent)
 
int GenerateFabFiles (const TOOL_EVENT &aEvent)
 
int UpdatePCBFromSchematic (const TOOL_EVENT &aEvent)
 
int ShowEeschema (const TOOL_EVENT &aEvent)
 
int ToggleLayersManager (const TOOL_EVENT &aEvent)
 
int ToggleMicrowaveToolbar (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)
 
int ZoneDuplicate (const TOOL_EVENT &aEvent)
 

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

More...
 
int PlaceTarget (const TOOL_EVENT &aEvent)
 Function PlaceTarget() Allows user to place a layer alignment target. More...
 
int PlaceModule (const TOOL_EVENT &aEvent)
 Function PlaceModule() Displays a dialog to select a module to be added and allows the user to set its position. More...
 
int ToggleLockSelected (const TOOL_EVENT &aEvent)
 

Toggles 'lock' property for selected items.

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

Locks selected items.

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

Unlocks selected items.

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

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

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

Static Public Member Functions

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

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

More...
 

Protected Types

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

Protected Member Functions

void doInteractiveItemPlacement (const std::string &aTool, INTERACTIVE_PLACER_BASE *aPlacer, const wxString &aCommitMessage, int aOptions=IPO_ROTATE|IPO_FLIP|IPO_REPEAT)
 Helper function for performing a common interactive idiom: wait for a left click, place an item there (perhaps with a dialog or other user interaction), then have it move with the mouse and respond to rotate/flip, etc. More...
 
KIGFX::PCB_VIEWview () const
 
KIGFX::VIEW_CONTROLScontrols () const
 
PCB_BASE_EDIT_FRAMEframe () const
 
BOARDboard () const
 
MODULEmodule () const
 
const PCB_DISPLAY_OPTIONSdisplayOptions () const
 
PCB_DRAW_PANEL_GALcanvas () const
 
const PCBNEW_SELECTIONselection () const
 
PCBNEW_SELECTIONselection ()
 
void attachManager (TOOL_MANAGER *aManager)
 Function attachManager() More...
 
KIGFX::VIEWgetView () const
 Function getView() More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Function getViewControls() More...
 
template<typename T >
T * getEditFrame () const
 Function getEditFrame() More...
 
template<typename T >
T * getModel () const
 Function getModel() More...
 

Protected Attributes

bool m_editModules
 
TOOL_MENU m_menu
 functions below are not yet implemented - their interface may change More...
 
TOOL_TYPE m_type
 

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

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

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 
TOOL_SETTINGS m_toolSettings
 

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)
 
void setTransitions () override
 

Sets up handlers for various events.

More...
 

Private Attributes

PCB_EDIT_FRAMEm_frame
 
std::unique_ptr< KIGFX::ORIGIN_VIEWITEMm_placeOrigin
 

Pointer to the currently used edit frame.

More...
 

Static Private Attributes

static const int WIDTH_STEP = 100000
 

Place & drill origin marker

More...
 

Detailed Description

Class PCB_EDITOR_CONTROL.

Handles actions specific to the board editor in pcbnew.

Definition at line 42 of file pcb_editor_control.h.

Member Enumeration Documentation

◆ INTERACTIVE_PLACEMENT_OPTIONS

Enumerator
IPO_ROTATE 
IPO_FLIP 
IPO_SINGLE_CLICK 
IPO_REPEAT 

Definition at line 109 of file pcb_tool_base.h.

◆ MODIFY_MODE

How to modify a property for selected items.

Enumerator
ON 
OFF 
TOGGLE 

Definition at line 120 of file pcb_editor_control.h.

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determines the reason of reset for a tool

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 79 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ PCB_EDITOR_CONTROL()

PCB_EDITOR_CONTROL::PCB_EDITOR_CONTROL ( )

Definition at line 140 of file pcb_editor_control.cpp.

140  :
141  PCB_TOOL_BASE( "pcbnew.EditorControl" ),
142  m_frame( nullptr )
143 {
144  m_placeOrigin.reset( new KIGFX::ORIGIN_VIEWITEM( KIGFX::COLOR4D( 0.8, 0.0, 0.0, 1.0 ),
146 }
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_placeOrigin
Pointer to the currently used edit frame.
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool_base.h:71
PCB_EDIT_FRAME * m_frame
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

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

◆ ~PCB_EDITOR_CONTROL()

PCB_EDITOR_CONTROL::~PCB_EDITOR_CONTROL ( )

Definition at line 149 of file pcb_editor_control.cpp.

150 {
151 }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

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

Definition at line 51 of file tool_interactive.cpp.

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

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

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

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

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

Definition at line 60 of file tool_base.cpp.

61 {
62  m_toolMgr = aManager;
63  m_toolSettings = TOOL_SETTINGS( this );
64 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:220
friend class TOOL_SETTINGS
Definition: tool_base.h:154

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

Referenced by TOOL_MANAGER::RegisterTool().

◆ board()

BOARD* PCB_TOOL_BASE::board ( ) const
inlineprotectedinherited

Definition at line 151 of file pcb_tool_base.h.

151 { return getModel<BOARD>(); }

Referenced by PCBNEW_CONTROL::AppendBoard(), AUTOPLACE_TOOL::autoplace(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), EDIT_TOOL::ChangeTrackWidth(), ZONE_FILLER_TOOL::CheckAllZones(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), PCB_INSPECTION_TOOL::ClearHighlight(), DRAWING_TOOL::constrainDimension(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), ROUTER_TOOL::CustomTrackWidthDialog(), PCBNEW_CONTROL::DeleteItemCursor(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), PAD_TOOL::EnumeratePads(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), ZONE_FILLER_TOOL::FillAllZones(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::getCollectorsGuide(), PCBNEW_CONTROL::GraphicDisplayMode(), PCB_INSPECTION_TOOL::highlightNet(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PCB_TOOL_BASE::module(), PCBNEW_CONTROL::ModuleEdgeOutlines(), ROUTER_TOOL::onTrackViaSizeChanged(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::PadDisplayMode(), PCBNEW_CONTROL::Paste(), PCBNEW_CONTROL::placeBoardItems(), PlaceModule(), PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), SELECTION_TOOL::RebuildSelection(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), SELECTION_TOOL::Selectable(), SELECTION_TOOL::selectAllItemsConnectedToItem(), SELECTION_TOOL::selectAllItemsConnectedToTrack(), SELECTION_TOOL::selectAllItemsOnNet(), SELECTION_TOOL::selectAllItemsOnSheet(), SELECTION_TOOL::selectPoint(), DRC::testDisabledLayers(), DRC::TestZoneToZoneOutline(), PCBNEW_CONTROL::TrackDisplayMode(), POINT_EDITOR::updateItem(), PCBNEW_CONTROL::ViaDisplayMode(), PCBNEW_CONTROL::ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

◆ BoardSetup()

int PCB_EDITOR_CONTROL::BoardSetup ( const TOOL_EVENT aEvent)

Definition at line 308 of file pcb_editor_control.cpp.

309 {
310  getEditFrame<PCB_EDIT_FRAME>()->DoShowBoardSetupDialog();
311  return 0;
312 }

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

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

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

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

◆ DoSetDrillOrigin()

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

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

Definition at line 1086 of file pcb_editor_control.cpp.

1088 {
1089  aFrame->SetAuxOrigin( wxPoint( aPosition.x, aPosition.y ) );
1090  originViewItem->SetPosition( wxPoint( aPosition.x, aPosition.y ) );
1091  aView->MarkDirty();
1092  aFrame->OnModify();
1093 }
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
void SetAuxOrigin(const wxPoint &aPoint) override
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:610

References KIGFX::VIEW::MarkDirty(), PCB_BASE_FRAME::OnModify(), PCB_BASE_FRAME::SetAuxOrigin(), BOARD_ITEM::SetPosition(), VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ DrillOrigin()

int PCB_EDITOR_CONTROL::DrillOrigin ( const TOOL_EVENT aEvent)

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

Definition at line 1096 of file pcb_editor_control.cpp.

1097 {
1098  std::string tool = aEvent.GetCommandStr().get();
1100 
1101  // Deactivate other tools; particularly important if another PICKER is currently running
1102  Activate();
1103 
1104  picker->SetClickHandler(
1105  [this] ( const VECTOR2D& pt ) -> bool
1106  {
1108  DoSetDrillOrigin( getView(), m_frame, m_placeOrigin.get(), pt );
1109  return false; // drill origin is a one-shot; don't continue with tool
1110  } );
1111 
1112  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
1113 
1114  return 0;
1115 }
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_placeOrigin
Pointer to the currently used edit frame.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
static TOOL_ACTION pickerTool
Definition: actions.h:145
Generic tool for picking a point.
void SaveCopyInUndoList(BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0)) override
Function SaveCopyInUndoList Creates a new entry in undo list of commands.
Definition: undo_redo.cpp:182
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
static void DoSetDrillOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, BOARD_ITEM *aItem, const VECTOR2D &aPoint)
Low-level access (below undo) to setting the drill origin
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
PCB_EDIT_FRAME * m_frame
void Activate()
Function Activate() Runs the tool.
void SetClickHandler(CLICK_HANDLER aHandler)
Function SetClickHandler() Sets a handler for mouse click event.

References TOOL_INTERACTIVE::Activate(), DoSetDrillOrigin(), 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(), PCBNEW_PICKER_TOOL::SetClickHandler(), and UR_DRILLORIGIN.

Referenced by setTransitions().

◆ EditingModules()

bool PCB_TOOL_BASE::EditingModules ( ) const
inlineinherited

◆ ExportSpecctraDSN()

int PCB_EDITOR_CONTROL::ExportSpecctraDSN ( const TOOL_EVENT aEvent)

Definition at line 342 of file pcb_editor_control.cpp.

343 {
344  wxString fullFileName = m_frame->GetLastPath( LAST_PATH_SPECCTRADSN );
345  wxFileName fn;
346 
347  if( fullFileName.IsEmpty() )
348  {
349  fn = m_frame->GetBoard()->GetFileName();
350  fn.SetExt( SpecctraDsnFileExtension );
351  }
352  else
353  fn = fullFileName;
354 
355  fullFileName = EDA_FILE_SELECTOR( _( "Specctra DSN File" ), fn.GetPath(), fn.GetFullName(),
357  frame(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, false );
358 
359  if( !fullFileName.IsEmpty() )
360  {
361  m_frame->SetLastPath( LAST_PATH_SPECCTRADSN, fullFileName );
362  getEditFrame<PCB_EDIT_FRAME>()->ExportSpecctraFile( fullFileName );
363  }
364 
365  return 0;
366 }
const wxString & GetFileName() const
Definition: class_board.h:216
wxString GetLastPath(LAST_PATH_TYPE aType)
Get the last path for a particular type.
PCB_BASE_EDIT_FRAME * frame() const
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:52
#define _(s)
const std::string SpecctraDsnFileExtension
PCB_EDIT_FRAME * m_frame
wxString SpecctraDsnFileWildcard()
BOARD * GetBoard() const
void SetLastPath(LAST_PATH_TYPE aType, const wxString &aLastPath)
Set the path of the last file successfully read.

References _, EDA_FILE_SELECTOR(), 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().

◆ FlipPcbView()

int PCB_EDITOR_CONTROL::FlipPcbView ( const TOOL_EVENT aEvent)

Definition at line 1118 of file pcb_editor_control.cpp.

1119 {
1120  view()->SetMirror( !view()->IsMirroredX(), false );
1121  view()->RecacheAllItems();
1122  frame()->Refresh();
1123  return 0;
1124 }
void RecacheAllItems()
Function RecacheAllItems() Rebuilds GAL display lists.
Definition: view.cpp:1402
void SetMirror(bool aMirrorX, bool aMirrorY)
Function SetMirror() Controls the mirroring of the VIEW.
Definition: view.cpp:565
PCB_BASE_EDIT_FRAME * frame() const
KIGFX::PCB_VIEW * view() const

References PCB_TOOL_BASE::frame(), KIGFX::VIEW::RecacheAllItems(), KIGFX::VIEW::SetMirror(), and PCB_TOOL_BASE::view().

Referenced by setTransitions().

◆ frame()

PCB_BASE_EDIT_FRAME* PCB_TOOL_BASE::frame ( ) const
inlineprotectedinherited

Definition at line 146 of file pcb_tool_base.h.

147  {
148  return getEditFrame<PCB_BASE_EDIT_FRAME>();
149  }

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

◆ GenerateDrillFiles()

int PCB_EDITOR_CONTROL::GenerateDrillFiles ( const TOOL_EVENT aEvent)

Definition at line 64 of file dialog_gendrill.cpp.

65 {
66  PCB_EDIT_FRAME* editFrame = getEditFrame<PCB_EDIT_FRAME>();
67  DIALOG_GENDRILL dlg( editFrame, editFrame );
68 
69  dlg.ShowModal();
70  return 0;
71 }
Class PCB_EDIT_FRAME is the main frame for Pcbnew.

Referenced by setTransitions().

◆ GenerateFabFiles()

int PCB_EDITOR_CONTROL::GenerateFabFiles ( const TOOL_EVENT aEvent)

Definition at line 369 of file pcb_editor_control.cpp.

370 {
371  wxCommandEvent dummy;
372 
373  if( aEvent.IsAction( &PCB_ACTIONS::generateGerbers ) )
375  else if( aEvent.IsAction( &PCB_ACTIONS::generateReportFile ) )
377  else if( aEvent.IsAction( &PCB_ACTIONS::generateD356File ) )
379  else if( aEvent.IsAction( &PCB_ACTIONS::generateBOM ) )
381  else
382  wxFAIL_MSG( "GenerateFabFiles(): unexpected request" );
383 
384  return 0;
385 }
static TOOL_ACTION generateGerbers
Definition: pcb_actions.h:319
void ToPlotter(int aID)
Function ToPlotter Open a dialog frame to create plot and drill files relative to the current board.
void RecreateBOMFileFromBoard(wxCommandEvent &aEvent)
Function RecreateBOMFileFromBoard Creates a BOM file from the current loaded board.
static TOOL_ACTION generateReportFile
Definition: pcb_actions.h:322
static TOOL_ACTION generateD356File
Definition: pcb_actions.h:323
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
void GenFootprintsReport(wxCommandEvent &event)
Function GenFootprintsReport Calls DoGenFootprintsReport to create a footprint reprot file See DoGenF...
static TOOL_ACTION generateBOM
Definition: pcb_actions.h:324
PCB_EDIT_FRAME * m_frame
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
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 PCB_EDITOR_CONTROL::GeneratePosFile ( const TOOL_EVENT aEvent)

Definition at line 472 of file gen_footprints_placefile.cpp.

473 {
474  PCB_EDIT_FRAME* editFrame = getEditFrame<PCB_EDIT_FRAME>();
475  DIALOG_GEN_FOOTPRINT_POSITION dlg( editFrame );
476 
477  dlg.ShowModal();
478  return 0;
479 }
Class PCB_EDIT_FRAME is 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

Function getEditFrame()

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

Definition at line 187 of file tool_base.h.

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

References TOOL_BASE::getEditFrameInt().

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

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

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

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 121 of file tool_base.h.

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

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 143 of file tool_base.h.

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

References TOOL_BASE::m_toolMgr.

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

◆ getModel()

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

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 201 of file tool_base.h.

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

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Function GetName() Returns the name of the tool.

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

Returns
The name of the tool.

Definition at line 132 of file tool_base.h.

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

References TOOL_BASE::m_toolName.

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

◆ GetSettings()

TOOL_SETTINGS & TOOL_BASE::GetSettings ( )
inherited

Definition at line 78 of file tool_base.cpp.

79 {
80  return m_toolSettings;
81 }
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:220

References TOOL_BASE::m_toolSettings.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 110 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

KIGFX::VIEW * TOOL_BASE::getView ( ) const
protectedinherited

Function getView()

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

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

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

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

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

◆ getViewControls()

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

Function getViewControls()

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

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

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

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

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

◆ Go()

template<class T >
void TOOL_INTERACTIVE::Go ( int(T::*)(const TOOL_EVENT &)  aStateFunc,
const TOOL_EVENT_LIST aConditions = TOOL_EVENTTC_ANYTA_ANY ) 
)
inherited

Function Go()

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

Definition at line 129 of file tool_interactive.h.

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

References TOOL_INTERACTIVE::goInternal().

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

◆ ImportNetlist()

int PCB_EDITOR_CONTROL::ImportNetlist ( const TOOL_EVENT aEvent)

Definition at line 315 of file pcb_editor_control.cpp.

316 {
317  getEditFrame<PCB_EDIT_FRAME>()->InstallNetlistFrame();
318  return 0;
319 }

Referenced by setTransitions().

◆ ImportSpecctraSession()

int PCB_EDITOR_CONTROL::ImportSpecctraSession ( const TOOL_EVENT aEvent)

Definition at line 322 of file pcb_editor_control.cpp.

323 {
324  wxString fullFileName = frame()->GetBoard()->GetFileName();
325  wxString path;
326  wxString name;
327  wxString ext;
328 
329  wxFileName::SplitPath( fullFileName, &path, &name, &ext );
330  name += wxT( ".ses" );
331 
332  fullFileName = EDA_FILE_SELECTOR( _( "Merge Specctra Session file:" ), path, name,
333  wxT( ".ses" ), wxT( "*.ses" ), frame(), wxFD_OPEN, false );
334 
335  if( !fullFileName.IsEmpty() )
336  getEditFrame<PCB_EDIT_FRAME>()->ImportSpecctraSession( fullFileName );
337 
338  return 0;
339 }
const wxString & GetFileName() const
Definition: class_board.h:216
PCB_BASE_EDIT_FRAME * frame() const
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:52
#define _(s)
const char * name
Definition: DXF_plotter.cpp:61
BOARD * GetBoard() const

References _, EDA_FILE_SELECTOR(), PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetBoard(), BOARD::GetFileName(), and name.

Referenced by setTransitions().

◆ Init()

bool PCB_EDITOR_CONTROL::Init ( )
overridevirtual

Function Init() 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 167 of file pcb_editor_control.cpp.

168 {
169  auto activeToolCondition = [ this ] ( const SELECTION& aSel ) {
170  return ( !m_frame->ToolStackIsEmpty() );
171  };
172 
173  auto inactiveStateCondition = [ this ] ( const SELECTION& aSel ) {
174  return ( m_frame->ToolStackIsEmpty() && aSel.Size() == 0 );
175  };
176 
177  auto placeModuleCondition = [ this ] ( const SELECTION& aSel ) {
178  return ( m_frame->IsCurrentTool( PCB_ACTIONS::placeModule ) && aSel.GetSize() == 0 );
179  };
180 
181  auto& ctxMenu = m_menu.GetMenu();
182 
183  // "Cancel" goes at the top of the context menu when a tool is active
184  ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolCondition, 1 );
185  ctxMenu.AddSeparator( 1 );
186 
187  // "Get and Place Footprint" should be available for Place Footprint tool
188  ctxMenu.AddItem( PCB_ACTIONS::getAndPlace, placeModuleCondition, 1000 );
189  ctxMenu.AddSeparator( 1000 );
190 
191  // Finally, add the standard zoom & grid items
192  getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus( m_menu );
193 
194  auto zoneMenu = std::make_shared<ZONE_CONTEXT_MENU>();
195  zoneMenu->SetTool( this );
196 
197  auto lockMenu = std::make_shared<LOCK_CONTEXT_MENU>();
198  lockMenu->SetTool( this );
199 
200  // Add the PCB control menus to relevant other tools
201 
203 
204  if( selTool )
205  {
206  auto& toolMenu = selTool->GetToolMenu();
207  auto& menu = toolMenu.GetMenu();
208 
209  // Add "Get and Place Footprint" when Selection tool is in an inactive state
210  menu.AddItem( PCB_ACTIONS::getAndPlace, inactiveStateCondition );
211  menu.AddSeparator();
212 
213  toolMenu.AddSubMenu( zoneMenu );
214  toolMenu.AddSubMenu( lockMenu );
215 
216  menu.AddMenu( zoneMenu.get(), SELECTION_CONDITIONS::OnlyType( PCB_ZONE_AREA_T ), 200 );
217  menu.AddMenu( lockMenu.get(), SELECTION_CONDITIONS::OnlyTypes( GENERAL_COLLECTOR::LockableItems ), 200 );
218  }
219 
220  DRAWING_TOOL* drawingTool = m_toolMgr->GetTool<DRAWING_TOOL>();
221 
222  if( drawingTool )
223  {
224  auto& toolMenu = drawingTool->GetToolMenu();
225  auto& menu = toolMenu.GetMenu();
226 
227  toolMenu.AddSubMenu( zoneMenu );
228 
229  // Functor to say if the PCB_EDIT_FRAME is in a given mode
230  // Capture the tool pointer and tool mode by value
231  auto toolActiveFunctor = [=]( DRAWING_TOOL::MODE aMode )
232  {
233  return [=]( const SELECTION& sel )
234  {
235  return drawingTool->GetDrawingMode() == aMode;
236  };
237  };
238 
239  menu.AddMenu( zoneMenu.get(), toolActiveFunctor( DRAWING_TOOL::MODE::ZONE ), 200 );
240  }
241 
242  return true;
243 }
static TOOL_ACTION placeModule
Definition: pcb_actions.h:165
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Function OnlyTypes Creates a functor that tests if the selected items are only of given types.
Class SELECTION_TOOL.
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:101
TOOL_MENU & GetToolMenu()
static TOOL_ACTION getAndPlace
Find an item and start moving.
Definition: pcb_actions.h:428
Class DRAWING_TOOL.
Definition: drawing_tool.h:49
static const KICAD_T LockableItems[]
A scan list for TRACKS, VIAS, MODULES.
Definition: collectors.h:318
MODE
The possible drawing modes of DRAWING_TOOL
Definition: drawing_tool.h:62
bool ToolStackIsEmpty()
PCB_EDIT_FRAME * m_frame
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Function OnlyType Creates a functor that tests if the selected items are only of given type.
MODE GetDrawingMode() const
Function GetDrawingMode.
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()
bool IsCurrentTool(const TOOL_ACTION &aAction) const

References CONDITIONAL_MENU::AddItem(), ACTIONS::cancelInteractive, PCB_ACTIONS::getAndPlace, DRAWING_TOOL::GetDrawingMode(), TOOL_MENU::GetMenu(), TOOL_MANAGER::GetTool(), TOOL_INTERACTIVE::GetToolMenu(), EDA_BASE_FRAME::IsCurrentTool(), GENERAL_COLLECTOR::LockableItems, m_frame, TOOL_INTERACTIVE::m_menu, TOOL_BASE::m_toolMgr, SELECTION_CONDITIONS::OnlyType(), SELECTION_CONDITIONS::OnlyTypes(), PCB_ZONE_AREA_T, PCB_ACTIONS::placeModule, EDA_BASE_FRAME::ToolStackIsEmpty(), and DRAWING_TOOL::ZONE.

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

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

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

◆ LockSelected()

int PCB_EDITOR_CONTROL::LockSelected ( const TOOL_EVENT aEvent)

Locks selected items.

Definition at line 773 of file pcb_editor_control.cpp.

774 {
775  return modifyLockSelected( ON );
776 }
int modifyLockSelected(MODIFY_MODE aMode)

References modifyLockSelected(), and ON.

Referenced by setTransitions().

◆ modifyLockSelected()

int PCB_EDITOR_CONTROL::modifyLockSelected ( MODIFY_MODE  aMode)
private

Definition at line 785 of file pcb_editor_control.cpp.

786 {
788  const PCBNEW_SELECTION& selection = selTool->GetSelection();
789  BOARD_COMMIT commit( m_frame );
790 
791  if( selection.Empty() )
793 
794  bool modified = false;
795 
796  for( EDA_ITEM* item : selection )
797  {
798  BOARD_ITEM* board_item = static_cast<BOARD_ITEM*>( item );
799  bool prevState = board_item->IsLocked();
800 
801  commit.Modify( board_item );
802 
803  switch( aMode )
804  {
805  case ON: board_item->SetLocked( true ); break;
806  case OFF: board_item->SetLocked( false ); break;
807  case TOGGLE: board_item->SetLocked( !prevState ); break;
808  }
809 
810  // Check if we really modified an item
811  if( !modified && prevState != board_item->IsLocked() )
812  modified = true;
813  }
814 
815  if( modified )
816  {
817  switch( aMode )
818  {
819  case ON: commit.Push( _( "Lock" ) ); break;
820  case OFF: commit.Push( _( "Unlock" ) ); break;
821  case TOGGLE: commit.Push( _( "Toggle Locking" ) ); break;
822  }
823 
825  m_frame->OnModify();
826  }
827 
828  return 0;
829 }
void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
virtual void SetLocked(bool aLocked)
Function SetLocked modifies 'lock' status for of the item.
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:201
PCBNEW_SELECTION & GetSelection()
Function GetSelection()
const PCBNEW_SELECTION & selection() const
#define _(s)
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:119
virtual bool IsLocked() const
Function IsLocked.
PCB_EDIT_FRAME * m_frame
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
void PostEvent(const TOOL_EVENT &aEvent)
Puts an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:237
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
Definition: pcb_actions.h:70

References _, SELECTION::Empty(), 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::SelectedItemsModified, PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionCursor, BOARD_ITEM::SetLocked(), and TOGGLE.

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

◆ module()

◆ New()

int PCB_EDITOR_CONTROL::New ( const TOOL_EVENT aEvent)

Definition at line 246 of file pcb_editor_control.cpp.

247 {
249  return 0;
250 }
PCB_EDIT_FRAME * m_frame
bool Files_io_from_id(int aId)
Function Files_io_from_id Read and write board files.

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

Referenced by setTransitions().

◆ Open()

int PCB_EDITOR_CONTROL::Open ( const TOOL_EVENT aEvent)

Definition at line 253 of file pcb_editor_control.cpp.

254 {
256  return 0;
257 }
PCB_EDIT_FRAME * m_frame
bool Files_io_from_id(int aId)
Function Files_io_from_id Read and write board files.

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

Referenced by setTransitions().

◆ PageSettings()

int PCB_EDITOR_CONTROL::PageSettings ( const TOOL_EVENT aEvent)

Definition at line 281 of file pcb_editor_control.cpp.

282 {
283  PICKED_ITEMS_LIST undoCmd;
284  WS_PROXY_UNDO_ITEM* undoItem = new WS_PROXY_UNDO_ITEM( m_frame );
285  ITEM_PICKER wrapper( undoItem, UR_PAGESETTINGS );
286 
287  undoCmd.PushItem( wrapper );
289 
292  dlg.SetWksFileName( BASE_SCREEN::m_PageLayoutDescrFileName );
293 
294  if( dlg.ShowModal() != wxID_OK )
296 
297  return 0;
298 }
void RollbackFromUndo()
Performs an undo of the last edit WITHOUT logging a corresponding redo.
Definition: undo_redo.cpp:606
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
static wxString m_PageLayoutDescrFileName
the name of the page layout descr file, or emty to used the default pagelayout
Definition: base_screen.h:109
#define MAX_PAGE_SIZE_PCBNEW_MILS
Definition: page_info.h:40
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
void SaveCopyInUndoList(BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0)) override
Function SaveCopyInUndoList Creates a new entry in undo list of commands.
Definition: undo_redo.cpp:182
PCB_EDIT_FRAME * m_frame

References m_frame, BASE_SCREEN::m_PageLayoutDescrFileName, MAX_PAGE_SIZE_PCBNEW_MILS, PICKED_ITEMS_LIST::PushItem(), PCB_BASE_EDIT_FRAME::RollbackFromUndo(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), DIALOG_PAGES_SETTINGS::SetWksFileName(), and UR_PAGESETTINGS.

Referenced by setTransitions().

◆ PlaceModule()

int PCB_EDITOR_CONTROL::PlaceModule ( const TOOL_EVENT aEvent)

Function PlaceModule() Displays a dialog to select a module to be added and allows the user to set its position.

Definition at line 627 of file pcb_editor_control.cpp.

628 {
629  MODULE* module = aEvent.Parameter<MODULE*>();
631  BOARD_COMMIT commit( m_frame );
632  BOARD* board = getModel<BOARD>();
633 
635  controls->ShowCursor( true );
636  controls->SetSnapping( true );
637 
638  std::string tool = aEvent.GetCommandStr().get();
639  m_frame->PushTool( tool );
640  Activate();
641 
642  VECTOR2I cursorPos = controls->GetCursorPosition();
643  bool reselect = false;
644 
645  // Prime the pump
646  if( module )
647  {
648  module->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
651  }
652  else if( aEvent.HasPosition() )
654 
655  // Main loop: keep receiving events
656  while( TOOL_EVENT* evt = Wait() )
657  {
658  m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
659  cursorPos = controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
660 
661  if( reselect && module )
663 
664  auto cleanup = [&] ()
665  {
667  commit.Revert();
668  module = NULL;
669  };
670 
671  if( evt->IsCancelInteractive() )
672  {
673  if( module )
674  cleanup();
675  else
676  {
677  m_frame->PopTool( tool );
678  break;
679  }
680  }
681 
682  else if( evt->IsActivate() )
683  {
684  if( module )
685  cleanup();
686 
687  if( evt->IsMoveTool() )
688  {
689  // leave ourselves on the stack so we come back after the move
690  break;
691  }
692  else
693  {
694  frame()->PopTool( tool );
695  break;
696  }
697  }
698 
699  else if( evt->IsClick( BUT_LEFT ) )
700  {
701  if( !module )
702  {
703  // Pick the module to be placed
705 
706  if( module == NULL )
707  continue;
708 
709  module->SetLink( 0 );
710 
711  module->SetFlags( IS_NEW ); // whatever
713 
714  // Set parent so that clearance can be loaded
715  module->SetParent( board );
716 
717  // Put it on FRONT layer,
718  // (Can be stored flipped if the lib is an archive built from a board)
719  if( module->IsFlipped() )
721 
722  module->SetOrientation( 0 );
723  module->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
724 
725  commit.Add( module );
727  controls->SetCursorPosition( cursorPos, false );
728  }
729  else
730  {
732  commit.Push( _( "Place a module" ) );
733  module = NULL; // to indicate that there is no module that we currently modify
734  }
735  }
736 
737  else if( evt->IsClick( BUT_RIGHT ) )
738  {
740  }
741 
742  else if( module && ( evt->IsMotion() || evt->IsAction( &ACTIONS::refreshPreview ) ) )
743  {
744  module->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
745  selection().SetReferencePoint( cursorPos );
746  getView()->Update( & selection() );
747  }
748 
749  else if( module && evt->IsAction( &PCB_ACTIONS::properties ) )
750  {
751  // Calling 'Properties' action clears the selection, so we need to restore it
752  reselect = true;
753  }
754 
755  else
756  evt->SetPassEvent();
757 
758  // Enable autopanning and cursor capture only when there is a module to be placed
759  controls->SetAutoPan( !!module );
761  }
762 
763  return 0;
764 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:73
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
BOARD * board() const
bool IsFlipped() const
function IsFlipped
Definition: class_module.h:288
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
static TOOL_ACTION properties
Activation of the edit tool.
Definition: pcb_actions.h:125
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
MODULE * SelectFootprintFromLibTree(LIB_ID aPreselect=LIB_ID())
Function SelectFootprintFromLibTree opens a dialog to select a footprint.
#define IS_NEW
New item, just created.
Definition: base_struct.h:120
PCB_BASE_EDIT_FRAME * frame() const
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:243
timestamp_t GetNewTimeStamp()
Definition: common.cpp:217
const PCBNEW_SELECTION & selection() const
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:265
void SetLink(timestamp_t aLink)
Definition: class_module.h:546
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:225
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
PCB_GENERAL_SETTINGS & Settings()
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Function Flip Flip this object, i.e.
Class TOOL_EVENT.
Definition: tool_event.h:171
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
void SetPosition(const wxPoint &aPos) override
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
#define _(s)
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
KIGFX::VIEW_CONTROLS * controls() const
PCB_EDIT_FRAME * m_frame
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
MODULE * module() const
void SetOrientation(double newangle)
static TOOL_ACTION selectItem
Selects an item (specified as the event parameter).
Definition: pcb_actions.h:76
virtual void PopTool(const std::string &actionName)
void Activate()
Function Activate() Runs the tool.
bool HasPosition() const
Returns if it this event has a valid position (true for mouse events and context-menu or hotkey-based...
Definition: tool_event.h:260
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
const wxPoint GetPosition() const override
Definition: class_module.h:213
static TOOL_ACTION refreshPreview
Definition: actions.h:101
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false)=0
Moves cursor to the requested position expressed in world coordinates.
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
static TOOL_ACTION cursorClick
Definition: actions.h:115
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:215

References _, TOOL_INTERACTIVE::Activate(), COMMIT::Add(), PCB_TOOL_BASE::board(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), PCB_TOOL_BASE::controls(), ACTIONS::cursorClick, MODULE::Flip(), PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetCanvas(), TOOL_EVENT::GetCommandStr(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), GetNewTimeStamp(), MODULE::GetPosition(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_EVENT::HasPosition(), IS_NEW, MODULE::IsFlipped(), PCB_GENERAL_SETTINGS::m_FlipLeftRight, m_frame, TOOL_INTERACTIVE::m_menu, TOOL_BASE::m_toolMgr, MD_ALT, PCB_TOOL_BASE::module(), TOOL_EVENT::Parameter(), EDA_BASE_FRAME::PopTool(), PCB_ACTIONS::properties, BOARD_COMMIT::Push(), EDA_BASE_FRAME::PushTool(), 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(), MODULE::SetLink(), MODULE::SetOrientation(), EDA_ITEM::SetParent(), MODULE::SetPosition(), SELECTION::SetReferencePoint(), KIGFX::VIEW_CONTROLS::SetSnapping(), EDA_ITEM::SetTimeStamp(), PCB_BASE_FRAME::Settings(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), KIGFX::VIEW::Update(), TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

◆ PlaceTarget()

int PCB_EDITOR_CONTROL::PlaceTarget ( const TOOL_EVENT aEvent)

Function PlaceTarget() Allows user to place a layer alignment target.

Definition at line 832 of file pcb_editor_control.cpp.

833 {
834  KIGFX::VIEW* view = getView();
836  BOARD* board = getModel<BOARD>();
837  PCB_TARGET* target = new PCB_TARGET( board );
838 
839  // Init the new item attributes
840  target->SetLayer( Edge_Cuts );
842  target->SetSize( Millimeter2iu( 5 ) );
843  VECTOR2I cursorPos = controls->GetCursorPosition();
844  target->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
845 
846  // Add a VIEW_GROUP that serves as a preview for the new item
847  KIGFX::VIEW_GROUP preview( view );
848  preview.Add( target );
849  view->Add( &preview );
850 
852  controls->SetSnapping( true );
853 
854  std::string tool = aEvent.GetCommandStr().get();
855  m_frame->PushTool( tool );
856  Activate();
857 
858  // Main loop: keep receiving events
859  while( TOOL_EVENT* evt = Wait() )
860  {
861  frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
862  cursorPos = controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
863 
864  if( evt->IsCancelInteractive() )
865  {
866  frame()->PopTool( tool );
867  break;
868  }
869 
870  else if( evt->IsActivate() )
871  {
872  if( evt->IsMoveTool() )
873  {
874  // leave ourselves on the stack so we come back after the move
875  break;
876  }
877  else
878  {
879  frame()->PopTool( tool );
880  break;
881  }
882  }
883 
884  else if( evt->IsAction( &PCB_ACTIONS::incWidth ) )
885  {
886  target->SetWidth( target->GetWidth() + WIDTH_STEP );
887  view->Update( &preview );
888  }
889 
890  else if( evt->IsAction( &PCB_ACTIONS::decWidth ) )
891  {
892  int width = target->GetWidth();
893 
894  if( width > WIDTH_STEP )
895  {
896  target->SetWidth( width - WIDTH_STEP );
897  view->Update( &preview );
898  }
899  }
900 
901  else if( evt->IsClick( BUT_LEFT ) )
902  {
903  assert( target->GetSize() > 0 );
904  assert( target->GetWidth() > 0 );
905 
906  BOARD_COMMIT commit( m_frame );
907  commit.Add( target );
908  commit.Push( _( "Place a layer alignment target" ) );
909 
910  preview.Remove( target );
911 
912  // Create next PCB_TARGET
913  target = new PCB_TARGET( *target );
914  preview.Add( target );
915  }
916 
917  else if( evt->IsClick( BUT_RIGHT ) )
918  {
920  }
921 
922  else if( evt->IsMotion() )
923  {
924  target->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
925  view->Update( &preview );
926  }
927 
928  else
929  evt->SetPassEvent();
930  }
931 
932  preview.Clear();
933  delete target;
934  view->Remove( &preview );
935  controls->SetSnapping( false );
936  return 0;
937 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:73
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
BOARD * board() const
static TOOL_ACTION incWidth
Increase width of currently drawn line.
Definition: pcb_actions.h:172
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:91
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
void SetSize(int aSize)
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
int GetSize() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:531
virtual void Remove(VIEW_ITEM *aItem) override
Function Remove() Removes a VIEW_ITEM from the view.
Definition: pcb_view.cpp:74
static TOOL_ACTION decWidth
Decrease width of currently drawn line.
Definition: pcb_actions.h:175
PCB_BASE_EDIT_FRAME * frame() const
int GetLineThickness(PCB_LAYER_ID aLayer) const
Function GetLineThickness Returns the default graphic segment thickness from the layer class for the ...
int GetWidth() const
const PCBNEW_SELECTION & selection() const
void SetPosition(const wxPoint &aPos) override
Class TOOL_EVENT.
Definition: tool_event.h:171
KIGFX::PCB_VIEW * view() const
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
#define _(s)
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
KIGFX::VIEW_CONTROLS * controls() const
PCB_EDIT_FRAME * m_frame
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
static const int WIDTH_STEP
Place & drill origin marker
void SetWidth(int aWidth)
virtual void PopTool(const std::string &actionName)
void Activate()
Function Activate() Runs the tool.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Function Add() Adds a VIEW_ITEM to the view.
Definition: pcb_view.cpp:58
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
Class VIEW.
Definition: view.h:61
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.

References _, TOOL_INTERACTIVE::Activate(), KIGFX::PCB_VIEW::Add(), KIGFX::VIEW_GROUP::Add(), 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, TOOL_INTERACTIVE::m_menu, TOOL_BASE::m_toolMgr, MD_ALT, EDA_BASE_FRAME::PopTool(), EDA_BASE_FRAME::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(), KIGFX::VIEW_CONTROLS::SetSnapping(), 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().

◆ Plot()

int PCB_EDITOR_CONTROL::Plot ( const TOOL_EVENT aEvent)

Definition at line 301 of file pcb_editor_control.cpp.

302 {
304  return 0;
305 }
void ToPlotter(int aID)
Function ToPlotter Open a dialog frame to create plot and drill files relative to the current board.
PCB_EDIT_FRAME * m_frame

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

Referenced by setTransitions().

◆ Reset()

void PCB_EDITOR_CONTROL::Reset ( RESET_REASON  aReason)
overridevirtual

Function Reset() Brings 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 154 of file pcb_editor_control.cpp.

155 {
156  m_frame = getEditFrame<PCB_EDIT_FRAME>();
157 
158  if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
159  {
160  m_placeOrigin->SetPosition( getModel<BOARD>()->GetAuxOrigin() );
161  getView()->Remove( m_placeOrigin.get() );
162  getView()->Add( m_placeOrigin.get() );
163  }
164 }
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_placeOrigin
Pointer to the currently used edit frame.
Model changes (required full reload)
Definition: tool_base.h:82
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
PCB_EDIT_FRAME * m_frame
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
Rendering engine changes.
Definition: tool_base.h:83

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

Function RunMainStack()

Calls a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

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

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

Referenced by DRAWING_TOOL::PlaceText().

◆ Save()

int PCB_EDITOR_CONTROL::Save ( const TOOL_EVENT aEvent)

Definition at line 260 of file pcb_editor_control.cpp.

261 {
263  return 0;
264 }
PCB_EDIT_FRAME * m_frame
bool Files_io_from_id(int aId)
Function Files_io_from_id Read and write board files.

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

Referenced by setTransitions().

◆ SaveAs()

int PCB_EDITOR_CONTROL::SaveAs ( const TOOL_EVENT aEvent)

Definition at line 267 of file pcb_editor_control.cpp.

268 {
270  return 0;
271 }
PCB_EDIT_FRAME * m_frame
bool Files_io_from_id(int aId)
Function Files_io_from_id Read and write board files.

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

Referenced by setTransitions().

◆ SaveCopyAs()

int PCB_EDITOR_CONTROL::SaveCopyAs ( const TOOL_EVENT aEvent)

Definition at line 274 of file pcb_editor_control.cpp.

275 {
277  return 0;
278 }
PCB_EDIT_FRAME * m_frame
bool Files_io_from_id(int aId)
Function Files_io_from_id Read and write board files.

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

Referenced by setTransitions().

◆ selection() [1/2]

const PCBNEW_SELECTION & PCB_TOOL_BASE::selection ( ) const
protectedinherited

Definition at line 269 of file pcb_tool_base.cpp.

270 {
271  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
272  const auto& selection = selTool->GetSelection();
273  return selection;
274 }
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
const PCBNEW_SELECTION & selection() const

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

Referenced by AUTOPLACE_TOOL::autoplaceSelected(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), EDIT_TOOL::ChangeTrackWidth(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawZone(), EDIT_TOOL::Duplicate(), EDIT_TOOL::EditFpInFpEditor(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::filterSelection(), EDIT_TOOL::Flip(), DRAWING_TOOL::getSourceZoneForAction(), PCB_INSPECTION_TOOL::highlightNet(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), EDIT_TOOL::Mirror(), modifyLockSelected(), EDIT_TOOL::Move(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), PAD_TOOL::pastePadProperties(), PCBNEW_CONTROL::placeBoardItems(), DRAWING_TOOL::PlaceImportedGraphics(), PlaceModule(), PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EDIT_TOOL::Rotate(), SELECTION_TOOL::selectCopper(), PCB_TOOL_BASE::selection(), SELECTION_TOOL::selectNet(), DRAWING_TOOL::SetAnchor(), TrackWidthDec(), TrackWidthInc(), PCBNEW_CONTROL::UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), ViaSizeDec(), ViaSizeInc(), ZoneDuplicate(), ZONE_FILLER_TOOL::ZoneFill(), ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfill().

◆ selection() [2/2]

PCBNEW_SELECTION & PCB_TOOL_BASE::selection ( )
protectedinherited

Definition at line 277 of file pcb_tool_base.cpp.

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

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

◆ SetContextMenu()

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

Function SetContextMenu()

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

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

Definition at line 76 of file tool_interactive.cpp.

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

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

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

◆ SetEditModules()

void PCB_TOOL_BASE::SetEditModules ( bool  aEnabled)
inlineinherited

Function SetEditModules()

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

Parameters
aEnableddecides if the mode should be enabled.

Definition at line 97 of file pcb_tool_base.h.

98  {
99  m_editModules = aEnabled;
100  }

References PCB_TOOL_BASE::m_editModules.

◆ setTransitions()

void PCB_EDITOR_CONTROL::setTransitions ( )
overrideprivatevirtual

Sets up handlers for various events.

Reimplemented from PCB_TOOL_BASE.

Definition at line 1127 of file pcb_editor_control.cpp.

1128 {
1129  Go( &PCB_EDITOR_CONTROL::New, ACTIONS::doNew.MakeEvent() );
1130  Go( &PCB_EDITOR_CONTROL::Open, ACTIONS::open.MakeEvent() );
1131  Go( &PCB_EDITOR_CONTROL::Save, ACTIONS::save.MakeEvent() );
1135  Go( &PCB_EDITOR_CONTROL::Plot, ACTIONS::plot.MakeEvent() );
1136 
1147 
1148  // Track & via size control
1153 
1154  // Zone actions
1157 
1158  // Placing tools
1162 
1163  // Other
1167 
1174 }
static TOOL_ACTION toggleLock
Definition: pcb_actions.h:399
static TOOL_ACTION placeModule
Definition: pcb_actions.h:165
int ZoneMerge(const TOOL_EVENT &aEvent)
static TOOL_ACTION unlock
Definition: pcb_actions.h:401
int PlaceModule(const TOOL_EVENT &aEvent)
Function PlaceModule() Displays a dialog to select a module to be added and allows the user to set it...
static TOOL_ACTION generateGerbers
Definition: pcb_actions.h:319
static TOOL_ACTION pageSettings
Definition: actions.h:59
static TOOL_ACTION drillOrigin
Definition: pcb_actions.h:414
int Open(const TOOL_EVENT &aEvent)
static TOOL_ACTION lock
Definition: pcb_actions.h:400
static TOOL_ACTION viaSizeInc
Definition: pcb_actions.h:287
int TrackWidthDec(const TOOL_EVENT &aEvent)
int GenerateDrillFiles(const TOOL_EVENT &aEvent)
int ShowEeschema(const TOOL_EVENT &aEvent)
int BoardSetup(const TOOL_EVENT &aEvent)
int ImportSpecctraSession(const TOOL_EVENT &aEvent)
static TOOL_ACTION trackWidthDec
Definition: pcb_actions.h:286
static TOOL_ACTION showPythonConsole
Definition: pcb_actions.h:332
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:330
static TOOL_ACTION updatePcbFromSchematic
Definition: actions.h:153
int ToggleMicrowaveToolbar(const TOOL_EVENT &aEvent)
int ZoneDuplicate(const TOOL_EVENT &aEvent)
Duplicates a zone onto a layer (prompts for new layer)
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
static TOOL_ACTION generateReportFile
Definition: pcb_actions.h:322
static TOOL_ACTION generateD356File
Definition: pcb_actions.h:323
static TOOL_ACTION saveCopyAs
Definition: actions.h:56
int Save(const TOOL_EVENT &aEvent)
static TOOL_ACTION trackWidthInc
Definition: pcb_actions.h:285
int ViaSizeDec(const TOOL_EVENT &aEvent)
static TOOL_ACTION importNetlist
Definition: pcb_actions.h:314
int TrackWidthInc(const TOOL_EVENT &aEvent)
static TOOL_ACTION open
Definition: actions.h:53
int Plot(const TOOL_EVENT &aEvent)
static TOOL_ACTION save
Definition: actions.h:54
static TOOL_ACTION doNew
Definition: actions.h:47
int ExportSpecctraDSN(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoneMerge
Definition: pcb_actions.h:297
int SaveAs(const TOOL_EVENT &aEvent)
int DrillOrigin(const TOOL_EVENT &aEvent)
Runs the drill origin tool for setting the origin for drill and pick-and-place files.
static TOOL_ACTION plot
Definition: actions.h:61
int GeneratePosFile(const TOOL_EVENT &aEvent)
int ViaSizeInc(const TOOL_EVENT &aEvent)
static TOOL_ACTION showEeschema
Definition: pcb_actions.h:416
static TOOL_ACTION generatePosFile
Definition: pcb_actions.h:321
static TOOL_ACTION placeTarget
Definition: pcb_actions.h:164
int LockSelected(const TOOL_EVENT &aEvent)
Locks selected items.
int UnlockSelected(const TOOL_EVENT &aEvent)
Unlocks selected items.
static TOOL_ACTION boardSetup
Definition: pcb_actions.h:303
int New(const TOOL_EVENT &aEvent)
static TOOL_ACTION importSpecctraSession
Definition: pcb_actions.h:316
int SaveCopyAs(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoneDuplicate
Duplicate zone onto another layer.
Definition: pcb_actions.h:300
static TOOL_ACTION generateBOM
Definition: pcb_actions.h:324
int TogglePythonConsole(const TOOL_EVENT &aEvent)
int GenerateFabFiles(const TOOL_EVENT &aEvent)
static TOOL_ACTION exportSpecctraDSN
Definition: pcb_actions.h:317
static TOOL_ACTION showMicrowaveToolbar
Definition: pcb_actions.h:331
int FlipPcbView(const TOOL_EVENT &aEvent)
static TOOL_ACTION saveAs
Definition: actions.h:55
int PlaceTarget(const TOOL_EVENT &aEvent)
Function PlaceTarget() Allows user to place a layer alignment target.
int ImportNetlist(const TOOL_EVENT &aEvent)
int ToggleLayersManager(const TOOL_EVENT &aEvent)
int UpdatePCBFromSchematic(const TOOL_EVENT &aEvent)
static TOOL_ACTION flipBoard
Definition: pcb_actions.h:282
int PageSettings(const TOOL_EVENT &aEvent)
int ToggleLockSelected(const TOOL_EVENT &aEvent)
Toggles 'lock' property for selected items.
static TOOL_ACTION viaSizeDec
Definition: pcb_actions.h:288
static TOOL_ACTION generateDrillFiles
Definition: pcb_actions.h:320

References BoardSetup(), PCB_ACTIONS::boardSetup, ACTIONS::doNew, DrillOrigin(), PCB_ACTIONS::drillOrigin, ExportSpecctraDSN(), PCB_ACTIONS::exportSpecctraDSN, PCB_ACTIONS::flipBoard, FlipPcbView(), PCB_ACTIONS::generateBOM, PCB_ACTIONS::generateD356File, GenerateDrillFiles(), PCB_ACTIONS::generateDrillFiles, GenerateFabFiles(), PCB_ACTIONS::generateGerbers, GeneratePosFile(), PCB_ACTIONS::generatePosFile, PCB_ACTIONS::generateReportFile, TOOL_INTERACTIVE::Go(), ImportNetlist(), PCB_ACTIONS::importNetlist, ImportSpecctraSession(), PCB_ACTIONS::importSpecctraSession, PCB_ACTIONS::lock, LockSelected(), New(), ACTIONS::open, Open(), PageSettings(), ACTIONS::pageSettings, PlaceModule(), PCB_ACTIONS::placeModule, PlaceTarget(), PCB_ACTIONS::placeTarget, Plot(), ACTIONS::plot, ACTIONS::save, Save(), ACTIONS::saveAs, SaveAs(), ACTIONS::saveCopyAs, SaveCopyAs(), ShowEeschema(), PCB_ACTIONS::showEeschema, PCB_ACTIONS::showLayersManager, PCB_ACTIONS::showMicrowaveToolbar, PCB_ACTIONS::showPythonConsole, ToggleLayersManager(), PCB_ACTIONS::toggleLock, ToggleLockSelected(), ToggleMicrowaveToolbar(), TogglePythonConsole(), TrackWidthDec(), PCB_ACTIONS::trackWidthDec, TrackWidthInc(), PCB_ACTIONS::trackWidthInc, PCB_ACTIONS::unlock, UnlockSelected(), UpdatePCBFromSchematic(), ACTIONS::updatePcbFromSchematic, ViaSizeDec(), PCB_ACTIONS::viaSizeDec, ViaSizeInc(), PCB_ACTIONS::viaSizeInc, ZoneDuplicate(), PCB_ACTIONS::zoneDuplicate, ZoneMerge(), and PCB_ACTIONS::zoneMerge.

◆ ShowEeschema()

int PCB_EDITOR_CONTROL::ShowEeschema ( const TOOL_EVENT aEvent)

Definition at line 402 of file pcb_editor_control.cpp.

403 {
404  m_frame->RunEeschema();
405  return 0;
406 }
PCB_EDIT_FRAME * m_frame

References m_frame, and PCB_EDIT_FRAME::RunEeschema().

Referenced by setTransitions().

◆ ToggleLayersManager()

int PCB_EDITOR_CONTROL::ToggleLayersManager ( const TOOL_EVENT aEvent)

Definition at line 409 of file pcb_editor_control.cpp.

410 {
411  getEditFrame<PCB_EDIT_FRAME>()->ToggleLayersManager();
412  return 0;
413 }

Referenced by setTransitions().

◆ ToggleLockSelected()

int PCB_EDITOR_CONTROL::ToggleLockSelected ( const TOOL_EVENT aEvent)

Toggles 'lock' property for selected items.

Definition at line 767 of file pcb_editor_control.cpp.

768 {
769  return modifyLockSelected( TOGGLE );
770 }
int modifyLockSelected(MODIFY_MODE aMode)

References modifyLockSelected(), and TOGGLE.

Referenced by setTransitions().

◆ ToggleMicrowaveToolbar()

int PCB_EDITOR_CONTROL::ToggleMicrowaveToolbar ( const TOOL_EVENT aEvent)

Definition at line 416 of file pcb_editor_control.cpp.

417 {
418  getEditFrame<PCB_EDIT_FRAME>()->ToggleMicrowaveToolbar();
419  return 0;
420 }

Referenced by setTransitions().

◆ TogglePythonConsole()

int PCB_EDITOR_CONTROL::TogglePythonConsole ( const TOOL_EVENT aEvent)

Definition at line 423 of file pcb_editor_control.cpp.

424 {
425 #if defined( KICAD_SCRIPTING_WXPYTHON )
426  m_frame->ScriptingConsoleEnableDisable();
427 #endif
428  return 0;
429 }
PCB_EDIT_FRAME * m_frame

References m_frame.

Referenced by setTransitions().

◆ TrackWidthDec()

int PCB_EDITOR_CONTROL::TrackWidthDec ( const TOOL_EVENT aEvent)

Definition at line 480 of file pcb_editor_control.cpp.

481 {
482  BOARD_DESIGN_SETTINGS& designSettings = getModel<BOARD>()->GetDesignSettings();
483  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
485 
487  {
488  BOARD_COMMIT commit( this );
489 
490  for( EDA_ITEM* item : selection )
491  {
492  if( item->Type() == PCB_TRACE_T )
493  {
494  TRACK* track = (TRACK*) item;
495 
496  for( int i = designSettings.m_TrackWidthList.size() - 1; i >= 0; --i )
497  {
498  int candidate = designSettings.m_TrackWidthList[ i ];
499 
500  if( candidate < track->GetWidth() )
501  {
502  commit.Modify( track );
503  track->SetWidth( candidate );
504  break;
505  }
506  }
507  }
508  }
509 
510  commit.Push( "Decrease Track Width" );
511  }
512  else
513  {
514  int widthIndex = designSettings.GetTrackWidthIndex() - 1;
515 
516  if( widthIndex < 0 )
517  widthIndex = 0;
518 
519  designSettings.SetTrackWidthIndex( widthIndex );
520  designSettings.UseCustomTrackViaSize( false );
521 
523  }
524 
525  return 0;
526 }
void SetTrackWidthIndex(unsigned aIndex)
Function SetTrackWidthIndex sets the current track width list index to aIndex.
std::vector< int > m_TrackWidthList
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Function OnlyTypes Creates a functor that tests if the selected items are only of given types.
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:290
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
void SetWidth(int aWidth)
Definition: class_track.h:102
const PCBNEW_SELECTION & selection() const
unsigned GetTrackWidthIndex() const
Function GetTrackWidthIndex.
bool ToolStackIsEmpty()
PCB_EDIT_FRAME * m_frame
size_t i
Definition: json11.cpp:649
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
void UseCustomTrackViaSize(bool aEnabled)
Function UseCustomTrackViaSize Enables/disables custom track/via size settings.
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References EOT, TOOL_MANAGER::GetTool(), BOARD_DESIGN_SETTINGS::GetTrackWidthIndex(), i, m_frame, TOOL_BASE::m_toolMgr, BOARD_DESIGN_SETTINGS::m_TrackWidthList, COMMIT::Modify(), SELECTION_CONDITIONS::OnlyTypes(), PCB_TRACE_T, PCB_VIA_T, BOARD_COMMIT::Push(), TOOL_MANAGER::RunAction(), PCB_TOOL_BASE::selection(), BOARD_DESIGN_SETTINGS::SetTrackWidthIndex(), TRACK::SetWidth(), EDA_BASE_FRAME::ToolStackIsEmpty(), PCB_ACTIONS::trackViaSizeChanged, and BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize().

Referenced by setTransitions().

◆ TrackWidthInc()

int PCB_EDITOR_CONTROL::TrackWidthInc ( const TOOL_EVENT aEvent)

Definition at line 433 of file pcb_editor_control.cpp.

434 {
435  BOARD_DESIGN_SETTINGS& designSettings = getModel<BOARD>()->GetDesignSettings();
436  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
438 
440  {
441  BOARD_COMMIT commit( this );
442 
443  for( EDA_ITEM* item : selection )
444  {
445  if( item->Type() == PCB_TRACE_T )
446  {
447  TRACK* track = (TRACK*) item;
448 
449  for( int candidate : designSettings.m_TrackWidthList )
450  {
451  if( candidate > track->GetWidth() )
452  {
453  commit.Modify( track );
454  track->SetWidth( candidate );
455  break;
456  }
457  }
458  }
459  }
460 
461  commit.Push( "Increase Track Width" );
462  }
463  else
464  {
465  int widthIndex = designSettings.GetTrackWidthIndex() + 1;
466 
467  if( widthIndex >= (int) designSettings.m_TrackWidthList.size() )
468  widthIndex = designSettings.m_TrackWidthList.size() - 1;
469 
470  designSettings.SetTrackWidthIndex( widthIndex );
471  designSettings.UseCustomTrackViaSize( false );
472 
474  }
475 
476  return 0;
477 }
void SetTrackWidthIndex(unsigned aIndex)
Function SetTrackWidthIndex sets the current track width list index to aIndex.
std::vector< int > m_TrackWidthList
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Function OnlyTypes Creates a functor that tests if the selected items are only of given types.
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:290
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
void SetWidth(int aWidth)
Definition: class_track.h:102
const PCBNEW_SELECTION & selection() const
unsigned GetTrackWidthIndex() const
Function GetTrackWidthIndex.
int GetWidth() const
Definition: class_track.h:103
bool ToolStackIsEmpty()
PCB_EDIT_FRAME * m_frame
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
void UseCustomTrackViaSize(bool aEnabled)
Function UseCustomTrackViaSize Enables/disables custom track/via size settings.
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References EOT, TOOL_MANAGER::GetTool(), BOARD_DESIGN_SETTINGS::GetTrackWidthIndex(), TRACK::GetWidth(), m_frame, TOOL_BASE::m_toolMgr, BOARD_DESIGN_SETTINGS::m_TrackWidthList, COMMIT::Modify(), SELECTION_CONDITIONS::OnlyTypes(), PCB_TRACE_T, PCB_VIA_T, BOARD_COMMIT::Push(), TOOL_MANAGER::RunAction(), PCB_TOOL_BASE::selection(), BOARD_DESIGN_SETTINGS::SetTrackWidthIndex(), TRACK::SetWidth(), EDA_BASE_FRAME::ToolStackIsEmpty(), PCB_ACTIONS::trackViaSizeChanged, and BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize().

Referenced by setTransitions().

◆ UnlockSelected()

int PCB_EDITOR_CONTROL::UnlockSelected ( const TOOL_EVENT aEvent)

Unlocks selected items.

Definition at line 779 of file pcb_editor_control.cpp.

780 {
781  return modifyLockSelected( OFF );
782 }
int modifyLockSelected(MODIFY_MODE aMode)

References modifyLockSelected(), and OFF.

Referenced by setTransitions().

◆ UpdatePCBFromSchematic()

int PCB_EDITOR_CONTROL::UpdatePCBFromSchematic ( const TOOL_EVENT aEvent)

Definition at line 388 of file pcb_editor_control.cpp.

389 {
390  NETLIST netlist;
391 
393  {
394  DIALOG_UPDATE_PCB updateDialog( m_frame, &netlist );
395  updateDialog.ShowModal();
396  }
397 
398  return 0;
399 }
Class NETLIST stores all of information read from a netlist along with the flags used to update the N...
Definition: pcb_netlist.h:214
PCB_EDIT_FRAME * m_frame
bool FetchNetlistFromSchematic(NETLIST &aNetlist, FETCH_NETLIST_MODE aMode)

References PCB_EDIT_FRAME::ANNOTATION_DIALOG, PCB_EDIT_FRAME::FetchNetlistFromSchematic(), and m_frame.

Referenced by setTransitions().

◆ ViaSizeDec()

int PCB_EDITOR_CONTROL::ViaSizeDec ( const TOOL_EVENT aEvent)

Definition at line 577 of file pcb_editor_control.cpp.

578 {
579  BOARD_DESIGN_SETTINGS& designSettings = getModel<BOARD>()->GetDesignSettings();
580  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
582 
584  {
585  BOARD_COMMIT commit( this );
586 
587  for( EDA_ITEM* item : selection )
588  {
589  if( item->Type() == PCB_VIA_T )
590  {
591  VIA* via = (VIA*) item;
592 
593  for( int i = designSettings.m_ViasDimensionsList.size() - 1; i >= 0; --i )
594  {
595  VIA_DIMENSION candidate = designSettings.m_ViasDimensionsList[ i ];
596 
597  if( candidate.m_Diameter < via->GetWidth() )
598  {
599  commit.Modify( via );
600  via->SetWidth( candidate.m_Diameter );
601  via->SetDrill( candidate.m_Drill );
602  break;
603  }
604  }
605  }
606  }
607 
608  commit.Push( "Decrease Via Size" );
609  }
610  else
611  {
612  int sizeIndex = designSettings.GetViaSizeIndex() - 1;
613 
614  if( sizeIndex < 0 )
615  sizeIndex = 0;
616 
617  designSettings.SetViaSizeIndex( sizeIndex );
618  designSettings.UseCustomTrackViaSize( false );
619 
621  }
622 
623  return 0;
624 }
Struct VIA_DIMENSION is a small helper container to handle a stock of specific vias each with unique ...
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Function OnlyTypes Creates a functor that tests if the selected items are only of given types.
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:290
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
void SetWidth(int aWidth)
Definition: class_track.h:102
void SetViaSizeIndex(unsigned aIndex)
Function SetViaSizeIndex sets the current via size list index to aIndex.
const PCBNEW_SELECTION & selection() const
unsigned GetViaSizeIndex() const
Function GetViaSizeIndex.
int GetWidth() const
Definition: class_track.h:103
bool ToolStackIsEmpty()
PCB_EDIT_FRAME * m_frame
size_t i
Definition: json11.cpp:649
void SetDrill(int aDrill)
Function SetDrill sets the drill value for vias.
Definition: class_track.h:354
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
std::vector< VIA_DIMENSION > m_ViasDimensionsList
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
void UseCustomTrackViaSize(bool aEnabled)
Function UseCustomTrackViaSize Enables/disables custom track/via size settings.
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References EOT, TOOL_MANAGER::GetTool(), BOARD_DESIGN_SETTINGS::GetViaSizeIndex(), TRACK::GetWidth(), i, 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(), VIA::SetDrill(), BOARD_DESIGN_SETTINGS::SetViaSizeIndex(), TRACK::SetWidth(), EDA_BASE_FRAME::ToolStackIsEmpty(), PCB_ACTIONS::trackViaSizeChanged, and BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize().

Referenced by setTransitions().

◆ ViaSizeInc()

int PCB_EDITOR_CONTROL::ViaSizeInc ( const TOOL_EVENT aEvent)

Definition at line 529 of file pcb_editor_control.cpp.

530 {
531  BOARD_DESIGN_SETTINGS& designSettings = getModel<BOARD>()->GetDesignSettings();
532  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
534 
536  {
537  BOARD_COMMIT commit( this );
538 
539  for( EDA_ITEM* item : selection )
540  {
541  if( item->Type() == PCB_VIA_T )
542  {
543  VIA* via = (VIA*) item;
544 
545  for( VIA_DIMENSION candidate : designSettings.m_ViasDimensionsList )
546  {
547  if( candidate.m_Diameter > via->GetWidth() )
548  {
549  commit.Modify( via );
550  via->SetWidth( candidate.m_Diameter );
551  via->SetDrill( candidate.m_Drill );
552  break;
553  }
554  }
555  }
556  }
557 
558  commit.Push( "Increase Via Size" );
559  }
560  else
561  {
562  int sizeIndex = designSettings.GetViaSizeIndex() + 1;
563 
564  if( sizeIndex >= (int) designSettings.m_ViasDimensionsList.size() )
565  sizeIndex = designSettings.m_ViasDimensionsList.size() - 1;
566 
567  designSettings.SetViaSizeIndex( sizeIndex );
568  designSettings.UseCustomTrackViaSize( false );
569 
571  }
572 
573  return 0;
574 }
Struct VIA_DIMENSION is a small helper container to handle a stock of specific vias each with unique ...
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Function OnlyTypes Creates a functor that tests if the selected items are only of given types.
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:290
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
void SetWidth(int aWidth)
Definition: class_track.h:102
void SetViaSizeIndex(unsigned aIndex)
Function SetViaSizeIndex sets the current via size list index to aIndex.
const PCBNEW_SELECTION & selection() const
unsigned GetViaSizeIndex() const
Function GetViaSizeIndex.
int GetWidth() const
Definition: class_track.h:103
bool ToolStackIsEmpty()
PCB_EDIT_FRAME * m_frame
void SetDrill(int aDrill)
Function SetDrill sets the drill value for vias.
Definition: class_track.h:354
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
std::vector< VIA_DIMENSION > m_ViasDimensionsList
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
void UseCustomTrackViaSize(bool aEnabled)
Function UseCustomTrackViaSize Enables/disables custom track/via size settings.
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References EOT, TOOL_MANAGER::GetTool(), BOARD_DESIGN_SETTINGS::GetViaSizeIndex(), TRACK::GetWidth(), 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(), VIA::SetDrill(), BOARD_DESIGN_SETTINGS::SetViaSizeIndex(), TRACK::SetWidth(), EDA_BASE_FRAME::ToolStackIsEmpty(), PCB_ACTIONS::trackViaSizeChanged, and BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize().

Referenced by setTransitions().

◆ view()

◆ Wait()

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

Function Wait()

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

Definition at line 57 of file tool_interactive.cpp.

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

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

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

◆ ZoneDuplicate()

int PCB_EDITOR_CONTROL::ZoneDuplicate ( const TOOL_EVENT aEvent)

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

Definition at line 1035 of file pcb_editor_control.cpp.

1036 {
1037  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
1038  const auto& selection = selTool->GetSelection();
1039 
1040  // because this pops up the zone editor, it would be confusing to handle multiple zones,
1041  // so just handle single selections containing exactly one zone
1042  if( selection.Size() != 1 )
1043  return 0;
1044 
1045  auto oldZone = dyn_cast<ZONE_CONTAINER*>( selection[0] );
1046 
1047  if( !oldZone )
1048  return 0;
1049 
1050  ZONE_SETTINGS zoneSettings;
1051  zoneSettings << *oldZone;
1052  int dialogResult;
1053 
1054  if( oldZone->GetIsKeepout() )
1055  dialogResult = InvokeKeepoutAreaEditor( m_frame, &zoneSettings );
1056  else if( oldZone->IsOnCopperLayer() )
1057  dialogResult = InvokeCopperZonesEditor( m_frame, &zoneSettings );
1058  else
1059  dialogResult = InvokeNonCopperZonesEditor( m_frame, &zoneSettings );
1060 
1061  if( dialogResult != wxID_OK )
1062  return 0;
1063 
1064  // duplicate the zone
1065  BOARD_COMMIT commit( m_frame );
1066 
1067  auto newZone = std::make_unique<ZONE_CONTAINER>( *oldZone );
1068  newZone->ClearSelected();
1069  newZone->UnFill();
1070  zoneSettings.ExportSetting( *newZone );
1071 
1072  // If the new zone is on the same layer(s) as the the initial zone,
1073  // offset it a bit so it can more easily be picked.
1074  if( oldZone->GetIsKeepout() && ( oldZone->GetLayerSet() == zoneSettings.m_Layers ) )
1075  newZone->Move( wxPoint( IU_PER_MM, IU_PER_MM ) );
1076  else if( !oldZone->GetIsKeepout() && ( oldZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) )
1077  newZone->Move( wxPoint( IU_PER_MM, IU_PER_MM ) );
1078 
1079  commit.Add( newZone.release() );
1080  commit.Push( _( "Duplicate zone" ) );
1081 
1082  return 0;
1083 }
int InvokeKeepoutAreaEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings)
Function InvokeKeepoutAreaEditor invokes up a modal dialog window for copper zone editing.
Class SELECTION_TOOL.
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:219
const PCBNEW_SELECTION & selection() const
void ExportSetting(ZONE_CONTAINER &aTarget, bool aFullExport=true) const
Function ExportSetting copy settings to a given zone.
#define _(s)
Class ZONE_SETTINGS handles zones parameters.
Definition: zone_settings.h:49
PCB_EDIT_FRAME * m_frame
int Size() const
Returns the number of selected parts.
Definition: selection.h:125
int InvokeCopperZonesEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings)
Function InvokeCopperZonesEditor invokes up a modal dialog window for copper zone editing.
PCB_LAYER_ID m_CurrentZone_Layer
Layer used to create the current zone.
Definition: zone_settings.h:78

References _, COMMIT::Add(), ZONE_SETTINGS::ExportSetting(), TOOL_MANAGER::GetTool(), InvokeCopperZonesEditor(), InvokeKeepoutAreaEditor(), InvokeNonCopperZonesEditor(), ZONE_SETTINGS::m_CurrentZone_Layer, 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 PCB_EDITOR_CONTROL::ZoneMerge ( const TOOL_EVENT aEvent)

Definition at line 977 of file pcb_editor_control.cpp.

978 {
979  const PCBNEW_SELECTION& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
980  BOARD* board = getModel<BOARD>();
981  BOARD_COMMIT commit( m_frame );
982 
983  if( selection.Size() < 2 )
984  return 0;
985 
986  int netcode = -1;
987 
988  ZONE_CONTAINER* firstZone = nullptr;
989  std::vector<ZONE_CONTAINER*> toMerge, merged;
990 
991  for( auto item : selection )
992  {
993  auto curr_area = dynamic_cast<ZONE_CONTAINER*>( item );
994 
995  if( !curr_area )
996  continue;
997 
998  if( !firstZone )
999  firstZone = curr_area;
1000 
1001  netcode = curr_area->GetNetCode();
1002 
1003  if( firstZone->GetNetCode() != netcode )
1004  continue;
1005 
1006  if( curr_area->GetPriority() != firstZone->GetPriority() )
1007  continue;
1008 
1009  if( curr_area->GetIsKeepout() != firstZone->GetIsKeepout() )
1010  continue;
1011 
1012  if( curr_area->GetLayer() != firstZone->GetLayer() )
1013  continue;
1014 
1015  if( !board->TestAreaIntersection( curr_area, firstZone ) )
1016  continue;
1017 
1018  toMerge.push_back( curr_area );
1019  }
1020 
1022 
1023  if( mergeZones( commit, toMerge, merged ) )
1024  {
1025  commit.Push( _( "Merge zones" ) );
1026 
1027  for( auto item : merged )
1029  }
1030 
1031  return 0;
1032 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:73
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
int GetNetCode() const
Function GetNetCode.
BOARD * board() const
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:203
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
bool TestAreaIntersection(ZONE_CONTAINER *area_ref, ZONE_CONTAINER *area_to_test)
Function TestAreaIntersection Test for intersection of 2 copper areas area_to_test must be after area...
const PCBNEW_SELECTION & selection() const
#define _(s)
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:630
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:103
PCB_EDIT_FRAME * m_frame
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
static TOOL_ACTION selectItem
Selects an item (specified as the event parameter).
Definition: pcb_actions.h:76
int Size() const
Returns the number of selected parts.
Definition: selection.h:125
static bool mergeZones(BOARD_COMMIT &aCommit, std::vector< ZONE_CONTAINER * > &aOriginZones, std::vector< ZONE_CONTAINER * > &aMergedZones)

References _, PCB_TOOL_BASE::board(), ZONE_CONTAINER::GetIsKeepout(), ZONE_CONTAINER::GetLayer(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE_CONTAINER::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::TestAreaIntersection().

Referenced by setTransitions().

Member Data Documentation

◆ m_editModules

◆ m_frame

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

functions below are not yet implemented - their interface may change

Definition at line 108 of file tool_interactive.h.

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

◆ m_placeOrigin

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

Pointer to the currently used edit frame.

Definition at line 130 of file pcb_editor_control.h.

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

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

Definition at line 214 of file tool_base.h.

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

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 219 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SELECTION_TOOL::AddItemToSel(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), EDIT_TOOL::ChangeTrackWidth(), PCB_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), SELECTION_TOOL::ClearSelection(), PL_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), MICROWAVE_TOOL::createInductorBetween(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), SCH_EDITOR_CONTROL::Cut(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), LIB_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::editComponentFieldText(), EDIT_TOOL::EditFpInFpEditor(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindComponentAndItem(), POINT_EDITOR::finishItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::getEditFrameInt(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), PCBNEW_CONTROL::GridSetOrigin(), GERBVIEW_CONTROL::HighlightControl(), PCB_INSPECTION_TOOL::HighlightItem(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), MODULE_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::ImportWorksheetContent(), LIB_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), PAD_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), LIB_CONTROL::Init(), PL_DRAWING_TOOLS::Init(), PL_POINT_EDITOR::Init(), POINT_EDITOR::Init(), Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), TOOL_BASE::IsToolActive(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), SCH_MOVE_TOOL::Main(), CVPCB_CONTROL::Main(), LIB_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), modifyLockSelected(), EDIT_TOOL::Move(), EDIT_TOOL::MoveExact(), LIB_CONTROL::OnDeMorgan(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickCopyReferencePoint(), LIB_EDIT_TOOL::PinTable(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PlaceModule(), PlaceTarget(), DRAWING_TOOL::PlaceText(), PCBNEW_CONTROL::Print(), GERBVIEW_CONTROL::Print(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), LIB_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), LIB_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC::RunTests(), EE_SELECTION_TOOL::SelectConnection(), SELECTION_TOOL::selectCopper(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::SelectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), DRC::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), TrackWidthDec(), TrackWidthInc(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), LIB_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCBNEW_CONTROL::UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), ViaSizeDec(), ViaSizeInc(), TOOL_INTERACTIVE::Wait(), ZoneDuplicate(), and ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

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

Definition at line 218 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_toolSettings

TOOL_SETTINGS TOOL_BASE::m_toolSettings
protectedinherited

Definition at line 220 of file tool_base.h.

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

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 211 of file tool_base.h.

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

◆ WIDTH_STEP

const int PCB_EDITOR_CONTROL::WIDTH_STEP = 100000
staticprivate

Place & drill origin marker

Definition at line 132 of file pcb_editor_control.h.

Referenced by PlaceTarget().


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