50 auto snapIsSetToAllLayers =
55 if(
frame->GetMagneticItemsSettings() )
56 return frame->GetMagneticItemsSettings()->allLayers;
91 wxT(
"PCB_PICKER_TOOL::Main() called without a source event" ) );
94 frame->PushTool( sourceEvent );
114 cursorPos =
controls->GetMousePosition();
119 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
121 if( !evt->IsActivate() && !evt->IsCancelInteractive() )
124 cursorPos =
grid.BestSnapAnchor( cursorPos,
nullptr );
125 controls->ForceCursorPosition(
true, cursorPos );
133 if( evt->IsCancelInteractive() || evt->IsActivate() )
139 (*m_cancelHandler)();
141 catch( std::exception& )
147 if( evt->IsActivate() )
156 bool getNext =
false;
164 getNext = (*m_clickHandler)( *m_picked );
166 catch( std::exception& )
183 else if( evt->IsMotion() )
189 (*m_motionHandler)( cursorPos );
191 catch( std::exception& )
221 (*m_finalizeHandler)( finalize_state );
223 catch( std::exception& )
229 controls->ForceCursorPosition(
false );
233 frame->PopTool( sourceEvent );
267 frame()->PushTool( aEvent );
270 statusPopup.SetText( wxGetTranslation( params.
m_Prompt ) );
272 const auto sendPoint =
273 [&](
const std::optional<VECTOR2I>& aPoint )
284 [&](
const VECTOR2D& aPoint ) ->
bool
288 sendPoint( snapped ? *snapped :
VECTOR2I( aPoint ) );
303 sendPoint( std::nullopt );
307 [&](
const int& aFinalState )
321 frame()->PopTool( aEvent );
335 frame()->PushTool( aEvent );
338 statusPopup.SetText( wxGetTranslation( params.
m_Prompt ) );
340 const auto sendItem =
352 [&](
const VECTOR2D& aPoint ) ->
bool
363 anchor_item = sel.
Front();
368 sendItem( sel.
Front() );
382 sendItem( anchor_item );
386 [&](
const int& aFinalState )
400 frame()->PopTool( aEvent );
static TOOL_ACTION pickerSubTool
static TOOL_ACTION cancelInteractive
static TOOL_ACTION pickerTool
static TOOL_ACTION selectionClear
Clear the current selection.
void SetStatusPopup(wxWindow *aPopup)
A base class for most all the KiCad significant classes used in schematics and boards.
Used when the right click button is pressed, or when the select tool is in effect.
std::optional< VECTOR2I > GetSnappedPoint() const
An interface for classes handling user events controlling the view behavior such as zooming,...
static const LSET & AllLayersMask()
static TOOL_ACTION magneticSnapAllLayers
static TOOL_ACTION magneticSnapActiveLayer
Snapping controls.
static TOOL_ACTION selectPointInteractively
static TOOL_ACTION selectItemInteractively
Selection of reference points/items.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
bool Empty() const
Checks if there is anything selected.
std::vector< FAB_LAYER_COLOR > dummy
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D