mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-26 09:58:20 +01:00
add new preference that when set prevents calculation and drawing of
crosshairs.
This commit is contained in:
parent
daa64a19a4
commit
b0470d5276
8 changed files with 55 additions and 11 deletions
|
@ -435,6 +435,9 @@ board_prefsChanged( BoardCtxt* board, CommonPrefs* cp )
|
|||
board->skipCommitConfirm = cp->skipCommitConfirm;
|
||||
board->showColors = cp->showColors;
|
||||
board->allowPeek = cp->allowPeek;
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
board->hideCrosshairs = cp->hideCrosshairs;
|
||||
#endif
|
||||
|
||||
if ( showArrowChanged ) {
|
||||
showArrowChanged = setArrowVisible( board, XP_FALSE );
|
||||
|
@ -1413,6 +1416,9 @@ invalCellsUnderRect( BoardCtxt* board, const XP_Rect* rect )
|
|||
void
|
||||
invalCol( BoardCtxt* board, XP_U16 col )
|
||||
{
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
XP_ASSERT( !board->hideCrosshairs );
|
||||
#endif
|
||||
XP_U16 row;
|
||||
XP_U16 nCols = model_numCols(board->model);
|
||||
for ( row = 0; row < nCols; ++row ) {
|
||||
|
@ -1423,6 +1429,9 @@ invalCol( BoardCtxt* board, XP_U16 col )
|
|||
void
|
||||
invalRow( BoardCtxt* board, XP_U16 row )
|
||||
{
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
XP_ASSERT( !board->hideCrosshairs );
|
||||
#endif
|
||||
XP_U16 col;
|
||||
XP_U16 nCols = model_numCols(board->model);
|
||||
for ( col = 0; col < nCols; ++col ) {
|
||||
|
|
|
@ -242,13 +242,15 @@ static CellFlags
|
|||
flagsForCrosshairs( const BoardCtxt* board, XP_U16 col, XP_U16 row )
|
||||
{
|
||||
CellFlags flags = 0;
|
||||
XP_Bool inHor, inVert;
|
||||
dragDropInCrosshairs( board, col, row, &inHor, &inVert );
|
||||
if ( inHor ) {
|
||||
flags |= CELL_CROSSHOR;
|
||||
}
|
||||
if ( inVert ) {
|
||||
flags |= CELL_CROSSVERT;
|
||||
if ( ! board->hideCrosshairs ) {
|
||||
XP_Bool inHor, inVert;
|
||||
dragDropInCrosshairs( board, col, row, &inHor, &inVert );
|
||||
if ( inHor ) {
|
||||
flags |= CELL_CROSSHOR;
|
||||
}
|
||||
if ( inVert ) {
|
||||
flags |= CELL_CROSSVERT;
|
||||
}
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
|
|
@ -176,6 +176,9 @@ struct BoardCtxt {
|
|||
XP_Bool hideValsInTray;
|
||||
XP_Bool skipCommitConfirm;
|
||||
XP_Bool allowPeek; /* Can look at non-turn player's rack */
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
XP_Bool hideCrosshairs;
|
||||
#endif
|
||||
|
||||
XP_Bool eraseTray;
|
||||
XP_Bool boardObscuresTray;
|
||||
|
|
|
@ -200,6 +200,9 @@ typedef struct CommonPrefs {
|
|||
#endif
|
||||
XP_Bool showColors; /* applies to all games */
|
||||
XP_Bool allowPeek; /* applies to all games */
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
XP_Bool hideCrosshairs; /* applies to all games */
|
||||
#endif
|
||||
} CommonPrefs;
|
||||
|
||||
typedef struct _PlayerDicts {
|
||||
|
|
|
@ -92,7 +92,11 @@ ddStartBoard( BoardCtxt* board, XP_U16 xx, XP_U16 yy )
|
|||
|
||||
found = coordToCell( board, xx, yy, &col, &row );
|
||||
XP_ASSERT( found );
|
||||
(void)crosshairs_set( board, col, row );
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
if ( !board->hideCrosshairs ) {
|
||||
(void)crosshairs_set( board, col, row );
|
||||
}
|
||||
#endif
|
||||
|
||||
trayVisible = board->trayVisState == TRAY_REVEALED;
|
||||
if ( trayVisible && holdsPendingTile( board, col, row ) ) {
|
||||
|
@ -481,8 +485,12 @@ dragDropContinueImpl( BoardCtxt* board, XP_U16 xx, XP_U16 yy,
|
|||
if ( newInfo.obj == OBJ_BOARD ) {
|
||||
(void)coordToCell( board, xx, yy, &newInfo.u.board.col,
|
||||
&newInfo.u.board.row );
|
||||
draw = crosshairs_set( board, newInfo.u.board.col,
|
||||
newInfo.u.board.row );
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
if ( !board->hideCrosshairs ) {
|
||||
draw = crosshairs_set( board, newInfo.u.board.col,
|
||||
newInfo.u.board.row );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( ds->dtype == DT_DIVIDER ) {
|
||||
|
|
|
@ -2269,6 +2269,9 @@ gtkmain( LaunchParams* params, int argc, char *argv[] )
|
|||
globals.cGlobals.cp.robotThinkMin = params->robotThinkMin;
|
||||
globals.cGlobals.cp.robotThinkMax = params->robotThinkMax;
|
||||
#endif
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
globals.cGlobals.cp.hideCrosshairs = params->hideCrosshairs;
|
||||
#endif
|
||||
|
||||
setupGtkUtilCallbacks( &globals, params->util );
|
||||
|
||||
|
|
|
@ -286,6 +286,9 @@ typedef enum {
|
|||
,CMD_SKIPCONFIRM
|
||||
,CMD_VERTICALSCORE
|
||||
,CMD_NOPEEK
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
,CMD_NOCROSSHAIRS
|
||||
#endif
|
||||
,CMD_ADDPIPE
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
,CMD_HINTRECT
|
||||
|
@ -365,6 +368,9 @@ static CmdInfoRec CmdInfoRecs[] = {
|
|||
,{ CMD_SKIPCONFIRM, false, "skip-confirm", "don't confirm before commit" }
|
||||
,{ CMD_VERTICALSCORE, false, "vertical", "scoreboard is vertical" }
|
||||
,{ CMD_NOPEEK, false, "no-peek", "disallow scoreboard tap changing player" }
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
,{ CMD_NOCROSSHAIRS, false, "hide-crosshairs", "don't show crosshairs on board" }
|
||||
#endif
|
||||
,{ CMD_ADDPIPE, true, "with-pipe", "named pipe to listen on for relay msgs" }
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
,{ CMD_HINTRECT, false, "hintrect", "enable draggable hint-limits rect" }
|
||||
|
@ -1204,7 +1210,7 @@ main( int argc, char** argv )
|
|||
mainParams.allowPeek = XP_TRUE;
|
||||
mainParams.showRobotScores = XP_FALSE;
|
||||
mainParams.useMmap = XP_TRUE;
|
||||
|
||||
|
||||
/* serverName = mainParams.info.clientInfo.serverName = "localhost"; */
|
||||
|
||||
#if defined PLATFORM_GTK
|
||||
|
@ -1419,6 +1425,12 @@ main( int argc, char** argv )
|
|||
break;
|
||||
case CMD_NOPEEK:
|
||||
mainParams.allowPeek = XP_FALSE;
|
||||
break;
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
case CMD_NOCROSSHAIRS:
|
||||
mainParams.hideCrosshairs = XP_TRUE;
|
||||
break;
|
||||
#endif
|
||||
case CMD_ADDPIPE:
|
||||
mainParams.pipe = optarg;
|
||||
break;
|
||||
|
|
|
@ -79,6 +79,10 @@ typedef struct LaunchParams {
|
|||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
XP_Bool allowHintRect;
|
||||
#endif
|
||||
#ifdef XWFEATURE_CROSSHAIRS
|
||||
XP_Bool hideCrosshairs;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XWFEATURE_SLOW_ROBOT
|
||||
XP_U16 robotThinkMin, robotThinkMax;
|
||||
|
|
Loading…
Reference in a new issue