summaryrefslogtreecommitdiff
path: root/MouseMateMonitor.c
blob: 2793230c2f4cb04491ae4c443edb504ddb1e5cff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/*
 * mousemate plugin for VDR
 *
 * MouseMate.c - MouseMate context monitor class
 *
 *
 * This code is distributed under the terms and conditions of the
 * GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
 */

#include "MouseMateMonitor.h"
#include "MouseMate.h"

cMouseMateMonitor:: cMouseMateMonitor(void)
:menu(false),
replay(false),
DVD(false),
MP3(false),
CDDA(false),
IMAGE(false)
{
}


cMouseMateMonitor:: ~cMouseMateMonitor()
{
}


int cMouseMateMonitor::GetContext(const bool toggle)
{
    if (!toggle)
    {
        if (menu)
        {
            #ifdef DEBUG
            dsyslog("mousemate: Context=Menu DVD=%i MP3=%i CDDA=%i IMAGE=%i\n",DVD,MP3,CDDA,IMAGE);
            #endif
            return kContextMenu;
        }
        if (replay)
        {
            #ifdef DEBUG
            dsyslog("mousemate: Context=Replay DVD=%i MP3=%i CDDA=%i IMAGE=%i\n",DVD,MP3,CDDA,IMAGE);
            #endif
            if (DVD && MouseMateSetup.dvdsensitive)
                return kContextReplayDVD;
            if (MP3&& MouseMateSetup.mp3sensitive)
                return kContextReplayMP3;
            if (CDDA&& MouseMateSetup.cddasensitive)
                return kContextReplayCDDA;
            if (IMAGE&& MouseMateSetup.imagesensitive)
                return kContextReplayIMAGE;

            return kContextReplay;
        }
        #ifdef DEBUG
        dsyslog("mousemate: Context=Normal DVD=%i MP3=%i CDDA=%i IMAGE=%i\n",DVD, MP3,CDDA, IMAGE);
        #endif
        return kContextNormal;
    }
    else
    {
        if (menu)
        {
            #ifdef DEBUG
            dsyslog("mousemate: Context=MenuAlt DVD=%i MP3=%i CDDA=%i IMAGE=%i\n",DVD,MP3,CDDA,IMAGE);
            #endif
            return kContextMenuAlt;
        }
        if (replay)
        {
            #ifdef DEBUG
            dsyslog("mousemate: Context=ReplayAlt DVD=%i MP3=%i CDDA=%i IMAGE=%i\n", DVD,MP3,CDDA,IMAGE);
            #endif
            if (DVD && MouseMateSetup.dvdsensitive)
                return kContextReplayDVDAlt;
            if (MP3&& MouseMateSetup.mp3sensitive)
                return kContextReplayMP3Alt;
            if (CDDA&& MouseMateSetup.cddasensitive)
                return kContextReplayCDDAAlt;
            if (IMAGE&& MouseMateSetup.imagesensitive)
                return kContextReplayIMAGEAlt;
            return kContextReplayAlt;
        }
        #ifdef DEBUG
        dsyslog("mousemate: Context=NormalAlt DVD=%i MP3=%i CDDA=%i IMAGE=%i\n",DVD, MP3,CDDA, IMAGE);
        #endif
        return kContextNormalAlt;
    }

}


void cMouseMateMonitor::Replaying(const cControl *Control, const char *Name, const char *FileName, bool On)
{
    if (On)
    {
        replay=true;
        if (!strcmp(Name,"DVD"))
            DVD=true;
        if (!strcmp(Name,"MP3"))
            MP3=true;
        if (!strcmp(Name,"cdda"))
            CDDA=true;
        if (!strcmp(Name,"image"))
            IMAGE=true;
    }
    else
    {
        DVD=false;
        MP3=false;
        CDDA=false;
        IMAGE=false;
        replay=false;
    }
    #ifdef DEBUG
    dsyslog("mousemate: %s is %i\n", Name, On);
    dsyslog("mousemate: Replaying DVD %i MP3: %i CDDA: %i IMAGE: %i\n",DVD, MP3,CDDA, IMAGE);
    #endif
}


void cMouseMateMonitor::OsdClear(void)
{
    menu =false;
}


void cMouseMateMonitor::OsdTitle(const char *Title)
{
    menu = true;
}


void cMouseMateMonitor::OsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue)
{
    menu = true;
}


void cMouseMateMonitor::OsdItem(const char *Text, int Index)
{
    menu = true;
}


void cMouseMateMonitor::OsdCurrentItem(const char *Text)
{
    menu = true;
}


void cMouseMateMonitor::OsdTextItem(const char *Text, bool Scroll)
{
    menu = true;
}