X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=dialogs.c;h=9def05c9a50bea7c2279bae8b55abfe581e5d0b5;hb=91c06da98efcb8ee5be8f779473de0fd78391551;hp=7db75dbd93fe695ad36d455e4453cf251b74bddc;hpb=6d85d43cbd1da3116589e825c82bcbdd38c3f65a;p=xboard.git diff --git a/dialogs.c b/dialogs.c index 7db75db..9def05c 100644 --- a/dialogs.c +++ b/dialogs.c @@ -1225,7 +1225,7 @@ static Option tagsOptions[] = { { 0, 0, 0, NULL, NULL, NULL, NULL, Label, NULL }, { 200, T_VSCRL | T_FILL | T_WRAP | T_TOP, 200, NULL, (void*) &tagsText, NULL, (char **) &TagsClick, TextBox, "", &appData.tagsFont }, { 0, 0, 100, NULL, (void*) &NewMove, NULL, NULL, Button, N_("add next move") }, -{ 0,SAME_ROW,100,NULL, (void*) &changeTags, NULL, NULL, Button, N_("save changes") }, +{ 0,SAME_ROW,100,NULL, (void*) &changeTags, NULL, NULL, Button, N_("commit changes") }, { 0,SAME_ROW, 0, NULL, (void*) &NewTagsCallback, "", NULL, EndMark , "" } }; @@ -1246,9 +1246,9 @@ changeTags (int n) } void -NewTagsPopup (char *text, char *msg) +NewTagsPopup (char *text, char *msg, char *ttl) { - char *title = bookUp ? _("Edit book") : _("Tags"); + char *title = bookUp ? _("Edit book") : ttl; tagsOptions[2].type = bookUp ? Button : Skip; tagsOptions[3].min = bookUp ? SAME_ROW : 0; @@ -1265,14 +1265,22 @@ NewTagsPopup (char *text, char *msg) void TagsPopUp (char *tags, char *msg) { - NewTagsPopup(tags, cmailMsgLoaded ? msg : NULL); + NewTagsPopup(tags, cmailMsgLoaded ? msg : NULL, _("Tags")); } void EditTagsPopUp (char *tags, char **dest) { // wrapper to preserve old name used in back-end resPtr = dest; - NewTagsPopup(tags, NULL); + NewTagsPopup(tags, NULL, _("Tags")); +} + +void +EditEnginePopUp (char *tags, char **dest) +{ // wrapper to preserve old name used in back-end + TagsPopDown(); + resPtr = dest; + NewTagsPopup(tags, NULL, _("Registered Engines")); } void @@ -2148,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]; @@ -2289,8 +2316,10 @@ ErrorPopUp (char *title, char *label, int modal) { errorUp = True; errorOptions[1].name = label; - if(dialogError = shellUp[MasterDlg]) - GenericPopUp(errorOptions+1, title, FatalDlg, MasterDlg, MODAL, 0); // pop up as daughter of the transient dialog + if(dialogError = shellUp[TransientDlg]) + GenericPopUp(errorOptions+1, title, FatalDlg, TransientDlg, MODAL, 0); // pop up as daughter of the transient dialog + else if(dialogError = shellUp[MasterDlg]) + GenericPopUp(errorOptions+1, title, FatalDlg, MasterDlg, MODAL, 0); // pop up as daughter of the master dialog else GenericPopUp(errorOptions+modal, title, modal ? FatalDlg: ErrorDlg, BoardWindow, modal, 0); // kludge: option start address indicates modality } @@ -2338,6 +2367,11 @@ DisplayFatalError (String message, int error, int status) { char buf[MSG_SIZ]; + if(status == 666) { // ignore this error when ICS Console window is up + if(shellUp[ChatDlg]) return; + status = 0; + } + errorExitStatus = status; if (error == 0) { fprintf(stderr, "%s: %s\n", programName, message); @@ -2349,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); @@ -2410,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] = { @@ -2804,6 +2892,7 @@ static char *Extensions[] = { ".trn", ".bin", ".wav", +".png", ".ini", ".log", "",