public Rect prepareDraw(Canvas _canvas) {
    if (isCollapsed()) {
      rect = Instruction.prepareDraw(_canvas, getCollapsedText(), this);
      return rect;
    }

    rect.top = 0;
    rect.left = 0;

    rect.right = 2 * Math.round(E_PADDING / 2);

    FontMetrics fm = _canvas.getFontMetrics(Element.font);

    rect.right = Math.round(2 * (Element.E_PADDING / 2));
    for (int i = 0; i < getText().count(); i++) {
      if (rect.right
          < getWidthOutVariables(_canvas, getText().get(i), this) + 2 * Math.round(E_PADDING / 2)) {
        rect.right =
            getWidthOutVariables(_canvas, getText().get(i), this) + 2 * Math.round(E_PADDING / 2);
      }
    }

    rect.bottom = 2 * Math.round(E_PADDING / 2) + getText().count() * fm.getHeight();

    r = q.prepareDraw(_canvas);

    rect.right = Math.max(rect.right, r.right + E_PADDING);
    rect.bottom += r.bottom + E_PADDING;
    return rect;
  }
  public void draw(Canvas _canvas, Rect _top_left) {
    if (isCollapsed()) {
      Instruction.draw(_canvas, _top_left, getCollapsedText(), this);
      return;
    }

    Rect myrect = new Rect();
    // START KGU 2015-10-13: All highlighting rules now encapsulated by this new method
    // Color drawColor = getColor();
    Color drawColor = getFillColor();
    // END KGU 2015-10-13
    FontMetrics fm = _canvas.getFontMetrics(font);
    //		int p;
    //		int w;

    // START KGU 2015-10-13: Became obsolete by new method getFillColor() applied above now
    //		if (selected==true)
    //		{
    //			drawColor=Element.E_DRAWCOLOR;
    //		}
    // END KGU 2015-10-13

    Canvas canvas = _canvas;
    canvas.setBackground(drawColor);
    canvas.setColor(drawColor);

    // draw background
    myrect = _top_left.copy();
    canvas.fillRect(myrect);

    // draw shape
    rect = _top_left.copy();
    canvas.setColor(Color.BLACK);
    canvas.drawRect(_top_left);

    myrect = _top_left.copy();
    myrect.bottom =
        _top_left.top + fm.getHeight() * getText().count() + 2 * Math.round(Element.E_PADDING / 2);
    canvas.drawRect(myrect);

    myrect.bottom = _top_left.bottom;
    myrect.top = myrect.bottom - E_PADDING;
    canvas.drawRect(myrect);

    myrect = _top_left.copy();
    myrect.right = myrect.left + E_PADDING;
    canvas.drawRect(myrect);

    // fill shape
    canvas.setColor(drawColor);
    myrect.left = myrect.left + 1;
    myrect.top = myrect.top + 1;
    myrect.bottom = myrect.bottom;
    myrect.right = myrect.right - 1;
    canvas.fillRect(myrect);

    myrect = _top_left.copy();
    myrect.bottom =
        _top_left.top + fm.getHeight() * getText().count() + 2 * Math.round(E_PADDING / 2);
    myrect.left = myrect.left + 1;
    myrect.top = myrect.top + 1;
    myrect.bottom = myrect.bottom;
    myrect.right = myrect.right - 1;
    canvas.fillRect(myrect);

    myrect.bottom = _top_left.bottom;
    myrect.top = myrect.bottom - Element.E_PADDING;
    myrect.left = myrect.left + 1;
    myrect.top = myrect.top + 1;
    myrect.bottom = myrect.bottom;
    myrect.right = myrect.right;
    canvas.fillRect(myrect);

    // draw comment
    if (Element.E_SHOWCOMMENTS == true && !comment.getText().trim().equals("")) {
      // START KGU 2015-10-11: Use an inherited helper method now
      //			canvas.setBackground(E_COMMENTCOLOR);
      //			canvas.setColor(E_COMMENTCOLOR);
      //
      //			Rect someRect = _top_left.copy();
      //
      //			someRect.left+=2;
      //			someRect.top+=2;
      //			someRect.right=someRect.left+4;
      //			someRect.bottom-=1;
      //
      //			canvas.fillRect(someRect);
      this.drawCommentMark(canvas, _top_left);
      // END KGU 2015-10-11
    }
    // START KGU 2015-10-11
    // draw breakpoint bar if necessary
    this.drawBreakpointMark(canvas, _top_left);
    // END KGU 2015-10-11

    // draw text
    for (int i = 0; i < getText().count(); i++) {
      String text = this.getText().get(i);
      text = BString.replace(text, "<--", "<-");

      canvas.setColor(Color.BLACK);
      writeOutVariables(
          canvas,
          _top_left.left + Math.round(E_PADDING / 2),
          _top_left.top + Math.round(E_PADDING / 2) + (i + 1) * fm.getHeight(),
          text,
          this);
    }

    // draw children
    myrect = _top_left.copy();
    myrect.left = myrect.left + Element.E_PADDING - 1;
    myrect.top =
        _top_left.top + fm.getHeight() * getText().count() + 2 * Math.round(E_PADDING / 2) - 1;
    myrect.bottom = myrect.bottom - E_PADDING + 1;
    q.draw(_canvas, myrect);
  }