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
158
159
|
var SelectScreen = {
keyToStateMap : []
};
SelectScreen.init = function() {
Main.log("SelectScreen.init");
Main.logToServer("Config.getWidgetVersion= " + Config.widgetVersion) ;
var parent = $("#selectView");
var idx = 0;
$("#selectScreen").show();
this.keyToStateMap[idx] = Main.eMAIN; // State of this view
this.keyToStateMap[++idx] = Main.eLIVE;
parent.append($("<div>", {id : "selectItem"+idx, text:idx+": Live", class : "style_menuItem"}));
this.keyToStateMap[++idx] = Main.eREC;
parent.append($("<div>", {id : "selectItem"+idx, text:idx+": Recordings", class : "style_menuItem"}));
this.keyToStateMap[++idx] = Main.eMED;
parent.append($("<div>", {id : "selectItem"+idx, text:idx+": Media", class : "style_menuItem"}));
this.keyToStateMap[++idx] = Main.eTMR;
parent.append($("<div>", {id : "selectItem"+idx, text:idx+": Timers", class : "style_menuItem"}));
if (Config.haveYouTube) {
this.keyToStateMap[++idx] = Main.eURLS;
parent.append($("<div>", {id : "selectItem"+idx, text:idx+": You Tube", class : "style_menuItem"}));
// Main.selectMenuKeyHndl.selectMax++;
}
this.keyToStateMap[++idx] = Main.eSRVR;
parent.append($("<div>", {id : "selectItem"+idx, text:idx+": Select Server", class : "style_menuItem"}));
this.keyToStateMap[++idx] = Main.eOPT;
parent.append($("<div>", {id : "selectItem"+idx, text:idx+": Options", class : "style_menuItem"}));
/*
var done = false;
var i = 0;
while (done != true) {
i ++;
var elm = document.getElementById("selectItem"+i);
// var elm = $("#selectItem"+i);
if (elm == null) {
done = true;
break;
}
Main.log("found " + i);
elm.style.paddingBottom = "3px";
elm.style.marginTop= " 5px";
elm.style.marginBottom= " 5px";
elm.style.textAlign = "center";
}
*/
Main.selectMenuKeyHndl.selectMax = idx;
Display.selectItem(document.getElementById("selectItem1"));
// Display.jqSelectItem($("#selectItem1"));
Main.log("SelectScreen.init - done");
};
SelectScreen.resetElements = function () {
$('.style_menuItem').remove();
this.keyToStateMap = [];
// Main.selectMenuKeyHndl.selectMax = 5;
Main.selectMenuKeyHndl.select =1;
// Main.selectedVideo = 0;
};
SelectScreen.keyToState = function (key) {
};
//---------------------------------------------------
//Select Menu Key Handler
//---------------------------------------------------
function cSelectMenuKeyHndl (def_hndl) {
this.defaultKeyHandler = def_hndl;
this.handlerName = "SelectMenuKeyHandler";
Main.log(this.handlerName + " created");
this.select = 1;
this.selectMax = 5; // Highest Select Entry
// this.selectMax = 6; // Highest Select Entry
};
cSelectMenuKeyHndl.prototype.handleKeyDown = function (keyCode) {
// var keyCode = event.keyCode;
// Main.log(this.handlerName+": Key pressed: " + Main.getKeyCode(keyCode));
switch(keyCode) {
case tvKey.KEY_1:
Main.log("KEY_1 pressed");
this.select = 1;
Main.changeState (SelectScreen.keyToStateMap[this.select]);
break;
case tvKey.KEY_2:
Main.log("KEY_2 pressed");
this.select = 2;
Main.changeState (SelectScreen.keyToStateMap[this.select]);
break;
case tvKey.KEY_3:
Main.log("KEY_3 pressed");
this.select = 3;
Main.changeState (SelectScreen.keyToStateMap[this.select]);
break;
case tvKey.KEY_4:
Main.log("KEY_4 pressed");
this.select = 4;
Main.changeState (SelectScreen.keyToStateMap[this.select]);
break;
case tvKey.KEY_5:
Main.log("KEY_5 pressed");
this.select = 5;
Main.changeState (SelectScreen.keyToStateMap[this.select]);
break;
case tvKey.KEY_6:
Main.log("KEY_6 pressed");
this.select = 6;
Main.changeState (SelectScreen.keyToStateMap[this.select]);
break;
case tvKey.KEY_ENTER:
case tvKey.KEY_PLAY:
case tvKey.KEY_PANEL_ENTER:
Main.log("ENTER");
Main.log ("CurSelect= " + this.select + " State= " + SelectScreen.keyToStateMap[this.select]);
Main.changeState (SelectScreen.keyToStateMap[this.select]);
break; //thlo: correct?
case tvKey.KEY_DOWN:
Display.unselectItem(document.getElementById("selectItem"+this.select));
if (++this.select > this.selectMax)
this.select = 1;
Display.selectItem(document.getElementById("selectItem"+this.select));
Main.log("DOWN " +this.select);
break;
case tvKey.KEY_UP:
Display.unselectItem(document.getElementById("selectItem"+this.select));
if (--this.select < 1)
this.select = this.selectMax;
Display.selectItem(document.getElementById("selectItem"+this.select));
Main.log("UP "+ this.select);
break;
default:
this.defaultKeyHandler.handleDefKeyDown(keyCode);
break;
}
};
|