62 if( !
editor->IsSymbolEditable() )
65 if(
editor->IsSymbolAlias() )
110 localCommit.
Push(
_(
"Move" ) );
130 bool unselect = selection.
IsHover();
149 bool restore_state =
false;
157 AXIS_LOCK axisLock = AXIS_LOCK::NONE;
158 long lastArrowKeyAction = 0;
188 std::set<SCH_PIN*> sync_pins;
190 for(
EDA_ITEM* sel_item : selection )
192 lib_item =
static_cast<SCH_ITEM*
>( sel_item );
198 std::vector<bool> got_unit( symbol->
GetUnitCount() + 1 );
200 got_unit[cur_pin->
GetUnit()] =
true;
204 if( !got_unit[
pin->GetUnit()]
211 if( sync_pins.insert(
pin ).second )
212 got_unit[
pin->GetUnit()] =
true;
231 if( lib_item->
IsNew() )
251 enteredGroup->AddItem( schItem );
258 else if(
m_frame->GetMoveWarpsCursor() )
262 selection.SetReferencePoint(
m_cursor );
289 grid.SetSnap(
false );
295 if( axisLock == AXIS_LOCK::HORIZONTAL )
301 axisLock = AXIS_LOCK::NONE;
307 axisLock = AXIS_LOCK::HORIZONTAL;
312 if( axisLock == AXIS_LOCK::VERTICAL )
318 axisLock = AXIS_LOCK::NONE;
324 axisLock = AXIS_LOCK::VERTICAL;
328 lastArrowKeyAction = action;
336 if( axisLock == AXIS_LOCK::HORIZONTAL )
338 else if( axisLock == AXIS_LOCK::VERTICAL )
363 restore_state =
true;
407 if( pinTool->
PlacePin( aCommit, curr_pin ) )
416 restore_state =
true;
419 catch(
const boost::bad_pointer& e )
421 restore_state =
true;
422 wxFAIL_MSG( wxString::Format( wxT(
"Boost pointer exception occurred: %s" ),
434 }
while( ( evt =
Wait() ) );
443 item->ClearEditFlags();
451 return !restore_state;
463 VECTOR2I newPos =
grid.AlignGrid( item->GetPosition(),
grid.GetItemGrid( item ) );
475 int length =
pin->GetLength();
488 int newLength =
KiROUND( (
double) length / pinGrid ) * pinGrid;
491 pin->SetLength( newLength );
497 commit.
Push(
_(
"Align Items to Grid" ) );
504 static_cast<SCH_ITEM*
>( aItem )->Move( aDelta );
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static TOOL_ACTION duplicate
static TOOL_ACTION doDelete
static TOOL_ACTION cursorClick
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION refreshPreview
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
A base class for most all the KiCad significant classes used in schematics and boards.
EDA_ITEM_FLAGS GetEditFlags() const
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
static const TOOL_EVENT SelectedItemsMoved
Used to inform tools that the selection should temporarily be non-editable.
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.
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.
const VC_SETTINGS & GetSettings() const
Return the current VIEW_CONTROLS settings.
Define a library symbol object.
std::vector< SCH_PIN * > GetPins() const override
int GetUnitCount() const override
static TOOL_ACTION alignToGrid
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Execute the changes.
virtual void Revert() override
Revert the commit by restoring the modified items state.
A set of SCH_ITEMs (i.e., without duplicates).
Base class for any item which can be embedded within the SCHEMATIC container class,...
bool IsGroupableType() const
const wxString & GetName() const
PIN_ORIENTATION GetOrientation() const
VECTOR2I GetPosition() const override
ELECTRICAL_PINTYPE GetType() const
static bool IdleSelection(const SELECTION &aSelection)
Test if all selected items are not being edited.
virtual unsigned int GetSize() const override
Return the number of stored items.
bool Empty() const
Checks if there is anything selected.
The symbol library editor main window.
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_MOVING
Item being moved.
@ PIN_RIGHT
The pin extends rightwards from the connection point.
@ PIN_LEFT
The pin extends leftwards from the connection point: Probably on the right side of the symbol.
Class to handle a set of SCH_ITEMs.
VECTOR2D m_lastKeyboardCursorPosition
Position of the above event.
bool m_lastKeyboardCursorPositionValid
Is last cursor motion event coming from keyboard arrow cursor motion action.
long m_lastKeyboardCursorCommand
ACTIONS::CURSOR_UP, ACTIONS::CURSOR_DOWN, etc.
VECTOR2< int32_t > VECTOR2I