use of com.cburch.logisim.circuit.Circuit in project logisim-evolution by reds-heig.
the class LoadedLibrary method replaceAll.
private static void replaceAll(LogisimFile file, Map<ComponentFactory, ComponentFactory> compMap, Map<Tool, Tool> toolMap) {
file.getOptions().getToolbarData().replaceAll(toolMap);
file.getOptions().getMouseMappings().replaceAll(toolMap);
for (Circuit circuit : file.getCircuits()) {
replaceAll(circuit, compMap);
}
}
use of com.cburch.logisim.circuit.Circuit in project logisim-evolution by reds-heig.
the class LogisimFile method createNew.
//
// creation methods
//
public static LogisimFile createNew(Loader loader, Project proj) {
LogisimFile ret = new LogisimFile(loader);
ret.main = new Circuit("main", ret, proj);
// The name will be changed in LogisimPreferences
ret.tools.add(new AddTool(ret.main.getSubcircuitFactory()));
return ret;
}
use of com.cburch.logisim.circuit.Circuit in project logisim-evolution by reds-heig.
the class LogisimFile method getUnloadLibraryMessage.
public String getUnloadLibraryMessage(Library lib) {
HashSet<ComponentFactory> factories = new HashSet<ComponentFactory>();
for (Tool tool : lib.getTools()) {
if (tool instanceof AddTool) {
factories.add(((AddTool) tool).getFactory());
}
}
for (Circuit circuit : getCircuits()) {
for (Component comp : circuit.getNonWires()) {
if (factories.contains(comp.getFactory())) {
return StringUtil.format(Strings.get("unloadUsedError"), circuit.getName());
}
}
}
ToolbarData tb = options.getToolbarData();
MouseMappings mm = options.getMouseMappings();
for (Tool t : lib.getTools()) {
if (tb.usesToolFromSource(t)) {
return Strings.get("unloadToolbarError");
}
if (mm.usesToolFromSource(t)) {
return Strings.get("unloadMappingError");
}
}
return null;
}
use of com.cburch.logisim.circuit.Circuit in project logisim-evolution by reds-heig.
the class LogisimFile method getCircuits.
public List<Circuit> getCircuits() {
List<Circuit> ret = new ArrayList<Circuit>(tools.size());
for (AddTool tool : tools) {
SubcircuitFactory factory = (SubcircuitFactory) tool.getFactory();
ret.add(factory.getSubcircuit());
}
return ret;
}
use of com.cburch.logisim.circuit.Circuit in project logisim-evolution by reds-heig.
the class Project method addCircuitListener.
public void addCircuitListener(CircuitListener value) {
circuitListeners.add(value);
Circuit current = getCurrentCircuit();
if (current != null)
current.addCircuitListener(value);
}
Aggregations