61 std::set<BOARD_ITEM*>
moved;
65 if( !item->IsBOARD_ITEM() )
73 if( !
moved.insert( boardItem ).second )
77 boardItem->
Move( aMoveVec );
94 m_commit = std::make_unique<BOARD_COMMIT>(
this );
133 std::deque<EDA_ITEM*>& items = padsOnly.
Items();
134 items.erase( std::remove_if( items.begin(), items.end(),
137 return aItem->Type() != PCB_PAD_T;
203 invertXAxis =
frame()->GetFootprintEditorSettings()->m_DisplayInvertXAxis;
204 invertYAxis =
frame()->GetFootprintEditorSettings()->m_DisplayInvertYAxis;
209 bool originSet =
false;
215 || (
frame()->GetPcbNewSettings()
216 &&
frame()->GetPcbNewSettings()->m_AllowFreePads );
224 view->SetVisible( &ruler,
false );
232 const auto setInitialMsg =
235 statusPopup.
SetText(
_(
"Select the reference point on the item to move." ) );
238 const auto setDragMsg =
241 statusPopup.
SetText(
_(
"Select the point to define the new offset from." ) );
244 const auto setPopupPosition =
253 view->SetVisible( &ruler,
false );
256 controls->ForceCursorPosition(
false );
261 const auto applyVector =
266 commit.
Push(
_(
"Set Relative Position Interactively" ) );
274 controls->ForceCursorPosition(
false );
289 grid.SetUseGrid(
view->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
290 VECTOR2I cursorPos = evt->HasPosition() ? evt->Position() :
controls->GetMousePosition();
293 if( !evt->IsActivate() && !evt->IsCancelInteractive() )
296 cursorPos =
grid.ResolveSnap( cursorPos,
nullptr ).position;
297 controls->ForceCursorPosition(
true, cursorPos );
304 if( evt->IsCancelInteractive() )
311 else if( evt->IsActivate() )
319 else if( !originSet && ( evt->IsDrag(
BUT_LEFT ) || evt->IsClick(
BUT_LEFT ) ) )
322 twoPtMgr.
SetEnd( cursorPos );
332 else if( originSet && ( evt->IsClick(
BUT_LEFT ) || evt->IsMouseUp(
BUT_LEFT ) ) )
346 const VECTOR2I move = toReferencePtVector + offsetVector;
366 else if( originSet && ( evt->IsMotion() || evt->IsDrag(
BUT_LEFT ) ) )
379 view->SetVisible( &ruler,
true );
384 if(
frame()->GetUserUnits() != units )
386 units =
frame()->GetUserUnits();
401 invertXAxis =
frame()->GetFootprintEditorSettings()->m_DisplayInvertXAxis;
402 invertYAxis =
frame()->GetFootprintEditorSettings()->m_DisplayInvertYAxis;
405 ruler.
UpdateDir( invertXAxis, invertYAxis );
411 else if( !evt->IsMouseAction() )
416 view->SetVisible( &ruler,
false );
427 view->SetVisible( &ruler,
false );
428 view->Remove( &ruler );
433 controls->ForceCursorPosition(
false );
446 || (
frame()->GetPcbNewSettings()
447 &&
frame()->GetPcbNewSettings()->m_AllowFreePads );
450 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 selectionClear
Clear the current selection.
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.
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 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.
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