Skip to content

Commit c72e23a

Browse files
committed
v2.45 Maintain a list of REDUCE panels and use it to update all REDUCE panels when the colour choices are saved, making the colour choices global.
1 parent 4ca4ea2 commit c72e23a

5 files changed

Lines changed: 59 additions & 49 deletions

File tree

docs/UserGuide.html

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -630,14 +630,13 @@ <h2 id="ViewMenu">The View Menu</h2>
630630
<h3>Font Size...</h3>
631631
<p>This displays a dialogue that allows you to change the font
632632
size used in the <em>Input/Output Display</em> and <em>Input
633-
Editor</em> panes. It applies to each REDUCE panel independently.
633+
Editor</em> panes. Font size applies to each REDUCE panel
634+
independently.
634635
</p>
635636
<h3>Font Colours...</h3>
636637
<p>This displays a dialogue that allows you to change the colours
637-
used in the <em>Input/Output Display</em> pane. Currently, it
638-
applies to the REDUCE panel selected when you click on
639-
the <em>Save</em> button (but this is not consistent with other
640-
options and may change in a future release).
638+
used in the <em>Input/Output Display</em> pane. Font colours
639+
apply to all REDUCE panels together.
641640
</p>
642641
<p>The colours that you can select are the foreground text colours
643642
for algebraic and symbolic mode input and output, and the
@@ -660,18 +659,20 @@ <h3>Font Colours...</h3>
660659
unless you click on the <em>Save</em> button.
661660
</p>
662661
<h3>Bold Prompts</h3>
663-
<p>Selecting this item causes Run-REDUCE to embolden the
664-
display of all input prompts. It applies to each REDUCE panel independently.
662+
<p>Selecting this item causes Run-REDUCE to embolden the display
663+
of all input prompts. Bold prompts apply to each REDUCE panel
664+
independently.
665665
</p>
666666
<h3>I/O Colouring</h3>
667667
<p>Selecting this item causes Run-REDUCE to colour the text in
668-
the <em>Input/Output Display</em> pane. The colouring depends on
669-
REDUCE's current input mode: by default, algebraic-mode prompts
670-
and input are red, algebraic-mode output is blue, symbolic-mode
671-
prompts and input are green, symbolic-mode output is brown.
672-
Echoed file input is not coloured. By default, Run-REDUCE
673-
highlights warnings and errors with quarter-opaque orange and red
674-
background colours.
668+
the <em>Input/Output Display</em> pane. I/O colouring applies to
669+
each REDUCE panel independently (although the colour choices apply
670+
to all REDUCE panels together). The colouring depends on REDUCE's
671+
current input mode: by default, algebraic-mode prompts and input
672+
are red, algebraic-mode output is blue, symbolic-mode prompts and
673+
input are green, symbolic-mode output is brown. Echoed file input
674+
is not coloured. By default, Run-REDUCE highlights warnings and
675+
errors with quarter-opaque orange and red background colours.
675676
</p>
676677
<p>Note that turning I/O colouring on does not fully take effect
677678
until the next input prompt. Turning I/O colouring off takes
@@ -685,15 +686,15 @@ <h3>I/O Colouring</h3>
685686
<h3>Typeset Maths</h3>
686687
<p>Selecting this item causes Run-REDUCE to display algebraic-mode
687688
mathematical output more-or-less as it would be typeset, and
688-
centred horizontally. It applies to each REDUCE panel
689-
independently. Output display will be significantly faster when
690-
Typeset Maths is turned off. <strong>WARNINGS:</strong> Typeset
691-
Maths is currently experimental and line breaking is somewhat
692-
arbitrary. The display may be incorrect in some cases,
693-
e.g. with unusual switch settings such as <em>on list</em>. If
694-
any LaTeX markup appears (coloured red) in the output then
695-
please let me know! <em>Save Session Log...</em> outputs
696-
typeset maths using LaTeX markup.
689+
centred horizontally. Typeset maths applies to each REDUCE
690+
panel independently. Output display will be significantly
691+
faster when Typeset Maths is turned
692+
off. <strong>WARNINGS:</strong> Typeset Maths is currently
693+
experimental and line breaking is somewhat arbitrary. The
694+
display may be incorrect in some cases, e.g. with unusual switch
695+
settings such as <em>on list</em>. If any LaTeX markup appears
696+
(coloured red) in the output then please let me know! <em>Save
697+
Session Log...</em> outputs typeset maths using LaTeX markup.
697698
</p>
698699
<h3>Single Pane Display</h3>
699700
<p>Selecting this causes Run-REDUCE to display the selected

src/fjwright/runreduce/REDUCEConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class FontColors {
121121
* Save colours as preferences.
122122
*/
123123
static void save() {
124-
RunREDUCE.reducePanel.updateFontColours();
124+
for (var reducePanel : RunREDUCE.reducePanelList) reducePanel.updateFontColours();
125125
Preferences prefs = RRPreferences.prefs.node(FONT_COLORS);
126126
prefs.put(ALGEBRAIC_INPUT, algebraicInput);
127127
prefs.put(SYMBOLIC_INPUT, symbolicInput);

src/fjwright/runreduce/RunREDUCE.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
import javafx.stage.Screen;
2929
import javafx.stage.Stage;
3030

31+
import java.util.ArrayList;
3132
import java.util.Arrays;
33+
import java.util.List;
3234

3335
/**
3436
* This is the main class that sets up and runs the application.
@@ -40,6 +42,7 @@ public class RunREDUCE extends Application {
4042
static TabPane tabPane;
4143
static int tabLabelNumber = 1;
4244
public static REDUCEPanel reducePanel; // the REDUCEPanel with current focus
45+
static List<REDUCEPanel> reducePanelList = new ArrayList<>();
4346

4447
// Set the main window to 2/3 the linear dimension of the screen initially:
4548
static final Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
@@ -84,6 +87,7 @@ public void start(Stage primaryStage) throws Exception {
8487
if (debugPlatform) System.err.println("reduceFont: " + reduceFont.toString());
8588

8689
reducePanel = new REDUCEPanel();
90+
reducePanelList.add(reducePanel);
8791
switch (RRPreferences.displayPane) {
8892
case SINGLE:
8993
runREDUCEFrame.frame.setCenter(reducePanel);
@@ -101,6 +105,7 @@ public void start(Stage primaryStage) throws Exception {
101105
static void useSplitPane(boolean enable, boolean startup) {
102106
if (enable) {
103107
REDUCEPanel reducePanel2 = new REDUCEPanel();
108+
reducePanelList.add(reducePanel2);
104109
splitPane = new SplitPane(reducePanel, reducePanel2);
105110
splitPane.setDividerPositions(0.5);
106111
runREDUCEFrame.frame.setCenter(splitPane);
@@ -116,6 +121,7 @@ static void useSplitPane(boolean enable, boolean startup) {
116121
reducePanel.inputTextArea.requestFocus();
117122
}
118123
} else { // Revert to single pane.
124+
reducePanelList.removeIf(x -> x != reducePanel);
119125
splitPane = null; // release resources
120126
reducePanel.removeEventFilter(MouseEvent.MOUSE_CLICKED, RunREDUCE::useSplitPaneMouseClicked);
121127
// Retain the reducePanel from the selected tab:
@@ -152,6 +158,7 @@ static void useTabPane(boolean enable) {
152158
Platform.runLater(() -> reducePanel.inputTextArea.requestFocus());
153159
}
154160
} else { // Revert to single pane.
161+
reducePanelList.removeIf(x -> x != reducePanel);
155162
tabPane = null; // release resources
156163
// Retain the reducePanel from the selected tab:
157164
runREDUCEFrame.frame.setCenter(reducePanel);
@@ -160,6 +167,7 @@ static void useTabPane(boolean enable) {
160167

161168
static void addTab() {
162169
Tab tab = new Tab("Tab " + (++tabLabelNumber), reducePanel = new REDUCEPanel());
170+
reducePanelList.add(reducePanel);
163171
tab.setOnSelectionChanged(RunREDUCE::tabOnSelectionChanged);
164172
tab.setOnClosed(RunREDUCE::tabOnClosed);
165173
tabPane.getTabs().add(tab);
@@ -184,7 +192,7 @@ private static void tabOnClosed(Event event) {
184192
RRPreferences.save(RRPreferences.DISPLAYPANE, RRPreferences.DisplayPane.SINGLE);
185193
runREDUCEFrame.singlePaneRadioButton.setSelected(true);
186194
runREDUCEFrame.addTabMenuItem.setDisable(true);
187-
}
195+
} else reducePanelList.remove(((Tab) event.getSource()).getContent());
188196
}
189197

190198
/**

src/fjwright/runreduce/RunREDUCEFrame.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ private void sourceForgeMenuItemAction() {
660660
RunREDUCE.hostServices.showDocument("https://sourceforge.net/projects/reduce-algebra/");
661661
}
662662

663-
static final String VERSION = "2.44";
663+
static final String VERSION = "2.45";
664664

665665
@FXML
666666
private void aboutMenuItemAction() {

src/fjwright/runreduce/UserGuide.html

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -630,14 +630,13 @@ <h2 id="ViewMenu">The View Menu</h2>
630630
<h3>Font Size...</h3>
631631
<p>This displays a dialogue that allows you to change the font
632632
size used in the <em>Input/Output Display</em> and <em>Input
633-
Editor</em> panes. It applies to each REDUCE panel independently.
633+
Editor</em> panes. Font size applies to each REDUCE panel
634+
independently.
634635
</p>
635636
<h3>Font Colours...</h3>
636637
<p>This displays a dialogue that allows you to change the colours
637-
used in the <em>Input/Output Display</em> pane. Currently, it
638-
applies to the REDUCE panel selected when you click on
639-
the <em>Save</em> button (but this is not consistent with other
640-
options and may change in a future release).
638+
used in the <em>Input/Output Display</em> pane. Font colours
639+
apply to all REDUCE panels together.
641640
</p>
642641
<p>The colours that you can select are the foreground text colours
643642
for algebraic and symbolic mode input and output, and the
@@ -660,18 +659,20 @@ <h3>Font Colours...</h3>
660659
unless you click on the <em>Save</em> button.
661660
</p>
662661
<h3>Bold Prompts</h3>
663-
<p>Selecting this item causes Run-REDUCE to embolden the
664-
display of all input prompts. It applies to each REDUCE panel independently.
662+
<p>Selecting this item causes Run-REDUCE to embolden the display
663+
of all input prompts. Bold prompts apply to each REDUCE panel
664+
independently.
665665
</p>
666666
<h3>I/O Colouring</h3>
667667
<p>Selecting this item causes Run-REDUCE to colour the text in
668-
the <em>Input/Output Display</em> pane. The colouring depends on
669-
REDUCE's current input mode: by default, algebraic-mode prompts
670-
and input are red, algebraic-mode output is blue, symbolic-mode
671-
prompts and input are green, symbolic-mode output is brown.
672-
Echoed file input is not coloured. By default, Run-REDUCE
673-
highlights warnings and errors with quarter-opaque orange and red
674-
background colours.
668+
the <em>Input/Output Display</em> pane. I/O colouring applies to
669+
each REDUCE panel independently (although the colour choices apply
670+
to all REDUCE panels together). The colouring depends on REDUCE's
671+
current input mode: by default, algebraic-mode prompts and input
672+
are red, algebraic-mode output is blue, symbolic-mode prompts and
673+
input are green, symbolic-mode output is brown. Echoed file input
674+
is not coloured. By default, Run-REDUCE highlights warnings and
675+
errors with quarter-opaque orange and red background colours.
675676
</p>
676677
<p>Note that turning I/O colouring on does not fully take effect
677678
until the next input prompt. Turning I/O colouring off takes
@@ -685,15 +686,15 @@ <h3>I/O Colouring</h3>
685686
<h3>Typeset Maths</h3>
686687
<p>Selecting this item causes Run-REDUCE to display algebraic-mode
687688
mathematical output more-or-less as it would be typeset, and
688-
centred horizontally. It applies to each REDUCE panel
689-
independently. Output display will be significantly faster when
690-
Typeset Maths is turned off. <strong>WARNINGS:</strong> Typeset
691-
Maths is currently experimental and line breaking is somewhat
692-
arbitrary. The display may be incorrect in some cases,
693-
e.g. with unusual switch settings such as <em>on list</em>. If
694-
any LaTeX markup appears (coloured red) in the output then
695-
please let me know! <em>Save Session Log...</em> outputs
696-
typeset maths using LaTeX markup.
689+
centred horizontally. Typeset maths applies to each REDUCE
690+
panel independently. Output display will be significantly
691+
faster when Typeset Maths is turned
692+
off. <strong>WARNINGS:</strong> Typeset Maths is currently
693+
experimental and line breaking is somewhat arbitrary. The
694+
display may be incorrect in some cases, e.g. with unusual switch
695+
settings such as <em>on list</em>. If any LaTeX markup appears
696+
(coloured red) in the output then please let me know! <em>Save
697+
Session Log...</em> outputs typeset maths using LaTeX markup.
697698
</p>
698699
<h3>Single Pane Display</h3>
699700
<p>Selecting this causes Run-REDUCE to display the selected

0 commit comments

Comments
 (0)