summaryrefslogtreecommitdiff
path: root/magazine.h
blob: 67b3451bb4c3b028639fa0e880266ab7ff4b334c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
 * magazine.h
 *
 * See the README file for copyright information and how to reach the author.
 *
 */

#ifndef MAGAZINE_H
#define MAGAZINE_H

#include <vdr/plugin.h>
#include <time.h>
#include <vdr/device.h>
#include "gfxtools.h"
#include "config.h"
#include "timer.h"
#include "search.h"

void mzlog(int level, const char *fmt, ...);

typedef enum
{
    NAME1_AREA = 0,
    NAME2_AREA,
    NAME3_AREA,
    DATETIME_AREA,
    TIMELINE_AREA,
    SCHED1_AREA,
    SCHED2_AREA,
    SCHED3_AREA,
    CONTROL_AREA,
    NUMBER_OF_AREAS
} tMagazineArea;

class magazine : public cOsdObject
{
private:
    cPlugin *parent;
    cOsd *osd;

    class tvOcMenuEvent *me;
    class cMenuEditTimer *met;
    class cSearchMenu *mes;

    anyFont *f1,*f2,*f3,*f4,*f5;

    cSchedulesLock _schedulesLock;
    const cSchedule** schedArray;
    int schedArrayNum;
    int currentFirst;

    int evnum;
    class cEvent **ev1;
    class cEvent **ev2;
    class cEvent **ev3;
    int *fullHours;

    enum modes {SHOW,EDIT};
    enum modes curmode;

    unsigned short EDIT_curEvent;
    int EDIT_curChannel;
    int EDIT_curEVI;

    bool timeline_tested;
    bool timeline_found_conflict;

    int YSTART;
    int TimelineWidth;
    int ScheduleWidth;
    int ScheduleHeight;
    int Width;
    int Height;
    double Aspect;

    cEvent **ev4ch(int);
    void searchcEvt();

    void printLogo(const cSchedule *s,int p);
    void printHead(const cSchedule *s,int p);
    void showKeys(void);
    void showDatetime(void);
    void showTimeline(void);
    void showHeads(bool onlyBG=false);
    void showScheds(void);
    void showSched(cEvent **ev, tMagazineArea area);
    void calcSched(const cSchedule *s,cEvent **ev);
    void calcScheds(void);

    void colorworkaround(cBitmap *b);
    void output(void);
    void outputLR(void);

    void gotoUsertime(int u);
    void showHelp(void);

    void autoTimer(const class cEvent *EventInfo);

    void setTransparency(unsigned int *color);
    unsigned int clrSched1;
    unsigned int clrSched2;
    unsigned int clrTimeline1;
    unsigned int clrTimeline2;
    unsigned int clrNames;
    unsigned int clrText;

    const cEvent *GetEventAfter(const cSchedule *s, time_t StartTime, time_t EndTime) const;

    time_t currentFirstTime;
    void setcurrentFirstTime(time_t now);

public:
    static const class cEvent *getNext(const cSchedule *s,const cEvent *e);
    static const class cEvent *getPrev(const cSchedule *s,const cEvent *e);

    magazine(class cPlugin *);
    virtual ~magazine();
    virtual void Show(void);
    virtual eOSState ProcessKey(eKeys Key);
};

#endif