use of com.cburch.logisim.tools.Tool in project logisim-evolution by reds-heig.
the class MouseMappings method copyFrom.
//
// modification methods
//
public void copyFrom(MouseMappings other, LogisimFile file) {
if (this == other)
return;
cache_mods = -1;
this.map.clear();
for (Integer mods : other.map.keySet()) {
Tool srcTool = other.map.get(mods);
Tool dstTool = file.findTool(srcTool);
if (dstTool != null) {
dstTool = dstTool.cloneTool();
AttributeSets.copy(srcTool.getAttributeSet(), dstTool.getAttributeSet());
this.map.put(mods, dstTool);
}
}
fireMouseMappingsChanged();
}
use of com.cburch.logisim.tools.Tool in project logisim-evolution by reds-heig.
the class MouseMappings method getToolFor.
public Tool getToolFor(int mods) {
if (mods == cache_mods) {
return cache_tool;
} else {
Tool ret = map.get(Integer.valueOf(mods));
cache_mods = mods;
cache_tool = ret;
return ret;
}
}
use of com.cburch.logisim.tools.Tool in project logisim-evolution by reds-heig.
the class ToolbarData method replaceAll.
//
// package-protected methods
//
void replaceAll(Map<Tool, Tool> toolMap) {
boolean changed = false;
for (ListIterator<Tool> it = contents.listIterator(); it.hasNext(); ) {
Object old = it.next();
if (toolMap.containsKey(old)) {
changed = true;
removeAttributeListeners((Tool) old);
Tool newTool = toolMap.get(old);
if (newTool == null) {
it.remove();
} else {
Tool addedTool = newTool.cloneTool();
addAttributeListeners(addedTool);
LoadedLibrary.copyAttributes(addedTool.getAttributeSet(), ((Tool) old).getAttributeSet());
it.set(addedTool);
}
}
}
if (changed)
fireToolbarChanged();
}
use of com.cburch.logisim.tools.Tool in project logisim-evolution by reds-heig.
the class ToolboxManip method doubleClicked.
public void doubleClicked(ProjectExplorerEvent event) {
Object clicked = event.getTarget();
if (clicked instanceof ProjectExplorerToolNode) {
Tool baseTool = ((ProjectExplorerToolNode) clicked).getValue();
if (baseTool instanceof AddTool) {
AddTool tool = (AddTool) baseTool;
ComponentFactory source = tool.getFactory();
if (source instanceof SubcircuitFactory) {
SubcircuitFactory circFact = (SubcircuitFactory) source;
proj.setCurrentCircuit(circFact.getSubcircuit());
proj.getFrame().setEditorView(Frame.EDIT_LAYOUT);
if (lastSelected != null) {
proj.setTool(lastSelected);
} else {
Library base = proj.getLogisimFile().getLibrary("Base");
if (base != null)
proj.setTool(base.getTool("Edit Tool"));
}
}
}
}
}
use of com.cburch.logisim.tools.Tool in project logisim-evolution by reds-heig.
the class ToolboxManip method selectionChanged.
public void selectionChanged(ProjectExplorerEvent event) {
Object selected = event.getTarget();
if (selected instanceof ProjectExplorerToolNode) {
Tool tool = ((ProjectExplorerToolNode) selected).getValue();
if (selected instanceof AddTool) {
AddTool addTool = (AddTool) tool;
ComponentFactory source = addTool.getFactory();
if (source instanceof SubcircuitFactory) {
SubcircuitFactory circFact = (SubcircuitFactory) source;
Circuit circ = circFact.getSubcircuit();
if (proj.getCurrentCircuit() == circ) {
AttrTableModel m = new AttrTableCircuitModel(proj, circ);
proj.getFrame().setAttrTableModel(m);
return;
}
}
}
// This was causing the selection to lag behind double-clicks,
// commented-out
// lastSelected = proj.getTool();
proj.setTool(tool);
proj.getFrame().viewAttributes(tool);
}
}
Aggregations