summaryrefslogtreecommitdiff
path: root/nopacity.c
blob: f75d3b925f52ad8601aadd25799d242a69000b8b (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
#include <vdr/osd.h>
#include <vdr/menu.h>

#include "nopacity.h"
#include "config.h"
#include "displaychannel.h"
#include "displaymenuview.h"
#include "displaymenu.h"
#include "displayreplay.h"
#include "displayvolume.h"
#include "displaytracks.h"
#include "displaymessage.h"

cNopacity::cNopacity(cImageCache *imgCache) : cSkin("nOpacity", &::Theme) {
    displayMenu = NULL;
    config.LoadThemeSpecificConfigs();
    config.SetThemeSpecificDefaults();
    config.SetThemeSetup();
    config.SetPathes();
    config.SetFontName();
    geoManager = new cGeometryManager();
    geoManager->SetGeometry();
    fontManager = new cFontManager();
    fontManager->SetFonts();
    this->imgCache = imgCache;
    imgCache->CreateCache();
}

const char *cNopacity::Description(void) {
  return "nOpacity";
}

cSkinDisplayChannel *cNopacity::DisplayChannel(bool WithInfo) {
    ReloadCaches();
    return new cNopacityDisplayChannel(imgCache, WithInfo);
}

cSkinDisplayMenu *cNopacity::DisplayMenu(void) {
    ReloadCaches();
    cNopacityDisplayMenu *menu = new cNopacityDisplayMenu(imgCache);
    displayMenu = menu;
    return menu;
}

cSkinDisplayReplay *cNopacity::DisplayReplay(bool ModeOnly) {
  ReloadCaches();
  return new cNopacityDisplayReplay(imgCache, ModeOnly);
}

cSkinDisplayVolume *cNopacity::DisplayVolume(void) {
  ReloadCaches();
  return new cNopacityDisplayVolume(imgCache);
}

cSkinDisplayTracks *cNopacity::DisplayTracks(const char *Title, int NumTracks, const char * const *Tracks) {
  ReloadCaches();
  return new cNopacityDisplayTracks(imgCache, Title, NumTracks, Tracks);
}

cSkinDisplayMessage *cNopacity::DisplayMessage(void) {
  ReloadCaches();
  return new cNopacityDisplayMessage(imgCache);
}

void cNopacity::ReloadCaches(void) {
    if (geoManager->GeometryChanged() || imgCache->ThemeChanged()) {
        int start = cTimeMs::Now();
        config.LoadDefaults();
        config.SetThemeSpecificDefaults();
        config.SetThemeSetup();
        config.SetFontName();
        geoManager->SetGeometry();
        fontManager->DeleteFonts();
        fontManager->SetFonts();
        imgCache->Reload();
        dsyslog("nopacity: Cache reloaded in %d ms", int(cTimeMs::Now()-start));
    }
}