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 , REDRAW }
 Determine the reason of reset for a tool. More...
 

Public Member Functions

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

Static Public Member Functions

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

Protected Types

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

Protected Member Functions

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

Protected Attributes

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

Private Member Functions

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

Private Attributes

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

Detailed Description

Handle actions that are shared between different frames in PcbNew.

Definition at line 46 of file pcb_control.h.

Member Enumeration Documentation

◆ INTERACTIVE_PLACEMENT_OPTIONS

Options for placing items interactively.

Enumerator
IPO_ROTATE 

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

IPO_FLIP 

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

IPO_SINGLE_CLICK 

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

IPO_REPEAT 

Allow repeat placement of the item.

Definition at line 121 of file pcb_tool_base.h.

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

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determine the reason of reset for a tool.

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

REDRAW 

Full drawing refresh.

Definition at line 77 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ PCB_CONTROL()

PCB_CONTROL::PCB_CONTROL ( )

Definition at line 74 of file pcb_control.cpp.

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

References m_gridOrigin.

◆ ~PCB_CONTROL()

PCB_CONTROL::~PCB_CONTROL ( )

Definition at line 83 of file pcb_control.cpp.

84{
85}

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run the tool.

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

Definition at line 51 of file tool_interactive.cpp.

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

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

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

◆ AddLibrary()

int PCB_CONTROL::AddLibrary ( const TOOL_EVENT aEvent)

Definition at line 102 of file pcb_control.cpp.

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

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

Referenced by DdAddLibrary(), and setTransitions().

◆ AppendBoard()

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

Definition at line 1200 of file pcb_control.cpp.

1201{
1202 PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
1203
1204 if( !editFrame )
1205 return 1;
1206
1207 BOARD* brd = board();
1208
1209 if( !brd )
1210 return 1;
1211
1212 // Mark existing items, in order to know what are the new items so we can select only
1213 // the new items after loading
1214 for( PCB_TRACK* track : brd->Tracks() )
1215 track->SetFlags( SKIP_STRUCT );
1216
1217 for( FOOTPRINT* footprint : brd->Footprints() )
1219
1220 for( PCB_GROUP* group : brd->Groups() )
1221 group->SetFlags( SKIP_STRUCT );
1222
1223 for( BOARD_ITEM* drawing : brd->Drawings() )
1224 drawing->SetFlags( SKIP_STRUCT );
1225
1226 for( ZONE* zone : brd->Zones() )
1227 zone->SetFlags( SKIP_STRUCT );
1228
1229 std::map<wxString, wxString> oldProperties = brd->GetProperties();
1230 std::map<wxString, wxString> newProperties;
1231
1232 PAGE_INFO oldPageInfo = brd->GetPageSettings();
1233 TITLE_BLOCK oldTitleBlock = brd->GetTitleBlock();
1234
1235 // Keep also the count of copper layers, to adjust if necessary
1236 int initialCopperLayerCount = brd->GetCopperLayerCount();
1237 LSET initialEnabledLayers = brd->GetEnabledLayers();
1238
1239 // Load the data
1240 try
1241 {
1242 STRING_UTF8_MAP props;
1243 char xbuf[30];
1244 char ybuf[30];
1245
1246 // EAGLE_PLUGIN can use this info to center the BOARD, but it does not yet.
1247 snprintf( xbuf, sizeof(xbuf), "%d", editFrame->GetPageSizeIU().x );
1248 snprintf( ybuf, sizeof(ybuf), "%d", editFrame->GetPageSizeIU().y );
1249
1250 props["page_width"] = xbuf;
1251 props["page_height"] = ybuf;
1252
1254 [&]( wxString aTitle, int aIcon, wxString aMessage, wxString aAction ) -> bool
1255 {
1256 KIDIALOG dlg( editFrame, aMessage, aTitle, wxOK | wxCANCEL | aIcon );
1257
1258 if( !aAction.IsEmpty() )
1259 dlg.SetOKLabel( aAction );
1260
1261 dlg.DoNotShowCheckbox( aMessage, 0 );
1262
1263 return dlg.ShowModal() == wxID_OK;
1264 } );
1265
1266 WX_PROGRESS_REPORTER progressReporter( editFrame, _( "Loading PCB" ), 1 );
1267
1268 editFrame->GetDesignSettings().m_NetSettings->m_NetClasses.clear();
1269 pi.Load( fileName, brd, &props, nullptr, &progressReporter );
1270 }
1271 catch( const IO_ERROR& ioe )
1272 {
1273 wxString msg = wxString::Format( _( "Error loading board.\n%s" ), ioe.What() );
1274 DisplayError( editFrame, msg );
1275
1276 return 0;
1277 }
1278
1279 newProperties = brd->GetProperties();
1280
1281 for( const std::pair<const wxString, wxString>& prop : oldProperties )
1282 newProperties[ prop.first ] = prop.second;
1283
1284 brd->SetProperties( newProperties );
1285
1286 brd->SetPageSettings( oldPageInfo );
1287 brd->SetTitleBlock( oldTitleBlock );
1288
1289 // rebuild nets and ratsnest before any use of nets
1290 brd->BuildListOfNets();
1291 brd->SynchronizeNetsAndNetClasses( true );
1292 brd->BuildConnectivity();
1293
1294 // Synchronize layers
1295 // we should not ask PLUGINs to do these items:
1296 int copperLayerCount = brd->GetCopperLayerCount();
1297
1298 if( copperLayerCount > initialCopperLayerCount )
1299 brd->SetCopperLayerCount( copperLayerCount );
1300
1301 // Enable all used layers, and make them visible:
1302 LSET enabledLayers = brd->GetEnabledLayers();
1303 enabledLayers |= initialEnabledLayers;
1304 brd->SetEnabledLayers( enabledLayers );
1305 brd->SetVisibleLayers( enabledLayers );
1306
1307 return placeBoardItems( brd, false, false ); // Do not reannotate duplicates on Append Board
1308}
std::shared_ptr< NET_SETTINGS > m_NetSettings
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:70
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:269
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:587
void BuildListOfNets()
Definition: board.h:763
void SetEnabledLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:607
const PAGE_INFO & GetPageSettings() const
Definition: board.h:632
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition: board.h:339
ZONES & Zones()
Definition: board.h:317
bool BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
Definition: board.cpp:166
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition: board.cpp:1546
TITLE_BLOCK & GetTitleBlock()
Definition: board.h:638
FOOTPRINTS & Footprints()
Definition: board.h:311
int GetCopperLayerCount() const
Definition: board.cpp:563
const std::map< wxString, wxString > & GetProperties() const
Definition: board.h:338
GROUPS & Groups()
The groups must maintain the following invariants.
Definition: board.h:333
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: board.h:633
TRACKS & Tracks()
Definition: board.h:308
void SetVisibleLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
Definition: board.cpp:619
void SetCopperLayerCount(int aCount)
Definition: board.cpp:569
DRAWINGS & Drawings()
Definition: board.h:314
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Definition: board.h:640
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:139
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: confirm.h:46
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:532
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
const VECTOR2I GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
int placeBoardItems(std::vector< BOARD_ITEM * > &aItems, bool aIsNew, bool aAnchorAtOrigin, bool aReannotateDuplicates)
Add and select or just select for move/place command a list of board items.
The main frame for Pcbnew.
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:51
BOARD * board() const
FOOTPRINT * footprint() const
virtual void SetQueryUserCallback(std::function< bool(wxString aTitle, int aIcon, wxString aMessage, wxString aAction)> aCallback)
Registers a KIDIALOG callback for collecting info from the user.
Definition: io_mgr.h:285
virtual BOARD * Load(const wxString &aFileName, BOARD *aAppendToMe, const STRING_UTF8_MAP *aProperties=nullptr, PROJECT *aProject=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)
Load information from some input file format that this PLUGIN implementation knows about into either ...
Definition: plugin.cpp:46
A name/value tuple with unique names and optional values.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:41
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:300
#define _(s)
#define SKIP_STRUCT
flag indicating that the structure should be ignored
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200

References _, PCB_TOOL_BASE::board(), BOARD::BuildConnectivity(), BOARD::BuildListOfNets(), DisplayError(), KIDIALOG::DoNotShowCheckbox(), BOARD::Drawings(), PCB_TOOL_BASE::footprint(), BOARD::Footprints(), Format(), BOARD::GetCopperLayerCount(), PCB_BASE_FRAME::GetDesignSettings(), BOARD::GetEnabledLayers(), BOARD::GetPageSettings(), PCB_BASE_FRAME::GetPageSizeIU(), BOARD::GetProperties(), BOARD::GetTitleBlock(), group, BOARD::Groups(), PLUGIN::Load(), m_frame, BOARD_DESIGN_SETTINGS::m_NetSettings, placeBoardItems(), BOARD::SetCopperLayerCount(), BOARD::SetEnabledLayers(), EDA_ITEM::SetFlags(), BOARD::SetPageSettings(), BOARD::SetProperties(), PLUGIN::SetQueryUserCallback(), BOARD::SetTitleBlock(), BOARD::SetVisibleLayers(), KIDIALOG::ShowModal(), SKIP_STRUCT, BOARD::SynchronizeNetsAndNetClasses(), BOARD::Tracks(), IO_ERROR::What(), VECTOR2< T >::x, VECTOR2< T >::y, and BOARD::Zones().

Referenced by AppendBoardFromFile(), and DdAppendBoard().

◆ AppendBoardFromFile()

int PCB_CONTROL::AppendBoardFromFile ( const TOOL_EVENT aEvent)

Definition at line 1001 of file pcb_control.cpp.

1002{
1003 int open_ctl;
1004 wxString fileName;
1005
1006 PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
1007
1008 if( !editFrame )
1009 return 1;
1010
1011 // Pick a file to append
1012 if( !AskLoadBoardFileName( editFrame, &open_ctl, &fileName, true ) )
1013 return 1;
1014
1015 IO_MGR::PCB_FILE_T pluginType = plugin_type( fileName, open_ctl );
1016 PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
1017
1018 return AppendBoard( *pi, fileName );
1019}
PCB_FILE_T
The set of file types that the IO_MGR knows about, and for which there has been a plugin written.
Definition: io_mgr.h:54
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Return a PLUGIN which the caller can use to import, export, save, or load design documents.
Definition: io_mgr.cpp:58
int AppendBoard(PLUGIN &pi, wxString &fileName)
Releases a PLUGIN in the context of a potential thrown exception through its destructor.
Definition: io_mgr.h:564
bool AskLoadBoardFileName(PCB_EDIT_FRAME *aParent, int *aCtl, wxString *aFileName, bool aKicadFilesOnly=false)
Show a wxFileDialog asking for a BOARD filename to open.
IO_MGR::PCB_FILE_T plugin_type(const wxString &aFileName, int aCtl)

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

Referenced by setTransitions().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Set the TOOL_MANAGER the tool will belong to.

Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

61{
62 m_toolMgr = aManager;
63}

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ board()

BOARD * PCB_TOOL_BASE::board ( ) const
inlineprotectedinherited

Definition at line 170 of file pcb_tool_base.h.

170{ return getModel<BOARD>(); }

Referenced by AppendBoard(), BOARD_EDITOR_CONTROL::AssignNetclass(), AUTOPLACE_TOOL::autoplace(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), EDIT_TOOL::ChangeTrackWidth(), ZONE_FILLER_TOOL::CheckAllZones(), BOARD_INSPECTION_TOOL::ClearHighlight(), EDIT_TOOL::copyToClipboard(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), MICROWAVE_TOOL::createInductorBetween(), ROUTER_TOOL::CustomTrackWidthDialog(), DeleteItemCursor(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawShape(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), BOARD_EDITOR_CONTROL::ExportNetlist(), ZONE_FILLER_TOOL::FillAllZones(), EDIT_TOOL::FilletTracks(), PCB_TOOL_BASE::footprint(), GROUP_TOOL::Group(), ROUTER_TOOL::handleLayerSwitch(), BOARD_INSPECTION_TOOL::highlightNet(), ROUTER_TOOL::Init(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), LayerNext(), LayerPrev(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EDIT_TOOL::MoveExact(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), Paste(), placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PAD_TOOL::PlacePad(), DRAWING_TOOL::PlaceText(), pruneItemLayers(), EDIT_TOOL::rebuildConnectivity(), ZONE_FILLER_TOOL::rebuildConnectivity(), PAD_TOOL::RecombinePad(), BOARD_EDITOR_CONTROL::RepairBoard(), FOOTPRINT_EDITOR_CONTROL::RepairFootprint(), PNS::TOOL_BASE::Reset(), PAD_TOOL::Reset(), Reset(), TrackDisplayMode(), unfilledZoneCheck(), GROUP_TOOL::Ungroup(), ROUTER_TOOL::UpdateMessagePanel(), ROUTER_TOOL::updateSizesAfterLayerSwitch(), ViaDisplayMode(), ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), ZONE_FILLER_TOOL::ZoneFillDirty(), BOARD_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

◆ canvas()

◆ controls()

◆ DdAddLibrary()

int PCB_CONTROL::DdAddLibrary ( const TOOL_EVENT aEvent)

Definition at line 116 of file pcb_control.cpp.

117{
118 const wxString fn = *aEvent.Parameter<wxString*>();
119 static_cast<PCB_BASE_EDIT_FRAME*>( m_frame )->AddLibrary( fn );
120 return 0;
121}
int AddLibrary(const TOOL_EVENT &aEvent)
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:442

References AddLibrary(), m_frame, and TOOL_EVENT::Parameter().

Referenced by setTransitions().

◆ DdAppendBoard()

int PCB_CONTROL::DdAppendBoard ( const TOOL_EVENT aEvent)

Definition at line 1543 of file pcb_control.cpp.

1544{
1545 wxFileName fileName = wxFileName( *aEvent.Parameter<wxString*>() );
1546
1547 int open_ctl = fileName.GetExt() == KiCadPcbFileExtension ? 0 : KICTL_EAGLE_BRD;
1548
1549 PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
1550
1551 if( !editFrame )
1552 return 1;
1553
1554 wxString filePath = fileName.GetFullPath();
1555 IO_MGR::PCB_FILE_T pluginType = plugin_type( filePath, open_ctl );
1556 PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
1557
1558 return AppendBoard( *pi, filePath );
1559}
const std::string KiCadPcbFileExtension
#define KICTL_EAGLE_BRD
chosen *.brd file is Eagle according to user.
Definition: kiway_player.h:81

References AppendBoard(), KiCadPcbFileExtension, KICTL_EAGLE_BRD, m_frame, TOOL_EVENT::Parameter(), plugin_type(), and IO_MGR::PluginFind().

Referenced by setTransitions().

◆ DdImportFootprint()

int PCB_CONTROL::DdImportFootprint ( const TOOL_EVENT aEvent)

Definition at line 124 of file pcb_control.cpp.

125{
126 const wxString fn = *aEvent.Parameter<wxString*>();
127 static_cast<FOOTPRINT_EDIT_FRAME*>( m_frame )->ImportFootprint( fn );
128 m_frame->Zoom_Automatique( false );
129 return 0;
130}
virtual void Zoom_Automatique(bool aWarpPointer)
Redraw the screen with best zoom level and the best centering that shows all the page or the board.

References m_frame, TOOL_EVENT::Parameter(), and EDA_DRAW_FRAME::Zoom_Automatique().

Referenced by setTransitions().

◆ DeleteItemCursor()

int PCB_CONTROL::DeleteItemCursor ( const TOOL_EVENT aEvent)

Definition at line 564 of file pcb_control.cpp.

565{
567 return 0;
568
570
571 m_pickerItem = nullptr;
573
574 // Deactivate other tools; particularly important if another PICKER is currently running
575 Activate();
576
577 picker->SetCursor( KICURSOR::REMOVE );
578
579 picker->SetClickHandler(
580 [this]( const VECTOR2D& aPosition ) -> bool
581 {
582 if( m_pickerItem )
583 {
585 {
586 m_statusPopup.reset( new STATUS_TEXT_POPUP( m_frame ) );
587 m_statusPopup->SetText( _( "Item locked." ) );
588 m_statusPopup->PopupFor( 2000 );
589 m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
590 return true;
591 }
592
594 selectionTool->UnbrightenItem( m_pickerItem );
595
596 PCB_SELECTION items;
597 items.Add( m_pickerItem );
598
599 EDIT_TOOL* editTool = m_toolMgr->GetTool<EDIT_TOOL>();
600 editTool->DeleteItems( items, false );
601
602 m_pickerItem = nullptr;
603 }
604
605 return true;
606 } );
607
608 picker->SetMotionHandler(
609 [this]( const VECTOR2D& aPos )
610 {
614 GENERAL_COLLECTOR collector;
615 collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
616
618 collector.Collect( board, GENERAL_COLLECTOR::FootprintItems, aPos, guide );
619 else
620 collector.Collect( board, GENERAL_COLLECTOR::BoardLevelItems, aPos, guide );
621
622 // Remove unselectable items
623 for( int i = collector.GetCount() - 1; i >= 0; --i )
624 {
625 if( !selectionTool->Selectable( collector[ i ] ) )
626 collector.Remove( i );
627 }
628
629 if( collector.GetCount() > 1 )
630 selectionTool->GuessSelectionCandidates( collector, aPos );
631
632 BOARD_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr;
633
634 if( m_pickerItem != item )
635 {
636 if( m_pickerItem )
637 selectionTool->UnbrightenItem( m_pickerItem );
638
639 m_pickerItem = item;
640
641 if( m_pickerItem )
642 selectionTool->BrightenItem( m_pickerItem );
643 }
644 } );
645
646 picker->SetFinalizeHandler(
647 [this]( const int& aFinalState )
648 {
649 if( m_pickerItem )
650 m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
651
652 m_statusPopup.reset();
653
654 // Ensure the cursor gets changed&updated
657 } );
658
660
661 return 0;
662}
static TOOL_ACTION pickerTool
Definition: actions.h:159
virtual bool IsLocked() const
Definition: board_item.cpp:71
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:403
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:81
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
Definition: collector.h:109
int m_Threshold
Definition: collector.h:234
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
The interactive edit tool.
Definition: edit_tool.h:65
void DeleteItems(const PCB_SELECTION &aItems, bool aIsCut)
Definition: edit_tool.cpp:1814
A general implementation of a COLLECTORS_GUIDE.
Definition: collectors.h:326
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:204
static const std::vector< KICAD_T > BoardLevelItems
A scan list for all primary board items, omitting items which are subordinate to a FOOTPRINT,...
Definition: collectors.h:235
void Collect(BOARD_ITEM *aItem, const std::vector< KICAD_T > &aScanList, const VECTOR2I &aRefPos, const COLLECTORS_GUIDE &aGuide)
Scan a BOARD_ITEM using this class's Inspector method, which does the collection.
Definition: collectors.cpp:596
static const std::vector< KICAD_T > FootprintItems
A scan list for primary footprint items.
Definition: collectors.h:250
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:59
BOARD * GetBoard() const
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide()
std::unique_ptr< STATUS_TEXT_POPUP > m_statusPopup
Definition: pcb_control.h:147
Generic tool for picking an item.
The selection tool: currently supports:
void GuessSelectionCandidates(GENERAL_COLLECTOR &aCollector, const VECTOR2I &aWhere) const
Try to guess best selection candidates in case multiple items are clicked, by doing some brain-dead h...
bool Selectable(const BOARD_ITEM *aItem, bool checkVisibilityOnly=false) const
bool m_isFootprintEditor
void SetMotionHandler(MOTION_HANDLER aHandler)
Set a handler for mouse motion.
Definition: picker_tool.h:82
void SetClickHandler(CLICK_HANDLER aHandler)
Set a handler for mouse click event.
Definition: picker_tool.h:71
void SetCursor(KICURSOR aCursor)
Definition: picker_tool.h:62
void SetFinalizeHandler(FINALIZE_HANDLER aHandler)
Set a handler for the finalize event.
Definition: picker_tool.h:102
void BrightenItem(EDA_ITEM *aItem)
void UnbrightenItem(EDA_ITEM *aItem)
virtual void Add(EDA_ITEM *aItem)
Definition: selection.cpp:42
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
void Activate()
Run the tool.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
#define HITTEST_THRESHOLD_PIXELS
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85

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

Referenced by setTransitions().

◆ displayOptions()

◆ doInteractiveItemPlacement()

void PCB_TOOL_BASE::doInteractiveItemPlacement ( const TOOL_EVENT 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 41 of file pcb_tool_base.cpp.

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

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

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

◆ DoSetGridOrigin()

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

Definition at line 504 of file pcb_control.cpp.

506{
507 aFrame->GetDesignSettings().SetGridOrigin( VECTOR2I( aPoint ) );
508 aView->GetGAL()->SetGridOrigin( aPoint );
509 originViewItem->SetPosition( aPoint );
510 aView->MarkDirty();
511 aFrame->OnModify();
512}
void SetGridOrigin(const VECTOR2I &aOrigin)
virtual void SetPosition(const VECTOR2I &aPos)
Definition: eda_item.h:250
void SetGridOrigin(const VECTOR2D &aGridOrigin)
Set the origin point for the grid.
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:195
void MarkDirty()
Force redraw of view on the next rendering.
Definition: view.h:641
void OnModify() override
Must be called after a change in order to set the "modify" flag and update other data structures and ...
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590

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

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

◆ FlipPcbView()

int PCB_CONTROL::FlipPcbView ( const TOOL_EVENT aEvent)

Definition at line 1562 of file pcb_control.cpp.

1563{
1564 view()->SetMirror( !view()->IsMirroredX(), false );
1565 view()->RecacheAllItems();
1568 return 0;
1569}
void ForceRefresh()
Force a redraw.
void SetMirror(bool aMirrorX, bool aMirrorY)
Control the mirroring of the VIEW.
Definition: view.cpp:538
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1384
virtual void OnDisplayOptionsChanged()

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

Referenced by setTransitions().

◆ footprint()

◆ frame()

PCB_BASE_EDIT_FRAME * PCB_TOOL_BASE::frame ( ) const
inlineprotectedinherited

Definition at line 165 of file pcb_tool_base.h.

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

Referenced by PCB_POINT_EDITOR::addCorner(), AUTOPLACE_TOOL::autoplace(), PCB_TOOL_BASE::canvas(), ZONE_FILLER_TOOL::CheckAllZones(), PNS::TOOL_BASE::checkSnap(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), ROUTER_TOOL::CustomTrackWidthDialog(), FOOTPRINT_EDITOR_CONTROL::DeleteFootprint(), EDIT_TOOL::DeleteItems(), PCB_TOOL_BASE::displayOptions(), BOARD_EDITOR_CONTROL::doCrossProbePcbToSch(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), ROUTER_TOOL::DpDimensionsDialog(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawShape(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EditPad(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), BOARD_EDITOR_CONTROL::ExportSpecctraDSN(), ZONE_FILLER_TOOL::FillAllZones(), EDIT_TOOL::FilletTracks(), ROUTER_TOOL::finishInteractive(), EDIT_TOOL::Flip(), FlipPcbView(), GLOBAL_EDIT_TOOL::GlobalDeletions(), ROUTER_TOOL::handleLayerSwitch(), HighContrastMode(), HighContrastModeCycle(), BOARD_INSPECTION_TOOL::HighlightItem(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), BOARD_EDITOR_CONTROL::ImportSpecctraSession(), SCRIPTING_TOOL::Init(), ROUTER_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_TOOL_BASE::Is45Limited(), PCB_PICKER_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::MoveExact(), NetColorModeCycle(), PCB_POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::onViaCommand(), Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), pruneItemLayers(), PAD_TOOL::pushPadSettings(), RatsnestModeCycle(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), SCRIPTING_TOOL::reloadPlugins(), PCB_POINT_EDITOR::removeCorner(), PNS::TOOL_BASE::Reset(), PAD_TOOL::Reset(), EDIT_TOOL::Rotate(), ROUTER_TOOL::RouteSelected(), ROUTER_TOOL::SelectCopperLayerPair(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), PCB_POINT_EDITOR::setEditedPoint(), ROUTER_TOOL::SettingsDialog(), GLOBAL_EDIT_TOOL::swapBoardItem(), GLOBAL_EDIT_TOOL::SwapLayers(), ROUTER_TOOL::switchLayerOnViaPlacement(), DRAWING_TOOL::ToggleHV45Mode(), ToggleRatsnest(), unfilledZoneCheck(), PCB_POINT_EDITOR::updateItem(), ROUTER_TOOL::UpdateMessagePanel(), EDIT_TOOL::updateModificationPoint(), BOARD_EDITOR_CONTROL::UpdateSchematicFromPCB(), ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), ZONE_FILLER_TOOL::ZoneFillAll(), and ZONE_FILLER_TOOL::ZoneFillDirty().

◆ getEditFrame()

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

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

Definition at line 185 of file tool_base.h.

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

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone(), and ZONE_CREATE_HELPER::setUniquePriority().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 121 of file tool_base.h.

122 {
123 return m_toolId;
124 }

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER * TOOL_BASE::GetManager ( ) const
inlineinherited

◆ getModel()

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

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 197 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ getModelInt()

EDA_ITEM * TOOL_BASE::getModelInt ( ) const
privateinherited

Definition at line 54 of file tool_base.cpp.

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

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

Referenced by TOOL_BASE::getModel().

◆ GetName()

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

Return the name of the tool.

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

Returns
The name of the tool.

Definition at line 134 of file tool_base.h.

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

References TOOL_BASE::m_toolName.

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

◆ getToolHolderInt()

TOOLS_HOLDER * TOOL_BASE::getToolHolderInt ( ) const
privateinherited

Definition at line 48 of file tool_base.cpp.

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

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

Referenced by TOOL_BASE::getEditFrame().

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 109 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

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

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

It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

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

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

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

◆ getViewControls()

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

Return the instance of VIEW_CONTROLS object used in the application.

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

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

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

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

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

◆ Go()

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

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

No conditions means any event.

Definition at line 147 of file tool_interactive.h.

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

References TOOL_INTERACTIVE::goInternal().

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

◆ goInternal()

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

Definition at line 70 of file tool_interactive.cpp.

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

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

Referenced by TOOL_INTERACTIVE::Go().

◆ GridResetOrigin()

int PCB_CONTROL::GridResetOrigin ( const TOOL_EVENT aEvent)

Definition at line 553 of file pcb_control.cpp.

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

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

Referenced by setTransitions().

◆ GridSetOrigin()

int PCB_CONTROL::GridSetOrigin ( const TOOL_EVENT aEvent)

Definition at line 515 of file pcb_control.cpp.

516{
517 VECTOR2D* origin = aEvent.Parameter<VECTOR2D*>();
518
519 if( origin )
520 {
521 // We can't undo the other grid dialog settings, so no sense undoing just the origin
522 DoSetGridOrigin( getView(), m_frame, m_gridOrigin.get(), *origin );
523 delete origin;
524 }
525 else
526 {
527 if( m_isFootprintEditor && !getEditFrame<PCB_BASE_EDIT_FRAME>()->GetModel() )
528 return 0;
529
531
532 if( !picker ) // Happens in footprint wizard
533 return 0;
534
535 // Deactivate other tools; particularly important if another PICKER is currently running
536 Activate();
537
538 picker->SetClickHandler(
539 [this]( const VECTOR2D& pt ) -> bool
540 {
543 return false; // drill origin is a one-shot; don't continue with tool
544 } );
545
547 }
548
549 return 0;
550}
SGLIB_API S3DMODEL * GetModel(SCENEGRAPH *aNode)
Function GetModel creates an S3DMODEL representation of aNode (raw data, no transforms)
Definition: ifsg_api.cpp:338

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

Referenced by setTransitions().

◆ HighContrastMode()

int PCB_CONTROL::HighContrastMode ( const TOOL_EVENT aEvent)

Definition at line 295 of file pcb_control.cpp.

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

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

Referenced by setTransitions().

◆ HighContrastModeCycle()

int PCB_CONTROL::HighContrastModeCycle ( const TOOL_EVENT aEvent)

◆ Init()

bool PCB_TOOL_BASE::Init ( )
overridevirtualinherited

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

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

Reimplemented from TOOL_BASE.

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

Definition at line 279 of file pcb_tool_base.cpp.

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

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

◆ Is45Limited()

bool PCB_TOOL_BASE::Is45Limited ( ) const
virtualinherited

Should the tool use its 45° mode option?

Returns
True if set to use 45°

Definition at line 332 of file pcb_tool_base.cpp.

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

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

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

◆ IsBoardEditor()

bool PCB_TOOL_BASE::IsBoardEditor ( ) const
inlineinherited

Definition at line 109 of file pcb_tool_base.h.

109{ return m_isBoardEditor; }

References PCB_TOOL_BASE::m_isBoardEditor.

Referenced by BOARD_COMMIT::BOARD_COMMIT().

◆ IsFootprintEditor()

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

32{
34}
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 EDIT_TOOL::Drag(), ROUTER_TOOL::handleLayerSwitch(), 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 476 of file pcb_control.cpp.

477{
479 int currentLayer = m_frame->GetActiveLayer();
480 KIGFX::COLOR4D currentColor = settings->GetColor( currentLayer );
481
482 if( currentColor.a >= ALPHA_MIN + ALPHA_STEP )
483 {
484 currentColor.a -= ALPHA_STEP;
485 settings->SetColor( currentLayer, currentColor );
487
489 view->UpdateLayerColor( currentLayer );
490 view->UpdateLayerColor( GetNetnameLayer( currentLayer ) );
491
492 if( IsCopperLayer( currentLayer ) )
493 view->UpdateLayerColor( ZONE_LAYER_FOR( currentLayer ) );
494 }
495 else
496 {
497 wxBell();
498 }
499
500 return 0;
501}
Color settings are a bit different than most of the settings objects in that there can be more than o...
void SetColor(int aLayer, const COLOR4D &aColor)
COLOR4D GetColor(int aLayer) const
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:102
double a
Alpha component.
Definition: color4d.h:375
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
void UpdateLayerColor(int aLayer)
Apply the new coloring scheme held by RENDER_SETTINGS in case that it has changed.
Definition: view.cpp:740
virtual PCB_LAYER_ID GetActiveLayer() const
virtual COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
void UpdateColors()
Update the color settings in the painter and GAL.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
Definition: layer_ids.h:968
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:827
#define ZONE_LAYER_FOR(boardLayer)
Definition: layer_ids.h:268
#define ALPHA_STEP
#define ALPHA_MIN

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

Referenced by setTransitions().

◆ LayerAlphaInc()

int PCB_CONTROL::LayerAlphaInc ( const TOOL_EVENT aEvent)

Definition at line 448 of file pcb_control.cpp.

449{
451 int currentLayer = m_frame->GetActiveLayer();
452 KIGFX::COLOR4D currentColor = settings->GetColor( currentLayer );
453
454 if( currentColor.a <= ALPHA_MAX - ALPHA_STEP )
455 {
456 currentColor.a += ALPHA_STEP;
457 settings->SetColor( currentLayer, currentColor );
459
461 view->UpdateLayerColor( currentLayer );
462 view->UpdateLayerColor( GetNetnameLayer( currentLayer ) );
463
464 if( IsCopperLayer( currentLayer ) )
465 view->UpdateLayerColor( ZONE_LAYER_FOR( currentLayer ) );
466 }
467 else
468 {
469 wxBell();
470 }
471
472 return 0;
473}
#define ALPHA_MAX

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

Referenced by setTransitions().

◆ LayerNext()

int PCB_CONTROL::LayerNext ( const TOOL_EVENT aEvent)

Definition at line 378 of file pcb_control.cpp.

379{
380 PCB_BASE_FRAME* editFrame = m_frame;
381 BOARD* brd = board();
382 int layer = editFrame->GetActiveLayer();
383 int startLayer = layer;
384
385 while( startLayer != ++layer )
386 {
387 if( brd->IsLayerVisible( static_cast<PCB_LAYER_ID>( layer ) ) && IsCopperLayer( layer ) )
388 break;
389
390 if( layer >= B_Cu )
391 layer = F_Cu - 1;
392 }
393
394 wxCHECK( IsCopperLayer( layer ), 0 );
395 editFrame->SwitchLayer( ToLAYER_ID( layer ) );
396
397 return 0;
398}
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:593
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
virtual void SwitchLayer(PCB_LAYER_ID aLayer)
Change the active layer in the frame.
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ B_Cu
Definition: layer_ids.h:95
@ F_Cu
Definition: layer_ids.h:64
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:932

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

402{
403 PCB_BASE_FRAME* editFrame = m_frame;
404 BOARD* brd = board();
405 int layer = editFrame->GetActiveLayer();
406 int startLayer = layer;
407
408 while( startLayer != --layer )
409 {
410 if( IsCopperLayer( layer ) // also test for valid layer id (layer >= F_Cu)
411 && brd->IsLayerVisible( static_cast<PCB_LAYER_ID>( layer ) ) )
412 {
413 break;
414 }
415
416 if( layer <= F_Cu )
417 layer = B_Cu + 1;
418 }
419
420 wxCHECK( IsCopperLayer( layer ), 0 );
421 editFrame->SwitchLayer( ToLAYER_ID( layer ) );
422
423 return 0;
424}

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

371{
373
374 return 0;
375}

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

428{
429 int currentLayer = m_frame->GetActiveLayer();
430 PCB_SCREEN* screen = m_frame->GetScreen();
431
432 if( currentLayer == screen->m_Route_Layer_TOP )
434 else
436
437 return 0;
438}
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
PCB_LAYER_ID m_Route_Layer_TOP
Definition: pcb_screen.h:43
PCB_LAYER_ID m_Route_Layer_BOTTOM
Definition: pcb_screen.h:44

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

Referenced by setTransitions().

◆ NetColorModeCycle()

int PCB_CONTROL::NetColorModeCycle ( const TOOL_EVENT aEvent)

Definition at line 326 of file pcb_control.cpp.

327{
329
330 switch( opts.m_NetColorMode )
331 {
335 }
336
337 m_frame->SetDisplayOptions( opts );
338
339 return 0;
340}
@ RATSNEST
Net/netclass colors are shown on ratsnest lines only.
@ ALL
Net/netclass colors are shown on all net copper.
@ OFF
Net (and netclass) colors are not shown.
NET_COLOR_MODE m_NetColorMode
How to use color overrides on specific nets and netclasses.

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

Referenced by setTransitions().

◆ Paste()

int PCB_CONTROL::Paste ( const TOOL_EVENT aEvent)

Definition at line 817 of file pcb_control.cpp.

818{
819 CLIPBOARD_IO pi;
820 BOARD_ITEM* clipItem = pi.Parse();
821
822 if( !clipItem )
823 return 0;
824
825 // The viewer frames cannot paste
826 if( !frame()->IsType( FRAME_FOOTPRINT_EDITOR ) && !frame()->IsType( FRAME_PCB_EDITOR ) )
827 return 0;
828
830 const wxString defaultRef = wxT( "REF**" );
831
832 if( aEvent.IsAction( &ACTIONS::pasteSpecial ) )
833 {
834 DIALOG_PASTE_SPECIAL dlg( m_frame, &mode, defaultRef );
835
836 if( dlg.ShowModal() == wxID_CANCEL )
837 return 0;
838 }
839
840 bool isFootprintEditor = m_isFootprintEditor || frame()->IsType( FRAME_FOOTPRINT_EDITOR );
841
842 if( clipItem->Type() == PCB_T )
843 {
844 if( isFootprintEditor )
845 {
846 for( BOARD_CONNECTED_ITEM* item : static_cast<BOARD*>( clipItem )->AllConnectedItems() )
847 item->SetNet( NETINFO_LIST::OrphanedItem() );
848 }
849 else
850 {
851 static_cast<BOARD*>( clipItem )->MapNets( m_frame->GetBoard() );
852 }
853 }
854
855 // The clipboard can contain two different things, an entire kicad_pcb or a single footprint
856 if( isFootprintEditor && ( !board() || !footprint() ) )
857 {
858 return 0;
859 }
860
861 switch( clipItem->Type() )
862 {
863 case PCB_T:
864 {
865 BOARD* clipBoard = static_cast<BOARD*>( clipItem );
866
867 if( isFootprintEditor )
868 {
869 FOOTPRINT* editorFootprint = board()->GetFirstFootprint();
870 std::vector<BOARD_ITEM*> pastedItems;
871
872 for( PCB_GROUP* group : clipBoard->Groups() )
873 {
874 group->SetParent( editorFootprint );
875 pastedItems.push_back( group );
876 }
877
878 clipBoard->Groups().clear();
879
880 for( FOOTPRINT* clipFootprint : clipBoard->Footprints() )
881 pasteFootprintItemsToFootprintEditor( clipFootprint, board(), pastedItems );
882
883 for( BOARD_ITEM* clipDrawItem : clipBoard->Drawings() )
884 {
885 if( clipDrawItem->Type() == PCB_SHAPE_T )
886 {
887 PCB_SHAPE* clipShape = static_cast<PCB_SHAPE*>( clipDrawItem );
888 PCB_GROUP* parentGroup = clipDrawItem->GetParentGroup();
889
890 if( parentGroup )
891 parentGroup->RemoveItem( clipDrawItem );
892
893 // Convert to PCB_FP_SHAPE_T
894 FP_SHAPE* pastedShape = new FP_SHAPE( editorFootprint );
895 static_cast<PCB_SHAPE*>( pastedShape )->SwapItemData( clipShape );
896 pastedShape->SetLocalCoord();
897
898 if( parentGroup )
899 parentGroup->AddItem( pastedShape );
900
901 pastedItems.push_back( pastedShape );
902 }
903 else if( clipDrawItem->Type() == PCB_TEXT_T )
904 {
905 PCB_TEXT* clipTextItem = static_cast<PCB_TEXT*>( clipDrawItem );
906 PCB_GROUP* parentGroup = clipDrawItem->GetParentGroup();
907
908 if( parentGroup )
909 parentGroup->RemoveItem( clipDrawItem );
910
911 // Convert to PCB_FP_TEXT_T
912 FP_TEXT* pastedTextItem = new FP_TEXT( editorFootprint );
913 static_cast<EDA_TEXT*>( pastedTextItem )->SwapText( *clipTextItem );
914 static_cast<EDA_TEXT*>( pastedTextItem )->SwapAttributes( *clipTextItem );
915
916 if( parentGroup )
917 parentGroup->AddItem( pastedTextItem );
918
919 pastedItems.push_back( pastedTextItem );
920 }
921 else if( clipDrawItem->Type() == PCB_TEXTBOX_T )
922 {
923 PCB_TEXTBOX* clipTextBox = static_cast<PCB_TEXTBOX*>( clipDrawItem );
924 PCB_GROUP* parentGroup = clipDrawItem->GetParentGroup();
925
926 if( parentGroup )
927 parentGroup->RemoveItem( clipDrawItem );
928
929 // Convert to PCB_FP_TEXTBOX_T
930 FP_TEXTBOX* pastedTextBox = new FP_TEXTBOX( editorFootprint );
931
932 // Handle shape data
933 static_cast<PCB_SHAPE*>( pastedTextBox )->SwapItemData( clipTextBox );
934 pastedTextBox->SetLocalCoord();
935
936 // Handle text data
937 static_cast<EDA_TEXT*>( pastedTextBox )->SwapText( *clipTextBox );
938 static_cast<EDA_TEXT*>( pastedTextBox )->SwapAttributes( *clipTextBox );
939
940 if( parentGroup )
941 parentGroup->AddItem( pastedTextBox );
942
943 pastedItems.push_back( pastedTextBox );
944 }
945 }
946
947 delete clipBoard;
948
949 pruneItemLayers( pastedItems );
950
951 placeBoardItems( pastedItems, true, true, mode == PASTE_MODE::UNIQUE_ANNOTATIONS );
952 }
953 else
954 {
956 {
957 for( FOOTPRINT* clipFootprint : clipBoard->Footprints() )
958 clipFootprint->SetReference( defaultRef );
959 }
960
961 placeBoardItems( clipBoard, true, mode == PASTE_MODE::UNIQUE_ANNOTATIONS );
962 }
963
964 break;
965 }
966
967 case PCB_FOOTPRINT_T:
968 {
969 FOOTPRINT* clipFootprint = static_cast<FOOTPRINT*>( clipItem );
970 std::vector<BOARD_ITEM*> pastedItems;
971
972 if( isFootprintEditor )
973 {
974 pasteFootprintItemsToFootprintEditor( clipFootprint, board(), pastedItems );
975 delete clipFootprint;
976 }
977 else
978 {
980 clipFootprint->SetReference( defaultRef );
981
982 clipFootprint->SetParent( board() );
983 pastedItems.push_back( clipFootprint );
984 }
985
986 pruneItemLayers( pastedItems );
987
988 placeBoardItems( pastedItems, true, true, mode == PASTE_MODE::UNIQUE_ANNOTATIONS );
989 break;
990 }
991
992 default:
993 m_frame->DisplayToolMsg( _( "Invalid clipboard contents" ) );
994 break;
995 }
996
997 return 1;
998}
static TOOL_ACTION pasteSpecial
Definition: actions.h:70
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:84
BOARD_ITEM * Parse()
void DisplayToolMsg(const wxString &msg) override
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:100
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:72
void SetReference(const wxString &aReference)
Definition: footprint.h:528
virtual void SetLocalCoord()
Set relative coordinates from draw coordinates.
Definition: fp_shape.cpp:52
static NETINFO_ITEM * OrphanedItem()
Wrapper class, so you can iterate through NETINFO_ITEM*s, not std::pair<int/wxString,...
Definition: netinfo.h:395
void pruneItemLayers(std::vector< BOARD_ITEM * > &aItems)
Helper for pasting.
bool RemoveItem(BOARD_ITEM *aItem)
Remove item from group.
Definition: pcb_group.cpp:95
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
Definition: pcb_group.cpp:80
@ REMOVE_ANNOTATIONS
@ UNIQUE_ANNOTATIONS
static void pasteFootprintItemsToFootprintEditor(FOOTPRINT *aClipFootprint, BOARD *aBoard, std::vector< BOARD_ITEM * > &aPastedItems)
@ PCB_T
Definition: typeinfo.h:82
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:88
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition: typeinfo.h:91
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition: typeinfo.h:90

References _, PCB_GROUP::AddItem(), PCB_TOOL_BASE::board(), 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(), BOARD_ITEM::GetParentGroup(), group, BOARD::Groups(), TOOL_EVENT::IsAction(), EDA_BASE_FRAME::IsType(), KEEP_ANNOTATIONS, m_frame, PCB_TOOL_BASE::m_isFootprintEditor, NETINFO_LIST::OrphanedItem(), CLIPBOARD_IO::Parse(), pasteFootprintItemsToFootprintEditor(), ACTIONS::pasteSpecial, PCB_FOOTPRINT_T, PCB_SHAPE_T, PCB_T, PCB_TEXT_T, PCB_TEXTBOX_T, placeBoardItems(), pruneItemLayers(), REMOVE_ANNOTATIONS, PCB_GROUP::RemoveItem(), FP_SHAPE::SetLocalCoord(), EDA_ITEM::SetParent(), FOOTPRINT::SetReference(), EDA_ITEM::Type(), and UNIQUE_ANNOTATIONS.

Referenced by setTransitions().

◆ placeBoardItems() [1/2]

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

Pointer to the currently used edit frame.

Definition at line 1085 of file pcb_control.cpp.

1086{
1087 // items are new if the current board is not the board source
1088 bool isNew = board() != aBoard;
1089 std::vector<BOARD_ITEM*> items;
1090
1091 moveUnflaggedItems( aBoard->Tracks(), items, isNew );
1092 moveUnflaggedItems( aBoard->Footprints(), items, isNew );
1093 moveUnflaggedItems( aBoard->Drawings(), items, isNew );
1094 moveUnflaggedItems( aBoard->Zones(), items, isNew );
1095
1096 // Subtlety: When selecting a group via the mouse,
1097 // PCB_SELECTION_TOOL::highlightInternal runs, which does a SetSelected() on all
1098 // descendants. In PCB_CONTROL::placeBoardItems, below, we skip that and
1099 // mark items non-recursively. That works because the saving of the
1100 // selection created aBoard that has the group and all descendants in it.
1101 moveUnflaggedItems( aBoard->Groups(), items, isNew );
1102
1103 pruneItemLayers( items );
1104
1105 return placeBoardItems( items, isNew, aAnchorAtOrigin, aReannotateDuplicates );
1106}
static void moveUnflaggedItems(std::deque< T > &aList, std::vector< BOARD_ITEM * > &aTarget, bool aIsNew)

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

◆ placeBoardItems() [2/2]

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

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

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

Definition at line 1109 of file pcb_control.cpp.

1111{
1113
1115 EDIT_TOOL* editTool = m_toolMgr->GetTool<EDIT_TOOL>();
1116
1117 std::vector<BOARD_ITEM*> itemsToSel;
1118 itemsToSel.reserve( aItems.size() );
1119
1120 for( BOARD_ITEM* item : aItems )
1121 {
1122 if( aIsNew )
1123 {
1124 const_cast<KIID&>( item->m_Uuid ) = KIID();
1125
1126 // Even though BOARD_COMMIT::Push() will add any new items to the group, we're
1127 // going to run PCB_ACTIONS::move first, and the move tool will throw out any
1128 // items that aren't in the entered group.
1129 if( selectionTool->GetEnteredGroup() && !item->GetParentGroup() )
1130 selectionTool->GetEnteredGroup()->AddItem( item );
1131 }
1132
1133 // Update item attributes if needed
1134 if( BaseType( item->Type() ) == PCB_DIMENSION_T )
1135 {
1136 static_cast<PCB_DIMENSION_BASE*>( item )->UpdateUnits();
1137 }
1138 else if( item->Type() == PCB_FOOTPRINT_T )
1139 {
1140 FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item );
1141
1142 // Update the footprint path with the new KIID path if the footprint is new
1143 if( aIsNew )
1145
1146 for( BOARD_ITEM* dwg : footprint->GraphicalItems() )
1147 {
1148 if( BaseType( dwg->Type() ) == PCB_DIMENSION_T )
1149 static_cast<PCB_DIMENSION_BASE*>( dwg )->UpdateUnits();
1150 }
1151 }
1152
1153 // We only need to add the items that aren't inside a group currently selected
1154 // to the selection. If an item is inside a group and that group is selected,
1155 // then the selection tool will select it for us.
1156 if( !item->GetParentGroup() || !alg::contains( aItems, item->GetParentGroup() ) )
1157 itemsToSel.push_back( item );
1158 }
1159
1160 // Select the items that should be selected
1161 m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &itemsToSel );
1162
1163 // Reannotate duplicate footprints (make sense only in board editor )
1164 if( aReannotateDuplicates && m_isBoardEditor )
1165 m_toolMgr->GetTool<BOARD_REANNOTATE_TOOL>()->ReannotateDuplicatesInSelection();
1166
1167 for( BOARD_ITEM* item : aItems )
1168 {
1169 // Commit after reannotation
1170 if( aIsNew )
1171 editTool->GetCurrentCommit()->Add( item );
1172 else
1173 editTool->GetCurrentCommit()->Added( item );
1174 }
1175
1176 PCB_SELECTION& selection = selectionTool->GetSelection();
1177
1178 if( selection.Size() > 0 )
1179 {
1180 if( aAnchorAtOrigin )
1181 {
1183 }
1184 else
1185 {
1186 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.GetTopLeftItem() );
1188 }
1189
1190 getViewControls()->SetCursorPosition( getViewControls()->GetMousePosition(), false );
1191
1194 }
1195
1196 return 0;
1197}
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:249
static const TOOL_EVENT SelectedEvent
Definition: actions.h:207
void SetPath(const KIID_PATH &aPath)
Definition: footprint.h:225
DRAWINGS & GraphicalItems()
Definition: footprint.h:173
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Move cursor to the requested position expressed in world coordinates.
Definition: kiid.h:48
static TOOL_ACTION move
move or drag an item
Definition: pcb_actions.h:110
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
Definition: pcb_actions.h:66
Abstract dimension API.
PCB_GROUP * GetEnteredGroup()
PCB_SELECTION & GetSelection()
EDA_ITEM * GetTopLeftItem(bool aFootprintsOnly=false) const override
int Size() const
Returns the number of selected parts.
Definition: selection.h:115
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:260
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:99
constexpr KICAD_T BaseType(const KICAD_T aType)
Return the underlying type of the given type.
Definition: typeinfo.h:253
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type
Definition: typeinfo.h:105

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

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

◆ Print()

int PCB_CONTROL::Print ( const TOOL_EVENT aEvent)

Definition at line 465 of file dialog_print_pcbnew.cpp.

466{
467 // Selection affects the origin item visibility
469
472
474 dlg.ForcePrintBorder( false );
475
476 dlg.ShowModal();
477
478 return 0;
479}
const PAGE_INFO & GetPageSettings() const override

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

Referenced by setTransitions().

◆ pruneItemLayers()

void PCB_CONTROL::pruneItemLayers ( std::vector< BOARD_ITEM * > &  aItems)
private

Helper for pasting.

Remove non-enabled layers from the items in aItems. If an item exists only on non-enabled layers, it will be removed entirely.

Definition at line 730 of file pcb_control.cpp.

731{
732 // Do not prune items or layers when copying to the FP editor, because all
733 // layers are accepted, even if they are not enabled in the dummy board
734 // This is mainly true for internal copper layers: all are allowed but only one
735 // (In1.cu) is enabled for the GUI.
737 return;
738
739 LSET enabledLayers = board()->GetEnabledLayers();
740 std::vector<BOARD_ITEM*> returnItems;
741 bool fpItemDeleted = false;
742
743 auto processFPItem =
744 [&]( FOOTPRINT* aFootprint, BOARD_ITEM* aItem )
745 {
746 LSET allowed = aItem->GetLayerSet() & enabledLayers;
747
748 if( allowed.any() )
749 {
750 // Don't prune internal copper layers on items with holes
751 if( aItem->HasHole() && aItem->IsOnCopperLayer() )
752 allowed |= LSET::InternalCuMask();
753
754 aItem->SetLayerSet( allowed );
755 }
756 else
757 {
758 aFootprint->Remove( aItem );
759 fpItemDeleted = true;
760 }
761 };
762
763 for( BOARD_ITEM* item : aItems )
764 {
765
766 if( item->Type() == PCB_FOOTPRINT_T )
767 {
768 FOOTPRINT* fp = static_cast<FOOTPRINT*>( item );
769
770 if( !enabledLayers.test( fp->Reference().GetLayer() ) )
771 fp->Reference().SetLayer( fp->IsFlipped() ? B_SilkS : F_SilkS );
772
773 if( !enabledLayers.test( fp->Value().GetLayer() ) )
774 fp->Value().SetLayer( fp->IsFlipped() ? B_Fab : F_Fab );
775
776 // NOTE: all traversals from the back as processFPItem() might delete the item
777
778 for( int ii = static_cast<int>( fp->Pads().size() ) - 1; ii >= 0; ii-- )
779 processFPItem( fp, fp->Pads()[ii] );
780
781 for( int ii = static_cast<int>( fp->Zones().size() ) - 1; ii >= 0; ii-- )
782 processFPItem( fp, fp->Zones()[ii] );
783
784 for( int ii = static_cast<int>( fp->GraphicalItems().size() ) - 1; ii >= 0; ii-- )
785 processFPItem( fp, fp->GraphicalItems()[ii] );
786
787 if( fp->GraphicalItems().size() || fp->Pads().size() || fp->Zones().size() )
788 returnItems.push_back( fp );
789 }
790 else if( item->Type() == PCB_GROUP_T )
791 {
792 returnItems.push_back( item );
793 }
794 else
795 {
796 LSET allowed = item->GetLayerSet() & enabledLayers;
797
798 if( allowed.any() )
799 {
800 item->SetLayerSet( allowed );
801 returnItems.push_back( item );
802 }
803 }
804 }
805
806 if( ( returnItems.size() < aItems.size() ) || fpItemDeleted )
807 {
808 DisplayError( m_frame, _( "Warning: some pasted items were on layers which are not "
809 "present in the current board.\n"
810 "These items could not be pasted.\n" ) );
811 }
812
813 aItems = returnItems;
814}
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:192
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:226
void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition: footprint.cpp:628
bool IsFlipped() const
Definition: footprint.h:324
PADS & Pads()
Definition: footprint.h:170
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:567
FP_ZONES & Zones()
Definition: footprint.h:176
FP_TEXT & Reference()
Definition: footprint.h:568
static LSET InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
Definition: lset.cpp:733
@ F_Fab
Definition: layer_ids.h:120
@ F_SilkS
Definition: layer_ids.h:104
@ B_SilkS
Definition: layer_ids.h:103
@ B_Fab
Definition: layer_ids.h:119
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:115

References _, B_Fab, B_SilkS, PCB_TOOL_BASE::board(), DisplayError(), F_Fab, F_SilkS, PCB_TOOL_BASE::frame(), FRAME_FOOTPRINT_EDITOR, BOARD::GetEnabledLayers(), BOARD_ITEM::GetLayer(), FOOTPRINT::GraphicalItems(), LSET::InternalCuMask(), FOOTPRINT::IsFlipped(), m_frame, PCB_TOOL_BASE::m_isFootprintEditor, FOOTPRINT::Pads(), PCB_FOOTPRINT_T, PCB_GROUP_T, FOOTPRINT::Reference(), FOOTPRINT::Remove(), BOARD_ITEM::SetLayer(), FOOTPRINT::Value(), and FOOTPRINT::Zones().

Referenced by Paste(), and placeBoardItems().

◆ Quit()

int PCB_CONTROL::Quit ( const TOOL_EVENT aEvent)

Definition at line 133 of file pcb_control.cpp.

134{
135 m_frame->Close( false );
136 return 0;
137}

References m_frame.

Referenced by setTransitions().

◆ RatsnestModeCycle()

int PCB_CONTROL::RatsnestModeCycle ( const TOOL_EVENT aEvent)

Definition at line 343 of file pcb_control.cpp.

344{
345 if( !displayOptions().m_ShowGlobalRatsnest )
346 {
349 }
350 else if( displayOptions().m_RatsnestMode == RATSNEST_MODE::ALL )
351 {
353 }
354 else
355 {
357 }
358
359 getEditFrame<PCB_EDIT_FRAME>()->SetElementVisibility( LAYER_RATSNEST,
360 displayOptions().m_ShowGlobalRatsnest );
361
363
365 canvas()->Refresh();
366 return 0;
367}
@ VISIBLE
Ratsnest lines are drawn to items on visible layers only.
@ ALL
Ratsnest lines are drawn to items on all layers (default)
void RedrawRatsnest()
Return the bounding box of the view that should be used if model is not valid.
PCB_DRAW_PANEL_GAL * canvas() const
PCBNEW_SETTINGS::DISPLAY_OPTIONS & displayOptions() const
@ LAYER_RATSNEST
Definition: layer_ids.h:204

References ALL, PCB_TOOL_BASE::canvas(), PCB_TOOL_BASE::displayOptions(), PCB_TOOL_BASE::frame(), LAYER_RATSNEST, PCBNEW_SETTINGS::DISPLAY_OPTIONS::m_RatsnestMode, PCBNEW_SETTINGS::DISPLAY_OPTIONS::m_ShowGlobalRatsnest, PCB_BASE_FRAME::OnDisplayOptionsChanged(), PCB_DRAW_PANEL_GAL::RedrawRatsnest(), EDA_DRAW_PANEL_GAL::Refresh(), and VISIBLE.

Referenced by setTransitions().

◆ Redo()

int PCB_CONTROL::Redo ( const TOOL_EVENT aEvent)

Definition at line 1323 of file pcb_control.cpp.

1324{
1325 PCB_BASE_EDIT_FRAME* editFrame = dynamic_cast<PCB_BASE_EDIT_FRAME*>( m_frame );
1326 wxCommandEvent dummy;
1327
1328 if( editFrame )
1329 editFrame->RestoreCopyFromRedoList( dummy );
1330
1331 return 0;
1332}
void RestoreCopyFromRedoList(wxCommandEvent &aEvent)
Redo the last edit:
Definition: undo_redo.cpp:343
std::vector< FAB_LAYER_COLOR > dummy

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

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

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, TOOL_BASE::REDRAW, and KIGFX::VIEW::Remove().

◆ resetTransitions()

void TOOL_INTERACTIVE::resetTransitions ( )
privateinherited

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

Definition at line 63 of file tool_interactive.cpp.

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

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

◆ RunMainStack()

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

Call a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

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

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

Referenced by DRAWING_TOOL::PlaceText().

◆ selection() [1/2]

PCB_SELECTION & PCB_TOOL_BASE::selection ( )
protectedinherited

Definition at line 324 of file pcb_tool_base.cpp.

325{
327
328 return selTool->GetSelection();
329}

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

◆ selection() [2/2]

const PCB_SELECTION & PCB_TOOL_BASE::selection ( ) const
protectedinherited

Definition at line 316 of file pcb_tool_base.cpp.

317{
319
320 return selTool->GetSelection();
321}

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

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

◆ SetContextMenu()

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

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

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

Definition at line 76 of file tool_interactive.cpp.

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

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

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

◆ SetIsBoardEditor()

void PCB_TOOL_BASE::SetIsBoardEditor ( bool  aEnabled)
inlineinherited

Definition at line 108 of file pcb_tool_base.h.

108{ m_isBoardEditor = aEnabled; }

References PCB_TOOL_BASE::m_isBoardEditor.

◆ SetIsFootprintEditor()

void PCB_TOOL_BASE::SetIsFootprintEditor ( bool  aEnabled)
inlineinherited

Function SetIsFootprintEditor()

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

Parameters
aEnableddecides if the mode should be enabled.

Definition at line 105 of file pcb_tool_base.h.

105{ m_isFootprintEditor = aEnabled; }

References PCB_TOOL_BASE::m_isFootprintEditor.

◆ setTransitions()

void PCB_CONTROL::setTransitions ( )
overrideprivatevirtual

< Sets up handlers for various events.

Reimplemented from PCB_TOOL_BASE.

Definition at line 1572 of file pcb_control.cpp.

1573{
1576 Go( &PCB_CONTROL::Print, ACTIONS::print.MakeEvent() );
1577 Go( &PCB_CONTROL::Quit, ACTIONS::quit.MakeEvent() );
1578
1579 // Display modes
1594
1595 // Layer control
1633
1634 // Grid control
1637
1638 Go( &PCB_CONTROL::Undo, ACTIONS::undo.MakeEvent() );
1639 Go( &PCB_CONTROL::Redo, ACTIONS::redo.MakeEvent() );
1640
1641 // Miscellaneous
1643
1644 // Append control
1647
1648 Go( &PCB_CONTROL::Paste, ACTIONS::paste.MakeEvent() );
1650
1657
1658 // Add library by dropping file
1661}
static TOOL_ACTION paste
Definition: actions.h:69
static TOOL_ACTION gridResetOrigin
Definition: actions.h:142
static TOOL_ACTION highContrastModeCycle
Definition: actions.h:107
static TOOL_ACTION undo
Definition: actions.h:65
static TOOL_ACTION highContrastMode
Definition: actions.h:106
static TOOL_ACTION quit
Definition: actions.h:59
static TOOL_ACTION redo
Definition: actions.h:66
static TOOL_ACTION deleteTool
Definition: actions.h:74
static TOOL_ACTION print
Definition: actions.h:57
static TOOL_ACTION gridSetOrigin
Definition: actions.h:141
static TOOL_ACTION ddAddLibrary
Definition: actions.h:60
static const TOOL_EVENT ClearedEvent
Definition: actions.h:209
static const TOOL_EVENT PointSelectedEvent
Definition: actions.h:206
static const TOOL_EVENT ConnectivityChangedEvent
Selected item had a property changed (except movement)
Definition: actions.h:211
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:208
static TOOL_ACTION layerToggle
Definition: pcb_actions.h:326
static TOOL_ACTION layerInner12
Definition: pcb_actions.h:302
static TOOL_ACTION layerInner8
Definition: pcb_actions.h:298
static TOOL_ACTION zoneDisplayToggle
Definition: pcb_actions.h:286
static TOOL_ACTION layerInner3
Definition: pcb_actions.h:293
static TOOL_ACTION layerPrev
Definition: pcb_actions.h:323
static TOOL_ACTION showRatsnest
Definition: pcb_actions.h:275
static TOOL_ACTION layerInner2
Definition: pcb_actions.h:292
static TOOL_ACTION ddAppendBoard
Drag and drop.
Definition: pcb_actions.h:528
static TOOL_ACTION layerInner25
Definition: pcb_actions.h:315
static TOOL_ACTION layerAlphaDec
Definition: pcb_actions.h:325
static TOOL_ACTION zoneDisplayFilled
Definition: pcb_actions.h:282
static TOOL_ACTION layerInner24
Definition: pcb_actions.h:314
static TOOL_ACTION viaDisplayMode
Definition: pcb_actions.h:281
static TOOL_ACTION layerInner29
Definition: pcb_actions.h:319
static TOOL_ACTION layerInner11
Definition: pcb_actions.h:301
static TOOL_ACTION layerAlphaInc
Definition: pcb_actions.h:324
static TOOL_ACTION layerInner16
Definition: pcb_actions.h:306
static TOOL_ACTION layerInner26
Definition: pcb_actions.h:316
static TOOL_ACTION layerInner18
Definition: pcb_actions.h:308
static TOOL_ACTION layerInner14
Definition: pcb_actions.h:304
static TOOL_ACTION trackDisplayMode
Definition: pcb_actions.h:279
static TOOL_ACTION layerInner6
Definition: pcb_actions.h:296
static TOOL_ACTION ddImportFootprint
Definition: pcb_actions.h:529
static TOOL_ACTION zoneDisplayTriangulated
Definition: pcb_actions.h:285
static TOOL_ACTION layerInner22
Definition: pcb_actions.h:312
static TOOL_ACTION layerInner5
Definition: pcb_actions.h:295
static TOOL_ACTION zoneDisplayFractured
Definition: pcb_actions.h:284
static TOOL_ACTION ratsnestModeCycle
Definition: pcb_actions.h:278
static TOOL_ACTION layerInner20
Definition: pcb_actions.h:310
static TOOL_ACTION layerInner7
Definition: pcb_actions.h:297
static TOOL_ACTION layerInner27
Definition: pcb_actions.h:317
static TOOL_ACTION appendBoard
Definition: pcb_actions.h:486
static TOOL_ACTION netColorModeCycle
Definition: pcb_actions.h:277
static TOOL_ACTION layerInner1
Definition: pcb_actions.h:291
static TOOL_ACTION layerInner10
Definition: pcb_actions.h:300
static TOOL_ACTION layerInner15
Definition: pcb_actions.h:305
static TOOL_ACTION layerInner17
Definition: pcb_actions.h:307
static TOOL_ACTION flipBoard
Definition: pcb_actions.h:330
static TOOL_ACTION layerBottom
Definition: pcb_actions.h:321
static TOOL_ACTION zoneDisplayOutline
Definition: pcb_actions.h:283
static TOOL_ACTION ratsnestLineMode
Definition: pcb_actions.h:276
static TOOL_ACTION layerInner19
Definition: pcb_actions.h:309
static TOOL_ACTION layerInner9
Definition: pcb_actions.h:299
static TOOL_ACTION layerInner30
Definition: pcb_actions.h:320
static TOOL_ACTION layerTop
Definition: pcb_actions.h:290
static TOOL_ACTION layerInner4
Definition: pcb_actions.h:294
static TOOL_ACTION layerInner13
Definition: pcb_actions.h:303
static TOOL_ACTION layerInner21
Definition: pcb_actions.h:311
static TOOL_ACTION layerNext
Definition: pcb_actions.h:322
static TOOL_ACTION layerInner23
Definition: pcb_actions.h:313
static TOOL_ACTION layerInner28
Definition: pcb_actions.h:318
int AppendBoardFromFile(const TOOL_EVENT &aEvent)
int DdAppendBoard(const TOOL_EVENT &aEvent)
int DdImportFootprint(const TOOL_EVENT &aEvent)
int NetColorModeCycle(const TOOL_EVENT &aEvent)
int RatsnestModeCycle(const TOOL_EVENT &aEvent)
int TrackDisplayMode(const TOOL_EVENT &aEvent)
int DdAddLibrary(const TOOL_EVENT &aEvent)
int Redo(const TOOL_EVENT &aEvent)
int UpdateMessagePanel(const TOOL_EVENT &aEvent)
int LayerAlphaDec(const TOOL_EVENT &aEvent)
int LayerNext(const TOOL_EVENT &aEvent)
int ToggleRatsnest(const TOOL_EVENT &aEvent)
int LayerAlphaInc(const TOOL_EVENT &aEvent)
int HighContrastModeCycle(const TOOL_EVENT &aEvent)
int Quit(const TOOL_EVENT &aEvent)
int HighContrastMode(const TOOL_EVENT &aEvent)
int Undo(const TOOL_EVENT &aEvent)
int ViaDisplayMode(const TOOL_EVENT &aEvent)
int GridSetOrigin(const TOOL_EVENT &aEvent)
int FlipPcbView(const TOOL_EVENT &aEvent)
int LayerToggle(const TOOL_EVENT &aEvent)
int DeleteItemCursor(const TOOL_EVENT &aEvent)
int Print(const TOOL_EVENT &aEvent)
int ZoneDisplayMode(const TOOL_EVENT &aEvent)
int GridResetOrigin(const TOOL_EVENT &aEvent)
int LayerPrev(const TOOL_EVENT &aEvent)
int Paste(const TOOL_EVENT &aEvent)
int LayerSwitch(const TOOL_EVENT &aEvent)
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).

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

◆ ToggleRatsnest()

int PCB_CONTROL::ToggleRatsnest ( const TOOL_EVENT aEvent)

Definition at line 162 of file pcb_control.cpp.

163{
164 if( aEvent.IsAction( &PCB_ACTIONS::showRatsnest ) )
165 {
166 // N.B. Do not disable the Ratsnest layer here. We use it for local ratsnest
167 Flip( displayOptions().m_ShowGlobalRatsnest );
168 getEditFrame<PCB_EDIT_FRAME>()->SetElementVisibility( LAYER_RATSNEST,
169 displayOptions().m_ShowGlobalRatsnest );
170
171 }
172 else if( aEvent.IsAction( &PCB_ACTIONS::ratsnestLineMode ) )
173 {
174 Flip( displayOptions().m_DisplayRatsnestLinesCurved );
175 }
176
178
180 canvas()->Refresh();
181
182 return 0;
183}
void Flip(T &aValue)

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

Referenced by setTransitions().

◆ TrackDisplayMode()

int PCB_CONTROL::TrackDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 146 of file pcb_control.cpp.

147{
148 Flip( displayOptions().m_DisplayPcbTrackFill );
149
150 for( PCB_TRACK* track : board()->Tracks() )
151 {
152 if( track->Type() == PCB_TRACE_T || track->Type() == PCB_ARC_T )
153 view()->Update( track, KIGFX::REPAINT );
154 }
155
156 canvas()->Refresh();
157
158 return 0;
159}
@ REPAINT
Item needs to be redrawn.
Definition: view_item.h:52
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:103
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:101

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

Referenced by setTransitions().

◆ Undo()

int PCB_CONTROL::Undo ( const TOOL_EVENT aEvent)

Definition at line 1311 of file pcb_control.cpp.

1312{
1313 PCB_BASE_EDIT_FRAME* editFrame = dynamic_cast<PCB_BASE_EDIT_FRAME*>( m_frame );
1314 wxCommandEvent dummy;
1315
1316 if( editFrame )
1317 editFrame->RestoreCopyFromUndoList( dummy );
1318
1319 return 0;
1320}
void RestoreCopyFromUndoList(wxCommandEvent &aEvent)
Undo the last edit:
Definition: undo_redo.cpp:313

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

208{
209 if( Pgm().GetCommonSettings()->m_DoNotShowAgain.zone_fill_warning )
210 return;
211
212 bool unfilledZones = false;
213
214 for( const ZONE* zone : board()->Zones() )
215 {
216 if( !zone->GetIsRuleArea() && !zone->IsFilled() )
217 {
218 unfilledZones = true;
219 break;
220 }
221 }
222
223 if( unfilledZones )
224 {
225 WX_INFOBAR* infobar = frame()->GetInfoBar();
226 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, _( "Don't show again" ),
227 wxEmptyString );
228
229 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
230 [&]( wxHyperlinkEvent& aEvent )
231 {
232 Pgm().GetCommonSettings()->m_DoNotShowAgain.zone_fill_warning = true;
233 frame()->GetInfoBar()->Dismiss();
234 } ) );
235
236 infobar->RemoveAllButtons();
237 infobar->AddButton( button );
238
239 wxString msg;
240 msg.Printf( _( "Not all zones are filled. Use Edit > Fill All Zones (%s) "
241 "if you wish to see all fills." ),
243
244 infobar->ShowMessageFor( msg, 5000, wxICON_WARNING );
245 }
246}
WX_INFOBAR * GetInfoBar()
static TOOL_ACTION zoneFillAll
Definition: pcb_actions.h:344
A modified version of the wxInfoBar class that allows us to:
Definition: wx_infobar.h:75
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
Definition: wx_infobar.cpp:289
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: wx_infobar.cpp:128
void AddButton(wxButton *aButton)
Add an already created button to the infobar.
Definition: wx_infobar.cpp:248
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: wx_infobar.cpp:175
wxString KeyNameFromKeyCode(int aKeycode, bool *aIsFound)
Return the key name from the key code.

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

Referenced by ZoneDisplayMode().

◆ UpdateMessagePanel()

int PCB_CONTROL::UpdateMessagePanel ( const TOOL_EVENT aEvent)

Definition at line 1335 of file pcb_control.cpp.

1336{
1338 ROUTER_TOOL* routerTool = m_toolMgr->GetTool<ROUTER_TOOL>();
1339 PCB_SELECTION& selection = selTool->GetSelection();
1340 PCB_EDIT_FRAME* pcbFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
1341 std::shared_ptr<DRC_ENGINE> drcEngine = m_frame->GetBoard()->GetDesignSettings().m_DRCEngine;
1342 DRC_CONSTRAINT constraint;
1343
1344 std::vector<MSG_PANEL_ITEM> msgItems;
1345
1346 if( routerTool && routerTool->RoutingInProgress() )
1347 {
1348 routerTool->UpdateMessagePanel();
1349 return 0;
1350 }
1351
1352 if( !pcbFrame && !m_frame->GetModel() )
1353 return 0;
1354
1355 if( selection.Empty() )
1356 {
1357 if( !pcbFrame )
1358 {
1359 FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_frame->GetModel() );
1360 fp->GetMsgPanelInfo( m_frame, msgItems );
1361 }
1362 else
1363 {
1365 }
1366 }
1367 else if( selection.GetSize() == 1 )
1368 {
1369 EDA_ITEM* item = selection.Front();
1370
1371 item->GetMsgPanelInfo( m_frame, msgItems );
1372 }
1373 else if( pcbFrame && selection.GetSize() == 2 )
1374 {
1375 // Pair selection broken into multiple, optional data, starting with the selected item
1376 // names
1377
1378 BOARD_ITEM* a = static_cast<BOARD_ITEM*>( selection[0] );
1379 BOARD_ITEM* b = static_cast<BOARD_ITEM*>( selection[1] );
1380
1381 msgItems.emplace_back( MSG_PANEL_ITEM( a->GetItemDescription( m_frame ),
1382 b->GetItemDescription( m_frame ) ) );
1383
1384 BOARD_CONNECTED_ITEM* a_conn = dyn_cast<BOARD_CONNECTED_ITEM*>( a );
1385 BOARD_CONNECTED_ITEM* b_conn = dyn_cast<BOARD_CONNECTED_ITEM*>( b );
1386
1387 if( a_conn && b_conn )
1388 {
1389 LSET overlap = a_conn->GetLayerSet() & b_conn->GetLayerSet() & LSET::AllCuMask();
1390 int a_netcode = a_conn->GetNetCode();
1391 int b_netcode = b_conn->GetNetCode();
1392
1393 if( overlap.count() > 0
1394 && ( a_netcode != b_netcode || a_netcode < 0 || b_netcode < 0 ) )
1395 {
1396 PCB_LAYER_ID layer = overlap.CuStack().front();
1397
1398 constraint = drcEngine->EvalRules( CLEARANCE_CONSTRAINT, a, b, layer );
1399
1400 std::shared_ptr<SHAPE> a_shape( a_conn->GetEffectiveShape( layer ) );
1401 std::shared_ptr<SHAPE> b_shape( b_conn->GetEffectiveShape( layer ) );
1402
1403 int actual_clearance = a_shape->GetClearance( b_shape.get() );
1404
1405 msgItems.emplace_back( _( "Resolved clearance" ),
1406 m_frame->MessageTextFromValue( constraint.m_Value.Min() ) );
1407
1408 if( actual_clearance > -1 && actual_clearance < std::numeric_limits<int>::max() )
1409 {
1410 msgItems.emplace_back( _( "Actual clearance" ),
1411 m_frame->MessageTextFromValue( actual_clearance ) );
1412 }
1413 }
1414 }
1415
1416 if( ( a->HasHole() || b->HasHole() ) )
1417 {
1420
1421 if( b->IsOnLayer( active ) && IsCopperLayer( active ) )
1422 layer = active;
1423 else if( b->HasHole() && a->IsOnLayer( active ) && IsCopperLayer( active ) )
1424 layer = active;
1425 else if( a->HasHole() && b->IsOnCopperLayer() )
1426 layer = b->GetLayer();
1427 else if( b->HasHole() && a->IsOnCopperLayer() )
1428 layer = a->GetLayer();
1429
1430 if( IsCopperLayer( layer ) )
1431 {
1432 int actual = std::numeric_limits<int>::max();
1433
1434 if( a->HasHole() && b->IsOnCopperLayer() )
1435 {
1436 std::shared_ptr<SHAPE_SEGMENT> hole = a->GetEffectiveHoleShape();
1437 std::shared_ptr<SHAPE> other( b->GetEffectiveShape( layer ) );
1438
1439 actual = std::min( actual, hole->GetClearance( other.get() ) );
1440 }
1441
1442 if( b->HasHole() && a->IsOnCopperLayer() )
1443 {
1444 std::shared_ptr<SHAPE_SEGMENT> hole = b->GetEffectiveHoleShape();
1445 std::shared_ptr<SHAPE> other( a->GetEffectiveShape( layer ) );
1446
1447 actual = std::min( actual, hole->GetClearance( other.get() ) );
1448 }
1449
1450 if( actual < std::numeric_limits<int>::max() )
1451 {
1452 constraint = drcEngine->EvalRules( HOLE_CLEARANCE_CONSTRAINT, a, b, layer );
1453 msgItems.emplace_back( _( "Resolved hole clearance" ),
1454 m_frame->MessageTextFromValue( constraint.m_Value.Min() ) );
1455
1456 if( actual > -1 && actual < std::numeric_limits<int>::max() )
1457 {
1458 msgItems.emplace_back( _( "Actual hole clearance" ),
1459 m_frame->MessageTextFromValue( actual ) );
1460 }
1461 }
1462 }
1463 }
1464
1465 for( PCB_LAYER_ID edgeLayer : { Edge_Cuts, Margin } )
1466 {
1469
1470 if( a->IsOnLayer( edgeLayer ) && b->Type() != PCB_FOOTPRINT_T )
1471 {
1472 if( b->IsOnLayer( active ) && IsCopperLayer( active ) )
1473 layer = active;
1474 else if( IsCopperLayer( b->GetLayer() ) )
1475 layer = b->GetLayer();
1476 }
1477 else if( b->IsOnLayer( edgeLayer ) && a->Type() != PCB_FOOTPRINT_T )
1478 {
1479 if( a->IsOnLayer( active ) && IsCopperLayer( active ) )
1480 layer = active;
1481 else if( IsCopperLayer( a->GetLayer() ) )
1482 layer = a->GetLayer();
1483 }
1484
1485 if( layer >= 0 )
1486 {
1487 constraint = drcEngine->EvalRules( EDGE_CLEARANCE_CONSTRAINT, a, b, layer );
1488
1489 if( edgeLayer == Edge_Cuts )
1490 {
1491 msgItems.emplace_back( _( "Resolved edge clearance" ),
1492 m_frame->MessageTextFromValue( constraint.m_Value.Min() ) );
1493 }
1494 else
1495 {
1496 msgItems.emplace_back( _( "Resolved margin clearance" ),
1497 m_frame->MessageTextFromValue( constraint.m_Value.Min() ) );
1498 }
1499 }
1500 }
1501 }
1502
1503 if( msgItems.empty() )
1504 {
1505 if( selection.GetSize() )
1506 {
1507 msgItems.emplace_back( _( "Selected Items" ),
1508 wxString::Format( wxT( "%d" ), selection.GetSize() ) );
1509
1510 std::set<wxString> netNames;
1511 std::set<wxString> netClasses;
1512
1513 for( EDA_ITEM* item : selection )
1514 {
1515 if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
1516 {
1517 netNames.insert( UnescapeString( bci->GetNetname() ) );
1518 netClasses.insert( UnescapeString( bci->GetEffectiveNetClass()->GetName() ) );
1519
1520 if( netNames.size() > 1 && netClasses.size() > 1 )
1521 break;
1522 }
1523 }
1524
1525 if( netNames.size() == 1 )
1526 msgItems.emplace_back( _( "Net" ), *netNames.begin() );
1527
1528 if( netClasses.size() == 1 )
1529 msgItems.emplace_back( _( "Resolved Netclass" ), *netClasses.begin() );
1530 }
1531 else
1532 {
1533 m_frame->GetBoard()->GetMsgPanelInfo( m_frame, msgItems );
1534 }
1535 }
1536
1537 m_frame->SetMsgPanel( msgItems );
1538
1539 return 0;
1540}
std::shared_ptr< DRC_ENGINE > m_DRCEngine
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition: board_item.cpp:219
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:197
virtual bool IsOnLayer(PCB_LAYER_ID aLayer, bool aIncludeCourtyards=false) const
Test to see if this object is on the given layer.
Definition: board_item.h:257
virtual bool IsOnCopperLayer() const
Definition: board_item.h:135
virtual std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const
Definition: board_item.cpp:229
virtual bool HasHole() const
Definition: board_item.h:140
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: board.cpp:1314
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:704
MINOPTMAX< int > m_Value
Definition: drc_rule.h:172
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
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:209
virtual wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const
Return a user-visible description string of this item.
Definition: eda_item.cpp:108
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: footprint.cpp:1026
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
Definition: lset.cpp:170
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:773
T Min() const
Definition: minoptmax.h:33
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:54
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:99
EDA_ITEM * Front() const
Definition: selection.h:208
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:109
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
@ EDGE_CLEARANCE_CONSTRAINT
Definition: drc_rule.h:50
@ CLEARANCE_CONSTRAINT
Definition: drc_rule.h:47
@ HOLE_CLEARANCE_CONSTRAINT
Definition: drc_rule.h:48
@ Edge_Cuts
Definition: layer_ids.h:113
@ Margin
Definition: layer_ids.h:114
@ UNDEFINED_LAYER
Definition: layer_ids.h:60
wxString UnescapeString(const wxString &aSource)

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

Referenced by setTransitions().

◆ ViaDisplayMode()

int PCB_CONTROL::ViaDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 186 of file pcb_control.cpp.

187{
188 Flip( displayOptions().m_DisplayViaFill );
189
190 for( PCB_TRACK* track : board()->Tracks() )
191 {
192 if( track->Type() == PCB_VIA_T )
193 view()->Update( track, KIGFX::REPAINT );
194 }
195
196 canvas()->Refresh();
197
198 return 0;
199}
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:102

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

Referenced by setTransitions().

◆ view()

◆ Wait()

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

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

No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

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

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

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

◆ ZoneDisplayMode()

int PCB_CONTROL::ZoneDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 249 of file pcb_control.cpp.

250{
252
253 // Apply new display options to the GAL canvas
255 {
257
259 }
260 else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayOutline ) )
261 {
263 }
264 else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayFractured ) )
265 {
267 }
269 {
271 }
272 else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayToggle ) )
273 {
276 else
278 }
279 else
280 {
281 wxFAIL;
282 }
283
284 m_frame->SetDisplayOptions( opts );
285
286 for( ZONE* zone : board()->Zones() )
287 view()->Update( zone, KIGFX::REPAINT );
288
289 canvas()->Refresh();
290
291 return 0;
292}
void unfilledZoneCheck()
We have bug reports indicating that some new users confuse zone filling/unfilling with the display mo...
ZONE_DISPLAY_MODE m_ZoneDisplayMode

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

Referenced by setTransitions().

Member Data Documentation

◆ m_frame

◆ m_gridOrigin

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

Definition at line 143 of file pcb_control.h.

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

◆ m_isBoardEditor

bool PCB_TOOL_BASE::m_isBoardEditor
protectedinherited

◆ m_isFootprintEditor

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

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

Definition at line 125 of file tool_interactive.h.

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

◆ m_pickerItem

BOARD_ITEM* PCB_CONTROL::m_pickerItem
private

Definition at line 145 of file pcb_control.h.

Referenced by DeleteItemCursor().

◆ m_statusPopup

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

Definition at line 147 of file pcb_control.h.

Referenced by DeleteItemCursor().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

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

Definition at line 210 of file tool_base.h.

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

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 215 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), SELECTION_TOOL::AddItemsToSel(), SELECTION_TOOL::AddItemToSel(), SCH_MOVE_TOOL::AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), BOARD_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), EE_SELECTION_TOOL::autostartEvent(), SCH_EDIT_TOOL::BreakWire(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDITOR_CONTROL::ChangeLineMode(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), SCH_EDITOR_CONTROL::ClearHighlight(), BOARD_INSPECTION_TOOL::ClearHighlight(), GERBVIEW_SELECTION_TOOL::clearSelection(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), MICROWAVE_TOOL::createInductorBetween(), EE_INSPECTION_TOOL::CrossProbe(), DRC_TOOL::CrossProbe(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), SCH_EDIT_TOOL::DeleteItemCursor(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), DeleteItemCursor(), EDIT_TOOL::DeleteItems(), SCH_EDITOR_CONTROL::doCopy(), BOARD_EDITOR_CONTROL::doCrossProbePcbToSch(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), SCH_EDIT_TOOL::DoDelete(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), BOARD_INSPECTION_TOOL::doHideRatsnestNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PCB_SELECTION_TOOL::doSyncSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::Drag(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editShapeProperties(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), PCB_SELECTION_TOOL::EnterGroup(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), PAD_TOOL::EnumeratePads(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_SELECTION_TOOL::ExitGroup(), 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(), PCB_SELECTION_TOOL::grabUnconnected(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), GridSetOrigin(), GROUP_TOOL::Group(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PL_EDIT_TOOL::ImportDrawingSheetContent(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), EE_TOOL_BASE< T >::Init(), SCH_EDIT_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_EDIT_TOOL::Init(), PL_POINT_EDITOR::Init(), ROUTER_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), BOARD_INSPECTION_TOOL::Init(), BOARD_REANNOTATE_TOOL::Init(), CONVERT_TOOL::Init(), DRAWING_TOOL::Init(), EDIT_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), GROUP_TOOL::Init(), PAD_TOOL::Init(), PCB_POINT_EDITOR::Init(), PCB_SELECTION_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), POSITION_RELATIVE_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), GROUP_TOOL::LeaveGroup(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EDA_3D_CONTROLLER::Main(), CVPCB_CONTROL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), SCH_EDITOR_CONTROL::NextLineMode(), SYMBOL_EDITOR_CONTROL::OnDeMorgan(), SELECTION_TOOL::onDisambiguationExpire(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_EDIT_TOOL::PinTable(), placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), GERBVIEW_CONTROL::Print(), Print(), SCH_EDIT_TOOL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EDIT_TOOL::rebuildConnectivity(), ZONE_FILLER_TOOL::rebuildConnectivity(), EE_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::RecombinePad(), SCH_EDITOR_CONTROL::Redo(), SYMBOL_EDITOR_EDIT_TOOL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), GROUP_TOOL::RemoveFromGroup(), SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem(), PCB_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), PAD_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), SCH_EDITOR_CONTROL::Revert(), SCH_EDIT_TOOL::Rotate(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), ROUTER_TOOL::RouteSelected(), TOOL_INTERACTIVE::RunMainStack(), DRC_TOOL::RunTests(), EE_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::SelectAll(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectNet(), GERBVIEW_SELECTION_TOOL::selectPoint(), PL_SELECTION_TOOL::SelectPoint(), PCB_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), EDA_3D_CONTROLLER::SetMaterial(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDIT_TOOL::Swap(), EE_SELECTION_TOOL::SyncSelection(), COMMON_TOOLS::ToggleCursor(), COMMON_TOOLS::ToggleCursorStyle(), EDA_3D_CONTROLLER::ToggleVisibility(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), SCH_MOVE_TOOL::trimDanglingLines(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_EDITOR_CONTROL::Undo(), SYMBOL_EDITOR_EDIT_TOOL::Undo(), GROUP_TOOL::Ungroup(), PCB_SELECTION_TOOL::unrouteSelected(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), PNS::TOOL_BASE::updateEndItem(), BOARD_INSPECTION_TOOL::UpdateLocalRatsnest(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), UpdateMessagePanel(), EDIT_TOOL::updateModificationPoint(), EE_POINT_EDITOR::updateParentItem(), PNS::TOOL_BASE::updateStartItem(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), BOARD_EDITOR_CONTROL::ZoneDuplicate(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 214 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

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

Definition at line 207 of file tool_base.h.

Referenced by TOOL_BASE::GetType().


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