mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-10 05:15:51 -04:00
Highlights the input connection port in the multiplexer when the input is selected; closes #1299
This commit is contained in:
parent
7e3ebcdf03
commit
426a1e1170
@ -7,6 +7,8 @@ HEAD, planned as v0.31
|
|||||||
- Allows disabling LED's in the measurement graph
|
- Allows disabling LED's in the measurement graph
|
||||||
- Adds drivers with inverted output
|
- Adds drivers with inverted output
|
||||||
- Adds a minified circuit as a new shape for embedded circuits
|
- Adds a minified circuit as a new shape for embedded circuits
|
||||||
|
- Highlights the input connection port in the multiplexer when the
|
||||||
|
input is selected.
|
||||||
- Allows recovering from oscillations.
|
- Allows recovering from oscillations.
|
||||||
- Supports XDG_CONFIG_HOME environment variable
|
- Supports XDG_CONFIG_HOME environment variable
|
||||||
- Fixes a bug in max path len calculation
|
- Fixes a bug in max path len calculation
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<circuit>
|
<circuit>
|
||||||
<version>1</version>
|
<version>2</version>
|
||||||
<attributes>
|
<attributes>
|
||||||
<entry>
|
<entry>
|
||||||
<string>Description</string>
|
<string>Description</string>
|
||||||
@ -158,10 +158,6 @@ Single-Cycle CPU.}}</string>
|
|||||||
<visualElement>
|
<visualElement>
|
||||||
<elementName>Clock</elementName>
|
<elementName>Clock</elementName>
|
||||||
<elementAttributes>
|
<elementAttributes>
|
||||||
<entry>
|
|
||||||
<string>runRealTime</string>
|
|
||||||
<boolean>true</boolean>
|
|
||||||
</entry>
|
|
||||||
<entry>
|
<entry>
|
||||||
<string>Label</string>
|
<string>Label</string>
|
||||||
<string>Clock</string>
|
<string>Clock</string>
|
||||||
@ -777,13 +773,15 @@ Single-Cycle CPU.}}</string>
|
|||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>Data</string>
|
<string>Data</string>
|
||||||
<data>8000,961,8190,951,a90,a83,a25,a3a,10e1,afc,2bef,3d5f,c21,212f,38f9,3d20,105,116,a30,
|
<data>8000,961,8190,951,a90,a83,a25,a3a,10e1,afc,2bef,3d5f,c21,212f
|
||||||
a20,aa0,8035,3ac0,4380,2180,3505,2172,3505,2173,3503,3d03,2173,3801,aa3,401a,c01,
|
,38f9,3d20,105,116,a30,a20,aa0,8035,3ac0,4380,2180,3505,2172,3505
|
||||||
c11,c21,8014,2020,38eb,c31,8014,2030,38e6,1991,ffff,3e09,146,165,154,4400,3ddb,a70,
|
,2173,3503,3d03,2173,3801,aa3,401a,c01,c11,c21,8014,2020,38eb
|
||||||
1031,8014,f00,8060,3ab0,c21,c01,8060,3ab0,c31,8014,b00,8060,3ab0,c31,8014,b00,8060,
|
,c31,8014,2030,38e6,1991,ffff,3e09,146,165,154,4400,3ddb,a70,1031
|
||||||
3ab0,1021,1001,8060,3ab0,1021,1001,8060,3ab0,1031,8014,f00,8060,3ab0,1031,8014,f00,
|
,8014,f00,8060,3ab0,c21,c01,8060,3ab0,c31,8014,b00,8060,3ab0,c31
|
||||||
8060,3ab0,c21,c31,8015,b00,3b0c,8014,2020,3707,8014,2030,3704,4380,2180,3501,c71,
|
,8014,b00,8060,3ab0,1021,1001,8060,3ab0,1021,1001,8060,3ab0,1031
|
||||||
3b0b,143,8014,1c40,242,246,4048,2cfe,ce1,3b0f</data>
|
,8014,f00,8060,3ab0,1031,8014,f00,8060,3ab0,c21,c31,8015,b00,3b0c
|
||||||
|
,8014,2020,3707,8014,2030,3704,4380,2180,3501,c71,3b0b,143,8014
|
||||||
|
,1c40,242,246,4048,2cfe,ce1,3b0f</data>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>lastDataFile</string>
|
<string>lastDataFile</string>
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
*/
|
*/
|
||||||
package de.neemann.digital.draw.shapes;
|
package de.neemann.digital.draw.shapes;
|
||||||
|
|
||||||
|
import de.neemann.digital.core.ObservableValue;
|
||||||
|
import de.neemann.digital.core.Value;
|
||||||
import de.neemann.digital.core.element.ElementAttributes;
|
import de.neemann.digital.core.element.ElementAttributes;
|
||||||
import de.neemann.digital.core.element.Keys;
|
import de.neemann.digital.core.element.Keys;
|
||||||
import de.neemann.digital.core.element.PinDescriptions;
|
import de.neemann.digital.core.element.PinDescriptions;
|
||||||
@ -14,6 +16,7 @@ import de.neemann.digital.draw.elements.Pins;
|
|||||||
import de.neemann.digital.draw.graphics.*;
|
import de.neemann.digital.draw.graphics.*;
|
||||||
|
|
||||||
import static de.neemann.digital.draw.shapes.GenericShape.SIZE;
|
import static de.neemann.digital.draw.shapes.GenericShape.SIZE;
|
||||||
|
import static de.neemann.digital.draw.shapes.GenericShape.SIZE2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Muxer shape
|
* The Muxer shape
|
||||||
@ -24,6 +27,8 @@ public class MuxerShape implements Shape {
|
|||||||
private final PinDescriptions inputs;
|
private final PinDescriptions inputs;
|
||||||
private final PinDescriptions outputs;
|
private final PinDescriptions outputs;
|
||||||
private Pins pins;
|
private Pins pins;
|
||||||
|
private ObservableValue selector;
|
||||||
|
private Value selectorValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance
|
* Creates a new instance
|
||||||
@ -58,9 +63,16 @@ public class MuxerShape implements Shape {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Interactor applyStateMonitor(IOState ioState) {
|
public Interactor applyStateMonitor(IOState ioState) {
|
||||||
|
selector = ioState.getInput(0);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readObservableValues() {
|
||||||
|
if (selector != null)
|
||||||
|
selectorValue = selector.getCopy();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawTo(Graphic graphic, Style heighLight) {
|
public void drawTo(Graphic graphic, Style heighLight) {
|
||||||
graphic.drawPolygon(new Polygon(true)
|
graphic.drawPolygon(new Polygon(true)
|
||||||
@ -69,5 +81,15 @@ public class MuxerShape implements Shape {
|
|||||||
.add(SIZE * 2 - 1, inputCount * SIZE - 5)
|
.add(SIZE * 2 - 1, inputCount * SIZE - 5)
|
||||||
.add(1, inputCount * SIZE + 4), Style.NORMAL);
|
.add(1, inputCount * SIZE + 4), Style.NORMAL);
|
||||||
graphic.drawText(new Vector(3, 2), "0", Orientation.LEFTTOP, Style.SHAPE_PIN);
|
graphic.drawText(new Vector(3, 2), "0", Orientation.LEFTTOP, Style.SHAPE_PIN);
|
||||||
|
|
||||||
|
if (selectorValue != null) {
|
||||||
|
int in = (int) selectorValue.getValue() + 1;
|
||||||
|
Pins p = getPins();
|
||||||
|
if (in < p.size()) {
|
||||||
|
Vector pos = p.get(in).getPos();
|
||||||
|
int s = SIZE2 / 2;
|
||||||
|
graphic.drawCircle(pos.add(-s, -s), pos.add(s, s), Style.THIN);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user