mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-13 06:49:36 -04:00
Merge branch 'master' into tutorial
This commit is contained in:
commit
2c1cd35a0d
@ -164,11 +164,11 @@ public class DataPlotter implements Drawable {
|
||||
if (width == 0) width = 1;
|
||||
long value = s.getValue(i).getValue();
|
||||
int ry;
|
||||
if (Math.abs(width >>> 1) < Integer.MAX_VALUE) {
|
||||
long sWidth = (width >>> 32);
|
||||
if (sWidth == 0) {
|
||||
ry = (int) (SIZE - (SIZE * value) / width);
|
||||
} else {
|
||||
width = (width >>> 32);
|
||||
ry = (int) (SIZE - (SIZE * (value >>> 32)) / width);
|
||||
ry = (int) (SIZE - (SIZE * (value >>> 32)) / sWidth);
|
||||
}
|
||||
|
||||
if (value != last[i].value)
|
||||
|
@ -180,9 +180,9 @@ public class GraphicSVG implements Graphic {
|
||||
}
|
||||
|
||||
if (rotateText)
|
||||
w.write("<text text-anchor=\"" + getAchor(orientation.getX()) + "\" x=\"" + p.getXFloat() + "\" y=\"" + p.getYFloat() + "\" fill=\"" + getColor(style) + "\" style=\"font-size:" + style.getFontSize() + "\" transform=\"rotate(-90," + str(p1) + ")\" >" + text + "</text>\n");
|
||||
w.write("<text text-anchor=\"" + getAchor(orientation.getX()) + "\" x=\"" + p.getXFloat() + "\" y=\"" + p.getYFloat() + "\" fill=\"" + getColor(style) + "\" style=\"font-size:" + style.getFontSize() + "px\" transform=\"rotate(-90," + str(p1) + ")\" >" + text + "</text>\n");
|
||||
else
|
||||
w.write("<text text-anchor=\"" + getAchor(orientation.getX()) + "\" x=\"" + p.getXFloat() + "\" y=\"" + p.getYFloat() + "\" fill=\"" + getColor(style) + "\" style=\"font-size:" + style.getFontSize() + "\">" + text + "</text>\n");
|
||||
w.write("<text text-anchor=\"" + getAchor(orientation.getX()) + "\" x=\"" + p.getXFloat() + "\" y=\"" + p.getYFloat() + "\" fill=\"" + getColor(style) + "\" style=\"font-size:" + style.getFontSize() + "px\">" + text + "</text>\n");
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -40,9 +40,9 @@ public final class SVGFormatter {
|
||||
if (mathMode)
|
||||
return format(d.getContent(), true);
|
||||
else
|
||||
return "<tspan style=\"font-style:italic\">" + format(d.getContent(), true) + "</tspan>";
|
||||
return "<tspan style=\"font-style:italic;\">" + format(d.getContent(), true) + "</tspan>";
|
||||
case OVERLINE:
|
||||
return '\u00AC' + format(d.getContent(), mathMode);
|
||||
return "<tspan style=\"text-decoration:overline;\">" + format(d.getContent(), mathMode) + "</tspan>";
|
||||
default:
|
||||
return format(d.getContent(), mathMode);
|
||||
}
|
||||
@ -50,9 +50,9 @@ public final class SVGFormatter {
|
||||
Index i = (Index) text;
|
||||
String str = format(i.getVar(), true);
|
||||
if (i.getSubScript() != null)
|
||||
str += "<tspan style=\"font-size:80%;baseline-shift:sub\">" + format(i.getSubScript(), mathMode) + "</tspan>";
|
||||
str += "<tspan style=\"font-size:80%;baseline-shift:sub;\">" + format(i.getSubScript(), mathMode) + "</tspan>";
|
||||
if (i.getSuperScript() != null)
|
||||
str += "<tspan style=\"font-size:80%;baseline-shift:super\">" + format(i.getSuperScript(), mathMode) + "</tspan>";
|
||||
str += "<tspan style=\"font-size:80%;baseline-shift:super;\">" + format(i.getSuperScript(), mathMode) + "</tspan>";
|
||||
return str;
|
||||
} else if (text instanceof Sentence) {
|
||||
Sentence s = (Sentence) text;
|
||||
|
@ -135,6 +135,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
||||
private ToolTipAction runToBreakAction;
|
||||
private ToolTipAction showMeasurementDialog;
|
||||
private ToolTipAction showMeasurementGraph;
|
||||
private ToolTipAction runTests;
|
||||
|
||||
private File baseFilename;
|
||||
private File filename;
|
||||
@ -979,7 +980,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
||||
.setToolTip(Lang.get("menu_element_tt"))
|
||||
.setEnabledChain(false);
|
||||
|
||||
ToolTipAction runTests = new ToolTipAction(Lang.get("menu_runTests"), ICON_TEST) {
|
||||
runTests = new ToolTipAction(Lang.get("menu_runTests"), ICON_TEST) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
startTests();
|
||||
@ -1231,6 +1232,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
||||
showMeasurementDialog.setEnabled(false);
|
||||
showMeasurementGraph.setEnabled(false);
|
||||
runToBreakAction.setEnabled(false);
|
||||
runTests.setEnabled(true);
|
||||
// keep errors
|
||||
if (circuitComponent.getHighLightStyle() != Style.ERROR)
|
||||
circuitComponent.removeHighLighted();
|
||||
@ -1245,6 +1247,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
||||
showMeasurementDialog.setEnabled(true);
|
||||
showMeasurementGraph.setEnabled(true);
|
||||
stoppedState.getAction().setEnabled(true);
|
||||
runTests.setEnabled(false);
|
||||
if (createAndStartModel(false, ModelEvent.MICROSTEP, null))
|
||||
circuitComponent.setManualChangeObserver(new MicroStepObserver(model));
|
||||
}
|
||||
@ -1252,6 +1255,23 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
||||
stateManager.setActualState(stoppedState);
|
||||
}
|
||||
|
||||
private class RunModelState extends State {
|
||||
@Override
|
||||
public void enter() {
|
||||
enter(true, null);
|
||||
}
|
||||
|
||||
void enter(boolean runRealTime, ModelModifier modelModifier) {
|
||||
super.enter();
|
||||
stoppedState.getAction().setEnabled(true);
|
||||
showMeasurementDialog.setEnabled(true);
|
||||
showMeasurementGraph.setEnabled(true);
|
||||
runTests.setEnabled(false);
|
||||
if (createAndStartModel(runRealTime, ModelEvent.STEP, modelModifier))
|
||||
circuitComponent.setManualChangeObserver(new FullStepObserver(model));
|
||||
}
|
||||
}
|
||||
|
||||
private void clearModelDescription() {
|
||||
if (model != null)
|
||||
model.access(() -> model.close());
|
||||
@ -1672,23 +1692,6 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class RunModelState extends State {
|
||||
@Override
|
||||
public void enter() {
|
||||
enter(true, null);
|
||||
}
|
||||
|
||||
void enter(boolean runRealTime, ModelModifier modelModifier) {
|
||||
super.enter();
|
||||
stoppedState.getAction().setEnabled(true);
|
||||
showMeasurementDialog.setEnabled(true);
|
||||
showMeasurementGraph.setEnabled(true);
|
||||
if (createAndStartModel(runRealTime, ModelEvent.STEP, modelModifier))
|
||||
circuitComponent.setManualChangeObserver(new FullStepObserver(model));
|
||||
}
|
||||
}
|
||||
|
||||
//***********************
|
||||
// remote interface start
|
||||
//***********************
|
||||
|
@ -1174,11 +1174,12 @@ public class CircuitComponent extends JComponent implements ChangedListener, Lib
|
||||
}
|
||||
|
||||
private VisualElement getActualVisualElement() {
|
||||
if (activeMouseController instanceof MouseControllerMoveElement)
|
||||
mouseNormal.activate();
|
||||
|
||||
VisualElement ve = null;
|
||||
if (activeMouseController instanceof MouseControllerNormal)
|
||||
ve = getCircuit().getElementAt(getPosVector(lastMousePos.x, lastMousePos.y));
|
||||
// if (activeMouseController instanceof MouseControllerMoveElement)
|
||||
// ve = ((MouseControllerMoveElement) activeMouseController).getVisualElement();
|
||||
return ve;
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,8 @@ import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
import static de.neemann.digital.draw.graphics.GraphicSVG.escapeXML;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -811,6 +813,7 @@ public class TableDialog extends JDialog {
|
||||
|
||||
@Override
|
||||
public String identifier(String ident) {
|
||||
ident = escapeXML(ident);
|
||||
int p = ident.indexOf("_");
|
||||
if (p < 0)
|
||||
return ident;
|
||||
|
@ -14,9 +14,9 @@ public class GraphicSVGIndexTest extends TestCase {
|
||||
GraphicSVGIndex gs = new GraphicSVGIndex(System.out, null, 30);
|
||||
gs.setBoundingBox(new Vector(0, 0), new Vector(30, 30));
|
||||
|
||||
assertEquals("Z<tspan style=\"font-size:80%;baseline-shift:sub\">0</tspan>", gs.formatText("Z_0", Style.NORMAL));
|
||||
assertEquals("Z<tspan style=\"font-size:80%;baseline-shift:sub;\">0</tspan>", gs.formatText("Z_0", Style.NORMAL));
|
||||
assertEquals("<a>", gs.formatText("<a>", Style.NORMAL));
|
||||
assertEquals("\u00ACZ", gs.formatText("~Z", Style.NORMAL));
|
||||
assertEquals("<tspan style=\"text-decoration:overline;\">Z</tspan>", gs.formatText("~Z", Style.NORMAL));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user