Package com.cburch.logisim.proj

Examples of com.cburch.logisim.proj.Project


        }

        @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);
            }
        }
View Full Code Here


                StatisticsDialog.show(frame, proj.getLogisimFile(), cur);
            }
        }

        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();
View Full Code Here

            fireEnableChanged();
        }

        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);
View Full Code Here

        }
    }

    class SimulateMenuListener implements ProjectListener, SimulateListener {
        void register() {
            Project proj = frame.getProject();
            proj.addProjectListener(this);
            menubar.setSimulateListener(this);
            menubar.setCircuitState(proj.getSimulator(), proj.getCircuitState());
        }
View Full Code Here

        setRoot(new ProjectExplorerLibraryNode(this, proj.getLogisimFile()));
        proj.addProjectListener(this);
    }

    public void setProject(Project value) {
        Project old = proj;
        if (old != null) {
            old.removeProjectListener(this);
        }
        setLogisimFile(null);
        proj = value;
        if (value != null) {
            value.addProjectListener(this);
View Full Code Here

    private Frame frame;

    LayoutEditHandler(Frame frame) {
        this.frame = frame;

        Project proj = frame.getProject();
        Clipboard.addPropertyChangeListener(Clipboard.contentsProperty, this);
        proj.addProjectListener(this);
        proj.addLibraryListener(this);
    }
View Full Code Here

    private class MyListener
            implements ActionListener {
        @Override
        public void actionPerformed(ActionEvent event) {
            Object src = event.getSource();
            Project proj = menubar.getProject();
            if (src == loadBuiltin) {
                ProjectLibraryActions.doLoadBuiltinLibrary(proj);
            } else if (src == loadLogisim) {
                ProjectLibraryActions.doLoadLogisimLibrary(proj);
            } else if (src == loadJar) {
                ProjectLibraryActions.doLoadJarLibrary(proj);
            } else if (src == unload) {
                ProjectLibraryActions.doUnloadLibraries(proj);
            } else if (src == options) {
                JFrame frame = proj.getOptionsFrame(true);
                frame.setVisible(true);
            }
        }
View Full Code Here

        if (!MacCompatibility.isQuitAutomaticallyPresent()) {
            addSeparator();
            add(quit);
        }

        Project proj = menubar.getProject();
        newi.addActionListener(this);
        open.addActionListener(this);
        if (proj == null) {
            close.setEnabled(false);
            save.setEnabled(false);
View Full Code Here

    }

    @Override
    public void actionPerformed(ActionEvent e) {
        Object src = e.getSource();
        Project proj = menubar.getProject();
        if (src == newi) {
            ProjectActions.doNew(proj);
        } else if (src == open) {
            ProjectActions.doOpen(proj == null ? null : proj.getFrame().getCanvas(), proj);
        } else if (src == close) {
            Frame frame = proj.getFrame();
            if (frame.confirmClose()) {
                frame.dispose();
                OptionsFrame f = proj.getOptionsFrame(false);
                if (f != null) {
                    f.dispose();
                }

            }
View Full Code Here

            setState(canvas, SHOW_GHOST);
        } else if (state == SHOW_ADD_NO) {
            setState(canvas, SHOW_NONE);
        }

        Project proj = canvas.getProject();
        Tool next = determineNext(proj);
        if (next != null) {
            proj.setTool(next);
            Action act = SelectionActions.dropAll(canvas.getSelection());
            if (act != null) {
                proj.doAction(act);
            }
            if (added != null) {
                canvas.getSelection().add(added);
            }
View Full Code Here

TOP

Related Classes of com.cburch.logisim.proj.Project

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.