X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fmodel%2Fcomponents%2FSimpleRectangularSubmodelComponent.java;h=17fa8ab5d53eb04ded8904c0cb77d08f0e300309;hb=7fff8ff23871cf904cb95c92305e903fbba3d773;hp=7a7bb9d52b569bd810a1d96d71d0d532abfed8ee;hpb=c223a9de7b0ef783bcb4f7612da350583ca29abd;p=Mograsim.git diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularSubmodelComponent.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularSubmodelComponent.java index 7a7bb9d5..17fa8ab5 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularSubmodelComponent.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularSubmodelComponent.java @@ -13,6 +13,7 @@ import net.haspamelodica.swt.helper.swtobjectwrappers.Font; import net.haspamelodica.swt.helper.swtobjectwrappers.Point; import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; import net.mograsim.logic.ui.model.ViewModelModifiable; +import net.mograsim.logic.ui.model.wires.MovablePin; import net.mograsim.logic.ui.model.wires.Pin; public class SimpleRectangularSubmodelComponent extends SubmodelComponent @@ -69,7 +70,7 @@ public class SimpleRectangularSubmodelComponent extends SubmodelComponent String pinName = newPinNames[i]; int oldPinIndex = pinNamesListThisSide.indexOf(pinName); if (oldPinIndex == -1) - super.addSubmodelInterface(pinName, logicWidth, relX, pinDistance / 2 + i * pinDistance); + super.addSubmodelInterface(new MovablePin(this, pinName, logicWidth, relX, pinDistance / 2 + i * pinDistance)); else getSupermodelMovablePin(pinName).setRelPos(relX, pinDistance / 2 + i * pinDistance); } @@ -108,8 +109,8 @@ public class SimpleRectangularSubmodelComponent extends SubmodelComponent { String pinName = outputPinNames.get(i); textExtent = gc.textExtent(pinName); - gc.drawText(pinName, getPosX() + width - textExtent.x - pinNameMargin, getPosY() + i * pinDistance + (pinDistance - textExtent.y) / 2, - true); + gc.drawText(pinName, getPosX() + width - textExtent.x - pinNameMargin, + getPosY() + i * pinDistance + (pinDistance - textExtent.y) / 2, true); } gc.setFont(oldFont); } @@ -135,7 +136,7 @@ public class SimpleRectangularSubmodelComponent extends SubmodelComponent } @Override - protected Pin addSubmodelInterface(String name, int logicWidth, double relX, double relY) + protected Pin addSubmodelInterface(MovablePin supermodelPin) { throw new UnsupportedOperationException( "Can't add submodel interfaces to a SimpleRectangularSubmodelComponent directly, call setInputPins / setOutputPins instead");