KiCad PCB EDA Suite
PCBNEW_CONTROL Class Reference

PCBNEW_CONTROL. More...

#include <pcbnew_control.h>

Inheritance diagram for PCBNEW_CONTROL:
PCB_TOOL_BASE TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 PCBNEW_CONTROL ()
 
 ~PCBNEW_CONTROL ()
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings 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 PadDisplayMode (const TOOL_EVENT &aEvent)
 
int ViaDisplayMode (const TOOL_EVENT &aEvent)
 
int GraphicDisplayMode (const TOOL_EVENT &aEvent)
 
int ModuleEdgeOutlines (const TOOL_EVENT &aEvent)
 
int ModuleTextOutlines (const TOOL_EVENT &aEvent)
 
int HighContrastMode (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 GridFast1 (const TOOL_EVENT &aEvent)
 
int GridFast2 (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 Show3DViewer (const TOOL_EVENT &aEvent)
 
int UpdateMessagePanel (const TOOL_EVENT &aEvent)
 
void setTransitions () override
 

Sets up handlers for various events.

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

Static Public Member Functions

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

Protected Types

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

Protected Member Functions

void doInteractiveItemPlacement (const std::string &aTool, INTERACTIVE_PLACER_BASE *aPlacer, const wxString &aCommitMessage, int aOptions=IPO_ROTATE|IPO_FLIP|IPO_REPEAT)
 Helper function for performing a common interactive idiom: wait for a left click, place an item there (perhaps with a dialog or other user interaction), then have it move with the mouse and respond to rotate/flip, etc. More...
 
KIGFX::PCB_VIEWview () const
 
KIGFX::VIEW_CONTROLScontrols () const
 
PCB_BASE_EDIT_FRAMEframe () const
 
BOARDboard () const
 
MODULEmodule () const
 
const PCB_DISPLAY_OPTIONSdisplayOptions () const
 
PCB_DRAW_PANEL_GALcanvas () const
 
const PCBNEW_SELECTIONselection () const
 
PCBNEW_SELECTIONselection ()
 
void attachManager (TOOL_MANAGER *aManager)
 Function attachManager() More...
 
KIGFX::VIEWgetView () const
 Function getView() More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Function getViewControls() More...
 
template<typename T >
T * getEditFrame () const
 Function getEditFrame() More...
 
template<typename T >
T * getModel () const
 Function getModel() More...
 

Protected Attributes

bool m_editModules
 
TOOL_MENU m_menu
 functions below are not yet implemented - their interface may change More...
 
TOOL_TYPE m_type
 

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

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

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 
TOOL_SETTINGS m_toolSettings
 

Private Member Functions

int placeBoardItems (std::vector< BOARD_ITEM * > &aItems, bool aIsNew, bool aAnchorAtOrigin)
 Add and select or just select for move/place command a list of board items. More...
 
int placeBoardItems (BOARD *aBoard, bool aAnchorAtOrigin)
 
void updateGrid ()
 

Applies the legacy canvas grid settings for GAL.

More...
 

Private Attributes

PCB_BASE_FRAMEm_frame
 

Pointer to the currently used edit frame.

More...
 
std::unique_ptr< KIGFX::ORIGIN_VIEWITEMm_gridOrigin
 

Grid origin marker.

More...
 
BOARD_ITEMm_pickerItem
 

Detailed Description

PCBNEW_CONTROL.

Handles actions that are shared between different frames in pcbnew.

Definition at line 44 of file pcbnew_control.h.

Member Enumeration Documentation

◆ INTERACTIVE_PLACEMENT_OPTIONS

Enumerator
IPO_ROTATE 
IPO_FLIP 
IPO_SINGLE_CLICK 
IPO_REPEAT 

Definition at line 109 of file pcb_tool_base.h.

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determines the reason of reset for a tool

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 79 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ PCBNEW_CONTROL()

PCBNEW_CONTROL::PCBNEW_CONTROL ( )

Definition at line 68 of file pcbnew_control.cpp.

68  :
69  PCB_TOOL_BASE( "pcbnew.Control" ),
70  m_frame( nullptr ),
71  m_pickerItem( nullptr )
72 {
73  m_gridOrigin.reset( new KIGFX::ORIGIN_VIEWITEM() );
74 }
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
BOARD_ITEM * m_pickerItem
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Grid origin marker.
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool_base.h:71

References m_gridOrigin.

◆ ~PCBNEW_CONTROL()

PCBNEW_CONTROL::~PCBNEW_CONTROL ( )

Definition at line 77 of file pcbnew_control.cpp.

78 {
79 }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

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

Definition at line 51 of file tool_interactive.cpp.

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

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

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), LIB_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), LIB_TREE::onContextMenu(), POINT_EDITOR::OnSelectionChange(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ AddLibrary()

int PCBNEW_CONTROL::AddLibrary ( const TOOL_EVENT aEvent)

Definition at line 96 of file pcbnew_control.cpp.

97 {
99  {
100  if( aEvent.IsAction( &ACTIONS::newLibrary ) )
101  static_cast<PCB_BASE_EDIT_FRAME*>( m_frame )->CreateNewLibrary();
102  else if( aEvent.IsAction( &ACTIONS::addLibrary ) )
103  static_cast<PCB_BASE_EDIT_FRAME*>( m_frame )->AddLibrary();
104  }
105 
106  return 0;
107 }
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
static TOOL_ACTION addLibrary
Definition: actions.h:52
static TOOL_ACTION newLibrary
Definition: actions.h:51
bool IsType(FRAME_T aType) const

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

Referenced by setTransitions().

◆ AppendBoard()

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

Definition at line 897 of file pcbnew_control.cpp.

898 {
899  PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
900 
901  if( !editFrame )
902  return 1;
903 
904  BOARD* brd = board();
905 
906  if( !brd )
907  return 1;
908 
909  // Mark existing items, in order to know what are the new items so we can select only
910  // the new items after loading
911  for( auto track : brd->Tracks() )
912  track->SetFlags( FLAG0 );
913 
914  for( auto module : brd->Modules() )
915  module->SetFlags( FLAG0 );
916 
917  for( auto drawing : brd->Drawings() )
918  drawing->SetFlags( FLAG0 );
919 
920  for( auto zone : brd->Zones() )
921  zone->SetFlags( FLAG0 );
922 
923  // Keep also the count of copper layers, to adjust if necessary
924  int initialCopperLayerCount = brd->GetCopperLayerCount();
925  LSET initialEnabledLayers = brd->GetEnabledLayers();
926 
927  // Load the data
928  try
929  {
930  PROPERTIES props;
931  char xbuf[30];
932  char ybuf[30];
933 
934  // EAGLE_PLUGIN can use this info to center the BOARD, but it does not yet.
935  sprintf( xbuf, "%d", editFrame->GetPageSizeIU().x );
936  sprintf( ybuf, "%d", editFrame->GetPageSizeIU().y );
937 
938  props["page_width"] = xbuf;
939  props["page_height"] = ybuf;
940 
941  editFrame->GetDesignSettings().m_NetClasses.Clear();
942  pi.Load( fileName, brd, &props );
943  }
944  catch( const IO_ERROR& ioe )
945  {
946  wxString msg = wxString::Format( _( "Error loading board.\n%s" ), GetChars( ioe.What() ));
947  DisplayError( editFrame, msg );
948 
949  return 0;
950  }
951 
952  // rebuild nets and ratsnest before any use of nets
953  brd->BuildListOfNets();
955  brd->BuildConnectivity();
956 
957  // Synchronize layers
958  // we should not ask PLUGINs to do these items:
959  int copperLayerCount = brd->GetCopperLayerCount();
960 
961  if( copperLayerCount > initialCopperLayerCount )
962  brd->SetCopperLayerCount( copperLayerCount );
963 
964  // Enable all used layers, and make them visible:
965  LSET enabledLayers = brd->GetEnabledLayers();
966  enabledLayers |= initialEnabledLayers;
967  brd->SetEnabledLayers( enabledLayers );
968  brd->SetVisibleLayers( enabledLayers );
969 
970  return placeBoardItems( brd, false );
971 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:236
void BuildListOfNets()
Definition: class_board.h:716
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame.
BOARD * board() const
void SetCopperLayerCount(int aCount)
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
PROPERTIES is a name/value tuple with unique names and optional values.
Definition: properties.h:34
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
void SynchronizeNetsAndNetClasses()
Function SynchronizeNetsAndNetClasses copies NETCLASS info to each NET, based on NET membership in a ...
Definition: netclass.cpp:155
LSET is a set of PCB_LAYER_IDs.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:255
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
MODULES & Modules()
Definition: class_board.h:226
void SetVisibleLayers(LSET aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
void BuildConnectivity()
Builds or rebuilds the board connectivity database for the board, especially the list of connected it...
#define FLAG0
Pcbnew: flag used in local computations.
Definition: base_struct.h:137
ZONE_CONTAINERS & Zones()
Definition: class_board.h:240
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:101
void Clear()
Function Clear destroys any contained NETCLASS instances except the Default one.
Definition: netclass.h:242
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:160
MODULE * module() const
#define _(s)
Definition: 3d_actions.cpp:31
int GetCopperLayerCount() const
Function GetCopperLayerCount.
int placeBoardItems(std::vector< BOARD_ITEM * > &aItems, bool aIsNew, bool aAnchorAtOrigin)
Add and select or just select for move/place command a list of board items.
PCB_EDIT_FRAME is the main frame for Pcbnew.
const wxSize GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
DRAWINGS & Drawings()
Definition: class_board.h:235
void SetEnabledLayers(LSET aLayerMask)
Function SetEnabledLayers is a proxy function that calls the correspondent function in m_BoardSetting...
TRACKS & Tracks()
Definition: class_board.h:217
virtual BOARD * Load(const wxString &aFileName, BOARD *aAppendToMe, const PROPERTIES *aProperties=NULL)
Function Load loads information from some input file format that this PLUGIN implementation knows abo...
Definition: plugin.cpp:46

References _, PCB_TOOL_BASE::board(), BOARD::BuildConnectivity(), BOARD::BuildListOfNets(), NETCLASSES::Clear(), DisplayError(), BOARD::Drawings(), FLAG0, Format(), GetChars(), BOARD::GetCopperLayerCount(), PCB_BASE_FRAME::GetDesignSettings(), BOARD::GetEnabledLayers(), PCB_BASE_FRAME::GetPageSizeIU(), PLUGIN::Load(), m_frame, BOARD_DESIGN_SETTINGS::m_NetClasses, PCB_TOOL_BASE::module(), BOARD::Modules(), placeBoardItems(), BOARD::SetCopperLayerCount(), BOARD::SetEnabledLayers(), EDA_ITEM::SetFlags(), BOARD::SetVisibleLayers(), BOARD::SynchronizeNetsAndNetClasses(), BOARD::Tracks(), IO_ERROR::What(), and BOARD::Zones().

Referenced by AppendBoardFromFile().

◆ AppendBoardFromFile()

int PCBNEW_CONTROL::AppendBoardFromFile ( const TOOL_EVENT aEvent)

Definition at line 762 of file pcbnew_control.cpp.

763 {
764  int open_ctl;
765  wxString fileName;
766 
767  PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
768 
769  if( !editFrame )
770  return 1;
771 
772  // Pick a file to append
773  if( !AskLoadBoardFileName( editFrame, &open_ctl, &fileName, true ) )
774  return 1;
775 
776  IO_MGR::PCB_FILE_T pluginType = plugin_type( fileName, open_ctl );
777  PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
778 
779  return AppendBoard( *pi, fileName );
780 }
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
RELEASER releases a PLUGIN in the context of a potential thrown exception, through its destructor.
Definition: io_mgr.h:577
bool AskLoadBoardFileName(wxWindow *aParent, int *aCtl, wxString *aFileName, bool aKicadFilesOnly=false)
Function AskLoadBoardFileName puts up a wxFileDialog asking for a BOARD filename to open.
IO_MGR::PCB_FILE_T plugin_type(const wxString &aFileName, int aCtl)
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Function PluginFind returns a PLUGIN which the caller can use to import, export, save,...
Definition: io_mgr.cpp:58
PCB_EDIT_FRAME is the main frame for Pcbnew.
PCB_FILE_T
Enum PCB_FILE_T is a set of file types that the IO_MGR knows about, and for which there has been a pl...
Definition: io_mgr.h:54
int AppendBoard(PLUGIN &pi, wxString &fileName)

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

Referenced by setTransitions().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

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

Definition at line 60 of file tool_base.cpp.

61 {
62  m_toolMgr = aManager;
63  m_toolSettings = TOOL_SETTINGS( this );
64 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:220
friend class TOOL_SETTINGS
Definition: tool_base.h:154

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

Referenced by TOOL_MANAGER::RegisterTool().

◆ board()

BOARD* PCB_TOOL_BASE::board ( ) const
inlineprotectedinherited

Definition at line 151 of file pcb_tool_base.h.

151 { return getModel<BOARD>(); }

Referenced by AppendBoard(), AUTOPLACE_TOOL::autoplace(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), EDIT_TOOL::ChangeTrackWidth(), ZONE_FILLER_TOOL::CheckAllZones(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), PCB_INSPECTION_TOOL::ClearHighlight(), DRAWING_TOOL::constrainDimension(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), ROUTER_TOOL::CustomTrackWidthDialog(), DeleteItemCursor(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), PAD_TOOL::EnumeratePads(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), ZONE_FILLER_TOOL::FillAllZones(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::getCollectorsGuide(), GraphicDisplayMode(), PCB_INSPECTION_TOOL::highlightNet(), LayerNext(), LayerPrev(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PCB_TOOL_BASE::module(), ModuleEdgeOutlines(), ModuleTextOutlines(), ROUTER_TOOL::onTrackViaSizeChanged(), ROUTER_TOOL::onViaCommand(), PadDisplayMode(), Paste(), placeBoardItems(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), SELECTION_TOOL::RebuildSelection(), PNS::TOOL_BASE::Reset(), Reset(), SELECTION_TOOL::Selectable(), SELECTION_TOOL::selectAllItemsOnNet(), SELECTION_TOOL::selectAllItemsOnSheet(), SELECTION_TOOL::selectConnectedTracks(), SELECTION_TOOL::selectPoint(), DRC::testDisabledLayers(), DRC::TestZoneToZoneOutline(), TrackDisplayMode(), POINT_EDITOR::updateItem(), ViaDisplayMode(), ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

◆ canvas()

◆ controls()

◆ DeleteItemCursor()

int PCBNEW_CONTROL::DeleteItemCursor ( const TOOL_EVENT aEvent)

Definition at line 529 of file pcbnew_control.cpp.

530 {
532  return 0;
533 
534  std::string tool = aEvent.GetCommandStr().get();
536 
537  m_pickerItem = nullptr;
539 
540  // Deactivate other tools; particularly important if another PICKER is currently running
541  Activate();
542 
543  picker->SetCursor( wxStockCursor( wxCURSOR_BULLSEYE ) );
544 
545  picker->SetClickHandler(
546  [this] ( const VECTOR2D& aPosition ) -> bool
547  {
548  if( m_pickerItem )
549  {
551  {
552  STATUS_TEXT_POPUP statusPopup( m_frame );
553  statusPopup.SetText( _( "Item locked." ) );
554  statusPopup.PopupFor( 2000 );
555  statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
556  return true;
557  }
558 
559  SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
560  selectionTool->UnbrightenItem( m_pickerItem );
561  selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
563  m_pickerItem = nullptr;
564  }
565 
566  return true;
567  } );
568 
569  picker->SetMotionHandler(
570  [this] ( const VECTOR2D& aPos )
571  {
572  BOARD* board = m_frame->GetBoard();
573  SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
575  GENERAL_COLLECTOR collector;
576  collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
577 
578  if( m_editModules )
579  collector.Collect( board, GENERAL_COLLECTOR::ModuleItems, (wxPoint) aPos, guide );
580  else
581  collector.Collect( board, GENERAL_COLLECTOR::BoardLevelItems, (wxPoint) aPos, guide );
582 
583  // Remove unselectable items
584  for( int i = collector.GetCount() - 1; i >= 0; --i )
585  {
586  if( !selectionTool->Selectable( collector[ i ] ) )
587  collector.Remove( i );
588  }
589 
590  if( collector.GetCount() > 1 )
591  selectionTool->GuessSelectionCandidates( collector, aPos );
592 
593  BOARD_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr;
594 
595  if( m_pickerItem != item )
596  {
597 
598  if( m_pickerItem )
599  selectionTool->UnbrightenItem( m_pickerItem );
600 
601  m_pickerItem = item;
602 
603  if( m_pickerItem )
604  selectionTool->BrightenItem( m_pickerItem );
605  }
606  } );
607 
608  picker->SetFinalizeHandler(
609  [this] ( const int& aFinalState )
610  {
611  if( m_pickerItem )
613  } );
614 
615  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
616 
617  return 0;
618 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:73
void GuessSelectionCandidates(GENERAL_COLLECTOR &aCollector, const VECTOR2I &aWhere) const
Function guessSelectionCandidates() Tries to guess best selection candidates in case multiple items a...
static const KICAD_T BoardLevelItems[]
A scan list for all primary board items, omitting items which are subordinate to a MODULE,...
Definition: collectors.h:283
int m_Threshold
Definition: collector.h:68
BOARD * board() const
static TOOL_ACTION doDelete
Definition: actions.h:74
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
void Collect(BOARD_ITEM *aItem, const KICAD_T aScanList[], const wxPoint &aRefPos, const COLLECTORS_GUIDE &aGuide)
Scan a BOARD_ITEM using this class's Inspector method, which does the collection.
Definition: collectors.cpp:480
SELECTION_TOOL.
STATUS_TEXT_POPUP.
Definition: status_popup.h:79
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
#define HITTEST_THRESHOLD_PIXELS
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
void SetFinalizeHandler(FINALIZE_HANDLER aHandler)
Function SetFinalizeHandler() Sets a handler for the finalize event.
void Remove(int aIndex)
Function Remove removes the item at aIndex (first position is 0);.
Definition: collector.h:145
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
static TOOL_ACTION pickerTool
Definition: actions.h:145
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:116
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide()
Function GetCollectorsGuide.
Generic tool for picking a point.
void UnbrightenItem(BOARD_ITEM *aItem)
void AddItemToSel(BOARD_ITEM *aItem, bool aQuietMode=false)
MODULE * GetFirstModule() const
Gets the first module in the list (used in footprint viewer/editor) or NULL if none.
Definition: class_board.h:275
BOARD_ITEM * m_pickerItem
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
virtual bool IsLocked() const
Function IsLocked.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:160
#define _(s)
Definition: 3d_actions.cpp:31
static const KICAD_T ModuleItems[]
A scan list for primary module items.
Definition: collectors.h:308
bool Selectable(const BOARD_ITEM *aItem, bool checkVisibilityOnly=false) const
Function selectable() Checks conditions for an item to be selected.
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:240
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:61
void SetMotionHandler(MOTION_HANDLER aHandler)
Function SetMotionHandler() Sets a handler for mouse motion.
void Activate()
Function Activate() Runs the tool.
BOARD * GetBoard() const
A general implementation of a COLLECTORS_GUIDE.
Definition: collectors.h:385
void BrightenItem(BOARD_ITEM *aItem)
void SetCursor(const wxCursor &aCursor)
void SetClickHandler(CLICK_HANDLER aHandler)
Function SetClickHandler() Sets a handler for mouse click event.

References _, TOOL_INTERACTIVE::Activate(), SELECTION_TOOL::AddItemToSel(), PCB_TOOL_BASE::board(), GENERAL_COLLECTOR::BoardLevelItems, SELECTION_TOOL::BrightenItem(), GENERAL_COLLECTOR::Collect(), ACTIONS::doDelete, PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCollectorsGuide(), TOOL_EVENT::GetCommandStr(), COLLECTOR::GetCount(), BOARD::GetFirstModule(), TOOL_MANAGER::GetTool(), TOOL_BASE::getView(), SELECTION_TOOL::GuessSelectionCandidates(), HITTEST_THRESHOLD_PIXELS, BOARD_ITEM::IsLocked(), KiROUND(), PCB_TOOL_BASE::m_editModules, m_frame, m_pickerItem, COLLECTOR::m_Threshold, TOOL_BASE::m_toolMgr, GENERAL_COLLECTOR::ModuleItems, STATUS_POPUP::Move(), ACTIONS::pickerTool, STATUS_POPUP::PopupFor(), COLLECTOR::Remove(), TOOL_MANAGER::RunAction(), SELECTION_TOOL::Selectable(), PCB_ACTIONS::selectionClear, PCBNEW_PICKER_TOOL::SetClickHandler(), PCBNEW_PICKER_TOOL::SetCursor(), PCBNEW_PICKER_TOOL::SetFinalizeHandler(), PCBNEW_PICKER_TOOL::SetMotionHandler(), STATUS_TEXT_POPUP::SetText(), and SELECTION_TOOL::UnbrightenItem().

Referenced by setTransitions().

◆ displayOptions()

const PCB_DISPLAY_OPTIONS & PCB_TOOL_BASE::displayOptions ( ) const
protectedinherited

Definition at line 258 of file pcb_tool_base.cpp.

259 {
260  return frame()->GetDisplayOptions();
261 }
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Function GetDisplayOptions returns the display options current in use Display options are relative to...
PCB_BASE_EDIT_FRAME * frame() const

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

Referenced by PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), GraphicDisplayMode(), HighContrastMode(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), ModuleEdgeOutlines(), ModuleTextOutlines(), PadDisplayMode(), PNS::TOOL_BASE::pickSingleItem(), ToggleRatsnest(), TrackDisplayMode(), ViaDisplayMode(), and ZoneDisplayMode().

◆ doInteractiveItemPlacement()

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

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

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

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

Definition at line 36 of file pcb_tool_base.cpp.

39 {
40  using namespace std::placeholders;
41  std::unique_ptr<BOARD_ITEM> newItem;
42 
43  frame()->PushTool( aTool );
44  Activate();
45 
46  BOARD_COMMIT commit( frame() );
47 
49 
50  // do not capture or auto-pan until we start placing an item
51  controls()->ShowCursor( true );
52  controls()->SetSnapping( true );
53 
54  // Add a VIEW_GROUP that serves as a preview for the new item
55  PCBNEW_SELECTION preview;
56  view()->Add( &preview );
57 
58  aPlacer->m_board = board();
59  aPlacer->m_frame = frame();
60  aPlacer->m_modifiers = 0;
61 
62  auto makeNewItem = [&] ( VECTOR2I aPosition )
63  {
64  if( frame()->GetModel() )
65  newItem = aPlacer->CreateItem();
66 
67  if( newItem )
68  {
69  newItem->SetPosition( (wxPoint) aPosition );
70  preview.Add( newItem.get() );
71 
72  if( newItem->Type() == PCB_MODULE_T )
73  {
74  auto module = dyn_cast<MODULE*>( newItem.get() );
75 
76  // modules have more drawable parts
77  module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
78  }
79  }
80  };
81 
82  if( aOptions & IPO_SINGLE_CLICK )
83  makeNewItem( controls()->GetCursorPosition() );
84 
85  // Main loop: keep receiving events
86  while( TOOL_EVENT* evt = Wait() )
87  {
88  VECTOR2I cursorPos = controls()->GetCursorPosition();
89  aPlacer->m_modifiers = evt->Modifier();
90 
91  auto cleanup = [&] ()
92  {
93  newItem = nullptr;
94  preview.Clear();
95  view()->Update( &preview );
96  controls()->SetAutoPan( false );
97  controls()->CaptureCursor( false );
98  controls()->ShowCursor( true );
99  };
100 
101  if( evt->IsCancelInteractive() )
102  {
103  if( aOptions & IPO_SINGLE_CLICK )
104  {
105  cleanup();
106  frame()->PopTool( aTool );
107  break;
108  }
109  else if( newItem )
110  cleanup();
111  else
112  {
113  frame()->PopTool( aTool );
114  break;
115  }
116  }
117  else if( evt->IsActivate() )
118  {
119  if( newItem )
120  cleanup();
121 
122  if( evt->IsPointEditor() )
123  {
124  // don't exit (the point editor runs in the background)
125  }
126  else if( evt->IsMoveTool() )
127  {
128  // leave ourselves on the stack so we come back after the move
129  break;
130  }
131  else
132  {
133  frame()->PopTool( aTool );
134  break;
135  }
136  }
137  else if( evt->IsClick( BUT_LEFT ) )
138  {
139  if( !newItem )
140  {
141  // create the item if possible
142  makeNewItem( cursorPos );
143 
144  // no item created, so wait for another click
145  if( !newItem )
146  continue;
147 
148  controls()->CaptureCursor( true );
149  controls()->SetAutoPan( true );
150  }
151  else
152  {
153  auto oldFlags = newItem->GetFlags();
154  newItem->ClearFlags();
155 
156  if( !aPlacer->PlaceItem( newItem.get(), commit ) )
157  {
158  newItem->SetFlags( oldFlags );
159  continue;
160  }
161 
162  preview.Clear();
163  newItem.release();
164  commit.Push( aCommitMessage );
165 
166  controls()->CaptureCursor( false );
167  controls()->SetAutoPan( false );
168  controls()->ShowCursor( true );
169 
170  if( !( aOptions & IPO_REPEAT ) )
171  break;
172 
173  if( aOptions & IPO_SINGLE_CLICK )
174  makeNewItem( controls()->GetCursorPosition() );
175  }
176  }
177  else if( evt->IsClick( BUT_RIGHT ) )
178  {
180  }
181  else if( newItem && evt->Category() == TC_COMMAND )
182  {
183  /*
184  * Handle any events that can affect the item as we move it around
185  */
186  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) && ( aOptions & IPO_ROTATE ) )
187  {
188  const int rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *frame(), *evt );
189  newItem->Rotate( newItem->GetPosition(), rotationAngle );
190  view()->Update( &preview );
191  }
192  else if( evt->IsAction( &PCB_ACTIONS::flip ) && ( aOptions & IPO_FLIP ) )
193  {
194  newItem->Flip( newItem->GetPosition(), frame()->Settings().m_FlipLeftRight );
195  view()->Update( &preview );
196  }
197  else if( evt->IsAction( &PCB_ACTIONS::viaSizeInc )
198  || evt->IsAction( &PCB_ACTIONS::viaSizeDec ) )
199  {
200  // Refresh preview after event runs
202  }
203  else if( evt->IsAction( &ACTIONS::refreshPreview ) )
204  {
205  preview.Clear();
206  newItem.release();
207 
208  makeNewItem( controls()->GetCursorPosition() );
209  view()->Update( &preview );
210  }
211  }
212 
213  else if( newItem && evt->IsMotion() )
214  {
215  // track the cursor
216  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
217  aPlacer->SnapItem( newItem.get() );
218 
219  // Show a preview of the item
220  view()->Update( &preview );
221  }
222 
223  else
224  evt->SetPassEvent();
225  }
226 
227  view()->Remove( &preview );
228 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:73
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
virtual void Clear() override
Function Clear() Removes all the stored items from the group.
Definition: selection.h:94
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction)
Function RunOnChildren.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
virtual bool PlaceItem(BOARD_ITEM *aItem, BOARD_COMMIT &aCommit)
BOARD * board() const
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:91
static TOOL_ACTION viaSizeInc
Definition: pcb_actions.h:282
virtual std::unique_ptr< BOARD_ITEM > CreateItem()=0
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
bool IsRotateToolEvt(const TOOL_EVENT &aEvt)
Function isRotateToolEvt()
virtual void Remove(VIEW_ITEM *aItem) override
Function Remove() Removes a VIEW_ITEM from the view.
Definition: pcb_view.cpp:74
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:75
TOOL_MANAGER * GetManager() const
Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool.
Definition: tool_base.h:143
PCB_BASE_EDIT_FRAME * frame() const
virtual void SnapItem(BOARD_ITEM *aItem)
class MODULE, a footprint
Definition: typeinfo.h:89
const PCBNEW_SELECTION & selection() const
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
PCB_GENERAL_SETTINGS & Settings()
TOOL_EVENT.
Definition: tool_event.h:171
KIGFX::PCB_VIEW * view() const
virtual void Add(VIEW_ITEM *aItem)
Function Add() Adds an item to the group.
Definition: view_group.cpp:55
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
static TOOL_ACTION flip
Flipping of selected objects.
Definition: pcb_actions.h:111
KIGFX::VIEW_CONTROLS * controls() const
MODULE * module() const
virtual void PopTool(const std::string &actionName)
void Activate()
Function Activate() Runs the tool.
virtual BOARD_ITEM_CONTAINER * GetModel() const =0
Function GetModel()
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Function Add() Adds a VIEW_ITEM to the view.
Definition: pcb_view.cpp:58
PCB_BASE_EDIT_FRAME * m_frame
Definition: pcb_tool_base.h:58
int GetEventRotationAngle(const PCB_BASE_EDIT_FRAME &aFrame, const TOOL_EVENT &aEvt)
Function getEventRotationAngle()
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
static TOOL_ACTION viaSizeDec
Definition: pcb_actions.h:283
static TOOL_ACTION refreshPreview
Definition: actions.h:101
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.

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

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

◆ DoSetGridOrigin()

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

Definition at line 471 of file pcbnew_control.cpp.

473 {
474  aFrame->SetGridOrigin( wxPoint( aPoint.x, aPoint.y ) );
475  aView->GetGAL()->SetGridOrigin( aPoint );
476  originViewItem->SetPosition( wxPoint( aPoint.x, aPoint.y ) );
477  aView->MarkDirty();
478  aFrame->OnModify();
479 }
virtual void SetPosition(const wxPoint &aPos)=0
void SetGridOrigin(const wxPoint &aPoint) override
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:180
void SetGridOrigin(const VECTOR2D &aGridOrigin)
Set the origin point for the grid.
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:610

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

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

◆ EditingModules()

bool PCB_TOOL_BASE::EditingModules ( ) const
inlineinherited

◆ frame()

PCB_BASE_EDIT_FRAME* PCB_TOOL_BASE::frame ( ) const
inlineprotectedinherited

Definition at line 146 of file pcb_tool_base.h.

147  {
148  return getEditFrame<PCB_BASE_EDIT_FRAME>();
149  }

Referenced by POINT_EDITOR::addCorner(), MICROWAVE_TOOL::addMicrowaveFootprint(), AUTOPLACE_TOOL::autoplace(), PCB_TOOL_BASE::canvas(), ZONE_FILLER_TOOL::CheckAllZones(), PNS::TOOL_BASE::checkSnap(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), ROUTER_TOOL::CustomTrackWidthDialog(), MODULE_EDITOR_TOOLS::DeleteFootprint(), PCB_TOOL_BASE::displayOptions(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ROUTER_TOOL::DpDimensionsDialog(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), PCB_EDITOR_CONTROL::ExportSpecctraDSN(), ROUTER_TOOL::finishInteractive(), EDIT_TOOL::Flip(), PCB_EDITOR_CONTROL::FlipPcbView(), GLOBAL_EDIT_TOOL::GlobalDeletions(), MODULE_EDITOR_TOOLS::ImportFootprint(), PCB_EDITOR_CONTROL::ImportSpecctraSession(), SELECTION_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::onViaCommand(), Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PAD_TOOL::pushPadSettings(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), PNS::TOOL_BASE::Reset(), ROUTER_TOOL::SelectCopperLayerPair(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), POINT_EDITOR::setEditedPoint(), ROUTER_TOOL::SettingsDialog(), GLOBAL_EDIT_TOOL::swapBoardItem(), GLOBAL_EDIT_TOOL::SwapLayers(), ROUTER_TOOL::switchLayerOnViaPlacement(), POINT_EDITOR::updateItem(), ZONE_FILLER_TOOL::ZoneFill(), and ZONE_FILLER_TOOL::ZoneFillAll().

◆ getEditFrame()

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

Function getEditFrame()

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

Definition at line 187 of file tool_base.h.

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

References TOOL_BASE::getEditFrameInt().

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

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

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

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 121 of file tool_base.h.

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

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 143 of file tool_base.h.

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

References TOOL_BASE::m_toolMgr.

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

◆ getModel()

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

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 201 of file tool_base.h.

202  {
203  EDA_ITEM* m = getModelInt();
204 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
205  wxASSERT( dynamic_cast<T*>( m ) );
206 #endif
207  return static_cast<T*>( m );
208  }
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:54
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:163

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Function GetName() Returns the name of the tool.

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

Returns
The name of the tool.

Definition at line 132 of file tool_base.h.

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

References TOOL_BASE::m_toolName.

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

◆ GetSettings()

TOOL_SETTINGS & TOOL_BASE::GetSettings ( )
inherited

Definition at line 78 of file tool_base.cpp.

79 {
80  return m_toolSettings;
81 }
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:220

References TOOL_BASE::m_toolSettings.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 110 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

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

Function getView()

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

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

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

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

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), EE_SELECTION_TOOL::ClearSelection(), COMMON_TOOLS::CursorControl(), LIB_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), MICROWAVE_TOOL::drawMicrowaveInductor(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), COMMON_TOOLS::GridPreset(), GridResetOrigin(), GridSetOrigin(), SELECTION_TOOL::GuessSelectionCandidates(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCB_INSPECTION_TOOL::highlightNet(), EE_POINT_EDITOR::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), LIB_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PNS::TOOL_BASE::pickSingleItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), PCB_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), SELECTION_TOOL::Selectable(), GERBVIEW_SELECTION_TOOL::selectable(), EE_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), COMMON_TOOLS::ToggleGrid(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), updateGrid(), EE_POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_TOOL_BASE::view(), COMMON_TOOLS::ZoomFitScreen(), SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

◆ getViewControls()

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

Function getViewControls()

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

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

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

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

Referenced by EE_POINT_EDITOR::addCorner(), POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), COMMON_TOOLS::GridPreset(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::HighlightNetTool(), MODULE_EDITOR_TOOLS::ImportFootprint(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LIB_DRAWING_TOOLS::PlaceAnchor(), placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCBNEW_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), LIB_MOVE_TOOL::updateModificationPoint(), EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

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

Function Go()

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

Definition at line 129 of file tool_interactive.h.

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

References TOOL_INTERACTIVE::goInternal().

Referenced by LENGTH_TUNER_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_CONTROL::setTransitions(), LIB_PIN_TOOL::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), COMMON_CONTROL::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), LIB_MOVE_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), POINT_EDITOR::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), LIB_CONTROL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), PCB_INSPECTION_TOOL::setTransitions(), setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), MODULE_EDITOR_TOOLS::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), PCBNEW_PICKER_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), DRAWING_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), EE_SELECTION_TOOL::setTransitions(), and DRC::setTransitions().

◆ GraphicDisplayMode()

int PCBNEW_CONTROL::GraphicDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 210 of file pcbnew_control.cpp.

211 {
212  auto opts = displayOptions();
213 
214  Flip( opts.m_DisplayDrawItemsFill );
215  m_frame->SetDisplayOptions( opts );
216  view()->UpdateDisplayOptions( opts );
217 
218  for( auto item : board()->Drawings() )
219  {
220  view()->Update( item, KIGFX::GEOMETRY );
221  }
222 
223  canvas()->Refresh();
224 
225  return 0;
226 }
BOARD * board() const
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:91
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
void UpdateDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Definition: pcb_view.cpp:113
KIGFX::PCB_VIEW * view() const
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
const PCB_DISPLAY_OPTIONS & displayOptions() const
PCB_DRAW_PANEL_GAL * canvas() const
void Flip(T &aValue)
Color has changed.
Definition: view_item.h:57

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

Referenced by setTransitions().

◆ GridFast1()

int PCBNEW_CONTROL::GridFast1 ( const TOOL_EVENT aEvent)

Definition at line 455 of file pcbnew_control.cpp.

456 {
458  updateGrid();
459  return 0;
460 }
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
void SetFastGrid1()
Function SetFastGrid1()
void updateGrid()
Applies the legacy canvas grid settings for GAL.

References m_frame, PCB_BASE_FRAME::SetFastGrid1(), and updateGrid().

Referenced by setTransitions().

◆ GridFast2()

int PCBNEW_CONTROL::GridFast2 ( const TOOL_EVENT aEvent)

Definition at line 463 of file pcbnew_control.cpp.

464 {
466  updateGrid();
467  return 0;
468 }
void SetFastGrid2()
Function SetFastGrid2()
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
void updateGrid()
Applies the legacy canvas grid settings for GAL.

References m_frame, PCB_BASE_FRAME::SetFastGrid2(), and updateGrid().

Referenced by setTransitions().

◆ GridResetOrigin()

int PCBNEW_CONTROL::GridResetOrigin ( const TOOL_EVENT aEvent)

Definition at line 518 of file pcbnew_control.cpp.

519 {
521  DoSetGridOrigin( getView(), m_frame, m_gridOrigin.get(), VECTOR2D( 0, 0 ) );
522  return 0;
523 }
static void DoSetGridOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, BOARD_ITEM *originViewItem, const VECTOR2D &aPoint)
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Grid origin marker.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void SaveCopyInUndoList(BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))=0
Function SaveCopyInUndoList (virtual pure) Creates a new entry in undo list of commands.

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

Referenced by setTransitions().

◆ GridSetOrigin()

int PCBNEW_CONTROL::GridSetOrigin ( const TOOL_EVENT aEvent)

Definition at line 482 of file pcbnew_control.cpp.

483 {
484  VECTOR2D* origin = aEvent.Parameter<VECTOR2D*>();
485 
486  if( origin )
487  {
488  // We can't undo the other grid dialog settings, so no sense undoing just the origin
489  DoSetGridOrigin( getView(), m_frame, m_gridOrigin.get(), *origin );
490  delete origin;
491  }
492  else
493  {
494  if( m_editModules && !getEditFrame<PCB_BASE_EDIT_FRAME>()->GetModel() )
495  return 0;
496 
497  std::string tool = aEvent.GetCommandStr().get();
499 
500  // Deactivate other tools; particularly important if another PICKER is currently running
501  Activate();
502 
503  picker->SetClickHandler(
504  [this] ( const VECTOR2D& pt ) -> bool
505  {
507  DoSetGridOrigin( getView(), m_frame, m_gridOrigin.get(), pt );
508  return false; // drill origin is a one-shot; don't continue with tool
509  } );
510 
511  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
512  }
513 
514  return 0;
515 }
static void DoSetGridOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, BOARD_ITEM *originViewItem, const VECTOR2D &aPoint)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
static TOOL_ACTION pickerTool
Definition: actions.h:145
Generic tool for picking a point.
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Grid origin marker.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
virtual void SaveCopyInUndoList(BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))=0
Function SaveCopyInUndoList (virtual pure) Creates a new entry in undo list of commands.
void Activate()
Function Activate() Runs the tool.
void SetClickHandler(CLICK_HANDLER aHandler)
Function SetClickHandler() Sets a handler for mouse click event.

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

Referenced by setTransitions().

◆ HighContrastMode()

int PCBNEW_CONTROL::HighContrastMode ( const TOOL_EVENT aEvent)

Definition at line 306 of file pcbnew_control.cpp.

307 {
308  auto opts = displayOptions();
309 
310  Flip( opts.m_ContrastModeDisplay );
311  m_frame->SetDisplayOptions( opts );
312  view()->UpdateDisplayOptions( opts );
314 
315  return 0;
316 }
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
void UpdateDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Definition: pcb_view.cpp:113
KIGFX::PCB_VIEW * view() const
virtual void SetHighContrastLayer(int aLayer) override
const PCB_DISPLAY_OPTIONS & displayOptions() const
PCB_DRAW_PANEL_GAL * canvas() const
void Flip(T &aValue)

References PCB_TOOL_BASE::canvas(), PCB_TOOL_BASE::displayOptions(), Flip(), PCB_BASE_FRAME::GetActiveLayer(), m_frame, PCB_BASE_FRAME::SetDisplayOptions(), PCB_DRAW_PANEL_GAL::SetHighContrastLayer(), KIGFX::PCB_VIEW::UpdateDisplayOptions(), and PCB_TOOL_BASE::view().

Referenced by setTransitions().

◆ Init()

bool PCB_TOOL_BASE::Init ( )
overridevirtualinherited

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

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

Reimplemented from TOOL_BASE.

Reimplemented in EDIT_TOOL, SELECTION_TOOL, DRAWING_TOOL, POSITION_RELATIVE_TOOL, PCB_EDITOR_CONTROL, POINT_EDITOR, MODULE_EDITOR_TOOLS, GLOBAL_EDIT_TOOL, PAD_TOOL, PCB_INSPECTION_TOOL, and ROUTER_TOOL.

Definition at line 231 of file pcb_tool_base.cpp.

232 {
233  // A basic context manu. Many (but not all) tools will choose to override this.
234 
235  auto& ctxMenu = m_menu.GetMenu();
236 
237  // cancel current tool goes in main context menu at the top if present
239  ctxMenu.AddSeparator( 1 );
240 
241  // Finally, add the standard zoom/grid items
242  getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus( m_menu );
243 
244  return true;
245 }
static bool ShowAlways(const SELECTION &aSelection)
Function ShowAlways The default condition function (always returns true).
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()

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

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

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

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

◆ LayerAlphaDec()

int PCBNEW_CONTROL::LayerAlphaDec ( const TOOL_EVENT aEvent)

Definition at line 428 of file pcbnew_control.cpp.

429 {
430  auto& settings = m_frame->Settings().Colors();
431 
432  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
433  KIGFX::COLOR4D currentColor = settings.GetLayerColor( currentLayer );
434 
435  if( currentColor.a >= ALPHA_MIN + ALPHA_STEP )
436  {
437  currentColor.a -= ALPHA_STEP;
438  settings.SetLayerColor( currentLayer, currentColor );
439 
441  view->GetPainter()->GetSettings()->ImportLegacyColors( &settings );
442  view->UpdateLayerColor( currentLayer );
443 
444  wxUpdateUIEvent dummy;
445  static_cast<PCB_BASE_FRAME*>( m_frame )->OnUpdateLayerAlpha( dummy );
446  }
447  else
448  wxBell();
449 
450  return 0;
451 }
#define ALPHA_MIN
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
double a
Alpha component.
Definition: color4d.h:304
#define ALPHA_STEP
virtual void ImportLegacyColors(const COLORS_DESIGN_SETTINGS *aSettings)
Function ImportLegacyColors Loads a list of color settings for layers.
Definition: painter.h:67
PCB_GENERAL_SETTINGS & Settings()
KIGFX::PCB_VIEW * view() const
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
COLORS_DESIGN_SETTINGS & Colors()
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
void UpdateLayerColor(int aLayer)
Function UpdateLayerColor() Applies the new coloring scheme held by RENDER_SETTINGS in case that it h...
Definition: view.cpp:777
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
VIEW.
Definition: view.h:61
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References KIGFX::COLOR4D::a, ALPHA_MIN, ALPHA_STEP, PCB_GENERAL_SETTINGS::Colors(), dummy(), PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetCanvas(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), PCB_DRAW_PANEL_GAL::GetView(), KIGFX::RENDER_SETTINGS::ImportLegacyColors(), m_frame, PCB_BASE_FRAME::Settings(), KIGFX::VIEW::UpdateLayerColor(), and PCB_TOOL_BASE::view().

Referenced by setTransitions().

◆ LayerAlphaInc()

int PCBNEW_CONTROL::LayerAlphaInc ( const TOOL_EVENT aEvent)

Definition at line 402 of file pcbnew_control.cpp.

403 {
404  auto& settings = m_frame->Settings().Colors();
405 
406  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
407  KIGFX::COLOR4D currentColor = settings.GetLayerColor( currentLayer );
408 
409  if( currentColor.a <= ALPHA_MAX - ALPHA_STEP )
410  {
411  currentColor.a += ALPHA_STEP;
412  settings.SetLayerColor( currentLayer, currentColor );
413 
415  view->GetPainter()->GetSettings()->ImportLegacyColors( &settings );
416  view->UpdateLayerColor( currentLayer );
417 
418  wxUpdateUIEvent dummy;
419  static_cast<PCB_EDIT_FRAME*>( m_frame )->OnUpdateLayerAlpha( dummy );
420  }
421  else
422  wxBell();
423 
424  return 0;
425 }
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
double a
Alpha component.
Definition: color4d.h:304
#define ALPHA_STEP
virtual void ImportLegacyColors(const COLORS_DESIGN_SETTINGS *aSettings)
Function ImportLegacyColors Loads a list of color settings for layers.
Definition: painter.h:67
PCB_GENERAL_SETTINGS & Settings()
KIGFX::PCB_VIEW * view() const
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
COLORS_DESIGN_SETTINGS & Colors()
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
void UpdateLayerColor(int aLayer)
Function UpdateLayerColor() Applies the new coloring scheme held by RENDER_SETTINGS in case that it h...
Definition: view.cpp:777
#define ALPHA_MAX
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
VIEW.
Definition: view.h:61
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References KIGFX::COLOR4D::a, ALPHA_MAX, ALPHA_STEP, PCB_GENERAL_SETTINGS::Colors(), dummy(), PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetCanvas(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), PCB_DRAW_PANEL_GAL::GetView(), KIGFX::RENDER_SETTINGS::ImportLegacyColors(), m_frame, PCB_BASE_FRAME::Settings(), KIGFX::VIEW::UpdateLayerColor(), and PCB_TOOL_BASE::view().

Referenced by setTransitions().

◆ LayerNext()

int PCBNEW_CONTROL::LayerNext ( const TOOL_EVENT aEvent)

Definition at line 328 of file pcbnew_control.cpp.

329 {
330  PCB_BASE_FRAME* editFrame = m_frame;
331  BOARD* brd = board();
332  LAYER_NUM layer = editFrame->GetActiveLayer();
333  LAYER_NUM startLayer = layer;
334 
335  if( layer < F_Cu || layer > B_Cu )
336  return 0;
337 
338  while( startLayer != ++layer )
339  {
340  if( brd->IsLayerVisible( static_cast<PCB_LAYER_ID>( layer ) ) && IsCopperLayer( layer ) )
341  break;
342 
343  if( layer >= B_Cu )
344  layer = F_Cu - 1;
345  }
346 
347  wxCHECK( IsCopperLayer( layer ), 0 );
348  editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
349 
350  return 0;
351 }
BOARD * board() const
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
#define NULL
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
virtual void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer)
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
Function IsLayerVisible is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:449
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:160
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:823
PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.

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

Referenced by setTransitions().

◆ LayerPrev()

int PCBNEW_CONTROL::LayerPrev ( const TOOL_EVENT aEvent)

Definition at line 354 of file pcbnew_control.cpp.

355 {
356  PCB_BASE_FRAME* editFrame = m_frame;
357  BOARD* brd = board();
358  LAYER_NUM layer = editFrame->GetActiveLayer();
359  LAYER_NUM startLayer = layer;
360 
361  if( layer < F_Cu || layer > B_Cu )
362  return 0;
363 
364  while( startLayer != --layer )
365  {
366  if( IsCopperLayer( layer ) // also test for valid layer id (layer >= F_Cu)
367  && brd->IsLayerVisible( static_cast<PCB_LAYER_ID>( layer ) ) )
368  break;
369 
370  if( layer <= F_Cu )
371  layer = B_Cu + 1;
372  }
373 
374 
375  wxCHECK( IsCopperLayer( layer ), 0 );
376  editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
377 
378  return 0;
379 }
BOARD * board() const
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
#define NULL
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
virtual void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer)
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
Function IsLayerVisible is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:449
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:160
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:823
PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.

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

Referenced by setTransitions().

◆ LayerSwitch()

int PCBNEW_CONTROL::LayerSwitch ( const TOOL_EVENT aEvent)

Definition at line 320 of file pcbnew_control.cpp.

321 {
323 
324  return 0;
325 }
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
PCB_LAYER_ID
A quick note on layer IDs:
#define NULL
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
virtual void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer)

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

Referenced by setTransitions().

◆ LayerToggle()

int PCBNEW_CONTROL::LayerToggle ( const TOOL_EVENT aEvent)

Definition at line 382 of file pcbnew_control.cpp.

383 {
384  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
385  PCB_SCREEN* screen = m_frame->GetScreen();
386 
387  if( currentLayer == screen->m_Route_Layer_TOP )
389  else
391 
392  return 0;
393 }
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
#define NULL
PCB_LAYER_ID m_Route_Layer_BOTTOM
Definition: pcb_screen.h:46
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
virtual void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer)
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
PCB_LAYER_ID m_Route_Layer_TOP
Definition: pcb_screen.h:45

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

Referenced by setTransitions().

◆ module()

◆ ModuleEdgeOutlines()

int PCBNEW_CONTROL::ModuleEdgeOutlines ( const TOOL_EVENT aEvent)

Definition at line 229 of file pcbnew_control.cpp.

230 {
231  auto opts = displayOptions();
232 
233  Flip( opts.m_DisplayModEdgeFill );
234  m_frame->SetDisplayOptions( opts );
235  view()->UpdateDisplayOptions( opts );
236 
237  for( auto module : board()->Modules() )
238  {
239  for( auto item : module->GraphicalItems() )
240  {
241  if( item->Type() == PCB_MODULE_EDGE_T )
242  view()->Update( item, KIGFX::GEOMETRY );
243  }
244  }
245 
246  canvas()->Refresh();
247 
248  return 0;
249 }
BOARD * board() const
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:91
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
DRAWINGS & GraphicalItems()
Definition: class_module.h:183
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
void UpdateDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Definition: pcb_view.cpp:113
KIGFX::PCB_VIEW * view() const
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
const PCB_DISPLAY_OPTIONS & displayOptions() const
MODULE * module() const
PCB_DRAW_PANEL_GAL * canvas() const
void Flip(T &aValue)
Color has changed.
Definition: view_item.h:57

References PCB_TOOL_BASE::board(), PCB_TOOL_BASE::canvas(), PCB_TOOL_BASE::displayOptions(), Flip(), KIGFX::GEOMETRY, MODULE::GraphicalItems(), m_frame, PCB_TOOL_BASE::module(), PCB_MODULE_EDGE_T, EDA_DRAW_PANEL_GAL::Refresh(), PCB_BASE_FRAME::SetDisplayOptions(), KIGFX::PCB_VIEW::Update(), KIGFX::PCB_VIEW::UpdateDisplayOptions(), and PCB_TOOL_BASE::view().

Referenced by setTransitions().

◆ ModuleTextOutlines()

int PCBNEW_CONTROL::ModuleTextOutlines ( const TOOL_EVENT aEvent)

Definition at line 252 of file pcbnew_control.cpp.

253 {
254  auto opts = displayOptions();
255 
256  Flip( opts.m_DisplayModTextFill );
257  m_frame->SetDisplayOptions( opts );
258  view()->UpdateDisplayOptions( opts );
259 
260  for( auto module : board()->Modules() )
261  {
264 
265  for( auto item : module->GraphicalItems() )
266  {
267  if( item->Type() == PCB_MODULE_TEXT_T )
268  view()->Update( item, KIGFX::GEOMETRY );
269  }
270  }
271 
272  canvas()->Refresh();
273 
274  return 0;
275 }
TEXTE_MODULE & Reference()
Definition: class_module.h:477
BOARD * board() const
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:91
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
DRAWINGS & GraphicalItems()
Definition: class_module.h:183
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
void UpdateDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Definition: pcb_view.cpp:113
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:476
KIGFX::PCB_VIEW * view() const
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
const PCB_DISPLAY_OPTIONS & displayOptions() const
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
MODULE * module() const
PCB_DRAW_PANEL_GAL * canvas() const
void Flip(T &aValue)
Color has changed.
Definition: view_item.h:57

References PCB_TOOL_BASE::board(), PCB_TOOL_BASE::canvas(), PCB_TOOL_BASE::displayOptions(), Flip(), KIGFX::GEOMETRY, MODULE::GraphicalItems(), m_frame, PCB_TOOL_BASE::module(), PCB_MODULE_TEXT_T, MODULE::Reference(), EDA_DRAW_PANEL_GAL::Refresh(), PCB_BASE_FRAME::SetDisplayOptions(), KIGFX::PCB_VIEW::Update(), KIGFX::PCB_VIEW::UpdateDisplayOptions(), MODULE::Value(), and PCB_TOOL_BASE::view().

Referenced by setTransitions().

◆ PadDisplayMode()

int PCBNEW_CONTROL::PadDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 170 of file pcbnew_control.cpp.

171 {
172  auto opts = displayOptions();
173 
174  Flip( opts.m_DisplayPadFill );
175  m_frame->SetDisplayOptions( opts );
176  view()->UpdateDisplayOptions( opts );
177 
178  for( auto module : board()->Modules() ) // fixme: move to PCB_VIEW
179  {
180  for( auto pad : module->Pads() )
181  view()->Update( pad, KIGFX::GEOMETRY );
182  }
183 
184  canvas()->Refresh();
185 
186  return 0;
187 }
BOARD * board() const
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:91
PADS & Pads()
Definition: class_module.h:173
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
void UpdateDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Definition: pcb_view.cpp:113
KIGFX::PCB_VIEW * view() const
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
const PCB_DISPLAY_OPTIONS & displayOptions() const
MODULE * module() const
PCB_DRAW_PANEL_GAL * canvas() const
void Flip(T &aValue)
Color has changed.
Definition: view_item.h:57

References PCB_TOOL_BASE::board(), PCB_TOOL_BASE::canvas(), PCB_TOOL_BASE::displayOptions(), Flip(), KIGFX::GEOMETRY, m_frame, PCB_TOOL_BASE::module(), MODULE::Pads(), EDA_DRAW_PANEL_GAL::Refresh(), PCB_BASE_FRAME::SetDisplayOptions(), KIGFX::PCB_VIEW::Update(), KIGFX::PCB_VIEW::UpdateDisplayOptions(), and PCB_TOOL_BASE::view().

Referenced by setTransitions().

◆ Paste()

int PCBNEW_CONTROL::Paste ( const TOOL_EVENT aEvent)

Definition at line 621 of file pcbnew_control.cpp.

622 {
623  CLIPBOARD_IO pi;
624  BOARD_ITEM* clipItem = pi.Parse();
625 
626  if( !clipItem )
627  return 0;
628 
629  if( clipItem->Type() == PCB_T )
630  static_cast<BOARD*>( clipItem )->MapNets( m_frame->GetBoard() );
631 
632  bool editModules = m_editModules || frame()->IsType( FRAME_FOOTPRINT_EDITOR );
633 
634  // The clipboard can contain two different things, an entire kicad_pcb
635  // or a single module
636 
637  if( editModules && ( !board() || !module() ) )
638  {
639  wxLogDebug( wxT( "Attempting to paste to empty module editor window\n") );
640  return 0;
641  }
642 
643  switch( clipItem->Type() )
644  {
645  case PCB_T:
646  {
647  BOARD* clipBoard = static_cast<BOARD*>( clipItem );
648 
649  if( editModules )
650  {
651  MODULE* editModule = board()->GetFirstModule();
652  std::vector<BOARD_ITEM*> pastedItems;
653 
654  for( MODULE* clipModule : clipBoard->Modules() )
655  {
656  clipModule->SetParent( board() );
657 
658  for( auto pad : clipModule->Pads() )
659  {
660  pad->SetParent( editModule );
661  pastedItems.push_back( pad );
662  }
663 
664  clipModule->Pads().clear();
665 
666  for( auto item : clipModule->GraphicalItems() )
667  {
668  item->SetParent( editModule );
669  pastedItems.push_back( item );
670  }
671 
672  clipModule->GraphicalItems().clear();
673  }
674 
675  for( BOARD_ITEM* clipDrawItem : clipBoard->Drawings() )
676  {
677  if( clipDrawItem->Type() == PCB_LINE_T )
678  {
679  DRAWSEGMENT* clipDrawSeg = static_cast<DRAWSEGMENT*>( clipDrawItem );
680 
681  // Convert to PCB_MODULE_EDGE_T
682  EDGE_MODULE* pastedDrawSeg = new EDGE_MODULE( editModule );
683  static_cast<DRAWSEGMENT*>( pastedDrawSeg )->SwapData( clipDrawSeg );
684  pastedDrawSeg->SetLocalCoord();
685 
686  pastedItems.push_back( pastedDrawSeg );
687  }
688  else if( clipDrawItem->Type() == PCB_TEXT_T )
689  {
690  TEXTE_PCB* clipTextItem = static_cast<TEXTE_PCB*>( clipDrawItem );
691 
692  // Convert to PCB_MODULE_TEXT_T
693  TEXTE_MODULE* pastedTextItem = new TEXTE_MODULE( editModule );
694  static_cast<EDA_TEXT*>( pastedTextItem )->SwapText( *clipTextItem );
695  static_cast<EDA_TEXT*>( pastedTextItem )->SwapEffects( *clipTextItem );
696 
697  pastedItems.push_back( pastedTextItem );
698  }
699  }
700 
701  delete clipBoard;
702 
703  placeBoardItems( pastedItems, true, true );
704  }
705  else
706  {
707  placeBoardItems( clipBoard, true );
708 
709  m_frame->Compile_Ratsnest( true );
711  }
712 
713  break;
714  }
715 
716  case PCB_MODULE_T:
717  {
718  MODULE* clipModule = static_cast<MODULE*>( clipItem );
719  std::vector<BOARD_ITEM*> pastedItems;
720 
721  if( editModules )
722  {
723  MODULE* editModule = board()->GetFirstModule();
724 
725  for( auto pad : clipModule->Pads() )
726  {
727  pad->SetParent( editModule );
728  pastedItems.push_back( pad );
729  }
730 
731  clipModule->Pads().clear();
732 
733  for( auto item : clipModule->GraphicalItems() )
734  {
735  item->SetParent( editModule );
736  pastedItems.push_back( item );
737  }
738 
739  clipModule->GraphicalItems().clear();
740 
741  delete clipModule;
742  }
743  else
744  {
745  clipModule->SetParent( board() );
746  pastedItems.push_back( clipModule );
747  }
748 
749  placeBoardItems( pastedItems, true, true );
750  break;
751  }
752 
753  default:
754  m_frame->DisplayToolMsg( _( "Invalid clipboard contents" ) );
755  break;
756  }
757 
758  return 1;
759 }
BOARD_ITEM * Parse()
Definition: typeinfo.h:85
BOARD * board() const
void Compile_Ratsnest(bool aDisplayStatus)
Function Compile_Ratsnest Create the entire board ratsnest.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
PADS & Pads()
Definition: class_module.h:173
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
DRAWINGS & GraphicalItems()
Definition: class_module.h:183
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
PCB_BASE_EDIT_FRAME * frame() const
class MODULE, a footprint
Definition: typeinfo.h:89
MODULES & Modules()
Definition: class_board.h:226
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:216
MODULE * GetFirstModule() const
Gets the first module in the list (used in footprint viewer/editor) or NULL if none.
Definition: class_board.h:275
void BuildConnectivity()
Builds or rebuilds the board connectivity database for the board, especially the list of connected it...
void SetLocalCoord()
Set relative coordinates from draw coordinates.
bool IsType(FRAME_T aType) const
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:160
MODULE * module() const
#define _(s)
Definition: 3d_actions.cpp:31
int placeBoardItems(std::vector< BOARD_ITEM * > &aItems, bool aIsNew, bool aAnchorAtOrigin)
Add and select or just select for move/place command a list of board items.
BOARD * GetBoard() const
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
DRAWINGS & Drawings()
Definition: class_board.h:235
void DisplayToolMsg(const wxString &msg) override
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207

References _, PCB_TOOL_BASE::board(), BOARD::BuildConnectivity(), PCB_BASE_FRAME::Compile_Ratsnest(), EDA_DRAW_FRAME::DisplayToolMsg(), BOARD::Drawings(), PCB_TOOL_BASE::frame(), FRAME_FOOTPRINT_EDITOR, PCB_BASE_FRAME::GetBoard(), BOARD::GetFirstModule(), MODULE::GraphicalItems(), EDA_BASE_FRAME::IsType(), PCB_TOOL_BASE::m_editModules, m_frame, PCB_TOOL_BASE::module(), BOARD::Modules(), MODULE::Pads(), CLIPBOARD_IO::Parse(), PCB_LINE_T, PCB_MODULE_T, PCB_T, PCB_TEXT_T, placeBoardItems(), EDGE_MODULE::SetLocalCoord(), EDA_ITEM::SetParent(), and EDA_ITEM::Type().

Referenced by setTransitions().

◆ placeBoardItems() [1/2]

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

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

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

Definition at line 853 of file pcbnew_control.cpp.

855 {
857 
858  auto selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
859  auto editTool = m_toolMgr->GetTool<EDIT_TOOL>();
860 
861  PCBNEW_SELECTION& selection = selectionTool->GetSelection();
862 
863  for( auto item : aItems )
864  {
865  item->SetSelected();
866  selection.Add( item );
867 
868  // Add or just select items for the move/place command
869  if( aIsNew )
870  editTool->GetCurrentCommit()->Add( item );
871  else
872  editTool->GetCurrentCommit()->Added( item );
873  }
874 
875  if( selection.Size() > 0 )
876  {
877  if( aAnchorAtOrigin )
878  {
880  }
881  else
882  {
883  BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.GetTopLeftItem() );
885  }
886 
887  getViewControls()->SetCursorPosition( getViewControls()->GetMousePosition(), false );
888 
891  }
892 
893  return 0;
894 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:73
static const TOOL_EVENT SelectedEvent
Definition: actions.h:197
static TOOL_ACTION move
move or drag an item
Definition: pcb_actions.h:103
EDA_ITEM * GetTopLeftItem(bool onlyModules=false) const override
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Moves cursor to the requested position expressed in world coordinates.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:75
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:244
const PCBNEW_SELECTION & selection() const
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
EDIT_TOOL.
Definition: edit_tool.h:66
virtual const wxPoint GetPosition() const =0
int Size() const
Returns the number of selected parts.
Definition: selection.h:126
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42

References SELECTION::Add(), BOARD_ITEM::GetPosition(), TOOL_MANAGER::GetTool(), PCBNEW_SELECTION::GetTopLeftItem(), TOOL_BASE::getViewControls(), TOOL_BASE::m_toolMgr, PCB_ACTIONS::move, TOOL_MANAGER::ProcessEvent(), TOOL_MANAGER::RunAction(), EVENTS::SelectedEvent, PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionClear, KIGFX::VIEW_CONTROLS::SetCursorPosition(), SELECTION::SetReferencePoint(), and SELECTION::Size().

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

◆ placeBoardItems() [2/2]

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

Definition at line 838 of file pcbnew_control.cpp.

839 {
840  // items are new if the current board is not the board source
841  bool isNew = board() != aBoard;
842  std::vector<BOARD_ITEM*> items;
843 
844  moveNoFlagToVector( aBoard->Tracks(), items, isNew );
845  moveNoFlagToVector( aBoard->Modules(), items, isNew );
846  moveNoFlagToVector( aBoard->Drawings(), items, isNew );
847  moveNoFlagToVector( aBoard->Zones(), items, isNew );
848 
849  return placeBoardItems( items, isNew, aAnchorAtOrigin );
850 }
BOARD * board() const
static void moveNoFlagToVector(std::deque< T > &aList, std::vector< BOARD_ITEM * > &aTarget, bool aIsNew)
MODULES & Modules()
Definition: class_board.h:226
ZONE_CONTAINERS & Zones()
Definition: class_board.h:240
int placeBoardItems(std::vector< BOARD_ITEM * > &aItems, bool aIsNew, bool aAnchorAtOrigin)
Add and select or just select for move/place command a list of board items.
DRAWINGS & Drawings()
Definition: class_board.h:235
TRACKS & Tracks()
Definition: class_board.h:217

References PCB_TOOL_BASE::board(), BOARD::Drawings(), BOARD::Modules(), moveNoFlagToVector(), placeBoardItems(), BOARD::Tracks(), and BOARD::Zones().

◆ Print()

int PCBNEW_CONTROL::Print ( const TOOL_EVENT aEvent)

Definition at line 327 of file dialog_print_pcbnew.cpp.

328 {
329  // Selection affects the origin item visibility
331 
333  DIALOG_PRINT_PCBNEW dlg( (PCB_BASE_EDIT_FRAME*) m_frame, &settings );
334 
335  if( m_editModules )
336  dlg.ForcePrintBorder( false );
337 
338  dlg.ShowModal();
339 
340  return 0;
341 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:73
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
Common, abstract interface for edit frames.
const PAGE_INFO & GetPageSettings() const override

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

Referenced by setTransitions().

◆ Quit()

int PCBNEW_CONTROL::Quit ( const TOOL_EVENT aEvent)

Definition at line 110 of file pcbnew_control.cpp.

111 {
112  m_frame->Close( false );
113  return 0;
114 }
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.

References m_frame.

Referenced by setTransitions().

◆ Redo()

int PCBNEW_CONTROL::Redo ( const TOOL_EVENT aEvent)

Definition at line 986 of file pcbnew_control.cpp.

987 {
988  PCB_BASE_EDIT_FRAME* editFrame = dynamic_cast<PCB_BASE_EDIT_FRAME*>( m_frame );
989  wxCommandEvent dummy;
990 
991  if( editFrame )
992  editFrame->RestoreCopyFromRedoList( dummy );
993 
994  return 0;
995 }
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
Common, abstract interface for edit frames.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
void RestoreCopyFromRedoList(wxCommandEvent &aEvent)
Function RestoreCopyFromRedoList Redo the last edit:
Definition: undo_redo.cpp:361

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

Referenced by setTransitions().

◆ Reset()

void PCBNEW_CONTROL::Reset ( RESET_REASON  aReason)
overridevirtual

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

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

Parameters
aReasoncontains information about the reason of tool reset.

Reimplemented from PCB_TOOL_BASE.

Definition at line 82 of file pcbnew_control.cpp.

83 {
84  m_frame = getEditFrame<PCB_BASE_FRAME>();
85 
86  if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
87  {
88  m_gridOrigin->SetPosition( board()->GetGridOrigin() );
89  m_gridOrigin->SetColor( m_frame->GetGridColor() );
90  getView()->Remove( m_gridOrigin.get() );
91  getView()->Add( m_gridOrigin.get() );
92  }
93 }
BOARD * board() const
Model changes (required full reload)
Definition: tool_base.h:82
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
virtual COLOR4D GetGridColor()
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Grid origin marker.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
Rendering engine changes.
Definition: tool_base.h:83

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

◆ RunMainStack()

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

Function RunMainStack()

Calls a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

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

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

Referenced by DRAWING_TOOL::PlaceText().

◆ selection() [1/2]

const PCBNEW_SELECTION & PCB_TOOL_BASE::selection ( ) const
protectedinherited

Definition at line 269 of file pcb_tool_base.cpp.

270 {
271  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
272  const auto& selection = selTool->GetSelection();
273  return selection;
274 }
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
const PCBNEW_SELECTION & selection() const

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

Referenced by AUTOPLACE_TOOL::autoplaceSelected(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), EDIT_TOOL::ChangeTrackWidth(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawZone(), EDIT_TOOL::Duplicate(), EDIT_TOOL::EditFpInFpEditor(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::filterSelection(), EDIT_TOOL::Flip(), DRAWING_TOOL::getSourceZoneForAction(), PCB_INSPECTION_TOOL::highlightNet(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::Move(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), PAD_TOOL::pastePadProperties(), placeBoardItems(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EDIT_TOOL::Rotate(), PCB_TOOL_BASE::selection(), SELECTION_TOOL::selectNet(), DRAWING_TOOL::SetAnchor(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), PCB_EDITOR_CONTROL::ZoneDuplicate(), ZONE_FILLER_TOOL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfill().

◆ selection() [2/2]

PCBNEW_SELECTION & PCB_TOOL_BASE::selection ( )
protectedinherited

Definition at line 277 of file pcb_tool_base.cpp.

278 {
279  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
280  auto& selection = selTool->GetSelection();
281  return selection;
282 }
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
const PCBNEW_SELECTION & selection() const

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

◆ SetContextMenu()

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

Function SetContextMenu()

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

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

Definition at line 76 of file tool_interactive.cpp.

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

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

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

◆ SetEditModules()

void PCB_TOOL_BASE::SetEditModules ( bool  aEnabled)
inlineinherited

Function SetEditModules()

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

Parameters
aEnableddecides if the mode should be enabled.

Definition at line 97 of file pcb_tool_base.h.

98  {
99  m_editModules = aEnabled;
100  }

References PCB_TOOL_BASE::m_editModules.

◆ setTransitions()

void PCBNEW_CONTROL::setTransitions ( )
overridevirtual

Sets up handlers for various events.

Reimplemented from PCB_TOOL_BASE.

Definition at line 1095 of file pcbnew_control.cpp.

1096 {
1099  Go( &PCBNEW_CONTROL::Print, ACTIONS::print.MakeEvent() );
1100  Go( &PCBNEW_CONTROL::Quit, ACTIONS::quit.MakeEvent() );
1101 
1102  // Display modes
1116 
1117  // Layer control
1155 
1156  // Grid control
1161 
1162  Go( &PCBNEW_CONTROL::Undo, ACTIONS::undo.MakeEvent() );
1163  Go( &PCBNEW_CONTROL::Redo, ACTIONS::redo.MakeEvent() );
1164 
1165  // Miscellaneous
1168 
1169  // Append control
1171 
1172  Go( &PCBNEW_CONTROL::Paste, ACTIONS::paste.MakeEvent() );
1173 
1178 }
static TOOL_ACTION layerBottom
Definition: pcb_actions.h:268
static TOOL_ACTION layerInner26
Definition: pcb_actions.h:263
static TOOL_ACTION show3DViewer
Definition: actions.h:148
static const TOOL_EVENT SelectedEvent
Definition: actions.h:197
int PadDisplayMode(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerNext
Definition: pcb_actions.h:269
int ToggleRatsnest(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner2
Definition: pcb_actions.h:239
static TOOL_ACTION layerInner5
Definition: pcb_actions.h:242
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:198
static TOOL_ACTION layerInner6
Definition: pcb_actions.h:243
static TOOL_ACTION layerInner7
Definition: pcb_actions.h:244
static TOOL_ACTION layerInner8
Definition: pcb_actions.h:245
int AddLibrary(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner21
Definition: pcb_actions.h:258
static TOOL_ACTION ratsnestLineMode
Definition: pcb_actions.h:226
static TOOL_ACTION layerAlphaDec
Definition: pcb_actions.h:272
static TOOL_ACTION gridResetOrigin
Definition: actions.h:130
int LayerAlphaInc(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoneDisplayOutlines
Definition: pcb_actions.h:233
int Quit(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerAlphaInc
Definition: pcb_actions.h:271
static TOOL_ACTION zoneDisplayDisable
Definition: pcb_actions.h:232
int HighContrastMode(const TOOL_EVENT &aEvent)
int ModuleEdgeOutlines(const TOOL_EVENT &aEvent)
int LayerPrev(const TOOL_EVENT &aEvent)
static TOOL_ACTION gridFast1
Definition: actions.h:125
int Paste(const TOOL_EVENT &aEvent)
int GridSetOrigin(const TOOL_EVENT &aEvent)
static TOOL_ACTION print
Definition: actions.h:60
static TOOL_ACTION layerInner3
Definition: pcb_actions.h:240
static TOOL_ACTION layerInner24
Definition: pcb_actions.h:261
int LayerNext(const TOOL_EVENT &aEvent)
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
static TOOL_ACTION layerInner11
Definition: pcb_actions.h:248
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:201
static TOOL_ACTION layerTop
Definition: pcb_actions.h:237
static TOOL_ACTION layerInner23
Definition: pcb_actions.h:260
static TOOL_ACTION appendBoard
Definition: pcb_actions.h:413
static TOOL_ACTION zoneDisplayToggle
Definition: pcb_actions.h:234
static TOOL_ACTION gridFast2
Definition: actions.h:126
static TOOL_ACTION layerInner13
Definition: pcb_actions.h:250
static TOOL_ACTION layerPrev
Definition: pcb_actions.h:270
int GridResetOrigin(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner25
Definition: pcb_actions.h:262
int GraphicDisplayMode(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner18
Definition: pcb_actions.h:255
int Show3DViewer(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner30
Definition: pcb_actions.h:267
static TOOL_ACTION layerInner29
Definition: pcb_actions.h:266
static TOOL_ACTION showRatsnest
Definition: pcb_actions.h:225
int LayerToggle(const TOOL_EVENT &aEvent)
static TOOL_ACTION addLibrary
Definition: actions.h:52
static TOOL_ACTION quit
Definition: actions.h:62
static TOOL_ACTION layerInner10
Definition: pcb_actions.h:247
static const TOOL_EVENT ClearedEvent
Definition: actions.h:199
int ZoneDisplayMode(const TOOL_EVENT &aEvent)
int GridFast1(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner15
Definition: pcb_actions.h:252
static TOOL_ACTION newLibrary
Definition: actions.h:51
static TOOL_ACTION layerInner28
Definition: pcb_actions.h:265
int ModuleTextOutlines(const TOOL_EVENT &aEvent)
int AppendBoardFromFile(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner27
Definition: pcb_actions.h:264
static TOOL_ACTION moduleEdgeOutlines
Display module edges as outlines.
Definition: pcb_actions.h:369
static TOOL_ACTION layerInner17
Definition: pcb_actions.h:254
int Redo(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner20
Definition: pcb_actions.h:257
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:228
static TOOL_ACTION viaDisplayMode
Definition: pcb_actions.h:229
static TOOL_ACTION moduleTextOutlines
Display module texts as lines.
Definition: pcb_actions.h:372
static TOOL_ACTION redo
Definition: actions.h:68
static TOOL_ACTION layerInner22
Definition: pcb_actions.h:259
int LayerAlphaDec(const TOOL_EVENT &aEvent)
int ViaDisplayMode(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner14
Definition: pcb_actions.h:251
static TOOL_ACTION layerInner9
Definition: pcb_actions.h:246
int TrackDisplayMode(const TOOL_EVENT &aEvent)
static TOOL_ACTION graphicDisplayMode
Definition: pcb_actions.h:230
static TOOL_ACTION layerInner16
Definition: pcb_actions.h:253
static TOOL_ACTION deleteTool
Definition: actions.h:75
int DeleteItemCursor(const TOOL_EVENT &aEvent)
int Undo(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner4
Definition: pcb_actions.h:241
int GridFast2(const TOOL_EVENT &aEvent)
static TOOL_ACTION undo
Definition: actions.h:67
static TOOL_ACTION gridSetOrigin
Definition: actions.h:129
static TOOL_ACTION layerInner19
Definition: pcb_actions.h:256
int LayerSwitch(const TOOL_EVENT &aEvent)
int UpdateMessagePanel(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner1
Definition: pcb_actions.h:238
static TOOL_ACTION highContrastMode
Definition: actions.h:99
static TOOL_ACTION paste
Definition: actions.h:71
int Print(const TOOL_EVENT &aEvent)
static TOOL_ACTION trackDisplayMode
Definition: pcb_actions.h:227
static TOOL_ACTION layerInner12
Definition: pcb_actions.h:249
static TOOL_ACTION layerToggle
Definition: pcb_actions.h:273
static TOOL_ACTION zoneDisplayEnable
Definition: pcb_actions.h:231

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

◆ Show3DViewer()

int PCBNEW_CONTROL::Show3DViewer ( const TOOL_EVENT aEvent)

Definition at line 998 of file pcbnew_control.cpp.

999 {
1000  EDA_3D_VIEWER* draw3DFrame = m_frame->CreateAndShow3D_Frame();
1001 
1002  // Suppress warnings on non-Mac systems
1003  [&draw3DFrame] {}();
1004 
1008  {
1009  m_frame->Update3DView( true );
1010 
1011 #ifdef __WXMAC__
1012  // A stronger version of Raise() which promotes the window to its parent's level.
1013  draw3DFrame->ReparentQuasiModal();
1014 #endif
1015  }
1016 
1017  return 0;
1018 }
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
EDA_3D_VIEWER * CreateAndShow3D_Frame()
Shows the 3D view frame.
bool IsType(FRAME_T aType) const
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
Definition: eda_3d_viewer.h:56
virtual void Update3DView(bool aForceReload, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.

References PCB_BASE_FRAME::CreateAndShow3D_Frame(), FRAME_FOOTPRINT_VIEWER, FRAME_FOOTPRINT_VIEWER_MODAL, FRAME_FOOTPRINT_WIZARD, EDA_BASE_FRAME::IsType(), m_frame, and PCB_BASE_FRAME::Update3DView().

Referenced by setTransitions().

◆ ToggleRatsnest()

int PCBNEW_CONTROL::ToggleRatsnest ( const TOOL_EVENT aEvent)

Definition at line 142 of file pcbnew_control.cpp.

143 {
144  auto opts = displayOptions();
145 
146  if( aEvent.IsAction( &PCB_ACTIONS::showRatsnest ) )
147  {
148  // N.B. Do not disable the Ratsnest layer here. We use it for local ratsnest
149  Flip( opts.m_ShowGlobalRatsnest );
150  m_frame->SetDisplayOptions( opts );
151  view()->UpdateDisplayOptions( opts );
152  getEditFrame<PCB_EDIT_FRAME>()->SetElementVisibility( LAYER_RATSNEST,
153  opts.m_ShowGlobalRatsnest );
154 
155  }
156  else if( aEvent.IsAction( &PCB_ACTIONS::ratsnestLineMode ) )
157  {
158  Flip( opts.m_DisplayRatsnestLinesCurved );
159  m_frame->SetDisplayOptions( opts );
160  view()->UpdateDisplayOptions( opts );
161  }
162 
163  canvas()->RedrawRatsnest();
164  canvas()->Refresh();
165 
166  return 0;
167 }
static TOOL_ACTION ratsnestLineMode
Definition: pcb_actions.h:226
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
void RedrawRatsnest()
Forces refresh of the ratsnest visual representation
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
void UpdateDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Definition: pcb_view.cpp:113
KIGFX::PCB_VIEW * view() const
static TOOL_ACTION showRatsnest
Definition: pcb_actions.h:225
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
const PCB_DISPLAY_OPTIONS & displayOptions() const
PCB_DRAW_PANEL_GAL * canvas() const
void Flip(T &aValue)

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

Referenced by setTransitions().

◆ TrackDisplayMode()

int PCBNEW_CONTROL::TrackDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 122 of file pcbnew_control.cpp.

123 {
124  auto opts = displayOptions();
125 
126  Flip( opts.m_DisplayPcbTrackFill );
127  m_frame->SetDisplayOptions( opts );
128  view()->UpdateDisplayOptions( opts );
129 
130  for( auto track : board()->Tracks() )
131  {
132  if( track->Type() == PCB_TRACE_T )
133  view()->Update( track, KIGFX::GEOMETRY );
134  }
135 
136  canvas()->Refresh();
137 
138  return 0;
139 }
BOARD * board() const
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:91
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
void UpdateDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Definition: pcb_view.cpp:113
KIGFX::PCB_VIEW * view() const
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
const PCB_DISPLAY_OPTIONS & displayOptions() const
PCB_DRAW_PANEL_GAL * canvas() const
void Flip(T &aValue)
Color has changed.
Definition: view_item.h:57

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

Referenced by setTransitions().

◆ Undo()

int PCBNEW_CONTROL::Undo ( const TOOL_EVENT aEvent)

Definition at line 974 of file pcbnew_control.cpp.

975 {
976  PCB_BASE_EDIT_FRAME* editFrame = dynamic_cast<PCB_BASE_EDIT_FRAME*>( m_frame );
977  wxCommandEvent dummy;
978 
979  if( editFrame )
980  editFrame->RestoreCopyFromUndoList( dummy );
981 
982  return 0;
983 }
void RestoreCopyFromUndoList(wxCommandEvent &aEvent)
Function RestoreCopyFromUndoList Undo the last edit:
Definition: undo_redo.cpp:332
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
Common, abstract interface for edit frames.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.

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

Referenced by setTransitions().

◆ updateGrid()

void PCBNEW_CONTROL::updateGrid ( )
private

Applies the legacy canvas grid settings for GAL.

Definition at line 1021 of file pcbnew_control.cpp.

1022 {
1023  BASE_SCREEN* screen = m_frame->GetScreen();
1024  getView()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGridSize() ) );
1026 }
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
Definition: base_screen.h:279
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:180
Auxiliary rendering target (noncached)
Definition: definitions.h:49
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:74
void SetGridSize(const VECTOR2D &aGridSize)
Set the grid size.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.

References KIGFX::VIEW::GetGAL(), BASE_SCREEN::GetGridSize(), PCB_BASE_FRAME::GetScreen(), TOOL_BASE::getView(), m_frame, KIGFX::VIEW::MarkTargetDirty(), KIGFX::GAL::SetGridSize(), and KIGFX::TARGET_NONCACHED.

Referenced by GridFast1(), and GridFast2().

◆ UpdateMessagePanel()

int PCBNEW_CONTROL::UpdateMessagePanel ( const TOOL_EVENT aEvent)

Definition at line 1029 of file pcbnew_control.cpp.

1030 {
1032  PCBNEW_SELECTION& selection = selTool->GetSelection();
1033 
1034  if( selection.GetSize() == 1 )
1035  {
1036  EDA_ITEM* item = selection.Front();
1037  MSG_PANEL_ITEMS msgItems;
1038 
1039  item->GetMsgPanelInfo( m_frame->GetUserUnits(), msgItems );
1040  m_frame->SetMsgPanel( msgItems );
1041  }
1042  else if( selection.GetSize() > 1 )
1043  {
1044  MSG_PANEL_ITEMS msgItems;
1045  wxString msg = wxString::Format( wxT( "%d" ), selection.GetSize() );
1046 
1047  msgItems.emplace_back( MSG_PANEL_ITEM( _( "Selected Items" ), msg, DARKCYAN ) );
1048  m_frame->SetMsgPanel( msgItems );
1049  }
1050  else if( auto editFrame = dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_frame ) )
1051  {
1052  MODULE* footprint = static_cast<MODULE*>( editFrame->GetModel() );
1053 
1054  if( !footprint )
1055  return 0;
1056 
1057  MSG_PANEL_ITEMS msgItems;
1058  wxString msg;
1059 
1060  msg = footprint->GetFPID().GetLibNickname().wx_str();
1061  msgItems.emplace_back( MSG_PANEL_ITEM( _( "Library" ), msg, DARKCYAN ) );
1062 
1063  msg = footprint->GetFPID().GetLibItemName().wx_str();
1064  msgItems.emplace_back( MSG_PANEL_ITEM( _( "Footprint Name" ), msg, DARKCYAN ) );
1065 
1066  wxDateTime date( static_cast<time_t>( footprint->GetLastEditTime() ) );
1067 
1068  if( footprint->GetLastEditTime() && date.IsValid() )
1069  // Date format: see http://www.cplusplus.com/reference/ctime/strftime
1070  msg = date.Format( wxT( "%b %d, %Y" ) ); // Abbreviated_month_name Day, Year
1071  else
1072  msg = _( "Unknown" );
1073 
1074  msgItems.emplace_back( MSG_PANEL_ITEM( _( "Last Change" ), msg, BROWN ) );
1075 
1076  msg.Printf( wxT( "%zu" ), (size_t) footprint->GetPadCount( DO_NOT_INCLUDE_NPTH ) );
1077  msgItems.emplace_back( MSG_PANEL_ITEM( _( "Pads" ), msg, BLUE ) );
1078 
1079  wxString doc, keyword;
1080  doc.Printf( _( "Doc: %s" ), footprint->GetDescription() );
1081  keyword.Printf( _( "Key Words: %s" ), footprint->GetKeywords() );
1082  msgItems.emplace_back( MSG_PANEL_ITEM( doc, keyword, BLACK ) );
1083 
1084  m_frame->SetMsgPanel( msgItems );
1085  }
1086  else
1087  {
1089  }
1090 
1091  return 0;
1092 }
unsigned GetPadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
GetPadCount returns the number of pads.
Definition: colors.h:57
timestamp_t GetLastEditTime() const
Definition: class_module.h:349
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
const LIB_ID & GetFPID() const
Definition: class_module.h:219
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
PCBNEW_SELECTION & GetSelection()
Function GetSelection()
const PCBNEW_SELECTION & selection() const
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
const wxString & GetKeywords() const
Definition: class_module.h:225
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:99
const wxString & GetDescription() const
Definition: class_module.h:222
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:31
wxString wx_str() const
Definition: utf8.cpp:51
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:163
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102
virtual void GetMsgPanelInfo(EDA_UNITS aUnits, std::vector< MSG_PANEL_ITEM > &aList)
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
Definition: base_struct.h:318
Definition: colors.h:45
BOARD * GetBoard() const
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
EDA_ITEM * Front() const
Definition: selection.h:183
Definition: colors.h:62

References _, BLACK, BLUE, BROWN, DARKCYAN, DO_NOT_INCLUDE_NPTH, Format(), SELECTION::Front(), PCB_BASE_FRAME::GetBoard(), MODULE::GetDescription(), MODULE::GetFPID(), MODULE::GetKeywords(), MODULE::GetLastEditTime(), LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), EDA_ITEM::GetMsgPanelInfo(), MODULE::GetPadCount(), SELECTION_TOOL::GetSelection(), SELECTION::GetSize(), TOOL_MANAGER::GetTool(), EDA_BASE_FRAME::GetUserUnits(), m_frame, TOOL_BASE::m_toolMgr, PCB_TOOL_BASE::selection(), EDA_DRAW_FRAME::SetMsgPanel(), and UTF8::wx_str().

Referenced by setTransitions().

◆ ViaDisplayMode()

int PCBNEW_CONTROL::ViaDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 190 of file pcbnew_control.cpp.

191 {
192  auto opts = displayOptions();
193 
194  Flip( opts.m_DisplayViaFill );
195  view()->UpdateDisplayOptions( opts );
196  m_frame->SetDisplayOptions( opts );
197 
198  for( auto track : board()->Tracks() )
199  {
200  if( track->Type() == PCB_TRACE_T || track->Type() == PCB_VIA_T )
201  view()->Update( track, KIGFX::GEOMETRY );
202  }
203 
204  canvas()->Refresh();
205 
206  return 0;
207 }
BOARD * board() const
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:91
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
void UpdateDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Definition: pcb_view.cpp:113
KIGFX::PCB_VIEW * view() const
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
const PCB_DISPLAY_OPTIONS & displayOptions() const
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
PCB_DRAW_PANEL_GAL * canvas() const
void Flip(T &aValue)
Color has changed.
Definition: view_item.h:57

References PCB_TOOL_BASE::board(), PCB_TOOL_BASE::canvas(), PCB_TOOL_BASE::displayOptions(), Flip(), KIGFX::GEOMETRY, m_frame, PCB_TRACE_T, PCB_VIA_T, EDA_DRAW_PANEL_GAL::Refresh(), PCB_BASE_FRAME::SetDisplayOptions(), KIGFX::PCB_VIEW::Update(), KIGFX::PCB_VIEW::UpdateDisplayOptions(), 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

Function Wait()

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

Definition at line 57 of file tool_interactive.cpp.

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

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), CVPCB_CONTROL::Main(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ ZoneDisplayMode()

int PCBNEW_CONTROL::ZoneDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 278 of file pcbnew_control.cpp.

279 {
280  auto opts = displayOptions();
281 
282  // Apply new display options to the GAL canvas
284  opts.m_DisplayZonesMode = 0;
285  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayDisable ) )
286  opts.m_DisplayZonesMode = 1;
287  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayOutlines ) )
288  opts.m_DisplayZonesMode = 2;
289  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayToggle ) )
290  opts.m_DisplayZonesMode = ( opts.m_DisplayZonesMode + 1 ) % 3;
291  else
292  wxFAIL;
293 
294  m_frame->SetDisplayOptions( opts );
295  view()->UpdateDisplayOptions( opts );
296 
297  for( int i = 0; i < board()->GetAreaCount(); ++i )
298  view()->Update( board()->GetArea( i ), KIGFX::GEOMETRY );
299 
300  canvas()->Refresh();
301 
302  return 0;
303 }
BOARD * board() const
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:91
static TOOL_ACTION zoneDisplayOutlines
Definition: pcb_actions.h:233
static TOOL_ACTION zoneDisplayDisable
Definition: pcb_actions.h:232
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
static TOOL_ACTION zoneDisplayToggle
Definition: pcb_actions.h:234
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:948
void UpdateDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Definition: pcb_view.cpp:113
KIGFX::PCB_VIEW * view() const
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
const PCB_DISPLAY_OPTIONS & displayOptions() const
PCB_DRAW_PANEL_GAL * canvas() const
Color has changed.
Definition: view_item.h:57
static TOOL_ACTION zoneDisplayEnable
Definition: pcb_actions.h:231

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

Referenced by setTransitions().

Member Data Documentation

◆ m_editModules

◆ m_frame

◆ m_gridOrigin

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

Grid origin marker.

Definition at line 117 of file pcbnew_control.h.

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

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

functions below are not yet implemented - their interface may change

Definition at line 108 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), PICKER_TOOL::Init(), SCH_EDIT_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), LIB_DRAWING_TOOLS::Init(), MODULE_EDITOR_TOOLS::Init(), LIB_CONTROL::Init(), PCB_EDITOR_CONTROL::Init(), SCH_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), EDIT_TOOL::Init(), PCB_TOOL_BASE::Init(), SCH_MOVE_TOOL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_pickerItem

BOARD_ITEM* PCBNEW_CONTROL::m_pickerItem
private

Definition at line 119 of file pcbnew_control.h.

Referenced by DeleteItemCursor().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

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

Referenced by TOOL_INTERACTIVE::Activate(), EE_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemToSel(), SELECTION_TOOL::AddItemToSel(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), EDIT_TOOL::ChangeTrackWidth(), PCB_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), MICROWAVE_TOOL::createInductorBetween(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), SCH_EDITOR_CONTROL::Cut(), LIB_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), LIB_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::editComponentFieldText(), EDIT_TOOL::EditFpInFpEditor(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindComponentAndItem(), POINT_EDITOR::finishItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::getEditFrameInt(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), GridSetOrigin(), GERBVIEW_CONTROL::HighlightControl(), PCB_INSPECTION_TOOL::HighlightItem(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), MODULE_EDITOR_TOOLS::ImportFootprint(), LIB_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), LIB_CONTROL::Init(), PCB_EDITOR_CONTROL::Init(), POINT_EDITOR::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), TOOL_BASE::IsToolActive(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), SCH_MOVE_TOOL::Main(), CVPCB_CONTROL::Main(), LIB_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::Move(), EDIT_TOOL::MoveExact(), LIB_CONTROL::OnDeMorgan(), LIB_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickCopyReferencePoint(), LIB_EDIT_TOOL::PinTable(), placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), Print(), GERBVIEW_CONTROL::Print(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), LIB_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), EE_SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), LIB_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC::RunTests(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), GERBVIEW_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::SelectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), DRC::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), LIB_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

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

Definition at line 218 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_toolSettings

TOOL_SETTINGS TOOL_BASE::m_toolSettings
protectedinherited

Definition at line 220 of file tool_base.h.

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

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 211 of file tool_base.h.

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


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