mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-24 04:42:51 -04:00
generic circuits have access to the circuit specific settings, closes #626
This commit is contained in:
parent
f7a37fc1e8
commit
822a6f02a4
@ -36,6 +36,7 @@ public class ResolveGenerics {
|
|||||||
* Key uses to store the args for the generic circuits
|
* Key uses to store the args for the generic circuits
|
||||||
*/
|
*/
|
||||||
public static final String GEN_ARGS_KEY = "genArgs";
|
public static final String GEN_ARGS_KEY = "genArgs";
|
||||||
|
private static final String SETTINGS_KEY = "settings";
|
||||||
private final HashMap<String, Statement> map;
|
private final HashMap<String, Statement> map;
|
||||||
private final HashMap<Args, CircuitHolder> circuitMap;
|
private final HashMap<Args, CircuitHolder> circuitMap;
|
||||||
private final Circuit circuit;
|
private final Circuit circuit;
|
||||||
@ -163,6 +164,7 @@ public class ResolveGenerics {
|
|||||||
Context context = new Context();
|
Context context = new Context();
|
||||||
if (circuit.getOrigin() != null)
|
if (circuit.getOrigin() != null)
|
||||||
context.declareVar(Context.BASE_FILE_KEY, circuit.getOrigin());
|
context.declareVar(Context.BASE_FILE_KEY, circuit.getOrigin());
|
||||||
|
context.declareVar(SETTINGS_KEY, new SubstituteLibrary.AllowSetAttributes(circuit.getAttributes()));
|
||||||
context.declareFunc("addWire", new AddWire(newWires));
|
context.declareFunc("addWire", new AddWire(newWires));
|
||||||
context.declareFunc("addComponent", new AddComponent(newComponents, args));
|
context.declareFunc("addComponent", new AddComponent(newComponents, args));
|
||||||
return context;
|
return context;
|
||||||
@ -308,7 +310,7 @@ public class ResolveGenerics {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!key.equals(Context.BASE_FILE_KEY)) {
|
if (!key.equals(Context.BASE_FILE_KEY) && !key.equals(SETTINGS_KEY)) {
|
||||||
contentSet.add(key);
|
contentSet.add(key);
|
||||||
sb.append(key).append(":=");
|
sb.append(key).append(":=");
|
||||||
if (val instanceof String) {
|
if (val instanceof String) {
|
||||||
|
@ -102,8 +102,8 @@ public class LayoutShape implements Shape {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
height = left.max(right.max(custom.getAttributes().get(Keys.HEIGHT)));
|
height = left.max(right.max(circuit.getAttributes().get(Keys.HEIGHT)));
|
||||||
width = top.max(bottom.max(custom.getAttributes().get(Keys.WIDTH)));
|
width = top.max(bottom.max(circuit.getAttributes().get(Keys.WIDTH)));
|
||||||
|
|
||||||
HashMap<String, PinPos> map = new HashMap<>();
|
HashMap<String, PinPos> map = new HashMap<>();
|
||||||
top.createPosition(map, new Vector(0, 0), width);
|
top.createPosition(map, new Vector(0, 0), width);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user