diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-11-15 15:51:23 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-11-15 15:51:23 +0000 |
commit | 073f8a91054a0b84fc2a3c6feaada832d2818bf7 (patch) | |
tree | db50876cd427e92a1173013500373b04e40e4778 | |
parent | fix indent (diff) | |
download | w3m-073f8a91054a0b84fc2a3c6feaada832d2818bf7.tar.gz w3m-073f8a91054a0b84fc2a3c6feaada832d2818bf7.zip |
[w3m-dev 03435] save image with SAVE
* buffer.c (discardBuffer): check image
* file.c (loadImageBuffer): add st
IMG_FLAG_DONE_REMOVE
s/sourcefile/mailcap_source/
* fm.h (IMG_FLAG_DONT_REMOVE): added
* image.c (drawImage): & IMG_FLAG_LOADED
(deleteImage): & IMG_FLAG_DONT_REMOVE
(showImageProgress): & IMG_FLAG_LOADED
(getImage): & IMG_FLAG_LOADED
(getImageSize): & IMG_FLAG_LOADED
* main.c (vmSrc): delete ifdef USE_IMAGE
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | buffer.c | 5 | ||||
-rw-r--r-- | file.c | 22 | ||||
-rw-r--r-- | fm.h | 3 | ||||
-rw-r--r-- | image.c | 11 | ||||
-rw-r--r-- | main.c | 6 |
6 files changed, 38 insertions, 26 deletions
@@ -1,5 +1,20 @@ 2002-11-16 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + * [w3m-dev 03435] save image with SAVE + * buffer.c (discardBuffer): check image + * file.c (loadImageBuffer): add st + IMG_FLAG_DONE_REMOVE + s/sourcefile/mailcap_source/ + * fm.h (IMG_FLAG_DONT_REMOVE): added + * image.c (drawImage): & IMG_FLAG_LOADED + (deleteImage): & IMG_FLAG_DONT_REMOVE + (showImageProgress): & IMG_FLAG_LOADED + (getImage): & IMG_FLAG_LOADED + (getImageSize): & IMG_FLAG_LOADED + * main.c (vmSrc): delete ifdef USE_IMAGE + +2002-11-16 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + * [w3m-dev 03434] Re: cygwin console on Win9X * terms.c (cygwin_mouse_btn_swapped): ifdef USE_MOUSE (lastConMouse): deleted @@ -4751,4 +4766,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.518 2002/11/15 15:44:36 ukai Exp $ +$Id: ChangeLog,v 1.519 2002/11/15 15:51:23 ukai Exp $ @@ -1,4 +1,4 @@ -/* $Id: buffer.c,v 1.14 2002/11/08 15:54:46 ukai Exp $ */ +/* $Id: buffer.c,v 1.15 2002/11/15 15:51:23 ukai Exp $ */ #include "fm.h" #ifdef USE_MOUSE @@ -97,7 +97,8 @@ discardBuffer(Buffer *buf) return; if (buf->pagerSource) ISclose(buf->pagerSource); - if (buf->sourcefile) { + if (buf->sourcefile && + (!buf->real_type || strncasecmp(buf->real_type, "image/", 6))) { if (buf->real_scheme != SCM_LOCAL || buf->bufferprop & BP_FRAME) unlink(buf->sourcefile); } @@ -1,4 +1,4 @@ -/* $Id: file.c,v 1.117 2002/11/15 15:21:07 ukai Exp $ */ +/* $Id: file.c,v 1.118 2002/11/15 15:51:23 ukai Exp $ */ #include "fm.h" #include <sys/types.h> #include "myctype.h" @@ -6569,6 +6569,7 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf) FILE *src = NULL; URLFile f; MySignalHandler(*prevtrap) (); + struct stat st; loadImage(IMG_FLAG_STOP); image = New(Image); @@ -6577,7 +6578,8 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf) image->width = -1; image->height = -1; cache = getImage(image, cur_baseURL, IMG_FLAG_AUTO); - if (!cur_baseURL->is_nocache && cache->loaded == IMG_FLAG_LOADED) + if (!cur_baseURL->is_nocache && cache->loaded & IMG_FLAG_LOADED && + !stat(cache->file, &st)) goto image_buffer; prevtrap = signal(SIGINT, KeyAbort); @@ -6597,24 +6599,20 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf) cache->loaded = IMG_FLAG_LOADED; cache->index = 0; - /* - * getImageSize(cache); - */ image_buffer: + cache->loaded |= IMG_FLAG_DONT_REMOVE; + if (uf->scheme != SCM_LOCAL) + newBuf->sourcefile = cache->file; + tmp = Sprintf("<img src=\"%s\"><br><br>", html_quote(image->url)); if (newBuf == NULL) newBuf = newBuffer(INIT_BUFFER_WIDTH); - /* - * if (frame_source) { - */ tmpf = tmpfname(TMPF_SRC, ".html"); src = fopen(tmpf->ptr, "w"); - newBuf->sourcefile = tmpf->ptr; + newBuf->mailcap_source = tmpf->ptr; pushText(fileToDelete, tmpf->ptr); - /* - * } - */ + init_stream(&f, SCM_LOCAL, newStrStream(tmp)); loadHTMLstream(&f, newBuf, src, TRUE); if (src) @@ -1,4 +1,4 @@ -/* $Id: fm.h,v 1.77 2002/11/15 15:19:44 ukai Exp $ */ +/* $Id: fm.h,v 1.78 2002/11/15 15:51:24 ukai Exp $ */ /* * w3m: WWW wo Miru utility * @@ -238,6 +238,7 @@ extern int REV_LB[]; #define IMG_FLAG_UNLOADED 0 #define IMG_FLAG_LOADED 1 #define IMG_FLAG_ERROR 2 +#define IMG_FLAG_DONT_REMOVE 4 /* * Macros. @@ -1,4 +1,4 @@ -/* $Id: image.c,v 1.16 2002/11/09 21:55:24 ukai Exp $ */ +/* $Id: image.c,v 1.17 2002/11/15 15:51:24 ukai Exp $ */ #include "fm.h" #include <sys/types.h> @@ -203,7 +203,7 @@ drawImage() return; for (j = 0; j < n_terminal_image; j++) { i = &terminal_image[j]; - if (!(i->cache->loaded == IMG_FLAG_LOADED && + if (!(i->cache->loaded & IMG_FLAG_LOADED && i->width > 0 && i->height > 0)) continue; if (!(Imgdisplay_rf && Imgdisplay_wf)) { @@ -319,6 +319,7 @@ deleteImage(Buffer *buf) for (i = 0, a = al->anchors; i < al->nanchor; i++, a++) { if (a->image && a->image->cache && a->image->cache->loaded != IMG_FLAG_UNLOADED && + !(a->image->cache->loaded & IMG_FLAG_DONT_REMOVE) && a->image->cache->index < 0) unlink(a->image->cache->file); } @@ -360,7 +361,7 @@ showImageProgress(Buffer *buf) for (i = 0, l = 0, n = 0, a = al->anchors; i < al->nanchor; i++, a++) { if (a->image && a->hseq >= 0) { n++; - if (a->image->cache && a->image->cache->loaded == IMG_FLAG_LOADED) + if (a->image->cache && a->image->cache->loaded & IMG_FLAG_LOADED) l++; } } @@ -587,7 +588,7 @@ getImage(Image * image, ParsedURL *current, int flag) if (!cache->index) cache->index = ++image_index; } - if (cache->loaded == IMG_FLAG_LOADED) + if (cache->loaded & IMG_FLAG_LOADED) getImageSize(cache); return cache; } @@ -600,7 +601,7 @@ getImageSize(ImageCache * cache) if (!activeImage) return FALSE; - if (!cache || cache->loaded != IMG_FLAG_LOADED || + if (!cache || !(cache->loaded & IMG_FLAG_LOADED) || (cache->width > 0 && cache->height > 0)) return FALSE; tmp = Strnew(); @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.134 2002/11/15 15:36:48 ukai Exp $ */ +/* $Id: main.c,v 1.135 2002/11/15 15:51:24 ukai Exp $ */ #define MAINPROGRAM #include "fm.h" #include <signal.h> @@ -4230,10 +4230,6 @@ vwSrc(void) if (Currentbuf->type == NULL || Currentbuf->bufferprop & BP_FRAME) return; -#ifdef USE_IMAGE - if (!strncasecmp(Currentbuf->real_type, "image/", 6)) - return; -#endif if ((buf = Currentbuf->linkBuffer[LB_SOURCE]) != NULL || (buf = Currentbuf->linkBuffer[LB_N_SOURCE]) != NULL) { Currentbuf = buf; |