Merge remote-tracking branch 'gogs/master'
This commit is contained in:
commit
2ea86cf76f
1
.gitignore
vendored
1
.gitignore
vendored
@ -18,6 +18,7 @@ font_gputest4.png
|
|||||||
font_gputest4.xcf
|
font_gputest4.xcf
|
||||||
manager2/
|
manager2/
|
||||||
VBO_Example.java
|
VBO_Example.java
|
||||||
|
math-rules-cache.zip
|
||||||
|
|
||||||
/target/
|
/target/
|
||||||
!/target/*.jar
|
!/target/*.jar
|
||||||
|
@ -6,7 +6,9 @@ import it.cavallium.warppi.device.Keyboard;
|
|||||||
import it.cavallium.warppi.gui.graphicengine.GraphicEngine;
|
import it.cavallium.warppi.gui.graphicengine.GraphicEngine;
|
||||||
import it.cavallium.warppi.gui.graphicengine.Renderer;
|
import it.cavallium.warppi.gui.graphicengine.Renderer;
|
||||||
import it.cavallium.warppi.gui.graphicengine.Skin;
|
import it.cavallium.warppi.gui.graphicengine.Skin;
|
||||||
|
import it.cavallium.warppi.gui.screens.Screen;
|
||||||
import it.cavallium.warppi.util.Utils;
|
import it.cavallium.warppi.util.Utils;
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
|
||||||
public class CalculatorHUD extends HUD {
|
public class CalculatorHUD extends HUD {
|
||||||
|
|
||||||
@ -30,40 +32,40 @@ public class CalculatorHUD extends HUD {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTopmostBackground() {
|
public void renderTopmostBackground() {
|
||||||
final Renderer renderer = d.renderer;
|
final Renderer r = d.renderer;
|
||||||
final GraphicEngine engine = d.engine;
|
final GraphicEngine engine = d.engine;
|
||||||
|
|
||||||
renderer.glColor(0xFFc5c2af);
|
r.glColor(0xFFc5c2af);
|
||||||
renderer.glFillColor(0, 0, engine.getWidth(), 20);
|
r.glFillColor(0, 0, engine.getWidth(), 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTopmost() {
|
public void renderTopmost() {
|
||||||
final Renderer renderer = d.renderer;
|
final Renderer r = d.renderer;
|
||||||
final GraphicEngine engine = d.engine;
|
final GraphicEngine engine = d.engine;
|
||||||
final Skin guiSkin = d.guiSkin;
|
final Skin guiSkin = d.guiSkin;
|
||||||
|
|
||||||
//DRAW TOP
|
//DRAW TOP
|
||||||
renderer.glColor3i(0, 0, 0);
|
r.glColor3i(0, 0, 0);
|
||||||
renderer.glDrawLine(0, 20, engine.getWidth() - 1, 20);
|
r.glDrawLine(0, 20, engine.getWidth() - 1, 20);
|
||||||
renderer.glColor3i(255, 255, 255);
|
r.glColor3i(255, 255, 255);
|
||||||
guiSkin.use(engine);
|
guiSkin.use(engine);
|
||||||
if (Keyboard.shift) {
|
if (Keyboard.shift) {
|
||||||
renderer.glFillRect(2 + 18 * 0, 2, 16, 16, 16 * 2, 16 * 0, 16, 16);
|
r.glFillRect(2 + 18 * 0, 2, 16, 16, 16 * 2, 16 * 0, 16, 16);
|
||||||
} else {
|
} else {
|
||||||
renderer.glFillRect(2 + 18 * 0, 2, 16, 16, 16 * 3, 16 * 0, 16, 16);
|
r.glFillRect(2 + 18 * 0, 2, 16, 16, 16 * 3, 16 * 0, 16, 16);
|
||||||
}
|
}
|
||||||
if (Keyboard.alpha) {
|
if (Keyboard.alpha) {
|
||||||
renderer.glFillRect(2 + 18 * 1, 2, 16, 16, 16 * 0, 16 * 0, 16, 16);
|
r.glFillRect(2 + 18 * 1, 2, 16, 16, 16 * 0, 16 * 0, 16, 16);
|
||||||
} else {
|
} else {
|
||||||
renderer.glFillRect(2 + 18 * 1, 2, 16, 16, 16 * 1, 16 * 0, 16, 16);
|
r.glFillRect(2 + 18 * 1, 2, 16, 16, 16 * 1, 16 * 0, 16, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
int padding = 2;
|
int padding = 2;
|
||||||
|
|
||||||
final int brightness = (int) Math.ceil(Engine.INSTANCE.getHardwareDevice().getDisplayManager().getBrightness() * 9);
|
final int brightness = (int) Math.ceil(Engine.INSTANCE.getHardwareDevice().getDisplayManager().getBrightness() * 9);
|
||||||
if (brightness <= 10) {
|
if (brightness <= 10) {
|
||||||
renderer.glFillRect(StaticVars.screenSize[0] - (padding + 16), 2, 16, 16, 16 * brightness, 16 * 1, 16, 16);
|
r.glFillRect(StaticVars.screenSize[0] - (padding + 16), 2, 16, 16, 16 * brightness, 16 * 1, 16, 16);
|
||||||
} else {
|
} else {
|
||||||
Engine.getPlatform().getConsoleUtils().out().println(1, "Brightness error");
|
Engine.getPlatform().getConsoleUtils().out().println(1, "Brightness error");
|
||||||
}
|
}
|
||||||
@ -74,34 +76,68 @@ public class CalculatorHUD extends HUD {
|
|||||||
final boolean canGoForward = Engine.INSTANCE.getHardwareDevice().getDisplayManager().canGoForward();
|
final boolean canGoForward = Engine.INSTANCE.getHardwareDevice().getDisplayManager().canGoForward();
|
||||||
|
|
||||||
if (Engine.getPlatform().getSettings().isDebugEnabled()) {
|
if (Engine.getPlatform().getSettings().isDebugEnabled()) {
|
||||||
renderer.glFillRect(StaticVars.screenSize[0] - (padding + 16), 2, 16, 16, 16 * 18, 16 * 0, 16, 16);
|
r.glFillRect(StaticVars.screenSize[0] - (padding + 16), 2, 16, 16, 16 * 18, 16 * 0, 16, 16);
|
||||||
padding += 18 + 6;
|
padding += 18 + 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canGoBack && canGoForward) {
|
if (canGoBack && canGoForward) {
|
||||||
renderer.glFillRect(StaticVars.screenSize[0] - (padding + 16), 2, 16, 16, 16 * 14, 16 * 0, 16, 16);
|
r.glFillRect(StaticVars.screenSize[0] - (padding + 16), 2, 16, 16, 16 * 14, 16 * 0, 16, 16);
|
||||||
} else if (canGoBack) {
|
} else if (canGoBack) {
|
||||||
renderer.glFillRect(StaticVars.screenSize[0] - (padding + 16), 2, 16, 16, 16 * 15, 16 * 0, 16, 16);
|
r.glFillRect(StaticVars.screenSize[0] - (padding + 16), 2, 16, 16, 16 * 15, 16 * 0, 16, 16);
|
||||||
} else if (canGoForward) {
|
} else if (canGoForward) {
|
||||||
renderer.glFillRect(StaticVars.screenSize[0] - (padding + 16), 2, 16, 16, 16 * 16, 16 * 0, 16, 16);
|
r.glFillRect(StaticVars.screenSize[0] - (padding + 16), 2, 16, 16, 16 * 16, 16 * 0, 16, 16);
|
||||||
} else {
|
} else {
|
||||||
renderer.glFillRect(StaticVars.screenSize[0] - (padding + 16), 2, 16, 16, 16 * 17, 16 * 0, 16, 16);
|
r.glFillRect(StaticVars.screenSize[0] - (padding + 16), 2, 16, 16, 16 * 17, 16 * 0, 16, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
padding += 18;
|
padding += 18;
|
||||||
|
|
||||||
//DRAW BOTTOM
|
//DRAW BOTTOM
|
||||||
d.renderer.glDrawStringLeft(2, 90, d.displayDebugString);
|
r.glDrawStringLeft(2, 90, d.displayDebugString);
|
||||||
|
|
||||||
Utils.getFont(true, false).use(Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine);
|
Utils.getFont(true, false).use(engine);
|
||||||
Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glColor4i(255, 0, 0, 40);
|
r.glColor4i(255, 0, 0, 40);
|
||||||
Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glDrawStringLeft(1 + 1, StaticVars.screenSize[1] - 7 - 7 + 1, "WORK IN");
|
r.glDrawStringLeft(1 + 1, StaticVars.screenSize[1] - 7 - 7 + 1, "WORK IN");
|
||||||
Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glColor4i(255, 0, 0, 80);
|
r.glColor4i(255, 0, 0, 80);
|
||||||
Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glDrawStringLeft(1, StaticVars.screenSize[1] - 7 - 7, "WORK IN");
|
r.glDrawStringLeft(1, StaticVars.screenSize[1] - 7 - 7, "WORK IN");
|
||||||
Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glColor4i(255, 0, 0, 40);
|
r.glColor4i(255, 0, 0, 40);
|
||||||
Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glDrawStringLeft(1 + 1, StaticVars.screenSize[1] - 7 + 1, "PROGRESS.");
|
r.glDrawStringLeft(1 + 1, StaticVars.screenSize[1] - 7 + 1, "PROGRESS.");
|
||||||
Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glColor4i(255, 0, 0, 80);
|
r.glColor4i(255, 0, 0, 80);
|
||||||
Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glDrawStringLeft(1, StaticVars.screenSize[1] - 7, "PROGRESS.");
|
r.glDrawStringLeft(1, StaticVars.screenSize[1] - 7, "PROGRESS.");
|
||||||
|
|
||||||
|
int currentDebugLine = 2;
|
||||||
|
if (Engine.getPlatform().getSettings().isDebugEnabled()) {
|
||||||
|
ObjectArrayList<Screen> allSessions = new ObjectArrayList<>();
|
||||||
|
for (Screen session : Engine.INSTANCE.getHardwareDevice().getDisplayManager().sessions) {
|
||||||
|
allSessions.add(0, session);
|
||||||
|
}
|
||||||
|
Screen curScreen = Engine.INSTANCE.getHardwareDevice().getDisplayManager().getScreen();
|
||||||
|
if (curScreen.canBeInHistory == false) {
|
||||||
|
allSessions.add(curScreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Screen session : allSessions) {
|
||||||
|
if (session != null) {
|
||||||
|
String title = session.getSessionTitle();
|
||||||
|
if (title != null && title.length() > 0) {
|
||||||
|
Utils.getFont(true).use(engine);
|
||||||
|
if (session.canBeInHistory == false) {
|
||||||
|
r.glColor(0xFF3333FF);
|
||||||
|
} else {
|
||||||
|
r.glColor(0xFF990000);
|
||||||
|
}
|
||||||
|
r.glDrawStringLeft(0, StaticVars.screenSize[1] - ((currentDebugLine+1) * (r.getCurrentFont().getCharacterHeight()+1)), "[" + String.format("%1$03d", session.debugScreenID) + "] " + title.toUpperCase());
|
||||||
|
if (session == Engine.INSTANCE.getHardwareDevice().getDisplayManager().getScreen()) {
|
||||||
|
r.glColor(0xFF00CC00);
|
||||||
|
} else {
|
||||||
|
r.glColor(0xFF990000);
|
||||||
|
}
|
||||||
|
r.glDrawStringLeft(0, StaticVars.screenSize[1] - ((currentDebugLine+1) * (r.getCurrentFont().getCharacterHeight()+1)), " " + title.toUpperCase());
|
||||||
|
}
|
||||||
|
currentDebugLine++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -166,7 +166,15 @@ public final class DisplayManager implements RenderingLoop {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setScreen(final Screen screen) {
|
public void setScreen(final Screen screen) {
|
||||||
if (screen.initialized == false) {
|
boolean mustBeAddedToHistory = screen.initialized == false;
|
||||||
|
if (!mustBeAddedToHistory) {
|
||||||
|
boolean found = false;
|
||||||
|
for (Screen s : sessions) {
|
||||||
|
found = found | s == screen;
|
||||||
|
}
|
||||||
|
mustBeAddedToHistory |= !found;
|
||||||
|
}
|
||||||
|
if (mustBeAddedToHistory) {
|
||||||
if (screen.canBeInHistory) {
|
if (screen.canBeInHistory) {
|
||||||
if (currentSession > 0) {
|
if (currentSession > 0) {
|
||||||
final int sl = sessions.length + 5; //TODO: I don't know why if i don't add +5 or more some items disappear
|
final int sl = sessions.length + 5; //TODO: I don't know why if i don't add +5 or more some items disappear
|
||||||
@ -183,7 +191,9 @@ public final class DisplayManager implements RenderingLoop {
|
|||||||
}
|
}
|
||||||
screen.d = this;
|
screen.d = this;
|
||||||
try {
|
try {
|
||||||
|
if (screen.created == false) {
|
||||||
screen.create();
|
screen.create();
|
||||||
|
}
|
||||||
this.screen = screen;
|
this.screen = screen;
|
||||||
screenChange.release();
|
screenChange.release();
|
||||||
if (screen.initialized == false) {
|
if (screen.initialized == false) {
|
||||||
@ -345,12 +355,14 @@ public final class DisplayManager implements RenderingLoop {
|
|||||||
if (fonts[0] != null && fonts[0] != engine.getRenderer().getCurrentFont()) {
|
if (fonts[0] != null && fonts[0] != engine.getRenderer().getCurrentFont()) {
|
||||||
fonts[0].use(engine);
|
fonts[0].use(engine);
|
||||||
}
|
}
|
||||||
hud.renderBackground();
|
if (hud.visible) hud.renderBackground();
|
||||||
screen.render();
|
screen.render();
|
||||||
|
if (hud.visible) {
|
||||||
hud.render();
|
hud.render();
|
||||||
hud.renderTopmostBackground();
|
hud.renderTopmostBackground();
|
||||||
|
}
|
||||||
screen.renderTopmost();
|
screen.renderTopmost();
|
||||||
hud.renderTopmost();
|
if (hud.visible) hud.renderTopmost();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ public abstract class HUD implements GraphicalInterface {
|
|||||||
public DisplayManager d;
|
public DisplayManager d;
|
||||||
public boolean created = false;
|
public boolean created = false;
|
||||||
public boolean initialized = false;
|
public boolean initialized = false;
|
||||||
|
public boolean visible = true;
|
||||||
|
|
||||||
public HUD() {}
|
public HUD() {}
|
||||||
|
|
||||||
@ -45,4 +46,12 @@ public abstract class HUD implements GraphicalInterface {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void hide() {
|
||||||
|
visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void show() {
|
||||||
|
visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package it.cavallium.warppi.gui.expression;
|
package it.cavallium.warppi.gui.expression;
|
||||||
|
|
||||||
public class Caret {
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class Caret implements Serializable {
|
||||||
|
|
||||||
private int pos;
|
private int pos;
|
||||||
private int remaining;
|
private int remaining;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package it.cavallium.warppi.gui.expression;
|
package it.cavallium.warppi.gui.expression;
|
||||||
|
|
||||||
public enum CaretState {
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public enum CaretState implements Serializable {
|
||||||
VISIBLE_ON, VISIBLE_OFF, HIDDEN
|
VISIBLE_ON, VISIBLE_OFF, HIDDEN
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package it.cavallium.warppi.gui.expression;
|
package it.cavallium.warppi.gui.expression;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import it.cavallium.warppi.gui.expression.blocks.BlockVariable;
|
import it.cavallium.warppi.gui.expression.blocks.BlockVariable;
|
||||||
import it.cavallium.warppi.math.MathematicalSymbols;
|
import it.cavallium.warppi.math.MathematicalSymbols;
|
||||||
import it.cavallium.warppi.math.functions.Variable.V_TYPE;
|
import it.cavallium.warppi.math.functions.Variable.V_TYPE;
|
||||||
|
|
||||||
public class InputContext {
|
public class InputContext implements Serializable {
|
||||||
public final HashMap<Character, V_TYPE> variableTypes;
|
public final HashMap<Character, V_TYPE> variableTypes;
|
||||||
public BlockVariable variableTypeDirtyID = null;
|
public BlockVariable variableTypeDirtyID = null;
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import it.cavallium.warppi.gui.graphicengine.Renderer;
|
|||||||
import it.cavallium.warppi.math.MathContext;
|
import it.cavallium.warppi.math.MathContext;
|
||||||
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
||||||
import it.cavallium.warppi.util.Error;
|
import it.cavallium.warppi.util.Error;
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
|
||||||
public abstract class Block implements TreeBlock, GraphicalElement {
|
public abstract class Block implements TreeBlock, GraphicalElement {
|
||||||
|
|
||||||
@ -35,6 +36,14 @@ public abstract class Block implements TreeBlock, GraphicalElement {
|
|||||||
|
|
||||||
public abstract BlockReference<?> getBlock(Caret caret);
|
public abstract BlockReference<?> getBlock(Caret caret);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used only to get inner blocks when deleting the parent block.
|
||||||
|
* @return every block of every inner container, or null if empty
|
||||||
|
*/
|
||||||
|
public abstract ObjectArrayList<Block> getInnerBlocks();
|
||||||
|
|
||||||
|
public abstract int getInnerContainersCount();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract void recomputeDimensions();
|
public abstract void recomputeDimensions();
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import it.cavallium.warppi.gui.graphicengine.Renderer;
|
|||||||
import it.cavallium.warppi.math.MathContext;
|
import it.cavallium.warppi.math.MathContext;
|
||||||
import it.cavallium.warppi.math.parser.features.FeatureChar;
|
import it.cavallium.warppi.math.parser.features.FeatureChar;
|
||||||
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
|
||||||
public class BlockChar extends Block {
|
public class BlockChar extends Block {
|
||||||
|
|
||||||
@ -65,4 +66,14 @@ public class BlockChar extends Block {
|
|||||||
return new FeatureChar(getChar());
|
return new FeatureChar(getChar());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> getInnerBlocks() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInnerContainersCount() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
|||||||
import it.cavallium.warppi.util.Error;
|
import it.cavallium.warppi.util.Error;
|
||||||
import it.cavallium.warppi.util.Errors;
|
import it.cavallium.warppi.util.Errors;
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectListIterator;
|
||||||
|
|
||||||
public class BlockContainer implements TreeContainer, GraphicalElement {
|
public class BlockContainer implements TreeContainer, GraphicalElement {
|
||||||
|
|
||||||
@ -218,8 +219,22 @@ public class BlockContainer implements TreeContainer, GraphicalElement {
|
|||||||
final int deltaCaret = caret.getRemaining();
|
final int deltaCaret = caret.getRemaining();
|
||||||
removed = removed | b.delBlock(caret);
|
removed = removed | b.delBlock(caret);
|
||||||
if (caret.getRemaining() == 0 || removed == false && deltaCaret >= 0 && caret.getRemaining() < 0) {
|
if (caret.getRemaining() == 0 || removed == false && deltaCaret >= 0 && caret.getRemaining() < 0) {
|
||||||
|
ObjectArrayList<Block> blocks = this.getBlockAt(pos - 1).get().getInnerBlocks();
|
||||||
|
int innerContainersCount = this.getBlockAt(pos - 1).get().getInnerContainersCount();
|
||||||
|
if (innerContainersCount > 0) {
|
||||||
|
innerContainersCount--;
|
||||||
|
}
|
||||||
removeAt(pos - 1);
|
removeAt(pos - 1);
|
||||||
caret.setPosition(caret.getPosition() - deltaCaret);
|
if (blocks != null) {
|
||||||
|
ObjectListIterator<Block> blocksIterator = blocks.iterator();
|
||||||
|
int blockNum = 0;
|
||||||
|
while (blocksIterator.hasNext()) {
|
||||||
|
Block block = blocksIterator.next();
|
||||||
|
addBlockUnsafe(pos - 1 + blockNum, block);
|
||||||
|
blockNum++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
caret.setPosition(caret.getPosition() - innerContainersCount);
|
||||||
removed = true;
|
removed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,8 @@ import it.cavallium.warppi.math.MathContext;
|
|||||||
import it.cavallium.warppi.math.parser.features.FeatureDivision;
|
import it.cavallium.warppi.math.parser.features.FeatureDivision;
|
||||||
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
||||||
import it.cavallium.warppi.util.Error;
|
import it.cavallium.warppi.util.Error;
|
||||||
|
import it.unimi.dsi.fastutil.objects.AbstractObjectList;
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
|
||||||
public class BlockDivision extends Block {
|
public class BlockDivision extends Block {
|
||||||
|
|
||||||
@ -118,4 +120,16 @@ public class BlockDivision extends Block {
|
|||||||
final Function lower = getLowerContainer().toFunction(context);
|
final Function lower = getLowerContainer().toFunction(context);
|
||||||
return new FeatureDivision(upper, lower);
|
return new FeatureDivision(upper, lower);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> getInnerBlocks() {
|
||||||
|
ObjectArrayList<Block> output = containerUp.getContent();
|
||||||
|
output.addAll(containerDown.getContent());
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInnerContainersCount() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,6 @@ public class BlockLogarithm extends Block implements IParenthesis {
|
|||||||
height = toph + nmbh;
|
height = toph + nmbh;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
System.out.println("b");
|
|
||||||
toph = 0;
|
toph = 0;
|
||||||
line = toph + nl;
|
line = toph + nl;
|
||||||
if (nmbh + bh - bl > toph + nmbh) {
|
if (nmbh + bh - bl > toph + nmbh) {
|
||||||
@ -160,4 +159,16 @@ public class BlockLogarithm extends Block implements IParenthesis {
|
|||||||
return new FeatureLogarithm(base, number);
|
return new FeatureLogarithm(base, number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> getInnerBlocks() {
|
||||||
|
ObjectArrayList<Block> output = containerBase.getContent();
|
||||||
|
output.addAll(containerNumber.getContent());
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInnerContainersCount() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,4 +20,14 @@ public class BlockParenthesis extends BlockParenthesisAbstract {
|
|||||||
return new FeatureParenthesis(cont);
|
return new FeatureParenthesis(cont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> getInnerBlocks() {
|
||||||
|
return getNumberContainer().getContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInnerContainersCount() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -115,4 +115,15 @@ public abstract class BlockParenthesisAbstract extends Block implements IParenth
|
|||||||
@Override
|
@Override
|
||||||
public abstract Feature toFeature(MathContext context) throws Error;
|
public abstract Feature toFeature(MathContext context) throws Error;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> getInnerBlocks() {
|
||||||
|
return containerNumber.getContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInnerContainersCount() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import it.cavallium.warppi.math.MathContext;
|
|||||||
import it.cavallium.warppi.math.parser.features.FeaturePowerChar;
|
import it.cavallium.warppi.math.parser.features.FeaturePowerChar;
|
||||||
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
||||||
import it.cavallium.warppi.util.Error;
|
import it.cavallium.warppi.util.Error;
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
|
||||||
public class BlockPower extends Block {
|
public class BlockPower extends Block {
|
||||||
|
|
||||||
@ -80,4 +81,14 @@ public class BlockPower extends Block {
|
|||||||
final Function exp = getExponentContainer().toFunction(context);
|
final Function exp = getExponentContainer().toFunction(context);
|
||||||
return new FeaturePowerChar(exp);
|
return new FeaturePowerChar(exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> getInnerBlocks() {
|
||||||
|
return this.containerExponent.getContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInnerContainersCount() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import it.cavallium.warppi.math.MathContext;
|
|||||||
import it.cavallium.warppi.math.parser.features.FeaturePowerChar;
|
import it.cavallium.warppi.math.parser.features.FeaturePowerChar;
|
||||||
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
||||||
import it.cavallium.warppi.util.Error;
|
import it.cavallium.warppi.util.Error;
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
|
||||||
public class BlockPower2 extends Block {
|
public class BlockPower2 extends Block {
|
||||||
|
|
||||||
@ -86,4 +87,14 @@ public class BlockPower2 extends Block {
|
|||||||
final Function exp = getExponentContainer().toFunction(context);
|
final Function exp = getExponentContainer().toFunction(context);
|
||||||
return new FeaturePowerChar(exp);
|
return new FeaturePowerChar(exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> getInnerBlocks() {
|
||||||
|
return containerExponent.getContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInnerContainersCount() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import it.cavallium.warppi.math.MathContext;
|
|||||||
import it.cavallium.warppi.math.parser.features.FeatureSine;
|
import it.cavallium.warppi.math.parser.features.FeatureSine;
|
||||||
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
||||||
import it.cavallium.warppi.util.Error;
|
import it.cavallium.warppi.util.Error;
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
|
||||||
public class BlockSine extends BlockParenthesisAbstract {
|
public class BlockSine extends BlockParenthesisAbstract {
|
||||||
public BlockSine() {
|
public BlockSine() {
|
||||||
|
@ -8,6 +8,7 @@ import it.cavallium.warppi.math.MathContext;
|
|||||||
import it.cavallium.warppi.math.parser.features.FeatureSquareRoot;
|
import it.cavallium.warppi.math.parser.features.FeatureSquareRoot;
|
||||||
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
||||||
import it.cavallium.warppi.util.Error;
|
import it.cavallium.warppi.util.Error;
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
|
||||||
public class BlockSquareRoot extends Block {
|
public class BlockSquareRoot extends Block {
|
||||||
|
|
||||||
@ -95,4 +96,16 @@ public class BlockSquareRoot extends Block {
|
|||||||
final Function contnt = getNumberContainer().toFunction(context);
|
final Function contnt = getNumberContainer().toFunction(context);
|
||||||
return new FeatureSquareRoot(contnt);
|
return new FeatureSquareRoot(contnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> getInnerBlocks() {
|
||||||
|
ObjectArrayList<Block> output = containerNumber.getContent();
|
||||||
|
// output.addAll();
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInnerContainersCount() {
|
||||||
|
return 1; //2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import it.cavallium.warppi.math.MathContext;
|
|||||||
import it.cavallium.warppi.math.MathematicalSymbols;
|
import it.cavallium.warppi.math.MathematicalSymbols;
|
||||||
import it.cavallium.warppi.math.parser.features.FeatureChar;
|
import it.cavallium.warppi.math.parser.features.FeatureChar;
|
||||||
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
|
||||||
public class BlockUndefined extends Block {
|
public class BlockUndefined extends Block {
|
||||||
|
|
||||||
@ -59,4 +60,14 @@ public class BlockUndefined extends Block {
|
|||||||
return new FeatureChar(MathematicalSymbols.UNDEFINED);
|
return new FeatureChar(MathematicalSymbols.UNDEFINED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> getInnerBlocks() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInnerContainersCount() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import it.cavallium.warppi.math.functions.Variable.V_TYPE;
|
|||||||
import it.cavallium.warppi.math.parser.features.FeatureVariable;
|
import it.cavallium.warppi.math.parser.features.FeatureVariable;
|
||||||
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
||||||
import it.cavallium.warppi.util.Error;
|
import it.cavallium.warppi.util.Error;
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
|
||||||
public class BlockVariable extends Block {
|
public class BlockVariable extends Block {
|
||||||
|
|
||||||
@ -255,4 +256,14 @@ public class BlockVariable extends Block {
|
|||||||
public Feature toFeature(final MathContext context) throws Error {
|
public Feature toFeature(final MathContext context) throws Error {
|
||||||
return new FeatureVariable(ch, type);
|
return new FeatureVariable(ch, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> getInnerBlocks() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInnerContainersCount() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package it.cavallium.warppi.gui.expression.blocks;
|
package it.cavallium.warppi.gui.expression.blocks;
|
||||||
|
|
||||||
public interface TreeBlock {
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public interface TreeBlock extends Serializable {
|
||||||
TreeContainer getParentContainer();
|
TreeContainer getParentContainer();
|
||||||
|
|
||||||
boolean hasParent();
|
boolean hasParent();
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package it.cavallium.warppi.gui.expression.blocks;
|
package it.cavallium.warppi.gui.expression.blocks;
|
||||||
|
|
||||||
public interface TreeContainer {
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public interface TreeContainer extends Serializable {
|
||||||
TreeBlock getParentBlock();
|
TreeBlock getParentBlock();
|
||||||
|
|
||||||
boolean hasParent();
|
boolean hasParent();
|
||||||
|
@ -78,4 +78,9 @@ public class ChooseVariableValueScreen extends Screen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSessionTitle() {
|
||||||
|
return "Choose a value for the variable.";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,4 +33,9 @@ public class EmptyScreen extends Screen {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSessionTitle() {
|
||||||
|
return "empty";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -222,4 +222,9 @@ public class KeyboardDebugScreen extends Screen {
|
|||||||
KeyboardDebugScreen.log = newlog;
|
KeyboardDebugScreen.log = newlog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSessionTitle() {
|
||||||
|
return "Keyboard debug";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ public class LoadingScreen extends Screen {
|
|||||||
public float loadingTextTranslation = 0.0f;
|
public float loadingTextTranslation = 0.0f;
|
||||||
public boolean loaded = false;
|
public boolean loaded = false;
|
||||||
private float previousZoomValue = 1;
|
private float previousZoomValue = 1;
|
||||||
|
private volatile boolean ended = false;
|
||||||
|
|
||||||
public LoadingScreen() {
|
public LoadingScreen() {
|
||||||
super();
|
super();
|
||||||
@ -28,6 +29,7 @@ public class LoadingScreen extends Screen {
|
|||||||
@Override
|
@Override
|
||||||
public void initialized() throws InterruptedException {
|
public void initialized() throws InterruptedException {
|
||||||
previousZoomValue = StaticVars.windowZoomFunction.apply(StaticVars.windowZoom.getLastValue());
|
previousZoomValue = StaticVars.windowZoomFunction.apply(StaticVars.windowZoom.getLastValue());
|
||||||
|
Engine.INSTANCE.getHardwareDevice().getDisplayManager().getHUD().hide();
|
||||||
StaticVars.windowZoom.onNext(1f);
|
StaticVars.windowZoom.onNext(1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,8 +38,10 @@ public class LoadingScreen extends Screen {
|
|||||||
loadingTextTranslation = GraphicUtils.sinDeg(endLoading * 90f) * 10f;
|
loadingTextTranslation = GraphicUtils.sinDeg(endLoading * 90f) * 10f;
|
||||||
|
|
||||||
endLoading += dt;
|
endLoading += dt;
|
||||||
if (loaded && (Engine.getPlatform().getSettings().isDebugEnabled() || endLoading >= 3.5f)) {
|
if (!ended && loaded && (Engine.getPlatform().getSettings().isDebugEnabled() || endLoading >= 3.5f)) {
|
||||||
|
ended = true;
|
||||||
StaticVars.windowZoom.onNext(previousZoomValue);
|
StaticVars.windowZoom.onNext(previousZoomValue);
|
||||||
|
Engine.INSTANCE.getHardwareDevice().getDisplayManager().getHUD().show();
|
||||||
Engine.INSTANCE.getHardwareDevice().getDisplayManager().setScreen(new MathInputScreen());
|
Engine.INSTANCE.getHardwareDevice().getDisplayManager().setScreen(new MathInputScreen());
|
||||||
}
|
}
|
||||||
mustRefresh = true;
|
mustRefresh = true;
|
||||||
@ -65,4 +69,9 @@ public class LoadingScreen extends Screen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSessionTitle() {
|
||||||
|
return "Loading...";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -197,4 +197,9 @@ public class MarioScreen extends Screen {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSessionTitle() {
|
||||||
|
return "Absolutely not Super Mario";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package it.cavallium.warppi.gui.screens;
|
package it.cavallium.warppi.gui.screens;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.SerializationUtils;
|
||||||
|
|
||||||
import it.cavallium.warppi.Engine;
|
import it.cavallium.warppi.Engine;
|
||||||
import it.cavallium.warppi.Platform.ConsoleUtils;
|
import it.cavallium.warppi.Platform.ConsoleUtils;
|
||||||
@ -27,6 +30,7 @@ import it.cavallium.warppi.math.MathematicalSymbols;
|
|||||||
import it.cavallium.warppi.math.functions.Expression;
|
import it.cavallium.warppi.math.functions.Expression;
|
||||||
import it.cavallium.warppi.math.functions.Number;
|
import it.cavallium.warppi.math.functions.Number;
|
||||||
import it.cavallium.warppi.math.functions.Variable;
|
import it.cavallium.warppi.math.functions.Variable;
|
||||||
|
import it.cavallium.warppi.math.functions.Variable.V_TYPE;
|
||||||
import it.cavallium.warppi.math.functions.Variable.VariableValue;
|
import it.cavallium.warppi.math.functions.Variable.VariableValue;
|
||||||
import it.cavallium.warppi.math.parser.MathParser;
|
import it.cavallium.warppi.math.parser.MathParser;
|
||||||
import it.cavallium.warppi.math.solver.MathSolver;
|
import it.cavallium.warppi.math.solver.MathSolver;
|
||||||
@ -238,6 +242,7 @@ public class MathInputScreen extends Screen {
|
|||||||
// currentExpression = newExpression;
|
// currentExpression = newExpression;
|
||||||
// simplify();
|
// simplify();
|
||||||
// });
|
// });
|
||||||
|
this.swapInputScreen();
|
||||||
}
|
}
|
||||||
} catch (final InterruptedException ex) {
|
} catch (final InterruptedException ex) {
|
||||||
Engine.getPlatform().getConsoleUtils().out().println(ConsoleUtils.OUTPUTLEVEL_DEBUG_MIN, "Computing thread stopped.");
|
Engine.getPlatform().getConsoleUtils().out().println(ConsoleUtils.OUTPUTLEVEL_DEBUG_MIN, "Computing thread stopped.");
|
||||||
@ -464,6 +469,24 @@ public class MathInputScreen extends Screen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private void swapInputScreen() {
|
||||||
|
MathInputScreen mis = new MathInputScreen();
|
||||||
|
mis.calc = SerializationUtils.clone(calc);
|
||||||
|
mis.canBeInHistory = true;
|
||||||
|
mis.currentStep = currentStep;
|
||||||
|
mis.created = created;
|
||||||
|
mis.d = d;
|
||||||
|
mis.errorLevel = errorLevel;
|
||||||
|
mis.ic = SerializationUtils.clone(ic);
|
||||||
|
mis.initialized = initialized;
|
||||||
|
mis.mustRefresh = true;
|
||||||
|
mis.result = SerializationUtils.clone(result);
|
||||||
|
mis.userInput = SerializationUtils.clone(userInput);
|
||||||
|
mis.d = d;
|
||||||
|
Engine.INSTANCE.getHardwareDevice().getDisplayManager().setScreen(mis);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private ObjectArrayList<Function> solveExpression(final ObjectArrayList<Function> f22) {
|
private ObjectArrayList<Function> solveExpression(final ObjectArrayList<Function> f22) {
|
||||||
@ -688,17 +711,8 @@ public class MathInputScreen extends Screen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
public String getSessionTitle() {
|
||||||
public MathInputScreen clone() {
|
return "Calculator";
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
// final MathInputScreen es = this;
|
|
||||||
// final MathInputScreen es2 = new MathInputScreen();
|
|
||||||
// es2.errorLevel = es.errorLevel;
|
|
||||||
// es2.mustRefresh = es.mustRefresh;
|
|
||||||
// es2.calc = Utils.cloner.deepClone(es.calc);
|
|
||||||
// es2.userInput = Utils.cloner.deepClone(es.userInput);
|
|
||||||
// es2.result = Utils.cloner.deepClone(es.result);
|
|
||||||
// return es2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package it.cavallium.warppi.gui.screens;
|
package it.cavallium.warppi.gui.screens;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
import it.cavallium.warppi.event.KeyboardEventListener;
|
import it.cavallium.warppi.event.KeyboardEventListener;
|
||||||
import it.cavallium.warppi.event.TouchEventListener;
|
import it.cavallium.warppi.event.TouchEventListener;
|
||||||
import it.cavallium.warppi.gui.DisplayManager;
|
import it.cavallium.warppi.gui.DisplayManager;
|
||||||
@ -11,7 +13,12 @@ public abstract class Screen implements KeyboardEventListener, TouchEventListene
|
|||||||
public boolean initialized = false;
|
public boolean initialized = false;
|
||||||
public boolean canBeInHistory = false;
|
public boolean canBeInHistory = false;
|
||||||
|
|
||||||
public Screen() {}
|
public static long lastDebugScreenID = 1;
|
||||||
|
public final long debugScreenID;
|
||||||
|
|
||||||
|
public Screen() {
|
||||||
|
debugScreenID = lastDebugScreenID++;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() throws InterruptedException {
|
public void initialize() throws InterruptedException {
|
||||||
@ -46,4 +53,6 @@ public abstract class Screen implements KeyboardEventListener, TouchEventListene
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract boolean mustBeRefreshed();
|
public abstract boolean mustBeRefreshed();
|
||||||
|
|
||||||
|
public abstract String getSessionTitle();
|
||||||
}
|
}
|
||||||
|
@ -67,4 +67,9 @@ public class SolveForXScreen extends Screen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSessionTitle() {
|
||||||
|
return "Solve for X";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package it.cavallium.warppi.math;
|
package it.cavallium.warppi.math;
|
||||||
|
|
||||||
public enum AngleMode {
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public enum AngleMode implements Serializable {
|
||||||
DEG, RAD, GRA
|
DEG, RAD, GRA
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package it.cavallium.warppi.math;
|
package it.cavallium.warppi.math;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
import it.cavallium.warppi.gui.expression.blocks.Block;
|
import it.cavallium.warppi.gui.expression.blocks.Block;
|
||||||
import it.cavallium.warppi.math.rules.Rule;
|
import it.cavallium.warppi.math.rules.Rule;
|
||||||
import it.cavallium.warppi.util.Error;
|
import it.cavallium.warppi.util.Error;
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
|
||||||
public interface Function {
|
public interface Function extends Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns this function and its children in a string form.
|
* Returns this function and its children in a string form.
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package it.cavallium.warppi.math;
|
package it.cavallium.warppi.math;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.SerializationUtils;
|
||||||
|
|
||||||
import it.cavallium.warppi.math.functions.Variable.VariableValue;
|
import it.cavallium.warppi.math.functions.Variable.VariableValue;
|
||||||
import it.cavallium.warppi.math.rules.Rule;
|
import it.cavallium.warppi.math.rules.Rule;
|
||||||
import it.cavallium.warppi.math.rules.RuleType;
|
import it.cavallium.warppi.math.rules.RuleType;
|
||||||
@ -7,7 +11,7 @@ import it.cavallium.warppi.math.rules.RulesManager;
|
|||||||
import it.cavallium.warppi.util.Error;
|
import it.cavallium.warppi.util.Error;
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
|
||||||
public class MathContext {
|
public class MathContext implements Serializable {
|
||||||
|
|
||||||
public AngleMode angleMode = AngleMode.DEG;
|
public AngleMode angleMode = AngleMode.DEG;
|
||||||
public boolean exactMode = false;
|
public boolean exactMode = false;
|
||||||
@ -126,20 +130,6 @@ public class MathContext {
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public MathContext clone() {
|
|
||||||
// MathContext mc = new MathContext();
|
|
||||||
// mc.angleMode = this.angleMode;
|
|
||||||
// mc.exactMode = this.exactMode;
|
|
||||||
// mc.f = this.f;
|
|
||||||
// mc.f2 = this.f2;
|
|
||||||
// mc.variablesValues = this.variablesValues;
|
|
||||||
// mc.resultsCount = this.resultsCount;
|
|
||||||
// return mc;
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ObjectArrayList<Rule> getAcceptableRules(final RuleType currentAcceptedRules) {
|
public ObjectArrayList<Rule> getAcceptableRules(final RuleType currentAcceptedRules) {
|
||||||
return RulesManager.rules[currentAcceptedRules.ordinal()];
|
return RulesManager.rules[currentAcceptedRules.ordinal()];
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package it.cavallium.warppi.math.functions;
|
package it.cavallium.warppi.math.functions;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
import it.cavallium.warppi.gui.expression.blocks.Block;
|
import it.cavallium.warppi.gui.expression.blocks.Block;
|
||||||
import it.cavallium.warppi.gui.expression.blocks.BlockChar;
|
import it.cavallium.warppi.gui.expression.blocks.BlockChar;
|
||||||
import it.cavallium.warppi.math.Function;
|
import it.cavallium.warppi.math.Function;
|
||||||
@ -45,7 +47,8 @@ public class Variable implements Function {
|
|||||||
return "" + getChar();
|
return "" + getChar();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class VariableValue {
|
public static class VariableValue implements Serializable {
|
||||||
|
private static final long serialVersionUID = -5656281021874324571L;
|
||||||
public final Variable v;
|
public final Variable v;
|
||||||
public final Number n;
|
public final Number n;
|
||||||
|
|
||||||
|
Binary file not shown.
@ -124,6 +124,7 @@ public class SwingRenderer implements Renderer {
|
|||||||
newColors[idx] = getSkinColorAt(currentSkin.skinData, skinIndex);
|
newColors[idx] = getSkinColorAt(currentSkin.skinData, skinIndex);
|
||||||
}
|
}
|
||||||
newColor = joinColors(newColors);
|
newColor = joinColors(newColors);
|
||||||
|
if (index >= 0 && index < SwingRenderer.canvas2d.length) {
|
||||||
if (transparent) {
|
if (transparent) {
|
||||||
oldColor = SwingRenderer.canvas2d[index];
|
oldColor = SwingRenderer.canvas2d[index];
|
||||||
final float a2 = (newColor >> 24 & 0xFF) / 255f;
|
final float a2 = (newColor >> 24 & 0xFF) / 255f;
|
||||||
@ -138,6 +139,7 @@ public class SwingRenderer implements Renderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int joinColors(final int[] newColors) {
|
private int joinColors(final int[] newColors) {
|
||||||
int a = 0;
|
int a = 0;
|
||||||
|
@ -104,7 +104,7 @@ public class SwingWindow extends JFrame {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentResized(final ComponentEvent e) {
|
public void componentResized(final ComponentEvent e) {
|
||||||
onResize.onNext(new Integer[] { getWidth(), getHeight() });
|
onResize.onNext(new Integer[] { c.getWidth(), c.getHeight() });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user