From: H.G. Muller <h.g.muller@hccnet.nl>
Date: Sat, 6 Oct 2012 09:26:24 +0000 (+0200)
Subject: Remove all bitmap & pixmap drawing
X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=f2d58fb3e53e223517fbaae950f29aa09a4fa9a5;p=xboard.git

Remove all bitmap & pixmap drawing

All Xt code for drawing the board is now removed, as are the
-pixmapDirectory and -bitmapdirectory option. This version is now
completely dependent on cairo for handling of all graphics anywhere.
(The build-in pixmaps are still left, though, for later use as an
alterative cairo source when no png files are found.)
---

diff --git a/args.h b/args.h
index 147f8bb..1890830 100644
--- a/args.h
+++ b/args.h
@@ -211,10 +211,6 @@ ArgDescriptor argDescriptors[] = {
   { "xtitle", ArgFalse, (void *) &appData.titleInWindow, FALSE, INVALID },
   { "flashCount", ArgInt, (void *) &appData.flashCount, XBOARD, INVALID }, // let X handle this
   { "flashRate", ArgInt, (void *) &appData.flashRate, XBOARD, (ArgIniType) FLASH_RATE },
-  { "pixmapDirectory", ArgFilename, (void *) &appData.pixmapDirectory, XBOARD, (ArgIniType) "" },
-  { "pixmap", ArgFilename, (void *) &appData.pixmapDirectory, FALSE, INVALID },
-  { "bitmapDirectory", ArgFilename, (void *) &appData.bitmapDirectory, XBOARD, (ArgIniType) "" },
-  { "bm", ArgFilename, (void *) &appData.bitmapDirectory, FALSE, INVALID },
   { "pngDirectory", ArgFilename, (void *) &appData.pngDirectory, XBOARD, (ArgIniType) "" },
   { "png", ArgFilename, (void *) &appData.pngDirectory, FALSE, INVALID },
   { "soundDirectory", ArgFilename, (void *) &appData.soundDirectory, XBOARD, (ArgIniType) "" },
diff --git a/common.h b/common.h
index 752d434..d41851d 100644
--- a/common.h
+++ b/common.h
@@ -408,7 +408,6 @@ typedef struct {
     Boolean firstPlaysBlack;
     Boolean noChessProgram;
     char *host[ENGINES];
-    char *bitmapDirectory;
     char *pngDirectory;
     char *soundDirectory;
     char *remoteShell;
@@ -476,7 +475,6 @@ typedef struct {
     Boolean zippyPlay;
     int flashCount; /* Number of times to flash (xboard only) */
     int flashRate; /* Flashes per second (xboard only)  */
-    char *pixmapDirectory; /* Path to XPM/XIM files to use (xboard only) */
     int msLoginDelay;  /* Delay per character (in msec) while sending
 			  ICS logon script (xboard only) */
     Boolean colorize;	/* If True, use the following colors to color text */
diff --git a/dialogs.c b/dialogs.c
index b5d9026..61085f7 100644
--- a/dialogs.c
+++ b/dialogs.c
@@ -756,7 +756,6 @@ static int
 BoardOptionsOK (int n)
 {
     if(appData.overrideLineGap >= 0) lineGap = appData.overrideLineGap; else lineGap = defaultLineGap;
-    useImages = useImageSqs = 0;
     InitDrawingParams();
     InitDrawingSizes(-1, 0);
     DrawPosition(True, NULL);
@@ -812,8 +811,6 @@ static Option boardOptions[] = {
 { 0, 0, 0, NULL, (void*) &appData.liteBackTextureFile, ".xpm", NULL, FileName, N_("Light-Squares Texture File:") },
 { 0, 0, 0, NULL, (void*) &appData.darkBackTextureFile, ".xpm", NULL, FileName, N_("Dark-Squares Texture File:") },
 { 0, 0, 0, NULL, (void*) &appData.pngDirectory, "", NULL, PathName, N_("Directory with PNG Pieces:") },
-{ 0, 0, 0, NULL, (void*) &appData.bitmapDirectory, "", NULL, PathName, N_("Directory with Bitmap Pieces:") },
-{ 0, 0, 0, NULL, (void*) &appData.pixmapDirectory, "", NULL, PathName, N_("Directory with Pixmap Pieces:") },
 { 0, 0, 0, NULL, (void*) &BoardOptionsOK, "", NULL, EndMark , "" }
 };
 
diff --git a/xboard.c b/xboard.c
index 4f3066e..3b97fca 100644
--- a/xboard.c
+++ b/xboard.c
@@ -1207,24 +1207,6 @@ main (int argc, char **argv)
 	// [HGM] font: use defaults from settings file if available and not overruled
     }
 
-    /* Now, using squareSize as a hint, find a good XPM/XIM set size */
-    if (strlen(appData.pixmapDirectory) > 0) {
-	p = ExpandPathName(appData.pixmapDirectory);
-	if (!p) {
-	    fprintf(stderr, _("Error expanding path name \"%s\"\n"),
-		   appData.pixmapDirectory);
-	    exit(1);
-	}
-	if (appData.debugMode) {
-          fprintf(stderr, _("\
-XBoard square size (hint): %d\n\
-%s fulldir:%s:\n"), squareSize, IMAGE_EXT, p);
-	}
-	squareSize = xpm_closest_to(p, squareSize, IMAGE_EXT);
-	if (appData.debugMode) {
-	    fprintf(stderr, _("Closest %s size: %d\n"), IMAGE_EXT, squareSize);
-	}
-    }
     defaultLineGap = lineGap;
     if(appData.overrideLineGap >= 0) lineGap = appData.overrideLineGap;
 
@@ -1339,7 +1321,6 @@ XBoard square size (hint): %d\n\
 
     CatchDeleteWindow(shellWidget, "QuitProc");
 
-    CreateGCs(False);
     CreateGrid();
 
     if(appData.logoSize)
@@ -1599,45 +1580,6 @@ FindFont (char *pattern, int targetPxlSize)
 void
 ReadBitmap (Pixmap *pm, String name, unsigned char bits[], u_int wreq, u_int hreq)
 {
-    int x_hot, y_hot;
-    u_int w, h;
-    int errcode;
-    char msg[MSG_SIZ], fullname[MSG_SIZ];
-
-    if (*appData.bitmapDirectory != NULLCHAR) {
-      safeStrCpy(fullname, appData.bitmapDirectory, sizeof(fullname)/sizeof(fullname[0]) );
-      strncat(fullname, "/", MSG_SIZ - strlen(fullname) - 1);
-      strncat(fullname, name, MSG_SIZ - strlen(fullname) - 1);
-      errcode = XReadBitmapFile(xDisplay, xBoardWindow, fullname,
-				&w, &h, pm, &x_hot, &y_hot);
-      fprintf(stderr, "load %s\n", name);
-	if (errcode != BitmapSuccess) {
-	    switch (errcode) {
-	      case BitmapOpenFailed:
-		snprintf(msg, sizeof(msg), _("Can't open bitmap file %s"), fullname);
-		break;
-	      case BitmapFileInvalid:
-		snprintf(msg, sizeof(msg), _("Invalid bitmap in file %s"), fullname);
-		break;
-	      case BitmapNoMemory:
-		snprintf(msg, sizeof(msg), _("Ran out of memory reading bitmap file %s"),
-			fullname);
-		break;
-	      default:
-		snprintf(msg, sizeof(msg), _("Unknown XReadBitmapFile error %d on file %s"),
-			errcode, fullname);
-		break;
-	    }
-	    fprintf(stderr, _("%s: %s...using built-in\n"),
-		    programName, msg);
-	} else if (w != wreq || h != hreq) {
-	    fprintf(stderr,
-		    _("%s: Bitmap %s is %dx%d, not %dx%d...using built-in\n"),
-		    programName, fullname, w, h, wreq, hreq);
-	} else {
-	    return;
-	}
-    }
     if (bits != NULL) {
 	*pm = XCreateBitmapFromData(xDisplay, xBoardWindow, (char *) bits,
 				    wreq, hreq);
diff --git a/xboard.conf.in b/xboard.conf.in
index 412eb24..070091c 100644
--- a/xboard.conf.in
+++ b/xboard.conf.in
@@ -22,8 +22,6 @@
 -flashCount 0
 -flashRate 5
 -fontSizeTolerance 4
--pixmapDirectory ""
--bitmapDirectory ""
 -useBoardTexture true
 -liteBackTextureFile  "@pixmapsdir@/wood_l.xpm"
 -darkBackTextureFile  "@pixmapsdir@/wood_d.xpm"