summaryrefslogtreecommitdiff
path: root/main_menu.c
blob: aeaceb95f344bfb5fde494a5da19a864f2e96a16 (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

#include <vdr/plugin.h>

#include "ambiservice.h"
#include "main_menu.h"
#include "config.h"
#include "common.h"

cBoblightPluginMenu::cBoblightPluginMenu(const char* title, cPluginBoblight* aPlugin)
{
   plugin = aPlugin;

   Create();
}

void cBoblightPluginMenu::Create(void) {
   SetMenuCategory(mcPluginSetup);
   Clear();

   Add(new cMenuEditStraItem(tr("3D Mode"), &cfg.osd3DMode, cAmbiService::osdCount, cAmbiService::osd3dModes));
   Add(new cMenuEditStraItem(tr("View Mode"), &cfg.viewMode, cAmbiService::vmCount, cAmbiService::viewModes));
   Add(new cMenuEditStraItem(tr("Startup View Mode"), &cfg.startupViewMode, cAmbiService::vmCount, cAmbiService::viewModes));

   Add(new cMenuEditIntItem(tr("Fixed Color Red"), &cfg.fixedR, 0, 255));
   Add(new cMenuEditIntItem(tr("Fixed Color Green"), &cfg.fixedG, 0, 255));
   Add(new cMenuEditIntItem(tr("Fixed Color Blue"), &cfg.fixedB, 0, 255));

   SetHelp(0, 0, 0, 0);
   Display();
}

void cBoblightPluginMenu::Store() {
	plugin->Save();
}

//***************************************************************************
// Process Key
//***************************************************************************

eOSState cBoblightPluginMenu::ProcessKey(eKeys key)
{
   eOSState state = cOsdMenu::ProcessKey(key);
   
   if (state != osUnknown)
      return state;

   if (key == kLeft || key == kRight)
   {
      if (cfg.viewMode == cAmbiService::vmDetached && plugin->isRunning())
         plugin->stopAtmo();
      else if (cfg.viewMode != cAmbiService::vmDetached && !plugin->isRunning())
         plugin->startAtmo();
   }

   if (key == kOk)
   {
      plugin->Save();
      return osEnd;
   }

   return state;
}