public override void getSize(Node containerNode) { if ((containerNode.firstChild != null) && (containerNode.firstChild.nextSibling != null)) { Node afterFirst = containerNode.firstChild.nextSibling; Node first = containerNode.firstChild; if (this.IsHarpoon(first)) { first.box.Width = containerNode.box.Width; if (first.firstChild != null) { Node entity = null; Node op = null; Node row = null; if (first.type_.type == ElementType.Mrow) { row = first; if ((first.numChildren == 1) && (first.firstChild.type_.type == ElementType.Mo)) { op = first.firstChild; } } else if (first.type_.type == ElementType.Mo) { op = first; } if (((op != null) && (op.numChildren == 1)) && (op.firstChild.type_.type == ElementType.Entity)) { entity = op.firstChild; } if ((entity == null) || (op == null)) { return; } int totalSpacing = 0; int lspace = 0; int width = afterFirst.box.Width + entity.box.Width; if (row != null) { row.box.Width = width; } if (op != null) { try { op.box.Width = width; Box_Mo box = (Box_Mo)op.box; totalSpacing = box.totalSpacing; lspace = box.lspace; } catch { } } if (entity != null) { entity.box.Width = width - totalSpacing; entity.box.X = op.box.X + lspace; } containerNode.box.Width = width; afterFirst.box.X = (width - afterFirst.box.Width) / 2; } } else if (afterFirst.type_.type == ElementType.Mrow) { if (((afterFirst.numChildren != 1) || !this.IsStretch(afterFirst.firstChild)) || (afterFirst.box.Width >= containerNode.firstChild.box.Width)) { return; } afterFirst.box.Width = containerNode.firstChild.box.Width; afterFirst.firstChild.box.Width = containerNode.firstChild.box.Width; if (afterFirst.firstChild.numChildren <= 0) { return; } afterFirst.firstChild.firstChild.box.Width = containerNode.firstChild.box.Width; } else if (this.IsStretch(afterFirst) && (afterFirst.box.Width < containerNode.firstChild.box.Width)) { afterFirst.box.Width = containerNode.firstChild.box.Width; if (afterFirst.numChildren > 0) { afterFirst.firstChild.box.Width = containerNode.firstChild.box.Width; } } } }
public override void getSize(Node containerNode) { if ((containerNode.firstChild != null) && (containerNode.firstChild.nextSibling != null)) { Node first = containerNode.firstChild; Node next = containerNode.firstChild.nextSibling; if (this.IsStretchyRec(first)) { first.box.Width = containerNode.box.Width; if (first.firstChild != null) { Node target = null; Node op = null; Node row = null; if (first.type_.type == ElementType.Mrow) { row = first; if ((first.numChildren == 1) && (first.firstChild.type_.type == ElementType.Mo)) { op = first.firstChild; } } else if (first.type_.type == ElementType.Mo) { op = first; } if (((op != null) && (op.numChildren == 1)) && (op.firstChild.type_.type == ElementType.Entity)) { target = op.firstChild; } if ((target == null) || (op == null)) { return; } int totalSpacing = 0; int lspace = 0; int nw = next.box.Width; int tw = target.box.Width; int width = nw + tw; if (row != null) { row.box.Width = width; } if (op != null) { try { op.box.Width = width; Box_Mo mo = (Box_Mo)op.box; totalSpacing = mo.totalSpacing; lspace = mo.lspace; } catch { } } if (target != null) { target.box.Width = width - totalSpacing; target.box.X = op.box.X + lspace; } containerNode.box.Width = width; next.box.X = (width - next.box.Width) / 2; } } else if (next.type_.type == ElementType.Mrow) { if (((next.numChildren != 1) || !this.IsStretchy(next.firstChild)) || (next.box.Width >= next.prevSibling.box.Width)) { return; } next.box.Width = next.prevSibling.box.Width; next.firstChild.box.Width = next.prevSibling.box.Width; if (next.firstChild.numChildren <= 0) { return; } next.firstChild.firstChild.box.Width = next.prevSibling.box.Width; } else if (this.IsStretchy(next) && (next.box.Width < next.prevSibling.box.Width)) { next.box.Width = next.prevSibling.box.Width; if (next.numChildren > 0) { next.firstChild.box.Width = next.prevSibling.box.Width; } } } }
public override void getSize(Node containerNode) { if (containerNode.numChildren == 3) { Node first = containerNode.firstChild; Node afterFirst = containerNode.firstChild.nextSibling; Node afterAfterFirst = containerNode.firstChild.nextSibling.nextSibling; if (this.IsHarpoon(first)) { first.box.Width = containerNode.box.Width; if (first.firstChild != null) { Node entity = null; Node cell = null; Node row = null; if (first.type_.type == ElementType.Mrow) { row = first; if ((first.numChildren == 1) && (first.firstChild.type_.type == ElementType.Mo)) { cell = first.firstChild; } } else if (first.type_.type == ElementType.Mo) { cell = first; } if (((cell != null) && (cell.numChildren == 1)) && (cell.firstChild.type_.type == ElementType.Entity)) { entity = cell.firstChild; } if ((entity == null) || (cell == null)) { return; } int totalSpacing = 0; int lspace = 0; int width = Math.Max(afterAfterFirst.box.Width, afterFirst.box.Width) + entity.box.Width; if (row != null) { row.box.Width = width; } if (cell != null) { try { cell.box.Width = width; Box_Mo box = (Box_Mo)cell.box; totalSpacing = box.totalSpacing; lspace = box.lspace; } catch { } } if (entity != null) { entity.box.Width = width - totalSpacing; entity.box.X = cell.box.X + lspace; } containerNode.box.Width = width; afterFirst.box.X = (width - afterFirst.box.Width) / 2; afterAfterFirst.box.X = (width - afterFirst.box.Width) / 2; } } else { int maxW = Math.Max(first.box.Width, afterAfterFirst.box.Width); if (afterFirst.type_.type == ElementType.Mrow) { if (((afterFirst.numChildren == 1) && this.IsStretchy(afterFirst.firstChild)) && (afterFirst.box.Width < maxW)) { afterFirst.box.Width = maxW; afterFirst.firstChild.box.Width = maxW; if (afterFirst.firstChild.numChildren > 0) { afterFirst.firstChild.firstChild.box.Width = maxW; } } } else if (this.IsStretchy(afterFirst) && (afterFirst.box.Width < maxW)) { afterFirst.box.Width = maxW; if (afterFirst.numChildren > 0) { afterFirst.firstChild.box.Width = maxW; } } maxW = Math.Max(first.box.Width, afterFirst.box.Width); if (afterAfterFirst.type_.type == ElementType.Mrow) { if (((afterAfterFirst.numChildren != 1) || !this.IsStretch(afterAfterFirst.firstChild)) || (afterAfterFirst.box.Width >= maxW)) { return; } afterAfterFirst.box.Width = maxW; afterAfterFirst.firstChild.box.Width = maxW; if (afterAfterFirst.firstChild.numChildren <= 0) { return; } afterAfterFirst.firstChild.firstChild.box.Width = maxW; } else if (this.IsStretch(afterAfterFirst) && (afterAfterFirst.box.Width < maxW)) { afterAfterFirst.box.Width = maxW; if (afterAfterFirst.numChildren > 0) { afterAfterFirst.firstChild.box.Width = maxW; } } } } }