2018-09-02 13:36:49 +02:00
|
|
|
|
package it.cavallium.warppi.gui.expression.blocks;
|
2017-04-11 22:04:44 +02:00
|
|
|
|
|
2019-02-27 23:29:03 +01:00
|
|
|
|
import it.cavallium.warppi.device.display.DisplayOutputDevice;
|
2018-09-02 13:36:49 +02:00
|
|
|
|
import it.cavallium.warppi.gui.expression.Caret;
|
2018-10-09 23:51:42 +02:00
|
|
|
|
import it.cavallium.warppi.gui.expression.InputContext;
|
2018-09-02 13:36:49 +02:00
|
|
|
|
import it.cavallium.warppi.gui.graphicengine.Renderer;
|
2017-04-23 14:11:37 +02:00
|
|
|
|
|
2017-04-11 22:04:44 +02:00
|
|
|
|
public class BlockExponentialNotation extends BlockPower {
|
2017-04-23 14:11:37 +02:00
|
|
|
|
private int bw;
|
|
|
|
|
private int bh;
|
2017-09-24 18:47:30 +02:00
|
|
|
|
|
2018-10-09 23:51:42 +02:00
|
|
|
|
public BlockExponentialNotation() {
|
|
|
|
|
super();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Copy
|
|
|
|
|
* @param old
|
|
|
|
|
* @param ic
|
|
|
|
|
*/
|
|
|
|
|
private BlockExponentialNotation(final TreeContainer parent, BlockExponentialNotation old, InputContext ic) {
|
|
|
|
|
super(parent, old, ic);
|
|
|
|
|
this.bw = old.bw;
|
|
|
|
|
this.bh = old.bh;
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-23 14:11:37 +02:00
|
|
|
|
@Override
|
2019-02-27 23:29:03 +01:00
|
|
|
|
public void draw(final DisplayOutputDevice ge, final Renderer r, final int x, final int y, final Caret caret) {
|
2017-04-23 14:11:37 +02:00
|
|
|
|
BlockContainer.getDefaultFont(small).use(ge);
|
|
|
|
|
r.glColor(BlockContainer.getDefaultColor());
|
2017-09-24 18:47:30 +02:00
|
|
|
|
r.glDrawStringLeft(x, y + height - bh, "ℯ℮");
|
|
|
|
|
super.draw(ge, r, x + bw, y, caret);
|
2017-04-23 14:11:37 +02:00
|
|
|
|
}
|
2017-09-24 18:47:30 +02:00
|
|
|
|
|
2017-04-11 22:04:44 +02:00
|
|
|
|
@Override
|
2017-04-23 14:11:37 +02:00
|
|
|
|
public void recomputeDimensions() {
|
|
|
|
|
super.recomputeDimensions();
|
2017-09-24 18:47:30 +02:00
|
|
|
|
bw = (int) (BlockContainer.getDefaultCharWidth(small) * 1.5);
|
2017-04-23 14:11:37 +02:00
|
|
|
|
bh = BlockContainer.getDefaultCharHeight(small);
|
2018-05-12 21:18:29 +02:00
|
|
|
|
width += bw;
|
2017-04-11 22:04:44 +02:00
|
|
|
|
}
|
2018-10-09 23:51:42 +02:00
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BlockExponentialNotation clone(final TreeContainer parent, InputContext ic) {
|
|
|
|
|
return new BlockExponentialNotation(parent, this, ic);
|
|
|
|
|
}
|
2017-04-11 22:04:44 +02:00
|
|
|
|
}
|