X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=13afbc52f435b666fe21ec76ee1c3997661edd45;hb=8baea05c6e9e63f8b1b57891b67b5ac0e1961b81;hp=7e8ed598b3db54170608a586a766028379be6810;hpb=40eab476400a6232e304c760c8d8559fbe697c46;p=xboard.git diff --git a/backend.c b/backend.c index 7e8ed59..13afbc5 100644 --- a/backend.c +++ b/backend.c @@ -129,6 +129,7 @@ extern int gettimeofday(struct timeval *, struct timezone *); # include "zippy.h" #endif #include "backendz.h" +#include "evalgraph.h" #include "gettext.h" #ifdef ENABLE_NLS @@ -1844,6 +1845,7 @@ read_from_player (InputSourceRef isr, VOIDSTAR closure, char *message, int count { int outError, outCount; static int gotEof = 0; + static FILE *ini; /* Pass data read from player on to ICS */ if (count > 0) { @@ -1852,6 +1854,17 @@ read_from_player (InputSourceRef isr, VOIDSTAR closure, char *message, int count if (outCount < count) { DisplayFatalError(_("Error writing to ICS"), outError, 1); } + if(have_sent_ICS_logon == 2) { + if(ini = fopen(appData.icsLogon, "w")) { // save first two lines (presumably username & password) on init script file + fprintf(ini, "%s", message); + have_sent_ICS_logon = 3; + } else + have_sent_ICS_logon = 1; + } else if(have_sent_ICS_logon == 3) { + fprintf(ini, "%s", message); + fclose(ini); + have_sent_ICS_logon = 1; + } } else if (count < 0) { RemoveInputSource(isr); DisplayFatalError(_("Error reading from keyboard"), error, 1); @@ -2513,9 +2526,7 @@ PlotSeekAd (int i) void PlotSingleSeekAd (int i) { - DrawSeekOpen(); PlotSeekAd(i); - DrawSeekClose(); } void @@ -2602,14 +2613,13 @@ DrawSeekGraph () h = BOARD_HEIGHT * (squareSize + lineGap) + lineGap; w = BOARD_WIDTH * (squareSize + lineGap) + lineGap; - DrawSeekOpen(); DrawSeekBackground(0, 0, w, h); DrawSeekAxis(hMargin, h-1-vMargin, w-5, h-1-vMargin); DrawSeekAxis(hMargin, h-1-vMargin, hMargin, 5); for(i=0; i<4000; i+= 100) if(i>=minRating && i 0) StartLoadGameTimer((long)(1000.0f * appData.timeDelay)); + AnalysisPeriodicEvent(1); } void @@ -17435,3 +17501,59 @@ LoadVariation (int index, char *text) ToNrEvent(currentMove+1); } +void +LoadTheme () +{ + char *p, *q, buf[MSG_SIZ]; + if(engineLine && engineLine[0]) { // a theme was selected from the listbox + snprintf(buf, MSG_SIZ, "-theme %s", engineLine); + ParseArgsFromString(buf); + ActivateTheme(TRUE); // also redo colors + return; + } + p = nickName; + if(*p && !strchr(p, '"')) // theme name specified and well-formed; add settings to theme list + { + int len; + q = appData.themeNames; + snprintf(buf, MSG_SIZ, "\"%s\"", nickName); + if(appData.useBitmaps) { + snprintf(buf+strlen(buf), MSG_SIZ-strlen(buf), " -ubt true -lbtf \"%s\" -dbtf \"%s\" -lbtm %d -dbtm %d", + appData.liteBackTextureFile, appData.darkBackTextureFile, + appData.liteBackTextureMode, + appData.darkBackTextureMode ); + } else { + snprintf(buf+strlen(buf), MSG_SIZ-strlen(buf), " -ubt false -lsc %s -dsc %s", + Col2Text(2), // lightSquareColor + Col2Text(3) ); // darkSquareColor + } + if(appData.useBorder) { + snprintf(buf+strlen(buf), MSG_SIZ-strlen(buf), " -ub true -border \"%s\"", + appData.border); + } else { + snprintf(buf+strlen(buf), MSG_SIZ-strlen(buf), " -ub false"); + } + if(appData.useFont) { + snprintf(buf+strlen(buf), MSG_SIZ-strlen(buf), " -upf true -pf \"%s\" -fptc \"%s\" -fpfcw %s -fpbcb %s", + appData.renderPiecesWithFont, + appData.fontToPieceTable, + Col2Text(9), // appData.fontBackColorWhite + Col2Text(10) ); // appData.fontForeColorBlack + } else { + snprintf(buf+strlen(buf), MSG_SIZ-strlen(buf), " -upf false -pid \"%s\"", + appData.pieceDirectory); + if(!appData.pieceDirectory[0]) + snprintf(buf+strlen(buf), MSG_SIZ-strlen(buf), " -wpc %s -bpc %s", + Col2Text(0), // whitePieceColor + Col2Text(1) ); // blackPieceColor + } + snprintf(buf+strlen(buf), MSG_SIZ-strlen(buf), " -hsc %s -phc %s\n", + Col2Text(4), // highlightSquareColor + Col2Text(5) ); // premoveHighlightColor + appData.themeNames = malloc(len = strlen(q) + strlen(buf) + 1); + if(insert != q) insert[-1] = NULLCHAR; + snprintf(appData.themeNames, len, "%s\n%s%s", q, buf, insert); + if(q) free(q); + } + ActivateTheme(FALSE); +}