Skip to content

Commit 69fc1df

Browse files
committed
V1.85 Widen all template dialogues to 600 px to avoid truncated button bar text on Linux. Add a KaTeX macros option to map \Int to \int (necessary for algint.tst). Display an error dialogue if no printers are available when trying to print. Hide the raw session log menu item.
1 parent 0b0adbf commit 69fc1df

15 files changed

Lines changed: 119 additions & 154 deletions

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,5 @@ Run-REDUCE-FX currently uses a bundled copy of
160160
* Update User Guide.
161161
* V1.84 Add table-based rewriting of \symb{n} and handle all (four)
162162
cases that I have noticed in fmprint.red.
163+
* V1.85 Map \Int to \int and fix some other bugs found when testing on
164+
Linux.

docs/UserGuide.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -618,10 +618,9 @@ <h3>Typeset Maths</h3>
618618
with redfront I/O colouring, so don't try to use the two
619619
together: one will effectively cancel the other. Big delimiters
620620
are not handled correctly: they or their components are too
621-
small. Some special symbols <em>might</em> be output as
622-
\symb{<em>n</em>}, where <em>n</em> is some number. (This
623-
should not happen; if it does please let me know!) <em>Save
624-
Session Log...</em> outputs typeset maths using TeX markup.
621+
small. If any TeX markup appears (coloured red) in the output
622+
then please let me know! <em>Save Session Log...</em> outputs
623+
typeset maths using TeX markup.
625624
</p>
626625
<h3>Single Pane Display</h3>
627626
<p>Selecting this causes Run-REDUCE-FX to display the selected

src/fjwright/runreduce/REDUCEPanel.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Use XML character entity references for control characters in strings, e.g. &#10
6464
<Label text="Control+Click for the Pop-Up Keyboard">
6565
<tooltip>
6666
<Tooltip
67-
text="Hold down the Control key and click you primary mouse button&#10;or click your middle (tertiary) mouse button on the text area&#10;to access special symbols etc. using the pop-up keyboard."/>
67+
text="Hold down the Control key and click your primary mouse button&#10;or click your middle (tertiary) mouse button on the text area&#10;to access special symbols etc. using the pop-up keyboard."/>
6868
</tooltip>
6969
</Label>
7070
<padding>

src/fjwright/runreduce/REDUCEPanel.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class REDUCEPanel extends BorderPane {
5858
private HTMLDocument doc;
5959
private HTMLElement html, head, inputPre;
6060
HTMLElement body;
61-
private JSObject katex;
61+
private JSObject katex, katexMacros;
6262

6363
/*
6464
* The <body> content should look like repeats of this structure:
@@ -169,6 +169,7 @@ private void outputWebViewAvailable() {
169169
head = (HTMLElement) html.getElementsByTagName("head").item(0);
170170
body = doc.getBody();
171171
katex = (JSObject) webEngine.executeScript("katex");
172+
katexMacros = (JSObject) webEngine.executeScript("var katexMacros={'\\\\Int': '\\\\int'};katexMacros;");
172173

173174
// Create default style elements:
174175

@@ -579,13 +580,18 @@ private String reprocessedMathOutputString() {
579580
* This class represents the options passed to katex.render.
580581
* It *must* be entirely public and *must* be instantiated.
581582
*/
582-
public static class KaTeXOptions {
583-
public static final boolean throwOnError = false;
584-
public static final boolean displayMode = true;
585-
public static final double minRuleThickness = 0.1;
586-
// public static final String output = "html";
583+
public class KaTeXOptions {
584+
public final boolean throwOnError = false;
585+
public final boolean displayMode = true;
586+
public final double minRuleThickness = 0.1;
587+
// public static final String output = "html";
587588
// Default is output = htmlAndMathml: Outputs HTML for visual rendering and includes MathML for accessibility.
588589
// The MathML includes the TeX input as annotation, which is what I currently output in the session log.
590+
public JSObject macros;
591+
592+
KaTeXOptions() {
593+
macros = katexMacros; // a JS object constructed in outputWebViewAvailable()
594+
}
589595
}
590596

591597
private void outputTypesetText(String text, String cssClass) {

src/fjwright/runreduce/RunREDUCEFrame.fxml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
<MenuItem mnemonicParsing="false" onAction="#printLogMenuItemAction" text="Print Session Log..."/>
3030
<MenuItem mnemonicParsing="false" onAction="#saveLogMenuItemAction" text="Save Session Log..."/>
3131
<MenuItem mnemonicParsing="false" onAction="#appendLogMenuItemAction" text="Append Session Log..."/>
32-
<SeparatorMenuItem mnemonicParsing="false"/>
33-
<MenuItem mnemonicParsing="false" onAction="#saveRawDisplayMenuItemAction" text="Save Raw Session Log..."/>
32+
<!-- <MenuItem mnemonicParsing="false" onAction="#saveRawDisplayMenuItemAction" text="Save Raw Session Log..."/>-->
3433
<SeparatorMenuItem mnemonicParsing="false"/>
3534
<MenuItem mnemonicParsing="false" onAction="#exitMenuItemAction" text="Exit"/>
3635
</Menu>

src/fjwright/runreduce/RunREDUCEFrame.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -298,16 +298,21 @@ private void loadPackagesMenuItemAction() {
298298
@FXML
299299
private void printLogMenuItemAction() {
300300
PrinterJob printerJob = PrinterJob.createPrinterJob();
301-
if (printerJob.showPrintDialog(frame.getScene().getWindow())) {
302-
RunREDUCE.reducePanel.webEngine.print(printerJob);
303-
if (printerJob.endJob()) {
304-
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
305-
alert.setHeaderText("Print Session Log...");
306-
alert.setContentText("Session log sent to printer.");
307-
alert.showAndWait();
308-
} else
309-
RunREDUCE.errorMessageDialog("Print Session Log...", "Request failed!");
310-
}
301+
if (printerJob != null) {
302+
if (printerJob.showPrintDialog(frame.getScene().getWindow())) {
303+
RunREDUCE.reducePanel.webEngine.print(printerJob);
304+
if (printerJob.endJob()) {
305+
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
306+
alert.setHeaderText("Print Session Log...");
307+
alert.setContentText("Session log sent to printer.");
308+
alert.showAndWait();
309+
} else
310+
RunREDUCE.errorMessageDialog("Print Session Log...",
311+
"Cannot send session log to printer!");
312+
}
313+
} else
314+
RunREDUCE.errorMessageDialog("Print Session Log...",
315+
"Cannot create printer job. Check that you have a printer installed!");
311316
}
312317

313318
// Save Session Log...
@@ -639,7 +644,7 @@ private void sourceForgeMenuItemAction() {
639644
@FXML
640645
private void aboutMenuItemAction() {
641646
Alert alert = new Alert(Alert.AlertType.INFORMATION,
642-
"Version 1.84, September 2020\n" +
647+
"Version 1.85, September 2020\n" +
643648
"\u00A9 2020 Francis Wright");
644649
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
645650
alert.initOwner(RunREDUCE.primaryStage);

src/fjwright/runreduce/UserGuide.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -618,10 +618,9 @@ <h3>Typeset Maths</h3>
618618
with redfront I/O colouring, so don't try to use the two
619619
together: one will effectively cancel the other. Big delimiters
620620
are not handled correctly: they or their components are too
621-
small. Some special symbols <em>might</em> be output as
622-
\symb{<em>n</em>}, where <em>n</em> is some number. (This
623-
should not happen; if it does please let me know!) <em>Save
624-
Session Log...</em> outputs typeset maths using TeX markup.
621+
small. If any TeX markup appears (coloured red) in the output
622+
then please let me know! <em>Save Session Log...</em> outputs
623+
typeset maths using TeX markup.
625624
</p>
626625
<h3>Single Pane Display</h3>
627626
<p>Selecting this causes Run-REDUCE-FX to display the selected

src/fjwright/runreduce/templates/Derivative.fxml

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,41 @@
55
<?import javafx.scene.layout.*?>
66
<?import javafx.scene.text.*?>
77

8-
<VBox fx:id="templateRoot" alignment="CENTER" prefWidth="500.0" spacing="10.0" stylesheets="@templates.css"
9-
xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1"
10-
fx:controller="fjwright.runreduce.templates.Derivative">
8+
<VBox fx:id="templateRoot" alignment="CENTER" prefWidth="600.0" spacing="10.0" stylesheets="@templates.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fjwright.runreduce.templates.Derivative">
119
<padding>
12-
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/>
10+
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
1311
</padding>
14-
<Text fontSmoothingType="LCD"
15-
text="The dependent variable or expression and first independent variable are required. Other fields may be left empty. Superscripts represent orders, which unless empty must be positive integers."
16-
textAlignment="CENTER" wrappingWidth="460.0"/>
12+
<Text fontSmoothingType="LCD" text="The dependent variable or expression and first independent variable are required. Other fields may be left empty. Superscripts represent orders, which unless empty must be positive integers." textAlignment="CENTER" wrappingWidth="560.0" />
1713
<HBox alignment="CENTER">
18-
<Label text="REDUCE Manual: "/>
14+
<Label text="REDUCE Manual: " />
1915
<Hyperlink onAction="#redManHyperlinkOnAction" text="DF Operator" userData="DF Operator">
2016
<tooltip>
21-
<Tooltip text="Click to visit the appropriate section of the REDUCE Manual in your default browser."/>
17+
<Tooltip text="Click to visit the appropriate section of the REDUCE Manual in your default browser." />
2218
</tooltip>
2319
</Hyperlink>
2420
</HBox>
2521
<VBox alignment="CENTER" fillWidth="false" spacing="5.0" styleClass="styled-textfields">
2622
<padding>
27-
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
23+
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
2824
</padding>
2925
<HBox alignment="CENTER" spacing="2.0" style="-fx-border-width: 0 0 1 0; -fx-border-color: black;">
3026
<padding>
31-
<Insets bottom="5.0"/>
27+
<Insets bottom="5.0" />
3228
</padding>
33-
<Label styleClass="d-symbol" text=""/>
34-
<Label fx:id="totalOrdLabel" styleClass="order"/>
35-
<TextField fx:id="depVarTextField" prefColumnCount="7" text="ws"/>
29+
<Label styleClass="d-symbol" text="" />
30+
<Label fx:id="totalOrdLabel" styleClass="order" />
31+
<TextField fx:id="depVarTextField" prefColumnCount="7" text="ws" />
3632
</HBox>
3733
<HBox alignment="CENTER" spacing="2.0">
38-
<Label styleClass="d-symbol" text=""/>
39-
<TextField fx:id="indVar0TextField" alignment="CENTER" onKeyTyped="#indVar1KeyTyped" prefColumnCount="1"
40-
text="x"/>
41-
<TextField fx:id="ord0TextField" alignment="CENTER" onKeyTyped="#indVar1KeyTyped" prefColumnCount="1"
42-
styleClass="order"/>
43-
<Label fx:id="d1Label" styleClass="d-symbol" text="" visible="false"/>
44-
<TextField fx:id="indVar1TextField" alignment="CENTER" onKeyTyped="#indVar2KeyTyped" prefColumnCount="1"/>
45-
<TextField fx:id="ord1TextField" alignment="CENTER" onKeyTyped="#indVar2KeyTyped" prefColumnCount="1"
46-
styleClass="order"/>
47-
<Label fx:id="d2Label" styleClass="d-symbol" text="" visible="false"/>
48-
<TextField fx:id="indVar2TextField" alignment="CENTER" onKeyTyped="#indVar3KeyTyped" prefColumnCount="1"/>
49-
<TextField fx:id="ord2TextField" alignment="CENTER" onKeyTyped="#indVar3KeyTyped" prefColumnCount="1"
50-
styleClass="order"/>
34+
<Label styleClass="d-symbol" text="" />
35+
<TextField fx:id="indVar0TextField" alignment="CENTER" onKeyTyped="#indVar1KeyTyped" prefColumnCount="1" text="x" />
36+
<TextField fx:id="ord0TextField" alignment="CENTER" onKeyTyped="#indVar1KeyTyped" prefColumnCount="1" styleClass="order" />
37+
<Label fx:id="d1Label" styleClass="d-symbol" text="" visible="false" />
38+
<TextField fx:id="indVar1TextField" alignment="CENTER" onKeyTyped="#indVar2KeyTyped" prefColumnCount="1" />
39+
<TextField fx:id="ord1TextField" alignment="CENTER" onKeyTyped="#indVar2KeyTyped" prefColumnCount="1" styleClass="order" />
40+
<Label fx:id="d2Label" styleClass="d-symbol" text="" visible="false" />
41+
<TextField fx:id="indVar2TextField" alignment="CENTER" onKeyTyped="#indVar3KeyTyped" prefColumnCount="1" />
42+
<TextField fx:id="ord2TextField" alignment="CENTER" onKeyTyped="#indVar3KeyTyped" prefColumnCount="1" styleClass="order" />
5143
</HBox>
5244
</VBox>
5345
</VBox>

src/fjwright/runreduce/templates/For.fxml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,17 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<?import java.lang.String?>
4-
<?import javafx.collections.FXCollections?>
5-
<?import javafx.geometry.Insets?>
6-
<?import javafx.scene.control.ChoiceBox?>
7-
<?import javafx.scene.control.Hyperlink?>
8-
<?import javafx.scene.control.Label?>
9-
<?import javafx.scene.control.Tab?>
10-
<?import javafx.scene.control.TabPane?>
11-
<?import javafx.scene.control.TextField?>
12-
<?import javafx.scene.control.Tooltip?>
13-
<?import javafx.scene.layout.AnchorPane?>
14-
<?import javafx.scene.layout.HBox?>
15-
<?import javafx.scene.layout.VBox?>
16-
<?import javafx.scene.text.Text?>
3+
<?import java.lang.*?>
4+
<?import javafx.collections.*?>
5+
<?import javafx.geometry.*?>
6+
<?import javafx.scene.control.*?>
7+
<?import javafx.scene.layout.*?>
8+
<?import javafx.scene.text.*?>
179

18-
<VBox fx:id="templateRoot" alignment="CENTER" prefWidth="500.0" spacing="20.0" stylesheets="@templates.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fjwright.runreduce.templates.For">
10+
<VBox fx:id="templateRoot" alignment="CENTER" prefWidth="600.0" spacing="20.0" stylesheets="@templates.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fjwright.runreduce.templates.For">
1911
<padding>
2012
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
2113
</padding>
22-
<Text fontSmoothingType="LCD" text="A 'var' entry must be an identifier. &#10;For iteration over a numerical range, the 'number' entries must *evaluate* to numbers. &#10;For iteration over a list, the 'list' entry must *evaluate* to a list; the 'on' option is allowed only in symbolic mode and makes the 'for variable' evaluate to successive 'cdr's of the list." textAlignment="CENTER" wrappingWidth="460.0" />
14+
<Text fontSmoothingType="LCD" text="A 'var' entry must be an identifier. &#10;For iteration over a numerical range, the 'number' entries must *evaluate* to numbers. &#10;For iteration over a list, the 'list' entry must *evaluate* to a list; the 'on' option is allowed only in symbolic mode and makes the 'for variable' evaluate to successive 'cdr's of the list." textAlignment="CENTER" wrappingWidth="560.0" />
2315
<HBox alignment="CENTER">
2416
<Label text="REDUCE Manual: " />
2517
<Hyperlink onAction="#redManHyperlinkOnAction" text="FOR Statements" userData="FOR Statements">
@@ -120,5 +112,8 @@
120112
<Insets top="5.0" />
121113
</padding>
122114
</HBox>
115+
<VBox.margin>
116+
<Insets left="50.0" right="50.0" />
117+
</VBox.margin>
123118
</VBox>
124119
</VBox>

src/fjwright/runreduce/templates/Integral.fxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<?import javafx.scene.text.*?>
77

88
<?import java.lang.Double?>
9-
<VBox fx:id="templateRoot" alignment="CENTER" prefWidth="500.0" spacing="20.0" stylesheets="@templates.css"
9+
<VBox fx:id="templateRoot" alignment="CENTER" prefWidth="600.0" spacing="20.0" stylesheets="@templates.css"
1010
xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1"
1111
fx:controller="fjwright.runreduce.templates.Integral">
1212
<padding>
@@ -15,7 +15,7 @@
1515
<VBox>
1616
<fx:define>
1717
<!-- This prevents use of SceneBuilder! -->
18-
<Double fx:id="textWrappingWidth" fx:value="460.0"/>
18+
<Double fx:id="textWrappingWidth" fx:value="560.0"/>
1919
</fx:define>
2020
<Text fontSmoothingType="LCD"
2121
text="The integrand and at least one integration variable are required. Enter additional integration variables to create a double or triple integral and display additional ∫ symbols. ∫ and d symbol pairs nest and their colours show how they match."

0 commit comments

Comments
 (0)