Index: kit/CHANGELOG
diff -u kit/CHANGELOG:1.9 kit/CHANGELOG:removed
--- kit/CHANGELOG:1.9	Sat Sep  5 00:11:21 1998
+++ kit/CHANGELOG	Mon Dec 31 05:10:00 2007
@@ -1,51 +0,0 @@
-CHANGELOG for magicpoint
-$Id: CHANGELOG,v 1.9 1998/09/04 15:11:21 onoe Exp $
-
-Fri Sep  5 1998  onoe@sm.sony.co.jp
-	* handle key inputs from invoked terminal as pressed on Xserver,
-	  even if the Xserver is running on a remote host.
-
-Mon Aug 26 1998  itojun@iijlab.net
-	* new copyright. (BSDish copyright without clause 3)
-
-Mon Aug 25 1998  itojun@iijlab.net
-	* print.c: better x11/freetype/vflib -> postscript font mapping.
-
-Mon Aug 23 1998  kato@wide.ad.jp
-	* embedded image support (added mgpembed.pl and embed.c)
-
-Mon Aug 22 1998  itojun@iijlab.net
-	* added contrib/xmindpath, MindPath PocketPoint user-level driver.
-
-Fri Jul 10 11:57:59 JST 1998  itojun@iijlab.net
-	* cache gs-generated image file.
-	  Suggested by: luigi@FreeBSD.org
-
-Mon Jul  6 11:38:32 JST 1998  itojun@iijlab.net
-	* capable of handling GB2312 and KSC5601 encoding.
-	  they must be encoded by using iso-2022 like escape sequences.
-	  EUC-cn or EUC-kr does not work.
-	* -x option is added.
-
-Thu Jul  2 18:04:16 JST 1998  itojun@iijlab.net
-	* eliminate gsview.
-	* revamp "xfont" directive. (see SYNTAX for detail)
-
-Thu Jun 25 13:10:28 JST 1998  itojun@iijlab.net
-	* print.c: color postscript support by "mgp2ps -c".
-
-changes between 1.02a and 1.03a:
-	* To allow color name that has space inbetween ("dark blue"), 
-	  color name after directives SHOULD come with doublequote.
-	  Therefore,
-		%fore blue
-	  should be
-		%fore "blue"
-	  At this moment, doublequote can be ommitted for backward
-	  compatibility.  We may require to have doublequote in the future.
-	  Font names and other string parameter obeys the same rule.
-	* %image is now capable of rendering encapsulated postscript files
-	  (*.eps).
-		%image foo.eps
-	  should work fine.
-	  By using -X option, you can specify device name for ghostscript.
Index: kit/configure
diff -u kit/configure:1.105 kit/configure:1.106
--- kit/configure:1.105	Mon Dec  3 18:08:40 2007
+++ kit/configure	Sat Dec 29 05:31:26 2007
@@ -7140,7 +7140,7 @@
 if test "${enable_imlib+set}" = set; then
   enableval=$enable_imlib; mgp_imlib="$enableval"
 else
-  mgp_imlib="no"
+  mgp_imlib="yes"
 fi
 
 { echo "$as_me:$LINENO: result: $mgp_imlib" >&5
Index: kit/configure.in
diff -u kit/configure.in:1.103 kit/configure.in:1.104
--- kit/configure.in:1.103	Mon Dec  3 18:08:40 2007
+++ kit/configure.in	Sat Dec 29 05:31:26 2007
@@ -3,7 +3,7 @@
 dnl independent (using srcdir), however, xmkmf and Imake.tmpl do not
 dnl allow us to switch compilation directory.
 dnl
-dnl $Id: configure.in,v 1.103 2007/12/03 09:08:40 nishida Exp $
+dnl $Id: configure.in,v 1.104 2007/12/28 20:31:26 nishida Exp $
 AC_INIT(image/imagetypes.c)
 
 dnl Checks for programs.
@@ -450,7 +450,7 @@
 AC_ARG_ENABLE(imlib,
 	[  --enable-imlib          use imlib exclusively to load images.],
 	[mgp_imlib="$enableval"],
-	[mgp_imlib="no"])
+	[mgp_imlib="yes"])
 AC_MSG_RESULT($mgp_imlib)
 if test $mgp_imlib = "yes"; then
   if type pkg-config > /dev/null 2>&1; then
Index: kit/ctlwords.pl
diff -u kit/ctlwords.pl:1.2 kit/ctlwords.pl:removed
--- kit/ctlwords.pl:1.2	Sat Sep  5 06:05:08 1998
+++ kit/ctlwords.pl	Mon Dec 31 05:10:00 2007
@@ -1,12 +0,0 @@
-#! /usr/bin/perl
-$counter = 0;	# 0 origin
-print "/* generated by ctlwords.awk. do not edit by hand. */\n";
-
-while (<>) {
-	next if (!/^\/\*CTL\*\//);
-	next if ($_ !~ /(CTL_[A-Z0-9]+)/);
-
-	$word = $1;
-	print "#define $word\t$counter\n";
-	$counter++;
-}
Index: kit/draw.c
diff -u kit/draw.c:1.235 kit/draw.c:1.238
--- kit/draw.c:1.235	Sun Nov 25 02:22:52 2007
+++ kit/draw.c	Sun Dec 30 00:02:31 2007
@@ -26,10 +26,11 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: draw.c,v 1.235 2007/11/24 17:22:52 nishida Exp $
+ * $Id: draw.c,v 1.238 2007/12/29 15:02:31 nishida Exp $
  */
 
 #include "mgp.h"
+#include <Imlib.h>
 
 /* state associated with the window - how should we treat this? */
 static struct ctrl *bg_ctl, *bg_ctl_last, *bg_ctl_cache;
@@ -79,6 +80,10 @@
 static int obj_new_xfont __P((struct render_state *, int, int, int,
 	u_int, char *));
 static int obj_new_image __P((struct render_state *, int, int, Image *, int, int));
+#ifdef USE_IMLIB
+ImlibImage *search_imdata __P((char *));
+static int obj_new_image2 __P((struct render_state *, int, int, Image *, int, int, ImlibImage *, int));
+#endif
 static int obj_new_icon __P((struct render_state *, int, int, u_int, u_int, u_long, u_int, XPoint *));
 static Pixel obj_image_color __P((Image *, Image *, Pixel, int *));
 static Image *obj_image_trans __P((Image *, u_int, u_int));
@@ -101,8 +106,8 @@
 
 static void back_gradation __P((struct render_state *, struct ctrl_grad *));
 #if 1  /* by h.kakugawa@computer.org */
-static void image_load __P((struct render_state *, char *, int, int, int, int, int, int, int, int));
-static void image_load_ps __P((struct render_state *, char *, int, int, int, int, int, int, int, int));
+static void image_load __P((struct render_state *, char *, int, int, int, int, int, int, int, int, int));
+static void image_load_ps __P((struct render_state *, char *, int, int, int, int, int, int, int, int, int));
 #else
 static void image_load __P((struct render_state *, char *, int, int, int, int, int, int));
 static void image_load_ps __P((struct render_state *, char *, int, int, int, int, int, int));
@@ -156,6 +161,22 @@
 XRenderColor xft_render_color;
 #endif
 
+#ifdef USE_IMLIB
+static void regist_zimage_position __P((struct render_object *, int, int, int, int));
+static void clear_zimage __P((void));
+static void clear_resion __P((int, int, int, int));
+#define ZIMAGENUM 100
+static ImlibImage *zimage[ZIMAGENUM];
+static int zonzoom[ZIMAGENUM];
+static int zx[ZIMAGENUM];
+static int zx[ZIMAGENUM];
+static int zy[ZIMAGENUM];
+static int zwidth[ZIMAGENUM];
+static int zheight[ZIMAGENUM];
+static int zimgnum;
+#endif
+extern int zoomin;
+
 static int
 ispsfilename(p0)
 	char *p0;
@@ -183,8 +204,12 @@
 	u_int page;
 	int repaint;
 {
-	if (!repaint)
+	if (!repaint) {
 		purgechild(state->page);
+#ifdef USE_IMLIB
+		clear_zimage();
+#endif
+	}
 
 	state->page = page;
 	state->line = 0;
@@ -236,6 +261,9 @@
 	if (page_attribute[state->page].pg_linenum < state->line) {
 		if (state->page < maxpage) {
 			purgechild(state->page);
+#ifdef USE_IMLIB
+			clear_zimage();
+#endif
 			if (mgp_flag & FL_FRDCACHE &&
 				cached_page == state->page + 1) {
 					/* Hit cache */
@@ -661,7 +689,7 @@
 #if 1  /* by h.kakugawa@computer.org */
 			image_load_ps(state, cp->ctm_fname, cp->ctm_numcolor,
 				cp->ctm_ximagesize, cp->ctm_yimagesize, 0,
-				cp->ctm_zoomflag, 0, cp->ctm_raise, cp->ctm_rotate);
+				cp->ctm_zoomflag, 0, cp->ctm_raise, cp->ctm_rotate, cp->ctm_clkonzoom);
 #else
 			image_load_ps(state, cp->ctm_fname, cp->ctm_numcolor,
 				cp->ctm_ximagesize, cp->ctm_yimagesize, 0,
@@ -671,7 +699,7 @@
 #if 1  /* by h.kakugawa@computer.org */
 			image_load(state, cp->ctm_fname, cp->ctm_numcolor,
 				cp->ctm_ximagesize, cp->ctm_yimagesize, 0,
-				cp->ctm_zoomflag, 0, cp->ctm_raise, cp->ctm_rotate);
+				cp->ctm_zoomflag, 0, cp->ctm_raise, cp->ctm_rotate, cp->ctm_clkonzoom);
 #else
 			image_load(state, cp->ctm_fname, cp->ctm_numcolor,
 				cp->ctm_ximagesize, cp->ctm_yimagesize, 0,
@@ -1782,6 +1810,36 @@
 	return 1;
 }
 
+#ifdef USE_IMLIB
+static int
+obj_new_image2(state, x, y, image, xzoom, yzoom, imimage, clkonzoom)
+	struct render_state *state;
+	int x, y;
+	Image *image;
+	int xzoom, yzoom;
+	ImlibImage *imimage;
+	int clkonzoom;
+{
+	struct render_object *obj;
+
+	obj = obj_alloc(state);
+	if (obj == NULL)
+		return 0;
+	obj->x = x;
+	obj->y = y;
+	obj->type = O_IMAGE;
+	obj->data.image.image = image;
+	obj->data.image.xzoom = xzoom;
+	obj->data.image.yzoom = yzoom;
+	obj->ascent = 0;	/*XXX*/
+	obj->descent = image->height * yzoom / 100;	/*XXX*/
+	obj->vertloc = VL_TOP;
+	obj->data.image.imimage = imimage;
+	obj->data.image.clkonzoom = clkonzoom;
+	return 1;
+}
+#endif
+
 static int
 obj_new_icon(state, x, y, itype, isize, color, npoint, xpoint)
 	struct render_state *state;
@@ -2052,6 +2110,12 @@
 		XSetBackground(display, gcfore, back_color[caching]);
 	XPutImage(display, target, gcfore, xim, 0, 0,
 		x, y, xim->width, xim->height);
+
+#ifdef USE_IMLIB
+	if (obj->data.image.clkonzoom) {
+		regist_zimage_position(obj, x, y, xim->width, xim->height);
+	}
+#endif
 	freeXImage(image, ximageinfo);
 }
 
@@ -3121,7 +3185,7 @@
 
 
 static void
-image_load(state, filename, numcolor, ximagesize, yimagesize, backflag, zoomflag, centerflag, raise, rotate)
+image_load(state, filename, numcolor, ximagesize, yimagesize, backflag, zoomflag, centerflag, raise, rotate, clkonzoom)
 	struct render_state *state;
 	char *filename;
 	int numcolor;
@@ -3132,6 +3196,7 @@
 	int centerflag;
 	int raise;
 	int rotate;
+	int clkonzoom;
 {
 	Image *image, *myimage;
 	Pixmap mypixmap;
@@ -3143,6 +3208,9 @@
 	static Cursor curs;
 	static char backfile[MAXPATHLEN];
 	static int backzoom, backnumcolor, backx, backy;
+#ifdef USE_IMLIB
+	ImlibImage *imimage;
+#endif
 
 	if (!caching){
 		if (!curs)
@@ -3299,9 +3367,17 @@
 	else
 		image_posx = 0;
 
+#ifdef USE_IMLIB
+	imimage = search_imdata(filename);
+	obj_new_image2(state, state->linewidth + image_posx,
+		- height * yzoomrate / 100 / 2,
+		myimage, xzoomrate, yzoomrate, imimage, clkonzoom);
+#else
 	obj_new_image(state, state->linewidth + image_posx,
 		- height * yzoomrate / 100 / 2,
 		myimage, xzoomrate, yzoomrate);
+#endif
+
 	state->linewidth += (width * xzoomrate / 100);
 end:
 	if (!caching){
@@ -3311,7 +3387,7 @@
 }
 
 static void
-image_load_ps(state, filename, numcolor, ximagesize, yimagesize, backflag, zoomflag, centerflag, raise, rotate)
+image_load_ps(state, filename, numcolor, ximagesize, yimagesize, backflag, zoomflag, centerflag, raise, rotate,clkonzoom)
 	struct render_state *state;
 	char *filename;
 	int numcolor;
@@ -3322,13 +3398,14 @@
 	int centerflag;
 	int raise;
 	int rotate;
+	int clkonzoom;
 {
 	int x1, y1, x2, y2;
 	static Cursor curs;
 	char fullname[MAXPATHLEN];
 	char *imagefile;
 	int width, height;
-	float xzoom, yzoom;
+	float xzoom, yzoom, zratio;
 	char *p;
 
 	/* wait for a while, please. */
@@ -3387,8 +3464,17 @@
 	height = height * yzoom / 100;
 #endif
 
+#ifndef USE_IMLIB 
 	imagefile = epstoimage(state, fullname, x1, y1, width, height, xzoom,
 		yzoom);
+#else
+	if (clkonzoom) 
+		zratio = (float) clkonzoom / 100.0 * window_width / width;
+	else 
+		zratio = 1.0;
+	imagefile = epstoimage(state, fullname, x1, y1, 
+		width * zratio, height * zratio, xzoom * zratio, yzoom * zratio);
+#endif
 	if (imagefile == NULL) {
 		fprintf(stderr, "WARN: cannot generate %s file from %s\n",
 			gsdevice, filename);
@@ -3401,8 +3487,13 @@
 		fprintf(stderr, "image_load_ps: %s: %s file = %s\n",
 			filename, gsdevice, imagefile);
 	}
+#ifndef USE_IMLIB 
 	image_load(state, imagefile, numcolor, 100, 100, backflag,
-		Z_NORMAL | (Z_NORMAL << Z_YSHIFT), centerflag, raise, rotate);
+		Z_NORMAL | (Z_NORMAL << Z_YSHIFT), centerflag, raise, rotate, clkonzoom);
+#else
+	image_load(state, imagefile, numcolor, 100.0 /zratio, 100.0/zratio, backflag,
+		Z_NORMAL | (Z_NORMAL << Z_YSHIFT), centerflag, raise, rotate, clkonzoom);
+#endif
 	/* XXX: unlink imagefile in /tmp */
 	if ((p = strrchr(imagefile, '/')) != NULL)
 		p++;
@@ -3508,7 +3599,7 @@
 		if (icon_y == 0) icon_y = 1;
 		tmp_color = fore_color[caching];
 		fore_color[caching] = cp->ctic_color;
-		image_load(state, cp->ctic_value, 0, icon_x, icon_y, 0, 0, 1, 0, 0);
+		image_load(state, cp->ctic_value, 0, icon_x, icon_y, 0, 0, 1, 0, 0, 0);
 		fore_color[caching] = tmp_color;
 		break;
 
@@ -4890,7 +4981,7 @@
 		case CTL_BIMAGE: 
 			image_load(state, ctl->ctm_fname, ctl->ctm_numcolor,
 						ctl->ctm_ximagesize, ctl->ctm_yimagesize, 1,
-						ctl->ctm_zoomflag, 0, 0, ctl->ctm_rotate);
+						ctl->ctm_zoomflag, 0, 0, ctl->ctm_rotate, 0);
 			break;
 		case CTL_BGRAD:
 			back_gradation(state, &ctl->ct_val.ctrl_grad);
@@ -5430,3 +5521,143 @@
 	return 1;
 }
 #endif
+
+#ifdef USE_IMLIB
+void
+regist_zimage_position(obj, x, y, width, height)
+	struct render_object *obj;
+	int x, y, width, height;
+{
+	int i;
+
+	for (i = 0; i < zimgnum; i ++){
+		if (zimage[i] == obj->data.image.imimage) return;
+	}
+	zimage[zimgnum] = obj->data.image.imimage;
+	zonzoom[zimgnum] = obj->data.image.clkonzoom;
+	zx[zimgnum] = x;
+	zy[zimgnum] = y;
+	zwidth[zimgnum] = width;
+	zheight[zimgnum] = height;
+	zimgnum ++;
+}
+
+static void
+clear_zimage()
+{
+	zimgnum = 0;
+	zoomin = 0;
+	manage_pixmap((Pixmap)NULL, 0);
+}
+
+int
+search_zimage(x, y)
+	int x, y;
+{
+	int i;
+	for (i = 0; i < zimgnum; i ++){
+		if (zx[i] <= x && zx[i] + zwidth[i] >= x && 
+		    zy[i] <= y && zy[i] + zheight[i] >= y) {
+			return i;
+		}
+	}
+	return -1;
+}
+
+void
+zoomin_zimage(id) 
+	int id;
+{
+	Pixmap pixmap;
+	int i, w, h, x, y, xf, yf;
+	int ratio = 10; 
+	float zstep = (window_width * zonzoom[id] / 100.0 - zwidth[id]) / (float)ratio;
+	float xstep;
+	float ystep;
+	float xyratio = (float)zheight[id] / zwidth[id];
+
+	xf = window_width * (100 - zonzoom[id]) / 200.0; 
+	yf = (window_height - (window_width * zonzoom[id] / 100.0 * xyratio)) / 2;
+	xstep = (float)(xf - zx[id]) / ratio;
+	ystep = (float)(yf - zy[id]) / ratio;
+
+	 for (i = 0; i <= ratio; i ++) {
+		w = zstep * i + zwidth[id];	
+		h = w * xyratio+1;
+		x = zx[id] + xstep * i;
+		y = zy[id] + ystep * i;
+		pixmap = pixmap_fromimimage(zimage[id], w, h); 
+		manage_pixmap(pixmap, 1);
+		if (i > 0) clear_resion(id, i-1, i, 0); 
+		XCopyArea(display, pixmap, window, gcfore, 0,0, w, h, x, y); 
+		XFlush(display);
+		if (i < ratio) usleep(10000);
+	 }
+}
+
+void
+zoomout_zimage(id) 
+	int id;
+{
+	Pixmap pixmap;
+	int i, w, h, x, y, xf, yf;
+	int ratio = 10; 
+	float zstep = (window_width * zonzoom[id] / 100.0 - zwidth[id]) / (float)ratio;
+	float xstep;
+	float ystep;
+	float xyratio = (float)zheight[id] / zwidth[id];
+
+	xf = window_width * (100 - zonzoom[id]) / 200.0; 
+	yf = (window_height - (window_width * zonzoom[id] / 100.0 * xyratio)) / 2;
+	xstep = (float)(xf - zx[id]) / ratio;
+	ystep = (float)(yf - zy[id]) / ratio;
+
+	for (i = ratio; i >= 0; i --) {
+		w = zstep * i + zwidth[id];	
+		h = w * xyratio+1;
+		x = zx[id] + xstep * i;
+		y = zy[id] + ystep * i;
+		pixmap = pixmap_fromimimage(zimage[id], w, h); 
+		manage_pixmap(pixmap, 1);
+		if (i < ratio) clear_resion(id, i+1, i, 0);
+		XCopyArea(display, pixmap, window, gcfore, 0, 0, w, h, x, y); 
+		XFlush(display);
+		if (i > 0) usleep(10000);
+	}
+	clear_resion(id, ratio, 2, 1);
+}
+
+void
+clear_resion(id, prev, cur, clear)
+	int id, prev, cur, clear;
+{
+	int i, w, h, x, y, xf, yf;
+	int x1, x2, y1, y2, w1, w2, h1, h2;
+	int ratio = 10; 
+	float zstep = (window_width * zonzoom[id] / 100.0 - zwidth[id]) / (float)ratio;
+	float xstep;
+	float ystep;
+	float xyratio = (float)zheight[id] / zwidth[id];
+
+	xf = window_width * (100 - zonzoom[id]) / 200.0; 
+	yf = (window_height - (window_width * zonzoom[id] / 100.0 * xyratio)) / 2;
+	xstep = (float)(xf - zx[id]) / ratio;
+	ystep = (float)(yf - zy[id]) / ratio;
+
+	x1 = zx[id] + xstep * prev;
+	y1 = zy[id] + ystep * prev;
+	w1 = zstep * prev + zwidth[id];	
+	h1 = w1 * xyratio+1;
+
+	x2 = zx[id] + xstep * cur;
+	y2 = zy[id] + ystep * cur;
+	w2 = zstep * cur + zwidth[id];	
+	h2 = w2 * xyratio+1;
+
+	if (x2 > x1) XClearArea(display, window, x1, y1, x2, y1 + h1, clear); 
+	if (y2 > y1) XClearArea(display, window, x1, y1, x1 + w1, y2, clear); 
+	if (x2 + w2 < x1 + w1) XClearArea(display, window, x2 + w2, y1, x1 + w1, y1 + h1, clear); 
+	if (y2 + h2 < y1 + h1) XClearArea(display, window, x1, y2 + h2, x1 + w1, y1 + h1, clear); 
+
+}
+#endif
Index: kit/grammar.y
diff -u kit/grammar.y:1.48 kit/grammar.y:1.49
--- kit/grammar.y:1.48	Sun Nov 25 02:47:28 2007
+++ kit/grammar.y	Sat Dec 29 05:31:26 2007
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: grammar.y,v 1.48 2007/11/24 17:47:28 nishida Exp $
+ * $Id: grammar.y,v 1.49 2007/12/28 20:31:26 nishida Exp $
  */
 /*
  * partly derived from lbl libpcap source code, which has the following
@@ -358,6 +358,7 @@
 	ct->ctm_zoomflag = Z_NORMAL | (Z_NORMAL << Z_YSHIFT);
 	ct->ctm_raise = 0;
 	ct->ctm_rotate = 0;
+	ct->ctm_clkonzoom = 0;
 
 	for (p = arg; p; p = p->ct_next) {
 		if (p->ctc_value[0] != '-')
@@ -413,6 +414,13 @@
 		} else if (strcmp(p->ctc_value, "-rotate") == 0 && p->ct_next) {
 			p = p->ct_next;
 			ct->ctm_rotate = atoi(p->ctc_value);
+		} else if (strcmp(p->ctc_value, "-clkonzoom") == 0 && p->ct_next) {
+			p = p->ct_next;
+#ifdef USE_IMLIB
+			ct->ctm_clkonzoom = atoi(p->ctc_value);
+#else
+			fprintf(stderr, "warning: cannot use -clkonzoom option in this configuration\n");
+#endif
 		} else {
 			yyerror("invalid argument %s specified for newimage",
 				p->ctc_value);
Index: kit/mgp.c
diff -u kit/mgp.c:1.147 kit/mgp.c:1.150
--- kit/mgp.c:1.147	Fri May 18 01:48:12 2007
+++ kit/mgp.c	Sun Dec 30 00:02:31 2007
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: mgp.c,v 1.147 2007/05/17 16:48:12 itojun Exp $
+ * $Id: mgp.c,v 1.150 2007/12/29 15:02:31 nishida Exp $
  */
 
 static char *mgp_version = "1.12a (20070123)";
@@ -52,6 +52,7 @@
 time_t t_start;
 u_int t_fin;
 u_int tbar_mode;
+int zoomin = 0;
 
 static int rakugaki = 0;
 static int rakugaki_x = -1;
@@ -895,6 +896,19 @@
 				if (e.xbutton.button == 1) {
 					struct render_state tstate;
 					tstate = state;
+					int zid;
+#ifdef USE_IMLIB
+					if (zoomin == 1){
+						zoomin = 0;
+						zoomout_zimage(zid);
+						break;
+					}
+					if ((zid = search_zimage(e.xbutton.x, e.xbutton.y)) >= 0){
+						zoomin_zimage(zid);
+						zoomin = 1;
+						break;
+					}
+#endif
 
 					if (!shift && state.cp
 					 && state.cp->ct_op == CTL_PAUSE) {
Index: kit/mgp.h
diff -u kit/mgp.h:1.144 kit/mgp.h:1.145
--- kit/mgp.h:1.144	Fri Feb 16 22:50:04 2007
+++ kit/mgp.h	Sat Dec 29 05:31:26 2007
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: mgp.h,v 1.144 2007/02/16 13:50:04 nishida Exp $
+ * $Id: mgp.h,v 1.145 2007/12/28 20:31:26 nishida Exp $
  */
 
 #include <stdio.h>
@@ -246,6 +246,7 @@
 	u_int ct_zoomflag;
 	u_int ct_raise;
 	u_int ct_rotate; /* +/-180, +/-90, 0, 270 */
+	u_int ct_clkonzoom; 
 #define Z_XMASK		0x0f
 #define Z_YMASK		0xf0
 #define Z_YSHIFT	4
@@ -345,6 +346,7 @@
 #define ctm_zoomflag	ct_val.ctrl_image.ct_zoomflag
 #define ctm_raise	ct_val.ctrl_image.ct_raise
 #define ctm_rotate	ct_val.ctrl_image.ct_rotate
+#define ctm_clkonzoom	ct_val.ctrl_image.ct_clkonzoom
 #define ctd_colors	ct_val.ctrl_grad.colors
 #define ctd_g_colors	ct_val.ctrl_grad.ct_g_colors
 #define ctd_numcolor	ct_val.ctrl_grad.ct_numcolor
@@ -503,6 +505,10 @@
 		struct {
 			Image *image;
 			float xzoom, yzoom;
+#ifdef USE_IMLIB
+			int clkonzoom;
+			ImlibImage *imimage;
+#endif
 		} image;
 		struct {
 			u_int itype;
Index: kit/image/gif.h
diff -u kit/image/gif.h:1.2 kit/image/gif.h:removed
--- kit/image/gif.h:1.2	Mon Dec 28 17:23:03 1998
+++ kit/image/gif.h	Mon Dec 31 05:10:01 2007
@@ -1,72 +0,0 @@
-/* gif.h:
- *
- * gifin.h
- * kirk johnson
- * november 1989
- * external interface to gifin.c
- *
- * Copyright 1989 Kirk L. Johnson (see the included file
- * "kljcpyrght.h" for complete copyright information)
- */
-
-/*
- * gifin return codes
- */
-#define GIFIN_SUCCESS       0   /* success */
-#define GIFIN_DONE          1   /* no more images */
-
-#define GIFIN_ERR_BAD_SD   -1   /* bad screen descriptor */
-#define GIFIN_ERR_BAD_SEP  -2   /* bad image separator */
-#define GIFIN_ERR_BAD_SIG  -3   /* bad signature */
-#define GIFIN_ERR_EOD      -4   /* unexpected end of raster data */
-#define GIFIN_ERR_EOF      -5   /* unexpected end of input stream */
-#define GIFIN_ERR_FAO      -6   /* file already open */
-#define GIFIN_ERR_IAO      -7   /* image already open */
-#define GIFIN_ERR_NFO      -8   /* no file open */
-#define GIFIN_ERR_NIO      -9   /* no image open */
-
-/*
- * colormap indices 
- */
-
-#define GIF_RED  0
-#define GIF_GRN  1
-#define GIF_BLU  2
-
-/*
- * typedef BYTE for convenience
- */
-
-typedef unsigned char BYTE;
-
-static int gifin_open_file();
-static int gifin_open_image();
-static int gifin_get_pixel();
-#if 0
-static int gifin_close_image();
-#endif
-static int gifin_close_file();
-static int gifin_load_cmap();
-static int gifin_skip_extension();
-static int gifin_read_data_block();
-static int gifin_push_string();
-static void gifin_add_string();
-static void gifin_fatal();
-
-/* #defines, typedefs, and such
- */
-
-#define GIF_SIG      "GIF87a"
-#define GIF_SIG_89   "GIF89a"
-#define GIF_SIG_LEN  6          /* GIF signature length */
-#define GIF_SD_SIZE  7          /* GIF screen descriptor size */
-#define GIF_ID_SIZE  9          /* GIF image descriptor size */
-
-#define GIF_SEPARATOR   ','     /* GIF image separator */
-#define GIF_EXTENSION   '!'     /* GIF extension block marker */
-#define GIF_TERMINATOR  ';'     /* GIF terminator */
-
-#define STAB_SIZE  4096         /* string table size */
-#define PSTK_SIZE  4096         /* pixel stack size */
-
-#define NULL_CODE  -1           /* string table null code */
Index: kit/image/imlib_loader.c
diff -u kit/image/imlib_loader.c:1.3 kit/image/imlib_loader.c:1.5
--- kit/image/imlib_loader.c:1.3	Sat Dec 30 02:00:17 2006
+++ kit/image/imlib_loader.c	Sun Dec 30 00:02:31 2007
@@ -8,6 +8,12 @@
 #include <X11/extensions/shape.h>
 #include <Imlib.h>
 
+#define IMFILENUM 500
+static char imfile[IMFILENUM][1024];
+static ImlibImage *imdata[IMFILENUM];
+static int imnum;
+static ImlibData *id;
+
 int imIdent(char *fullname, char *name)
 {
 	return 1;
@@ -17,16 +23,19 @@
 {
 	static Display *disp = NULL;
 	Image *image;
-	static ImlibData *id;
 	ImlibImage *im;
 	ImlibColor shape;
 	unsigned int w,h, size;
+	ImlibImage *search_imdata();
+	void regist_imdata();
 
 	if (disp == NULL) {
 		disp=XOpenDisplay(NULL);
 	}
 	if (id == NULL) id=Imlib_init(disp);
-	im=Imlib_load_image(id, fullname);
+	if ((im = search_imdata(fullname)) == NULL) {
+		im = Imlib_load_image(id, fullname);
+	}
 	if (im == NULL) {
 		return NULL;
 	}
@@ -50,9 +59,64 @@
 	    ((shape.b & 0xff) <<  0);
 
 	image->title = dupString(name);
+#if 0
 	Imlib_kill_image(id, im);
+#else
+	regist_imdata(fullname, im);
+#endif
 	
 	return image;
 }
 
+ImlibImage *search_imdata(char *fullname)
+{
+	int i;
+	for (i = 0; i < imnum; i ++){
+		if (!strcmp(imfile[i], fullname)) {
+			return imdata[i];
+		}
+	}
+	return NULL;
+}
+
+void regist_imdata(fullname, im)
+	char *fullname; 
+	ImlibImage *im;
+{
+	strcpy(imfile[imnum], fullname);	
+	imdata[imnum] = im;
+	imnum ++;
+}
+
+Pixmap pixmap_fromimimage(imimage, width, height)
+	ImlibImage *imimage;
+	int width, height;
+{
+	static Pixmap pixmap;
+	Imlib_render(id, imimage, width, height);
+	pixmap = Imlib_move_image(id, imimage);
+
+	return pixmap;
+}
+
+void
+manage_pixmap(pixmap, add)
+	Pixmap pixmap;
+	int add;
+{
+	static int pnum = 0;
+	static Pixmap pmap[100];
+	int i;
+
+	if (add) {
+		pmap[pnum] = pixmap;
+		pnum ++;
+	} else {
+		for (i = 0; i < pnum; i ++) {
+			Imlib_free_pixmap(id, pmap[i]);
+		}
+		pnum = 0;
+	}
+}
+
 #endif
Index: kit/image/xloadimage.h
diff -u kit/image/xloadimage.h:1.1.1.1 kit/image/xloadimage.h:1.2
--- kit/image/xloadimage.h:1.1.1.1	Mon Oct 27 00:26:14 1997
+++ kit/image/xloadimage.h	Sat Dec 29 05:31:26 2007
@@ -15,6 +15,10 @@
 #include "image.h"
 #include "options.h"
 
+#ifdef USE_IMLIB
+#include <Imlib.h>
+#endif
+
 /* image name and option structure used when processing arguments
  */
 
Index: kit/sample/cloud.gif
Index: kit/sample/dad.gif
Index: kit/sample/dns-jp.mgp
diff -u kit/sample/dns-jp.mgp:1.5 kit/sample/dns-jp.mgp:removed
--- kit/sample/dns-jp.mgp:1.5	Fri Sep  4 21:33:18 1998
+++ kit/sample/dns-jp.mgp	Mon Dec 31 05:10:01 2007
@@ -1,130 +0,0 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%
-%%	This file is automatically created from the file
-%%	main.pre modified at Fri Jan 23 14:31:24 1998
-%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%
-%include "default.mgp"
-%% "noop" cancels definitions in default.mgp
-%default 1 left, size 7, fore "light yellow", back "blue4", font "standard", ccolor "white", vgap 35
-%default 2 noop
-%default 3 fore "white", bar "gray70", vgap 10
-%default 4 noop
-%tab 1 noop
-%tab 2 noop
-%tab 3 noop
-%%%
-%page
-%nodefault
-%fore "red", back "blue4", size 9, vgap 15
-%center, fore "yellow", font "thick"
-%ccolor "white"
-
-
-
-Root DNS `M' $B$K$D$$$F(B
-
-%size 6, fore "red", font "thick"
-$B2CF#(B   $BO/(B
-
-%size 5, fore "white", font "standard"
-$BEl5~Bg3XBg7?7W;;5!%;%s%?!<(B
-
-
-%font "typewriter"
-kato@wide.ad.jp
-%font "standard"
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%page
-
-%back "blue4"
-  $B7P0^(B (1)
-%fore "red", size 6, font "thick"
-   $B!y(B Root DNS
-%fore "white", size 5, font "standard"
-       $B!&(B $B#9Bf$G1?MQ(B
-%fore "white", size 5, font "standard"
-          $B!](B $B#8Bf$,(B US
-          $B!](B Stockholm $B$K#1Bf(B
-%fore "white", size 5, font "standard"
-       $B!&(B $B:GBg$G#1#3Bf(B
-%fore "white", size 5, font "standard"
-          $B!](B $B%Q%1%C%HD9$N@)Ls(B
-%fore "red", size 6, font "thick"
-   $B!y(B Root DNS $B$N1?MQ4p=`(B
-%fore "white", size 5, font "standard"
-       $B!&(B RFC 2010
-       $B!&(B gTLD $B$H$N4X78(B
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%page
-
-%back "blue4"
-  $B7P0^(B (2)
-%fore "red", size 6, font "thick"
-   $B!y(B IEPG $B$G3HD%$r8!F$(B
-   $B!y(B $B%h!<%m%C%QCO0h(B
-%fore "white", size 5, font "standard"
-       $B!&(B LINX $B$K?7@_(B : 1997 $BG/(B 4 $B7n(B
-%fore "white", size 5, font "standard"
-          $B!](B RIPE/NCC $B$,4IM}(B
-          $B!](B `K'
-%fore "red", size 6, font "thick"
-   $B!y(B $B%"%8%"B@J?MNCO0h(B
-%fore "white", size 5, font "standard"
-       $B!&(B NSPIXP-2 $B!'(B 1997 $BG/(B 8 $B7n(B
-%fore "white", size 5, font "standard"
-          $B!](B WIDE $B$,4IM}(B
-          $B!](B `M'
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%page
-
-%back "blue4"
-  `M'
-%fore "red", size 6, font "thick"
-   $B!y(B $B9=@.(B
-%fore "white", size 5, font "standard"
-       $B!&(B $B#2Bf$N(B PentiumPro 200MHz
-       $B!&(B Primary/Backup$B!"(B $B<+F0@Z$jBX$((B
-%fore "red", size 6, font "thick"
-   $B!y(B Root-only $B%5!<%P(B
-%fore "white", size 5, font "standard"
-       $B!&(B 
-%cont, font "typewriter"
-202.12.27.33
-%font "standard"
-       $B!&(B 400 $B!A(B 500 query/sec
-%fore "red", size 6, font "thick"
-   $B!y(B $B1?MQ4IM}(B
-%fore "white", size 5, font "standard"
-       $B!&(B WIDE $B$*$h$S(B ISP $BM-;V(B
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%page
-
-%back "blue4"
-  $B$*4j$$(B
-%fore "red", size 6, font "thick"
-   $B!y(B $B:G?7$N(B root.cache $B$NF~$l49$((B
-%fore "white", size 5, font "standard"
-       $B!&(B 
-%cont, font "typewriter"
-1997082200
-%fore "red", size 6, font "thick"
-   $B!y(B Named $B$N99?7(B
-%fore "white", size 5, font "standard"
-       $B!&(B 4.9.6/8.8.1
-%fore "red", size 6, font "thick"
-   $B!y(B $BM7$P$J$$$G!'(B
-%fore "white", size 5, font "standard"
-       $B!&(B 
-%cont, font "typewriter"
-ping/traceroute
-%font "standard"
-       $B!&(B 
-%cont, font "typewriter"
-telnet/spray/...
-%fore "red", size 6, font "thick"
-   $B!y(B Thanks to
-%fore "white", size 5, font "standard"
-       $B!&(B $BF|K\(B Cisco/$BB?$/$N(B ISP
-       $B!&(B `M' $B4IM}%0%k!<%W(B
Index: kit/sample/mgp-old1.gif
Index: kit/sample/mgp-old2.gif
Index: kit/sample/mgp-old3.gif
Index: kit/sample/mgp1.gif
Index: kit/sample/mgp2.gif
Index: kit/sample/mgp3.gif
Index: kit/sample/sample.mgp
diff -u kit/sample/sample.mgp:1.32 kit/sample/sample.mgp:1.34
--- kit/sample/sample.mgp:1.32	Sun Jan 21 19:15:32 2007
+++ kit/sample/sample.mgp	Sat Dec 29 19:59:57 2007
@@ -309,6 +309,16 @@
 		tap space bar to see the 'special effect'. 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %PAGE
+%back "white"
+
+Enlarging Images in Slides
+
+	You can enlarge images by clicking on them 
+		Use -clkonzoom option in %newimage
+		Click the following image to see this feature
+%center, newimage -xscrzoom 20 -clkonzoom 95 "cloud.jpg"
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%PAGE
 %bgrad 0 0 256 0 0 "skyblue" "white"
 %PCACHE 0 
 
Index: kit/sample/v6header.gif
