X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;ds=inline;f=LogicUI%2Fsrc%2Fera%2Fmi%2Fgui%2Fmodel%2Fwires%2FPin.java;fp=LogicUI%2Fsrc%2Fera%2Fmi%2Fgui%2Fmodel%2Fwires%2FPin.java;h=0000000000000000000000000000000000000000;hb=a28f7aa0dab4248e99159c5a647676170cb17a4e;hp=abafc07125746ee41cccf422960f8663262718ac;hpb=80bfbd8ebf0ad8a7ad98584544a0c73f43e6f3b6;p=Mograsim.git diff --git a/LogicUI/src/era/mi/gui/model/wires/Pin.java b/LogicUI/src/era/mi/gui/model/wires/Pin.java deleted file mode 100644 index abafc071..00000000 --- a/LogicUI/src/era/mi/gui/model/wires/Pin.java +++ /dev/null @@ -1,68 +0,0 @@ -package era.mi.gui.model.wires; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.Consumer; - -import era.mi.gui.model.components.GUIComponent; -import net.haspamelodica.swt.helper.swtobjectwrappers.Point; -import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; - -public class Pin -{ - public final GUIComponent component; - public final int logicWidth; - - protected double relX; - protected double relY; - - private final List> pinMovedListeners; - - public Pin(GUIComponent component, int logicWidth, double relX, double relY) - { - this.component = component; - this.logicWidth = logicWidth; - this.relX = relX; - this.relY = relY; - - this.pinMovedListeners = new ArrayList<>(); - - component.addComponentMovedListener(c -> callPinMovedListeners()); - } - - public double getRelX() - { - return relX; - } - - public double getRelY() - { - return relY; - } - - public Point getRelPos() - { - return new Point(relX, relY); - } - - public Point getPos() - { - Rectangle componentBounds = component.getBounds(); - return new Point(relX + componentBounds.x, relY + componentBounds.y); - } - - // @formatter:off - public void addPinMovedListener (Consumer listener){pinMovedListeners.add (listener);} - - public void removePinMovedListener(Consumer listener){pinMovedListeners.remove(listener);} - - private void callPinMovedListeners() {pinMovedListeners.forEach(l -> l.accept(this));} - // @formatter:on - - protected void setRelPos(double relX, double relY) - { - this.relX = relX; - this.relY = relY; - callPinMovedListeners(); - } -} \ No newline at end of file