public EditorButtons(Editor editor) {
    this.editor = editor;
    buttons = Base.getImage("buttons.gif", this);

    buttonCount = 0;
    which = new int[BUTTON_COUNT];

    // which[buttonCount++] = NOTHING;
    which[buttonCount++] = RUN;
    which[buttonCount++] = STOP;
    which[buttonCount++] = NEW;
    which[buttonCount++] = OPEN;
    which[buttonCount++] = SAVE;
    which[buttonCount++] = EXPORT;
    which[buttonCount++] = SERIAL;

    currentRollover = -1;

    // hardcoding new blue color scheme for consistency with images,
    // see EditorStatus.java for details.
    // bgcolor = Preferences.getColor("buttons.bgcolor");
    bgcolor = new Color(0x04, 0x4F, 0x6F);

    status = "";

    statusFont = Preferences.getFont("buttons.status.font");
    statusColor = Preferences.getColor("buttons.status.color");

    // statusY = (BUTTON_COUNT + 1) * BUTTON_HEIGHT;

    addMouseListener(this);
    addMouseMotionListener(this);
  }
Esempio n. 2
0
  protected void updateContributionListing() {
    if (editor != null) {
      List<Contribution> contributions = new ArrayList<Contribution>();

      List<Library> libraries = new ArrayList<Library>(editor.getMode().contribLibraries);

      // Only add core libraries that are installed in the sketchbook
      // https://github.com/processing/processing/issues/3688
      // libraries.addAll(editor.getMode().coreLibraries);
      final String sketchbookPath = Base.getSketchbookLibrariesFolder().getAbsolutePath();
      for (Library lib : editor.getMode().coreLibraries) {
        if (lib.getLibraryPath().startsWith(sketchbookPath)) {
          libraries.add(lib);
        }
      }

      contributions.addAll(libraries);

      Base base = editor.getBase();

      List<ToolContribution> tools = base.getToolContribs();
      contributions.addAll(tools);

      List<ModeContribution> modes = base.getModeContribs();
      contributions.addAll(modes);

      List<ExamplesContribution> examples = base.getExampleContribs();
      contributions.addAll(examples);

      //    ArrayList<LibraryCompilation> compilations = LibraryCompilation.list(libraries);
      //
      //    // Remove libraries from the list that are part of a compilations
      //    for (LibraryCompilation compilation : compilations) {
      //      Iterator<Library> it = libraries.iterator();
      //      while (it.hasNext()) {
      //        Library current = it.next();
      //        if (compilation.getFolder().equals(current.getFolder().getParentFile())) {
      //          it.remove();
      //        }
      //      }
      //    }

      contribListing.updateInstalledList(contributions);
    }
  }
Esempio n. 3
0
  protected void loadButtons() {
    Image allButtons = Base.getThemeImage("buttons.gif", this);
    buttonImages = new Image[BUTTON_COUNT][3];

      for (int i = 0; i < BUTTON_COUNT; i++) {
      for (int state = 0; state < 3; state++) {
        Image image = createImage(BUTTON_WIDTH, BUTTON_HEIGHT);
        Graphics g = image.getGraphics();
        g.drawImage(allButtons, 
                    -(i*BUTTON_IMAGE_SIZE) - 3, 
                    (-2 + state)*BUTTON_IMAGE_SIZE, null);
        buttonImages[i][state] = image;
      }
    }
  }