mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-24 04:42:51 -04:00
also the clock shape can be smaller; see #755
This commit is contained in:
parent
96e0c86095
commit
b26934a4fd
@ -1,6 +1,7 @@
|
|||||||
Release Notes
|
Release Notes
|
||||||
|
|
||||||
HEAD, planned as v0.28
|
HEAD, planned as v0.28
|
||||||
|
- Inputs and outputs can have a smaller shape.
|
||||||
- adds paste functionality to ROM data editor.
|
- adds paste functionality to ROM data editor.
|
||||||
- adds some more ATF150x devices
|
- adds some more ATF150x devices
|
||||||
- Probe is able to count edges.
|
- Probe is able to count edges.
|
||||||
|
@ -25,6 +25,7 @@ public class Clock implements Element {
|
|||||||
.addAttribute(Keys.RUN_AT_REAL_TIME)
|
.addAttribute(Keys.RUN_AT_REAL_TIME)
|
||||||
.addAttribute(Keys.FREQUENCY)
|
.addAttribute(Keys.FREQUENCY)
|
||||||
.addAttribute(Keys.PINNUMBER)
|
.addAttribute(Keys.PINNUMBER)
|
||||||
|
.addAttribute(Keys.IN_OUT_SMALL)
|
||||||
.supportsHDL();
|
.supportsHDL();
|
||||||
|
|
||||||
private final ObservableValue output;
|
private final ObservableValue output;
|
||||||
|
@ -28,10 +28,9 @@ import static de.neemann.digital.draw.shapes.OutputShape.OUT_SIZE;
|
|||||||
* The Clock shape
|
* The Clock shape
|
||||||
*/
|
*/
|
||||||
public class ClockShape implements Shape {
|
public class ClockShape implements Shape {
|
||||||
private static final int WI = OUT_SIZE / 3;
|
|
||||||
|
|
||||||
private final String label;
|
private final String label;
|
||||||
private final PinDescriptions outputs;
|
private final PinDescriptions outputs;
|
||||||
|
private final boolean small;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance
|
* Creates a new instance
|
||||||
@ -47,6 +46,8 @@ public class ClockShape implements Shape {
|
|||||||
this.label = attr.getLabel();
|
this.label = attr.getLabel();
|
||||||
else
|
else
|
||||||
this.label = attr.getLabel() + " (" + pinNumber + ")";
|
this.label = attr.getLabel() + " (" + pinNumber + ")";
|
||||||
|
|
||||||
|
small = attr.get(Keys.IN_OUT_SMALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -69,31 +70,35 @@ public class ClockShape implements Shape {
|
|||||||
@Override
|
@Override
|
||||||
public void drawTo(Graphic graphic, Style heighLight) {
|
public void drawTo(Graphic graphic, Style heighLight) {
|
||||||
Vector wavePos;
|
Vector wavePos;
|
||||||
|
int waveSize = OUT_SIZE / 3;
|
||||||
if (graphic.isFlagSet(Graphic.Flag.smallIO)) {
|
if (graphic.isFlagSet(Graphic.Flag.smallIO)) {
|
||||||
Vector center = new Vector(-LATEX_RAD.x, 0);
|
Vector center = new Vector(-LATEX_RAD.x, 0);
|
||||||
graphic.drawCircle(center.sub(LATEX_RAD), center.add(LATEX_RAD), Style.NORMAL);
|
graphic.drawCircle(center.sub(LATEX_RAD), center.add(LATEX_RAD), Style.NORMAL);
|
||||||
Vector textPos = new Vector(-SIZE2 - LATEX_RAD.x, 0);
|
Vector textPos = new Vector(-SIZE2 - LATEX_RAD.x, 0);
|
||||||
graphic.drawText(textPos, label, Orientation.RIGHTCENTER, Style.INOUT);
|
graphic.drawText(textPos, label, Orientation.RIGHTCENTER, Style.INOUT);
|
||||||
wavePos = center.sub(new Vector(2 * WI, LATEX_RAD.y + WI + 1));
|
wavePos = center.sub(new Vector(2 * waveSize, LATEX_RAD.y + waveSize + 1));
|
||||||
} else {
|
} else {
|
||||||
|
int outSize = OutputShape.getOutSize(small);
|
||||||
|
waveSize = outSize / 3;
|
||||||
graphic.drawPolygon(new Polygon(true)
|
graphic.drawPolygon(new Polygon(true)
|
||||||
.add(-OUT_SIZE * 2 - 1, -OUT_SIZE)
|
.add(-outSize * 2 - 1, -outSize)
|
||||||
.add(-1, -OUT_SIZE)
|
.add(-1, -outSize)
|
||||||
.add(-1, OUT_SIZE)
|
.add(-1, outSize)
|
||||||
.add(-OUT_SIZE * 2 - 1, OUT_SIZE), Style.NORMAL);
|
.add(-outSize * 2 - 1, outSize), Style.NORMAL);
|
||||||
|
|
||||||
Vector textPos = new Vector(-OUT_SIZE * 3, 0);
|
Vector textPos = new Vector(-outSize * 3, 0);
|
||||||
graphic.drawText(textPos, label, Orientation.RIGHTCENTER, Style.NORMAL);
|
graphic.drawText(textPos, label, Orientation.RIGHTCENTER, Style.INOUT);
|
||||||
wavePos = new Vector(-OUT_SIZE - WI * 2, WI);
|
|
||||||
|
wavePos = new Vector(-outSize - waveSize * 2, waveSize);
|
||||||
}
|
}
|
||||||
graphic.drawPolygon(new Polygon(false)
|
graphic.drawPolygon(new Polygon(false)
|
||||||
.add(wavePos)
|
.add(wavePos)
|
||||||
.add(wavePos.add(WI, 0))
|
.add(wavePos.add(waveSize, 0))
|
||||||
.add(wavePos.add(WI, -WI * 2))
|
.add(wavePos.add(waveSize, -waveSize * 2))
|
||||||
.add(wavePos.add(2 * WI, -WI * 2))
|
.add(wavePos.add(2 * waveSize, -waveSize * 2))
|
||||||
.add(wavePos.add(2 * WI, 0))
|
.add(wavePos.add(2 * waveSize, 0))
|
||||||
.add(wavePos.add(3 * WI, 0))
|
.add(wavePos.add(3 * waveSize, 0))
|
||||||
.add(wavePos.add(3 * WI, -WI * 2))
|
.add(wavePos.add(3 * waveSize, -waveSize * 2))
|
||||||
.add(wavePos.add(4 * WI, -WI * 2)), Style.THIN);
|
.add(wavePos.add(4 * waveSize, -waveSize * 2)), Style.THIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user