46 auto snapIsSetToAllLayers =
51 if(
frame->GetMagneticItemsSettings() )
52 return frame->GetMagneticItemsSettings()->allLayers;
87 wxT(
"PCB_PICKER_TOOL::Main() called without a source event" ) );
90 frame->PushTool( sourceEvent );
110 cursorPos =
controls->GetMousePosition();
115 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
117 if( !evt->IsActivate() && !evt->IsCancelInteractive() )
120 cursorPos =
grid.BestSnapAnchor( cursorPos,
nullptr );
121 controls->ForceCursorPosition(
true, cursorPos );
129 if( evt->IsCancelInteractive() || evt->IsActivate() )
135 (*m_cancelHandler)();
137 catch( std::exception& )
143 if( evt->IsActivate() )
152 bool getNext =
false;
160 getNext = (*m_clickHandler)( *m_picked );
162 catch( std::exception& )
179 else if( evt->IsMotion() )
185 (*m_motionHandler)( cursorPos );
187 catch( std::exception& )
217 (*m_finalizeHandler)( finalize_state );
219 catch( std::exception& )
225 controls->ForceCursorPosition(
false );
229 frame->PopTool( sourceEvent );
263 frame()->PushTool( aEvent );
266 statusPopup.SetText( wxGetTranslation( params.
m_Prompt ) );
268 const auto sendPoint =
269 [&](
const std::optional<VECTOR2I>& aPoint )
280 [&](
const VECTOR2D& aPoint ) ->
bool
284 sendPoint( snapped ? *snapped :
VECTOR2I( aPoint ) );
299 sendPoint( std::nullopt );
303 [&](
const int& aFinalState )
317 frame()->PopTool( aEvent );
331 frame()->PushTool( aEvent );
334 statusPopup.SetText( wxGetTranslation( params.
m_Prompt ) );
336 const auto sendItem =
348 [&](
const VECTOR2D& aPoint ) ->
bool
359 anchor_item = sel.
Front();
364 sendItem( sel.
Front() );
378 sendItem( anchor_item );
382 [&](
const int& aFinalState )
396 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