#ifndef __DISPLAYCHANNEL_H
#define __DISPLAYCHANNEL_H

#include <vdr/skins.h>

#if VDRVERSNUM >= 10332
#include <vdr/device.h>
#endif

#include "scroll.h"
#include "setup.h"

#ifdef HAVE_IMAGEMAGICK
class cLogo : public cThread {
private:
    virtual void Action(void);
    int pid, bpp;
    bool ready, update;
    cCondWait Wait;
    char *filename;
    FILE *file;
    const char *path;
    const char *channelname;
public:
    cLogo(void);
    ~cLogo();
    int Pid;
    int logox, logoy;
    void Update(const char* Path = NULL, const char* ChannelName = NULL, int Bpp = 4);
    bool Ready();
    void Drawed(void);
    cBitmap *LogoBmp;
};
#endif

class cGetEvent : public cThread {
private:
    virtual void Action(void);
    int pid;
    const cEvent *present;
    const cEvent *following;
    const char *presenttitle;
    const char *presentshorttext;
    const char *presenttimestring;
    const char *followingtitle;
    const char *followingshorttext;
    const char *followingtimestring;
    const char *Presenttitle;
    const char *Presentshorttext;
    const char *Presenttimestring;
    const char *Followingtitle;
    const char *Followingshorttext;
    const char *Followingtimestring;
    bool ready, update;
    cCondWait Wait;
public:
    cGetEvent(void);
    ~cGetEvent();
    int Pid;
    void Update(const cEvent *Present = NULL, const cEvent *Following = NULL);
    bool Ready(void);
    void Drawed(void);
    const char *PresentTitle(void);
    const char *PresentShortText(void);
    const char *PresentTimeString(void);
    const char *FollowingTitle(void);
    const char *FollowingShortText(void);
    const char *FollowingTimeString(void);
};

class cSkinElchiDisplayChannel : public cSkinDisplayChannel {
private:
  cOsd *osd;
  int logox, logoy;
  int x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11;
  int y0, y1, y2, y3, y4, y5, y6, y7, y8, y9;
  const cFont *smallfont;
  const cFont *font;
  bool withInfo, rec, message, showVolume, sleeptimermessage;
  int lh, slh, lhh, lineOffset;
  tColor bg;
  char number[6];
  cTimeMs volume;
  int volumechange, oldvolume;
  const cEvent *present;
  const tTrackId *track;
  int lastSeen;
  bool oldvps;
  bool changed, noflush;
  int oldaudiow;
  char *olddate;
  time_t oldpresentvps;
  static cBitmap bmVps, bmTeletext, bmRadio, bmAudio, bmDolbyDigital, bmEncrypted, bmRecording;
#ifdef VIDEOSTATUS
  char *oldvideoformatchar;
  int oldvideow;
  cBitmap *oldbm;
#endif
  int setchannel_x;
  cCharScroll AudioStringScroll;
  cCharScroll ChannelNameScroll;
  cCharScroll EventScroll;
  cCharScroll EventShortScroll;
  cCharScroll NextEventScroll;
  cCharScroll NextEventShortScroll;
#ifdef HAVE_IMAGEMAGICK
  cLogo *Logo;
#endif
  cGetEvent *GetEvent;
public:
  cSkinElchiDisplayChannel(bool WithInfo);
  virtual ~cSkinElchiDisplayChannel();
  virtual void SetChannel(const cChannel *Channel, int Number);
  virtual void SetEvents(const cEvent *Present, const cEvent *Following);
  virtual void SetMessage(eMessageType Type, const char *Text);
  virtual void Flush(void);
};

#endif //__DISPLAYCHANNEL_H
