use of com.cburch.logisim.tools.Tool in project logisim-evolution by reds-heig.
the class Frame method setAttrTableModel.
void setAttrTableModel(AttrTableModel value) {
attrTable.setAttrTableModel(value);
if (value instanceof AttrTableToolModel) {
Tool tool = ((AttrTableToolModel) value).getTool();
toolbox.setHaloedTool(tool);
layoutToolbarModel.setHaloedTool(tool);
} else {
toolbox.setHaloedTool(null);
layoutToolbarModel.setHaloedTool(null);
}
if (value instanceof AttrTableComponentModel) {
Circuit circ = ((AttrTableComponentModel) value).getCircuit();
Component comp = ((AttrTableComponentModel) value).getComponent();
layoutCanvas.setHaloedComponent(circ, comp);
} else {
layoutCanvas.setHaloedComponent(null, null);
}
}
use of com.cburch.logisim.tools.Tool in project logisim-evolution by reds-heig.
the class LayoutEditHandler method selectSelectTool.
private void selectSelectTool(Project proj) {
for (Library sub : proj.getLogisimFile().getLibraries()) {
if (sub instanceof Base) {
Base base = (Base) sub;
Tool tool = base.getTool("Edit Tool");
if (tool != null)
proj.setTool(tool);
}
}
}
use of com.cburch.logisim.tools.Tool in project logisim-evolution by reds-heig.
the class LayoutToolbarModel method buildContents.
private void buildContents() {
List<ToolbarItem> oldItems = items;
List<ToolbarItem> newItems = new ArrayList<ToolbarItem>();
ToolbarData data = proj.getLogisimFile().getOptions().getToolbarData();
for (Tool tool : data.getContents()) {
if (tool == null) {
newItems.add(new ToolbarSeparator(4));
} else {
ToolbarItem i = findItem(oldItems, tool);
if (i == null) {
newItems.add(new ToolItem(tool));
} else {
newItems.add(i);
}
}
}
items = Collections.unmodifiableList(newItems);
fireToolbarContentsChanged();
}
use of com.cburch.logisim.tools.Tool in project logisim-evolution by reds-heig.
the class Wiring method getTools.
@Override
public List<Tool> getTools() {
if (tools == null) {
List<Tool> ret = new ArrayList<Tool>(ADD_TOOLS.length + DESCRIPTIONS.length);
for (Tool a : ADD_TOOLS) {
ret.add(a);
}
ret.addAll(FactoryDescription.getTools(Wiring.class, DESCRIPTIONS));
tools = ret;
}
return tools;
}
use of com.cburch.logisim.tools.Tool 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;
}
Aggregations