Package ket.display.box

Examples of ket.display.box.Box


   * inner rectangle, return that box.
   */
  @Override
  public Box findDeepestBox(Position p) {
    for (BoxEquation next : boxSet) {
      Box match = next.findDeepestBox(p);
      if (match!=null) {
        return match;
      }
    }
    return null;
View Full Code Here


    Vector<Integer> indices = new Vector<Integer>();
    if (boxSet==null) return indices;
    for (BoxEquation next : boxSet) {
      //?- if (animate) continue;
      //? if (equationBox.getArgument()!=null && next.getEquation()==equationBox.getArgument().getEquation()) continue;
      Box equationPart = next.getEquationBox();
      if (equationPart==null) continue;
      Argument a = equationPart.getArgument();
      if (a==null) continue;
      int index = a.getEquationIndex();
      indices.add(index);
    }
    return indices;
View Full Code Here

  }

  private Vector<BoxEquation> getValidBoxEquations(Graphics2D g2D, int fontSize, ColourScheme colourScheme) {
    Vector<BoxEquation> source = new Vector<BoxEquation>();
    for (Equation equation : getValidEquations()) {
      Box box = equation.toBox(colourScheme);
      box.setupInnerRectangle(fontSize);
      Box labelBox = equation.getLabelBox(colourScheme);
      labelBox.setupInnerRectangle(fontSize);
      BoxEquation boxEquation = new BoxEquation(box, labelBox);
      source.add(boxEquation);
    }
    return source;
  }
View Full Code Here

  private void setupColumn(Graphics2D g2D, Vector<BoxEquation> column, double width, double widest, boolean multiple) {
    double sum = 0.0;
    for (BoxEquation b : column) {
      assert b!=null; // HACK
      double step = b.getHeight();
      Box box = b.getEquationBox();
      Box labelBox = b.getLabel();
      if (b.getEquation().isText() ) {
        box.setProperties(Box.LEFT_ALIGN, Box.TOP_ALIGN, Box.TOP_ALIGN);
      } else if (multiple) { // TODO: Indent rather than centre?
        box.setProperties(Box.LEFT_ALIGN, Box.Y_CENTRE_ALIGN, Box.Y_CENTRE_ALIGN);
      } else {
        box.setProperties(Box.X_CENTRE_ALIGN, Box.Y_CENTRE_ALIGN, Box.Y_CENTRE_ALIGN);
      }
      labelBox.setProperties(Box.RIGHT_ALIGN, Box.SMALL_FONT, Box.BOLD_FONT);
      Offset equationRectangle = new Offset(widest, step);
      labelBox.setupOuterRectangle(equationRectangle);
      Offset leftRectangle = new Offset(equationRectangle);
      leftRectangle.width -= labelBox.getInnerRectangle().width;
      box.setupOuterRectangle(leftRectangle);
      double left = KetPanel.LEFT_BORDER_SIZE + width;
      double top = KetPanel.TOP_BORDER_SIZE + sum;
      Position topLeft = new Position(left, top);
      b.setTopLeft(topLeft);
View Full Code Here

    for (BoxEquation boxEquation : boxSet) {
      if (animate && boxEquation.getEquation()==equationBox.getArgument().getEquation()) {
        position = boxEquation.getTopLeft();
      } else {
        g2D.setColor(Color.BLACK); // <-- use colourscheme.
        Box eb = boxEquation.getEquationBox();
        boxEquation.paint(g2D, colourScheme);
      }
    }
    return position;
  }
View Full Code Here

  @Override
  public boolean isArgumentVisible(Argument argument) {
    if (boxSet==null) return false;
    for (BoxEquation boxEquation : boxSet) {
      Box box = boxEquation.getEquationBox();
      if (box.containsArgument(argument)) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

      return;
    }
    afterRootBox = after.toBox(0L, colourScheme);
    labelSetup(afterEquation, colourScheme);
    Offset windowWithoutLabel = afterBoxSetup(fontSize, panelRectangle);
    Box beforeRootBox = beforeBoxSetup(g2D, colourScheme, before, fontSize, windowWithoutLabel);
    initialTime = System.currentTimeMillis();
    TreeDiff treeDiff = new TreeDiff(before, after);
    transitions = treeDiff.getTransitions(beforeRootBox, afterRootBox);
  }
View Full Code Here

  /**
   * Setup the box that represents the previous state.
   */
  private Box beforeBoxSetup(Graphics2D g2D, ColourScheme colourScheme, Argument before, int fontSize, Offset windowWithoutLabel) {
    Box beforeRootBox = before.toBox(0L, colourScheme);
    beforeRootBox.setupInnerRectangle(fontSize);
    beforeRootBox.setupOuterRectangle(windowWithoutLabel);
    beforeRootBox.calcRootOffset();
    return beforeRootBox;
  }
View Full Code Here

    return " " + state.toLatex() + " ";
  }

  @Override
  public Box toBox(long settings, ColourScheme colourScheme) {
    Box box;
    if (isBold()) {
      settings |= Box.BOLD_FONT;
    }
    if (isVisible()) {
      box = state.toBox(this, settings, colourScheme);
    } else {
      box = super.toBox(settings, colourScheme);
    }
    box.setArgument(this);
    return box;
  }
View Full Code Here

    g2D.drawString(label, dx, ascent+dy);
  }

  public static ImageIcon asIcon(String expression, String label) {
    Argument argument = ArgumentParser.parseArgument(expression, knownArguments, null, mathCollection); // null clipboard
    Box box = argument.toBox(Box.X_CENTRE_ALIGN|Box.Y_CENTRE_ALIGN, colourScheme);
    BufferedImage image = ImageTools.boxToBufferedImage(box, 160, 120, colourScheme, false);
    labelImage(image, label);
    ImageIcon imageIcon = new ImageIcon(image);
    return imageIcon;
  }
View Full Code Here

TOP

Related Classes of ket.display.box.Box

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.