当前位置: 首页>>代码示例>>Java>>正文


Java Project.getCurrentCircuit方法代码示例

本文整理汇总了Java中com.cburch.logisim.proj.Project.getCurrentCircuit方法的典型用法代码示例。如果您正苦于以下问题:Java Project.getCurrentCircuit方法的具体用法?Java Project.getCurrentCircuit怎么用?Java Project.getCurrentCircuit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.cburch.logisim.proj.Project的用法示例。


在下文中一共展示了Project.getCurrentCircuit方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CircuitJList

import com.cburch.logisim.proj.Project; //导入方法依赖的package包/类
public CircuitJList(Project proj, boolean includeEmpty) {
	LogisimFile file = proj.getLogisimFile();
	Circuit current = proj.getCurrentCircuit();
	Vector<Circuit> options = new Vector<Circuit>();
	boolean currentFound = false;
	for (Circuit circ : file.getCircuits()) {
		if (!includeEmpty || circ.getBounds() != Bounds.EMPTY_BOUNDS) {
			if (circ == current)
				currentFound = true;
			options.add(circ);
		}
	}

	setListData(options);
	if (currentFound)
		setSelectedValue(current, true);
	setVisibleRowCount(Math.min(6, options.size()));
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:19,代码来源:CircuitJList.java

示例2: doIt

import com.cburch.logisim.proj.Project; //导入方法依赖的package包/类
@Override
public void doIt(Project proj) {
	Clipboard clip = Clipboard.get();
	Circuit circuit = proj.getCurrentCircuit();
	CircuitMutation xn = new CircuitMutation(circuit);
	Collection<Component> comps = clip.getComponents();
	Collection<Component> toAdd = computeAdditions(comps);
	if (toAdd.size() > 0) {
		sel.pasteHelper(xn, toAdd);
		CircuitTransactionResult result = xn.execute();
		xnReverse = result.getReverseTransaction();
		after = SelectionSave.create(sel);
	} else {
		xnReverse = null;
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:17,代码来源:SelectionActions.java

示例3: selectAll

import com.cburch.logisim.proj.Project; //导入方法依赖的package包/类
@Override
public void selectAll() {
	Project proj = frame.getProject();
	Selection sel = frame.getCanvas().getSelection();
	selectSelectTool(proj);
	Circuit circ = proj.getCurrentCircuit();
	sel.addAll(circ.getWires());
	sel.addAll(circ.getNonWires());
	proj.repaintCanvas();
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:11,代码来源:LayoutEditHandler.java

示例4: actionPerformed

import com.cburch.logisim.proj.Project; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
	Object src = event.getSource();
	Project proj = frame.getProject();
	Circuit cur = proj == null ? null : proj.getCurrentCircuit();
	if (src == LogisimMenuBar.ADD_CIRCUIT) {
		ProjectCircuitActions.doAddCircuit(proj);
	} else if (src == LogisimMenuBar.MOVE_CIRCUIT_UP) {
		ProjectCircuitActions.doMoveCircuit(proj, cur, -1);
	} else if (src == LogisimMenuBar.MOVE_CIRCUIT_DOWN) {
		ProjectCircuitActions.doMoveCircuit(proj, cur, 1);
	} else if (src == LogisimMenuBar.SET_MAIN_CIRCUIT) {
		ProjectCircuitActions.doSetAsMainCircuit(proj, cur);
	} else if (src == LogisimMenuBar.REMOVE_CIRCUIT) {
		ProjectCircuitActions.doRemoveCircuit(proj, cur);
	} else if (src == LogisimMenuBar.EDIT_LAYOUT) {
		frame.setEditorView(Frame.EDIT_LAYOUT);
	} else if (src == LogisimMenuBar.EDIT_APPEARANCE) {
		frame.setEditorView(Frame.EDIT_APPEARANCE);
	} else if (src == LogisimMenuBar.VIEW_TOOLBOX) {
		frame.setExplorerView(Frame.VIEW_TOOLBOX);
	} else if (src == LogisimMenuBar.VIEW_SIMULATION) {
		frame.setExplorerView(Frame.VIEW_SIMULATION);
	} else if (src == LogisimMenuBar.REVERT_APPEARANCE) {
		proj.doAction(new RevertAppearanceAction(cur));
	} else if (src == LogisimMenuBar.ANALYZE_CIRCUIT) {
		ProjectCircuitActions.doAnalyze(proj, cur);
	} else if (src == LogisimMenuBar.CIRCUIT_STATS) {
		StatisticsDialog.show(frame, proj.getLogisimFile(), cur);
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:32,代码来源:MenuListener.java

示例5: computeRevertEnabled

import com.cburch.logisim.proj.Project; //导入方法依赖的package包/类
private void computeRevertEnabled() {
	// do this separately since it can happen rather often
	Project proj = frame.getProject();
	LogisimFile file = proj.getLogisimFile();
	Circuit cur = proj.getCurrentCircuit();
	boolean isProjectCircuit = file.contains(cur);
	boolean viewAppearance = frame.getEditorView().equals(Frame.EDIT_APPEARANCE);
	boolean canRevert = isProjectCircuit && viewAppearance && !cur.getAppearance().isDefaultAppearance();
	boolean oldValue = menubar.isEnabled(LogisimMenuBar.REVERT_APPEARANCE);
	if (canRevert != oldValue) {
		menubar.setEnabled(LogisimMenuBar.REVERT_APPEARANCE, canRevert);
		fireEnableChanged();
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:15,代码来源:MenuListener.java

示例6: register

import com.cburch.logisim.proj.Project; //导入方法依赖的package包/类
void register() {
	Project proj = frame.getProject();
	if (proj == null) {
		return;
	}

	proj.addProjectListener(this);
	proj.addLibraryListener(this);
	frame.addPropertyChangeListener(Frame.EDITOR_VIEW, this);
	frame.addPropertyChangeListener(Frame.EXPLORER_VIEW, this);
	Circuit circ = proj.getCurrentCircuit();
	if (circ != null) {
		circ.getAppearance().addCanvasModelListener(this);
	}

	menubar.addActionListener(LogisimMenuBar.ADD_CIRCUIT, this);
	menubar.addActionListener(LogisimMenuBar.MOVE_CIRCUIT_UP, this);
	menubar.addActionListener(LogisimMenuBar.MOVE_CIRCUIT_DOWN, this);
	menubar.addActionListener(LogisimMenuBar.SET_MAIN_CIRCUIT, this);
	menubar.addActionListener(LogisimMenuBar.REMOVE_CIRCUIT, this);
	menubar.addActionListener(LogisimMenuBar.EDIT_LAYOUT, this);
	menubar.addActionListener(LogisimMenuBar.EDIT_APPEARANCE, this);
	menubar.addActionListener(LogisimMenuBar.VIEW_TOOLBOX, this);
	menubar.addActionListener(LogisimMenuBar.VIEW_SIMULATION, this);
	menubar.addActionListener(LogisimMenuBar.REVERT_APPEARANCE, this);
	menubar.addActionListener(LogisimMenuBar.ANALYZE_CIRCUIT, this);
	menubar.addActionListener(LogisimMenuBar.CIRCUIT_STATS, this);

	computeEnabled();
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:31,代码来源:MenuListener.java

示例7: CircuitPopup

import com.cburch.logisim.proj.Project; //导入方法依赖的package包/类
CircuitPopup(Project proj, Tool tool, Circuit circuit) {
	super(Strings.get("circuitMenu"));
	this.proj = proj;
	this.circuit = circuit;

	add(editLayout);
	editLayout.addActionListener(this);
	add(editAppearance);
	editAppearance.addActionListener(this);
	add(analyze);
	analyze.addActionListener(this);
	add(stats);
	stats.addActionListener(this);
	addSeparator();
	add(main);
	main.addActionListener(this);
	add(remove);
	remove.addActionListener(this);

	boolean canChange = proj.getLogisimFile().contains(circuit);
	LogisimFile file = proj.getLogisimFile();
	if (circuit == proj.getCurrentCircuit()) {
		if (proj.getFrame().getEditorView().equals(Frame.EDIT_APPEARANCE)) {
			editAppearance.setEnabled(false);
		} else {
			editLayout.setEnabled(false);
		}
	}
	main.setEnabled(canChange && file.getMainCircuit() != circuit);
	remove.setEnabled(canChange && file.getCircuitCount() > 1 && proj.getDependencies().canRemove(circuit));
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:32,代码来源:Popups.java

示例8: drawWithUserState

import com.cburch.logisim.proj.Project; //导入方法依赖的package包/类
private void drawWithUserState(Graphics base, Graphics g, Project proj) {
	Circuit circ = proj.getCurrentCircuit();
	Selection sel = proj.getSelection();
	Set<Component> hidden;
	Tool dragTool = canvas.getDragTool();
	if (dragTool == null) {
		hidden = NO_COMPONENTS;
	} else {
		hidden = dragTool.getHiddenComponents(canvas);
		if (hidden == null)
			hidden = NO_COMPONENTS;
	}

	// draw halo around component whose attributes we are viewing
	boolean showHalo = AppPreferences.ATTRIBUTE_HALO.getBoolean();
	if (showHalo && haloedComponent != null && haloedCircuit == circ && !hidden.contains(haloedComponent)) {
		GraphicsUtil.switchToWidth(g, 3);
		g.setColor(Canvas.HALO_COLOR);
		Bounds bds = haloedComponent.getBounds(g).expand(5);
		int w = bds.getWidth();
		int h = bds.getHeight();
		double a = Canvas.SQRT_2 * w;
		double b = Canvas.SQRT_2 * h;
		g.drawOval((int) Math.round(bds.getX() + w / 2.0 - a / 2.0),
				(int) Math.round(bds.getY() + h / 2.0 - b / 2.0), (int) Math.round(a), (int) Math.round(b));
		GraphicsUtil.switchToWidth(g, 1);
		g.setColor(Color.BLACK);
	}

	// draw circuit and selection
	CircuitState circState = proj.getCircuitState();
	boolean printerView = AppPreferences.PRINTER_VIEW.getBoolean();
	ComponentDrawContext context = new ComponentDrawContext(canvas, circ, circState, base, g, printerView);
	context.setHighlightedWires(highlightedWires);
	circ.draw(context, hidden);
	sel.draw(context, hidden);

	// draw tool
	Tool tool = dragTool != null ? dragTool : proj.getTool();
	if (tool != null && !canvas.isPopupMenuUp()) {
		Graphics gCopy = g.create();
		context.setGraphics(gCopy);
		tool.draw(canvas, context);
		gCopy.dispose();
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:47,代码来源:CanvasPainter.java

示例9: computeEnabled

import com.cburch.logisim.proj.Project; //导入方法依赖的package包/类
private void computeEnabled() {
	Project proj = frame.getProject();
	LogisimFile file = proj.getLogisimFile();
	Circuit cur = proj.getCurrentCircuit();
	int curIndex = file.getCircuits().indexOf(cur);
	boolean isProjectCircuit = curIndex >= 0;
	String editorView = frame.getEditorView();
	String explorerView = frame.getExplorerView();
	boolean canSetMain = false;
	boolean canMoveUp = false;
	boolean canMoveDown = false;
	boolean canRemove = false;
	boolean canRevert = false;
	boolean viewAppearance = editorView.equals(Frame.EDIT_APPEARANCE);
	boolean viewLayout = editorView.equals(Frame.EDIT_LAYOUT);
	boolean viewToolbox = explorerView.equals(Frame.VIEW_TOOLBOX);
	boolean viewSimulation = explorerView.equals(Frame.VIEW_SIMULATION);
	if (isProjectCircuit) {
		List<?> tools = proj.getLogisimFile().getTools();

		canSetMain = proj.getLogisimFile().getMainCircuit() != cur;
		canMoveUp = curIndex > 0;
		canMoveDown = curIndex < tools.size() - 1;
		canRemove = tools.size() > 1;
		canRevert = viewAppearance && !cur.getAppearance().isDefaultAppearance();
	}

	menubar.setEnabled(LogisimMenuBar.ADD_CIRCUIT, true);
	menubar.setEnabled(LogisimMenuBar.MOVE_CIRCUIT_UP, canMoveUp);
	menubar.setEnabled(LogisimMenuBar.MOVE_CIRCUIT_DOWN, canMoveDown);
	menubar.setEnabled(LogisimMenuBar.SET_MAIN_CIRCUIT, canSetMain);
	menubar.setEnabled(LogisimMenuBar.REMOVE_CIRCUIT, canRemove);
	menubar.setEnabled(LogisimMenuBar.VIEW_TOOLBOX, !viewToolbox);
	menubar.setEnabled(LogisimMenuBar.VIEW_SIMULATION, !viewSimulation);
	menubar.setEnabled(LogisimMenuBar.EDIT_LAYOUT, !viewLayout);
	menubar.setEnabled(LogisimMenuBar.EDIT_APPEARANCE, !viewAppearance);
	menubar.setEnabled(LogisimMenuBar.REVERT_APPEARANCE, canRevert);
	menubar.setEnabled(LogisimMenuBar.ANALYZE_CIRCUIT, true);
	menubar.setEnabled(LogisimMenuBar.CIRCUIT_STATS, true);
	fireEnableChanged();
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:42,代码来源:MenuListener.java


注:本文中的com.cburch.logisim.proj.Project.getCurrentCircuit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。