diff --git a/DroidFish/assets/ChessCases.ttf b/DroidFish/assets/fonts/ChessCases.ttf similarity index 100% rename from DroidFish/assets/ChessCases.ttf rename to DroidFish/assets/fonts/ChessCases.ttf diff --git a/DroidFish/res/values-de/strings.xml b/DroidFish/res/values-de/strings.xml index 3c92bb9..f99f24e 100644 --- a/DroidFish/res/values-de/strings.xml +++ b/DroidFish/res/values-de/strings.xml @@ -230,8 +230,8 @@ wenn Sie es nicht aktiv nutzen.\ Benutzeroberfläche Zuganimation Bewegung der Figuren animieren - Einzelberührung - Bei Berührung eines Feldes, von dem genau ein Zug möglich ist, diesen Zug sofort ausführen + Alternative Durchführung des Zuges + Die Reihenfolge der Auswahl für einen Zug (von bzw. nach) ist beliebig. Eindeutige Züge werden sofort durchgeführt. Töne Ton bei Computer-Zug ausgeben Vibration aktivieren @@ -303,6 +303,8 @@ wenn Sie es nicht aktiv nutzen.\ Kommentare Benutzerkommentare anzeigen Annotationen + Figuren + Festlegung, wie die Schach-Figuren notiert werden Annotationen (Numeric Annotation Glyphs, NAGs) anzeigen Partie-Informationen Partie-Informationen anzeigen @@ -338,6 +340,16 @@ wenn Sie es nicht aktiv nutzen.\ Modus-Taste Zurück-Taste Vorwärts-Taste + + Englische Buchstaben + Buchstaben der Landessprache + Darstellung als Figuren + + + 0 + 1 + 2 + Automatisch 1 diff --git a/DroidFish/res/values/strings.xml b/DroidFish/res/values/strings.xml index 9aa8332..61ac5c3 100644 --- a/DroidFish/res/values/strings.xml +++ b/DroidFish/res/values/strings.xml @@ -391,10 +391,12 @@ you are not actively using the program.\ English letters Local language letters + Figurine notation 0 1 + 2 16 MB diff --git a/DroidFish/src/org/petero/droidfish/ChessBoard.java b/DroidFish/src/org/petero/droidfish/ChessBoard.java index 7c849e3..ca8d71d 100644 --- a/DroidFish/src/org/petero/droidfish/ChessBoard.java +++ b/DroidFish/src/org/petero/droidfish/ChessBoard.java @@ -134,7 +134,7 @@ public class ChessBoard extends View { if (isInEditMode()) return; - Typeface chessFont = Typeface.createFromAsset(getContext().getAssets(), "ChessCases.ttf"); + Typeface chessFont = Typeface.createFromAsset(getContext().getAssets(), "fonts/ChessCases.ttf"); whitePiecePaint.setTypeface(chessFont); blackPiecePaint.setTypeface(chessFont); diff --git a/DroidFish/src/org/petero/droidfish/DroidFish.java b/DroidFish/src/org/petero/droidfish/DroidFish.java index f886b17..227c058 100644 --- a/DroidFish/src/org/petero/droidfish/DroidFish.java +++ b/DroidFish/src/org/petero/droidfish/DroidFish.java @@ -129,7 +129,6 @@ public class DroidFish extends Activity implements GUIInterface { // FIXME!!! Remove invalid playerActions in PGN import (should be done in verifyChildren) // FIXME!!! Implement bookmark mechanism for positions in pgn files // FIXME!!! Add support for "Chess Leipzig" font - // FIXME!!! Implement figurine notation // FIXME!!! Computer clock should stop if phone turned off (computer stops thinking if unplugged) // FIXME!!! Add support for all time controls defined by the PGN standard @@ -205,6 +204,11 @@ public class DroidFish extends Activity implements GUIInterface { private WakeLock wakeLock = null; private boolean useWakeLock = false; +// private Typeface figNotation; + private Typeface defaultMoveListTypeFace; + private Typeface defaultThinkingListTypeFace; + + /** Defines all configurable button actions. */ private ActionFactory actionFactory = new ActionFactory() { private HashMap actions; @@ -353,7 +357,7 @@ public class DroidFish extends Activity implements GUIInterface { custom3ButtonActions = new ButtonActions("custom3", CUSTOM3_BUTTON_DIALOG, R.string.select_action); - TextIO.setPieceNames(getString(R.string.piece_names)); + setPieceNames(PGNOptions.PT_LOCAL); initUI(true); gameTextListener = new PgnScreenText(pgnOptions); @@ -389,6 +393,15 @@ public class DroidFish extends Activity implements GUIInterface { } } + private final void setPieceNames(int pieceType) { + if (pieceType == PGNOptions.PT_FIGURINE) { + // Unicode code points for chess pieces + TextIO.setPieceNames("\u2659 \u2658 \u2657 \u2656 \u2655 \u2654"); + } else { + TextIO.setPieceNames(getString(R.string.piece_names)); + } + } + /** Create directory structure on SD card. */ private void createDirectories() { File extDir = Environment.getExternalStorageDirectory(); @@ -499,7 +512,9 @@ public class DroidFish extends Activity implements GUIInterface { status = (TextView)findViewById(R.id.status); moveListScroll = (ScrollView)findViewById(R.id.scrollView); moveList = (TextView)findViewById(R.id.moveList); + defaultMoveListTypeFace = moveList.getTypeface(); thinking = (TextView)findViewById(R.id.thinking); + defaultThinkingListTypeFace = thinking.getTypeface(); status.setFocusable(false); moveListScroll.setFocusable(false); moveList.setFocusable(false); @@ -770,6 +785,7 @@ public class DroidFish extends Activity implements GUIInterface { setWakeLock(useWakeLock); int fontSize = getIntSetting("fontSize", 12); +// figNotation = Typeface.createFromAsset(getAssets(), "fonts/DroidFishChessNotationDark.otf"); status.setTextSize(fontSize); moveList.setTextSize(fontSize); thinking.setTextSize(fontSize); @@ -825,7 +841,28 @@ public class DroidFish extends Activity implements GUIInterface { cb.setColors(); gameTextListener.clear(); + setPieceNames(pgnOptions.view.pieceType); ctrl.prefsChanged(oldViewPieceType != pgnOptions.view.pieceType); + // update the typeset in case of a change anyway, cause it could occur + // as well in rotation + setFigurineNotation(pgnOptions.view.pieceType == PGNOptions.PT_FIGURINE, fontSize); + } + + /** + * Change the Pieces into figurine or regular (i.e. letters) display + */ + private void setFigurineNotation(boolean displayAsFigures, int fontSize) { +/* if (displayAsFigures) { + // increase the font cause it has different kerning and looks small + float increaseFontSize = fontSize * 1.1f; + moveList.setTypeface(figNotation); + moveList.setTextSize(increaseFontSize); + thinking.setTypeface(figNotation); + thinking.setTextSize(increaseFontSize); + } else { */ + moveList.setTypeface(defaultMoveListTypeFace); + thinking.setTypeface(defaultThinkingListTypeFace); +// } } private void updateButtons() { diff --git a/DroidFish/src/org/petero/droidfish/PGNOptions.java b/DroidFish/src/org/petero/droidfish/PGNOptions.java index 5577103..1b8f962 100644 --- a/DroidFish/src/org/petero/droidfish/PGNOptions.java +++ b/DroidFish/src/org/petero/droidfish/PGNOptions.java @@ -20,8 +20,13 @@ package org.petero.droidfish; /** Settings controlling PGN import/export */ public class PGNOptions { - public static final int PT_ENGLISH = 0; // Piece type english letters - public static final int PT_LOCAL = 1; // Piece type local language letters + /** Pieces displayed as english letters. */ + public static final int PT_ENGLISH = 0; + /** Pieces displayed as local language letters. */ + public static final int PT_LOCAL = 1; + /** Piece displayed in figurine notation, by using the english piece-names + * and a special font. */ + public static final int PT_FIGURINE = 2; public static class Viewer { public boolean variations; diff --git a/DroidFish/src/org/petero/droidfish/gamelogic/DroidChessController.java b/DroidFish/src/org/petero/droidfish/gamelogic/DroidChessController.java index 3e50d74..38b949d 100644 --- a/DroidFish/src/org/petero/droidfish/gamelogic/DroidChessController.java +++ b/DroidFish/src/org/petero/droidfish/gamelogic/DroidChessController.java @@ -587,7 +587,14 @@ public class DroidChessController { /** Return true if localized piece names should be used. */ private final boolean localPt() { - return pgnOptions.view.pieceType == PGNOptions.PT_LOCAL; + switch (pgnOptions.view.pieceType) { + case PGNOptions.PT_ENGLISH: + return false; + case PGNOptions.PT_LOCAL: + case PGNOptions.PT_FIGURINE: + default: + return true; + } } /** Engine search information receiver. */ diff --git a/DroidFish/src/org/petero/droidfish/gamelogic/GameTree.java b/DroidFish/src/org/petero/droidfish/gamelogic/GameTree.java index 3fd346c..772ca52 100644 --- a/DroidFish/src/org/petero/droidfish/gamelogic/GameTree.java +++ b/DroidFish/src/org/petero/droidfish/gamelogic/GameTree.java @@ -1188,12 +1188,12 @@ public class GameTree { } } String str; - if (options.exp.pieceType == PGNOptions.PT_LOCAL) { - str = moveStrLocal; - } else { + if (options.exp.pieceType == PGNOptions.PT_ENGLISH) { str = moveStr; if (options.exp.pgnPromotions && (move != null) && (move.promoteTo != Piece.EMPTY)) str = TextIO.pgnPromotion(str); + } else { + str = moveStrLocal; } out.processToken(this, PgnToken.SYMBOL, str); needMoveNr = false;