KiCad PCB EDA Suite
PCB_EDITOR_CONTROL Class Reference

Class PCB_EDITOR_CONTROL. More...

#include <pcb_editor_control.h>

Inheritance diagram for PCB_EDITOR_CONTROL:
PCB_TOOL_BASE TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 PCB_EDITOR_CONTROL ()
 
 ~PCB_EDITOR_CONTROL ()
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings the tool to a known, initial state. More...
 
bool Init () override
 Function Init() Init() is called once upon a registration of the tool. More...
 
int TrackWidthInc (const TOOL_EVENT &aEvent)
 
int TrackWidthDec (const TOOL_EVENT &aEvent)
 
int ViaSizeInc (const TOOL_EVENT &aEvent)
 
int ViaSizeDec (const TOOL_EVENT &aEvent)
 
int ZoneMerge (const TOOL_EVENT &aEvent)
 
int ZoneDuplicate (const TOOL_EVENT &aEvent)
 

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

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

Toggles 'lock' property for selected items.

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

Locks selected items.

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

Unlocks selected items.

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

Notifies eeschema about the selected item.

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

Reacts to selection change in eeschema.

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

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

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

Highlights net belonging to the item under the cursor.

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

Clears all board highlights

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

Launches a tool to pick the item whose net is going to be highlighted.

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

Updates ratsnest for selected items.

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

Hides ratsnest for selected items. Called when there are no items selected.

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

Shows local ratsnest of a component

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

Static Public Member Functions

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

UI-level access (including undo) to setting the drill origin

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

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

More...
 

Protected Types

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

Protected Member Functions

void doInteractiveItemPlacement (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_EDIT_FRAMEframe () const
 
BOARDboard () const
 
MODULEmodule () const
 
PCB_DISPLAY_OPTIONSdisplayOptions () const
 
PCB_DRAW_PANEL_GALcanvas () const
 
const SELECTIONselection () const
 
SELECTIONselection ()
 
const TOOL_EVENT evActivate (std::string aToolName="")
 functions below are not yet implemented - their interface may change More...
 
const TOOL_EVENT evCommand (int aCommandId=-1)
 
const TOOL_EVENT evCommand (std::string aCommandStr="")
 
const TOOL_EVENT evMotion ()
 
const TOOL_EVENT evClick (int aButton=BUT_ANY)
 
const TOOL_EVENT evDrag (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonUp (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonDown (int aButton=BUT_ANY)
 
void attachManager (TOOL_MANAGER *aManager)
 Function attachManager() More...
 
KIGFX::VIEWgetView () const
 Function getView() More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Function getViewControls() More...
 
template<typename T >
T * getEditFrame () const
 Function getEditFrame() More...
 
template<typename T >
T * getModel () const
 Function getModel() More...
 

Protected Attributes

bool m_editModules
 
TOOL_TYPE m_type
 

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

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

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 
TOOL_SETTINGS m_toolSettings
 

Private Types

enum  MODIFY_MODE { ON, OFF, TOGGLE }
 

Timer to initiate lazy ratsnest calculation (ie: when slow)

More...
 

Private Member Functions

void ratsnestTimer (wxTimerEvent &aEvent)
 

Event handler to recalculate dynamic ratsnest

More...
 
void calculateSelectionRatsnest ()
 

Recalculates dynamic ratsnest for the current selection

More...
 
void setTransitions () override
 

Sets up handlers for various events.

More...
 
int modifyLockSelected (MODIFY_MODE aMode)
 

Private Attributes

PCB_EDIT_FRAMEm_frame
 

Pointer to the currently used edit frame.

More...
 
TOOL_MENU m_menu
 Menu model displayed by the tool. More...
 
std::unique_ptr< KIGFX::ORIGIN_VIEWITEMm_placeOrigin
 
bool m_probingSchToPcb
 

Place & drill origin marker

More...
 
bool m_slowRatsnest
 

Recursion guard when cross-probing to EESchema

More...
 
wxTimer m_ratsnestTimer
 

Indicates current selection ratsnest will be slow to calculate

More...
 

Static Private Attributes

static const int WIDTH_STEP = 100000
 

Detailed Description

Class PCB_EDITOR_CONTROL.

Handles actions specific to the board editor in pcbnew.

Definition at line 42 of file pcb_editor_control.h.

Member Enumeration Documentation

◆ INTERACTIVE_PLACEMENT_OPTIONS

Enumerator
IPO_ROTATE 
IPO_FLIP 
IPO_PROPERTIES 
IPO_SINGLE_CLICK 
IPO_REPEAT 

Definition at line 109 of file pcb_tool_base.h.

◆ MODIFY_MODE

Timer to initiate lazy ratsnest calculation (ie: when slow)

How to modify a property for selected items.

Enumerator
ON 
OFF 
TOGGLE 

Definition at line 145 of file pcb_editor_control.h.

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determines the reason of reset for a tool

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 80 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ PCB_EDITOR_CONTROL()

PCB_EDITOR_CONTROL::PCB_EDITOR_CONTROL ( )

Definition at line 237 of file pcb_editor_control.cpp.

237  :
238  PCB_TOOL_BASE( "pcbnew.EditorControl" ),
239  m_frame( nullptr ),
240  m_menu( *this )
241 {
242  m_placeOrigin.reset( new KIGFX::ORIGIN_VIEWITEM( KIGFX::COLOR4D( 0.8, 0.0, 0.0, 1.0 ),
244  m_probingSchToPcb = false;
245  m_slowRatsnest = false;
246 }
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_placeOrigin
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool_base.h:71
PCB_EDIT_FRAME * m_frame
Pointer to the currently used edit frame.
bool m_probingSchToPcb
Place & drill origin marker
TOOL_MENU m_menu
Menu model displayed by the tool.
bool m_slowRatsnest
Recursion guard when cross-probing to EESchema
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

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

◆ ~PCB_EDITOR_CONTROL()

PCB_EDITOR_CONTROL::~PCB_EDITOR_CONTROL ( )

Definition at line 249 of file pcb_editor_control.cpp.

250 {
251 }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

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

Definition at line 49 of file tool_interactive.cpp.

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

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

Referenced by AUTOPLACE_TOOL::autoplace(), LIB_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), EDIT_TOOL::doCopyToClipboard(), SCH_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), SCH_DRAWING_TOOLS::doPlaceComponent(), SCH_DRAWING_TOOLS::doSingleClickPlace(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::drawZone(), DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), HighlightNetCursor(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), EDIT_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), EDIT_TOOL::pickCopyReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PlaceModule(), PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), ShowLocalRatsnest(), SCH_WIRE_BUS_TOOL::StartBus(), SCH_WIRE_BUS_TOOL::StartWire(), and SCH_WIRE_BUS_TOOL::UnfoldBus().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

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

Definition at line 59 of file tool_base.cpp.

60 {
61  m_toolMgr = aManager;
62  m_toolSettings = TOOL_SETTINGS( this );
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:217
friend class TOOL_SETTINGS
Definition: tool_base.h:155

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

Referenced by TOOL_MANAGER::RegisterTool().

◆ board()

BOARD* PCB_TOOL_BASE::board ( ) const
inlineprotectedinherited

Definition at line 140 of file pcb_tool_base.h.

140 { return getModel<BOARD>(); }

Referenced by PCBNEW_CONTROL::AppendBoard(), AUTOPLACE_TOOL::autoplace(), calculateSelectionRatsnest(), EDIT_TOOL::changeTrackWidthOnClick(), ClearHighlight(), MICROWAVE_TOOL::createInductorBetween(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), ROUTER_TOOL::CustomTrackWidthDialog(), EDIT_TOOL::doCopyToClipboard(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), MODULE_EDITOR_TOOLS::EnumeratePads(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::filterSelection(), POINT_EDITOR::finishItem(), SELECTION_TOOL::getCollectorsGuide(), PCBNEW_CONTROL::GraphicDisplayMode(), PAD_TOOL::haveFootprints(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), PCB_TOOL_BASE::module(), PCBNEW_CONTROL::ModuleEdgeOutlines(), PCBNEW_CONTROL::ModuleTextOutlines(), ROUTER_TOOL::onTrackViaSizeChanged(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::PadDisplayMode(), PCBNEW_CONTROL::PasteItemsFromClipboard(), PCBNEW_CONTROL::placeBoardItems(), PlaceModule(), MODULE_EDITOR_TOOLS::PlacePad(), PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), SELECTION_TOOL::RebuildSelection(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), SELECTION_TOOL::selectable(), SELECTION_TOOL::selectAllItemsConnectedToItem(), SELECTION_TOOL::selectAllItemsConnectedToTrack(), SELECTION_TOOL::selectAllItemsOnNet(), SELECTION_TOOL::selectAllItemsOnSheet(), SELECTION_TOOL::selectPoint(), ShowLocalRatsnest(), PCBNEW_CONTROL::TrackDisplayMode(), TrackWidthDec(), TrackWidthInc(), PCBNEW_CONTROL::ViaDisplayMode(), ViaSizeDec(), ViaSizeInc(), PCBNEW_CONTROL::ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), ZONE_FILLER_TOOL::ZoneFillAll(), ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

◆ calculateSelectionRatsnest()

void PCB_EDITOR_CONTROL::calculateSelectionRatsnest ( )
private

Recalculates dynamic ratsnest for the current selection

Definition at line 1232 of file pcb_editor_control.cpp.

1233 {
1234  auto selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
1235  auto& selection = selectionTool->GetSelection();
1236  auto connectivity = board()->GetConnectivity();
1237 
1238  std::vector<BOARD_ITEM*> items;
1239  items.reserve( selection.Size() );
1240 
1241  for( auto item : selection )
1242  {
1243  auto board_item = static_cast<BOARD_CONNECTED_ITEM*>( item );
1244 
1245  if( board_item->Type() != PCB_MODULE_T && board_item->GetLocalRatsnestVisible() )
1246  {
1247  items.push_back( board_item );
1248  }
1249  else if( board_item->Type() == PCB_MODULE_T )
1250  {
1251  for( auto pad : static_cast<MODULE*>( item )->Pads() )
1252  {
1253  if( pad->GetLocalRatsnestVisible() )
1254  items.push_back( pad );
1255  }
1256  }
1257  }
1258 
1259  connectivity->ComputeDynamicRatsnest( items );
1260 }
BOARD * board() const
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
class MODULE, a footprint
Definition: typeinfo.h:89
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:292
int Size() const
Returns the number of selected parts.
Definition: selection.h:125
const SELECTION & selection() const

References PCB_TOOL_BASE::board(), BOARD::GetConnectivity(), TOOL_MANAGER::GetTool(), TOOL_BASE::m_toolMgr, PCB_MODULE_T, PCB_TOOL_BASE::selection(), and SELECTION::Size().

Referenced by ratsnestTimer(), and UpdateSelectionRatsnest().

◆ canvas()

◆ ClearHighlight()

int PCB_EDITOR_CONTROL::ClearHighlight ( const TOOL_EVENT aEvent)

Clears all board highlights

Definition at line 1057 of file pcb_editor_control.cpp.

1058 {
1059  auto frame = static_cast<PCB_EDIT_FRAME*>( m_toolMgr->GetEditFrame() );
1060  auto board = static_cast<BOARD*>( m_toolMgr->GetModel() );
1062 
1063  board->ResetHighLight();
1064  render->SetHighlight( false );
1066  frame->SetMsgPanel( board );
1068  return 0;
1069 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:252
void SendCrossProbeNetName(const wxString &aNetName)
Sends a net name to eeschema for highlighting.
BOARD * board() const
Class RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output ...
Definition: painter.h:56
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
void ResetHighLight()
Function ResetHighLight Reset all high light data to the init state.
Definition: class_board.h:358
EDA_DRAW_FRAME * GetEditFrame() const
Definition: tool_manager.h:267
EDA_ITEM * GetModel() const
Definition: tool_manager.h:262
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
PCB_EDIT_FRAME * frame() const
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
void UpdateAllLayersColor()
Function UpdateAllLayersColor() Applies the new coloring scheme to all layers.
Definition: view.cpp:797

References PCB_TOOL_BASE::board(), PCB_TOOL_BASE::frame(), TOOL_MANAGER::GetEditFrame(), TOOL_MANAGER::GetModel(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), TOOL_MANAGER::GetView(), TOOL_BASE::m_toolMgr, BOARD::ResetHighLight(), PCB_EDIT_FRAME::SendCrossProbeNetName(), EDA_DRAW_FRAME::SetMsgPanel(), and KIGFX::VIEW::UpdateAllLayersColor().

Referenced by setTransitions().

◆ controls()

◆ CrossProbePcbToSch()

int PCB_EDITOR_CONTROL::CrossProbePcbToSch ( const TOOL_EVENT aEvent)

Notifies eeschema about the selected item.

Definition at line 831 of file pcb_editor_control.cpp.

832 {
833  // Don't get in an infinite loop PCB -> SCH -> PCB -> SCH -> ...
834  if( m_probingSchToPcb )
835  {
836  m_probingSchToPcb = false;
837  return 0;
838  }
839 
841  const SELECTION& selection = selTool->GetSelection();
842 
843  if( selection.Size() == 1 )
844  m_frame->SendMessageToEESCHEMA( static_cast<BOARD_ITEM*>( selection.Front() ) );
845  else
846  m_frame->SendMessageToEESCHEMA( nullptr );
847 
848  return 0;
849 }
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
SELECTION & GetSelection()
Function GetSelection()
void SendMessageToEESCHEMA(BOARD_ITEM *objectToSync)
Function SendMessageToEESCHEMA sends a message to the schematic editor so that it may move its cursor...
PCB_EDIT_FRAME * m_frame
Pointer to the currently used edit frame.
int Size() const
Returns the number of selected parts.
Definition: selection.h:125
bool m_probingSchToPcb
Place & drill origin marker
const SELECTION & selection() const
EDA_ITEM * Front() const
Definition: selection.h:155

References SELECTION::Front(), SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), m_frame, m_probingSchToPcb, TOOL_BASE::m_toolMgr, PCB_TOOL_BASE::selection(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), and SELECTION::Size().

Referenced by setTransitions().

◆ CrossProbeSchToPcb()

int PCB_EDITOR_CONTROL::CrossProbeSchToPcb ( const TOOL_EVENT aEvent)

Reacts to selection change in eeschema.

Definition at line 852 of file pcb_editor_control.cpp.

853 {
854  BOARD_ITEM* item = aEvent.Parameter<BOARD_ITEM*>();
855 
856  if( item )
857  {
858  m_probingSchToPcb = true;
859  getView()->SetCenter( VECTOR2D( item->GetPosition() ) );
861 
862  // If it is a pad and the net highlighting tool is enabled, highlight the net
863  if( item->Type() == PCB_PAD_T && m_frame->GetToolId() == ID_PCB_HIGHLIGHT_BUTT )
864  {
865  int net = static_cast<D_PAD*>( item )->GetNetCode();
867  }
868  else
869  // Otherwise simply select the corresponding item
870  {
872  // Ensure the display is refreshed, because in some installs
873  // the refresh is done only when the gal canvas has the focus, and
874  // that is not the case when crossprobing from Eeschema:
876  }
877  }
878 
879  return 0;
880 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:931
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:601
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:378
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
virtual const wxPoint GetPosition() const =0
static TOOL_ACTION highlightNet
Definition: pcb_actions.h:312
PCB_EDIT_FRAME * m_frame
Pointer to the currently used edit frame.
static TOOL_ACTION selectItem
Selects an item (specified as the event parameter).
Definition: pcb_actions.h:56
bool m_probingSchToPcb
Place & drill origin marker
int GetToolId() const
Definition: draw_frame.h:524
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

References EDA_DRAW_FRAME::GetGalCanvas(), BOARD_ITEM::GetPosition(), EDA_DRAW_FRAME::GetToolId(), TOOL_BASE::getView(), PCB_ACTIONS::highlightNet, ID_PCB_HIGHLIGHT_BUTT, m_frame, m_probingSchToPcb, TOOL_BASE::m_toolMgr, TOOL_EVENT::Parameter(), PCB_PAD_T, EDA_DRAW_PANEL_GAL::Refresh(), TOOL_MANAGER::RunAction(), PCB_ACTIONS::selectionClear, PCB_ACTIONS::selectItem, KIGFX::VIEW::SetCenter(), and EDA_ITEM::Type().

Referenced by setTransitions().

◆ displayOptions()

◆ doInteractiveItemPlacement()

void PCB_TOOL_BASE::doInteractiveItemPlacement ( 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  Activate();
47 
48  BOARD_COMMIT commit( frame() );
49 
51 
52  // do not capture or auto-pan until we start placing an item
53  controls()->ShowCursor( true );
54  controls()->SetSnapping( true );
55 
56  // Add a VIEW_GROUP that serves as a preview for the new item
57  SELECTION preview;
58  view()->Add( &preview );
59 
60  aPlacer->m_board = board();
61  aPlacer->m_frame = frame();
62  aPlacer->m_modifiers = 0;
63 
64  if( aOptions & IPO_SINGLE_CLICK && !( aOptions & IPO_PROPERTIES ) )
65  {
66  VECTOR2I cursorPos = controls()->GetCursorPosition();
67 
68  newItem = aPlacer->CreateItem();
69 
70  if( newItem )
71  {
72  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
73  preview.Add( newItem.get() );
74  }
75  }
76 
77  // Main loop: keep receiving events
78  while( OPT_TOOL_EVENT evt = Wait() )
79  {
80  VECTOR2I cursorPos = controls()->GetCursorPosition();
81  aPlacer->m_modifiers = evt->Modifier();
82 
84  {
85  if( newItem )
86  {
87  // Delete the old item and have another try
88  newItem = nullptr;
89 
90  preview.Clear();
91 
92  if( aOptions & IPO_SINGLE_CLICK )
93  break;
94 
95  controls()->SetAutoPan( false );
96  controls()->CaptureCursor( false );
97  controls()->ShowCursor( true );
98  }
99  else
100  {
101  break;
102  }
103 
104  if( evt->IsActivate() ) // now finish unconditionally
105  break;
106  }
107  else if( evt->IsClick( BUT_LEFT ) )
108  {
109  if( !newItem )
110  {
111  // create the item if possible
112  newItem = aPlacer->CreateItem();
113 
114  // no item created, so wait for another click
115  if( !newItem )
116  continue;
117 
118  controls()->CaptureCursor( true );
119  controls()->SetAutoPan( true );
120 
121  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
122 
123  preview.Add( newItem.get() );
124 
125  if( newItem->Type() == PCB_MODULE_T )
126  {
127  auto module = dyn_cast<MODULE*>( newItem.get() );
128 
129  // modules have more drawable parts
130  module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
131  }
132  }
133  else
134  {
135  auto oldFlags = newItem->GetFlags();
136  newItem->ClearFlags();
137 
138  if( !aPlacer->PlaceItem( newItem.get(), commit ) )
139  {
140  newItem->SetFlags( oldFlags );
141  continue;
142  }
143 
144  preview.Remove( newItem.get() );
145 
146  if( newItem->Type() == PCB_MODULE_T )
147  {
148  auto module = dyn_cast<MODULE*>( newItem.get() );
149  module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Remove, &preview, _1 ) );
150  }
151 
152  newItem.release();
153  commit.Push( aCommitMessage );
154 
155  controls()->CaptureCursor( false );
156  controls()->SetAutoPan( false );
157  controls()->ShowCursor( true );
158 
159  if( !( aOptions & IPO_REPEAT ) )
160  break;
161 
162  if( aOptions & IPO_SINGLE_CLICK && !( aOptions & IPO_PROPERTIES ) )
163  {
165 
166  newItem = aPlacer->CreateItem();
167 
168  if( newItem )
169  {
170  newItem->SetPosition( wxPoint( pos.x, pos.y ) );
171  preview.Add( newItem.get() );
172  }
173  }
174  }
175  }
176  else if( evt->IsClick( BUT_RIGHT ) )
177  {
179  }
180  else if( newItem && evt->Category() == TC_COMMAND )
181  {
182  /*
183  * Handle any events that can affect the item as we move
184  * it around, eg rotate and flip
185  */
186 
187  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) && ( aOptions & IPO_ROTATE ) )
188  {
189  const int rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *frame(), *evt );
190  newItem->Rotate( newItem->GetPosition(), rotationAngle );
191  view()->Update( &preview );
192  }
193  else if( evt->IsAction( &PCB_ACTIONS::flip ) && ( aOptions & IPO_FLIP ) )
194  {
195  newItem->Flip( newItem->GetPosition() );
196  view()->Update( &preview );
197  }
198  }
199 
200  else if( newItem && evt->IsMotion() )
201  {
202  // track the cursor
203  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
204  aPlacer->SnapItem( newItem.get() );
205 
206  // Show a preview of the item
207  view()->Update( &preview );
208  }
209  }
210 
211  view()->Remove( &preview );
212 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
TOOL_MENU m_menu
Menu model displayed by the tool.
virtual void Clear() override
Function Clear() Removes all the stored items from the group.
Definition: selection.h:93
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction)
Function RunOnChildren.
virtual bool PlaceItem(BOARD_ITEM *aItem, BOARD_COMMIT &aCommit)
BOARD * board() const
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:91
virtual std::unique_ptr< BOARD_ITEM > CreateItem()=0
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
PCB_EDIT_FRAME * m_frame
Definition: pcb_tool_base.h:58
bool IsRotateToolEvt(const TOOL_EVENT &aEvt)
Function isRotateToolEvt()
virtual void Remove(VIEW_ITEM *aItem) override
Function Remove() Removes a VIEW_ITEM from the view.
Definition: pcb_view.cpp:74
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:74
TOOL_MANAGER * GetManager() const
Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool.
Definition: tool_base.h:144
virtual void SnapItem(BOARD_ITEM *aItem)
class MODULE, a footprint
Definition: typeinfo.h:89
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
KIGFX::PCB_VIEW * view() const
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes an item from the group.
Definition: view_group.cpp:61
bool IsCancelInteractive(const TOOL_EVENT &aEvt)
Function IsCancelInteractive()
Definition: tool_event.cpp:177
virtual void Add(VIEW_ITEM *aItem)
Function Add() Adds an item to the group.
Definition: view_group.cpp:55
PCB_EDIT_FRAME * frame() const
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
static TOOL_ACTION flip
Flipping of selected objects.
Definition: pcb_actions.h:99
KIGFX::VIEW_CONTROLS * controls() const
MODULE * module() const
void Activate()
Function Activate() Runs the tool.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Function Add() Adds a VIEW_ITEM to the view.
Definition: pcb_view.cpp:58
int GetEventRotationAngle(const PCB_BASE_EDIT_FRAME &aFrame, const TOOL_EVENT &aEvt)
Function getEventRotationAngle()
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:486
virtual void Remove(EDA_ITEM *aItem)
Definition: selection.h:85

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

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

◆ DoSetDrillOrigin()

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

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

Definition at line 883 of file pcb_editor_control.cpp.

885 {
886  aFrame->SetAuxOrigin( wxPoint( aPosition.x, aPosition.y ) );
887  originViewItem->SetPosition( wxPoint( aPosition.x, aPosition.y ) );
888  aView->MarkDirty();
889  aFrame->OnModify();
890  return true;
891 }
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
void SetAuxOrigin(const wxPoint &aPoint) override
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:621

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

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

◆ DrillOrigin()

int PCB_EDITOR_CONTROL::DrillOrigin ( const TOOL_EVENT aEvent)

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

Definition at line 902 of file pcb_editor_control.cpp.

903 {
904  Activate();
905 
907  assert( picker );
908 
909  m_frame->SetToolID( ID_PCB_PLACE_OFFSET_COORD_BUTT, wxCURSOR_HAND, _( "Adjust zero" ) );
910  picker->SetClickHandler( std::bind( SetDrillOrigin, getView(), m_frame,
911  m_placeOrigin.get(), _1 ) );
912  picker->Activate();
913  Wait();
914 
915  return 0;
916 }
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg) override
Set the tool command ID to aId and sets the cursor to aCursor.
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_placeOrigin
void SetClickHandler(CLICK_HANDLER aHandler)
Function SetClickHandler() Sets a handler for mouse click event.
Definition: picker_tool.h:83
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
Generic tool for picking a point.
Definition: picker_tool.h:34
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
PCB_EDIT_FRAME * m_frame
Pointer to the currently used edit frame.
void Activate()
Function Activate() Runs the tool.
static bool SetDrillOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, BOARD_ITEM *aItem, const VECTOR2D &aPoint)
UI-level access (including undo) to setting the drill origin

References TOOL_INTERACTIVE::Activate(), TOOL_MANAGER::GetTool(), TOOL_BASE::getView(), ID_PCB_PLACE_OFFSET_COORD_BUTT, m_frame, m_placeOrigin, TOOL_BASE::m_toolMgr, PICKER_TOOL::SetClickHandler(), SetDrillOrigin(), PCB_BASE_FRAME::SetToolID(), and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

◆ EditingModules()

bool PCB_TOOL_BASE::EditingModules ( ) const
inlineinherited

◆ evActivate()

const TOOL_EVENT TOOL_INTERACTIVE::evActivate ( std::string  aToolName = "")
protectedinherited

functions below are not yet implemented - their interface may change

◆ evButtonDown()

const TOOL_EVENT TOOL_INTERACTIVE::evButtonDown ( int  aButton = BUT_ANY)
protectedinherited

◆ evButtonUp()

const TOOL_EVENT TOOL_INTERACTIVE::evButtonUp ( int  aButton = BUT_ANY)
protectedinherited

◆ evClick()

const TOOL_EVENT TOOL_INTERACTIVE::evClick ( int  aButton = BUT_ANY)
protectedinherited

◆ evCommand() [1/2]

const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( int  aCommandId = -1)
protectedinherited

◆ evCommand() [2/2]

const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( std::string  aCommandStr = "")
protectedinherited

◆ evDrag()

const TOOL_EVENT TOOL_INTERACTIVE::evDrag ( int  aButton = BUT_ANY)
protectedinherited

◆ evMotion()

const TOOL_EVENT TOOL_INTERACTIVE::evMotion ( )
protectedinherited

◆ frame()

PCB_EDIT_FRAME* PCB_TOOL_BASE::frame ( ) const
inlineprotectedinherited

Definition at line 139 of file pcb_tool_base.h.

139 { return getEditFrame<PCB_EDIT_FRAME>(); }

Referenced by POINT_EDITOR::addCorner(), MICROWAVE_TOOL::addMicrowaveFootprint(), AUTOPLACE_TOOL::autoplace(), PCB_TOOL_BASE::canvas(), EDIT_TOOL::changeTrackWidthOnClick(), PNS::TOOL_BASE::checkSnap(), ClearHighlight(), PAD_TOOL::copyPadSettings(), MICROWAVE_TOOL::createInductorBetween(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), ROUTER_TOOL::CustomTrackWidthDialog(), PCB_TOOL_BASE::displayOptions(), EDIT_TOOL::doCopyToClipboard(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ROUTER_TOOL::DpDimensionsDialog(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::drawZone(), MODULE_EDITOR_TOOLS::EnumeratePads(), EDIT_TOOL::ExchangeFootprints(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), ROUTER_TOOL::finishInteractive(), PAD_TOOL::Init(), EDIT_TOOL::Init(), SELECTION_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::PasteItemsFromClipboard(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), MODULE_EDITOR_TOOLS::PlacePad(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PAD_TOOL::pushPadSettings(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), PNS::TOOL_BASE::Reset(), ROUTER_TOOL::RouteDiffPair(), ROUTER_TOOL::RouteSingleTrace(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ROUTER_TOOL::SettingsDialog(), ROUTER_TOOL::switchLayerOnViaPlacement(), LENGTH_TUNER_TOOL::TuneDiffPair(), LENGTH_TUNER_TOOL::TuneDiffPairSkew(), LENGTH_TUNER_TOOL::TuneSingleTrace(), POINT_EDITOR::updateItem(), ZONE_FILLER_TOOL::ZoneFill(), and ZONE_FILLER_TOOL::ZoneFillAll().

◆ getEditFrame()

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

Function getEditFrame()

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

Definition at line 188 of file tool_base.h.

189  {
190  return static_cast<T*>( getEditFrameInt() );
191  }
wxWindow * getEditFrameInt() const
Definition: tool_base.cpp:47

References TOOL_BASE::getEditFrameInt().

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

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

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

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 122 of file tool_base.h.

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

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 144 of file tool_base.h.

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

References TOOL_BASE::m_toolMgr.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), ZONE_CREATE_HELPER::createNewZone(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ACTION_MENU::getToolManager(), ACTION_MENU::onMenuEvent(), and ZONE_CREATE_HELPER::performZoneCutout().

◆ getModel()

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

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 199 of file tool_base.h.

200  {
201  EDA_ITEM* m = getModelInt();
202  wxASSERT( dynamic_cast<T*>( m ) );
203 
204  return static_cast<T*>( m );
205  }
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:53
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:157

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Function GetName() Returns the name of the tool.

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

Returns
The name of the tool.

Definition at line 133 of file tool_base.h.

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

References TOOL_BASE::m_toolName.

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

◆ GetSettings()

TOOL_SETTINGS & TOOL_BASE::GetSettings ( )
inherited

Definition at line 77 of file tool_base.cpp.

78 {
79  return m_toolSettings;
80 }
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:217

References TOOL_BASE::m_toolSettings.

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

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 111 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

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

Function getView()

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

Returns
The instance of VIEW.

Definition at line 35 of file tool_base.cpp.

36 {
37  return m_toolMgr->GetView();
38 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:252
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216

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

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), EE_SELECTION_TOOL::clearSelection(), CrossProbeSchToPcb(), COMMON_TOOLS::CursorControl(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), COMMON_TOOLS::doGridPreset(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), MICROWAVE_TOOL::drawMicrowaveInductor(), DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findCallback(), ROUTER_TOOL::getStartLayer(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::guessSelectionCandidates(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), EE_POINT_EDITOR::Main(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), LIB_EDIT_TOOL::Paste(), PNS::TOOL_BASE::pickSingleItem(), PlaceModule(), PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), Reset(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), SELECTION_TOOL::selectable(), GERBVIEW_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), GERBVIEW_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), COMMON_TOOLS::ToggleGrid(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), PCBNEW_CONTROL::updateGrid(), EE_POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_TOOL_BASE::view(), COMMON_TOOLS::ZoomFitScreen(), GERBVIEW_SELECTION_TOOL::zoomFitSelection(), SELECTION_TOOL::zoomFitSelection(), CVPCB_SELECTION_TOOL::~CVPCB_SELECTION_TOOL(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

◆ getViewControls()

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

Function getViewControls()

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

Returns
The instance of VIEW_CONTROLS.

Definition at line 41 of file tool_base.cpp.

42 {
43  return m_toolMgr->GetViewControls();
44 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:257

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

Referenced by EE_POINT_EDITOR::addCorner(), POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), COMMON_TOOLS::CursorControl(), SCH_WIRE_BUS_TOOL::doDrawSegments(), SCH_DRAWING_TOOLS::doPlaceComponent(), SCH_DRAWING_TOOLS::doSingleClickPlace(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), COMMON_TOOLS::doZoomToPreset(), MICROWAVE_TOOL::drawMicrowaveInductor(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findMove(), SCH_WIRE_BUS_TOOL::finishSegments(), SCH_EDITOR_CONTROL::HighlightNet(), HighlightNet(), HighlightNetCursor(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), EE_PICKER_TOOL::Main(), PICKER_TOOL::Main(), CVPCB_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EDIT_TOOL::Main(), ROUTER_TOOL::mainLoop(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceImage(), PlaceModule(), PlaceTarget(), SCH_EDIT_TOOL::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), CVPCB_CONTROL::ResetCoords(), GERBVIEW_CONTROL::ResetCoords(), PCBNEW_CONTROL::ResetCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), GERBVIEW_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), EE_PICKER_TOOL::setControls(), PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), POINT_EDITOR::setEditedPoint(), LIB_MOVE_TOOL::updateModificationPoint(), SCH_MOVE_TOOL::updateModificationPoint(), EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

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

Function Go()

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

Definition at line 135 of file tool_interactive.h.

137 {
138  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
139 
140  goInternal( sptr, aConditions );
141 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:59
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)

References TOOL_INTERACTIVE::goInternal().

Referenced by ZOOM_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), EE_POINT_EDITOR::setTransitions(), LIB_CONTROL::setTransitions(), LIB_PIN_TOOL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), LIB_MOVE_TOOL::setTransitions(), POINT_EDITOR::setTransitions(), GERBVIEW_CONTROL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), CVPCB_SELECTION_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), MODULE_EDITOR_TOOLS::setTransitions(), SCH_WIRE_BUS_TOOL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), EE_PICKER_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), setTransitions(), SELECTION_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), DRAWING_TOOL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ HideSelectionRatsnest()

int PCB_EDITOR_CONTROL::HideSelectionRatsnest ( const TOOL_EVENT aEvent)

Hides ratsnest for selected items. Called when there are no items selected.

Definition at line 1215 of file pcb_editor_control.cpp.

1216 {
1217  getModel<BOARD>()->GetConnectivity()->ClearDynamicRatsnest();
1218  m_slowRatsnest = false;
1219  return 0;
1220 }
bool m_slowRatsnest
Recursion guard when cross-probing to EESchema

References m_slowRatsnest.

Referenced by setTransitions().

◆ HighlightNet()

int PCB_EDITOR_CONTROL::HighlightNet ( const TOOL_EVENT aEvent)

Highlights net belonging to the item under the cursor.

Definition at line 1037 of file pcb_editor_control.cpp.

1038 {
1039  int netcode = aEvent.Parameter<intptr_t>();
1040 
1041  if( netcode > 0 )
1042  {
1044  render->SetHighlight( true, netcode );
1046  }
1047  else
1048  {
1049  // No net code specified, pick the net code belonging to the item under the cursor
1050  highlightNet( m_toolMgr, getViewControls()->GetMousePosition() );
1051  }
1052 
1053  return 0;
1054 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:252
Class RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output ...
Definition: painter.h:56
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:378
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
static bool highlightNet(TOOL_MANAGER *aToolMgr, const VECTOR2D &aPosition, bool aUseSelection=false)
Look for a BOARD_CONNECTED_ITEM in a given spot and if one is found - it enables highlight for its ne...
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
void UpdateAllLayersColor()
Function UpdateAllLayersColor() Applies the new coloring scheme to all layers.
Definition: view.cpp:797
void SetHighlight(bool aEnabled, int aNetcode=-1)
Function SetHighlight Turns on/off highlighting - it may be done for the active layer or the specifie...
Definition: painter.h:140

References KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), TOOL_MANAGER::GetView(), TOOL_BASE::getViewControls(), highlightNet(), TOOL_BASE::m_toolMgr, TOOL_EVENT::Parameter(), KIGFX::RENDER_SETTINGS::SetHighlight(), and KIGFX::VIEW::UpdateAllLayersColor().

Referenced by setTransitions().

◆ HighlightNetCursor()

int PCB_EDITOR_CONTROL::HighlightNetCursor ( const TOOL_EVENT aEvent)

Launches a tool to pick the item whose net is going to be highlighted.

Definition at line 1072 of file pcb_editor_control.cpp.

1073 {
1074  // If the keyboard hotkey was triggered, the behavior is as follows:
1075  // If we are already in the highlight tool, behave the same as a left click.
1076  // If we are not, highlight the net of the selected item(s), or if there is
1077  // no selection, then behave like a Ctrl+Left Click.
1079  {
1080  bool use_selection = ( m_frame->GetToolId() != ID_PCB_HIGHLIGHT_BUTT );
1081  highlightNet( m_toolMgr, getViewControls()->GetMousePosition(),
1082  use_selection );
1083  }
1084 
1085  Activate();
1086 
1087  PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
1088  assert( picker );
1089 
1090  m_frame->SetToolID( ID_PCB_HIGHLIGHT_BUTT, wxCURSOR_HAND, _( "Highlight net" ) );
1091  picker->SetClickHandler( std::bind( highlightNet, m_toolMgr, _1, false ) );
1092  picker->SetLayerSet( LSET::AllCuMask() );
1093  picker->Activate();
1094  Wait();
1095 
1096  return 0;
1097 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:676
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg) override
Set the tool command ID to aId and sets the cursor to aCursor.
void SetClickHandler(CLICK_HANDLER aHandler)
Function SetClickHandler() Sets a handler for mouse click event.
Definition: picker_tool.h:83
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:54
Generic tool for picking a point.
Definition: picker_tool.h:34
void SetLayerSet(LSET aLayerSet)
Function SetLayerSet() Sets the tool's snap layer set.
Definition: picker_tool.h:76
static TOOL_ACTION highlightNetSelection
Definition: pcb_actions.h:314
PCB_EDIT_FRAME * m_frame
Pointer to the currently used edit frame.
void Activate()
Function Activate() Runs the tool.
static bool highlightNet(TOOL_MANAGER *aToolMgr, const VECTOR2D &aPosition, bool aUseSelection=false)
Look for a BOARD_CONNECTED_ITEM in a given spot and if one is found - it enables highlight for its ne...
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
int GetToolId() const
Definition: draw_frame.h:524

References TOOL_INTERACTIVE::Activate(), LSET::AllCuMask(), TOOL_MANAGER::GetTool(), EDA_DRAW_FRAME::GetToolId(), TOOL_BASE::getViewControls(), highlightNet(), PCB_ACTIONS::highlightNetSelection, ID_PCB_HIGHLIGHT_BUTT, TOOL_EVENT::IsAction(), m_frame, TOOL_BASE::m_toolMgr, PICKER_TOOL::SetClickHandler(), PICKER_TOOL::SetLayerSet(), PCB_BASE_FRAME::SetToolID(), and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

◆ Init()

bool PCB_EDITOR_CONTROL::Init ( )
overridevirtual

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

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

Reimplemented from PCB_TOOL_BASE.

Definition at line 267 of file pcb_editor_control.cpp.

268 {
269  auto activeToolCondition = [ this ] ( const SELECTION& aSel ) {
270  return ( m_frame->GetToolId() != ID_NO_TOOL_SELECTED );
271  };
272 
273  auto inactiveStateCondition = [ this ] ( const SELECTION& aSel ) {
274  return ( m_frame->GetToolId() == ID_NO_TOOL_SELECTED && aSel.Size() == 0 );
275  };
276 
277  auto placeModuleCondition = [ this ] ( const SELECTION& aSel ) {
278  return ( m_frame->GetToolId() == ID_PCB_MODULE_BUTT && aSel.GetSize() == 0 );
279  };
280 
281  auto& ctxMenu = m_menu.GetMenu();
282 
283  // "Cancel" goes at the top of the context menu when a tool is active
284  ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolCondition, 1000 );
285  ctxMenu.AddSeparator( activeToolCondition, 1000 );
286 
287  // "Get and Place Footprint" should be available for Place Footprint tool
288  ctxMenu.AddItem( PCB_ACTIONS::findMove, placeModuleCondition, 1000 );
289  ctxMenu.AddSeparator( placeModuleCondition, 1000 );
290 
291  // Finally, add the standard zoom & grid items
292  m_menu.AddStandardSubMenus( getEditFrame<PCB_BASE_FRAME>() );
293 
294  auto zoneMenu = std::make_shared<ZONE_CONTEXT_MENU>();
295  zoneMenu->SetTool( this );
296 
297  auto lockMenu = std::make_shared<LOCK_CONTEXT_MENU>();
298  lockMenu->SetTool( this );
299 
300  // Add the PCB control menus to relevant other tools
301 
303 
304  if( selTool )
305  {
306  auto& toolMenu = selTool->GetToolMenu();
307  auto& menu = toolMenu.GetMenu();
308 
309  // Add "Get and Place Footprint" when Selection tool is in an inactive state
310  menu.AddItem( PCB_ACTIONS::findMove, inactiveStateCondition );
311  menu.AddSeparator( inactiveStateCondition );
312 
313  toolMenu.AddSubMenu( zoneMenu );
314  toolMenu.AddSubMenu( lockMenu );
315 
316  menu.AddMenu( zoneMenu.get(), SELECTION_CONDITIONS::OnlyType( PCB_ZONE_AREA_T ), 200 );
317  menu.AddMenu( lockMenu.get(), SELECTION_CONDITIONS::OnlyTypes( GENERAL_COLLECTOR::LockableItems ), 200 );
318  }
319 
320  DRAWING_TOOL* drawingTool = m_toolMgr->GetTool<DRAWING_TOOL>();
321 
322  if( drawingTool )
323  {
324  auto& toolMenu = drawingTool->GetToolMenu();
325  auto& menu = toolMenu.GetMenu();
326 
327  toolMenu.AddSubMenu( zoneMenu );
328 
329  // Functor to say if the PCB_EDIT_FRAME is in a given mode
330  // Capture the tool pointer and tool mode by value
331  auto toolActiveFunctor = [=]( DRAWING_TOOL::MODE aMode )
332  {
333  return [=]( const SELECTION& sel )
334  {
335  return drawingTool->GetDrawingMode() == aMode;
336  };
337  };
338 
339  menu.AddMenu( zoneMenu.get(), toolActiveFunctor( DRAWING_TOOL::MODE::ZONE ), 200 );
340  }
341 
342  m_ratsnestTimer.SetOwner( this );
343  Connect( m_ratsnestTimer.GetId(), wxEVT_TIMER,
344  wxTimerEventHandler( PCB_EDITOR_CONTROL::ratsnestTimer ), NULL, this );
345 
346  return true;
347 }
void AddStandardSubMenus(EDA_DRAW_FRAME *aFrame)
Function CreateBasicMenu.
Definition: tool_menu.cpp:83
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Function OnlyTypes Creates a functor that tests if the selected items are only of given types.
Class SELECTION_TOOL.
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
TOOL_MENU & GetToolMenu()
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
static TOOL_ACTION cancelInteractive
Definition: actions.h:45
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:100
wxTimer m_ratsnestTimer
Indicates current selection ratsnest will be slow to calculate
TOOL_MENU & GetToolMenu()
Get the DRAWING_TOOL top-level context menu
Definition: drawing_tool.h:62
Class DRAWING_TOOL.
Definition: drawing_tool.h:49
void ratsnestTimer(wxTimerEvent &aEvent)
Event handler to recalculate dynamic ratsnest
static const KICAD_T LockableItems[]
A scan list for TRACKS, VIAS, MODULES.
Definition: collectors.h:318
MODE
The possible drawing modes of DRAWING_TOOL
Definition: drawing_tool.h:68
PCB_EDIT_FRAME * m_frame
Pointer to the currently used edit frame.
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Function OnlyType Creates a functor that tests if the selected items are only of given type.
TOOL_MENU m_menu
Menu model displayed by the tool.
static TOOL_ACTION findMove
Find an item and start moving.
Definition: pcb_actions.h:330
MODE GetDrawingMode() const
Function GetDrawingMode.
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()
int GetToolId() const
Definition: draw_frame.h:524

References CONDITIONAL_MENU::AddItem(), TOOL_MENU::AddStandardSubMenus(), ACTIONS::cancelInteractive, PCB_ACTIONS::findMove, DRAWING_TOOL::GetDrawingMode(), TOOL_MENU::GetMenu(), TOOL_MANAGER::GetTool(), EDA_DRAW_FRAME::GetToolId(), DRAWING_TOOL::GetToolMenu(), SELECTION_TOOL::GetToolMenu(), ID_NO_TOOL_SELECTED, ID_PCB_MODULE_BUTT, GENERAL_COLLECTOR::LockableItems, m_frame, m_menu, m_ratsnestTimer, TOOL_BASE::m_toolMgr, SELECTION_CONDITIONS::OnlyType(), SELECTION_CONDITIONS::OnlyTypes(), PCB_ZONE_AREA_T, ratsnestTimer(), and DRAWING_TOOL::ZONE.

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 30 of file tool_base.cpp.

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

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

◆ LockSelected()

int PCB_EDITOR_CONTROL::LockSelected ( const TOOL_EVENT aEvent)

Locks selected items.

Definition at line 542 of file pcb_editor_control.cpp.

543 {
544  return modifyLockSelected( ON );
545 }
int modifyLockSelected(MODIFY_MODE aMode)

References modifyLockSelected(), and ON.

Referenced by setTransitions().

◆ modifyLockSelected()

int PCB_EDITOR_CONTROL::modifyLockSelected ( MODIFY_MODE  aMode)
private

Definition at line 554 of file pcb_editor_control.cpp.

555 {
557  const SELECTION& selection = selTool->GetSelection();
558 
559  if( selection.Empty() )
561 
562  bool modified = false;
563 
564  for( auto i : selection )
565  {
566  auto item = static_cast<BOARD_ITEM*>( i );
567  bool prevState = item->IsLocked();
568 
569  switch( aMode )
570  {
571  case ON:
572  item->SetLocked( true );
573  break;
574 
575  case OFF:
576  item->SetLocked( false );
577  break;
578 
579  case TOGGLE:
580  item->SetLocked( !prevState );
581  break;
582  }
583 
584  // Check if we really modified an item
585  if( !modified && prevState != item->IsLocked() )
586  modified = true;
587  }
588 
589  if( modified )
590  m_frame->OnModify();
591 
592  return 0;
593 }
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
SELECTION & GetSelection()
Function GetSelection()
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:119
PCB_EDIT_FRAME * m_frame
Pointer to the currently used edit frame.
size_t i
Definition: json11.cpp:597
const SELECTION & selection() const
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
Definition: pcb_actions.h:50

References SELECTION::Empty(), SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), i, m_frame, TOOL_BASE::m_toolMgr, OFF, ON, PCB_EDIT_FRAME::OnModify(), TOOL_MANAGER::RunAction(), PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionCursor, and TOGGLE.

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

◆ module()

◆ PlaceModule()

int PCB_EDITOR_CONTROL::PlaceModule ( const TOOL_EVENT aEvent)

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

Definition at line 419 of file pcb_editor_control.cpp.

420 {
421  MODULE* module = aEvent.Parameter<MODULE*>();
424  SELECTION& selection = selTool->GetSelection();
425  BOARD_COMMIT commit( m_frame );
426  BOARD* board = getModel<BOARD>();
427 
429  controls->ShowCursor( true );
430  controls->SetSnapping( true );
431 
432  Activate();
433  m_frame->SetToolID( ID_PCB_MODULE_BUTT, wxCURSOR_PENCIL, _( "Add footprint" ) );
434 
435  // Add all the drawable parts to preview
436  VECTOR2I cursorPos = controls->GetCursorPosition();
437 
438  if( module )
439  {
440  module->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
442  }
443 
444  bool reselect = false;
445 
446  // Main loop: keep receiving events
447  while( OPT_TOOL_EVENT evt = Wait() )
448  {
449  cursorPos = controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
450 
451  if( reselect && module )
453 
455  {
456  if( module )
457  {
459  commit.Revert();
460  module = NULL;
461  }
462  else // let's have another chance placing a module
463  break;
464 
465  if( evt->IsActivate() ) // now finish unconditionally
466  break;
467  }
468 
469  else if( evt->IsClick( BUT_LEFT ) )
470  {
471  if( !module )
472  {
473  // Pick the module to be placed
475 
476  if( module == NULL )
477  continue;
478 
479  module->SetLink( 0 );
480 
481  module->SetFlags( IS_NEW ); // whatever
483 
484  // Set parent so that clearance can be loaded
485  module->SetParent( board );
486 
487  // Put it on FRONT layer,
488  // (Can be stored flipped if the lib is an archive built from a board)
489  if( module->IsFlipped() )
490  module->Flip( module->GetPosition() );
491 
492  module->SetOrientation( 0 );
493  module->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
494 
495  commit.Add( module );
497  controls->SetCursorPosition( cursorPos, false );
498  }
499  else
500  {
502  commit.Push( _( "Place a module" ) );
503  module = NULL; // to indicate that there is no module that we currently modify
504  }
505  }
506 
507  else if( evt->IsClick( BUT_RIGHT ) )
508  {
510  }
511 
512  else if( module && evt->IsMotion() )
513  {
514  module->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
515  selection.SetReferencePoint( cursorPos );
516  getView()->Update( &selection );
517  }
518 
519  else if( module && evt->IsAction( &PCB_ACTIONS::properties ) )
520  {
521  // Calling 'Properties' action clears the selection, so we need to restore it
522  reselect = true;
523  }
524 
525  // Enable autopanning and cursor capture only when there is a module to be placed
526  controls->SetAutoPan( !!module );
528  }
529 
531 
532  return 0;
533 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg) override
Set the tool command ID to aId and sets the cursor to aCursor.
BOARD * board() const
bool IsFlipped() const
function IsFlipped
Definition: class_module.h:258
void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
static TOOL_ACTION properties
Activation of the edit tool.
Definition: pcb_actions.h:105
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:208
timestamp_t GetNewTimeStamp()
Definition: common.cpp:217
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:259
void SetLink(timestamp_t aLink)
Definition: class_module.h:568
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:219
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:378
MODULE * SelectFootprintFromLibTree(LIB_ID aPreselect=LIB_ID(), bool aAllowBroswer=true)
Function SelectFootprintFromLibTree opens a dialog to select a footprint.
SELECTION & GetSelection()
Function GetSelection()
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
void SetPosition(const wxPoint &aPos) override
bool IsCancelInteractive(const TOOL_EVENT &aEvt)
Function IsCancelInteractive()
Definition: tool_event.cpp:177
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1539
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
virtual void SetNoToolSelected()
Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
KIGFX::VIEW_CONTROLS * controls() const
PCB_EDIT_FRAME * m_frame
Pointer to the currently used edit frame.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
MODULE * module() const
void SetOrientation(double newangle)
static TOOL_ACTION selectItem
Selects an item (specified as the event parameter).
Definition: pcb_actions.h:56
void Activate()
Function Activate() Runs the tool.
TOOL_MENU m_menu
Menu model displayed by the tool.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
const SELECTION & selection() const
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
const wxPoint GetPosition() const override
Definition: class_module.h:183
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false)=0
Moves cursor to the requested position expressed in world coordinates.
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:486
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:209

References TOOL_INTERACTIVE::Activate(), COMMIT::Add(), PCB_TOOL_BASE::board(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), PCB_TOOL_BASE::controls(), MODULE::Flip(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), GetNewTimeStamp(), MODULE::GetPosition(), SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), ID_PCB_MODULE_BUTT, IS_NEW, TOOL_EVT_UTILS::IsCancelInteractive(), MODULE::IsFlipped(), m_frame, m_menu, TOOL_BASE::m_toolMgr, MD_ALT, PCB_TOOL_BASE::module(), TOOL_EVENT::Parameter(), PCB_ACTIONS::properties, BOARD_COMMIT::Push(), BOARD_COMMIT::Revert(), TOOL_MANAGER::RunAction(), PCB_BASE_FRAME::SelectFootprintFromLibTree(), PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionClear, PCB_ACTIONS::selectItem, KIGFX::VIEW_CONTROLS::SetAutoPan(), KIGFX::VIEW_CONTROLS::SetCursorPosition(), EDA_ITEM::SetFlags(), MODULE::SetLink(), EDA_DRAW_FRAME::SetNoToolSelected(), MODULE::SetOrientation(), EDA_ITEM::SetParent(), MODULE::SetPosition(), SELECTION::SetReferencePoint(), KIGFX::VIEW_CONTROLS::SetSnapping(), EDA_ITEM::SetTimeStamp(), PCB_BASE_FRAME::SetToolID(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), KIGFX::VIEW::Update(), TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

◆ PlaceTarget()

int PCB_EDITOR_CONTROL::PlaceTarget ( const TOOL_EVENT aEvent)

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

Definition at line 596 of file pcb_editor_control.cpp.

597 {
598  KIGFX::VIEW* view = getView();
600  BOARD* board = getModel<BOARD>();
601  PCB_TARGET* target = new PCB_TARGET( board );
602 
603  // Init the new item attributes
604  target->SetLayer( Edge_Cuts );
606  target->SetSize( Millimeter2iu( 5 ) );
607  VECTOR2I cursorPos = controls->GetCursorPosition();
608  target->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
609 
610  // Add a VIEW_GROUP that serves as a preview for the new item
611  KIGFX::VIEW_GROUP preview( view );
612  preview.Add( target );
613  view->Add( &preview );
614 
616  controls->SetSnapping( true );
617 
618  Activate();
619  m_frame->SetToolID( ID_PCB_TARGET_BUTT, wxCURSOR_PENCIL, _( "Add layer alignment target" ) );
620 
621  // Main loop: keep receiving events
622  while( OPT_TOOL_EVENT evt = Wait() )
623  {
624  cursorPos = controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
625 
627  break;
628 
629  else if( evt->IsAction( &PCB_ACTIONS::incWidth ) )
630  {
631  target->SetWidth( target->GetWidth() + WIDTH_STEP );
632  view->Update( &preview );
633  }
634 
635  else if( evt->IsAction( &PCB_ACTIONS::decWidth ) )
636  {
637  int width = target->GetWidth();
638 
639  if( width > WIDTH_STEP )
640  {
641  target->SetWidth( width - WIDTH_STEP );
642  view->Update( &preview );
643  }
644  }
645 
646  else if( evt->IsClick( BUT_LEFT ) )
647  {
648  assert( target->GetSize() > 0 );
649  assert( target->GetWidth() > 0 );
650 
651  BOARD_COMMIT commit( m_frame );
652  commit.Add( target );
653  commit.Push( _( "Place a layer alignment target" ) );
654 
655  preview.Remove( target );
656 
657  // Create next PCB_TARGET
658  target = new PCB_TARGET( *target );
659  preview.Add( target );
660  }
661 
662  else if( evt->IsClick( BUT_RIGHT ) )
663  {
665  }
666 
667  else if( evt->IsMotion() )
668  {
669  target->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
670  view->Update( &preview );
671  }
672  }
673 
674  delete target;
675 
676  controls->SetSnapping( false );
677  view->Remove( &preview );
678 
680 
681  return 0;
682 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg) override
Set the tool command ID to aId and sets the cursor to aCursor.
BOARD * board() const
static TOOL_ACTION incWidth
Increase width of currently drawn line.
Definition: pcb_actions.h:154
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:91
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
void SetSize(int aSize)
int GetSize() const
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:534
virtual void Remove(VIEW_ITEM *aItem) override
Function Remove() Removes a VIEW_ITEM from the view.
Definition: pcb_view.cpp:74
static TOOL_ACTION decWidth
Decrease width of currently drawn line.
Definition: pcb_actions.h:157
int GetLineThickness(PCB_LAYER_ID aLayer) const
Function GetLineThickness Returns the default graphic segment thickness from the layer class for the ...
int GetWidth() const
void SetPosition(const wxPoint &aPos) override
KIGFX::PCB_VIEW * view() const
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
bool IsCancelInteractive(const TOOL_EVENT &aEvt)
Function IsCancelInteractive()
Definition: tool_event.cpp:177
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
virtual void SetNoToolSelected()
Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
KIGFX::VIEW_CONTROLS * controls() const
PCB_EDIT_FRAME * m_frame
Pointer to the currently used edit frame.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
static const int WIDTH_STEP
void SetWidth(int aWidth)
void Activate()
Function Activate() Runs the tool.
TOOL_MENU m_menu
Menu model displayed by the tool.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Function Add() Adds a VIEW_ITEM to the view.
Definition: pcb_view.cpp:58
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
Class VIEW.
Definition: view.h:61
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:486

References TOOL_INTERACTIVE::Activate(), KIGFX::PCB_VIEW::Add(), KIGFX::VIEW_GROUP::Add(), PCB_TOOL_BASE::board(), BUT_LEFT, BUT_RIGHT, PCB_TOOL_BASE::controls(), PCB_ACTIONS::decWidth, Edge_Cuts, KIGFX::VIEW_CONTROLS::GetCursorPosition(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetLineThickness(), PCB_TARGET::GetSize(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), PCB_TARGET::GetWidth(), ID_PCB_TARGET_BUTT, PCB_ACTIONS::incWidth, TOOL_EVT_UTILS::IsCancelInteractive(), m_frame, m_menu, TOOL_BASE::m_toolMgr, MD_ALT, KIGFX::PCB_VIEW::Remove(), KIGFX::VIEW_GROUP::Remove(), TOOL_MANAGER::RunAction(), PCB_ACTIONS::selectionClear, BOARD_ITEM::SetLayer(), EDA_DRAW_FRAME::SetNoToolSelected(), PCB_TARGET::SetPosition(), PCB_TARGET::SetSize(), KIGFX::VIEW_CONTROLS::SetSnapping(), PCB_BASE_FRAME::SetToolID(), PCB_TARGET::SetWidth(), TOOL_MENU::ShowContextMenu(), KIGFX::PCB_VIEW::Update(), PCB_TOOL_BASE::view(), TOOL_INTERACTIVE::Wait(), WIDTH_STEP, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

◆ ratsnestTimer()

void PCB_EDITOR_CONTROL::ratsnestTimer ( wxTimerEvent &  aEvent)
private

Event handler to recalculate dynamic ratsnest

Definition at line 1223 of file pcb_editor_control.cpp.

1224 {
1225  m_ratsnestTimer.Stop();
1227  static_cast<PCB_DRAW_PANEL_GAL*>( m_frame->GetGalCanvas() )->RedrawRatsnest();
1229 }
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:931
wxTimer m_ratsnestTimer
Indicates current selection ratsnest will be slow to calculate
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
PCB_EDIT_FRAME * m_frame
Pointer to the currently used edit frame.
void calculateSelectionRatsnest()
Recalculates dynamic ratsnest for the current selection

References calculateSelectionRatsnest(), EDA_DRAW_FRAME::GetGalCanvas(), m_frame, m_ratsnestTimer, and EDA_DRAW_PANEL_GAL::Refresh().

Referenced by Init().

◆ Reset()

void PCB_EDITOR_CONTROL::Reset ( RESET_REASON  aReason)
overridevirtual

Function Reset() Brings the tool to a known, initial state.

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

Parameters
aReasoncontains information about the reason of tool reset.

Reimplemented from PCB_TOOL_BASE.

Definition at line 254 of file pcb_editor_control.cpp.

255 {
256  m_frame = getEditFrame<PCB_EDIT_FRAME>();
257 
258  if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
259  {
260  m_placeOrigin->SetPosition( getModel<BOARD>()->GetAuxOrigin() );
261  getView()->Remove( m_placeOrigin.get() );
262  getView()->Add( m_placeOrigin.get() );
263  }
264 }
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_placeOrigin
Model changes (required full reload)
Definition: tool_base.h:83
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
PCB_EDIT_FRAME * m_frame
Pointer to the currently used edit frame.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
Rendering engine changes.
Definition: tool_base.h:84

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

◆ RunMainStack()

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

Function RunMainStack()

Calls a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 85 of file tool_interactive.cpp.

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

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

Referenced by DRAWING_TOOL::PlaceText().

◆ selection() [1/2]

const SELECTION & PCB_TOOL_BASE::selection ( ) const
protectedinherited

Definition at line 251 of file pcb_tool_base.cpp.

252 {
253  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
254  const auto& selection = selTool->GetSelection();
255  return selection;
256 }
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
const SELECTION & selection() const

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

Referenced by AUTOPLACE_TOOL::autoplaceSelected(), calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), EDIT_TOOL::changeTrackWidthOnClick(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::CreateArray(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), CrossProbePcbToSch(), EDIT_TOOL::doCopyToClipboard(), EDIT_TOOL::Duplicate(), EDIT_TOOL::editFootprintInFpEditor(), EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::filterSelection(), EDIT_TOOL::Flip(), DRAWING_TOOL::getSourceZoneForAction(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::Main(), EDIT_TOOL::Mirror(), modifyLockSelected(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), PAD_TOOL::pastePadProperties(), PCBNEW_CONTROL::placeBoardItems(), PlaceModule(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EDIT_TOOL::Rotate(), SELECTION_TOOL::selectCopper(), PCB_TOOL_BASE::selection(), SELECTION_TOOL::selectNet(), UpdateSelectionRatsnest(), ZoneDuplicate(), ZONE_FILLER_TOOL::ZoneFill(), ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfill().

◆ selection() [2/2]

SELECTION & PCB_TOOL_BASE::selection ( )
protectedinherited

Definition at line 258 of file pcb_tool_base.cpp.

259 {
260  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
261  auto& selection = selTool->GetSelection();
262  return selection;
263 }
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
const SELECTION & selection() const

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

◆ SetContextMenu()

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

Function SetContextMenu()

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

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

Definition at line 74 of file tool_interactive.cpp.

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

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), TOOL_MENU::ShowContextMenu(), and SCH_WIRE_BUS_TOOL::UnfoldBus().

◆ SetDrillOrigin()

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

UI-level access (including undo) to setting the drill origin

Definition at line 894 of file pcb_editor_control.cpp.

896 {
897  aFrame->SaveCopyInUndoList( originViewItem, UR_DRILLORIGIN );
898  return DoSetDrillOrigin( aView, aFrame, originViewItem, aPosition );
899 }
static bool DoSetDrillOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, BOARD_ITEM *aItem, const VECTOR2D &aPoint)
Low-level access (below undo) to setting the drill origin
virtual void SaveCopyInUndoList(BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))=0
Function SaveCopyInUndoList (virtual pure) Creates a new entry in undo list of commands.

References DoSetDrillOrigin(), PCB_BASE_FRAME::SaveCopyInUndoList(), and UR_DRILLORIGIN.

Referenced by DrillOrigin(), and PCB_EDIT_FRAME::OnLeftClick().

◆ SetEditModules()

void PCB_TOOL_BASE::SetEditModules ( bool  aEnabled)
inlineinherited

Function SetEditModules()

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

Parameters
aEnableddecides if the mode should be enabled.

Definition at line 97 of file pcb_tool_base.h.

98  {
99  m_editModules = aEnabled;
100  }

References PCB_TOOL_BASE::m_editModules.

◆ setTransitions()

void PCB_EDITOR_CONTROL::setTransitions ( )
overrideprivatevirtual

Sets up handlers for various events.

Reimplemented from PCB_TOOL_BASE.

Definition at line 1263 of file pcb_editor_control.cpp.

1264 {
1265  // Track & via size control
1270 
1271  // Zone actions
1274 
1275  // Placing tools
1278 
1279  // Other
1292 
1296 }
static TOOL_ACTION toggleLock
Definition: pcb_actions.h:300
static TOOL_ACTION placeModule
Definition: pcb_actions.h:149
static const TOOL_EVENT SelectedEvent
Event sent after an item is selected.
Definition: actions.h:132
int ZoneMerge(const TOOL_EVENT &aEvent)
static TOOL_ACTION unlock
Definition: pcb_actions.h:302
int PlaceModule(const TOOL_EVENT &aEvent)
Function PlaceModule() Displays a dialog to select a module to be added and allows the user to set it...
static const TOOL_EVENT UnselectedEvent
Event sent after an item is unselected.
Definition: actions.h:133
static TOOL_ACTION drillOrigin
Definition: pcb_actions.h:315
static TOOL_ACTION lock
Definition: pcb_actions.h:301
static TOOL_ACTION viaSizeInc
Definition: pcb_actions.h:244
int TrackWidthDec(const TOOL_EVENT &aEvent)
int HideSelectionRatsnest(const TOOL_EVENT &aEvent)
Hides ratsnest for selected items. Called when there are no items selected.
static TOOL_ACTION trackWidthDec
Definition: pcb_actions.h:243
int ZoneDuplicate(const TOOL_EVENT &aEvent)
Duplicates a zone onto a layer (prompts for new layer)
static TOOL_ACTION highlightNetCursor
Definition: pcb_actions.h:313
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
static TOOL_ACTION showLocalRatsnest
Definition: pcb_actions.h:322
static TOOL_ACTION crossProbeSchToPcb
Definition: pcb_actions.h:316
int HighlightNet(const TOOL_EVENT &aEvent)
Highlights net belonging to the item under the cursor.
static TOOL_ACTION trackWidthInc
Definition: pcb_actions.h:242
int ShowLocalRatsnest(const TOOL_EVENT &aEvent)
Shows local ratsnest of a component
int ViaSizeDec(const TOOL_EVENT &aEvent)
int ClearHighlight(const TOOL_EVENT &aEvent)
Clears all board highlights
static TOOL_ACTION hideLocalRatsnest
Definition: pcb_actions.h:323
int TrackWidthInc(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoneMerge
Definition: pcb_actions.h:254
int DrillOrigin(const TOOL_EVENT &aEvent)
Runs the drill origin tool for setting the origin for drill and pick-and-place files.
static const TOOL_EVENT ClearedEvent
Event sent after selection is cleared.
Definition: actions.h:134
int ViaSizeInc(const TOOL_EVENT &aEvent)
static TOOL_ACTION placeTarget
Definition: pcb_actions.h:148
int LockSelected(const TOOL_EVENT &aEvent)
Locks selected items.
int UnlockSelected(const TOOL_EVENT &aEvent)
Unlocks selected items.
int HighlightNetCursor(const TOOL_EVENT &aEvent)
Launches a tool to pick the item whose net is going to be highlighted.
static TOOL_ACTION clearHighlight
Definition: pcb_actions.h:311
static TOOL_ACTION zoneDuplicate
Duplicate zone onto another layer.
Definition: pcb_actions.h:257
int UpdateSelectionRatsnest(const TOOL_EVENT &aEvent)
Updates ratsnest for selected items.
static TOOL_ACTION highlightNet
Definition: pcb_actions.h:312
static TOOL_ACTION highlightNetSelection
Definition: pcb_actions.h:314
int PlaceTarget(const TOOL_EVENT &aEvent)
Function PlaceTarget() Allows user to place a layer alignment target.
int CrossProbePcbToSch(const TOOL_EVENT &aEvent)
Notifies eeschema about the selected item.
static TOOL_ACTION updateLocalRatsnest
Definition: pcb_actions.h:324
int CrossProbeSchToPcb(const TOOL_EVENT &aEvent)
Reacts to selection change in eeschema.
int ToggleLockSelected(const TOOL_EVENT &aEvent)
Toggles 'lock' property for selected items.
static TOOL_ACTION viaSizeDec
Definition: pcb_actions.h:245

References EVENTS::ClearedEvent, ClearHighlight(), PCB_ACTIONS::clearHighlight, CrossProbePcbToSch(), CrossProbeSchToPcb(), PCB_ACTIONS::crossProbeSchToPcb, DrillOrigin(), PCB_ACTIONS::drillOrigin, TOOL_INTERACTIVE::Go(), PCB_ACTIONS::hideLocalRatsnest, HideSelectionRatsnest(), HighlightNet(), PCB_ACTIONS::highlightNet, HighlightNetCursor(), PCB_ACTIONS::highlightNetCursor, PCB_ACTIONS::highlightNetSelection, PCB_ACTIONS::lock, LockSelected(), PlaceModule(), PCB_ACTIONS::placeModule, PlaceTarget(), PCB_ACTIONS::placeTarget, EVENTS::SelectedEvent, ShowLocalRatsnest(), PCB_ACTIONS::showLocalRatsnest, PCB_ACTIONS::toggleLock, ToggleLockSelected(), TrackWidthDec(), PCB_ACTIONS::trackWidthDec, TrackWidthInc(), PCB_ACTIONS::trackWidthInc, PCB_ACTIONS::unlock, UnlockSelected(), EVENTS::UnselectedEvent, PCB_ACTIONS::updateLocalRatsnest, UpdateSelectionRatsnest(), ViaSizeDec(), PCB_ACTIONS::viaSizeDec, ViaSizeInc(), PCB_ACTIONS::viaSizeInc, ZoneDuplicate(), PCB_ACTIONS::zoneDuplicate, ZoneMerge(), and PCB_ACTIONS::zoneMerge.

◆ ShowLocalRatsnest()

int PCB_EDITOR_CONTROL::ShowLocalRatsnest ( const TOOL_EVENT aEvent)

Shows local ratsnest of a component

Definition at line 1149 of file pcb_editor_control.cpp.

1150 {
1151  Activate();
1152 
1153  auto picker = m_toolMgr->GetTool<PICKER_TOOL>();
1154  auto board = getModel<BOARD>();
1155  wxASSERT( picker );
1156  wxASSERT( board );
1157 
1158  m_frame->SetToolID( ID_PCB_SHOW_1_RATSNEST_BUTT, wxCURSOR_PENCIL,
1159  _( "Pick Components for Local Ratsnest" ) );
1160  picker->SetClickHandler( std::bind( showLocalRatsnest, m_toolMgr, board, _1 ) );
1161  picker->SetFinalizeHandler( [ board ]( int aCondition ){
1162  auto vis = board->IsElementVisible( LAYER_RATSNEST );
1163 
1164  if( aCondition != PICKER_TOOL::END_ACTIVATE )
1165  {
1166  for( auto mod : board->Modules() )
1167  for( auto pad : mod->Pads() )
1168  pad->SetLocalRatsnestVisible( vis );
1169  }
1170  } );
1171 
1172  picker->Activate();
1173  Wait();
1174 
1175  return 0;
1176 }
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg) override
Set the tool command ID to aId and sets the cursor to aCursor.
BOARD * board() const
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
Generic tool for picking a point.
Definition: picker_tool.h:34
DLIST_ITERATOR_WRAPPER< MODULE > Modules()
Definition: class_board.h:252
static bool showLocalRatsnest(TOOL_MANAGER *aToolMgr, BOARD *aBoard, const VECTOR2D &aPosition)
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Function IsElementVisible tests whether a given element category is visible.
PCB_EDIT_FRAME * m_frame
Pointer to the currently used edit frame.
void Activate()
Function Activate() Runs the tool.
#define mod(a, n)
Definition: greymap.cpp:24

References TOOL_INTERACTIVE::Activate(), PCB_TOOL_BASE::board(), PICKER_TOOL::END_ACTIVATE, TOOL_MANAGER::GetTool(), ID_PCB_SHOW_1_RATSNEST_BUTT, BOARD::IsElementVisible(), LAYER_RATSNEST, m_frame, TOOL_BASE::m_toolMgr, mod, BOARD::Modules(), PCB_BASE_FRAME::SetToolID(), showLocalRatsnest(), and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

◆ ToggleLockSelected()

int PCB_EDITOR_CONTROL::ToggleLockSelected ( const TOOL_EVENT aEvent)

Toggles 'lock' property for selected items.

Definition at line 536 of file pcb_editor_control.cpp.

537 {
538  return modifyLockSelected( TOGGLE );
539 }
int modifyLockSelected(MODIFY_MODE aMode)

References modifyLockSelected(), and TOGGLE.

Referenced by setTransitions().

◆ TrackWidthDec()

int PCB_EDITOR_CONTROL::TrackWidthDec ( const TOOL_EVENT aEvent)

Definition at line 368 of file pcb_editor_control.cpp.

369 {
370  BOARD* board = getModel<BOARD>();
371  int widthIndex = board->GetDesignSettings().GetTrackWidthIndex() - 1;
372 
373  if( widthIndex < 0 )
374  widthIndex = 0;
375 
376  board->GetDesignSettings().SetTrackWidthIndex( widthIndex );
378 
380 
381  return 0;
382 }
void SetTrackWidthIndex(unsigned aIndex)
Function SetTrackWidthIndex sets the current track width list index to aIndex.
BOARD * board() const
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:247
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:534
unsigned GetTrackWidthIndex() const
Function GetTrackWidthIndex.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
void UseCustomTrackViaSize(bool aEnabled)
Function UseCustomTrackViaSize Enables/disables custom track/via size settings.

References PCB_TOOL_BASE::board(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetTrackWidthIndex(), TOOL_BASE::m_toolMgr, TOOL_MANAGER::RunAction(), BOARD_DESIGN_SETTINGS::SetTrackWidthIndex(), PCB_ACTIONS::trackViaSizeChanged, and BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize().

Referenced by setTransitions().

◆ TrackWidthInc()

int PCB_EDITOR_CONTROL::TrackWidthInc ( const TOOL_EVENT aEvent)

Definition at line 351 of file pcb_editor_control.cpp.

352 {
353  BOARD* board = getModel<BOARD>();
354  int widthIndex = board->GetDesignSettings().GetTrackWidthIndex() + 1;
355 
356  if( widthIndex >= (int) board->GetDesignSettings().m_TrackWidthList.size() )
357  widthIndex = board->GetDesignSettings().m_TrackWidthList.size() - 1;
358 
359  board->GetDesignSettings().SetTrackWidthIndex( widthIndex );
361 
363 
364  return 0;
365 }
void SetTrackWidthIndex(unsigned aIndex)
Function SetTrackWidthIndex sets the current track width list index to aIndex.
BOARD * board() const
std::vector< int > m_TrackWidthList
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:247
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:534
unsigned GetTrackWidthIndex() const
Function GetTrackWidthIndex.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
void UseCustomTrackViaSize(bool aEnabled)
Function UseCustomTrackViaSize Enables/disables custom track/via size settings.

References PCB_TOOL_BASE::board(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetTrackWidthIndex(), TOOL_BASE::m_toolMgr, BOARD_DESIGN_SETTINGS::m_TrackWidthList, TOOL_MANAGER::RunAction(), BOARD_DESIGN_SETTINGS::SetTrackWidthIndex(), PCB_ACTIONS::trackViaSizeChanged, and BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize().

Referenced by setTransitions().

◆ UnlockSelected()

int PCB_EDITOR_CONTROL::UnlockSelected ( const TOOL_EVENT aEvent)

Unlocks selected items.

Definition at line 548 of file pcb_editor_control.cpp.

549 {
550  return modifyLockSelected( OFF );
551 }
int modifyLockSelected(MODIFY_MODE aMode)

References modifyLockSelected(), and OFF.

Referenced by setTransitions().

◆ UpdateSelectionRatsnest()

int PCB_EDITOR_CONTROL::UpdateSelectionRatsnest ( const TOOL_EVENT aEvent)

Updates ratsnest for selected items.

Definition at line 1179 of file pcb_editor_control.cpp.

1180 {
1181  auto selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
1182  auto& selection = selectionTool->GetSelection();
1183  auto connectivity = getModel<BOARD>()->GetConnectivity();
1184 
1185  if( selection.Empty() )
1186  {
1187  connectivity->ClearDynamicRatsnest();
1188  }
1189  else if( m_slowRatsnest )
1190  {
1191  // Compute ratsnest only when user stops dragging for a moment
1192  connectivity->HideDynamicRatsnest();
1193  m_ratsnestTimer.Start( 20 );
1194  }
1195  else
1196  {
1197  // Check how much time doest it take to calculate ratsnest
1198  PROF_COUNTER counter;
1200  counter.Stop();
1201 
1202  // If it is too slow, then switch to 'slow ratsnest' mode when
1203  // ratsnest is calculated when user stops dragging items for a moment
1204  if( counter.msecs() > 25 )
1205  {
1206  m_slowRatsnest = true;
1207  connectivity->HideDynamicRatsnest();
1208  }
1209  }
1210 
1211  return 0;
1212 }
void Stop()
save the time when this function was called, and set the counter stane to stop
Definition: profile.h:83
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
The class PROF_COUNTER is a small class to help profiling.
Definition: profile.h:45
wxTimer m_ratsnestTimer
Indicates current selection ratsnest will be slow to calculate
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:119
double msecs() const
Definition: profile.h:144
const SELECTION & selection() const
bool m_slowRatsnest
Recursion guard when cross-probing to EESchema
void calculateSelectionRatsnest()
Recalculates dynamic ratsnest for the current selection

References calculateSelectionRatsnest(), SELECTION::Empty(), TOOL_MANAGER::GetTool(), m_ratsnestTimer, m_slowRatsnest, TOOL_BASE::m_toolMgr, PROF_COUNTER::msecs(), PCB_TOOL_BASE::selection(), and PROF_COUNTER::Stop().

Referenced by setTransitions().

◆ ViaSizeDec()

int PCB_EDITOR_CONTROL::ViaSizeDec ( const TOOL_EVENT aEvent)

Definition at line 402 of file pcb_editor_control.cpp.

403 {
404  BOARD* board = getModel<BOARD>();
405  int sizeIndex = board->GetDesignSettings().GetViaSizeIndex() - 1;
406 
407  if( sizeIndex < 0 )
408  sizeIndex = 0;
409 
410  board->GetDesignSettings().SetViaSizeIndex( sizeIndex );
412 
414 
415  return 0;
416 }
BOARD * board() const
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:247
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:534
void SetViaSizeIndex(unsigned aIndex)
Function SetViaSizeIndex sets the current via size list index to aIndex.
unsigned GetViaSizeIndex() const
Function GetViaSizeIndex.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
void UseCustomTrackViaSize(bool aEnabled)
Function UseCustomTrackViaSize Enables/disables custom track/via size settings.

References PCB_TOOL_BASE::board(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetViaSizeIndex(), TOOL_BASE::m_toolMgr, TOOL_MANAGER::RunAction(), BOARD_DESIGN_SETTINGS::SetViaSizeIndex(), PCB_ACTIONS::trackViaSizeChanged, and BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize().

Referenced by setTransitions().

◆ ViaSizeInc()

int PCB_EDITOR_CONTROL::ViaSizeInc ( const TOOL_EVENT aEvent)

Definition at line 385 of file pcb_editor_control.cpp.

386 {
387  BOARD* board = getModel<BOARD>();
388  int sizeIndex = board->GetDesignSettings().GetViaSizeIndex() + 1;
389 
390  if( sizeIndex >= (int) board->GetDesignSettings().m_ViasDimensionsList.size() )
391  sizeIndex = board->GetDesignSettings().m_ViasDimensionsList.size() - 1;
392 
393  board->GetDesignSettings().SetViaSizeIndex( sizeIndex );
395 
397 
398  return 0;
399 }
BOARD * board() const
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:247
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:534
void SetViaSizeIndex(unsigned aIndex)
Function SetViaSizeIndex sets the current via size list index to aIndex.
unsigned GetViaSizeIndex() const
Function GetViaSizeIndex.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
std::vector< VIA_DIMENSION > m_ViasDimensionsList
void UseCustomTrackViaSize(bool aEnabled)
Function UseCustomTrackViaSize Enables/disables custom track/via size settings.

References PCB_TOOL_BASE::board(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetViaSizeIndex(), TOOL_BASE::m_toolMgr, BOARD_DESIGN_SETTINGS::m_ViasDimensionsList, TOOL_MANAGER::RunAction(), BOARD_DESIGN_SETTINGS::SetViaSizeIndex(), PCB_ACTIONS::trackViaSizeChanged, and BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize().

Referenced by setTransitions().

◆ view()

◆ Wait()

OPT_TOOL_EVENT TOOL_INTERACTIVE::Wait ( const TOOL_EVENT_LIST aEventList = TOOL_EVENTTC_ANYTA_ANY ))
inherited

Function Wait()

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

Definition at line 55 of file tool_interactive.cpp.

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

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

Referenced by LIB_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), SCH_DRAWING_TOOLS::doPlaceComponent(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), SCH_DRAWING_TOOLS::doSingleClickPlace(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::drawZone(), DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), HighlightNetCursor(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), EE_PICKER_TOOL::Main(), PICKER_TOOL::Main(), CVPCB_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), EDIT_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PlaceModule(), PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), GERBVIEW_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), ShowLocalRatsnest(), and SCH_WIRE_BUS_TOOL::UnfoldBus().

◆ ZoneDuplicate()

int PCB_EDITOR_CONTROL::ZoneDuplicate ( const TOOL_EVENT aEvent)

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

Definition at line 780 of file pcb_editor_control.cpp.

781 {
782  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
783  const auto& selection = selTool->GetSelection();
784 
785  // because this pops up the zone editor, it would be confusing to handle multiple zones,
786  // so just handle single selections containing exactly one zone
787  if( selection.Size() != 1 )
788  return 0;
789 
790  auto oldZone = dyn_cast<ZONE_CONTAINER*>( selection[0] );
791 
792  if( !oldZone )
793  return 0;
794 
795  ZONE_SETTINGS zoneSettings;
796  zoneSettings << *oldZone;
797  int dialogResult;
798 
799  if( oldZone->GetIsKeepout() )
800  dialogResult = InvokeKeepoutAreaEditor( m_frame, &zoneSettings );
801  else if( oldZone->IsOnCopperLayer() )
802  dialogResult = InvokeCopperZonesEditor( m_frame, &zoneSettings );
803  else
804  dialogResult = InvokeNonCopperZonesEditor( m_frame, &zoneSettings );
805 
806  if( dialogResult != wxID_OK )
807  return 0;
808 
809  // duplicate the zone
810  BOARD_COMMIT commit( m_frame );
811 
812  auto newZone = std::make_unique<ZONE_CONTAINER>( *oldZone );
813  newZone->ClearSelected();
814  newZone->UnFill();
815  zoneSettings.ExportSetting( *newZone );
816 
817  // If the new zone is on the same layer(s) as the the initial zone,
818  // offset it a bit so it can more easily be picked.
819  if( oldZone->GetIsKeepout() && ( oldZone->GetLayerSet() == zoneSettings.m_Layers ) )
820  newZone->Move( wxPoint( IU_PER_MM, IU_PER_MM ) );
821  else if( !oldZone->GetIsKeepout() && ( oldZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) )
822  newZone->Move( wxPoint( IU_PER_MM, IU_PER_MM ) );
823 
824  commit.Add( newZone.release() );
825  commit.Push( _( "Duplicate zone" ) );
826 
827  return 0;
828 }
int InvokeKeepoutAreaEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings)
Function InvokeKeepoutAreaEditor invokes up a modal dialog window for copper zone editing.
Class SELECTION_TOOL.
int InvokeNonCopperZonesEditor(PCB_BASE_FRAME *aParent, ZONE_SETTINGS *aSettings)
Function InvokeNonCopperZonesEditor invokes up a modal dialog window for non-copper zone editing.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
void ExportSetting(ZONE_CONTAINER &aTarget, bool aFullExport=true) const
Function ExportSetting copy settings to a given zone.
Class ZONE_SETTINGS handles zones parameters.
Definition: zone_settings.h:49
PCB_EDIT_FRAME * m_frame
Pointer to the currently used edit frame.
int Size() const
Returns the number of selected parts.
Definition: selection.h:125
int InvokeCopperZonesEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings)
Function InvokeCopperZonesEditor invokes up a modal dialog window for copper zone editing.
const SELECTION & selection() const
PCB_LAYER_ID m_CurrentZone_Layer
Layer used to create the current zone.
Definition: zone_settings.h:78

References COMMIT::Add(), ZONE_SETTINGS::ExportSetting(), TOOL_MANAGER::GetTool(), InvokeCopperZonesEditor(), InvokeKeepoutAreaEditor(), InvokeNonCopperZonesEditor(), ZONE_SETTINGS::m_CurrentZone_Layer, m_frame, ZONE_SETTINGS::m_Layers, TOOL_BASE::m_toolMgr, BOARD_COMMIT::Push(), PCB_TOOL_BASE::selection(), and SELECTION::Size().

Referenced by setTransitions().

◆ ZoneMerge()

int PCB_EDITOR_CONTROL::ZoneMerge ( const TOOL_EVENT aEvent)

Definition at line 722 of file pcb_editor_control.cpp.

723 {
724  const SELECTION& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
725  BOARD* board = getModel<BOARD>();
726  BOARD_COMMIT commit( m_frame );
727 
728  if( selection.Size() < 2 )
729  return 0;
730 
731  int netcode = -1;
732 
733  ZONE_CONTAINER* firstZone = nullptr;
734  std::vector<ZONE_CONTAINER*> toMerge, merged;
735 
736  for( auto item : selection )
737  {
738  auto curr_area = dynamic_cast<ZONE_CONTAINER*>( item );
739 
740  if( !curr_area )
741  continue;
742 
743  if( !firstZone )
744  firstZone = curr_area;
745 
746  netcode = curr_area->GetNetCode();
747 
748  if( firstZone->GetNetCode() != netcode )
749  continue;
750 
751  if( curr_area->GetPriority() != firstZone->GetPriority() )
752  continue;
753 
754  if( curr_area->GetIsKeepout() != firstZone->GetIsKeepout() )
755  continue;
756 
757  if( curr_area->GetLayer() != firstZone->GetLayer() )
758  continue;
759 
760  if( !board->TestAreaIntersection( curr_area, firstZone ) )
761  continue;
762 
763  toMerge.push_back( curr_area );
764  }
765 
767 
768  if( mergeZones( commit, toMerge, merged ) )
769  {
770  commit.Push( _( "Merge zones" ) );
771 
772  for( auto item : merged )
774  }
775 
776  return 0;
777 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
int GetNetCode() const
Function GetNetCode.
BOARD * board() const
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:185
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
bool TestAreaIntersection(ZONE_CONTAINER *area_ref, ZONE_CONTAINER *area_to_test)
Function TestAreaIntersection Test for intersection of 2 copper areas area_to_test must be after area...
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:651
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:96
PCB_EDIT_FRAME * m_frame
Pointer to the currently used edit frame.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
static TOOL_ACTION selectItem
Selects an item (specified as the event parameter).
Definition: pcb_actions.h:56
int Size() const
Returns the number of selected parts.
Definition: selection.h:125
static bool mergeZones(BOARD_COMMIT &aCommit, std::vector< ZONE_CONTAINER * > &aOriginZones, std::vector< ZONE_CONTAINER * > &aMergedZones)
const SELECTION & selection() const

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

Referenced by setTransitions().

Member Data Documentation

◆ m_editModules

◆ m_frame

PCB_EDIT_FRAME* PCB_EDITOR_CONTROL::m_frame
private

◆ m_menu

TOOL_MENU PCB_EDITOR_CONTROL::m_menu
private

Menu model displayed by the tool.

Definition at line 136 of file pcb_editor_control.h.

Referenced by Init(), PlaceModule(), and PlaceTarget().

◆ m_placeOrigin

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

Definition at line 138 of file pcb_editor_control.h.

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

◆ m_probingSchToPcb

bool PCB_EDITOR_CONTROL::m_probingSchToPcb
private

Place & drill origin marker

Definition at line 140 of file pcb_editor_control.h.

Referenced by CrossProbePcbToSch(), CrossProbeSchToPcb(), and PCB_EDITOR_CONTROL().

◆ m_ratsnestTimer

wxTimer PCB_EDITOR_CONTROL::m_ratsnestTimer
private

Indicates current selection ratsnest will be slow to calculate

Definition at line 142 of file pcb_editor_control.h.

Referenced by Init(), ratsnestTimer(), and UpdateSelectionRatsnest().

◆ m_slowRatsnest

bool PCB_EDITOR_CONTROL::m_slowRatsnest
private

Recursion guard when cross-probing to EESchema

Definition at line 141 of file pcb_editor_control.h.

Referenced by HideSelectionRatsnest(), PCB_EDITOR_CONTROL(), and UpdateSelectionRatsnest().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

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

Referenced by TOOL_INTERACTIVE::Activate(), EE_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemToSel(), SCH_DRAWING_TOOLS::AddJunction(), SCH_DRAWING_TOOLS::AddLabel(), TOOL_BASE::attachManager(), calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDITOR_CONTROL::ClearHighlight(), ClearHighlight(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::clearSelection(), SELECTION_TOOL::clearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), CrossProbePcbToSch(), CrossProbeSchToPcb(), COMMON_TOOLS::CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), SCH_EDITOR_CONTROL::Cut(), LIB_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), LIB_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_WIRE_BUS_TOOL::doDrawSegments(), SCH_DRAWING_TOOLS::doPlaceComponent(), SCH_DRAWING_TOOLS::doSingleClickPlace(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), DRAWING_TOOL::drawArc(), SCH_WIRE_BUS_TOOL::DrawBusses(), DRAWING_TOOL::DrawDimension(), SCH_WIRE_BUS_TOOL::DrawLines(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_WIRE_BUS_TOOL::DrawWires(), DRAWING_TOOL::drawZone(), DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), EDIT_TOOL::editFootprintInFpEditor(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_EDITOR_CONTROL::EnterSheet(), MODULE_EDITOR_TOOLS::EnumeratePads(), EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::findCallback(), SELECTION_TOOL::findMove(), SCH_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), TOOL_BASE::getEditFrameInt(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), PCBNEW_CONTROL::GridSetOrigin(), GERBVIEW_CONTROL::HighlightControl(), SCH_EDITOR_CONTROL::HighlightNet(), HighlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), HighlightNetCursor(), LIB_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), Init(), POINT_EDITOR::Init(), POSITION_RELATIVE_TOOL::Init(), EDIT_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), TOOL_BASE::IsToolActive(), ZOOM_TOOL::Main(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), EE_PICKER_TOOL::Main(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), modifyLockSelected(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickCopyReferencePoint(), LIB_EDIT_TOOL::PinTable(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PlaceModule(), PlaceTarget(), DRAWING_TOOL::PlaceText(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), EE_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_DRAWING_TOOLS::RepeatDrawItem(), SELECTION_TOOL::RequestSelection(), CVPCB_CONTROL::ResetCoords(), PCBNEW_CONTROL::ResetCoords(), TOOL_INTERACTIVE::resetTransitions(), LIB_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), EE_SELECTION_TOOL::SelectConnection(), SELECTION_TOOL::selectCopper(), PCB_TOOL_BASE::selection(), GERBVIEW_SELECTION_TOOL::SelectItem(), SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), GERBVIEW_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), EE_SELECTION_TOOL::SelectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), SELECTION_TOOL::selectSheetContents(), TOOL_INTERACTIVE::SetContextMenu(), ShowLocalRatsnest(), SCH_WIRE_BUS_TOOL::StartBus(), SCH_WIRE_BUS_TOOL::StartLine(), SCH_WIRE_BUS_TOOL::StartWire(), GERBVIEW_SELECTION_TOOL::toggleSelection(), EE_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), TrackWidthDec(), TrackWidthInc(), SCH_EDITOR_CONTROL::Undo(), SCH_WIRE_BUS_TOOL::UnfoldBus(), GERBVIEW_SELECTION_TOOL::UnselectItem(), SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), EE_INSPECTION_TOOL::UpdateMessagePanel(), UpdateSelectionRatsnest(), ViaSizeDec(), ViaSizeInc(), TOOL_INTERACTIVE::Wait(), ZoneDuplicate(), and ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

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

Definition at line 215 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_toolSettings

TOOL_SETTINGS TOOL_BASE::m_toolSettings
protectedinherited

Definition at line 217 of file tool_base.h.

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

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 208 of file tool_base.h.

Referenced by TOOL_BASE::GetType().

◆ WIDTH_STEP

const int PCB_EDITOR_CONTROL::WIDTH_STEP = 100000
staticprivate

Definition at line 150 of file pcb_editor_control.h.

Referenced by PlaceTarget().


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