Package ket.display.box

Examples of ket.display.box.Box


    long innerSettings = isBold() ? Box.BOLD_FONT : 0L;
    boolean noBracketFlag = (Box.SUPPRESS_BRACKETS&settings)==Box.SUPPRESS_BRACKETS;
    //- Color colour = colourScheme.getBoxColour(this);
    if (!noBracketFlag && hasBracket(false)) {
      // Note: Only pass RELATIVE_FONT_FLAGS once (in bracket).
      Box box = nonNullFunction.toBox(this, innerSettings, colourScheme, args);
      box.setArgument(this);
      Box bracketedBox = BoxTools.roundBrackets(this, box, settings, colourScheme);
      bracketedBox.setProperty(Box.PRESERVE_ASPECT_RATIO|Box.VERTICAL_STRETCH);
      bracketedBox.setArgument(this);
      return bracketedBox;
    } else {
      Box box = nonNullFunction.toBox(this, settings|innerSettings, colourScheme, args);
      box.setArgument(this); //? Redundant
      return box;
    }
  }
View Full Code Here


    Message message = modes.getMessage();
    KetPanel ketPanel = document.getKetPanel();
    // box list: (BoxWord) start, (BoxWord) "|", (BoxWord) end
    BoxList messageBox = ketPanel.getMessageBoxList();
    if (messageBox==null) return false;
    Box clickedOn = messageBox.findDeepestBox(p);
    boolean messageBoxClick = clickedOn!=null;
    if (!messageBoxClick) return false;
    Vector<Box> children = messageBox.getChildren();
    if (children.size()!=3) return false;
    BoxWord startBoxWord = (BoxWord) children.get(0);
View Full Code Here

  @Override
  public Equation pointToEquation(Position p) {
    Equation e = null;
    Double bestTop = null;
    for (BoxEquation next : boxSet) {
      Box box = next.getEquationBox();
      if (box==null) continue;
      if (box.getTopLeft()==null) continue;
      double top = box.getTopLeft().y;
      if (top<p.y && (bestTop==null || bestTop<top)) {
        e = box.getArgument().getEquation();
        Ket.out.println(e);
        bestTop = top;
      }
    }
    return e;
View Full Code Here

    this.before = before;
    this.after = after;
  }

  public Transition getTransition(Box beforeRootBox, Box afterRootBox) {
    Box beforeBox = beforeRootBox.findBoxByArgument(before);
    Box afterBox = afterRootBox.findBoxByArgument(after);
    if (beforeBox==null || afterBox==null) {
      return null;
    }
    return new Transition(beforeBox, afterBox);
  }
View Full Code Here

   * 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

      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) {
        Ket.out.println("[pointToEquation::null box-set element]");
        continue;
      }
      Argument argument = equationPart.getArgument();
      if (argument==null) {
        Ket.out.println("[pointToEquation::null box-set argument]");
        continue;
      }
      Integer index = argument.getEquationIndex(); //NOTE: Integer, not int
View Full Code Here

    if (boxSet==null) {
      System.out.println("[null box set]");
      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;
    }
    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

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.