64 std::set<BOARD_ITEM*>
moved;
68 if( !item->IsBOARD_ITEM() )
76 if( !
moved.insert( boardItem ).second )
80 boardItem->
Move( aMoveVec );
97 m_commit = std::make_unique<BOARD_COMMIT>(
this );
136 std::deque<EDA_ITEM*>& items = padsOnly.
Items();
137 items.erase( std::remove_if( items.begin(), items.end(),
140 return aItem->Type() != PCB_PAD_T;
206 invertXAxis =
frame()->GetFootprintEditorSettings()->m_DisplayInvertXAxis;
207 invertYAxis =
frame()->GetFootprintEditorSettings()->m_DisplayInvertYAxis;
212 bool originSet =
false;
218 || (
frame()->GetPcbNewSettings()
219 &&
frame()->GetPcbNewSettings()->m_AllowFreePads );
227 view->SetVisible( &ruler,
false );
235 const auto setInitialMsg =
238 statusPopup.
SetText(
_(
"Select the reference point on the item to move." ) );
241 const auto setDragMsg =
244 statusPopup.
SetText(
_(
"Select the point to define the new offset from." ) );
247 const auto setPopupPosition =
256 view->SetVisible( &ruler,
false );
259 controls->ForceCursorPosition(
false );
264 const auto applyVector =
269 commit.
Push(
_(
"Set Relative Position Interactively" ) );
277 controls->ForceCursorPosition(
false );
292 grid.SetUseGrid(
view->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
293 VECTOR2I cursorPos = evt->HasPosition() ? evt->Position() :
controls->GetMousePosition();
296 if( !evt->IsActivate() && !evt->IsCancelInteractive() )
299 cursorPos =
grid.ResolveSnap( cursorPos,
nullptr ).position;
300 controls->ForceCursorPosition(
true, cursorPos );
307 if( evt->IsCancelInteractive() )
314 else if( evt->IsActivate() )
322 else if( !originSet && ( evt->IsDrag(
BUT_LEFT )
327 twoPtMgr.
SetEnd( cursorPos );
337 else if( originSet && ( evt->IsClick(
BUT_LEFT )
353 const VECTOR2I move = toReferencePtVector + offsetVector;
373 else if( originSet && ( evt->IsMotion()
388 view->SetVisible( &ruler,
true );
393 if(
frame()->GetUserUnits() != units )
395 units =
frame()->GetUserUnits();
410 invertXAxis =
frame()->GetFootprintEditorSettings()->m_DisplayInvertXAxis;
411 invertYAxis =
frame()->GetFootprintEditorSettings()->m_DisplayInvertYAxis;
414 ruler.
UpdateDir( invertXAxis, invertYAxis );
420 else if( !evt->IsMouseAction() )
425 view->SetVisible( &ruler,
false );
436 view->SetVisible( &ruler,
false );
437 view->Remove( &ruler );
442 controls->ForceCursorPosition(
false );
455 || (
frame()->GetPcbNewSettings()
456 &&
frame()->GetPcbNewSettings()->m_AllowFreePads );
459 m_commit->Push(
_(
"Position Relative" ) );
constexpr EDA_IU_SCALE pcbIUScale
static TOOL_ACTION updatePreferences
static TOOL_ACTION updateUnits
static TOOL_ACTION measureTool
static TOOL_ACTION cursorClick
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION refreshPreview
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.
BOARD_ITEM_CONTAINER * GetParent() const
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
Dialog that invites the user to enter some kind of offset.
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 item had a property changed (except movement)
Used when the right click button is pressed, or when the select tool is in effect.
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(LEADER_MODE aSnap)
VECTOR2I GetOrigin() const
void Reset()
Reset the manager to the initial state.
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the end that moves with the cursor.
An interface for classes handling user events controlling the view behavior such as zooming,...
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
static TOOL_ACTION interactiveOffsetTool
static TOOL_ACTION positionRelative
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
EDA_ITEM * GetTopLeftItem(bool aFootprintsOnly=false) const override
std::deque< EDA_ITEM * > & Items()
EDA_UNITS GetUserUnits() const
@ DIRECT
Unconstrained point-to-point.
@ 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.
T * GetAppSettings(const char *aFilename)
bool m_DisplayInvertYAxis
bool m_DisplayInvertXAxis
@ PCB_PAD_T
class PAD, a pad in a footprint
VECTOR2< int32_t > VECTOR2I