X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xaw%2Fxboard.c;h=f1d9747c642b3f02b7d9619d3dbcc041d7ac7404;hb=a799eb8719fdd78da3359ab5810adac322ea4365;hp=0d96b7fd2723b9dc7ea5a8c814cc3e7387ab2528;hpb=d6ad098f095eb0644827bf4dd6659870a1e09d07;p=xboard.git diff --git a/xaw/xboard.c b/xaw/xboard.c index 0d96b7f..f1d9747 100644 --- a/xaw/xboard.c +++ b/xaw/xboard.c @@ -183,13 +183,6 @@ extern char *getenv(); // [HGM] bitmaps: put before incuding the bitmaps / pixmaps, to know how many piece types there are. #include "common.h" -#if HAVE_LIBXPM -#include -#define IMAGE_EXT "xpm" -#else -#define IMAGE_EXT "xim" -#endif - #include "bitmaps/icon_white.bm" #include "bitmaps/icon_black.bm" #include "bitmaps/checkmark.bm" @@ -431,128 +424,6 @@ String xboardResources[] = { /* Max possible square size */ #define MAXSQSIZE 256 -static int xpm_avail[MAXSQSIZE]; - -#ifdef HAVE_DIR_STRUCT - -/* Extract piece size from filename */ -static int -xpm_getsize (char *name, int len, char *ext) -{ - char *p, *d; - char buf[10]; - - if (len < 4) - return 0; - - if ((p=strchr(name, '.')) == NULL || - StrCaseCmp(p+1, ext) != 0) - return 0; - - p = name + 3; - d = buf; - - while (*p && isdigit(*p)) - *(d++) = *(p++); - - *d = 0; - return atoi(buf); -} - -/* Setup xpm_avail */ -static int -xpm_getavail (char *dirname, char *ext) -{ - DIR *dir; - struct dirent *ent; - int i; - - for (i=0; id_name, NAMLEN(ent), ext); - if (i > 0 && i < MAXSQSIZE) - xpm_avail[i] = 1; - } - - closedir(dir); - - return 0; -} - -void -xpm_print_avail (FILE *fp, char *ext) -{ - int i; - - fprintf(fp, _("Available `%s' sizes:\n"), ext); - for (i=1; i= 0 && size= 0 && size%s: MenuItem(%s) \n ", mods, key, name); - char *buffer = malloc(buffersize+1); - snprintf(buffer, buffersize+1, ":%s%s: MenuItem(%s) \n ", mods, key, name); + char *buffer = malloc(MSG_SIZ); + snprintf(buffer, MSG_SIZ, ":%s%s: MenuItem(%s) \n ", mods, key, name); /* add string to the output */ - output = realloc(output, strlen(output) + strlen(buffer)+1); - strncat(output, buffer, strlen(buffer)); + output[shift|alt|ctrl] = realloc(output[shift|alt|ctrl], strlen(output[shift|alt|ctrl]) + strlen(buffer)+1); + strncat(output[shift|alt|ctrl], buffer, strlen(buffer)); /* clean up */ free(key); @@ -1054,7 +940,10 @@ GenerateGlobalTranslationTable (void) } } } - return output; + output[1] = realloc(output[1], strlen(output[1]) + strlen(output[0])+1); + strncat(output[1], output[0], strlen(output[0])); + free(output[0]); + return output[1]; } @@ -1102,6 +991,9 @@ main (int argc, char **argv) char *p; int forceMono = False; + extern Option chatOptions[]; // FIXME: adapt Chat window, removing ICS pane and Hide button + chatOptions[6].type = chatOptions[10].type = Skip; + srandom(time(0)); // [HGM] book: make random truly random setbuf(stdout, NULL); @@ -1109,7 +1001,7 @@ main (int argc, char **argv) debugFP = stderr; if(argc > 1 && (!strcmp(argv[1], "-v" ) || !strcmp(argv[1], "--version" ))) { - printf("%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION); + printf("%s version %s\n\n configure options: %s\n", PACKAGE_NAME, PACKAGE_VERSION, CONFIGURE_OPTIONS); exit(0); } @@ -1118,6 +1010,23 @@ main (int argc, char **argv) exit(0); } + if(argc > 1 && !strcmp(argv[1], "--show-config")) { // [HGM] install: called to print config info + typedef struct {char *name, *value; } Config; + static Config configList[] = { + { "Datadir", DATADIR }, + { "Sysconfdir", SYSCONFDIR }, + { NULL } + }; + int i; + + for(i=0; configList[i].name; i++) { + if(argc > 2 && strcmp(argv[2], configList[i].name)) continue; + if(argc > 2) printf("%s", configList[i].value); + else printf("%-12s: %s\n", configList[i].name, configList[i].value); + } + exit(0); + } + programName = strrchr(argv[0], '/'); if (programName == NULL) programName = argv[0]; @@ -1214,6 +1123,8 @@ main (int argc, char **argv) programName, appData.boardSize); exit(2); } + if(BOARD_WIDTH > 8) + squareSize = (squareSize*8 + BOARD_WIDTH/2)/BOARD_WIDTH; // scale height if (i < 7) { /* Find some defaults; use the nearest known size */ SizeDefaults *szd, *nearest; @@ -1237,8 +1148,8 @@ main (int argc, char **argv) } else { SizeDefaults *szd = sizeDefaults; if (*appData.boardSize == NULLCHAR) { - while (DisplayWidth(xDisplay, xScreen) < szd->minScreenSize || - DisplayHeight(xDisplay, xScreen) < szd->minScreenSize) { + while (DisplayWidth(xDisplay, xScreen) < (szd->minScreenSize*BOARD_WIDTH + 4)/8 || + DisplayHeight(xDisplay, xScreen) < (szd->minScreenSize*BOARD_HEIGHT + 4)/8) { szd++; } if (szd->name == NULL) szd--; @@ -1417,6 +1328,9 @@ main (int argc, char **argv) EngineOutputPopUp(); } + gameInfo.boardWidth = 0; // [HGM] pieces: kludge to ensure InitPosition() calls InitDrawingSizes() + InitPosition(TRUE); + InitBackEnd2(); if (errorExitStatus == -1) { @@ -1437,8 +1351,6 @@ main (int argc, char **argv) } } - gameInfo.boardWidth = 0; // [HGM] pieces: kludge to ensure InitPosition() calls InitDrawingSizes() - InitPosition(TRUE); UpdateLogos(TRUE); // XtSetKeyboardFocus(shellWidget, formWidget); XSetInputFocus(xDisplay, XtWindow(formWidget), RevertToPointerRoot, CurrentTime); @@ -1448,6 +1360,13 @@ main (int argc, char **argv) return 0; } +void +DoEvents () +{ + XtInputMask m; + while((m = XtAppPending(appContext))) XtAppProcessEvent(appContext, m); +} + RETSIGTYPE TermSizeSigHandler (int sig) {