mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-27 07:58:49 +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
|
||||
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 )
|
||||
{
|
||||
boolean canDraw = figureFontDims();
|
||||
|
@ -432,15 +432,19 @@ public class BoardCanvas extends Canvas implements DrawCtx {
|
|||
}
|
||||
} else {
|
||||
m_fillPaint.setColor( adjustColor(foreColor) );
|
||||
Rect smaller = new Rect(rect);
|
||||
smaller.bottom -= smaller.height() / 4;
|
||||
smaller.right -= smaller.width() / 4;
|
||||
drawCentered( text, smaller, m_fontDims );
|
||||
if ( null == value ) {
|
||||
drawCentered( text, rect, m_fontDims );
|
||||
} else {
|
||||
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.left += (3 * smaller.width()) / 4;
|
||||
smaller.top += (3 * smaller.height()) / 4;
|
||||
drawCentered( String.format("%d", value), smaller, m_fontDims );
|
||||
smaller = new Rect(rect);
|
||||
smaller.left += (3 * smaller.width()) / 4;
|
||||
smaller.top += (3 * smaller.height()) / 4;
|
||||
drawCentered( value, smaller, m_fontDims );
|
||||
}
|
||||
}
|
||||
|
||||
if ( (CELL_ISBLANK & flags) != 0 ) {
|
||||
|
@ -667,7 +671,6 @@ public class BoardCanvas extends Canvas implements DrawCtx {
|
|||
{
|
||||
boolean canDraw = figureFontDims();
|
||||
if ( canDraw ) {
|
||||
// boolean valHidden = (flags & CELL_VALHIDDEN) != 0;
|
||||
boolean notEmpty = (flags & CELL_ISEMPTY) == 0;
|
||||
boolean isCursor = (flags & CELL_ISCURSOR) != 0;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public interface DrawCtx {
|
|||
static final int CELL_ISSTAR = 0x04;
|
||||
static final int CELL_ISCURSOR = 0x08;
|
||||
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_DRAGCUR = 0x80; /* where drag is now */
|
||||
static final int CELL_CROSSVERT = 0x100;
|
||||
|
@ -59,7 +59,7 @@ public interface DrawCtx {
|
|||
|
||||
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 );
|
||||
void drawBoardArrow ( Rect rect, int bonus, boolean vert, int hintAtts,
|
||||
int flags );
|
||||
|
|
|
@ -1394,8 +1394,8 @@
|
|||
remind themselves how much played tiles are worth while
|
||||
planning a move. -->
|
||||
<string name="not_again_values">This button changes whether the
|
||||
board shows letters on placed tiles or their point values.
|
||||
Use it to remind yourself what a tile is worth.</string>
|
||||
board shows values (in addition to letters) on tiles on the
|
||||
board.</string>
|
||||
<!-- 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
|
||||
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.
|
||||
*
|
||||
* 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
|
||||
and_draw_drawCell( DrawCtx* dctx, XWEnv xwe, const XP_Rect* rect,
|
||||
const XP_UCHAR* text,
|
||||
const XP_Bitmaps* bitmaps, Tile tile, XP_U16 value,
|
||||
const XP_UCHAR* text, const XP_Bitmaps* bitmaps,
|
||||
Tile tile, const XP_UCHAR* value,
|
||||
XP_S16 owner, XWBonusType bonus, HintAtts hintAtts,
|
||||
CellFlags flags )
|
||||
{
|
||||
jboolean result;
|
||||
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 );
|
||||
jstring jtext = NULL;
|
||||
if ( !!text ) {
|
||||
|
@ -425,13 +425,14 @@ and_draw_drawCell( DrawCtx* dctx, XWEnv xwe, const XP_Rect* rect,
|
|||
}
|
||||
jtext = (*env)->NewStringUTF( env, text );
|
||||
}
|
||||
jstring jval = !!value ? (*env)->NewStringUTF( env, value ) : NULL;
|
||||
|
||||
result = (*env)->CallBooleanMethod( env, draw->jdraw, mid,
|
||||
jrect, jtext, tile, value,
|
||||
jrect, jtext, tile, jval,
|
||||
owner, bonus, hintAtts,
|
||||
flags );
|
||||
returnJRect( draw, JCACHE_RECT0, jrect );
|
||||
deleteLocalRef( env, jtext );
|
||||
deleteLocalRefs( env, jtext, jval, DELETE_NO_REF );
|
||||
|
||||
DRAW_CBK_HEADER_END();
|
||||
return result;
|
||||
|
|
|
@ -397,7 +397,6 @@ drawCell( BoardCtxt* board, XWEnv xwe, const XP_U16 col,
|
|||
while ( board->trayVisState == TRAY_HIDDEN ||
|
||||
!rectContainsRect( &board->trayBounds, &cellRect ) ) {
|
||||
XP_Bool recent = XP_FALSE;
|
||||
XP_UCHAR ch[4] = {'\0'};
|
||||
XP_S16 owner = -1;
|
||||
XP_Bitmaps bitmaps;
|
||||
XP_Bitmaps* bptr = NULL;
|
||||
|
@ -405,7 +404,8 @@ drawCell( BoardCtxt* board, XWEnv xwe, const XP_U16 col,
|
|||
HintAtts hintAtts;
|
||||
CellFlags flags = CELL_NONE;
|
||||
XP_Bool isOrigin;
|
||||
XP_U16 value = 0;
|
||||
XP_UCHAR valBuf[4];
|
||||
XP_UCHAR* value = NULL;
|
||||
|
||||
isEmpty = !model_getTile( model, modelCol, modelRow, showPending,
|
||||
selPlayer, &tile, &isBlank,
|
||||
|
@ -426,7 +426,7 @@ drawCell( BoardCtxt* board, XWEnv xwe, const XP_U16 col,
|
|||
break;
|
||||
} else {
|
||||
Tile valTile = isBlank? dict_getBlankTile( dict ) : tile;
|
||||
value = dict_getTileValue( dict, valTile );
|
||||
XP_U16 val = dict_getTileValue( dict, valTile );
|
||||
|
||||
if ( board->showColors ) {
|
||||
owner = (XP_S16)model_getCellOwner( model, modelCol,
|
||||
|
@ -434,15 +434,14 @@ drawCell( BoardCtxt* board, XWEnv xwe, const XP_U16 col,
|
|||
}
|
||||
|
||||
if ( board->showCellValues ) {
|
||||
XP_SNPRINTF( ch, VSIZE(ch), "%d", value );
|
||||
textP = ch;
|
||||
} else {
|
||||
if ( dict_faceIsBitmap( dict, tile ) ) {
|
||||
dict_getFaceBitmaps( dict, tile, &bitmaps );
|
||||
bptr = &bitmaps;
|
||||
}
|
||||
textP = dict_getTileString( dict, tile );
|
||||
XP_SNPRINTF( valBuf, VSIZE(valBuf), "%d", val );
|
||||
value = valBuf;
|
||||
}
|
||||
if ( dict_faceIsBitmap( dict, tile ) ) {
|
||||
dict_getFaceBitmaps( dict, tile, &bitmaps );
|
||||
bptr = &bitmaps;
|
||||
}
|
||||
textP = dict_getTileString( dict, tile );
|
||||
}
|
||||
bonus = model_getSquareBonus( model, xwe, col, row );
|
||||
hintAtts = figureHintAtts( board, col, row );
|
||||
|
|
|
@ -177,11 +177,9 @@ typedef struct DrawCtxVTable {
|
|||
XP_Bool turnDone );
|
||||
|
||||
XP_Bool DRAW_VTABLE_NAME(drawCell) ( DrawCtx* dctx, XWEnv xwe, const XP_Rect* rect,
|
||||
/* at least one of these two will be
|
||||
null */
|
||||
const XP_UCHAR* text,
|
||||
const XP_Bitmaps* bitmaps,
|
||||
Tile tile, XP_U16 value,
|
||||
/* at least one of these two will be null */
|
||||
const XP_UCHAR* text, const XP_Bitmaps* bitmaps,
|
||||
Tile tile, const XP_UCHAR* value, /* null if hidden */
|
||||
XP_S16 owner, /* -1 means don't use */
|
||||
XWBonusType bonus, HintAtts hintAtts,
|
||||
CellFlags flags );
|
||||
|
|
|
@ -392,7 +392,7 @@ static XP_Bool
|
|||
curses_draw_drawCell( DrawCtx* p_dctx, XWEnv XP_UNUSED(xwe), const XP_Rect* rect,
|
||||
const XP_UCHAR* letter,
|
||||
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,
|
||||
HintAtts XP_UNUSED(hintAtts), CellFlags flags )
|
||||
{
|
||||
|
|
|
@ -607,9 +607,10 @@ drawCrosshairs( GtkDrawCtx* dctx, const XP_Rect* rect, CellFlags flags )
|
|||
#endif
|
||||
|
||||
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),
|
||||
XP_U16 XP_UNUSED(value), XP_S16 owner, XWBonusType bonus,
|
||||
const XP_UCHAR* value, XP_S16 owner, XWBonusType bonus,
|
||||
HintAtts hintAtts, CellFlags flags )
|
||||
{
|
||||
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;
|
||||
GdkRGBA* cursor =
|
||||
((flags & CELL_ISCURSOR) != 0) ? &dctx->cursor : NULL;
|
||||
GdkRGBA* foreground = &dctx->white;
|
||||
|
||||
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 */
|
||||
if ( (flags & (CELL_DRAGSRC|CELL_ISEMPTY)) != 0 ) {
|
||||
if ( !!cursor || bonus != BONUS_NONE ) {
|
||||
GdkRGBA* foreground;
|
||||
if ( !!cursor ) {
|
||||
foreground = cursor;
|
||||
} else if ( bonus != BONUS_NONE ) {
|
||||
foreground = &dctx->bonusColors[bonus-1];
|
||||
} else {
|
||||
foreground = &dctx->white;
|
||||
/* } else { */
|
||||
/* foreground = &dctx->white; */
|
||||
}
|
||||
if ( !!foreground ) {
|
||||
#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 );
|
||||
}
|
||||
} 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 ) {
|
||||
XP_Bool isBlank = (flags & CELL_ISBLANK) != 0;
|
||||
GdkRGBA* foreground;
|
||||
if ( cursor ) {
|
||||
gtkSetForeground( dctx, cursor );
|
||||
} else if ( !recent && !pending ) {
|
||||
|
@ -692,7 +697,14 @@ gtk_draw_drawCell( DrawCtx* p_dctx, XWEnv XP_UNUSED(xwe), const XP_Rect* rect, c
|
|||
} else {
|
||||
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 );
|
||||
|
||||
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 );
|
||||
drawCrosshairs( dctx, rect, flags );
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue