From: H.G. Muller Date: Tue, 3 Jan 2012 20:32:04 +0000 (+0100) Subject: Implement -viewerOptions X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=a3e7cc9b3eb04ffb69fd73b47c06758f73316373;p=xboard.git Implement -viewerOptions A mechanism is added to allow the user to configure persistently if the game viewer that starts on clicking PGN files will use -ncp mode, or load an egine for analysis (or, in fact, do anything). This by introducing a persistent string option -viewerOptions, which will be parsed as a command line after the real command line when the option -viewer was present. --- diff --git a/args.h b/args.h index a9c120c..826bc38 100644 --- a/args.h +++ b/args.h @@ -646,6 +646,8 @@ ArgDescriptor argDescriptors[] = { { "stretch", ArgInt, (void *) &appData.stretch, FALSE, (ArgIniType) 1 }, { "ignoreColors", ArgBoolean, (void *) &appData.ignoreColors, FALSE, FALSE }, { "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" }, #if ZIPPY { "zippyTalk", ArgBoolean, (void *) &appData.zippyTalk, FALSE, (ArgIniType) ZIPPY_TALK }, @@ -1248,6 +1250,8 @@ InitAppData(char *lpCmdLine) /* Parse command line */ ParseArgs(StringGet, &lpCmdLine); + if(appData.viewer && appData.viewerOptions[0]) ParseArgsFromString(appData.viewerOptions); + /* [HGM] make sure board size is acceptable */ if(appData.NrFiles > BOARD_FILES || appData.NrRanks > BOARD_RANKS ) diff --git a/common.h b/common.h index 09e9e77..decda5b 100644 --- a/common.h +++ b/common.h @@ -563,6 +563,8 @@ typedef struct { Boolean useStickyWindows; Boolean bgObserve; /* [HGM] bughouse */ Boolean dualBoard; /* [HGM] dual */ + Boolean viewer; + char * viewerOptions; int adjudicateDrawMoves; Boolean autoDisplayComment; Boolean autoDisplayTags; diff --git a/pgn-viewer.desktop b/pgn-viewer.desktop index 84afb7f..9c8ce54 100644 --- a/pgn-viewer.desktop +++ b/pgn-viewer.desktop @@ -44,7 +44,7 @@ Comment=Run XBoard as PGN viewer GenericName=X-windows chess board Type=Application Categories=Game;BoardGame; -Exec=xboard -ncp -lgf %f +Exec=xboard -viewer -lgf %f Icon=xboard NoDisplay=true Terminal=false diff --git a/xoptions.c b/xoptions.c index 00ac44c..955471e 100644 --- a/xoptions.c +++ b/xoptions.c @@ -595,6 +595,8 @@ Option loadOptions[] = { { 0, 0, 0, NULL, (void*) &appData.autoDisplayComment, "", NULL, CheckBox, N_("Auto-Display Comment") }, { 0, 0, 0, NULL, NULL, NULL, NULL, Label, N_("Auto-Play speed of loaded games\n(0 = instant, -1 = off):") }, { 0, -1, 10000000, NULL, (void*) &appData.timeDelay, "", NULL, Fractional, N_("Seconds per Move:") }, +{ 0, 0, 0, NULL, NULL, NULL, NULL, Label, N_("\noptions to use in game-viewer mode:") }, +{ 0, 0, 300, NULL, (void*) &appData.viewerOptions, "", NULL, TextBox, "" }, { 0, 0, 0, NULL, NULL, NULL, NULL, Label, N_("\nThresholds for position filtering in game list:") }, { 0, 0, 5000, NULL, (void*) &appData.eloThreshold1, "", NULL, Spin, N_("Elo of strongest player at least:") }, { 0, 0, 5000, NULL, (void*) &appData.eloThreshold2, "", NULL, Spin, N_("Elo of weakest player at least:") },