mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-12-19 04:02:23 +01:00
DroidFish: Preliminary support for figurine chess notation. From Leo Mayer, with some small changes by me.
This commit is contained in:
@@ -230,8 +230,8 @@ wenn Sie es nicht aktiv nutzen.\
|
|||||||
<string name="prefs_user_interface">Benutzeroberfläche</string>
|
<string name="prefs_user_interface">Benutzeroberfläche</string>
|
||||||
<string name="prefs_animateMoves_title">Zuganimation</string>
|
<string name="prefs_animateMoves_title">Zuganimation</string>
|
||||||
<string name="prefs_animateMoves_summary">Bewegung der Figuren animieren</string>
|
<string name="prefs_animateMoves_summary">Bewegung der Figuren animieren</string>
|
||||||
<string name="prefs_oneTouchMoves_title">Einzelberührung</string>
|
<string name="prefs_quickMoveInput_title">Alternative Durchführung des Zuges</string>
|
||||||
<string name="prefs_oneTouchMoves_summary">Bei Berührung eines Feldes, von dem genau ein Zug möglich ist, diesen Zug sofort ausführen</string>
|
<string name="prefs_quickMoveInput_summary">Die Reihenfolge der Auswahl für einen Zug (von bzw. nach) ist beliebig. Eindeutige Züge werden sofort durchgeführt.</string>
|
||||||
<string name="prefs_soundEnabled_title">Töne</string>
|
<string name="prefs_soundEnabled_title">Töne</string>
|
||||||
<string name="prefs_soundEnabled_summary">Ton bei Computer-Zug ausgeben</string>
|
<string name="prefs_soundEnabled_summary">Ton bei Computer-Zug ausgeben</string>
|
||||||
<string name="prefs_vibrateEnabled_title">Vibration aktivieren</string>
|
<string name="prefs_vibrateEnabled_title">Vibration aktivieren</string>
|
||||||
@@ -303,6 +303,8 @@ wenn Sie es nicht aktiv nutzen.\
|
|||||||
<string name="prefs_viewComments_title">Kommentare</string>
|
<string name="prefs_viewComments_title">Kommentare</string>
|
||||||
<string name="prefs_viewComments_summary">Benutzerkommentare anzeigen</string>
|
<string name="prefs_viewComments_summary">Benutzerkommentare anzeigen</string>
|
||||||
<string name="prefs_viewNAG_title">Annotationen</string>
|
<string name="prefs_viewNAG_title">Annotationen</string>
|
||||||
|
<string name="prefs_viewPieceType_title">Figuren</string>
|
||||||
|
<string name="prefs_viewPieceType_summary">Festlegung, wie die Schach-Figuren notiert werden</string>
|
||||||
<string name="prefs_viewNAG_summary">Annotationen (Numeric Annotation Glyphs, NAGs) anzeigen</string>
|
<string name="prefs_viewNAG_summary">Annotationen (Numeric Annotation Glyphs, NAGs) anzeigen</string>
|
||||||
<string name="prefs_viewHeaders_title">Partie-Informationen</string>
|
<string name="prefs_viewHeaders_title">Partie-Informationen</string>
|
||||||
<string name="prefs_viewHeaders_summary">Partie-Informationen anzeigen</string>
|
<string name="prefs_viewHeaders_summary">Partie-Informationen anzeigen</string>
|
||||||
@@ -338,6 +340,16 @@ wenn Sie es nicht aktiv nutzen.\
|
|||||||
<string name="buttonDesc_mode">Modus-Taste</string>
|
<string name="buttonDesc_mode">Modus-Taste</string>
|
||||||
<string name="buttonDesc_back">Zurück-Taste</string>
|
<string name="buttonDesc_back">Zurück-Taste</string>
|
||||||
<string name="buttonDesc_forward">Vorwärts-Taste</string>
|
<string name="buttonDesc_forward">Vorwärts-Taste</string>
|
||||||
|
<string-array name="viewPieceType_texts">
|
||||||
|
<item>Englische Buchstaben</item>
|
||||||
|
<item>Buchstaben der Landessprache</item>
|
||||||
|
<item>Darstellung als Figuren</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="viewPieceType_values">
|
||||||
|
<item>0</item>
|
||||||
|
<item>1</item>
|
||||||
|
<item>2</item>
|
||||||
|
</string-array>
|
||||||
<string-array name="engine_threads_texts">
|
<string-array name="engine_threads_texts">
|
||||||
<item>Automatisch</item>
|
<item>Automatisch</item>
|
||||||
<item>1</item>
|
<item>1</item>
|
||||||
|
|||||||
@@ -391,10 +391,12 @@ you are not actively using the program.\
|
|||||||
<string-array name="viewPieceType_texts">
|
<string-array name="viewPieceType_texts">
|
||||||
<item>English letters</item>
|
<item>English letters</item>
|
||||||
<item>Local language letters</item>
|
<item>Local language letters</item>
|
||||||
|
<item>Figurine notation</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="viewPieceType_values">
|
<string-array name="viewPieceType_values">
|
||||||
<item>0</item>
|
<item>0</item>
|
||||||
<item>1</item>
|
<item>1</item>
|
||||||
|
<item>2</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="engine_hash_texts">
|
<string-array name="engine_hash_texts">
|
||||||
<item>16 MB</item>
|
<item>16 MB</item>
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ public class ChessBoard extends View {
|
|||||||
if (isInEditMode())
|
if (isInEditMode())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Typeface chessFont = Typeface.createFromAsset(getContext().getAssets(), "ChessCases.ttf");
|
Typeface chessFont = Typeface.createFromAsset(getContext().getAssets(), "fonts/ChessCases.ttf");
|
||||||
whitePiecePaint.setTypeface(chessFont);
|
whitePiecePaint.setTypeface(chessFont);
|
||||||
blackPiecePaint.setTypeface(chessFont);
|
blackPiecePaint.setTypeface(chessFont);
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,6 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
// FIXME!!! Remove invalid playerActions in PGN import (should be done in verifyChildren)
|
// FIXME!!! Remove invalid playerActions in PGN import (should be done in verifyChildren)
|
||||||
// FIXME!!! Implement bookmark mechanism for positions in pgn files
|
// FIXME!!! Implement bookmark mechanism for positions in pgn files
|
||||||
// FIXME!!! Add support for "Chess Leipzig" font
|
// 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!!! 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
|
// 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 WakeLock wakeLock = null;
|
||||||
private boolean useWakeLock = false;
|
private boolean useWakeLock = false;
|
||||||
|
|
||||||
|
// private Typeface figNotation;
|
||||||
|
private Typeface defaultMoveListTypeFace;
|
||||||
|
private Typeface defaultThinkingListTypeFace;
|
||||||
|
|
||||||
|
|
||||||
/** Defines all configurable button actions. */
|
/** Defines all configurable button actions. */
|
||||||
private ActionFactory actionFactory = new ActionFactory() {
|
private ActionFactory actionFactory = new ActionFactory() {
|
||||||
private HashMap<String, UIAction> actions;
|
private HashMap<String, UIAction> actions;
|
||||||
@@ -353,7 +357,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
custom3ButtonActions = new ButtonActions("custom3", CUSTOM3_BUTTON_DIALOG,
|
custom3ButtonActions = new ButtonActions("custom3", CUSTOM3_BUTTON_DIALOG,
|
||||||
R.string.select_action);
|
R.string.select_action);
|
||||||
|
|
||||||
TextIO.setPieceNames(getString(R.string.piece_names));
|
setPieceNames(PGNOptions.PT_LOCAL);
|
||||||
initUI(true);
|
initUI(true);
|
||||||
|
|
||||||
gameTextListener = new PgnScreenText(pgnOptions);
|
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. */
|
/** Create directory structure on SD card. */
|
||||||
private void createDirectories() {
|
private void createDirectories() {
|
||||||
File extDir = Environment.getExternalStorageDirectory();
|
File extDir = Environment.getExternalStorageDirectory();
|
||||||
@@ -499,7 +512,9 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
status = (TextView)findViewById(R.id.status);
|
status = (TextView)findViewById(R.id.status);
|
||||||
moveListScroll = (ScrollView)findViewById(R.id.scrollView);
|
moveListScroll = (ScrollView)findViewById(R.id.scrollView);
|
||||||
moveList = (TextView)findViewById(R.id.moveList);
|
moveList = (TextView)findViewById(R.id.moveList);
|
||||||
|
defaultMoveListTypeFace = moveList.getTypeface();
|
||||||
thinking = (TextView)findViewById(R.id.thinking);
|
thinking = (TextView)findViewById(R.id.thinking);
|
||||||
|
defaultThinkingListTypeFace = thinking.getTypeface();
|
||||||
status.setFocusable(false);
|
status.setFocusable(false);
|
||||||
moveListScroll.setFocusable(false);
|
moveListScroll.setFocusable(false);
|
||||||
moveList.setFocusable(false);
|
moveList.setFocusable(false);
|
||||||
@@ -770,6 +785,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
setWakeLock(useWakeLock);
|
setWakeLock(useWakeLock);
|
||||||
|
|
||||||
int fontSize = getIntSetting("fontSize", 12);
|
int fontSize = getIntSetting("fontSize", 12);
|
||||||
|
// figNotation = Typeface.createFromAsset(getAssets(), "fonts/DroidFishChessNotationDark.otf");
|
||||||
status.setTextSize(fontSize);
|
status.setTextSize(fontSize);
|
||||||
moveList.setTextSize(fontSize);
|
moveList.setTextSize(fontSize);
|
||||||
thinking.setTextSize(fontSize);
|
thinking.setTextSize(fontSize);
|
||||||
@@ -825,7 +841,28 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
cb.setColors();
|
cb.setColors();
|
||||||
|
|
||||||
gameTextListener.clear();
|
gameTextListener.clear();
|
||||||
|
setPieceNames(pgnOptions.view.pieceType);
|
||||||
ctrl.prefsChanged(oldViewPieceType != 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() {
|
private void updateButtons() {
|
||||||
|
|||||||
@@ -20,8 +20,13 @@ package org.petero.droidfish;
|
|||||||
|
|
||||||
/** Settings controlling PGN import/export */
|
/** Settings controlling PGN import/export */
|
||||||
public class PGNOptions {
|
public class PGNOptions {
|
||||||
public static final int PT_ENGLISH = 0; // Piece type english letters
|
/** Pieces displayed as english letters. */
|
||||||
public static final int PT_LOCAL = 1; // Piece type local language 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 static class Viewer {
|
||||||
public boolean variations;
|
public boolean variations;
|
||||||
|
|||||||
@@ -587,7 +587,14 @@ public class DroidChessController {
|
|||||||
|
|
||||||
/** Return true if localized piece names should be used. */
|
/** Return true if localized piece names should be used. */
|
||||||
private final boolean localPt() {
|
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. */
|
/** Engine search information receiver. */
|
||||||
|
|||||||
@@ -1188,12 +1188,12 @@ public class GameTree {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
String str;
|
String str;
|
||||||
if (options.exp.pieceType == PGNOptions.PT_LOCAL) {
|
if (options.exp.pieceType == PGNOptions.PT_ENGLISH) {
|
||||||
str = moveStrLocal;
|
|
||||||
} else {
|
|
||||||
str = moveStr;
|
str = moveStr;
|
||||||
if (options.exp.pgnPromotions && (move != null) && (move.promoteTo != Piece.EMPTY))
|
if (options.exp.pgnPromotions && (move != null) && (move.promoteTo != Piece.EMPTY))
|
||||||
str = TextIO.pgnPromotion(str);
|
str = TextIO.pgnPromotion(str);
|
||||||
|
} else {
|
||||||
|
str = moveStrLocal;
|
||||||
}
|
}
|
||||||
out.processToken(this, PgnToken.SYMBOL, str);
|
out.processToken(this, PgnToken.SYMBOL, str);
|
||||||
needMoveNr = false;
|
needMoveNr = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user