source: titan/titan/gmultiepg.h @ 30760

Last change on this file since 30760 was 23286, checked in by nit, 11 years ago

[titan] cleanup

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