#include <string>

#include <vdr/interface.h>
#include <vdr/menu.h>
#include <vdr/status.h>
#include <vdr/plugin.h>

#include "commands.h"
#include "setup-image.h"
#include "control-image.h"

// ------------ cMenuMP3Playlist ---------------------------------------------------------------------------------------------- //



cMenuMP3Playlist::cMenuMP3Playlist(void)
:cOsdMenu(tr("Picselshow: Commands"),4)
{

  Add(new cOsdItem(hk(tr("Rotate 90 degree left"))));
  Add(new cOsdItem(hk(tr("Rotate 90 degree right"))));
  Add(new cOsdItem(hk(tr("Rotate 180 degree"))));
  Add(new cOsdItem(hk(tr("Restore original image"))));
  Add(new cOsdItem(hk(tr("Save changes"))));

  SetHelp();

  Display();
}

void cMenuMP3Playlist::SetHelp() {
  cOsdMenu::SetHelp(tr("Parent"),NULL,NULL,NULL);
}


eOSState cMenuMP3Playlist::SetMusic(void) {

  int ItemIndex = Current();

  if(ItemIndex == 0) {
    ImageSetup.save = false;
    ImageSetup.rotate = 3;
    ImageSetup.oldrotate =3;
    }
  else if(ItemIndex ==1) {
    ImageSetup.save = false;
    ImageSetup.rotate = 1;
    ImageSetup.oldrotate =1;
    }
  
  else if(ItemIndex ==2) {
    ImageSetup.save = false;
    ImageSetup.rotate = 2;
    ImageSetup.oldrotate =2;
    }
      
  else if(ItemIndex ==3) {
    ImageSetup.save = false;
    ImageSetup.rotate = 4;
    ImageSetup.oldrotate = 4;
    }
      
  else if(ItemIndex ==4) {
    ImageSetup.save = true;
    ImageSetup.rotate = ImageSetup.oldrotate;
    }

  return osBack;
  
}


eOSState cMenuMP3Playlist::ProcessKey(eKeys Key)
{
  eOSState state = cOsdMenu::ProcessKey(Key);

  if(state==osUnknown) {
     switch(Key) {
       case kOk:
          state = SetMusic();
	  break;     
       case kBlue:
       case kGreen:
       case kYellow:
       case kRed: return osBack;
       default: return osContinue;;
       }
     }
  return state;
}
