summaryrefslogtreecommitdiff
path: root/views/displaypluginview.c
blob: 89ff94c1f9d0cd83d7f57e92f13c71f2ac395c5e (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
#define __STL_CONFIG_H
#include "displaypluginview.h"

cDisplayPluginView::cDisplayPluginView(cTemplateView *tmplView) : cView(tmplView) {
    intTokens = NULL;
    stringTokens = NULL;
    loopTokens = NULL;
    DeleteOsdOnExit();
    SetFadeTime(tmplView->GetNumericParameter(ptFadeTime));
}

cDisplayPluginView::~cDisplayPluginView() {
    CancelSave();
    FadeOut();
}

bool cDisplayPluginView::createOsd(void) {
    cRect osdSize = tmplView->GetOsdSize();
    bool ok = CreateOsd(cOsd::OsdLeft() + osdSize.X(),
                        cOsd::OsdTop() + osdSize.Y(),
                        osdSize.Width(),
                        osdSize.Height());
    return ok;
}

void cDisplayPluginView::DisplayViewElement(int id) {
    if (!intTokens || !stringTokens || !loopTokens)
        return;
    DrawViewElement((eViewElement)id, stringTokens, intTokens, loopTokens);
}

void cDisplayPluginView::InitGrids(int viewGridID) {
    map< int, cViewGrid* >::iterator hit = viewGrids.find(viewGridID);
    if (hit != viewGrids.end()) {
        delete hit->second;
        viewGrids.erase(hit);
    }
    cTemplateViewGrid *tmplGrid = tmplView->GetViewGrid(viewGridID);
    cViewGrid *grid = new cViewGrid(tmplGrid);
    viewGrids.insert(pair< int, cViewGrid* >(viewGridID, grid));
}

void cDisplayPluginView::SetGrid(int viewGridID, long gridID, 
                                 double x, double y, double width, double height, 
                                 map<string,int> *intTokens, map<string,string> *stringTokens) {
    map< int, cViewGrid* >::iterator hit = viewGrids.find(viewGridID);
    if (hit != viewGrids.end())
        (hit->second)->SetGrid(gridID, x, y, width, height, intTokens, stringTokens);
}

void cDisplayPluginView::SetGridCurrent(int viewGridID, long gridID, bool current) {
    map< int, cViewGrid* >::iterator hit = viewGrids.find(viewGridID);
    if (hit != viewGrids.end())
        (hit->second)->SetCurrent(gridID, current);
}

void cDisplayPluginView::DeleteGrid(int viewGridID, long gridID) {
    map< int, cViewGrid* >::iterator hit = viewGrids.find(viewGridID);
    if (hit == viewGrids.end())
        return;
    (hit->second)->Delete(gridID);    
}

void cDisplayPluginView::DisplayGrids(int viewGridID) {
    map< int, cViewGrid* >::iterator hit = viewGrids.find(viewGridID);
    if (hit == viewGrids.end())
        return;
    (hit->second)->Render();
}

void cDisplayPluginView::ClearGrids(int viewGridID) {
    map< int, cViewGrid* >::iterator hit = viewGrids.find(viewGridID);
    if (hit == viewGrids.end())
        return;
    (hit->second)->Clear();
}

void cDisplayPluginView::Action(void) {
    SetInitFinished();
    FadeIn();
    DoFlush();
    cView::Action();
}