Skip to content

Commit

Permalink
Implement -autoCopyPV
Browse files Browse the repository at this point in the history
This option causes automatic copying of the last position of a PV walk
to the clipboard.
  • Loading branch information
HGMuller committed Feb 22, 2012
1 parent a841d3b commit 6d2eb06
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions args.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
1 change: 1 addition & 0 deletions backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions xboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions xboard.texi
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 6d2eb06

Please sign in to comment.