Skip to content

Commit

Permalink
Merge fix for featurecat#885
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiraoka committed Jul 10, 2021
2 parents b04bb29 + 9362875 commit d403892
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/main/java/featurecat/lizzie/Lizzie.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static void shutdown() {
if (config.config.getJSONObject("ui").getBoolean("confirm-exit")) {
int ret =
JOptionPane.showConfirmDialog(
null, "Do you want to save this SGF?", "Save SGF?", JOptionPane.OK_CANCEL_OPTION);
frame, "Do you want to save this SGF?", "Save SGF?", JOptionPane.OK_CANCEL_OPTION);
if (ret == JOptionPane.OK_OPTION) {
frame.saveFile();
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/featurecat/lizzie/analysis/YaZenGtp.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void startEngine(String engineCommand, int index) {
process = processBuilder.start();
} catch (IOException e) {
// TODO Auto-generated catch block
Utils.showMessageDialog(null, resourceBundle.getString("YaZenGtp.nofile"));
Utils.showMessageDialog(Lizzie.frame, resourceBundle.getString("YaZenGtp.nofile"));
return;
}
initializeStreams();
Expand Down Expand Up @@ -99,7 +99,7 @@ private void parseLine(String line) {
}

if (line.startsWith("Throw")) {
Utils.showMessageDialog(null, resourceBundle.getString("YaZenGtp.nofile"));
Utils.showMessageDialog(Lizzie.frame, resourceBundle.getString("YaZenGtp.nofile"));
shutdown();
}
if (line.startsWith(" ")) {
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/featurecat/lizzie/gui/BoardPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -531,14 +531,14 @@ public void replayBranch(boolean generateGif) {
chooser.setAcceptAllFileFilterUsed(false);
chooser.setFileFilter(filter);
chooser.setMultiSelectionEnabled(false);
int result = chooser.showSaveDialog(null);
int result = chooser.showSaveDialog(Lizzie.frame);
if (result == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
filesystem.put("last-image-folder", file.getParent());
if (file.exists()) {
int ret =
JOptionPane.showConfirmDialog(
null,
Lizzie.frame,
resourceBundle.getString("LizzieFrame.prompt.fileExists"),
"Warning",
JOptionPane.OK_CANCEL_OPTION);
Expand Down Expand Up @@ -620,7 +620,7 @@ public void saveImage() {
chooser.addChoosableFileFilter(filter3);
chooser.addChoosableFileFilter(filter4);
chooser.setMultiSelectionEnabled(false);
int result = chooser.showSaveDialog(null);
int result = chooser.showSaveDialog(Lizzie.frame);
if (result == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
filesystem.put("last-image-folder", file.getParent());
Expand All @@ -636,7 +636,7 @@ public void saveImage() {
if (file.exists()) {
int ret =
JOptionPane.showConfirmDialog(
null,
Lizzie.frame,
resourceBundle.getString("LizzieFrame.prompt.fileExists"),
"Warning",
JOptionPane.OK_CANCEL_OPTION);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/featurecat/lizzie/gui/LizzieDialog.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package featurecat.lizzie.gui;

import featurecat.lizzie.Lizzie;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.Window;
Expand All @@ -12,7 +13,7 @@ public class LizzieDialog extends JDialog {
private String osName;

public LizzieDialog() {
super();
super(Lizzie.frame); // Set owner for dual monitors. (#885)
setOsName();
}

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/featurecat/lizzie/gui/MainFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public void editComment() {
textArea.setSize(textArea.getPreferredSize().width, textArea.getPreferredSize().height);
int ret =
JOptionPane.showConfirmDialog(
null, new JScrollPane(textArea), "Comment", JOptionPane.OK_CANCEL_OPTION);
this, new JScrollPane(textArea), "Comment", JOptionPane.OK_CANCEL_OPTION);
if (ret == JOptionPane.OK_OPTION) {
Lizzie.board.getHistory().getData().comment = textArea.getText();
refresh();
Expand Down Expand Up @@ -396,7 +396,7 @@ public void saveFile() {
JFileChooser chooser = new JFileChooser(filesystem.getString("last-folder"));
chooser.setFileFilter(filter);
chooser.setMultiSelectionEnabled(false);
int result = chooser.showSaveDialog(null);
int result = chooser.showSaveDialog(this);
if (result == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
if (!(file.getPath().endsWith(".sgf") || file.getPath().endsWith(".SGF"))) {
Expand All @@ -405,7 +405,7 @@ public void saveFile() {
if (file.exists()) {
int ret =
JOptionPane.showConfirmDialog(
null,
this,
resourceBundle.getString("LizzieFrame.prompt.sgfExists"),
"Warning",
JOptionPane.OK_CANCEL_OPTION);
Expand All @@ -420,7 +420,7 @@ public void saveFile() {
}
} catch (IOException err) {
JOptionPane.showConfirmDialog(
null,
this,
resourceBundle.getString("LizzieFrame.prompt.failedTosaveFile"),
"Error",
JOptionPane.ERROR);
Expand Down Expand Up @@ -461,7 +461,7 @@ public void loadFile(File file) {
}
} catch (IOException err) {
JOptionPane.showConfirmDialog(
null,
this,
resourceBundle.getString("LizzieFrame.prompt.failedToOpenFile"),
"Error",
JOptionPane.ERROR);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/featurecat/lizzie/rules/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ public void deleteMove() {
// Will delete more than one move, ask for confirmation
int ret =
JOptionPane.showConfirmDialog(
null,
Lizzie.frame,
"This will delete all moves and branches after this move",
"Delete",
JOptionPane.OK_CANCEL_OPTION);
Expand Down Expand Up @@ -1395,12 +1395,12 @@ public void toggleAnalysis() {
analysisMode = false;
} else {
if (!getNextMove().isPresent()) {
JOptionPane.showMessageDialog(null, "No next move.");
JOptionPane.showMessageDialog(Lizzie.frame, "No next move.");
return;
}
String answer =
JOptionPane.showInputDialog(
"# playouts for analysis (e.g. 100 (fast) or 50000 (slow)): ");
Lizzie.frame, "# playouts for analysis (e.g. 100 (fast) or 50000 (slow)): ");
try {
playoutsAnalysis = Integer.parseInt(answer);
} catch (NumberFormatException err) {
Expand Down

0 comments on commit d403892

Please sign in to comment.