This iterated over all pins to find the pin after a given item. Because
out pattern is consistently to iterate in the outer loop, this means
that we were an O(n^2) loop for the pins just to find their names. This
affected very large parts (e.g. FPGAs) when switching sheets to display
ADDED: When pin length is changed now, the pin position is adjusted
according to its orientation such that the connection point for wires
moves instead of the other side of the stem base. For pins coming out of
component boxes, etc. this keeps them attached to the box while the
length is changed.
Calling UpdateItem() may be performed by in a common loop, e.g. for(
SCH_ITEM* item : GetScreen()->Items() ) or similar. We cannot call
GetScreen()->Update( SCH_ITEM* ) in this routine as it will remove and
re-add the item to the RTree, invalidating iterators. If needed, the
items need to be cached to an external container before updating
Fixes https://gitlab.com/kicad/code/kicad/issues/9318
Units in library items start at 1. 0 is reserved for "all units".
Previous code was requesting an out of range index due to an assumption
that units start at 0.
Consider a pin synchronized iff the names and electrical types match in
addition to the position, orientation and demorgan variant.
Also, only modify one matching pin per unit. This prevents
moving/editing a full stack of pins on the same unit when synchonized.
Fixes https://gitlab.com/kicad/code/kicad/issues/2590