KiCad PCB EDA Suite
PCB_CONTROL Class Reference

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

#include <pcb_control.h>

Inheritance diagram for PCB_CONTROL:
PCB_TOOL_BASE TOOL_INTERACTIVE TOOL_BASE

Public Types

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

Public Member Functions

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

Static Public Member Functions

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

Protected Types

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

Protected Member Functions

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

Protected Attributes

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

Private Member Functions

void setTransitions () override
 < Sets up handlers for various events. More...
 
void unfilledZoneCheck ()
 We have bug reports indicating that some new users confuse zone filling/unfilling with the display modes. More...
 
int placeBoardItems (std::vector< BOARD_ITEM * > &aItems, bool aIsNew, bool aAnchorAtOrigin, bool aReannotateDuplicates)
 Add and select or just select for move/place command a list of board items. More...
 
int placeBoardItems (BOARD *aBoard, bool aAnchorAtOrigin, bool aReannotateDuplicates)
 Pointer to the currently used edit frame. More...
 

Private Attributes

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

Detailed Description

Handle actions that are shared between different frames in PcbNew.

Definition at line 46 of file pcb_control.h.

Member Enumeration Documentation

◆ INTERACTIVE_PLACEMENT_OPTIONS

Options for placing items interactively.

Enumerator
IPO_ROTATE 

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

IPO_FLIP 

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

IPO_SINGLE_CLICK 

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

IPO_REPEAT 

Allow repeat placement of the item.

Definition at line 116 of file pcb_tool_base.h.

116  {
118  IPO_ROTATE = 0x01,
119 
121  IPO_FLIP = 0x02,
122 
125  IPO_SINGLE_CLICK = 0x04,
126 
128  IPO_REPEAT = 0x08
129  };
Handle flip action in the loop by calling the item's flip method.
Allow repeat placement of the item.
Create an item immediately on placement starting, otherwise show the pencil cursor until the item is ...
Handle the rotate action in the loop by calling the item's rotate method.

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determine the reason of reset for a tool.

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 77 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ PCB_CONTROL()

PCB_CONTROL::PCB_CONTROL ( )

Definition at line 71 of file pcb_control.cpp.

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

References m_gridOrigin.

◆ ~PCB_CONTROL()

PCB_CONTROL::~PCB_CONTROL ( )

Definition at line 80 of file pcb_control.cpp.

81 {
82 }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run the tool.

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

Definition at line 51 of file tool_interactive.cpp.

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

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

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

◆ AddLibrary()

int PCB_CONTROL::AddLibrary ( const TOOL_EVENT aEvent)

Definition at line 99 of file pcb_control.cpp.

100 {
102  {
103  if( aEvent.IsAction( &ACTIONS::newLibrary ) )
104  static_cast<PCB_BASE_EDIT_FRAME*>( m_frame )->CreateNewLibrary();
105  else if( aEvent.IsAction( &ACTIONS::addLibrary ) )
106  static_cast<PCB_BASE_EDIT_FRAME*>( m_frame )->AddLibrary();
107  }
108 
109  return 0;
110 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:88
static TOOL_ACTION addLibrary
Definition: actions.h:49
static TOOL_ACTION newLibrary
Definition: actions.h:48
bool IsType(FRAME_T aType) const

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

Referenced by setTransitions().

◆ AppendBoard()

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

Definition at line 1030 of file pcb_control.cpp.

1031 {
1032  PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
1033 
1034  if( !editFrame )
1035  return 1;
1036 
1037  BOARD* brd = board();
1038 
1039  if( !brd )
1040  return 1;
1041 
1042  // Mark existing items, in order to know what are the new items so we can select only
1043  // the new items after loading
1044  for( PCB_TRACK* track : brd->Tracks() )
1045  track->SetFlags( SKIP_STRUCT );
1046 
1047  for( FOOTPRINT* footprint : brd->Footprints() )
1049 
1050  for( PCB_GROUP* group : brd->Groups() )
1051  group->SetFlags( SKIP_STRUCT );
1052 
1053  for( BOARD_ITEM* drawing : brd->Drawings() )
1054  drawing->SetFlags( SKIP_STRUCT );
1055 
1056  for( ZONE* zone : brd->Zones() )
1057  zone->SetFlags( SKIP_STRUCT );
1058 
1059  std::map<wxString, wxString> oldProperties = brd->GetProperties();
1060  std::map<wxString, wxString> newProperties;
1061 
1062  // Keep also the count of copper layers, to adjust if necessary
1063  int initialCopperLayerCount = brd->GetCopperLayerCount();
1064  LSET initialEnabledLayers = brd->GetEnabledLayers();
1065 
1066  // Load the data
1067  try
1068  {
1069  PROPERTIES props;
1070  char xbuf[30];
1071  char ybuf[30];
1072 
1073  // EAGLE_PLUGIN can use this info to center the BOARD, but it does not yet.
1074  sprintf( xbuf, "%d", editFrame->GetPageSizeIU().x );
1075  sprintf( ybuf, "%d", editFrame->GetPageSizeIU().y );
1076 
1077  props["page_width"] = xbuf;
1078  props["page_height"] = ybuf;
1079 
1080  WX_PROGRESS_REPORTER progressReporter( editFrame, _( "Loading PCB" ), 1 );
1081 
1082  editFrame->GetDesignSettings().GetNetClasses().Clear();
1083  pi.Load( fileName, brd, &props, nullptr, &progressReporter );
1084  }
1085  catch( const IO_ERROR& ioe )
1086  {
1087  wxString msg = wxString::Format( _( "Error loading board.\n%s" ), ioe.What() );
1088  DisplayError( editFrame, msg );
1089 
1090  return 0;
1091  }
1092 
1093  newProperties = brd->GetProperties();
1094 
1095  for( const std::pair<const wxString, wxString>& prop : oldProperties )
1096  newProperties[ prop.first ] = prop.second;
1097 
1098  brd->SetProperties( newProperties );
1099 
1100  // rebuild nets and ratsnest before any use of nets
1101  brd->BuildListOfNets();
1103  brd->BuildConnectivity();
1104 
1105  // Synchronize layers
1106  // we should not ask PLUGINs to do these items:
1107  int copperLayerCount = brd->GetCopperLayerCount();
1108 
1109  if( copperLayerCount > initialCopperLayerCount )
1110  brd->SetCopperLayerCount( copperLayerCount );
1111 
1112  // Enable all used layers, and make them visible:
1113  LSET enabledLayers = brd->GetEnabledLayers();
1114  enabledLayers |= initialEnabledLayers;
1115  brd->SetEnabledLayers( enabledLayers );
1116  brd->SetVisibleLayers( enabledLayers );
1117 
1118  return placeBoardItems( brd, false, false ); // Do not reannotate duplicates on Append Board
1119 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:271
void BuildListOfNets()
Definition: board.h:663
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
ZONES & Zones()
Definition: board.h:239
BOARD * board() const
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition: board.h:259
virtual BOARD * Load(const wxString &aFileName, BOARD *aAppendToMe, const PROPERTIES *aProperties=nullptr, PROJECT *aProject=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)
Load information from some input file format that this PLUGIN implementation knows about into either ...
Definition: plugin.cpp:46
GROUPS & Groups()
The groups must maintain the following invariants.
Definition: board.h:253
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
int placeBoardItems(std::vector< BOARD_ITEM * > &aItems, bool aIsNew, bool aAnchorAtOrigin, bool aReannotateDuplicates)
Add and select or just select for move/place command a list of board items.
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:153
void SetCopperLayerCount(int aCount)
Definition: board.cpp:460
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:466
A name/value tuple with unique names and optional values.
Definition: properties.h:33
const std::map< wxString, wxString > & GetProperties() const
Definition: board.h:258
void SynchronizeNetsAndNetClasses()
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition: board.cpp:1410
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:502
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
void SetVisibleLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
Definition: board.cpp:498
FOOTPRINTS & Footprints()
Definition: board.h:233
FOOTPRINT * footprint() const
#define _(s)
NETCLASSES & GetNetClasses() const
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
void BuildConnectivity()
Build or rebuild the board connectivity database for the board, especially the list of connected item...
Definition: board.cpp:136
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
void Clear()
Destroy any contained NETCLASS instances except the default one, and clears any members from the defa...
Definition: netclass.h:228
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
int GetCopperLayerCount() const
Definition: board.cpp:454
The main frame for Pcbnew.
const wxSize GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
DRAWINGS & Drawings()
Definition: board.h:236
void SetEnabledLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:486
TRACKS & Tracks()
Definition: board.h:230

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

Referenced by AppendBoardFromFile().

◆ AppendBoardFromFile()

int PCB_CONTROL::AppendBoardFromFile ( const TOOL_EVENT aEvent)

Definition at line 827 of file pcb_control.cpp.

828 {
829  int open_ctl;
830  wxString fileName;
831 
832  PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
833 
834  if( !editFrame )
835  return 1;
836 
837  // Pick a file to append
838  if( !AskLoadBoardFileName( editFrame, &open_ctl, &fileName, true ) )
839  return 1;
840 
841  IO_MGR::PCB_FILE_T pluginType = plugin_type( fileName, open_ctl );
842  PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
843 
844  return AppendBoard( *pi, fileName );
845 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
Releases a PLUGIN in the context of a potential thrown exception through its destructor.
Definition: io_mgr.h:555
int AppendBoard(PLUGIN &pi, wxString &fileName)
bool AskLoadBoardFileName(PCB_EDIT_FRAME *aParent, int *aCtl, wxString *aFileName, bool aKicadFilesOnly=false)
Show a wxFileDialog asking for a BOARD filename to open.
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Return a PLUGIN which the caller can use to import, export, save, or load design documents.
Definition: io_mgr.cpp:58
The main frame for Pcbnew.
PCB_FILE_T
The set of file types that the IO_MGR knows about, and for which there has been a plugin written.
Definition: io_mgr.h:53
IO_MGR::PCB_FILE_T plugin_type(const wxString &aFileName, int aCtl)

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

Referenced by setTransitions().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Set the TOOL_MANAGER the tool will belong to.

Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

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

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ board()

BOARD* PCB_TOOL_BASE::board ( ) const
inlineprotectedinherited

Definition at line 165 of file pcb_tool_base.h.

165 { return getModel<BOARD>(); }

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

◆ canvas()

◆ controls()

◆ DeleteItemCursor()

int PCB_CONTROL::DeleteItemCursor ( const TOOL_EVENT aEvent)

Definition at line 521 of file pcb_control.cpp.

522 {
524  return 0;
525 
526  std::string tool = aEvent.GetCommandStr().get();
528 
529  m_pickerItem = nullptr;
531 
532  // Deactivate other tools; particularly important if another PICKER is currently running
533  Activate();
534 
535  picker->SetCursor( KICURSOR::REMOVE );
536 
537  picker->SetClickHandler(
538  [this]( const VECTOR2D& aPosition ) -> bool
539  {
540  if( m_pickerItem )
541  {
543  {
544  m_statusPopup.reset( new STATUS_TEXT_POPUP( m_frame ) );
545  m_statusPopup->SetText( _( "Item locked." ) );
546  m_statusPopup->PopupFor( 2000 );
547  m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
548  return true;
549  }
550 
552  selectionTool->UnbrightenItem( m_pickerItem );
553  selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
555  m_pickerItem = nullptr;
556  }
557 
558  return true;
559  } );
560 
561  picker->SetMotionHandler(
562  [this]( const VECTOR2D& aPos )
563  {
564  BOARD* board = m_frame->GetBoard();
567  GENERAL_COLLECTOR collector;
568  collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
569 
570  if( m_isFootprintEditor )
572  (wxPoint) aPos, guide );
573  else
575  (wxPoint) aPos, guide );
576 
577  // Remove unselectable items
578  for( int i = collector.GetCount() - 1; i >= 0; --i )
579  {
580  if( !selectionTool->Selectable( collector[ i ] ) )
581  collector.Remove( i );
582  }
583 
584  if( collector.GetCount() > 1 )
585  selectionTool->GuessSelectionCandidates( collector, aPos );
586 
587  BOARD_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr;
588 
589  if( m_pickerItem != item )
590  {
591 
592  if( m_pickerItem )
593  selectionTool->UnbrightenItem( m_pickerItem );
594 
595  m_pickerItem = item;
596 
597  if( m_pickerItem )
598  selectionTool->BrightenItem( m_pickerItem );
599  }
600  } );
601 
602  picker->SetFinalizeHandler(
603  [this]( const int& aFinalState )
604  {
605  if( m_pickerItem )
607 
608  m_statusPopup.reset();
609 
610  // Ensure the cursor gets changed&updated
612  m_frame->GetCanvas()->Refresh();
613  } );
614 
615  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
616 
617  return 0;
618 }
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:59
static const KICAD_T FootprintItems[]
A scan list for primary footprint items.
Definition: collectors.h:293
static const KICAD_T BoardLevelItems[]
A scan list for all primary board items, omitting items which are subordinate to a FOOTPRINT,...
Definition: collectors.h:278
int m_Threshold
Definition: collector.h:248
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
BOARD_ITEM * m_pickerItem
Definition: pcb_control.h:132
BOARD * board() const
static TOOL_ACTION doDelete
Definition: actions.h:72
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
void Collect(BOARD_ITEM *aItem, const KICAD_T aScanList[], const wxPoint &aRefPos, const COLLECTORS_GUIDE &aGuide)
Scan a BOARD_ITEM using this class's Inspector method, which does the collection.
Definition: collectors.cpp:571
Extension of STATUS_POPUP for displaying a single line text.
Definition: status_popup.h:79
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
void SetFinalizeHandler(FINALIZE_HANDLER aHandler)
Set a handler for the finalize event.
Definition: picker_tool.h:102
virtual bool IsLocked() const
Definition: board_item.cpp:78
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
Definition: collector.h:115
static TOOL_ACTION pickerTool
Definition: actions.h:155
#define HITTEST_THRESHOLD_PIXELS
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:87
void UnbrightenItem(BOARD_ITEM *aItem)
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide()
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:317
void AddItemToSel(BOARD_ITEM *aItem, bool aQuietMode=false)
Select all items on the board.
void SetMotionHandler(MOTION_HANDLER aHandler)
Set a handler for mouse motion.
Definition: picker_tool.h:82
bool Selectable(const BOARD_ITEM *aItem, bool checkVisibilityOnly=false) const
Check conditions for an item to be selected.
#define _(s)
void BrightenItem(BOARD_ITEM *aItem)
bool m_isFootprintEditor
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
void SetCursor(KICURSOR aCursor)
Definition: picker_tool.h:62
Generic tool for picking an item.
void SetClickHandler(CLICK_HANDLER aHandler)
Set a handler for mouse click event.
Definition: picker_tool.h:71
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:460
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
std::unique_ptr< STATUS_TEXT_POPUP > m_statusPopup
Definition: pcb_control.h:134
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:240
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
The selection tool: currently supports:
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73
void Activate()
Run the tool.
BOARD * GetBoard() const
A general implementation of a COLLECTORS_GUIDE.
Definition: collectors.h:377
void GuessSelectionCandidates(GENERAL_COLLECTOR &aCollector, const VECTOR2I &aWhere) const
Try to guess best selection candidates in case multiple items are clicked, by doing some brain-dead h...

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

Referenced by setTransitions().

◆ displayOptions()

const PCB_DISPLAY_OPTIONS & PCB_TOOL_BASE::displayOptions ( ) const
protectedinherited

Definition at line 302 of file pcb_tool_base.cpp.

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

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

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

◆ doInteractiveItemPlacement()

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

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

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

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

Definition at line 37 of file pcb_tool_base.cpp.

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

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

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

◆ DoSetGridOrigin()

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

Definition at line 460 of file pcb_control.cpp.

462 {
463  aFrame->GetDesignSettings().m_GridOrigin = (wxPoint) aPoint;
464  aView->GetGAL()->SetGridOrigin( aPoint );
465  originViewItem->SetPosition( (wxPoint) aPoint );
466  aView->MarkDirty();
467  aFrame->OnModify();
468 }
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
wxPoint m_GridOrigin
origin for grid offsets
virtual void SetPosition(const wxPoint &aPos)
Definition: eda_item.h:253
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:190
void SetGridOrigin(const VECTOR2D &aGridOrigin)
Set the origin point for the grid.
virtual void OnModify()
Must be called after a change in order to set the "modify" flag of the current screen and update the ...
void MarkDirty()
Force redraw of view on the next rendering.
Definition: view.h:633

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

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

◆ FlipPcbView()

int PCB_CONTROL::FlipPcbView ( const TOOL_EVENT aEvent)

Definition at line 1212 of file pcb_control.cpp.

1213 {
1214  view()->SetMirror( !view()->IsMirroredX(), false );
1215  view()->RecacheAllItems();
1216  frame()->GetCanvas()->ForceRefresh();
1218  return 0;
1219 }
void ForceRefresh()
Force a redraw.
virtual void OnDisplayOptionsChanged()
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1395
void SetMirror(bool aMirrorX, bool aMirrorY)
Control the mirroring of the VIEW.
Definition: view.cpp:542
PCB_BASE_EDIT_FRAME * frame() const
KIGFX::PCB_VIEW * view() const

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

Referenced by setTransitions().

◆ footprint()

◆ frame()

PCB_BASE_EDIT_FRAME* PCB_TOOL_BASE::frame ( ) const
inlineprotectedinherited

Definition at line 160 of file pcb_tool_base.h.

161  {
162  return getEditFrame<PCB_BASE_EDIT_FRAME>();
163  }

Referenced by PCB_POINT_EDITOR::addCorner(), AUTOPLACE_TOOL::autoplace(), PCB_TOOL_BASE::canvas(), ZONE_FILLER_TOOL::CheckAllZones(), PNS::TOOL_BASE::checkSnap(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), ROUTER_TOOL::CustomTrackWidthDialog(), FOOTPRINT_EDITOR_CONTROL::DeleteFootprint(), PCB_TOOL_BASE::displayOptions(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), ROUTER_TOOL::DpDimensionsDialog(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EditPad(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), BOARD_EDITOR_CONTROL::ExportSpecctraDSN(), ZONE_FILLER_TOOL::FillAllZones(), EDIT_TOOL::FilletTracks(), ROUTER_TOOL::finishInteractive(), EDIT_TOOL::Flip(), FlipPcbView(), GLOBAL_EDIT_TOOL::GlobalDeletions(), ROUTER_TOOL::handleLayerSwitch(), BOARD_INSPECTION_TOOL::HighlightItem(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), BOARD_EDITOR_CONTROL::ImportSpecctraSession(), ROUTER_TOOL::Init(), SCRIPTING_TOOL::Init(), PCB_SELECTION_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_TOOL_BASE::Is45Limited(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::MoveExact(), PCB_POINT_EDITOR::OnSelectionChange(), Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PAD_TOOL::pushPadSettings(), PAD_TOOL::recombinePad(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), SCRIPTING_TOOL::reloadPlugins(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), PCB_SELECTION_TOOL::RequestSelection(), PNS::TOOL_BASE::Reset(), ROUTER_TOOL::SelectCopperLayerPair(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), PCB_POINT_EDITOR::setEditedPoint(), ROUTER_TOOL::SettingsDialog(), GLOBAL_EDIT_TOOL::swapBoardItem(), GLOBAL_EDIT_TOOL::SwapLayers(), ROUTER_TOOL::switchLayerOnViaPlacement(), unfilledZoneCheck(), ROUTER_TOOL::updateMessagePanel(), EDIT_TOOL::updateModificationPoint(), BOARD_EDITOR_CONTROL::UpdateSchematicFromPCB(), ZONE_FILLER_TOOL::ZoneFill(), and ZONE_FILLER_TOOL::ZoneFillAll().

◆ getEditFrame()

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

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

Definition at line 184 of file tool_base.h.

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

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 120 of file tool_base.h.

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

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 143 of file tool_base.h.

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

References TOOL_BASE::m_toolMgr.

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

◆ getModel()

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

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 196 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Return the name of the tool.

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

Returns
The name of the tool.

Definition at line 133 of file tool_base.h.

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

References TOOL_BASE::m_toolName.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 108 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

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

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

It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

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

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

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

◆ getViewControls()

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

Return the instance of VIEW_CONTROLS object used in the application.

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

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

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

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

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

◆ Go()

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

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

No conditions means any event.

Definition at line 147 of file tool_interactive.h.

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

References TOOL_INTERACTIVE::goInternal().

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

◆ GridResetOrigin()

int PCB_CONTROL::GridResetOrigin ( const TOOL_EVENT aEvent)

Definition at line 510 of file pcb_control.cpp.

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

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

Referenced by setTransitions().

◆ GridSetOrigin()

int PCB_CONTROL::GridSetOrigin ( const TOOL_EVENT aEvent)

Definition at line 471 of file pcb_control.cpp.

472 {
473  VECTOR2D* origin = aEvent.Parameter<VECTOR2D*>();
474 
475  if( origin )
476  {
477  // We can't undo the other grid dialog settings, so no sense undoing just the origin
478  DoSetGridOrigin( getView(), m_frame, m_gridOrigin.get(), *origin );
479  delete origin;
480  }
481  else
482  {
483  if( m_isFootprintEditor && !getEditFrame<PCB_BASE_EDIT_FRAME>()->GetModel() )
484  return 0;
485 
486  std::string tool = aEvent.GetCommandStr().get();
488 
489  if( !picker ) // Happens in footprint wizard
490  return 0;
491 
492  // Deactivate other tools; particularly important if another PICKER is currently running
493  Activate();
494 
495  picker->SetClickHandler(
496  [this]( const VECTOR2D& pt ) -> bool
497  {
499  DoSetGridOrigin( getView(), m_frame, m_gridOrigin.get(), pt );
500  return false; // drill origin is a one-shot; don't continue with tool
501  } );
502 
503  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
504  }
505 
506  return 0;
507 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
static TOOL_ACTION pickerTool
Definition: actions.h:155
static void DoSetGridOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, EDA_ITEM *originViewItem, const VECTOR2D &aPoint)
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
bool m_isFootprintEditor
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
Generic tool for picking an item.
void SetClickHandler(CLICK_HANDLER aHandler)
Set a handler for mouse click event.
Definition: picker_tool.h:71
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:460
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Definition: pcb_control.h:130
virtual void SaveCopyInUndoList(EDA_ITEM *aItemToCopy, UNDO_REDO aTypeCommand)=0
Create a new entry in undo list of commands.
void Activate()
Run the tool.

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

Referenced by setTransitions().

◆ HighContrastMode()

int PCB_CONTROL::HighContrastMode ( const TOOL_EVENT aEvent)

Definition at line 283 of file pcb_control.cpp.

284 {
286 
287  opts.m_ContrastModeDisplay =
291 
292  m_frame->SetDisplayOptions( opts );
293 
294  return 0;
295 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions, bool aRefresh=true)
Updates the current display options from the given options struct.
Container for display options like enable/disable some optional drawings.
Inactive layers are dimmed (old high-contrast mode)
Inactive layers are shown normally (no high-contrast mode)
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
const PCB_DISPLAY_OPTIONS & displayOptions() const

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

Referenced by setTransitions().

◆ HighContrastModeCycle()

int PCB_CONTROL::HighContrastModeCycle ( const TOOL_EVENT aEvent)

Definition at line 298 of file pcb_control.cpp.

299 {
301 
302  switch( opts.m_ContrastModeDisplay )
303  {
307  }
308 
309  m_frame->SetDisplayOptions( opts );
310 
311  return 0;
312 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions, bool aRefresh=true)
Updates the current display options from the given options struct.
Container for display options like enable/disable some optional drawings.
Inactive layers are dimmed (old high-contrast mode)
Inactive layers are shown normally (no high-contrast mode)
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
const PCB_DISPLAY_OPTIONS & displayOptions() const
Inactive layers are hidden.

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

Referenced by setTransitions().

◆ Init()

bool PCB_TOOL_BASE::Init ( void  )
overridevirtualinherited

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

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

Reimplemented from TOOL_BASE.

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

Definition at line 276 of file pcb_tool_base.cpp.

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

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

◆ Is45Limited()

bool PCB_TOOL_BASE::Is45Limited ( ) const
inherited

◆ IsFootprintEditor()

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

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

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

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

◆ LayerAlphaDec()

int PCB_CONTROL::LayerAlphaDec ( const TOOL_EVENT aEvent)

Definition at line 430 of file pcb_control.cpp.

431 {
432  COLOR_SETTINGS* settings = m_frame->GetColorSettings();
433  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
434  KIGFX::COLOR4D currentColor = settings->GetColor( currentLayer );
435 
436  if( currentColor.a >= ALPHA_MIN + ALPHA_STEP )
437  {
438  currentColor.a -= ALPHA_STEP;
439  settings->SetColor( currentLayer, currentColor );
441 
443  view->UpdateLayerColor( currentLayer );
444  view->UpdateLayerColor( GetNetnameLayer( currentLayer ) );
445 
446  if( IsCopperLayer( currentLayer ) )
447  view->UpdateLayerColor( ZONE_LAYER_FOR( currentLayer ) );
448 
449  static_cast<PCB_BASE_EDIT_FRAME*>( m_frame )->OnLayerAlphaChanged();
450  }
451  else
452  {
453  wxBell();
454  }
455 
456  return 0;
457 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
#define ALPHA_MIN
int LAYER_NUM
This can be replaced with int and removed.
Definition: layer_ids.h:40
void SetColor(int aLayer, const COLOR4D &aColor)
#define ZONE_LAYER_FOR(copperLayer)
Macro for getting the zone layer for a given copper layer.
Definition: layer_ids.h:251
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
Definition: layer_ids.h:932
virtual COLOR_SETTINGS * GetColorSettings() const override
Helper to retrieve the current color settings.
virtual PCB_LAYER_ID GetActiveLayer() const
double a
Alpha component.
Definition: color4d.h:374
KIGFX::PCB_VIEW * view() const
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:787
void UpdateColors()
Update the color settings in the painter and GAL.
void UpdateLayerColor(int aLayer)
Apply the new coloring scheme held by RENDER_SETTINGS in case that it has changed.
Definition: view.cpp:754
#define ALPHA_STEP
COLOR4D GetColor(int aLayer) const
Color settings are a bit different than most of the settings objects in that there can be more than o...
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

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

Referenced by setTransitions().

◆ LayerAlphaInc()

int PCB_CONTROL::LayerAlphaInc ( const TOOL_EVENT aEvent)

Definition at line 400 of file pcb_control.cpp.

401 {
402  COLOR_SETTINGS* settings = m_frame->GetColorSettings();
403  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
404  KIGFX::COLOR4D currentColor = settings->GetColor( currentLayer );
405 
406  if( currentColor.a <= ALPHA_MAX - ALPHA_STEP )
407  {
408  currentColor.a += ALPHA_STEP;
409  settings->SetColor( currentLayer, currentColor );
411 
413  view->UpdateLayerColor( currentLayer );
414  view->UpdateLayerColor( GetNetnameLayer( currentLayer ) );
415 
416  if( IsCopperLayer( currentLayer ) )
417  view->UpdateLayerColor( ZONE_LAYER_FOR( currentLayer ) );
418 
419  static_cast<PCB_BASE_EDIT_FRAME*>( m_frame )->OnLayerAlphaChanged();
420  }
421  else
422  {
423  wxBell();
424  }
425 
426  return 0;
427 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
int LAYER_NUM
This can be replaced with int and removed.
Definition: layer_ids.h:40
void SetColor(int aLayer, const COLOR4D &aColor)
#define ZONE_LAYER_FOR(copperLayer)
Macro for getting the zone layer for a given copper layer.
Definition: layer_ids.h:251
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
Definition: layer_ids.h:932
virtual COLOR_SETTINGS * GetColorSettings() const override
Helper to retrieve the current color settings.
virtual PCB_LAYER_ID GetActiveLayer() const
double a
Alpha component.
Definition: color4d.h:374
#define ALPHA_MAX
KIGFX::PCB_VIEW * view() const
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:787
void UpdateColors()
Update the color settings in the painter and GAL.
void UpdateLayerColor(int aLayer)
Apply the new coloring scheme held by RENDER_SETTINGS in case that it has changed.
Definition: view.cpp:754
#define ALPHA_STEP
COLOR4D GetColor(int aLayer) const
Color settings are a bit different than most of the settings objects in that there can be more than o...
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

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

Referenced by setTransitions().

◆ LayerNext()

int PCB_CONTROL::LayerNext ( const TOOL_EVENT aEvent)

Definition at line 323 of file pcb_control.cpp.

324 {
325  PCB_BASE_FRAME* editFrame = m_frame;
326  BOARD* brd = board();
327  LAYER_NUM layer = editFrame->GetActiveLayer();
328  LAYER_NUM startLayer = layer;
329 
330  if( layer < F_Cu || layer > B_Cu )
331  return 0;
332 
333  while( startLayer != ++layer )
334  {
335  if( brd->IsLayerVisible( static_cast<PCB_LAYER_ID>( layer ) ) && IsCopperLayer( layer ) )
336  break;
337 
338  if( layer >= B_Cu )
339  layer = F_Cu - 1;
340  }
341 
342  wxCHECK( IsCopperLayer( layer ), 0 );
343  editFrame->SwitchLayer( nullptr, ToLAYER_ID( layer ) );
344 
345  return 0;
346 }
BOARD * board() const
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
int LAYER_NUM
This can be replaced with int and removed.
Definition: layer_ids.h:40
virtual PCB_LAYER_ID GetActiveLayer() const
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:787
virtual void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer)
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
Definition: board.cpp:472
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
Definition: layer_ids.h:70
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:905
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.

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

Referenced by setTransitions().

◆ LayerPrev()

int PCB_CONTROL::LayerPrev ( const TOOL_EVENT aEvent)

Definition at line 349 of file pcb_control.cpp.

350 {
351  PCB_BASE_FRAME* editFrame = m_frame;
352  BOARD* brd = board();
353  LAYER_NUM layer = editFrame->GetActiveLayer();
354  LAYER_NUM startLayer = layer;
355 
356  if( layer < F_Cu || layer > B_Cu )
357  return 0;
358 
359  while( startLayer != --layer )
360  {
361  if( IsCopperLayer( layer ) // also test for valid layer id (layer >= F_Cu)
362  && brd->IsLayerVisible( static_cast<PCB_LAYER_ID>( layer ) ) )
363  {
364  break;
365  }
366 
367  if( layer <= F_Cu )
368  layer = B_Cu + 1;
369  }
370 
371 
372  wxCHECK( IsCopperLayer( layer ), 0 );
373  editFrame->SwitchLayer( nullptr, ToLAYER_ID( layer ) );
374 
375  return 0;
376 }
BOARD * board() const
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
int LAYER_NUM
This can be replaced with int and removed.
Definition: layer_ids.h:40
virtual PCB_LAYER_ID GetActiveLayer() const
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:787
virtual void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer)
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
Definition: board.cpp:472
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
Definition: layer_ids.h:70
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:905
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.

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

Referenced by setTransitions().

◆ LayerSwitch()

int PCB_CONTROL::LayerSwitch ( const TOOL_EVENT aEvent)

Definition at line 315 of file pcb_control.cpp.

316 {
317  m_frame->SwitchLayer( nullptr, aEvent.Parameter<PCB_LAYER_ID>() );
318 
319  return 0;
320 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
virtual void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer)
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:64

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

Referenced by setTransitions().

◆ LayerToggle()

int PCB_CONTROL::LayerToggle ( const TOOL_EVENT aEvent)

Definition at line 379 of file pcb_control.cpp.

380 {
381  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
382  PCB_SCREEN* screen = m_frame->GetScreen();
383 
384  if( currentLayer == screen->m_Route_Layer_TOP )
385  m_frame->SwitchLayer( nullptr, screen->m_Route_Layer_BOTTOM );
386  else
387  m_frame->SwitchLayer( nullptr, screen->m_Route_Layer_TOP );
388 
389  return 0;
390 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
int LAYER_NUM
This can be replaced with int and removed.
Definition: layer_ids.h:40
virtual PCB_LAYER_ID GetActiveLayer() const
PCB_LAYER_ID m_Route_Layer_BOTTOM
Definition: pcb_screen.h:44
virtual void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer)
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
PCB_LAYER_ID m_Route_Layer_TOP
Definition: pcb_screen.h:43

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

Referenced by setTransitions().

◆ Paste()

int PCB_CONTROL::Paste ( const TOOL_EVENT aEvent)

Definition at line 686 of file pcb_control.cpp.

687 {
688  CLIPBOARD_IO pi;
689  BOARD_ITEM* clipItem = pi.Parse();
690 
691  if( !clipItem )
692  return 0;
693 
694  // The viewer frames cannot paste
695  if( !frame()->IsType( FRAME_FOOTPRINT_EDITOR ) && !frame()->IsType( FRAME_PCB_EDITOR ) )
696  return 0;
697 
699  const wxString defaultRef = wxT( "REF**" );
700 
701  if( aEvent.IsAction( &ACTIONS::pasteSpecial ) )
702  {
703  DIALOG_PASTE_SPECIAL dlg( m_frame, &pasteMode, defaultRef );
704 
705  if( dlg.ShowModal() == wxID_CANCEL )
706  return 0;
707  }
708 
709  bool isFootprintEditor = m_isFootprintEditor || frame()->IsType( FRAME_FOOTPRINT_EDITOR );
710 
711  if( clipItem->Type() == PCB_T )
712  {
713  if( isFootprintEditor )
714  {
715  for( BOARD_CONNECTED_ITEM* item : static_cast<BOARD*>( clipItem )->AllConnectedItems() )
716  item->SetNet( NETINFO_LIST::OrphanedItem() );
717  }
718  else
719  {
720  static_cast<BOARD*>( clipItem )->MapNets( m_frame->GetBoard() );
721  }
722  }
723 
724  // The clipboard can contain two different things, an entire kicad_pcb or a single footprint
725  if( isFootprintEditor && ( !board() || !footprint() ) )
726  {
727  return 0;
728  }
729 
730  switch( clipItem->Type() )
731  {
732  case PCB_T:
733  {
734  BOARD* clipBoard = static_cast<BOARD*>( clipItem );
735 
736  if( isFootprintEditor )
737  {
738  FOOTPRINT* editorFootprint = board()->GetFirstFootprint();
739  std::vector<BOARD_ITEM*> pastedItems;
740 
741  for( FOOTPRINT* clipFootprint : clipBoard->Footprints() )
742  pasteFootprintItemsToFootprintEditor( clipFootprint, board(), pastedItems );
743 
744  for( BOARD_ITEM* clipDrawItem : clipBoard->Drawings() )
745  {
746  if( clipDrawItem->Type() == PCB_SHAPE_T )
747  {
748  PCB_SHAPE* clipShape = static_cast<PCB_SHAPE*>( clipDrawItem );
749 
750  // Convert to PCB_FP_SHAPE_T
751  FP_SHAPE* pastedShape = new FP_SHAPE( editorFootprint );
752  static_cast<PCB_SHAPE*>( pastedShape )->SwapData( clipShape );
753  pastedShape->SetLocalCoord();
754 
755  // Replace parent nuked by above call to SwapData()
756  pastedShape->SetParent( editorFootprint );
757  pastedItems.push_back( pastedShape );
758  }
759  else if( clipDrawItem->Type() == PCB_TEXT_T )
760  {
761  PCB_TEXT* clipTextItem = static_cast<PCB_TEXT*>( clipDrawItem );
762 
763  // Convert to PCB_FP_TEXT_T
764  FP_TEXT* pastedTextItem = new FP_TEXT( editorFootprint );
765  static_cast<EDA_TEXT*>( pastedTextItem )->SwapText( *clipTextItem );
766  static_cast<EDA_TEXT*>( pastedTextItem )->SwapEffects( *clipTextItem );
767 
768  pastedTextItem->SetParent( editorFootprint );
769  pastedItems.push_back( pastedTextItem );
770  }
771  }
772 
773  delete clipBoard;
774 
775  placeBoardItems( pastedItems, true, true,
776  pasteMode == PASTE_MODE::UNIQUE_ANNOTATIONS );
777  }
778  else
779  {
780  if( pasteMode == PASTE_MODE::REMOVE_ANNOTATIONS )
781  {
782  for( FOOTPRINT* clipFootprint : clipBoard->Footprints() )
783  clipFootprint->SetReference( defaultRef );
784  }
785 
786  placeBoardItems( clipBoard, true, pasteMode == PASTE_MODE::UNIQUE_ANNOTATIONS );
787 
789  m_frame->Compile_Ratsnest( true );
790  }
791 
792  break;
793  }
794 
795  case PCB_FOOTPRINT_T:
796  {
797  FOOTPRINT* clipFootprint = static_cast<FOOTPRINT*>( clipItem );
798  std::vector<BOARD_ITEM*> pastedItems;
799 
800  if( isFootprintEditor )
801  {
802  pasteFootprintItemsToFootprintEditor( clipFootprint, board(), pastedItems );
803  delete clipFootprint;
804  }
805  else
806  {
807  if( pasteMode == PASTE_MODE::REMOVE_ANNOTATIONS )
808  clipFootprint->SetReference( defaultRef );
809 
810  clipFootprint->SetParent( board() );
811  pastedItems.push_back( clipFootprint );
812  }
813 
814  placeBoardItems( pastedItems, true, true, pasteMode == PASTE_MODE::UNIQUE_ANNOTATIONS );
815  break;
816  }
817 
818  default:
819  m_frame->DisplayToolMsg( _( "Invalid clipboard contents" ) );
820  break;
821  }
822 
823  return 1;
824 }
void SetReference(const wxString &aReference)
Definition: footprint.h:439
BOARD_ITEM * Parse()
Definition: typeinfo.h:84
static NETINFO_ITEM * OrphanedItem()
Wrapper class, so you can iterate through NETINFO_ITEM*s, not std::pair<int/wxString,...
Definition: netinfo.h:373
BOARD * board() const
void Compile_Ratsnest(bool aDisplayStatus)
Create the entire board ratsnest.
Definition: ratsnest.cpp:40
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
int placeBoardItems(std::vector< BOARD_ITEM * > &aItems, bool aIsNew, bool aAnchorAtOrigin, bool aReannotateDuplicates)
Add and select or just select for move/place command a list of board items.
class PCB_TEXT, text on a layer
Definition: typeinfo.h:91
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:116
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:88
PCB_BASE_EDIT_FRAME * frame() const
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:317
FOOTPRINTS & Footprints()
Definition: board.h:233
FOOTPRINT * footprint() const
#define _(s)
void BuildConnectivity()
Build or rebuild the board connectivity database for the board, especially the list of connected item...
Definition: board.cpp:136
bool m_isFootprintEditor
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
static TOOL_ACTION pasteSpecial
Definition: actions.h:69
static void pasteFootprintItemsToFootprintEditor(FOOTPRINT *aClipFootprint, BOARD *aBoard, std::vector< BOARD_ITEM * > &aPastedItems)
bool IsType(FRAME_T aType) const
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
void SetLocalCoord()
Set relative coordinates from draw coordinates.
Definition: fp_shape.cpp:54
BOARD * GetBoard() const
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
DRAWINGS & Drawings()
Definition: board.h:236
void DisplayToolMsg(const wxString &msg) override
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

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

Referenced by setTransitions().

◆ placeBoardItems() [1/2]

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

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

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

Definition at line 933 of file pcb_control.cpp.

935 {
937 
939  EDIT_TOOL* editTool = m_toolMgr->GetTool<EDIT_TOOL>();
940 
941  std::vector<BOARD_ITEM*> itemsToSel;
942  itemsToSel.reserve( aItems.size() );
943 
944  for( BOARD_ITEM* item : aItems )
945  {
946  if( aIsNew )
947  {
948  const_cast<KIID&>( item->m_Uuid ) = KIID();
949 
950  if( selectionTool->GetEnteredGroup() && !item->GetParentGroup() )
951  selectionTool->GetEnteredGroup()->AddItem( item );
952  }
953 
954  // Update item attributes if needed
955  switch( item->Type() )
956  {
957  case PCB_DIMENSION_T:
958  case PCB_DIM_ALIGNED_T:
959  case PCB_DIM_CENTER_T:
961  case PCB_DIM_LEADER_T:
962  {
963  // Dimensions need to have their units updated if they are automatic
964  PCB_DIMENSION_BASE* dim = static_cast<PCB_DIMENSION_BASE*>( item );
965 
967  dim->SetUnits( frame()->GetUserUnits() );
968 
969  break;
970  }
971 
972  case PCB_FOOTPRINT_T:
973  // Update the footprint path with the new KIID path if the footprint is new
974  if( aIsNew )
975  static_cast<FOOTPRINT*>( item )->SetPath( KIID_PATH() );
976 
977  break;
978 
979  default:
980  break;
981  }
982 
983  // We only need to add the items that aren't inside a group currently selected
984  // to the selection. If an item is inside a group and that group is selected,
985  // then the selection tool will select it for us.
986  if( !item->GetParentGroup() || !alg::contains( aItems, item->GetParentGroup() ) )
987  itemsToSel.push_back( item );
988  }
989 
990  // Select the items that should be selected
991  m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &itemsToSel );
992 
993  // Reannotate duplicate footprints (make sense only in board editor )
994  if( aReannotateDuplicates && m_frame->IsType( FRAME_PCB_EDITOR ) )
996 
997  for( BOARD_ITEM* item : aItems )
998  {
999  // Commit after reannotation
1000  if( aIsNew )
1001  editTool->GetCurrentCommit()->Add( item );
1002  else
1003  editTool->GetCurrentCommit()->Added( item );
1004  }
1005 
1006  PCB_SELECTION& selection = selectionTool->GetSelection();
1007 
1008  if( selection.Size() > 0 )
1009  {
1010  if( aAnchorAtOrigin )
1011  {
1013  }
1014  else
1015  {
1016  BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.GetTopLeftItem() );
1018  }
1019 
1020  getViewControls()->SetCursorPosition( getViewControls()->GetMousePosition(), false );
1021 
1024  }
1025 
1026  return 0;
1027 }
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
Definition: pcb_actions.h:66
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:59
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:91
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
Definition: pcb_group.cpp:38
void SetUnits(EDA_UNITS aUnits)
static const TOOL_EVENT SelectedEvent
Definition: actions.h:199
static TOOL_ACTION move
move or drag an item
Definition: pcb_actions.h:92
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:100
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:101
int GetUserUnits()
Return the currently selected user unit value for the interface.
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:102
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Move cursor to the requested position expressed in world coordinates.
Abstract dimension API.
Definition: pcb_dimension.h:95
PCB_GROUP * GetEnteredGroup()
virtual wxPoint GetPosition() const
Definition: eda_item.h:252
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
DIM_UNITS_MODE GetUnitsMode() const
PCB_BASE_EDIT_FRAME * frame() const
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
Definition: kiid.h:44
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:186
const PCB_SELECTION & selection() const
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
EDA_ITEM * GetTopLeftItem(bool aFootprintsOnly=false) const override
class PCB_DIMENSION_BASE: abstract dimension meta-type
Definition: typeinfo.h:99
The interactive edit tool.
Definition: edit_tool.h:64
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:99
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
bool IsType(FRAME_T aType) const
int Size() const
Returns the number of selected parts.
Definition: selection.h:103
The selection tool: currently supports:
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:103
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42

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

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

◆ placeBoardItems() [2/2]

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

Pointer to the currently used edit frame.

Definition at line 911 of file pcb_control.cpp.

912 {
913  // items are new if the current board is not the board source
914  bool isNew = board() != aBoard;
915  std::vector<BOARD_ITEM*> items;
916 
917  moveUnflaggedItems( aBoard->Tracks(), items, isNew );
918  moveUnflaggedItems( aBoard->Footprints(), items, isNew );
919  moveUnflaggedItems( aBoard->Drawings(), items, isNew );
920  moveUnflaggedItems( aBoard->Zones(), items, isNew );
921 
922  // Subtlety: When selecting a group via the mouse,
923  // PCB_SELECTION_TOOL::highlightInternal runs, which does a SetSelected() on all
924  // descendants. In PCB_CONTROL::placeBoardItems, below, we skip that and
925  // mark items non-recursively. That works because the saving of the
926  // selection created aBoard that has the group and all descendants in it.
927  moveUnflaggedItems( aBoard->Groups(), items, isNew );
928 
929  return placeBoardItems( items, isNew, aAnchorAtOrigin, aReannotateDuplicates );
930 }
ZONES & Zones()
Definition: board.h:239
BOARD * board() const
GROUPS & Groups()
The groups must maintain the following invariants.
Definition: board.h:253
int placeBoardItems(std::vector< BOARD_ITEM * > &aItems, bool aIsNew, bool aAnchorAtOrigin, bool aReannotateDuplicates)
Add and select or just select for move/place command a list of board items.
FOOTPRINTS & Footprints()
Definition: board.h:233
static void moveUnflaggedItems(std::deque< T > &aList, std::vector< BOARD_ITEM * > &aTarget, bool aIsNew)
DRAWINGS & Drawings()
Definition: board.h:236
TRACKS & Tracks()
Definition: board.h:230

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

◆ Print()

int PCB_CONTROL::Print ( const TOOL_EVENT aEvent)

Definition at line 465 of file dialog_print_pcbnew.cpp.

466 {
467  // Selection affects the origin item visibility
469 
471  DIALOG_PRINT_PCBNEW dlg( (PCB_BASE_EDIT_FRAME*) m_frame, &settings );
472 
473  if( m_isFootprintEditor )
474  dlg.ForcePrintBorder( false );
475 
476  dlg.ShowModal();
477 
478  return 0;
479 }
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:59
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
bool m_isFootprintEditor
Common, abstract interface for edit frames.
const PAGE_INFO & GetPageSettings() const override

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

Referenced by setTransitions().

◆ Quit()

int PCB_CONTROL::Quit ( const TOOL_EVENT aEvent)

Definition at line 113 of file pcb_control.cpp.

114 {
115  m_frame->Close( false );
116  return 0;
117 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127

References m_frame.

Referenced by setTransitions().

◆ Redo()

int PCB_CONTROL::Redo ( const TOOL_EVENT aEvent)

Definition at line 1134 of file pcb_control.cpp.

1135 {
1136  PCB_BASE_EDIT_FRAME* editFrame = dynamic_cast<PCB_BASE_EDIT_FRAME*>( m_frame );
1137  wxCommandEvent dummy;
1138 
1139  if( editFrame )
1140  editFrame->RestoreCopyFromRedoList( dummy );
1141 
1142  return 0;
1143 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:72
Common, abstract interface for edit frames.
void RestoreCopyFromRedoList(wxCommandEvent &aEvent)
Redo the last edit:
Definition: undo_redo.cpp:345

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

Referenced by setTransitions().

◆ Reset()

void PCB_CONTROL::Reset ( RESET_REASON  aReason)
overridevirtual

Bring the tool to a known, initial state.

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

Parameters
aReasoncontains information about the reason of tool reset.

Reimplemented from PCB_TOOL_BASE.

Definition at line 85 of file pcb_control.cpp.

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

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

◆ RunMainStack()

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

Call a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

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

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

Referenced by DRAWING_TOOL::PlaceText().

◆ selection() [1/2]

const PCB_SELECTION & PCB_TOOL_BASE::selection ( ) const
protectedinherited

Definition at line 313 of file pcb_tool_base.cpp.

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

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

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

◆ selection() [2/2]

PCB_SELECTION & PCB_TOOL_BASE::selection ( )
protectedinherited

Definition at line 321 of file pcb_tool_base.cpp.

322 {
324 
325  return selTool->GetSelection();
326 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
The selection tool: currently supports:

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

◆ SetContextMenu()

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

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

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

Definition at line 76 of file tool_interactive.cpp.

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

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

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

◆ SetIsFootprintEditor()

void PCB_TOOL_BASE::SetIsFootprintEditor ( bool  aEnabled)
inlineinherited

Function SetIsFootprintEditor()

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

Parameters
aEnableddecides if the mode should be enabled.

Definition at line 103 of file pcb_tool_base.h.

103 { m_isFootprintEditor = aEnabled; }
bool m_isFootprintEditor

References PCB_TOOL_BASE::m_isFootprintEditor.

◆ setTransitions()

void PCB_CONTROL::setTransitions ( )
overrideprivatevirtual

< Sets up handlers for various events.

Reimplemented from PCB_TOOL_BASE.

Definition at line 1222 of file pcb_control.cpp.

1223 {
1226  Go( &PCB_CONTROL::Print, ACTIONS::print.MakeEvent() );
1227  Go( &PCB_CONTROL::Quit, ACTIONS::quit.MakeEvent() );
1228 
1229  // Display modes
1242 
1243  // Layer control
1281 
1282  // Grid control
1285 
1286  Go( &PCB_CONTROL::Undo, ACTIONS::undo.MakeEvent() );
1287  Go( &PCB_CONTROL::Redo, ACTIONS::redo.MakeEvent() );
1288 
1289  // Miscellaneous
1291 
1292  // Append control
1294 
1295  Go( &PCB_CONTROL::Paste, ACTIONS::paste.MakeEvent() );
1296  Go( &PCB_CONTROL::Paste, ACTIONS::pasteSpecial.MakeEvent() );
1297 
1302 }
static TOOL_ACTION layerBottom
Definition: pcb_actions.h:282
static TOOL_ACTION layerInner26
Definition: pcb_actions.h:277
int ZoneDisplayMode(const TOOL_EVENT &aEvent)
int GridSetOrigin(const TOOL_EVENT &aEvent)
static const TOOL_EVENT SelectedEvent
Definition: actions.h:199
static TOOL_ACTION layerNext
Definition: pcb_actions.h:283
static TOOL_ACTION layerInner2
Definition: pcb_actions.h:253
int LayerAlphaDec(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner5
Definition: pcb_actions.h:256
int Redo(const TOOL_EVENT &aEvent)
int LayerNext(const TOOL_EVENT &aEvent)
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:200
static TOOL_ACTION layerInner6
Definition: pcb_actions.h:257
static TOOL_ACTION layerInner7
Definition: pcb_actions.h:258
static TOOL_ACTION layerInner8
Definition: pcb_actions.h:259
static TOOL_ACTION layerInner21
Definition: pcb_actions.h:272
static TOOL_ACTION ratsnestLineMode
Definition: pcb_actions.h:239
static TOOL_ACTION layerAlphaDec
Definition: pcb_actions.h:286
static TOOL_ACTION gridResetOrigin
Definition: actions.h:138
int LayerAlphaInc(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerAlphaInc
Definition: pcb_actions.h:285
static TOOL_ACTION print
Definition: actions.h:57
static TOOL_ACTION zoneDisplayFilled
Definition: pcb_actions.h:243
static TOOL_ACTION layerInner3
Definition: pcb_actions.h:254
static TOOL_ACTION layerInner24
Definition: pcb_actions.h:275
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
static TOOL_ACTION layerInner11
Definition: pcb_actions.h:262
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:204
static TOOL_ACTION layerTop
Definition: pcb_actions.h:251
int Undo(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner23
Definition: pcb_actions.h:274
static TOOL_ACTION appendBoard
Definition: pcb_actions.h:438
static TOOL_ACTION zoneDisplayToggle
Definition: pcb_actions.h:247
static TOOL_ACTION zoneDisplayFractured
Definition: pcb_actions.h:245
static TOOL_ACTION layerInner13
Definition: pcb_actions.h:264
static TOOL_ACTION layerPrev
Definition: pcb_actions.h:284
static TOOL_ACTION layerInner25
Definition: pcb_actions.h:276
static TOOL_ACTION layerInner18
Definition: pcb_actions.h:269
static TOOL_ACTION layerInner30
Definition: pcb_actions.h:281
int GridResetOrigin(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner29
Definition: pcb_actions.h:280
int DeleteItemCursor(const TOOL_EVENT &aEvent)
static TOOL_ACTION showRatsnest
Definition: pcb_actions.h:238
static TOOL_ACTION addLibrary
Definition: actions.h:49
static TOOL_ACTION quit
Definition: actions.h:59
static TOOL_ACTION layerInner10
Definition: pcb_actions.h:261
static const TOOL_EVENT ClearedEvent
Selected item had a property changed (except movement)
Definition: actions.h:201
static TOOL_ACTION zoneDisplayTriangulated
Definition: pcb_actions.h:246
int HighContrastMode(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner15
Definition: pcb_actions.h:266
static TOOL_ACTION newLibrary
Definition: actions.h:48
static TOOL_ACTION layerInner28
Definition: pcb_actions.h:279
static TOOL_ACTION layerInner27
Definition: pcb_actions.h:278
static TOOL_ACTION layerInner17
Definition: pcb_actions.h:268
static TOOL_ACTION zoneDisplayOutline
Definition: pcb_actions.h:244
static TOOL_ACTION layerInner20
Definition: pcb_actions.h:271
static TOOL_ACTION pasteSpecial
Definition: actions.h:69
static TOOL_ACTION viaDisplayMode
Definition: pcb_actions.h:242
int Quit(const TOOL_EVENT &aEvent)
static TOOL_ACTION redo
Definition: actions.h:65
static TOOL_ACTION layerInner22
Definition: pcb_actions.h:273
int LayerSwitch(const TOOL_EVENT &aEvent)
int Print(const TOOL_EVENT &aEvent)
int Paste(const TOOL_EVENT &aEvent)
int FlipPcbView(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner14
Definition: pcb_actions.h:265
static TOOL_ACTION layerInner9
Definition: pcb_actions.h:260
int HighContrastModeCycle(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner16
Definition: pcb_actions.h:267
int AddLibrary(const TOOL_EVENT &aEvent)
Definition: pcb_control.cpp:99
int LayerPrev(const TOOL_EVENT &aEvent)
static TOOL_ACTION deleteTool
Definition: actions.h:73
static TOOL_ACTION highContrastModeCycle
Definition: actions.h:104
static TOOL_ACTION layerInner4
Definition: pcb_actions.h:255
static TOOL_ACTION undo
Definition: actions.h:64
int ToggleRatsnest(const TOOL_EVENT &aEvent)
static TOOL_ACTION flipBoard
Definition: pcb_actions.h:291
static TOOL_ACTION gridSetOrigin
Definition: actions.h:137
static TOOL_ACTION layerInner19
Definition: pcb_actions.h:270
int LayerToggle(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner1
Definition: pcb_actions.h:252
static TOOL_ACTION highContrastMode
Definition: actions.h:103
static TOOL_ACTION paste
Definition: actions.h:68
int AppendBoardFromFile(const TOOL_EVENT &aEvent)
static TOOL_ACTION trackDisplayMode
Definition: pcb_actions.h:240
int TrackDisplayMode(const TOOL_EVENT &aEvent)
int UpdateMessagePanel(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner12
Definition: pcb_actions.h:263
static TOOL_ACTION layerToggle
Definition: pcb_actions.h:287
int ViaDisplayMode(const TOOL_EVENT &aEvent)

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

◆ ToggleRatsnest()

int PCB_CONTROL::ToggleRatsnest ( const TOOL_EVENT aEvent)

Definition at line 145 of file pcb_control.cpp.

146 {
148 
149  if( aEvent.IsAction( &PCB_ACTIONS::showRatsnest ) )
150  {
151  // N.B. Do not disable the Ratsnest layer here. We use it for local ratsnest
152  Flip( opts.m_ShowGlobalRatsnest );
153  m_frame->SetDisplayOptions( opts );
154  getEditFrame<PCB_EDIT_FRAME>()->SetElementVisibility( LAYER_RATSNEST,
155  opts.m_ShowGlobalRatsnest );
156 
157  }
158  else if( aEvent.IsAction( &PCB_ACTIONS::ratsnestLineMode ) )
159  {
161  m_frame->SetDisplayOptions( opts );
162  }
163 
164  canvas()->RedrawRatsnest();
165  canvas()->Refresh();
166 
167  return 0;
168 }
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
static TOOL_ACTION ratsnestLineMode
Definition: pcb_actions.h:239
void Flip(T &aValue)
void RedrawRatsnest()
Return the bounding box of the view that should be used if model is not valid.
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:88
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions, bool aRefresh=true)
Updates the current display options from the given options struct.
Container for display options like enable/disable some optional drawings.
static TOOL_ACTION showRatsnest
Definition: pcb_actions.h:238
const PCB_DISPLAY_OPTIONS & displayOptions() const
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
PCB_DRAW_PANEL_GAL * canvas() const

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

Referenced by setTransitions().

◆ TrackDisplayMode()

int PCB_CONTROL::TrackDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 126 of file pcb_control.cpp.

127 {
129 
130  Flip( opts.m_DisplayPcbTrackFill );
131  m_frame->SetDisplayOptions( opts );
132 
133  for( PCB_TRACK* track : board()->Tracks() )
134  {
135  if( track->Type() == PCB_TRACE_T || track->Type() == PCB_ARC_T )
136  view()->Update( track, KIGFX::REPAINT );
137  }
138 
139  canvas()->Refresh();
140 
141  return 0;
142 }
BOARD * board() const
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
void Flip(T &aValue)
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions, bool aRefresh=true)
Updates the current display options from the given options struct.
Container for display options like enable/disable some optional drawings.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: pcb_view.cpp:92
Item needs to be redrawn.
Definition: view_item.h:57
KIGFX::PCB_VIEW * view() const
const PCB_DISPLAY_OPTIONS & displayOptions() const
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
PCB_DRAW_PANEL_GAL * canvas() const

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

Referenced by setTransitions().

◆ Undo()

int PCB_CONTROL::Undo ( const TOOL_EVENT aEvent)

Definition at line 1122 of file pcb_control.cpp.

1123 {
1124  PCB_BASE_EDIT_FRAME* editFrame = dynamic_cast<PCB_BASE_EDIT_FRAME*>( m_frame );
1125  wxCommandEvent dummy;
1126 
1127  if( editFrame )
1128  editFrame->RestoreCopyFromUndoList( dummy );
1129 
1130  return 0;
1131 }
void RestoreCopyFromUndoList(wxCommandEvent &aEvent)
Undo the last edit:
Definition: undo_redo.cpp:315
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:72
Common, abstract interface for edit frames.

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

Referenced by setTransitions().

◆ unfilledZoneCheck()

void PCB_CONTROL::unfilledZoneCheck ( )
private

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

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

Definition at line 195 of file pcb_control.cpp.

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

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

Referenced by ZoneDisplayMode().

◆ UpdateMessagePanel()

int PCB_CONTROL::UpdateMessagePanel ( const TOOL_EVENT aEvent)

Definition at line 1146 of file pcb_control.cpp.

1147 {
1149  PCB_SELECTION& selection = selTool->GetSelection();
1150 
1151  if( selection.GetSize() == 1 )
1152  {
1153  EDA_ITEM* item = selection.Front();
1154  MSG_PANEL_ITEMS msgItems;
1155 
1156  item->GetMsgPanelInfo( m_frame, msgItems );
1157  m_frame->SetMsgPanel( msgItems );
1158  }
1159  else if( selection.GetSize() > 1 )
1160  {
1161  MSG_PANEL_ITEMS msgItems;
1162  wxString msg = wxString::Format( wxT( "%d" ), selection.GetSize() );
1163 
1164  msgItems.emplace_back( MSG_PANEL_ITEM( _( "Selected Items" ), msg ) );
1165  m_frame->SetMsgPanel( msgItems );
1166  }
1167  else if( auto editFrame = dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_frame ) )
1168  {
1169  FOOTPRINT* footprint = static_cast<FOOTPRINT*>( editFrame->GetModel() );
1170 
1171  if( !footprint )
1172  return 0;
1173 
1174  MSG_PANEL_ITEMS msgItems;
1175  wxString msg;
1176 
1177  msg = footprint->GetFPID().GetLibNickname().wx_str();
1178  msgItems.emplace_back( MSG_PANEL_ITEM( _( "Library" ), msg ) );
1179 
1180  msg = footprint->GetFPID().GetLibItemName().wx_str();
1181  msgItems.emplace_back( MSG_PANEL_ITEM( _( "Footprint Name" ), msg ) );
1182 
1183  wxDateTime date( static_cast<time_t>( footprint->GetLastEditTime() ) );
1184 
1185  if( footprint->GetLastEditTime() && date.IsValid() )
1186  // Date format: see http://www.cplusplus.com/reference/ctime/strftime
1187  msg = date.Format( wxT( "%b %d, %Y" ) ); // Abbreviated_month_name Day, Year
1188  else
1189  msg = _( "Unknown" );
1190 
1191  msgItems.emplace_back( MSG_PANEL_ITEM( _( "Last Change" ), msg ) );
1192 
1193  msg.Printf( wxT( "%zu" ), (size_t) footprint->GetPadCount( DO_NOT_INCLUDE_NPTH ) );
1194  msgItems.emplace_back( MSG_PANEL_ITEM( _( "Pads" ), msg ) );
1195 
1196  wxString doc, keyword;
1197  doc.Printf( _( "Doc: %s" ), footprint->GetDescription() );
1198  keyword.Printf( _( "Keywords: %s" ), footprint->GetKeywords() );
1199  msgItems.emplace_back( MSG_PANEL_ITEM( doc, keyword ) );
1200 
1201  m_frame->SetMsgPanel( msgItems );
1202  }
1203  else
1204  {
1206  }
1207 
1208  return 0;
1209 }
const wxString & GetDescription() const
Definition: footprint.h:197
const UTF8 & GetLibItemName() const
Definition: lib_id.h:104
unsigned GetPadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of pads.
Definition: footprint.cpp:1067
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
timestamp_t GetLastEditTime() const
Definition: footprint.h:336
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
const PCB_SELECTION & selection() const
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
virtual void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: eda_item.h:214
FOOTPRINT * footprint() const
#define _(s)
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:90
const LIB_ID & GetFPID() const
Definition: footprint.h:194
const wxString & GetKeywords() const
Definition: footprint.h:200
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:87
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
wxString wx_str() const
Definition: utf8.cpp:46
The selection tool: currently supports:
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:97
BOARD * GetBoard() const
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:53
EDA_ITEM * Front() const
Definition: selection.h:144

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

Referenced by setTransitions().

◆ ViaDisplayMode()

int PCB_CONTROL::ViaDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 171 of file pcb_control.cpp.

172 {
174 
175  Flip( opts.m_DisplayViaFill );
176  m_frame->SetDisplayOptions( opts );
177 
178  for( PCB_TRACK* track : board()->Tracks() )
179  {
180  if( track->Type() == PCB_TRACE_T || track->Type() == PCB_VIA_T )
181  view()->Update( track, KIGFX::REPAINT );
182  }
183 
184  canvas()->Refresh();
185 
186  return 0;
187 }
BOARD * board() const
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
void Flip(T &aValue)
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions, bool aRefresh=true)
Updates the current display options from the given options struct.
Container for display options like enable/disable some optional drawings.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: pcb_view.cpp:92
Item needs to be redrawn.
Definition: view_item.h:57
KIGFX::PCB_VIEW * view() const
const PCB_DISPLAY_OPTIONS & displayOptions() const
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
PCB_DRAW_PANEL_GAL * canvas() const

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

Referenced by setTransitions().

◆ view()

◆ Wait()

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

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

No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

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

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

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

◆ ZoneDisplayMode()

int PCB_CONTROL::ZoneDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 237 of file pcb_control.cpp.

238 {
240 
241  // Apply new display options to the GAL canvas
243  {
245 
247  }
248  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayOutline ) )
249  {
251  }
252  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayFractured ) )
253  {
255  }
256  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayTriangulated ) )
257  {
259  }
260  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayToggle ) )
261  {
264  else
266  }
267  else
268  {
269  wxFAIL;
270  }
271 
272  m_frame->SetDisplayOptions( opts );
273 
274  for( ZONE* zone : board()->Zones() )
275  view()->Update( zone, KIGFX::REPAINT );
276 
277  canvas()->Refresh();
278 
279  return 0;
280 }
BOARD * board() const
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:127
static TOOL_ACTION zoneDisplayFilled
Definition: pcb_actions.h:243
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:88
static TOOL_ACTION zoneDisplayToggle
Definition: pcb_actions.h:247
static TOOL_ACTION zoneDisplayFractured
Definition: pcb_actions.h:245
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions, bool aRefresh=true)
Updates the current display options from the given options struct.
Container for display options like enable/disable some optional drawings.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: pcb_view.cpp:92
Item needs to be redrawn.
Definition: view_item.h:57
KIGFX::PCB_VIEW * view() const
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
static TOOL_ACTION zoneDisplayTriangulated
Definition: pcb_actions.h:246
void unfilledZoneCheck()
We have bug reports indicating that some new users confuse zone filling/unfilling with the display mo...
const PCB_DISPLAY_OPTIONS & displayOptions() const
static TOOL_ACTION zoneDisplayOutline
Definition: pcb_actions.h:244
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
ZONE_DISPLAY_MODE m_ZoneDisplayMode
PCB_DRAW_PANEL_GAL * canvas() const

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

Referenced by setTransitions().

Member Data Documentation

◆ m_frame

◆ m_gridOrigin

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

Definition at line 130 of file pcb_control.h.

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

◆ m_isFootprintEditor

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

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

Definition at line 125 of file tool_interactive.h.

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

◆ m_pickerItem

BOARD_ITEM* PCB_CONTROL::m_pickerItem
private

Definition at line 132 of file pcb_control.h.

Referenced by DeleteItemCursor().

◆ m_statusPopup

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

Definition at line 134 of file pcb_control.h.

Referenced by DeleteItemCursor().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

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

Definition at line 209 of file tool_base.h.

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

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 214 of file tool_base.h.

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

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 213 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

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

Definition at line 206 of file tool_base.h.

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


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