home *** CD-ROM | disk | FTP | other *** search
- package webeq3.schema;
-
- import java.awt.Graphics;
- import webeq3.app.Equation;
-
- public class MUnderover extends MScripts {
- boolean accent_over = false;
- boolean accent_under = false;
-
- public MUnderover(Box var1) {
- super(var1);
- super.type = 8;
- }
-
- public MUnderover() {
- super.type = 8;
- }
-
- public MUnderover(Equation var1) {
- super(var1);
- super.type = 8;
- }
-
- public void size() {
- super.useLinearForm = false;
- super.size();
- int var1 = super.fm.charWidth('M');
- if (super.my_view.linebreak && super.width > 6 * var1) {
- super.atomic = false;
- Box var2 = ((Box)this).getChild(0);
- Box var3 = ((Box)this).getChild(1);
- Box var4 = ((Box)this).getChild(2);
- if (var3.getWidth() > var1 && var4.getWidth() > var1) {
- if (super.width < super.my_view.getDisplayWidth() - 2 * 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(var2);
- var2.setParent(this);
- ((Box)var5).addChild(var3);
- var3.setParent(this);
- super.lb_rewrite.addChild(var4);
- var4.setParent(this);
- }
-
- super.lb_rewrite.layout();
- 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 setChildDepths() {
- String var1 = ((Box)this).getAttributeByIndex(28);
- if (!"true".equals(var1) && !"false".equals(var1)) {
- Box var2;
- for(var2 = ((Box)this).getChild(2); ((MScripts)this).base_check(var2); var2 = var2.getChild(0)) {
- }
-
- this.accent_over = "true".equals(var2.getAttributeByIndex(28));
- } else {
- this.accent_over = "true".equals(var1);
- }
-
- var1 = ((Box)this).getAttributeByIndex(27);
- if (!"true".equals(var1) && !"false".equals(var1)) {
- Box var4;
- for(var4 = ((Box)this).getChild(1); ((MScripts)this).base_check(var4); var4 = var4.getChild(0)) {
- }
-
- this.accent_under = "true".equals(var4.getAttributeByIndex(28));
- } else {
- this.accent_under = "true".equals(var1);
- }
-
- super.base.depth = super.depth;
- if (!this.accent_over) {
- super.high.depth = super.depth + 1;
- } else {
- super.high.depth = super.depth;
- }
-
- if (!this.accent_under) {
- super.low.depth = super.depth + 1;
- } else {
- super.low.depth = super.depth;
- }
-
- }
-
- public void sizeScripts() {
- Box var1;
- for(var1 = super.high; ((MScripts)this).base_check(var1); var1 = var1.getChild(0)) {
- }
-
- if (var1 != null && var1 instanceof MO) {
- ((MO)var1).widthTo(super.base.getWidth());
- ((MO)var1).noLayout = true;
- super.high.layout();
- }
-
- for(var1 = super.low; ((MScripts)this).base_check(var1); var1 = var1.getChild(0)) {
- }
-
- if (var1 != null && "webeq3.schema.MO".equals(var1.getClass().getName())) {
- ((MO)var1).widthTo(super.base.getWidth());
- ((MO)var1).noLayout = true;
- super.low.layout();
- }
-
- for(var1 = super.base; ((MScripts)this).base_check(var1); var1 = var1.getChild(0)) {
- }
-
- if (var1 != null && "webeq3.schema.MO".equals(var1.getClass().getName())) {
- int var2 = super.low.getWidth() > super.high.getWidth() ? super.low.getWidth() : super.high.getWidth();
- ((MO)var1).widthTo(var2);
- ((MO)var1).noLayout = true;
- super.base.layout();
- super.truebasewidth = super.base.getWidth();
- if (super.base.getClass().getName().equals("webeq3.schema.MO")) {
- super.truebasewidth = super.truebasewidth - super.lspace - super.rspace;
- }
-
- if (super.itc == (double)0.0F) {
- super.truebasewidth += (int)(0.2 * (double)super.xheight);
- }
- }
-
- if (super.move_scripts) {
- ((MScripts)this).sizeSubSup();
- } else {
- int var6 = !this.accent_over && super.high.getHeight() != 0 ? (int)((double)0.25F * (double)super.xheight) : (int)(0.05 * (double)super.xheight);
- int var3 = !this.accent_under && super.low.getHeight() != 0 ? (int)((double)0.25F * (double)super.xheight) + ((double)super.low.getHeight() < 0.6 * (double)super.xheight ? (int)(0.9 * (double)super.xheight - (double)super.low.getHeight()) : 0) : (int)(0.1 * (double)super.xheight);
- ((MScripts)this).sizeUnderOver(var3, var6);
- }
-
- }
-
- public void position() {
- if (super.useLinearForm) {
- super.lb_rewrite.setTop(0);
- super.lb_rewrite.setLeft(0);
- } else if (super.move_scripts) {
- ((MScripts)this).positionSubSup();
- } else {
- ((MScripts)this).positionUnderOver();
- }
-
- }
-
- 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) {
- if (super.ascent < var1 || super.descent < var2) {
- var4 |= var3.stretchTo(var1, var2);
- }
-
- if (super.move_scripts) {
- ((MScripts)this).sizeSubSup();
- ((MScripts)this).positionSubSup();
- } else {
- int var5 = !this.accent_over && super.high.getHeight() != 0 ? (int)((double)0.25F * (double)super.xheight) : 0;
- int var6 = !this.accent_under && super.low.getHeight() != 0 ? (int)((double)0.25F * (double)super.xheight) : 0;
- ((MScripts)this).sizeUnderOver(var6, var5);
- ((MScripts)this).positionUnderOver();
- }
- }
-
- 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 {
- super.paint(var1, var2, var3);
- }
-
- super.absleft = var2 + super.left;
- super.abstop = var3 + super.top;
- }
- }
-