X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=dialogs.c;h=19b69af10e458836f1e1a68563a9d8608c31682c;hb=fcf1b04ac104178d84c30b2824804f199061e250;hp=6db9c6ec86bdfd68adcf3c8849b39ff8d1480eb1;hpb=6e119123be4cf0ac4b922318e8855ee9c71743cd;p=xboard.git diff --git a/dialogs.c b/dialogs.c index 6db9c6e..19b69af 100644 --- a/dialogs.c +++ b/dialogs.c @@ -66,7 +66,7 @@ extern char *getenv(); int values[MAX_OPTIONS]; ChessProgramState *currentCps; -char dataDir[MSG_SIZ] = DATADIR, manDir[MSG_SIZ] = MANDIR; +char manDir[MSG_SIZ] = MANDIR; //----------------------------Generic dialog -------------------------------------------- @@ -546,7 +546,7 @@ Pick (int n) } gameInfo.variant = v; - appData.variant = VariantName(v); + ASSIGN(appData.variant, VariantName(v)); shuffleOpenings = FALSE; /* [HGM] shuffle: possible shuffle reset when we switch */ startedFromPositionFile = FALSE; /* [HGM] loadPos: no longer valid in new variant */ @@ -555,8 +555,9 @@ Pick (int n) appData.NrFiles = filesTmp; appData.holdingsSize = sizeTmp; appData.pieceToCharTable = NULL; - appData.pieceNickNames = ""; - appData.colorNickNames = ""; + ASSIGN(appData.pieceNickNames, ""); + ASSIGN(appData.colorNickNames, ""); + ASSIGN(appData.men, ""); PopDown(TransientDlg); Reset(True, True); return; @@ -1606,10 +1607,10 @@ static Option shuffleOptions[] = { static void SetRandom (int n) { - int r = n==2 ? -1 : random() & (1<<30)-1; + int r = n==3 ? -1 : random() & (1<<30)-1; char buf[MSG_SIZ]; snprintf(buf, MSG_SIZ, "%d", r); - SetWidgetText(&shuffleOptions[1], buf, TransientDlg); + SetWidgetText(&shuffleOptions[2], buf, TransientDlg); SetWidgetState(&shuffleOptions[0], True); } @@ -2119,6 +2120,10 @@ void ConsoleWrite(char *message, int count) { if(shellUp[ChatDlg] && chatOptions[CHAT_ICS].type != Skip) { // in Xaw this is a no-op + if(*message == 7) { + message++; // remove bell + if(strcmp(message, "\n")) return; + } AppendColorized(&chatOptions[CHAT_ICS], message, count); SetInsertPos(&chatOptions[CHAT_ICS], 999999); } @@ -2471,15 +2476,16 @@ GetHelpText (FILE *f, char *name) { char *line, buf[MSG_SIZ], title[MSG_SIZ], text[10000], *p = text, *q = text; int len, cnt = 0; + while(*name == '\n') name++; snprintf(buf, MSG_SIZ, ".B %s", name); len = strlen(buf); - for(len=1; buf[len] == ' ' || buf[len] == '-' || isalpha(buf[len]) || isdigit(buf[len]); len++); + for(len=3; buf[len] && buf[len] != '(' && buf[len] != ':' && buf[len] != '.' && buf[len] != '?' && buf[len] != '\n'; len++); buf[len] = NULLCHAR; while(buf[--len] == ' ') buf[len] = NULLCHAR; snprintf(title, MSG_SIZ, "Help on '%s'", buf+3); while((line = ReadLine(f))) { - if(!strncmp(line, buf, len) || !strncmp(line, ".SS ", 4) && !strncmp(line+4, buf+3, len-3) - || !strncmp(line, ".IX Item \"", 10) && !strncmp(line+10, buf+3, len-3)) { + if(!strncmp(line, buf, ++len) || !strncmp(line, ".SS ", 4) && !strncmp(line+4, buf+3, len-3) + || !strncmp(line, ".IX Item \"", 10) && !strncmp(line+10, buf+3, len-3)) { while((line = ReadLine(f)) && (cnt == 0 || strncmp(line, ".B ", 3) && strncmp(line, ".SS ", 4) && strncmp(line, ".IX ", 4))) { if(!*line) { *p++ = '\n'; *p++ = '\n'; q = p; continue; } if(*line == '.') continue; @@ -2543,6 +2549,8 @@ DisplayHelp (char *name) } else snprintf(buf, MSG_SIZ, "%s", xboardMan); // use xboard man f = fopen(buf, "r"); if(f) { + char *msg = "Right-clicking menu item or dialog text pops up help on it"; + ASSIGN(appData.suppress, msg); if(strstr(buf, ".gz")) { // man file is gzipped if(!manText[n]) { // unzipped text not buffered yet snprintf(tidy, MSG_SIZ, "gunzip -c %s", buf); @@ -2552,7 +2560,7 @@ DisplayHelp (char *name) } else textPtr = NULL; // use plaintext man file directly GetHelpText(f, name); fclose(f); - } + } else if(currentCps) DisplayNote("No manual is installed for this engine"); } #define PAUSE_BUTTON "P"