54 m_selectionTool( nullptr )
62 m_commit = std::make_unique<BOARD_COMMIT>(
this );
98 std::deque<EDA_ITEM*>& items = padsOnly.
Items();
99 items.erase( std::remove_if( items.begin(), items.end(),
102 return aItem->Type() != PCB_PAD_T;
152 frame()->PushTool( aEvent );
159 invertXAxis =
frame()->GetFootprintEditorSettings()->m_DisplayInvertXAxis;
160 invertYAxis =
frame()->GetFootprintEditorSettings()->m_DisplayInvertYAxis;
165 bool originSet =
false;
181 frame()->GetCanvas()->SetCurrentCursor( KICURSOR::MEASURE );
194 const auto applyVector = [&](
const VECTOR2I& aMoveVec )
200 if( !item->IsBOARD_ITEM() )
207 && !
frame()->GetPcbNewSettings()->m_AllowFreePads
211 commit.
Modify( boardItem );
212 boardItem->
Move( aMoveVec );
215 commit.
Push(
_(
"Set Relative Position Interactively" ) );
228 const auto setInitialMsg = [&]()
230 statusPopup.
SetText(
_(
"Select the reference point on the item to move." ) );
233 const auto setDragMsg = [&]()
235 statusPopup.
SetText(
_(
"Select the point to define the new offset from." ) );
238 const auto setPopupPosition = [&]()
255 cursorPos =
grid.BestSnapAnchor( cursorPos,
nullptr );
259 if( evt->IsCancelInteractive() )
267 frame()->PopTool( aEvent );
271 else if( evt->IsActivate() )
276 frame()->PopTool( aEvent );
280 else if( !originSet && ( evt->IsDrag(
BUT_LEFT ) || evt->IsClick(
BUT_LEFT ) ) )
283 twoPtMgr.
SetEnd( cursorPos );
293 else if( originSet && ( evt->IsClick(
BUT_LEFT ) || evt->IsMouseUp(
BUT_LEFT ) ) )
323 else if( originSet && ( evt->IsMotion() || evt->IsDrag(
BUT_LEFT ) ) )
334 twoPtMgr.
SetEnd( cursorPos );
341 if(
frame()->GetUserUnits() != units )
343 units =
frame()->GetUserUnits();
358 invertXAxis =
frame()->GetFootprintEditorSettings()->m_DisplayInvertXAxis;
359 invertYAxis =
frame()->GetFootprintEditorSettings()->m_DisplayInvertYAxis;
362 ruler.
UpdateDir( invertXAxis, invertYAxis );
384 frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
401 if( !item->IsBOARD_ITEM() )
408 && !
frame()->GetPcbNewSettings()->m_AllowFreePads
415 boardItem->
Move( aggregateTranslation );
418 m_commit->Push(
_(
"Position Relative" ) );
constexpr EDA_IU_SCALE pcbIUScale
static TOOL_ACTION updatePreferences
static TOOL_ACTION updateUnits
static TOOL_ACTION measureTool
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual void Move(const VECTOR2I &aMoveVector)
Move this object.
BOARD_ITEM_CONTAINER * GetParent() const
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
Dialog that invites the user to enter some kind of offset.
bool Show(bool show) override
EDA_UNITS GetUserUnits() const
void ForceRefresh()
Force a redraw.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
void SetStatusPopup(wxWindow *aPopup)
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
KICAD_T Type() const
Returns the type of object.
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Used when the right click button is pressed, or when the select tool is in effect.
bool GetGridSnapping() const
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
A drawn ruler item for showing the distance between two points.
void SetShowEndArrowHead(bool aShow)
void SwitchUnits(EDA_UNITS aUnits)
Switch the ruler units.
void UpdateDir(bool aFlipX, bool aFlipY)
void SetColor(const COLOR4D &aColor)
void SetShowTicks(bool aShow)
Represent a very simple geometry manager for items that have a start and end point.
void SetOrigin(const VECTOR2I &aOrigin)
< Set the origin of the ruler (the fixed end)
void SetAngleSnap(bool aSnap)
VECTOR2I GetOrigin() const
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the end that moves with the cursor.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
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.
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION positionRelativeInteractively
static TOOL_ACTION positionRelative
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
EDA_ITEM * GetTopLeftItem(bool aFootprintsOnly=false) const override
virtual SETTINGS_MANAGER & GetSettingsManager() const
bool HasType(KICAD_T aType) const
Checks if there is at least one item of requested kind.
std::deque< EDA_ITEM * > & Items()
bool Empty() const
Checks if there is anything selected.
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
EDA_UNITS GetUserUnits() const
@ LAYER_ANCHOR
anchor of items having an anchor point (texts, footprints)
@ GEOMETRY
Position or shape has changed.
Class to handle a set of BOARD_ITEMs.
PGM_BASE & Pgm()
The global Program "get" accessor.
std::vector< FAB_LAYER_COLOR > dummy
bool m_DisplayInvertYAxis
bool m_DisplayInvertXAxis
@ PCB_PAD_T
class PAD, a pad in a footprint