From 6d2eb06e7ad56484b364a517cea83c85919f2bd8 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Wed, 22 Feb 2012 17:46:16 +0100 Subject: [PATCH] Implement -autoCopyPV This option causes automatic copying of the last position of a PV walk to the clipboard. --- args.h | 1 + backend.c | 1 + common.h | 1 + frontend.h | 1 + xboard.c | 6 ++++++ xboard.texi | 7 +++++++ 6 files changed, 17 insertions(+), 0 deletions(-) diff --git a/args.h b/args.h index 6737499..9c746f6 100644 --- a/args.h +++ b/args.h @@ -651,6 +651,7 @@ ArgDescriptor argDescriptors[] = { { "findMirrorImage", ArgBoolean, (void *) &appData.findMirror, FALSE, FALSE }, { "viewer", ArgTrue, (void *) &appData.viewer, FALSE, FALSE }, { "viewerOptions", ArgString, (void *) &appData.viewerOptions, TRUE, (ArgIniType) "-ncp -engineOutputUp false -saveSettingsOnExit false" }, + { "autoCopyPV", ArgBoolean, (void *) &appData.autoCopyPV, TRUE, FALSE }, #if ZIPPY { "zippyTalk", ArgBoolean, (void *) &appData.zippyTalk, FALSE, (ArgIniType) ZIPPY_TALK }, diff --git a/backend.c b/backend.c index eee690b..06c3145 100644 --- a/backend.c +++ b/backend.c @@ -5451,6 +5451,7 @@ UnLoadPV () { int oldFMM = forwardMostMove; // N.B.: this was currentMove before PV was loaded! if(endPV < 0) return; + if(appData.autoCopyPV) CopyFENToClipboard(); endPV = -1; if(gameMode == AnalyzeMode && currentMove > forwardMostMove) { Boolean saveAnimate = appData.animate; diff --git a/common.h b/common.h index b1e13cc..9e1c3dd 100644 --- a/common.h +++ b/common.h @@ -664,6 +664,7 @@ typedef struct { int evalThreshold; /* [HGM] evalGraph */ Boolean dropMenu; /* [HGM] pv */ Boolean markers; /* [HGM] markers */ + Boolean autoCopyPV; Boolean pieceMenu; Boolean sweepSelect; Boolean whitePOV; diff --git a/frontend.h b/frontend.h index 1267230..d1914b5 100644 --- a/frontend.h +++ b/frontend.h @@ -208,6 +208,7 @@ void HistorySet P((char movelist[][2*MOVE_LEN], int first, int last, int current void FreezeUI P((void)); void ThawUI P((void)); void ChangeDragPiece P((ChessSquare piece)); +void CopyFENToClipboard P((void)); extern char *programName; extern int commentUp; extern char *firstChessProgramNames; diff --git a/xboard.c b/xboard.c index c2a5373..0b3c7f4 100644 --- a/xboard.c +++ b/xboard.c @@ -5617,6 +5617,12 @@ CopyPositionProc (Widget w, XEvent *event, String *prms, Cardinal *nprms) NULL/* transfer_done_proc */); } +void +CopyFENToClipboard () +{ // wrapper to make call from back-end possible + CopyPositionProc(NULL, NULL, NULL, NULL); +} + /* function called when the data to Paste is ready */ static void PastePositionCB (Widget w, XtPointer client_data, Atom *selection, diff --git a/xboard.texi b/xboard.texi index 76b3aca..b0e4e3a 100644 --- a/xboard.texi +++ b/xboard.texi @@ -3126,6 +3126,13 @@ loaded game. Default: true. If this option is set to true, the Paste Position and Paste Game options paste from the currently selected text. If false, they paste from the clipboard. Default: false. +@item -autoCopyPV true|false +@cindex autoCopyPV, option +When this option is set, the position displayed on the board when +you terminate a PV walk +(initiated by a right-click on board or engine-output window) +will be automatically put on the clipboard as FEN. +Default: false. @item -dropMenu true|false @cindex dropMenu, option This option allows you to emulate old behavior, -- 1.7.0.4