Lambert Duijst
2002-08-01 08:03:43 UTC
Hi people,
I am considering to use viewml for my project, it is really a great browser.
But I found out that it lacks support for animated gif's (when used with
nano-X, I don't know what it does with other windowing systems) which would
be a cool feature. That is why I made a start for support of animated gif.
I will send you my patch, but I have to say that it is not complete yet. It
completely ignores the sequence/timing of the animated gif's and it makes the
area sizes of all pictures in the animation equal to the one of the first
picture. Some of the times this causes gif's to be displayed incorrectly. And
sometimes I have problems with pallette's.
As you see it is far from fully functional yet , but I wanted to let you guys
know that I am working on this. I would like to receive some comments /
reactions and perhaps tips to enhance the code as I am not yet familiar with
the entire viewml code.
The patch is for viewml 0-21 with the use of nano-X perhaps it will also work
on X-windows.
Then I have one more question, I run viewml on a redhat 7.1 intel machine and
on my target , which is an arm720T running at 75 Mhz with
arm-linux2.4.17rmk5. Loading a page takes some time , but on my intel machine
it doesn't take too long, on my arm system however it seems to take ages
before a page is fully displayed. Is there a way to improve the speed of
loading a page ??
See ya,
Lambert Duijst
diff -urN ./viewml-0.21/jscript/t2.c ./viewml-0.21_anim/jscript/t2.c
--- ./viewml-0.21/jscript/t2.c Wed Apr 11 17:29:01 2001
+++ ./viewml-0.21_anim/jscript/t2.c Tue Jul 2 14:41:52 2002
@@ -19,7 +19,7 @@
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
- * $Header: /usr/cvs/viewml/jscript/t2.c,v 1.13 2001/04/11 15:29:01 jasonk
Exp $
+ * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48
vern Exp $
*/
#define FLEX_SCANNER
@@ -27,6 +27,7 @@
#define YY_FLEX_MINOR_VERSION 5
#include <stdio.h>
+#include <unistd.h>
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
@@ -40,7 +41,6 @@
#ifdef __cplusplus
#include <stdlib.h>
-#include <unistd.h>
/* Use prototypes in function declarations. */
#define YY_USE_PROTOS
@@ -1494,11 +1494,6 @@
}
-#ifndef YY_ALWAYS_INTERACTIVE
-#ifndef YY_NEVER_INTERACTIVE
-extern int isatty YY_PROTO(( int ));
-#endif
-#endif
#ifdef YY_USE_PROTOS
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
diff -urN ./viewml-0.21/src/Makefile ./viewml-0.21_anim/src/Makefile
--- ./viewml-0.21/src/Makefile Thu Nov 9 00:42:05 2000
+++ ./viewml-0.21_anim/src/Makefile Tue Jul 9 09:34:30 2002
@@ -54,7 +54,8 @@
fltk/qobject.cpp fltk/qpainter.cpp fltk/qdrawutil.cpp \
fltk/qfont.cpp fltk/qrect.cpp fltk/qregexp.cpp fltk/qstring.cpp \
fltk/kcharsets.cpp fltk/qcolor.cpp fltk/qpixmap.cpp \
- fltk/qfontinfo.cpp fltk/qwidget.cpp fltk/history.cpp fltk/qscrollbar.cpp
+ fltk/qfontinfo.cpp fltk/qwidget.cpp fltk/history.cpp fltk/qscrollbar.cpp \
+ fltk/qmovie.cpp
OBJS = html.o htmlchain.o htmlclue.o htmldata.o htmlfont.o htmliter.o \
htmltable.o htmltoken.o jscript.o htmlview.o htmlframe.o htmlobj.o \
@@ -66,7 +67,7 @@
fltk/qpainter.o fltk/qdrawutil.o fltk/qfont.o fltk/qrect.o \
fltk/qregexp.o fltk/qstring.o fltk/kcharsets.o fltk/qcolor.o \
fltk/qpixmap.o fltk/qfontinfo.o fltk/qwidget.o fltk/history.o \
- fltk/qscrollbar.o
+ fltk/qscrollbar.o fltk/qmovie.o
################################################################
@@ -901,6 +902,7 @@
fltk/qstring.o: /usr/include/libio.h /usr/include/_G_config.h
fltk/qstring.o: /usr/include/bits/stdio_lim.h ./fltk/fltk-qdefs.h
fltk/qstring.o: ./fltk/qregexp.h
+fltk/qmovie.o: /usr/include/errno.h /usr/include/bits/errno.h
fltk/kcharsets.o: ./fltk/kcharsets.h ./fltk/qfont.h ./fltk/qrect.h
fltk/kcharsets.o: ./fltk/qpoint.h ./fltk/qarray.h ./fltk/qsize.h
fltk/kcharsets.o: ./fltk/fltk-qbase.h /usr/include/stdio.h
@@ -1101,3 +1103,6 @@
fltk/qscrollbar.o: /usr/include/X11/Xosdefs.h ./fltk/qpaintdevice.h
fltk/qscrollbar.o: ./fltk/qcursor.h ./fltk/qbitmap.h ./fltk/qpalette.h
fltk/qscrollbar.o: ./fltk/qfontmetrics.h ./fltk/qfont.h ./fltk/qfontinfo.h
+
+
+
diff -urN ./viewml-0.21/src/Makefile.new ./viewml-0.21_anim/src/Makefile.new
--- ./viewml-0.21/src/Makefile.new Wed Dec 13 19:45:08 2000
+++ ./viewml-0.21_anim/src/Makefile.new Tue Jul 9 09:47:09 2002
@@ -24,7 +24,8 @@
fltk/qpainter.o fltk/qdrawutil.o fltk/qfont.o fltk/qrect.o \
fltk/qregexp.o fltk/qstring.o fltk/kcharsets.o fltk/qcolor.o \
fltk/qpixmap.o fltk/qfontinfo.o fltk/qwidget.o fltk/history.o \
- fltk/qscrollbar.o fltk/qpushbutton.o fltk/drag.o fltk/qlineedit.o
+ fltk/qscrollbar.o fltk/qpushbutton.o fltk/drag.o fltk/qlineedit.o \
+ fltk/qmovie.o
all: $(OBJS) $(OTHEROBJS)
$(CXX) $(OBJS) $(OTHEROBJS) $(LDFLAGS) -o $(VIEWML_BINARY) $(LIBS)
@@ -59,4 +60,5 @@
@ rm -f fltk/*.o
@ rm -f ../kdecore/*.o
@ rm -f ../kdeui/*.o
+
diff -urN ./viewml-0.21/src/build_depends.mk
./viewml-0.21_anim/src/build_depends.mk
--- ./viewml-0.21/src/build_depends.mk Thu Nov 9 00:42:05 2000
+++ ./viewml-0.21_anim/src/build_depends.mk Thu Jan 1 01:00:00 1970
@@ -1,23 +0,0 @@
-include ../makeinclude
-
-CPPFILES = html.cpp htmlchain.cpp htmlclue.cpp htmldata.cpp htmlfont.cpp \
- htmliter.cpp htmltable.cpp htmltoken.cpp jscript.cpp htmlview.cpp \
- htmlframe.cpp htmlobj.cpp debug.cpp htmlform.cpp main.cpp http.cpp \
- http_.cpp
-
-OTHERCPP = ../kdecore/kurl.cpp ../kdeui/kcursor.cpp fltk/qtimer.cpp \
- fltk/qobject.cpp fltk/qpainter.cpp fltk/qdrawutil.cpp \
- fltk/qfont.cpp fltk/qrect.cpp fltk/qregexp.cpp fltk/qstring.cpp \
- fltk/kcharsets.cpp fltk/qcolor.cpp fltk/qpixmap.cpp \
- fltk/qfontinfo.cpp fltk/qwidget.cpp fltk/history.cpp fltk/qscrollbar.cpp
-
-check-depends:
- if [ ! -s .build_depends ]; then $(MAKE) -f build_depends.mk force-depends;
fi
-
-force-depends:
- @ echo "Generating dependancies for `pwd`..."
- @ echo "# Dependancy file for `pwd`" > .build_depends
- @ echo "# Automatically generated. Do not edit." >> .build_depends
- $(CXX) -M $(INCLUDES) $(CXXFLAGS) $(CPPFILES) $(OTHERCPP) >> .build_depends
-
-# End of file
diff -urN ./viewml-0.21/src/fltk/qmovie.cpp
./viewml-0.21_anim/src/fltk/qmovie.cpp
--- ./viewml-0.21/src/fltk/qmovie.cpp Thu Jan 1 01:00:00 1970
+++ ./viewml-0.21/src/fltk/qmovie.cpp Thu Aug 1 09:12:53 2002
@@ -0,0 +1,249 @@
+/***************************************************************************
+ qmovie.cpp - description
+ -------------------
+ begin : Mon Jul 8 2002
+ copyright : (C) 2002 by lambert
+ email : ***@rbs_lambert
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "qmovie.h"
+#include "qpainter.h"
+
+void QMovie::connectUpdate (QObject * receiver, const char * member)
+ {
+ QObject::connect ((QObject*) m_Timer, SIGNAL(timeout()), receiver, member);
+ m_Timer->start (200, FALSE);
+
+ }
+
+void QMovie::disconnectUpdate(QObject * receiver, const char * member=0)
+{
+ //QObject::disconnect (SIGNAL(timeout()), receiver, member);
+}
+
+int QMovie::gif_skipExtension (const QByteArray &array, int &offset)
+{
+ offset +=2; //skip the character that follows '!'
+ if (offset >= array.length() )
+ return -1;
+ return gif_skipBlock (array, offset);
+}
+
+
+/*Index points to begin of a block of data, which starts with the length of
the block
+ When te end of the block is found the index will point to the zero
terminator.*/
+int QMovie::gif_skipBlock (const QByteArray &array, int &offset)
+{
+ unsigned char c;
+ while ((c = (unsigned char)array.buffer()[offset]) != 0 && offset <
array.length() )
+ offset += (c + 1);
+ offset++; //After the data block
+ if (offset >= array.length() )
+ return -1;
+ else
+ return 1;
+
+}
+
+int QMovie::gif_skipHeader (const QByteArray &array, int &offset)
+{
+ char c;
+ if (strncmp (array.buffer(), "GIF", 3))
+ return -1;
+ if (array.length() < 11)
+ return -1;
+ if ((c = array.buffer()[10]) &0x80) //There is a global map
+ offset += (((2<<(c&0x07)) +1) * 3) + 10; // skip it
+ return 0;
+}
+/*Assumes that the index points to the beginning of image data, at 0x2c or
after a global colormap*/
+/*Returns 0 if there are no more images to be found in the buffer */
+int QMovie::gif_findNextImageOffset (const QByteArray &array, int &offset)
+{
+ int ret;
+ char c;
+ /*
+ if (index + 8 >= array.length())
+ return -1;
+ if ((cmap = array.buffer()[offset+8])&0x80) //local colormap
+ index += (2 << (((cmap&0x07 ) + 1) *3)) + 8;
+ if (index >= array.length())
+ return -1; */
+ do {
+ c = array.buffer()[offset];
+ if (c == ';') //Terminator
+ return 0;
+
+ if (c== '!') {
+ ret = gif_skipExtension (array, offset);
+ if ( ret < 0)
+ return ret;
+ continue;
+ }
+ if (c == ',') {
+ offset++;
+ if (offset >= array.length())
+ return -2;
+ printf ("New image data found at 0x%x\n",offset);
+ return offset; //next image data found
+ }
+ offset += 8;
+ if (offset >= array.length())
+ return -2;
+ if ((c=array.buffer()[offset] ) & 0x80)
+ offset += (1<<((c&0x07) + 1)) * 3; // Skip the colormap
+ //else
+ //offset++;
+ offset += 2; //skip some lzw init char , now at begin of a block
+ if (offset >= array.length())
+ return -1;
+
+ if ((ret = gif_skipBlock (array, offset)) < 0)
+ return ret;
+ //printf ("Image found at offset 0x%x\n",offset);
+ //return offset;
+ }
+ while (offset < array.length ());
+ return -2;
+}
+
+
+QMovie::QMovie(QByteArray data, int bufsize) //int bufsize = 1024
+{
+ //unsigned int *indexarray;
+ unsigned int indexarray[3]; //[0] = index of first image data
+ //[1] = index of begin of data to be copied to [0]
+ //[2] = index of end of data to be copied to [0]
+
+ int arraylen;
+ int index;
+ int count;
+ int ret;
+ m_Timer = new QTimer ();
+ QByteArray buffer (data);
+ index = 0;
+ count = 0;
+ pix_array = 0;
+ if (gif_skipHeader (data, index) < 0)
+ goto fail;
+ while ((ret = gif_findNextImageOffset (data, index)) > 0)
+ count++;
+ if (ret < 0)
+ goto fail;
+ if (count == 0)
+ goto fail;
+
+ frames = count;
+ printf ("%i Images found in GIF file.\n", count);
+ printf ("End of file 0x%x\n",index);
+ indexarray[2] = index; //end
+ pix_array = new QPixmap* [frames];
+ for (count = 0; count < frames; count++)
+ pix_array[count] = 0; //Make sure they are all null pointers
+ index = 0;
+ if (gif_skipHeader (data, index) < 0)
+ goto fail;
+
+ if (gif_findNextImageOffset (data, index) < 0)
+ goto fail;
+
+ indexarray[0] = index; //first address just after header
+ if (gif_findNextImageOffset (data, index) < 0)
+ goto fail;
+
+ indexarray[1] = index; //now we have the addres range of the image data of
the first image
+ pix_array[0] = new QPixmap ();
+ pix_array[0]->loadFromData (buffer);
+
+ for (count = 0; count < frames - 1; count++) {
+ memcpy ((buffer.buffer() + indexarray[0]), (data.buffer() +
indexarray[1]), (indexarray[2] - indexarray[1]) + 1);
+ pix_array[count + 1] = new QPixmap ();
+ pix_array[count + 1]->loadFromData (buffer);
+
+ if (gif_findNextImageOffset (data, index) < 0)
+ goto fail;
+
+ indexarray[1] = index;
+ }
+ currentframe = 0;
+ m_Rect = new QRect (0,0, pix_array[0]->width(), pix_array[0]->height());
+ return;
+
+fail: /*Fall back to just a static gif*/
+ if (pix_array) {
+ for (count = 0; count < frames; count++) {
+ if (pix_array[count])
+ delete pix_array[count];
+ }
+ delete (pix_array);
+ }
+ pix_array = new QPixmap* [1];
+ pix_array[0] = new QPixmap ();
+ pix_array[0]->loadFromData (data);
+ frames = 1;
+ currentframe = 0;
+ m_Rect = new QRect (0,0, pix_array[0]->width(), pix_array[0]->height());
+ return;
+}
+
+/*QMovie::QMovie(QByteArray data) //int bufsize = 1024
+{
+ m_Pixmap.loadFromData (data);
+ //m_Pixmap2 = m_Pixmap;
+ //toggle = 0;
+}*/
+
+QMovie::~QMovie ()
+{
+ int i;
+ for (i=0; i < frames; i++) {
+ if (pix_array[i])
+ delete pix_array[i];
+ }
+ delete m_Rect;
+ delete m_Timer;
+}
+void QMovie::connectStatus(QObject * receiver, const char * member)
+{
+}
+
+const QRect & QMovie::getValidRect() const
+{
+ //QRect rect (0, 0, m_Pixmap.width(), m_Pixmap.height());
+ return *m_Rect;
+}
+
+const QPixmap & QMovie::framePixmap()
+{
+ QPixmap &pixmap = *pix_array[currentframe];
+
+ currentframe++;
+ if (currentframe >= frames)
+ currentframe = 0;
+ return pixmap;
+
+ //m_Pixmap.Fl_Window::clear_border (); //Another patch to get rid of
windowlike behavior of QPaintDevices
+// if (toggle = true) {
+// toggle = false;
+// return m_Pixmap;
+// }
+// else {
+// toggle = true;
+// return pixmap2;
+// }
+
+}
+
+void QMovie::pause()
+{
+}
+
diff -urN ./viewml-0.21/src/fltk/qmovie.h ./viewml-0.21_anim/src/fltk/qmovie.h
--- ./viewml-0.21/src/fltk/qmovie.h Wed Jul 12 01:10:54 2000
+++ ./viewml-0.21_anim/src/fltk/qmovie.h Wed Jul 31 12:54:21 2002
@@ -1,23 +1,39 @@
#ifndef __QMOVIE_H
#define __QMOVIE_H
-#include "qbuffer.h"
+/*#include "qbuffer.h"
#include "qrect.h"
+#include "qpixmap.h" */
#include "qpixmap.h"
+#include "qobject.h"
+#include "qtimer.h"
+#include "qwidget.h"
+
class QMovie
{
protected:
- QRect m_Rect;
- QPixmap m_Pixmap;
+ QRect *m_Rect;
+ QTimer *m_Timer;
public:
- QMovie(QByteArray data, int bufsize=1024) { }
- void connectUpdate(QObject * receiver, const char * member) { }
- void connectStatus(QObject * receiver, const char * member) { }
- const QRect & getValidRect() const { return m_Rect; }
- const QPixmap & framePixmap() const { return m_Pixmap; }
- void pause() { }
- void disconnectUpdate(QObject * receiver, const char * member=0) { }
+ //QMovie(QByteArray data);
+ QMovie(QByteArray data, int bufsize=1024);// { }
+ ~QMovie();
+ void connectUpdate(QObject * receiver, const char * member);// { }
+ void connectStatus(QObject * receiver, const char * member);// { }
+ const QRect & getValidRect() const; // { return m_Rect; }
+ const QPixmap & framePixmap() ; //const { return m_Pixmap; }
+ void pause();// { }
+ void disconnectUpdate(QObject * receiver, const char * member=0); // { }
+ private:
+ int currentframe;
+ int frames;
+ QPixmap **pix_array;
+
+ gif_skipExtension (const QByteArray &array, int &offset);
+ gif_skipBlock (const QByteArray &array, int &offset);
+ gif_findNextImageOffset (const QByteArray &array, int &offset);
+ gif_skipHeader (const QByteArray &array, int &offset);
};
#endif
diff -urN ./viewml-0.21/src/html.cpp ./viewml-0.21_anim/src/html.cpp
--- ./viewml-0.21/src/html.cpp Wed Apr 11 17:29:01 2001
+++ ./viewml-0.21_anim/src/html.cpp Thu Jul 11 14:06:04 2002
@@ -1269,7 +1269,8 @@
void KHTMLWidget::paintSingleObject( HTMLObject *_obj )
{
bool newPainter = FALSE;
-
+
+
// if ( parsing )
// return;
diff -urN ./viewml-0.21/src/htmlobj.cpp ./viewml-0.21_anim/src/htmlobj.cpp
--- ./viewml-0.21/src/htmlobj.cpp Thu Nov 9 17:55:41 2000
+++ ./viewml-0.21_anim/src/htmlobj.cpp Wed Jul 31 15:19:20 2002
@@ -1482,14 +1482,13 @@
bool HTMLImage::fileLoaded( const char* _url, QBuffer& _buffer )
{
bComplete = true;
-
char buffer[ 4 ];
buffer[0] = 0;
_buffer.open( IO_ReadOnly );
_buffer.readBlock( buffer, 3 );
_buffer.close();
- if ( strcmp( buffer, "GIF" ) == 0 )
+ if ( strncmp( buffer, "GIF", 3 ) == 0 )
{
movie = new QMovie( _buffer.buffer() );
movie->connectUpdate( this, SLOT( movieUpdated( const QRect &) ) );
@@ -1504,9 +1503,10 @@
if ( pixmap == 0 || pixmap->isNull() )
return false;
+ init();
}
- init();
+
// Commented out .. jsk
@@ -1651,7 +1651,8 @@
QRect rect( 0, 0, width - border*2, ascent - border );
#ifdef USE_QMOVIE
- if ( movie && pixmap )
+/* if ( movie && pixmap )
+
{
// Wow... all this mess, just to get QMovies with transparent
// parts working... (Lars 30.11.98)
@@ -1695,6 +1696,9 @@
oldRect = rect;
pixptr = movieCache;
+ }*/
+ if (movie && pixmap) {
+ *pixmap = movie->framePixmap();
}
#endif
@@ -1804,7 +1808,11 @@
pixmap = new QPixmap;
*pixmap = movie->framePixmap();
init();
-
+
+ /*Hack to get single objects to be children of the HTML widget*/
+ if (!(pixmap->Fl_Widget::parent())) //no parent, this is a bad thing
+ htmlWidget->Fl_Double_Window::add (pixmap);
+
if ( !predefinedWidth || !predefinedHeight )
{
htmlWidget->calcSize();
@@ -1813,8 +1821,9 @@
return;
}
}
-
- htmlWidget->paintSingleObject( this );
+
+ //htmlWidget->repaint();
+ htmlWidget->paintSingleObject( this );
#endif
}
#############################################################
This message is sent to you because you are subscribed to
the mailing list <viewml-***@viewml.com>.
To unsubscribe, E-mail to: <viewml-devel-***@viewml.com>
To switch to the DIGEST mode, E-mail to <viewml-devel-***@viewml.com>
To switch to the INDEX mode, E-mail to <viewml-devel-***@viewml.com>
Send administrative queries to <viewml-devel-***@viewml.com>
I am considering to use viewml for my project, it is really a great browser.
But I found out that it lacks support for animated gif's (when used with
nano-X, I don't know what it does with other windowing systems) which would
be a cool feature. That is why I made a start for support of animated gif.
I will send you my patch, but I have to say that it is not complete yet. It
completely ignores the sequence/timing of the animated gif's and it makes the
area sizes of all pictures in the animation equal to the one of the first
picture. Some of the times this causes gif's to be displayed incorrectly. And
sometimes I have problems with pallette's.
As you see it is far from fully functional yet , but I wanted to let you guys
know that I am working on this. I would like to receive some comments /
reactions and perhaps tips to enhance the code as I am not yet familiar with
the entire viewml code.
The patch is for viewml 0-21 with the use of nano-X perhaps it will also work
on X-windows.
Then I have one more question, I run viewml on a redhat 7.1 intel machine and
on my target , which is an arm720T running at 75 Mhz with
arm-linux2.4.17rmk5. Loading a page takes some time , but on my intel machine
it doesn't take too long, on my arm system however it seems to take ages
before a page is fully displayed. Is there a way to improve the speed of
loading a page ??
See ya,
Lambert Duijst
diff -urN ./viewml-0.21/jscript/t2.c ./viewml-0.21_anim/jscript/t2.c
--- ./viewml-0.21/jscript/t2.c Wed Apr 11 17:29:01 2001
+++ ./viewml-0.21_anim/jscript/t2.c Tue Jul 2 14:41:52 2002
@@ -19,7 +19,7 @@
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
- * $Header: /usr/cvs/viewml/jscript/t2.c,v 1.13 2001/04/11 15:29:01 jasonk
Exp $
+ * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48
vern Exp $
*/
#define FLEX_SCANNER
@@ -27,6 +27,7 @@
#define YY_FLEX_MINOR_VERSION 5
#include <stdio.h>
+#include <unistd.h>
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
@@ -40,7 +41,6 @@
#ifdef __cplusplus
#include <stdlib.h>
-#include <unistd.h>
/* Use prototypes in function declarations. */
#define YY_USE_PROTOS
@@ -1494,11 +1494,6 @@
}
-#ifndef YY_ALWAYS_INTERACTIVE
-#ifndef YY_NEVER_INTERACTIVE
-extern int isatty YY_PROTO(( int ));
-#endif
-#endif
#ifdef YY_USE_PROTOS
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
diff -urN ./viewml-0.21/src/Makefile ./viewml-0.21_anim/src/Makefile
--- ./viewml-0.21/src/Makefile Thu Nov 9 00:42:05 2000
+++ ./viewml-0.21_anim/src/Makefile Tue Jul 9 09:34:30 2002
@@ -54,7 +54,8 @@
fltk/qobject.cpp fltk/qpainter.cpp fltk/qdrawutil.cpp \
fltk/qfont.cpp fltk/qrect.cpp fltk/qregexp.cpp fltk/qstring.cpp \
fltk/kcharsets.cpp fltk/qcolor.cpp fltk/qpixmap.cpp \
- fltk/qfontinfo.cpp fltk/qwidget.cpp fltk/history.cpp fltk/qscrollbar.cpp
+ fltk/qfontinfo.cpp fltk/qwidget.cpp fltk/history.cpp fltk/qscrollbar.cpp \
+ fltk/qmovie.cpp
OBJS = html.o htmlchain.o htmlclue.o htmldata.o htmlfont.o htmliter.o \
htmltable.o htmltoken.o jscript.o htmlview.o htmlframe.o htmlobj.o \
@@ -66,7 +67,7 @@
fltk/qpainter.o fltk/qdrawutil.o fltk/qfont.o fltk/qrect.o \
fltk/qregexp.o fltk/qstring.o fltk/kcharsets.o fltk/qcolor.o \
fltk/qpixmap.o fltk/qfontinfo.o fltk/qwidget.o fltk/history.o \
- fltk/qscrollbar.o
+ fltk/qscrollbar.o fltk/qmovie.o
################################################################
@@ -901,6 +902,7 @@
fltk/qstring.o: /usr/include/libio.h /usr/include/_G_config.h
fltk/qstring.o: /usr/include/bits/stdio_lim.h ./fltk/fltk-qdefs.h
fltk/qstring.o: ./fltk/qregexp.h
+fltk/qmovie.o: /usr/include/errno.h /usr/include/bits/errno.h
fltk/kcharsets.o: ./fltk/kcharsets.h ./fltk/qfont.h ./fltk/qrect.h
fltk/kcharsets.o: ./fltk/qpoint.h ./fltk/qarray.h ./fltk/qsize.h
fltk/kcharsets.o: ./fltk/fltk-qbase.h /usr/include/stdio.h
@@ -1101,3 +1103,6 @@
fltk/qscrollbar.o: /usr/include/X11/Xosdefs.h ./fltk/qpaintdevice.h
fltk/qscrollbar.o: ./fltk/qcursor.h ./fltk/qbitmap.h ./fltk/qpalette.h
fltk/qscrollbar.o: ./fltk/qfontmetrics.h ./fltk/qfont.h ./fltk/qfontinfo.h
+
+
+
diff -urN ./viewml-0.21/src/Makefile.new ./viewml-0.21_anim/src/Makefile.new
--- ./viewml-0.21/src/Makefile.new Wed Dec 13 19:45:08 2000
+++ ./viewml-0.21_anim/src/Makefile.new Tue Jul 9 09:47:09 2002
@@ -24,7 +24,8 @@
fltk/qpainter.o fltk/qdrawutil.o fltk/qfont.o fltk/qrect.o \
fltk/qregexp.o fltk/qstring.o fltk/kcharsets.o fltk/qcolor.o \
fltk/qpixmap.o fltk/qfontinfo.o fltk/qwidget.o fltk/history.o \
- fltk/qscrollbar.o fltk/qpushbutton.o fltk/drag.o fltk/qlineedit.o
+ fltk/qscrollbar.o fltk/qpushbutton.o fltk/drag.o fltk/qlineedit.o \
+ fltk/qmovie.o
all: $(OBJS) $(OTHEROBJS)
$(CXX) $(OBJS) $(OTHEROBJS) $(LDFLAGS) -o $(VIEWML_BINARY) $(LIBS)
@@ -59,4 +60,5 @@
@ rm -f fltk/*.o
@ rm -f ../kdecore/*.o
@ rm -f ../kdeui/*.o
+
diff -urN ./viewml-0.21/src/build_depends.mk
./viewml-0.21_anim/src/build_depends.mk
--- ./viewml-0.21/src/build_depends.mk Thu Nov 9 00:42:05 2000
+++ ./viewml-0.21_anim/src/build_depends.mk Thu Jan 1 01:00:00 1970
@@ -1,23 +0,0 @@
-include ../makeinclude
-
-CPPFILES = html.cpp htmlchain.cpp htmlclue.cpp htmldata.cpp htmlfont.cpp \
- htmliter.cpp htmltable.cpp htmltoken.cpp jscript.cpp htmlview.cpp \
- htmlframe.cpp htmlobj.cpp debug.cpp htmlform.cpp main.cpp http.cpp \
- http_.cpp
-
-OTHERCPP = ../kdecore/kurl.cpp ../kdeui/kcursor.cpp fltk/qtimer.cpp \
- fltk/qobject.cpp fltk/qpainter.cpp fltk/qdrawutil.cpp \
- fltk/qfont.cpp fltk/qrect.cpp fltk/qregexp.cpp fltk/qstring.cpp \
- fltk/kcharsets.cpp fltk/qcolor.cpp fltk/qpixmap.cpp \
- fltk/qfontinfo.cpp fltk/qwidget.cpp fltk/history.cpp fltk/qscrollbar.cpp
-
-check-depends:
- if [ ! -s .build_depends ]; then $(MAKE) -f build_depends.mk force-depends;
fi
-
-force-depends:
- @ echo "Generating dependancies for `pwd`..."
- @ echo "# Dependancy file for `pwd`" > .build_depends
- @ echo "# Automatically generated. Do not edit." >> .build_depends
- $(CXX) -M $(INCLUDES) $(CXXFLAGS) $(CPPFILES) $(OTHERCPP) >> .build_depends
-
-# End of file
diff -urN ./viewml-0.21/src/fltk/qmovie.cpp
./viewml-0.21_anim/src/fltk/qmovie.cpp
--- ./viewml-0.21/src/fltk/qmovie.cpp Thu Jan 1 01:00:00 1970
+++ ./viewml-0.21/src/fltk/qmovie.cpp Thu Aug 1 09:12:53 2002
@@ -0,0 +1,249 @@
+/***************************************************************************
+ qmovie.cpp - description
+ -------------------
+ begin : Mon Jul 8 2002
+ copyright : (C) 2002 by lambert
+ email : ***@rbs_lambert
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "qmovie.h"
+#include "qpainter.h"
+
+void QMovie::connectUpdate (QObject * receiver, const char * member)
+ {
+ QObject::connect ((QObject*) m_Timer, SIGNAL(timeout()), receiver, member);
+ m_Timer->start (200, FALSE);
+
+ }
+
+void QMovie::disconnectUpdate(QObject * receiver, const char * member=0)
+{
+ //QObject::disconnect (SIGNAL(timeout()), receiver, member);
+}
+
+int QMovie::gif_skipExtension (const QByteArray &array, int &offset)
+{
+ offset +=2; //skip the character that follows '!'
+ if (offset >= array.length() )
+ return -1;
+ return gif_skipBlock (array, offset);
+}
+
+
+/*Index points to begin of a block of data, which starts with the length of
the block
+ When te end of the block is found the index will point to the zero
terminator.*/
+int QMovie::gif_skipBlock (const QByteArray &array, int &offset)
+{
+ unsigned char c;
+ while ((c = (unsigned char)array.buffer()[offset]) != 0 && offset <
array.length() )
+ offset += (c + 1);
+ offset++; //After the data block
+ if (offset >= array.length() )
+ return -1;
+ else
+ return 1;
+
+}
+
+int QMovie::gif_skipHeader (const QByteArray &array, int &offset)
+{
+ char c;
+ if (strncmp (array.buffer(), "GIF", 3))
+ return -1;
+ if (array.length() < 11)
+ return -1;
+ if ((c = array.buffer()[10]) &0x80) //There is a global map
+ offset += (((2<<(c&0x07)) +1) * 3) + 10; // skip it
+ return 0;
+}
+/*Assumes that the index points to the beginning of image data, at 0x2c or
after a global colormap*/
+/*Returns 0 if there are no more images to be found in the buffer */
+int QMovie::gif_findNextImageOffset (const QByteArray &array, int &offset)
+{
+ int ret;
+ char c;
+ /*
+ if (index + 8 >= array.length())
+ return -1;
+ if ((cmap = array.buffer()[offset+8])&0x80) //local colormap
+ index += (2 << (((cmap&0x07 ) + 1) *3)) + 8;
+ if (index >= array.length())
+ return -1; */
+ do {
+ c = array.buffer()[offset];
+ if (c == ';') //Terminator
+ return 0;
+
+ if (c== '!') {
+ ret = gif_skipExtension (array, offset);
+ if ( ret < 0)
+ return ret;
+ continue;
+ }
+ if (c == ',') {
+ offset++;
+ if (offset >= array.length())
+ return -2;
+ printf ("New image data found at 0x%x\n",offset);
+ return offset; //next image data found
+ }
+ offset += 8;
+ if (offset >= array.length())
+ return -2;
+ if ((c=array.buffer()[offset] ) & 0x80)
+ offset += (1<<((c&0x07) + 1)) * 3; // Skip the colormap
+ //else
+ //offset++;
+ offset += 2; //skip some lzw init char , now at begin of a block
+ if (offset >= array.length())
+ return -1;
+
+ if ((ret = gif_skipBlock (array, offset)) < 0)
+ return ret;
+ //printf ("Image found at offset 0x%x\n",offset);
+ //return offset;
+ }
+ while (offset < array.length ());
+ return -2;
+}
+
+
+QMovie::QMovie(QByteArray data, int bufsize) //int bufsize = 1024
+{
+ //unsigned int *indexarray;
+ unsigned int indexarray[3]; //[0] = index of first image data
+ //[1] = index of begin of data to be copied to [0]
+ //[2] = index of end of data to be copied to [0]
+
+ int arraylen;
+ int index;
+ int count;
+ int ret;
+ m_Timer = new QTimer ();
+ QByteArray buffer (data);
+ index = 0;
+ count = 0;
+ pix_array = 0;
+ if (gif_skipHeader (data, index) < 0)
+ goto fail;
+ while ((ret = gif_findNextImageOffset (data, index)) > 0)
+ count++;
+ if (ret < 0)
+ goto fail;
+ if (count == 0)
+ goto fail;
+
+ frames = count;
+ printf ("%i Images found in GIF file.\n", count);
+ printf ("End of file 0x%x\n",index);
+ indexarray[2] = index; //end
+ pix_array = new QPixmap* [frames];
+ for (count = 0; count < frames; count++)
+ pix_array[count] = 0; //Make sure they are all null pointers
+ index = 0;
+ if (gif_skipHeader (data, index) < 0)
+ goto fail;
+
+ if (gif_findNextImageOffset (data, index) < 0)
+ goto fail;
+
+ indexarray[0] = index; //first address just after header
+ if (gif_findNextImageOffset (data, index) < 0)
+ goto fail;
+
+ indexarray[1] = index; //now we have the addres range of the image data of
the first image
+ pix_array[0] = new QPixmap ();
+ pix_array[0]->loadFromData (buffer);
+
+ for (count = 0; count < frames - 1; count++) {
+ memcpy ((buffer.buffer() + indexarray[0]), (data.buffer() +
indexarray[1]), (indexarray[2] - indexarray[1]) + 1);
+ pix_array[count + 1] = new QPixmap ();
+ pix_array[count + 1]->loadFromData (buffer);
+
+ if (gif_findNextImageOffset (data, index) < 0)
+ goto fail;
+
+ indexarray[1] = index;
+ }
+ currentframe = 0;
+ m_Rect = new QRect (0,0, pix_array[0]->width(), pix_array[0]->height());
+ return;
+
+fail: /*Fall back to just a static gif*/
+ if (pix_array) {
+ for (count = 0; count < frames; count++) {
+ if (pix_array[count])
+ delete pix_array[count];
+ }
+ delete (pix_array);
+ }
+ pix_array = new QPixmap* [1];
+ pix_array[0] = new QPixmap ();
+ pix_array[0]->loadFromData (data);
+ frames = 1;
+ currentframe = 0;
+ m_Rect = new QRect (0,0, pix_array[0]->width(), pix_array[0]->height());
+ return;
+}
+
+/*QMovie::QMovie(QByteArray data) //int bufsize = 1024
+{
+ m_Pixmap.loadFromData (data);
+ //m_Pixmap2 = m_Pixmap;
+ //toggle = 0;
+}*/
+
+QMovie::~QMovie ()
+{
+ int i;
+ for (i=0; i < frames; i++) {
+ if (pix_array[i])
+ delete pix_array[i];
+ }
+ delete m_Rect;
+ delete m_Timer;
+}
+void QMovie::connectStatus(QObject * receiver, const char * member)
+{
+}
+
+const QRect & QMovie::getValidRect() const
+{
+ //QRect rect (0, 0, m_Pixmap.width(), m_Pixmap.height());
+ return *m_Rect;
+}
+
+const QPixmap & QMovie::framePixmap()
+{
+ QPixmap &pixmap = *pix_array[currentframe];
+
+ currentframe++;
+ if (currentframe >= frames)
+ currentframe = 0;
+ return pixmap;
+
+ //m_Pixmap.Fl_Window::clear_border (); //Another patch to get rid of
windowlike behavior of QPaintDevices
+// if (toggle = true) {
+// toggle = false;
+// return m_Pixmap;
+// }
+// else {
+// toggle = true;
+// return pixmap2;
+// }
+
+}
+
+void QMovie::pause()
+{
+}
+
diff -urN ./viewml-0.21/src/fltk/qmovie.h ./viewml-0.21_anim/src/fltk/qmovie.h
--- ./viewml-0.21/src/fltk/qmovie.h Wed Jul 12 01:10:54 2000
+++ ./viewml-0.21_anim/src/fltk/qmovie.h Wed Jul 31 12:54:21 2002
@@ -1,23 +1,39 @@
#ifndef __QMOVIE_H
#define __QMOVIE_H
-#include "qbuffer.h"
+/*#include "qbuffer.h"
#include "qrect.h"
+#include "qpixmap.h" */
#include "qpixmap.h"
+#include "qobject.h"
+#include "qtimer.h"
+#include "qwidget.h"
+
class QMovie
{
protected:
- QRect m_Rect;
- QPixmap m_Pixmap;
+ QRect *m_Rect;
+ QTimer *m_Timer;
public:
- QMovie(QByteArray data, int bufsize=1024) { }
- void connectUpdate(QObject * receiver, const char * member) { }
- void connectStatus(QObject * receiver, const char * member) { }
- const QRect & getValidRect() const { return m_Rect; }
- const QPixmap & framePixmap() const { return m_Pixmap; }
- void pause() { }
- void disconnectUpdate(QObject * receiver, const char * member=0) { }
+ //QMovie(QByteArray data);
+ QMovie(QByteArray data, int bufsize=1024);// { }
+ ~QMovie();
+ void connectUpdate(QObject * receiver, const char * member);// { }
+ void connectStatus(QObject * receiver, const char * member);// { }
+ const QRect & getValidRect() const; // { return m_Rect; }
+ const QPixmap & framePixmap() ; //const { return m_Pixmap; }
+ void pause();// { }
+ void disconnectUpdate(QObject * receiver, const char * member=0); // { }
+ private:
+ int currentframe;
+ int frames;
+ QPixmap **pix_array;
+
+ gif_skipExtension (const QByteArray &array, int &offset);
+ gif_skipBlock (const QByteArray &array, int &offset);
+ gif_findNextImageOffset (const QByteArray &array, int &offset);
+ gif_skipHeader (const QByteArray &array, int &offset);
};
#endif
diff -urN ./viewml-0.21/src/html.cpp ./viewml-0.21_anim/src/html.cpp
--- ./viewml-0.21/src/html.cpp Wed Apr 11 17:29:01 2001
+++ ./viewml-0.21_anim/src/html.cpp Thu Jul 11 14:06:04 2002
@@ -1269,7 +1269,8 @@
void KHTMLWidget::paintSingleObject( HTMLObject *_obj )
{
bool newPainter = FALSE;
-
+
+
// if ( parsing )
// return;
diff -urN ./viewml-0.21/src/htmlobj.cpp ./viewml-0.21_anim/src/htmlobj.cpp
--- ./viewml-0.21/src/htmlobj.cpp Thu Nov 9 17:55:41 2000
+++ ./viewml-0.21_anim/src/htmlobj.cpp Wed Jul 31 15:19:20 2002
@@ -1482,14 +1482,13 @@
bool HTMLImage::fileLoaded( const char* _url, QBuffer& _buffer )
{
bComplete = true;
-
char buffer[ 4 ];
buffer[0] = 0;
_buffer.open( IO_ReadOnly );
_buffer.readBlock( buffer, 3 );
_buffer.close();
- if ( strcmp( buffer, "GIF" ) == 0 )
+ if ( strncmp( buffer, "GIF", 3 ) == 0 )
{
movie = new QMovie( _buffer.buffer() );
movie->connectUpdate( this, SLOT( movieUpdated( const QRect &) ) );
@@ -1504,9 +1503,10 @@
if ( pixmap == 0 || pixmap->isNull() )
return false;
+ init();
}
- init();
+
// Commented out .. jsk
@@ -1651,7 +1651,8 @@
QRect rect( 0, 0, width - border*2, ascent - border );
#ifdef USE_QMOVIE
- if ( movie && pixmap )
+/* if ( movie && pixmap )
+
{
// Wow... all this mess, just to get QMovies with transparent
// parts working... (Lars 30.11.98)
@@ -1695,6 +1696,9 @@
oldRect = rect;
pixptr = movieCache;
+ }*/
+ if (movie && pixmap) {
+ *pixmap = movie->framePixmap();
}
#endif
@@ -1804,7 +1808,11 @@
pixmap = new QPixmap;
*pixmap = movie->framePixmap();
init();
-
+
+ /*Hack to get single objects to be children of the HTML widget*/
+ if (!(pixmap->Fl_Widget::parent())) //no parent, this is a bad thing
+ htmlWidget->Fl_Double_Window::add (pixmap);
+
if ( !predefinedWidth || !predefinedHeight )
{
htmlWidget->calcSize();
@@ -1813,8 +1821,9 @@
return;
}
}
-
- htmlWidget->paintSingleObject( this );
+
+ //htmlWidget->repaint();
+ htmlWidget->paintSingleObject( this );
#endif
}
#############################################################
This message is sent to you because you are subscribed to
the mailing list <viewml-***@viewml.com>.
To unsubscribe, E-mail to: <viewml-devel-***@viewml.com>
To switch to the DIGEST mode, E-mail to <viewml-devel-***@viewml.com>
To switch to the INDEX mode, E-mail to <viewml-devel-***@viewml.com>
Send administrative queries to <viewml-devel-***@viewml.com>