import net.mograsim.logic.model.model.components.GUIComponent;
import net.mograsim.logic.model.model.wires.MovablePin;
import net.mograsim.logic.model.model.wires.Pin;
+import net.mograsim.logic.model.model.wires.PinUsage;
+import net.mograsim.logic.model.serializing.IdentifierGetter;
import net.mograsim.preferences.Preferences;
public class SimpleRectangularGUIGate extends GUIComponent
this.logicWidth = logicWidth;
this.isInverted = isInverted;
this.rectWidth = width - (isInverted ? invertedCircleDiam : 0);
- this.outputPin = new MovablePin(this, "Y", logicWidth, width, 0);
+ this.outputPin = new MovablePin(this, "Y", logicWidth, PinUsage.OUTPUT, width, 0);
addPin(outputPin);
this.inputPins = new ArrayList<>();
setInputCount(1);
for (int i = oldInputCount; i < inputCount; i++)
{
// TODO what for more than 24 input pins?
- Pin pin = new Pin(this, String.valueOf((char) ('A' + i)), logicWidth, 0, pinDistance / 2 + i * pinDistance);
+ Pin pin = new Pin(this, String.valueOf((char) ('A' + i)), logicWidth, PinUsage.INPUT, 0, pinDistance / 2 + i * pinDistance);
inputPins.add(pin);
addPin(pin);
}
@Override
public void render(GeneralGC gc, Rectangle visibleRegion)
{
- Color foreground = Preferences.current().getColor("net.mograsim.logic.ui.color.foreground");
+ Color foreground = Preferences.current().getColor("net.mograsim.logic.model.color.foreground");
if (foreground != null)
gc.setForeground(foreground);
double height = (getPins().size() - 1) * pinDistance;
Font labelFont = new Font(oldFont.getName(), fontHeight, oldFont.getStyle());
gc.setFont(labelFont);
Point textExtent = gc.textExtent(label);
- Color textColor = Preferences.current().getColor("net.mograsim.logic.ui.color.text");
+ Color textColor = Preferences.current().getColor("net.mograsim.logic.model.color.text");
if (textColor != null)
gc.setForeground(textColor);
gc.drawText(label, getPosX() + (rectWidth - textExtent.x) / 2, getPosY() + (height - textExtent.y) / 2, true);
* {@link SimpleRectangularGUIGate}s implementation returns a {@link JsonPrimitive} of type int containing the {@link #logicWidth} of
* this component.
*
- * @see GUIComponent#getParams()
+ * @see GUIComponent#getParamsForSerializing()
*/
@Override
- public JsonElement getParams()
+ public JsonElement getParamsForSerializing(IdentifierGetter idGetter)
{
return new JsonPrimitive(logicWidth);
}