Package com.cburch.logisim.proj

Examples of com.cburch.logisim.proj.Project


  }

  class ProjectMenuListener implements ProjectListener, LibraryListener,
        ActionListener, PropertyChangeListener, CanvasModelListener {
    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);
View Full Code Here


      computeEnabled();
    }
   
    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

class MenuProject extends Menu {
  private class MyListener
      implements ActionListener {
    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

    menubar.fireEnableChanged();
  }
 
  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();
      }
    } else if (src == save) {
      ProjectActions.doSave(proj);
    } else if (src == saveAs) {
View Full Code Here

      setEnabled(file != null);
      addActionListener(this);
    }
   
    public void actionPerformed(ActionEvent event) {
      Project proj = menubar.getProject();
      Component par = proj == null ? null : proj.getFrame().getCanvas();
      ProjectActions.doOpen(par, proj, file);
    }
View Full Code Here

    DialogPanel() {
      List<Project> projects = Projects.getOpenProjects();
      Object[] options = new Object[projects.size()];
      Object initialSelection = null;
      for (int i = 0; i < options.length; i++) {
        Project proj = projects.get(i);
        options[i] = new ProjectItem(proj);
        if (proj == model.getCurrentProject()) {
          initialSelection = options[i];
        }
      }
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.