2 * $Id: pictureviewer.h,v 1.21 2007/02/20 21:57:04 ghostrider Exp $
4 * (C) 2005 by digi_casi <digi_casi@tuxbox.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifndef __pictureviewer_h
23 #define __pictureviewer_h
25 #include <lib/base/estring.h>
26 #include <lib/gui/ewidget.h>
27 #include <src/enigma_main.h>
30 #define FH_ERROR_FILE 1 /* read/access error */
31 #define FH_ERROR_FORMAT 2 /* file format error */
32 #define FH_ERROR_MALLOC 3 /* error during malloc */
34 #define dbout(fmt, args...) {struct timeval tv; gettimeofday(&tv, NULL); \
35 printf( "PV[%ld|%02ld] " fmt, (long)tv.tv_sec, (long)tv.tv_usec / 10000, ## args);}
37 class ePictureViewer
: public eWidget
39 eTimer slideshowTimer
;
40 std::list
<eString
> slideshowList
;
41 std::list
<eString
>::iterator myIt
;
44 struct cformathandler
*next
;
45 int (*get_size
)(const char *, int *, int *, int, int);
46 int (*get_pic
)(const char *, unsigned char *, int, int);
47 int (*id_pic
)(const char *);
49 typedef struct cformathandler CFormathandler
;
51 int eventHandler(const eWidgetEvent
&evt
);
52 void listDirectory(eString
, int);
54 void previousPicture();
55 void showNameOnLCD(const eString
& filename
);
56 bool DecodeImage(const std::string
& name
, bool unscaled
= false);
57 bool DisplayNextImage();
65 ePictureViewer(const eString
&filename
);
75 bool ShowImage(const std::string
& filename
, bool unscaled
= false);
76 void SetScaling(ScalingMode s
) {m_scaling
= s
;}
77 void SetAspectRatio(float aspect_ratio
) {m_aspect
= aspect_ratio
;}
78 void showBusy(int sx
, int sy
, int width
, char r
, char g
, char b
);
80 void Zoom(float factor
);
81 void Move(int dx
, int dy
);
82 void slideshowTimeout();
83 eString
GetCurrentFile() { return *myIt
; }
85 CFormathandler
*fh_root
;
86 ScalingMode m_scaling
;
88 std::string m_NextPic_Name
;
89 unsigned char *m_NextPic_Buffer
;
97 unsigned char *m_busy_buffer
;
108 CFormathandler
* fh_getsize(const char *name
, int *x
, int *y
, int width_wanted
, int height_wanted
);
109 void init_handlers(void);
110 void add_format(int (*picsize
)(const char *, int *, int *, int, int), int (*picread
)(const char *, unsigned char *, int , int), int (*id
)(const char *));