From 0180a8f61d355b74439e623ea6f9e5502d56ad48 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sun, 17 Apr 2011 12:46:47 +0200 Subject: [PATCH] Make user wav file available for try-out in sound dialog The GenericReadout was adapted to be able to read a single selected value, so that the callback to the 'play' button in the sounds dialog could get the name of the 'user WAV file' without accepting all settings for the other sounds (which should only happen on 'OK', and might still be cancelled in stead). --- xoptions.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/xoptions.c b/xoptions.c index 2b29bbe..f592209 100644 --- a/xoptions.c +++ b/xoptions.c @@ -736,7 +736,7 @@ static int oldCores, oldPonder; int MakeColors P((void)); void CreateGCs P((int redo)); void CreateAnyPieces P((void)); -void GenericReadout(); +void GenericReadout P((int selected)); Widget shells[10]; Widget marked[10]; Boolean shellUp[10]; @@ -853,7 +853,7 @@ void Pick(int n) } } - GenericReadout(); // make sure ranks and file settings are read + GenericReadout(-1); // make sure ranks and file settings are read gameInfo.variant = v; appData.variant = VariantName(v); @@ -1050,6 +1050,7 @@ char *soundFiles[] = { // sound files corresponding to above names void Test(int n) { + GenericReadout(2); if(soundFiles[values[3]]) PlaySound(soundFiles[values[3]]); } @@ -1205,7 +1206,7 @@ Option boardOptions[] = { { 0, 0, 0, NULL, (void*) &BoardOptionsOK, "", NULL, EndMark , "" } }; -void GenericReadout() +void GenericReadout(int selected) { int i, j; String name, val; @@ -1213,6 +1214,7 @@ void GenericReadout() char buf[MSG_SIZ], **dest; float x; for(i=0; ; i++) { // send all options that had to be OK-ed to engine + if(selected >= 0) { if(i < selected) continue; else if(i > selected) break; } switch(currentOption[i].type) { case TextBox: case FileName: @@ -1306,12 +1308,12 @@ void GenericCallback(w, client_data, call_data) return; } if (strcmp(name, _("OK")) == 0) { // save buttons imply OK - GenericReadout(); + GenericReadout(-1); PopDown(data); return; } if(currentCps) { - if(currentOption[data].type == SaveButton) GenericReadout(); + if(currentOption[data].type == SaveButton) GenericReadout(-1); snprintf(buf, MSG_SIZ, "option %s\n", name); SendToProgram(buf, currentCps); } else ((ButtonCallback*) currentOption[data].target)(data); -- 1.7.0.4