source: titan/titan/gmultiepg.h @ 40810

Last change on this file since 40810 was 38791, checked in by obi, 8 years ago

skinadjust add gepg selection

File size: 29.9 KB
Line 
1#ifndef GMULTIEPG_H
2#define GMULTIEPG_H
3
4time_t calcprimetime(time_t akttime)
5{
6        struct tm *loctime = NULL;
7        time_t ret = 0;
8
9        char* primetime = getconfig("epg_primetime", NULL);
10        int count = 0, hour = 20, min = 15;
11        struct splitstr* ret1 = NULL;
12        ret1 = strsplit(primetime, ":", &count);
13
14        if(ret1 != NULL && count > 1)
15        {
16                hour = atoi(ret1[0].part);
17                min = atoi(ret1[1].part);
18        }
19        free(ret1), ret1 = NULL;
20                                       
21        loctime = olocaltime(&akttime);
22        if(loctime != NULL)
23        {
24                loctime->tm_hour = hour; // 20;
25                loctime->tm_min = min; // 15;
26                ret = mktime(loctime);
27                if(ret < akttime) // add 1 day
28                {
29                        free(loctime);
30                        ret += 86400;
31                        loctime = olocaltime(&ret);
32                        if(loctime != NULL)
33                                ret = mktime(loctime);
34                        else
35                                ret = akttime;
36                }
37        }
38
39        free(loctime);
40        return ret;
41}
42
43void createtimeline(struct skin* gmultiepg, struct skin* timeline, time_t akttime, int zoom)
44{
45        struct skin* node = NULL;
46        struct tm *loctime = NULL;
47        int posx = 0;
48        char* buf = NULL;
49
50        buf = malloc(6);
51        if(buf == NULL)
52        {
53                err("no mem");
54                return;
55        }
56
57        delmarkedscreennodes(gmultiepg, 3);
58
59        while(posx < timeline->iwidth)
60        {
61                node = addlistbox(gmultiepg, timeline, node, 3);
62                if(node != NULL)
63                {
64
65                        loctime = olocaltime(&akttime);
66                        if(loctime != NULL)
67                                strftime(buf, 6, "%H:%M", loctime);
68                        else
69                                snprintf(buf, 6, "00:00");
70                        free(loctime); loctime = NULL;
71
72                        akttime += 30 * 60;
73                        changetext(node, buf);
74                        node->prozwidth = 0;
75                        node->posx = posx;
76                        node->width = 30 * zoom; //30 min * zoom pixel
77                        node->bordersize = 1;
78                        posx += node->width;
79                        if(posx > timeline->iwidth)
80                                node->width -= (posx - timeline->iwidth);
81                }
82        }
83
84        free(buf);
85}
86
87int selectchannelgmepg(struct skin* listbox)
88{
89        struct skin* node = listbox;
90        struct channel* chnode = NULL;
91        listbox->aktpage = -1;
92        listbox->aktline = 1;
93
94        listbox->select = NULL;
95
96        if(status.servicetype == 0)
97                chnode = getchannel(getconfigint("serviceid", NULL), getconfigllu("transponderid", NULL));
98        else
99                chnode = getchannel(getconfigint("rserviceid", NULL), getconfigllu("rtransponderid", NULL));
100
101        if(chnode == NULL)
102        {
103                err("NULL detect");
104                return 1;
105        }
106
107        while(node != NULL)
108        {
109                if(node->deaktivcol > -1)
110                {
111                        node = node->next;
112                        continue;
113                }
114                if(chnode == (struct channel*)node->handle)
115                        return 0;
116
117                if(node->del == 1) listbox->aktline++;
118                node = node->next;
119        }
120        listbox->aktline = 1;
121        return 1;
122}
123
124int calcgmultiepg(struct channel* tmpchannel, struct skin* gmultiepg, struct skin* channellistbox, struct skin* listbox, struct skin* timeline, int zoom, time_t akttime, struct channel* aktchannel, int linecol1, int linecol2, int linecol3, int* aktline, struct skin** pchnode, struct skin** pchnode1, int height, int picheight, int epgpicon, long deaktivcol, int marklast)
125{
126        int treffer = 0, gridbr = 0, aktcol = 0, nottuneable = 0;
127        struct epg* epgnode = NULL;
128        struct skin* chnode = NULL, *chnode1 = NULL;
129        char* tmpstr = NULL;
130        time_t nowtime = time(NULL);
131
132        if(tmpchannel != NULL && tmpchannel->servicetype == status.servicetype)
133        {
134                if(channelnottunable(tmpchannel) == 1) nottuneable = 1;
135                *pchnode = addlistbox(gmultiepg, channellistbox, *pchnode, 1);
136                chnode = *pchnode;
137                if(chnode != NULL)
138                {
139                        chnode->bgspace = 1;
140                       
141                        if(epgpicon == 1) tmpstr = createpiconpath(tmpchannel, 0);
142                        if(tmpstr != NULL && ostrstr(tmpstr, "default.png") == NULL)
143                        {
144                                changepic(chnode, tmpstr);
145                                chnode->height = picheight;
146                        }
147                        else
148                        {
149                                changetext(chnode, tmpchannel->name);
150                                chnode->height = height;
151                        }
152                        free(tmpstr); tmpstr = NULL;
153
154                        epgnode = getepgakt(tmpchannel);
155                        if(epgnode == NULL) epgnode = getepgnext(tmpchannel);
156
157                        while(epgnode != NULL)
158                        {
159                                if(epgnode->endtime <= akttime)
160                                {
161                                        epgnode = epgnode->next;
162                                        continue;
163                                }
164                                if(epgnode->starttime >= akttime + ((listbox->iwidth * 60) / zoom))
165                                        break;
166
167                                *pchnode1 = addlistbox(gmultiepg, listbox, *pchnode1, 1);
168                                chnode1 = *pchnode1;
169                                if(chnode1 != NULL)
170                                {
171                                        /*if(nottuneable != 1)*/ (*aktline)++;
172                                        if(gridbr == 0)
173                                        {
174                                                //used for left/right scroll
175                                                chnode1->titlealign = 1;
176                                                chnode1->type = TEXTBOX | GRIDBR | MULTIPROGRESSBAR;
177                                                if(tmpchannel == aktchannel)
178                                                {
179                                                        listbox->aktline = *aktline;
180                                                        listbox->gridcol = 0;
181                                                }
182                                        }
183                                        else
184                                                chnode1->type = TEXTBOX | MULTIPROGRESSBAR;
185                                        chnode1->wrap = YES;
186                                        gridbr = 1;
187                                        treffer = 1;
188                                        chnode1->height = chnode->height;
189                                        chnode1->width = ((epgnode->endtime - epgnode->starttime) / 60) * zoom;
190                                        chnode1->posx = ((epgnode->starttime - akttime) / 60) * zoom;
191                                        if(chnode1->posx < 0)
192                                        {
193                                                chnode1->width += chnode1->posx;
194                                                chnode1->posx = 0;
195                                        }
196                                        chnode1->prozwidth = 0;
197                                        if(aktcol == linecol1)
198                                                aktcol = linecol2;
199                                        else
200                                                aktcol = linecol1;
201                                        if(nowtime >= epgnode->starttime && nowtime < epgnode->endtime)
202                                                aktcol = linecol3;
203                                        chnode1->bgcol = aktcol;
204                                        chnode1->bgspace = 1;
205                                        chnode1->vspace = 2;
206                                        chnode1->hspace = 2;
207                                        /*if(nottuneable == 1) chnode1->deaktivcol = deaktivcol;*/
208                                       
209                                        //record timeline
210                                        chnode1->progresscol = listbox->progresscol;
211                                        chnode1->epgrecord = getepgrecord(tmpchannel, epgnode);
212               
213                                        changetext(chnode1, epgnode->title);
214                                        chnode1->handle = (char*)tmpchannel;
215                                        chnode1->handle1 = (char*)epgnode;
216                                        if(chnode1->posx + chnode1->width >= listbox->iwidth)
217                                        {
218                                                if(marklast == 1 && tmpchannel == aktchannel)
219                                                        listbox->aktline = *aktline;
220                                                //used for left/right scroll
221                                                chnode1->titlealign += 2;
222                                                chnode1->width = listbox->iwidth - chnode1->posx;
223                                                break;
224                                        }
225                                }
226                                epgnode = epgnode->next;
227                        }
228                       
229                        if(chnode1 != NULL && chnode1->titlealign < 2) chnode1->titlealign += 2;
230                       
231                        if(gridbr == 0)
232                        {
233                                *pchnode1 = addlistbox(gmultiepg, listbox, *pchnode1, 1);
234                                chnode1 = *pchnode1;
235                                if(chnode1 != NULL)
236                                {
237                                        //used for left/right scroll
238                                        chnode1->titlealign = 3;
239                                        if(nottuneable == 1)
240                                                chnode1->deaktivcol = deaktivcol;
241                                        else
242                                                (*aktline)++;
243                                        if(tmpchannel == aktchannel)
244                                                listbox->aktline = *aktline;
245                                        if(gridbr == 0) chnode1->type = GRIDBR;
246                                        gridbr = 1;
247                                        chnode1->height = chnode->height;
248                                        chnode1->handle = (char*)tmpchannel;
249                                        chnode1->bgspace = 1;
250                                }
251                        }
252
253                        chnode->handle = (char*)tmpchannel;
254                        if(nottuneable == 1)
255                                chnode->deaktivcol = deaktivcol;
256                }
257        }
258        return treffer;
259}
260
261int showallgmepgchannel(struct skin* gmultiepg, struct skin* channellistbox, struct skin* listbox, struct skin* timeline, int zoom, time_t akttime, struct channel* aktchannel, int marklast)
262{
263        int treffer = 0, aktline = 0;
264        struct skin* chnode = NULL, *chnode1 = NULL;
265        struct channel* tmpchannel = channel;
266
267        int linecol1 = convertcol("epgcol1");
268        int linecol2 = convertcol("epgcol2");
269        int linecol3 = convertcol("epgcol3");
270        int height = getskinconfigint("epgheight", NULL);
271        int picheight = getskinconfigint("epgpicheight", NULL);
272        int epgpicon = getconfigint("epgpicon", NULL);
273        long deaktivcol = convertcol("deaktivcol");
274
275        if(height < 1) height = 35;
276        if(picheight < 1) picheight = 35;
277
278        if(gmultiepg != NULL) delmarkedscreennodes(gmultiepg, 1);
279        if(listbox != NULL) listbox->aktline = 1;
280
281        while(tmpchannel != NULL)
282        {
283                if(calcgmultiepg(tmpchannel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight, epgpicon, deaktivcol, marklast) == 1)
284                        treffer = 1;
285                tmpchannel = tmpchannel->next;
286        }
287        return treffer;
288}
289
290int showbouquetgmepgchannel(struct skin* gmultiepg, struct skin* channellistbox, struct skin* listbox, struct skin* timeline, struct bouquet* firstbouquet, struct mainbouquet* mbouquet, int zoom, time_t akttime, struct channel* aktchannel, int marklast)
291{
292        int treffer = 0, aktline = 0;
293        struct skin* chnode = NULL, *chnode1 = NULL;
294        struct bouquet* tmpbouquet = firstbouquet;
295
296        int linecol1 = convertcol("epgcol1");
297        int linecol2 = convertcol("epgcol2");
298        int linecol3 = convertcol("epgcol3");
299        int height = getskinconfigint("epgheight", NULL);
300        int picheight = getskinconfigint("epgpicheight", NULL);
301        int epgpicon = getconfigint("epgpicon", NULL);
302        long deaktivcol = convertcol("deaktivcol");
303
304        if(height < 1) height = 35;
305        if(picheight < 1) picheight = 35;
306
307        if(gmultiepg != NULL) delmarkedscreennodes(gmultiepg, 1);
308        if(listbox != NULL) listbox->aktline = 1;
309
310        if(mbouquet != NULL && ostrcmp(mbouquet->filename, "0") == 0)
311        {
312                mostzaptobouquet(mbouquet);
313                tmpbouquet = mbouquet->bouquet;
314        }
315
316        while(tmpbouquet != NULL)
317        {
318                if(calcgmultiepg(tmpbouquet->channel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight, epgpicon, deaktivcol, marklast) == 1)
319                        treffer = 1;
320                tmpbouquet = tmpbouquet->next;
321        }
322        return treffer;
323}
324
325int showprovidergmepgchannel(struct skin* gmultiepg, struct skin* channellistbox, struct skin* listbox, struct skin* timeline, struct provider* providernode, int zoom, time_t akttime, struct channel* aktchannel, int marklast)
326{
327        int treffer = 0, aktline = 0;
328        struct skin* chnode = NULL, *chnode1 = NULL;
329        struct channel* tmpchannel = channel;
330
331        int linecol1 = convertcol("epgcol1");
332        int linecol2 = convertcol("epgcol2");
333        int linecol3 = convertcol("epgcol3");
334        int height = getskinconfigint("epgheight", NULL);
335        int picheight = getskinconfigint("epgpicheight", NULL);
336        int epgpicon = getconfigint("epgpicon", NULL);
337        long deaktivcol = convertcol("deaktivcol");
338
339        if(height < 1) height = 35;
340        if(picheight < 1) picheight = 35;
341
342        if(gmultiepg != NULL) delmarkedscreennodes(gmultiepg, 1);
343
344        while(tmpchannel != NULL)
345        {
346                if(tmpchannel->provider == providernode)
347                {
348                        if(calcgmultiepg(tmpchannel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight, epgpicon, deaktivcol, marklast) == 1)
349                                treffer = 1;
350                }
351                tmpchannel = tmpchannel->next;
352        }
353        return treffer;
354}
355
356int showsatgmepgchannel(struct skin* gmultiepg, struct skin* channellistbox, struct skin* listbox, struct skin* timeline, struct sat* satnode, int zoom, time_t akttime, struct channel* aktchannel, int marklast)
357{
358        int treffer = 0, aktline = 0;
359        struct skin* chnode = NULL, *chnode1 = NULL;
360        struct channel* tmpchannel = channel;
361       
362        if(satnode == NULL) return 1;
363
364        int linecol1 = convertcol("epgcol1");
365        int linecol2 = convertcol("epgcol2");
366        int linecol3 = convertcol("epgcol3");
367        int height = getskinconfigint("epgheight", NULL);
368        int picheight = getskinconfigint("epgpicheight", NULL);
369        int epgpicon = getconfigint("epgpicon", NULL);
370        long deaktivcol = convertcol("deaktivcol");
371
372        if(height < 1) height = 35;
373        if(picheight < 1) picheight = 35;
374
375        if(gmultiepg != NULL) delmarkedscreennodes(gmultiepg, 1);
376
377        while(tmpchannel != NULL)
378        {
379                if(tmpchannel->transponder != NULL && tmpchannel->transponder->orbitalpos == satnode->orbitalpos)
380                {
381                        if(calcgmultiepg(tmpchannel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight, epgpicon, deaktivcol, marklast) == 1)
382                                treffer = 1;
383                }
384                tmpchannel = tmpchannel->next;
385        }
386        return treffer;
387}
388
389int showazgmepgchannel(struct skin* gmultiepg, struct skin* channellistbox, struct skin* listbox, struct skin* timeline, int character, int zoom, time_t akttime, struct channel* aktchannel, int marklast)
390{
391        int treffer = 0, aktline = 0;
392        struct skin* chnode = NULL, *chnode1 = NULL;
393        struct channel* tmpchannel = channel;
394
395        int linecol1 = convertcol("epgcol1");
396        int linecol2 = convertcol("epgcol2");
397        int linecol3 = convertcol("epgcol3");
398        int height = getskinconfigint("epgheight", NULL);
399        int picheight = getskinconfigint("epgpicheight", NULL);
400        int epgpicon = getconfigint("epgpicon", NULL);
401        long deaktivcol = convertcol("deaktivcol");
402
403        if(height < 1) height = 35;
404        if(picheight < 1) picheight = 35;
405
406        if(gmultiepg != NULL) delmarkedscreennodes(gmultiepg, 1);
407
408        while(tmpchannel != NULL)
409        {
410                if(tmpchannel->name != NULL && (tmpchannel->name[0] == character || tmpchannel->name[0] == character + 32))
411                {
412                        if(calcgmultiepg(tmpchannel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight, epgpicon, deaktivcol, marklast) == 1)
413                                treffer = 1;
414                }
415                tmpchannel = tmpchannel->next;
416        }
417        return treffer;
418}
419
420void drawchannellistgmepg(struct skin* gmultiepg, int list, struct skin* listbox)
421{
422        status.markedchannel = NULL;
423
424        if(list == ALLCHANNEL || list == SATCHANNEL || list == PROVIDERCHANNEL || list == AZCHANNEL || list == BOUQUETCHANNEL)
425        {
426                if(listbox->select == NULL)
427                        drawscreen(gmultiepg, 2, 0);
428
429                if(listbox->select != NULL)
430                        status.markedchannel = (struct channel*)listbox->select->handle;
431        }
432        drawscreen(gmultiepg, 0, 0);
433}
434
435//flag 0: epg from listbox
436//flag 1: epg from param or aktepg
437void gmultiepgfilldesc(struct skin* listbox, struct skin* epgdesc, struct skin* epgdate, struct epg* epgnode, struct channel* chnode, int flag)
438{
439        char* tmpstr = NULL;
440
441        changetext(epgdesc, NULL);
442        changetext(epgdate, NULL);
443
444        if(flag == 0)
445        {
446                if(listbox->select != NULL)
447                        epgnode = (struct epg*)listbox->select->handle1;
448        }
449        else
450                if(chnode != NULL && epgnode == NULL) epgnode = getepgakt(chnode);
451
452        if(epgnode != NULL)
453        {
454                char* buf2 = malloc(50);
455                struct tm* loctime = olocaltime(&epgnode->starttime);
456                if(loctime != NULL)
457                        strftime(buf2, 50, "%d.%m. (%a) %H:%M", loctime);
458                free(loctime); loctime = NULL;
459
460                char* buf3 = malloc(50);
461                loctime = olocaltime(&epgnode->endtime);
462                if(loctime != NULL)
463                        strftime(buf3, 50, "%H:%M", loctime);
464                free(loctime); loctime = NULL;
465
466                buf2 = translate_time(buf2, 1);
467                //buf3 = translate_time(buf3, 1);
468                buf2 = ostrcat(buf2, "-", 1, 0);
469                buf2 = ostrcat(buf2, buf3, 1, 0);
470                changetext(epgdate, buf2);
471                tmpstr = ostrcat(buf2, " - ", 0, 0);
472                free(buf2); buf2 = NULL;
473                free(buf3); buf3 = NULL;
474
475                if(epgnode->title != NULL)
476                {
477                        tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0);
478                        tmpstr = ostrcat(tmpstr, " - ", 1, 0);
479                }
480                tmpstr = ostrcat(tmpstr, epgdescunzip(epgnode), 1, 1);
481                changetext(epgdesc, tmpstr);
482                free(tmpstr); tmpstr = NULL;
483        }
484}
485
486void gmultiepgchangesize(struct skin* gmultiepg, struct skin* listbox, struct skin* channellistbox, struct skin* timeline)
487{
488        int chboxwidth = 0;
489        int epgpicon = getconfigint("epgpicon", NULL);
490
491        if(epgpicon == 1)
492                chboxwidth = getskinconfigint("epgchannelpiconwidth", NULL);
493        else
494                chboxwidth = getskinconfigint("epgchannelwidth", NULL);
495                       
496        if(chboxwidth != 0)
497        {
498                channellistbox->width = chboxwidth;
499               
500                listbox->width = gmultiepg->iwidth - (channellistbox->width + channellistbox->posx);
501                listbox->posx = channellistbox->width + channellistbox->posx;
502                listbox->prozwidth = 0;
503
504                timeline->width = gmultiepg->iwidth - (channellistbox->width + channellistbox->posx);
505                timeline->posx = channellistbox->width + channellistbox->posx;
506                timeline->prozwidth = 0;
507        }
508}
509
510int screengmultiepg(struct channel* chnode, struct epg* epgnode, int flag)
511{
512        int rcret = 0, ret = 0, epgscreenconf = 0, end = 0;
513
514        char* gmultiepg_sel = getskinconfig("gmultiepg_selection", NULL);
515        debug(10, "get initial gmultiepg=%s", gmultiepg_sel);
516
517        if(gmultiepg_sel == NULL) {
518                gmultiepg_sel = ostrcat(gmultiepg_sel, "gmultiepg", 1, 0); // fallback to default
519                debug(10, "fallback to default, set gmultiepg=%s", gmultiepg_sel);
520        }
521
522        struct skin* gmultiepg = getscreen(gmultiepg_sel);
523        debug(10, "final gmultiepg=%s", gmultiepg_sel);
524
525//      struct skin* gmultiepg = getscreen("gmultiepg");
526        struct skin* listbox = getscreennode(gmultiepg, "listbox");
527        struct skin* channellistbox = getscreennode(gmultiepg, "channellistbox");
528        struct skin* epgdesc = getscreennode(gmultiepg, "epgdesc");
529        struct skin* epgdate = getscreennode(gmultiepg, "epgdate");
530        struct skin* timeline = getscreennode(gmultiepg, "timeline");
531        struct skin* b2 = getscreennode(gmultiepg, "b2");
532        struct skin* b3 = getscreennode(gmultiepg, "b3");
533        struct skin* b4 = getscreennode(gmultiepg, "b4");
534       
535        int list = ALLCHANNEL;
536        char* tmpstr = NULL, *tmpstr1 = NULL;
537        void* aktlist = NULL;
538        int character = 0;
539        struct sat* satnode = NULL;
540        struct provider* providernode = NULL;
541        struct channel* aktchannel = NULL;
542#ifdef SIMULATE
543        time_t akttime = time(NULL);
544        //time_t akttime = 1307871000;
545        //akttime = 1315614900;
546        //akttime = 1317926400;
547#else
548        time_t akttime = time(NULL);
549#endif
550        int zoom = getconfigint("gmultiepgzoom", NULL);
551        if(zoom < 1) zoom = 4;
552        int nochanneltitle = getskinconfigint("nochanneltitle", NULL);
553
554        akttime -= (((akttime / 60) % 15) * 60);
555        akttime -= (((akttime) % 60));
556        time_t starttime = akttime;
557
558        if(chnode == NULL) chnode = status.aktservice->channel;
559        gmultiepgfilldesc(listbox, epgdesc, epgdate, epgnode, chnode, 1);
560
561        //chalc screen, so we have all infos
562        drawscreen(gmultiepg, 2, 0);
563
564        time_t addtime = (listbox->iwidth / zoom) * 60;
565        addtime -= (((addtime / 60) % 15) * 60);
566        addtime -= (((addtime) % 60));
567        epgscreenconf = getconfigint("epg_screen", NULL);
568
569        if(status.servicetype == 0)
570        {
571                tmpstr = getconfig("channellist", NULL);
572                aktchannel = getchannel(getconfigint("serviceid", NULL), getconfigllu("transponderid", NULL));
573        }
574        else
575        {
576                tmpstr = getconfig("rchannellist", NULL);
577                aktchannel = getchannel(getconfigint("rserviceid", NULL), getconfigllu("rtransponderid", NULL));
578        }
579
580        if(ostrncmp("(BOUQUET)-", tmpstr, 10) == 0 && strlen(tmpstr) > 10)
581        {
582                struct mainbouquet* mainbouquetnode = NULL;
583                mainbouquetnode = getmainbouquet(tmpstr + 10);
584                if(mainbouquetnode != NULL && mainbouquetnode->bouquet != NULL)
585                {
586                        tmpstr1 = ostrcat(tmpstr1, _("GRAPHIC MULTI EPG - Bouquets"), 0, 0);
587                        tmpstr1 = ostrcat(tmpstr1, " - ", 1, 0);
588                        tmpstr1 = ostrcat(tmpstr1, tmpstr + 10, 1, 0);
589                        if(nochanneltitle == 0) changetitle(gmultiepg, tmpstr1);
590                        free(tmpstr1); tmpstr1 = NULL;
591                        list = BOUQUETCHANNEL;
592                        aktlist = (void*)mainbouquetnode;
593                        showbouquetgmepgchannel(gmultiepg, channellistbox, listbox, timeline, mainbouquetnode->bouquet, mainbouquetnode, zoom, akttime, aktchannel, 0);
594                        selectchannelgmepg(channellistbox);
595                }
596        }
597        else if(ostrncmp("(A-Z)-", tmpstr, 6) == 0 && strlen(tmpstr) > 6)
598        {
599                tmpstr1 = ostrcat(tmpstr1, _("GRAPHIC MULTI EPG - Channel"), 0, 0);
600                tmpstr1 = ostrcat(tmpstr1, " - ", 1, 0);
601                tmpstr1 = ostrcat(tmpstr1, tmpstr + 6, 1, 0);
602                if(nochanneltitle == 0) changetitle(gmultiepg, tmpstr1);
603                free(tmpstr1); tmpstr1 = NULL;
604                list = AZCHANNEL;
605                character = (int)tmpstr[6];
606                aktlist = (void*)(int)tmpstr[6];
607                showazgmepgchannel(gmultiepg, channellistbox, listbox, timeline, character, zoom, akttime, aktchannel, 0);
608                selectchannelgmepg(channellistbox);
609        }
610        else if(ostrncmp("(SAT)-", tmpstr, 6) == 0 && strlen(tmpstr) > 6)
611        {
612                tmpstr1 = ostrcat(tmpstr1, _("GRAPHIC MULTI EPG - Satellites"), 0, 0);
613                tmpstr1 = ostrcat(tmpstr1, " - ", 1, 0);
614                tmpstr1 = ostrcat(tmpstr1, tmpstr + 6, 1, 0);
615                if(nochanneltitle == 0) changetitle(gmultiepg, tmpstr1);
616                free(tmpstr1); tmpstr1 = NULL;
617                satnode = getsat(tmpstr + 6);
618                list = SATCHANNEL;
619                aktlist = (void*)satnode;
620                showsatgmepgchannel(gmultiepg, channellistbox, listbox, timeline, satnode, zoom, akttime, aktchannel, 0);
621                selectchannelgmepg(channellistbox);
622        }
623        else if(ostrncmp("(PROVIDER)-", tmpstr, 11) == 0 && strlen(tmpstr) > 6)
624        {
625                tmpstr1 = ostrcat(tmpstr1, _("GRAPHIC MULTI EPG - Provider"), 0, 0);
626                tmpstr1 = ostrcat(tmpstr1, " - ", 1, 0);
627                tmpstr1 = ostrcat(tmpstr1, tmpstr + 11, 1, 0);
628                if(nochanneltitle == 0) changetitle(gmultiepg, tmpstr1);
629                free(tmpstr1); tmpstr1 = NULL;
630                providernode = getproviderbyname(tmpstr + 11);
631                list = PROVIDERCHANNEL;
632                aktlist = (void*)providernode;
633                showprovidergmepgchannel(gmultiepg, channellistbox, listbox, timeline, providernode, zoom, akttime, aktchannel, 0);
634                selectchannelgmepg(channellistbox);
635        }
636        else
637        {
638                if(nochanneltitle == 0) changetitle(gmultiepg, _("GRAPHIC MULTI EPG - All Channels"));
639                list = ALLCHANNEL;
640                showallgmepgchannel(gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, 0);
641                selectchannelgmepg(channellistbox);
642        }
643
644        if(flag == 0 && epgscreenconf == 3)
645        {
646                b2->hidden = NO;
647                b3->hidden = NO;
648                b4->hidden = NO;
649        }
650        else
651        {
652                b2->hidden = YES;
653                b3->hidden = YES;
654                b4->hidden = YES;
655        }
656
657        gmultiepgchangesize(gmultiepg, listbox, channellistbox, timeline);
658
659        tmpstr = NULL;
660        drawscreen(gmultiepg, 2, 0);
661        addscreenrc(gmultiepg, listbox);
662        listbox->aktpage = channellistbox->aktpage;
663
664        createtimeline(gmultiepg, timeline, akttime, zoom);
665
666        drawchannellistgmepg(gmultiepg, list, listbox);
667
668        while(1)
669        {
670                rcret = waitrc(gmultiepg, 0, 2);
671
672                channellistbox->aktpage = listbox->aktpage;
673
674                if((rcret == getrcconfigint("rcexit", NULL)) || (rcret == getrcconfigint("rcepg", NULL))) break;
675                //if(rcret == getrcconfigint("rcinfo", NULL)) break;
676                if(listbox->select != NULL && rcret == getrcconfigint("rcok", NULL))
677                {
678                        if(channelnottunable((struct channel*)listbox->select->handle) == 0)
679                        {
680                                //clear screen before zap
681                                clearscreen(gmultiepg);
682                                drawscreen(skin, 0, 0);
683                               
684                                int ret = 0;
685                                if(status.servicetype == 0)
686                                        ret = servicestart((struct channel*)listbox->select->handle, getconfig("channellist", NULL), NULL, 0);
687                                else
688                                        ret = servicestart((struct channel*)listbox->select->handle, getconfig("rchannellist", NULL), NULL, 0);
689                                if(ret == 20) writeconfigtmp();
690                                servicecheckret(ret, 0);
691                                end = 1;
692                                break;
693                        }
694                }
695                if(rcret == getrcconfigint("rcinfo", NULL))
696                {
697                        if(listbox->select != NULL)
698                        {
699                                clearscreen(gmultiepg);
700                                end = screenepg((struct channel*)listbox->select->handle, (struct epg*)listbox->select->handle1, 1);
701                                if(end == 1)
702                                        break;
703                                else
704                                        drawscreen(gmultiepg, 0, 0);
705                        }
706                }
707               
708                if(flag == 0 && epgscreenconf == 3 && rcret == getrcconfigint("rcgreen", NULL))
709                {
710                        if(listbox->select != NULL)
711                        {
712                                clearscreen(gmultiepg);
713                                end = screenepg((struct channel*)listbox->select->handle, (struct epg*)listbox->select->handle1, 0);
714                                //drawscreen(gmultiepg, 0, 0);
715                                break;
716                        }
717                }
718                if(flag == 0 && epgscreenconf == 3 && rcret == getrcconfigint("rcyellow", NULL))
719                {
720                        if(listbox->select != NULL)
721                        {
722                                clearscreen(gmultiepg);
723                                end = screensingleepg((struct channel*)listbox->select->handle, NULL, 0);
724                                //drawscreen(gmultiepg, 0, 0);
725                                break;
726                        }
727                }
728                if(flag == 0 && epgscreenconf == 3 && rcret == getrcconfigint("rcblue", NULL))
729                {
730                        if(listbox->select != NULL)
731                        {
732                                clearscreen(gmultiepg);
733                                end = screenmultiepg((struct channel*)listbox->select->handle, NULL, 0);
734                                //drawscreen(gmultiepg, 0, 0);
735                                break;
736                        }
737                }
738                if(rcret == getrcconfigint("rc0", NULL))
739                {
740                        if(listbox->select != NULL && listbox->select->handle1 != NULL)
741                        {
742                                screenepgsearch(((struct epg*)listbox->select->handle1)->title);
743                                resettvpic();
744                                drawscreen(gmultiepg, 0, 0);
745                                continue;
746                        }
747                }
748
749                if(list == BOUQUETCHANNEL && (rcret == getrcconfigint("rcff", NULL) || rcret == getrcconfigint("rcfr", NULL)))
750                {
751                        struct mainbouquet *mnode = (struct mainbouquet*)aktlist;
752                        int round = 0;
753                        while(mnode != NULL)
754                        {
755                                if(rcret == getrcconfigint("rcff", NULL))
756                                {
757                                        mnode = mnode->next;
758                                        if(mnode == NULL && round == 0)
759                                        {
760                                                round = 1;
761                                                mnode = mainbouquet;
762                                        }
763                                }
764                                else if(rcret == getrcconfigint("rcfr", NULL))
765                                {
766                                        mnode = mnode->prev;
767                                        if(mnode == NULL && round == 0)
768                                        {
769                                                round = 1;
770                                                mnode = getlastmainbouquet(mainbouquet);
771                                        }
772                                }
773                                if(mnode == NULL) break;
774                                if(mnode->type != status.servicetype) continue;
775
776                                char* tmp = ostrcat(tmp, "(BOUQUET)-", 0, 0);
777                                tmp = ostrcat(tmp, mnode->name, 1, 0);
778                                if(status.servicetype == 0)
779                                        addconfigtmp("channellist", tmp);
780                                else
781                                        addconfigtmp("rchannellist", tmp);
782                                free(tmp); tmp = NULL;
783
784                                tmpstr1 = ostrcat(tmpstr1, _("GRAPHIC MULTI EPG - Bouquets"), 0, 0);
785                                tmpstr1 = ostrcat(tmpstr1, " - ", 1, 0);
786                                tmpstr1 = ostrcat(tmpstr1, mnode->name, 1, 0);
787                                if(nochanneltitle == 0) changetitle(gmultiepg, tmpstr1);
788                                free(tmpstr1); tmpstr1 = NULL;
789
790                                if(status.servicetype == 0)
791                                        aktchannel = getchannel(getconfigint("serviceid", NULL), getconfigllu("transponderid", NULL));
792                                else
793                                        aktchannel = getchannel(getconfigint("rserviceid", NULL), getconfigllu("rtransponderid", NULL));
794
795                                listbox->aktpage = -1;
796                                listbox->aktline = 1;
797                                listbox->select = NULL;
798                                showbouquetgmepgchannel(gmultiepg, channellistbox, listbox, timeline, mnode->bouquet, mnode, zoom, starttime, aktchannel, 0);
799                                selectchannelgmepg(channellistbox);
800                                aktlist = (void*)mnode;
801
802                                createtimeline(gmultiepg, timeline, starttime, zoom);
803                                drawscreen(gmultiepg, 2, 0);
804                                gmultiepgfilldesc(listbox, epgdesc, epgdate, NULL, NULL, 0);
805                                drawscreen(gmultiepg, 0, 0);
806                                if(listbox->select != NULL)
807                                        aktchannel = (struct channel*)listbox->select->handle;
808                                break;
809                        }
810                        continue;
811                }
812
813                if((listbox->select != NULL && (listbox->select->titlealign == 1 || listbox->select->titlealign == 3) && rcret == getrcconfigint("rcright", NULL)) || rcret == getrcconfigint("rc9", NULL) || rcret == getrcconfigint("rcnext", NULL) || rcret == getrcconfigint("rcfav", NULL))
814                {
815                        time_t tmptime = 0;
816
817                        if(rcret == getrcconfigint("rcfav", NULL))
818                        {
819                                tmptime = calcprimetime(akttime);
820                                if(tmptime != 0)
821                                {
822                                        akttime = tmptime;
823                                        akttime -= addtime;
824                                }
825                        }
826                        akttime += addtime;
827
828                        if(list == BOUQUETCHANNEL)
829                        {
830                                if(showbouquetgmepgchannel(gmultiepg, channellistbox, listbox, timeline, ((struct mainbouquet*)aktlist)->bouquet, (struct mainbouquet*)aktlist, zoom, akttime, aktchannel, 0) == 0)
831                                {
832                                        if(tmptime == 0)
833                                                akttime -= addtime;
834                                        else
835                                                akttime = starttime;
836                                        if(akttime < starttime)
837                                                akttime = starttime;
838                                        else
839                                                showbouquetgmepgchannel(gmultiepg, channellistbox, listbox, timeline, ((struct mainbouquet*)aktlist)->bouquet, (struct mainbouquet*)aktlist, zoom, akttime, aktchannel, 0);
840                                }
841                        }
842                        else if(list == ALLCHANNEL)
843                        {
844                                if(showallgmepgchannel(gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, 0) == 0)
845                                {
846                                        if(tmptime == 0)
847                                                akttime -= addtime;
848                                        else
849                                                akttime = starttime;
850                                        if(akttime < starttime)
851                                                akttime = starttime;
852                                        else
853                                                showallgmepgchannel(gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, 0);
854                                }
855                        }
856                        else if(list == AZCHANNEL)
857                        {
858                                if(showazgmepgchannel(gmultiepg, channellistbox, listbox, timeline, character, zoom, akttime, aktchannel, 0) == 0)
859                                {
860                                        if(tmptime == 0)
861                                                akttime -= addtime;
862                                        else
863                                                akttime = starttime;
864                                        if(akttime < starttime)
865                                                akttime = starttime;
866                                        else
867                                                showazgmepgchannel(gmultiepg, channellistbox, listbox, timeline, character, zoom, akttime, aktchannel, 0);
868                                }
869                        }
870                        else if(list == SATCHANNEL)
871                        {
872                                if(showsatgmepgchannel(gmultiepg, channellistbox, listbox, timeline, satnode, zoom, akttime, aktchannel, 0) == 0)
873                                {
874                                        if(tmptime == 0)
875                                                akttime -= addtime;
876                                        else
877                                                akttime = starttime;
878                                        if(akttime < starttime)
879                                                akttime = starttime;
880                                        else
881                                                showsatgmepgchannel(gmultiepg, channellistbox, listbox, timeline, satnode, zoom, akttime, aktchannel, 0);
882                                }
883                        }
884                        else if(list == PROVIDERCHANNEL)
885                        {
886                                if(showprovidergmepgchannel(gmultiepg, channellistbox, listbox, timeline, providernode, zoom, akttime, aktchannel, 0) == 0)
887                                {
888                                        if(tmptime == 0)
889                                                akttime -= addtime;
890                                        else
891                                                akttime = starttime;
892                                        if(akttime < starttime)
893                                                akttime = starttime;
894                                        else
895                                                showprovidergmepgchannel(gmultiepg, channellistbox, listbox, timeline, providernode, zoom, akttime, aktchannel, 0);
896                                }
897                        }
898                        createtimeline(gmultiepg, timeline, akttime, zoom);
899                        drawscreen(gmultiepg, 2, 0);
900                        gmultiepgfilldesc(listbox, epgdesc, epgdate, NULL, NULL, 0);
901                        drawscreen(gmultiepg, 0, 0);
902                        if(listbox->select != NULL)
903                                aktchannel = (struct channel*)listbox->select->handle;
904                        continue;
905                }
906
907                if((listbox->select != NULL && (listbox->select->titlealign == 2 || listbox->select->titlealign == 3) && rcret == getrcconfigint("rcleft", NULL)) || rcret == getrcconfigint("rc7", NULL) || rcret == getrcconfigint("rcprev", NULL))
908                {
909                        akttime -= addtime;
910                        if(akttime < starttime) akttime = starttime;
911                       
912                        int marklast = 0;
913                        if(rcret == getrcconfigint("rcleft", NULL)) marklast = 1;
914
915                        if(list == BOUQUETCHANNEL)
916                                showbouquetgmepgchannel(gmultiepg, channellistbox, listbox, timeline, ((struct mainbouquet*)aktlist)->bouquet, (struct mainbouquet*)aktlist, zoom, akttime, aktchannel, marklast);
917                        else if(list == ALLCHANNEL)
918                                showallgmepgchannel(gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, marklast);
919                        else if(list == AZCHANNEL)
920                                showazgmepgchannel(gmultiepg, channellistbox, listbox, timeline, character, zoom, akttime, aktchannel, marklast);
921                        else if(list == SATCHANNEL)
922                                showsatgmepgchannel(gmultiepg, channellistbox, listbox, timeline, satnode, zoom, akttime, aktchannel, marklast);
923                        else if(list == PROVIDERCHANNEL)
924                                showprovidergmepgchannel(gmultiepg, channellistbox, listbox, timeline, providernode, zoom, akttime, aktchannel, marklast);
925                        createtimeline(gmultiepg, timeline, akttime, zoom);
926                        drawscreen(gmultiepg, 2, 0);
927                        gmultiepgfilldesc(listbox, epgdesc, epgdate, NULL, NULL, 0);
928                        drawscreen(gmultiepg, 0, 0);
929                        if(listbox->select != NULL)
930                                aktchannel = (struct channel*)listbox->select->handle;
931                        continue;
932                }
933
934                if(rcret == getrcconfigint("rcred", NULL) && listbox->select != NULL)
935                {
936                        clearscreen(gmultiepg);
937                        ret = addrecepg((struct channel*)listbox->select->handle, (struct epg*)listbox->select->handle1, NULL);
938
939                        //recalc record timelines
940                        struct skin* tmplistbox = listbox;
941                        while(tmplistbox != NULL)
942                        {
943                                if(tmplistbox->type & MULTIPROGRESSBAR)
944                                        tmplistbox->epgrecord = getepgrecord((struct channel*)tmplistbox->handle, (struct epg*)tmplistbox->handle1);
945                                tmplistbox = tmplistbox->next;
946                        }
947
948                        drawscreen(gmultiepg, 0, 0);
949                        continue;
950                }
951
952                gmultiepgfilldesc(listbox, epgdesc, epgdate, NULL, NULL, 0);
953                drawscreen(gmultiepg, 0, 0);
954                if(listbox->select != NULL)
955                        aktchannel = (struct channel*)listbox->select->handle;
956        }
957
958        delconfigtmp("channellist");
959        delconfigtmp("rchannellist");
960        status.markedchannel = NULL;
961        status.markmodus = 0;
962        delmarkedscreennodes(gmultiepg, 1);
963        delmarkedscreennodes(gmultiepg, 3);
964        delownerrc(gmultiepg);
965        clearscreen(gmultiepg);
966
967        return end;
968}
969
970#endif
Note: See TracBrowser for help on using the repository browser.