minor changes to layout of parts

This commit is contained in:
hneemann 2016-03-19 21:32:45 +01:00
parent 7900bed856
commit d59083f76e
5 changed files with 11 additions and 11 deletions

View File

@ -14,7 +14,7 @@ import de.neemann.digital.core.part.PartTypeDescription;
*/
public class Add extends Node implements Part {
public static final PartTypeDescription DESCRIPTION = new PartTypeDescription(Add.class, "a", "b", "c_in").addAttribute(AttributeKey.Bits);
public static final PartTypeDescription DESCRIPTION = new PartTypeDescription(Add.class, "a", "b", "c_i").addAttribute(AttributeKey.Bits);
private final int bits;
private final ObservableValue sum;
private final ObservableValue c_out;
@ -28,8 +28,8 @@ public class Add extends Node implements Part {
bits = attributes.get(AttributeKey.Bits);
this.mask = 1 << bits;
this.sum = new ObservableValue("sum", bits);
this.c_out = new ObservableValue("c_out", 1);
this.sum = new ObservableValue("s", bits);
this.c_out = new ObservableValue("c_o", 1);
}
@Override

View File

@ -10,7 +10,7 @@ import de.neemann.digital.core.part.PartTypeDescription;
*/
public class Sub extends Add {
public static final PartTypeDescription DESCRIPTION = new PartTypeDescription(Sub.class, "a", "b", "c_in").addAttribute(AttributeKey.Bits);
public static final PartTypeDescription DESCRIPTION = new PartTypeDescription(Sub.class, "a", "b", "c_i").addAttribute(AttributeKey.Bits);
public Sub(PartAttributes attributes) {
super(attributes);

View File

@ -154,9 +154,9 @@ public class CircuitComponent extends JComponent implements Observer {
if (gr.getMin() != null) {
Vector delta = gr.getMax().sub(gr.getMin());
double sx = ((double) getWidth()) / delta.x;
double sy = ((double) getHeight()) / delta.y;
double s = Math.min(sx, sy) * 0.8;
double sx = ((double) getWidth()) / delta.x * 0.8;
double sy = ((double) getHeight()) / delta.y * 0.95;
double s = Math.min(sx, sy);
transform.setToScale(s, s); // set Scaling

View File

@ -56,7 +56,7 @@ public class OutputShape implements Shape {
Vector center = new Vector(2 + SIZE, 0);
graphic.drawCircle(center.sub(RAD), center.add(RAD), style);
graphic.drawCircle(center.sub(RADL), center.add(RADL), Style.NORMAL);
Vector textPos = new Vector(SIZE * 2 + 3, 0);
Vector textPos = new Vector(SIZE * 3, 0);
graphic.drawText(textPos, textPos.add(1, 0), label, Orientation.LEFTCENTER, Style.NORMAL);
}
}

View File

@ -43,9 +43,9 @@ public final class ShapeFactory {
map.put(XOr.DESCRIPTION.getName(), new CreatorSimple("=1", XOr.DESCRIPTION, false));
map.put(XNOr.DESCRIPTION.getName(), new CreatorSimple("=1", XNOr.DESCRIPTION, true));
map.put(Add.DESCRIPTION.getName(), new CreatorSimple("+", Add.DESCRIPTION, false));
map.put(Sub.DESCRIPTION.getName(), new CreatorSimple("-", Sub.DESCRIPTION, false));
map.put(Mul.DESCRIPTION.getName(), new CreatorSimple("*", Mul.DESCRIPTION, false));
map.put(Add.DESCRIPTION.getName(), attr -> new GenericShape("+", Add.DESCRIPTION.getInputNames(attr), outputNames(Add.DESCRIPTION, attr), true));
map.put(Sub.DESCRIPTION.getName(), attr -> new GenericShape("-", Sub.DESCRIPTION.getInputNames(attr), outputNames(Sub.DESCRIPTION, attr), true));
map.put(Mul.DESCRIPTION.getName(), attr -> new GenericShape("*", Mul.DESCRIPTION.getInputNames(attr), outputNames(Mul.DESCRIPTION, attr), true));
map.put(In.DESCRIPTION.getName(), attr -> new InputShape(attr.get(AttributeKey.Label)));