/*
 * config.c: A plugin for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *
 * $Id: config.c,v 1.2 2004/10/20 20:59:54 torsten Exp $
 */

#include <vdr/eit.h>
#include <vdr/osd.h>
#include <vdr/menuitems.h>

#include "config.h"
#include "i18n.h"

cVdrconvertSetup VdrconvertSetup;

// --- cVdrconvertSetup -----------------------------------------------------------

cVdrconvertSetup::cVdrconvertSetup(void)
{
  anzeigeBereichTexte[0]=tr("common");
  anzeigeBereichTexte[1]=tr("dvd");
  anzeigeBereichTexte[2]=tr("divx");
  anzeigeBereichTexte[3]=tr("mp3");

    strcpy(VerzeichnisListendateien, "/tmp");
    strcpy(DVD_aussehen, "default");
    DVD_EPGMenue=1;

  //INIT Anfang
  //TODO Projekttyp-Abhaengigkeit einbauen

  //allgemeine Variablen
  strcpy(VDRROOT,"/video");
  strcpy(DESTDIR,"/video");
  strcpy(CONVERT_JOBS,"vdr2divx vdr2dvd vdr2vcd vdr2svcd vdr2mpg vdr2mp3 vdr2ac3 burn");
  strcpy(VDRSYNC,"vdrsync.pl");
  strcpy(TCMPLEX,"tcmplex");
  strcpy(TCMPLEX_PANTELTJE,"tcmplex-panteltje");
  strcpy(DVBMPLEX,"dvb-mplex");
  strcpy(MPLEX,"mplex");
  strcpy(MKISOFS,"mkisofs");
  strcpy(MENCODER,"mencoder");
  strcpy(LAME,"lame");
  strcpy(DVDAUTHOR,"dvdauthor");
  strcpy(TOSVCD,"tosvcd");
  PRIO=15;
  SLEEP_TIME=5;
  strcpy(TEMPDIR,strcat(DESTDIR,"/tmp"));
  strcpy(LOGDIR,"/var/log/vdrconvert");
  strcpy(SVDRPSEND,"vdrsync-0.1.2.2.pl");
  strcpy(PARQ,"none");
  DEBUG=0;
  strcpy(COMPRESS,"bzip2");
  CONV_TITLEDATE=0;
  strcpy(VCOQUEDIR,"");
  strcpy(DEMUXER,"px");
  strcpy(XVFB,"xvfb");
  strcpy(JAVA,"java");
  OSDMONITOR=0;
  
  //DVD-Variablen
  strcpy(DVD_DESTDIR,strcat(DESTDIR,"/dvd"));
  strcpy(DVDTCMPLEXOPTS,"-m d");
  strcpy(DVD_DVBMPLEXOPTS,"-t DVD");
  strcpy(DVDALLOWEDWIDTH,"720 704 352 480");
  strcpy(DVDTRANSCODEOPTS,"-I 3 -V -y mpeg -Z 720x576 -b 192");
  strcpy(PPMTOY4M_OPTIONS,"-n 1 -F 25:1 -A 59:54 -I t -L -r -v 0");
  strcpy(DVDTRANSCODEBITRATE,"3300000.0");
  strcpy(DVDAUTHORUSERCHAP,"15min");
  strcpy(DVDUSESTREAMS,"bd.ac3:ac3+de c0.mpa:mp2+de c1.mpa:mp2+en");
  DVDREMOVEAUTHORDIR=1;
  DVDSIZE=4472;
  CDSIZE=650;
  strcpy(DVDNORM,"pal");
  strcpy(DVDMAINSILENCEFILE,"/etc/vdr/vdrconvert/etc/silence-1s.mp2");
  strcpy(DVDSUBSILENCEFILE,"/etc/vdr/vdrconvert/etc/silence-1s.mp2");
  strcpy(DVDTEXTPLAYMOVIE,"Film abspielen");
  strcpy(DVDTEXTMENU,"Titelmenü");
  strcpy(DVDMAINMENUEPOSTACTION,"vtsm");
  strcpy(DVDMENUEPOSTACTION,"vtsm");
  strcpy(DVDBUTTONCOLOR,"#A0A0FF");
  strcpy(DVDSUBBUTTONCOLOR,DVDBUTTONCOLOR);
  strcpy(DVDHIBUTTON2COLOR_MENU,"0000ff");
  strcpy(DVDHIBUTTONCOLOR_MENU,"ffffff");
  strcpy(DVDHIBUTTONCOLOR_SUBMENU,DVDHIBUTTONCOLOR_MENU);
  strcpy(DVDHIBUTTON2COLOR_SUBMENU,DVDHIBUTTON2COLOR_MENU);
  strcpy(DVDFILE_MAINBACKGROUND_COLOR,"#000000");
  strcpy(DVDFILE_SUBBACKGROUND_COLOR,DVDFILE_MAINBACKGROUND_COLOR);
  strcpy(DVDFILE_MAINBACKGROUND_COLOR,"#000000");
  strcpy(DVDFILE_SUBBACKGROUND_COLOR,DVDFILE_MAINBACKGROUND_COLOR);
  strcpy(DVDTEXTCOLOR_MENU,"#A0A0A0");
  strcpy(DVDTEXTCOLOR_SUBMENU,DVDTEXTCOLOR_MENU);
  DVDMENU_SHADOW=1;
  strcpy(DVDMAINCOLSFG,"#00000000");
  strcpy(DVDMAINCOLSBG,"000000ff");
  strcpy(DVDSUBCOLSFG,DVDMAINCOLSFG);
  strcpy(DVDSUBCOLSBG,DVDMAINCOLSBG);
  DVDMAINMENUETIMEOUT=20;
  DVDMENUETIMEOUT=30;
  strcpy(DVDMAINBACKFILE,"");
  strcpy(DVDSUBBACKFILE,"");

  //MP3-Variablen
  strcpy(MP3_DESTDIR,"mp3");
  strcpy(MP3_OPTS,"-b 192 -h --resample 44100");
  MP3_SPLIT=0;
  strcpy(MPLAYERMP3SOURCE,"");
  strcpy(MP3_TITLEDATE,"CONV_TITLEDATE");
  MP3_USE_MPG123=0;
  strcpy(MP3USESTREAMS,"apid1 apid2");



}

bool cVdrconvertSetup::SetupParse(const char *Name, const char *Value)
{
  // Parse your own setup parameters and store their values.
  if (!strcasecmp(Name, "VerzeichnisListendateien"))  strn0cpy(VerzeichnisListendateien, Value, MaxFileName);
  //Allgemeines
  else if (!strcasecmp(Name, "VDRROOT"))  strn0cpy(VDRROOT, Value, MaxFileName);
  else if (!strcasecmp(Name, "DESTDIR"))  strn0cpy(DESTDIR, Value, MaxFileName);
  else if (!strcasecmp(Name, "CONVERT_JOBS"))  strn0cpy(CONVERT_JOBS, Value, MaxFileName);
  else if (!strcasecmp(Name, "VDRSYNC"))  strn0cpy(VDRSYNC, Value, MaxFileName);
  else if (!strcasecmp(Name, "TCMPLEX"))  strn0cpy(TCMPLEX, Value, MaxFileName);
  else if (!strcasecmp(Name, "TCMPLEX_PANTELTJE"))  strn0cpy(TCMPLEX_PANTELTJE, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVBMPLEX"))  strn0cpy(DVBMPLEX, Value, MaxFileName);
  else if (!strcasecmp(Name, "MPLEX"))  strn0cpy(MPLEX, Value, MaxFileName);
  else if (!strcasecmp(Name, "MKISOFS"))  strn0cpy(MKISOFS, Value, MaxFileName);
  else if (!strcasecmp(Name, "MENCODER"))  strn0cpy(MENCODER, Value, MaxFileName);
  else if (!strcasecmp(Name, "LAME"))  strn0cpy(LAME, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDAUTHOR"))  strn0cpy(DVDAUTHOR, Value, MaxFileName);
  else if (!strcasecmp(Name, "TOSVCD"))  strn0cpy(TOSVCD, Value, MaxFileName);
  else if (!strcasecmp(Name, "TEMPDIR"))  strn0cpy(TEMPDIR, Value, MaxFileName);
  else if (!strcasecmp(Name, "LOGDIR"))  strn0cpy(LOGDIR, Value, MaxFileName);
  else if (!strcasecmp(Name, "SVDRPSEND"))  strn0cpy(SVDRPSEND, Value, MaxFileName);
  else if (!strcasecmp(Name, "PARQ"))  strn0cpy(PARQ, Value, MaxFileName);
  else if (!strcasecmp(Name, "COMPRESS"))  strn0cpy(COMPRESS, Value, MaxFileName);
  else if (!strcasecmp(Name, "DEBUG")) DEBUG=atoi(Value);
  else if (!strcasecmp(Name, "PRIO"))  PRIO=atoi(Value);
  else if (!strcasecmp(Name, "SLEEP_TIME"))  SLEEP_TIME=atoi(Value);
  else if (!strcasecmp(Name, "CONV_TITLEDATE"))  CONV_TITLEDATE=atoi(Value);
  else if (!strcasecmp(Name, "OSDMONITOR"))  OSDMONITOR=atoi(Value);
  else if (!strcasecmp(Name, "VCOQUEDIR"))  strn0cpy(VCOQUEDIR, Value, MaxFileName);
  else if (!strcasecmp(Name, "XVFB"))  strn0cpy(XVFB, Value, MaxFileName);
  else if (!strcasecmp(Name, "JAVA"))  strn0cpy(JAVA, Value, MaxFileName);
  else if (!strcasecmp(Name, "DEMUXER"))  strn0cpy(DEMUXER, Value, MaxFileName);
  //DVD-Parameter
  else if (!strcasecmp(Name, "DVD_DESTDIR"))  strn0cpy(DVD_DESTDIR, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDTCMPLEXOPTS"))  strn0cpy(DVDTCMPLEXOPTS, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVD_DVBMPLEXOPTS"))  strn0cpy(DVD_DVBMPLEXOPTS, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDALLOWEDWIDTH"))  strn0cpy(DVDALLOWEDWIDTH, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDTRANSCODEOPTS"))  strn0cpy(DVDTRANSCODEOPTS, Value, MaxFileName);
  else if (!strcasecmp(Name, "PPMTOY4M_OPTIONS"))  strn0cpy(PPMTOY4M_OPTIONS, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDTRANSCODEBITRATE"))  strn0cpy(DVDTRANSCODEBITRATE, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDAUTHORUSERCHAP"))  strn0cpy(DVDAUTHORUSERCHAP, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDUSESTREAMS"))  strn0cpy(DVDUSESTREAMS, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDREMOVEAUTHORDIR"))  DVDREMOVEAUTHORDIR=atoi(Value);
  else if (!strcasecmp(Name, "DVDSIZE"))  DVDSIZE=atoi(Value);
  else if (!strcasecmp(Name, "CDSIZE"))  CDSIZE=atoi(Value);
  else if (!strcasecmp(Name, "DVDNORM"))  strn0cpy(DVDNORM, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDMAINSILENCEFILE"))  strn0cpy(DVDMAINSILENCEFILE, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDSUBSILENCEFILE"))  strn0cpy(DVDSUBSILENCEFILE, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDTEXTPLAYMOVIE"))  strn0cpy(DVDTEXTPLAYMOVIE, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDTEXTMENU"))  strn0cpy(DVDTEXTMENU, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDMAINMENUEPOSTACTION"))  strn0cpy(DVDMAINMENUEPOSTACTION, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDMENUEPOSTACTION"))  strn0cpy(DVDMENUEPOSTACTION, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDBUTTONCOLOR"))  strn0cpy(DVDBUTTONCOLOR, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDSUBBUTTONCOLOR"))  strn0cpy(DVDSUBBUTTONCOLOR, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDHIBUTTON2COLOR_MENU"))  strn0cpy(DVDHIBUTTON2COLOR_MENU, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDHIBUTTONCOLOR_MENU"))  strn0cpy(DVDHIBUTTONCOLOR_MENU, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDHIBUTTONCOLOR_SUBMENU"))  strn0cpy(DVDHIBUTTONCOLOR_SUBMENU, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDHIBUTTON2COLOR_SUBMENU"))  strn0cpy(DVDHIBUTTON2COLOR_SUBMENU, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDFILE_MAINBACKGROUND_COLOR"))  strn0cpy(DVDFILE_MAINBACKGROUND_COLOR, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDFILE_SUBBACKGROUND_COLOR"))  strn0cpy(DVDFILE_SUBBACKGROUND_COLOR, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDTEXTCOLOR_MENU"))  strn0cpy(DVDTEXTCOLOR_MENU, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDTEXTCOLOR_SUBMENU"))  strn0cpy(DVDTEXTCOLOR_SUBMENU, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDMENU_SHADOW"))  DVDMENU_SHADOW=atoi(Value);
  else if (!strcasecmp(Name, "DVDMAINCOLSFG"))  strn0cpy(DVDMAINCOLSFG, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDMAINCOLSBG"))  strn0cpy(DVDMAINCOLSBG, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDSUBCOLSFG"))  strn0cpy(DVDSUBCOLSFG, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDSUBCOLSBG"))  strn0cpy(DVDSUBCOLSBG, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDMAINMENUETIMEOUT"))  DVDMAINMENUETIMEOUT=atoi(Value);
  else if (!strcasecmp(Name, "DVDMENUETIMEOUT"))  DVDMENUETIMEOUT=atoi(Value);
  else if (!strcasecmp(Name, "DVDMAINBACKFILE"))  strn0cpy(DVDMAINBACKFILE, Value, MaxFileName);
  else if (!strcasecmp(Name, "DVDSUBBACKFILE"))  strn0cpy(DVDSUBBACKFILE, Value, MaxFileName);
  //MP3-Variablen
  else if (!strcasecmp(Name, "MP3_DESTDIR")) strn0cpy(MP3_DESTDIR ,Value, MaxFileName);
  else if (!strcasecmp(Name, "MP3_OPTS")) strn0cpy(MP3_OPTS ,Value, MaxFileName);
  else if (!strcasecmp(Name, "MP3_SPLIT")) MP3_SPLIT=atoi(Value);
  else if (!strcasecmp(Name, "MPLAYERMP3SOURCE")) strn0cpy(MPLAYERMP3SOURCE ,Value, MaxFileName);
  else if (!strcasecmp(Name, "MP3_TITLEDATE")) strn0cpy(MP3_TITLEDATE ,Value, MaxFileName);
  else if (!strcasecmp(Name, "MP3_USE_MPG123")) MP3_USE_MPG123=atoi(Value);
  else if (!strcasecmp(Name, "MP3USESTREAMS")) strn0cpy(MP3USESTREAMS ,Value, MaxFileName);

  else
    return false;
  return true;
}

char* cVdrconvertSetup::gibDateiname(int myProjekttyp)
{
  if (myProjekttyp==1){
    return "/tmp/vdrconvert.dvd";
  }else{
    return "/tmp/vdrconvert.unbekannt";
  }
}

// --- cMenuSetupVdrconvert --------------------------------------------------

cMenuSetupVdrconvert::cMenuSetupVdrconvert(void)
{
  data = VdrconvertSetup;
  SetSection(tr("Vdrconvert"));

  //anzeige-Parameter
  anzeigeBereich=0;

  anzeigen();
}

void cMenuSetupVdrconvert::anzeigen(){
  Clear();
  
  Add(new cMenuEditStraItem( tr("area"),
			    &anzeigeBereich,
			    4,
			    data.anzeigeBereichTexte
			    ));
  
  if (anzeigeBereich==0){

    Add(new cMenuEditStrItem( tr("VerzeichnisListendateien"),
        data.VerzeichnisListendateien,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
  //Allgemeines
  Add(new cMenuEditStrItem( tr("VDRROOT"),
	data.VDRROOT,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("DESTDIR"),
	data.DESTDIR,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("CONVERT_JOBS"),
	data.CONVERT_JOBS,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("VDRSYNC"),
	data.VDRSYNC,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("TCMPLEX"),
	data.TCMPLEX,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("TCMPLEX_PANTELTJE"),
	data.TCMPLEX_PANTELTJE,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("DVBMPLEX"),
	data.DVBMPLEX,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("MPLEX"),
	data.MPLEX,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("MKISOFS"),
	data.MKISOFS,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("MENCODER"),
	data.MENCODER,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("LAME"),
	data.LAME,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("DVDAUTHOR"),
	data.DVDAUTHOR,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("TOSVCD"),
	data.TOSVCD,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("LOGDIR"),
	data.LOGDIR,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("SVDRPSEND"),
	data.SVDRPSEND,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("PARQ"),
	data.PARQ,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("COMPRESS"),
	data.COMPRESS,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("VCOQUEDIR"),
	data.VCOQUEDIR,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("XVFB"),
	data.XVFB,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("DEMUXER"),
	data.DEMUXER,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditStrItem( tr("JAVA"),
	data.JAVA,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));
    Add(new cMenuEditIntItem( tr("PRIO"),
        &data.PRIO,
	-15,
        15
      ));
    Add(new cMenuEditIntItem( tr("SLEEP_TIME"),
        &data.SLEEP_TIME,
	1,
        60
      ));
    Add(new cMenuEditIntItem( tr("CONV_TITLEDATE"),
        &data.CONV_TITLEDATE,
	0,
        60
      ));
  Add(new cMenuEditBoolItem( tr("OSDMONITOR"),
        &data.OSDMONITOR
      ));
  Add(new cMenuEditBoolItem( tr("DEBUG"),
        &data.DEBUG
      ));

  }else if(anzeigeBereich==1){
  //DVD-Parameter
      Add(new cMenuEditStrItem( tr("DVD_DESTDIR"),
	data.DVD_DESTDIR,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDTCMPLEXOPTS"),
	data.DVDTCMPLEXOPTS,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVD_DVBMPLEXOPTS"),
	data.DVD_DVBMPLEXOPTS,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDALLOWEDWIDTH"),
	data.DVDALLOWEDWIDTH,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDTRANSCODEOPTS"),
	data.DVDTRANSCODEOPTS,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("PPMTOY4M_OPTIONS"),
	data.PPMTOY4M_OPTIONS,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDTRANSCODEBITRATE"),
	data.DVDTRANSCODEBITRATE,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDAUTHORUSERCHAP"),
	data.DVDAUTHORUSERCHAP,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDMAINBACKFILE"),
	data.DVDMAINBACKFILE,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDSUBBACKFILE"),
	data.DVDSUBBACKFILE,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDUSESTREAMS"),
	data.DVDUSESTREAMS,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditBoolItem( tr("DVDREMOVEAUTHORDIR"),
	&data.DVDREMOVEAUTHORDIR
      ));

      Add(new cMenuEditIntItem( tr("DVDSIZE"),
	&data.DVDSIZE,
	0,
        5000
      ));

      Add(new cMenuEditIntItem( tr("CDSIZE"),
	&data.CDSIZE,
	0,
        900
      ));

      Add(new cMenuEditStrItem( tr("DVDNORM"),
	data.DVDNORM,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDMAINSILENCEFILE"),
	data.DVDMAINSILENCEFILE,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDSUBSILENCEFILE"),
	data.DVDSUBSILENCEFILE,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDTEXTPLAYMOVIE"),
	data.DVDTEXTPLAYMOVIE,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDTEXTMENU"),
	data.DVDTEXTMENU,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDMAINMENUEPOSTACTION"),
	data.DVDMAINMENUEPOSTACTION,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDMENUEPOSTACTION"),
	data.DVDMENUEPOSTACTION,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDBUTTONCOLOR"),
	data.DVDBUTTONCOLOR,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDSUBBUTTONCOLOR"),
	data.DVDSUBBUTTONCOLOR,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDHIBUTTON2COLOR_MENU"),
	data.DVDHIBUTTON2COLOR_MENU,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDHIBUTTONCOLOR_MENU"),
	data.DVDHIBUTTONCOLOR_MENU,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDHIBUTTONCOLOR_SUBMENU"),
	data.DVDHIBUTTONCOLOR_SUBMENU,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDHIBUTTON2COLOR_SUBMENU"),
	data.DVDHIBUTTON2COLOR_SUBMENU,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDFILE_MAINBACKGROUND_COLOR"),
	data.DVDFILE_MAINBACKGROUND_COLOR,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDFILE_SUBBACKGROUND_COLOR"),
	data.DVDFILE_SUBBACKGROUND_COLOR,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDTEXTCOLOR_MENU"),
	data.DVDTEXTCOLOR_MENU,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDTEXTCOLOR_SUBMENU"),
	data.DVDTEXTCOLOR_SUBMENU,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditIntItem( tr("DVDMENU_SHADOW"),
	&data.DVDMENU_SHADOW,
	0,
        60
      ));

      Add(new cMenuEditStrItem( tr("DVDMAINCOLSFG"),
	data.DVDMAINCOLSFG,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDMAINCOLSBG"),
	data.DVDMAINCOLSBG,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDSUBCOLSFG"),
	data.DVDSUBCOLSFG,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("DVDSUBCOLSBG"),
	data.DVDSUBCOLSBG,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditIntItem( tr("DVDMAINMENUETIMEOUT"),
	&data.DVDMAINMENUETIMEOUT,
	0,
        60
      ));

      Add(new cMenuEditIntItem( tr("DVDMENUETIMEOUT"),
	&data.DVDMENUETIMEOUT,
	0,
        60
      ));
  }else if(anzeigeBereich==3){
  //MP3-Parameter
      Add(new cMenuEditStrItem( tr("MP3_DESTDIR"),
	data.MP3_DESTDIR,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("MP3_OPTS"),
	data.MP3_OPTS,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditBoolItem( tr("MP3_SPLIT"),
        &data.MP3_SPLIT
      ));

      Add(new cMenuEditStrItem( tr("MPLAYERMP3SOURCE"),
	data.MPLAYERMP3SOURCE,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("MP3_TITLEDATE"),
	data.MP3_TITLEDATE,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

      Add(new cMenuEditStrItem( tr("MP3USESTREAMS"),
	data.MP3USESTREAMS,
        MaxFileName,
        tr("abcdefghijklmnopqrstuvwxyz0123456789 -./#")
      ));

  }//if-anzeigeBereich

  Display();
}

void cMenuSetupVdrconvert::Store(void)
{
  VdrconvertSetup = data;
  SetupStore( "VerzeichnisListendateien", data.VerzeichnisListendateien);

  //Allgemeines
  SetupStore( "VDRROOT",data.VDRROOT);
  SetupStore( "DESTDIR",data.DESTDIR);
  SetupStore( "CONVERT_JOBS",data.CONVERT_JOBS);
  SetupStore( "VDRSYNC",data.VDRSYNC);
  SetupStore( "TCMPLEX",data.TCMPLEX);
  SetupStore( "TCMPLEX_PANTELTJE",data.TCMPLEX_PANTELTJE);
  SetupStore( "DVBMPLEX",data.DVBMPLEX);
  SetupStore( "MPLEX",data.MPLEX);
  SetupStore( "MKISOFS",data.MKISOFS);
  SetupStore( "MENCODER",data.MENCODER);
  SetupStore( "LAME",data.LAME);
  SetupStore( "DVDAUTHOR",data.DVDAUTHOR);
  SetupStore( "TOSVCD",data.TOSVCD);
  SetupStore( "TEMPDIR",data.TEMPDIR);
  SetupStore( "LOGDIR",data.LOGDIR);
  SetupStore( "SVDRPSEND",data.SVDRPSEND);
  SetupStore( "PARQ",data.PARQ);
  SetupStore( "COMPRESS",data.COMPRESS);
  SetupStore( "DEBUG",data.DEBUG);
  SetupStore( "PRIO",data.PRIO);
  SetupStore( "SLEEP_TIME",data.SLEEP_TIME);
  SetupStore( "CONV_TITLEDATE",data.CONV_TITLEDATE);
  SetupStore( "VCOQUEDIR",data.VCOQUEDIR);
  SetupStore( "OSDMONITOR",data.OSDMONITOR);
  SetupStore( "XVFB",data.XVFB);
  SetupStore( "JAVA",data.JAVA);
  SetupStore( "DEMUXER",data.DEMUXER);


  //DVD-Variablen
  SetupStore( "DVD_DESTDIR",data.DVD_DESTDIR );
  SetupStore( "DVDTCMPLEXOPTS",data.DVDTCMPLEXOPTS );
  SetupStore( "DVD_DVBMPLEXOPTS",data.DVD_DVBMPLEXOPTS);
  SetupStore( "DVDALLOWEDWIDTH",data.DVDALLOWEDWIDTH );
  SetupStore( "DVDTRANSCODEOPTS",data.DVDTRANSCODEOPTS );
  SetupStore( "PPMTOY4M_OPTIONS",data.PPMTOY4M_OPTIONS );
  SetupStore( "DVDTRANSCODEBITRATE",data.DVDTRANSCODEBITRATE );
  SetupStore( "DVDAUTHORUSERCHAP",data.DVDAUTHORUSERCHAP );
  SetupStore( "DVDUSESTREAMS",data.DVDUSESTREAMS );
  SetupStore( "DVDREMOVEAUTHORDIR",data.DVDREMOVEAUTHORDIR );
  SetupStore( "DVDSIZE",data.DVDSIZE );
  SetupStore( "CDSIZE",data.CDSIZE );
  SetupStore( "DVDNORM",data.DVDNORM );
  SetupStore( "DVDMAINSILENCEFILE",data.DVDMAINSILENCEFILE );
  SetupStore( "DVDSUBSILENCEFILE",data.DVDSUBSILENCEFILE );
  SetupStore( "DVDTEXTPLAYMOVIE",data.DVDTEXTPLAYMOVIE );
  SetupStore( "DVDTEXTMENU",data.DVDTEXTMENU );
  SetupStore( "DVDMAINMENUEPOSTACTION",data.DVDMAINMENUEPOSTACTION );
  SetupStore( "DVDMENUEPOSTACTION",data.DVDMENUEPOSTACTION );
  SetupStore( "DVDBUTTONCOLOR",data.DVDBUTTONCOLOR );
  SetupStore( "DVDSUBBUTTONCOLOR",data.DVDSUBBUTTONCOLOR );
  SetupStore( "DVDHIBUTTON2COLOR_MENU",data.DVDHIBUTTON2COLOR_MENU );
  SetupStore( "DVDHIBUTTONCOLOR_MENU",data.DVDHIBUTTONCOLOR_MENU );
  SetupStore( "DVDHIBUTTONCOLOR_SUBMENU",data.DVDHIBUTTONCOLOR_SUBMENU );
  SetupStore( "DVDHIBUTTON2COLOR_SUBMENU",data.DVDHIBUTTON2COLOR_SUBMENU );
  SetupStore( "DVDFILE_MAINBACKGROUND_COLOR",data.DVDFILE_MAINBACKGROUND_COLOR );
  SetupStore( "DVDFILE_SUBBACKGROUND_COLOR",data.DVDFILE_SUBBACKGROUND_COLOR );
  SetupStore( "DVDTEXTCOLOR_MENU",data.DVDTEXTCOLOR_MENU );
  SetupStore( "DVDTEXTCOLOR_SUBMENU",data.DVDTEXTCOLOR_SUBMENU );
  SetupStore( "DVDMENU_SHADOW",data.DVDMENU_SHADOW );
  SetupStore( "DVDMAINCOLSFG",data.DVDMAINCOLSFG );
  SetupStore( "DVDMAINCOLSBG",data.DVDMAINCOLSBG );
  SetupStore( "DVDSUBCOLSFG",data.DVDSUBCOLSFG );
  SetupStore( "DVDSUBCOLSBG",data.DVDSUBCOLSBG );
  SetupStore( "DVDMAINMENUETIMEOUT",data.DVDMAINMENUETIMEOUT );
  SetupStore( "DVDMENUETIMEOUT",data.DVDMENUETIMEOUT );
  SetupStore( "DVDMAINBACKFILE",data.DVDMAINBACKFILE );
  SetupStore( "DVDSUBBACKFILE",data.DVDSUBBACKFILE );

  //MP3-Daten
  SetupStore( "MP3_DESTDIR",data.MP3_DESTDIR );
  SetupStore( "MP3_OPTS",data.MP3_OPTS );
  SetupStore( "MP3_SPLIT",data.MP3_SPLIT );
  SetupStore( "MPLAYERMP3SOURCE",data.MPLAYERMP3SOURCE );
  SetupStore( "MP3_TITLEDATE",data.MP3_TITLEDATE );
  SetupStore( "MP3_USE_MPG123",data.MP3_USE_MPG123 );
  SetupStore( "MP3USESTREAMS",data.MP3USESTREAMS );
}


eOSState cMenuSetupVdrconvert::ProcessKey(eKeys Key){

  int anzeigeBereich_old = anzeigeBereich;
  eOSState state = cOsdMenu::ProcessKey(Key);
  
  if (state == osUnknown) {
    switch (Key) {
    case kOk:
      Store();
      state=osBack;
    default:
      break;
    }//switch
  }//if

  if (Key != kNone && (anzeigeBereich != anzeigeBereich_old))
    anzeigen();
  //  if (Key != kNone)

  return state;
}


