42 m_moveInProgress( false )
62 if( !
editor->IsSymbolEditable() )
65 if(
editor->IsSymbolAlias() )
110 localCommit.
Push(
_(
"Move" ) );
131 bool unselect = selection.
IsHover();
150 bool restore_state =
false;
185 std::set<SCH_PIN*> sync_pins;
187 for(
EDA_ITEM* sel_item : selection )
189 lib_item =
static_cast<SCH_ITEM*
>( sel_item );
195 std::vector<bool> got_unit( symbol->
GetUnitCount() + 1 );
197 got_unit[cur_pin->
GetUnit()] =
true;
201 if( !got_unit[
pin->GetUnit()]
208 if( sync_pins.insert(
pin ).second )
209 got_unit[
pin->GetUnit()] =
true;
228 if( lib_item->
IsNew() )
248 enteredGroup->AddItem( schItem );
259 selection.SetReferencePoint(
m_cursor );
302 restore_state =
true;
346 if( pinTool->
PlacePin( aCommit, curr_pin ) )
355 restore_state =
true;
358 catch(
const boost::bad_pointer& e )
360 restore_state =
true;
361 wxFAIL_MSG( wxString::Format( wxT(
"Boost pointer exception occurred: %s" ),
373 }
while( ( evt =
Wait() ) );
382 item->ClearEditFlags();
390 return !restore_state;
402 VECTOR2I newPos =
grid.AlignGrid( item->GetPosition(),
grid.GetItemGrid( item ) );
414 int length =
pin->GetLength();
417 if(
pin->GetOrientation() == PIN_ORIENTATION::PIN_LEFT
418 ||
pin->GetOrientation() == PIN_ORIENTATION::PIN_RIGHT )
427 int newLength =
KiROUND( (
double) length / pinGrid ) * pinGrid;
430 pin->SetLength( newLength );
436 commit.
Push(
_(
"Align Items to Grid" ) );
443 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.
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.
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.
Define a library symbol object.
std::vector< SCH_PIN * > GetPins(int aUnit, int aBodyStyle) const
Return a list of pin object pointers from the draw item list.
int GetUnitCount() const override
static TOOL_ACTION alignToGrid
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
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.
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.
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_MOVING
Item being moved.
Class to handle a set of SCH_ITEMs.
VECTOR2< int32_t > VECTOR2I