/*
 * screenshot.h: A plugin for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *
 */

#ifndef _SCREENSHOT__H
#define _SCREENSHOT__H
 
#include <vdr/plugin.h>
#include <vdr/status.h>
#include "i18n.h"

static const char *VERSION        = "0.0.10";
static const char *DESCRIPTION    = "Takes screenshots";
static const char *MAINMENUENTRY  = "Screenshot";

static const char *FILEFORMATS[10] = {"pnm", "jpg"};

char sPath[100]     = "/tmp";
int  iFileformat    = 1;
int  iQuality       = 95;
int  iResX          = 768;
int  iResY          = 576;
int  iNoOfPics      = 1;
int  iHideMenuEntry = false;
int  iUserKey       = 0;
int  iHideOsd       = true;
int  iShowDate      = false;

class cMyMenu : public cOsdObject {
private:
  const char *title;
  int showdate;
public:
	cMyMenu(const char *Title, int ShowDate = false);
	~cMyMenu();
	void Show(void);
  virtual eOSState ProcessKey(eKeys Key) { return osEnd; }
};

class cPluginScreenshot : public cPlugin, public cStatus {
private:
  // Add any member variables or functions you may need here.
  char title[100];
#if VDRVERSNUM < 10338
  virtual void Replaying(const cControl *Control, const char *Name);
#else
  virtual void Replaying(const cControl *Control, const char *Name, const char *FileName, bool On);
#endif
//  virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber);
  virtual void OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle);
//  virtual void UserKeyPressed(eKeys Key);
public:
  cPluginScreenshot(void);
  virtual ~cPluginScreenshot();
  virtual const char *Version(void) { return VERSION; }
  virtual const char *Description(void) { return tr(DESCRIPTION); }
  virtual const char *CommandLineHelp(void);
  virtual bool ProcessArgs(int argc, char *argv[]);
  virtual bool Initialize(void);
  virtual bool Start(void);
  virtual void Housekeeping(void);
  virtual const char *MainMenuEntry(void) { return iHideMenuEntry ? NULL : tr(MAINMENUENTRY); }
  virtual cOsdObject *MainMenuAction(void);
  virtual cMenuSetupPage *SetupMenu(void);
  virtual bool SetupParse(const char *Name, const char *Value);
  };

class cThreadScreenshot : public cThread {
  virtual void Action(void);
};
  
class cMenuSetupScreenshot : public cMenuSetupPage {
private:
  char sNewPath[100];
  int  iNewFileformat;
  int  iNewQuality;
  int  iNewResX;
  int  iNewResY;
  int  iNewNoOfPics;
  int  iNewHideMenuEntry;
  int  iNewUserKey;
  int  iNewHideOsd;
  int  iNewShowDate;
protected:
  virtual void Store(void);
public:
  cMenuSetupScreenshot(void);
};

#endif
