Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next: Allow config show coordinates in the config.txt #419

Merged
merged 2 commits into from
Nov 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/main/java/featurecat/lizzie/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class Config {
public boolean showCaptured = true;
public boolean handicapInsteadOfWinrate = false;
public boolean showDynamicKomi = true;
public boolean showCoordinates = false;

public boolean showStatus = true;
public boolean showBranch = true;
Expand Down Expand Up @@ -172,6 +173,7 @@ public Config() throws IOException {
startMaximized = uiConfig.getBoolean("window-maximized");
showDynamicKomi = uiConfig.getBoolean("show-dynamic-komi");
appendWinrateToComment = uiConfig.optBoolean("append-winrate-to-comment");
showCoordinates = uiConfig.optBoolean("show-coordinates");

winrateStrokeWidth = theme.winrateStrokeWidth();
minimumBlunderBarWidth = theme.minimumBlunderBarWidth();
Expand Down Expand Up @@ -271,6 +273,10 @@ public void toggleLargeSubBoard() {
this.largeSubBoard = !this.largeSubBoard;
}

public void toggleCoordinates() {
showCoordinates = !showCoordinates;
}

public boolean showLargeSubBoard() {
return showSubBoard && largeSubBoard;
}
Expand Down Expand Up @@ -358,10 +364,6 @@ private JSONObject createDefaultConfig() {
ui.put("window-maximized", false);
ui.put("show-dynamic-komi", true);
ui.put("min-playout-ratio-for-stats", 0.0);
ui.put("blunder-winrate-thresholds", "[-30,-20,-10,-5,5,10]");
ui.put("blunder-node-colors", "[[255,0,0],[0,255,0],[0,0,255],[255,255,0],[0,255,255],[255,0,255]]");
ui.put("comment-node-color", "[0,0,255,255]");

config.put("ui", ui);
return config;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/featurecat/lizzie/gui/BoardRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ public boolean isInside(int x1, int y1) {
}

private boolean showCoordinates() {
return isMainBoard && Lizzie.frame.showCoordinates;
return isMainBoard && Lizzie.config.showCoordinates;
}

public void increaseMaxAlpha(int k) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/featurecat/lizzie/gui/Input.java
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ public void keyPressed(KeyEvent e) {
if (controlIsPressed(e)) {
Lizzie.frame.copySgf();
} else {
Lizzie.frame.toggleCoordinates();
Lizzie.config.toggleCoordinates();
}
break;

Expand Down
5 changes: 0 additions & 5 deletions src/main/java/featurecat/lizzie/gui/LizzieFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public class LizzieFrame extends JFrame {
private static final int[] outOfBoundCoordinate = new int[] {-1, -1};
public int[] mouseOverCoordinate = outOfBoundCoordinate;
public boolean showControls = false;
public boolean showCoordinates = false;
public boolean isPlayingAgainstLeelaz = false;
public boolean playerIsBlack = true;
public int winRateGridLines = 3;
Expand Down Expand Up @@ -1282,10 +1281,6 @@ private void autosaveMaybe() {
}
}

public void toggleCoordinates() {
showCoordinates = !showCoordinates;
}

public void setPlayers(String whitePlayer, String blackPlayer) {
playerTitle = String.format("(%s [W] vs %s [B])", whitePlayer, blackPlayer);
updateTitle();
Expand Down