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 NetColorModeCycle (const TOOL_EVENT &aEvent)
 
int RatsnestModeCycle (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 SetIsBoardEditor (bool aEnabled)
 
bool IsBoardEditor () const
 
virtual bool Is45Limited () const
 Should the tool use its 45° mode option? More...
 
void Activate ()
 Run the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Assign a context menu and tells when it should be activated. More...
 
void RunMainStack (std::function< void()> aFunc)
 Call a function using the main stack. More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Define which state (aStateFunc) to go when a certain event arrives (aConditions). More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Suspend execution of the tool until an event specified in aEventList arrives. More...
 
TOOL_TYPE GetType () const
 Return the type of the tool. More...
 
TOOL_ID GetId () const
 Return the unique identifier of the tool. More...
 
const std::string & GetName () const
 Return the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Return the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Static Public Member Functions

static void 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
 
PCBNEW_SETTINGS::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
 
bool m_isBoardEditor
 
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...
 
void unfilledZoneCheck ()
 We have bug reports indicating that some new users confuse zone filling/unfilling with the display modes. More...
 
int placeBoardItems (std::vector< BOARD_ITEM * > &aItems, bool aIsNew, bool aAnchorAtOrigin, bool aReannotateDuplicates)
 Add and select or just select for move/place command a list of board items. More...
 
int placeBoardItems (BOARD *aBoard, bool aAnchorAtOrigin, bool aReannotateDuplicates)
 Pointer to the currently used edit frame. More...
 
void resetTransitions ()
 Clear the current transition map and restores the default one created by setTransitions(). More...
 
void goInternal (TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)
 
EDA_ITEMgetModelInt () const
 
TOOLS_HOLDERgetToolHolderInt () const
 

Private Attributes

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

Detailed Description

Handle actions that are shared between different frames in PcbNew.

Definition at line 46 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 121 of file pcb_tool_base.h.

121 {
123 IPO_ROTATE = 0x01,
124
126 IPO_FLIP = 0x02,
127
130 IPO_SINGLE_CLICK = 0x04,
131
133 IPO_REPEAT = 0x08
134 };
@ IPO_FLIP
Handle flip action in the loop by calling the item's flip method.
@ IPO_ROTATE
Handle the rotate action in the loop by calling the item's rotate method.
@ IPO_SINGLE_CLICK
Create an item immediately on placement starting, otherwise show the pencil cursor until the item is ...
@ IPO_REPEAT
Allow repeat placement of the item.

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determine the reason of reset for a tool.

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 77 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ PCB_CONTROL()

PCB_CONTROL::PCB_CONTROL ( )

Definition at line 72 of file pcb_control.cpp.

72 :
73 PCB_TOOL_BASE( "pcbnew.Control" ),
74 m_frame( nullptr ),
75 m_pickerItem( nullptr )
76{
78}
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Definition: pcb_control.h:132
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:129
BOARD_ITEM * m_pickerItem
Definition: pcb_control.h:134
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool_base.h:77

References m_gridOrigin.

◆ ~PCB_CONTROL()

PCB_CONTROL::~PCB_CONTROL ( )

Definition at line 81 of file pcb_control.cpp.

82{
83}

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run the tool.

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

Definition at line 51 of file tool_interactive.cpp.

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

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

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), SCH_EDIT_TOOL::DeleteItemCursor(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_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(), SCH_DRAWING_TOOLS::DrawShape(), 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(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EE_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_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(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ AddLibrary()

int PCB_CONTROL::AddLibrary ( const TOOL_EVENT aEvent)

Definition at line 100 of file pcb_control.cpp.

101{
103 {
104 if( aEvent.IsAction( &ACTIONS::newLibrary ) )
105 static_cast<PCB_BASE_EDIT_FRAME*>( m_frame )->CreateNewLibrary();
106 else if( aEvent.IsAction( &ACTIONS::addLibrary ) )
107 static_cast<PCB_BASE_EDIT_FRAME*>( m_frame )->AddLibrary();
108 }
109
110 return 0;
111}
static TOOL_ACTION addLibrary
Definition: actions.h:49
static TOOL_ACTION newLibrary
Definition: actions.h:48
bool IsType(FRAME_T aType) const
Common, abstract interface for edit frames.
bool AddLibrary(const wxString &aLibName=wxEmptyString, FP_LIB_TABLE *aTable=nullptr)
Add an existing library to either the global or project library table.
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:88
@ FRAME_PCB_EDITOR
Definition: frame_type.h:40
@ FRAME_FOOTPRINT_EDITOR
Definition: frame_type.h:41

References ACTIONS::addLibrary, PCB_BASE_EDIT_FRAME::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 1056 of file pcb_control.cpp.

1057{
1058 PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
1059
1060 if( !editFrame )
1061 return 1;
1062
1063 BOARD* brd = board();
1064
1065 if( !brd )
1066 return 1;
1067
1068 // Mark existing items, in order to know what are the new items so we can select only
1069 // the new items after loading
1070 for( PCB_TRACK* track : brd->Tracks() )
1071 track->SetFlags( SKIP_STRUCT );
1072
1073 for( FOOTPRINT* footprint : brd->Footprints() )
1075
1076 for( PCB_GROUP* group : brd->Groups() )
1077 group->SetFlags( SKIP_STRUCT );
1078
1079 for( BOARD_ITEM* drawing : brd->Drawings() )
1080 drawing->SetFlags( SKIP_STRUCT );
1081
1082 for( ZONE* zone : brd->Zones() )
1083 zone->SetFlags( SKIP_STRUCT );
1084
1085 std::map<wxString, wxString> oldProperties = brd->GetProperties();
1086 std::map<wxString, wxString> newProperties;
1087
1088 // Keep also the count of copper layers, to adjust if necessary
1089 int initialCopperLayerCount = brd->GetCopperLayerCount();
1090 LSET initialEnabledLayers = brd->GetEnabledLayers();
1091
1092 // Load the data
1093 try
1094 {
1095 PROPERTIES props;
1096 char xbuf[30];
1097 char ybuf[30];
1098
1099 // EAGLE_PLUGIN can use this info to center the BOARD, but it does not yet.
1100 sprintf( xbuf, "%d", editFrame->GetPageSizeIU().x );
1101 sprintf( ybuf, "%d", editFrame->GetPageSizeIU().y );
1102
1103 props["page_width"] = xbuf;
1104 props["page_height"] = ybuf;
1105
1107 [&]( wxString aTitle, int aIcon, wxString aMessage, wxString aAction ) -> bool
1108 {
1109 KIDIALOG dlg( editFrame, aMessage, aTitle, wxOK | wxCANCEL | aIcon );
1110
1111 if( !aAction.IsEmpty() )
1112 dlg.SetOKLabel( aAction );
1113
1114 dlg.DoNotShowCheckbox( aMessage, 0 );
1115
1116 return dlg.ShowModal() == wxID_OK;
1117 } );
1118
1119 WX_PROGRESS_REPORTER progressReporter( editFrame, _( "Loading PCB" ), 1 );
1120
1121 editFrame->GetDesignSettings().GetNetClasses().Clear();
1122 pi.Load( fileName, brd, &props, nullptr, &progressReporter );
1123 }
1124 catch( const IO_ERROR& ioe )
1125 {
1126 wxString msg = wxString::Format( _( "Error loading board.\n%s" ), ioe.What() );
1127 DisplayError( editFrame, msg );
1128
1129 return 0;
1130 }
1131
1132 newProperties = brd->GetProperties();
1133
1134 for( const std::pair<const wxString, wxString>& prop : oldProperties )
1135 newProperties[ prop.first ] = prop.second;
1136
1137 brd->SetProperties( newProperties );
1138
1139 // rebuild nets and ratsnest before any use of nets
1140 brd->BuildListOfNets();
1142 brd->BuildConnectivity();
1143
1144 // Synchronize layers
1145 // we should not ask PLUGINs to do these items:
1146 int copperLayerCount = brd->GetCopperLayerCount();
1147
1148 if( copperLayerCount > initialCopperLayerCount )
1149 brd->SetCopperLayerCount( copperLayerCount );
1150
1151 // Enable all used layers, and make them visible:
1152 LSET enabledLayers = brd->GetEnabledLayers();
1153 enabledLayers |= initialEnabledLayers;
1154 brd->SetEnabledLayers( enabledLayers );
1155 brd->SetVisibleLayers( enabledLayers );
1156
1157 return placeBoardItems( brd, false, false ); // Do not reannotate duplicates on Append Board
1158}
NETCLASSES & GetNetClasses() const
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:53
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:240
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:498
void BuildListOfNets()
Definition: board.h:716
void SetEnabledLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:518
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition: board.h:308
ZONES & Zones()
Definition: board.h:288
void SynchronizeNetsAndNetClasses()
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition: board.cpp:1498
FOOTPRINTS & Footprints()
Definition: board.h:282
int GetCopperLayerCount() const
Definition: board.cpp:486
const std::map< wxString, wxString > & GetProperties() const
Definition: board.h:307
GROUPS & Groups()
The groups must maintain the following invariants.
Definition: board.h:302
TRACKS & Tracks()
Definition: board.h:279
void SetVisibleLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
Definition: board.cpp:530
void SetCopperLayerCount(int aCount)
Definition: board.cpp:492
DRAWINGS & Drawings()
Definition: board.h:285
void BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
Definition: board.cpp:156
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:152
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: confirm.h:46
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:529
void Clear()
Destroy any contained NETCLASS instances except the default one, and clears any members from the defa...
Definition: netclass.h:228
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
const wxSize GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
int placeBoardItems(std::vector< BOARD_ITEM * > &aItems, bool aIsNew, bool aAnchorAtOrigin, bool aReannotateDuplicates)
Add and select or just select for move/place command a list of board items.
The main frame for Pcbnew.
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:51
BOARD * board() const
FOOTPRINT * footprint() const
virtual void SetQueryUserCallback(std::function< bool(wxString aTitle, int aIcon, wxString aMessage, wxString aAction)> aCallback)
Registers a KIDIALOG callback for collecting info from the user.
Definition: io_mgr.h:285
virtual BOARD * Load(const wxString &aFileName, BOARD *aAppendToMe, const PROPERTIES *aProperties=nullptr, PROJECT *aProject=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)
Load information from some input file format that this PLUGIN implementation knows about into either ...
Definition: plugin.cpp:46
A name/value tuple with unique names and optional values.
Definition: properties.h:34
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
Handle a list of polygons defining a copper zone.
Definition: zone.h:58
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:280
#define _(s)
#define SKIP_STRUCT
flag indicating that the structure should be ignored
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

References _, PCB_TOOL_BASE::board(), BOARD::BuildConnectivity(), BOARD::BuildListOfNets(), NETCLASSES::Clear(), DisplayError(), KIDIALOG::DoNotShowCheckbox(), 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(), group, BOARD::Groups(), PLUGIN::Load(), m_frame, placeBoardItems(), BOARD::SetCopperLayerCount(), BOARD::SetEnabledLayers(), EDA_ITEM::SetFlags(), BOARD::SetProperties(), PLUGIN::SetQueryUserCallback(), BOARD::SetVisibleLayers(), KIDIALOG::ShowModal(), 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 851 of file pcb_control.cpp.

852{
853 int open_ctl;
854 wxString fileName;
855
856 PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
857
858 if( !editFrame )
859 return 1;
860
861 // Pick a file to append
862 if( !AskLoadBoardFileName( editFrame, &open_ctl, &fileName, true ) )
863 return 1;
864
865 IO_MGR::PCB_FILE_T pluginType = plugin_type( fileName, open_ctl );
866 PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
867
868 return AppendBoard( *pi, fileName );
869}
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:54
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
int AppendBoard(PLUGIN &pi, wxString &fileName)
Releases a PLUGIN in the context of a potential thrown exception through its destructor.
Definition: io_mgr.h:564
bool AskLoadBoardFileName(PCB_EDIT_FRAME *aParent, int *aCtl, wxString *aFileName, bool aKicadFilesOnly=false)
Show a wxFileDialog asking for a BOARD filename to open.
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}

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ board()

BOARD * PCB_TOOL_BASE::board ( ) const
inlineprotectedinherited

Definition at line 170 of file pcb_tool_base.h.

170{ 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::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawShape(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), BOARD_EDITOR_CONTROL::ExportNetlist(), ZONE_FILLER_TOOL::FillAllZones(), EDIT_TOOL::FilletTracks(), PCB_TOOL_BASE::footprint(), GROUP_TOOL::Group(), ROUTER_TOOL::handleLayerSwitch(), BOARD_INSPECTION_TOOL::highlightNet(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), LayerNext(), LayerPrev(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EDIT_TOOL::MoveExact(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), Paste(), placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PAD_TOOL::PlacePad(), DRAWING_TOOL::PlaceText(), PAD_TOOL::recombinePad(), BOARD_EDITOR_CONTROL::RepairBoard(), FOOTPRINT_EDITOR_CONTROL::RepairFootprint(), PNS::TOOL_BASE::Reset(), Reset(), TrackDisplayMode(), unfilledZoneCheck(), GROUP_TOOL::Ungroup(), ROUTER_TOOL::UpdateMessagePanel(), ViaDisplayMode(), ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), ZONE_FILLER_TOOL::ZoneFillDirty(), BOARD_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

◆ canvas()

◆ controls()

◆ DeleteItemCursor()

int PCB_CONTROL::DeleteItemCursor ( const TOOL_EVENT aEvent)

Definition at line 537 of file pcb_control.cpp.

538{
540 return 0;
541
542 std::string tool = aEvent.GetCommandStr().get();
544
545 m_pickerItem = nullptr;
547
548 // Deactivate other tools; particularly important if another PICKER is currently running
549 Activate();
550
551 picker->SetCursor( KICURSOR::REMOVE );
552
553 picker->SetClickHandler(
554 [this]( const VECTOR2D& aPosition ) -> bool
555 {
556 if( m_pickerItem )
557 {
559 {
560 m_statusPopup.reset( new STATUS_TEXT_POPUP( m_frame ) );
561 m_statusPopup->SetText( _( "Item locked." ) );
562 m_statusPopup->PopupFor( 2000 );
563 m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
564 return true;
565 }
566
568 selectionTool->UnbrightenItem( m_pickerItem );
569 selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
571 m_pickerItem = nullptr;
572 }
573
574 return true;
575 } );
576
577 picker->SetMotionHandler(
578 [this]( const VECTOR2D& aPos )
579 {
583 GENERAL_COLLECTOR collector;
584 collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
585
587 collector.Collect( board, GENERAL_COLLECTOR::FootprintItems, aPos, guide );
588 else
589 collector.Collect( board, GENERAL_COLLECTOR::BoardLevelItems, aPos, guide );
590
591 // Remove unselectable items
592 for( int i = collector.GetCount() - 1; i >= 0; --i )
593 {
594 if( !selectionTool->Selectable( collector[ i ] ) )
595 collector.Remove( i );
596 }
597
598 if( collector.GetCount() > 1 )
599 selectionTool->GuessSelectionCandidates( collector, aPos );
600
601 BOARD_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr;
602
603 if( m_pickerItem != item )
604 {
605 if( m_pickerItem )
606 selectionTool->UnbrightenItem( m_pickerItem );
607
608 m_pickerItem = item;
609
610 if( m_pickerItem )
611 selectionTool->BrightenItem( m_pickerItem );
612 }
613 } );
614
615 picker->SetFinalizeHandler(
616 [this]( const int& aFinalState )
617 {
618 if( m_pickerItem )
619 m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
620
621 m_statusPopup.reset();
622
623 // Ensure the cursor gets changed&updated
626 } );
627
628 m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
629
630 return 0;
631}
static TOOL_ACTION pickerTool
Definition: actions.h:156
static TOOL_ACTION doDelete
Definition: actions.h:72
virtual bool IsLocked() const
Definition: board_item.cpp:65
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:372
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:82
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
Definition: collector.h:110
int m_Threshold
Definition: collector.h:241
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
A general implementation of a COLLECTORS_GUIDE.
Definition: collectors.h:356
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:219
static const KICAD_T FootprintItems[]
A scan list for primary footprint items.
Definition: collectors.h:271
static const KICAD_T BoardLevelItems[]
A scan list for all primary board items, omitting items which are subordinate to a FOOTPRINT,...
Definition: collectors.h:256
void Collect(BOARD_ITEM *aItem, const KICAD_T aScanList[], const VECTOR2I &aRefPos, const COLLECTORS_GUIDE &aGuide)
Scan a BOARD_ITEM using this class's Inspector method, which does the collection.
Definition: collectors.cpp:620
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:59
BOARD * GetBoard() const
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide()
std::unique_ptr< STATUS_TEXT_POPUP > m_statusPopup
Definition: pcb_control.h:136
Generic tool for picking an item.
The selection tool: currently supports:
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...
bool Selectable(const BOARD_ITEM *aItem, bool checkVisibilityOnly=false) const
Check conditions for an item to be selected.
bool m_isFootprintEditor
void SetMotionHandler(MOTION_HANDLER aHandler)
Set a handler for mouse motion.
Definition: picker_tool.h:82
void SetClickHandler(CLICK_HANDLER aHandler)
Set a handler for mouse click event.
Definition: picker_tool.h:71
void SetCursor(KICURSOR aCursor)
Definition: picker_tool.h:62
void SetFinalizeHandler(FINALIZE_HANDLER aHandler)
Set a handler for the finalize event.
Definition: picker_tool.h:102
void BrightenItem(EDA_ITEM *aItem)
void UnbrightenItem(EDA_ITEM *aItem)
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:462
void Activate()
Run the tool.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
#define HITTEST_THRESHOLD_PIXELS
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:80

References TOOL_INTERACTIVE::Activate(), ARROW, PCB_TOOL_BASE::board(), GENERAL_COLLECTOR::BoardLevelItems, 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, m_statusPopup, COLLECTOR::m_Threshold, TOOL_BASE::m_toolMgr, ACTIONS::pickerTool, EDA_DRAW_PANEL_GAL::Refresh(), COLLECTOR::Remove(), 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(), and SELECTION_TOOL::UnbrightenItem().

Referenced by setTransitions().

◆ displayOptions()

◆ doInteractiveItemPlacement()

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

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

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

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

Definition at line 39 of file pcb_tool_base.cpp.

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

References TOOL_INTERACTIVE::Activate(), SELECTION::Add(), KIGFX::VIEW_GROUP::Add(), KIGFX::PCB_VIEW::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, KIGFX::VIEW_CONTROLS::ForceCursorPosition(), PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetCanvas(), TOOL_EVT_UTILS::GetEventRotationAngle(), TOOL_BASE::GetManager(), PCB_BASE_FRAME::GetModel(), TOOL_BASE::getView(), grid, PCB_TOOL_BASE::IPO_FLIP, PCB_TOOL_BASE::IPO_REPEAT, PCB_TOOL_BASE::IPO_ROTATE, PCB_TOOL_BASE::IPO_SINGLE_CLICK, TOOL_EVT_UTILS::IsRotateToolEvt(), INTERACTIVE_PLACER_BASE::m_board, 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(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), INTERACTIVE_PLACER_BASE::SnapItem(), TC_COMMAND, PCB_ACTIONS::trackViaSizeChanged, KIGFX::PCB_VIEW::Update(), PCB_TOOL_BASE::view(), and TOOL_INTERACTIVE::Wait().

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

◆ DoSetGridOrigin()

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

Definition at line 476 of file pcb_control.cpp.

478{
479 aFrame->GetDesignSettings().SetGridOrigin( wxPoint( aPoint ) );
480 aView->GetGAL()->SetGridOrigin( aPoint );
481 originViewItem->SetPosition( (wxPoint) aPoint );
482 aView->MarkDirty();
483 aFrame->OnModify();
484}
void SetGridOrigin(const VECTOR2I &aOrigin)
virtual void SetPosition(const VECTOR2I &aPos)
Definition: eda_item.h:263
void SetGridOrigin(const VECTOR2D &aGridOrigin)
Set the origin point for the grid.
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:195
void MarkDirty()
Force redraw of view on the next rendering.
Definition: view.h:641
virtual void OnModify()
Must be called after a change in order to set the "modify" flag of the current screen and update the ...

References PCB_BASE_FRAME::GetDesignSettings(), KIGFX::VIEW::GetGAL(), KIGFX::VIEW::MarkDirty(), PCB_BASE_FRAME::OnModify(), KIGFX::GAL::SetGridOrigin(), BOARD_DESIGN_SETTINGS::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 1379 of file pcb_control.cpp.

1380{
1381 view()->SetMirror( !view()->IsMirroredX(), false );
1382 view()->RecacheAllItems();
1385 return 0;
1386}
void ForceRefresh()
Force a redraw.
void SetMirror(bool aMirrorX, bool aMirrorY)
Control the mirroring of the VIEW.
Definition: view.cpp:535
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1381
virtual void OnDisplayOptionsChanged()

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 165 of file pcb_tool_base.h.

166 {
167 return getEditFrame<PCB_BASE_EDIT_FRAME>();
168 }

Referenced by PCB_POINT_EDITOR::addCorner(), AUTOPLACE_TOOL::autoplace(), PCB_TOOL_BASE::canvas(), ZONE_FILLER_TOOL::CheckAllZones(), PNS::TOOL_BASE::checkSnap(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), ROUTER_TOOL::CustomTrackWidthDialog(), FOOTPRINT_EDITOR_CONTROL::DeleteFootprint(), PCB_TOOL_BASE::displayOptions(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ROUTER_TOOL::DpDimensionsDialog(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawShape(), 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(), HighContrastMode(), HighContrastModeCycle(), BOARD_INSPECTION_TOOL::HighlightItem(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), BOARD_EDITOR_CONTROL::ImportSpecctraSession(), SCRIPTING_TOOL::Init(), ROUTER_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_TOOL_BASE::Is45Limited(), PCB_PICKER_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::MoveExact(), NetColorModeCycle(), PCB_POINT_EDITOR::OnSelectionChange(), Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), PNS::TOOL_BASE::pickSingleItem(), placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PAD_TOOL::pushPadSettings(), PAD_TOOL::recombinePad(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), SCRIPTING_TOOL::reloadPlugins(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), PNS::TOOL_BASE::Reset(), PAD_TOOL::Reset(), EDIT_TOOL::Rotate(), ROUTER_TOOL::SelectCopperLayerPair(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), PCB_POINT_EDITOR::setEditedPoint(), ROUTER_TOOL::SettingsDialog(), GLOBAL_EDIT_TOOL::swapBoardItem(), GLOBAL_EDIT_TOOL::SwapLayers(), ROUTER_TOOL::switchLayerOnViaPlacement(), DRAWING_TOOL::ToggleHV45Mode(), unfilledZoneCheck(), PCB_POINT_EDITOR::updateItem(), ROUTER_TOOL::UpdateMessagePanel(), EDIT_TOOL::updateModificationPoint(), BOARD_EDITOR_CONTROL::UpdateSchematicFromPCB(), ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), ZONE_FILLER_TOOL::ZoneFillAll(), and ZONE_FILLER_TOOL::ZoneFillDirty().

◆ getEditFrame()

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

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

Definition at line 184 of file tool_base.h.

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

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 120 of file tool_base.h.

121 {
122 return m_toolId;
123 }

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

◆ getModel()

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

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 196 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ getModelInt()

EDA_ITEM * TOOL_BASE::getModelInt ( ) const
privateinherited

Definition at line 54 of file tool_base.cpp.

55{
56 return m_toolMgr->GetModel();
57}
EDA_ITEM * GetModel() const
Definition: tool_manager.h:292

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

Referenced by TOOL_BASE::getModel().

◆ GetName()

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

Return the name of the tool.

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

Returns
The name of the tool.

Definition at line 133 of file tool_base.h.

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

References TOOL_BASE::m_toolName.

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

◆ getToolHolderInt()

TOOLS_HOLDER * TOOL_BASE::getToolHolderInt ( ) const
privateinherited

Definition at line 48 of file tool_base.cpp.

49{
50 return m_toolMgr->GetToolHolder();
51}
TOOLS_HOLDER * GetToolHolder() const
Definition: tool_manager.h:296

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

Referenced by TOOL_BASE::getEditFrame().

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 108 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

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

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

It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

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

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

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::CheckSymbol(), GERBVIEW_CONTROL::ClearAllLayers(), EE_SELECTION_TOOL::ClearSelection(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::CollectHits(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), SCH_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), DeleteItemCursor(), PL_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), DRAWING_TOOL::drawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), GridResetOrigin(), GridSetOrigin(), EE_SELECTION_TOOL::GuessSelectionCandidates(), ROUTER_TOOL::handleCommonEvents(), EE_SELECTION_TOOL::highlight(), PL_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), EE_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), PL_EDIT_TOOL::moveItem(), SCH_MOVE_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), ROUTER_TOOL::performRouting(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), ROUTER_TOOL::prepareInteractive(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), EE_SELECTION_TOOL::Reset(), EE_TOOL_BASE< T >::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), PNS::TOOL_BASE::Reset(), BOARD_EDITOR_CONTROL::Reset(), DRAWING_TOOL::Reset(), Reset(), PCB_SELECTION_TOOL::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::SelectAll(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), PL_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::ToggleERCErrors(), SCH_EDITOR_CONTROL::ToggleERCExclusions(), SCH_EDITOR_CONTROL::ToggleERCWarnings(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_SELECTION_TOOL::unhighlight(), PL_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< T >::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), PCB_SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), PCB_SELECTION_TOOL::view(), PCB_TOOL_BASE::view(), PCB_VIEWER_TOOLS::view(), PCB_SELECTION_TOOL::zoomFitCrossProbeBBox(), 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}
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:287

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(), EE_SELECTION_TOOL::autostartEvent(), SCH_EDIT_TOOL::BreakWire(), PCB_SELECTION_TOOL::controls(), 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(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNet(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), PCB_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(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), DRAWING_TOOL::Reset(), PCB_POINT_EDITOR::Reset(), COMMON_TOOLS::ResetLocalCoords(), PCB_SELECTION_TOOL::selectCursor(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCB_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateItem(), PL_EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

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

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

No conditions means any event.

Definition at line 147 of file tool_interactive.h.

149{
150 TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
151
152 goInternal( sptr, aConditions );
153}
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:58

References TOOL_INTERACTIVE::goInternal().

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

◆ goInternal()

void TOOL_INTERACTIVE::goInternal ( TOOL_STATE_FUNC aState,
const TOOL_EVENT_LIST aConditions 
)
privateinherited

Definition at line 70 of file tool_interactive.cpp.

71{
72 m_toolMgr->ScheduleNextState( this, aState, aConditions );
73}
void ScheduleNextState(TOOL_BASE *aTool, TOOL_STATE_FUNC &aHandler, const TOOL_EVENT_LIST &aConditions)
Define a state transition.

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

Referenced by TOOL_INTERACTIVE::Go().

◆ GridResetOrigin()

int PCB_CONTROL::GridResetOrigin ( const TOOL_EVENT aEvent)

Definition at line 526 of file pcb_control.cpp.

527{
530 return 0;
531}
virtual void SaveCopyInUndoList(EDA_ITEM *aItemToCopy, UNDO_REDO aTypeCommand)=0
Create a new entry in undo list of commands.
static void DoSetGridOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, EDA_ITEM *originViewItem, const VECTOR2D &aPoint)

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 487 of file pcb_control.cpp.

488{
489 VECTOR2D* origin = aEvent.Parameter<VECTOR2D*>();
490
491 if( origin )
492 {
493 // We can't undo the other grid dialog settings, so no sense undoing just the origin
494 DoSetGridOrigin( getView(), m_frame, m_gridOrigin.get(), *origin );
495 delete origin;
496 }
497 else
498 {
499 if( m_isFootprintEditor && !getEditFrame<PCB_BASE_EDIT_FRAME>()->GetModel() )
500 return 0;
501
502 std::string tool = aEvent.GetCommandStr().get();
504
505 if( !picker ) // Happens in footprint wizard
506 return 0;
507
508 // Deactivate other tools; particularly important if another PICKER is currently running
509 Activate();
510
511 picker->SetClickHandler(
512 [this]( const VECTOR2D& pt ) -> bool
513 {
516 return false; // drill origin is a one-shot; don't continue with tool
517 } );
518
519 m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
520 }
521
522 return 0;
523}
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:434
SGLIB_API S3DMODEL * GetModel(SCENEGRAPH *aNode)
Function GetModel creates an S3DMODEL representation of aNode (raw data, no transforms)
Definition: ifsg_api.cpp:338

References TOOL_INTERACTIVE::Activate(), DoSetGridOrigin(), TOOL_EVENT::GetCommandStr(), S3D::GetModel(), 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 274 of file pcb_control.cpp.

275{
277
281
282 m_frame->SetDisplayOptions( opts );
283
284 return 0;
285}
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
@ DIMMED
Inactive layers are dimmed (old high-contrast mode)
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions, bool aRefresh=true)
Updates the current display options from the given options struct.
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.

References DIMMED, PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetDisplayOptions(), PCB_DISPLAY_OPTIONS::m_ContrastModeDisplay, m_frame, NORMAL, and PCB_BASE_FRAME::SetDisplayOptions().

Referenced by setTransitions().

◆ HighContrastModeCycle()

int PCB_CONTROL::HighContrastModeCycle ( const TOOL_EVENT aEvent)

◆ Init()

bool PCB_TOOL_BASE::Init ( )
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 SCRIPTING_TOOL, LENGTH_TUNER_TOOL, ROUTER_TOOL, BOARD_EDITOR_CONTROL, BOARD_INSPECTION_TOOL, BOARD_REANNOTATE_TOOL, DRAWING_TOOL, EDIT_TOOL, FOOTPRINT_EDITOR_CONTROL, GLOBAL_EDIT_TOOL, GROUP_TOOL, PAD_TOOL, PCB_POINT_EDITOR, and POSITION_RELATIVE_TOOL.

Definition at line 275 of file pcb_tool_base.cpp.

276{
277 // A basic context manu. Many (but not all) tools will choose to override this.
278 CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
279
280 // cancel current tool goes in main context menu at the top if present
282 ctxMenu.AddSeparator( 1 );
283
284 // Finally, add the standard zoom/grid items
285 getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus( m_menu );
286
287 return true;
288}
static TOOL_ACTION cancelInteractive
Definition: actions.h:62
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.
void AddSeparator(int aOrder=ANY_ORDER)
Add a separator to the menu.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:44

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

◆ Is45Limited()

bool PCB_TOOL_BASE::Is45Limited ( ) const
virtualinherited

Should the tool use its 45° mode option?

Returns
True if set to use 45°

Definition at line 328 of file pcb_tool_base.cpp.

329{
330 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
331
332 if( frame()->IsType( FRAME_PCB_EDITOR ) )
333 return mgr.GetAppSettings<PCBNEW_SETTINGS>()->m_Use45DegreeLimit;
334 else
335 return mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>()->m_Use45Limit;
336}
T * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111

References PCB_TOOL_BASE::frame(), FRAME_PCB_EDITOR, SETTINGS_MANAGER::GetAppSettings(), and Pgm().

Referenced by DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawShape(), DRAWING_TOOL::DrawZone(), and ZONE_CREATE_HELPER::OnFirstPoint().

◆ IsBoardEditor()

bool PCB_TOOL_BASE::IsBoardEditor ( ) const
inlineinherited

Definition at line 109 of file pcb_tool_base.h.

109{ return m_isBoardEditor; }

References PCB_TOOL_BASE::m_isBoardEditor.

Referenced by BOARD_COMMIT::BOARD_COMMIT().

◆ IsFootprintEditor()

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

◆ LayerAlphaDec()

int PCB_CONTROL::LayerAlphaDec ( const TOOL_EVENT aEvent)

Definition at line 448 of file pcb_control.cpp.

449{
451 int currentLayer = m_frame->GetActiveLayer();
452 KIGFX::COLOR4D currentColor = settings->GetColor( currentLayer );
453
454 if( currentColor.a >= ALPHA_MIN + ALPHA_STEP )
455 {
456 currentColor.a -= ALPHA_STEP;
457 settings->SetColor( currentLayer, currentColor );
459
461 view->UpdateLayerColor( currentLayer );
462 view->UpdateLayerColor( GetNetnameLayer( currentLayer ) );
463
464 if( IsCopperLayer( currentLayer ) )
465 view->UpdateLayerColor( ZONE_LAYER_FOR( currentLayer ) );
466 }
467 else
468 {
469 wxBell();
470 }
471
472 return 0;
473}
Color settings are a bit different than most of the settings objects in that there can be more than o...
void SetColor(int aLayer, const COLOR4D &aColor)
COLOR4D GetColor(int aLayer) const
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
double a
Alpha component.
Definition: color4d.h:387
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
void UpdateLayerColor(int aLayer)
Apply the new coloring scheme held by RENDER_SETTINGS in case that it has changed.
Definition: view.cpp:737
virtual PCB_LAYER_ID GetActiveLayer() const
virtual COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
void UpdateColors()
Update the color settings in the painter and GAL.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
Definition: layer_ids.h:965
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:822
#define ZONE_LAYER_FOR(boardLayer)
Definition: layer_ids.h:268
#define ALPHA_STEP
#define ALPHA_MIN

References KIGFX::COLOR4D::a, ALPHA_MIN, ALPHA_STEP, PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetCanvas(), COLOR_SETTINGS::GetColor(), PCB_BASE_FRAME::GetColorSettings(), GetNetnameLayer(), PCB_DRAW_PANEL_GAL::GetView(), IsCopperLayer(), m_frame, COLOR_SETTINGS::SetColor(), 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 420 of file pcb_control.cpp.

421{
423 int currentLayer = m_frame->GetActiveLayer();
424 KIGFX::COLOR4D currentColor = settings->GetColor( currentLayer );
425
426 if( currentColor.a <= ALPHA_MAX - ALPHA_STEP )
427 {
428 currentColor.a += ALPHA_STEP;
429 settings->SetColor( currentLayer, currentColor );
431
433 view->UpdateLayerColor( currentLayer );
434 view->UpdateLayerColor( GetNetnameLayer( currentLayer ) );
435
436 if( IsCopperLayer( currentLayer ) )
437 view->UpdateLayerColor( ZONE_LAYER_FOR( currentLayer ) );
438 }
439 else
440 {
441 wxBell();
442 }
443
444 return 0;
445}
#define ALPHA_MAX

References KIGFX::COLOR4D::a, ALPHA_MAX, ALPHA_STEP, PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetCanvas(), COLOR_SETTINGS::GetColor(), PCB_BASE_FRAME::GetColorSettings(), GetNetnameLayer(), PCB_DRAW_PANEL_GAL::GetView(), IsCopperLayer(), m_frame, COLOR_SETTINGS::SetColor(), 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 350 of file pcb_control.cpp.

351{
352 PCB_BASE_FRAME* editFrame = m_frame;
353 BOARD* brd = board();
354 int layer = editFrame->GetActiveLayer();
355 int startLayer = layer;
356
357 while( startLayer != ++layer )
358 {
359 if( brd->IsLayerVisible( static_cast<PCB_LAYER_ID>( layer ) ) && IsCopperLayer( layer ) )
360 break;
361
362 if( layer >= B_Cu )
363 layer = F_Cu - 1;
364 }
365
366 wxCHECK( IsCopperLayer( layer ), 0 );
367 editFrame->SwitchLayer( ToLAYER_ID( layer ) );
368
369 return 0;
370}
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:504
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
virtual void SwitchLayer(PCB_LAYER_ID aLayer)
Change the active layer in the frame.
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ B_Cu
Definition: layer_ids.h:95
@ F_Cu
Definition: layer_ids.h:64
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:926

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

Referenced by setTransitions().

◆ LayerPrev()

int PCB_CONTROL::LayerPrev ( const TOOL_EVENT aEvent)

Definition at line 373 of file pcb_control.cpp.

374{
375 PCB_BASE_FRAME* editFrame = m_frame;
376 BOARD* brd = board();
377 int layer = editFrame->GetActiveLayer();
378 int startLayer = layer;
379
380 while( startLayer != --layer )
381 {
382 if( IsCopperLayer( layer ) // also test for valid layer id (layer >= F_Cu)
383 && brd->IsLayerVisible( static_cast<PCB_LAYER_ID>( layer ) ) )
384 {
385 break;
386 }
387
388 if( layer <= F_Cu )
389 layer = B_Cu + 1;
390 }
391
392 wxCHECK( IsCopperLayer( layer ), 0 );
393 editFrame->SwitchLayer( ToLAYER_ID( layer ) );
394
395 return 0;
396}

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

Referenced by setTransitions().

◆ LayerSwitch()

int PCB_CONTROL::LayerSwitch ( const TOOL_EVENT aEvent)

Definition at line 342 of file pcb_control.cpp.

343{
345
346 return 0;
347}

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

Referenced by setTransitions().

◆ LayerToggle()

int PCB_CONTROL::LayerToggle ( const TOOL_EVENT aEvent)

Definition at line 399 of file pcb_control.cpp.

400{
401 int currentLayer = m_frame->GetActiveLayer();
402 PCB_SCREEN* screen = m_frame->GetScreen();
403
404 if( currentLayer == screen->m_Route_Layer_TOP )
406 else
408
409 return 0;
410}
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
PCB_LAYER_ID m_Route_Layer_BOTTOM
Definition: pcb_screen.h:44

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

Referenced by setTransitions().

◆ NetColorModeCycle()

int PCB_CONTROL::NetColorModeCycle ( const TOOL_EVENT aEvent)

Definition at line 305 of file pcb_control.cpp.

306{
308
309 switch( opts.m_NetColorMode )
310 {
314 }
315
316 m_frame->SetDisplayOptions( opts );
317
318 return 0;
319}
@ RATSNEST
Net/netclass colors are shown on ratsnest lines only.
@ ALL
Net/netclass colors are shown on all net copper.
@ OFF
Net (and netclass) colors are not shown.
NET_COLOR_MODE m_NetColorMode
How to use color overrides on specific nets and netclasses.

References ALL, PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetDisplayOptions(), m_frame, PCB_DISPLAY_OPTIONS::m_NetColorMode, OFF, RATSNEST, and PCB_BASE_FRAME::SetDisplayOptions().

Referenced by setTransitions().

◆ Paste()

int PCB_CONTROL::Paste ( const TOOL_EVENT aEvent)

Definition at line 699 of file pcb_control.cpp.

700{
701 CLIPBOARD_IO pi;
702 BOARD_ITEM* clipItem = pi.Parse();
703
704 if( !clipItem )
705 return 0;
706
707 // The viewer frames cannot paste
708 if( !frame()->IsType( FRAME_FOOTPRINT_EDITOR ) && !frame()->IsType( FRAME_PCB_EDITOR ) )
709 return 0;
710
712 const wxString defaultRef = wxT( "REF**" );
713
714 if( aEvent.IsAction( &ACTIONS::pasteSpecial ) )
715 {
716 DIALOG_PASTE_SPECIAL dlg( m_frame, &mode, defaultRef );
717
718 if( dlg.ShowModal() == wxID_CANCEL )
719 return 0;
720 }
721
722 bool isFootprintEditor = m_isFootprintEditor || frame()->IsType( FRAME_FOOTPRINT_EDITOR );
723
724 if( clipItem->Type() == PCB_T )
725 {
726 if( isFootprintEditor )
727 {
728 for( BOARD_CONNECTED_ITEM* item : static_cast<BOARD*>( clipItem )->AllConnectedItems() )
729 item->SetNet( NETINFO_LIST::OrphanedItem() );
730 }
731 else
732 {
733 static_cast<BOARD*>( clipItem )->MapNets( m_frame->GetBoard() );
734 }
735 }
736
737 // The clipboard can contain two different things, an entire kicad_pcb or a single footprint
738 if( isFootprintEditor && ( !board() || !footprint() ) )
739 {
740 return 0;
741 }
742
743 switch( clipItem->Type() )
744 {
745 case PCB_T:
746 {
747 BOARD* clipBoard = static_cast<BOARD*>( clipItem );
748
749 if( isFootprintEditor )
750 {
751 FOOTPRINT* editorFootprint = board()->GetFirstFootprint();
752 std::vector<BOARD_ITEM*> pastedItems;
753
754 for( FOOTPRINT* clipFootprint : clipBoard->Footprints() )
755 pasteFootprintItemsToFootprintEditor( clipFootprint, board(), pastedItems );
756
757 for( BOARD_ITEM* clipDrawItem : clipBoard->Drawings() )
758 {
759 if( clipDrawItem->Type() == PCB_SHAPE_T )
760 {
761 PCB_SHAPE* clipShape = static_cast<PCB_SHAPE*>( clipDrawItem );
762
763 // Convert to PCB_FP_SHAPE_T
764 FP_SHAPE* pastedShape = new FP_SHAPE( editorFootprint );
765 static_cast<PCB_SHAPE*>( pastedShape )->SwapData( clipShape );
766 pastedShape->SetLocalCoord();
767
768 // Replace parent nuked by above call to SwapData()
769 pastedShape->SetParent( editorFootprint );
770 pastedItems.push_back( pastedShape );
771 }
772 else if( clipDrawItem->Type() == PCB_TEXT_T )
773 {
774 PCB_TEXT* clipTextItem = static_cast<PCB_TEXT*>( clipDrawItem );
775
776 // Convert to PCB_FP_TEXT_T
777 FP_TEXT* pastedTextItem = new FP_TEXT( editorFootprint );
778 static_cast<EDA_TEXT*>( pastedTextItem )->SwapText( *clipTextItem );
779 static_cast<EDA_TEXT*>( pastedTextItem )->SwapAttributes( *clipTextItem );
780
781 pastedTextItem->SetParent( editorFootprint );
782 pastedItems.push_back( pastedTextItem );
783 }
784 else if( clipDrawItem->Type() == PCB_TEXTBOX_T )
785 {
786 PCB_TEXTBOX* clipTextBox = static_cast<PCB_TEXTBOX*>( clipDrawItem );
787
788 // Convert to PCB_FP_TEXTBOX_T
789 FP_TEXTBOX* pastedTextBox = new FP_TEXTBOX( editorFootprint );
790 static_cast<EDA_TEXT*>( pastedTextBox )->SwapText( *clipTextBox );
791 static_cast<EDA_TEXT*>( pastedTextBox )->SwapAttributes( *clipTextBox );
792
793 pastedTextBox->SetParent( editorFootprint );
794 pastedItems.push_back( pastedTextBox );
795 }
796 }
797
798 delete clipBoard;
799
800 placeBoardItems( pastedItems, true, true, mode == PASTE_MODE::UNIQUE_ANNOTATIONS );
801 }
802 else
803 {
805 {
806 for( FOOTPRINT* clipFootprint : clipBoard->Footprints() )
807 clipFootprint->SetReference( defaultRef );
808 }
809
810 placeBoardItems( clipBoard, true, mode == PASTE_MODE::UNIQUE_ANNOTATIONS );
811
813 m_frame->Compile_Ratsnest( true );
814 }
815
816 break;
817 }
818
819 case PCB_FOOTPRINT_T:
820 {
821 FOOTPRINT* clipFootprint = static_cast<FOOTPRINT*>( clipItem );
822 std::vector<BOARD_ITEM*> pastedItems;
823
824 if( isFootprintEditor )
825 {
826 pasteFootprintItemsToFootprintEditor( clipFootprint, board(), pastedItems );
827 delete clipFootprint;
828 }
829 else
830 {
832 clipFootprint->SetReference( defaultRef );
833
834 clipFootprint->SetParent( board() );
835 pastedItems.push_back( clipFootprint );
836 }
837
838 placeBoardItems( pastedItems, true, true, mode == PASTE_MODE::UNIQUE_ANNOTATIONS );
839 break;
840 }
841
842 default:
843 m_frame->DisplayToolMsg( _( "Invalid clipboard contents" ) );
844 break;
845 }
846
847 return 1;
848}
static TOOL_ACTION pasteSpecial
Definition: actions.h:69
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
BOARD_ITEM * Parse()
void DisplayToolMsg(const wxString &msg) override
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:115
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:73
void SetReference(const wxString &aReference)
Definition: footprint.h:477
virtual void SetLocalCoord()
Set relative coordinates from draw coordinates.
Definition: fp_shape.cpp:52
static NETINFO_ITEM * OrphanedItem()
Wrapper class, so you can iterate through NETINFO_ITEM*s, not std::pair<int/wxString,...
Definition: netinfo.h:383
void Compile_Ratsnest(bool aDisplayStatus)
Create the entire board ratsnest.
Definition: ratsnest.cpp:40
@ REMOVE_ANNOTATIONS
@ UNIQUE_ANNOTATIONS
static void pasteFootprintItemsToFootprintEditor(FOOTPRINT *aClipFootprint, BOARD *aBoard, std::vector< BOARD_ITEM * > &aPastedItems)
@ PCB_T
Definition: typeinfo.h:84
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition: typeinfo.h:93
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition: typeinfo.h:92

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(), TOOL_EVENT::IsAction(), EDA_BASE_FRAME::IsType(), KEEP_ANNOTATIONS, m_frame, PCB_TOOL_BASE::m_isFootprintEditor, NETINFO_LIST::OrphanedItem(), CLIPBOARD_IO::Parse(), pasteFootprintItemsToFootprintEditor(), ACTIONS::pasteSpecial, PCB_FOOTPRINT_T, PCB_SHAPE_T, PCB_T, PCB_TEXT_T, PCB_TEXTBOX_T, placeBoardItems(), REMOVE_ANNOTATIONS, FP_SHAPE::SetLocalCoord(), EDA_ITEM::SetParent(), FOOTPRINT::SetReference(), EDA_ITEM::Type(), and UNIQUE_ANNOTATIONS.

Referenced by setTransitions().

◆ placeBoardItems() [1/2]

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

Pointer to the currently used edit frame.

Definition at line 935 of file pcb_control.cpp.

936{
937 // items are new if the current board is not the board source
938 bool isNew = board() != aBoard;
939 std::vector<BOARD_ITEM*> items;
940
941 moveUnflaggedItems( aBoard->Tracks(), items, isNew );
942 moveUnflaggedItems( aBoard->Footprints(), items, isNew );
943 moveUnflaggedItems( aBoard->Drawings(), items, isNew );
944 moveUnflaggedItems( aBoard->Zones(), items, isNew );
945
946 // Subtlety: When selecting a group via the mouse,
947 // PCB_SELECTION_TOOL::highlightInternal runs, which does a SetSelected() on all
948 // descendants. In PCB_CONTROL::placeBoardItems, below, we skip that and
949 // mark items non-recursively. That works because the saving of the
950 // selection created aBoard that has the group and all descendants in it.
951 moveUnflaggedItems( aBoard->Groups(), items, isNew );
952
953 return placeBoardItems( items, isNew, aAnchorAtOrigin, aReannotateDuplicates );
954}
static void moveUnflaggedItems(std::deque< T > &aList, std::vector< BOARD_ITEM * > &aTarget, bool aIsNew)

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

◆ placeBoardItems() [2/2]

int PCB_CONTROL::placeBoardItems ( std::vector< BOARD_ITEM * > &  aItems,
bool  aIsNew,
bool  aAnchorAtOrigin,
bool  aReannotateDuplicates 
)
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)
aReannotateDuplicates= true to reannotate any footprints with a designator that already exist in the board.

Definition at line 957 of file pcb_control.cpp.

959{
961
963 EDIT_TOOL* editTool = m_toolMgr->GetTool<EDIT_TOOL>();
964
965 std::vector<BOARD_ITEM*> itemsToSel;
966 itemsToSel.reserve( aItems.size() );
967
968 auto updateDimensionUnits =
969 [this]( PCB_DIMENSION_BASE* dimension )
970 {
971 // Dimensions need to have their units updated if they are automatic
972 if( dimension->GetUnitsMode() == DIM_UNITS_MODE::AUTOMATIC )
973 dimension->SetUnits( frame()->GetUserUnits() );
974 };
975
976 for( BOARD_ITEM* item : aItems )
977 {
978 if( aIsNew )
979 {
980 const_cast<KIID&>( item->m_Uuid ) = KIID();
981
982 // Even though BOARD_COMMIT::Push() will add any new items to the group, we're
983 // going to run PCB_ACTIONS::move first, and the move tool will throw out any
984 // items that aren't in the entered group.
985 if( selectionTool->GetEnteredGroup() && !item->GetParentGroup() )
986 selectionTool->GetEnteredGroup()->AddItem( item );
987 }
988
989 // Update item attributes if needed
990 if( BaseType( item->Type() ) == PCB_DIMENSION_T )
991 {
992 updateDimensionUnits( static_cast<PCB_DIMENSION_BASE*>( item ) );
993 }
994 else if( item->Type() == PCB_FOOTPRINT_T )
995 {
996 FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item );
997
998 // Update the footprint path with the new KIID path if the footprint is new
999 if( aIsNew )
1001
1002 for( BOARD_ITEM* dwg : footprint->GraphicalItems() )
1003 {
1004 if( BaseType( dwg->Type() ) == PCB_DIMENSION_T )
1005 updateDimensionUnits( static_cast<PCB_DIMENSION_BASE*>( dwg ) );
1006 }
1007 }
1008
1009 // We only need to add the items that aren't inside a group currently selected
1010 // to the selection. If an item is inside a group and that group is selected,
1011 // then the selection tool will select it for us.
1012 if( !item->GetParentGroup() || !alg::contains( aItems, item->GetParentGroup() ) )
1013 itemsToSel.push_back( item );
1014 }
1015
1016 // Select the items that should be selected
1017 m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &itemsToSel );
1018
1019 // Reannotate duplicate footprints (make sense only in board editor )
1020 if( aReannotateDuplicates && m_frame->IsType( FRAME_PCB_EDITOR ) )
1022
1023 for( BOARD_ITEM* item : aItems )
1024 {
1025 // Commit after reannotation
1026 if( aIsNew )
1027 editTool->GetCurrentCommit()->Add( item );
1028 else
1029 editTool->GetCurrentCommit()->Added( item );
1030 }
1031
1032 PCB_SELECTION& selection = selectionTool->GetSelection();
1033
1034 if( selection.Size() > 0 )
1035 {
1036 if( aAnchorAtOrigin )
1037 {
1039 }
1040 else
1041 {
1042 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.GetTopLeftItem() );
1044 }
1045
1046 getViewControls()->SetCursorPosition( getViewControls()->GetMousePosition(), false );
1047
1050 }
1051
1052 return 0;
1053}
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:65
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:262
The interactive edit tool.
Definition: edit_tool.h:65
static const TOOL_EVENT SelectedEvent
Definition: actions.h:201
void SetPath(const KIID_PATH &aPath)
Definition: footprint.h:221
DRAWINGS & GraphicalItems()
Definition: footprint.h:178
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.
Definition: kiid.h:45
static TOOL_ACTION move
move or drag an item
Definition: pcb_actions.h:98
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
Definition: pcb_actions.h:66
Abstract dimension API.
Definition: pcb_dimension.h:96
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
Definition: pcb_group.cpp:39
PCB_GROUP * GetEnteredGroup()
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
EDA_ITEM * GetTopLeftItem(bool aFootprintsOnly=false) const override
int Size() const
Returns the number of selected parts.
Definition: selection.h:104
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:234
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:99
constexpr KICAD_T BaseType(const KICAD_T aType)
Return the underlying type of the given type.
Definition: typeinfo.h:245
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type
Definition: typeinfo.h:107
VECTOR2< int > VECTOR2I
Definition: vector2d.h:607

References PCB_GROUP::AddItem(), AUTOMATIC, BaseType(), alg::contains(), PCB_TOOL_BASE::footprint(), PCB_TOOL_BASE::frame(), FRAME_PCB_EDITOR, PCB_SELECTION_TOOL::GetEnteredGroup(), BOARD_ITEM::GetParentGroup(), EDA_ITEM::GetPosition(), PCB_SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), PCB_SELECTION::GetTopLeftItem(), EDA_BASE_FRAME::GetUserUnits(), TOOL_BASE::getViewControls(), FOOTPRINT::GraphicalItems(), EDA_BASE_FRAME::IsType(), m_frame, TOOL_BASE::m_toolMgr, PCB_ACTIONS::move, PCB_DIMENSION_T, PCB_FOOTPRINT_T, TOOL_MANAGER::ProcessEvent(), BOARD_REANNOTATE_TOOL::ReannotateDuplicatesInSelection(), TOOL_MANAGER::RunAction(), EVENTS::SelectedEvent, PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionClear, PCB_ACTIONS::selectItems, KIGFX::VIEW_CONTROLS::SetCursorPosition(), FOOTPRINT::SetPath(), SELECTION::SetReferencePoint(), and SELECTION::Size().

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

◆ Print()

int PCB_CONTROL::Print ( const TOOL_EVENT aEvent)

Definition at line 464 of file dialog_print_pcbnew.cpp.

465{
466 // Selection affects the origin item visibility
468
471
473 dlg.ForcePrintBorder( false );
474
475 dlg.ShowModal();
476
477 return 0;
478}
const PAGE_INFO & GetPageSettings() const override

References DIALOG_PRINT_GENERIC::ForcePrintBorder(), 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 114 of file pcb_control.cpp.

115{
116 m_frame->Close( false );
117 return 0;
118}

References m_frame.

Referenced by setTransitions().

◆ RatsnestModeCycle()

int PCB_CONTROL::RatsnestModeCycle ( const TOOL_EVENT aEvent)

Definition at line 322 of file pcb_control.cpp.

323{
324 if( !displayOptions().m_ShowGlobalRatsnest )
325 {
328 }
329 else if( displayOptions().m_RatsnestMode == RATSNEST_MODE::ALL )
330 {
332 }
333 else
334 {
336 }
337
338 return 0;
339}
@ VISIBLE
Ratsnest lines are drawn to items on visible layers only.
@ ALL
Ratsnest lines are drawn to items on all layers (default)
PCBNEW_SETTINGS::DISPLAY_OPTIONS & displayOptions() const

References ALL, PCB_TOOL_BASE::displayOptions(), PCBNEW_SETTINGS::DISPLAY_OPTIONS::m_RatsnestMode, PCBNEW_SETTINGS::DISPLAY_OPTIONS::m_ShowGlobalRatsnest, and VISIBLE.

Referenced by setTransitions().

◆ Redo()

int PCB_CONTROL::Redo ( const TOOL_EVENT aEvent)

Definition at line 1173 of file pcb_control.cpp.

1174{
1175 PCB_BASE_EDIT_FRAME* editFrame = dynamic_cast<PCB_BASE_EDIT_FRAME*>( m_frame );
1176 wxCommandEvent dummy;
1177
1178 if( editFrame )
1179 editFrame->RestoreCopyFromRedoList( dummy );
1180
1181 return 0;
1182}
void RestoreCopyFromRedoList(wxCommandEvent &aEvent)
Redo the last edit:
Definition: undo_redo.cpp:361
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:73

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 86 of file pcb_control.cpp.

87{
88 m_frame = getEditFrame<PCB_BASE_FRAME>();
89
90 if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
91 {
92 m_gridOrigin->SetPosition( (wxPoint) board()->GetDesignSettings().GetGridOrigin() );
93 m_gridOrigin->SetColor( m_frame->GetGridColor() );
94 getView()->Remove( m_gridOrigin.get() );
95 getView()->Add( m_gridOrigin.get() );
96 }
97}
virtual COLOR4D GetGridColor()
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:316
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:346

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().

◆ resetTransitions()

void TOOL_INTERACTIVE::resetTransitions ( )
privateinherited

Clear the current transition map and restores the default one created by setTransitions().

Definition at line 63 of file tool_interactive.cpp.

64{
67}
virtual void setTransitions()=0
This method is meant to be overridden in order to specify handlers for events.
void ClearTransitions(TOOL_BASE *aTool)
Clear the state transition map for a tool.

References TOOL_MANAGER::ClearTransitions(), TOOL_BASE::m_toolMgr, and TOOL_INTERACTIVE::setTransitions().

◆ 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}
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]

PCB_SELECTION & PCB_TOOL_BASE::selection ( )
protectedinherited

Definition at line 320 of file pcb_tool_base.cpp.

321{
323
324 return selTool->GetSelection();
325}

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

◆ selection() [2/2]

const PCB_SELECTION & PCB_TOOL_BASE::selection ( ) const
protectedinherited

Definition at line 312 of file pcb_tool_base.cpp.

313{
315
316 return selTool->GetSelection();
317}

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

Referenced by AUTOPLACE_TOOL::autoplaceSelected(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), EDIT_TOOL::ChangeTrackWidth(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), DRC_TOOL::CrossProbe(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), BOARD_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Drag(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawShape(), 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(), EDIT_TOOL::Flip(), DRAWING_TOOL::getSourceZoneForAction(), GROUP_TOOL::Group(), BOARD_INSPECTION_TOOL::highlightNet(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_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(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), BOARD_REANNOTATE_TOOL::ReannotateDuplicatesInSelection(), GROUP_TOOL::RemoveFromGroup(), GLOBAL_EDIT_TOOL::RemoveUnusedPads(), EDIT_TOOL::Rotate(), 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().

◆ 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}
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.
@ CMENU_OFF
Definition: tool_event.h:148

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

Referenced by SELECTION_TOOL::doSelectionMenu(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ SetIsBoardEditor()

void PCB_TOOL_BASE::SetIsBoardEditor ( bool  aEnabled)
inlineinherited

Definition at line 108 of file pcb_tool_base.h.

108{ m_isBoardEditor = aEnabled; }

References PCB_TOOL_BASE::m_isBoardEditor.

◆ 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 105 of file pcb_tool_base.h.

105{ m_isFootprintEditor = aEnabled; }

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 1389 of file pcb_control.cpp.

1390{
1393 Go( &PCB_CONTROL::Print, ACTIONS::print.MakeEvent() );
1394 Go( &PCB_CONTROL::Quit, ACTIONS::quit.MakeEvent() );
1395
1396 // Display modes
1411
1412 // Layer control
1450
1451 // Grid control
1454
1455 Go( &PCB_CONTROL::Undo, ACTIONS::undo.MakeEvent() );
1456 Go( &PCB_CONTROL::Redo, ACTIONS::redo.MakeEvent() );
1457
1458 // Miscellaneous
1460
1461 // Append control
1463
1464 Go( &PCB_CONTROL::Paste, ACTIONS::paste.MakeEvent() );
1466
1471}
static TOOL_ACTION paste
Definition: actions.h:68
static TOOL_ACTION gridResetOrigin
Definition: actions.h:139
static TOOL_ACTION highContrastModeCycle
Definition: actions.h:104
static TOOL_ACTION undo
Definition: actions.h:64
static TOOL_ACTION highContrastMode
Definition: actions.h:103
static TOOL_ACTION quit
Definition: actions.h:59
static TOOL_ACTION redo
Definition: actions.h:65
static TOOL_ACTION deleteTool
Definition: actions.h:73
static TOOL_ACTION print
Definition: actions.h:57
static TOOL_ACTION gridSetOrigin
Definition: actions.h:138
static const TOOL_EVENT ClearedEvent
Selected item had a property changed (except movement)
Definition: actions.h:203
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:202
static TOOL_ACTION layerToggle
Definition: pcb_actions.h:290
static TOOL_ACTION layerInner12
Definition: pcb_actions.h:266
static TOOL_ACTION layerInner8
Definition: pcb_actions.h:262
static TOOL_ACTION zoneDisplayToggle
Definition: pcb_actions.h:250
static TOOL_ACTION layerInner3
Definition: pcb_actions.h:257
static TOOL_ACTION layerPrev
Definition: pcb_actions.h:287
static TOOL_ACTION showRatsnest
Definition: pcb_actions.h:239
static TOOL_ACTION layerInner2
Definition: pcb_actions.h:256
static TOOL_ACTION layerInner25
Definition: pcb_actions.h:279
static TOOL_ACTION layerAlphaDec
Definition: pcb_actions.h:289
static TOOL_ACTION zoneDisplayFilled
Definition: pcb_actions.h:246
static TOOL_ACTION layerInner24
Definition: pcb_actions.h:278
static TOOL_ACTION viaDisplayMode
Definition: pcb_actions.h:245
static TOOL_ACTION layerInner29
Definition: pcb_actions.h:283
static TOOL_ACTION layerInner11
Definition: pcb_actions.h:265
static TOOL_ACTION layerAlphaInc
Definition: pcb_actions.h:288
static TOOL_ACTION layerInner16
Definition: pcb_actions.h:270
static TOOL_ACTION layerInner26
Definition: pcb_actions.h:280
static TOOL_ACTION layerInner18
Definition: pcb_actions.h:272
static TOOL_ACTION layerInner14
Definition: pcb_actions.h:268
static TOOL_ACTION trackDisplayMode
Definition: pcb_actions.h:243
static TOOL_ACTION layerInner6
Definition: pcb_actions.h:260
static TOOL_ACTION zoneDisplayTriangulated
Definition: pcb_actions.h:249
static TOOL_ACTION layerInner22
Definition: pcb_actions.h:276
static TOOL_ACTION layerInner5
Definition: pcb_actions.h:259
static TOOL_ACTION zoneDisplayFractured
Definition: pcb_actions.h:248
static TOOL_ACTION ratsnestModeCycle
Definition: pcb_actions.h:242
static TOOL_ACTION layerInner20
Definition: pcb_actions.h:274
static TOOL_ACTION layerInner7
Definition: pcb_actions.h:261
static TOOL_ACTION layerInner27
Definition: pcb_actions.h:281
static TOOL_ACTION appendBoard
Definition: pcb_actions.h:447
static TOOL_ACTION netColorModeCycle
Definition: pcb_actions.h:241
static TOOL_ACTION layerInner1
Definition: pcb_actions.h:255
static TOOL_ACTION layerInner10
Definition: pcb_actions.h:264
static TOOL_ACTION layerInner15
Definition: pcb_actions.h:269
static TOOL_ACTION layerInner17
Definition: pcb_actions.h:271
static TOOL_ACTION flipBoard
Definition: pcb_actions.h:294
static TOOL_ACTION layerBottom
Definition: pcb_actions.h:285
static TOOL_ACTION zoneDisplayOutline
Definition: pcb_actions.h:247
static TOOL_ACTION ratsnestLineMode
Definition: pcb_actions.h:240
static TOOL_ACTION layerInner19
Definition: pcb_actions.h:273
static TOOL_ACTION layerInner9
Definition: pcb_actions.h:263
static TOOL_ACTION layerInner30
Definition: pcb_actions.h:284
static TOOL_ACTION layerTop
Definition: pcb_actions.h:254
static TOOL_ACTION layerInner4
Definition: pcb_actions.h:258
static TOOL_ACTION layerInner13
Definition: pcb_actions.h:267
static TOOL_ACTION layerInner21
Definition: pcb_actions.h:275
static TOOL_ACTION layerNext
Definition: pcb_actions.h:286
static TOOL_ACTION layerInner23
Definition: pcb_actions.h:277
static TOOL_ACTION layerInner28
Definition: pcb_actions.h:282
int AppendBoardFromFile(const TOOL_EVENT &aEvent)
int AddLibrary(const TOOL_EVENT &aEvent)
int NetColorModeCycle(const TOOL_EVENT &aEvent)
int RatsnestModeCycle(const TOOL_EVENT &aEvent)
int TrackDisplayMode(const TOOL_EVENT &aEvent)
int Redo(const TOOL_EVENT &aEvent)
int UpdateMessagePanel(const TOOL_EVENT &aEvent)
int LayerAlphaDec(const TOOL_EVENT &aEvent)
int LayerNext(const TOOL_EVENT &aEvent)
int ToggleRatsnest(const TOOL_EVENT &aEvent)
int LayerAlphaInc(const TOOL_EVENT &aEvent)
int HighContrastModeCycle(const TOOL_EVENT &aEvent)
int Quit(const TOOL_EVENT &aEvent)
int HighContrastMode(const TOOL_EVENT &aEvent)
int Undo(const TOOL_EVENT &aEvent)
int ViaDisplayMode(const TOOL_EVENT &aEvent)
int GridSetOrigin(const TOOL_EVENT &aEvent)
int FlipPcbView(const TOOL_EVENT &aEvent)
int LayerToggle(const TOOL_EVENT &aEvent)
int DeleteItemCursor(const TOOL_EVENT &aEvent)
int Print(const TOOL_EVENT &aEvent)
int ZoneDisplayMode(const TOOL_EVENT &aEvent)
int GridResetOrigin(const TOOL_EVENT &aEvent)
int LayerPrev(const TOOL_EVENT &aEvent)
int Paste(const TOOL_EVENT &aEvent)
int LayerSwitch(const TOOL_EVENT &aEvent)
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).

References ACTIONS::addLibrary, AddLibrary(), PCB_ACTIONS::appendBoard, AppendBoardFromFile(), EVENTS::ClearedEvent, DeleteItemCursor(), ACTIONS::deleteTool, PCB_ACTIONS::flipBoard, FlipPcbView(), TOOL_INTERACTIVE::Go(), ACTIONS::gridResetOrigin, GridResetOrigin(), ACTIONS::gridSetOrigin, GridSetOrigin(), ACTIONS::highContrastMode, HighContrastMode(), ACTIONS::highContrastModeCycle, HighContrastModeCycle(), PCB_ACTIONS::layerAlphaDec, LayerAlphaDec(), PCB_ACTIONS::layerAlphaInc, 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, PCB_ACTIONS::layerNext, LayerNext(), PCB_ACTIONS::layerPrev, LayerPrev(), LayerSwitch(), PCB_ACTIONS::layerToggle, LayerToggle(), PCB_ACTIONS::layerTop, PCB_ACTIONS::netColorModeCycle, NetColorModeCycle(), ACTIONS::newLibrary, ACTIONS::paste, Paste(), ACTIONS::pasteSpecial, ACTIONS::print, Print(), ACTIONS::quit, Quit(), PCB_ACTIONS::ratsnestLineMode, PCB_ACTIONS::ratsnestModeCycle, RatsnestModeCycle(), ACTIONS::redo, Redo(), EVENTS::SelectedEvent, EVENTS::SelectedItemsModified, PCB_ACTIONS::showRatsnest, ToggleRatsnest(), PCB_ACTIONS::trackDisplayMode, TrackDisplayMode(), ACTIONS::undo, Undo(), EVENTS::UnselectedEvent, UpdateMessagePanel(), PCB_ACTIONS::viaDisplayMode, ViaDisplayMode(), PCB_ACTIONS::zoneDisplayFilled, PCB_ACTIONS::zoneDisplayFractured, ZoneDisplayMode(), PCB_ACTIONS::zoneDisplayOutline, PCB_ACTIONS::zoneDisplayToggle, and PCB_ACTIONS::zoneDisplayTriangulated.

◆ ToggleRatsnest()

int PCB_CONTROL::ToggleRatsnest ( const TOOL_EVENT aEvent)

Definition at line 143 of file pcb_control.cpp.

144{
145 if( aEvent.IsAction( &PCB_ACTIONS::showRatsnest ) )
146 {
147 // N.B. Do not disable the Ratsnest layer here. We use it for local ratsnest
148 Flip( displayOptions().m_ShowGlobalRatsnest );
149 getEditFrame<PCB_EDIT_FRAME>()->SetElementVisibility( LAYER_RATSNEST,
150 displayOptions().m_ShowGlobalRatsnest );
151
152 }
153 else if( aEvent.IsAction( &PCB_ACTIONS::ratsnestLineMode ) )
154 {
155 Flip( displayOptions().m_DisplayRatsnestLinesCurved );
156 }
157
159 canvas()->Refresh();
160
161 return 0;
162}
void RedrawRatsnest()
Return the bounding box of the view that should be used if model is not valid.
PCB_DRAW_PANEL_GAL * canvas() const
@ LAYER_RATSNEST
Definition: layer_ids.h:204
void Flip(T &aValue)

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

Referenced by setTransitions().

◆ TrackDisplayMode()

int PCB_CONTROL::TrackDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 127 of file pcb_control.cpp.

128{
129 Flip( displayOptions().m_DisplayPcbTrackFill );
130
131 for( PCB_TRACK* track : board()->Tracks() )
132 {
133 if( track->Type() == PCB_TRACE_T || track->Type() == PCB_ARC_T )
134 view()->Update( track, KIGFX::REPAINT );
135 }
136
137 canvas()->Refresh();
138
139 return 0;
140}
@ REPAINT
Item needs to be redrawn.
Definition: view_item.h:52
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:105
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:103

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

Referenced by setTransitions().

◆ Undo()

int PCB_CONTROL::Undo ( const TOOL_EVENT aEvent)

Definition at line 1161 of file pcb_control.cpp.

1162{
1163 PCB_BASE_EDIT_FRAME* editFrame = dynamic_cast<PCB_BASE_EDIT_FRAME*>( m_frame );
1164 wxCommandEvent dummy;
1165
1166 if( editFrame )
1167 editFrame->RestoreCopyFromUndoList( dummy );
1168
1169 return 0;
1170}
void RestoreCopyFromUndoList(wxCommandEvent &aEvent)
Undo the last edit:
Definition: undo_redo.cpp:331

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

Referenced by setTransitions().

◆ unfilledZoneCheck()

void PCB_CONTROL::unfilledZoneCheck ( )
private

We have bug reports indicating that some new users confuse zone filling/unfilling with the display modes.

This will put up a warning if they show zone fills when one or more zones are unfilled.

Definition at line 186 of file pcb_control.cpp.

187{
188 if( Pgm().GetCommonSettings()->m_DoNotShowAgain.zone_fill_warning )
189 return;
190
191 bool unfilledZones = false;
192
193 for( const ZONE* zone : board()->Zones() )
194 {
195 if( !zone->GetIsRuleArea() && !zone->IsFilled() )
196 {
197 unfilledZones = true;
198 break;
199 }
200 }
201
202 if( unfilledZones )
203 {
204 WX_INFOBAR* infobar = frame()->GetInfoBar();
205 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, _( "Don't show again" ),
206 wxEmptyString );
207
208 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
209 [&]( wxHyperlinkEvent& aEvent )
210 {
211 Pgm().GetCommonSettings()->m_DoNotShowAgain.zone_fill_warning = true;
212 frame()->GetInfoBar()->Dismiss();
213 } ) );
214
215 infobar->RemoveAllButtons();
216 infobar->AddButton( button );
217
218 wxString msg;
219 msg.Printf( _( "Not all zones are filled. Use Edit > Fill All Zones (%s) "
220 "if you wish to see all fills." ),
222
223 infobar->ShowMessageFor( msg, 5000, wxICON_WARNING );
224 }
225}
WX_INFOBAR * GetInfoBar()
static TOOL_ACTION zoneFillAll
Definition: pcb_actions.h:306
A modified version of the wxInfoBar class that allows us to:
Definition: infobar.h:74
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
Definition: infobar.cpp:286
void ShowMessageFor(const wxString &aMessage, int aTime, int aFlags=wxICON_INFORMATION, MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the infobar with the provided message and icon for a specific period of time.
Definition: infobar.cpp:128
void AddButton(wxButton *aButton)
Add an already created button to the infobar.
Definition: infobar.cpp:245
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: infobar.cpp:175
wxString KeyNameFromKeyCode(int aKeycode, bool *aIsFound)
Return the key name from the key code.

References _, WX_INFOBAR::AddButton(), PCB_TOOL_BASE::board(), WX_INFOBAR::Dismiss(), PCB_TOOL_BASE::frame(), EDA_BASE_FRAME::GetInfoBar(), KeyNameFromKeyCode(), Pgm(), WX_INFOBAR::RemoveAllButtons(), WX_INFOBAR::ShowMessageFor(), and PCB_ACTIONS::zoneFillAll.

Referenced by ZoneDisplayMode().

◆ UpdateMessagePanel()

int PCB_CONTROL::UpdateMessagePanel ( const TOOL_EVENT aEvent)

Definition at line 1185 of file pcb_control.cpp.

1186{
1188 ROUTER_TOOL* routerTool = m_toolMgr->GetTool<ROUTER_TOOL>();
1189 PCB_SELECTION& selection = selTool->GetSelection();
1190 PCB_EDIT_FRAME* pcbFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
1191 std::shared_ptr<DRC_ENGINE> drcEngine = m_frame->GetBoard()->GetDesignSettings().m_DRCEngine;
1192 DRC_CONSTRAINT constraint;
1193
1194 EDA_UNITS units = m_frame->GetUserUnits();
1195 std::vector<MSG_PANEL_ITEM> msgItems;
1196
1197 if( routerTool && routerTool->RoutingInProgress() )
1198 {
1199 routerTool->UpdateMessagePanel();
1200 return 0;
1201 }
1202
1203 if( !pcbFrame && !m_frame->GetModel() )
1204 return 0;
1205
1206 if( selection.Empty() )
1207 {
1208 if( !pcbFrame )
1209 {
1210 FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_frame->GetModel() );
1211 size_t padCount = fp->GetPadCount( DO_NOT_INCLUDE_NPTH );
1212
1213 msgItems.emplace_back( _( "Library" ), fp->GetFPID().GetLibNickname().wx_str() );
1214
1215 msgItems.emplace_back( _( "Footprint Name" ), fp->GetFPID().GetLibItemName().wx_str() );
1216
1217 msgItems.emplace_back( _( "Pads" ), wxString::Format( wxT( "%zu" ), padCount ) );
1218
1219 msgItems.emplace_back( wxString::Format( _( "Doc: %s" ), fp->GetDescription() ),
1220 wxString::Format( _( "Keywords: %s" ), fp->GetKeywords() ) );
1221 }
1222 else
1223 {
1225 }
1226 }
1227 else if( selection.GetSize() == 1 )
1228 {
1229 EDA_ITEM* item = selection.Front();
1230
1231 item->GetMsgPanelInfo( m_frame, msgItems );
1232 }
1233 else if( pcbFrame && selection.GetSize() == 2 )
1234 {
1235 // Pair selection broken into multiple, optional data, starting with the selected item
1236 // names
1237
1238 BOARD_ITEM* a = static_cast<BOARD_ITEM*>( selection[0] );
1239 BOARD_ITEM* b = static_cast<BOARD_ITEM*>( selection[1] );
1240
1241 msgItems.emplace_back( MSG_PANEL_ITEM( a->GetSelectMenuText( units ),
1242 b->GetSelectMenuText( units ) ) );
1243
1244 BOARD_CONNECTED_ITEM* a_conn = dyn_cast<BOARD_CONNECTED_ITEM*>( a );
1245 BOARD_CONNECTED_ITEM* b_conn = dyn_cast<BOARD_CONNECTED_ITEM*>( b );
1246
1247 if( a_conn && b_conn )
1248 {
1249 LSET overlap = a_conn->GetLayerSet() & b_conn->GetLayerSet() & LSET::AllCuMask();
1250 int a_netcode = a_conn->GetNetCode();
1251 int b_netcode = b_conn->GetNetCode();
1252
1253 if( overlap.count() > 0
1254 && ( a_netcode != b_netcode || a_netcode < 0 || b_netcode < 0 ) )
1255 {
1256 PCB_LAYER_ID layer = overlap.CuStack().front();
1257
1258 constraint = drcEngine->EvalRules( CLEARANCE_CONSTRAINT, a, b, layer );
1259
1260 std::shared_ptr<SHAPE> a_shape( a_conn->GetEffectiveShape( layer ) );
1261 std::shared_ptr<SHAPE> b_shape( b_conn->GetEffectiveShape( layer ) );
1262
1263 int actual_clearance = a_shape->GetClearance( b_shape.get() );
1264
1265 msgItems.emplace_back( _( "Resolved clearance" ),
1266 MessageTextFromValue( units, constraint.m_Value.Min() ) );
1267
1268 if( actual_clearance > -1 && actual_clearance < std::numeric_limits<int>::max() )
1269 {
1270 msgItems.emplace_back( _( "Actual clearance" ),
1271 MessageTextFromValue( units, actual_clearance ) );
1272 }
1273 }
1274 }
1275
1276 if( a->HasHole() || b->HasHole() )
1277 {
1280
1281 if( b->IsOnLayer( active ) && IsCopperLayer( active ) )
1282 layer = active;
1283 else if( b->HasHole() && a->IsOnLayer( active ) && IsCopperLayer( active ) )
1284 layer = active;
1285 else if( a->HasHole() && b->IsOnCopperLayer() )
1286 layer = b->GetLayer();
1287 else if( b->HasHole() && b->IsOnCopperLayer() )
1288 layer = a->GetLayer();
1289
1290 if( layer >= 0 )
1291 {
1292 int actual = std::numeric_limits<int>::max();
1293
1294 if( a->HasHole() )
1295 {
1296 std::shared_ptr<SHAPE_SEGMENT> hole = a->GetEffectiveHoleShape();
1297 std::shared_ptr<SHAPE> other( b->GetEffectiveShape( layer ) );
1298
1299 actual = std::min( actual, hole->GetClearance( other.get() ) );
1300 }
1301
1302 if( b->HasHole() )
1303 {
1304 std::shared_ptr<SHAPE_SEGMENT> hole = b->GetEffectiveHoleShape();
1305 std::shared_ptr<SHAPE> other( a->GetEffectiveShape( layer ) );
1306
1307 actual = std::min( actual, hole->GetClearance( other.get() ) );
1308 }
1309
1310 constraint = drcEngine->EvalRules( HOLE_CLEARANCE_CONSTRAINT, a, b, layer );
1311 msgItems.emplace_back( _( "Resolved hole clearance" ),
1312 MessageTextFromValue( units, constraint.m_Value.Min() ) );
1313
1314 if( actual > -1 && actual < std::numeric_limits<int>::max() )
1315 {
1316 msgItems.emplace_back( _( "Actual hole clearance" ),
1317 MessageTextFromValue( units, actual ) );
1318 }
1319 }
1320 }
1321
1322 for( PCB_LAYER_ID edgeLayer : { Edge_Cuts, Margin } )
1323 {
1326
1327 if( a->IsOnLayer( edgeLayer ) && b->Type() != PCB_FOOTPRINT_T )
1328 {
1329 if( b->IsOnLayer( active ) && IsCopperLayer( active ) )
1330 layer = active;
1331 else if( IsCopperLayer( b->GetLayer() ) )
1332 layer = b->GetLayer();
1333 }
1334 else if( b->IsOnLayer( edgeLayer ) && a->Type() != PCB_FOOTPRINT_T )
1335 {
1336 if( a->IsOnLayer( active ) && IsCopperLayer( active ) )
1337 layer = active;
1338 else if( IsCopperLayer( a->GetLayer() ) )
1339 layer = a->GetLayer();
1340 }
1341
1342 if( layer >= 0 )
1343 {
1344 constraint = drcEngine->EvalRules( EDGE_CLEARANCE_CONSTRAINT, a, b, layer );
1345
1346 if( edgeLayer == Edge_Cuts )
1347 {
1348 msgItems.emplace_back( _( "Resolved edge clearance" ),
1349 MessageTextFromValue( units, constraint.m_Value.Min() ) );
1350 }
1351 else
1352 {
1353 msgItems.emplace_back( _( "Resolved margin clearance" ),
1354 MessageTextFromValue( units, constraint.m_Value.Min() ) );
1355 }
1356 }
1357 }
1358 }
1359
1360 if( msgItems.empty() )
1361 {
1362 if( selection.GetSize() )
1363 {
1364 msgItems.emplace_back( _( "Selected Items" ),
1365 wxString::Format( wxT( "%d" ), selection.GetSize() ) );
1366 }
1367 else
1368 {
1369 m_frame->GetBoard()->GetMsgPanelInfo( m_frame, msgItems );
1370 }
1371 }
1372
1373 m_frame->SetMsgPanel( msgItems );
1374
1375 return 0;
1376}
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:103
std::shared_ptr< DRC_ENGINE > m_DRCEngine
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:170
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Test to see if this object is on the given layer.
Definition: board_item.h:229
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition: board_item.cpp:197
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:175
virtual bool IsOnCopperLayer() const
Definition: board_item.h:116
virtual std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const
Definition: board_item.cpp:207
virtual bool HasHole() const
Definition: board_item.h:121
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: board.cpp:1232
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:615
MINOPTMAX< int > m_Value
Definition: drc_rule.h:170
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
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:224
virtual wxString GetSelectMenuText(EDA_UNITS aUnits) const
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: eda_item.cpp:109
unsigned GetPadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of pads.
Definition: footprint.cpp:1180
const wxString & GetKeywords() const
Definition: footprint.h:217
const LIB_ID & GetFPID() const
Definition: footprint.h:208
const wxString & GetDescription() const
Definition: footprint.h:214
const UTF8 & GetLibItemName() const
Definition: lib_id.h:104
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:90
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
Definition: lset.cpp:170
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:773
T Min() const
Definition: minoptmax.h:33
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:54
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:88
EDA_ITEM * Front() const
Definition: selection.h:182
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:98
wxString wx_str() const
Definition: utf8.cpp:46
@ EDGE_CLEARANCE_CONSTRAINT
Definition: drc_rule.h:49
@ CLEARANCE_CONSTRAINT
Definition: drc_rule.h:46
@ HOLE_CLEARANCE_CONSTRAINT
Definition: drc_rule.h:47
EDA_UNITS
Definition: eda_units.h:39
@ DO_NOT_INCLUDE_NPTH
Definition: footprint.h:57
@ Edge_Cuts
Definition: layer_ids.h:113
@ Margin
Definition: layer_ids.h:114
@ UNDEFINED_LAYER
Definition: layer_ids.h:60

References _, LSET::AllCuMask(), CLEARANCE_CONSTRAINT, LSET::CuStack(), DO_NOT_INCLUDE_NPTH, EDGE_CLEARANCE_CONSTRAINT, Edge_Cuts, SELECTION::Empty(), Format(), SELECTION::Front(), PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetBoard(), FOOTPRINT::GetDescription(), BOARD::GetDesignSettings(), BOARD_ITEM::GetEffectiveHoleShape(), BOARD_ITEM::GetEffectiveShape(), FOOTPRINT::GetFPID(), FOOTPRINT::GetKeywords(), BOARD_ITEM::GetLayer(), BOARD_ITEM::GetLayerSet(), LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), PCB_BASE_FRAME::GetModel(), EDA_ITEM::GetMsgPanelInfo(), BOARD::GetMsgPanelInfo(), BOARD_CONNECTED_ITEM::GetNetCode(), FOOTPRINT::GetPadCount(), PCB_SELECTION_TOOL::GetSelection(), EDA_ITEM::GetSelectMenuText(), SELECTION::GetSize(), TOOL_MANAGER::GetTool(), EDA_BASE_FRAME::GetUserUnits(), BOARD_ITEM::HasHole(), HOLE_CLEARANCE_CONSTRAINT, IsCopperLayer(), BOARD_ITEM::IsOnCopperLayer(), BOARD_ITEM::IsOnLayer(), BOARD_DESIGN_SETTINGS::m_DRCEngine, m_frame, TOOL_BASE::m_toolMgr, DRC_CONSTRAINT::m_Value, Margin, MessageTextFromValue(), MINOPTMAX< T >::Min(), PCB_FOOTPRINT_T, PCB_TOOL_BASE::selection(), EDA_DRAW_FRAME::SetMsgPanel(), EDA_ITEM::Type(), UNDEFINED_LAYER, and UTF8::wx_str().

Referenced by setTransitions().

◆ ViaDisplayMode()

int PCB_CONTROL::ViaDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 165 of file pcb_control.cpp.

166{
167 Flip( displayOptions().m_DisplayViaFill );
168
169 for( PCB_TRACK* track : board()->Tracks() )
170 {
171 if( track->Type() == PCB_VIA_T )
172 view()->Update( track, KIGFX::REPAINT );
173 }
174
175 canvas()->Refresh();
176
177 return 0;
178}
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:104

References PCB_TOOL_BASE::board(), PCB_TOOL_BASE::canvas(), PCB_TOOL_BASE::displayOptions(), Flip(), PCB_VIA_T, EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::REPAINT, 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_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 SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SELECTION_TOOL::doSelectionMenu(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDA_3D_CONTROLLER::Main(), CVPCB_CONTROL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_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(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ ZoneDisplayMode()

int PCB_CONTROL::ZoneDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 228 of file pcb_control.cpp.

229{
231
232 // Apply new display options to the GAL canvas
234 {
236
238 }
239 else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayOutline ) )
240 {
242 }
243 else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayFractured ) )
244 {
246 }
248 {
250 }
251 else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayToggle ) )
252 {
255 else
257 }
258 else
259 {
260 wxFAIL;
261 }
262
263 m_frame->SetDisplayOptions( opts );
264
265 for( ZONE* zone : board()->Zones() )
266 view()->Update( zone, KIGFX::REPAINT );
267
268 canvas()->Refresh();
269
270 return 0;
271}
void unfilledZoneCheck()
We have bug reports indicating that some new users confuse zone filling/unfilling with the display mo...
ZONE_DISPLAY_MODE m_ZoneDisplayMode

References PCB_TOOL_BASE::board(), PCB_TOOL_BASE::canvas(), PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetDisplayOptions(), TOOL_EVENT::IsAction(), m_frame, PCB_DISPLAY_OPTIONS::m_ZoneDisplayMode, EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::REPAINT, PCB_BASE_FRAME::SetDisplayOptions(), SHOW_FILLED, SHOW_FRACTURE_BORDERS, SHOW_TRIANGULATION, SHOW_ZONE_OUTLINE, unfilledZoneCheck(), KIGFX::PCB_VIEW::Update(), PCB_TOOL_BASE::view(), PCB_ACTIONS::zoneDisplayFilled, PCB_ACTIONS::zoneDisplayFractured, PCB_ACTIONS::zoneDisplayOutline, PCB_ACTIONS::zoneDisplayToggle, and PCB_ACTIONS::zoneDisplayTriangulated.

Referenced by setTransitions().

Member Data Documentation

◆ m_frame

◆ m_gridOrigin

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

Definition at line 132 of file pcb_control.h.

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

◆ m_isBoardEditor

bool PCB_TOOL_BASE::m_isBoardEditor
protectedinherited

◆ m_isFootprintEditor

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

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

Definition at line 125 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), EDA_3D_CONTROLLER::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< T >::Init(), SCH_DRAWING_TOOLS::Init(), SCH_EDIT_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), PICKER_TOOL::Init(), ZOOM_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_EDIT_TOOL::Init(), PL_SELECTION_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), ROUTER_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), DRAWING_TOOL::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PAD_TOOL::Init(), PCB_SELECTION_TOOL::Init(), PCB_TOOL_BASE::Init(), PCB_VIEWER_TOOLS::Init(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDA_3D_CONTROLLER::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_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(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace().

◆ m_pickerItem

BOARD_ITEM* PCB_CONTROL::m_pickerItem
private

Definition at line 134 of file pcb_control.h.

Referenced by DeleteItemCursor().

◆ m_statusPopup

std::unique_ptr<STATUS_TEXT_POPUP> PCB_CONTROL::m_statusPopup
private

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

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

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 214 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), SELECTION_TOOL::AddItemsToSel(), SELECTION_TOOL::AddItemToSel(), SCH_MOVE_TOOL::AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), EE_SELECTION_TOOL::autostartEvent(), SCH_EDIT_TOOL::BreakWire(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDITOR_CONTROL::ChangeLineMode(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), SCH_EDITOR_CONTROL::ClearHighlight(), BOARD_INSPECTION_TOOL::ClearHighlight(), EE_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), PL_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), MICROWAVE_TOOL::createInductorBetween(), EE_INSPECTION_TOOL::CrossProbe(), DRC_TOOL::CrossProbe(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), SCH_EDIT_TOOL::DeleteItemCursor(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), SCH_EDIT_TOOL::DoDelete(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), BOARD_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PCB_SELECTION_TOOL::doSyncSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::Drag(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawShape(), 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(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editShapeProperties(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), PAD_TOOL::EnumeratePads(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), PCB_SELECTION_TOOL::filterSelection(), PCB_SELECTION_TOOL::FindItem(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getToolHolderInt(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), GridSetOrigin(), GROUP_TOOL::Group(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PL_EDIT_TOOL::ImportDrawingSheetContent(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), EE_TOOL_BASE< T >::Init(), SCH_EDIT_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_EDIT_TOOL::Init(), PL_POINT_EDITOR::Init(), ROUTER_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), BOARD_INSPECTION_TOOL::Init(), BOARD_REANNOTATE_TOOL::Init(), CONVERT_TOOL::Init(), DRAWING_TOOL::Init(), EDIT_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), GROUP_TOOL::Init(), PAD_TOOL::Init(), PCB_POINT_EDITOR::Init(), PCB_SELECTION_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), POSITION_RELATIVE_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), GROUP_TOOL::LeaveGroup(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EDA_3D_CONTROLLER::Main(), CVPCB_CONTROL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), SCH_EDITOR_CONTROL::NextLineMode(), SYMBOL_EDITOR_CONTROL::OnDeMorgan(), SELECTION_TOOL::onDisambiguationExpire(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_EDIT_TOOL::PinTable(), placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), GERBVIEW_CONTROL::Print(), Print(), SCH_EDIT_TOOL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::recombinePad(), SCH_EDITOR_CONTROL::Redo(), SYMBOL_EDITOR_EDIT_TOOL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), GROUP_TOOL::RemoveFromGroup(), SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem(), PCB_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), PAD_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), SCH_EDITOR_CONTROL::Revert(), SCH_EDIT_TOOL::Rotate(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC_TOOL::RunTests(), EE_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectNet(), GERBVIEW_SELECTION_TOOL::selectPoint(), PL_SELECTION_TOOL::SelectPoint(), PCB_SELECTION_TOOL::selectPoint(), EE_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(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_EDITOR_CONTROL::Undo(), SYMBOL_EDITOR_EDIT_TOOL::Undo(), GROUP_TOOL::Ungroup(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), PNS::TOOL_BASE::updateEndItem(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), UpdateMessagePanel(), EDIT_TOOL::updateModificationPoint(), EE_POINT_EDITOR::updateParentItem(), 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 213 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

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

Definition at line 206 of file tool_base.h.

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


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