? gphoto/build ? gphoto/barbie/.cvsignore ? gphoto/digita/.cvsignore ? gphoto/dimera/.cvsignore ? gphoto/gallery/CSSjimmac/.cvsignore ? gphoto/jd11/.cvsignore ? gphoto/polaroid/.cvsignore Index: gphoto/.cvsignore =================================================================== RCS file: /cvs/gnome/gphoto/.cvsignore,v retrieving revision 1.2.2.1 diff -u -r1.2.2.1 .cvsignore --- gphoto/.cvsignore 1999/11/21 16:33:37 1.2.2.1 +++ gphoto/.cvsignore 2000/07/22 21:06:53 @@ -18,3 +18,4 @@ install-sh missing mkinstalldirs +ChangeLog Index: gphoto/autogen.sh =================================================================== RCS file: /cvs/gnome/gphoto/autogen.sh,v retrieving revision 1.4.2.3 diff -u -r1.4.2.3 autogen.sh --- gphoto/autogen.sh 2000/06/08 12:36:13 1.4.2.3 +++ gphoto/autogen.sh 2000/07/22 21:06:53 @@ -1,66 +1,17 @@ #!/bin/sh # Run this to generate all the initial makefiles, etc. -# This was lifted from the Gimp, and adapted slightly by -# Raph Levien . -DIE=0 +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. -PROJECT=gphoto +PKG_NAME="GPhoto" -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have autoconf installed to compile $PROJECT." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" - DIE=1 -} - -(libtool --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have libtool installed to compile $PROJECT." - echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 -} - -(automake --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have automake installed to compile $PROJECT." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 -} - -if test "$DIE" -eq 1; then +(test -f $srcdir/configure.in \ + && test -f $srcdir/HACKING \ + && test -d $srcdir/photopc) || { + echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" + echo " top-level GPhoto directory" exit 1 -fi - -test -f PROGRAMMERS || { - echo "You must run this script in the top-level gphoto directory" - exit 1 } - -if test -z "$*"; then - echo "I am going to run ./configure with no arguments - if you wish " - echo "to pass any to it, please specify them on the $0 command line." -fi - - -case $CC in -*xlc | *xlc\ * | *lcc | *lcc\ *) am_opt=--include-deps;; -esac - -for dir in . -do - echo processing $dir - (cd $dir; \ - libtoolize --copy --force; \ - aclocalinclude="$ACLOCAL_FLAGS"; \ - aclocal $aclocalinclude; \ - autoheader; automake --add-missing --gnu $am_opt; autoconf) -done - -./configure "$@" -echo -echo "Now type 'make' to compile $PROJECT." +. $srcdir/macros/autogen.sh Index: gphoto/canon/canon.c =================================================================== RCS file: /cvs/gnome/gphoto/canon/canon.c,v retrieving revision 1.3.2.17 diff -u -r1.3.2.17 canon.c --- gphoto/canon/canon.c 2000/06/22 18:09:01 1.3.2.17 +++ gphoto/canon/canon.c 2000/07/22 21:06:53 @@ -532,7 +532,7 @@ // GtkWidget *window,*box,*scrolled_win,*tree,*clear,*done; GtkWidget *dialog, *hbox, *vbox, *label, *tree, *vseparator; GtkWidget *file_list, *button, *cbutton, *clear,*set_button; - GtkWidget *combo, *swoff, *sync, *linkCombo; + GtkWidget *combo, *swoff, *sync; GtkWidget *owner_entry, *ga; GList *list; Index: gphoto/canon/psa50.c =================================================================== RCS file: /cvs/gnome/gphoto/canon/psa50.c,v retrieving revision 1.4.2.17 diff -u -r1.4.2.17 psa50.c --- gphoto/canon/psa50.c 2000/06/08 12:25:41 1.4.2.17 +++ gphoto/canon/psa50.c 2000/07/22 21:06:53 @@ -544,7 +544,6 @@ int msgsize; char packet[0x3000]; static char buffer[0x3000]; - int i; int lonlen; memset(packet,0x00,0x3000); /* zero block */ @@ -1303,7 +1302,6 @@ unsigned char msg[0x3000]; unsigned char *msgg; char newstr[100]; - unsigned char *namn; unsigned int total = 0,expect = 0,size; int name_len,len,maxfilesize; Index: gphoto/canon/serial.c =================================================================== RCS file: /cvs/gnome/gphoto/canon/serial.c,v retrieving revision 1.3.2.12 diff -u -r1.3.2.12 serial.c --- gphoto/canon/serial.c 2000/07/21 00:12:39 1.3.2.12 +++ gphoto/canon/serial.c 2000/07/22 21:06:53 @@ -19,6 +19,7 @@ #include #include #include +#include #include "util.h" #include "psa50.h" @@ -114,7 +115,6 @@ { #ifdef GPIO_USB char msg[65536]; - char mem; char buffer[65536]; gpio_device_settings settings; struct usb_device *udev; @@ -247,13 +247,13 @@ if (sleep>0) { for(i=0;i #include +#include #include #include Index: gphoto/casio/ppm.c =================================================================== RCS file: /cvs/gnome/gphoto/casio/ppm.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 ppm.c --- gphoto/casio/ppm.c 1999/05/27 18:32:02 1.1.1.1 +++ gphoto/casio/ppm.c 2000/07/22 21:06:54 @@ -1,6 +1,7 @@ #include "config.h" #include #include +#include #include #include "../src/gphoto.h" Index: gphoto/digita/commands.c =================================================================== RCS file: /cvs/gnome/gphoto/digita/Attic/commands.c,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 commands.c --- gphoto/digita/commands.c 2000/06/08 12:25:41 1.1.2.2 +++ gphoto/digita/commands.c 2000/07/22 21:06:55 @@ -11,6 +11,7 @@ #include #include #include +#include #include "digita.h" Index: gphoto/digita/digita.c =================================================================== RCS file: /cvs/gnome/gphoto/digita/Attic/digita.c,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 digita.c --- gphoto/digita/digita.c 2000/06/08 12:25:41 1.1.2.2 +++ gphoto/digita/digita.c 2000/07/22 21:06:55 @@ -9,6 +9,7 @@ #include #include #include +#include #include "digita.h" Index: gphoto/digita/serial.c =================================================================== RCS file: /cvs/gnome/gphoto/digita/Attic/serial.c,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 serial.c --- gphoto/digita/serial.c 2000/06/08 12:25:41 1.1.2.2 +++ gphoto/digita/serial.c 2000/07/22 21:06:55 @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "digita.h" Index: gphoto/jd11/decomp.c =================================================================== RCS file: /cvs/gnome/gphoto/jd11/Attic/decomp.c,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 decomp.c --- gphoto/jd11/decomp.c 2000/06/05 07:00:37 1.1.2.1 +++ gphoto/jd11/decomp.c 2000/07/22 21:06:56 @@ -2,6 +2,7 @@ #include #include #include +#include #include "decomp.h" Index: gphoto/jd11/jd11.c =================================================================== RCS file: /cvs/gnome/gphoto/jd11/Attic/jd11.c,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 jd11.c --- gphoto/jd11/jd11.c 2000/06/05 07:00:37 1.1.2.1 +++ gphoto/jd11/jd11.c 2000/07/22 21:06:56 @@ -4,6 +4,7 @@ #include #include #include +#include #include "../src/gphoto.h" Index: gphoto/kodak/kodak_dc210.c =================================================================== RCS file: /cvs/gnome/gphoto/kodak/kodak_dc210.c,v retrieving revision 1.4.2.2 diff -u -r1.4.2.2 kodak_dc210.c --- gphoto/kodak/kodak_dc210.c 1999/11/30 18:32:10 1.4.2.2 +++ gphoto/kodak/kodak_dc210.c 2000/07/22 21:06:56 @@ -7,6 +7,7 @@ #include #include +#include /* glib is used for byte swapping and endian checking */ #include Index: gphoto/konica_qmxxx/main.c =================================================================== RCS file: /cvs/gnome/gphoto/konica_qmxxx/main.c,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 main.c --- gphoto/konica_qmxxx/main.c 1999/11/21 16:33:38 1.1.2.1 +++ gphoto/konica_qmxxx/main.c 2000/07/22 21:06:56 @@ -2,6 +2,7 @@ #include "../src/gphoto.h" #undef DECLARE_GLOBAL_VARS_IN_GPHOTO_H -void main(void) +int main(void) { + return 0; } Index: gphoto/konica_qmxxx/qm.c =================================================================== RCS file: /cvs/gnome/gphoto/konica_qmxxx/qm.c,v retrieving revision 1.1 diff -u -r1.1 qm.c --- gphoto/konica_qmxxx/qm.c 1999/10/03 00:09:02 1.1 +++ gphoto/konica_qmxxx/qm.c 2000/07/22 21:06:56 @@ -25,6 +25,7 @@ #include #include #include +#include #include "../src/gphoto.h" #include "../src/util.h" Index: gphoto/mustek/core.c =================================================================== RCS file: /cvs/gnome/gphoto/mustek/core.c,v retrieving revision 1.1.2.3 diff -u -r1.1.2.3 core.c --- gphoto/mustek/core.c 2000/01/13 22:52:38 1.1.2.3 +++ gphoto/mustek/core.c 2000/07/22 21:06:57 @@ -26,6 +26,7 @@ #include #include #include +#include #include "print.h" //------------- Global System Data ----------------------------------------/ Index: gphoto/mustek/image.c =================================================================== RCS file: /cvs/gnome/gphoto/mustek/image.c,v retrieving revision 1.1.2.3 diff -u -r1.1.2.3 image.c --- gphoto/mustek/image.c 2000/01/13 22:52:38 1.1.2.3 +++ gphoto/mustek/image.c 2000/07/22 21:06:57 @@ -22,6 +22,7 @@ * is used. */ +#include #include "image.h" #include "print.h" Index: gphoto/mustek/io.c =================================================================== RCS file: /cvs/gnome/gphoto/mustek/io.c,v retrieving revision 1.1.2.5 diff -u -r1.1.2.5 io.c --- gphoto/mustek/io.c 2000/02/24 19:50:23 1.1.2.5 +++ gphoto/mustek/io.c 2000/07/22 21:06:57 @@ -32,6 +32,7 @@ #undef _IO_C #include "../src/gphoto.h" +#include #include #include "print.h" #include "rs232.h" Index: gphoto/nikon/coolpix600.c =================================================================== RCS file: /cvs/gnome/gphoto/nikon/coolpix600.c,v retrieving revision 1.2 diff -u -r1.2 coolpix600.c --- gphoto/nikon/coolpix600.c 1999/09/11 09:51:29 1.2 +++ gphoto/nikon/coolpix600.c 2000/07/22 21:06:57 @@ -51,16 +51,17 @@ * - port to other *nixs. That shouldn't be too hard. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "../src/gphoto.h" #include "../src/util.h" Index: gphoto/philips/gphoto_philips.c =================================================================== RCS file: /cvs/gnome/gphoto/philips/gphoto_philips.c,v retrieving revision 1.5.2.2 diff -u -r1.5.2.2 gphoto_philips.c --- gphoto/philips/gphoto_philips.c 1999/11/21 16:33:39 1.5.2.2 +++ gphoto/philips/gphoto_philips.c 2000/07/22 21:06:57 @@ -25,6 +25,7 @@ #include #include +#include /* #include */ #include "../src/gphoto.h" #include "../src/util.h" Index: gphoto/philips/gphoto_philips_callbacks.c =================================================================== RCS file: /cvs/gnome/gphoto/philips/gphoto_philips_callbacks.c,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 gphoto_philips_callbacks.c --- gphoto/philips/gphoto_philips_callbacks.c 1999/10/08 00:49:24 1.1.2.1 +++ gphoto/philips/gphoto_philips_callbacks.c 2000/07/22 21:06:57 @@ -31,6 +31,7 @@ #include +#include #include #include Index: gphoto/photopc/eph_cmd.c =================================================================== RCS file: /cvs/gnome/gphoto/photopc/eph_cmd.c,v retrieving revision 1.2.2.1 diff -u -r1.2.2.1 eph_cmd.c --- gphoto/photopc/eph_cmd.c 2000/07/05 11:07:49 1.2.2.1 +++ gphoto/photopc/eph_cmd.c 2000/07/22 21:06:58 @@ -79,6 +79,7 @@ #include "config.h" #endif #include +#include #include "eph_io.h" #include "eph_priv.h" @@ -258,7 +259,7 @@ putpoint=buf; maywrite=sizeof(buf); pktsize=0; - (iob->runcb)(written); + (iob->runcb)(written,0); } if (length <= maywrite) { maywrite=length; @@ -295,6 +296,7 @@ char *ptr; char *tmpbuf=NULL; size_t tmpbufsize=0; + off_t total = *bufsize; if ((buffer == NULL) && (iob->storecb == NULL)) { eph_error(iob,ERR_BADARGS, @@ -361,7 +363,7 @@ if (pkt.seq == expect) { index+=readsize; expect++; - (iob->runcb)(index); + (iob->runcb)(index,total); if (buffer == NULL) { if (iob->debug) printf("storing %lu at %08lx\n", Index: gphoto/photopc/eph_io.c =================================================================== RCS file: /cvs/gnome/gphoto/photopc/eph_io.c,v retrieving revision 1.2.2.2 diff -u -r1.2.2.2 eph_io.c --- gphoto/photopc/eph_io.c 2000/07/09 21:40:14 1.2.2.2 +++ gphoto/photopc/eph_io.c 2000/07/22 21:06:58 @@ -368,10 +368,10 @@ uint16 usb_read; unsigned char usbbuf[256]; unsigned char *buffer_ptr; + unsigned char *buffer_ext; uint16 buffer_remaining; uint16 buffer_read; - buffer_ptr=buffer; buffer_read=0; usb_read=olympus_usb_read (gpdev,usbbuf,usbbuf_size); if (usb_read<4) { @@ -396,16 +396,32 @@ (unsigned long)length,(unsigned long)*bufsize); return -1; } + length+=2; /* frame length + 2bytes crc */ + buffer_ext = (iob->realloccb)(NULL,(size_t)length); + buffer_ptr = buffer_ext; + if (buffer_ext==0) { + eph_error(iob,ERR_DATA_TOO_LONG, + "could not malloc() %lu bytes",(unsigned long)length); + return -1; + } buffer_read=MIN (length,usb_read-4); memcpy (buffer_ptr,usbbuf+4,buffer_read); + for (i=0; i= 2. + */ + crc2=(buffer_ext[length-1]<<8)|buffer_ext[length-2]; + crc1-=buffer_ext[length-1]; + crc1-=buffer_ext[length-2]; + if (iob->debug) { + printf ("crc1=0x%04x\n",crc1); + printf ("crc2=0x%04x\n\n",crc2); + } + if (crc1 != crc2) { + if (iob->debug) + printf("crc %04x != %04x\n",crc1,crc2); + eph_error(iob,ERR_BADCRC, + "crc received=0x%04x counted=0x%04x", + crc2,crc1); + return -1; + } + /* + * copy the data to the buffer passed as argument, and + * exclude the final checksum + */ + memcpy (buffer,buffer_ext,length-2); + free (buffer_ext); + (*bufsize)=length-2; return 0; - } - - i=eph_readt(iob,buf,1,timeout_usec,&rc); - if (iob->debug > 1) - printf ("pktstart: i=%d rc=%d char=0x%02x\n",i,rc,*buf); - if (i < 0) { - eph_error(iob,ERRNO,"pkt start read error %s",strerror(ERRNO)); - return -1; - } else if ((i == 0) && (rc == 0)) { - eph_error(iob,ERR_TIMEOUT,"pkt start read timeout (%ld)", - timeout_usec); - return -2; - } else if (i != 1) { - eph_error(iob,ERR_BADREAD,"pkt start read %d, expected 1",i); - return -1; - } - pkthdr->typ=buf[0]; - if ((*buf != PKT_DATA) && (*buf != PKT_LAST)) { - if ((*buf != NAK) && (*buf != DC1)) - eph_error(iob,ERR_BADDATA,"pkt start got 0x%02x",*buf); - return *buf; - } - got=0; - while ((i=eph_readt(iob,buf+1+got,3-got,DATATIMEOUT,&rc)) > 0) { - got+=i; - } - if (got != 3) { - if (i < 0) { - eph_error(iob,ERRNO,"pkt hdr read error %s (got %d)", - strerror(ERRNO),got); - return -1; - } else if ((i == 0) && (rc == 0)) { - eph_error(iob,ERR_TIMEOUT,"pkt hdr read timeout (%ld)", - DATATIMEOUT); - return -2; - } else { - eph_error(iob,ERR_BADREAD,"pkt hdr read return %d rc %d", - i,rc); - return -1; - } - } - if (iob->debug > 1) printf("header: %02x %02x %02x %02x\n", - buf[0],buf[1],buf[2],buf[3]); - pkthdr->seq=buf[1]; - length=(buf[3]<<8)|buf[2]; - if (length > *bufsize) { - eph_error(iob,ERR_DATA_TOO_LONG, - "length in pkt header %lu bigger than buffer size %lu", - (unsigned long)length,(unsigned long)*bufsize); - return -1; - } - - got=0; - while ((i=eph_readt(iob,buffer+got,length-got,iob->timeout,&rc)) > 0) { - got+=i; - } - if (got != length) { + } else { + i=eph_readt(iob,buf,1,timeout_usec,&rc); + if (iob->debug > 1) + printf ("pktstart: i=%d rc=%d char=0x%02x\n",i,rc,*buf); if (i < 0) { - eph_error(iob,ERRNO,"pkt data read error %s",strerror(ERRNO)); + eph_error(iob,ERRNO, + "pkt start read error %s",strerror(ERRNO)); return -1; } else if ((i == 0) && (rc == 0)) { - eph_error(iob,ERR_TIMEOUT,"pkt data read timeout (%ld)", - iob->timeout); + eph_error(iob,ERR_TIMEOUT, + "pkt start read timeout (%ld)",timeout_usec); return -2; - } else { + } else if (i != 1) { eph_error(iob,ERR_BADREAD, - "pkt read return %d, rc %d",i,rc); + "pkt start read %d, expected 1",i); return -1; } - } - - for (i=0;i 0) { - got+=i; - } - if (iob->debug > 1) - printf ("crc: %02x %02x i=%d rc=%d\n",buf[0],buf[1],i,rc); - if (got != 2) { - if (i < 0) { - eph_error(iob,ERRNO,"pkt crc read error %s",strerror(ERRNO)); - return -1; - } else if ((i == 0) && (rc == 0)) { - eph_error(iob,ERR_TIMEOUT,"pkt crc read timeout (%ld)", - DATATIMEOUT); - return -2; - } else { - eph_error(iob,ERR_BADREAD,"pkt crc read return %d rc %d", - i,rc); - return -1; - } - } - - crc2=(buf[1]<<8)|buf[0]; - if (crc1 != crc2) { - if (iob->debug) printf("crc %04x != %04x\n",crc1,crc2); - eph_error(iob,ERR_BADCRC, - "crc received=0x%04x counted=0x%04x",crc2,crc1); - return -1; - } - if (iob->debug > 1) { - int j; - - printf("< %d,%d (%d)",pkthdr->typ,pkthdr->seq,length); - if (iob->debug > 2) for (j=0;jtyp,pkthdr->seq,length); - if (iob->debug > 2) for (j=0;j= ' ' && buffer[j] < 127) + pkthdr->typ=buf[0]; + if ((*buf != PKT_DATA) && (*buf != PKT_LAST)) { + if ((*buf != NAK) && (*buf != DC1)) + eph_error(iob,ERR_BADDATA, + "pkt start got 0x%02x",*buf); + return *buf; + } + got=0; + while ((i=eph_readt(iob,buf+1+got,3-got,DATATIMEOUT,&rc)) > 0) + got+=i; + if (got != 3) { + if (i < 0) { + eph_error(iob,ERRNO, + "pkt hdr read error %s (got %d)", + strerror(ERRNO),got); + return -1; + } else if ((i == 0) && (rc == 0)) { + eph_error(iob,ERR_TIMEOUT, + "pkt hdr read timeout (%ld)", + DATATIMEOUT); + return -2; + } else { + eph_error(iob,ERR_BADREAD, + "pkt hdr read return %d rc %d", + i,rc); + return -1; + } + } + if (iob->debug > 1) + printf("header: %02x %02x %02x %02x\n", + buf[0],buf[1],buf[2],buf[3]); + pkthdr->seq=buf[1]; + length=(buf[3]<<8)|buf[2]; + if (length > *bufsize) { + eph_error(iob,ERR_DATA_TOO_LONG, + "length in pkt header %lu " + "bigger than buffer size %lu", + (unsigned long)length, + (unsigned long)*bufsize); + return -1; + } + + got=0; + while ((i=eph_readt(iob,buffer+got, + length-got,iob->timeout,&rc)) > 0) + got+=i; + if (got != length) { + if (i < 0) { + eph_error(iob,ERRNO, + "pkt data read error %s", + strerror(ERRNO)); + return -1; + } else if ((i == 0) && (rc == 0)) { + eph_error(iob,ERR_TIMEOUT, + "pkt data read timeout (%ld)", + iob->timeout); + return -2; + } else { + eph_error(iob,ERR_BADREAD, + "pkt read return %d, rc %d",i,rc); + return -1; + } + } + + for (i=0;i 0) + got+=i; + if (iob->debug > 1) + printf ("crc: %02x %02x i=%d rc=%d\n", + buf[0],buf[1],i,rc); + if (got != 2) { + if (i < 0) { + eph_error(iob,ERRNO, + "pkt crc read error %s", + strerror(ERRNO)); + return -1; + } else if ((i == 0) && (rc == 0)) { + eph_error(iob,ERR_TIMEOUT, + "pkt crc read timeout (%ld)", + DATATIMEOUT); + return -2; + } else { + eph_error(iob,ERR_BADREAD, + "pkt crc read return %d rc %d", + i,rc); + return -1; + } + } + + crc2=(buf[1]<<8)|buf[0]; + if (crc1 != crc2) { + if (iob->debug) + printf("crc %04x != %04x\n",crc1,crc2); + eph_error(iob,ERR_BADCRC, + "crc received=0x%04x counted=0x%04x", + crc2,crc1); + return -1; + } + if (iob->debug > 1) { + int j; + + printf("< %d,%d (%d)",pkthdr->typ,pkthdr->seq,length); + if (iob->debug > 2) + for (j=0;jtyp,pkthdr->seq,length); + if (iob->debug > 2) + for (j=0;j= ' ' + && buffer[j] < 127) ? buffer[j] : '.'); - } else printf(" ..."); - printf("\n"); + } else + printf(" ..."); + printf("\n"); + } + (*bufsize)=length; + return 0; } - (*bufsize)=length; - return 0; } int Index: gphoto/photopc/eph_io.h =================================================================== RCS file: /cvs/gnome/gphoto/photopc/eph_io.h,v retrieving revision 1.1.1.1.2.1 diff -u -r1.1.1.1.2.1 eph_io.h --- gphoto/photopc/eph_io.h 2000/07/05 11:07:49 1.1.1.1.2.1 +++ gphoto/photopc/eph_io.h 2000/07/22 21:06:58 @@ -95,7 +95,7 @@ typedef struct _eph_iob { void (*errorcb)(int errcode,char *errstr); void *(*realloccb)(void *old,size_t length); - void (*runcb)(off_t count); + void (*runcb)(off_t count, off_t total); int (*storecb)(char *data,size_t size); int debug; #if defined(UNIX) @@ -119,7 +119,7 @@ eph_iob *eph_new(void (*errorcb)(int errcode,char *errstr), void *(*realloccb)(void *old,size_t length), - void (*runcb)(off_t count), + void (*runcb)(off_t count, off_t total), int (*storecb)(char *data,size_t size), int debug); int eph_open(eph_iob *iob,char *device_name,long speed, Index: gphoto/photopc/eph_iob.c =================================================================== RCS file: /cvs/gnome/gphoto/photopc/eph_iob.c,v retrieving revision 1.1.1.1.2.1 diff -u -r1.1.1.1.2.1 eph_iob.c --- gphoto/photopc/eph_iob.c 2000/07/05 11:07:49 1.1.1.1.2.1 +++ gphoto/photopc/eph_iob.c 2000/07/22 21:06:58 @@ -78,7 +78,7 @@ } static void -defruncb(off_t count) +defruncb(off_t count, off_t total) { return; } @@ -86,7 +86,7 @@ eph_iob * eph_new(void (*errorcb)(int errcode,char *errstr), void *(*realloccb)(void *old,size_t length), - void (*runcb)(off_t count), + void (*runcb)(off_t count, off_t total), int (*storecb)(char *data,size_t size), int debug) { Index: gphoto/photopc/olympus.c =================================================================== RCS file: /cvs/gnome/gphoto/photopc/olympus.c,v retrieving revision 1.5.2.1 diff -u -r1.5.2.1 olympus.c --- gphoto/photopc/olympus.c 2000/07/05 11:07:49 1.5.2.1 +++ gphoto/photopc/olympus.c 2000/07/22 21:06:58 @@ -19,9 +19,21 @@ eph_iob *iob; /* Olympus/photoPC io-buffer */ struct olympus_device *gpdev; -int oly_initialize () { +extern float progress_min; +extern float progress_max; + +static void +oly_update_progress (off_t count, off_t total) +{ + float percent = (float)count/(float)total; + if (total) + update_progress (progress_min+percent*(progress_max-progress_min)); +} - iob = eph_new(NULL, NULL, NULL, NULL, 0); +int +oly_initialize () { + + iob = eph_new(NULL, NULL, oly_update_progress, NULL, 0); return 1; } @@ -32,7 +44,8 @@ * for the context. Cameras not supporting folders should not * reach this code, but should still work if they do. -mid */ -static int xchdir(eph_iob *iob,char *where, int have_folders) +static int +xchdir(eph_iob *iob,char *where, int have_folders) { char path[MAXPATH],*p; @@ -57,7 +70,8 @@ return 0; } -static int descend(eph_iob *iob,int depth,char *root,int(*each)(eph_iob *iob,char *path), int have_folders) +static int +descend(eph_iob *iob,int depth,char *root,int(*each)(eph_iob *iob,char *path), int have_folders) { long nfolders=0L,i; off_t f_size; @@ -125,7 +139,8 @@ } else return 0; } -int oly_init2(eph_iob *iob) +int +oly_init2(eph_iob *iob) { long ret; int rc; @@ -142,7 +157,9 @@ return 0; } -int oly_open_camera () { +int +oly_open_camera () +{ /* Open the camera for reading/writing */ @@ -154,19 +171,21 @@ gpdev = olympus_usb_open(); if (!gpdev) - return (0); + return 0; info_size=16; info=malloc(info_size); } else { if (eph_open(iob, serial_port, 115200, 0, 0) == -1) - return (0); + return 0; } oly_init2(iob); - return (1); + return 1; } -void oly_close_camera() { +void +oly_close_camera() +{ /* Close the camera */ @@ -176,7 +195,9 @@ eph_close(iob, 0); } -int oly_number_of_pictures () { +int +oly_number_of_pictures () +{ long num_pictures_taken = 0; @@ -190,7 +211,9 @@ return ((int)num_pictures_taken); } -int oly_take_picture () { +int +oly_take_picture () +{ char zero = 0; @@ -203,7 +226,9 @@ return (oly_number_of_pictures()); } -struct Image *oly_get_picture (int picNum, int thumbnail) { +struct Image * +oly_get_picture (int picNum, int thumbnail) +{ /* Reads image #picNum the Olympus camera. @@ -255,20 +280,26 @@ strcpy(im->image_type, "jpg"); oly_close_camera(); - update_progress(0); return (im); } -struct Image *oly_get_preview () { +struct Image * +oly_get_preview () +{ - char zero = '0'; + char zero = 0; - oly_open_camera(); + if (oly_open_camera() == 0) { + error_dialog("Could not open camera."); + return NULL; + } eph_action(iob,5,&zero,1); return (oly_get_picture(0, 0)); } -int oly_configure () { +int +oly_configure () +{ /* Shows the Olympus config dialog @@ -277,6 +308,8 @@ char *info, *camID; off_t info_size = 2048; time_t camtime; + time_t gmttime; + struct tm *loctime; char *atime; long value; @@ -526,8 +559,8 @@ eph_getint(iob,2,&camtime); update_progress(1.0); - atime = ctime(&camtime); - label = gtk_label_new(atime); + atime = asctime(gmtime(&camtime)); + label = gtk_label_new(atime); gtk_widget_show(label); gtk_table_attach_defaults(GTK_TABLE(table),label,3,5,11,12); @@ -639,9 +672,17 @@ /* Set the clock... */ if (GTK_WIDGET_STATE(Config.clk_comp) == GTK_STATE_ACTIVE) { - camtime = time(&camtime); - eph_setint(iob,2,camtime); - sleep(1); + gmttime = time(NULL); + loctime = localtime(&gmttime); + + /* + * Let's get the Seconds east of UTC + */ +#ifdef __USE_BSD + eph_setint(iob,2,gmttime+loctime->tm_gmtoff); +#else + eph_setint(iob,2,gmttime+loctime->__tm_gmtoff); +#endif } update_progress(1.00); oly_close_camera(); @@ -651,7 +692,9 @@ return 1; } -int oly_delete_image (int picNum) { +int +oly_delete_image (int picNum) +{ /* deletes image #picNum from the Olympus camera. @@ -672,7 +715,9 @@ char oly_summary_text[1024]; -char *oly_summary() { +char * +oly_summary() +{ unsigned long l; char *s; Index: gphoto/photopc/photopc-usb.c =================================================================== RCS file: /cvs/gnome/gphoto/photopc/Attic/photopc-usb.c,v retrieving revision 1.1.2.3 diff -u -r1.1.2.3 photopc-usb.c --- gphoto/photopc/photopc-usb.c 2000/07/21 00:12:39 1.1.2.3 +++ gphoto/photopc/photopc-usb.c 2000/07/22 21:06:58 @@ -17,19 +17,27 @@ #include -int olympus_usb_read(struct olympus_device *dev, void *buffer, int len) +int +olympus_usb_read(struct olympus_device *dev, void *buffer, int len) { #ifdef GPIO_USB - return gpio_read(dev->gpdev, buffer, len); + if (dev) + return gpio_read(dev->gpdev, buffer, len); + else + return GPIO_ERROR; #else return GPIO_ERROR; #endif } -int olympus_usb_send(struct olympus_device *dev, void *buffer, int len) +int +olympus_usb_send(struct olympus_device *dev, void *buffer, int len) { #ifdef GPIO_USB - return gpio_write(dev->gpdev, buffer, len); + if (dev) + return gpio_write(dev->gpdev, buffer, len); + else + return GPIO_ERROR; #else return GPIO_ERROR; #endif @@ -38,7 +46,8 @@ #ifdef GPIO_USB extern struct Model *Camera; -int olympus_usb_probe(struct usb_device **udev) +int +olympus_usb_probe(struct usb_device **udev) { if (gpio_usb_find_device(Camera->idVendor, Camera->idProduct, udev)) { @@ -53,7 +62,8 @@ } #endif -struct olympus_device *olympus_usb_open(void) +struct olympus_device * +olympus_usb_open(void) { #ifdef GPIO_USB struct olympus_device *dev; @@ -80,7 +90,7 @@ settings.usb.altsetting = 0; gpio_set_settings(dev->gpdev, settings); - gpio_set_timeout(dev->gpdev, 50000); + gpio_set_timeout(dev->gpdev, 5000); if (gpio_open(dev->gpdev) < 0) { fprintf(stderr, "error opening device\n"); return NULL; @@ -92,18 +102,23 @@ #endif } -void olympus_usb_close (struct olympus_device *dev) +void +olympus_usb_close (struct olympus_device *dev) { #ifdef GPIO_USB - gpio_close (dev->gpdev); - gpio_free (dev->gpdev); - free (dev); + if (dev) { + gpio_close (dev->gpdev); + gpio_free (dev->gpdev); + free (dev); + } #endif } -void olympus_usb_reset (struct olympus_device *dev) +void +olympus_usb_reset (struct olympus_device *dev) { #ifdef GPIO_USB - gpio_usb_clear_halt (dev->gpdev); + if (dev) + gpio_usb_clear_halt (dev->gpdev, GPIO_USB_IN_ENDPOINT); #endif } Index: gphoto/ricoh/ricoh_300_io.c =================================================================== RCS file: /cvs/gnome/gphoto/ricoh/ricoh_300_io.c,v retrieving revision 1.2 diff -u -r1.2 ricoh_300_io.c --- gphoto/ricoh/ricoh_300_io.c 1999/06/18 12:25:19 1.2 +++ gphoto/ricoh/ricoh_300_io.c 2000/07/22 21:07:00 @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include #include Index: gphoto/ricoh/ricoh_300z.c =================================================================== RCS file: /cvs/gnome/gphoto/ricoh/ricoh_300z.c,v retrieving revision 1.8 diff -u -r1.8 ricoh_300z.c --- gphoto/ricoh/ricoh_300z.c 1999/10/02 23:41:37 1.8 +++ gphoto/ricoh/ricoh_300z.c 2000/07/22 21:07:00 @@ -4,6 +4,7 @@ #include #include #include +#include #include "../src/gphoto.h" #include "../src/util.h" Index: gphoto/samsung/samsung.c =================================================================== RCS file: /cvs/gnome/gphoto/samsung/samsung.c,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 samsung.c --- gphoto/samsung/samsung.c 2000/01/13 19:31:48 1.1.2.1 +++ gphoto/samsung/samsung.c 2000/07/22 21:07:00 @@ -32,16 +32,17 @@ ** */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "../src/gphoto.h" #include "../src/util.h" Index: gphoto/sony/command.c =================================================================== RCS file: /cvs/gnome/gphoto/sony/command.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 command.c --- gphoto/sony/command.c 1999/05/27 18:32:06 1.1.1.1 +++ gphoto/sony/command.c 2000/07/22 21:07:00 @@ -1,5 +1,6 @@ #include "config.h" #include +#include #include #include "common.h" #ifdef X68 @@ -288,11 +289,11 @@ break; } sprintf(tmp_buf, "Total Pictures: %02d\n", pic_num); - strcat(status_buf, tmp_buf, sizeof(tmp_buf)); + strcat(status_buf, tmp_buf); sprintf(tmp_buf, "Date: %02d/%02d/%02d\n", month, date, year); - strcat(status_buf, tmp_buf, sizeof(tmp_buf)); + strcat(status_buf, tmp_buf); sprintf(tmp_buf, "Time: %02d:%02d\n",hour, minutes); - strcat(status_buf, tmp_buf, sizeof(tmp_buf)); + strcat(status_buf, tmp_buf); } /* return (buf[2]); ok*/ strcpy(return_buf, status_buf); Index: gphoto/sony/dscf55/Makefile.am =================================================================== RCS file: /cvs/gnome/gphoto/sony/dscf55/Makefile.am,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 Makefile.am --- gphoto/sony/dscf55/Makefile.am 2000/06/08 12:25:43 1.1.2.2 +++ gphoto/sony/dscf55/Makefile.am 2000/07/22 21:07:00 @@ -7,8 +7,8 @@ rsony_SOURCES = rsony_LDADD = srsony.o config.o serio.o -srsony.o : rsony.c serio.o config.o serio.h - $(COMPILE) -DSTAND_ALONE -o srsony.o -c rsony.c +srsony.o : ${srcdir}/rsony.c serio.o config.o serio.h + $(COMPILE) -DSTAND_ALONE -o srsony.o -c ${srcdir}/rsony.c ## rsony_SOURCES = rmain.c rsony.c config.c serio.c serio.h @@ -18,4 +18,4 @@ libgphoto_sony_dscf55_la_LDFLAGS = -version-info 0:0:0 -EXTRA_DIST = serio.h rsony.c serio.c config.c config.h \ No newline at end of file +EXTRA_DIST = serio.h rsony.c serio.c config.c config.h Index: gphoto/src/callbacks.c =================================================================== RCS file: /cvs/gnome/gphoto/src/callbacks.c,v retrieving revision 1.51.2.23 diff -u -r1.51.2.23 callbacks.c --- gphoto/src/callbacks.c 2000/07/06 18:08:15 1.51.2.23 +++ gphoto/src/callbacks.c 2000/07/22 21:07:01 @@ -57,6 +57,10 @@ extern char *filesel_cwd; +extern float progress_min; +extern float progress_max; +extern int cam_busy; + /* Search the image_info tags for "name", return its value (string) */ char *find_tag(struct Image *im, char *name) { @@ -90,6 +94,7 @@ void set_camera(char *model) { int i; + int ret; for (i = 0; cameras[i].name; i++) { if (strcmp(model, cameras[i].name)) @@ -103,14 +108,29 @@ Camera = &cameras[i]; - if (Camera->ops->initialize() != 0) + if (cam_busy) { + error_dialog("Camera is already busy"); return; + } + cam_busy=1; + ret=Camera->ops->initialize(); + cam_busy=0; + if (ret) return; } } void configure_call(void) { - if (Camera->ops->configure() == 0) + int ret; + + if (cam_busy) { + error_dialog("Camera is already busy"); + return; + } + cam_busy=1; + ret=Camera->ops->configure(); + cam_busy=0; + if (ret == 0) error_dialog("No configuration options."); } @@ -126,14 +146,20 @@ update_status("Taking picture..."); + if (cam_busy) { + error_dialog("Camera is already busy"); + return; + } + cam_busy=1; picNum = Camera->ops->take_picture(); + cam_busy=0; if (!picNum) { error_dialog("Could not take a picture."); return; } - appendpic(picNum, 0, TRUE, NULL); + appendpic(picNum, 0, TRUE, NULL, 100); sprintf(status, "New picture is #%03i", picNum); gtk_notebook_set_page(GTK_NOTEBOOK(notebook), picNum); update_status(status); @@ -144,6 +170,11 @@ gint current, no_pics, i; char error[32]; + if (cam_busy) { + error_dialog("Camera is already busy"); + return; + } + cam_busy=1; no_pics = Camera->ops->number_of_pictures(); i = no_pics; @@ -166,6 +197,7 @@ update_status("Deleted all images."); update_progress(0); gtk_widget_destroy(dialog); + cam_busy=0; } void del_pics(GtkWidget *dialog, GtkObject *button) @@ -174,6 +206,11 @@ char error[32]; struct ImageMembers *node = &Thumbnails; + if (cam_busy) { + error_dialog("Camera is already busy"); + return; + } + cam_busy=1; gtk_widget_hide(dialog); update_status("Deleting selected pictures..."); @@ -196,6 +233,7 @@ } gtk_widget_destroy(dialog); update_status("Done."); + cam_busy=0; } void del_dialog(int type) @@ -282,7 +320,14 @@ } } - if ((im = Camera->ops->get_picture(picNum, thumbnail)) == 0) { + if (cam_busy) { + error_dialog("Camera is already busy"); + return; + } + cam_busy=1; + im = Camera->ops->get_picture(picNum, thumbnail); + cam_busy=0; + if (im == 0) { sprintf(error, "Could not save #%i", picNum); error_dialog(error); return; @@ -383,13 +428,14 @@ update_status(fname); } -void appendpic(gint picNum, gint thumbnail, gint fromCamera, char *fileName) +void appendpic(gint picNum, gint thumbnail, gint fromCamera, char *fileName, int factor) { int w, h; char fname[15], error[32], process[1024], imagename[1024],*openName; GtkWidget *scrwin, *label; + GdkImlibImage *scaledImage; GdkPixmap *pixmap; struct Image *im; @@ -410,7 +456,14 @@ node->next = NULL; if (fromCamera) { - if ((im = Camera->ops->get_picture(picNum, thumbnail))==0) { + if (cam_busy) { + error_dialog("Camera is already busy"); + return; + } + cam_busy=1; + im = Camera->ops->get_picture(picNum, thumbnail); + cam_busy=0; + if (im == 0) { sprintf(error, "Could not retrieve #%i", picNum); error_dialog(error); return; @@ -432,8 +485,29 @@ } else node->imlibimage = gdk_imlib_load_image(fileName); + if (node->imlibimage==0) { + sprintf(error, "Could not load image #%i to memory", picNum); + error_dialog(error); + return; + } w = node->imlibimage->rgb_width; h = node->imlibimage->rgb_height; + + w = (w * factor)/100; + h = (h * factor)/100; + + scaledImage = gdk_imlib_clone_scaled_image(node->imlibimage,w,h); + gdk_imlib_kill_image(node->imlibimage); + + if (scaledImage==0) { + sprintf(error, "Could not load image #%i to memory", picNum); + error_dialog(error); + return; + } + node->imlibimage = scaledImage; + w = node->imlibimage->rgb_width; + h = node->imlibimage->rgb_height; + gdk_imlib_render(node->imlibimage, w, h); pixmap = gdk_imlib_move_image(node->imlibimage); node->image = gtk_pixmap_new(pixmap, NULL); @@ -1097,14 +1171,21 @@ /* If the thumbnail is already there, then just load the image */ if (node->image && node->imlibimage) { - appendpic(i, 0, TRUE, NULL); + appendpic(i, 0, TRUE, NULL, 100); return; } sprintf(status, "Getting thumbnail %i...", i); update_status(status); - if ((im = Camera->ops->get_picture(i, 1))==0) { + if (cam_busy) { + error_dialog("Camera is already busy"); + return; + } + cam_busy=1; + im = Camera->ops->get_picture(i, 1); + cam_busy=0; + if (im==0) { sprintf(error, "Could not retrieve #%i", i); error_dialog(error); return; @@ -1123,6 +1204,11 @@ node->imlibimage = gdk_imlib_load_image_mem(im->image, im->image_size); free_image (im); + if (node->imlibimage==0) { + sprintf(error, "Could not load image #%i to memory", i); + error_dialog(error); + return; + } w = node->imlibimage->rgb_width; h = node->imlibimage->rgb_height; @@ -1203,8 +1289,14 @@ gtk_widget_show(index_table); gtk_container_add(GTK_CONTAINER(index_vp), index_table); + if (cam_busy) { + error_dialog("Camera is already busy"); + return; + } + cam_busy=1; num_pictures_taken = Camera->ops->number_of_pictures(); -fprintf(stderr, "num_pictures_taken is %d\n", num_pictures_taken); + cam_busy=0; + fprintf(stderr, "num_pictures_taken is %d\n", num_pictures_taken); if (num_pictures_taken == -1) { error_dialog("Could not get the number of pictures"); return; @@ -1259,6 +1351,8 @@ node->image=NULL; node->imlibimage=NULL; + progress_min=(float)i/(float)num_pictures_taken; + progress_max=(float)(i+1)/(float)num_pictures_taken; if (getthumbs) insert_thumbnail(node); @@ -1271,7 +1365,7 @@ node->button, i%6,i%6+1,i/6,i/6+1, GTK_FILL,GTK_FILL,5,5); - update_progress((float)i/(float)(num_pictures_taken - 1)); + update_progress(progress_max); } deactivate_button(stop_button); update_progress(0); @@ -1298,6 +1392,12 @@ /* get selected pictures */ void getpics(char *pictype) { + getpics_with_scale (pictype, 100); +} + +/* get selected pictures at a given scale */ +void getpics_with_scale(char *pictype, int factor) +{ char status[256]; gint i=0; gint x=0, y=0; @@ -1322,23 +1422,25 @@ node = node->next; i++; if (GTK_TOGGLE_BUTTON(node->button)->active) { + progress_min=(float)y/(float)x; + progress_max=(float)(y+1)/(float)x; y++; if ((strcmp("i", pictype) == 0) || (strcmp("ti", pictype) == 0)) { sprintf(status, "Getting Image #%03i...", i); update_status(status); - appendpic(i, 0, TRUE, NULL); + appendpic(i, 0, TRUE, NULL, factor); } if ((strcmp("t", pictype) == 0) || (strcmp("ti", pictype) == 0)) { - appendpic(i, 1, TRUE, NULL); + appendpic(i, 1, TRUE, NULL, factor); sprintf(status, "Getting Thumbnail #%03i...", i); update_status(status); } gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(node->button), FALSE); - update_progress((float)y/(float)x); + update_progress(progress_max); } } @@ -1484,7 +1586,7 @@ return; appendpic(0, 0, FALSE, gtk_file_selection_get_filename( - GTK_FILE_SELECTION(filew))); + GTK_FILE_SELECTION(filew)), 100); gtk_widget_destroy(filew); } @@ -1826,7 +1928,14 @@ void summary_dialog(void) { - message_window("Camera Summary", Camera->ops->summary(), GTK_JUSTIFY_FILL); + if (cam_busy) { + error_dialog("Camera is already busy"); + return; + } + cam_busy=1; + message_window("Camera Summary", + Camera->ops->summary(), GTK_JUSTIFY_FILL); + cam_busy=0; } /* Decreases image size by factor n % */ @@ -1903,8 +2012,18 @@ } void open_images(gpointer data, guint action, GtkWidget *widget) +{ + getpics_with_scale("i",100); +} + +void open_images_and_scale50(gpointer data, guint action, GtkWidget *widget) +{ + getpics_with_scale("i",50); +} + +void open_images_and_scale25(gpointer data, guint action, GtkWidget *widget) { - getpics("i"); + getpics_with_scale("i",25); } void save_thumbs(gpointer data, guint action, GtkWidget *widget) @@ -1914,7 +2033,7 @@ void open_thumbs(gpointer data, guint action, GtkWidget *widget) { - getpics("t"); + getpics_with_scale("t",100); } void save_both (gpointer data, guint action, GtkWidget *widget) @@ -1925,7 +2044,7 @@ void open_both(gpointer data, guint action, GtkWidget *widget) { - getpics("ti"); + getpics_with_scale("ti",100); } Index: gphoto/src/callbacks.h =================================================================== RCS file: /cvs/gnome/gphoto/src/callbacks.h,v retrieving revision 1.12.2.6 diff -u -r1.12.2.6 callbacks.h --- gphoto/src/callbacks.h 1999/11/21 16:33:39 1.12.2.6 +++ gphoto/src/callbacks.h 2000/07/22 21:07:01 @@ -16,7 +16,7 @@ void del_dialog (int type); void savepictodisk (int picNum, int thumbnail, char *prefix); void saveselectedtodisk (GtkWidget *widget, char *type); -void appendpic (int picNum, int thumbnail, int fromCamera, char *fileName); +void appendpic (int picNum, int thumbnail, int fromCamera, char *fileName, int factor); void destroy (GtkWidget *widget, gpointer data); void port_dialog(); void version_dialog(); @@ -32,6 +32,7 @@ void getindex_empty (); void halt_action (); void getpics (char *type); +void getpics_with_scale (char *type, int factor); void remove_image(int i); void closepic (); void print_pic (); @@ -47,6 +48,8 @@ void scale_double (); void save_images (gpointer data, guint action, GtkWidget *widget); void open_images (gpointer data, guint action, GtkWidget *widget); +void open_images_and_scale25 (gpointer data, guint action, GtkWidget *widget); +void open_images_and_scale50 (gpointer data, guint action, GtkWidget *widget); void save_thumbs (gpointer data, guint action, GtkWidget *widget); void open_thumbs (gpointer data, guint action, GtkWidget *widget); void save_both (gpointer data, guint action, GtkWidget *widget); Index: gphoto/src/commandline.c =================================================================== RCS file: /cvs/gnome/gphoto/src/commandline.c,v retrieving revision 1.8.2.4 diff -u -r1.8.2.4 commandline.c --- gphoto/src/commandline.c 2000/02/24 19:50:24 1.8.2.4 +++ gphoto/src/commandline.c 2000/07/22 21:07:02 @@ -1,4 +1,5 @@ +#include #include #include Index: gphoto/src/gallery.c =================================================================== RCS file: /cvs/gnome/gphoto/src/gallery.c,v retrieving revision 1.18.2.7 diff -u -r1.18.2.7 gallery.c --- gphoto/src/gallery.c 2000/07/06 18:08:15 1.18.2.7 +++ gphoto/src/gallery.c 2000/07/22 21:07:02 @@ -202,6 +202,7 @@ #include #include #include +#include extern GtkWidget *index_window; /* extern GtkWidget *browse_button; */ @@ -211,6 +212,8 @@ extern struct Model *Camera; extern char *filesel_cwd; +extern int cam_busy; + /* initialize some tags */ char gallery_name[256]; char gallery_index[128]; @@ -323,7 +326,7 @@ char * cmd1, *cmd2, *cmd3, *cmd4, *cmd5, *cmd6, *cmd7, *cmd8, *cmd9, *cmd10, *cmd11; pid_t pid; - const char *argv [5]; + const char * argv [5]; cmd1 = gallery_make_sed_command ("s", "#GALLERY_NAME#", gallery_name); cmd2 = gallery_make_sed_command ("s", "#GALLERY_INDEX#", gallery_index); @@ -383,7 +386,7 @@ perror ("close"); } - execvp (argv [0], argv); + execvp (argv [0], (char * const *)argv); perror ("exec"); exit (1); } @@ -675,7 +678,16 @@ /* Get the current thumbnail */ sprintf(cp, "Getting Thumbnail #%i...", j+1); update_status(cp); - if ((im = Camera->ops->get_picture(j+1, 1))==0) { + if (cam_busy) { + error_dialog("Camera is already busy"); + if (GTK_IS_OBJECT(dialog)) + gtk_widget_destroy(dialog); + return; + } + cam_busy=1; + im = Camera->ops->get_picture(j+1, 1); + cam_busy=0; + if (im==0) { sprintf(error, "Could not retrieve #%i", j+1); error_dialog(error); @@ -706,7 +718,16 @@ sprintf(cp, "Getting Image #%i...", j+1); update_status(cp); - if ((im = Camera->ops->get_picture(j+1, 0))==0) { + if (cam_busy) { + error_dialog("Camera is already busy"); + if (GTK_IS_OBJECT(dialog)) + gtk_widget_destroy(dialog); + return; + } + cam_busy=1; + im = Camera->ops->get_picture(j+1, 0); + cam_busy=0; + if (im==0) { sprintf(error, "Could not retrieve #%i", j+1); error_dialog(error); sprintf(picture, "Not Available"); Index: gphoto/src/live.c =================================================================== RCS file: /cvs/gnome/gphoto/src/live.c,v retrieving revision 1.4.2.2 diff -u -r1.4.2.2 live.c --- gphoto/src/live.c 2000/07/06 18:08:15 1.4.2.2 +++ gphoto/src/live.c 2000/07/22 21:07:02 @@ -10,6 +10,7 @@ */ extern struct Model *Camera; +extern int cam_busy; int live_video_mode = 0; @@ -22,22 +23,32 @@ struct Image *im; GList *child = gtk_container_children( - GTK_CONTAINER(GTK_DIALOG(dialog)->vbox)); + GTK_CONTAINER(GTK_DIALOG(dialog)->vbox)); GtkWidget *gpixmap = GTK_WIDGET(child->data); + if (cam_busy) { + error_dialog("Camera is already busy"); + return; + } update_status("Getting live image..."); + cam_busy=1; if ((im = Camera->ops->get_preview()) == 0) { error_dialog("Could not get preview"); return; } - imlibimage = gdk_imlib_load_image_mem(im->image, im->image_size); - free_image(im); - w = imlibimage->rgb_width; - h = imlibimage->rgb_height; - gdk_imlib_render(imlibimage, w, h); - pixmap = gdk_imlib_move_image(imlibimage); - gtk_pixmap_set(GTK_PIXMAP(gpixmap), pixmap, NULL); - update_status("Done."); + cam_busy=0; + if (im) { + imlibimage = gdk_imlib_load_image_mem(im->image, im->image_size); + free_image(im); + if (imlibimage) { + w = imlibimage->rgb_width; + h = imlibimage->rgb_height; + gdk_imlib_render(imlibimage, w, h); + pixmap = gdk_imlib_move_image(imlibimage); + gtk_pixmap_set(GTK_PIXMAP(gpixmap), pixmap, NULL); + update_status("Done."); + } + } } void live_video (GtkWidget *button, GtkWidget *dialog) { @@ -50,10 +61,16 @@ while (live_video_mode) { while (gtk_events_pending()) gtk_main_iteration(); - live_snapshot(dialog); + if (live_video_mode) + live_snapshot(dialog); } } +void live_close (GtkWidget *dialog) { + live_video_mode = 0; + gtk_widget_destroy (dialog); +} + void live_main () { int w, h; @@ -65,6 +82,10 @@ GdkImlibImage *imlibimage; struct Image *im; + if (cam_busy) { + error_dialog("Camera is already busy"); + return; + } update_status("Getting live image..."); dialog = gtk_dialog_new(); gtk_window_set_title(GTK_WINDOW(dialog), "Live Camera!"); @@ -103,12 +124,14 @@ cbutton); gtk_signal_connect_object(GTK_OBJECT(cbutton), "clicked", - GTK_SIGNAL_FUNC(gtk_widget_destroy), + GTK_SIGNAL_FUNC(live_close), GTK_OBJECT(dialog)); + cam_busy=1; if ((im = Camera->ops->get_preview()) == 0) { error_dialog("Could not get preview"); return; } + cam_busy=0; imlibimage = gdk_imlib_load_image_mem(im->image, im->image_size); free(im->image); free(im); Index: gphoto/src/main.c =================================================================== RCS file: /cvs/gnome/gphoto/src/main.c,v retrieving revision 1.22.2.11 diff -u -r1.22.2.11 main.c --- gphoto/src/main.c 2000/07/09 21:40:15 1.22.2.11 +++ gphoto/src/main.c 2000/07/22 21:07:02 @@ -37,6 +37,10 @@ GtkWidget *index_vp; /* Viewport for above */ GtkWidget *index_window; /* Index Scrolled Window */ GtkWidget *progress; /* Progress bar */ + float progress_min; /* min and max values for */ + float progress_max; /* Progress Bar during download */ + int cam_busy; /* TRUE/FALSE to lock operation */ + /* with the camera */ int post_process; /* TRUE/FALSE to post-process */ char post_process_script[1024]; /* Full path/filename */ @@ -135,9 +139,9 @@ command_line_mode = 0; gtk_init(&argc, &argv); -#if 1 /* by fujisawa */ gdk_imlib_init(); -#endif + gpio_init(); + gtk_widget_push_visual(gdk_imlib_get_visual()); gtk_widget_push_colormap(gdk_imlib_get_colormap()); Index: gphoto/src/menu.c =================================================================== RCS file: /cvs/gnome/gphoto/src/menu.c,v retrieving revision 1.12.2.8 diff -u -r1.12.2.8 menu.c --- gphoto/src/menu.c 2000/02/24 19:50:24 1.12.2.8 +++ gphoto/src/menu.c 2000/07/22 21:07:02 @@ -211,6 +211,8 @@ {"/Camera/Download _Selected", NULL, 0, 0, ""}, {"/Camera/Download Selected/_Images", NULL, 0, 0, ""}, {"/Camera/Download Selected/Images/_Open in window", NULL, open_images, 18}, + {"/Camera/Download Selected/Images/_Open in window (scale 50%)",NULL, open_images_and_scale50,18}, + {"/Camera/Download Selected/Images/_Open in window (scale 25%)",NULL, open_images_and_scale25,18}, {"/Camera/Download Selected/Images/_Save to disk...","g", save_images, 19}, {"/Camera/Download Selected/_Thumbnails", NULL, 0, 0, ""}, {"/Camera/Download Selected/Thumbnails/_Open in window", NULL, open_thumbs, 0},