44 const wxString& aCommitMessage,
int aOptions )
46 using namespace std::placeholders;
47 std::unique_ptr<BOARD_ITEM> newItem;
56 bool restoreAngleSnapMode =
false;
77 savedAngleSnapMode = *angleSnapMode;
79 restoreAngleSnapMode =
true;
104 if(
frame()->GetModel() )
109 newItem->SetPosition( aPosition );
110 preview.
Add( newItem.get() );
122 makeNewItem(
controls()->GetCursorPosition() );
133 auto ensureVisibility =
138 auto ensureLayerVisible =
143 if( !
view()->IsLayerVisible( aLayer ) )
145 controls->SetLayerVisible( aLayer,
true );
146 frame()->GetCanvas()->Refresh();
154 frame()->GetCanvas()->Refresh();
167 switch(
static_cast<PCB_VIA*
>( aItem )->GetViaType() )
181 ensureLayerVisible( aItem->GetLayer() );
194 grid.SetSnap(
false );
195 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
198 if( !evt->IsActivate() && !evt->IsCancelInteractive() )
199 cursorPos =
grid.ResolveSnap( cursorPos,
nullptr ).position;
217 if( evt->IsCancelInteractive() )
233 else if( evt->IsActivate() )
238 if( evt->IsPointEditor() )
244 if( evt->IsMoveTool() )
247 frame()->PushTool( originalEvent );
258 makeNewItem( cursorPos );
264 ensureVisibility( newItem.get() );
273 ensureVisibility( newBoardItem );
276 if( !aPlacer->
PlaceItem( newBoardItem, commit ) )
279 newItem.reset( newBoardItem );
284 commit.
Push( aCommitMessage );
294 makeNewItem(
controls()->GetCursorPosition() );
307 else if( newItem && evt->Category() ==
TC_COMMAND )
315 newItem->Rotate( newItem->GetPosition(), rotationAngle );
320 newItem->Flip( newItem->GetPosition(),
frame()->GetPcbNewSettings()->m_FlipDirection );
325 frame()->OnEditItemRequest( newItem.get() );
335 makeNewItem( cursorPos );
344 else if( newItem && ( evt->IsMotion()
348 newItem->SetPosition( cursorPos );
366 if( restoreAngleSnapMode )
368 *angleSnapMode = savedAngleSnapMode;
463 aCommit.
Add( aItem );
static TOOL_ACTION cancelInteractive
static TOOL_ACTION cursorDblClick
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...
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
void SetFlags(EDA_ITEM_FLAGS aMask)
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
EDA_ITEM_FLAGS GetFlags() const
static const TOOL_EVENT SelectedItemsModified
Selected item had a property changed (except movement)
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.
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.
virtual void Add(VIEW_ITEM *aItem)
Add an item to the group.
static TOOL_ACTION trackViaSizeChanged
static TOOL_ACTION properties
Activation of the edit tool.
static TOOL_ACTION angleSnapModeChanged
Notification event when angle mode changes.
static TOOL_ACTION flip
Flipping of selected objects.
VIEWERS_DISPLAY_OPTIONS m_ViewersDisplay
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
virtual void Add(EDA_ITEM *aItem)
A null aItem is ignored; the selection never holds null members.
virtual void Clear() override
Remove all the stored items from the group.
std::uint32_t EDA_ITEM_FLAGS
LEADER_MODE
The kind of the leader line.
@ DIRECT
Unconstrained point-to-point.
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
@ LAYER_POINTS
PCB reference/manual snap points visibility.
@ LAYER_PADS
Meta control for all pads opacity/visibility (color ignored).
@ LAYER_VIA_BURIED
Draw blind vias.
@ LAYER_VIA_BLIND
Draw micro vias.
@ LAYER_VIAS
Meta control for all vias opacity/visibility.
T * GetAppSettings(const char *aFilename)
virtual void SnapItem(BOARD_ITEM *aItem)
PCB_BASE_EDIT_FRAME * m_frame
virtual std::unique_ptr< BOARD_ITEM > CreateItem()=0
virtual bool PlaceItem(BOARD_ITEM *aItem, BOARD_COMMIT &aCommit)
LEADER_MODE m_AngleSnapMode
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_POINT_T
class PCB_POINT, a 0-dimensional point
VECTOR2< int32_t > VECTOR2I