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

Protected Attributes

bool m_editModules
 
TOOL_TYPE m_type
 

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

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

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 
TOOL_SETTINGS m_toolSettings
 

Private Member Functions

int placeBoardItems (BOARD *aBoard)
 
int placeBoardItems (std::vector< BOARD_ITEM * > &aItems, bool aIsNew)
 add and selec or just select for move/place command a list of board items. More...
 
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 104 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:69
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 898 of file pcbnew_control.cpp.

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

Referenced by AppendBoardFromFile().

899 {
900  PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
901 
902  if( !editFrame )
903  return 1;
904 
905  BOARD* brd = board();
906 
907  if( !brd )
908  return 1;
909 
910  // Mark existing items, in order to know what are the new items
911  // to be ble to select only the new items after loadind
912  for( auto track : brd->Tracks() )
913  {
914  track->SetFlags( FLAG0 );
915  }
916 
917  for( auto module : brd->Modules() )
918  {
919  module->SetFlags( FLAG0 );
920  }
921 
922  for( auto drawing : brd->Drawings() )
923  {
924  drawing->SetFlags( FLAG0 );
925  }
926 
927  for( auto zone : brd->Zones() )
928  {
929  zone->SetFlags( FLAG0 );
930  }
931 
932  // Keep also the count of copper layers, to adjust if necessary
933  int initialCopperLayerCount = brd->GetCopperLayerCount();
934  LSET initialEnabledLayers = brd->GetEnabledLayers();
935 
936  // Load the data
937  try
938  {
939  PROPERTIES props;
940  char xbuf[30];
941  char ybuf[30];
942 
943  // EAGLE_PLUGIN can use this info to center the BOARD, but it does not yet.
944  sprintf( xbuf, "%d", editFrame->GetPageSizeIU().x );
945  sprintf( ybuf, "%d", editFrame->GetPageSizeIU().y );
946 
947  props["page_width"] = xbuf;
948  props["page_height"] = ybuf;
949 
950  editFrame->GetDesignSettings().m_NetClasses.Clear();
951  pi.Load( fileName, brd, &props );
952  }
953  catch( const IO_ERROR& ioe )
954  {
955  wxString msg = wxString::Format( _( "Error loading board.\n%s" ), GetChars( ioe.What() ));
956  DisplayError( editFrame, msg );
957 
958  return 0;
959  }
960 
961  // rebuild nets and ratsnest before any use of nets
962  brd->BuildListOfNets();
964  brd->BuildConnectivity();
965 
966  // Synchronize layers
967  // we should not ask PLUGINs to do these items:
968  int copperLayerCount = brd->GetCopperLayerCount();
969 
970  if( copperLayerCount > initialCopperLayerCount )
971  brd->SetCopperLayerCount( copperLayerCount );
972 
973  // Enable all used layers, and make them visible:
974  LSET enabledLayers = brd->GetEnabledLayers();
975  enabledLayers |= initialEnabledLayers;
976  brd->SetEnabledLayers( enabledLayers );
977  brd->SetVisibleLayers( enabledLayers );
978 
979 
980  return placeBoardItems( brd );
981 }
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 SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:280
DLIST_ITERATOR_WRAPPER< MODULE > Modules()
Definition: class_board.h:250
void SetVisibleLayers(LSET aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
MODULE * module() const
Definition: pcb_tool.h:136
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
void BuildConnectivity()
Builds or rebuilds the board connectivity database for the board, especially the list of connected it...
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
ZONE_CONTAINERS & Zones()
Definition: class_board.h:252
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:73
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...
DLIST_ITERATOR_WRAPPER< BOARD_ITEM > Drawings()
Definition: class_board.h:251
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:135
int PCBNEW_CONTROL::AppendBoardFromFile ( const TOOL_EVENT aEvent)

Definition at line 806 of file pcbnew_control.cpp.

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

Referenced by setTransitions().

807 {
808  int open_ctl;
809  wxString fileName;
810 
811  PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
812 
813  if( !editFrame )
814  return 1;
815 
816  // Pick a file to append
817  if( !AskLoadBoardFileName( editFrame, &open_ctl, &fileName, true ) )
818  return 1;
819 
820  IO_MGR::PCB_FILE_T pluginType = plugin_type( fileName, open_ctl );
821  PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
822 
823  return AppendBoard( *pi, fileName );
824 }
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:546
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 135 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(), POINT_EDITOR::finishItem(), SELECTION_TOOL::getCollectorsGuide(), 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(), placeBoardItems(), 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(), ZONE_FILLER_TOOL::ZoneFill(), ZONE_FILLER_TOOL::ZoneFillAll(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

135 { return getModel<BOARD>(); }
PCB_DRAW_PANEL_GAL * PCB_TOOL::canvas ( ) const
protectedinherited

Definition at line 213 of file pcb_tool.cpp.

References PCB_TOOL::frame(), and EDA_DRAW_FRAME::GetGalCanvas().

Referenced by HighContrastMode(), PadDisplayMode(), TrackDisplayMode(), ViaDisplayMode(), ZoneDisplayMode(), and SELECTION_TOOL::zoomFitSelection().

214 {
215  return static_cast<PCB_DRAW_PANEL_GAL*>( frame()->GetGalCanvas() );
216 }
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:134
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:864
int PCBNEW_CONTROL::CursorControl ( const TOOL_EVENT aEvent)

Definition at line 479 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, GRID_HELPER::GetGrid(), KIGFX::VIEW_CONTROLS::GetRawCursorPosition(), 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().

480 {
481  long type = aEvent.Parameter<intptr_t>();
482  bool fastMove = type & PCB_ACTIONS::CURSOR_FAST_MOVE;
483  type &= ~PCB_ACTIONS::CURSOR_FAST_MOVE;
484  bool mirroredX = getView()->IsMirroredX();
485 
486  GRID_HELPER gridHelper( m_frame );
487  VECTOR2D cursor = getViewControls()->GetRawCursorPosition( true );
488  VECTOR2I gridSize = gridHelper.GetGrid();
489 
490  if( fastMove )
491  gridSize = gridSize * 10;
492 
493  switch( type )
494  {
496  cursor -= VECTOR2D( 0, gridSize.y );
497  break;
498 
500  cursor += VECTOR2D( 0, gridSize.y );
501  break;
502 
504  cursor -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
505  break;
506 
508  cursor += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
509  break;
510 
511  case PCB_ACTIONS::CURSOR_CLICK: // fall through
513  {
514  TOOL_ACTIONS action = TA_NONE;
515  int modifiers = 0;
516 
517  modifiers |= wxGetKeyState( WXK_SHIFT ) ? MD_SHIFT : 0;
518  modifiers |= wxGetKeyState( WXK_CONTROL ) ? MD_CTRL : 0;
519  modifiers |= wxGetKeyState( WXK_ALT ) ? MD_ALT : 0;
520 
521  if( type == PCB_ACTIONS::CURSOR_CLICK )
522  action = TA_MOUSE_CLICK;
523  else if( type == PCB_ACTIONS::CURSOR_DBL_CLICK )
524  action = TA_MOUSE_DBLCLICK;
525  else
526  assert( false );
527 
528  TOOL_EVENT evt( TC_MOUSE, action, BUT_LEFT | modifiers );
529  evt.SetMousePosition( getViewControls()->GetCursorPosition() );
530  m_toolMgr->ProcessEvent( evt );
531 
532  return 0;
533  }
534  break;
535  }
536 
537  getViewControls()->SetCursorPosition( cursor );
538 
539  return 0;
540 }
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:588
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
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
virtual VECTOR2D GetRawCursorPosition(bool aSnappingEnabled=true) const =0
Returns the current cursor position in world coordinates - ingoring the cursorUp position force mode...
int PCBNEW_CONTROL::DeleteItemCursor ( const TOOL_EVENT aEvent)

Definition at line 712 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().

713 {
714  Activate();
715 
717  assert( picker );
718 
719  // TODO it will not check the toolbar button in the module editor, as it uses a different ID..
720  m_frame->SetToolID( ID_PCB_DELETE_ITEM_BUTT, wxCURSOR_BULLSEYE, _( "Delete item" ) );
721  picker->SetSnapping( false );
722  picker->SetClickHandler( std::bind( deleteItem, m_toolMgr, _1 ) );
723  picker->Activate();
724  Wait();
725 
726  return 0;
727 }
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.
PCB_DISPLAY_OPTIONS * PCB_TOOL::displayOptions ( ) const
protectedinherited

Definition at line 208 of file pcb_tool.cpp.

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

Referenced by HighContrastMode(), PadDisplayMode(), PNS::TOOL_BASE::pickSingleItem(), TrackDisplayMode(), ViaDisplayMode(), and ZoneDisplayMode().

209 {
210  return static_cast<PCB_DISPLAY_OPTIONS*>( frame()->GetDisplayOptions() );
211 }
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings...
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:134
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 39 of file pcb_tool.cpp.

References TOOL_INTERACTIVE::Activate(), KIGFX::PCB_VIEW::Add(), KIGFX::VIEW_GROUP::Add(), SELECTION::Add(), COMMIT::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::PCB_VIEW::Remove(), KIGFX::VIEW_GROUP::Remove(), SELECTION::Remove(), TOOL_MANAGER::RunAction(), MODULE::RunOnChildren(), PCB_ACTIONS::selectionClear, KIGFX::VIEW_CONTROLS::SetAutoPan(), KIGFX::VIEW_CONTROLS::SetSnapping(), KIGFX::VIEW_CONTROLS::ShowCursor(), TC_COMMAND, KIGFX::PCB_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().

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

Definition at line 97 of file pcb_tool.h.

References PCB_TOOL::m_editModules.

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

98  {
99  return m_editModules;
100  }
bool m_editModules
Definition: pcb_tool.h:142
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 134 of file pcb_tool.h.

Referenced by POINT_EDITOR::addCorner(), MICROWAVE_TOOL::addMicrowaveFootprint(), PAD_TOOL::applyPadSettings(), PCB_TOOL::canvas(), 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::displayOptions(), 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(), SELECTION_TOOL::Init(), 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(), MODULE_EDITOR_TOOLS::PlacePad(), ROUTER_TOOL::prepareInteractive(), PAD_TOOL::pushPadSettings(), POINT_EDITOR::removeCorner(), 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(), ZONE_FILLER_TOOL::ZoneFill(), and ZONE_FILLER_TOOL::ZoneFillAll().

134 { 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(), and TOOL_SETTINGS::getConfigBase().

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::commitZone(), 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:178
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 ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), 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(), 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(), 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(), 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(), PCB_TOOL::view(), 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(), ZONE_FILLER_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(), PCB_EDITOR_CONTROL::setTransitions(), GERBVIEW_SELECTION_TOOL::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 582 of file pcbnew_control.cpp.

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

Referenced by setTransitions().

583 {
585  updateGrid();
586 
587  return 0;
588 }
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 591 of file pcbnew_control.cpp.

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

Referenced by setTransitions().

592 {
594  updateGrid();
595 
596  return 0;
597 }
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 639 of file pcbnew_control.cpp.

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

Referenced by setTransitions().

640 {
641  board()->SetGridOrigin( wxPoint( 0, 0 ) );
642  m_gridOrigin->SetPosition( VECTOR2D( 0, 0 ) );
643 
644  return 0;
645 }
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:588
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Grid origin marker.
BOARD * board() const
Definition: pcb_tool.h:135
int PCBNEW_CONTROL::GridSetOrigin ( const TOOL_EVENT aEvent)

Definition at line 612 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().

613 {
614  VECTOR2D* origin = aEvent.Parameter<VECTOR2D*>();
615 
616  if( origin )
617  {
618  setOrigin( getView(), m_frame, m_gridOrigin.get(), *origin );
619  delete origin;
620  }
621  else
622  {
623  Activate();
624 
626  assert( picker );
627 
628  // TODO it will not check the toolbar button in module editor, as it uses a different ID..
629  m_frame->SetToolID( ID_PCB_PLACE_GRID_COORD_BUTT, wxCURSOR_PENCIL, _( "Adjust grid origin" ) );
630  picker->SetClickHandler( std::bind( setOrigin, getView(), m_frame, m_gridOrigin.get(), _1 ) );
631  picker->Activate();
632  Wait();
633  }
634 
635  return 0;
636 }
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 363 of file pcbnew_control.cpp.

Referenced by setTransitions().

364 {
365  return 0;
366 }
int PCBNEW_CONTROL::HighContrastInc ( const TOOL_EVENT aEvent)

Definition at line 357 of file pcbnew_control.cpp.

Referenced by setTransitions().

358 {
359  return 0;
360 }
int PCBNEW_CONTROL::HighContrastMode ( const TOOL_EVENT aEvent)

Definition at line 345 of file pcbnew_control.cpp.

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

Referenced by setTransitions().

346 {
347  auto opts = displayOptions();
348 
349  Flip( opts->m_ContrastModeDisplay );
350  view()->UpdateDisplayOptions( opts );
352 
353  return 0;
354 }
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
PCB_DRAW_PANEL_GAL * canvas() const
Definition: pcb_tool.cpp:213
PCB_DISPLAY_OPTIONS * displayOptions() const
Definition: pcb_tool.cpp:208
void UpdateDisplayOptions(PCB_DISPLAY_OPTIONS *aOptions)
Definition: pcb_view.cpp:103
virtual void SetHighContrastLayer(int aLayer) override
>
KIGFX::PCB_VIEW * view() const
Definition: pcb_tool.h:132
void Flip(T &aValue)
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 459 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().

460 {
461  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
462  auto settings = painter->GetSettings();
463 
464  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
465  KIGFX::COLOR4D currentColor = settings->GetLayerColor( currentLayer );
466 
467  if( currentColor.a >= 0.05 )
468  {
469  currentColor.a -= 0.05;
470  settings->SetLayerColor( currentLayer, currentColor );
471  m_frame->GetGalCanvas()->GetView()->UpdateLayerColor( currentLayer );
472  }
473 
474  return 0;
475 }
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:294
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:864
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 440 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().

441 {
442  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
443  auto settings = painter->GetSettings();
444 
445  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
446  KIGFX::COLOR4D currentColor = settings->GetLayerColor( currentLayer );
447 
448  if( currentColor.a <= 0.95 )
449  {
450  currentColor.a += 0.05;
451  settings->SetLayerColor( currentLayer, currentColor );
452  m_frame->GetGalCanvas()->GetView()->UpdateLayerColor( currentLayer );
453  }
454 
455  return 0;
456 }
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:294
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:864
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 378 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().

379 {
380  PCB_BASE_FRAME* editFrame = m_frame;
381  LAYER_NUM layer = editFrame->GetActiveLayer();
382 
383  if( layer < F_Cu || layer > B_Cu )
384  return 0;
385 
386  int layerCount = board()->GetCopperLayerCount();
387 
388  if( layer == layerCount - 2 || layerCount < 2 )
389  layer = B_Cu;
390  else if( layer == B_Cu )
391  layer = F_Cu;
392  else
393  ++layer;
394 
395  assert( IsCopperLayer( layer ) );
396  editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
397 
398  return 0;
399 }
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:135
int PCBNEW_CONTROL::LayerPrev ( const TOOL_EVENT aEvent)

Definition at line 402 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().

403 {
404  PCB_BASE_FRAME* editFrame = m_frame;
405  LAYER_NUM layer = editFrame->GetActiveLayer();
406 
407  if( layer < F_Cu || layer > B_Cu )
408  return 0;
409 
410  int layerCount = board()->GetCopperLayerCount();
411 
412  if( layer == F_Cu || layerCount < 2 )
413  layer = B_Cu;
414  else if( layer == B_Cu )
415  layer = layerCount - 2;
416  else
417  --layer;
418 
419  assert( IsCopperLayer( layer ) );
420  editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
421 
422  return 0;
423 }
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:135
int PCBNEW_CONTROL::LayerSwitch ( const TOOL_EVENT aEvent)

Definition at line 370 of file pcbnew_control.cpp.

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

Referenced by setTransitions().

371 {
372  m_frame->SwitchLayer( NULL, (PCB_LAYER_ID) aEvent.Parameter<intptr_t>() );
373 
374  return 0;
375 }
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 426 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().

427 {
428  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
429  PCB_SCREEN* screen = m_frame->GetScreen();
430 
431  if( currentLayer == screen->m_Route_Layer_TOP )
432  m_frame->SwitchLayer( NULL, screen->m_Route_Layer_BOTTOM );
433  else
434  m_frame->SwitchLayer( NULL, screen->m_Route_Layer_TOP );
435 
436  return 0;
437 }
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(), PCB_TOOL::canvas(), PCB_TOOL::displayOptions(), Flip(), KIGFX::GEOMETRY, PCB_TOOL::module(), MODULE::Pads(), EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::PCB_VIEW::Update(), KIGFX::PCB_VIEW::UpdateDisplayOptions(), and PCB_TOOL::view().

Referenced by setTransitions().

283 {
284  auto opts = displayOptions();
285 
286  Flip( opts->m_DisplayPadFill );
287  view()->UpdateDisplayOptions( opts );
288 
289  for( auto module : board()->Modules() ) // fixme: move to PCB_VIEW
290  {
291  for( auto pad : module->Pads() )
292  view()->Update( pad, KIGFX::GEOMETRY );
293  }
294 
295  canvas()->Refresh();
296 
297  return 0;
298 }
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:81
DLIST_ITERATOR_WRAPPER< D_PAD > Pads()
Definition: class_module.h:160
PCB_DRAW_PANEL_GAL * canvas() const
Definition: pcb_tool.cpp:213
PCB_DISPLAY_OPTIONS * displayOptions() const
Definition: pcb_tool.cpp:208
MODULE * module() const
Definition: pcb_tool.h:136
void UpdateDisplayOptions(PCB_DISPLAY_OPTIONS *aOptions)
Definition: pcb_view.cpp:103
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...
KIGFX::PCB_VIEW * view() const
Definition: pcb_tool.h:132
void Flip(T &aValue)
Color has changed.
Definition: view_item.h:57
BOARD * board() const
Definition: pcb_tool.h:135
int PCBNEW_CONTROL::PanControl ( const TOOL_EVENT aEvent)

Definition at line 543 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().

544 {
545  long type = aEvent.Parameter<intptr_t>();
546  KIGFX::VIEW* view = getView();
547  GRID_HELPER gridHelper( m_frame );
548  VECTOR2D center = view->GetCenter();
549  VECTOR2I gridSize = gridHelper.GetGrid() * 10;
550  bool mirroredX = view->IsMirroredX();
551 
552  switch( type )
553  {
555  center -= VECTOR2D( 0, gridSize.y );
556  break;
557 
559  center += VECTOR2D( 0, gridSize.y );
560  break;
561 
563  center -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
564  break;
565 
567  center += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
568  break;
569 
570  default:
571  assert( false );
572  break;
573  }
574 
575  view->SetCenter( center );
576 
577  return 0;
578 }
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:588
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
KIGFX::PCB_VIEW * view() const
Definition: pcb_tool.h:132
Class VIEW.
Definition: view.h:58
int PCBNEW_CONTROL::PasteItemsFromClipboard ( const TOOL_EVENT aEvent)

Definition at line 729 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().

730 {
731  CLIPBOARD_IO pi;
732  BOARD tmpBoard;
733  BOARD_ITEM* clipItem = pi.Parse();
734 
735  if( !clipItem )
736  {
737  return 0;
738  }
739 
740  if( clipItem->Type() == PCB_T )
741  static_cast<BOARD*>(clipItem)->ClearAllNetCodes();
742 
743  bool editModules = m_editModules || frame()->IsType( FRAME_PCB_MODULE_EDITOR );
744 
745  // The clipboard can contain two different things, an entire kicad_pcb
746  // or a single module
747 
748  if( editModules && ( !board() || !module() ) )
749  {
750  wxLogDebug( wxT( "Attempting to paste to empty module editor window\n") );
751  return 0;
752  }
753 
754 
755  switch( clipItem->Type() )
756  {
757  case PCB_T:
758  {
759  if( editModules )
760  {
761  wxLogDebug( wxT( "attempting to paste a pcb in the footprint editor\n") );
762  return 0;
763  }
764 
765  placeBoardItems( static_cast<BOARD*>( clipItem ) );
766  break;
767  }
768 
769  case PCB_MODULE_T:
770  {
771  std::vector<BOARD_ITEM *> items;
772 
773  clipItem->SetParent( board() );
774 
775  if( editModules )
776  {
777  auto mod = static_cast<MODULE *>( clipItem );
778 
779  for( auto pad : mod->Pads() )
780  {
781  pad->SetParent ( board()->m_Modules.GetFirst() );
782  items.push_back( pad );
783  }
784  for( auto item : mod->GraphicalItems() )
785  {
786  item->SetParent ( board()->m_Modules.GetFirst() );
787  items.push_back( item );
788  }
789  }
790  else
791  {
792  items.push_back( clipItem );
793  }
794 
795  placeBoardItems( items, true );
796  break;
797  }
798  default:
799  m_frame->DisplayToolMsg( _( "Invalid clipboard contents" ) );
800  // FAILED
801  break;
802  }
803  return 1;
804 }
BOARD_ITEM * Parse()
KICAD_T Type() const
Function Type()
Definition: base_struct.h:225
Definition: typeinfo.h:85
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:89
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:240
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:134
MODULE * module() const
Definition: pcb_tool.h:136
int placeBoardItems(BOARD *aBoard)
bool m_editModules
Definition: pcb_tool.h:142
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:135
int PCBNEW_CONTROL::placeBoardItems ( BOARD aBoard)
private

Definition at line 826 of file pcbnew_control.cpp.

References PCB_TOOL::board(), EDA_ITEM::ClearFlags(), BOARD::Drawings(), FLAG0, EDA_ITEM::GetFlags(), PCB_TOOL::module(), BOARD::Modules(), BOARD::Tracks(), and BOARD::Zones().

Referenced by AppendBoard(), and PasteItemsFromClipboard().

827 {
828  std::vector<BOARD_ITEM*> items;
829 
830  for( auto track : aBoard->Tracks() )
831  {
832  if( track->GetFlags() & FLAG0 )
833  track->ClearFlags( FLAG0 );
834  else
835  items.push_back( track );
836  }
837 
838  for( auto module : aBoard->Modules() )
839  {
840  if( module->GetFlags() & FLAG0 )
841  module->ClearFlags( FLAG0 );
842  else
843  items.push_back( module );
844  }
845 
846  for( auto drawing : aBoard->Drawings() )
847  {
848  if( drawing->GetFlags() & FLAG0 )
849  drawing->ClearFlags( FLAG0 );
850  else
851  items.push_back( drawing );
852  }
853 
854  for( auto zone : aBoard->Zones() )
855  {
856  if( zone->GetFlags() & FLAG0 )
857  zone->ClearFlags( FLAG0 );
858  else
859  items.push_back( zone );
860  }
861 
862  // items are new if the current board is not the board source
863  bool isNew = board() != aBoard;
864  return placeBoardItems( items, isNew );
865 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:282
DLIST_ITERATOR_WRAPPER< MODULE > Modules()
Definition: class_board.h:250
MODULE * module() const
Definition: pcb_tool.h:136
int placeBoardItems(BOARD *aBoard)
#define FLAG0
Pcbnew: flag used in local computations.
Definition: base_struct.h:145
ZONE_CONTAINERS & Zones()
Definition: class_board.h:252
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:281
DLIST_ITERATOR_WRAPPER< TRACK > Tracks()
Definition: class_board.h:249
DLIST_ITERATOR_WRAPPER< BOARD_ITEM > Drawings()
Definition: class_board.h:251
BOARD * board() const
Definition: pcb_tool.h:135
int PCBNEW_CONTROL::placeBoardItems ( std::vector< BOARD_ITEM * > &  aItems,
bool  aIsNew 
)
private

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

Parameters
aItemsis the list of items
aIsNew= true to add items to the current board, false to just select if items are already managed by the current board

Definition at line 868 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, PCB_TOOL::selection(), and PCB_ACTIONS::selectionClear.

869 {
871 
872  auto selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
873  auto editTool = m_toolMgr->GetTool<EDIT_TOOL>();
874 
875  SELECTION& selection = selectionTool->GetSelection();
876 
877  for( auto item : aItems )
878  {
879  item->SetSelected();
880  selection.Add( item );
881 
882  // Add or just select items for the move/place command
883  if( aIsNew )
884  editTool->GetCurrentCommit()->Add( item );
885  else
886  editTool->GetCurrentCommit()->Added( item );
887  }
888 
889  selection.SetReferencePoint( VECTOR2I( 0, 0 ) );
890 
893 
894  return 0;
895 }
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:589
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).
const SELECTION & selection() const
Definition: pcb_tool.cpp:218
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.

Reimplemented from PCB_TOOL.

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
virtual 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
virtual 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:135
int PCBNEW_CONTROL::ResetCoords ( const TOOL_EVENT aEvent)

Definition at line 649 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().

650 {
651  VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
652 
653  m_frame->GetScreen()->m_O_Curseur = wxPoint( cursorPos.x, cursorPos.y );
655 
656  return 0;
657 }
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)
const SELECTION & PCB_TOOL::selection ( ) const
protectedinherited

Definition at line 218 of file pcb_tool.cpp.

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

Referenced by PAD_TOOL::applyPadSettings(), PCB_EDITOR_CONTROL::calculateSelectionRatsnest(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_EDITOR_CONTROL::CrossProbePcbToSch(), EDIT_TOOL::Duplicate(), EDIT_TOOL::editFootprintInFpEditor(), EDIT_TOOL::ExchangeFootprints(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::filterSelection(), EDIT_TOOL::Flip(), DRAWING_TOOL::getSourceZoneForAction(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::Main(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), placeBoardItems(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EDIT_TOOL::Remove(), EDIT_TOOL::Rotate(), SELECTION_TOOL::selectConnection(), SELECTION_TOOL::selectCopper(), PCB_TOOL::selection(), SELECTION_TOOL::selectNet(), EDIT_TOOL::uniqueSelected(), PCB_EDITOR_CONTROL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ZoneDuplicate(), ZONE_FILLER_TOOL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfill().

219 {
220  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
221  const auto& selection = selTool->GetSelection();
222  return selection;
223 }
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
const SELECTION & selection() const
Definition: pcb_tool.cpp:218
SELECTION & PCB_TOOL::selection ( )
protectedinherited

Definition at line 225 of file pcb_tool.cpp.

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

226 {
227  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
228  auto& selection = selTool->GetSelection();
229  return selection;
230 }
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
const SELECTION & selection() const
Definition: pcb_tool.cpp:218
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 92 of file pcb_tool.h.

References PCB_TOOL::m_editModules.

93  {
94  m_editModules = aEnabled;
95  }
bool m_editModules
Definition: pcb_tool.h:142
void PCBNEW_CONTROL::setTransitions ( )
overridevirtual

Sets up handlers for various events.

Reimplemented from PCB_TOOL.

Definition at line 1000 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.

1001 {
1002  // Display modes
1012 
1013  // Layer control
1027 
1028  // Cursor control
1039 
1040  // Pan control
1045 
1046  // Grid control
1051 
1052  // Miscellaneous
1059 
1060  // Append control
1062  PCB_ACTIONS::appendBoard.MakeEvent() );
1063 
1065  PCB_ACTIONS::pasteFromClipboard.MakeEvent() );
1066 }
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 984 of file pcbnew_control.cpp.

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

Referenced by setTransitions().

985 {
987 
988  return 0;
989 }
EDA_HOTKEY_CONFIG * GetHotkeyConfig() const
Function GetHotkeyConfig() Returns a structure containing currently used hotkey mapping.
Definition: draw_frame.h:377
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 660 of file pcbnew_control.cpp.

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

Referenced by setTransitions().

661 {
662  auto& galOpts = m_frame->GetGalDisplayOptions();
663 
664  galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor;
665  galOpts.NotifyChanged();
666 
667  return 0;
668 }
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for render...
Definition: draw_frame.h:885
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 671 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().

672 {
673  // TODO should not it be refactored to pcb_frame member function?
674  wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
675 
676  if( g_UserUnit == INCHES )
677  evt.SetId( ID_TB_OPTIONS_SELECT_UNIT_MM );
678  else
679  evt.SetId( ID_TB_OPTIONS_SELECT_UNIT_INCH );
680 
681  m_frame->ProcessEvent( evt );
682 
683  return 0;
684 }
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 992 of file pcbnew_control.cpp.

References DisplayInfoMessage(), and m_frame.

Referenced by setTransitions().

993 {
994  DisplayInfoMessage( m_frame, _( "Not available in OpenGL/Cairo canvases." ) );
995 
996  return 0;
997 }
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:104
int PCBNEW_CONTROL::TrackDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 264 of file pcbnew_control.cpp.

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

Referenced by setTransitions().

265 {
266  auto opts = displayOptions();
267 
268  Flip( opts->m_DisplayPcbTrackFill );
269  view()->UpdateDisplayOptions( opts );
270 
271  for( auto track : board()->Tracks() )
272  {
273  if( track->Type() == PCB_TRACE_T )
274  view()->Update( track, KIGFX::GEOMETRY );
275  }
276 
277  canvas()->Refresh();
278 
279  return 0;
280 }
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:81
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
PCB_DRAW_PANEL_GAL * canvas() const
Definition: pcb_tool.cpp:213
PCB_DISPLAY_OPTIONS * displayOptions() const
Definition: pcb_tool.cpp:208
void UpdateDisplayOptions(PCB_DISPLAY_OPTIONS *aOptions)
Definition: pcb_view.cpp:103
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...
KIGFX::PCB_VIEW * view() const
Definition: pcb_tool.h:132
void Flip(T &aValue)
Color has changed.
Definition: view_item.h:57
BOARD * board() const
Definition: pcb_tool.h:135
void PCBNEW_CONTROL::updateGrid ( )
private

Applies the legacy canvas grid settings for GAL.

Definition at line 1069 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().

1070 {
1071  BASE_SCREEN* screen = m_frame->GetScreen();
1072  //GRID_TYPE grid = screen->GetGrid( idx );
1073  getView()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGridSize() ) );
1075 }
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:588
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 301 of file pcbnew_control.cpp.

References PCB_TOOL::board(), PCB_TOOL::canvas(), PCB_TOOL::displayOptions(), Flip(), KIGFX::GEOMETRY, PCB_TRACE_T, PCB_VIA_T, EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::PCB_VIEW::Update(), KIGFX::PCB_VIEW::UpdateDisplayOptions(), and PCB_TOOL::view().

Referenced by setTransitions().

302 {
303  auto opts = displayOptions();
304 
305  Flip( opts->m_DisplayViaFill );
306  view()->UpdateDisplayOptions( opts );
307 
308  for( auto track : board()->Tracks() )
309  {
310  if( track->Type() == PCB_TRACE_T || track->Type() == PCB_VIA_T )
311  view()->Update( track, KIGFX::GEOMETRY );
312  }
313 
314  canvas()->Refresh();
315 
316  return 0;
317 }
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:81
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
PCB_DRAW_PANEL_GAL * canvas() const
Definition: pcb_tool.cpp:213
PCB_DISPLAY_OPTIONS * displayOptions() const
Definition: pcb_tool.cpp:208
void UpdateDisplayOptions(PCB_DISPLAY_OPTIONS *aOptions)
Definition: pcb_view.cpp:103
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...
KIGFX::PCB_VIEW * view() const
Definition: pcb_tool.h:132
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
void Flip(T &aValue)
Color has changed.
Definition: view_item.h:57
BOARD * board() const
Definition: pcb_tool.h:135
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
OPT< TOOL_EVENT > ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pauses execution of a given tool until one or more events matching aConditions arrives.
int PCBNEW_CONTROL::ZoneDisplayMode ( const TOOL_EVENT aEvent)

Definition at line 320 of file pcbnew_control.cpp.

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

Referenced by setTransitions().

321 {
322  auto opts = displayOptions();
323 
324  // Apply new display options to the GAL canvas
326  opts->m_DisplayZonesMode = 0;
327  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayDisable ) )
328  opts->m_DisplayZonesMode = 1;
329  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayOutlines ) )
330  opts->m_DisplayZonesMode = 2;
331  else
332  assert( false );
333 
334  view()->UpdateDisplayOptions( opts );
335 
336  for( int i = 0; i < board()->GetAreaCount(); ++i )
337  view()->Update( board()->GetArea( i ), KIGFX::GEOMETRY );
338 
339  canvas()->Refresh();
340 
341  return 0;
342 }
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:81
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
PCB_DRAW_PANEL_GAL * canvas() const
Definition: pcb_tool.cpp:213
PCB_DISPLAY_OPTIONS * displayOptions() const
Definition: pcb_tool.cpp:208
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1011
void UpdateDisplayOptions(PCB_DISPLAY_OPTIONS *aOptions)
Definition: pcb_view.cpp:103
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...
KIGFX::PCB_VIEW * view() const
Definition: pcb_tool.h:132
Color has changed.
Definition: view_item.h:57
BOARD * board() const
Definition: pcb_tool.h:135
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 107 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(), POINT_EDITOR::removeCorner(), 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(), PCB_TOOL::selection(), 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(), and PCB_EDITOR_CONTROL::ZoneMerge().

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: