61 if( !item->IsBOARD_ITEM() )
65 commit.
Modify( boardItem );
66 boardItem->
Move( aMoveVec );
87 m_selectionTool( nullptr )
95 m_commit = std::make_unique<BOARD_COMMIT>(
this );
127 std::deque<EDA_ITEM*>& items = padsOnly.
Items();
128 items.erase( std::remove_if( items.begin(), items.end(),
131 return aItem->Type() != PCB_PAD_T;
176 frame()->PushTool( aEvent );
183 invertXAxis =
frame()->GetFootprintEditorSettings()->m_DisplayInvertXAxis;
184 invertYAxis =
frame()->GetFootprintEditorSettings()->m_DisplayInvertYAxis;
189 bool originSet =
false;
205 frame()->GetCanvas()->SetCurrentCursor( KICURSOR::MEASURE );
218 const auto applyVector = [&](
const VECTOR2I& aMoveVec )
222 commit.
Push(
_(
"Set Relative Position Interactively" ) );
235 const auto setInitialMsg = [&]()
237 statusPopup.
SetText(
_(
"Select the reference point on the item to move." ) );
240 const auto setDragMsg = [&]()
242 statusPopup.
SetText(
_(
"Select the point to define the new offset from." ) );
245 const auto setPopupPosition = [&]()
262 cursorPos =
grid.BestSnapAnchor( cursorPos,
nullptr );
266 if( evt->IsCancelInteractive() )
274 frame()->PopTool( aEvent );
278 else if( evt->IsActivate() )
283 frame()->PopTool( aEvent );
287 else if( !originSet && ( evt->IsDrag(
BUT_LEFT ) || evt->IsClick(
BUT_LEFT ) ) )
290 twoPtMgr.
SetEnd( cursorPos );
300 else if( originSet && ( evt->IsClick(
BUT_LEFT ) || evt->IsMouseUp(
BUT_LEFT ) ) )
330 else if( originSet && ( evt->IsMotion() || evt->IsDrag(
BUT_LEFT ) ) )
341 twoPtMgr.
SetEnd( cursorPos );
348 if(
frame()->GetUserUnits() != units )
350 units =
frame()->GetUserUnits();
365 invertXAxis =
frame()->GetFootprintEditorSettings()->m_DisplayInvertXAxis;
366 invertYAxis =
frame()->GetFootprintEditorSettings()->m_DisplayInvertYAxis;
369 ruler.
UpdateDir( invertXAxis, invertYAxis );
391 frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
406 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
Execute the changes.
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.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Modify a given item in the model.
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
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(const wxString &aFilename)
Return a handle to the a given settings by type.
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