/*
 * mousemate plugin for VDR
 *
 * setup.h - settings and setup menu
 *
 *
 * This code is distributed under the terms and conditions of the
 * GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
 */

#ifndef _SETUP_H_
#define _SETUP_H_

#include <vdr/plugin.h>
#include "i18n.h"

const int kEvents = 20;
const int kEventTurnLeft           = 0;
const int kEventTurnRight          = 1;
const int kEventPushedTurnLeft     = 2;
const int kEventPushedTurnRight    = 3;
const int kEventLeftClick          = 4;
const int kEventLeftDoubleClick    = 5;
const int kEventMiddleClick        = 6;
const int kEventMiddleDoubleClick  = 7;
const int kEventRightClick         = 8;
const int kEventRightDoubleClick   = 9;
const int kEventSideClick          = 10;
const int kEventSideDoubleClick    = 11;
const int kEventExtraClick         = 12;
const int kEventExtraDoubleClick   = 13;
const int kEventForwardClick       = 14;
const int kEventForwardDoubleClick = 15;
const int kEventBackClick          = 16;
const int kEventBackDoubleClick    = 17;
const int kEventTaskClick          = 18;
const int kEventTaskDoubleClick    = 19;

const int kContexts = 14;
const int kContextNormal = 0;
const int kContextMenu = 1;
const int kContextReplay = 2;
const int kContextReplayDVD = 3;
const int kContextReplayMP3 = 4;
const int kContextReplayCDDA = 5;
const int kContextReplayIMAGE = 6;
const int kContextNormalAlt = 7;
const int kContextMenuAlt = 8;
const int kContextReplayAlt = 9;
const int kContextReplayDVDAlt = 10;
const int kContextReplayMP3Alt = 11;
const int kContextReplayCDDAAlt = 12;
const int kContextReplayIMAGEAlt = 13;

class cMouseMateSetup
{
    public:
        char device[256];                         // device for mouse 
        char cdevice[256];                        // device for console
        int sensitivity;
        int doubleClickTime;
        int toggleClickTime;
        int led;                                  // for scroll-lock led
        int autotoggleoff;                        // auto toggle off after toggletime yes no
        int toggleOffTime;

        eKeys keys[kContexts][kEvents];
    public:
        cMouseMateSetup();
        bool Parse(const char *Name, const char *Value);
};

class cMouseMateSetupPage : public cMenuSetupPage
{
    private:
        char * strKeys[100];
        int numKeys;
        int sensitivity;
        int doubleClickTime;
        int toggleClickTime;
        int led;
        int autotoggleoff;                        // auto toggle off after toggletime yes no
        int toggleOffTime;                        // timer after toggle is switched off automatically
        int keys[kContexts][kEvents];
        int setKeys[kEvents];
        int context;
        int contextOld;

        cOsdItem * itemContext;
        cOsdItem * itemToggle;
    protected:
        virtual void Store();
        virtual eOSState ProcessKey(eKeys key);
    public:
        cMouseMateSetupPage();
        virtual ~cMouseMateSetupPage();
};

extern cMouseMateSetup MouseMateSetup;
#endif
