import java.util.Collections;
import java.util.List;
-import net.mograsim.logic.ui.model.ViewModel;
-import net.mograsim.logic.ui.model.wires.MovablePin;
-import net.mograsim.logic.ui.model.wires.Pin;
import net.haspamelodica.swt.helper.gcs.GeneralGC;
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 SimpleRectangularGUIGate extends GUIComponent
{
private final List<Pin> inputPins;
private final List<Pin> inputPinsUnmodifiable;
- protected SimpleRectangularGUIGate(ViewModel model, int logicWidth, String label, boolean isInverted)
+ protected SimpleRectangularGUIGate(ViewModelModifiable model, int logicWidth, String label, boolean isInverted)
{
super(model);
this.label = label;
this.logicWidth = logicWidth;
this.isInverted = isInverted;
this.rectWidth = width - (isInverted ? invertedCircleDiam : 0);
- this.outputPin = new MovablePin(this, logicWidth, width, 0);
+ this.outputPin = new MovablePin(this, "Y", logicWidth, width, 0);
addPin(outputPin);
this.inputPins = new ArrayList<>();
this.inputPinsUnmodifiable = Collections.unmodifiableList(inputPins);
setSize(width, inputCount * pinDistance);
if (oldInputCount > inputCount)
while (inputPins.size() > inputCount)
- removePin(inputPins.get(inputCount));
+ removePin(inputPins.remove(inputCount));
else if (oldInputCount < inputCount)
for (int i = oldInputCount; i < inputCount; i++)
{
- Pin pin = new Pin(this, logicWidth, 0, pinDistance / 2 + i * pinDistance);
+ // TODO what for more than 26 input pins?
+ Pin pin = new Pin(this, "A" + i, logicWidth, 0, pinDistance / 2 + i * pinDistance);
inputPins.add(pin);
addPin(pin);
}