KiCad PCB EDA Suite
MODULE_EDITOR_TOOLS Class Reference

MODULE_EDITOR_TOOLS. More...

#include <footprint_editor_tools.h>

Inheritance diagram for MODULE_EDITOR_TOOLS:
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

 MODULE_EDITOR_TOOLS ()
 
 ~MODULE_EDITOR_TOOLS () override
 
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 NewFootprint (const TOOL_EVENT &aEvent)
 
int CreateFootprint (const TOOL_EVENT &aEvent)
 
int Save (const TOOL_EVENT &aEvent)
 
int SaveAs (const TOOL_EVENT &aEvent)
 
int Revert (const TOOL_EVENT &aEvent)
 
int EditFootprint (const TOOL_EVENT &aEvent)
 
int CutCopyFootprint (const TOOL_EVENT &aEvent)
 
int PasteFootprint (const TOOL_EVENT &aEvent)
 
int DeleteFootprint (const TOOL_EVENT &aEvent)
 
int ImportFootprint (const TOOL_EVENT &aEvent)
 
int ExportFootprint (const TOOL_EVENT &aEvent)
 
int PinLibrary (const TOOL_EVENT &aEvent)
 
int UnpinLibrary (const TOOL_EVENT &aEvent)
 
int ToggleFootprintTree (const TOOL_EVENT &aEvent)
 
int Properties (const TOOL_EVENT &aEvent)
 
int DefaultPadProperties (const TOOL_EVENT &aEvent)
 Edit the properties used for new pad creation. More...
 
int PlacePad (const TOOL_EVENT &aEvent)
 Function PlacePad() Places a pad in module editor. More...
 
int CreateArray (TOOL_EVENT &aEvent)
 Function CreateArray. More...
 
int CreatePadFromShapes (const TOOL_EVENT &aEvent)
 Function CreatePadFromShapes() More...
 
int ExplodePadToShapes (const TOOL_EVENT &aEvent)
 Function ExplodePadToShapes() More...
 
void SetEditModules (bool aEnabled)
 Function SetEditModules() More...
 
bool EditingModules () const
 
void Activate ()
 Function Activate() Runs the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Function SetContextMenu() More...
 
void RunMainStack (std::function< void()> aFunc)
 Function RunMainStack() More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Go() More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Wait() More...
 
TOOL_TYPE GetType () const
 Function GetType() Returns the type of the tool. More...
 
TOOL_ID GetId () const
 Function GetId() Returns the unique identifier of the tool. More...
 
const std::string & GetName () const
 Function GetName() Returns the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Types

enum  INTERACTIVE_PLACEMENT_OPTIONS { IPO_ROTATE = 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
 

Private Member Functions

void setTransitions () override
 

Sets up handlers for various events.

More...
 

Private Attributes

FOOTPRINT_EDIT_FRAMEm_frame
 
std::unique_ptr< MODULEm_copiedModule
 

Detailed Description

MODULE_EDITOR_TOOLS.

Module editor specific tools.

Definition at line 39 of file footprint_editor_tools.h.

Member Enumeration Documentation

◆ INTERACTIVE_PLACEMENT_OPTIONS

Enumerator
IPO_ROTATE 
IPO_FLIP 
IPO_SINGLE_CLICK 
IPO_REPEAT 

Definition at line 113 of file pcb_tool_base.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 78 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ MODULE_EDITOR_TOOLS()

MODULE_EDITOR_TOOLS::MODULE_EDITOR_TOOLS ( )

Definition at line 57 of file footprint_editor_tools.cpp.

57  :
58  PCB_TOOL_BASE( "pcbnew.ModuleEditor" ),
59  m_frame( nullptr )
60 {
61 }
FOOTPRINT_EDIT_FRAME * m_frame
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool_base.h:75

◆ ~MODULE_EDITOR_TOOLS()

MODULE_EDITOR_TOOLS::~MODULE_EDITOR_TOOLS ( )
override

Definition at line 64 of file footprint_editor_tools.cpp.

65 {
66 }

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:218
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:213
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(), 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(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), SCH_MOVE_TOOL::Main(), EE_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(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::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 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:218

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ board()

BOARD* PCB_TOOL_BASE::board ( ) const
inlineprotectedinherited

Definition at line 155 of file pcb_tool_base.h.

155 { 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(), CreatePadFromShapes(), ROUTER_TOOL::CustomTrackWidthDialog(), PCBNEW_CONTROL::DeleteItemCursor(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), PAD_TOOL::EnumeratePads(), 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(), PCBNEW_CONTROL::ModuleTextOutlines(), ROUTER_TOOL::onTrackViaSizeChanged(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::PadDisplayMode(), PCBNEW_CONTROL::Paste(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), SELECTION_TOOL::RebuildSelection(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), SELECTION_TOOL::Selectable(), SELECTION_TOOL::selectAllItemsOnNet(), SELECTION_TOOL::selectAllItemsOnSheet(), SELECTION_TOOL::selectConnectedTracks(), SELECTION_TOOL::selectPoint(), DRC::testDisabledLayers(), DRC::TestZoneToZoneOutlines(), PCBNEW_CONTROL::TrackDisplayMode(), POINT_EDITOR::updateItem(), PCBNEW_CONTROL::ViaDisplayMode(), PCBNEW_CONTROL::ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

◆ canvas()

◆ controls()

◆ CreateArray()

int MODULE_EDITOR_TOOLS::CreateArray ( TOOL_EVENT aEvent)

Function CreateArray.

Creates an array of objects using settings from a dialog

◆ CreateFootprint()

int MODULE_EDITOR_TOOLS::CreateFootprint ( const TOOL_EVENT aEvent)

Definition at line 142 of file footprint_editor_tools.cpp.

143 {
144  wxCommandEvent evt( wxEVT_NULL, ID_MODEDIT_NEW_MODULE_FROM_WIZARD );
145  getEditFrame<FOOTPRINT_EDIT_FRAME>()->Process_Special_Functions( evt );
146  return 0;
147 }

References ID_MODEDIT_NEW_MODULE_FROM_WIZARD.

Referenced by setTransitions().

◆ CreatePadFromShapes()

int MODULE_EDITOR_TOOLS::CreatePadFromShapes ( const TOOL_EVENT aEvent)

Function CreatePadFromShapes()

Creates a custom-shaped pad from a set of selected graphical shapes

Definition at line 420 of file footprint_editor_tools.cpp.

421 {
423 
424  std::unique_ptr<D_PAD> pad( new D_PAD( board()->GetFirstModule() ) );
425  D_PAD *refPad = nullptr;
426  bool multipleRefPadsFound = false;
427  bool illegalItemsFound = false;
428 
429  std::vector<PAD_CS_PRIMITIVE> shapes;
430 
431  BOARD_COMMIT commit( m_frame );
432 
433  for( auto item : selection )
434  {
435  switch( item->Type() )
436  {
437  case PCB_PAD_T:
438  {
439  if( refPad )
440  multipleRefPadsFound = true;
441 
442  refPad = static_cast<D_PAD*>( item );
443  break;
444  }
445 
446  case PCB_MODULE_EDGE_T:
447  {
448  auto em = static_cast<EDGE_MODULE*> ( item );
449 
450  PAD_CS_PRIMITIVE shape( em->GetShape() );
451  shape.m_Start = em->GetStart();
452  shape.m_End = em->GetEnd();
453  shape.m_Radius = em->GetRadius();
454  shape.m_Thickness = em->GetWidth();
455  shape.m_ArcAngle = em->GetAngle();
456  shape.m_Ctrl1 = em->GetBezControl1();
457  shape.m_Ctrl2 = em->GetBezControl2();
458  shape.m_Poly = em->BuildPolyPointsList();
459 
460  shapes.push_back(shape);
461 
462  break;
463  }
464 
465  default:
466  {
467  illegalItemsFound = true;
468  break;
469  }
470  }
471  }
472 
473  if( refPad && selection.Size() == 1 )
474  {
475  // don't convert a pad into itself...
476  return 0;
477  }
478 
479  if( multipleRefPadsFound )
480  {
481  DisplayErrorMessage( m_frame, _( "Cannot convert items to a custom-shaped pad:\n"
482  "selection contains more than one reference pad." ) );
483  return 0;
484  }
485 
486  if( illegalItemsFound )
487  {
488  DisplayErrorMessage( m_frame, _( "Cannot convert items to a custom-shaped pad:\n"
489  "selection contains unsupported items.\n"
490  "Only graphical lines, circles, arcs and polygons "
491  "are allowed." ) );
492  return 0;
493  }
494 
495  double refOrientation = 0.0;
496 
497  if( refPad )
498  {
499  pad.reset( static_cast<D_PAD*>( refPad->Clone() ) );
500 
501  if( refPad->GetShape() == PAD_SHAPE_RECT )
502  pad->SetAnchorPadShape( PAD_SHAPE_RECT );
503 
504  // ignore the pad offset for the moment. Makes more trouble than it's worth.
505  pad->SetOffset( wxPoint( 0, 0 ) );
506  refOrientation = pad->GetOrientation();
507  pad->SetOrientation( 0.0 );
508  }
509  else
510  {
511  // Create a default pad anchor:
512  pad->SetAnchorPadShape( PAD_SHAPE_CIRCLE );
513  pad->SetAttribute( PAD_ATTRIB_SMD );
514  pad->SetLayerSet( D_PAD::SMDMask() );
515  int radius = Millimeter2iu( 0.2 );
516  pad->SetSize ( wxSize( radius, radius ) );
517  pad->IncrementPadName( true, true );
518  pad->SetOrientation( 0 );
519  }
520 
521  pad->SetShape ( PAD_SHAPE_CUSTOM );
522 
523  OPT<VECTOR2I> anchor;
524  VECTOR2I tmp;
525 
526  if( refPad )
527  {
528  anchor = VECTOR2I( pad->GetPosition() );
529  }
530  else if( pad->GetBestAnchorPosition( tmp ) )
531  {
532  anchor = tmp;
533  }
534 
535  if( !anchor )
536  {
537  DisplayErrorMessage( m_frame, _( "Cannot convert items to a custom-shaped pad:\n"
538  "unable to determine the anchor point position.\n"
539  "Consider adding a small anchor pad to the selection "
540  "and try again.") );
541  return 0;
542  }
543 
544 
545  // relocate the shapes, they are relative to the anchor pad position
546  for( auto& shape : shapes )
547  {
548  shape.Move( wxPoint( -anchor->x, -anchor->y ) );
549  shape.Rotate( wxPoint( 0, 0 ), -refOrientation );
550  }
551 
552  pad->SetPosition( wxPoint( anchor->x, anchor->y ) );
553  pad->AddPrimitives( shapes );
554  pad->ClearFlags();
555 
556  bool result = pad->MergePrimitivesAsPolygon();
557  pad->Rotate( wxPoint( anchor->x, anchor->y ), refOrientation );
558 
559  if( !result )
560  {
561  DisplayErrorMessage( m_frame, _( "Cannot convert items to a custom-shaped pad:\n"
562  "selected items do not form a single solid shape.") );
563  return 0;
564  }
565 
566  auto padPtr = pad.release();
567 
568  commit.Add( padPtr );
569  for ( auto item : selection )
570  {
571  commit.Remove( item );
572  }
573 
575  commit.Push(_("Create Pad from Selected Shapes") );
576  m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, padPtr );
577 
578  return 0;
579 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:73
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_pad.cpp:1315
BOARD * board() const
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:252
static LSET SMDMask()
layer set for a SMD pad on Front layer
Definition: class_pad.cpp:111
SELECTION_TOOL.
wxPoint m_Start
angle of an arc, from its starting point, in 0.1 deg
Definition: class_pad.h:98
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:218
FOOTPRINT_EDIT_FRAME * m_frame
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:62
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:139
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
const PCBNEW_SELECTION & selection() const
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:89
#define _(s)
Definition: 3d_actions.cpp:33
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:126
boost::optional< T > OPT
Definition: optional.h:7
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:237

References _, COMMIT::Add(), PCB_TOOL_BASE::board(), D_PAD::Clone(), DisplayErrorMessage(), D_PAD::GetShape(), TOOL_MANAGER::GetTool(), m_frame, PAD_CS_PRIMITIVE::m_Start, TOOL_BASE::m_toolMgr, PAD_ATTRIB_SMD, PAD_SHAPE_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_RECT, PCB_MODULE_EDGE_T, PCB_PAD_T, BOARD_COMMIT::Push(), COMMIT::Remove(), TOOL_MANAGER::RunAction(), PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionClear, PCB_ACTIONS::selectItem, SELECTION::Size(), and D_PAD::SMDMask().

Referenced by setTransitions().

◆ CutCopyFootprint()

int MODULE_EDITOR_TOOLS::CutCopyFootprint ( const TOOL_EVENT aEvent)

Definition at line 173 of file footprint_editor_tools.cpp.

174 {
175  LIB_ID fpID = m_frame->GetTreeFPID();
176 
177  if( fpID == m_frame->GetLoadedFPID() )
178  m_copiedModule.reset( new MODULE( *m_frame->GetBoard()->GetFirstModule() ) );
179  else
180  m_copiedModule.reset( m_frame->LoadFootprint( fpID ) );
181 
182  if( aEvent.IsAction( &PCB_ACTIONS::cutFootprint ) )
183  DeleteFootprint(aEvent );
184 
185  return 0;
186 }
int DeleteFootprint(const TOOL_EVENT &aEvent)
FOOTPRINT_EDIT_FRAME * m_frame
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
static TOOL_ACTION cutFootprint
Definition: pcb_actions.h:349
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
MODULE * GetFirstModule() const
Gets the first module in the list (used in footprint viewer/editor) or NULL if none.
Definition: class_board.h:283
MODULE * LoadFootprint(const LIB_ID &aFootprintId)
Function LoadFootprint attempts to load aFootprintId from the footprint library table.
LIB_ID GetLoadedFPID() const
Return the LIB_ID of the part being edited.
std::unique_ptr< MODULE > m_copiedModule
BOARD * GetBoard() const
LIB_ID GetTreeFPID() const
Return the LIB_ID of the part or library selected in the footprint tree.

References PCB_ACTIONS::cutFootprint, DeleteFootprint(), PCB_BASE_FRAME::GetBoard(), BOARD::GetFirstModule(), FOOTPRINT_EDIT_FRAME::GetLoadedFPID(), FOOTPRINT_EDIT_FRAME::GetTreeFPID(), TOOL_EVENT::IsAction(), PCB_BASE_FRAME::LoadFootprint(), m_copiedModule, and m_frame.

Referenced by setTransitions().

◆ DefaultPadProperties()

int MODULE_EDITOR_TOOLS::DefaultPadProperties ( const TOOL_EVENT aEvent)

Edit the properties used for new pad creation.

Definition at line 319 of file footprint_editor_tools.cpp.

320 {
321  getEditFrame<FOOTPRINT_EDIT_FRAME>()->InstallPadOptionsFrame( nullptr );
322  return 0;
323 }

Referenced by setTransitions().

◆ DeleteFootprint()

int MODULE_EDITOR_TOOLS::DeleteFootprint ( const TOOL_EVENT aEvent)

Definition at line 211 of file footprint_editor_tools.cpp.

212 {
213  FOOTPRINT_EDIT_FRAME* frame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
214 
215  if( frame->DeleteModuleFromLibrary( frame->GetTargetFPID(), true ) )
216  {
217  if( frame->GetTargetFPID() == frame->GetLoadedFPID() )
218  frame->Clear_Pcb( false );
219 
220  frame->SyncLibraryTree( true );
221  }
222 
223  return 0;
224 }
PCB_BASE_EDIT_FRAME * frame() const

References PCB_TOOL_BASE::frame().

Referenced by CutCopyFootprint(), and setTransitions().

◆ displayOptions()

◆ doInteractiveItemPlacement()

void PCB_TOOL_BASE::doInteractiveItemPlacement ( const std::string &  aTool,
INTERACTIVE_PLACER_BASE aPlacer,
const wxString &  aCommitMessage,
int  aOptions = IPO_ROTATE | IPO_FLIP | IPO_REPEAT 
)
protectedinherited

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

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

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

Definition at line 37 of file pcb_tool_base.cpp.

40 {
41  using namespace std::placeholders;
42  std::unique_ptr<BOARD_ITEM> newItem;
43 
44  frame()->PushTool( aTool );
45  Activate();
46 
47  BOARD_COMMIT commit( frame() );
48 
50 
51  // do not capture or auto-pan until we start placing an item
52  controls()->ShowCursor( true );
53  controls()->SetSnapping( true );
54 
55  // Add a VIEW_GROUP that serves as a preview for the new item
56  PCBNEW_SELECTION preview;
57  view()->Add( &preview );
58 
59  aPlacer->m_board = board();
60  aPlacer->m_frame = frame();
61  aPlacer->m_modifiers = 0;
62 
63  auto makeNewItem = [&] ( VECTOR2I aPosition )
64  {
65  if( frame()->GetModel() )
66  newItem = aPlacer->CreateItem();
67 
68  if( newItem )
69  {
70  newItem->SetPosition( (wxPoint) aPosition );
71  preview.Add( newItem.get() );
72 
73  if( newItem->Type() == PCB_MODULE_T )
74  {
75  auto module = dyn_cast<MODULE*>( newItem.get() );
76 
77  // modules have more drawable parts
78  module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
79  }
80  }
81  };
82 
83  if( aOptions & IPO_SINGLE_CLICK )
84  makeNewItem( controls()->GetCursorPosition() );
85 
86  // Main loop: keep receiving events
87  while( TOOL_EVENT* evt = Wait() )
88  {
89  VECTOR2I cursorPos = controls()->GetCursorPosition();
90  aPlacer->m_modifiers = evt->Modifier();
91 
92  auto cleanup = [&] ()
93  {
94  newItem = nullptr;
95  preview.Clear();
96  view()->Update( &preview );
97  controls()->SetAutoPan( false );
98  controls()->CaptureCursor( false );
99  controls()->ShowCursor( true );
100  };
101 
102  if( evt->IsCancelInteractive() )
103  {
104  if( aOptions & IPO_SINGLE_CLICK )
105  {
106  cleanup();
107  frame()->PopTool( aTool );
108  break;
109  }
110  else if( newItem )
111  cleanup();
112  else
113  {
114  frame()->PopTool( aTool );
115  break;
116  }
117  }
118  else if( evt->IsActivate() )
119  {
120  if( newItem )
121  cleanup();
122 
123  if( evt->IsPointEditor() )
124  {
125  // don't exit (the point editor runs in the background)
126  }
127  else if( evt->IsMoveTool() )
128  {
129  // leave ourselves on the stack so we come back after the move
130  break;
131  }
132  else
133  {
134  frame()->PopTool( aTool );
135  break;
136  }
137  }
138  else if( evt->IsClick( BUT_LEFT ) )
139  {
140  if( !newItem )
141  {
142  // create the item if possible
143  makeNewItem( cursorPos );
144 
145  // no item created, so wait for another click
146  if( !newItem )
147  continue;
148 
149  controls()->CaptureCursor( true );
150  controls()->SetAutoPan( true );
151  }
152  else
153  {
154  auto oldFlags = newItem->GetFlags();
155  newItem->ClearFlags();
156 
157  if( !aPlacer->PlaceItem( newItem.get(), commit ) )
158  {
159  newItem->SetFlags( oldFlags );
160  continue;
161  }
162 
163  preview.Clear();
164  newItem.release();
165  commit.Push( aCommitMessage );
166 
167  controls()->CaptureCursor( false );
168  controls()->SetAutoPan( false );
169  controls()->ShowCursor( true );
170 
171  if( !( aOptions & IPO_REPEAT ) )
172  break;
173 
174  if( aOptions & IPO_SINGLE_CLICK )
175  makeNewItem( controls()->GetCursorPosition() );
176  }
177  }
178  else if( evt->IsClick( BUT_RIGHT ) )
179  {
181  }
182  else if( newItem && evt->Category() == TC_COMMAND )
183  {
184  /*
185  * Handle any events that can affect the item as we move it around
186  */
187  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) && ( aOptions & IPO_ROTATE ) )
188  {
189  const int rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *frame(), *evt );
190  newItem->Rotate( newItem->GetPosition(), rotationAngle );
191  view()->Update( &preview );
192  }
193  else if( evt->IsAction( &PCB_ACTIONS::flip ) && ( aOptions & IPO_FLIP ) )
194  {
195  newItem->Flip( newItem->GetPosition(), frame()->Settings().m_FlipLeftRight );
196  view()->Update( &preview );
197  }
198  else if( evt->IsAction( &PCB_ACTIONS::viaSizeInc )
199  || evt->IsAction( &PCB_ACTIONS::viaSizeDec ) )
200  {
201  // Refresh preview after event runs
203  }
204  else if( evt->IsAction( &ACTIONS::refreshPreview ) )
205  {
206  preview.Clear();
207  newItem.release();
208 
209  makeNewItem( controls()->GetCursorPosition() );
210  view()->Update( &preview );
211  }
212  }
213 
214  else if( newItem && evt->IsMotion() )
215  {
216  // track the cursor
217  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
218  aPlacer->SnapItem( newItem.get() );
219 
220  // Show a preview of the item
221  view()->Update( &preview );
222  }
223 
224  else
225  evt->SetPassEvent();
226  }
227 
228  view()->Remove( &preview );
229 }
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:94
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:284
virtual std::unique_ptr< BOARD_ITEM > CreateItem()=0
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:218
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:139
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:75
TOOL_MANAGER * GetManager() const
Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool.
Definition: tool_base.h:142
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.
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:111
KIGFX::VIEW_CONTROLS * controls() const
MODULE * module() const
PCBNEW_SETTINGS & Settings()
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:62
int GetEventRotationAngle(const PCB_BASE_EDIT_FRAME &aFrame, const TOOL_EVENT &aEvt)
Function getEventRotationAngle()
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
static TOOL_ACTION viaSizeDec
Definition: pcb_actions.h:285
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, PCBNEW_SETTINGS::m_FlipLeftRight, INTERACTIVE_PLACER_BASE::m_frame, TOOL_INTERACTIVE::m_menu, INTERACTIVE_PLACER_BASE::m_modifiers, TOOL_BASE::m_toolMgr, PCB_TOOL_BASE::module(), PCB_MODULE_T, INTERACTIVE_PLACER_BASE::PlaceItem(), 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 PlacePad().

◆ EditFootprint()

int MODULE_EDITOR_TOOLS::EditFootprint ( const TOOL_EVENT aEvent)

Definition at line 264 of file footprint_editor_tools.cpp.

265 {
267  return 0;
268 }
FOOTPRINT_EDIT_FRAME * m_frame
void LoadModuleFromLibrary(LIB_ID aFPID)
LIB_ID GetTreeFPID() const
Return the LIB_ID of the part or library selected in the footprint tree.

References FOOTPRINT_EDIT_FRAME::GetTreeFPID(), FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary(), and m_frame.

Referenced by setTransitions().

◆ EditingModules()

bool PCB_TOOL_BASE::EditingModules ( ) const
inlineinherited

◆ ExplodePadToShapes()

int MODULE_EDITOR_TOOLS::ExplodePadToShapes ( const TOOL_EVENT aEvent)

Function ExplodePadToShapes()

Breaks apart a complex-shaped part into a set of graphical shapes

Definition at line 370 of file footprint_editor_tools.cpp.

371 {
373  BOARD_COMMIT commit( m_frame );
374 
375  if( selection.Size() != 1 )
376  return 0;
377 
378  if( selection[0]->Type() != PCB_PAD_T )
379  return 0;
380 
381  auto pad = static_cast<D_PAD*>( selection[0] );
382 
383  if( pad->GetShape() != PAD_SHAPE_CUSTOM )
384  return 0;
385 
386  commit.Modify( pad );
387 
388  wxPoint anchor = pad->GetPosition();
389 
390  for( auto prim : pad->GetPrimitives() )
391  {
392  auto ds = new EDGE_MODULE( board()->GetFirstModule() );
393 
394  prim.ExportTo( ds ); // ExportTo exports to a DRAWSEGMENT
395  // Fix an arbitray draw layer for this EDGE_MODULE
396  ds->SetLayer( Dwgs_User ); //pad->GetLayer() );
397  ds->Move( anchor );
398  ds->Rotate( anchor, pad->GetOrientation() );
399 
400  commit.Add( ds );
401  }
402 
403  pad->SetShape( pad->GetAnchorPadShape() );
404  // Cleanup the pad primitives data, because the initial pad was a custom
405  // shaped pad, and it contains primitives, that does not exist in non custom pads,
406  // and can create issues later:
407  if( pad->GetShape() != PAD_SHAPE_CUSTOM ) // should be always the case
408  {
409  pad->DeletePrimitivesList();
410  }
411 
412  commit.Push( _("Explode pad to shapes") );
413 
415 
416  return 0;
417 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:73
BOARD * board() const
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:218
FOOTPRINT_EDIT_FRAME * m_frame
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:139
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
const PCBNEW_SELECTION & selection() const
#define _(s)
Definition: 3d_actions.cpp:33
int Size() const
Returns the number of selected parts.
Definition: selection.h:126

References _, COMMIT::Add(), PCB_TOOL_BASE::board(), Dwgs_User, TOOL_MANAGER::GetTool(), m_frame, TOOL_BASE::m_toolMgr, COMMIT::Modify(), PAD_SHAPE_CUSTOM, PCB_PAD_T, BOARD_COMMIT::Push(), TOOL_MANAGER::RunAction(), PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionClear, and SELECTION::Size().

Referenced by setTransitions().

◆ ExportFootprint()

int MODULE_EDITOR_TOOLS::ExportFootprint ( const TOOL_EVENT aEvent)

Definition at line 249 of file footprint_editor_tools.cpp.

250 {
251  LIB_ID fpID = m_frame->GetTreeFPID();
252  MODULE* fp;
253 
254  if( !fpID.IsValid() )
255  fp = m_frame->GetBoard()->GetFirstModule();
256  else
257  fp = m_frame->LoadFootprint( fpID );
258 
259  m_frame->Export_Module( fp );
260  return 0;
261 }
FOOTPRINT_EDIT_FRAME * m_frame
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
bool IsValid() const
Definition: lib_id.h:171
MODULE * GetFirstModule() const
Gets the first module in the list (used in footprint viewer/editor) or NULL if none.
Definition: class_board.h:283
void Export_Module(MODULE *aModule)
Create a file containing only one footprint.
MODULE * LoadFootprint(const LIB_ID &aFootprintId)
Function LoadFootprint attempts to load aFootprintId from the footprint library table.
BOARD * GetBoard() const
LIB_ID GetTreeFPID() const
Return the LIB_ID of the part or library selected in the footprint tree.

References FOOTPRINT_EDIT_FRAME::Export_Module(), PCB_BASE_FRAME::GetBoard(), BOARD::GetFirstModule(), FOOTPRINT_EDIT_FRAME::GetTreeFPID(), LIB_ID::IsValid(), PCB_BASE_FRAME::LoadFootprint(), and m_frame.

Referenced by setTransitions().

◆ frame()

PCB_BASE_EDIT_FRAME* PCB_TOOL_BASE::frame ( ) const
inlineprotectedinherited

Definition at line 150 of file pcb_tool_base.h.

151  {
152  return getEditFrame<PCB_BASE_EDIT_FRAME>();
153  }

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(), 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(), PCB_EDITOR_CONTROL::ExportSpecctraDSN(), ROUTER_TOOL::finishInteractive(), EDIT_TOOL::Flip(), PCB_EDITOR_CONTROL::FlipPcbView(), GLOBAL_EDIT_TOOL::GlobalDeletions(), ImportFootprint(), PCB_EDITOR_CONTROL::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(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::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(), PCB_EDITOR_CONTROL::UpdateSchematicFromPCB(), ZONE_FILLER_TOOL::ZoneFill(), and ZONE_FILLER_TOOL::ZoneFillAll().

◆ getEditFrame()

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

Function getEditFrame()

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

Definition at line 186 of file tool_base.h.

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

References TOOL_BASE::getEditFrameInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

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

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 120 of file tool_base.h.

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

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 142 of file tool_base.h.

143  {
144  return m_toolMgr;
145  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:218

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

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

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

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

References TOOL_BASE::m_toolName.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 109 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

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

Function getView()

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

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

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

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(), EE_SELECTION_TOOL::ClearSelection(), COMMON_TOOLS::CursorControl(), LIB_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), MICROWAVE_TOOL::drawMicrowaveInductor(), PCB_EDITOR_CONTROL::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(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCB_INSPECTION_TOOL::highlightNet(), EE_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(), POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), LIB_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PNS::TOOL_BASE::pickSingleItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), PCB_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), SELECTION_TOOL::Selectable(), GERBVIEW_SELECTION_TOOL::selectable(), EE_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), COMMON_TOOLS::ToggleGrid(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), PCBNEW_CONTROL::updateGrid(), EE_POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_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:218
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:285

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

Referenced by EE_POINT_EDITOR::addCorner(), 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(), 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(), ImportFootprint(), SCH_MOVE_TOOL::Main(), EE_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(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), 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(), POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), LIB_MOVE_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:57
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(), ZONE_FILLER_TOOL::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), COMMON_CONTROL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), LIB_MOVE_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), POINT_EDITOR::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), EDA_3D_VIEWER_CONTROL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), LIB_CONTROL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), PCB_INSPECTION_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), setTransitions(), CVPCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), PCBNEW_PICKER_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), DRAWING_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), DRC::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ ImportFootprint()

int MODULE_EDITOR_TOOLS::ImportFootprint ( const TOOL_EVENT aEvent)

Definition at line 227 of file footprint_editor_tools.cpp.

228 {
229  if( !m_frame->Clear_Pcb( true ) )
230  return -1; // this command is aborted
231 
234 
235  if( m_frame->GetBoard()->GetFirstModule() )
237 
238  // Clear undo and redo lists because we don't have handling to in
239  // FP editor to undo across imports (the module _is_ the board with the stack)
240  // todo: Abstract undo/redo stack to a higher element or keep consistent board item in fpeditor
242 
244  m_frame->OnModify();
245  return 0;
246 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:218
FOOTPRINT_EDIT_FRAME * m_frame
static TOOL_ACTION zoomFitScreen
Definition: actions.h:93
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:139
PCB_BASE_EDIT_FRAME * frame() const
bool Clear_Pcb(bool aQuery)
Delete all and reinitialize the current board.
Definition: initpcb.cpp:98
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
void OnModify() override
Must be called after a footprint change in order to set the "modify" flag of the current screen and p...
virtual void ClearUndoRedoList()
Function ClearUndoRedoList clear undo and redo list, using ClearUndoORRedoList() picked items are del...
MODULE * GetFirstModule() const
Gets the first module in the list (used in footprint viewer/editor) or NULL if none.
Definition: class_board.h:283
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves the graphic crosshair cursor to the requested position expressed in world coordinates.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:258
BOARD * GetBoard() const
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
MODULE * Import_Module(const wxString &aName=wxT(""))
Read a file containing only one footprint.

References FOOTPRINT_EDIT_FRAME::Clear_Pcb(), EDA_ITEM::ClearFlags(), BASE_SCREEN::ClearUndoRedoList(), PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetBoard(), BOARD::GetFirstModule(), PCB_BASE_FRAME::GetScreen(), TOOL_BASE::getViewControls(), FOOTPRINT_EDIT_FRAME::Import_Module(), m_frame, TOOL_BASE::m_toolMgr, FOOTPRINT_EDIT_FRAME::OnModify(), TOOL_MANAGER::RunAction(), KIGFX::VIEW_CONTROLS::SetCrossHairCursorPosition(), and ACTIONS::zoomFitScreen.

Referenced by setTransitions().

◆ Init()

bool MODULE_EDITOR_TOOLS::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 75 of file footprint_editor_tools.cpp.

76 {
77  // Build a context menu for the footprint tree
78  //
79  CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
80 
81  auto libSelectedCondition = [ this ] ( const SELECTION& aSel ) {
82  LIB_ID sel = m_frame->GetTreeFPID();
83  return !sel.GetLibNickname().empty() && sel.GetLibItemName().empty();
84  };
85  auto pinnedLibSelectedCondition = [ this ] ( const SELECTION& aSel ) {
87  return current && current->m_Type == LIB_TREE_NODE::LIB && current->m_Pinned;
88  };
89  auto unpinnedLibSelectedCondition = [ this ] (const SELECTION& aSel ) {
91  return current && current->m_Type == LIB_TREE_NODE::LIB && !current->m_Pinned;
92  };
93  auto fpSelectedCondition = [ this ] ( const SELECTION& aSel ) {
94  LIB_ID sel = m_frame->GetTreeFPID();
95  return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
96  };
97 
98  ctxMenu.AddItem( ACTIONS::pinLibrary, unpinnedLibSelectedCondition );
99  ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLibSelectedCondition );
100  ctxMenu.AddSeparator();
101 
104  ctxMenu.AddItem( ACTIONS::save, libSelectedCondition );
105  ctxMenu.AddItem( ACTIONS::saveAs, libSelectedCondition );
106  ctxMenu.AddItem( ACTIONS::revert, libSelectedCondition );
107 
108  ctxMenu.AddSeparator();
110 #ifdef KICAD_SCRIPTING
112 #endif
113  ctxMenu.AddItem( PCB_ACTIONS::editFootprint, fpSelectedCondition );
114 
115  ctxMenu.AddSeparator();
116  ctxMenu.AddItem( ACTIONS::save, fpSelectedCondition );
117  ctxMenu.AddItem( ACTIONS::saveCopyAs, fpSelectedCondition );
118  ctxMenu.AddItem( PCB_ACTIONS::deleteFootprint, fpSelectedCondition );
119  ctxMenu.AddItem( ACTIONS::revert, fpSelectedCondition );
120 
121  ctxMenu.AddSeparator();
122  ctxMenu.AddItem( PCB_ACTIONS::cutFootprint, fpSelectedCondition );
123  ctxMenu.AddItem( PCB_ACTIONS::copyFootprint, fpSelectedCondition );
125 
126  ctxMenu.AddSeparator();
128  ctxMenu.AddItem( PCB_ACTIONS::exportFootprint, fpSelectedCondition );
129 
130  return true;
131 }
static bool ShowAlways(const SELECTION &aSelection)
Function ShowAlways The default condition function (always returns true).
static TOOL_ACTION pinLibrary
Definition: actions.h:104
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
FOOTPRINT_EDIT_FRAME * m_frame
static TOOL_ACTION unpinLibrary
Definition: actions.h:105
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
static TOOL_ACTION createFootprint
Definition: pcb_actions.h:340
static TOOL_ACTION saveCopyAs
Definition: actions.h:56
static TOOL_ACTION cutFootprint
Definition: pcb_actions.h:349
static TOOL_ACTION copyFootprint
Definition: pcb_actions.h:350
static TOOL_ACTION exportFootprint
Definition: pcb_actions.h:353
static TOOL_ACTION editFootprint
Definition: pcb_actions.h:347
static TOOL_ACTION save
Definition: actions.h:54
static TOOL_ACTION addLibrary
Definition: actions.h:52
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
static TOOL_ACTION newLibrary
Definition: actions.h:51
LIB_TREE_NODE * GetCurrentTreeNode() const
static TOOL_ACTION importFootprint
Definition: pcb_actions.h:352
void AddSeparator(int aOrder=ANY_ORDER)
Function AddSeparator()
static TOOL_ACTION saveAs
Definition: actions.h:55
enum TYPE m_Type
static TOOL_ACTION pasteFootprint
Definition: pcb_actions.h:351
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()
static TOOL_ACTION deleteFootprint
Definition: pcb_actions.h:348
LIB_ID GetTreeFPID() const
Return the LIB_ID of the part or library selected in the footprint tree.
static TOOL_ACTION revert
Definition: actions.h:58
static TOOL_ACTION newFootprint
Definition: pcb_actions.h:337
bool empty() const
Definition: utf8.h:108

References CONDITIONAL_MENU::AddItem(), ACTIONS::addLibrary, CONDITIONAL_MENU::AddSeparator(), PCB_ACTIONS::copyFootprint, PCB_ACTIONS::createFootprint, PCB_ACTIONS::cutFootprint, PCB_ACTIONS::deleteFootprint, PCB_ACTIONS::editFootprint, UTF8::empty(), PCB_ACTIONS::exportFootprint, FOOTPRINT_EDIT_FRAME::GetCurrentTreeNode(), LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), TOOL_MENU::GetMenu(), FOOTPRINT_EDIT_FRAME::GetTreeFPID(), PCB_ACTIONS::importFootprint, LIB_TREE_NODE::LIB, m_frame, TOOL_INTERACTIVE::m_menu, LIB_TREE_NODE::m_Pinned, LIB_TREE_NODE::m_Type, PCB_ACTIONS::newFootprint, ACTIONS::newLibrary, PCB_ACTIONS::pasteFootprint, ACTIONS::pinLibrary, ACTIONS::revert, ACTIONS::save, ACTIONS::saveAs, ACTIONS::saveCopyAs, SELECTION_CONDITIONS::ShowAlways(), and ACTIONS::unpinLibrary.

◆ 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:218
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:213
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.

◆ module()

◆ NewFootprint()

int MODULE_EDITOR_TOOLS::NewFootprint ( const TOOL_EVENT aEvent)

Definition at line 134 of file footprint_editor_tools.cpp.

135 {
136  wxCommandEvent evt( wxEVT_NULL, ID_MODEDIT_NEW_MODULE );
137  getEditFrame<FOOTPRINT_EDIT_FRAME>()->Process_Special_Functions( evt );
138  return 0;
139 }

References ID_MODEDIT_NEW_MODULE.

Referenced by setTransitions().

◆ PasteFootprint()

int MODULE_EDITOR_TOOLS::PasteFootprint ( const TOOL_EVENT aEvent)

Definition at line 189 of file footprint_editor_tools.cpp.

190 {
192  {
193  wxString newLib = m_frame->GetTreeFPID().GetLibNickname();
194  MODULE* newModule( m_copiedModule.get() );
195  wxString newName = newModule->GetFPID().GetLibItemName();
196 
197  while( m_frame->Prj().PcbFootprintLibs()->FootprintExists( newLib, newName ) )
198  newName += _( "_copy" );
199 
200  newModule->SetFPID( LIB_ID( newLib, newName ) );
201  m_frame->SaveFootprintInLibrary( newModule, newLib );
202 
203  m_frame->SyncLibraryTree( true );
204  m_frame->FocusOnLibID( newModule->GetFPID() );
205  }
206 
207  return 0;
208 }
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
FOOTPRINT_EDIT_FRAME * m_frame
const LIB_ID & GetFPID() const
Definition: class_module.h:219
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
void SyncLibraryTree(bool aProgress)
Synchronize the footprint library tree to the current state of the footprint library table.
void FocusOnLibID(const LIB_ID &aLibID)
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:427
bool SaveFootprintInLibrary(MODULE *aModule, const wxString &aLibraryName)
#define _(s)
Definition: 3d_actions.cpp:33
std::unique_ptr< MODULE > m_copiedModule
bool FootprintExists(const wxString &aNickname, const wxString &aFootprintName)
Function FootprintExists.
LIB_ID GetTreeFPID() const
Return the LIB_ID of the part or library selected in the footprint tree.
bool empty() const
Definition: utf8.h:108

References _, UTF8::empty(), FOOTPRINT_EDIT_FRAME::FocusOnLibID(), FP_LIB_TABLE::FootprintExists(), MODULE::GetFPID(), LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), FOOTPRINT_EDIT_FRAME::GetTreeFPID(), m_copiedModule, m_frame, PROJECT::PcbFootprintLibs(), KIWAY_HOLDER::Prj(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), and FOOTPRINT_EDIT_FRAME::SyncLibraryTree().

Referenced by setTransitions().

◆ PinLibrary()

int MODULE_EDITOR_TOOLS::PinLibrary ( const TOOL_EVENT aEvent)

Definition at line 271 of file footprint_editor_tools.cpp.

272 {
273  LIB_TREE_NODE* currentNode = m_frame->GetCurrentTreeNode();
274 
275  if( currentNode && !currentNode->m_Pinned )
276  {
277  currentNode->m_Pinned = true;
279  }
280 
281  return 0;
282 }
FOOTPRINT_EDIT_FRAME * m_frame
void RegenerateLibraryTree()
Filter, sort, and redisplay the library tree.
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
LIB_TREE_NODE * GetCurrentTreeNode() const

References FOOTPRINT_EDIT_FRAME::GetCurrentTreeNode(), m_frame, LIB_TREE_NODE::m_Pinned, and FOOTPRINT_EDIT_FRAME::RegenerateLibraryTree().

Referenced by setTransitions().

◆ PlacePad()

int MODULE_EDITOR_TOOLS::PlacePad ( const TOOL_EVENT aEvent)

Function PlacePad() Places a pad in module editor.

Definition at line 326 of file footprint_editor_tools.cpp.

327 {
328  if( !m_frame->GetBoard()->GetFirstModule() )
329  return 0;
330 
331  struct PAD_PLACER : public INTERACTIVE_PLACER_BASE
332  {
333  virtual ~PAD_PLACER()
334  {
335  }
336 
337  std::unique_ptr<BOARD_ITEM> CreateItem() override
338  {
339  D_PAD* pad = new D_PAD( m_board->GetFirstModule() );
341  pad->IncrementPadName( true, true );
342  return std::unique_ptr<BOARD_ITEM>( pad );
343  }
344 
345  bool PlaceItem( BOARD_ITEM *aItem, BOARD_COMMIT& aCommit ) override
346  {
347  D_PAD* pad = dynamic_cast<D_PAD*>( aItem );
348 
349  if( pad )
350  {
352  pad->SetLocalCoord();
353  aCommit.Add( aItem );
354  return true;
355  }
356 
357  return false;
358  }
359  };
360 
361  PAD_PLACER placer;
362 
363  doInteractiveItemPlacement( aEvent.GetCommandStr().get(), &placer, _( "Place pad" ),
365 
366  return 0;
367 }
bool IncrementPadName(bool aSkipUnconnectable, bool aFillSequenceGaps)
Function IncrementPadName.
Definition: class_pad.cpp:585
BOARD_DESIGN_SETTINGS & GetDesignSettings() const override
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
COMMIT & Add(EDA_ITEM *aItem)
Adds a new item to the model
Definition: commit.h:78
FOOTPRINT_EDIT_FRAME * m_frame
void SetLocalCoord()
Set relative coordinates.
Definition: class_pad.cpp:408
MODULE * GetFirstModule() const
Gets the first module in the list (used in footprint viewer/editor) or NULL if none.
Definition: class_board.h:283
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
#define _(s)
Definition: 3d_actions.cpp:33
void ImportSettingsFrom(const D_PAD &aMasterPad)
Imports the pad settings from aMasterPad.
Definition: class_pad.cpp:1488
D_PAD m_Pad_Master
A dummy pad to store all default parameters.
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...
BOARD * GetBoard() const

References _, COMMIT::Add(), PCB_TOOL_BASE::doInteractiveItemPlacement(), PCB_BASE_FRAME::GetBoard(), TOOL_EVENT::GetCommandStr(), FOOTPRINT_EDIT_FRAME::GetDesignSettings(), BOARD::GetFirstModule(), D_PAD::ImportSettingsFrom(), D_PAD::IncrementPadName(), PCB_TOOL_BASE::IPO_FLIP, PCB_TOOL_BASE::IPO_REPEAT, PCB_TOOL_BASE::IPO_ROTATE, PCB_TOOL_BASE::IPO_SINGLE_CLICK, m_frame, BOARD_DESIGN_SETTINGS::m_Pad_Master, and D_PAD::SetLocalCoord().

Referenced by setTransitions().

◆ Properties()

int MODULE_EDITOR_TOOLS::Properties ( const TOOL_EVENT aEvent)

Definition at line 306 of file footprint_editor_tools.cpp.

307 {
308  MODULE* footprint = m_frame->GetBoard()->GetFirstModule();
309 
310  if( footprint )
311  {
312  getEditFrame<FOOTPRINT_EDIT_FRAME>()->OnEditItemRequest( footprint );
313  m_frame->GetCanvas()->Refresh();
314  }
315  return 0;
316 }
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
FOOTPRINT_EDIT_FRAME * m_frame
MODULE * GetFirstModule() const
Gets the first module in the list (used in footprint viewer/editor) or NULL if none.
Definition: class_board.h:283
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
BOARD * GetBoard() const

References PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), BOARD::GetFirstModule(), m_frame, and EDA_DRAW_PANEL_GAL::Refresh().

Referenced by setTransitions().

◆ Reset()

void MODULE_EDITOR_TOOLS::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 69 of file footprint_editor_tools.cpp.

70 {
71  m_frame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
72 }
FOOTPRINT_EDIT_FRAME * m_frame

References m_frame.

◆ Revert()

int MODULE_EDITOR_TOOLS::Revert ( const TOOL_EVENT aEvent)

Definition at line 166 of file footprint_editor_tools.cpp.

167 {
168  getEditFrame<FOOTPRINT_EDIT_FRAME>()->RevertFootprint();
169  return 0;
170 }

Referenced by setTransitions().

◆ 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:218
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 MODULE_EDITOR_TOOLS::Save ( const TOOL_EVENT aEvent)

Definition at line 150 of file footprint_editor_tools.cpp.

151 {
152  wxCommandEvent evt( wxEVT_NULL, ID_MODEDIT_SAVE );
153  getEditFrame<FOOTPRINT_EDIT_FRAME>()->Process_Special_Functions( evt );
154  return 0;
155 }

References ID_MODEDIT_SAVE.

Referenced by setTransitions().

◆ SaveAs()

int MODULE_EDITOR_TOOLS::SaveAs ( const TOOL_EVENT aEvent)

Definition at line 158 of file footprint_editor_tools.cpp.

159 {
160  wxCommandEvent evt( wxEVT_NULL, ID_MODEDIT_SAVE_AS );
161  getEditFrame<FOOTPRINT_EDIT_FRAME>()->Process_Special_Functions( evt );
162  return 0;
163 }

References ID_MODEDIT_SAVE_AS.

Referenced by setTransitions().

◆ selection() [1/2]

const PCBNEW_SELECTION & PCB_TOOL_BASE::selection ( ) const
protectedinherited

Definition at line 270 of file pcb_tool_base.cpp.

271 {
272  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
273  const auto& selection = selTool->GetSelection();
274  return selection;
275 }
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:218
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(), 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(), 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(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::Move(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), PAD_TOOL::pastePadProperties(), PCBNEW_CONTROL::placeBoardItems(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EDIT_TOOL::Rotate(), PCB_TOOL_BASE::selection(), SELECTION_TOOL::selectNet(), DRAWING_TOOL::SetAnchor(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), PCBNEW_CONTROL::UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), PCB_EDITOR_CONTROL::ZoneDuplicate(), ZONE_FILLER_TOOL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfill().

◆ selection() [2/2]

PCBNEW_SELECTION & PCB_TOOL_BASE::selection ( )
protectedinherited

Definition at line 278 of file pcb_tool_base.cpp.

279 {
280  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
281  auto& selection = selTool->GetSelection();
282  return selection;
283 }
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:218
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:218
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(), 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 101 of file pcb_tool_base.h.

102  {
103  m_editModules = aEnabled;
104  }

References PCB_TOOL_BASE::m_editModules.

◆ setTransitions()

void MODULE_EDITOR_TOOLS::setTransitions ( )
overrideprivatevirtual

Sets up handlers for various events.

Reimplemented from PCB_TOOL_BASE.

Definition at line 581 of file footprint_editor_tools.cpp.

582 {
585  Go( &MODULE_EDITOR_TOOLS::Save, ACTIONS::save.MakeEvent() );
592 
597 
600 
606 
610 }
static TOOL_ACTION pinLibrary
Definition: actions.h:104
static TOOL_ACTION saveToBoard
Definition: pcb_actions.h:344
int DefaultPadProperties(const TOOL_EVENT &aEvent)
Edit the properties used for new pad creation.
static TOOL_ACTION footprintProperties
Definition: pcb_actions.h:355
int Properties(const TOOL_EVENT &aEvent)
int DeleteFootprint(const TOOL_EVENT &aEvent)
int CutCopyFootprint(const TOOL_EVENT &aEvent)
int EditFootprint(const TOOL_EVENT &aEvent)
static TOOL_ACTION explodePadToShapes
Definition: pcb_actions.h:362
static TOOL_ACTION placePad
Activation of the drawing tool (placing a PAD)
Definition: pcb_actions.h:359
static TOOL_ACTION unpinLibrary
Definition: actions.h:105
int CreatePadFromShapes(const TOOL_EVENT &aEvent)
Function CreatePadFromShapes()
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
int UnpinLibrary(const TOOL_EVENT &aEvent)
static TOOL_ACTION createFootprint
Definition: pcb_actions.h:340
static TOOL_ACTION saveCopyAs
Definition: actions.h:56
static TOOL_ACTION cutFootprint
Definition: pcb_actions.h:349
static TOOL_ACTION copyFootprint
Definition: pcb_actions.h:350
int ImportFootprint(const TOOL_EVENT &aEvent)
int ExplodePadToShapes(const TOOL_EVENT &aEvent)
Function ExplodePadToShapes()
int Revert(const TOOL_EVENT &aEvent)
int SaveAs(const TOOL_EVENT &aEvent)
static TOOL_ACTION toggleFootprintTree
Definition: pcb_actions.h:333
int PlacePad(const TOOL_EVENT &aEvent)
Function PlacePad() Places a pad in module editor.
int Save(const TOOL_EVENT &aEvent)
static TOOL_ACTION exportFootprint
Definition: pcb_actions.h:353
static TOOL_ACTION editFootprint
Definition: pcb_actions.h:347
static TOOL_ACTION save
Definition: actions.h:54
int NewFootprint(const TOOL_EVENT &aEvent)
int ExportFootprint(const TOOL_EVENT &aEvent)
int PinLibrary(const TOOL_EVENT &aEvent)
int PasteFootprint(const TOOL_EVENT &aEvent)
static TOOL_ACTION importFootprint
Definition: pcb_actions.h:352
static TOOL_ACTION saveToLibrary
Definition: pcb_actions.h:345
static TOOL_ACTION createPadFromShapes
Definition: pcb_actions.h:361
static TOOL_ACTION defaultPadProperties
Definition: pcb_actions.h:356
static TOOL_ACTION saveAs
Definition: actions.h:55
int CreateFootprint(const TOOL_EVENT &aEvent)
static TOOL_ACTION pasteFootprint
Definition: pcb_actions.h:351
int ToggleFootprintTree(const TOOL_EVENT &aEvent)
static TOOL_ACTION deleteFootprint
Definition: pcb_actions.h:348
static TOOL_ACTION revert
Definition: actions.h:58
static TOOL_ACTION newFootprint
Definition: pcb_actions.h:337

References PCB_ACTIONS::copyFootprint, CreateFootprint(), PCB_ACTIONS::createFootprint, CreatePadFromShapes(), PCB_ACTIONS::createPadFromShapes, CutCopyFootprint(), PCB_ACTIONS::cutFootprint, DefaultPadProperties(), PCB_ACTIONS::defaultPadProperties, DeleteFootprint(), PCB_ACTIONS::deleteFootprint, EditFootprint(), PCB_ACTIONS::editFootprint, ExplodePadToShapes(), PCB_ACTIONS::explodePadToShapes, ExportFootprint(), PCB_ACTIONS::exportFootprint, PCB_ACTIONS::footprintProperties, TOOL_INTERACTIVE::Go(), ImportFootprint(), PCB_ACTIONS::importFootprint, NewFootprint(), PCB_ACTIONS::newFootprint, PasteFootprint(), PCB_ACTIONS::pasteFootprint, PinLibrary(), ACTIONS::pinLibrary, PlacePad(), PCB_ACTIONS::placePad, Properties(), Revert(), ACTIONS::revert, Save(), ACTIONS::save, ACTIONS::saveAs, SaveAs(), ACTIONS::saveCopyAs, PCB_ACTIONS::saveToBoard, PCB_ACTIONS::saveToLibrary, ToggleFootprintTree(), PCB_ACTIONS::toggleFootprintTree, UnpinLibrary(), and ACTIONS::unpinLibrary.

◆ ToggleFootprintTree()

int MODULE_EDITOR_TOOLS::ToggleFootprintTree ( const TOOL_EVENT aEvent)

Definition at line 299 of file footprint_editor_tools.cpp.

300 {
302  return 0;
303 }
FOOTPRINT_EDIT_FRAME * m_frame

References m_frame, and FOOTPRINT_EDIT_FRAME::ToggleSearchTree().

Referenced by setTransitions().

◆ UnpinLibrary()

int MODULE_EDITOR_TOOLS::UnpinLibrary ( const TOOL_EVENT aEvent)

Definition at line 285 of file footprint_editor_tools.cpp.

286 {
287  LIB_TREE_NODE* currentNode = m_frame->GetCurrentTreeNode();
288 
289  if( currentNode && currentNode->m_Pinned )
290  {
291  currentNode->m_Pinned = false;
293  }
294 
295  return 0;
296 }
FOOTPRINT_EDIT_FRAME * m_frame
void RegenerateLibraryTree()
Filter, sort, and redisplay the library tree.
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
LIB_TREE_NODE * GetCurrentTreeNode() const

References FOOTPRINT_EDIT_FRAME::GetCurrentTreeNode(), m_frame, LIB_TREE_NODE::m_Pinned, and FOOTPRINT_EDIT_FRAME::RegenerateLibraryTree().

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:218
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(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), CVPCB_CONTROL::Main(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EDA_3D_VIEWER_CONTROL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_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(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_copiedModule

std::unique_ptr<MODULE> MODULE_EDITOR_TOOLS::m_copiedModule
private

Definition at line 110 of file footprint_editor_tools.h.

Referenced by CutCopyFootprint(), and PasteFootprint().

◆ 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(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), PICKER_TOOL::Init(), SCH_EDIT_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), LIB_DRAWING_TOOLS::Init(), EDA_3D_VIEWER_CONTROL::Init(), Init(), LIB_CONTROL::Init(), PCB_EDITOR_CONTROL::Init(), SCH_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), EDIT_TOOL::Init(), PCB_TOOL_BASE::Init(), SCH_MOVE_TOOL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EDA_3D_VIEWER_CONTROL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_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(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

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

Referenced by TOOL_INTERACTIVE::Activate(), EE_SELECTION_TOOL::AddItemsToSel(), 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(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), MICROWAVE_TOOL::createInductorBetween(), CreatePadFromShapes(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), SCH_EDITOR_CONTROL::Cut(), LIB_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(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::editFieldText(), 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(), 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(), ImportFootprint(), LIB_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), LIB_CONTROL::Init(), PCB_EDITOR_CONTROL::Init(), POINT_EDITOR::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), TOOL_BASE::IsToolActive(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), SCH_MOVE_TOOL::Main(), CVPCB_CONTROL::Main(), LIB_MOVE_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(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::Move(), EDIT_TOOL::MoveExact(), LIB_CONTROL::OnDeMorgan(), LIB_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(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCBNEW_CONTROL::Print(), GERBVIEW_CONTROL::Print(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), LIB_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), EE_SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemFromSel(), 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(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), 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(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::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(), PCBNEW_CONTROL::UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

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

Definition at line 217 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 210 of file tool_base.h.

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


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