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.ModelVisitor;
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
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);
}
{
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);
}
ret.type = SimpleRectangularSubmodelComponent.class.getSimpleName();
Map<String, Object> m = new TreeMap<>();
m.put(kLabel, label);
- m.put(kInCount, inputPinNames.size());
- m.put(kOutCount, outputPinNames.size());
+ m.put(kInCount, inputPinNames.toArray());
+ m.put(kOutCount, outputPinNames.toArray());
m.put(kLogicWidth, logicWidth);
ret.specialized = m;
return ret;
}
@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");
throw new UnsupportedOperationException(
"Can't set the size of a SimpleRectangularSubmodelComponent directly, call setInputPins / setOutputPins instead");
}
+
+ @Override
+ public void accept(ModelVisitor mv)
+ {
+ mv.visit(this);
+ }
}
\ No newline at end of file