X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=dialogs.c;h=9def05c9a50bea7c2279bae8b55abfe581e5d0b5;hb=91c06da98efcb8ee5be8f779473de0fd78391551;hp=6380b77bc27d51c90275f543ef022406921ccf81;hpb=e4def842c0f4ed63df0196ac34ffdeb6a12304fe;p=xboard.git diff --git a/dialogs.c b/dialogs.c index 6380b77..9def05c 100644 --- a/dialogs.c +++ b/dialogs.c @@ -2156,6 +2156,25 @@ ConsoleAutoPopUp (char *buf) } else PopUpMoveDialog(*buf); } +static Boolean noEcho; + +void +EchoOn () +{ + if(!noEcho) return; + system("stty echo"); + WidgetEcho(&chatOptions[CHAT_IN], 1); + noEcho = False; +} + +void +EchoOff () +{ + system("stty -echo"); + WidgetEcho(&chatOptions[CHAT_IN], 0); + noEcho = True; +} + //--------------------------------- Game-List options dialog ------------------------------------------ char *strings[LPUSERGLT_SIZE]; @@ -2364,6 +2383,7 @@ DisplayFatalError (String message, int error, int status) } if(mainOptions[W_BOARD].handle) { if (appData.popupExitMessage) { + if(appData.icsActive) SendToICS("logout\n"); // [HGM] make sure no new games will be started ErrorPopUp(status ? _("Fatal Error") : _("Exiting"), message, TRUE); } else { ExitEvent(status); @@ -2425,6 +2445,59 @@ DisplayTitle (char *text) SetWindowTitle(text, title, icon); } +static char * +ReadLine (FILE *f) +{ + static char buf[MSG_SIZ]; + int i = 0, c; + while((c = fgetc(f)) != '\n') { if(c == EOF) return NULL; buf[i++] = c; } + buf[i] = NULLCHAR; + return buf; +} + +void +GetHelpText (FILE *f, char *name) +{ + char *line, buf[MSG_SIZ], text[10000], *p = text, *q = text; + int len, cnt = 0; + snprintf(buf, MSG_SIZ, ".B %s", name); + len = strlen(buf); + for(len=1; buf[len] == ' ' || buf[len] == '-' || isalpha(buf[len]) || isdigit(buf[len]); len++); + buf[len] = NULLCHAR; + while(buf[--len] == ' ') buf[len] = NULLCHAR; + while((line = ReadLine(f))) { + if(!strncmp(line, buf, len) && (strncmp(line, ".SS ", 4) || strncmp(line+4, buf+3, len-3))) { + while((line = ReadLine(f)) && (cnt == 0 || strncmp(line, ".B ", 3))) { + if(!*line) { *p++ = '\n'; *p++ = '\n'; q = p; continue; } + if(*line == '.') continue; + *p++ = ' '; cnt++; + while(*line) { + if(*line < ' ') { line++; continue;} + if(*line == ' ' && p - q > 80) *line = '\n', q = p; + *p++ = *line++; + } + if(p - text > 9900) break; + } + *p = NULLCHAR; + ErrorPopUp("Help", text, FALSE); + return; + } + } + snprintf(text, MSG_SIZ, "No help on '%s'\n", buf+3); + DisplayNote(text); +} + +void +DisplayHelp (char *name) +{ + char *manFile = DATADIR "/../../man/man6/xboard.6"; + FILE *f = fopen(manFile, "r"); + if(f) { + GetHelpText(f, name); + fclose(f); + } +} + #define PAUSE_BUTTON "P" #define PIECE_MENU_SIZE 18 static String pieceMenuStrings[2][PIECE_MENU_SIZE+1] = { @@ -2819,6 +2892,7 @@ static char *Extensions[] = { ".trn", ".bin", ".wav", +".png", ".ini", ".log", "",