KiCad PCB EDA Suite
PCB_CONTROL Class Reference

Handle actions that are shared between different frames in PcbNew. More...

#include <pcb_control.h>

Inheritance diagram for PCB_CONTROL:
PCB_TOOL_BASE TOOL_INTERACTIVE TOOL_BASE

Public Types

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

Public Member Functions

 PCB_CONTROL ()
 
 ~PCB_CONTROL ()
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
int AddLibrary (const TOOL_EVENT &aEvent)
 
int Print (const TOOL_EVENT &aEvent)
 
int Quit (const TOOL_EVENT &aEvent)
 
int ToggleRatsnest (const TOOL_EVENT &aEvent)
 
int ZoneDisplayMode (const TOOL_EVENT &aEvent)
 
int TrackDisplayMode (const TOOL_EVENT &aEvent)
 
int ViaDisplayMode (const TOOL_EVENT &aEvent)
 
int HighContrastMode (const TOOL_EVENT &aEvent)
 
int HighContrastModeCycle (const TOOL_EVENT &aEvent)
 
int LayerSwitch (const TOOL_EVENT &aEvent)
 
int LayerNext (const TOOL_EVENT &aEvent)
 
int LayerPrev (const TOOL_EVENT &aEvent)
 
int LayerToggle (const TOOL_EVENT &aEvent)
 
int LayerAlphaInc (const TOOL_EVENT &aEvent)
 
int LayerAlphaDec (const TOOL_EVENT &aEvent)
 
int GridSetOrigin (const TOOL_EVENT &aEvent)
 
int GridResetOrigin (const TOOL_EVENT &aEvent)
 
int Undo (const TOOL_EVENT &aEvent)
 
int Redo (const TOOL_EVENT &aEvent)
 
int DeleteItemCursor (const TOOL_EVENT &aEvent)
 
int Paste (const TOOL_EVENT &aEvent)
 
int AppendBoardFromFile (const TOOL_EVENT &aEvent)
 
int AppendBoard (PLUGIN &pi, wxString &fileName)
 
int UpdateMessagePanel (const TOOL_EVENT &aEvent)
 
int FlipPcbView (const TOOL_EVENT &aEvent)
 
virtual bool Init () override
 Init() is called once upon a registration of the tool. More...
 
void SetIsFootprintEditor (bool aEnabled)
 Function SetIsFootprintEditor() More...
 
bool IsFootprintEditor () const
 
void Activate ()
 Run the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Assign a context menu and tells when it should be activated. More...
 
void RunMainStack (std::function< void()> aFunc)
 Call a function using the main stack. More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Define which state (aStateFunc) to go when a certain event arrives (aConditions). More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Suspend execution of the tool until an event specified in aEventList arrives. More...
 
TOOL_TYPE GetType () const
 Return the type of the tool. More...
 
TOOL_ID GetId () const
 Return the unique identifier of the tool. More...
 
const std::string & GetName () const
 Return the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Return the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Static Public Member Functions

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

Protected Types

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

Protected Member Functions

void doInteractiveItemPlacement (const std::string &aTool, INTERACTIVE_PLACER_BASE *aPlacer, const wxString &aCommitMessage, int aOptions=IPO_ROTATE|IPO_FLIP|IPO_REPEAT)
 Helper function for performing a common interactive idiom: wait for a left click, place an item there (perhaps with a dialog or other user interaction), then have it move with the mouse and respond to rotate/flip, etc. More...
 
KIGFX::PCB_VIEWview () const
 
KIGFX::VIEW_CONTROLScontrols () const
 
PCB_BASE_EDIT_FRAMEframe () const
 
BOARDboard () const
 
FOOTPRINTfootprint () const
 
const PCB_DISPLAY_OPTIONSdisplayOptions () const
 
PCB_DRAW_PANEL_GALcanvas () const
 
const PCB_SELECTIONselection () const
 
PCB_SELECTIONselection ()
 
void attachManager (TOOL_MANAGER *aManager)
 Set the TOOL_MANAGER the tool will belong to. More...
 
KIGFX::VIEWgetView () const
 Returns the instance of #VIEW object used in the application. More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Return the instance of VIEW_CONTROLS object used in the application. More...
 
template<typename T >
T * getEditFrame () const
 Return the application window object, casted to requested user type. More...
 
template<typename T >
T * getModel () const
 Return the model object if it matches the requested type. More...
 

Protected Attributes

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

Private Member Functions

void setTransitions () override
 < Sets up handlers for various events. More...
 
int placeBoardItems (std::vector< BOARD_ITEM * > &aItems, bool aIsNew, bool aAnchorAtOrigin)
 Add and select or just select for move/place command a list of board items. More...
 
int placeBoardItems (BOARD *aBoard, bool aAnchorAtOrigin)
 Pointer to the currently used edit frame. More...
 

Private Attributes

PCB_BASE_FRAMEm_frame
 Grid origin marker. More...
 
std::unique_ptr< KIGFX::ORIGIN_VIEWITEMm_gridOrigin
 
BOARD_ITEMm_pickerItem
 

Detailed Description

Handle actions that are shared between different frames in PcbNew.

Definition at line 45 of file pcb_control.h.

Member Enumeration Documentation

◆ INTERACTIVE_PLACEMENT_OPTIONS

Options for placing items interactively.

Enumerator
IPO_ROTATE 

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

IPO_FLIP 

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

IPO_SINGLE_CLICK 

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

IPO_REPEAT 

Allow repeat placement of the item.

Definition at line 111 of file pcb_tool_base.h.

111  {
113  IPO_ROTATE = 0x01,
114 
116  IPO_FLIP = 0x02,
117 
120  IPO_SINGLE_CLICK = 0x04,
121 
123  IPO_REPEAT = 0x08
124  };
Handle flip action in the loop by calling the item's flip method.
Allow repeat placement of the item.
Create an item immediately on placement starting, otherwise show the pencil cursor until the item is ...
Handle the rotate action in the loop by calling the item's rotate method.

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determine the reason of reset for a tool.

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 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

◆ PCB_CONTROL()

PCB_CONTROL::PCB_CONTROL ( )

Definition at line 64 of file pcb_control.cpp.

64  :
65  PCB_TOOL_BASE( "pcbnew.Control" ),
66  m_frame( nullptr ),
67  m_pickerItem( nullptr )
68 {
69  m_gridOrigin.reset( new KIGFX::ORIGIN_VIEWITEM() );
70 }
BOARD_ITEM * m_pickerItem
Definition: pcb_control.h:121
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool_base.h:78
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Definition: pcb_control.h:119

References m_gridOrigin.

◆ ~PCB_CONTROL()

PCB_CONTROL::~PCB_CONTROL ( )

Definition at line 73 of file pcb_control.cpp.

74 {
75 }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run the tool.

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

Definition at line 51 of file tool_interactive.cpp.

52 {
54 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.

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

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), BOARD_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_TREE::onContextMenu(), PCB_POINT_EDITOR::OnSelectionChange(), GROUP_TOOL::PickNewMember(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ AddLibrary()

int PCB_CONTROL::AddLibrary ( const TOOL_EVENT aEvent)

Definition at line 92 of file pcb_control.cpp.

93 {
95  {
96  if( aEvent.IsAction( &ACTIONS::newLibrary ) )
97  static_cast<PCB_BASE_EDIT_FRAME*>( m_frame )->CreateNewLibrary();
98  else if( aEvent.IsAction( &ACTIONS::addLibrary ) )
99  static_cast<PCB_BASE_EDIT_FRAME*>( m_frame )->AddLibrary();
100  }
101 
102  return 0;
103 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:70
static TOOL_ACTION addLibrary
Definition: actions.h:52
static TOOL_ACTION newLibrary
Definition: actions.h:51
bool IsType(FRAME_T aType) const

References ACTIONS::addLibrary, FRAME_FOOTPRINT_EDITOR, FRAME_PCB_EDITOR, TOOL_EVENT::IsAction(), EDA_BASE_FRAME::IsType(), m_frame, and ACTIONS::newLibrary.

Referenced by setTransitions().

◆ AppendBoard()

int PCB_CONTROL::AppendBoard ( PLUGIN pi,
wxString &  fileName 
)

Definition at line 936 of file pcb_control.cpp.

937 {
938  PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
939 
940  if( !editFrame )
941  return 1;
942 
943  BOARD* brd = board();
944 
945  if( !brd )
946  return 1;
947 
948  // Mark existing items, in order to know what are the new items so we can select only
949  // the new items after loading
950  for( TRACK* track : brd->Tracks() )
951  track->SetFlags( SKIP_STRUCT );
952 
953  for( FOOTPRINT* footprint : brd->Footprints() )
955 
956  for( PCB_GROUP* group : brd->Groups() )
957  group->SetFlags( SKIP_STRUCT );
958 
959  for( BOARD_ITEM* drawing : brd->Drawings() )
960  drawing->SetFlags( SKIP_STRUCT );
961 
962  for( ZONE* zone : brd->Zones() )
963  zone->SetFlags( SKIP_STRUCT );
964 
965  std::map<wxString, wxString> oldProperties = brd->GetProperties();
966  std::map<wxString, wxString> newProperties;
967 
968  // Keep also the count of copper layers, to adjust if necessary
969  int initialCopperLayerCount = brd->GetCopperLayerCount();
970  LSET initialEnabledLayers = brd->GetEnabledLayers();
971 
972  // Load the data
973  try
974  {
975  PROPERTIES props;
976  char xbuf[30];
977  char ybuf[30];
978 
979  // EAGLE_PLUGIN can use this info to center the BOARD, but it does not yet.
980  sprintf( xbuf, "%d", editFrame->GetPageSizeIU().x );
981  sprintf( ybuf, "%d", editFrame->GetPageSizeIU().y );
982 
983  props["page_width"] = xbuf;
984  props["page_height"] = ybuf;
985 
986  editFrame->GetDesignSettings().GetNetClasses().Clear();
987  pi.Load( fileName, brd, &props );
988  }
989  catch( const IO_ERROR& ioe )
990  {
991  wxString msg = wxString::Format( _( "Error loading board.\n%s" ), ioe.What() );
992  DisplayError( editFrame, msg );
993 
994  return 0;
995  }
996 
997  newProperties = brd->GetProperties();
998 
999  for( const std::pair<const wxString, wxString>& prop : oldProperties )
1000  newProperties[ prop.first ] = prop.second;
1001 
1002  brd->SetProperties( newProperties );
1003 
1004  // rebuild nets and ratsnest before any use of nets
1005  brd->BuildListOfNets();
1007  brd->BuildConnectivity();
1008 
1009  // Synchronize layers
1010  // we should not ask PLUGINs to do these items:
1011  int copperLayerCount = brd->GetCopperLayerCount();
1012 
1013  if( copperLayerCount > initialCopperLayerCount )
1014  brd->SetCopperLayerCount( copperLayerCount );
1015 
1016  // Enable all used layers, and make them visible:
1017  LSET enabledLayers = brd->GetEnabledLayers();
1018  enabledLayers |= initialEnabledLayers;
1019  brd->SetEnabledLayers( enabledLayers );
1020  brd->SetVisibleLayers( enabledLayers );
1021 
1022  return placeBoardItems( brd, false );
1023 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:253
void BuildListOfNets()
Definition: board.h:733
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
ZONES & Zones()
Definition: board.h:309
BOARD * board() const
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition: board.h:329
int placeBoardItems(std::vector< BOARD_ITEM * > &aItems, bool aIsNew, bool aAnchorAtOrigin)
Add and select or just select for move/place command a list of board items.
GROUPS & Groups()
The groups must maintain the following invariants.
Definition: board.h:323
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
void SetCopperLayerCount(int aCount)
Definition: board.cpp:441
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings Returns a bit-mask of all t...
Definition: board.cpp:447
A name/value tuple with unique names and optional values.
Definition: properties.h:33
virtual BOARD * Load(const wxString &aFileName, BOARD *aAppendToMe, const PROPERTIES *aProperties=nullptr, PROJECT *aProject=nullptr)
Load information from some input file format that this PLUGIN implementation knows about into either ...
Definition: plugin.cpp:46
const std::map< wxString, wxString > & GetProperties() const
Definition: board.h:328
void SynchronizeNetsAndNetClasses()
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition: board.cpp:1413
LSET is a set of PCB_LAYER_IDs.
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:202
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
void SetVisibleLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
Definition: board.cpp:473
FOOTPRINTS & Footprints()
Definition: board.h:303
FOOTPRINT * footprint() const
NETCLASSES & GetNetClasses() const
ZONE handles a list of polygons defining a copper zone.
Definition: zone.h:57
void BuildConnectivity()
Builds or rebuilds the board connectivity database for the board, especially the list of connected it...
Definition: board.cpp:133
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
void Clear()
Destroy any contained NETCLASS instances except the default one, and clears any members from the defa...
Definition: netclass.h:228
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
#define _(s)
Definition: 3d_actions.cpp:33
int GetCopperLayerCount() const
Definition: board.cpp:435
The main frame for Pcbnew.
const wxSize GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: eda_item.h:117
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
DRAWINGS & Drawings()
Definition: board.h:306
void SetEnabledLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings Changes the bit-mask of ena...
Definition: board.cpp:467
TRACKS & Tracks()
Definition: board.h:300
Definition: track.h:83

References _, PCB_TOOL_BASE::board(), BOARD::BuildConnectivity(), BOARD::BuildListOfNets(), NETCLASSES::Clear(), DisplayError(), BOARD::Drawings(), PCB_TOOL_BASE::footprint(), BOARD::Footprints(), Format(), BOARD::GetCopperLayerCount(), PCB_BASE_FRAME::GetDesignSettings(), BOARD::GetEnabledLayers(), BOARD_DESIGN_SETTINGS::GetNetClasses(), PCB_BASE_FRAME::GetPageSizeIU(), BOARD::GetProperties(), BOARD::Groups(), PLUGIN::Load(), m_frame, placeBoardItems(), BOARD::SetCopperLayerCount(), BOARD::SetEnabledLayers(), EDA_ITEM::SetFlags(), BOARD::SetProperties(), BOARD::SetVisibleLayers(), SKIP_STRUCT, BOARD::SynchronizeNetsAndNetClasses(), BOARD::Tracks(), IO_ERROR::What(), and BOARD::Zones().

Referenced by AppendBoardFromFile().

◆ AppendBoardFromFile()

int PCB_CONTROL::AppendBoardFromFile ( const TOOL_EVENT aEvent)

Definition at line 744 of file pcb_control.cpp.

745 {
746  int open_ctl;
747  wxString fileName;
748 
749  PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
750 
751  if( !editFrame )
752  return 1;
753 
754  // Pick a file to append
755  if( !AskLoadBoardFileName( editFrame, &open_ctl, &fileName, true ) )
756  return 1;
757 
758  IO_MGR::PCB_FILE_T pluginType = plugin_type( fileName, open_ctl );
759  PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
760 
761  return AppendBoard( *pi, fileName );
762 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
Releases a PLUGIN in the context of a potential thrown exception through its destructor.
Definition: io_mgr.h:545
int AppendBoard(PLUGIN &pi, wxString &fileName)
bool AskLoadBoardFileName(PCB_EDIT_FRAME *aParent, int *aCtl, wxString *aFileName, bool aKicadFilesOnly=false)
Show a wxFileDialog asking for a BOARD filename to open.
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Return a PLUGIN which the caller can use to import, export, save, or load design documents.
Definition: io_mgr.cpp:58
The main frame for Pcbnew.
PCB_FILE_T
The set of file types that the IO_MGR knows about, and for which there has been a plugin written.
Definition: io_mgr.h:52
IO_MGR::PCB_FILE_T plugin_type(const wxString &aFileName, int aCtl)

References AppendBoard(), AskLoadBoardFileName(), m_frame, plugin_type(), and IO_MGR::PluginFind().

Referenced by setTransitions().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Set the TOOL_MANAGER the tool will belong to.

Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

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

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ board()

BOARD* PCB_TOOL_BASE::board ( ) const
inlineprotectedinherited

Definition at line 160 of file pcb_tool_base.h.

160 { return getModel<BOARD>(); }

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

◆ canvas()

◆ controls()

◆ DeleteItemCursor()

int PCB_CONTROL::DeleteItemCursor ( const TOOL_EVENT aEvent)

Definition at line 463 of file pcb_control.cpp.

464 {
466  return 0;
467 
468  std::string tool = aEvent.GetCommandStr().get();
470 
471  m_pickerItem = nullptr;
473 
474  // Deactivate other tools; particularly important if another PICKER is currently running
475  Activate();
476 
477  picker->SetCursor( KICURSOR::REMOVE );
478 
479  picker->SetClickHandler(
480  [this] ( const VECTOR2D& aPosition ) -> bool
481  {
482  if( m_pickerItem )
483  {
485  {
486  STATUS_TEXT_POPUP statusPopup( m_frame );
487  statusPopup.SetText( _( "Item locked." ) );
488  statusPopup.PopupFor( 2000 );
489  statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
490  return true;
491  }
492 
494  selectionTool->UnbrightenItem( m_pickerItem );
495  selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
497  m_pickerItem = nullptr;
498  }
499 
500  return true;
501  } );
502 
503  picker->SetMotionHandler(
504  [this] ( const VECTOR2D& aPos )
505  {
506  BOARD* board = m_frame->GetBoard();
509  GENERAL_COLLECTOR collector;
510  collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
511 
512  if( m_isFootprintEditor )
513  collector.Collect( board, GENERAL_COLLECTOR::FootprintItems, (wxPoint) aPos, guide );
514  else
515  collector.Collect( board, GENERAL_COLLECTOR::BoardLevelItems, (wxPoint) aPos, guide );
516 
517  // Remove unselectable items
518  for( int i = collector.GetCount() - 1; i >= 0; --i )
519  {
520  if( !selectionTool->Selectable( collector[ i ] ) )
521  collector.Remove( i );
522  }
523 
524  if( collector.GetCount() > 1 )
525  selectionTool->GuessSelectionCandidates( collector, aPos );
526 
527  BOARD_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr;
528 
529  if( m_pickerItem != item )
530  {
531 
532  if( m_pickerItem )
533  selectionTool->UnbrightenItem( m_pickerItem );
534 
535  m_pickerItem = item;
536 
537  if( m_pickerItem )
538  selectionTool->BrightenItem( m_pickerItem );
539  }
540  } );
541 
542  picker->SetFinalizeHandler(
543  [this] ( const int& aFinalState )
544  {
545  if( m_pickerItem )
547 
548  // Ensure the cursor gets changed&updated
550  m_frame->GetCanvas()->Refresh();
551  } );
552 
553  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
554 
555  return 0;
556 }
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:63
static const KICAD_T FootprintItems[]
A scan list for primary footprint items.
Definition: collectors.h:294
static const KICAD_T BoardLevelItems[]
A scan list for all primary board items, omitting items which are subordinate to a FOOTPRINT,...
Definition: collectors.h:279
int m_Threshold
Definition: collector.h:248
BOARD_ITEM * m_pickerItem
Definition: pcb_control.h:121
BOARD * board() const
static TOOL_ACTION doDelete
Definition: actions.h:75
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
void Collect(BOARD_ITEM *aItem, const KICAD_T aScanList[], const wxPoint &aRefPos, const COLLECTORS_GUIDE &aGuide)
Scan a BOARD_ITEM using this class's Inspector method, which does the collection.
Definition: collectors.cpp:567
Extension of STATUS_POPUP for displaying a single line text.
Definition: status_popup.h:79
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:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
void SetFinalizeHandler(FINALIZE_HANDLER aHandler)
Set a handler for the finalize event.
Definition: picker_tool.h:100
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
Definition: collector.h:115
void SetCurrentCursor(KICURSOR cursor)
Set the current cursor shape for this panel.
static TOOL_ACTION pickerTool
Definition: actions.h:158
#define HITTEST_THRESHOLD_PIXELS
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:87
void UnbrightenItem(BOARD_ITEM *aItem)
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide()
FOOTPRINT * GetFirstFootprint() const
Gets the first footprint on the board or nullptr.
Definition: board.h:380
void AddItemToSel(BOARD_ITEM *aItem, bool aQuietMode=false)
Select all items on the board.
void SetMotionHandler(MOTION_HANDLER aHandler)
Set a handler for mouse motion.
Definition: picker_tool.h:80
bool Selectable(const BOARD_ITEM *aItem, bool checkVisibilityOnly=false) const
Check conditions for an item to be selected.
void BrightenItem(BOARD_ITEM *aItem)
bool m_isFootprintEditor
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
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...
void SetCursor(KICURSOR aCursor)
Definition: picker_tool.h:60
Generic tool for picking an item.
void SetClickHandler(CLICK_HANDLER aHandler)
Set a handler for mouse click event.
Definition: picker_tool.h:69
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:471
virtual bool IsLocked() const
Definition: board_item.h:249
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
#define _(s)
Definition: 3d_actions.cpp:33
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:241
The selection tool: currently supports:
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
void Activate()
Run the tool.
BOARD * GetBoard() const
A general implementation of a COLLECTORS_GUIDE.
Definition: collectors.h:381
void GuessSelectionCandidates(GENERAL_COLLECTOR &aCollector, const VECTOR2I &aWhere) const
Try to guess best selection candidates in case multiple items are clicked, by doing some brain-dead h...

References _, TOOL_INTERACTIVE::Activate(), PCB_SELECTION_TOOL::AddItemToSel(), ARROW, PCB_TOOL_BASE::board(), GENERAL_COLLECTOR::BoardLevelItems, PCB_SELECTION_TOOL::BrightenItem(), GENERAL_COLLECTOR::Collect(), ACTIONS::doDelete, GENERAL_COLLECTOR::FootprintItems, PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetCollectorsGuide(), TOOL_EVENT::GetCommandStr(), COLLECTOR::GetCount(), BOARD::GetFirstFootprint(), TOOL_MANAGER::GetTool(), TOOL_BASE::getView(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), HITTEST_THRESHOLD_PIXELS, BOARD_ITEM::IsLocked(), KiROUND(), m_frame, PCB_TOOL_BASE::m_isFootprintEditor, m_pickerItem, COLLECTOR::m_Threshold, TOOL_BASE::m_toolMgr, STATUS_POPUP::Move(), ACTIONS::pickerTool, STATUS_POPUP::PopupFor(), EDA_DRAW_PANEL_GAL::Refresh(), REMOVE, COLLECTOR::Remove(), TOOL_MANAGER::RunAction(), PCB_SELECTION_TOOL::Selectable(), PCB_ACTIONS::selectionClear, PICKER_TOOL_BASE::SetClickHandler(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), PICKER_TOOL_BASE::SetCursor(), PICKER_TOOL_BASE::SetFinalizeHandler(), PICKER_TOOL_BASE::SetMotionHandler(), STATUS_TEXT_POPUP::SetText(), and PCB_SELECTION_TOOL::UnbrightenItem().

Referenced by setTransitions().

◆ displayOptions()

const PCB_DISPLAY_OPTIONS & PCB_TOOL_BASE::displayOptions ( ) const
protectedinherited

Definition at line 290 of file pcb_tool_base.cpp.

291 {
292  return frame()->GetDisplayOptions();
293 }
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
PCB_BASE_EDIT_FRAME * frame() const

References PCB_TOOL_BASE::frame(), and PCB_BASE_FRAME::GetDisplayOptions().

Referenced by BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), HighContrastMode(), HighContrastModeCycle(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PNS::TOOL_BASE::pickSingleItem(), ToggleRatsnest(), TrackDisplayMode(), ViaDisplayMode(), and ZoneDisplayMode().

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

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

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

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

◆ DoSetGridOrigin()

void PCB_CONTROL::DoSetGridOrigin ( KIGFX::VIEW aView,
PCB_BASE_FRAME aFrame,
EDA_ITEM originViewItem,
const VECTOR2D aPoint 
)
static

Definition at line 405 of file pcb_control.cpp.

407 {
408  aFrame->GetDesignSettings().m_GridOrigin = (wxPoint) aPoint;
409  aView->GetGAL()->SetGridOrigin( aPoint );
410  originViewItem->SetPosition( (wxPoint) aPoint );
411  aView->MarkDirty();
412  aFrame->OnModify();
413 }
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
wxPoint m_GridOrigin
origin for grid offsets
virtual void SetPosition(const wxPoint &aPos)
Definition: eda_item.h:302
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:189
void SetGridOrigin(const VECTOR2D &aGridOrigin)
Set the origin point for the grid.
virtual void OnModify()
Must be called after a change in order to set the "modify" flag of the current screen and update the ...
void MarkDirty()
Force redraw of view on the next rendering.
Definition: view.h:598

References PCB_BASE_FRAME::GetDesignSettings(), KIGFX::VIEW::GetGAL(), BOARD_DESIGN_SETTINGS::m_GridOrigin, KIGFX::VIEW::MarkDirty(), PCB_BASE_FRAME::OnModify(), KIGFX::GAL::SetGridOrigin(), and EDA_ITEM::SetPosition().

Referenced by GridResetOrigin(), GridSetOrigin(), and PCB_BASE_EDIT_FRAME::PutDataInPreviousState().

◆ FlipPcbView()

int PCB_CONTROL::FlipPcbView ( const TOOL_EVENT aEvent)

Definition at line 1116 of file pcb_control.cpp.

1117 {
1118  view()->SetMirror( !view()->IsMirroredX(), false );
1119  view()->RecacheAllItems();
1120  frame()->GetCanvas()->ForceRefresh();
1122  return 0;
1123 }
void ForceRefresh()
Force a redraw.
virtual void OnDisplayOptionsChanged()
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1372
void SetMirror(bool aMirrorX, bool aMirrorY)
Control the mirroring of the VIEW.
Definition: view.cpp:540
PCB_BASE_EDIT_FRAME * frame() const
KIGFX::PCB_VIEW * view() const

References EDA_DRAW_PANEL_GAL::ForceRefresh(), PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::OnDisplayOptionsChanged(), KIGFX::VIEW::RecacheAllItems(), KIGFX::VIEW::SetMirror(), and PCB_TOOL_BASE::view().

Referenced by setTransitions().

◆ footprint()

◆ frame()

PCB_BASE_EDIT_FRAME* PCB_TOOL_BASE::frame ( ) const
inlineprotectedinherited

Definition at line 155 of file pcb_tool_base.h.

156  {
157  return getEditFrame<PCB_BASE_EDIT_FRAME>();
158  }

Referenced by PCB_POINT_EDITOR::addCorner(), AUTOPLACE_TOOL::autoplace(), PCB_TOOL_BASE::canvas(), ZONE_FILLER_TOOL::CheckAllZones(), PNS::TOOL_BASE::checkSnap(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), ROUTER_TOOL::CustomTrackWidthDialog(), FOOTPRINT_EDITOR_CONTROL::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::EditPad(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), BOARD_EDITOR_CONTROL::ExportSpecctraDSN(), ZONE_FILLER_TOOL::FillAllZones(), EDIT_TOOL::FilletTracks(), ROUTER_TOOL::finishInteractive(), EDIT_TOOL::Flip(), FlipPcbView(), GLOBAL_EDIT_TOOL::GlobalDeletions(), ROUTER_TOOL::handleLayerSwitch(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), BOARD_EDITOR_CONTROL::ImportSpecctraSession(), ROUTER_TOOL::Init(), PCB_SELECTION_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::MoveExact(), PCB_POINT_EDITOR::OnSelectionChange(), Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PAD_TOOL::pushPadSettings(), PAD_TOOL::recombinePad(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), PCB_SELECTION_TOOL::RequestSelection(), PNS::TOOL_BASE::Reset(), ROUTER_TOOL::SelectCopperLayerPair(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), PCB_POINT_EDITOR::setEditedPoint(), ROUTER_TOOL::SettingsDialog(), GLOBAL_EDIT_TOOL::swapBoardItem(), GLOBAL_EDIT_TOOL::SwapLayers(), ROUTER_TOOL::switchLayerOnViaPlacement(), BOARD_EDITOR_CONTROL::UpdateSchematicFromPCB(), ZONE_FILLER_TOOL::ZoneFill(), and ZONE_FILLER_TOOL::ZoneFillAll().

◆ getEditFrame()

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

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

Definition at line 185 of file tool_base.h.

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

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 121 of file tool_base.h.

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

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 144 of file tool_base.h.

145  {
146  return m_toolMgr;
147  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215

References TOOL_BASE::m_toolMgr.

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

◆ getModel()

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

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 197 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Return the name of the tool.

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

Returns
The name of the tool.

Definition at line 134 of file tool_base.h.

135  {
136  return m_toolName;
137  }
std::string m_toolName
Definition: tool_base.h:214

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

Return 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
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:207

References TOOL_BASE::m_type.

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

◆ getView()

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

Returns the instance of #VIEW object used in the application.

It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

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

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

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

◆ getViewControls()

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

Return the instance of VIEW_CONTROLS object used in the application.

It allows tools to read & modify user input and its settings (eg. show cursor, enable snapping to grid, etc.).

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

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

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

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

◆ Go()

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

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

No conditions means any event.

Definition at line 128 of file tool_interactive.h.

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

References TOOL_INTERACTIVE::goInternal().

Referenced by AUTOPLACE_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), BOARD_REANNOTATE_TOOL::setTransitions(), GERBVIEW_INSPECTION_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), PCB_PICKER_TOOL::setTransitions(), SCH_NAVIGATE_TOOL::setTransitions(), SYMBOL_EDITOR_PIN_TOOL::setTransitions(), SYMBOL_EDITOR_MOVE_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), PL_POINT_EDITOR::setTransitions(), COMMON_CONTROL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), CONVERT_TOOL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), MICROWAVE_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PCB_POINT_EDITOR::setTransitions(), GERBVIEW_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), setTransitions(), EDA_3D_CONTROLLER::setTransitions(), DRC_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), PCB_SELECTION_TOOL::setTransitions(), DRAWING_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ GridResetOrigin()

int PCB_CONTROL::GridResetOrigin ( const TOOL_EVENT aEvent)

Definition at line 452 of file pcb_control.cpp.

453 {
455  DoSetGridOrigin( getView(), m_frame, m_gridOrigin.get(), VECTOR2D( 0, 0 ) );
456  return 0;
457 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
static void DoSetGridOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, EDA_ITEM *originViewItem, const VECTOR2D &aPoint)
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Definition: pcb_control.h:119
virtual void SaveCopyInUndoList(EDA_ITEM *aItemToCopy, UNDO_REDO aTypeCommand)=0
Create a new entry in undo list of commands.

References DoSetGridOrigin(), TOOL_BASE::getView(), GRIDORIGIN, m_frame, m_gridOrigin, and PCB_BASE_FRAME::SaveCopyInUndoList().

Referenced by setTransitions().

◆ GridSetOrigin()

int PCB_CONTROL::GridSetOrigin ( const TOOL_EVENT aEvent)

Definition at line 416 of file pcb_control.cpp.

417 {
418  VECTOR2D* origin = aEvent.Parameter<VECTOR2D*>();
419 
420  if( origin )
421  {
422  // We can't undo the other grid dialog settings, so no sense undoing just the origin
423  DoSetGridOrigin( getView(), m_frame, m_gridOrigin.get(), *origin );
424  delete origin;
425  }
426  else
427  {
428  if( m_isFootprintEditor && !getEditFrame<PCB_BASE_EDIT_FRAME>()->GetModel() )
429  return 0;
430 
431  std::string tool = aEvent.GetCommandStr().get();
433 
434  // Deactivate other tools; particularly important if another PICKER is currently running
435  Activate();
436 
437  picker->SetClickHandler(
438  [this] ( const VECTOR2D& pt ) -> bool
439  {
441  DoSetGridOrigin( getView(), m_frame, m_gridOrigin.get(), pt );
442  return false; // drill origin is a one-shot; don't continue with tool
443  } );
444 
445  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
446  }
447 
448  return 0;
449 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
static TOOL_ACTION pickerTool
Definition: actions.h:158
static void DoSetGridOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, EDA_ITEM *originViewItem, const VECTOR2D &aPoint)
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:443
bool m_isFootprintEditor
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
Generic tool for picking an item.
void SetClickHandler(CLICK_HANDLER aHandler)
Set a handler for mouse click event.
Definition: picker_tool.h:69
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:471
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Definition: pcb_control.h:119
virtual void SaveCopyInUndoList(EDA_ITEM *aItemToCopy, UNDO_REDO aTypeCommand)=0
Create a new entry in undo list of commands.
void Activate()
Run the tool.

References TOOL_INTERACTIVE::Activate(), DoSetGridOrigin(), TOOL_EVENT::GetCommandStr(), TOOL_MANAGER::GetTool(), TOOL_BASE::getView(), GRIDORIGIN, m_frame, m_gridOrigin, PCB_TOOL_BASE::m_isFootprintEditor, TOOL_BASE::m_toolMgr, TOOL_EVENT::Parameter(), ACTIONS::pickerTool, TOOL_MANAGER::RunAction(), PCB_BASE_FRAME::SaveCopyInUndoList(), and PICKER_TOOL_BASE::SetClickHandler().

Referenced by setTransitions().

◆ HighContrastMode()

int PCB_CONTROL::HighContrastMode ( const TOOL_EVENT aEvent)

Definition at line 221 of file pcb_control.cpp.

222 {
223  auto opts = displayOptions();
224 
225  opts.m_ContrastModeDisplay =
226  ( opts.m_ContrastModeDisplay == HIGH_CONTRAST_MODE::NORMAL ) ?
229 
230  m_frame->SetDisplayOptions( opts );
231 
232  return 0;
233 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Non-active layers are dimmed (old high-contrast mode)
Non-active layers are shown normally (no high-contrast mode)
const PCB_DISPLAY_OPTIONS & displayOptions() const

References DIMMED, PCB_TOOL_BASE::displayOptions(), m_frame, NORMAL, and PCB_BASE_FRAME::SetDisplayOptions().

Referenced by setTransitions().

◆ HighContrastModeCycle()

int PCB_CONTROL::HighContrastModeCycle ( const TOOL_EVENT aEvent)

Definition at line 236 of file pcb_control.cpp.

237 {
238  auto opts = displayOptions();
239 
240  switch( opts.m_ContrastModeDisplay )
241  {
243  opts.m_ContrastModeDisplay = HIGH_CONTRAST_MODE::DIMMED;
244  break;
245 
247  opts.m_ContrastModeDisplay = HIGH_CONTRAST_MODE::HIDDEN;
248  break;
249 
251  opts.m_ContrastModeDisplay = HIGH_CONTRAST_MODE::NORMAL;
252  break;
253  }
254 
255  m_frame->SetDisplayOptions( opts );
256 
257  return 0;
258 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Non-active layers are dimmed (old high-contrast mode)
Non-active layers are shown normally (no high-contrast mode)
const PCB_DISPLAY_OPTIONS & displayOptions() const
Non-active layers are hidden.

References DIMMED, PCB_TOOL_BASE::displayOptions(), HIDDEN, m_frame, NORMAL, and PCB_BASE_FRAME::SetDisplayOptions().

Referenced by setTransitions().

◆ Init()

bool PCB_TOOL_BASE::Init ( void  )
overridevirtualinherited

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

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

Reimplemented from TOOL_BASE.

Reimplemented in EDIT_TOOL, PCB_SELECTION_TOOL, BOARD_INSPECTION_TOOL, DRAWING_TOOL, POSITION_RELATIVE_TOOL, BOARD_EDITOR_CONTROL, PCB_POINT_EDITOR, FOOTPRINT_EDITOR_CONTROL, GLOBAL_EDIT_TOOL, GROUP_TOOL, PAD_TOOL, BOARD_REANNOTATE_TOOL, LENGTH_TUNER_TOOL, and ROUTER_TOOL.

Definition at line 264 of file pcb_tool_base.cpp.

265 {
266  // A basic context manu. Many (but not all) tools will choose to override this.
267  CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
268 
269  // cancel current tool goes in main context menu at the top if present
271  ctxMenu.AddSeparator( 1 );
272 
273  // Finally, add the standard zoom/grid items
274  getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus( m_menu );
275 
276  return true;
277 }
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
void AddSeparator(int aOrder=ANY_ORDER)
Add a separator to the menu.
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.

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

◆ IsFootprintEditor()

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

32 {
33  return m_toolMgr->IsToolActive( m_toolId );
34 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210
bool IsToolActive(TOOL_ID aId) const
Return true if a tool with given id is active (executing)

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

Referenced by ROUTER_TOOL::handleLayerSwitch(), EDIT_TOOL::isRouterActive(), PCB_SELECTION_TOOL::Main(), BOARD_EDITOR_CONTROL::TrackWidthDec(), and BOARD_EDITOR_CONTROL::TrackWidthInc().

◆ LayerAlphaDec()

int PCB_CONTROL::LayerAlphaDec ( const TOOL_EVENT aEvent)

Definition at line 374 of file pcb_control.cpp.

375 {
376  auto settings = m_frame->GetColorSettings();
377 
378  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
379  KIGFX::COLOR4D currentColor = settings->GetColor( currentLayer );
380 
381  if( currentColor.a >= ALPHA_MIN + ALPHA_STEP )
382  {
383  currentColor.a -= ALPHA_STEP;
384  settings->SetColor( currentLayer, currentColor );
386 
388  view->UpdateLayerColor( currentLayer );
389  view->UpdateLayerColor( GetNetnameLayer( currentLayer ) );
390 
391  if( IsCopperLayer( currentLayer ) )
392  view->UpdateLayerColor( ZONE_LAYER_FOR( currentLayer ) );
393 
394  wxUpdateUIEvent dummy;
395  static_cast<PCB_BASE_FRAME*>( m_frame )->OnUpdateLayerAlpha( dummy );
396  }
397  else
398  wxBell();
399 
400  return 0;
401 }
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
#define ZONE_LAYER_FOR(copperLayer)
Macro for getting the zone layer for a given copper layer.
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
#define ALPHA_MIN
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
Definition: sch_symbol.cpp:69
virtual COLOR_SETTINGS * GetColorSettings() const override
Helper to retrieve the current color settings.
virtual PCB_LAYER_ID GetActiveLayer() const
double a
Alpha component.
Definition: color4d.h:361
KIGFX::PCB_VIEW * view() const
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void UpdateColors()
Update the color settings in the painter and GAL.
int LAYER_NUM
This can be replaced with int and removed.
void UpdateLayerColor(int aLayer)
Apply the new coloring scheme held by RENDER_SETTINGS in case that it has changed.
Definition: view.cpp:749
#define ALPHA_STEP
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98

References KIGFX::COLOR4D::a, ALPHA_MIN, ALPHA_STEP, dummy(), PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetColorSettings(), GetNetnameLayer(), PCB_DRAW_PANEL_GAL::GetView(), IsCopperLayer(), m_frame, PCB_DRAW_PANEL_GAL::UpdateColors(), KIGFX::VIEW::UpdateLayerColor(), PCB_TOOL_BASE::view(), and ZONE_LAYER_FOR.

Referenced by setTransitions().

◆ LayerAlphaInc()

int PCB_CONTROL::LayerAlphaInc ( const TOOL_EVENT aEvent)

Definition at line 344 of file pcb_control.cpp.

345 {
346  auto settings = m_frame->GetColorSettings();
347 
348  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
349  KIGFX::COLOR4D currentColor = settings->GetColor( currentLayer );
350 
351  if( currentColor.a <= ALPHA_MAX - ALPHA_STEP )
352  {
353  currentColor.a += ALPHA_STEP;
354  settings->SetColor( currentLayer, currentColor );
356 
358  view->UpdateLayerColor( currentLayer );
359  view->UpdateLayerColor( GetNetnameLayer( currentLayer ) );
360 
361  if( IsCopperLayer( currentLayer ) )
362  view->UpdateLayerColor( ZONE_LAYER_FOR( currentLayer ) );
363 
364  wxUpdateUIEvent dummy;
365  static_cast<PCB_EDIT_FRAME*>( m_frame )->OnUpdateLayerAlpha( dummy );
366  }
367  else
368  wxBell();
369 
370  return 0;
371 }
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
#define ZONE_LAYER_FOR(copperLayer)
Macro for getting the zone layer for a given copper layer.
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
Definition: sch_symbol.cpp:69
virtual COLOR_SETTINGS * GetColorSettings() const override
Helper to retrieve the current color settings.
virtual PCB_LAYER_ID GetActiveLayer() const
double a
Alpha component.
Definition: color4d.h:361
#define ALPHA_MAX
KIGFX::PCB_VIEW * view() const
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void UpdateColors()
Update the color settings in the painter and GAL.
int LAYER_NUM
This can be replaced with int and removed.
void UpdateLayerColor(int aLayer)
Apply the new coloring scheme held by RENDER_SETTINGS in case that it has changed.
Definition: view.cpp:749
#define ALPHA_STEP
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98

References KIGFX::COLOR4D::a, ALPHA_MAX, ALPHA_STEP, dummy(), PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetColorSettings(), GetNetnameLayer(), PCB_DRAW_PANEL_GAL::GetView(), IsCopperLayer(), m_frame, PCB_DRAW_PANEL_GAL::UpdateColors(), KIGFX::VIEW::UpdateLayerColor(), PCB_TOOL_BASE::view(), and ZONE_LAYER_FOR.

Referenced by setTransitions().

◆ LayerNext()

int PCB_CONTROL::LayerNext ( const TOOL_EVENT aEvent)

Definition at line 270 of file pcb_control.cpp.

271 {
272  PCB_BASE_FRAME* editFrame = m_frame;
273  BOARD* brd = board();
274  LAYER_NUM layer = editFrame->GetActiveLayer();
275  LAYER_NUM startLayer = layer;
276 
277  if( layer < F_Cu || layer > B_Cu )
278  return 0;
279 
280  while( startLayer != ++layer )
281  {
282  if( brd->IsLayerVisible( static_cast<PCB_LAYER_ID>( layer ) ) && IsCopperLayer( layer ) )
283  break;
284 
285  if( layer >= B_Cu )
286  layer = F_Cu - 1;
287  }
288 
289  wxCHECK( IsCopperLayer( layer ), 0 );
290  editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
291 
292  return 0;
293 }
BOARD * board() const
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
virtual PCB_LAYER_ID GetActiveLayer() const
#define NULL
int LAYER_NUM
This can be replaced with int and removed.
virtual void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer)
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
Definition: board.cpp:453
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:905
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.

References B_Cu, PCB_TOOL_BASE::board(), F_Cu, PCB_BASE_FRAME::GetActiveLayer(), IsCopperLayer(), BOARD::IsLayerVisible(), m_frame, NULL, PCB_BASE_FRAME::SwitchLayer(), and ToLAYER_ID().

Referenced by setTransitions().

◆ LayerPrev()

int PCB_CONTROL::LayerPrev ( const TOOL_EVENT aEvent)

Definition at line 296 of file pcb_control.cpp.

297 {
298  PCB_BASE_FRAME* editFrame = m_frame;
299  BOARD* brd = board();
300  LAYER_NUM layer = editFrame->GetActiveLayer();
301  LAYER_NUM startLayer = layer;
302 
303  if( layer < F_Cu || layer > B_Cu )
304  return 0;
305 
306  while( startLayer != --layer )
307  {
308  if( IsCopperLayer( layer ) // also test for valid layer id (layer >= F_Cu)
309  && brd->IsLayerVisible( static_cast<PCB_LAYER_ID>( layer ) ) )
310  break;
311 
312  if( layer <= F_Cu )
313  layer = B_Cu + 1;
314  }
315 
316 
317  wxCHECK( IsCopperLayer( layer ), 0 );
318  editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
319 
320  return 0;
321 }
BOARD * board() const
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
virtual PCB_LAYER_ID GetActiveLayer() const
#define NULL
int LAYER_NUM
This can be replaced with int and removed.
virtual void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer)
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
Definition: board.cpp:453
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:905
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.

References B_Cu, PCB_TOOL_BASE::board(), F_Cu, PCB_BASE_FRAME::GetActiveLayer(), IsCopperLayer(), BOARD::IsLayerVisible(), m_frame, NULL, PCB_BASE_FRAME::SwitchLayer(), and ToLAYER_ID().

Referenced by setTransitions().

◆ LayerSwitch()

int PCB_CONTROL::LayerSwitch ( const TOOL_EVENT aEvent)

Definition at line 262 of file pcb_control.cpp.

263 {
265 
266  return 0;
267 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
PCB_LAYER_ID
A quick note on layer IDs:
#define NULL
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:443
virtual void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer)

References m_frame, NULL, TOOL_EVENT::Parameter(), and PCB_BASE_FRAME::SwitchLayer().

Referenced by setTransitions().

◆ LayerToggle()

int PCB_CONTROL::LayerToggle ( const TOOL_EVENT aEvent)

Definition at line 324 of file pcb_control.cpp.

325 {
326  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
327  PCB_SCREEN* screen = m_frame->GetScreen();
328 
329  if( currentLayer == screen->m_Route_Layer_TOP )
331  else
333 
334  return 0;
335 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
virtual PCB_LAYER_ID GetActiveLayer() const
#define NULL
PCB_LAYER_ID m_Route_Layer_BOTTOM
Definition: pcb_screen.h:44
int LAYER_NUM
This can be replaced with int and removed.
virtual void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer)
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
PCB_LAYER_ID m_Route_Layer_TOP
Definition: pcb_screen.h:43

References PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetScreen(), m_frame, PCB_SCREEN::m_Route_Layer_BOTTOM, PCB_SCREEN::m_Route_Layer_TOP, NULL, and PCB_BASE_FRAME::SwitchLayer().

Referenced by setTransitions().

◆ Paste()

int PCB_CONTROL::Paste ( const TOOL_EVENT aEvent)

Definition at line 624 of file pcb_control.cpp.

625 {
626  CLIPBOARD_IO pi;
627  BOARD_ITEM* clipItem = pi.Parse();
628 
629  if( !clipItem )
630  return 0;
631 
632  // The viewer frames cannot paste
633  if( !frame()->IsType( FRAME_FOOTPRINT_EDITOR ) && !frame()->IsType( FRAME_PCB_EDITOR ) )
634  return 0;
635 
636  bool isFootprintEditor = m_isFootprintEditor || frame()->IsType( FRAME_FOOTPRINT_EDITOR );
637 
638  if( clipItem->Type() == PCB_T )
639  {
640  if( isFootprintEditor )
641  {
642  for( BOARD_CONNECTED_ITEM* item : static_cast<BOARD*>( clipItem )->AllConnectedItems() )
643  item->SetNet( NETINFO_LIST::OrphanedItem() );
644  }
645  else
646  {
647  static_cast<BOARD*>( clipItem )->MapNets( m_frame->GetBoard() );
648  }
649  }
650 
651  // The clipboard can contain two different things, an entire kicad_pcb or a single footprint
652  if( isFootprintEditor && ( !board() || !footprint() ) )
653  {
654  return 0;
655  }
656 
657  switch( clipItem->Type() )
658  {
659  case PCB_T:
660  {
661  BOARD* clipBoard = static_cast<BOARD*>( clipItem );
662 
663  if( isFootprintEditor )
664  {
665  FOOTPRINT* editorFootprint = board()->GetFirstFootprint();
666  std::vector<BOARD_ITEM*> pastedItems;
667 
668  for( FOOTPRINT* clipFootprint : clipBoard->Footprints() )
669  pasteFootprintItemsToFootprintEditor( clipFootprint, board(), pastedItems );
670 
671  for( BOARD_ITEM* clipDrawItem : clipBoard->Drawings() )
672  {
673  if( clipDrawItem->Type() == PCB_SHAPE_T )
674  {
675  PCB_SHAPE* clipShape = static_cast<PCB_SHAPE*>( clipDrawItem );
676 
677  // Convert to PCB_FP_SHAPE_T
678  FP_SHAPE* pastedShape = new FP_SHAPE( editorFootprint );
679  static_cast<PCB_SHAPE*>( pastedShape )->SwapData( clipShape );
680  pastedShape->SetLocalCoord();
681 
682  // Replace parent nuked by above call to SwapData()
683  pastedShape->SetParent( editorFootprint );
684  pastedItems.push_back( pastedShape );
685  }
686  else if( clipDrawItem->Type() == PCB_TEXT_T )
687  {
688  PCB_TEXT* clipTextItem = static_cast<PCB_TEXT*>( clipDrawItem );
689 
690  // Convert to PCB_FP_TEXT_T
691  FP_TEXT* pastedTextItem = new FP_TEXT( editorFootprint );
692  static_cast<EDA_TEXT*>( pastedTextItem )->SwapText( *clipTextItem );
693  static_cast<EDA_TEXT*>( pastedTextItem )->SwapEffects( *clipTextItem );
694 
695  pastedTextItem->SetParent( editorFootprint );
696  pastedItems.push_back( pastedTextItem );
697  }
698  }
699 
700  delete clipBoard;
701 
702  placeBoardItems( pastedItems, true, true );
703  }
704  else
705  {
706  placeBoardItems( clipBoard, true );
707 
709  m_frame->Compile_Ratsnest( true );
710  }
711 
712  break;
713  }
714 
715  case PCB_FOOTPRINT_T:
716  {
717  FOOTPRINT* clipFootprint = static_cast<FOOTPRINT*>( clipItem );
718  std::vector<BOARD_ITEM*> pastedItems;
719 
720  if( isFootprintEditor )
721  {
722  pasteFootprintItemsToFootprintEditor( clipFootprint, board(), pastedItems );
723  delete clipFootprint;
724  }
725  else
726  {
727  clipFootprint->SetParent( board() );
728  pastedItems.push_back( clipFootprint );
729  }
730 
731  placeBoardItems( pastedItems, true, true );
732  break;
733  }
734 
735  default:
736  m_frame->DisplayToolMsg( _( "Invalid clipboard contents" ) );
737  break;
738  }
739 
740  return 1;
741 }
BOARD_ITEM * Parse()
Definition: typeinfo.h:84
static NETINFO_ITEM * OrphanedItem()
Wrapper class, so you can iterate through NETINFO_ITEM*s, not std::pair<int/wxString,...
Definition: netinfo.h:373
BOARD * board() const
void Compile_Ratsnest(bool aDisplayStatus)
Create the entire board ratsnest.
Definition: ratsnest.cpp:41
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
int placeBoardItems(std::vector< BOARD_ITEM * > &aItems, bool aIsNew, bool aAnchorAtOrigin)
Add and select or just select for move/place command a list of board items.
class PCB_TEXT, text on a layer
Definition: typeinfo.h:91
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:165
PCB_BASE_EDIT_FRAME * frame() const
FOOTPRINT * GetFirstFootprint() const
Gets the first footprint on the board or nullptr.
Definition: board.h:380
FOOTPRINTS & Footprints()
Definition: board.h:303
FOOTPRINT * footprint() const
void BuildConnectivity()
Builds or rebuilds the board connectivity database for the board, especially the list of connected it...
Definition: board.cpp:133
bool m_isFootprintEditor
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
static void pasteFootprintItemsToFootprintEditor(FOOTPRINT *aClipFootprint, BOARD *aBoard, std::vector< BOARD_ITEM * > &aPastedItems)
bool IsType(FRAME_T aType) const
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
#define _(s)
Definition: 3d_actions.cpp:33
void SetLocalCoord()
Set relative coordinates from draw coordinates.
Definition: fp_shape.cpp:53
BOARD * GetBoard() const
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
DRAWINGS & Drawings()
Definition: board.h:306
void DisplayToolMsg(const wxString &msg) override
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162

References _, PCB_TOOL_BASE::board(), BOARD::BuildConnectivity(), PCB_BASE_FRAME::Compile_Ratsnest(), EDA_DRAW_FRAME::DisplayToolMsg(), BOARD::Drawings(), PCB_TOOL_BASE::footprint(), BOARD::Footprints(), PCB_TOOL_BASE::frame(), FRAME_FOOTPRINT_EDITOR, FRAME_PCB_EDITOR, PCB_BASE_FRAME::GetBoard(), BOARD::GetFirstFootprint(), EDA_BASE_FRAME::IsType(), m_frame, PCB_TOOL_BASE::m_isFootprintEditor, NETINFO_LIST::OrphanedItem(), CLIPBOARD_IO::Parse(), pasteFootprintItemsToFootprintEditor(), PCB_FOOTPRINT_T, PCB_SHAPE_T, PCB_T, PCB_TEXT_T, placeBoardItems(), FP_SHAPE::SetLocalCoord(), EDA_ITEM::SetParent(), and EDA_ITEM::Type().

Referenced by setTransitions().

◆ placeBoardItems() [1/2]

int PCB_CONTROL::placeBoardItems ( std::vector< BOARD_ITEM * > &  aItems,
bool  aIsNew,
bool  aAnchorAtOrigin 
)
private

Add and select or just select for move/place command a list of board items.

Parameters
aItemsis the list of items
aIsNew= true to add items to the current board, false to just select if items are already managed by the current board
aAnchorAtOrigin= true if the items are translated so that the anchor is {0, 0} (if false, the top-left item's origin will be used)

Definition at line 846 of file pcb_control.cpp.

848 {
850 
852  EDIT_TOOL* editTool = m_toolMgr->GetTool<EDIT_TOOL>();
853  PCB_SELECTION& selection = selectionTool->GetSelection();
854 
855  for( BOARD_ITEM* item : aItems )
856  {
857  if( aIsNew )
858  {
859  const_cast<KIID&>( item->m_Uuid ) = KIID();
860 
861  if( selectionTool->GetEnteredGroup() && !item->GetParentGroup() )
862  selectionTool->GetEnteredGroup()->AddItem( item );
863  }
864 
865  // Update item attributes if needed
866  switch( item->Type() )
867  {
868  case PCB_DIMENSION_T:
869  case PCB_DIM_ALIGNED_T:
870  case PCB_DIM_CENTER_T:
872  case PCB_DIM_LEADER_T:
873  {
874  // Dimensions need to have their units updated if they are automatic
875  DIMENSION_BASE* dim = static_cast<DIMENSION_BASE*>( item );
876 
878  dim->SetUnits( frame()->GetUserUnits() );
879 
880  break;
881  }
882 
883  case PCB_FOOTPRINT_T:
884  // Update the footprint path with the new KIID path if the footprint is new
885  if( aIsNew )
886  static_cast<FOOTPRINT*>( item )->SetPath( KIID_PATH() );
887 
888  break;
889 
890  default:
891  break;
892  }
893 
894  // Add or just select items for the move/place command
895  if( aIsNew )
896  editTool->GetCurrentCommit()->Add( item );
897  else
898  editTool->GetCurrentCommit()->Added( item );
899 
900  // Matching the logic of PCB_SELECTION_TOOL::select for PCB_GROUP_T, there
901  // is a distinction between which items are SetSelected and which are in
902  // the selection object. Top-level groups or items not in groups are
903  // added to the selection object (via selection.Add(), below), but all
904  // items have SetSelected called. This is because much of the selection
905  // management logic (e.g. move) recursively acts on groups in the
906  // selection, so descendents of groups should not be in the selection
907  // object.
908  item->SetSelected();
909 
910  if( !item->GetParentGroup() || !alg::contains( aItems, item->GetParentGroup() ) )
911  selection.Add( item );
912  }
913 
914  if( selection.Size() > 0 )
915  {
916  if( aAnchorAtOrigin )
917  {
919  }
920  else
921  {
922  BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.GetTopLeftItem() );
924  }
925 
926  getViewControls()->SetCursorPosition( getViewControls()->GetMousePosition(), false );
927 
930  }
931 
932  return 0;
933 }
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:63
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:93
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
Definition: pcb_group.cpp:38
static const TOOL_EVENT SelectedEvent
Definition: actions.h:209
static TOOL_ACTION move
move or drag an item
Definition: pcb_actions.h:96
class ALIGNED_DIMENSION, a linear dimension (graphic item)
Definition: typeinfo.h:100
class LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:101
int GetUserUnits()
Returns the currently selected user unit value for the interface.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
DIM_UNITS_MODE GetUnitsMode() const
Definition: dimension.cpp:150
class CENTER_DIMENSION, a center point marking (graphic item)
Definition: typeinfo.h:102
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Move cursor to the requested position expressed in world coordinates.
PCB_GROUP * GetEnteredGroup()
Apply the SELECTION_FILTER_OPTIONS to a collection of items.
void SetUnits(EDA_UNITS aUnits)
Definition: dimension.cpp:144
virtual wxPoint GetPosition() const
Definition: eda_item.h:301
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:77
PCB_BASE_EDIT_FRAME * frame() const
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
Definition: kiid.h:44
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:264
const PCB_SELECTION & selection() const
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
EDA_ITEM * GetTopLeftItem(bool aFootprintsOnly=false) const override
class DIMENSION_BASE: abstract dimension meta-type
Definition: typeinfo.h:99
The interactive edit tool.
Definition: edit_tool.h:64
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:81
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
int Size() const
Returns the number of selected parts.
Definition: selection.h:128
The selection tool: currently supports:
class ORTHOGONAL_DIMENSION, a linear dimension constrained to x/y
Definition: typeinfo.h:103
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
Abstract dimension API.
Definition: dimension.h:95

References SELECTION::Add(), PCB_GROUP::AddItem(), AUTOMATIC, alg::contains(), PCB_TOOL_BASE::frame(), PCB_SELECTION_TOOL::GetEnteredGroup(), BOARD_ITEM::GetParentGroup(), EDA_ITEM::GetPosition(), PCB_SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), PCB_SELECTION::GetTopLeftItem(), DIMENSION_BASE::GetUnitsMode(), GetUserUnits(), TOOL_BASE::getViewControls(), TOOL_BASE::m_toolMgr, PCB_ACTIONS::move, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_DIMENSION_T, PCB_FOOTPRINT_T, TOOL_MANAGER::ProcessEvent(), TOOL_MANAGER::RunAction(), EVENTS::SelectedEvent, PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionClear, KIGFX::VIEW_CONTROLS::SetCursorPosition(), SELECTION::SetReferencePoint(), DIMENSION_BASE::SetUnits(), and SELECTION::Size().

Referenced by AppendBoard(), Paste(), and placeBoardItems().

◆ placeBoardItems() [2/2]

int PCB_CONTROL::placeBoardItems ( BOARD aBoard,
bool  aAnchorAtOrigin 
)
private

Pointer to the currently used edit frame.

Definition at line 824 of file pcb_control.cpp.

825 {
826  // items are new if the current board is not the board source
827  bool isNew = board() != aBoard;
828  std::vector<BOARD_ITEM*> items;
829 
830  moveUnflaggedItems( aBoard->Tracks(), items, isNew );
831  moveUnflaggedItems( aBoard->Footprints(), items, isNew );
832  moveUnflaggedItems( aBoard->Drawings(), items, isNew );
833  moveUnflaggedItems( aBoard->Zones(), items, isNew );
834 
835  // Subtlety: When selecting a group via the mouse,
836  // PCB_SELECTION_TOOL::highlightInternal runs, which does a SetSelected() on all
837  // descendants. In PCB_CONTROL::placeBoardItems, below, we skip that and
838  // mark items non-recursively. That works because the saving of the
839  // selection created aBoard that has the group and all descendents in it.
840  moveUnflaggedItems( aBoard->Groups(), items, isNew );
841 
842  return placeBoardItems( items, isNew, aAnchorAtOrigin );
843 }
ZONES & Zones()
Definition: board.h:309
BOARD * board() const
int placeBoardItems(std::vector< BOARD_ITEM * > &aItems, bool aIsNew, bool aAnchorAtOrigin)
Add and select or just select for move/place command a list of board items.
GROUPS & Groups()
The groups must maintain the following invariants.
Definition: board.h:323
FOOTPRINTS & Footprints()
Definition: board.h:303
static void moveUnflaggedItems(std::deque< T > &aList, std::vector< BOARD_ITEM * > &aTarget, bool aIsNew)
DRAWINGS & Drawings()
Definition: board.h:306
TRACKS & Tracks()
Definition: board.h:300

References PCB_TOOL_BASE::board(), BOARD::Drawings(), BOARD::Footprints(), BOARD::Groups(), moveUnflaggedItems(), placeBoardItems(), BOARD::Tracks(), and BOARD::Zones().

◆ Print()

int PCB_CONTROL::Print ( const TOOL_EVENT aEvent)

Definition at line 444 of file dialog_print_pcbnew.cpp.

445 {
446  // Selection affects the origin item visibility
448 
450  DIALOG_PRINT_PCBNEW dlg( (PCB_BASE_EDIT_FRAME*) m_frame, &settings );
451 
452  if( m_isFootprintEditor )
453  dlg.ForcePrintBorder( false );
454 
455  dlg.ShowModal();
456 
457  return 0;
458 }
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:63
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
bool m_isFootprintEditor
Common, abstract interface for edit frames.
const PAGE_INFO & GetPageSettings() const override

References PCB_BASE_FRAME::GetPageSettings(), m_frame, PCB_TOOL_BASE::m_isFootprintEditor, TOOL_BASE::m_toolMgr, TOOL_MANAGER::RunAction(), and PCB_ACTIONS::selectionClear.

Referenced by setTransitions().

◆ Quit()

int PCB_CONTROL::Quit ( const TOOL_EVENT aEvent)

Definition at line 106 of file pcb_control.cpp.

107 {
108  m_frame->Close( false );
109  return 0;
110 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116

References m_frame.

Referenced by setTransitions().

◆ Redo()

int PCB_CONTROL::Redo ( const TOOL_EVENT aEvent)

Definition at line 1038 of file pcb_control.cpp.

1039 {
1040  PCB_BASE_EDIT_FRAME* editFrame = dynamic_cast<PCB_BASE_EDIT_FRAME*>( m_frame );
1041  wxCommandEvent dummy;
1042 
1043  if( editFrame )
1044  editFrame->RestoreCopyFromRedoList( dummy );
1045 
1046  return 0;
1047 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
Definition: sch_symbol.cpp:69
Common, abstract interface for edit frames.
void RestoreCopyFromRedoList(wxCommandEvent &aEvent)
Redo the last edit:
Definition: undo_redo.cpp:344

References dummy(), m_frame, and PCB_BASE_EDIT_FRAME::RestoreCopyFromRedoList().

Referenced by setTransitions().

◆ Reset()

void PCB_CONTROL::Reset ( RESET_REASON  aReason)
overridevirtual

Bring the tool to a known, initial state.

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

Parameters
aReasoncontains information about the reason of tool reset.

Reimplemented from PCB_TOOL_BASE.

Definition at line 78 of file pcb_control.cpp.

79 {
80  m_frame = getEditFrame<PCB_BASE_FRAME>();
81 
82  if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
83  {
84  m_gridOrigin->SetPosition( board()->GetDesignSettings().m_GridOrigin );
85  m_gridOrigin->SetColor( m_frame->GetGridColor() );
86  getView()->Remove( m_gridOrigin.get() );
87  getView()->Add( m_gridOrigin.get() );
88  }
89 }
BOARD * board() const
Model changes (required full reload)
Definition: tool_base.h:81
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:351
virtual COLOR4D GetGridColor()
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Definition: pcb_control.h:119
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:321
Rendering engine changes.
Definition: tool_base.h:82

References KIGFX::VIEW::Add(), PCB_TOOL_BASE::board(), TOOL_BASE::GAL_SWITCH, EDA_DRAW_FRAME::GetGridColor(), TOOL_BASE::getView(), m_frame, m_gridOrigin, TOOL_BASE::MODEL_RELOAD, and KIGFX::VIEW::Remove().

◆ RunMainStack()

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

Call a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

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

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

Referenced by DRAWING_TOOL::PlaceText().

◆ selection() [1/2]

const PCB_SELECTION & PCB_TOOL_BASE::selection ( ) const
protectedinherited

Definition at line 301 of file pcb_tool_base.cpp.

302 {
304 
305  return selTool->GetSelection();
306 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
The selection tool: currently supports:

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

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

◆ selection() [2/2]

PCB_SELECTION & PCB_TOOL_BASE::selection ( )
protectedinherited

Definition at line 309 of file pcb_tool_base.cpp.

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

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

◆ SetContextMenu()

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

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

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

Definition at line 76 of file tool_interactive.cpp.

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

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

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

◆ SetIsFootprintEditor()

void PCB_TOOL_BASE::SetIsFootprintEditor ( bool  aEnabled)
inlineinherited

Function SetIsFootprintEditor()

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

Parameters
aEnableddecides if the mode should be enabled.

Definition at line 104 of file pcb_tool_base.h.

104 { m_isFootprintEditor = aEnabled; }
bool m_isFootprintEditor

References PCB_TOOL_BASE::m_isFootprintEditor.

◆ setTransitions()

void PCB_CONTROL::setTransitions ( )
overrideprivatevirtual

< Sets up handlers for various events.

Reimplemented from PCB_TOOL_BASE.

Definition at line 1126 of file pcb_control.cpp.

1127 {
1130  Go( &PCB_CONTROL::Print, ACTIONS::print.MakeEvent() );
1131  Go( &PCB_CONTROL::Quit, ACTIONS::quit.MakeEvent() );
1132 
1133  // Display modes
1145 
1146  // Layer control
1184 
1185  // Grid control
1188 
1189  Go( &PCB_CONTROL::Undo, ACTIONS::undo.MakeEvent() );
1190  Go( &PCB_CONTROL::Redo, ACTIONS::redo.MakeEvent() );
1191 
1192  // Miscellaneous
1194 
1195  // Append control
1197 
1198  Go( &PCB_CONTROL::Paste, ACTIONS::paste.MakeEvent() );
1199 
1204 }
static TOOL_ACTION layerBottom
Definition: pcb_actions.h:286
static TOOL_ACTION layerInner26
Definition: pcb_actions.h:281
int ZoneDisplayMode(const TOOL_EVENT &aEvent)
int GridSetOrigin(const TOOL_EVENT &aEvent)
static const TOOL_EVENT SelectedEvent
Definition: actions.h:209
static TOOL_ACTION layerNext
Definition: pcb_actions.h:287
static TOOL_ACTION layerInner2
Definition: pcb_actions.h:257
int LayerAlphaDec(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner5
Definition: pcb_actions.h:260
int Redo(const TOOL_EVENT &aEvent)
int LayerNext(const TOOL_EVENT &aEvent)
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:210
static TOOL_ACTION layerInner6
Definition: pcb_actions.h:261
static TOOL_ACTION layerInner7
Definition: pcb_actions.h:262
static TOOL_ACTION layerInner8
Definition: pcb_actions.h:263
static TOOL_ACTION layerInner21
Definition: pcb_actions.h:276
static TOOL_ACTION ratsnestLineMode
Definition: pcb_actions.h:243
static TOOL_ACTION layerAlphaDec
Definition: pcb_actions.h:290
static TOOL_ACTION gridResetOrigin
Definition: actions.h:141
static TOOL_ACTION zoneDisplayOutlines
Definition: pcb_actions.h:249
int LayerAlphaInc(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerAlphaInc
Definition: pcb_actions.h:289
static TOOL_ACTION zoneDisplayDisable
Definition: pcb_actions.h:248
static TOOL_ACTION print
Definition: actions.h:60
static TOOL_ACTION layerInner3
Definition: pcb_actions.h:258
static TOOL_ACTION layerInner24
Definition: pcb_actions.h:279
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
static TOOL_ACTION layerInner11
Definition: pcb_actions.h:266
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:214
static TOOL_ACTION layerTop
Definition: pcb_actions.h:255
int Undo(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner23
Definition: pcb_actions.h:278
static TOOL_ACTION appendBoard
Definition: pcb_actions.h:435
static TOOL_ACTION zoneDisplayToggle
Definition: pcb_actions.h:250
static TOOL_ACTION layerInner13
Definition: pcb_actions.h:268
static TOOL_ACTION layerPrev
Definition: pcb_actions.h:288
static TOOL_ACTION layerInner25
Definition: pcb_actions.h:280
static TOOL_ACTION layerInner18
Definition: pcb_actions.h:273
static TOOL_ACTION layerInner30
Definition: pcb_actions.h:285
int GridResetOrigin(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner29
Definition: pcb_actions.h:284
int DeleteItemCursor(const TOOL_EVENT &aEvent)
static TOOL_ACTION showRatsnest
Definition: pcb_actions.h:242
static TOOL_ACTION addLibrary
Definition: actions.h:52
static TOOL_ACTION quit
Definition: actions.h:62
static TOOL_ACTION layerInner10
Definition: pcb_actions.h:265
static const TOOL_EVENT ClearedEvent
Selected item had a property changed (except movement)
Definition: actions.h:211
int HighContrastMode(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner15
Definition: pcb_actions.h:270
static TOOL_ACTION newLibrary
Definition: actions.h:51
static TOOL_ACTION layerInner28
Definition: pcb_actions.h:283
static TOOL_ACTION layerInner27
Definition: pcb_actions.h:282
static TOOL_ACTION layerInner17
Definition: pcb_actions.h:272
static TOOL_ACTION layerInner20
Definition: pcb_actions.h:275
static TOOL_ACTION viaDisplayMode
Definition: pcb_actions.h:246
int Quit(const TOOL_EVENT &aEvent)
static TOOL_ACTION redo
Definition: actions.h:68
static TOOL_ACTION layerInner22
Definition: pcb_actions.h:277
int LayerSwitch(const TOOL_EVENT &aEvent)
int Print(const TOOL_EVENT &aEvent)
int Paste(const TOOL_EVENT &aEvent)
int FlipPcbView(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner14
Definition: pcb_actions.h:269
static TOOL_ACTION layerInner9
Definition: pcb_actions.h:264
int HighContrastModeCycle(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner16
Definition: pcb_actions.h:271
int AddLibrary(const TOOL_EVENT &aEvent)
Definition: pcb_control.cpp:92
int LayerPrev(const TOOL_EVENT &aEvent)
static TOOL_ACTION deleteTool
Definition: actions.h:76
static TOOL_ACTION highContrastModeCycle
Definition: actions.h:107
static TOOL_ACTION layerInner4
Definition: pcb_actions.h:259
static TOOL_ACTION undo
Definition: actions.h:67
int ToggleRatsnest(const TOOL_EVENT &aEvent)
static TOOL_ACTION flipBoard
Definition: pcb_actions.h:295
static TOOL_ACTION gridSetOrigin
Definition: actions.h:140
static TOOL_ACTION layerInner19
Definition: pcb_actions.h:274
int LayerToggle(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner1
Definition: pcb_actions.h:256
static TOOL_ACTION highContrastMode
Definition: actions.h:106
static TOOL_ACTION paste
Definition: actions.h:71
int AppendBoardFromFile(const TOOL_EVENT &aEvent)
static TOOL_ACTION trackDisplayMode
Definition: pcb_actions.h:244
int TrackDisplayMode(const TOOL_EVENT &aEvent)
int UpdateMessagePanel(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner12
Definition: pcb_actions.h:267
static TOOL_ACTION layerToggle
Definition: pcb_actions.h:291
static TOOL_ACTION zoneDisplayEnable
Definition: pcb_actions.h:247
int ViaDisplayMode(const TOOL_EVENT &aEvent)

References ACTIONS::addLibrary, AddLibrary(), PCB_ACTIONS::appendBoard, AppendBoardFromFile(), EVENTS::ClearedEvent, DeleteItemCursor(), ACTIONS::deleteTool, PCB_ACTIONS::flipBoard, FlipPcbView(), TOOL_INTERACTIVE::Go(), GridResetOrigin(), ACTIONS::gridResetOrigin, GridSetOrigin(), ACTIONS::gridSetOrigin, HighContrastMode(), ACTIONS::highContrastMode, HighContrastModeCycle(), ACTIONS::highContrastModeCycle, LayerAlphaDec(), PCB_ACTIONS::layerAlphaDec, LayerAlphaInc(), PCB_ACTIONS::layerAlphaInc, PCB_ACTIONS::layerBottom, PCB_ACTIONS::layerInner1, PCB_ACTIONS::layerInner10, PCB_ACTIONS::layerInner11, PCB_ACTIONS::layerInner12, PCB_ACTIONS::layerInner13, PCB_ACTIONS::layerInner14, PCB_ACTIONS::layerInner15, PCB_ACTIONS::layerInner16, PCB_ACTIONS::layerInner17, PCB_ACTIONS::layerInner18, PCB_ACTIONS::layerInner19, PCB_ACTIONS::layerInner2, PCB_ACTIONS::layerInner20, PCB_ACTIONS::layerInner21, PCB_ACTIONS::layerInner22, PCB_ACTIONS::layerInner23, PCB_ACTIONS::layerInner24, PCB_ACTIONS::layerInner25, PCB_ACTIONS::layerInner26, PCB_ACTIONS::layerInner27, PCB_ACTIONS::layerInner28, PCB_ACTIONS::layerInner29, PCB_ACTIONS::layerInner3, PCB_ACTIONS::layerInner30, PCB_ACTIONS::layerInner4, PCB_ACTIONS::layerInner5, PCB_ACTIONS::layerInner6, PCB_ACTIONS::layerInner7, PCB_ACTIONS::layerInner8, PCB_ACTIONS::layerInner9, LayerNext(), PCB_ACTIONS::layerNext, LayerPrev(), PCB_ACTIONS::layerPrev, LayerSwitch(), LayerToggle(), PCB_ACTIONS::layerToggle, PCB_ACTIONS::layerTop, ACTIONS::newLibrary, ACTIONS::paste, Paste(), Print(), ACTIONS::print, Quit(), ACTIONS::quit, PCB_ACTIONS::ratsnestLineMode, ACTIONS::redo, Redo(), EVENTS::SelectedEvent, EVENTS::SelectedItemsModified, PCB_ACTIONS::showRatsnest, ToggleRatsnest(), TrackDisplayMode(), PCB_ACTIONS::trackDisplayMode, ACTIONS::undo, Undo(), EVENTS::UnselectedEvent, UpdateMessagePanel(), ViaDisplayMode(), PCB_ACTIONS::viaDisplayMode, PCB_ACTIONS::zoneDisplayDisable, PCB_ACTIONS::zoneDisplayEnable, ZoneDisplayMode(), PCB_ACTIONS::zoneDisplayOutlines, and PCB_ACTIONS::zoneDisplayToggle.

◆ ToggleRatsnest()

int PCB_CONTROL::ToggleRatsnest ( const TOOL_EVENT aEvent)

Definition at line 138 of file pcb_control.cpp.

139 {
140  auto opts = displayOptions();
141 
142  if( aEvent.IsAction( &PCB_ACTIONS::showRatsnest ) )
143  {
144  // N.B. Do not disable the Ratsnest layer here. We use it for local ratsnest
145  Flip( opts.m_ShowGlobalRatsnest );
146  m_frame->SetDisplayOptions( opts );
147  getEditFrame<PCB_EDIT_FRAME>()->SetElementVisibility( LAYER_RATSNEST,
148  opts.m_ShowGlobalRatsnest );
149 
150  }
151  else if( aEvent.IsAction( &PCB_ACTIONS::ratsnestLineMode ) )
152  {
153  Flip( opts.m_DisplayRatsnestLinesCurved );
154  m_frame->SetDisplayOptions( opts );
155  }
156 
157  canvas()->RedrawRatsnest();
158  canvas()->Refresh();
159 
160  return 0;
161 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
static TOOL_ACTION ratsnestLineMode
Definition: pcb_actions.h:243
void Flip(T &aValue)
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
void RedrawRatsnest()
Return the bounding box of the view that should be used if model is not valid.
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:70
static TOOL_ACTION showRatsnest
Definition: pcb_actions.h:242
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...
const PCB_DISPLAY_OPTIONS & displayOptions() const
PCB_DRAW_PANEL_GAL * canvas() const

References PCB_TOOL_BASE::canvas(), PCB_TOOL_BASE::displayOptions(), Flip(), TOOL_EVENT::IsAction(), LAYER_RATSNEST, m_frame, PCB_ACTIONS::ratsnestLineMode, PCB_DRAW_PANEL_GAL::RedrawRatsnest(), EDA_DRAW_PANEL_GAL::Refresh(), PCB_BASE_FRAME::SetDisplayOptions(), and PCB_ACTIONS::showRatsnest.

Referenced by setTransitions().

◆ TrackDisplayMode()

int PCB_CONTROL::TrackDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 119 of file pcb_control.cpp.

120 {
121  auto opts = displayOptions();
122 
123  Flip( opts.m_DisplayPcbTrackFill );
124  m_frame->SetDisplayOptions( opts );
125 
126  for( auto track : board()->Tracks() )
127  {
128  if( track->Type() == PCB_TRACE_T || track->Type() == PCB_ARC_T )
129  view()->Update( track, KIGFX::GEOMETRY );
130  }
131 
132  canvas()->Refresh();
133 
134  return 0;
135 }
BOARD * board() const
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
void Flip(T &aValue)
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: pcb_view.cpp:92
KIGFX::PCB_VIEW * view() const
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...
const PCB_DISPLAY_OPTIONS & displayOptions() const
PCB_DRAW_PANEL_GAL * canvas() const
Position or shape has changed.
Definition: view_item.h:54

References PCB_TOOL_BASE::board(), PCB_TOOL_BASE::canvas(), PCB_TOOL_BASE::displayOptions(), Flip(), KIGFX::GEOMETRY, m_frame, PCB_ARC_T, PCB_TRACE_T, EDA_DRAW_PANEL_GAL::Refresh(), PCB_BASE_FRAME::SetDisplayOptions(), KIGFX::PCB_VIEW::Update(), and PCB_TOOL_BASE::view().

Referenced by setTransitions().

◆ Undo()

int PCB_CONTROL::Undo ( const TOOL_EVENT aEvent)

Definition at line 1026 of file pcb_control.cpp.

1027 {
1028  PCB_BASE_EDIT_FRAME* editFrame = dynamic_cast<PCB_BASE_EDIT_FRAME*>( m_frame );
1029  wxCommandEvent dummy;
1030 
1031  if( editFrame )
1032  editFrame->RestoreCopyFromUndoList( dummy );
1033 
1034  return 0;
1035 }
void RestoreCopyFromUndoList(wxCommandEvent &aEvent)
Undo the last edit:
Definition: undo_redo.cpp:315
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
Definition: sch_symbol.cpp:69
Common, abstract interface for edit frames.

References dummy(), m_frame, and PCB_BASE_EDIT_FRAME::RestoreCopyFromUndoList().

Referenced by setTransitions().

◆ UpdateMessagePanel()

int PCB_CONTROL::UpdateMessagePanel ( const TOOL_EVENT aEvent)

Definition at line 1050 of file pcb_control.cpp.

1051 {
1053  PCB_SELECTION& selection = selTool->GetSelection();
1054 
1055  if( selection.GetSize() == 1 )
1056  {
1057  EDA_ITEM* item = selection.Front();
1058  MSG_PANEL_ITEMS msgItems;
1059 
1060  item->GetMsgPanelInfo( m_frame, msgItems );
1061  m_frame->SetMsgPanel( msgItems );
1062  }
1063  else if( selection.GetSize() > 1 )
1064  {
1065  MSG_PANEL_ITEMS msgItems;
1066  wxString msg = wxString::Format( wxT( "%d" ), selection.GetSize() );
1067 
1068  msgItems.emplace_back( MSG_PANEL_ITEM( _( "Selected Items" ), msg ) );
1069  m_frame->SetMsgPanel( msgItems );
1070  }
1071  else if( auto editFrame = dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_frame ) )
1072  {
1073  FOOTPRINT* footprint = static_cast<FOOTPRINT*>( editFrame->GetModel() );
1074 
1075  if( !footprint )
1076  return 0;
1077 
1078  MSG_PANEL_ITEMS msgItems;
1079  wxString msg;
1080 
1081  msg = footprint->GetFPID().GetLibNickname().wx_str();
1082  msgItems.emplace_back( MSG_PANEL_ITEM( _( "Library" ), msg ) );
1083 
1084  msg = footprint->GetFPID().GetLibItemName().wx_str();
1085  msgItems.emplace_back( MSG_PANEL_ITEM( _( "Footprint Name" ), msg ) );
1086 
1087  wxDateTime date( static_cast<time_t>( footprint->GetLastEditTime() ) );
1088 
1089  if( footprint->GetLastEditTime() && date.IsValid() )
1090  // Date format: see http://www.cplusplus.com/reference/ctime/strftime
1091  msg = date.Format( wxT( "%b %d, %Y" ) ); // Abbreviated_month_name Day, Year
1092  else
1093  msg = _( "Unknown" );
1094 
1095  msgItems.emplace_back( MSG_PANEL_ITEM( _( "Last Change" ), msg ) );
1096 
1097  msg.Printf( wxT( "%zu" ), (size_t) footprint->GetPadCount( DO_NOT_INCLUDE_NPTH ) );
1098  msgItems.emplace_back( MSG_PANEL_ITEM( _( "Pads" ), msg ) );
1099 
1100  wxString doc, keyword;
1101  doc.Printf( _( "Doc: %s" ), footprint->GetDescription() );
1102  keyword.Printf( _( "Keywords: %s" ), footprint->GetKeywords() );
1103  msgItems.emplace_back( MSG_PANEL_ITEM( doc, keyword ) );
1104 
1105  m_frame->SetMsgPanel( msgItems );
1106  }
1107  else
1108  {
1110  }
1111 
1112  return 0;
1113 }
const wxString & GetDescription() const
Definition: footprint.h:193
const UTF8 & GetLibItemName() const
Definition: lib_id.h:106
unsigned GetPadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of pads.
Definition: footprint.cpp:1003
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
timestamp_t GetLastEditTime() const
Definition: footprint.h:329
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
const PCB_SELECTION & selection() const
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
virtual void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: eda_item.h:263
FOOTPRINT * footprint() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:92
const LIB_ID & GetFPID() const
Definition: footprint.h:190
const wxString & GetKeywords() const
Definition: footprint.h:196
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:101
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
#define _(s)
Definition: 3d_actions.cpp:33
wxString wx_str() const
Definition: utf8.cpp:51
The selection tool: currently supports:
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:149
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:97
BOARD * GetBoard() const
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:54
EDA_ITEM * Front() const
Definition: selection.h:203

References _, DO_NOT_INCLUDE_NPTH, PCB_TOOL_BASE::footprint(), Format(), SELECTION::Front(), PCB_BASE_FRAME::GetBoard(), FOOTPRINT::GetDescription(), FOOTPRINT::GetFPID(), FOOTPRINT::GetKeywords(), FOOTPRINT::GetLastEditTime(), LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), EDA_ITEM::GetMsgPanelInfo(), FOOTPRINT::GetPadCount(), PCB_SELECTION_TOOL::GetSelection(), SELECTION::GetSize(), TOOL_MANAGER::GetTool(), m_frame, TOOL_BASE::m_toolMgr, PCB_TOOL_BASE::selection(), EDA_DRAW_FRAME::SetMsgPanel(), and UTF8::wx_str().

Referenced by setTransitions().

◆ ViaDisplayMode()

int PCB_CONTROL::ViaDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 164 of file pcb_control.cpp.

165 {
166  auto opts = displayOptions();
167 
168  Flip( opts.m_DisplayViaFill );
169  m_frame->SetDisplayOptions( opts );
170 
171  for( auto track : board()->Tracks() )
172  {
173  if( track->Type() == PCB_TRACE_T || track->Type() == PCB_VIA_T )
174  view()->Update( track, KIGFX::GEOMETRY );
175  }
176 
177  canvas()->Refresh();
178 
179  return 0;
180 }
BOARD * board() const
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
void Flip(T &aValue)
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: pcb_view.cpp:92
KIGFX::PCB_VIEW * view() const
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...
const PCB_DISPLAY_OPTIONS & displayOptions() const
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
PCB_DRAW_PANEL_GAL * canvas() const
Position or shape has changed.
Definition: view_item.h:54

References PCB_TOOL_BASE::board(), PCB_TOOL_BASE::canvas(), PCB_TOOL_BASE::displayOptions(), Flip(), KIGFX::GEOMETRY, m_frame, PCB_TRACE_T, PCB_VIA_T, EDA_DRAW_PANEL_GAL::Refresh(), PCB_BASE_FRAME::SetDisplayOptions(), KIGFX::PCB_VIEW::Update(), and PCB_TOOL_BASE::view().

Referenced by setTransitions().

◆ view()

◆ Wait()

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

Suspend execution of the tool until an event specified in aEventList arrives.

No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

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

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PL_POINT_EDITOR::Main(), CVPCB_CONTROL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ ZoneDisplayMode()

int PCB_CONTROL::ZoneDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 183 of file pcb_control.cpp.

184 {
185  auto opts = displayOptions();
186 
187  // Apply new display options to the GAL canvas
189  {
190  opts.m_ZoneDisplayMode = ZONE_DISPLAY_MODE::SHOW_FILLED;
191  }
192  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayDisable ) )
193  {
194  opts.m_ZoneDisplayMode = ZONE_DISPLAY_MODE::SHOW_ZONE_OUTLINE;
195  }
196  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayOutlines ) )
197  {
198  opts.m_ZoneDisplayMode = ZONE_DISPLAY_MODE::SHOW_FILLED_OUTLINE;
199  }
200  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayToggle ) )
201  {
202  int nextMode = ( static_cast<int>( opts.m_ZoneDisplayMode ) + 1 ) % 3;
203  opts.m_ZoneDisplayMode = static_cast<ZONE_DISPLAY_MODE>( nextMode );
204  }
205  else
206  {
207  wxFAIL;
208  }
209 
210  m_frame->SetDisplayOptions( opts );
211 
212  for( ZONE* zone : board()->Zones() )
213  view()->Update( zone, KIGFX::GEOMETRY );
214 
215  canvas()->Refresh();
216 
217  return 0;
218 }
Filled polygons are shown.
BOARD * board() const
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:116
Outlines of filled polygons are shown.
static TOOL_ACTION zoneDisplayOutlines
Definition: pcb_actions.h:249
static TOOL_ACTION zoneDisplayDisable
Definition: pcb_actions.h:248
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:70
static TOOL_ACTION zoneDisplayToggle
Definition: pcb_actions.h:250
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: pcb_view.cpp:92
KIGFX::PCB_VIEW * view() const
ZONE handles a list of polygons defining a copper zone.
Definition: zone.h:57
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...
const PCB_DISPLAY_OPTIONS & displayOptions() const
Only the zone outline is shown.
PCB_DRAW_PANEL_GAL * canvas() const
Position or shape has changed.
Definition: view_item.h:54
static TOOL_ACTION zoneDisplayEnable
Definition: pcb_actions.h:247

References PCB_TOOL_BASE::board(), PCB_TOOL_BASE::canvas(), PCB_TOOL_BASE::displayOptions(), KIGFX::GEOMETRY, TOOL_EVENT::IsAction(), m_frame, EDA_DRAW_PANEL_GAL::Refresh(), PCB_BASE_FRAME::SetDisplayOptions(), SHOW_FILLED, SHOW_FILLED_OUTLINE, SHOW_ZONE_OUTLINE, KIGFX::PCB_VIEW::Update(), PCB_TOOL_BASE::view(), PCB_ACTIONS::zoneDisplayDisable, PCB_ACTIONS::zoneDisplayEnable, PCB_ACTIONS::zoneDisplayOutlines, and PCB_ACTIONS::zoneDisplayToggle.

Referenced by setTransitions().

Member Data Documentation

◆ m_frame

◆ m_gridOrigin

std::unique_ptr<KIGFX::ORIGIN_VIEWITEM> PCB_CONTROL::m_gridOrigin
private

Definition at line 119 of file pcb_control.h.

Referenced by GridResetOrigin(), GridSetOrigin(), PCB_CONTROL(), and Reset().

◆ m_isFootprintEditor

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

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

Definition at line 106 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), ROUTER_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), PL_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), PCB_VIEWER_TOOLS::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PL_SELECTION_TOOL::Init(), SCH_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), EDA_3D_CONTROLLER::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), PCB_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PCB_TOOL_BASE::Init(), PICKER_TOOL::Init(), PCB_PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_pickerItem

BOARD_ITEM* PCB_CONTROL::m_pickerItem
private

Definition at line 121 of file pcb_control.h.

Referenced by DeleteItemCursor().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

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

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

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

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 214 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

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

Definition at line 207 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: