KiCad PCB EDA Suite
PCBNEW_CONTROL Class Reference

Class PCBNEW_CONTROL. More...

#include <pcbnew_control.h>

Inheritance diagram for PCBNEW_CONTROL:
PCB_TOOL 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 TrackDisplayMode (const TOOL_EVENT &aEvent)
 
int PadDisplayMode (const TOOL_EVENT &aEvent)
 
int ViaDisplayMode (const TOOL_EVENT &aEvent)
 
int ZoneDisplayMode (const TOOL_EVENT &aEvent)
 
int HighContrastMode (const TOOL_EVENT &aEvent)
 
int HighContrastInc (const TOOL_EVENT &aEvent)
 
int HighContrastDec (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 CursorControl (const TOOL_EVENT &aEvent)
 
int PanControl (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 ResetCoords (const TOOL_EVENT &aEvent)
 
int SwitchCursor (const TOOL_EVENT &aEvent)
 
int SwitchUnits (const TOOL_EVENT &aEvent)
 
int DeleteItemCursor (const TOOL_EVENT &aEvent)
 
int PasteItemsFromClipboard (const TOOL_EVENT &aEvent)
 
int AppendBoardFromFile (const TOOL_EVENT &aEvent)
 
int AppendBoard (PLUGIN &pi, wxString &fileName)
 
int ShowHelp (const TOOL_EVENT &aEvent)
 
int ToBeDone (const TOOL_EVENT &aEvent)
 
void setTransitions () override
 

Sets up handlers for various events.

More...
 
void SetEditModules (bool aEnabled)
 Function SetEditModules() More...
 
bool EditingModules () const
 
void Activate ()
 Function Activate() Runs the tool. More...
 
void SetContextMenu (CONTEXT_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Function SetContextMenu() More...
 
void RunMainStack (std::function< void()> aFunc)
 Function RunMainStack() More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Go() More...
 
OPT_TOOL_EVENT Wait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Wait() More...
 
virtual bool Init ()
 Function Init() Init() is called once upon a registration of the tool. 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
 

Protected Types

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

Protected Member Functions

void doInteractiveItemPlacement (INTERACTIVE_PLACER_BASE *aPlacer, const wxString &aCommitMessage, int aOptions=IPO_ROTATE|IPO_FLIP|IPO_REPEAT)
 Helper function for performing a common interactive idiom: wait for a left click, place an item there (perhaps with a dialog or other user interaction), then have it move with the mouse and respond to rotate/flip, etc. More...
 
KIGFX::VIEWview () const
 
KIGFX::VIEW_CONTROLScontrols () const
 
PCB_EDIT_FRAMEframe () const
 
BOARDboard () const
 
MODULEmodule () const
 
const TOOL_EVENT evActivate (std::string aToolName="")
 functions below are not yet implemented - their interface may change More...
 
const TOOL_EVENT evCommand (int aCommandId=-1)
 
const TOOL_EVENT evCommand (std::string aCommandStr="")
 
const TOOL_EVENT evMotion ()
 
const TOOL_EVENT evClick (int aButton=BUT_ANY)
 
const TOOL_EVENT evDrag (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonUp (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonDown (int aButton=BUT_ANY)
 
void attachManager (TOOL_MANAGER *aManager)
 Function attachManager() More...
 
KIGFX::VIEWgetView () const
 Function getView() More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Function getViewControls() More...
 
template<typename T >
T * getEditFrame () const
 Function getEditFrame() More...
 
template<typename T >
T * getModel () const
 Function getModel() More...
 

Protected Attributes

bool m_editModules
 
TOOL_TYPE m_type
 

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

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

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 
TOOL_SETTINGS m_toolSettings
 

Private Member Functions

int placeBoardItems (BOARD *aBoard)
 
int placeBoardItems (std::vector< BOARD_ITEM * > &aItems)
 
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...
 

Detailed Description

Class PCBNEW_CONTROL.

Handles actions that are shared between different frames in pcbnew.

Definition at line 44 of file pcbnew_control.h.

Member Enumeration Documentation

enum PCB_TOOL::INTERACTIVE_PLACEMENT_OPTIONS
protectedinherited
Enumerator
IPO_ROTATE 
IPO_FLIP 
IPO_PROPERTIES 
IPO_SINGLE_CLICK 
IPO_REPEAT 

Definition at line 98 of file pcb_tool.h.

enum TOOL_BASE::RESET_REASON
inherited

Determines the reason of reset for a tool

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 80 of file tool_base.h.

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

Constructor & Destructor Documentation

PCBNEW_CONTROL::PCBNEW_CONTROL ( )

Definition at line 235 of file pcbnew_control.cpp.

References m_gridOrigin.

235  :
236  PCB_TOOL( "pcbnew.Control" ), m_frame( NULL )
237 {
238  m_gridOrigin.reset( new KIGFX::ORIGIN_VIEWITEM() );
239 }
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
PCB_TOOL(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool.h:65
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Grid origin marker.
PCBNEW_CONTROL::~PCBNEW_CONTROL ( )

Definition at line 242 of file pcbnew_control.cpp.

243 {
244 }

Member Function Documentation

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

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

Definition at line 49 of file tool_interactive.cpp.

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

Referenced by EDIT_TOOL::copyToClipboard(), DeleteItemCursor(), PCB_TOOL::doInteractiveItemPlacement(), ROUTER_TOOL::DpDimensionsDialog(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), GridSetOrigin(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), EDIT_TOOL::pickCopyReferencePoint(), DRAWING_TOOL::PlaceDXF(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), ROUTER_TOOL::SettingsDialog(), and PCB_EDITOR_CONTROL::ShowLocalRatsnest().

50 {
52 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:210
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID...
int PCBNEW_CONTROL::AppendBoard ( PLUGIN pi,
wxString &  fileName 
)

Definition at line 889 of file pcbnew_control.cpp.

References PCB_TOOL::board(), BOARD::BuildListOfNets(), NETCLASSES::Clear(), DisplayError(), FLAG0, Format(), GetChars(), BOARD::GetCopperLayerCount(), PCB_BASE_FRAME::GetDesignSettings(), BOARD::GetEnabledLayers(), PCB_BASE_FRAME::GetPageSizeIU(), PLUGIN::Load(), m_frame, BOARD_DESIGN_SETTINGS::m_NetClasses, placeBoardItems(), BOARD::SetCopperLayerCount(), BOARD::SetEnabledLayers(), BOARD::SetVisibleLayers(), BOARD::SynchronizeNetsAndNetClasses(), BOARD::Tracks(), and IO_ERROR::What().

Referenced by AppendBoardFromFile().

890 {
891  PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
892  if( !editFrame )
893  return 1;
894 
895  // Mark existing tracks, in order to know what are the new tracks
896  // Tracks are inserted, not appended, so mark existing tracks to be
897  // able to select the new tracks only later
898  BOARD* brd = board();
899  if( !brd )
900  return 1;
901 
902  for( auto track : brd->Tracks() )
903  track->SetFlags( FLAG0 );
904 
905  // Keep also the count of copper layers, to adjust if necessary
906  int initialCopperLayerCount = brd->GetCopperLayerCount();
907  LSET initialEnabledLayers = brd->GetEnabledLayers();
908 
909  // Load the data
910  try
911  {
912  PROPERTIES props;
913  char xbuf[30];
914  char ybuf[30];
915 
916  // EAGLE_PLUGIN can use this info to center the BOARD, but it does not yet.
917  sprintf( xbuf, "%d", editFrame->GetPageSizeIU().x );
918  sprintf( ybuf, "%d", editFrame->GetPageSizeIU().y );
919 
920  props["page_width"] = xbuf;
921  props["page_height"] = ybuf;
922 
923  editFrame->GetDesignSettings().m_NetClasses.Clear();
924  pi.Load( fileName, brd, &props );
925  }
926  catch( const IO_ERROR& ioe )
927  {
928  wxString msg = wxString::Format( _( "Error loading board.\n%s" ), GetChars( ioe.What() ));
929  DisplayError( editFrame, msg );
930 
931  return 0;
932  }
933 
934  // rebuild nets and ratsnest before any use of nets
935  brd->BuildListOfNets();
937 
938 
939  // Synchronize layers
940  // we should not ask PLUGINs to do these items:
941  int copperLayerCount = brd->GetCopperLayerCount();
942 
943  if( copperLayerCount > initialCopperLayerCount )
944  brd->SetCopperLayerCount( copperLayerCount );
945 
946  // Enable all used layers, and make them visible:
947  LSET enabledLayers = brd->GetEnabledLayers();
948  enabledLayers |= initialEnabledLayers;
949  brd->SetEnabledLayers( enabledLayers );
950  brd->SetVisibleLayers( enabledLayers );
951 
952 
953  return placeBoardItems( brd );
954 }
void BuildListOfNets()
Definition: class_board.h:722
int GetCopperLayerCount() const
Function GetCopperLayerCount.
void SetCopperLayerCount(int aCount)
Class PROPERTIES is a name/value tuple with unique names and optional values.
Definition: properties.h:34
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
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 ...
Class LSET is a set of PCB_LAYER_IDs.
void SetVisibleLayers(LSET aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
int placeBoardItems(BOARD *aBoard)
#define FLAG0
Pcbnew: flag used in local computations.
Definition: base_struct.h:145
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
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:92
void Clear()
Function Clear destroys any contained NETCLASS instances except the Default one.
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
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
const wxSize GetPageSizeIU() const override
Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the int...
DLIST_ITERATOR_WRAPPER< TRACK > Tracks()
Definition: class_board.h:249
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:71
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
void SetEnabledLayers(LSET aLayerMask)
Function SetEnabledLayers is a proxy function that calls the correspondent function in m_BoardSetting...
NETCLASSES m_NetClasses
List of current netclasses. There is always the default netclass.
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:47
BOARD * board() const
Definition: pcb_tool.h:126
int PCBNEW_CONTROL::AppendBoardFromFile ( const TOOL_EVENT aEvent)

Definition at line 817 of file pcbnew_control.cpp.

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

Referenced by setTransitions().

818 {
819  int open_ctl;
820  wxString fileName;
821 
822  PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
823 
824  if( !editFrame )
825  return 1;
826 
827  // Pick a file to append
828  if( !AskLoadBoardFileName( editFrame, &open_ctl, &fileName, true ) )
829  return 1;
830 
831  IO_MGR::PCB_FILE_T pluginType = plugin_type( fileName, open_ctl );
832  PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
833 
834  return AppendBoard( *pi, fileName );
835 }
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
Class RELEASER releases a PLUGIN in the context of a potential thrown exception, through its destruct...
Definition: io_mgr.h:474
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, or load design documents.
Definition: io_mgr.cpp:58
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:51
int AppendBoard(PLUGIN &pi, wxString &fileName)
void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

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

Definition at line 59 of file tool_base.cpp.

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

Referenced by TOOL_MANAGER::RegisterTool().

60 {
61  m_toolMgr = aManager;
62  m_toolSettings = TOOL_SETTINGS( this );
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:216
friend class TOOL_SETTINGS
Definition: tool_base.h:155
BOARD* PCB_TOOL::board ( ) const
inlineprotectedinherited

Definition at line 126 of file pcb_tool.h.

Referenced by AppendBoard(), PCB_EDITOR_CONTROL::calculateSelectionRatsnest(), EDIT_TOOL::changeTrackWidthOnClick(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), ROUTER_TOOL::CustomTrackWidthDialog(), PCB_TOOL::doInteractiveItemPlacement(), MODULE_EDITOR_TOOLS::EnumeratePads(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::filterSelection(), ROUTER_TOOL::getNetclassDimensions(), GridResetOrigin(), PAD_TOOL::haveFootprints(), LayerNext(), LayerPrev(), ROUTER_TOOL::mainLoop(), PCB_TOOL::module(), MODULE_EDITOR_TOOLS::ModuleEdgeOutlines(), MODULE_EDITOR_TOOLS::ModuleTextOutlines(), ROUTER_TOOL::onTrackViaSizeChanged(), ROUTER_TOOL::onViaCommand(), PadDisplayMode(), PasteItemsFromClipboard(), PCB_EDITOR_CONTROL::PlaceModule(), MODULE_EDITOR_TOOLS::PlacePad(), PCB_EDITOR_CONTROL::PlaceTarget(), ROUTER_TOOL::prepareInteractive(), Reset(), PNS::TOOL_BASE::Reset(), SELECTION_TOOL::selectable(), SELECTION_TOOL::selectAllItemsConnectedToItem(), SELECTION_TOOL::selectAllItemsConnectedToTrack(), SELECTION_TOOL::selectAllItemsOnNet(), SELECTION_TOOL::selectAllItemsOnSheet(), SELECTION_TOOL::selectPoint(), TrackDisplayMode(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), ViaDisplayMode(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), ZoneDisplayMode(), PCB_EDITOR_CONTROL::ZoneFillAll(), PCB_EDITOR_CONTROL::ZoneMerge(), and PCB_EDITOR_CONTROL::ZoneUnfillAll().

126 { return getModel<BOARD>(); }
int PCBNEW_CONTROL::CursorControl ( const TOOL_EVENT aEvent)

Definition at line 490 of file pcbnew_control.cpp.

References BUT_LEFT, ACTIONS::CURSOR_CLICK, ACTIONS::CURSOR_DBL_CLICK, ACTIONS::CURSOR_DOWN, ACTIONS::CURSOR_FAST_MOVE, ACTIONS::CURSOR_LEFT, ACTIONS::CURSOR_RIGHT, ACTIONS::CURSOR_UP, KIGFX::VIEW_CONTROLS::GetCursorPosition(), GRID_HELPER::GetGrid(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), KIGFX::VIEW::IsMirroredX(), m_frame, TOOL_BASE::m_toolMgr, MD_ALT, MD_CTRL, MD_SHIFT, TOOL_EVENT::Parameter(), TOOL_MANAGER::ProcessEvent(), KIGFX::VIEW_CONTROLS::SetCursorPosition(), TOOL_EVENT::SetMousePosition(), TA_MOUSE_CLICK, TA_MOUSE_DBLCLICK, TA_NONE, TC_MOUSE, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

491 {
492  long type = aEvent.Parameter<intptr_t>();
493  bool fastMove = type & PCB_ACTIONS::CURSOR_FAST_MOVE;
494  type &= ~PCB_ACTIONS::CURSOR_FAST_MOVE;
495  bool mirroredX = getView()->IsMirroredX();
496 
497  GRID_HELPER gridHelper( m_frame );
499  VECTOR2I gridSize = gridHelper.GetGrid();
500 
501  if( fastMove )
502  gridSize = gridSize * 10;
503 
504  switch( type )
505  {
507  cursor -= VECTOR2D( 0, gridSize.y );
508  break;
509 
511  cursor += VECTOR2D( 0, gridSize.y );
512  break;
513 
515  cursor -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
516  break;
517 
519  cursor += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
520  break;
521 
522  case PCB_ACTIONS::CURSOR_CLICK: // fall through
524  {
525  TOOL_ACTIONS action = TA_NONE;
526  int modifiers = 0;
527 
528  modifiers |= wxGetKeyState( WXK_SHIFT ) ? MD_SHIFT : 0;
529  modifiers |= wxGetKeyState( WXK_CONTROL ) ? MD_CTRL : 0;
530  modifiers |= wxGetKeyState( WXK_ALT ) ? MD_ALT : 0;
531 
532  if( type == PCB_ACTIONS::CURSOR_CLICK )
533  action = TA_MOUSE_CLICK;
534  else if( type == PCB_ACTIONS::CURSOR_DBL_CLICK )
535  action = TA_MOUSE_DBLCLICK;
536  else
537  assert( false );
538 
539  TOOL_EVENT evt( TC_MOUSE, action, BUT_LEFT | modifiers );
540  evt.SetMousePosition( getViewControls()->GetCursorPosition() );
541  m_toolMgr->ProcessEvent( evt );
542 
543  return 0;
544  }
545  break;
546  }
547 
548  getViewControls()->SetCursorPosition( cursor );
549 
550  return 0;
551 }
bool IsMirroredX() const
Function IsMirroredX() Returns true if view is flipped across the X axis.
Definition: view.h:227
TOOL_ACTIONS
Definition: tool_event.h:55
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves cursor to the requested position expressed in world coordinates.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:589
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
Class TOOL_EVENT.
Definition: tool_event.h:162
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:373
Class PCB_ACTIONS.
Definition: pcb_actions.h:42
int PCBNEW_CONTROL::DeleteItemCursor ( const TOOL_EVENT aEvent)

Definition at line 723 of file pcbnew_control.cpp.

References TOOL_INTERACTIVE::Activate(), deleteItem(), TOOL_MANAGER::GetTool(), ID_PCB_DELETE_ITEM_BUTT, m_frame, TOOL_BASE::m_toolMgr, PICKER_TOOL::SetClickHandler(), PICKER_TOOL::SetSnapping(), PCB_BASE_FRAME::SetToolID(), and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

724 {
725  Activate();
726 
728  assert( picker );
729 
730  // TODO it will not check the toolbar button in the module editor, as it uses a different ID..
731  m_frame->SetToolID( ID_PCB_DELETE_ITEM_BUTT, wxCURSOR_BULLSEYE, _( "Delete item" ) );
732  picker->SetSnapping( false );
733  picker->SetClickHandler( std::bind( deleteItem, m_toolMgr, _1 ) );
734  picker->Activate();
735  Wait();
736 
737  return 0;
738 }
void SetSnapping(bool aEnable)
Function SetSnapping() Sets cursor snapping to grid for the period when the tool is active...
Definition: picker_tool.h:53
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg) override
Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor.
void SetClickHandler(CLICK_HANDLER aHandler)
Function SetClickHandler() Sets a handler for mouse click event.
Definition: picker_tool.h:94
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
Generic tool for picking a point.
Definition: picker_tool.h:34
static bool deleteItem(TOOL_MANAGER *aToolMgr, const VECTOR2D &aPosition)
void Activate()
Function Activate() Runs the tool.
void PCB_TOOL::doInteractiveItemPlacement ( INTERACTIVE_PLACER_BASE aPlacer,
const wxString &  aCommitMessage,
int  aOptions = IPO_ROTATE | IPO_FLIP | IPO_REPEAT 
)
protectedinherited

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

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

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

Definition at line 38 of file pcb_tool.cpp.

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

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

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

Definition at line 91 of file pcb_tool.h.

References PCB_TOOL::m_editModules.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), PAD_TOOL::Init(), and EDIT_TOOL::MeasureTool().

92  {
93  return m_editModules;
94  }
bool m_editModules
Definition: pcb_tool.h:129
const TOOL_EVENT TOOL_INTERACTIVE::evActivate ( std::string  aToolName = "")
protectedinherited

functions below are not yet implemented - their interface may change

const TOOL_EVENT TOOL_INTERACTIVE::evButtonDown ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evButtonUp ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evClick ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( int  aCommandId = -1)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( std::string  aCommandStr = "")
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evDrag ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evMotion ( )
protectedinherited
PCB_EDIT_FRAME* PCB_TOOL::frame ( ) const
inlineprotectedinherited

Definition at line 125 of file pcb_tool.h.

Referenced by MICROWAVE_TOOL::addMicrowaveFootprint(), PAD_TOOL::applyPadSettings(), EDIT_TOOL::changeTrackWidthOnClick(), PNS::TOOL_BASE::checkSnap(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), ROUTER_TOOL::CustomTrackWidthDialog(), PCB_TOOL::doInteractiveItemPlacement(), ROUTER_TOOL::DpDimensionsDialog(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawVia(), MODULE_EDITOR_TOOLS::EnumeratePads(), EDIT_TOOL::ExchangeFootprints(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), ROUTER_TOOL::finishInteractive(), ROUTER_TOOL::InlineDrag(), PICKER_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::MeasureTool(), MODULE_EDITOR_TOOLS::ModuleEdgeOutlines(), MODULE_EDITOR_TOOLS::ModuleTextOutlines(), ROUTER_TOOL::onViaCommand(), PasteItemsFromClipboard(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), PNS::TOOL_BASE::pickSingleItem(), MODULE_EDITOR_TOOLS::PlacePad(), ROUTER_TOOL::prepareInteractive(), PAD_TOOL::pushPadSettings(), PNS::TOOL_BASE::Reset(), ROUTER_TOOL::RouteDiffPair(), ROUTER_TOOL::RouteSingleTrace(), ROUTER_TOOL::SettingsDialog(), ROUTER_TOOL::switchLayerOnViaPlacement(), LENGTH_TUNER_TOOL::TuneDiffPair(), LENGTH_TUNER_TOOL::TuneDiffPairSkew(), LENGTH_TUNER_TOOL::TuneSingleTrace(), and PCB_EDITOR_CONTROL::ZoneFillAll().

125 { return getEditFrame<PCB_EDIT_FRAME>(); }
template<typename T >
T* TOOL_BASE::getEditFrame ( ) const
inlineprotectedinherited

Function getEditFrame()

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

Definition at line 188 of file tool_base.h.

References TOOL_BASE::getEditFrameInt().

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

189  {
190  return static_cast<T*>( getEditFrameInt() );
191  }
T
enum T contains all this lexer's tokens.
wxWindow * getEditFrameInt() const
Definition: tool_base.cpp:47
TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

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

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 122 of file tool_base.h.

References TOOL_BASE::m_toolId.

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

123  {
124  return m_toolId;
125  }
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:210
TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 144 of file tool_base.h.

References TOOL_BASE::m_toolMgr.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), PCB_TOOL::doInteractiveItemPlacement(), CONTEXT_MENU::getToolManager(), EDIT_TOOL::MeasureTool(), and CONTEXT_MENU::onMenuEvent().

145  {
146  return m_toolMgr;
147  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
template<typename T >
T* TOOL_BASE::getModel ( ) const
inlineprotectedinherited

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 199 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

200  {
201  EDA_ITEM* m = getModelInt();
202 
203  return static_cast<T*>( m );
204  }
T
enum T contains all this lexer's tokens.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:53
const std::string& TOOL_BASE::GetName ( void  ) const
inlineinherited

Function GetName() Returns the name of the tool.

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

Returns
The name of the tool.

Definition at line 133 of file tool_base.h.

References TOOL_BASE::m_toolName.

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

134  {
135  return m_toolName;
136  }
std::string m_toolName
Name of the tool.
Definition: tool_base.h:214
TOOL_SETTINGS & TOOL_BASE::GetSettings ( )
inherited

Definition at line 77 of file tool_base.cpp.

References TOOL_BASE::m_toolSettings.

Referenced by GERBVIEW_CONTROL::HighlightControl(), ROUTER_TOOL::Init(), SELECTION_TOOL::selectable(), and ROUTER_TOOL::~ROUTER_TOOL().

78 {
79  return m_toolSettings;
80 }
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:216
TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 111 of file tool_base.h.

References TOOL_BASE::m_type.

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

112  {
113  return m_type;
114  }
TOOL_TYPE m_type
Stores the type of the tool.
Definition: tool_base.h:207
KIGFX::VIEW * TOOL_BASE::getView ( ) const
protectedinherited

Function getView()

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

Returns
The instance of VIEW.

Definition at line 35 of file tool_base.cpp.

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

Referenced by PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), CursorControl(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), MICROWAVE_TOOL::drawMicrowaveInductor(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findCallback(), ROUTER_TOOL::getStartLayer(), GridSetOrigin(), SELECTION_TOOL::guessSelectionCandidates(), HighContrastMode(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), LayerAlphaDec(), LayerAlphaInc(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), MODULE_EDITOR_TOOLS::ModuleEdgeOutlines(), MODULE_EDITOR_TOOLS::ModuleTextOutlines(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), PadDisplayMode(), PanControl(), PNS::TOOL_BASE::pickSingleItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), PCB_EDITOR_CONTROL::Reset(), Reset(), PNS::TOOL_BASE::Reset(), DRAWING_TOOL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), SELECTION_TOOL::Reset(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), SELECTION_TOOL::selectable(), GERBVIEW_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), TrackDisplayMode(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), POINT_EDITOR::updateEditedPoint(), COMMON_TOOLS::updateGrid(), updateGrid(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), ViaDisplayMode(), PCB_TOOL::view(), ZoneDisplayMode(), COMMON_TOOLS::ZoomFitScreen(), GERBVIEW_SELECTION_TOOL::zoomFitSelection(), SELECTION_TOOL::zoomFitSelection(), COMMON_TOOLS::ZoomInOutCenter(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

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

Function getViewControls()

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

Returns
The instance of VIEW_CONTROLS.

Definition at line 41 of file tool_base.cpp.

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

Referenced by POINT_EDITOR::addCorner(), PCB_TOOL::controls(), CursorControl(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawZone(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findMove(), PCB_EDITOR_CONTROL::HighlightNet(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), ROUTER_TOOL::mainLoop(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::Reset(), ResetCoords(), DRAWING_TOOL::runPolygonEventLoop(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), PICKER_TOOL::setControls(), POINT_EDITOR::setEditedPoint(), EDIT_TOOL::updateModificationPoint(), COMMON_TOOLS::ZoomCenter(), and COMMON_TOOLS::ZoomInOut().

42 {
43  return m_toolMgr->GetViewControls();
44 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:257
template<class T >
void TOOL_INTERACTIVE::Go ( int(T::*)(const TOOL_EVENT &)  aStateFunc,
const TOOL_EVENT_LIST aConditions = TOOL_EVENTTC_ANYTA_ANY ) 
)
inherited

Function Go()

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

Definition at line 135 of file tool_interactive.h.

References TOOL_INTERACTIVE::goInternal().

Referenced by ZOOM_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), PAD_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), POINT_EDITOR::setTransitions(), COMMON_TOOLS::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), MODULE_EDITOR_TOOLS::setTransitions(), PICKER_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), SELECTION_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), and DRAWING_TOOL::setTransitions().

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

Definition at line 593 of file pcbnew_control.cpp.

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

Referenced by setTransitions().

594 {
596  updateGrid();
597 
598  return 0;
599 }
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.
int PCBNEW_CONTROL::GridFast2 ( const TOOL_EVENT aEvent)

Definition at line 602 of file pcbnew_control.cpp.

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

Referenced by setTransitions().

603 {
605  updateGrid();
606 
607  return 0;
608 }
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.
int PCBNEW_CONTROL::GridResetOrigin ( const TOOL_EVENT aEvent)

Definition at line 650 of file pcbnew_control.cpp.

References PCB_TOOL::board(), m_gridOrigin, and BOARD::SetGridOrigin().

Referenced by setTransitions().

651 {
652  board()->SetGridOrigin( wxPoint( 0, 0 ) );
653  m_gridOrigin->SetPosition( VECTOR2D( 0, 0 ) );
654 
655  return 0;
656 }
void SetGridOrigin(const wxPoint &aPoint)
Function SetGridOrigin sets the origin point of the grid.
Definition: class_board.h:349
VECTOR2< double > VECTOR2D
Definition: vector2d.h:589
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Grid origin marker.
BOARD * board() const
Definition: pcb_tool.h:126
int PCBNEW_CONTROL::GridSetOrigin ( const TOOL_EVENT aEvent)

Definition at line 623 of file pcbnew_control.cpp.

References TOOL_INTERACTIVE::Activate(), TOOL_MANAGER::GetTool(), TOOL_BASE::getView(), ID_PCB_PLACE_GRID_COORD_BUTT, m_frame, m_gridOrigin, TOOL_BASE::m_toolMgr, TOOL_EVENT::Parameter(), PICKER_TOOL::SetClickHandler(), setOrigin(), PCB_BASE_FRAME::SetToolID(), and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

624 {
625  VECTOR2D* origin = aEvent.Parameter<VECTOR2D*>();
626 
627  if( origin )
628  {
629  setOrigin( getView(), m_frame, m_gridOrigin.get(), *origin );
630  delete origin;
631  }
632  else
633  {
634  Activate();
635 
637  assert( picker );
638 
639  // TODO it will not check the toolbar button in module editor, as it uses a different ID..
640  m_frame->SetToolID( ID_PCB_PLACE_GRID_COORD_BUTT, wxCURSOR_PENCIL, _( "Adjust grid origin" ) );
641  picker->SetClickHandler( std::bind( setOrigin, getView(), m_frame, m_gridOrigin.get(), _1 ) );
642  picker->Activate();
643  Wait();
644  }
645 
646  return 0;
647 }
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg) override
Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor.
void SetClickHandler(CLICK_HANDLER aHandler)
Function SetClickHandler() Sets a handler for mouse click event.
Definition: picker_tool.h:94
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
static bool setOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, KIGFX::ORIGIN_VIEWITEM *aItem, const VECTOR2D &aPoint)
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
Generic tool for picking a point.
Definition: picker_tool.h:34
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Grid origin marker.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:373
void Activate()
Function Activate() Runs the tool.
int PCBNEW_CONTROL::HighContrastDec ( const TOOL_EVENT aEvent)

Definition at line 374 of file pcbnew_control.cpp.

Referenced by setTransitions().

375 {
376  return 0;
377 }
int PCBNEW_CONTROL::HighContrastInc ( const TOOL_EVENT aEvent)

Definition at line 368 of file pcbnew_control.cpp.

Referenced by setTransitions().

369 {
370  return 0;
371 }
int PCBNEW_CONTROL::HighContrastMode ( const TOOL_EVENT aEvent)

Definition at line 354 of file pcbnew_control.cpp.

References PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetDisplayOptions(), EDA_DRAW_FRAME::GetGalCanvas(), KIGFX::VIEW::GetPainter(), KIGFX::PCB_PAINTER::GetSettings(), TOOL_BASE::getView(), DISPLAY_OPTIONS::m_ContrastModeDisplay, m_frame, and EDA_DRAW_PANEL_GAL::SetHighContrastLayer().

Referenced by setTransitions().

355 {
356  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
357  auto settings = painter->GetSettings();
359 
360  displ_opts->m_ContrastModeDisplay = !displ_opts->m_ContrastModeDisplay;
361  settings->LoadDisplayOptions( displ_opts );
363 
364  return 0;
365 }
virtual void SetHighContrastLayer(int aLayer)
Function SetHighContrastLayer Takes care of display settings for the given layer to be displayed in h...
Class PCB_PAINTER Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:176
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
virtual PCB_RENDER_SETTINGS * GetSettings() override
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
Definition: pcb_painter.h:188
bool m_ContrastModeDisplay
Definition: pcbstruct.h:85
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:196
Class DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
Definition: pcbstruct.h:62
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:870
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
virtual bool TOOL_BASE::Init ( )
inlinevirtualinherited

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

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

Reimplemented in SELECTION_TOOL, DRAWING_TOOL, GERBVIEW_SELECTION_TOOL, EDIT_TOOL, POSITION_RELATIVE_TOOL, PCB_EDITOR_CONTROL, POINT_EDITOR, MICROWAVE_TOOL, PAD_TOOL, ALIGN_DISTRIBUTE_TOOL, and ROUTER_TOOL.

Definition at line 93 of file tool_base.h.

Referenced by TOOL_MANAGER::InitTools().

94  {
95  return true;
96  }
bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 30 of file tool_base.cpp.

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

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

Definition at line 470 of file pcbnew_control.cpp.

References KIGFX::COLOR4D::a, PCB_BASE_FRAME::GetActiveLayer(), EDA_DRAW_FRAME::GetGalCanvas(), KIGFX::VIEW::GetPainter(), KIGFX::PCB_PAINTER::GetSettings(), EDA_DRAW_PANEL_GAL::GetView(), TOOL_BASE::getView(), m_frame, and KIGFX::VIEW::UpdateLayerColor().

Referenced by setTransitions().

471 {
472  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
473  auto settings = painter->GetSettings();
474 
475  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
476  KIGFX::COLOR4D currentColor = settings->GetLayerColor( currentLayer );
477 
478  if( currentColor.a >= 0.05 )
479  {
480  currentColor.a -= 0.05;
481  settings->SetLayerColor( currentLayer, currentColor );
482  m_frame->GetGalCanvas()->GetView()->UpdateLayerColor( currentLayer );
483  }
484 
485  return 0;
486 }
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
Class PCB_PAINTER Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:176
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
double a
Alpha component.
Definition: color4d.h:289
virtual PCB_RENDER_SETTINGS * GetSettings() override
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
Definition: pcb_painter.h:188
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:196
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
void UpdateLayerColor(int aLayer)
Function UpdateLayerColor() Applies the new coloring scheme held by RENDER_SETTINGS in case that it h...
Definition: view.cpp:657
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:870
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
int PCBNEW_CONTROL::LayerAlphaInc ( const TOOL_EVENT aEvent)

Definition at line 451 of file pcbnew_control.cpp.

References KIGFX::COLOR4D::a, PCB_BASE_FRAME::GetActiveLayer(), EDA_DRAW_FRAME::GetGalCanvas(), KIGFX::VIEW::GetPainter(), KIGFX::PCB_PAINTER::GetSettings(), EDA_DRAW_PANEL_GAL::GetView(), TOOL_BASE::getView(), m_frame, and KIGFX::VIEW::UpdateLayerColor().

Referenced by setTransitions().

452 {
453  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
454  auto settings = painter->GetSettings();
455 
456  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
457  KIGFX::COLOR4D currentColor = settings->GetLayerColor( currentLayer );
458 
459  if( currentColor.a <= 0.95 )
460  {
461  currentColor.a += 0.05;
462  settings->SetLayerColor( currentLayer, currentColor );
463  m_frame->GetGalCanvas()->GetView()->UpdateLayerColor( currentLayer );
464  }
465 
466  return 0;
467 }
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
Class PCB_PAINTER Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:176
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
double a
Alpha component.
Definition: color4d.h:289
virtual PCB_RENDER_SETTINGS * GetSettings() override
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
Definition: pcb_painter.h:188
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:196
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
void UpdateLayerColor(int aLayer)
Function UpdateLayerColor() Applies the new coloring scheme held by RENDER_SETTINGS in case that it h...
Definition: view.cpp:657
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:870
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
int PCBNEW_CONTROL::LayerNext ( const TOOL_EVENT aEvent)

Definition at line 389 of file pcbnew_control.cpp.

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

Referenced by setTransitions().

390 {
391  PCB_BASE_FRAME* editFrame = m_frame;
392  LAYER_NUM layer = editFrame->GetActiveLayer();
393 
394  if( layer < F_Cu || layer > B_Cu )
395  return 0;
396 
397  int layerCount = board()->GetCopperLayerCount();
398 
399  if( layer == layerCount - 2 || layerCount < 2 )
400  layer = B_Cu;
401  else if( layer == B_Cu )
402  layer = F_Cu;
403  else
404  ++layer;
405 
406  assert( IsCopperLayer( layer ) );
407  editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
408 
409  return 0;
410 }
int GetCopperLayerCount() const
Function GetCopperLayerCount.
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
virtual void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer)
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:774
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
BOARD * board() const
Definition: pcb_tool.h:126
int PCBNEW_CONTROL::LayerPrev ( const TOOL_EVENT aEvent)

Definition at line 413 of file pcbnew_control.cpp.

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

Referenced by setTransitions().

414 {
415  PCB_BASE_FRAME* editFrame = m_frame;
416  LAYER_NUM layer = editFrame->GetActiveLayer();
417 
418  if( layer < F_Cu || layer > B_Cu )
419  return 0;
420 
421  int layerCount = board()->GetCopperLayerCount();
422 
423  if( layer == F_Cu || layerCount < 2 )
424  layer = B_Cu;
425  else if( layer == B_Cu )
426  layer = layerCount - 2;
427  else
428  --layer;
429 
430  assert( IsCopperLayer( layer ) );
431  editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
432 
433  return 0;
434 }
int GetCopperLayerCount() const
Function GetCopperLayerCount.
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
virtual void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer)
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:774
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
BOARD * board() const
Definition: pcb_tool.h:126
int PCBNEW_CONTROL::LayerSwitch ( const TOOL_EVENT aEvent)

Definition at line 381 of file pcbnew_control.cpp.

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

Referenced by setTransitions().

382 {
383  m_frame->SwitchLayer( NULL, (PCB_LAYER_ID) aEvent.Parameter<intptr_t>() );
384 
385  return 0;
386 }
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
PCB_LAYER_ID
A quick note on layer IDs:
virtual void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer)
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:373
int PCBNEW_CONTROL::LayerToggle ( const TOOL_EVENT aEvent)

Definition at line 437 of file pcbnew_control.cpp.

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

Referenced by setTransitions().

438 {
439  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
440  PCB_SCREEN* screen = m_frame->GetScreen();
441 
442  if( currentLayer == screen->m_Route_Layer_TOP )
443  m_frame->SwitchLayer( NULL, screen->m_Route_Layer_BOTTOM );
444  else
445  m_frame->SwitchLayer( NULL, screen->m_Route_Layer_TOP );
446 
447  return 0;
448 }
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
PCB_LAYER_ID m_Route_Layer_BOTTOM
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
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
PCB_LAYER_ID m_Route_Layer_TOP
int PCBNEW_CONTROL::PadDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 282 of file pcbnew_control.cpp.

References PCB_TOOL::board(), KIGFX::GEOMETRY, PCB_BASE_FRAME::GetDisplayOptions(), EDA_DRAW_FRAME::GetGalCanvas(), KIGFX::VIEW::GetPainter(), KIGFX::PCB_PAINTER::GetSettings(), TOOL_BASE::getView(), DISPLAY_OPTIONS::m_DisplayPadFill, m_frame, PCB_TOOL::module(), MODULE::Pads(), EDA_DRAW_PANEL_GAL::Refresh(), and KIGFX::VIEW::Update().

Referenced by setTransitions().

283 {
284  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
285  auto settings = painter->GetSettings();
286 
288 
289  // Apply new display options to the GAL canvas
290  displ_opts->m_DisplayPadFill = !displ_opts->m_DisplayPadFill;
291  settings->LoadDisplayOptions( displ_opts );
292 
293  for( auto module : board()->Modules() )
294  {
295  for( auto pad : module->Pads() )
296  getView()->Update( pad, KIGFX::GEOMETRY );
297  }
298 
300 
301  return 0;
302 }
DLIST_ITERATOR_WRAPPER< D_PAD > Pads()
Definition: class_module.h:140
Class PCB_PAINTER Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:176
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
virtual PCB_RENDER_SETTINGS * GetSettings() override
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
Definition: pcb_painter.h:188
MODULE * module() const
Definition: pcb_tool.h:127
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:196
void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1385
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Class DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
Definition: pcbstruct.h:62
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
bool m_DisplayPadFill
Definition: pcbstruct.h:65
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:870
Color has changed.
Definition: view_item.h:57
BOARD * board() const
Definition: pcb_tool.h:126
int PCBNEW_CONTROL::PanControl ( const TOOL_EVENT aEvent)

Definition at line 554 of file pcbnew_control.cpp.

References ACTIONS::CURSOR_DOWN, ACTIONS::CURSOR_LEFT, ACTIONS::CURSOR_RIGHT, ACTIONS::CURSOR_UP, GRID_HELPER::GetGrid(), TOOL_BASE::getView(), m_frame, TOOL_EVENT::Parameter(), PCB_TOOL::view(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

555 {
556  long type = aEvent.Parameter<intptr_t>();
557  KIGFX::VIEW* view = getView();
558  GRID_HELPER gridHelper( m_frame );
559  VECTOR2D center = view->GetCenter();
560  VECTOR2I gridSize = gridHelper.GetGrid() * 10;
561  bool mirroredX = view->IsMirroredX();
562 
563  switch( type )
564  {
566  center -= VECTOR2D( 0, gridSize.y );
567  break;
568 
570  center += VECTOR2D( 0, gridSize.y );
571  break;
572 
574  center -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
575  break;
576 
578  center += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
579  break;
580 
581  default:
582  assert( false );
583  break;
584  }
585 
586  view->SetCenter( center );
587 
588  return 0;
589 }
KIGFX::VIEW * view() const
Definition: pcb_tool.h:123
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:589
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:373
Class VIEW.
Definition: view.h:58
int PCBNEW_CONTROL::PasteItemsFromClipboard ( const TOOL_EVENT aEvent)

Definition at line 740 of file pcbnew_control.cpp.

References PCB_TOOL::board(), EDA_DRAW_FRAME::DisplayToolMsg(), PCB_TOOL::frame(), FRAME_PCB_MODULE_EDITOR, EDA_BASE_FRAME::IsType(), PCB_TOOL::m_editModules, m_frame, mod, PCB_TOOL::module(), CLIPBOARD_IO::Parse(), PCB_MODULE_T, PCB_T, placeBoardItems(), EDA_ITEM::SetParent(), and EDA_ITEM::Type().

Referenced by setTransitions().

741 {
742  CLIPBOARD_IO pi;
743  BOARD tmpBoard;
744  BOARD_ITEM* clipItem = pi.Parse();
745 
746  if( !clipItem )
747  {
748  return 0;
749  }
750 
751  if( clipItem->Type() == PCB_T )
752  static_cast<BOARD*>(clipItem)->ClearAllNetCodes();
753 
754  bool editModules = m_editModules || frame()->IsType( FRAME_PCB_MODULE_EDITOR );
755 
756  // The clipboard can contain two different things, an entire kicad_pcb
757  // or a single module
758 
759  if( editModules && ( !board() || !module() ) )
760  {
761  wxLogDebug( wxT( "Attempting to paste to empty module editor window\n") );
762  return 0;
763  }
764 
765 
766  switch( clipItem->Type() )
767  {
768  case PCB_T:
769  {
770  if( editModules )
771  {
772  wxLogDebug( wxT( "attempting to paste a pcb in the footprint editor\n") );
773  return 0;
774  }
775 
776  placeBoardItems( static_cast<BOARD*>( clipItem ) );
777  break;
778  }
779 
780  case PCB_MODULE_T:
781  {
782  std::vector<BOARD_ITEM *> items;
783 
784  clipItem->SetParent( board() );
785 
786  if( editModules )
787  {
788  auto mod = static_cast<MODULE *>( clipItem );
789 
790  for( auto pad : mod->Pads() )
791  {
792  pad->SetParent ( board()->m_Modules.GetFirst() );
793  items.push_back( pad );
794  }
795  for( auto item : mod->GraphicalItems() )
796  {
797  item->SetParent ( board()->m_Modules.GetFirst() );
798  items.push_back( item );
799  }
800  }
801  else
802  {
803  items.push_back( clipItem );
804  }
805 
806  placeBoardItems( items );
807  break;
808  }
809  default:
810  m_frame->DisplayToolMsg( _( "Invalid clipboard contents" ) );
811  // FAILED
812  break;
813  }
814  return 1;
815 }
BOARD_ITEM * Parse()
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
Definition: typeinfo.h:97
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
class MODULE, a footprint
Definition: typeinfo.h:101
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:227
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:125
MODULE * module() const
Definition: pcb_tool.h:127
int placeBoardItems(BOARD *aBoard)
bool m_editModules
Definition: pcb_tool.h:129
void DisplayToolMsg(const wxString &msg)
Definition: draw_frame.cpp:508
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
bool IsType(FRAME_T aType) const
Definition: wxstruct.h:229
#define mod(a, n)
Definition: greymap.cpp:24
BOARD * board() const
Definition: pcb_tool.h:126
int PCBNEW_CONTROL::placeBoardItems ( BOARD aBoard)
private

Definition at line 837 of file pcbnew_control.cpp.

References BOARD::Drawings(), PCB_TOOL::module(), BOARD::Modules(), BOARD::Tracks(), and BOARD::Zones().

Referenced by AppendBoard(), and PasteItemsFromClipboard().

838 {
839  std::vector<BOARD_ITEM*> items;
840 
841  for( auto track : aBoard->Tracks() )
842  {
843  items.push_back( track );
844  }
845 
846  for( auto module : aBoard->Modules() )
847  {
848  items.push_back( module );
849  }
850 
851  for( auto drawing : aBoard->Drawings() )
852  {
853  items.push_back( drawing );
854  }
855 
856  for( auto zone : aBoard->Zones() )
857  {
858  items.push_back( zone );
859  }
860 
861  return placeBoardItems( items );
862 }
DLIST_ITERATOR_WRAPPER< MODULE > Modules()
Definition: class_board.h:250
MODULE * module() const
Definition: pcb_tool.h:127
int placeBoardItems(BOARD *aBoard)
ZONE_CONTAINERS & Zones()
Definition: class_board.h:252
DLIST_ITERATOR_WRAPPER< TRACK > Tracks()
Definition: class_board.h:249
DLIST_ITERATOR_WRAPPER< BOARD_ITEM > Drawings()
Definition: class_board.h:251
int PCBNEW_CONTROL::placeBoardItems ( std::vector< BOARD_ITEM * > &  aItems)
private

Definition at line 865 of file pcbnew_control.cpp.

References SELECTION::Add(), TOOL_MANAGER::GetTool(), TOOL_BASE::m_toolMgr, PCB_ACTIONS::move, TOOL_MANAGER::ProcessEvent(), TOOL_MANAGER::RunAction(), SELECTION_TOOL::SelectedEvent, and PCB_ACTIONS::selectionClear.

866 {
868 
869  auto selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
870  auto editTool = m_toolMgr->GetTool<EDIT_TOOL>();
871 
872  SELECTION& selection = selectionTool->GetSelection();
873 
874  for( auto item : aItems )
875  {
876  item->SetSelected();
877  selection.Add( item );
878  editTool->GetCurrentCommit()->Add( item );
879  }
880 
881  selection.SetReferencePoint( VECTOR2I( 0, 0 ) );
882 
885 
886  return 0;
887 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
static TOOL_ACTION move
move an item
Definition: pcb_actions.h:90
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:71
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
Class EDIT_TOOL.
Definition: edit_tool.h:45
static const TOOL_EVENT SelectedEvent
Event sent after an item is selected.
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.

Implements TOOL_BASE.

Definition at line 247 of file pcbnew_control.cpp.

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

248 {
249  m_frame = getEditFrame<PCB_BASE_FRAME>();
250 
251  if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
252  {
253  m_gridOrigin->SetPosition( board()->GetGridOrigin() );
254  getView()->Remove( m_gridOrigin.get() );
255  getView()->Add( m_gridOrigin.get() );
256  }
257 }
Model changes (required full reload)
Definition: tool_base.h:83
void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:342
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Grid origin marker.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:312
Rendering engine changes.
Definition: tool_base.h:84
BOARD * board() const
Definition: pcb_tool.h:126
int PCBNEW_CONTROL::ResetCoords ( const TOOL_EVENT aEvent)

Definition at line 660 of file pcbnew_control.cpp.

References KIGFX::VIEW_CONTROLS::GetCursorPosition(), PCB_BASE_FRAME::GetScreen(), TOOL_BASE::getViewControls(), m_frame, BASE_SCREEN::m_O_Curseur, PCB_BASE_FRAME::UpdateStatusBar(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

661 {
662  VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
663 
664  m_frame->GetScreen()->m_O_Curseur = wxPoint( cursorPos.x, cursorPos.y );
666 
667  return 0;
668 }
wxPoint m_O_Curseur
Relative Screen cursor coordinate (on grid) in user units.
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
virtual void UpdateStatusBar() override
Function UpdateStatusBar updates the status bar information.
PCB_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
void TOOL_INTERACTIVE::RunMainStack ( std::function< void()>  aFunc)
inherited

Function RunMainStack()

Calls a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 85 of file tool_interactive.cpp.

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

Referenced by DRAWING_TOOL::PlaceText().

86 {
87  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
88 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)
void TOOL_INTERACTIVE::SetContextMenu ( CONTEXT_MENU aMenu,
CONTEXT_MENU_TRIGGER  aTrigger = CMENU_BUTTON 
)
inherited

Function SetContextMenu()

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

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

Definition at line 74 of file tool_interactive.cpp.

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

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

75 {
76  if( aMenu )
77  aMenu->SetTool( this );
78  else
79  aTrigger = CMENU_OFF;
80 
81  m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
82 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void ScheduleContextMenu(TOOL_BASE *aTool, CONTEXT_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Sets behaviour of the tool's context popup menu.
void SetTool(TOOL_INTERACTIVE *aTool)
Function SetTool() Sets a tool that is the creator of the menu.
void PCB_TOOL::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 86 of file pcb_tool.h.

References PCB_TOOL::m_editModules.

87  {
88  m_editModules = aEnabled;
89  }
bool m_editModules
Definition: pcb_tool.h:129
void PCBNEW_CONTROL::setTransitions ( )
overridevirtual

Sets up handlers for various events.

Implements TOOL_INTERACTIVE.

Definition at line 973 of file pcbnew_control.cpp.

References PCB_ACTIONS::appendBoard, AppendBoardFromFile(), PCB_ACTIONS::cursorClick, CursorControl(), PCB_ACTIONS::cursorDblClick, PCB_ACTIONS::cursorDown, PCB_ACTIONS::cursorDownFast, PCB_ACTIONS::cursorLeft, PCB_ACTIONS::cursorLeftFast, PCB_ACTIONS::cursorRight, PCB_ACTIONS::cursorRightFast, PCB_ACTIONS::cursorUp, PCB_ACTIONS::cursorUpFast, DeleteItemCursor(), PCB_ACTIONS::deleteItemCursor, TOOL_INTERACTIVE::Go(), ACTIONS::gridFast1, GridFast1(), ACTIONS::gridFast2, GridFast2(), ACTIONS::gridResetOrigin, GridResetOrigin(), ACTIONS::gridSetOrigin, GridSetOrigin(), HighContrastDec(), PCB_ACTIONS::highContrastDec, HighContrastInc(), PCB_ACTIONS::highContrastInc, HighContrastMode(), PCB_ACTIONS::highContrastMode, LayerAlphaDec(), PCB_ACTIONS::layerAlphaDec, LayerAlphaInc(), PCB_ACTIONS::layerAlphaInc, PCB_ACTIONS::layerBottom, PCB_ACTIONS::layerInner1, PCB_ACTIONS::layerInner2, PCB_ACTIONS::layerInner3, PCB_ACTIONS::layerInner4, PCB_ACTIONS::layerInner5, PCB_ACTIONS::layerInner6, LayerNext(), PCB_ACTIONS::layerNext, LayerPrev(), PCB_ACTIONS::layerPrev, LayerSwitch(), LayerToggle(), PCB_ACTIONS::layerToggle, PCB_ACTIONS::layerTop, PadDisplayMode(), PCB_ACTIONS::padDisplayMode, PanControl(), PCB_ACTIONS::panDown, PCB_ACTIONS::panLeft, PCB_ACTIONS::panRight, PCB_ACTIONS::panUp, PCB_ACTIONS::pasteFromClipboard, PasteItemsFromClipboard(), ResetCoords(), PCB_ACTIONS::resetCoords, ShowHelp(), PCB_ACTIONS::showHelp, SwitchCursor(), PCB_ACTIONS::switchCursor, SwitchUnits(), PCB_ACTIONS::switchUnits, ToBeDone(), PCB_ACTIONS::toBeDone, TrackDisplayMode(), PCB_ACTIONS::trackDisplayMode, ViaDisplayMode(), PCB_ACTIONS::viaDisplayMode, PCB_ACTIONS::zoneDisplayDisable, PCB_ACTIONS::zoneDisplayEnable, ZoneDisplayMode(), and PCB_ACTIONS::zoneDisplayOutlines.

974 {
975  // Display modes
985 
986  // Layer control
1000 
1001  // Cursor control
1012 
1013  // Pan control
1018 
1019  // Grid control
1024 
1025  // Miscellaneous
1032 
1033  // Append control
1035  PCB_ACTIONS::appendBoard.MakeEvent() );
1036 
1038  PCB_ACTIONS::pasteFromClipboard.MakeEvent() );
1039 }
static TOOL_ACTION layerBottom
Definition: pcb_actions.h:263
int SwitchCursor(const TOOL_EVENT &aEvent)
int PanControl(const TOOL_EVENT &aEvent)
int PadDisplayMode(const TOOL_EVENT &aEvent)
static TOOL_ACTION cursorUpFast
Definition: pcb_actions.h:345
static TOOL_ACTION layerNext
Definition: pcb_actions.h:264
int HighContrastInc(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner2
Definition: pcb_actions.h:258
static TOOL_ACTION cursorDblClick
Definition: pcb_actions.h:351
static TOOL_ACTION layerInner5
Definition: pcb_actions.h:261
static TOOL_ACTION layerInner6
Definition: pcb_actions.h:262
static TOOL_ACTION showHelp
Definition: pcb_actions.h:377
static TOOL_ACTION layerAlphaDec
Definition: pcb_actions.h:267
static TOOL_ACTION gridResetOrigin
Definition: actions.h:66
int LayerAlphaInc(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoneDisplayOutlines
Definition: pcb_actions.h:250
static TOOL_ACTION layerAlphaInc
Definition: pcb_actions.h:266
static TOOL_ACTION zoneDisplayDisable
Definition: pcb_actions.h:249
int HighContrastMode(const TOOL_EVENT &aEvent)
int LayerPrev(const TOOL_EVENT &aEvent)
static TOOL_ACTION gridFast1
Definition: actions.h:61
int GridSetOrigin(const TOOL_EVENT &aEvent)
static TOOL_ACTION cursorUp
Cursor control with keyboard.
Definition: pcb_actions.h:340
static TOOL_ACTION pasteFromClipboard
Paste from clipboard.
Definition: pcb_actions.h:307
static TOOL_ACTION switchUnits
Definition: pcb_actions.h:370
static TOOL_ACTION layerInner3
Definition: pcb_actions.h:259
int LayerNext(const TOOL_EVENT &aEvent)
static TOOL_ACTION deleteItemCursor
Definition: pcb_actions.h:371
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
static TOOL_ACTION resetCoords
Definition: pcb_actions.h:367
static TOOL_ACTION layerTop
Definition: pcb_actions.h:256
static TOOL_ACTION highContrastMode
Definition: pcb_actions.h:251
static TOOL_ACTION appendBoard
Definition: pcb_actions.h:376
static TOOL_ACTION gridFast2
Definition: actions.h:62
static TOOL_ACTION cursorRightFast
Definition: pcb_actions.h:348
static TOOL_ACTION layerPrev
Definition: pcb_actions.h:265
static TOOL_ACTION toBeDone
Definition: pcb_actions.h:379
int GridResetOrigin(const TOOL_EVENT &aEvent)
static TOOL_ACTION panRight
Definition: pcb_actions.h:357
static TOOL_ACTION cursorClick
Definition: pcb_actions.h:350
int LayerToggle(const TOOL_EVENT &aEvent)
static TOOL_ACTION panUp
Definition: pcb_actions.h:354
int ZoneDisplayMode(const TOOL_EVENT &aEvent)
int GridFast1(const TOOL_EVENT &aEvent)
static TOOL_ACTION cursorRight
Definition: pcb_actions.h:343
int AppendBoardFromFile(const TOOL_EVENT &aEvent)
static TOOL_ACTION panLeft
Definition: pcb_actions.h:356
int ResetCoords(const TOOL_EVENT &aEvent)
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:246
static TOOL_ACTION viaDisplayMode
Definition: pcb_actions.h:247
int ShowHelp(const TOOL_EVENT &aEvent)
static TOOL_ACTION cursorLeft
Definition: pcb_actions.h:342
int LayerAlphaDec(const TOOL_EVENT &aEvent)
static TOOL_ACTION highContrastInc
Definition: pcb_actions.h:252
static TOOL_ACTION switchCursor
Definition: pcb_actions.h:369
int ViaDisplayMode(const TOOL_EVENT &aEvent)
int TrackDisplayMode(const TOOL_EVENT &aEvent)
int SwitchUnits(const TOOL_EVENT &aEvent)
int DeleteItemCursor(const TOOL_EVENT &aEvent)
int CursorControl(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner4
Definition: pcb_actions.h:260
int GridFast2(const TOOL_EVENT &aEvent)
static TOOL_ACTION cursorDown
Definition: pcb_actions.h:341
static TOOL_ACTION gridSetOrigin
Definition: actions.h:65
static TOOL_ACTION cursorLeftFast
Definition: pcb_actions.h:347
int ToBeDone(const TOOL_EVENT &aEvent)
int LayerSwitch(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerInner1
Definition: pcb_actions.h:257
static TOOL_ACTION panDown
Definition: pcb_actions.h:355
int PasteItemsFromClipboard(const TOOL_EVENT &aEvent)
static TOOL_ACTION highContrastDec
Definition: pcb_actions.h:253
static TOOL_ACTION trackDisplayMode
Definition: pcb_actions.h:245
static TOOL_ACTION layerToggle
Definition: pcb_actions.h:268
static TOOL_ACTION zoneDisplayEnable
Definition: pcb_actions.h:248
int HighContrastDec(const TOOL_EVENT &aEvent)
static TOOL_ACTION cursorDownFast
Definition: pcb_actions.h:346
int PCBNEW_CONTROL::ShowHelp ( const TOOL_EVENT aEvent)

Definition at line 957 of file pcbnew_control.cpp.

References DisplayHotkeyList(), EDA_DRAW_FRAME::GetHotkeyConfig(), and m_frame.

Referenced by setTransitions().

958 {
960 
961  return 0;
962 }
EDA_HOTKEY_CONFIG * GetHotkeyConfig() const
Function GetHotkeyConfig() Returns a structure containing currently used hotkey mapping.
Definition: draw_frame.h:383
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
void DisplayHotkeyList(EDA_BASE_FRAME *aFrame, struct EDA_HOTKEY_CONFIG *aDescList)
Function DisplayHotkeyList Displays the current hotkey list.
int PCBNEW_CONTROL::SwitchCursor ( const TOOL_EVENT aEvent)

Definition at line 671 of file pcbnew_control.cpp.

References EDA_DRAW_FRAME::GetGalDisplayOptions(), m_frame, and KIGFX::GAL_DISPLAY_OPTIONS::m_fullscreenCursor.

Referenced by setTransitions().

672 {
673  auto& galOpts = m_frame->GetGalDisplayOptions();
674 
675  galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor;
676  galOpts.NotifyChanged();
677 
678  return 0;
679 }
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for render...
Definition: draw_frame.h:891
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
bool m_fullscreenCursor
Fullscreen crosshair or small cross
int PCBNEW_CONTROL::SwitchUnits ( const TOOL_EVENT aEvent)

Definition at line 682 of file pcbnew_control.cpp.

References g_UserUnit, ID_TB_OPTIONS_SELECT_UNIT_INCH, ID_TB_OPTIONS_SELECT_UNIT_MM, INCHES, m_frame, and EDA_BASE_FRAME::ProcessEvent().

Referenced by setTransitions().

683 {
684  // TODO should not it be refactored to pcb_frame member function?
685  wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
686 
687  if( g_UserUnit == INCHES )
688  evt.SetId( ID_TB_OPTIONS_SELECT_UNIT_MM );
689  else
690  evt.SetId( ID_TB_OPTIONS_SELECT_UNIT_INCH );
691 
692  m_frame->ProcessEvent( evt );
693 
694  return 0;
695 }
EDA_DRAW_FRAME::OnSelectGrid ID_TB_OPTIONS_SELECT_UNIT_INCH
Definition: draw_frame.cpp:124
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
bool ProcessEvent(wxEvent &aEvent) override
Function ProcessEvent overrides the default process event handler to implement the auto save feature...
Definition: basicframe.cpp:185
int PCBNEW_CONTROL::ToBeDone ( const TOOL_EVENT aEvent)

Definition at line 965 of file pcbnew_control.cpp.

References DisplayInfoMessage(), and m_frame.

Referenced by setTransitions().

966 {
967  DisplayInfoMessage( m_frame, _( "Not available in OpenGL/Cairo canvases." ) );
968 
969  return 0;
970 }
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:102
int PCBNEW_CONTROL::TrackDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 260 of file pcbnew_control.cpp.

References PCB_TOOL::board(), KIGFX::GEOMETRY, PCB_BASE_FRAME::GetDisplayOptions(), EDA_DRAW_FRAME::GetGalCanvas(), KIGFX::VIEW::GetPainter(), KIGFX::PCB_PAINTER::GetSettings(), TOOL_BASE::getView(), DISPLAY_OPTIONS::m_DisplayPcbTrackFill, m_frame, PCB_TRACE_T, EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::VIEW::Update(), and PCB_TOOL::view().

Referenced by setTransitions().

261 {
262  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
263  auto settings = painter->GetSettings();
264 
265  // Apply new display options to the GAL canvas
267  displ_opts->m_DisplayPcbTrackFill = !displ_opts->m_DisplayPcbTrackFill;
268  settings->LoadDisplayOptions( displ_opts );
269 
270  for( auto track : board()->Tracks() )
271  {
272  if( track->Type() == PCB_TRACE_T )
273  view()->Update( track, KIGFX::GEOMETRY );
274  }
275 
277 
278  return 0;
279 }
KIGFX::VIEW * view() const
Definition: pcb_tool.h:123
Class PCB_PAINTER Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:176
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:107
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
bool m_DisplayPcbTrackFill
Definition: pcbstruct.h:71
virtual PCB_RENDER_SETTINGS * GetSettings() override
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
Definition: pcb_painter.h:188
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:196
void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1385
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Class DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
Definition: pcbstruct.h:62
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:870
Color has changed.
Definition: view_item.h:57
BOARD * board() const
Definition: pcb_tool.h:126
void PCBNEW_CONTROL::updateGrid ( )
private

Applies the legacy canvas grid settings for GAL.

Definition at line 1042 of file pcbnew_control.cpp.

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

1043 {
1044  BASE_SCREEN* screen = m_frame->GetScreen();
1045  //GRID_TYPE grid = screen->GetGrid( idx );
1046  getView()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGridSize() ) );
1048 }
Auxiliary rendering target (noncached)
Definition: definitions.h:42
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:589
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:177
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:568
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
void SetGridSize(const VECTOR2D &aGridSize)
Set the grid size.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
PCB_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
int PCBNEW_CONTROL::ViaDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 305 of file pcbnew_control.cpp.

References PCB_TOOL::board(), KIGFX::GEOMETRY, PCB_BASE_FRAME::GetDisplayOptions(), EDA_DRAW_FRAME::GetGalCanvas(), KIGFX::VIEW::GetPainter(), KIGFX::PCB_PAINTER::GetSettings(), TOOL_BASE::getView(), DISPLAY_OPTIONS::m_DisplayViaFill, m_frame, PCB_TRACE_T, PCB_VIA_T, EDA_DRAW_PANEL_GAL::Refresh(), and KIGFX::VIEW::Update().

Referenced by setTransitions().

306 {
307  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
308  auto settings = painter->GetSettings();
310 
311  // Apply new display options to the GAL canvas
312  displ_opts->m_DisplayViaFill = !displ_opts->m_DisplayViaFill;
313  settings->LoadDisplayOptions( displ_opts );
314 
315  for( auto track : board()->Tracks() )
316  {
317  if( track->Type() == PCB_TRACE_T || track->Type() == PCB_VIA_T )
318  getView()->Update( track, KIGFX::GEOMETRY );
319  }
320 
322 
323  return 0;
324 }
Class PCB_PAINTER Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:176
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:107
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
virtual PCB_RENDER_SETTINGS * GetSettings() override
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
Definition: pcb_painter.h:188
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:196
void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1385
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Class DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
Definition: pcbstruct.h:62
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:870
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:108
bool m_DisplayViaFill
Definition: pcbstruct.h:66
Color has changed.
Definition: view_item.h:57
BOARD * board() const
Definition: pcb_tool.h:126
OPT_TOOL_EVENT TOOL_INTERACTIVE::Wait ( const TOOL_EVENT_LIST aEventList = TOOL_EVENTTC_ANYTA_ANY ))
inherited

Function Wait()

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

Definition at line 55 of file tool_interactive.cpp.

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

Referenced by DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), PCB_TOOL::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), GridSetOrigin(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), DRAWING_TOOL::PlaceDXF(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::runPolygonEventLoop(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), and PCB_EDITOR_CONTROL::ShowLocalRatsnest().

56 {
57  return m_toolMgr->ScheduleWait( this, aEventList );
58 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
boost::optional< 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.
int PCBNEW_CONTROL::ZoneDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 327 of file pcbnew_control.cpp.

References PCB_TOOL::board(), KIGFX::GEOMETRY, BOARD::GetAreaCount(), PCB_BASE_FRAME::GetDisplayOptions(), EDA_DRAW_FRAME::GetGalCanvas(), KIGFX::VIEW::GetPainter(), KIGFX::PCB_PAINTER::GetSettings(), TOOL_BASE::getView(), TOOL_EVENT::IsAction(), DISPLAY_OPTIONS::m_DisplayZonesMode, m_frame, EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::VIEW::Update(), PCB_TOOL::view(), PCB_ACTIONS::zoneDisplayDisable, PCB_ACTIONS::zoneDisplayEnable, and PCB_ACTIONS::zoneDisplayOutlines.

Referenced by setTransitions().

328 {
329  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
330  auto settings = painter->GetSettings();
332 
333  // Apply new display options to the GAL canvas
335  displ_opts->m_DisplayZonesMode = 0;
336  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayDisable ) )
337  displ_opts->m_DisplayZonesMode = 1;
338  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayOutlines ) )
339  displ_opts->m_DisplayZonesMode = 2;
340  else
341  assert( false );
342 
343  settings->LoadDisplayOptions( displ_opts );
344 
345  for( int i = 0; i < board()->GetAreaCount(); ++i )
346  view()->Update( board()->GetArea( i ), KIGFX::GEOMETRY );
347 
349 
350  return 0;
351 }
KIGFX::VIEW * view() const
Definition: pcb_tool.h:123
static TOOL_ACTION zoneDisplayOutlines
Definition: pcb_actions.h:250
static TOOL_ACTION zoneDisplayDisable
Definition: pcb_actions.h:249
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:54
Class PCB_PAINTER Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:176
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
virtual PCB_RENDER_SETTINGS * GetSettings() override
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
Definition: pcb_painter.h:188
int m_DisplayZonesMode
Definition: pcbstruct.h:77
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1011
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:196
void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1385
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Class DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
Definition: pcbstruct.h:62
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:870
Color has changed.
Definition: view_item.h:57
BOARD * board() const
Definition: pcb_tool.h:126
static TOOL_ACTION zoneDisplayEnable
Definition: pcb_actions.h:248

Member Data Documentation

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

Grid origin marker.

Definition at line 101 of file pcbnew_control.h.

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

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

Definition at line 210 of file tool_base.h.

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

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 215 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PAD_TOOL::applyPadSettings(), TOOL_BASE::attachManager(), PCB_EDITOR_CONTROL::calculateSelectionRatsnest(), GERBVIEW_SELECTION_TOOL::clearSelection(), SELECTION_TOOL::clearSelection(), PAD_TOOL::copyPadSettings(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_EDITOR_CONTROL::CrossProbePcbToSch(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), DeleteItemCursor(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), EDIT_TOOL::Duplicate(), EDIT_TOOL::editFootprintInFpEditor(), MODULE_EDITOR_TOOLS::EnumeratePads(), EDIT_TOOL::ExchangeFootprints(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::findCallback(), SELECTION_TOOL::findMove(), EDIT_TOOL::Flip(), 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_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ALIGN_DISTRIBUTE_TOOL::Init(), PAD_TOOL::Init(), POINT_EDITOR::Init(), PCB_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), TOOL_BASE::IsToolActive(), ZOOM_TOOL::Main(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), EDIT_TOOL::pickCopyReferencePoint(), placeBoardItems(), DRAWING_TOOL::PlaceDXF(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), GERBVIEW_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), TOOL_INTERACTIVE::resetTransitions(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), SELECTION_TOOL::SanitizeSelection(), SELECTION_TOOL::selectConnection(), SELECTION_TOOL::selectCopper(), GERBVIEW_SELECTION_TOOL::SelectItem(), SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), SELECTION_TOOL::selectOnSheetFromEeschema(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), TOOL_INTERACTIVE::SetContextMenu(), PCB_EDITOR_CONTROL::ShowLocalRatsnest(), GERBVIEW_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), GERBVIEW_SELECTION_TOOL::UnselectItem(), SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), EDIT_TOOL::updateModificationPoint(), PCB_EDITOR_CONTROL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), PCB_EDITOR_CONTROL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneMerge(), and PCB_EDITOR_CONTROL::ZoneUnfill().

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 214 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

TOOL_SETTINGS TOOL_BASE::m_toolSettings
protectedinherited

Definition at line 216 of file tool_base.h.

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

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 207 of file tool_base.h.

Referenced by TOOL_BASE::GetType().


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