home *** CD-ROM | disk | FTP | other *** search
- package webeq3.schema;
-
- import java.awt.Graphics;
- import webeq3.app.Equation;
-
- public class MSubsup extends MScripts {
- public MSubsup(Box var1) {
- super(var1);
- super.type = 8;
- }
-
- public MSubsup() {
- super.type = 8;
- }
-
- public MSubsup(Equation var1) {
- super(var1);
- super.type = 8;
- }
-
- public void setChildDepths() {
- super.base.depth = super.depth;
- super.low.depth = super.depth + 1;
- super.high.depth = super.depth + 1;
- }
-
- public void size() {
- super.useLinearForm = false;
- super.size();
- if (super.my_view.linebreak && super.width > 3 * super.fm.charWidth('M')) {
- Box var1 = ((Box)this).getChild(0);
- Box var2 = ((Box)this).getChild(1);
- Box var3 = ((Box)this).getChild(2);
- if (!var1.isAtomic() || !var2.isAtomic() || !var3.isAtomic()) {
- super.atomic = false;
- int var4 = super.fm.charWidth('M');
- if (var2.getWidth() > var4 && var3.getWidth() > var4) {
- if ((double)super.width < 0.9 * (double)(super.my_view.getDisplayWidth() - super.my_view.indent)) {
- super.atomic = true;
- } else {
- super.useLinearForm = true;
- if (super.lb_rewrite == null) {
- super.lb_rewrite = new MSup(super.parent);
- MSub var5 = new MSub(super.lb_rewrite);
- super.lb_rewrite.addChild(var5);
- ((Box)var5).addChild(var1);
- ((Box)var5).addChild(var2);
- super.lb_rewrite.addChild(var3);
- }
-
- super.lb_rewrite.layout();
- var1.setParent(this);
- var2.setParent(this);
- var3.setParent(this);
- super.width = super.lb_rewrite.getWidth();
- super.ascent = super.lb_rewrite.getAscent();
- super.descent = super.lb_rewrite.getDescent();
- super.height = super.ascent + super.descent;
- }
- }
- }
- }
-
- }
-
- public void sizeScripts() {
- ((MScripts)this).sizeSubSup();
- }
-
- public void position() {
- if (super.useLinearForm) {
- super.lb_rewrite.setTop(0);
- super.lb_rewrite.setLeft(0);
- } else {
- ((MScripts)this).positionSubSup();
- }
-
- }
-
- public boolean stretchTo(int var1, int var2) {
- if (super.useLinearForm) {
- return super.lb_rewrite.stretchTo(var1, var2);
- } else {
- Box var3 = ((Box)this).getChild(0);
- boolean var4 = false;
- if (var3.embellished_op) {
- var4 = var3.stretchTo(var1, var2);
- ((MScripts)this).sizeSubSup();
- ((MScripts)this).positionSubSup();
- }
-
- return var4;
- }
- }
-
- public void paint(Graphics var1, int var2, int var3) {
- ((Box)this).paintBackground(var1, var2, var3);
- if (super.useLinearForm) {
- super.lb_rewrite.paint(var1, var2 + super.left, var3 + super.top);
- } else if (super.my_view.linebreak) {
- int var4 = var2 + super.left + super.my_view.offsetx;
- int var5 = super.my_view.getDisplayWidth();
- int var6 = 0;
- boolean var7 = false;
- boolean var8 = false;
- var6 = var3 + super.top + super.my_view.offsety;
-
- for(int var17 = var2 + super.left + super.my_view.offsetx + super.width - var5; var17 > 0; var8 = true) {
- var6 += 5 + super.my_view.root.getHeight();
- ((Box)this).rvPaint(var1, super.my_view.indent, var6, var5, super.height);
- var17 -= var5 - super.my_view.indent;
- }
-
- Box var9 = ((Box)this).getChild(0);
- Box var10 = ((Box)this).getChild(1);
- Box var11 = ((Box)this).getChild(2);
- int var12 = super.fm.charWidth('M');
- boolean var13 = false;
- if ((Math.abs(var5 - (var4 + var9.getLeft() + var9.getWidth() + super.breakLookAhead)) < var12 || 0 < var5 - (var4 + var11.getLeft() + super.breakLookAhead) && var5 - (var4 + var11.getLeft() + super.breakLookAhead) < var11.getWidth() && var11.isAtomic() || 0 < var5 - (var4 + var10.getLeft() + super.breakLookAhead) && var5 - (var4 + var10.getLeft() + super.breakLookAhead) < var10.getWidth() && var10.isAtomic()) && var4 + super.width + super.breakLookAhead > var5) {
- if (var9.isAtomic()) {
- super.my_view.offsetx = super.my_view.indent - (var2 + super.left + var9.getLeft());
- Equation var10000 = super.my_view;
- var10000.offsety += 5 + super.my_view.root.getHeight();
- Integer var20 = new Integer(var2 + super.left + var9.getLeft());
- super.my_view.breaks.addElement(var20);
- } else if (var5 - (var4 + var9.getLeft() + var9.getWidth() + super.breakLookAhead) + 2 <= 0 || (var5 - (var4 + var11.getLeft() + super.breakLookAhead) >= var11.getWidth() || !var11.isAtomic()) && (var5 - (var4 + var10.getLeft() + super.breakLookAhead) >= var10.getWidth() || !var10.isAtomic())) {
- int var19 = var5 - (var4 + var9.getLeft() + var9.getWidth()) - super.breakLookAhead + var12 + 2;
- var9.setLookAhead(super.breakLookAhead + var19);
- var13 = true;
- } else {
- int var14 = var5 - (var4 + var9.getLeft() + var9.getWidth()) - super.breakLookAhead + 2;
- var9.setLookAhead(super.breakLookAhead + var14);
- var13 = true;
- }
- }
-
- var8 |= ((Box)this).paintBreakingChildren(var1, var2, var3, 0, super.children.size(), var6);
- if (var8) {
- ((Box)this).paintCleanup(var1, var2 + super.left + super.my_view.offsetx + super.width, var3 + super.top + super.my_view.offsety, super.my_view.size().width, super.height);
- }
-
- if (var13) {
- var9.setLookAhead(0);
- }
- } else {
- for(int var15 = 0; var15 < super.children.size(); ++var15) {
- ((Box)this).getChild(var15).paint(var1, var2 + super.left, var3 + super.top);
- }
- }
-
- super.absleft = var2 + super.left;
- super.abstop = var3 + super.top;
- }
- }
-