mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-18 01:14:42 -04:00
Avoid opening a file if tutorial is started.
This commit is contained in:
parent
736c9323cf
commit
1c1b3ef687
@ -182,16 +182,18 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
||||
|
||||
circuitComponent = new CircuitComponent(this, library, shapeFactory);
|
||||
circuitComponent.addListener(this);
|
||||
if (builder.circuit != null) {
|
||||
SwingUtilities.invokeLater(() -> circuitComponent.setCircuit(builder.circuit));
|
||||
setFilename(builder.fileToOpen, false);
|
||||
} else {
|
||||
if (builder.fileToOpen != null) {
|
||||
SwingUtilities.invokeLater(() -> loadFile(builder.fileToOpen, builder.library == null, builder.library == null));
|
||||
if (!builder.dontOpenFile) {
|
||||
if (builder.circuit != null) {
|
||||
SwingUtilities.invokeLater(() -> circuitComponent.setCircuit(builder.circuit));
|
||||
setFilename(builder.fileToOpen, false);
|
||||
} else {
|
||||
File name = fileHistory.getMostRecent();
|
||||
if (name != null) {
|
||||
SwingUtilities.invokeLater(() -> loadFile(name, true, false));
|
||||
if (builder.fileToOpen != null) {
|
||||
SwingUtilities.invokeLater(() -> loadFile(builder.fileToOpen, builder.library == null, builder.library == null));
|
||||
} else {
|
||||
File name = fileHistory.getMostRecent();
|
||||
if (name != null) {
|
||||
SwingUtilities.invokeLater(() -> loadFile(name, true, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1830,6 +1832,10 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
||||
if (file != null)
|
||||
builder.setFileToOpen(file);
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
final boolean tutorial = Settings.getInstance().getAttributes().get(Keys.SETTINGS_SHOW_TUTORIAL);
|
||||
if (tutorial)
|
||||
builder.setDontOpenAFile(true);
|
||||
|
||||
Main main = builder.build();
|
||||
try {
|
||||
new RemoteSever(new DigitalHandler(main)).start(41114);
|
||||
@ -1838,7 +1844,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
||||
}
|
||||
main.setVisible(true);
|
||||
|
||||
if (Settings.getInstance().getAttributes().get(Keys.SETTINGS_SHOW_TUTORIAL))
|
||||
if (tutorial)
|
||||
new InitialTutorial(main).setVisible(true);
|
||||
|
||||
CheckForNewRelease.showReleaseDialog(main);
|
||||
@ -1858,6 +1864,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
||||
private File baseFileName;
|
||||
private boolean keepPrefMainFile;
|
||||
private boolean mainFrame = false;
|
||||
private boolean dontOpenFile =false;
|
||||
|
||||
/**
|
||||
* @param fileToOpen the file to open
|
||||
@ -1925,6 +1932,14 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoids to open a file
|
||||
* @param dontOpenFile true if no file should be opened
|
||||
*/
|
||||
public void setDontOpenAFile(boolean dontOpenFile) {
|
||||
this.dontOpenFile = dontOpenFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Main instance
|
||||
*
|
||||
|
@ -1999,7 +1999,7 @@ Daher steht auch das Signal 'D_out' zur Verfügung, um in diesem Fall den Wert z
|
||||
<string name="tutorial10">
|
||||
Der Vollständigkeit halber sollen die Ein- und Ausgänge benannt werden.
|
||||
|
||||
Durch Rechts-Klick auf einen Einsgang öffnet sich ein Dialog (Unter MacOS wird
|
||||
Durch Rechts-Klick auf einen Eingang öffnet sich ein Dialog (Unter MacOS wird
|
||||
Controll-Klick verwendet). Hier kann der Eingang mit einer Bezeichnung versehen werden.
|
||||
</string>
|
||||
<string name="tutorial11">
|
||||
|
Loading…
x
Reference in New Issue
Block a user