KiCad PCB EDA Suite
Loading...
Searching...
No Matches
symbol_editor_move_tool.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2019 CERN
5 * Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <tool/tool_manager.h>
27#include <ee_actions.h>
28#include <ee_grid_helper.h>
29#include <eda_item.h>
31#include <lib_shape.h>
32#include <sch_commit.h>
33#include <wx/log.h>
36
37
39 EE_TOOL_BASE( "eeschema.SymbolMoveTool" ),
40 m_moveInProgress( false )
41{
42}
43
44
46{
48
49 //
50 // Add move actions to the selection tool menu
51 //
53
54 auto canMove =
55 [&]( const SELECTION& sel )
56 {
58 wxCHECK( editor, false );
59
60 if( !editor->IsSymbolEditable() )
61 return false;
62
63 if( editor->IsSymbolAlias() )
64 {
65 for( EDA_ITEM* item : sel )
66 {
67 if( item->Type() != LIB_FIELD_T )
68 return false;
69 }
70 }
71
72 return true;
73 };
74
75 selToolMenu.AddItem( EE_ACTIONS::move, canMove && EE_CONDITIONS::IdleSelection, 150 );
76 selToolMenu.AddItem( EE_ACTIONS::alignToGrid, canMove && EE_CONDITIONS::IdleSelection, 150 );
77
78 return true;
79}
80
81
83{
84 EE_TOOL_BASE::Reset( aReason );
85
86 if( aReason == MODEL_RELOAD )
87 m_moveInProgress = false;
88}
89
90
92{
93 if( SCH_COMMIT* commit = dynamic_cast<SCH_COMMIT*>( aEvent.Commit() ) )
94 {
95 wxCHECK( aEvent.SynchronousState(), 0 );
96 aEvent.SynchronousState()->store( STS_RUNNING );
97
98 if( doMoveSelection( aEvent, commit ) )
99 aEvent.SynchronousState()->store( STS_FINISHED );
100 else
101 aEvent.SynchronousState()->store( STS_CANCELLED );
102 }
103 else
104 {
105 SCH_COMMIT localCommit( m_toolMgr );
106
107 if( doMoveSelection( aEvent, &localCommit ) )
108 localCommit.Push( _( "Move" ) );
109 else
110 localCommit.Revert();
111 }
112
113 return 0;
114}
115
116
118{
121
122 m_anchorPos = { 0, 0 };
123
124 // Be sure that there is at least one item that we can move. If there's no selection try
125 // looking for the stuff under mouse cursor (i.e. Kicad old-style hover selection).
126 EE_SELECTION& selection = m_frame->IsSymbolAlias()
129 bool unselect = selection.IsHover();
130
131 if( !m_frame->IsSymbolEditable() || selection.Empty() )
132 return false;
133
134 if( m_moveInProgress )
135 {
136 // The tool hotkey is interpreted as a click when already moving
138 return true;
139 }
140
141 m_frame->PushTool( aEvent );
142
143 Activate();
144 // Must be done after Activate() so that it gets set into the correct context
145 controls->ShowCursor( true );
146 controls->SetAutoPan( true );
147
148 bool restore_state = false;
149 TOOL_EVENT copy = aEvent;
150 TOOL_EVENT* evt = &copy;
151 VECTOR2I prevPos;
152 VECTOR2I moveOffset;
153
154 if( !selection.Front()->IsNew() )
155 aCommit->Modify( m_frame->GetCurSymbol(), m_frame->GetScreen() );
156
157 m_cursor = controls->GetCursorPosition( !aEvent.DisableGridSnapping() );
158
159 // Main loop: keep receiving events
160 do
161 {
162 m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING );
163 grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
164 grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
165
166 if( evt->IsAction( &EE_ACTIONS::move )
167 || evt->IsMotion()
168 || evt->IsDrag( BUT_LEFT )
170 {
171 if( !m_moveInProgress ) // Prepare to start moving/dragging
172 {
173 LIB_ITEM* lib_item = static_cast<LIB_ITEM*>( selection.Front() );
174
175 // Pick up any synchronized pins
176 //
177 // Careful when pasting. The pasted pin will be at the same location as it
178 // was copied from, leading us to believe it's a synchronized pin. It's not.
180 && ( lib_item->GetEditFlags() & IS_PASTED ) == 0 )
181 {
182 std::set<LIB_PIN*> sync_pins;
183
184 for( EDA_ITEM* sel_item : selection )
185 {
186 lib_item = static_cast<LIB_ITEM*>( sel_item );
187
188 if( lib_item->Type() == LIB_PIN_T )
189 {
190 LIB_PIN* cur_pin = static_cast<LIB_PIN*>( lib_item );
191 LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
192 std::vector<bool> got_unit( symbol->GetUnitCount() + 1 );
193
194 got_unit[cur_pin->GetUnit()] = true;
195
196 std::vector<LIB_PIN*> pins = symbol->GetAllLibPins();
197
198 for( LIB_PIN* pin : pins )
199 {
200 if( !got_unit[pin->GetUnit()]
201 && pin->GetPosition() == cur_pin->GetPosition()
202 && pin->GetOrientation() == cur_pin->GetOrientation()
203 && pin->GetBodyStyle() == cur_pin->GetBodyStyle()
204 && pin->GetType() == cur_pin->GetType()
205 && pin->GetName() == cur_pin->GetName() )
206 {
207 if( sync_pins.insert( pin ).second )
208 got_unit[pin->GetUnit()] = true;
209 }
210 }
211 }
212 }
213
214 for( LIB_PIN* pin : sync_pins )
215 m_selectionTool->AddItemToSel( pin, true /*quiet mode*/ );
216 }
217
218 // Apply any initial offset in case we're coming from a previous command.
219 //
220 for( EDA_ITEM* item : selection )
221 moveItem( item, moveOffset );
222
223 // Set up the starting position and move/drag offset
224 //
225 m_cursor = controls->GetCursorPosition( !evt->DisableGridSnapping() );
226
227 if( lib_item->IsNew() )
228 {
229 m_anchorPos = selection.GetReferencePoint();
231
232 // Drag items to the current cursor position
233 for( EDA_ITEM* item : selection )
234 {
235 moveItem( item, delta );
236 updateItem( item, false );
237 }
238
240 }
241 else if( m_frame->GetMoveWarpsCursor() )
242 {
243 VECTOR2I itemPos = selection.GetTopLeftItem()->GetPosition();
244 m_anchorPos = VECTOR2I( itemPos.x, -itemPos.y );
245
248 }
249 else
250 {
251 m_cursor = controls->GetCursorPosition( !evt->DisableGridSnapping() );
253 }
254
255 controls->SetCursorPosition( m_cursor, false );
256
257 prevPos = m_cursor;
258 controls->SetAutoPan( true );
259 m_moveInProgress = true;
260 }
261
262 //------------------------------------------------------------------------
263 // Follow the mouse
264 //
265 m_cursor = grid.BestSnapAnchor( controls->GetCursorPosition( false ),
266 grid.GetSelectionGrid( selection ), selection );
267 VECTOR2I delta( m_cursor - prevPos );
269
270 moveOffset += delta;
271 prevPos = m_cursor;
272
273 for( EDA_ITEM* item : selection )
274 {
275 moveItem( item, delta );
276 updateItem( item, false );
277 }
278
280 }
281 //------------------------------------------------------------------------
282 // Handle cancel
283 //
284 else if( evt->IsCancelInteractive() || evt->IsActivate() )
285 {
286 if( m_moveInProgress )
287 {
288 evt->SetPassEvent( false );
289 restore_state = true;
290 }
291
292 break;
293 }
294 //------------------------------------------------------------------------
295 // Handle TOOL_ACTION special cases
296 //
297 else if( evt->Action() == TA_UNDO_REDO_PRE )
298 {
299 unselect = true;
300 break;
301 }
302 else if( evt->IsAction( &ACTIONS::doDelete ) )
303 {
304 // Exit on a remove operation; there is no further processing for removed items.
305 break;
306 }
307 else if( evt->IsAction( &ACTIONS::duplicate ) )
308 {
309 wxBell();
310 }
311 //------------------------------------------------------------------------
312 // Handle context menu
313 //
314 else if( evt->IsClick( BUT_RIGHT ) )
315 {
317 }
318 //------------------------------------------------------------------------
319 // Handle drop
320 //
321 else if( evt->IsMouseUp( BUT_LEFT )
322 || evt->IsClick( BUT_LEFT )
323 || evt->IsDblClick( BUT_LEFT ) )
324 {
325 if( selection.GetSize() == 1 && selection.Front()->Type() == LIB_PIN_T )
326 {
328
329 try
330 {
331 LIB_PIN* curr_pin = (LIB_PIN*) selection.Front();
332
333 if( pinTool->PlacePin( curr_pin ) )
334 {
335 // PlacePin() clears the current selection, which we don't want. Not only
336 // is it a poor user experience, but it also prevents us from doing the
337 // proper cleanup at the end of this routine (ie: clearing the edit flags).
338 m_selectionTool->AddItemToSel( curr_pin, true /*quiet mode*/ );
339 }
340 else
341 {
342 restore_state = true;
343 }
344 }
345 catch( const boost::bad_pointer& e )
346 {
347 restore_state = true;
348 wxLogError( "Boost pointer exception occurred: \"%s\"", e.what() );
349 }
350 }
351
352 break; // Finish
353 }
354 else
355 {
356 evt->SetPassEvent();
357 }
358
359 } while( ( evt = Wait() ) ); // Assignment intentional; not equality test
360
361 controls->ForceCursorPosition( false );
362 controls->ShowCursor( false );
363 controls->SetAutoPan( false );
364
365 m_anchorPos = { 0, 0 };
366
367 for( EDA_ITEM* item : selection )
368 item->ClearEditFlags();
369
370 if( unselect )
372
373 m_moveInProgress = false;
374 m_frame->PopTool( aEvent );
375
376 return !restore_state;
377}
378
379
381{
384 SCH_COMMIT commit( m_toolMgr );
385
386 auto doMoveItem =
387 [&]( EDA_ITEM* item, const VECTOR2I& delta )
388 {
389 commit.Modify( item, m_frame->GetScreen() );
390 static_cast<LIB_ITEM*>( item )->Offset( mapCoords( delta ) );
391 updateItem( item, true );
392 };
393
394 for( EDA_ITEM* item : selection )
395 {
396 if( LIB_SHAPE* shape = dynamic_cast<LIB_SHAPE*>( item ) )
397 {
398 VECTOR2I newStart = grid.AlignGrid( shape->GetStart(), grid.GetItemGrid( shape ) );
399 VECTOR2I newEnd = grid.AlignGrid( shape->GetEnd(), grid.GetItemGrid( shape ) );
400
401 switch( shape->GetShape() )
402 {
403 case SHAPE_T::SEGMENT:
404 case SHAPE_T::RECTANGLE:
405 case SHAPE_T::CIRCLE:
406 case SHAPE_T::ARC:
407 if( newStart == newEnd )
408 {
409 // Don't collapse shape; just snap its position
410 if( newStart != shape->GetStart() )
411 doMoveItem( shape, newStart - shape->GetStart() );
412 }
413 else if( newStart != shape->GetStart() || newEnd != shape->GetEnd() )
414 {
415 // Snap both ends
416 commit.Modify( shape, m_frame->GetScreen() );
417
418 shape->SetStart( newStart );
419 shape->SetEnd( newEnd );
420
421 updateItem( item, true );
422 }
423
424 break;
425
426 break;
427
428 case SHAPE_T::POLY:
429 if( shape->GetPointCount() > 0 )
430 {
431 std::vector<VECTOR2I> newPts;
432
433 for( const VECTOR2I& pt : shape->GetPolyShape().Outline( 0 ).CPoints() )
434 newPts.push_back( grid.AlignGrid( pt, grid.GetItemGrid( shape ) ) );
435
436 bool collapsed = false;
437
438 for( int ii = 0; ii < (int) newPts.size() - 1; ++ii )
439 {
440 if( newPts[ii] == newPts[ii + 1] )
441 collapsed = true;
442 }
443
444 if( collapsed )
445 {
446 // Don't collapse shape; just snap its position
447 if( newStart != shape->GetStart() )
448 doMoveItem( shape, newStart - shape->GetStart() );
449 }
450 else
451 {
452 commit.Modify( shape, m_frame->GetScreen() );
453
454 for( int ii = 0; ii < (int) newPts.size(); ++ii )
455 shape->GetPolyShape().Outline( 0 ).SetPoint( ii, newPts[ii] );
456
457 updateItem( item, true );
458 }
459 }
460
461 break;
462
463 case SHAPE_T::BEZIER:
464 // Snapping bezier control points is unlikely to be useful. Just snap its
465 // position.
466 if( newStart != shape->GetStart() )
467 doMoveItem( shape, newStart - shape->GetStart() );
468
469 break;
470 }
471 }
472 else
473 {
474 VECTOR2I newPos = grid.AlignGrid( item->GetPosition(), grid.GetItemGrid( item ) );
475 VECTOR2I delta = newPos - item->GetPosition();
476
477 if( delta != VECTOR2I( 0, 0 ) )
478 doMoveItem( item, delta );
479
480 if( LIB_PIN* pin = dynamic_cast<LIB_PIN*>( item ) )
481 {
482 int length = pin->GetLength();
483 int pinGrid;
484
485 if( pin->GetOrientation() == PIN_ORIENTATION::PIN_LEFT
486 || pin->GetOrientation() == PIN_ORIENTATION::PIN_RIGHT )
487 {
488 pinGrid = KiROUND( grid.GetGridSize( grid.GetItemGrid( item ) ).x );
489 }
490 else
491 {
492 pinGrid = KiROUND( grid.GetGridSize( grid.GetItemGrid( item ) ).y );
493 }
494
495 int newLength = KiROUND( (double) length / pinGrid ) * pinGrid;
496
497 if( newLength > 0 )
498 pin->SetLength( newLength );
499 }
500 }
501 }
502
504
505 commit.Push( _( "Align" ) );
506 return 0;
507}
508
509
511{
512 static_cast<LIB_ITEM*>( aItem )->Offset( mapCoords( aDelta ) );
513 aItem->SetFlags( IS_MOVING );
514}
515
516
518{
521}
VECTOR2D mapCoords(const VECTOR2D &aSource)
Definition: PS_plotter.cpp:531
static TOOL_ACTION duplicate
Definition: actions.h:74
static TOOL_ACTION doDelete
Definition: actions.h:75
static TOOL_ACTION cursorClick
Definition: actions.h:154
static TOOL_ACTION refreshPreview
Definition: actions.h:137
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
Definition: commit.h:105
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:239
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:129
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:123
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
bool IsNew() const
Definition: eda_item.h:103
static TOOL_ACTION alignToGrid
Definition: ee_actions.h:117
static TOOL_ACTION move
Definition: ee_actions.h:118
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
EE_SELECTION & RequestSelection(const std::vector< KICAD_T > &aScanTypes={ SCH_LOCATE_ANY_T }, bool aPromoteCellSelections=false)
Return either an existing selection (filtered), or the selection at the current cursor position if th...
EE_SELECTION & GetSelection()
A foundation class for a tool operating on a schematic or symbol.
Definition: ee_tool_base.h:48
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
Definition: ee_tool_base.h:84
void updateItem(EDA_ITEM *aItem, bool aUpdateRTree) const
Similar to getView()->Update(), but handles items that are redrawn by their parents and updating the ...
Definition: ee_tool_base.h:109
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:200
bool Init() override
Init() is called once upon a registration of the tool.
Definition: ee_tool_base.h:64
static const TOOL_EVENT SelectedItemsMoved
Used to inform tools that the selection should temporarily be non-editable.
Definition: actions.h:267
An interface for classes handling user events controlling the view behavior such as zooming,...
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 void WarpMouseCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
If enabled (.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Move cursor to the requested position expressed in world coordinates.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:68
int GetBodyStyle() const
Definition: lib_item.h:346
int GetUnit() const
Definition: lib_item.h:343
ELECTRICAL_PINTYPE GetType() const
Definition: lib_pin.h:84
PIN_ORIENTATION GetOrientation() const
Definition: lib_pin.h:68
VECTOR2I GetPosition() const override
Definition: lib_pin.h:232
const wxString & GetName() const
Definition: lib_pin.h:106
Define a library symbol object.
Definition: lib_symbol.h:99
std::vector< LIB_PIN * > GetAllLibPins() const
Return a list of pin pointers for all units / converts.
int GetUnitCount() const override
For items with units, return the number of units.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
Definition: sch_commit.cpp:393
virtual void Revert() override
Definition: sch_commit.cpp:474
static bool IdleSelection(const SELECTION &aSelection)
Test if all selected items are not being edited.
int AddItemToSel(const TOOL_EVENT &aEvent)
bool IsHover() const
Definition: selection.h:83
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:99
EDA_ITEM * Front() const
Definition: selection.h:208
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:109
bool doMoveSelection(const TOOL_EVENT &aEvent, SCH_COMMIT *aCommit)
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
void moveItem(EDA_ITEM *aItem, const VECTOR2I &aDelta)
Set up handlers for various events.
bool Init() override
Init() is called once upon a registration of the tool.
int Main(const TOOL_EVENT &aEvent)
Run an interactive move of the selected items, or the item under the cursor.
int AlignElements(const TOOL_EVENT &aEvent)
Align selected elements to the grid.
bool m_moveInProgress
Last cursor position (needed for getModificationPoint() to avoid changes of edit reference point).
The symbol library editor main window.
bool IsSymbolAlias() const
Return true if aLibId is an alias for the editor screen symbol.
bool IsSymbolEditable() const
Test if a symbol is loaded and can be edited.
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
virtual void PopTool(const TOOL_EVENT &aEvent)
Pops a tool from the stack.
bool GetMoveWarpsCursor() const
Indicate that a move operation should warp the mouse pointer to the origin of the move object.
Definition: tools_holder.h:150
virtual void PushTool(const TOOL_EVENT &aEvent)
NB: the definition of "tool" is different at the user level.
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
RESET_REASON
Determine the reason of reset for a tool.
Definition: tool_base.h:78
@ MODEL_RELOAD
Model changes (the sheet for a schematic)
Definition: tool_base.h:80
Generic, UI-independent tool event.
Definition: tool_event.h:167
bool DisableGridSnapping() const
Definition: tool_event.h:363
bool IsCancelInteractive() const
Indicate the event should restart/end an ongoing interactive tool's event loop (eg esc key,...
Definition: tool_event.cpp:221
TOOL_ACTIONS Action() const
These give a tool a method of informing the TOOL_MANAGER that a particular event should be passed on ...
Definition: tool_event.h:246
bool IsActivate() const
Definition: tool_event.h:337
COMMIT * Commit() const
Returns information about difference between current mouse cursor position and the place where draggi...
Definition: tool_event.h:275
bool IsClick(int aButtonMask=BUT_ANY) const
Definition: tool_event.cpp:209
bool IsDrag(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:307
int Modifier(int aMask=MD_MODIFIER_MASK) const
Definition: tool_event.h:358
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:82
bool IsDblClick(int aButtonMask=BUT_ANY) const
Definition: tool_event.cpp:215
std::atomic< SYNCRONOUS_TOOL_STATE > * SynchronousState() const
Definition: tool_event.h:272
void SetPassEvent(bool aPass=true)
Returns if it this event has a valid position (true for mouse events and context-menu or hotkey-based...
Definition: tool_event.h:252
bool IsMouseUp(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:317
bool IsMotion() const
Definition: tool_event.h:322
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
TOOL_MENU & GetToolMenu()
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Suspend execution of the tool until an event specified in aEventList arrives.
void Activate()
Run the tool.
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
Definition: tool_manager.h:145
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:44
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:57
#define _(s)
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_MOVING
Item being moved.
constexpr int delta
@ TA_UNDO_REDO_PRE
Definition: tool_event.h:105
@ MD_SHIFT
Definition: tool_event.h:142
@ STS_CANCELLED
Definition: tool_event.h:160
@ STS_FINISHED
Definition: tool_event.h:159
@ STS_RUNNING
Definition: tool_event.h:158
@ BUT_LEFT
Definition: tool_event.h:131
@ BUT_RIGHT
Definition: tool_event.h:132
@ LIB_PIN_T
Definition: typeinfo.h:206
@ LIB_FIELD_T
Definition: typeinfo.h:212
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588