Package com.cburch.logisim.file

Examples of com.cburch.logisim.file.LogisimFile


    } else {
      loader = new Loader(baseProject == null ? parent : baseProject.getFrame());
    }

    try {
      LogisimFile lib = loader.openLogisimFile(f);
      AppPreferences.updateRecentFile(f);
      if (lib == null) return null;
      if (proj == null) {
        proj = new Project(lib);
      } else {
View Full Code Here


      }
    }
  }
 
  public void moveRequested(ProjectExplorer.Event event, AddTool dragged, AddTool target) {
    LogisimFile file = proj.getLogisimFile();
    int draggedIndex = file.getTools().indexOf(dragged);
    int targetIndex = file.getTools().indexOf(target);
    if (targetIndex > draggedIndex) targetIndex++;
    proj.doAction(LogisimFileActions.moveCircuit(dragged, targetIndex));
  }
View Full Code Here

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

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

  public void setStartupScreen(boolean value) {
    startupScreen = value;
  }

  public void setLogisimFile(LogisimFile value) {
    LogisimFile old = this.file;
    if (old != null) {
      for (LibraryListener l : fileListeners) {
        old.removeLibraryListener(l);
      }
    }
    file = value;
    stateMap.clear();
    depends = new Dependencies(file);
View Full Code Here

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

      }
    }
  }

  public static void doLoadBuiltinLibrary(Project proj) {
    LogisimFile file = proj.getLogisimFile();
    List<Library> baseBuilt = file.getLoader().getBuiltin().getLibraries();
    ArrayList<Library> builtins = new ArrayList<Library>(baseBuilt);
    builtins.removeAll(file.getLibraries());
    if (builtins.isEmpty()) {
      JOptionPane.showMessageDialog(proj.getFrame(),
          Strings.get("loadBuiltinNoneError"),
          Strings.get("loadBuiltinErrorTitle"),
          JOptionPane.INFORMATION_MESSAGE);
View Full Code Here

      }
    }
  }
 
  public static void doUnloadLibraries(Project proj) {
    LogisimFile file = proj.getLogisimFile();
    ArrayList<Library> canUnload = new ArrayList<Library>();
    for (Library lib : file.getLibraries()) {
      String message = file.getUnloadLibraryMessage(lib);
      if (message == null) canUnload.add(lib);
    }
    if (canUnload.isEmpty()) {
      JOptionPane.showMessageDialog(proj.getFrame(),
          Strings.get("unloadNoneError"),
View Full Code Here

 
  private static HashMap<Component, Component> getReplacementMap(Project proj) {
    HashMap<Component, Component> replMap;
    replMap = new HashMap<Component, Component>();
   
    LogisimFile file = proj.getLogisimFile();
    ArrayList<Library> libs = new ArrayList<Library>();
    libs.add(file);
    libs.addAll(file.getLibraries());
   
    ArrayList<String> dropped = null;
    Clipboard clip = Clipboard.get();
    Collection<Component> comps = clip.getComponents();
    HashMap<ComponentFactory, ComponentFactory> factoryReplacements;
View Full Code Here

    }

    public static void run(Startup args) {
        File fileToOpen = args.getFilesToOpen().get(0);
        Loader loader = new Loader(null);
        LogisimFile file;
        try {
            file = loader.openLogisimFile(fileToOpen, args.getSubstitutions());
        } catch (LoadFailedException e) {
            //OK
            System.err.println(getFromLocale("ttyLoadError", fileToOpen.getName()));
            System.exit(-1);
            return;
        }

        int format = args.getTtyFormat();
        if ((format & FORMAT_STATISTICS) != 0) {
            format &= ~FORMAT_STATISTICS;
            displayStatistics(file);
        }
        // no simulation remaining to perform, so just exit
        if (format == 0) {
            System.exit(0);
        }

        Project proj = new Project(file);
        Circuit circuit = file.getMainCircuit();
        Map<Instance, String> pinNames = Analyze.getPinLabels(circuit);
        ArrayList<Instance> outputPins = new ArrayList<Instance>();
        Instance haltPin = null;
        for (Map.Entry<Instance, String> entry : pinNames.entrySet()) {
            Instance pin = entry.getKey();
View Full Code Here

TOP

Related Classes of com.cburch.logisim.file.LogisimFile

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.