46 auto snapIsSetToAllLayers =
51 if(
frame->GetMagneticItemsSettings() )
52 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.ResolveSnap( cursorPos,
nullptr ).position;
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& )
189 (*m_motionHandler)( cursorPos );
191 catch( std::exception& )
198 bool getNext =
false;
210 getNext = (*m_areaHandler)();
212 catch( std::exception& )
226 else if( evt->IsDblClick(
BUT_LEFT )
253 (*m_finalizeHandler)( finalize_state );
255 catch( std::exception& )
261 controls->ForceCursorPosition(
false );
265 frame->PopTool( sourceEvent );
305 statusPopup.SetText( wxGetTranslation( params.
m_Prompt ) );
307 const auto sendPoint =
308 [&](
const std::optional<VECTOR2I>& aPoint )
319 [&](
const VECTOR2D& aPoint ) ->
bool
323 sendPoint( snapped ? *snapped :
VECTOR2I( aPoint ) );
338 sendPoint( std::nullopt );
342 [&](
const int& aFinalState )
370 statusPopup.SetText( wxGetTranslation( params.
m_Prompt ) );
372 const auto sendItem =
384 [&](
const VECTOR2D& aPoint ) ->
bool
417 [&](
const int& aFinalState )
static TOOL_ACTION pickerSubTool
static TOOL_ACTION cancelInteractive
static TOOL_ACTION pickerTool
static TOOL_ACTION cursorDblClick
static TOOL_ACTION cursorClick
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION refreshPreview
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