]> git.vomp.tv Git - vompclient.git/commitdiff
Options view files added, new remote type supported
authorChris Tallon <chris@vomp.tv>
Fri, 5 Aug 2005 23:57:05 +0000 (23:57 +0000)
committerChris Tallon <chris@vomp.tv>
Fri, 5 Aug 2005 23:57:05 +0000 (23:57 +0000)
26 files changed:
Makefile
command.cc
led.cc
led.h
player.cc
remote.cc
remote.h
vchannellist.cc
vconnect.cc
vlivebanner.cc
voptions.cc [new file with mode: 0644]
voptions.h [new file with mode: 0644]
vquestion.cc
vradiolive.cc
vrecordinglist.cc
vrecordingmenu.cc
vserverselect.cc
vvideolive.cc
vvolume.cc
vwelcome.cc
vwelcome.h
wjpeg.cc
woptionbox.cc [new file with mode: 0644]
woptionbox.h [new file with mode: 0644]
wsymbol.cc
wsymbol.h

index 1ccbb7df84655855566981694193e5f345499147..cef5d10fe9bf0811df69f38b0fa4a8d4c25d08fb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -15,8 +15,8 @@ OBJECTS = main.o command.o log.o remote.o led.o mtd.o video.o audio.o tcp.o dire
           list.o queue.o node.o recording.o channel.o message.o playerradio.o messagequeue.o \
           view.o vinfo.o vwallpaper.o vvolume.o vrecordinglist.o vlivebanner.o vmute.o \
           vrecordingmenu.o vquestion.o vchannellist.o vwelcome.o vvideolive.o vvideorec.o vradiolive.o \
-          vchannelselect.o vserverselect.o colour.o vconnect.o \
-          wselectlist.o wjpeg.o wsymbol.o wbutton.o \
+          vchannelselect.o vserverselect.o colour.o vconnect.o voptions.o \
+          wselectlist.o wjpeg.o wsymbol.o wbutton.o woptionbox.o \
           fonts/helvB24.o fonts/helvB18.o
 
 .PHONY: clean fresh all install strip
index 06ae398e3725a79b37dbc78dde1912620246bc8e..22cf675c6a2b67fc9e666d295c8e48f293de2f35 100644 (file)
@@ -123,9 +123,9 @@ void Command::run()
   while(irun)
   {
     button = remote->getButtonPress(2);  // FIXME why is this set to 2 and not 0? so it can quit
-    if ((button == Remote::NONE) || (button == Remote::UNKNOWN)) continue;
+    if ((button == Remote::NA_NONE) || (button == Remote::NA_UNKNOWN)) continue;
 
-    if (button != Remote::SIGNAL) handleCommand(button);
+    if (button != Remote::NA_SIGNAL) handleCommand(button);
     processMessageQueue();
   }
 }
@@ -170,8 +170,10 @@ void Command::handleCommand(int button)
 
   switch(button)
   {
-    case Remote::LEFT:
-    case Remote::RIGHT:
+    case Remote::DF_LEFT:
+    case Remote::DF_RIGHT:
+    case Remote::VOLUMEUP:
+    case Remote::VOLUMEDOWN:
     {
       VVolume* v = new VVolume();
       v->handleCommand(button); // this will draw+show
@@ -298,10 +300,6 @@ void Command::doJustConnected(VConnect* vconnect)
     }
   }
 
-  // Save power state = on
-
-  vdr->configSave("General", "Last Power State", "On");
-
 
   // Go S-Video if config says so
 
@@ -325,9 +323,43 @@ void Command::doJustConnected(VConnect* vconnect)
     logger->log("Command", Log::INFO, "Config TV/S-Video not found");
   }
 
-  // s video done
+  // Set remote type
+
+  char* remoteType = vdr->configLoad("General", "Remote type");
+
+  if (remoteType)
+  {
+    if (!strcasecmp(remoteType, "New"))
+    {
+      logger->log("Command", Log::INFO, "Switching to New remote type");
+      remote->setRemoteType(Remote::NEWREMOTE);
+    }
+    else
+    {
+      logger->log("Command", Log::INFO, "Switching to Old remote type");
+      remote->setRemoteType(Remote::OLDREMOTE);
+    }
+  }
+  else
+  {
+    logger->log("Command", Log::INFO, "Config General/Remote type not found");
+    remote->setRemoteType(Remote::OLDREMOTE);
+  }
+
+  // Save power state = on
+
+  vdr->configSave("General", "Last Power State", "On");
+
+  // config done
 
   VWelcome* vw = new VWelcome();
   viewman->add(vw);
   viewman->redrawAll();
+
+/*
+  handleCommand(Remote::DOWN);
+  handleCommand(Remote::DOWN);
+  handleCommand(Remote::DOWN);
+  handleCommand(Remote::OK);
+*/
 }
diff --git a/led.cc b/led.cc
index 8f4936445abfd717974d2fc51b4f089fca06b8a9..a4bffbfd9cf3c3773a2120fb0d36d9e31eb418dd 100644 (file)
--- a/led.cc
+++ b/led.cc
@@ -61,6 +61,7 @@ int Led::on()
   if (!initted) return 0;
 
   int result = ioctl(device, IR_SET_LED, 0);
+  Log::getInstance()->log("LED", Log::DEBUG, "led on %i %i", device, result);
   if (result >= 0) return 1;
   else return 0;
 }
@@ -70,6 +71,7 @@ int Led::off()
   if (!initted) return 0;
 
   int result = ioctl(device, IR_SET_LED, 1);
+  Log::getInstance()->log("LED", Log::DEBUG, "led off %i %i", device, result);
   if (result >= 0) return 1;
   else return 0;
 }
diff --git a/led.h b/led.h
index 4b67e0b45cd6aaf5fe7d666eebebfc78358fa94f..67cf380f923ce760282e61012936e3b96dfd1c35 100644 (file)
--- a/led.h
+++ b/led.h
@@ -26,6 +26,8 @@
 
 #include "stb.h"
 
+#include "log.h" // temp while fix led on bug!
+
 class Led
 {
   public:
index 4cbef18a9219b0ffef2061b1b3394e1876e91af8..27bb9b7d922a3cce0948b0137b6afc67eb117cae 100644 (file)
--- a/player.cc
+++ b/player.cc
@@ -215,11 +215,13 @@ void Player::stop()
   }
 
   playing = 0;
+  paused = 0;
 
   threadStop();
   video->stop();
   video->blank();
   audio->stop();
+  audio->unPause();
   vfeed.stop();
   afeed.stop();
   video->reset();
index c589ab1300ef1e6eb553f19d496b82e2a9859cf8..a0ed018aef5d658a4de9a70a5800644cc0f03da6 100644 (file)
--- a/remote.cc
+++ b/remote.cc
@@ -30,6 +30,7 @@ Remote::Remote()
   device = 0;
   tv.tv_sec = 0;
   tv.tv_usec = 0;
+  remoteType = OLDREMOTE;
 }
 
 Remote::~Remote()
@@ -72,6 +73,12 @@ int Remote::getDevice()
   return device;
 }
 
+void Remote::setRemoteType(UCHAR newType)
+{
+  if ((newType != OLDREMOTE) && (newType != NEWREMOTE)) return;
+  remoteType = newType;
+}
+
 UCHAR Remote::getButtonPress(int waitType)
 {
   /* how = 0 - block
@@ -117,15 +124,24 @@ UCHAR Remote::getButtonPress(int waitType)
   // 0 = nothing happened
   // 1 = data arrived (actually num of descriptors that changed)
   // other value = signal or error
-  if (retval == 0) return NONE;
-  if (retval == -1) return SIGNAL;
+  if (retval == 0) return NA_NONE;
+  if (retval == -1) return NA_SIGNAL;
 
   int count = read(device, &input, 4);
   if (count == 4)
   {
     input = (0X00FF0000 & input) >> 16;
     Log::getInstance()->log("Remote", Log::DEBUG, "Button %i", input);
+
+    if (remoteType == OLDREMOTE)
+    {
+      if (input == VOLUMEDOWN) return DF_LEFT;
+      if (input == VOLUMEUP) return DF_RIGHT;
+      if (input == CHANNELUP) return DF_UP;
+      if (input == CHANNELDOWN) return DF_DOWN;
+    }
+
     return (UCHAR) input;
   }
-  return UNKNOWN;
+  return NA_UNKNOWN;
 }
index 440718ca773e0e4f098b2cfcc36c2e13167c7cf3..799f62fbb364ea334ebd402aa9a2260a417ad67f 100644 (file)
--- a/remote.h
+++ b/remote.h
@@ -38,8 +38,25 @@ class Remote
     int init(char *devName);
     int shutdown();
     int getDevice();
+    void setRemoteType(UCHAR type);
     UCHAR getButtonPress(int how);
 
+    // Not buttons
+    const static UCHAR NA_NONE     = 98;
+    const static UCHAR NA_UNKNOWN  = 99;
+    const static UCHAR NA_SIGNAL   = 100;
+    const static UCHAR DF_UP       = 94;
+    const static UCHAR DF_DOWN     = 95;
+    const static UCHAR DF_LEFT     = 96;
+    const static UCHAR DF_RIGHT    = 97;
+
+    // Problem common buttons
+    const static UCHAR VOLUMEUP    = 16;
+    const static UCHAR VOLUMEDOWN  = 17;
+    const static UCHAR CHANNELUP   = 32;
+    const static UCHAR CHANNELDOWN = 33;
+
+    // Common buttons
     const static UCHAR ZERO        = 0;
     const static UCHAR ONE         = 1;
     const static UCHAR TWO         = 2;
@@ -58,13 +75,8 @@ class Remote
     const static UCHAR GREEN       = 46;
     const static UCHAR YELLOW      = 56;
     const static UCHAR BLUE        = 41;
-    const static UCHAR LEFT        = 17;
-    const static UCHAR RIGHT       = 16;
-    const static UCHAR UP          = 32;
-    const static UCHAR DOWN        = 33;
     const static UCHAR MUTE        = 15;
-    const static UCHAR OSD         = 12;
-    const static UCHAR FULL        = 60;
+    const static UCHAR RADIO       = 12; // The unlabelled button on old
     const static UCHAR REVERSE     = 50;
     const static UCHAR PLAY        = 53;
     const static UCHAR FORWARD     = 52;
@@ -74,15 +86,34 @@ class Remote
     const static UCHAR SKIPBACK    = 36;
     const static UCHAR SKIPFORWARD = 30;
     const static UCHAR OK          = 37;
-    const static UCHAR NONE        = 98;
-    const static UCHAR UNKNOWN     = 99;
-    const static UCHAR SIGNAL      = 100;
+
+    // Old remote only
+    const static UCHAR FULL        = 60;
+
+    // New remote only
+    const static UCHAR TV          = 28;
+    const static UCHAR VIDEOS      = 24;
+    const static UCHAR MUSIC       = 25;
+    const static UCHAR PICTURES    = 26;
+    const static UCHAR GUIDE       = 27;
+    const static UCHAR UP          = 20;
+    const static UCHAR DOWN        = 21;
+    const static UCHAR LEFT        = 22;
+    const static UCHAR RIGHT       = 23;
+    const static UCHAR PREVCHANNEL = 18;
+    const static UCHAR STAR        = 10;
+    const static UCHAR HASH        = 14;
+
+    // Remote types
+    const static UCHAR OLDREMOTE   = 1;
+    const static UCHAR NEWREMOTE   = 2;
 
   private:
     static Remote* instance;
     int initted;
     int device;
     struct timeval tv;
+    UCHAR remoteType;
 };
 
 #endif
index 17a98d2290651b996614935ec1661e43e9b73f42..1dcdeabdc6484b17d8f0950dd3fd1ff4daa1ebd1 100644 (file)
@@ -134,84 +134,89 @@ void VChannelList::doShowingBar()
 
 int VChannelList::handleCommand(int command)
 {
-  if (command == Remote::UP)
+  switch(command)
   {
-    sl.up();
-    sl.draw();
-
-    doShowingBar();
-    show();
-    return 2;
-  }
-  else if (command == Remote::DOWN)
-  {
-    sl.down();
-    sl.draw();
+    case Remote::DF_UP:
+    case Remote::UP:
+    {
+      sl.up();
+      sl.draw();
 
-    doShowingBar();
-    show();
-    return 2;
-  }
-  else if (command == Remote::SKIPBACK)
-  {
-    sl.pageUp();
-    sl.draw();
+      doShowingBar();
+      show();
+      return 2;
+    }
+    case Remote::DF_DOWN:
+    case Remote::DOWN:
+    {
+      sl.down();
+      sl.draw();
 
-    doShowingBar();
-    show();
-    return 2;
-  }
-  else if (command == Remote::SKIPFORWARD)
-  {
-    sl.pageDown();
-    sl.draw();
+      doShowingBar();
+      show();
+      return 2;
+    }
+    case Remote::SKIPBACK:
+    {
+      sl.pageUp();
+      sl.draw();
 
-    doShowingBar();
-    show();
-    return 2;
-  }
-  else if (command == Remote::OK)
-  {
-    Channel* chan = NULL;
-    if (chanList)
+      doShowingBar();
+      show();
+      return 2;
+    }
+    case Remote::SKIPFORWARD:
     {
-      int currentOption = sl.getCurrentOption();
-      chanList->reset();
+      sl.pageDown();
+      sl.draw();
 
-      while((chan = (Channel*)chanList->getCurrent()))
+      doShowingBar();
+      show();
+      return 2;
+    }
+    case Remote::OK:
+    {
+      Channel* chan = NULL;
+      if (chanList)
       {
-        if (currentOption == chan->index) break;
-        chanList->next();
+        int currentOption = sl.getCurrentOption();
+        chanList->reset();
+
+        while((chan = (Channel*)chanList->getCurrent()))
+        {
+          if (currentOption == chan->index) break;
+          chanList->next();
+        }
       }
-    }
 
-    if (chan == NULL) return 2;
+      if (chan == NULL) return 2;
 
-    View* v = NULL;
+      View* v = NULL;
 
-// stop radio
-//    if (chan->type == VDR::RADIO) return 2;
+  // stop radio
+  //    if (chan->type == VDR::RADIO) return 2;
 
-    if (chan->type == VDR::VIDEO)
-    {
-      v = new VVideoLive(chanList);
-      ((VVideoLive*)v)->setChannel(chan->number);
+      if (chan->type == VDR::VIDEO)
+      {
+        v = new VVideoLive(chanList);
+        ((VVideoLive*)v)->setChannel(chan->number);
+      }
+      else if (chan->type == VDR::RADIO)
+      {
+        v = new VRadioLive(chanList);
+        ((VRadioLive*)v)->setChannel(chan->number);
+      }
+
+      ViewMan::getInstance()->addNoLock(v);
+      v->draw();
+      v->show();
+
+      return 2;
     }
-    else if (chan->type == VDR::RADIO)
+    case Remote::BACK:
     {
-      v = new VRadioLive(chanList);
-      ((VRadioLive*)v)->setChannel(chan->number);
+      return 4;
     }
-
-    ViewMan::getInstance()->addNoLock(v);
-    v->draw();
-    v->show();
-
-    return 2;
-  }
-  else if (command == Remote::BACK)
-  {
-    return 4;
   }
   // stop command getting to any more views
   return 1;
index 79abef78a28afebb616561e274b7e55871bb252a..0a31bf8db9ade01121b8f78dfc75094c391a281b 100644 (file)
@@ -93,8 +93,7 @@ void VConnect::threadMethod()
       threadWaitForSignal();
     }
 
-    printf("server selected %i\n", selectedServer);
-
+    logger->log("Command", Log::NOTICE, "Connecting to server at %s", serverIPs[selectedServer]);
     vdr->setServerIP(serverIPs[selectedServer]);
 
     // Clear the serverIPs vector
@@ -104,7 +103,6 @@ void VConnect::threadMethod()
     }
     serverIPs.clear();
 
-    logger->log("Command", Log::NOTICE, "Connecting to server at %s", serverIPs[selectedServer]);
     setMainText("\n                     Connecting to VDR");
     draw();
     show();
index 278e8ef0d5dcc6ccc233519df29ef18d362d7eb5..bd2db8a211303ae8cd2f33466cb564ead5a58be0 100644 (file)
@@ -75,6 +75,7 @@ int VLiveBanner::handleCommand(int command)
     {
       return 4;
     }
+    case Remote::DF_UP:
     case Remote::UP:
     {
       sl.up();
@@ -83,6 +84,7 @@ int VLiveBanner::handleCommand(int command)
       show();
       return 2;
     }
+    case Remote::DF_DOWN:
     case Remote::DOWN:
     {
       sl.down();
diff --git a/voptions.cc b/voptions.cc
new file mode 100644 (file)
index 0000000..9c80dde
--- /dev/null
@@ -0,0 +1,244 @@
+/*
+    Copyright 2004-2005 Chris Tallon
+
+    This file is part of VOMP.
+
+    VOMP is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    VOMP is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with VOMP; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include "voptions.h"
+
+VOptions::VOptions()
+{
+  setDimensions(190, 460);
+
+  if (Video::getInstance()->getFormat() == Video::PAL)
+  {
+    setScreenPos(140, 170);
+  }
+  else
+  {
+    setScreenPos(130, 140);
+  }
+
+  setBackgroundColour(Colour::VIEWBACKGROUND);
+  setTitleBarOn(1);
+  setTitleBarColour(Colour::TITLEBARBACKGROUND);
+  setTitleText("Options");
+
+  int fontHeight = surface->getFontHeight();
+
+  optionBox[0].setScreenPos(screenX + 290, screenY + 45);
+  optionBox[0].setDimensions(fontHeight, 150);
+  optionBox[0].addOption("Old");
+  optionBox[0].addOption("New");
+
+  optionBox[1].setScreenPos(screenX + 290, screenY + 75);
+  optionBox[1].setDimensions(fontHeight, 150);
+  optionBox[1].addOption("RGB+composite");
+  optionBox[1].addOption("S-Video");
+
+  optionBox[2].setScreenPos(screenX + 290, screenY + 105);
+  optionBox[2].setDimensions(fontHeight, 150);
+  optionBox[2].addOption("On");
+  optionBox[2].addOption("Off");
+  optionBox[2].addOption("Last state");
+
+
+  char* config;
+  vdr = VDR::getInstance();
+
+
+  config = vdr->configLoad("General", "Remote type");
+  if (!config)
+  {
+    optionBox[0].setSelected("Old");
+  }
+  else if (!strcasecmp(config, "New"))
+  {
+    optionBox[0].setSelected("New");
+  }
+  else
+  {
+    optionBox[0].setSelected("Old");
+  }
+
+
+  config = vdr->configLoad("TV", "S-Video");
+  if (!config)
+  {
+    optionBox[1].setSelected("RGB+composite");
+  }
+  else if (!strcasecmp(config, "Yes"))
+  {
+    optionBox[1].setSelected("S-Video");
+  }
+  else
+  {
+    optionBox[1].setSelected("RGB+composite");
+  }
+
+
+  config = vdr->configLoad("General", "Power After Boot");
+  if (!config)
+  {
+    optionBox[2].setSelected("On");
+  }
+  else if (!strcasecmp(config, "On")) // just for completeness
+  {
+    optionBox[2].setSelected("On");
+  }
+  else if (!strcasecmp(config, "Off"))
+  {
+    optionBox[2].setSelected("Off");
+  }
+  else if (!strcasecmp(config, "Last state"))
+  {
+    optionBox[2].setSelected("Last state");
+  }
+  else
+  {
+    optionBox[2].setSelected("On");
+  }
+
+
+  selectedOption = 0;
+  optionBox[0].setActive(1);
+}
+
+VOptions::~VOptions()
+{
+}
+
+void VOptions::draw()
+{
+  View::draw();
+
+  WSymbol ws;
+  Colour cl;
+
+  drawText("Remote control type", 10, 45, Colour::LIGHTTEXT);
+  drawText("TV connection type", 10, 75, Colour::LIGHTTEXT);
+  drawText("Power state after bootup", 10, 105, Colour::LIGHTTEXT);
+
+  drawText("Press back to exit, <, > or [ok] to change", 10, 160, Colour::LIGHTTEXT);
+
+  for (UINT i = 0; i < numOptions; i++)
+  {
+    if (i == selectedOption) cl = Colour::SELECTHIGHLIGHT;
+    else cl = Colour::BUTTONBACKGROUND;
+
+    ws.nextSymbol = WSymbol::LEFTARROW;
+    ws.setScreenPos(screenX + 272, screenY + 47 + (i * 30));
+    ws.draw(cl);
+    ws.nextSymbol = WSymbol::RIGHTARROW;
+    ws.setScreenPos(screenX + 442, screenY + 47 + (i * 30));
+    ws.draw(cl);
+    optionBox[i].draw();
+    optionBox[i].show();
+  }
+
+}
+
+int VOptions::handleCommand(int command)
+{
+  switch(command)
+  {
+    case Remote::DF_UP:
+    case Remote::UP:
+    {
+      if (selectedOption > 0)
+      {
+        optionBox[selectedOption].setActive(0);
+        --selectedOption;
+        optionBox[selectedOption].setActive(1);
+        draw();
+        show();
+      }
+      return 2;
+    }
+    case Remote::DF_DOWN:
+    case Remote::DOWN:
+    {
+      if (selectedOption < (numOptions - 1))
+      {
+        optionBox[selectedOption].setActive(0);
+        ++selectedOption;
+        optionBox[selectedOption].setActive(1);
+        draw();
+        show();
+      }
+      return 2;
+    }
+    case Remote::DF_LEFT:
+    case Remote::LEFT:
+    {
+      optionBox[selectedOption].left();
+      draw();
+      show();
+      return 2;
+    }
+    case Remote::DF_RIGHT:
+    case Remote::RIGHT:
+    {
+      optionBox[selectedOption].right();
+      draw();
+      show();
+      return 2;
+    }
+    case Remote::BACK:
+    {
+      doSave();
+      return 4;
+    }
+    case Remote::OK:
+    {
+      optionBox[selectedOption].cycle();
+      draw();
+      show();
+    }
+  }
+
+  return 1;
+}
+
+void VOptions::doSave()
+{
+  char* remoteType = optionBox[0].getSelected();
+  vdr->configSave("General", "Remote type", remoteType);
+  if (!strcmp(remoteType, "New"))
+  {
+    Remote::getInstance()->setRemoteType(Remote::NEWREMOTE);
+  }
+  else
+  {
+    Remote::getInstance()->setRemoteType(Remote::OLDREMOTE);
+  }
+
+  char* tvconnection = optionBox[1].getSelected();
+  if (!strcmp(tvconnection, "S-Video"))
+  {
+    vdr->configSave("TV", "S-Video", "Yes");
+    Video::getInstance()->setConnection(Video::SVIDEO);
+  }
+  else
+  {
+    vdr->configSave("TV", "S-Video", "No");
+    Video::getInstance()->setConnection(Video::COMPOSITERGB);
+  }
+
+  char* powerState = optionBox[2].getSelected();
+  vdr->configSave("General", "Power After Boot", powerState);
+}
diff --git a/voptions.h b/voptions.h
new file mode 100644 (file)
index 0000000..2ae5c1f
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+    Copyright 2004-2005 Chris Tallon
+
+    This file is part of VOMP.
+
+    VOMP is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    VOMP is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with VOMP; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#ifndef VOPTIONS_H
+#define VOPTIONS_H
+
+#include "view.h"
+#include "remote.h"
+#include "viewman.h"
+#include "vdr.h"
+#include "colour.h"
+#include "video.h"
+#include "woptionbox.h"
+#include "wsymbol.h"
+
+class VOptions : public View
+{
+  public:
+    VOptions();
+    ~VOptions();
+
+    int handleCommand(int command);
+    void draw();
+
+  private:
+    void doSave();
+
+    const static UINT numOptions = 3;
+    UINT selectedOption;
+    WOptionBox optionBox[numOptions];
+    VDR* vdr;
+
+};
+
+#endif
index d15a5629e7b4467ef22154ee4a4a30faaf0d2cb4..f0c2dab303ab53c648c95d08255bc3ca8ee0d033 100644 (file)
@@ -73,37 +73,41 @@ void VQuestion::swap()
 
 int VQuestion::handleCommand(int command)
 {
-  if (command == Remote::LEFT)
+  switch(command)
   {
-    swap();
-    draw();
-    show();
-    return 2;
+    case Remote::DF_LEFT:
+    case Remote::LEFT:
+    {
+      swap();
+      draw();
+      show();
+      return 2;
+    }
+    case Remote::DF_RIGHT:
+    case Remote::RIGHT:
+    {
+      swap();
+      draw();
+      show();
+      return 2;
+    }
+    case Remote::BACK:
+    {
+      return 4;
+    }
+    case Remote::OK:
+    {
+      if (selectedOption != YES) return 4;
+
+      Message* m = new Message();
+      m->from = this;
+      m->to = parent;
+      m->message = Message::QUESTION_YES;
+      ViewMan::getInstance()->postMessage(m);
+
+      return 4;
+    }
   }
-  else if (command == Remote::RIGHT)
-  {
-    swap();
-    draw();
-    show();
-    return 2;
-  }
-  else if (command == Remote::BACK)
-  {
-    return 4;
-  }
-  else if (command == Remote::OK)
-  {
-    if (selectedOption != YES) return 4;
-
-    Message* m = new Message();
-    m->from = this;
-    m->to = parent;
-    m->message = Message::QUESTION_YES;
-    ViewMan::getInstance()->postMessage(m);
-
-    return 4;
-  }
-
   return 1;
 }
 
index 92734374f8314020074f503ec0feec03b0eaac68..c0e57ef5fead8079e16b6dbcdc00be2132a965d2 100644 (file)
@@ -54,6 +54,7 @@ int VRadioLive::handleCommand(int command)
       vdr->stopStreaming();
       return 4;
     }
+    case Remote::DF_UP:
     case Remote::UP:
     {
       player->stop();
@@ -63,6 +64,7 @@ int VRadioLive::handleCommand(int command)
       player->play();
       return 2;
     }
+    case Remote::DF_DOWN:
     case Remote::DOWN:
     {
       player->stop();
index 59a9135126ca52a259c3540cabf7cb8638985493..8dd20e40cc6f87c48a137023a946985a5315ac48 100644 (file)
@@ -266,93 +266,98 @@ Recording* VRecordingList::getCurrentOptionRecording()
 
 int VRecordingList::handleCommand(int command)
 {
-  if (command == Remote::UP)
+  switch(command)
   {
-    sl.up();
-    sl.draw();
-
-    doShowingBar();
-    show();
-    return 2;
-  }
-  else if (command == Remote::DOWN)
-  {
-    sl.down();
-    sl.draw();
+    case Remote::DF_UP:
+    case Remote::UP:
+    {
+      sl.up();
+      sl.draw();
 
-    doShowingBar();
-    show();
-    return 2;
-  }
-  else if (command == Remote::SKIPBACK)
-  {
-    sl.pageUp();
-    sl.draw();
+      doShowingBar();
+      show();
+      return 2;
+    }
+    case Remote::DF_DOWN:
+    case Remote::DOWN:
+    {
+      sl.down();
+      sl.draw();
 
-    doShowingBar();
-    show();
-    return 2;
-  }
-  else if (command == Remote::SKIPFORWARD)
-  {
-    sl.pageDown();
-    sl.draw();
+      doShowingBar();
+      show();
+      return 2;
+    }
+    case Remote::SKIPBACK:
+    {
+      sl.pageUp();
+      sl.draw();
 
-    doShowingBar();
-    show();
-    return 2;
-  }
-  else if (command == Remote::OK)
-  {
-    if (sl.getNumOptions() == 0) return 2;
+      doShowingBar();
+      show();
+      return 2;
+    }
+    case Remote::SKIPFORWARD:
+    {
+      sl.pageDown();
+      sl.draw();
 
-    // Check to see if it is a sub directory
-    Directory* curDir;
-    for(recDir->dirList->reset(); (curDir = (Directory*)recDir->dirList->getCurrent()); recDir->dirList->next())
+      doShowingBar();
+      show();
+      return 2;
+    }
+    case Remote::OK:
     {
-      if (curDir->index == sl.getCurrentOption())
+      if (sl.getNumOptions() == 0) return 2;
+
+      // Check to see if it is a sub directory
+      Directory* curDir;
+      for(recDir->dirList->reset(); (curDir = (Directory*)recDir->dirList->getCurrent()); recDir->dirList->next())
       {
-        VRecordingList* sub = new VRecordingList();
-        sub->setDir(curDir);
-        ViewMan::getInstance()->addNoLock(sub);
+        if (curDir->index == sl.getCurrentOption())
+        {
+          VRecordingList* sub = new VRecordingList();
+          sub->setDir(curDir);
+          ViewMan::getInstance()->addNoLock(sub);
 
-        sub->draw();
-        sub->show();
+          sub->draw();
+          sub->show();
 
-        return 2;
+          return 2;
+        }
       }
-    }
 
-    // check to see if it's a recording
-    Recording* current;
-    for(recDir->recList->reset(); (current = (Recording*)recDir->recList->getCurrent()); recDir->recList->next())
-    {
-      if (current->index == sl.getCurrentOption())
+      // check to see if it's a recording
+      Recording* current;
+      for(recDir->recList->reset(); (current = (Recording*)recDir->recList->getCurrent()); recDir->recList->next())
       {
-        Log::getInstance()->log("VRecordingList", Log::DEBUG, "Found the option you pointed at. %s %s", current->getProgName(), current->fileName);
-
-        VRecordingMenu* v = new VRecordingMenu();
-        v->setParent(this);
-        v->setRecording(current);
-        ViewMan::getInstance()->addNoLock(v);
-        v->draw();
-        v->show();
-        return 2;
+        if (current->index == sl.getCurrentOption())
+        {
+          Log::getInstance()->log("VRecordingList", Log::DEBUG, "Found the option you pointed at. %s %s", current->getProgName(), current->fileName);
+
+          VRecordingMenu* v = new VRecordingMenu();
+          v->setParent(this);
+          v->setRecording(current);
+          ViewMan::getInstance()->addNoLock(v);
+          v->draw();
+          v->show();
+          return 2;
+        }
       }
+      // should not get to here
+      return 1;
+    }
+    case Remote::BACK:
+    {
+      return 4;
+    }
+    case Remote::PLAY:
+    {
+      if (doPlay()) return 2;
+      return 1;
     }
-    // should not get to here
-    return 1;
-  }
-  else if (command == Remote::BACK)
-  {
-    return 4;
-  }
-  else if (command == Remote::PLAY)
-  {
-    if (doPlay()) return 2;
-    return 1;
-  }
 
+  }
   // stop command getting to any more views
   return 1;
 }
index 5212c2b7013dbc8fc256b54ddee30be5192b8785..bdf3af701b1bb3282d8d398c2f9ec16b3e1a75ee 100644 (file)
@@ -71,102 +71,106 @@ void VRecordingMenu::draw()
 
 int VRecordingMenu::handleCommand(int command)
 {
-  if (command == Remote::UP)
+  switch(command)
   {
-    sl.up();
-    sl.draw();
-    show();
-    return 2;
-  }
-  else if (command == Remote::DOWN)
-  {
-    sl.down();
-    sl.draw();
-    show();
-    return 2;
-  }
-  else if (command == Remote::OK)
-  {
-    if (sl.getCurrentOption() == 0)
+    case Remote::DF_UP:
+    case Remote::UP:
     {
-      Message* m = new Message();
-      m->from = this;
-      m->to = vRecList;
-      m->message = Message::PLAY_SELECTED_RECORDING;
-      ViewMan::getInstance()->postMessage(m);
-      return 4;
+      sl.up();
+      sl.draw();
+      show();
+      return 2;
     }
-
-    if (sl.getCurrentOption() == 1)
+    case Remote::DF_DOWN:
+    case Remote::DOWN:
     {
-      Message* m = new Message();
-      m->from = this;
-      m->to = vRecList;
-      m->message = Message::RESUME_SELECTED_RECORDING;
-      ViewMan::getInstance()->postMessage(m);
-      return 4;
+      sl.down();
+      sl.draw();
+      show();
+      return 2;
     }
-
-    if (sl.getCurrentOption() == 2)
+    case Remote::OK:
     {
-      char* summary = VDR::getInstance()->getRecordingSummary(rec->fileName);
-
-      VInfo* vi = new VInfo();
-      vi->setTitleText("Programme summary");
-      vi->setBorderOn(1);
-      vi->setExitable();
-      if (summary) vi->setMainText(summary);
-      else vi->setMainText("Summary unavailable");
-      if (Video::getInstance()->getFormat() == Video::PAL)
+      if (sl.getCurrentOption() == 0)
       {
-        vi->setScreenPos(120, 130);
+        Message* m = new Message();
+        m->from = this;
+        m->to = vRecList;
+        m->message = Message::PLAY_SELECTED_RECORDING;
+        ViewMan::getInstance()->postMessage(m);
+        return 4;
       }
-      else
+
+      if (sl.getCurrentOption() == 1)
       {
-        vi->setScreenPos(110, 90);
+        Message* m = new Message();
+        m->from = this;
+        m->to = vRecList;
+        m->message = Message::RESUME_SELECTED_RECORDING;
+        ViewMan::getInstance()->postMessage(m);
+        return 4;
       }
-      vi->setDimensions(300, 490);
-
-      ViewMan::getInstance()->addNoLock(vi);
-      vi->draw();
-      vi->show();
 
-      if (summary) delete[] summary;
-
-      return 2;
-    }
-    else if (sl.getCurrentOption() == 3)
-    {
-      VQuestion* v = new VQuestion();
-      v->setParent(this);
-      v->setBackgroundColour(Colour::VIEWBACKGROUND);
-      v->setTitleBarColour(Colour::DANGER);
-      v->setTitleBarOn(1);
-      v->setBorderOn(1);
-      v->setTitleText("Delete recording");
-      v->setMainText("Are you sure you want to delete this recording?");
-      v->setDefault(VQuestion::NO);
-      if (Video::getInstance()->getFormat() == Video::PAL)
+      if (sl.getCurrentOption() == 2)
       {
-        v->setScreenPos(230, 160);
+        char* summary = VDR::getInstance()->getRecordingSummary(rec->fileName);
+
+        VInfo* vi = new VInfo();
+        vi->setTitleText("Programme summary");
+        vi->setBorderOn(1);
+        vi->setExitable();
+        if (summary) vi->setMainText(summary);
+        else vi->setMainText("Summary unavailable");
+        if (Video::getInstance()->getFormat() == Video::PAL)
+        {
+          vi->setScreenPos(120, 130);
+        }
+        else
+        {
+          vi->setScreenPos(110, 90);
+        }
+        vi->setDimensions(300, 490);
+
+        ViewMan::getInstance()->addNoLock(vi);
+        vi->draw();
+        vi->show();
+
+        if (summary) delete[] summary;
+
+        return 2;
       }
-      else
+      else if (sl.getCurrentOption() == 3)
       {
-        v->setScreenPos(220, 140);
+        VQuestion* v = new VQuestion();
+        v->setParent(this);
+        v->setBackgroundColour(Colour::VIEWBACKGROUND);
+        v->setTitleBarColour(Colour::DANGER);
+        v->setTitleBarOn(1);
+        v->setBorderOn(1);
+        v->setTitleText("Delete recording");
+        v->setMainText("Are you sure you want to delete this recording?");
+        v->setDefault(VQuestion::NO);
+        if (Video::getInstance()->getFormat() == Video::PAL)
+        {
+          v->setScreenPos(230, 160);
+        }
+        else
+        {
+          v->setScreenPos(220, 140);
+        }
+        v->setDimensions(180, 260);
+
+        ViewMan::getInstance()->addNoLock(v);
+        v->draw();
+        v->show();
+        return 2;
       }
-      v->setDimensions(180, 260);
-
-      ViewMan::getInstance()->addNoLock(v);
-      v->draw();
-      v->show();
-      return 2;
+    }
+    case Remote::BACK:
+    {
+      return 4;
     }
   }
-  else if (command == Remote::BACK)
-  {
-    return 4;
-  }
-
   // stop command getting to any more views
   return 1;
 }
index d0ae51f2cda566c4091616ca975c588c5e99e0a8..9dd91a39bee718c4c992f30f87bc49b852b1aa8f 100644 (file)
@@ -63,28 +63,33 @@ void VServerSelect::draw()
 
 int VServerSelect::handleCommand(int command)
 {
-  if (command == Remote::UP)
+  switch(command)
   {
-    sl.up();
-    sl.draw();
-    show();
-    return 2;
-  }
-  else if (command == Remote::DOWN)
-  {
-    sl.down();
-    sl.draw();
-    show();
-    return 2;
-  }
-  else if (command == Remote::OK)
-  {
-    Message* m = new Message();
-    m->to = parent;
-    m->message = Message::SERVER_SELECTED;
-    m->parameter = sl.getCurrentOption();
-    ViewMan::getInstance()->postMessage(m);
-    return 4;
+    case Remote::DF_UP:
+    case Remote::UP:
+    {
+      sl.up();
+      sl.draw();
+      show();
+      return 2;
+    }
+    case Remote::DF_DOWN:
+    case Remote::DOWN:
+    {
+      sl.down();
+      sl.draw();
+      show();
+      return 2;
+    }
+    case Remote::OK:
+    {
+      Message* m = new Message();
+      m->to = parent;
+      m->message = Message::SERVER_SELECTED;
+      m->parameter = sl.getCurrentOption();
+      ViewMan::getInstance()->postMessage(m);
+      return 4;
+    }
   }
 
   return 1;
index d09bbbad50b68b4961fbacb319d575816c3836d4..96bb763f0f756d95c333c2b777a33f69dafebf00 100644 (file)
@@ -62,6 +62,7 @@ int VVideoLive::handleCommand(int command)
       vdr->stopStreaming();
       return 4;
     }
+    case Remote::DF_UP:
     case Remote::UP:
     {
       player->stop();
@@ -72,6 +73,7 @@ int VVideoLive::handleCommand(int command)
       player->play();
       return 2;
     }
+    case Remote::DF_DOWN:
     case Remote::DOWN:
     {
       player->stop();
index 441a7ef014d95b39e604bcc28381b0724bed209b..0ad082569e38b2524dac489c7fee157c1a990a29 100644 (file)
@@ -70,7 +70,8 @@ int VVolume::handleCommand(int command)
 {
   switch(command)
   {
-    case Remote::LEFT:
+    case Remote::DF_LEFT:
+    case Remote::VOLUMEDOWN:
     {
       displayVolume = Audio::getInstance()->volumeDown();
       draw();
@@ -78,7 +79,8 @@ int VVolume::handleCommand(int command)
       // handled
       return 2;
     }
-    case Remote::RIGHT:
+    case Remote::DF_RIGHT:
+    case Remote::VOLUMEUP:
     {
       displayVolume = Audio::getInstance()->volumeUp();
       draw();
index d17e07048e7f959e01660e293c084aeaac8b2da3..8881035c64fe7ccc17a026c7e6ac4104a7d9e165 100644 (file)
@@ -22,7 +22,7 @@
 
 VWelcome::VWelcome()
 {
-  setDimensions(190, 460);
+  setDimensions(200, 460);
 
   if (Video::getInstance()->getFormat() == Video::PAL)
   {
@@ -39,15 +39,16 @@ VWelcome::VWelcome()
   setTitleText("Welcome");
 
   sl.setScreenPos(screenX + 20, screenY + 40);
-  sl.setDimensions(130, 170);
+  sl.setDimensions(140, 170);
 
   sl.addOption("1. Live TV", 1);
   sl.addOption("2. Radio", 0);
   sl.addOption("3. Recordings", 0);
-  sl.addOption("4. Stand by", 0);
-  sl.addOption("5. Reboot", 0);
+  sl.addOption("4. Options", 0);
+  sl.addOption("5. Stand by", 0);
+  sl.addOption("6. Reboot", 0);
 
-  jpeg.setScreenPos(screenX + 240, screenY + 50);
+  jpeg.setScreenPos(screenX + 240, screenY + 60);
 }
 
 VWelcome::~VWelcome()
@@ -74,75 +75,91 @@ void VWelcome::draw()
 
 int VWelcome::handleCommand(int command)
 {
-  if (command == Remote::UP)
+  switch(command)
   {
-    sl.up();
-    sl.draw();
-    show();
-    return 2;
-  }
-  else if (command == Remote::DOWN)
-  {
-    sl.down();
-    sl.draw();
-    show();
-    return 2;
-  }
-  else if (command == Remote::ONE)
-  {
-    doChannelsList();
-    return 2;
-  }
-  else if (command == Remote::TWO)
-  {
-    doRadioList();
-    return 2;
-  }
-  else if (command == Remote::THREE)
-  {
-    doRecordingsList();
-    return 2;
-  }
-  else if (command == Remote::FOUR)
-  {
-    Message* m = new Message();
-    m->message = Message::STANDBY;
-    Command::getInstance()->postMessage(m);
-    return 4;
-  }
-  else if (command == Remote::FIVE)
-  {
-    Command::getInstance()->doReboot();
-  }
-  else if (command == Remote::OK)
-  {
-    int option = sl.getCurrentOption();
-    if (option == 0)
+    case Remote::DF_UP:
+    case Remote::UP:
+    {
+      sl.up();
+      sl.draw();
+      show();
+      return 2;
+    }
+    case Remote::DF_DOWN:
+    case Remote::DOWN:
+    {
+      sl.down();
+      sl.draw();
+      show();
+      return 2;
+    }
+    case Remote::ONE:
     {
       doChannelsList();
       return 2;
     }
-    else if (option == 1)
+    case Remote::TWO:
     {
       doRadioList();
       return 2;
     }
-    else if (option == 2)
+    case Remote::THREE:
     {
       doRecordingsList();
       return 2;
     }
-    else if (option == 3)
+    case Remote::FOUR:
+    {
+      doOptions();
+      return 2;
+    }
+    case Remote::FIVE:
     {
       Message* m = new Message();
       m->message = Message::STANDBY;
       Command::getInstance()->postMessage(m);
       return 4;
     }
-    else if (option == 4)
+    case Remote::SIX:
     {
       Command::getInstance()->doReboot();
-      return 2;
+    }
+    case Remote::OK:
+    {
+      int option = sl.getCurrentOption();
+      if (option == 0)
+      {
+        doChannelsList();
+        return 2;
+      }
+      else if (option == 1)
+      {
+        doRadioList();
+        return 2;
+      }
+      else if (option == 2)
+      {
+        doRecordingsList();
+        return 2;
+      }
+      else if (option == 3)
+      {
+        doOptions();
+        return 2;
+      }
+      else if (option == 4)
+      {
+        Message* m = new Message();
+        m->message = Message::STANDBY;
+        Command::getInstance()->postMessage(m);
+        return 4;
+      }
+      else if (option == 5)
+      {
+        Command::getInstance()->doReboot();
+        return 2;
+      }
+      return 2; // never gets here
     }
   }
 
@@ -225,3 +242,11 @@ void VWelcome::doRecordingsList()
   viewman->removeView(viewWait, 1, 1);
   Log::getInstance()->log("VWelcome", Log::DEBUG, "possible delay end");
 }
+
+void VWelcome::doOptions()
+{
+  VOptions* voptions = new VOptions();
+  ViewMan::getInstance()->addNoLock(voptions);
+  voptions->draw();
+  voptions->show();
+}
index a5c3b584ff98aaf3236e780d0668677948694887..e8f680ee8b99e36e4ae07b81ed66958ec5279413 100644 (file)
@@ -37,6 +37,7 @@
 #include "message.h"
 #include "colour.h"
 #include "video.h"
+#include "voptions.h"
 
 class VWelcome : public View
 {
@@ -55,6 +56,7 @@ class VWelcome : public View
     void doChannelsList();
     void doRadioList();
     void doRecordingsList();
+    void doOptions();
 };
 
 #endif
index 6379c4e9d4244d4613b887c539bee6a61bacb0a3..47d6d1ea9a8fa72d56c15a6073ec4d8c920f5e1b 100644 (file)
--- a/wjpeg.cc
+++ b/wjpeg.cc
@@ -35,8 +35,6 @@ void WJpeg::draw()
 {
   Log* logger = Log::getInstance();
 
-  logger->log("BJpeg", Log::DEBUG, "Here1");
-
   FILE* infile = fopen(fileName, "r");
   if (infile == NULL)
   {
diff --git a/woptionbox.cc b/woptionbox.cc
new file mode 100644 (file)
index 0000000..cd2cafe
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+    Copyright 2004-2005 Chris Tallon
+
+    This file is part of VOMP.
+
+    VOMP is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    VOMP is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with VOMP; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include "woptionbox.h"
+
+WOptionBox::WOptionBox()
+{
+  numOptions = 0;
+  options = NULL;
+  active = 0;
+  currentOption = 0;
+}
+
+WOptionBox::~WOptionBox()
+{
+  if (!options) return;
+
+  for(UINT i = 0; i < numOptions; i++) delete[] options[i];
+  free(options);
+}
+
+void WOptionBox::addOption(char* takeText)
+{
+  int length = strlen(takeText);
+  char* newOption = new char[length + 1];
+  strcpy(newOption, takeText);
+
+  options = (char**)realloc(options, numOptions * sizeof(char*));
+  options[numOptions] = newOption;
+
+  numOptions++;
+}
+
+void WOptionBox::setActive(UCHAR tactive)
+{
+  active = tactive;
+}
+
+void WOptionBox::draw()
+{
+  if (active)
+  {
+    fillColour(Colour::SELECTHIGHLIGHT);
+    drawText(options[currentOption], 0, 0, Colour::DARKTEXT);
+  }
+  else
+  {
+    fillColour(Colour::BUTTONBACKGROUND);
+    drawText(options[currentOption], 0, 0, Colour::LIGHTTEXT);
+  }
+}
+
+void WOptionBox::left()
+{
+  if (currentOption == 0) return;
+  --currentOption;
+}
+
+void WOptionBox::right()
+{
+  if (currentOption == (numOptions - 1)) return;
+  ++currentOption;
+}
+
+void WOptionBox::cycle()
+{
+  if (currentOption == (numOptions - 1))
+  {
+    currentOption = 0;
+  }
+  else
+  {
+    ++currentOption;
+  }
+}
+
+void WOptionBox::setSelected(char* toSelect)
+{
+  for(UINT i = 0; i < numOptions; i++)
+  {
+    if (!strcmp(toSelect, options[i]))
+    {
+      currentOption = i;
+      return;
+    }
+  }
+  currentOption = 0;
+}
+
+char* WOptionBox::getSelected()
+{
+  return options[currentOption];
+}
diff --git a/woptionbox.h b/woptionbox.h
new file mode 100644 (file)
index 0000000..25253eb
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+    Copyright 2004-2005 Chris Tallon
+
+    This file is part of VOMP.
+
+    VOMP is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    VOMP is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with VOMP; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#ifndef WOPTIONBOX_H
+#define WOPTIONBOX_H
+
+#include <stdlib.h>
+
+#include "defines.h"
+#include "box.h"
+#include "colour.h"
+
+class WOptionBox : public Box
+{
+  public:
+    WOptionBox();
+    ~WOptionBox();
+    void addOption(char* newOption);
+    void setSelected(char* selectedOption);
+    char* getSelected();
+    void setActive(UCHAR tactive);
+    void left();
+    void right();
+    void cycle();
+    void draw();
+
+  private:
+    UCHAR active;
+    UINT numOptions;
+    char** options;
+    UINT currentOption;
+};
+
+#endif
index 1d02df4512120c69e321e35375a201af5adddb30..a12d0339f7b237ab05957b3126febfa1c38758cc 100644 (file)
@@ -20,8 +20,8 @@
 
 #include "wsymbol.h"
 
-UCHAR WSymbol::widths[] = { 2, 2, 4, 4, 1, 1, 3, 3, 3, 3, 3, 4, 4 };
-UCHAR WSymbol::heights[] = { 8, 8, 12, 12, 24, 4, 18, 18, 18, 18, 18, 30, 30 };
+UCHAR WSymbol::widths[] = { 2, 2, 4, 4, 1, 1, 3, 3, 3, 3, 3, 4, 4, 2, 2};
+UCHAR WSymbol::heights[] = { 8, 8, 12, 12, 24, 4, 18, 18, 18, 18, 18, 30, 30, 16, 16};
 
 UCHAR WSymbol::symbols[] = {
 
@@ -522,7 +522,79 @@ UCHAR WSymbol::symbols[] = {
 0x00, 0x01, 0xC0, 0x00,
 0x00, 0x00, 0xC0, 0x00,
 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00
+0x00, 0x00, 0x00, 0x00,
+
+/*
+00000000 00000011
+00000000 00001111
+00000000 00111111
+00000000 11111111
+00000011 11111111
+00001111 11111111
+00111111 11111111
+11111111 11111111
+11111111 11111111
+00111111 11111111
+00001111 11111111
+00000011 11111111
+00000000 11111111
+00000000 00111111
+00000000 00001111
+00000000 00000011
+*/
+
+0x00, 0x03,
+0x00, 0x07,
+0x00, 0x3F,
+0x00, 0xFF,
+0x03, 0xFF,
+0x07, 0xFF,
+0x3F, 0xFF,
+0xFF, 0xFF,
+0xFF, 0xFF,
+0x3F, 0xFF,
+0x07, 0xFF,
+0x03, 0xFF,
+0x00, 0xFF,
+0x00, 0x3F,
+0x00, 0x07,
+0x00, 0x03,
+
+/*
+11000000 00000000
+11110000 00000000
+11111100 00000000
+11111111 00000000
+11111111 11000000
+11111111 11110000
+11111111 11111100
+11111111 11111111
+11111111 11111111
+11111111 11111100
+11111111 11110000
+11111111 11000000
+11111111 00000000
+11111100 00000000
+11110000 00000000
+11000000 00000000
+*/
+
+0xC0, 0x00,
+0xF0, 0x00,
+0xFC, 0x00,
+0xFF, 0x00,
+0xFF, 0xC0,
+0xFF, 0xF0,
+0xFF, 0xFC,
+0xFF, 0xFF,
+0xFF, 0xFF,
+0xFF, 0xFC,
+0xFF, 0xF0,
+0xFF, 0xC0,
+0xFF, 0x00,
+0xFC, 0x00,
+0xF0, 0x00,
+0xC0, 0x00
 
 
 };
@@ -532,7 +604,7 @@ WSymbol::WSymbol()
   nextSymbol = 0;
 }
 
-void WSymbol::draw()
+void WSymbol::draw(Colour& colour)
 {
   int offset = 0;
   for(int i = 0; i < nextSymbol; i++)
@@ -556,7 +628,7 @@ void WSymbol::draw()
 
       if ((base[bytesIn] >> (7 - bitsIn)) & 0x01)
       {
-        drawPixel(x, y, Colour::LIGHTTEXT);
+        drawPixel(x, y, colour);
       }
     }
   }
index 5b0eb79e636086fdc0e4b22350ab76a1dc8bf227..8e02bae5ea69f5c616816fd9a348b908522a4ff6 100644 (file)
--- a/wsymbol.h
+++ b/wsymbol.h
@@ -30,7 +30,7 @@ class WSymbol : public Box
   public:
     WSymbol();
 
-    void draw();
+    void draw(Colour& colour = Colour::LIGHTTEXT);
     UCHAR nextSymbol;
 
     const static UCHAR VOLUME = 0;
@@ -46,6 +46,8 @@ class WSymbol : public Box
     const static UCHAR PLAY = 10;
     const static UCHAR MUTE = 11;
     const static UCHAR UNMUTE = 12;
+    const static UCHAR LEFTARROW = 13;
+    const static UCHAR RIGHTARROW = 14;
 
   private:
     static UCHAR symbols[];