51 const auto snapIsSetToAllLayers = [&](
const SELECTION& aSel )
85 wxT(
"PCB_PICKER_TOOL::Main() called without a source event" ) );
88 frame->PushTool( sourceEvent );
113 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
118 if( evt->IsCancelInteractive() || evt->IsActivate() )
124 (*m_cancelHandler)();
126 catch( std::exception& )
132 if( evt->IsActivate() )
141 bool getNext =
false;
149 getNext = (*m_clickHandler)( *m_picked );
151 catch( std::exception& )
168 else if( evt->IsMotion() )
174 (*m_motionHandler)( cursorPos );
176 catch( std::exception& )
206 (*m_finalizeHandler)( finalize_state );
208 catch( std::exception& )
218 frame->PopTool( sourceEvent );
252 statusPopup.SetText(
_( params.
m_Prompt ) );
254 const auto sendPoint = [&](
const std::optional<VECTOR2I>& aPoint )
261 [&](
const VECTOR2D& aPoint ) ->
bool
265 sendPoint( snapped ? *snapped :
VECTOR2I( aPoint ) );
280 sendPoint( std::nullopt );
284 [&](
const int& aFinalState )
311 statusPopup.SetText(
_( params.
m_Prompt ) );
313 const auto sendItem = [&](
const EDA_ITEM* aItem )
320 [&](
const VECTOR2D& aPoint ) ->
bool
332 anchor_item = sel.
Front();
337 sendItem( sel.
Front() );
351 sendItem( anchor_item );
355 [&](
const int& aFinalState )
static TOOL_ACTION pickerSubTool
static TOOL_ACTION cancelInteractive
static TOOL_ACTION pickerTool
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,...
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
virtual VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const =0
Return the current mouse pointer position.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
static LSET AllLayersMask()
static TOOL_ACTION magneticSnapAllLayers
static TOOL_ACTION magneticSnapActiveLayer
Snapping controls.
static TOOL_ACTION selectionClear
Clear the current selection.
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