1 | #ifndef DISEQCCONFIG_H |
---|
2 | #define DISEQCCONFIG_H |
---|
3 | |
---|
4 | int changeuncommittedcmd(struct skin* cmdorder, char* type) |
---|
5 | { |
---|
6 | if(type == NULL || ostrcmp(type, "0") == 0) |
---|
7 | { |
---|
8 | changeinput(cmdorder, NULL); |
---|
9 | addchoicebox(cmdorder, "0", _("committed, toneburst")); |
---|
10 | addchoicebox(cmdorder, "1", _("toneburst, committed")); |
---|
11 | return 0; |
---|
12 | } |
---|
13 | else |
---|
14 | { |
---|
15 | changeinput(cmdorder, NULL); |
---|
16 | addchoicebox(cmdorder, "0", _("committed, toneburst")); |
---|
17 | addchoicebox(cmdorder, "1", _("toneburst, committed")); |
---|
18 | addchoicebox(cmdorder, "2", _("committed, uncommitted, toneburst")); |
---|
19 | addchoicebox(cmdorder, "3", _("toneburst, committed, uncommitted")); |
---|
20 | addchoicebox(cmdorder, "4", _("uncommitted, committed, toneburst")); |
---|
21 | addchoicebox(cmdorder, "5", _("toneburst, uncommitted, committed")); |
---|
22 | return 1; |
---|
23 | } |
---|
24 | |
---|
25 | } |
---|
26 | |
---|
27 | void changediseqcmode(struct skin* committedcmd, struct skin* cmdorder, struct skin* uncommittedcmd, struct skin* rotorpos, struct skin* diseqcrepeat, char *type) |
---|
28 | { |
---|
29 | committedcmd->hidden = YES; |
---|
30 | cmdorder->hidden = YES; |
---|
31 | uncommittedcmd->hidden = YES; |
---|
32 | rotorpos->hidden = YES; |
---|
33 | diseqcrepeat->hidden = YES; |
---|
34 | |
---|
35 | if(type == NULL || ostrcmp(type, "0") == 0 || ostrcmp(type, "1") == 0 || ostrcmp(type, "2") == 0 || ostrcmp(type, "3") == 0) |
---|
36 | { |
---|
37 | committedcmd->hidden = NO; |
---|
38 | cmdorder->hidden = NO; |
---|
39 | diseqcrepeat->hidden = NO; |
---|
40 | |
---|
41 | if(ostrcmp(type, "1") == 0 || ostrcmp(type, "2") == 0) |
---|
42 | uncommittedcmd->hidden = NO; |
---|
43 | if(ostrcmp(type, "2") == 0) |
---|
44 | rotorpos->hidden = NO; |
---|
45 | } |
---|
46 | } |
---|
47 | |
---|
48 | void changediseqc(struct skin* diseqcmode, struct skin* toneburst, struct skin* committedcmd, struct skin* cmdorder, struct skin* uncommittedcmd, struct skin* diseqcrepeat, struct skin* rotorpos, char* feshortname, char *diseqcnr) |
---|
49 | { |
---|
50 | char* tmpstr = NULL, *tmpnr = NULL; |
---|
51 | int i = 0; |
---|
52 | |
---|
53 | tmpstr = ostrcat(feshortname, "_diseqc_mode", 0, 0); |
---|
54 | tmpstr = ostrcat(tmpstr, diseqcnr, 1, 0); |
---|
55 | changename(diseqcmode, tmpstr); |
---|
56 | setchoiceboxselection(diseqcmode, getconfig(tmpstr, NULL)); |
---|
57 | changeuncommittedcmd(cmdorder, getconfig(tmpstr, NULL)); |
---|
58 | free(tmpstr); |
---|
59 | |
---|
60 | tmpstr = ostrcat(feshortname, "_diseqc_toneburst", 0, 0); |
---|
61 | tmpstr = ostrcat(tmpstr, diseqcnr, 1, 0); |
---|
62 | changename(toneburst, tmpstr); |
---|
63 | setchoiceboxselection(toneburst, getconfig(tmpstr, NULL)); |
---|
64 | free(tmpstr); |
---|
65 | |
---|
66 | tmpstr = ostrcat(feshortname, "_diseqc_committedcmd", 0, 0); |
---|
67 | tmpstr = ostrcat(tmpstr, diseqcnr, 1, 0); |
---|
68 | changename(committedcmd, tmpstr); |
---|
69 | setchoiceboxselection(committedcmd, getconfig(tmpstr, NULL)); |
---|
70 | free(tmpstr); |
---|
71 | |
---|
72 | tmpstr = ostrcat(feshortname, "_diseqc_cmdorder", 0, 0); |
---|
73 | tmpstr = ostrcat(tmpstr, diseqcnr, 1, 0); |
---|
74 | changename(cmdorder, tmpstr); |
---|
75 | setchoiceboxselection(cmdorder, getconfig(tmpstr, NULL)); |
---|
76 | free(tmpstr); |
---|
77 | |
---|
78 | tmpstr = ostrcat(feshortname, "_diseqc_uncommittedcmd", 0, 0); |
---|
79 | tmpstr = ostrcat(tmpstr, diseqcnr, 1, 0); |
---|
80 | changename(uncommittedcmd, tmpstr); |
---|
81 | setchoiceboxselection(uncommittedcmd, getconfig(tmpstr, NULL)); |
---|
82 | free(tmpstr); |
---|
83 | |
---|
84 | tmpstr = ostrcat(feshortname, "_diseqc_repeate", 0, 0); |
---|
85 | tmpstr = ostrcat(tmpstr, diseqcnr, 1, 0); |
---|
86 | changename(diseqcrepeat, tmpstr); |
---|
87 | setchoiceboxselection(diseqcrepeat, getconfig(tmpstr, NULL)); |
---|
88 | free(tmpstr); |
---|
89 | |
---|
90 | tmpstr = ostrcat(feshortname, "_diseqc_rotorpos", 0, 0); |
---|
91 | tmpstr = ostrcat(tmpstr, diseqcnr, 1, 0); |
---|
92 | changename(rotorpos, tmpstr); |
---|
93 | for(i = 1; i < 255; i++) |
---|
94 | { |
---|
95 | tmpnr = oitoa(i); |
---|
96 | addchoicebox(rotorpos, tmpnr, tmpnr); |
---|
97 | free(tmpnr); tmpnr = NULL; |
---|
98 | } |
---|
99 | setchoiceboxselection(rotorpos, getconfig(tmpstr, NULL)); |
---|
100 | free(tmpstr); |
---|
101 | } |
---|
102 | |
---|
103 | void screendiseqc(char* feshortname, char* diseqcnr) |
---|
104 | { |
---|
105 | int rcret = 0; |
---|
106 | struct skin* diseqcscreen = getscreen("diseqcscreen"); |
---|
107 | struct skin* listbox = getscreennode(diseqcscreen, "listbox"); |
---|
108 | struct skin* diseqcmode = getscreennode(diseqcscreen, "diseqcmode"); |
---|
109 | struct skin* toneburst = getscreennode(diseqcscreen, "toneburst"); |
---|
110 | struct skin* committedcmd = getscreennode(diseqcscreen, "committedcmd"); |
---|
111 | struct skin* cmdorder = getscreennode(diseqcscreen, "cmdorder"); |
---|
112 | |
---|
113 | struct skin* uncommittedcmd = getscreennode(diseqcscreen, "uncommittedcmd"); |
---|
114 | struct skin* diseqcrepeat = getscreennode(diseqcscreen, "diseqcrepeat"); |
---|
115 | struct skin* rotorpos = getscreennode(diseqcscreen, "rotorpos"); |
---|
116 | struct skin* tmp = NULL; |
---|
117 | char* tmpstr = NULL; |
---|
118 | |
---|
119 | listbox->aktline = 1; |
---|
120 | listbox->aktpage = 1; |
---|
121 | |
---|
122 | if(diseqcnr != NULL) |
---|
123 | diseqcnr = oitoa((int)diseqcnr); |
---|
124 | else |
---|
125 | return; |
---|
126 | |
---|
127 | changeinput(diseqcmode, NULL); |
---|
128 | addchoicebox(diseqcmode, "0", _("DiSEqC 1.0")); |
---|
129 | addchoicebox(diseqcmode, "1", _("DiSEqC 1.1")); |
---|
130 | addchoicebox(diseqcmode, "2", _("DiSEqC 1.2")); |
---|
131 | addchoicebox(diseqcmode, "3", _("DiSEqC 1.3 (USALS)")); |
---|
132 | addchoicebox(diseqcmode, "100", _("Tonburst A/B")); |
---|
133 | |
---|
134 | changeinput(toneburst, NULL); |
---|
135 | addchoicebox(toneburst, "0", _("none")); |
---|
136 | addchoicebox(toneburst, "1", _("A")); |
---|
137 | addchoicebox(toneburst, "2", _("B")); |
---|
138 | |
---|
139 | changeinput(committedcmd, NULL); |
---|
140 | addchoicebox(committedcmd, "0", _("none")); |
---|
141 | addchoicebox(committedcmd, "1", _("Input 1")); |
---|
142 | addchoicebox(committedcmd, "2", _("Input 2")); |
---|
143 | addchoicebox(committedcmd, "3", _("Input 3")); |
---|
144 | addchoicebox(committedcmd, "4", _("Input 4")); |
---|
145 | addchoicebox(committedcmd, "5", _("Input 5")); |
---|
146 | addchoicebox(committedcmd, "6", _("Input 6")); |
---|
147 | addchoicebox(committedcmd, "7", _("Input 7")); |
---|
148 | addchoicebox(committedcmd, "8", _("Input 8")); |
---|
149 | addchoicebox(committedcmd, "9", _("Input 9")); |
---|
150 | addchoicebox(committedcmd, "10", _("Input 10")); |
---|
151 | addchoicebox(committedcmd, "11", _("Input 11")); |
---|
152 | addchoicebox(committedcmd, "12", _("Input 12")); |
---|
153 | addchoicebox(committedcmd, "13", _("Input 13")); |
---|
154 | addchoicebox(committedcmd, "14", _("Input 14")); |
---|
155 | addchoicebox(committedcmd, "15", _("Input 15")); |
---|
156 | addchoicebox(committedcmd, "16", _("Input 16")); |
---|
157 | |
---|
158 | changeinput(uncommittedcmd, NULL); |
---|
159 | addchoicebox(uncommittedcmd, "0", _("none")); |
---|
160 | addchoicebox(uncommittedcmd, "1", _("Input 1")); |
---|
161 | addchoicebox(uncommittedcmd, "2", _("Input 2")); |
---|
162 | addchoicebox(uncommittedcmd, "3", _("Input 3")); |
---|
163 | addchoicebox(uncommittedcmd, "4", _("Input 4")); |
---|
164 | addchoicebox(uncommittedcmd, "5", _("Input 5")); |
---|
165 | addchoicebox(uncommittedcmd, "6", _("Input 6")); |
---|
166 | addchoicebox(uncommittedcmd, "7", _("Input 7")); |
---|
167 | addchoicebox(uncommittedcmd, "8", _("Input 8")); |
---|
168 | addchoicebox(uncommittedcmd, "9", _("Input 9")); |
---|
169 | addchoicebox(uncommittedcmd, "10", _("Input 10")); |
---|
170 | addchoicebox(uncommittedcmd, "11", _("Input 11")); |
---|
171 | addchoicebox(uncommittedcmd, "12", _("Input 12")); |
---|
172 | addchoicebox(uncommittedcmd, "13", _("Input 13")); |
---|
173 | addchoicebox(uncommittedcmd, "14", _("Input 14")); |
---|
174 | addchoicebox(uncommittedcmd, "15", _("Input 15")); |
---|
175 | addchoicebox(uncommittedcmd, "16", _("Input 16")); |
---|
176 | |
---|
177 | changeinput(diseqcrepeat, "1\n2\n3\n4\n5\n6"); |
---|
178 | |
---|
179 | changediseqc(diseqcmode, toneburst, committedcmd, cmdorder, uncommittedcmd, diseqcrepeat, rotorpos, feshortname, diseqcnr); |
---|
180 | |
---|
181 | tmpstr = ostrcat(feshortname, "_diseqc_mode", 0, 0); |
---|
182 | changediseqcmode(committedcmd, cmdorder, uncommittedcmd, rotorpos, diseqcrepeat, getconfig(tmpstr, diseqcnr)); |
---|
183 | free(tmpstr); tmpstr = NULL; |
---|
184 | free(diseqcnr); diseqcnr = NULL; |
---|
185 | |
---|
186 | drawscreen(diseqcscreen, 0); |
---|
187 | addscreenrc(diseqcscreen, listbox); |
---|
188 | |
---|
189 | tmp = listbox->select; |
---|
190 | while(1) |
---|
191 | { |
---|
192 | addscreenrc(diseqcscreen, tmp); |
---|
193 | status.screencalc = 2; |
---|
194 | rcret = waitrc(diseqcscreen, 0, 0); |
---|
195 | tmp = listbox->select; |
---|
196 | |
---|
197 | if(listbox->select != NULL && listbox->select->name != NULL && strstr(listbox->select->name, "diseqc_mode") != NULL && (rcret == getrcconfigint("rcleft", NULL) || rcret == getrcconfigint("rcright", NULL))) |
---|
198 | { |
---|
199 | changediseqcmode(committedcmd, cmdorder, uncommittedcmd, rotorpos, diseqcrepeat, diseqcmode->ret); |
---|
200 | changeuncommittedcmd(cmdorder, diseqcmode->ret); |
---|
201 | } |
---|
202 | |
---|
203 | addconfigscreentmpcheck(diseqcmode->name, diseqcmode, "0"); |
---|
204 | addconfigscreentmpcheck(toneburst->name, toneburst, "0"); |
---|
205 | addconfigscreentmpcheck(committedcmd->name, committedcmd, "0"); |
---|
206 | addconfigscreentmpcheck(cmdorder->name, cmdorder, "0"); |
---|
207 | addconfigscreentmpcheck(diseqcrepeat->name, diseqcrepeat, "1"); |
---|
208 | addconfigscreentmpcheck(uncommittedcmd->name, uncommittedcmd, "0"); |
---|
209 | addconfigscreentmpcheck(rotorpos->name, rotorpos, "000"); |
---|
210 | |
---|
211 | status.screencalc = 0; |
---|
212 | drawscreen(diseqcscreen, 0); |
---|
213 | |
---|
214 | if(rcret == getrcconfigint("rcexit", NULL)) break; |
---|
215 | if(rcret == getrcconfigint("rcok", NULL)) |
---|
216 | { |
---|
217 | writeconfigtmp(); |
---|
218 | break; |
---|
219 | } |
---|
220 | } |
---|
221 | |
---|
222 | changename(diseqcmode, "diseqcmode"); |
---|
223 | changename(toneburst, "toneburst"); |
---|
224 | changename(committedcmd, "committedcmd"); |
---|
225 | changename(cmdorder, "cmdorder"); |
---|
226 | changename(uncommittedcmd, "uncommittedcmd"); |
---|
227 | changename(diseqcrepeat, "diseqcrepeat"); |
---|
228 | changename(rotorpos, "rotorpos"); |
---|
229 | |
---|
230 | status.screencalc = 0; |
---|
231 | delconfigtmpall(); |
---|
232 | delownerrc(diseqcscreen); |
---|
233 | clearscreen(diseqcscreen); |
---|
234 | } |
---|
235 | |
---|
236 | void screenownpos() |
---|
237 | { |
---|
238 | int rcret = 0; |
---|
239 | struct skin* ownpos = getscreen("ownpos"); |
---|
240 | struct skin* listbox = getscreennode(ownpos, "listbox"); |
---|
241 | struct skin* latitude = getscreennode(ownpos, "latitude"); |
---|
242 | struct skin* longitude = getscreennode(ownpos, "longitude"); |
---|
243 | struct skin* latpos = getscreennode(ownpos, "latpos"); |
---|
244 | struct skin* longpos = getscreennode(ownpos, "longpos"); |
---|
245 | struct skin* tmp = NULL; |
---|
246 | |
---|
247 | listbox->aktline = 1; |
---|
248 | listbox->aktpage = 1; |
---|
249 | |
---|
250 | changemask(latitude, "000.000"); |
---|
251 | changeinput(latitude, getconfig("latitude", NULL)); |
---|
252 | |
---|
253 | changemask(longitude, "000.000"); |
---|
254 | changeinput(longitude, getconfig("longitude", NULL)); |
---|
255 | |
---|
256 | changeinput(latpos, NULL); |
---|
257 | addchoicebox(latpos, "0", _("north")); |
---|
258 | addchoicebox(latpos, "1", _("south")); |
---|
259 | setchoiceboxselection(latpos, getconfig("latpos", NULL)); |
---|
260 | |
---|
261 | changeinput(longpos, NULL); |
---|
262 | addchoicebox(longpos, "0", _("east")); |
---|
263 | addchoicebox(longpos, "1", _("west")); |
---|
264 | setchoiceboxselection(latpos, getconfig("longpos", NULL)); |
---|
265 | |
---|
266 | drawscreen(ownpos, 0); |
---|
267 | addscreenrc(ownpos, listbox); |
---|
268 | |
---|
269 | tmp = listbox->select; |
---|
270 | while(1) |
---|
271 | { |
---|
272 | addscreenrc(ownpos, tmp); |
---|
273 | rcret = waitrc(ownpos, 0, 0); |
---|
274 | tmp = listbox->select; |
---|
275 | |
---|
276 | if(rcret == getrcconfigint("rcexit", NULL)) break; |
---|
277 | if(rcret == getrcconfigint("rcok", NULL)) |
---|
278 | { |
---|
279 | addconfigscreencheck("latitude", latitude, "000.000"); |
---|
280 | addconfigscreencheck("longitude", longitude, "000.000"); |
---|
281 | addconfigscreencheck("latpos", latpos, "0"); |
---|
282 | addconfigscreencheck("longpos", longpos, "0"); |
---|
283 | break; |
---|
284 | } |
---|
285 | } |
---|
286 | |
---|
287 | delownerrc(ownpos); |
---|
288 | clearscreen(ownpos); |
---|
289 | } |
---|
290 | |
---|
291 | #endif |
---|