mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
show-values mode now means show along with face
not instead of. It now feels as if it should be a global setting, not a per-game thing to toggle. We'll see what folks think.
This commit is contained in:
parent
d3cf74920e
commit
64f1d83b5d
8 changed files with 69 additions and 46 deletions
|
@ -372,7 +372,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean drawCell( Rect rect, String text, int tile, int value,
|
public boolean drawCell( Rect rect, String text, int tile, String value,
|
||||||
int owner, int bonus, int hintAtts, int flags )
|
int owner, int bonus, int hintAtts, int flags )
|
||||||
{
|
{
|
||||||
boolean canDraw = figureFontDims();
|
boolean canDraw = figureFontDims();
|
||||||
|
@ -432,15 +432,19 @@ public class BoardCanvas extends Canvas implements DrawCtx {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_fillPaint.setColor( adjustColor(foreColor) );
|
m_fillPaint.setColor( adjustColor(foreColor) );
|
||||||
Rect smaller = new Rect(rect);
|
if ( null == value ) {
|
||||||
smaller.bottom -= smaller.height() / 4;
|
drawCentered( text, rect, m_fontDims );
|
||||||
smaller.right -= smaller.width() / 4;
|
} else {
|
||||||
drawCentered( text, smaller, m_fontDims );
|
Rect smaller = new Rect(rect);
|
||||||
|
smaller.bottom -= smaller.height() / 4;
|
||||||
|
smaller.right -= smaller.width() / 4;
|
||||||
|
drawCentered( text, smaller, m_fontDims );
|
||||||
|
|
||||||
smaller = new Rect(rect);
|
smaller = new Rect(rect);
|
||||||
smaller.left += (3 * smaller.width()) / 4;
|
smaller.left += (3 * smaller.width()) / 4;
|
||||||
smaller.top += (3 * smaller.height()) / 4;
|
smaller.top += (3 * smaller.height()) / 4;
|
||||||
drawCentered( String.format("%d", value), smaller, m_fontDims );
|
drawCentered( value, smaller, m_fontDims );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (CELL_ISBLANK & flags) != 0 ) {
|
if ( (CELL_ISBLANK & flags) != 0 ) {
|
||||||
|
@ -667,7 +671,6 @@ public class BoardCanvas extends Canvas implements DrawCtx {
|
||||||
{
|
{
|
||||||
boolean canDraw = figureFontDims();
|
boolean canDraw = figureFontDims();
|
||||||
if ( canDraw ) {
|
if ( canDraw ) {
|
||||||
// boolean valHidden = (flags & CELL_VALHIDDEN) != 0;
|
|
||||||
boolean notEmpty = (flags & CELL_ISEMPTY) == 0;
|
boolean notEmpty = (flags & CELL_ISEMPTY) == 0;
|
||||||
boolean isCursor = (flags & CELL_ISCURSOR) != 0;
|
boolean isCursor = (flags & CELL_ISCURSOR) != 0;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ public interface DrawCtx {
|
||||||
static final int CELL_ISSTAR = 0x04;
|
static final int CELL_ISSTAR = 0x04;
|
||||||
static final int CELL_ISCURSOR = 0x08;
|
static final int CELL_ISCURSOR = 0x08;
|
||||||
static final int CELL_ISEMPTY = 0x10; /* of a tray tile slot */
|
static final int CELL_ISEMPTY = 0x10; /* of a tray tile slot */
|
||||||
static final int CELL_VALHIDDEN = 0x20; /* show letter only, not value */
|
// static final int CELL_VALHIDDEN = 0x20; /* show letter only, not value */
|
||||||
static final int CELL_DRAGSRC = 0x40; /* where drag originated */
|
static final int CELL_DRAGSRC = 0x40; /* where drag originated */
|
||||||
static final int CELL_DRAGCUR = 0x80; /* where drag is now */
|
static final int CELL_DRAGCUR = 0x80; /* where drag is now */
|
||||||
static final int CELL_CROSSVERT = 0x100;
|
static final int CELL_CROSSVERT = 0x100;
|
||||||
|
@ -59,7 +59,7 @@ public interface DrawCtx {
|
||||||
|
|
||||||
void drawTimer( Rect rect, int player, int secondsLeft, boolean inDuplicateMode );
|
void drawTimer( Rect rect, int player, int secondsLeft, boolean inDuplicateMode );
|
||||||
|
|
||||||
boolean drawCell( Rect rect, String text, int tile, int value,
|
boolean drawCell( Rect rect, String text, int tile, String value,
|
||||||
int owner, int bonus, int hintAtts, int flags );
|
int owner, int bonus, int hintAtts, int flags );
|
||||||
void drawBoardArrow ( Rect rect, int bonus, boolean vert, int hintAtts,
|
void drawBoardArrow ( Rect rect, int bonus, boolean vert, int hintAtts,
|
||||||
int flags );
|
int flags );
|
||||||
|
|
|
@ -1394,8 +1394,8 @@
|
||||||
remind themselves how much played tiles are worth while
|
remind themselves how much played tiles are worth while
|
||||||
planning a move. -->
|
planning a move. -->
|
||||||
<string name="not_again_values">This button changes whether the
|
<string name="not_again_values">This button changes whether the
|
||||||
board shows letters on placed tiles or their point values.
|
board shows values (in addition to letters) on tiles on the
|
||||||
Use it to remind yourself what a tile is worth.</string>
|
board.</string>
|
||||||
<!-- This is shown when you choose the board_menu_done menu item.
|
<!-- This is shown when you choose the board_menu_done menu item.
|
||||||
It's to let you know that there's a shortcut that does almost
|
It's to let you know that there's a shortcut that does almost
|
||||||
the same thing. -->
|
the same thing. -->
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* -*-mode: C; compile-command: "find-and-gradle.sh insXwdDeb"; -*- */
|
/* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */
|
||||||
/*
|
/*
|
||||||
* Copyright 2001-2010 by Eric House (xwords@eehouse.org). All rights
|
* Copyright 2001-2021 by Eric House (xwords@eehouse.org). All rights
|
||||||
* reserved.
|
* reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -409,14 +409,14 @@ and_draw_boardBegin( DrawCtx* XP_UNUSED(dctx), XWEnv XP_UNUSED(xwe),
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
and_draw_drawCell( DrawCtx* dctx, XWEnv xwe, const XP_Rect* rect,
|
and_draw_drawCell( DrawCtx* dctx, XWEnv xwe, const XP_Rect* rect,
|
||||||
const XP_UCHAR* text,
|
const XP_UCHAR* text, const XP_Bitmaps* bitmaps,
|
||||||
const XP_Bitmaps* bitmaps, Tile tile, XP_U16 value,
|
Tile tile, const XP_UCHAR* value,
|
||||||
XP_S16 owner, XWBonusType bonus, HintAtts hintAtts,
|
XP_S16 owner, XWBonusType bonus, HintAtts hintAtts,
|
||||||
CellFlags flags )
|
CellFlags flags )
|
||||||
{
|
{
|
||||||
jboolean result;
|
jboolean result;
|
||||||
DRAW_CBK_HEADER("drawCell",
|
DRAW_CBK_HEADER("drawCell",
|
||||||
"(Landroid/graphics/Rect;Ljava/lang/String;IIIIII)Z" );
|
"(Landroid/graphics/Rect;Ljava/lang/String;ILjava/lang/String;IIII)Z" );
|
||||||
jobject jrect = makeJRect( draw, xwe, JCACHE_RECT0, rect );
|
jobject jrect = makeJRect( draw, xwe, JCACHE_RECT0, rect );
|
||||||
jstring jtext = NULL;
|
jstring jtext = NULL;
|
||||||
if ( !!text ) {
|
if ( !!text ) {
|
||||||
|
@ -425,13 +425,14 @@ and_draw_drawCell( DrawCtx* dctx, XWEnv xwe, const XP_Rect* rect,
|
||||||
}
|
}
|
||||||
jtext = (*env)->NewStringUTF( env, text );
|
jtext = (*env)->NewStringUTF( env, text );
|
||||||
}
|
}
|
||||||
|
jstring jval = !!value ? (*env)->NewStringUTF( env, value ) : NULL;
|
||||||
|
|
||||||
result = (*env)->CallBooleanMethod( env, draw->jdraw, mid,
|
result = (*env)->CallBooleanMethod( env, draw->jdraw, mid,
|
||||||
jrect, jtext, tile, value,
|
jrect, jtext, tile, jval,
|
||||||
owner, bonus, hintAtts,
|
owner, bonus, hintAtts,
|
||||||
flags );
|
flags );
|
||||||
returnJRect( draw, JCACHE_RECT0, jrect );
|
returnJRect( draw, JCACHE_RECT0, jrect );
|
||||||
deleteLocalRef( env, jtext );
|
deleteLocalRefs( env, jtext, jval, DELETE_NO_REF );
|
||||||
|
|
||||||
DRAW_CBK_HEADER_END();
|
DRAW_CBK_HEADER_END();
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -397,7 +397,6 @@ drawCell( BoardCtxt* board, XWEnv xwe, const XP_U16 col,
|
||||||
while ( board->trayVisState == TRAY_HIDDEN ||
|
while ( board->trayVisState == TRAY_HIDDEN ||
|
||||||
!rectContainsRect( &board->trayBounds, &cellRect ) ) {
|
!rectContainsRect( &board->trayBounds, &cellRect ) ) {
|
||||||
XP_Bool recent = XP_FALSE;
|
XP_Bool recent = XP_FALSE;
|
||||||
XP_UCHAR ch[4] = {'\0'};
|
|
||||||
XP_S16 owner = -1;
|
XP_S16 owner = -1;
|
||||||
XP_Bitmaps bitmaps;
|
XP_Bitmaps bitmaps;
|
||||||
XP_Bitmaps* bptr = NULL;
|
XP_Bitmaps* bptr = NULL;
|
||||||
|
@ -405,7 +404,8 @@ drawCell( BoardCtxt* board, XWEnv xwe, const XP_U16 col,
|
||||||
HintAtts hintAtts;
|
HintAtts hintAtts;
|
||||||
CellFlags flags = CELL_NONE;
|
CellFlags flags = CELL_NONE;
|
||||||
XP_Bool isOrigin;
|
XP_Bool isOrigin;
|
||||||
XP_U16 value = 0;
|
XP_UCHAR valBuf[4];
|
||||||
|
XP_UCHAR* value = NULL;
|
||||||
|
|
||||||
isEmpty = !model_getTile( model, modelCol, modelRow, showPending,
|
isEmpty = !model_getTile( model, modelCol, modelRow, showPending,
|
||||||
selPlayer, &tile, &isBlank,
|
selPlayer, &tile, &isBlank,
|
||||||
|
@ -426,7 +426,7 @@ drawCell( BoardCtxt* board, XWEnv xwe, const XP_U16 col,
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
Tile valTile = isBlank? dict_getBlankTile( dict ) : tile;
|
Tile valTile = isBlank? dict_getBlankTile( dict ) : tile;
|
||||||
value = dict_getTileValue( dict, valTile );
|
XP_U16 val = dict_getTileValue( dict, valTile );
|
||||||
|
|
||||||
if ( board->showColors ) {
|
if ( board->showColors ) {
|
||||||
owner = (XP_S16)model_getCellOwner( model, modelCol,
|
owner = (XP_S16)model_getCellOwner( model, modelCol,
|
||||||
|
@ -434,15 +434,14 @@ drawCell( BoardCtxt* board, XWEnv xwe, const XP_U16 col,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( board->showCellValues ) {
|
if ( board->showCellValues ) {
|
||||||
XP_SNPRINTF( ch, VSIZE(ch), "%d", value );
|
XP_SNPRINTF( valBuf, VSIZE(valBuf), "%d", val );
|
||||||
textP = ch;
|
value = valBuf;
|
||||||
} else {
|
|
||||||
if ( dict_faceIsBitmap( dict, tile ) ) {
|
|
||||||
dict_getFaceBitmaps( dict, tile, &bitmaps );
|
|
||||||
bptr = &bitmaps;
|
|
||||||
}
|
|
||||||
textP = dict_getTileString( dict, tile );
|
|
||||||
}
|
}
|
||||||
|
if ( dict_faceIsBitmap( dict, tile ) ) {
|
||||||
|
dict_getFaceBitmaps( dict, tile, &bitmaps );
|
||||||
|
bptr = &bitmaps;
|
||||||
|
}
|
||||||
|
textP = dict_getTileString( dict, tile );
|
||||||
}
|
}
|
||||||
bonus = model_getSquareBonus( model, xwe, col, row );
|
bonus = model_getSquareBonus( model, xwe, col, row );
|
||||||
hintAtts = figureHintAtts( board, col, row );
|
hintAtts = figureHintAtts( board, col, row );
|
||||||
|
|
|
@ -177,11 +177,9 @@ typedef struct DrawCtxVTable {
|
||||||
XP_Bool turnDone );
|
XP_Bool turnDone );
|
||||||
|
|
||||||
XP_Bool DRAW_VTABLE_NAME(drawCell) ( DrawCtx* dctx, XWEnv xwe, const XP_Rect* rect,
|
XP_Bool DRAW_VTABLE_NAME(drawCell) ( DrawCtx* dctx, XWEnv xwe, const XP_Rect* rect,
|
||||||
/* at least one of these two will be
|
/* at least one of these two will be null */
|
||||||
null */
|
const XP_UCHAR* text, const XP_Bitmaps* bitmaps,
|
||||||
const XP_UCHAR* text,
|
Tile tile, const XP_UCHAR* value, /* null if hidden */
|
||||||
const XP_Bitmaps* bitmaps,
|
|
||||||
Tile tile, XP_U16 value,
|
|
||||||
XP_S16 owner, /* -1 means don't use */
|
XP_S16 owner, /* -1 means don't use */
|
||||||
XWBonusType bonus, HintAtts hintAtts,
|
XWBonusType bonus, HintAtts hintAtts,
|
||||||
CellFlags flags );
|
CellFlags flags );
|
||||||
|
|
|
@ -392,7 +392,7 @@ static XP_Bool
|
||||||
curses_draw_drawCell( DrawCtx* p_dctx, XWEnv XP_UNUSED(xwe), const XP_Rect* rect,
|
curses_draw_drawCell( DrawCtx* p_dctx, XWEnv XP_UNUSED(xwe), const XP_Rect* rect,
|
||||||
const XP_UCHAR* letter,
|
const XP_UCHAR* letter,
|
||||||
const XP_Bitmaps* XP_UNUSED(bitmaps),
|
const XP_Bitmaps* XP_UNUSED(bitmaps),
|
||||||
Tile XP_UNUSED(tile), XP_U16 XP_UNUSED(value),
|
Tile XP_UNUSED(tile), const XP_UCHAR* XP_UNUSED(value),
|
||||||
XP_S16 XP_UNUSED(owner), XWBonusType bonus,
|
XP_S16 XP_UNUSED(owner), XWBonusType bonus,
|
||||||
HintAtts XP_UNUSED(hintAtts), CellFlags flags )
|
HintAtts XP_UNUSED(hintAtts), CellFlags flags )
|
||||||
{
|
{
|
||||||
|
|
|
@ -607,9 +607,10 @@ drawCrosshairs( GtkDrawCtx* dctx, const XP_Rect* rect, CellFlags flags )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
gtk_draw_drawCell( DrawCtx* p_dctx, XWEnv XP_UNUSED(xwe), const XP_Rect* rect, const XP_UCHAR* letter,
|
gtk_draw_drawCell( DrawCtx* p_dctx, XWEnv XP_UNUSED(xwe), const XP_Rect* rect,
|
||||||
|
const XP_UCHAR* letter,
|
||||||
const XP_Bitmaps* bitmaps, Tile XP_UNUSED(tile),
|
const XP_Bitmaps* bitmaps, Tile XP_UNUSED(tile),
|
||||||
XP_U16 XP_UNUSED(value), XP_S16 owner, XWBonusType bonus,
|
const XP_UCHAR* value, XP_S16 owner, XWBonusType bonus,
|
||||||
HintAtts hintAtts, CellFlags flags )
|
HintAtts hintAtts, CellFlags flags )
|
||||||
{
|
{
|
||||||
GtkDrawCtx* dctx = (GtkDrawCtx*)(void*)p_dctx;
|
GtkDrawCtx* dctx = (GtkDrawCtx*)(void*)p_dctx;
|
||||||
|
@ -620,6 +621,7 @@ gtk_draw_drawCell( DrawCtx* p_dctx, XWEnv XP_UNUSED(xwe), const XP_Rect* rect, c
|
||||||
XP_Bool pending = (flags & CELL_PENDING) != 0;
|
XP_Bool pending = (flags & CELL_PENDING) != 0;
|
||||||
GdkRGBA* cursor =
|
GdkRGBA* cursor =
|
||||||
((flags & CELL_ISCURSOR) != 0) ? &dctx->cursor : NULL;
|
((flags & CELL_ISCURSOR) != 0) ? &dctx->cursor : NULL;
|
||||||
|
GdkRGBA* foreground = &dctx->white;
|
||||||
|
|
||||||
gtkEraseRect( dctx, rect );
|
gtkEraseRect( dctx, rect );
|
||||||
|
|
||||||
|
@ -643,13 +645,12 @@ gtk_draw_drawCell( DrawCtx* p_dctx, XWEnv XP_UNUSED(xwe), const XP_Rect* rect, c
|
||||||
in the cell or if CELL_DRAGSRC is set */
|
in the cell or if CELL_DRAGSRC is set */
|
||||||
if ( (flags & (CELL_DRAGSRC|CELL_ISEMPTY)) != 0 ) {
|
if ( (flags & (CELL_DRAGSRC|CELL_ISEMPTY)) != 0 ) {
|
||||||
if ( !!cursor || bonus != BONUS_NONE ) {
|
if ( !!cursor || bonus != BONUS_NONE ) {
|
||||||
GdkRGBA* foreground;
|
|
||||||
if ( !!cursor ) {
|
if ( !!cursor ) {
|
||||||
foreground = cursor;
|
foreground = cursor;
|
||||||
} else if ( bonus != BONUS_NONE ) {
|
} else if ( bonus != BONUS_NONE ) {
|
||||||
foreground = &dctx->bonusColors[bonus-1];
|
foreground = &dctx->bonusColors[bonus-1];
|
||||||
} else {
|
/* } else { */
|
||||||
foreground = &dctx->white;
|
/* foreground = &dctx->white; */
|
||||||
}
|
}
|
||||||
if ( !!foreground ) {
|
if ( !!foreground ) {
|
||||||
#ifdef USE_CAIRO
|
#ifdef USE_CAIRO
|
||||||
|
@ -668,10 +669,14 @@ gtk_draw_drawCell( DrawCtx* p_dctx, XWEnv XP_UNUSED(xwe), const XP_Rect* rect, c
|
||||||
XP_GTK_JUST_CENTER, &dctx->black, NULL );
|
XP_GTK_JUST_CENTER, &dctx->black, NULL );
|
||||||
}
|
}
|
||||||
} else if ( !!bitmaps && !!bitmaps->bmps[0] ) {
|
} else if ( !!bitmaps && !!bitmaps->bmps[0] ) {
|
||||||
drawBitmapFromLBS( dctx, bitmaps->bmps[0], rect );
|
XP_Rect tmpRect = *rect;
|
||||||
|
if ( !!value ) {
|
||||||
|
tmpRect.width = tmpRect.width * 3 / 4;
|
||||||
|
tmpRect.height = tmpRect.height * 3 / 4;
|
||||||
|
}
|
||||||
|
drawBitmapFromLBS( dctx, bitmaps->bmps[0], &tmpRect );
|
||||||
} else if ( !!letter ) {
|
} else if ( !!letter ) {
|
||||||
XP_Bool isBlank = (flags & CELL_ISBLANK) != 0;
|
XP_Bool isBlank = (flags & CELL_ISBLANK) != 0;
|
||||||
GdkRGBA* foreground;
|
|
||||||
if ( cursor ) {
|
if ( cursor ) {
|
||||||
gtkSetForeground( dctx, cursor );
|
gtkSetForeground( dctx, cursor );
|
||||||
} else if ( !recent && !pending ) {
|
} else if ( !recent && !pending ) {
|
||||||
|
@ -692,7 +697,14 @@ gtk_draw_drawCell( DrawCtx* p_dctx, XWEnv XP_UNUSED(xwe), const XP_Rect* rect, c
|
||||||
} else {
|
} else {
|
||||||
foreground = &dctx->playerColors[owner];
|
foreground = &dctx->playerColors[owner];
|
||||||
}
|
}
|
||||||
draw_string_at( dctx, NULL, letter, dctx->cellHeight, &rectInset,
|
XP_Rect tmpRect = rectInset;
|
||||||
|
XP_U16 fontHt = dctx->cellHeight;
|
||||||
|
if ( !!value ) {
|
||||||
|
tmpRect.width = tmpRect.width * 3 / 4;
|
||||||
|
tmpRect.height = tmpRect.height * 3 / 4;
|
||||||
|
fontHt = fontHt * 3 / 4;
|
||||||
|
}
|
||||||
|
draw_string_at( dctx, NULL, letter, fontHt, &tmpRect,
|
||||||
XP_GTK_JUST_CENTER, foreground, cursor );
|
XP_GTK_JUST_CENTER, foreground, cursor );
|
||||||
|
|
||||||
if ( isBlank ) {
|
if ( isBlank ) {
|
||||||
|
@ -709,6 +721,16 @@ gtk_draw_drawCell( DrawCtx* p_dctx, XWEnv XP_UNUSED(xwe), const XP_Rect* rect, c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !!value ) {
|
||||||
|
XP_Rect tmpRect = *rect;
|
||||||
|
tmpRect.left += tmpRect.width * 3 / 4;
|
||||||
|
tmpRect.width /= 4;
|
||||||
|
tmpRect.top += tmpRect.height * 3 / 4;
|
||||||
|
tmpRect.height /= 4;
|
||||||
|
draw_string_at( dctx, NULL, value, dctx->cellHeight/4, &tmpRect,
|
||||||
|
XP_GTK_JUST_CENTER, foreground, cursor );
|
||||||
|
}
|
||||||
|
|
||||||
drawHintBorders( dctx, rect, hintAtts );
|
drawHintBorders( dctx, rect, hintAtts );
|
||||||
drawCrosshairs( dctx, rect, flags );
|
drawCrosshairs( dctx, rect, flags );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue