]> git.vomp.tv Git - vompclient-marten.git/commitdiff
Switch trunk code to new boxes
authorChris Tallon <chris@vomp.tv>
Fri, 26 Oct 2007 22:49:42 +0000 (22:49 +0000)
committerChris Tallon <chris@vomp.tv>
Fri, 26 Oct 2007 22:49:42 +0000 (22:49 +0000)
165 files changed:
CREDITS
GNUmakefile
afeed.cc
afeed.h
audio.cc
audio.h
audiomvp.cc
audiomvp.h
audioplayer.cc
audioplayer.h
box.cc [deleted file]
box.h [deleted file]
boxstack.cc [new file with mode: 0644]
boxstack.h [new file with mode: 0644]
boxx.cc [new file with mode: 0644]
boxx.h [new file with mode: 0644]
channel.cc
channel.h
colour.cc
command.cc
command.h
defines.h
demuxeraudio.cc
event.cc
event.h
i18n.cc
i18n.h
main.cc
message.h
messagequeue.cc
messagequeue.h
mtdmvp.cc
mtdmvp.h
objects.mk
option.cc [new file with mode: 0644]
option.h [new file with mode: 0644]
osd.cc
osd.h
osdwin.cc
player.cc
player.h
playerradio.cc
playerradio.h
recinfo.cc
recinfo.h
recman.cc
recording.cc
recording.h
rectimer.h
remote.cc
remote.h
remotemvp.cc
remotemvp.h
stream.h
surface.cc
surface.h
surfacemvp.cc
surfacemvp.h
surfacewin.cc
surfacewin.h
tbboxx.cc [new file with mode: 0644]
tbboxx.h [new file with mode: 0644]
tcp.cc
tcp.h
timers.cc
timers.h
udp.cc
udp.h
vaudioplayer.cc
vaudioplayer.h
vaudioselector.cc
vaudioselector.h
vchannellist.cc
vchannellist.h
vchannelselect.cc
vchannelselect.h
vconnect.cc
vconnect.h
vdr.cc
vdr.h
vepg.cc
vepg.h
vepgsettimer.cc
vepgsettimer.h
vfeed.cc
vfeed.h
view.cc [deleted file]
view.h [deleted file]
viewman.cc [deleted file]
viewman.h [deleted file]
vinfo.cc
vinfo.h
vlivebanner.cc
vlivebanner.h
vmedialist.cc
vmedialist.h
vmute.cc
vmute.h
voptions.cc [deleted file]
voptions.h [deleted file]
voptionsmenu.cc [deleted file]
voptionsmenu.h [deleted file]
vopts.cc [new file with mode: 0644]
vopts.h [new file with mode: 0644]
vpicture.cc
vpicture.h
vpicturebanner.cc
vpicturebanner.h
vquestion.cc
vquestion.h
vradiorec.cc
vradiorec.h
vrecmove.cc
vrecmove.h
vrecordinglist.cc
vrecordinglist.h
vrecordingmenu.cc
vrecordingmenu.h
vremoteconfig.cc
vremoteconfig.h
vscreensaver.cc
vscreensaver.h
vserverselect.cc
vserverselect.h
vtabsviewman.cc [deleted file]
vtabsviewman.h [deleted file]
vtimeredit.cc
vtimeredit.h
vtimerlist.cc
vtimerlist.h
vvideolive.cc
vvideolive.h
vvideorec.cc
vvideorec.h
vvolume.cc
vvolume.h
vwallpaper.cc [deleted file]
vwallpaper.h [deleted file]
vwelcome.cc
vwelcome.h
wbutton.cc
wbutton.h
widget.cc [deleted file]
widget.h [deleted file]
winmain.cc
wjpeg.cc
wjpeg.h
wol.cc
wol.h
woptionbox.cc
woptionbox.h
woptionpane.cc [new file with mode: 0644]
woptionpane.h [new file with mode: 0644]
wremoteconfig.cc [new file with mode: 0644]
wremoteconfig.h [new file with mode: 0644]
wselectlist.cc
wselectlist.h
wsymbol.cc
wsymbol.h
wtabbar.cc [new file with mode: 0644]
wtabbar.h [new file with mode: 0644]
wtextbox.cc
wtextbox.h
wwss.cc
wwss.h

diff --git a/CREDITS b/CREDITS
index fd0fc9a4c24a58f92a76434b804180108eda5fc9..285ccd3f0d058056e45aaa9f2269c188ecd92eac 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -41,6 +41,8 @@ Marten Richter
   Reporting of many bugs
   Audio channel selection
 
+Andreas Vogel
+  Media player
 
 Thanks to the following people for their work with the MVP:
 
index 347c5f00713608dbe385a5ea4beb860ac60f78df..faa83f36b05d5555c42b837f909e0ce1524764b8 100644 (file)
@@ -47,10 +47,10 @@ install-wmp:
 
 
 debug:
-       ../../gdb/gdb-6.3-target-ppc/gdb/gdb /diskless/nfs/mvp/vompclient /diskless/nfs/mvp/core.*
+       ../../gdb/gdb-6.7/gdb/gdb /diskless/nfs/mvp/vompclient /diskless/nfs/mvp/core.*
 
 debug2:
-       ../../gdb/gdb-6.3-target-ppc/gdb/gdb /diskless/nfs/wmvp/vompclient /diskless/nfs/wmvp/core.*
+       ../../gdb/gdb-6.7/gdb/gdb /diskless/nfs/wmvp/vompclient /diskless/nfs/wmvp/core.*
 
 dev: CXXFLAGS := $(CXXFLAGS_DEV)
 dev: vompclient
index 5f864459cc288d4eac9df774407652e05300171f..e942d24e09258d7d7fffd8dbecff4ebddc298169 100644 (file)
--- a/afeed.cc
+++ b/afeed.cc
 
 #include "afeed.h"
 
+#include "log.h"
+#include "demuxer.h"
+#include "callback.h"
+
 AFeed::AFeed(Callback* tcb)
 : cb(*tcb)
 {
diff --git a/afeed.h b/afeed.h
index 76ec46635f5efcef8d324d193cab6546b9ffebe3..aef429dc599ccddb3971b79ae0533b85e5db2218 100644 (file)
--- a/afeed.h
+++ b/afeed.h
 #include <stdio.h>
 #include <time.h>
 
-#include "log.h"
-#include "demuxer.h"
-#include "callback.h"
-
 #ifdef WIN32
 #include "threadwin.h"
 #else
 #include "threadp.h"
 #endif
 
+class Callback;
 
 class AFeed : public Thread_TYPE
 {
index a601421653c8ba35e03fc8659b217b58d30221cd..87a05f7e4a27a124dfb6ab671b6840ed83b7f43b 100644 (file)
--- a/audio.cc
+++ b/audio.cc
@@ -20,6 +20,8 @@
 
 #include "audio.h"
 
+#include "log.h"
+
 Audio* Audio::instance = NULL;
 
 Audio::Audio()
@@ -101,7 +103,6 @@ int Audio::doMuting()
 {
   Log::getInstance()->log("Audio", Log::DEBUG, "doMuting: user=%i sys=%i", userMute, systemMute);
 
-
   if (userMute || systemMute)
   {
     return mute();
diff --git a/audio.h b/audio.h
index 340110c861c239c8edc60b5933f592fdb87ab469..3830bf85e7e933e45f2928e1d93e06ae65c81a93 100644 (file)
--- a/audio.h
+++ b/audio.h
@@ -23,7 +23,6 @@
 
 #include <stdio.h>
 #include "defines.h"
-#include "log.h"
 #include "draintarget.h"
 
 typedef struct
index d8265341b45a9524bd642774ce73f0f554cddda7..75e20070e72080e28f2ee06ed255a5b286318b24 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "audiomvp.h"
 
+#include "log.h"
+
 AudioMVP::AudioMVP()
 {
   if (instance) return;
index fdd6f178dafdc66b8a6fe6fecbc2d6b567bf18b4..6e68091c98c358c4925ac6d557ba575e7b3a5425 100644 (file)
 #include <sys/ioctl.h>
 
 #include "defines.h"
-#include "log.h"
 #include "audio.h"
 
-
 typedef struct
 {
   int parm1;
index 0524362e6d180f4b81ac7df29356e710515f25eb..5dd2c65f29c9c231bf4ff927d47ad4c1e37960b6 100644 (file)
 #include "vaudioplayer.h"
 #include "demuxeraudio.h"
 #include "timers.h"
+#include "video.h"
+#include "command.h"
+#include "i18n.h"
+#include "boxx.h"
 
 AudioPlayer * AudioPlayer::instance=NULL;
 
-AudioPlayer * AudioPlayer::getInstance(View * parent,bool create) {
+AudioPlayer * AudioPlayer::getInstance(Boxx * parent,bool create) {
 //     Log::getInstance()->log("AudioPlayer",Log::DEBUG,"getInstance for view %p, instance=%p",parent,instance);
        AudioPlayer *np=instance;
        if (! np && ! create) return NULL;
@@ -40,7 +44,7 @@ AudioPlayer * AudioPlayer::getInstance(View * parent,bool create) {
        return instance;
 }
 
-AudioPlayer::AudioPlayer(View *parent) : afeed(this)
+AudioPlayer::AudioPlayer(Boxx *parent) : afeed(this)
 {
        frontend=parent;
   audio = Audio::getInstance();
index 727e03551621bfe5571f7be3524cee66ca85bfe2..dc21bf664c0a8bbd96ad70a3bc3410e0efd53d2d 100644 (file)
@@ -46,7 +46,7 @@
 
 
 
-class View;
+class Boxx;
 class DemuxerAudio;
 
 
@@ -59,7 +59,7 @@ class AudioPlayer : public Thread_TYPE, public Callback, public TimerReceiver
     //later you can change the view the player is connect with
                //a view that "goes" should call getInstance(NULL,false) to detach
                //the last media view should shutdown the player
-    static AudioPlayer * getInstance(View * frontend, bool create=true);
+    static AudioPlayer * getInstance(Boxx * frontend, bool create=true);
     //start the player thread
     void run();
 
@@ -136,7 +136,7 @@ class AudioPlayer : public Thread_TYPE, public Callback, public TimerReceiver
   private:
                //to guess lengthes if the demux does not know
                const static ULONG DEFAULT_BITRATE=128000;
-    AudioPlayer(View *frontend);
+    AudioPlayer(Boxx *frontend);
     virtual ~AudioPlayer();
     static AudioPlayer * instance;
     bool playerRunnig;
@@ -178,7 +178,7 @@ class AudioPlayer : public Thread_TYPE, public Callback, public TimerReceiver
                int skipfactor;
     //the buffer len in bytes
     const static int BUFLEN=50*1024;
-    View *frontend;
+    Boxx *frontend;
     //requested sequence
     int requestedSequence;
     //handled sequence
diff --git a/box.cc b/box.cc
deleted file mode 100644 (file)
index 0203155..0000000
--- a/box.cc
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
-    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 "box.h"
-
-char Box::numBoxes = 0;
-
-Box::Box()
-{
-  area.x = 0;
-  area.y = 0;
-  area.w = 0;
-  area.h = 0;
-
-  offsetX = 0;
-  offsetY = 0;
-
-  gap = 6; // default gap for drawPara
-
-  numBoxes++;
-  Log::getInstance()->log("Box", Log::DEBUG, "Construct, now %u", numBoxes);
-
-  surface = NULL;
-}
-
-Box::~Box()
-{
-  numBoxes--;
-  Log::getInstance()->log("Box", Log::DEBUG, "Destruct, now %u", numBoxes);
-}
-
-void Box::draw()
-{
-}
-
-void Box::setScreenPos(int x, int y)
-{
-  area.x = x;
-  area.y = y;
-}
-
-void Box::setSurfaceOffset(UINT x, UINT y)
-{
-  offsetX = x;
-  offsetY = y;
-}
-
-void Box::setGap(UINT tgap)
-{
-  gap = tgap;
-}
-
-void Box::blt(Region& r)
-{
-//  Log::getInstance()->log("Box", Log::DEBUG, "Show region %p %u %u %u %u", surface, r.x, r.y, r.w, r.h);
-//  surface->updateToScreen(area.x, area.y, area.w, area.h);
-
-  /* surface update to screen needs:
-  source x distance into this surface
-  source y distance into this surface
-  width of update
-  height of update
-  destination x on screen
-  destination y on screen
-  */
-
-  surface->updateToScreen(r.x - area.x, r.y - area.y, r.w, r.h, r.x, r.y);
-}
-
-int Box::getScreenX()
-{
-  return area.x;
-}
-
-int Box::getScreenY()
-{
-  return area.y;
-}
-
-int Box::getWidth()
-{
-  return area.w;
-}
-
-int Box::getHeight()
-{
-  return area.h;
-}
-
-// Level 1 drawing functions
-
-void Box::fillColour(Colour& colour)
-{
-  rectangle(0, 0, area.w, area.h, colour);
-}
-
-void Box::drawPara(char* text, int x, int y, Colour& colour)
-{
-  char line[256];
-  int lineHeight = surface->getFontHeight() + gap;
-
-  int lineWidth;
-  int thisCharWidth;
-  int textPos;
-  int linePos;
-  int ypos;
-  int printLine;
-
-  textPos = 0;
-  ypos = y;
-
-  while(1)
-  {
-    linePos = 0;
-    lineWidth = 0;
-    while(1)
-    {
-      printLine = 0;
-
-      if (text[textPos] == '\0') break;
-
-      if (text[textPos] == '\n')
-      {
-        textPos++; // ignore the \n
-        printLine = 1;
-        break;
-      }
-
-      thisCharWidth = surface->getCharWidth(text[textPos]);
-      if ((lineWidth + thisCharWidth) > (int)(area.w - (2 * paraMargin)))
-      {
-        // this character would break the right margin
-        if (text[textPos] == ' ')
-        {
-          // this char is a space, ignore and break
-          textPos++;
-          break;
-        }
-        else
-        {
-          // Need to go back to the last space in the line
-          while ((text[textPos] != ' ') && (linePos >= 0))
-          {
-            textPos--;
-            linePos--;
-          }
-          // Now take the space we just found
-          textPos++;
-          break;
-        }
-      }
-      line[linePos++] = text[textPos];
-      lineWidth += thisCharWidth;
-      textPos++;
-    }
-
-//    line[linePos++] = '\0';
-    if (linePos>=0) line[linePos++] = '\0'; //Here is the change
-
-    if (printLine || (linePos > 1)) // if some text was put in line
-    {
-      drawText(line, x, ypos, colour);
-      ypos += lineHeight;
-      if (ypos > (int)(area.h - lineHeight)) break;
-    }
-    else
-    {
-      break;
-    }
-  }
-}
-
-// Level 0 drawing functions
-
-void Box::rectangle(int x1, int y1, int w, int h, Colour colour)
-{
-  surface->fillblt(offsetX + x1, offsetY + y1, w, h, colour.rgba());
-}
-
-void Box::rectangle(Region& region, Colour& colour)
-{
-  surface->fillblt(offsetX + region.x, offsetY + region.y, region.w, region.h, colour.rgba());
-}
-
-void Box::drawText(char* text, int x, int y, Colour& colour)
-{
-  surface->drawText(text, offsetX + x, offsetY + y, colour.rgba());
-}
-
-void Box::drawTextRJ(char* text, int x, int y, Colour& colour)
-{
-  surface->drawTextRJ(text, offsetX + x, offsetY + y, colour.rgba());
-}
-
-void Box::drawTextCentre(char* text, int x, int y, Colour& colour)
-{
-  surface->drawTextCentre(text, offsetX + x, offsetY + y, colour.rgba());
-}
-
-void Box::drawPixel(UINT x, UINT y, Colour& colour)
-{
-  int c = (  (0xFF000000        )
-             | (colour.red  << 16)
-             | (colour.green  <<  8)
-             | (colour.blue     ) );
-
-
-  surface->drawPixel(offsetX + x, offsetY + y, c);
-}
diff --git a/box.h b/box.h
deleted file mode 100644 (file)
index 1908b58..0000000
--- a/box.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-    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 BOX_H
-#define BOX_H
-
-#include <stdio.h>
-
-#include "log.h"
-#include "colour.h"
-#include "region.h"
-
-#ifdef WIN32
-#include "surfacewin.h"
-#else
-#include "surfacemvp.h"
-#endif
-
-// Abstract ???????
-class Box
-{
-  public:
-    Box();
-    virtual ~Box();
-
-    void setScreenPos(int x, int y); // Even numbers only!!!
-    void setSurfaceOffset(UINT x, UINT y);
-    void setGap(UINT gap);
-
-    virtual void blt(Region& r); // For use only by ViewMan
-
-    virtual void draw();
-
-    // Drawing functions level 1
-    void fillColour(Colour& colour);
-    void drawPara(char* text, int x, int y, Colour& colour);
-
-    // Drawing functions level 0
-    void rectangle(int x, int y, int w, int h, Colour colour); // FIXME make this ref again
-    void rectangle(Region& region, Colour& colour);
-
-    void drawText(char* text, int x, int y, Colour& colour);
-    void drawTextRJ(char* text, int x, int y, Colour& colour);
-    void drawTextCentre(char* text, int x, int y, Colour& colour);
-    void drawPixel(UINT x, UINT y, Colour& colour);
-
-    int getScreenX();
-    int getScreenY();
-    int getWidth();
-    int getHeight();
-
-    // so viewman can read it:
-    Region area;
-    Surface* surface; // temp  - is there a get function for this? FIXME
-
-  protected:
-    UINT offsetX;
-    UINT offsetY;
-
-    UINT gap;
-
-    static char numBoxes;
-
-    static const int paraMargin = 10;
-
-};
-
-#endif
diff --git a/boxstack.cc b/boxstack.cc
new file mode 100644 (file)
index 0000000..6917afc
--- /dev/null
@@ -0,0 +1,459 @@
+/*
+    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 "boxstack.h"
+
+#include "command.h"
+#include "remote.h"
+#include "log.h"
+
+BoxStack* BoxStack::instance = NULL;
+
+BoxStack::BoxStack()
+{
+  if (instance) return;
+  instance = this;
+  initted = 0;
+  numBoxes = 0;
+}
+
+BoxStack::~BoxStack()
+{
+  instance = NULL;
+}
+
+BoxStack* BoxStack::getInstance()
+{
+  return instance;
+}
+
+int BoxStack::init()
+{
+  if (initted) return 0;
+  initted = 1;
+  return 1;
+}
+
+int BoxStack::shutdown()
+{
+  if (!initted) return 0;
+
+  // FIXME don't think this can work properly, removeAll leaves the wallpaper there!
+  removeAll();
+
+  initted = 0;
+  return 1;
+}
+
+int BoxStack::add(Boxx* v)
+{
+  if (!initted) return 0;
+  if (numBoxes == 16) return 0;
+
+  boxes[numBoxes++] = v;
+
+  return 1;
+}
+
+// ---------------------------------------------------- REMOVE CODE
+
+int BoxStack::remove(Boxx* toDelete)
+{
+  if (!initted) return 0;
+  if (numBoxes == 0) return 0;
+
+//  Log::getInstance()->log("BoxStack", Log::DEBUG, "entering remove, numBoxes=%i", numBoxes);
+
+  int i;
+
+  if (toDelete == NULL)
+  {
+    toDelete = boxes[numBoxes-1];
+    i = numBoxes - 1;
+  }
+  else
+  {
+    // to be deleted box is more likely to be at the top
+    for (i = numBoxes-1; i >= 0; i--)
+    {
+//      Log::getInstance()->log("BoxStack", Log::DEBUG, "todel: %p, i=%i, boxes[i]=%p", toDelete, i, boxes[i]);
+      if (boxes[i] == toDelete) break;
+    }
+
+    if (i == -1)
+    {
+      // not a Box we have!
+      return 0;
+    }
+  }
+
+//  Log::getInstance()->log("BoxStack", Log::DEBUG, "Starting deleteBox");
+  deleteBox(i);
+//  Log::getInstance()->log("BoxStack", Log::DEBUG, "Done deleteBox");
+
+  // Shift the boxes on top down one
+  --numBoxes;
+  for(int j = i; j < numBoxes; j++) boxes[j] = boxes[j+1];
+
+  // Delete the box
+  delete toDelete;
+
+  // If there is only the wallpaper left signal command
+  if (numBoxes == 1)
+  {
+    Message* m = new Message();
+    m->to = Command::getInstance();
+    m->message = Message::LAST_VIEW_CLOSE;
+    Command::getInstance()->postMessageNoLock(m);
+  }
+
+  return 1;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// NEW STUFF
+/////////////////////////////////////////////////////////////////////////////
+
+void BoxStack::deleteBox(int z)
+{
+//  Log::getInstance()->log("BoxStack", Log::DEBUG, "Delete box %i of %i", z, numBoxes);
+  RegionList rl;
+  boxSplit(boxes[z]->area, z + 1, numBoxes, 1, rl);
+  while(!rl.empty())
+  {
+    repaintRevealed(z, rl.front());
+    rl.pop_front();
+  }
+}
+
+void BoxStack::update(Boxx* toUpdate, Region* regionToUpdate)
+{
+//  Log::getInstance()->log("BoxStack", Log::DEBUG, "Update called");
+  // Get the z index of the box
+
+  int z;
+  for (z = 0; z < numBoxes; z++)
+  {
+    if (boxes[z] == toUpdate) break;
+  }
+
+  if (z == numBoxes)
+  {
+    // not a Box we have!
+    return;
+  }
+
+  // get the region for the whole box, could be less than that
+  // for smaller updates
+
+  Region r = toUpdate->area;
+
+  if (regionToUpdate)
+  {
+    // Can be null if the whole box should be updated
+    // If this is given the numbers are relative to the size of the box, not the screen
+
+    r.x += regionToUpdate->x;
+    r.y += regionToUpdate->y;
+    r.w = regionToUpdate->w;
+    r.h = regionToUpdate->h;
+  }
+
+  RegionList rl;
+
+  Region r2;
+  boxSplit(r, z+1, numBoxes, 1, rl);
+  while(!rl.empty())
+  {
+    r2 = rl.front();
+    r2.z = z;
+    boxes[z]->blt(r2);
+    rl.pop_front();
+  }
+}
+
+void BoxStack::repaintRevealed(int x, Region r)
+{
+  RegionList rl;
+  boxSplit(r, x - 1, -1, -1, rl);
+
+  Region r2;
+  while(!rl.empty())
+  {
+    r2 = rl.front();
+    boxes[r2.z]->blt(r2);
+    rl.pop_front();
+  }
+}
+
+void BoxStack::boxSplit(Region r, int start, int end, int direction, RegionList& rl)
+{
+//  printf("Y=  S=%i E=%i D=%i: Boxsplit: %i %i %i %i\n", start, end, direction, r.x, r.y, r.w, r.h);
+
+  for(int z = start; z != end; z += direction)
+  {
+    if (r.overlappedBy(boxes[z]->area))
+    {
+//      printf("Z=%i S=%i E=%i D=%i: %i overlaps\n", z, start, end, direction, z);
+
+      int top = r.y;
+      int btm = r.y2();
+
+      if (boxes[z]->area.y > r.y)
+      {
+//        printf("Z=%i S=%i E=%i D=%i: Case 1 for %i %i %i %i split by %i: %i %i %i %i\n", z, start, end, direction, r.x, r.y, r.w, r.h, z, boxes[z]->area.x, boxes[z]->area.y, boxes[z]->area.w, boxes[z]->area.h);
+        top = boxes[z]->area.y;
+        Region newR;
+        newR.x = r.x;
+        newR.y = r.y;
+        newR.w = r.w;
+        newR.h = boxes[z]->area.y - r.y;
+        boxSplit(newR, z + direction, end, direction, rl);
+
+        if (direction == -1)
+        {
+          Region newR2;
+          newR2.x = r.x;
+          newR2.y = boxes[z]->area.y;
+          newR2.w = r.w;
+          newR2.h = r.h - newR.h;
+          boxSplit(newR2, z, end, -1, rl);
+          return;
+        }
+      }
+
+      if (boxes[z]->area.y2() < r.y2())
+      {
+//        printf("Z=%i S=%i E=%i D=%i: Case 2 for %i %i %i %i split by %i: %i %i %i %i\n", z, start, end, direction, r.x, r.y, r.w, r.h, z, boxes[z]->area.x, boxes[z]->area.y, boxes[z]->area.w, boxes[z]->area.h);
+        btm = boxes[z]->area.y2();
+        Region newR;
+        newR.x = r.x;
+        newR.y = boxes[z]->area.y2() + 1;
+        newR.w = r.w;
+        newR.h = r.y2() - newR.y + 1;
+        boxSplit(newR, z + direction, end, direction, rl);
+
+        if (direction == -1)
+        {
+          Region newR2;
+          newR2.x = r.x;
+          newR2.y = r.y;
+          newR2.w = r.w;
+          newR2.h = r.h - newR.h;
+          boxSplit(newR2, z, end, -1, rl);
+          return;
+        }
+      }
+
+      if (boxes[z]->area.x > r.x)
+      {
+//        printf("Z=%i S=%i E=%i D=%i: Case 3 for %i %i %i %i split by %i: %i %i %i %i\n", z, start, end, direction, r.x, r.y, r.w, r.h, z, boxes[z]->area.x, boxes[z]->area.y, boxes[z]->area.w, boxes[z]->area.h);
+        Region newR;
+        newR.x = r.x;
+        newR.y = top;
+        newR.w = boxes[z]->area.x - r.x;
+        newR.h = btm - top + 1;
+        boxSplit(newR, z + direction, end, direction, rl);
+
+        if (direction == -1)
+        {
+          Region newR2;
+          newR2.x = r.x + newR.w;
+          newR2.y = r.y;
+          newR2.w = r.w - newR.w;
+          newR2.h = r.h;
+          boxSplit(newR2, z, end, -1, rl);
+          return;
+        }
+      }
+
+      if (boxes[z]->area.x2() < r.x2())
+      {
+//        printf("Z=%i S=%i E=%i D=%i: Case 4 for %i %i %i %i split by %i: %i %i %i %i\n", z, start, end, direction, r.x, r.y, r.w, r.h, z, boxes[z]->area.x, boxes[z]->area.y, boxes[z]->area.w, boxes[z]->area.h);
+        Region newR;
+        newR.x = boxes[z]->area.x2() + 1;
+        newR.y = top;
+        newR.w = r.x2() - newR.x + 1;
+        newR.h = btm - top + 1;
+        boxSplit(newR, z + direction, end, direction, rl);
+
+        if (direction == -1)
+        {
+          Region newR2;
+          newR2.x = r.x;
+          newR2.y = r.y;
+          newR2.w = r.w - newR.w;
+          newR2.h = r.h;
+          boxSplit(newR2, z, end, -1, rl);
+          return;
+        }
+      }
+
+      if (direction == -1)
+      {
+        // we are going down the stack
+        // r is underlapped by boxes[z]
+        // but we have not split
+        // Therefore this region under test is
+        // completely covering boxes[z]
+
+        // don't go any further down, generate a region and quit
+
+//        printf("Repaint region: %i %i %i %i\n", r.x, r.y, r.w, r.h);
+        r.z = z;
+        rl.push_front(r);
+      }
+
+//      printf("Returning from Z=%i\n", z);
+      return;
+    }
+    else
+    {
+//      printf("Z=%i S=%i E=%i D=%i: %i does not overlap\n", z, start, end, direction, z);
+    }
+  }
+
+  // if direction = 1 then we have come to a region that is
+  // entirely clear of higher boxes and needs to be redrawn
+
+  // if direction = -1 then we have come to a region that is on
+  // the very bottom with nothing below it to repaint.
+  // do nothing. stale window data will be left on screen?
+
+  if (direction == 1)
+  {
+    rl.push_front(r);
+  }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// END NEW STUFF
+/////////////////////////////////////////////////////////////////////////////
+
+// ---------------------------------------------------- END OF REMOVE CODE
+
+
+void BoxStack::removeAll()
+{
+  // 1.. Don't delete wallpaper. No point.
+  for (; numBoxes > 1; --numBoxes)
+  {
+    delete boxes[numBoxes-1];
+  }
+}
+
+int BoxStack::handleCommand(int command)
+{
+  int retVal;
+  int retVal2 = 0;
+  int i;
+
+  if (command != Remote::NA_NONE)
+  {
+    // handle command return values
+    // 0 - drop through to next box
+    // 1 - dont drop to next box, but not handled
+    // 2 - handled - stop command here
+    // 4 - handled - delete this box
+
+    for (i=numBoxes-1; i>=0; i--)
+    {
+//      Log::getInstance()->log("BoxStack", Log::DEBUG, "Giving command to i=%i", i);
+      retVal = boxes[i]->handleCommand(command);
+      if (retVal == 1)
+      {
+        // not handled but don't give to any more boxes
+        return 0;
+      }
+
+      if (retVal == 2)
+      {
+        // command handled
+        retVal2 = 1;
+        break;
+      }
+      else if (retVal == 4)
+      {
+//        Log::getInstance()->log("BoxStack", Log::DEBUG, "Return 4: i=%i, boxes[i]=%p", i, boxes[i]);
+        remove(boxes[i]);
+        retVal2 = 1;
+        break;
+      }
+    }
+  }
+  else
+  {
+    // fake the return code
+    retVal2 = 2;
+  }
+
+  return retVal2;
+}
+
+void BoxStack::processMessage(Message* m)
+{
+  if (m->to != this)
+  {
+    for (int i = numBoxes-1; i >= 0; i--)
+    {
+      if (boxes[i] == m->to)
+      {
+        Log::getInstance()->log("BoxStack", Log::DEBUG, "sending message from box %p to box %p %lu", m->from, m->to, m->message);
+        boxes[i]->processMessage(m);
+        return;
+      }
+    }
+    return;
+  }
+
+  /* Handle mouse events*/
+  // They come in with m->to = NULL? and just need to be delivered to top box?
+  if ((numBoxes > 1) && ((m->message == Message::MOUSE_MOVE) || (m->message == Message::MOUSE_LBDOWN)))
+  {
+    boxes[numBoxes-1]->processMessage(m);
+    return;
+  }
+
+  Log::getInstance()->log("BoxStack", Log::DEBUG, "it's for meeee!");
+
+  switch(m->message)
+  {
+    case Message::CLOSE_ME:
+    {
+      remove((Boxx*)m->from);
+      break;
+    }
+    case Message::ADD_VIEW: // currently not used by anything but it might come in useful again
+    {
+      Boxx* toAdd = (Boxx*)m->parameter;
+      add(toAdd);
+      toAdd->draw();
+      update(toAdd);
+      break;
+    }
+    case Message::REDRAW:
+    {
+      Boxx* toRedraw = (Boxx*)m->from;
+      Region* toRedrawRegion = (Region*)m->parameter;
+      update(toRedraw, toRedrawRegion);
+      break;
+    }
+  }
+}
diff --git a/boxstack.h b/boxstack.h
new file mode 100644 (file)
index 0000000..e930d87
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+    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 BOXSTACK_H
+#define BOXSTACK_H
+
+#include <stdio.h>
+#include <time.h>
+#include <signal.h>
+#include <list>
+
+#include "boxx.h"
+#include "region.h"
+#include "message.h"
+
+
+//using namespace std;
+
+//using namespace __gnu_cxx; // needed for newer compilers?
+
+typedef list<Region> RegionList;
+
+class BoxStack
+{
+  public:
+    BoxStack();
+    virtual ~BoxStack();
+    static BoxStack* getInstance();
+
+    int init();
+    int shutdown();
+
+    int add(Boxx*);
+    int remove(Boxx*);
+    void removeAll();
+    void update(Boxx*, Region* regionToUpdate = NULL);
+
+    int handleCommand(int command);
+    void processMessage(Message* m);
+
+  private:
+    static BoxStack* instance;
+    int initted;
+
+    Boxx* boxes[20];
+    int numBoxes;
+
+    void deleteBox(int z);
+    void repaintRevealed(int x, Region r);
+    void boxSplit(Region r, int start, int end, int direction, RegionList& rl);
+};
+
+#endif
diff --git a/boxx.cc b/boxx.cc
new file mode 100644 (file)
index 0000000..d546633
--- /dev/null
+++ b/boxx.cc
@@ -0,0 +1,345 @@
+/*
+    Copyright 2007 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 "boxx.h"
+
+#include "log.h"
+
+char Boxx::numBoxxes = 0;
+
+Boxx::Boxx()
+{
+  // I want a parent box or a surface.
+  parent = NULL;
+  surface = NULL;
+
+  area.x = 0;
+  area.y = 0;
+  area.w = 0;
+  area.h = 0;
+
+  paraVSpace = 6; // default gap for drawPara
+
+  backgroundColourSet = false;
+  visible = true;
+
+  numBoxxes++;
+  Log::getInstance()->log("Boxx", Log::DEBUG, "Construct, now %u", numBoxxes);
+}
+
+Boxx::~Boxx()
+{
+  if (surface) delete surface;
+  numBoxxes--;
+  Log::getInstance()->log("Boxx", Log::DEBUG, "Destruct, now %u", numBoxxes);
+}
+
+void Boxx::draw()
+{
+  //Log::getInstance()->log("Boxx", Log::DEBUG, "Draw this %p surface %p", this, surface);
+  if (backgroundColourSet) fillColour(backgroundColour);
+
+  Boxx* currentBoxx;
+  vector<Boxx*>::iterator j;
+  for (j = children.begin(); j != children.end(); j++)
+  {
+    currentBoxx = *j;
+    if (currentBoxx->getVisible()) currentBoxx->draw();
+  }  
+}
+
+int Boxx::handleCommand(int x)
+{
+  // A similar comment for this? FIXME make a commandreceiver thingy
+  return 0;
+}
+
+void Boxx::processMessage(Message* m)
+{
+  // And this?
+}
+
+void Boxx::setSize(UINT w, UINT h)
+{
+  area.w = w;
+  area.h = h;
+}
+
+void Boxx::setPosition(UINT x, UINT y)
+{
+  area.x = x;
+  area.y = y;
+}
+
+void Boxx::createBuffer()
+{
+  surface = new Surface_TYPE();
+  surface->create(area.w, area.h);
+}
+
+void Boxx::add(Boxx* newChild)
+{
+  newChild->setParent(this);
+  children.push_back(newChild);
+}
+
+void Boxx::remove(Boxx* oldChild)
+{
+  for(vector<Boxx*>::iterator i = children.begin(); i != children.end(); i++)
+  {
+    if (*i == oldChild)
+    {
+      children.erase(i);
+      return;
+    }
+  }
+  Log::getInstance()->log("Boxx", Log::ERR, "Remove child box called, child %p not found", oldChild);
+}
+
+void Boxx::setParent(Boxx* newParent)
+{
+  parent = newParent;
+}
+
+void Boxx::setBackgroundColour(Colour& Tcolour)
+{
+  backgroundColour = Tcolour;
+  backgroundColourSet = true;
+}
+
+void Boxx::setVisible(bool isVisible)
+{
+  visible = isVisible;
+}
+
+bool Boxx::getVisible()
+{
+  return visible;
+}
+
+void Boxx::setGap(UINT gap)
+{
+  paraVSpace = gap;
+}
+
+void Boxx::blt(Region& r)
+{
+  /* surface update to screen needs:
+  source x distance into this surface
+  source y distance into this surface
+  width of update
+  height of update
+  destination x on screen
+  destination y on screen
+  */
+
+  if (parent)
+  {
+    printf("parent blt???\n");
+    abort();
+    return;
+  }
+
+  // this shouldn't be here
+  r.x -= area.x;
+  r.y -= area.y;
+
+  surface->updateToScreen(r.x, r.y, r.w, r.h, area.x + r.x, area.y + r.y);
+  
+}
+
+int Boxx::getScreenX()
+{
+  if (parent) return area.x + parent->getScreenX();
+  return area.x;
+}
+
+int Boxx::getScreenY()
+{
+  if (parent) return area.y + parent->getScreenY();
+  return area.y;
+}
+
+int Boxx::getRootBoxOffsetX()  // convert this to be getX and silently do the parent/not thing? same for Y below?
+{
+  if (parent) return area.x + parent->getRootBoxOffsetX();
+  return 0;
+}
+
+int Boxx::getRootBoxOffsetY()
+{
+  if (parent) return area.y + parent->getRootBoxOffsetY();
+  return 0;
+}
+
+int Boxx::getX()
+{
+  return area.x;
+}
+
+int Boxx::getY()
+{
+  return area.y;
+}
+
+UINT Boxx::getWidth()
+{
+  return area.w;
+}
+
+UINT Boxx::getHeight()
+{
+  return area.h;
+}
+
+// Level 1 drawing functions
+
+void Boxx::fillColour(Colour& colour)
+{
+  rectangle(0, 0, area.w, area.h, colour);
+}
+
+void Boxx::drawPara(char* text, int x, int y, Colour& colour)
+{
+  char line[256];
+  int lineHeight = surface->getFontHeight() + paraVSpace;
+
+  int lineWidth;
+  int thisCharWidth;
+  int textPos;
+  int linePos;
+  int ypos;
+  int printLine;
+
+  textPos = 0;
+  ypos = y;
+
+  while(1)
+  {
+    linePos = 0;
+    lineWidth = 0;
+    while(1)
+    {
+      printLine = 0;
+
+      if (text[textPos] == '\0') break;
+
+      if (text[textPos] == '\n')
+      {
+        textPos++; // ignore the \n
+        printLine = 1;
+        break;
+      }
+
+      thisCharWidth = surface->getCharWidth(text[textPos]);
+      if ((lineWidth + thisCharWidth) > (int)(area.w - (2 * paraMargin)))
+      {
+        // this character would break the right margin
+        if (text[textPos] == ' ')
+        {
+          // this char is a space, ignore and break
+          textPos++;
+          break;
+        }
+        else
+        {
+          // Need to go back to the last space in the line
+          while ((text[textPos] != ' ') && (linePos >= 0))
+          {
+            textPos--;
+            linePos--;
+          }
+          // Now take the space we just found
+          textPos++;
+          break;
+        }
+      }
+      line[linePos++] = text[textPos];
+      lineWidth += thisCharWidth;
+      textPos++;
+    }
+
+//    line[linePos++] = '\0';
+    if (linePos>=0) line[linePos++] = '\0'; //Here is the change
+
+    if (printLine || (linePos > 1)) // if some text was put in line
+    {
+      drawText(line, x, ypos, colour);
+      ypos += lineHeight;
+      if (ypos > (int)(area.h - lineHeight)) break;
+    }
+    else
+    {
+      break;
+    }
+  }
+}
+
+void Boxx::rectangle(Region& region, Colour& colour)
+{
+  rectangle(region.x, region.y, region.w, region.h, colour);
+}
+
+// Level 0 drawing functions
+
+void Boxx::rectangle(UINT x, UINT y, UINT w, UINT h, Colour& colour)
+{
+  if (parent) parent->rectangle(area.x + x, area.y + y, w, h, colour);
+  else surface->fillblt(x, y, w, h, colour.rgba());
+}
+
+void Boxx::drawText(const char* text, int x, int y, Colour& colour)
+{
+  if (parent) parent->drawText(text, area.x + x, area.y + y, colour);
+  else surface->drawText(text, x, y, colour.rgba());
+}
+
+void Boxx::drawTextRJ(const char* text, int x, int y, Colour& colour)
+{
+  if (parent) parent->drawTextRJ(text, area.x + x, area.y + y, colour);
+  else surface->drawTextRJ(text, x, y, colour.rgba());
+}
+
+void Boxx::drawTextCentre(const char* text, int x, int y, Colour& colour)
+{
+  if (parent) parent->drawTextCentre(text, area.x + x, area.y + y, colour);
+  else surface->drawTextCentre(text, x, y, colour.rgba());
+}
+
+void Boxx::drawPixel(UINT x, UINT y, Colour& colour)
+{
+  if (parent) parent->drawPixel(area.x + x, area.y + y, colour);
+  else
+  {
+    int c = (  (0xFF000000         )
+             | (colour.red    << 16)
+             | (colour.green  <<  8)
+             | (colour.blue        ) );
+
+    surface->drawPixel(x, y, c);
+  }
+}
+
+int Boxx::charWidth(char c)
+{
+  if (parent) return parent->charWidth(c);
+  else return surface->getCharWidth(c);
+}
+
diff --git a/boxx.h b/boxx.h
new file mode 100644 (file)
index 0000000..560904c
--- /dev/null
+++ b/boxx.h
@@ -0,0 +1,151 @@
+/*
+    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 BOXX_H
+#define BOXX_H
+
+#include <stdio.h>
+#include <vector>
+
+using namespace std;
+
+#include "colour.h"
+#include "region.h"
+#include "message.h"
+
+#ifdef WIN32
+#include "surfacewin.h"
+#else
+#include "surfacemvp.h"
+#endif
+
+class Boxx
+{
+  public:
+    Boxx();
+    virtual ~Boxx();
+
+    virtual void setSize(UINT w, UINT h);
+    void setPosition(UINT x, UINT y); // Set position on parent. Even numbers only!!!
+    void createBuffer(); // Make this a root view that goes in the BoxStack
+
+    void setGap(UINT gap);
+
+    // Not really for box.. see .cc
+    virtual void draw();
+    virtual int handleCommand(int);
+    virtual void processMessage(Message*);
+
+    void setBackgroundColour(Colour& colour);
+    void setVisible(bool isVisible);
+    
+    // Drawing functions level 1
+    void fillColour(Colour& colour);
+    void drawPara(char* text, int x, int y, Colour& colour);
+
+    // Drawing functions level 0
+    void rectangle(UINT x, UINT y, UINT w, UINT h, Colour& colour);
+    void rectangle(Region& region, Colour& colour);
+
+    void drawText(const char* text, int x, int y, Colour& colour);
+    void drawTextRJ(const char* text, int x, int y, Colour& colour);
+    void drawTextCentre(const char* text, int x, int y, Colour& colour);
+    void drawPixel(UINT x, UINT y, Colour& colour);
+
+    int charWidth(char c);
+
+    // Following 4 used by mouse stuff only, except 1 getWidth/getHeight? in orig. vtabsman
+    int getScreenX();
+    int getScreenY();
+    int getRootBoxOffsetX();
+    int getRootBoxOffsetY();
+    int getX();
+    int getY();
+    UINT getWidth();
+    UINT getHeight();
+    bool getVisible();
+
+    void add(Boxx*); // a boxx has a set of child boxxs
+    void remove(Boxx*);
+
+    /*
+    The following function sets the child's parent pointer without adding the child to the children vector.
+    It's a hack (that should be deprecated?) to allow things like WSymbol to be created, do some drawing on
+    the surface and then be deleted again, leaving the drawing present.
+    A better design would be to create many WSymbols - one per symbol and leave them created - then the
+    automatic draw code (not written yet) will be able to redraw the symbols without all that code needing
+    to be in the derived boxx's draw method.
+    */    
+    void TEMPADD(Boxx* child) { child->setParent(this); }
+
+  friend class BoxStack;
+  protected:
+    Boxx* parent;
+    Region area;
+    vector<Boxx*> children;
+
+    void setParent(Boxx*);    
+    void blt(Region& r);
+
+    static const int paraMargin = 10;
+    UINT paraVSpace;
+
+    Colour backgroundColour;
+    bool backgroundColourSet;
+    bool visible;
+
+    static char numBoxxes;
+    Surface* surface;
+};
+
+#endif
+
+
+/*
+
+New Boxx design
+
+It's "Boxx" because "Box" was already taken.
+
+BoxStack replaces Viewman and handles displaying a stack of root boxxs (boxxs with surfaces) on the screen.
+
+Boxx relaces Box, Widget and parts of View and represents a box with or without a surface.
+Let's call a Boxx with a surface a root box, and a boxx without a surface a child box.
+
+A boxx with a surface (root) is like an old View and is handled by BoxStack.
+A boxx without a surface (child) is like and old Widget and needs to be a child box of another boxx (root or not).
+
+Don't add a boxx with a surface to another boxx. That isn't the design.
+
+So, when you create a boxx, either that boxx calls createBuffer() on itself,
+or some other box add()s the new box to itself.
+
+Root boxxs can overlap each other - this is managed by boxstack.
+Child boxxs within a parent boxx do not overlap each other.
+However, a grandchild box can overlap a child box (but must be entirely contained within the child box).
+
+TBBoxx replaces View but is now only a convenience class for the window dressing stuff. It isn't required anymore since
+all the real work that view used to do is done in Boxx now.
+
+Obseleted classes: Box, View, Viewman, Widget, others?
+No code outside boxx should talk about surfaces anymore. Hopefully.
+
+*/
+
index 4de723d4eda31c22e8254ba61c511af823b66997..4edef1420adc7a5b53d844f34bb6a4fec0589e3d 100644 (file)
@@ -19,7 +19,9 @@
 */
 
 #include "channel.h"
+
 #include "vdr.h"
+#include "log.h"
 
 Channel::Channel()
 {
index c872c799bfc0ad8d237250a7f17a69b4782b5371..6efb9fdf11b28e4896e411d8b3823e14205662a9 100644 (file)
--- a/channel.h
+++ b/channel.h
@@ -24,7 +24,6 @@
 #include <stdio.h>
 #include <vector>
 
-#include "log.h"
 #include "defines.h"
 
 using namespace std;
index 711b8e8665f40be3cfea08a03b435987552ab54d..3db474e0aeb4cca485e9eb3dc3dd2f8457ad1c3d 100644 (file)
--- a/colour.cc
+++ b/colour.cc
@@ -34,7 +34,7 @@ Colour Colour::SELECTHIGHLIGHT(240, 250, 80);
 Colour Colour::LIGHTTEXT(255, 255, 255);
 Colour Colour::DARKTEXT(0, 0, 100);
 Colour Colour::DANGER(200, 0, 0);
-Colour Colour::BUTTONBACKGROUND(0, 0, 150);
+Colour Colour::BUTTONBACKGROUND(0, 0, 200);
 Colour Colour::PROGRAMMEB(80, 80, 240); // two colours used as alterating backgrounds for individual programmes in EPG
 Colour Colour::PROGRAMMEA(40, 40, 120); // TODO fit epg style (colours) in with rest of application
 Colour Colour::NOPROGRAMME(180, 180, 180); // no programme details colour
index e1e83e014677253d9fcc7413521d10beba07a3e3..0d0bf9d0b857f810d91787271f658f36b5e7b3c4 100644 (file)
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
+#include <linux/errno.h>
+
 #include "command.h"
+
 #ifdef WIN32
 #include "remotewin.h"
 #endif
 
+#include "led.h"
+#include "video.h"
+#include "vdr.h"
+#include "vvolume.h"
+#include "vserverselect.h"
+#include "vwelcome.h"
+#include "vmute.h"
+#include "colour.h"
+#include "osd.h"
+#include "i18n.h"
+#include "timerreceiver.h"
+#include "timers.h"
+#include "wol.h"
+#include "vvideolive.h"
+#include "vconnect.h"
+#include "message.h"
+#include "remote.h"
+#include "vinfo.h"
+#include "boxx.h"
+#include "boxstack.h"
+#include "log.h"
+
+
 Command* Command::instance = NULL;
 
 Command::Command()
@@ -51,10 +77,10 @@ int Command::init()
   initted = 1;
 
   logger = Log::getInstance();
-  viewman = ViewMan::getInstance();
+  boxstack = BoxStack::getInstance();
   remote = Remote::getInstance();
-
-  if (!logger || !viewman || !remote)
+  
+  if (!logger || !boxstack || !remote)
   {
     initted = 0;
     return 0;
@@ -87,29 +113,35 @@ void Command::doWallpaper()
   Video* video = Video::getInstance();
 
   // Blue background
-  View* v = new View();
-  v->create(video->getScreenWidth(), video->getScreenHeight());
-  v->setBackgroundColour(Colour::VIDEOBLUE);
-  v->draw();
-  viewman->add(v);
-  viewman->updateView(v);
-  viewman->removeView(v);
+  Boxx* bbg = new Boxx();
+  bbg->setSize(video->getScreenWidth(), video->getScreenHeight());
+  bbg->createBuffer();
+  bbg->fillColour(Colour::VIDEOBLUE);
+  boxstack->add(bbg);
+  boxstack->update(bbg);
+  boxstack->remove(bbg);
 
   // Wallpaper
-  wallpaper = new VWallpaper();
+  WJpeg* wallpaperj = new WJpeg();
+  wallpaperj->setSize(video->getScreenWidth(), video->getScreenHeight());
+  wallpaperj->createBuffer();
+
   if (video->getFormat() == Video::PAL)
   {
     logger->log("Command", Log::DEBUG, "PAL wallpaper selected");
-    wallpaper->init("/wallpaperPAL.jpg");
+    wallpaperj->init("/wallpaperPAL.jpg");
   }
   else
   {
     logger->log("Command", Log::DEBUG, "NTSC wallpaper selected");
-    wallpaper->init("/wallpaperNTSC.jpg");
+    wallpaperj->init("/wallpaperNTSC.jpg");
   }
-  wallpaper->draw();
-  viewman->add(wallpaper);
-  viewman->updateView(wallpaper);
+  wallpaperj->draw();
+
+  boxstack->add(wallpaperj);
+  boxstack->update(wallpaperj);
+
+  wallpaper = wallpaperj;
 }
 
 void Command::run()
@@ -136,7 +168,7 @@ void Command::run()
   //logger->log("Command", Log::DEBUG, "LOCKED");
 
   VConnect* vconnect = new VConnect();
-  viewman->add(vconnect);
+  boxstack->add(vconnect);
   vconnect->run();
 
   // Start method 2 of getting commands in...
@@ -155,13 +187,13 @@ void Command::run()
     button = remote->getButtonPress(2);  // FIXME why is this set to 2 and not 0? so it can quit
     // something happened, lock and process
 
-    //logger->log("Command", Log::DEBUG, "WANT LOCK");
+    //  logger->log("Command", Log::DEBUG, "WANT LOCK");
 #ifndef WIN32
     pthread_mutex_lock(&masterLock);
 #else
     WaitForSingleObject(masterLock, INFINITE );
 #endif
-    //logger->log("Command", Log::DEBUG, "LOCK");
+    // logger->log("Command", Log::DEBUG, "LOCK");
 
     if ((button == Remote::NA_NONE) /*|| (button == Remote::NA_UNKNOWN)*/) continue;
 
@@ -267,13 +299,13 @@ void Command::postMessageFromOuterSpace(Message* m)
   The whole message system was at first supposed to prevent the problem of
   calling a function on an object that had just been deleted, by ordering
   messages such that all calls are done before object deletion. However,
-  because of the new centralised messaging system and the fact that ViewMan
+  because of the new centralised messaging system and the fact that BoxStack
   locates the destination object before calling it, the messaging system now
   allows the kind of sloppy calls it was supposed to stop. Weird huh. This
   is mentioned here because the video stream might generate an event just as
   the user hits stop. The mutex is locked, and by the time the message
   is examined the vvideorec/live has been deleted. This doesn't matter because
-  viewman will drop the message if it can't find the matching object to
+  boxstack will drop the message if it can't find the matching object to
   deliver it to.
   Finally, all this is fine and dandy, except that I'm not 100% sure that
   this sloppy postMessage and hope a queued signal will force it to be processed
@@ -350,21 +382,22 @@ void Command::processMessage(Message* m)
       }
       case Message::CHANGE_LANGUAGE:
       {
-        viewman->removeAll();
-        viewman->updateView(wallpaper);
+        boxstack->removeAll();
+        boxstack->update(wallpaper);
         I18n::initialize();
         VWelcome* vw = new VWelcome();
         vw->draw();
-        viewman->add(vw);
-        viewman->updateView(vw);
+        boxstack->add(vw);
+        boxstack->update(vw);
         break;
       }
       case Message::LAST_VIEW_CLOSE:
       {
+//        not currently used
 //        VWelcome* vw = new VWelcome();
 //        vw->draw();
-//        viewman->add(vw);
-//        viewman->updateView(vw);
+//        boxstack->add(vw);
+//        boxstack->update(vw);
 
         break;
       }
@@ -372,16 +405,15 @@ void Command::processMessage(Message* m)
   }
   else
   {
-    logger->log("Command", Log::DEBUG, "Sending message to viewman");
-    viewman->processMessage(m);
+    logger->log("Command", Log::DEBUG, "Sending message to boxstack");
+    boxstack->processMessage(m);
   }
 }
 
 void Command::handleCommand(int button)
 {
   if (isStandby && (button != Remote::POWER)) return;
-
-  if (!connLost && viewman->handleCommand(button)) return; // don't send to viewman if connLost
+  if (!connLost && boxstack->handleCommand(button)) return; // don't send to boxstack if connLost
 
   // command was not handled
 
@@ -393,7 +425,7 @@ void Command::handleCommand(int button)
     case Remote::VOLUMEDOWN:
     {
       VVolume* v = new VVolume();
-      viewman->add(v);
+      boxstack->add(v);
       v->handleCommand(button); // this will draw+show
       return;
     }
@@ -401,8 +433,8 @@ void Command::handleCommand(int button)
     {
       VMute* v = new VMute();
       v->draw();
-      viewman->add(v);
-      viewman->updateView(v);
+      boxstack->add(v);
+      boxstack->update(v);
       return;
     }
     case Remote::POWER:
@@ -439,14 +471,14 @@ void Command::doStandby()
 
 
     VConnect* vconnect = new VConnect();
-    viewman->add(vconnect);
+    boxstack->add(vconnect);
     vconnect->run();
   }
   else
   {
-    viewman->removeAll();
+    boxstack->removeAll();
     Video::getInstance()->signalOff();
-    viewman->updateView(wallpaper);
+    boxstack->update(wallpaper);
 
     VDR::getInstance()->configSave("General", "Last Power State", "Off");
     VDR::getInstance()->disconnect();
@@ -463,29 +495,30 @@ void Command::doFromTheTop(bool which)
   if (which)
   {
     connLost = new VInfo();
-    connLost->create(360, 200);
+    connLost->setSize(360, 200);
+    connLost->createBuffer();
     if (Video::getInstance()->getFormat() == Video::PAL)
-      connLost->setScreenPos(190, 170);
+      connLost->setPosition(190, 170);
     else
-      connLost->setScreenPos(180, 120);
+      connLost->setPosition(180, 120);
     connLost->setOneLiner(tr("Connection lost"));
     connLost->setDropThrough();
     connLost->setBorderOn(1);
     connLost->setTitleBarColour(Colour::DANGER);
     connLost->okButton();
     connLost->draw();
-    viewman->add(connLost);
-    viewman->updateView(connLost);
+    boxstack->add(connLost);
+    boxstack->update(connLost);
     remote->clearBuffer();
   }
   else
   {
     VDR::getInstance()->disconnect();
-    viewman->removeAll();
-    viewman->updateView(wallpaper);
+    boxstack->removeAll();
+    boxstack->update(wallpaper);
     connLost = NULL;
     VConnect* vconnect = new VConnect();
-    viewman->add(vconnect);
+    boxstack->add(vconnect);
     vconnect->run();
   }
 }
@@ -512,19 +545,19 @@ void Command::doJustConnected(VConnect* vconnect)
 {
   I18n::initialize();
   Video* video = Video::getInstance();
-  viewman->removeView(vconnect);
+  boxstack->remove(vconnect);
 
   VInfo* vi = new VInfo();
-  vi->create(400, 200);
+  vi->setSize(400, 200);
+  vi->createBuffer();
   if (video->getFormat() == Video::PAL)
-    vi->setScreenPos(170, 200);
+    vi->setPosition(170, 200);
   else
-    vi->setScreenPos(160, 150);
-
+    vi->setPosition(160, 150);
   vi->setOneLiner(tr("Connected, loading config"));
   vi->draw();
-  viewman->add(vi);
-  viewman->updateView(vi);
+  boxstack->add(vi);
+  boxstack->update(vi);
 
   VDR* vdr = VDR::getInstance();
   char* config;
@@ -541,8 +574,8 @@ void Command::doJustConnected(VConnect* vconnect)
       // Oh sheesh, need to switch format. Bye bye TV...
 
       // Take everything down
-      viewman->removeAll();
-      viewman->removeView(wallpaper);
+      boxstack->removeAll();
+      boxstack->remove(wallpaper);
       Osd* osd = Osd::getInstance();
       osd->shutdown();
       video->shutdown();
@@ -565,16 +598,17 @@ void Command::doJustConnected(VConnect* vconnect)
 
       // Re add the vinfo
       vi = new VInfo();
-      vi->create(400, 200);
+      vi->setSize(400, 200);
+      vi->createBuffer();
       if (video->getFormat() == Video::PAL)
-        vi->setScreenPos(170, 200);
+        vi->setPosition(170, 200);
       else
-        vi->setScreenPos(160, 150);
+        vi->setPosition(160, 150);
 
       vi->setOneLiner(tr("Connected, loading config"));
       vi->draw();
-      viewman->add(vi);
-      viewman->updateView(vi);
+      boxstack->add(vi);
+      boxstack->update(vi);
     }
     else
     {
@@ -804,15 +838,15 @@ void Command::doJustConnected(VConnect* vconnect)
   }
   else
   {
-    viewman->removeView(vi);
+    boxstack->remove(vi);
 
     VWelcome* vw = new VWelcome();
     vw->draw();
-    viewman->add(vw);
-    viewman->updateView(vw);
+    boxstack->add(vw);
+    boxstack->update(vw);
 
     // Enter pre-keys here
-//    handleCommand(Remote::THREE);
+//    handleCommand(Remote::SIX);
 //    handleCommand(Remote::UP);
 //    handleCommand(Remote::PLAY);
 //    handleCommand(Remote::DOWN);
@@ -820,6 +854,6 @@ void Command::doJustConnected(VConnect* vconnect)
 //    handleCommand(Remote::DOWN);
 //    handleCommand(Remote::OK);
 //    handleCommand(Remote::OK);
-//    handleCommand(Remote::OK);
+//    handleCommand(Remote::RED);
   }
 }
index a5a6d03e4abc65b40e4f60775c6419ff4d0a6b2c..e07dda2a265a3dd6f9d86e718df8a30d74daa8a7 100644 (file)
--- a/command.h
+++ b/command.h
 #include <signal.h>
 
 #include "defines.h"
-#include "log.h"
-#include "viewman.h"
-#include "led.h"
-#include "video.h"
-#include "remote.h"
-#include "vdr.h"
-#include "message.h"
 #include "messagequeue.h"
-#include "box.h"
-#include "view.h"
-#include "vinfo.h"
-#include "vwallpaper.h"
-#include "vvolume.h"
-#include "vconnect.h"
-#include "vserverselect.h"
-#include "vwelcome.h"
-#include "vmute.h"
-#include "colour.h"
-#include "osd.h"
-#include "i18n.h"
-#include "timerreceiver.h"
-#include "timers.h"
 #include "udp.h"
 
 class VConnect;
+class Message;
+class Remote;
+class Boxx;
+class BoxStack;
+class Log;
+class VInfo;
 
 class Command : public MessageQueue
 {
@@ -102,11 +87,11 @@ class Command : public MessageQueue
     UCHAR firstBoot;
 
     Log* logger;
-    ViewMan* viewman;
+    BoxStack* boxstack;
     Remote* remote;
-    VWallpaper* wallpaper;
+    Boxx* wallpaper;
     VInfo* connLost;
-
+    
     UDP udp;
 
     void processMessage(Message* m);
index 6f1c78a4615695ac7c9e91bc0bdc991138271214..d2eb4f451b7fdf2cd438cf31eed8696db2ecd2a5 100644 (file)
--- a/defines.h
+++ b/defines.h
@@ -66,4 +66,19 @@ void MILLISLEEP(ULONG a);
 
 #endif
 
+/*
+typedef struct
+{
+  UINT id;               // Used for working out what has changed at the end
+  char *title;           // Name of the option
+  char *configSection;   // Which section of the config file
+  char *configParam;     // Parameter name in the config file
+  UINT optionType;       // 1 for text, 2 for int
+  UINT optionCount;      // How many choices?
+  UINT defaultOption;    // Serial of the default choice (base 0), or actual option in int mode
+  int startInt;          // Starting int for int mode
+  const char * const * options;  // Text for the options (null for int mode)
+} OPTIONDATA;
+*/
+
 #endif
index e2f524475f55e22480c32dce7d6c114a7ce71176..f53947423211bbfe011f2cfcdaa1792e9b2b9da2 100644 (file)
@@ -1184,13 +1184,13 @@ int id3_tag::stringlen(bool withTitle) const {
 //create a string out of the id3 tag info
 //delete this string afterwards if you did not provide the buffer
 char * id3_tag::toString(char *b, int len, bool withTitle) const {
-  char *ta=tr("Artist");
+  const char *ta=tr("Artist");
 //char *tg=tr("Genre");
 //char *ty=tr("Year");
-  char *tx=tr("Album");
+  const char *tx=tr("Album");
 //char *to=tr("Composer");
 //char *tc=tr("Comment");
-  char *tn=tr("Track");
+  const char *tn=tr("Track");
   /* in the moment:
      Title: 
      Artist:
@@ -1204,7 +1204,7 @@ char * id3_tag::toString(char *b, int len, bool withTitle) const {
        const char * del=" - ";
        if (strlen(year) == 0) del="";
        if (withTitle){
-    char *tt=tr("Title");
+    const char *tt=tr("Title");
                snprintf(b,len-1,"%s: %s\n%s: %s\n%s: %s%s%s\n%s: %s",
                                tt,title,ta,artist,tx,year,del,album,tn,track);
        }
index b08a784f085ef34322b2f363a550bdcb915faed2..c4d9b6ae658219d952c30446733e5d20c6ac4e93 100644 (file)
--- a/event.cc
+++ b/event.cc
@@ -38,21 +38,21 @@ Event::~Event()
   if (description) delete[] description;
 }
 
-void Event::settitle(char* s)
+void Event::settitle(const char* s)
 {
   delete title;
   title = new char[strlen(s) + 1];
   strcpy(title, s);
 }
 
-void Event::setdescription(char* s)
+void Event::setdescription(const char* s)
 {
   delete description;
   description = new char[strlen(s) + 1];
   strcpy(description, s);
 }
 
-void Event::setsubtitle(char* s)
+void Event::setsubtitle(const char* s)
 {
   delete subtitle;
   subtitle = new char[strlen(s) + 1];
diff --git a/event.h b/event.h
index 05b6d4750e822934a210e5a94a46f8802a7bf82a..71fc45ddad6195a76cd183747629f42b078f2a73 100644 (file)
--- a/event.h
+++ b/event.h
@@ -32,9 +32,9 @@ class Event
     Event();
     ~Event();
 
-    void settitle(char* title);
-    void setsubtitle(char* subtitle);
-    void setdescription(char* description);
+    void settitle(const char* title);
+    void setsubtitle(const char* subtitle);
+    void setdescription(const char* description);
 
     ULONG id;
     ULONG time;
diff --git a/i18n.cc b/i18n.cc
index 4097bf7b0bafe6f5c76f850f6b8784b161571fe7..f36d052c9394a23f43a186ba3f68358f610691cc 100644 (file)
--- a/i18n.cc
+++ b/i18n.cc
@@ -25,6 +25,9 @@
 #include "i18n.h"
 #include "language-data.h"
 
+#include "log.h"
+#include "vdr.h"
+
 int I18n::LanguageID = DEFAULT_LANGUAGE_INDEX;
 
 int I18n::initialize(void)
@@ -47,7 +50,7 @@ int I18n::initialize(void)
   return LanguageID;
 }
 
-char* I18n::translate(char* s)
+const char* I18n::translate(const char* s)
 {
   if (LanguageID >= 0)
   {
diff --git a/i18n.h b/i18n.h
index 86a930e4b81dad642d52cbf96cc1db610a2475a5..77ff57aee309a96122f5885d27f95c6e34a1fe74 100644 (file)
--- a/i18n.h
+++ b/i18n.h
@@ -33,8 +33,7 @@
 #endif
 
 #include "defines.h"
-#include "log.h"
-#include "vdr.h"
+
 
 #define I18N_HEADER
 #include "language-data.h"
@@ -46,7 +45,7 @@ class I18n
 {
   public:
     static int initialize(void);
-    static char* translate(char* s);
+    static const char* translate(const char* s);
 
     static const char* LanguageName(int index);
     static int LanguageIndex(const char* name);
diff --git a/main.cc b/main.cc
index f51b75de950cf1a7c4cbbfa51fd1d906013770eb..bf1910be0b5cfd97c385a526aea09a1aa9189da4 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -31,7 +31,7 @@
 #include "log.h"
 #include "timers.h"
 #include "vdr.h"
-#include "viewman.h"
+#include "boxstack.h"
 #include "command.h"
 
 #include "mtdmvp.h"
@@ -40,6 +40,7 @@
 #include "osdmvp.h"
 #include "audiomvp.h"
 #include "videomvp.h"
+#include "wol.h"
 
 #ifndef WIN32
 void sighandler(int signalReceived);
@@ -60,7 +61,7 @@ Mtd* mtd;
 Led* led;
 Osd* osd;
 Timers* timers;
-ViewMan* viewman;
+BoxStack* boxstack;
 Command* command;
 VDR* vdr;
 Video* video;
@@ -87,11 +88,11 @@ int main(int argc, char** argv)
   osd        = new OsdMVP();
   audio      = new AudioMVP();
   video      = new VideoMVP();
-  viewman    = new ViewMan();
+  boxstack   = new BoxStack();
   command    = new Command();
   wol        = new Wol();
 
-  if (!logger || !remote || !mtd || !led || !osd || !video || !audio || !viewman || !command || !wol)
+  if (!logger || !remote || !mtd || !led || !osd || !video || !audio || !boxstack || !command || !wol)
   {
     printf("Could not create objects. Memory problems?\n");
     shutdown(1);
@@ -270,14 +271,14 @@ int main(int argc, char** argv)
     shutdown(1);
   }
 
-  success = viewman->init();
+  success = boxstack->init();
   if (success)
   {
-    logger->log("Core", Log::INFO, "ViewMan module initialised");
+    logger->log("Core", Log::INFO, "BoxStack module initialised");
   }
   else
   {
-    logger->log("Core", Log::EMERG, "ViewMan module failed to initialise");
+    logger->log("Core", Log::EMERG, "BoxStack module failed to initialise");
     shutdown(1);
   }
 
@@ -359,13 +360,14 @@ void sighandler(int signalReceived)
 
 void shutdown(int code)
 {
-  if (viewman)
+  if (boxstack)
   {
-    viewman->shutdown();
-    delete viewman;
-    logger->log("Core", Log::NOTICE, "ViewMan module shut down");
+    boxstack->shutdown();
+    delete boxstack;
+    logger->log("Core", Log::NOTICE, "BoxStack module shut down");
   }
 
+  // FIXME, send a del all to boxstack first, then get rid of it after command?
   if (command) // shut down command here in case views have posted messages
   {
     command->shutdown();
index 9f1a4b028e8baadac264e3f00bac30397cb40815..d08fa8c30bd5bc4bc1fb8d34da66b8d0306a21e1 100644 (file)
--- a/message.h
+++ b/message.h
@@ -72,6 +72,7 @@ class Message
     const static ULONG CHANGE_LANGUAGE = 27;
     const static ULONG LAST_VIEW_CLOSE = 28;
     const static ULONG CHANGED_REMOTECONTROL = 29;
+    const static ULONG DELETE_SELECTED_TIMER = 30;
 };
 
 #endif
index e5b0ab846fea1e4e08f1b9d7aada8e078eba41f7..a9b5a66c35108c4f0692437f890a4de79b55758d 100644 (file)
@@ -20,6 +20,9 @@
 
 #include "messagequeue.h"
 
+#include "message.h"
+#include "log.h"
+
 void MessageQueue::postMessage(Message* m)
 {
   messages.push(m);
index 9949424b7498ea1e91f41949a4da97b1cae1a68f..b167c67d10b44cabb2df8b51ee90e6404888325a 100644 (file)
@@ -24,8 +24,7 @@
 #include <queue>
 using namespace std;
 
-#include "message.h"
-#include "log.h"
+class Message;
 
 typedef queue<Message*> MQueue;
 
index 24654ed08caed16e236ef07c0aaa088b898650dc..87b74c18a875fa7861bf110faa0e799abd34ead6 100644 (file)
--- a/mtdmvp.cc
+++ b/mtdmvp.cc
@@ -20,6 +20,8 @@
 
 #include "mtdmvp.h"
 
+#include "log.h"
+
 MtdMVP::MtdMVP()
 {
   if (instance) return;
index 21d64048b282f5496f22e4daa3390bd07930e75c..fe858047158013a2de57b83e87039df30276ef0e 100644 (file)
--- a/mtdmvp.h
+++ b/mtdmvp.h
@@ -43,7 +43,6 @@ So, am assuming:
 #include <unistd.h>
 #include <fcntl.h>
 
-#include "log.h"
 #include "mtd.h"
 
 class MtdMVP : public Mtd
index d9eb4c21464191b316b4eb5f27dd1022cdca0ed7..8f89d10d5fc4898a759ccde187f6d74bc60083c9 100644 (file)
@@ -1,19 +1,17 @@
 OBJECTS1 = command.o log.o tcp.o dsock.o thread.o timers.o i18n.o mutex.o     \
            message.o messagequeue.o udp.o wol.o                               \
            vdr.o recman.o recording.o recinfo.o channel.o rectimer.o event.o  \
-           directory.o mark.o                                                 \
+           directory.o mark.o option.o                                        \
            player.o playerradio.o vfeed.o afeed.o                             \
            demuxer.o demuxervdr.o demuxerts.o stream.o draintarget.o          \
-           viewman.o box.o region.o colour.o view.o                           \
-           vinfo.o vquestion.o vwallpaper.o vrecordinglist.o vlivebanner.o    \
-           vmute.o vvolume.o voptions.o                                       \
-           vtimerlist.o vtimeredit.o voptionsmenu.o vrecordingmenu.o          \
+           region.o colour.o boxstack.o boxx.o tbboxx.o                       \
+           vinfo.o vquestion.o vrecordinglist.o vlivebanner.o                 \
+           vmute.o vvolume.o vtimerlist.o vtimeredit.o vrecordingmenu.o       \
            vchannellist.o vwelcome.o vvideolive.o vvideorec.o vepgsettimer.o  \
            vchannelselect.o vserverselect.o vconnect.o vepg.o vrecmove.o      \
-           vradiorec.o vaudioselector.o vscreensaver.o                        \
-           vtabsviewman.o vremoteconfig.o                                     \
-           widget.o wselectlist.o wjpeg.o wsymbol.o wbutton.o                 \
-           woptionbox.o wtextbox.o wwss.o                                     \
+           vradiorec.o vaudioselector.o vscreensaver.o vopts.o                \
+           wselectlist.o wjpeg.o wsymbol.o wbutton.o wtextbox.o wwss.o        \
+           woptionpane.o woptionbox.o wremoteconfig.o wtabbar.o               \
            fonts/helvB24.o fonts/helvB18.o                                    \
            remote.o led.o mtd.o video.o audio.o osd.o surface.o               \
            vmedialist.o media.o vpicture.o vpicturebanner.o                   \
diff --git a/option.cc b/option.cc
new file mode 100644 (file)
index 0000000..310d3ba
--- /dev/null
+++ b/option.cc
@@ -0,0 +1,53 @@
+/*
+    Copyright 2007 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 "option.h"
+#include "vdr.h"
+
+Option::Option(UINT ID, const char* DISPLAYTEXT, const char* CONFIGSECTION, const char* CONFIGKEY, UINT OPTIONTYPE, 
+               UINT NUMCHOICES, UINT DEFAULTCHOICE, UINT STARTINT, const char * const * OPTIONS)
+: id(ID), displayText(DISPLAYTEXT), configSection(CONFIGSECTION), configKey(CONFIGKEY), optionType(OPTIONTYPE),
+  numChoices(NUMCHOICES), defaultChoice(DEFAULTCHOICE), startInt(STARTINT), options(OPTIONS)
+{
+  configChoice = defaultChoice;
+  userSetChoice = defaultChoice;
+  
+  // Now see if there is a config saved at vdr for this option
+  char* config = VDR::getInstance()->configLoad(configSection, configKey);
+  if (config)
+  {
+    if (optionType == TYPE_TEXT)
+    {
+      for (UINT i = 0; i < numChoices; i++)
+      {
+        if (!STRCASECMP(config, options[i]))
+        {
+          configChoice = i;
+        }
+      }
+    }
+    else
+    {
+      configChoice = atoi(config);
+    }
+    delete[] config;
+  }
+}
+
diff --git a/option.h b/option.h
new file mode 100644 (file)
index 0000000..00056a9
--- /dev/null
+++ b/option.h
@@ -0,0 +1,50 @@
+/*
+    Copyright 2007 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 OPTION_H
+#define OPTION_H
+
+#include "defines.h"
+
+class Option
+{
+  public:
+    Option(UINT id, const char* displayText, const char* configSection, const char* configKey, UINT optionType, 
+           UINT numChoices, UINT defaultChoice, UINT startInt, const char * const * options);
+  
+    UINT id;
+    const char* displayText;
+    const char* configSection;
+    const char* configKey;
+    UCHAR optionType;
+    UINT numChoices;
+    UINT defaultChoice;
+    int startInt;
+    const char * const * options;
+    
+    UINT configChoice;
+    UINT userSetChoice;
+
+    const static UCHAR TYPE_TEXT = 1;
+    const static UCHAR TYPE_INT  = 2;
+};
+
+#endif
+
diff --git a/osd.cc b/osd.cc
index 96db8e37ac742e11224ee70763ef2a230a6fee9b..b2453f8491a1adad4dd07c01d0de646c779fd4e2 100644 (file)
--- a/osd.cc
+++ b/osd.cc
@@ -20,6 +20,8 @@
 
 #include "osd.h"
 
+#include "surface.h"
+
 Osd* Osd::instance = NULL;
 
 Osd::Osd()
diff --git a/osd.h b/osd.h
index c22dfe0e98ea96edca4d4a95646befa88825b65b..eec42248c28eb676b1c66b37f45b35ed0f590b63 100644 (file)
--- a/osd.h
+++ b/osd.h
@@ -23,7 +23,7 @@
 
 #include <stdio.h>
 
-#include "surface.h"
+class Surface;
 
 class Osd
 {
index 23e0b910e82aec1ce9e5d94e0a780c5e9cf6c64e..e0858c7254277fcefdfbce4906e5527af1ba3bbe 100644 (file)
--- a/osdwin.cc
+++ b/osdwin.cc
@@ -309,9 +309,10 @@ bool OsdWin::DoLost(){
        }
     d3ddevice->GetRenderTarget(0,&d3drtsurf);
        InitVertexBuffer();
-    //Redraw Views, Chris could you add a member function to viewman, so that
+    //Redraw Views, Chris could you add a member function to BoxStack, so that
        // I can cause it to completely redraw the Views?
        // Otherwise the OSD would be distorted after Device Lost
+       // FIXME
        
        SetEvent(event);
 
index 8f2c07618ea890f74336a08ffb74b16089b09494..9d77ab6d3fe1baf1565b5cd842845fe917ae4964 100644 (file)
--- a/player.cc
+++ b/player.cc
 
 #include "player.h"
 
+#include "log.h"
+#include "audio.h"
+#include "video.h"
+#include "demuxervdr.h"
+#include "demuxerts.h"
+#include "vdr.h"
+#include "messagequeue.h"
+#include "remote.h"
+#include "message.h"
+
 #define USER_RESPONSE_TIME 500 // Milliseconds
 
 // ----------------------------------- Called from outside, one offs or info funcs
@@ -162,7 +172,10 @@ int Player::getCurrentAudioChannel()
 
 void Player::setAudioChannel(int newChannel)
 {
-  demuxer->setAudioChannel(newChannel);
+  if (isRecording)
+    demuxer->setAudioChannel(newChannel);
+  else
+    ((DemuxerTS*)demuxer)->setAID(newChannel);
 }
 
 // ----------------------------------- Externally called events
index 4306cbc2384615ce2315e3ca8864f60db78eb980..b7033b5b8fed63a3934b85355f2dd8a82fd38312 100644 (file)
--- a/player.h
+++ b/player.h
 #endif
 #include <time.h>
 
-#include "audio.h"
-#include "video.h"
-#include "demuxervdr.h"
-#include "demuxerts.h"
-#include "vfeed.h"
-#include "afeed.h"
-#include "remote.h"
-#include "vdr.h"
-#include "callback.h"
-#include "message.h"
-#include "messagequeue.h"
-
 #ifdef WIN32
 #include "threadwin.h"
 #else
 #include "threadp.h"
 #endif
 
+#include "callback.h"
+#include "defines.h"
+#include "vfeed.h"
+#include "afeed.h"
+
+class MessageQueue;
+class Audio;
+class Video;
+class VDR;
+class Log;
+class Demuxer;
+
 class Player : public Thread_TYPE, public Callback
 {
   public:
index ee1a7882d924791f4efbc039c7af0e7f3d7f76c3..55a6377d6c9d221842a74d661cd60dd4dd46e31d 100644 (file)
 
 #include "playerradio.h"
 
+#include "log.h"
+#include "audio.h"
+#include "video.h"
+#include "demuxervdr.h"
+#include "demuxerts.h"
+#include "remote.h"
+#include "vdr.h"
+#include "message.h"
+#include "messagequeue.h"
+
 // ----------------------------------- Called from outside, one offs or info funcs
 
 PlayerRadio::PlayerRadio(MessageQueue* tmessageQueue, void* tmessageReceiver, bool tIsRecording)
index 863ea912d8b219211715ec9ea08ee1ccf4ba7d36..ea51dd021a003e51a4eea85c748f29c310a8f012 100644 (file)
 #endif
 #include <time.h>
 
-#include "audio.h"
-#include "video.h"
-#include "demuxervdr.h"
-#include "demuxerts.h"
-#include "afeed.h"
-#include "remote.h"
-#include "vdr.h"
-#include "callback.h"
-#include "message.h"
-#include "messagequeue.h"
-
 #ifdef WIN32
 #include "threadwin.h"
 #else
 #include "threadp.h"
 #endif
+#include "callback.h"
+#include "defines.h"
+#include "afeed.h"
+
+class Log;
+class Audio;
+class Video;
+class Demuxer;
+class VDR;
+class MessageQueue;
 
 class PlayerRadio : public Thread_TYPE, public Callback
 {
index faa370aad0150dba28f13700735209d4ace32b1e..22e4753ae31d1935104c3260055bec39478091be 100644 (file)
@@ -19,6 +19,7 @@
 */
 
 #include "recinfo.h"
+#include "log.h"
 
 RecInfo::RecInfo()
 {
index 031fcc5ea39f396be1f7088cd638b433a0f24d1d..1c535da9383f3091243d8347f40b49042fa40a09 100644 (file)
--- a/recinfo.h
+++ b/recinfo.h
@@ -24,7 +24,6 @@
 #include <time.h>
 
 #include "defines.h"
-#include "log.h"
 
 class RecInfo
 {
index e46da9548ef84c34cea97cdc47209b535b197e4f..524d91648711d7235e2a02c95924d1ce99ac4bab 100644 (file)
--- a/recman.cc
+++ b/recman.cc
@@ -19,6 +19,7 @@
 */
 
 #include "recman.h"
+
 #include "vdr.h"
 
 RecMan::RecMan()
index 5f7b3817c65bcfd59f3db597e72b2976662e9e0d..b9c123f87bb58217e28198a0a0fe521bca452a9c 100644 (file)
 
 #include "recording.h"
 
+#include "recinfo.h"
+#include "mark.h"
+#include "log.h"
+#include "demuxer.h"
+
 Recording* Recording::recInfoFor = NULL;
 RecInfo* Recording::recInfo = NULL;
 
index 14b6c0f7812641606a788ecd39909f48aaba743d..2b3490ce3ba11b33cfbfd250db285d73c8ac356f 100644 (file)
 #include <string.h>
 #include "defines.h"
 #include "vdr.h"
-#include "recinfo.h"
-#include "mark.h"
-#include "log.h"
-#include "demuxer.h"
+
+class Log;
 
 class Recording
 {
index cb5cfcd4d70fdbc91071f8e2d37b14a19d8c3812..d351a8aa625c5c4bce27193895117174b57f9294 100644 (file)
@@ -45,6 +45,8 @@ class RecTimer
     ULONG channelNumber;
     ULONG startTime;
     ULONG stopTime;
+    ULONG day;
+    ULONG weekDays;
 
 //    int index;
 
index 8da388bde9c38f1b9afd9978b2e4e4eef1625a5f..7e6ea758d36b71f1718d93fcbb21fc6f9d6d5203 100644 (file)
--- a/remote.cc
+++ b/remote.cc
@@ -19,7 +19,9 @@
 */
 
 #include "remote.h"
+
 #include "i18n.h"
+#include "log.h"
 
 Remote* Remote::instance = NULL;
 
index 7d0be6ee1e9b9713a5babc1c81f409b19df54ef5..729713df3440e780b85c7f32fe5bb0681d737a9a 100644 (file)
--- a/remote.h
+++ b/remote.h
@@ -25,7 +25,6 @@
 #include <map>
 
 #include "defines.h"
-#include "log.h"
 
 using namespace std;
 typedef map<ULLONG,UCHAR> RemoteTranslationList;
index bb078597f66f8d8e1c602f735077ff57aeacb37a..ff209830ae19f4e2fbafe83287b393480e7a719d 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "remotemvp.h"
 
+#include "log.h"
+
 RemoteMVP::RemoteMVP()
 {
   if (instance) return;
index 25c3844d90b57ba8c02d2ef24103b724141440be..09425a85845560790ac5a4ce1505f14bee5f1f52 100644 (file)
@@ -25,9 +25,8 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-#include "defines.h"
-#include "log.h"
 #include "remote.h"
+#include "defines.h"
 
 class RemoteMVP : public Remote
 {
index 59c5575cb2aede91b81d6e996bb0427c0267324d..1f13c1f8cb7f9cbc19417e88f93b612a7640c1c5 100644 (file)
--- a/stream.h
+++ b/stream.h
@@ -34,6 +34,7 @@
 #endif
 #include <memory.h>
 #include "defines.h"
+
 #include "draintarget.h"
 
 class Stream
index 8a4c42bae398e039a5c75c69b4a20af2d76885f4..fc69577db374b85547b6bc091d2402cda592528a 100644 (file)
@@ -19,7 +19,9 @@
 */
 
 #include "surface.h"
+
 #include "osd.h"
+#include "log.h"
 
 Surface* Surface::screen = NULL;
 osd_font_t* Surface::font = &font_helvB18;
@@ -38,7 +40,7 @@ Surface* Surface::getScreen()
   return screen;
 }
 
-int Surface::drawText(char* text, int x, int y, ULONG rgba)
+int Surface::drawText(const char* text, int x, int y, ULONG rgba)
 {
   int h, n, i;
   int Y, X, cx;
@@ -71,7 +73,7 @@ int Surface::drawText(char* text, int x, int y, ULONG rgba)
   return 1;
 }
 
-int Surface::drawTextRJ(char* text, int x, int y, ULONG rgba)
+int Surface::drawTextRJ(const char* text, int x, int y, ULONG rgba)
 {
   int i, n, w;
   w = 0;
@@ -89,7 +91,7 @@ int Surface::drawTextRJ(char* text, int x, int y, ULONG rgba)
   else return drawText(text, x, y, rgba);
 }
 
-int Surface::drawTextCentre(char* text, int x, int y, ULONG rgba)
+int Surface::drawTextCentre(const char* text, int x, int y, ULONG rgba)
 {
   int i, n, w;
   w = 0;
index 557f630ea3a095a9af34fdf83d730bc03a71930d..56611ceb829dfc81dd66086f8bb7cb98b4221dc7 100644 (file)
--- a/surface.h
+++ b/surface.h
@@ -23,7 +23,6 @@
 
 #include <stdio.h>
 #include "defines.h"
-#include "log.h"
 
 // Font stuff
 
@@ -50,9 +49,9 @@ class Surface
     static int getFontHeight();
     int getCharWidth(char c);
 
-    int drawText(char* text, int x, int y, ULONG rgba);
-    int drawTextRJ(char* text, int x, int y, ULONG rgba);
-    int drawTextCentre(char* text, int x, int y, ULONG rgba);
+    int drawText(const char* text, int x, int y, ULONG rgba);
+    int drawTextRJ(const char* text, int x, int y, ULONG rgba);
+    int drawTextCentre(const char* text, int x, int y, ULONG rgba);
 
     virtual int create(UINT width, UINT height)=0;
     virtual void display()=0;
index 4fe3bccba7a327ebd9bdd054f2af53e8c388f874..b088178d5a19fa52efa4ccfb5eac4cb351b17242 100644 (file)
@@ -20,7 +20,9 @@
 */
 
 #include "surfacemvp.h"
+
 #include "osd.h"
+#include "log.h"
 
 SurfaceMVP::SurfaceMVP(int id)
 : Surface(id)
index 79c4083eca1281ecc484751349fa39cb9031cc70..574651410f18345217393b7708e2157aa2a0ff9b 100644 (file)
@@ -34,7 +34,6 @@ extern "C"
 }
 
 #include "defines.h"
-#include "log.h"
 #include "surface.h"
 
 // Structures for surface management
index b5f32260e24d9a7036b528cd56a51e9828dcd02e..dfaea4ee9569e2ac62b361b4a03f37a740313038 100644 (file)
@@ -21,6 +21,7 @@
 #include "surfacewin.h"
 #include "osdwin.h"
 #include <d3dx9tex.h>
+#include "log.h"
 
 SurfaceWin::SurfaceWin(int id)
 : Surface(id)
index 6409103b7f71807e363964ae3c8a970d39e46da9..45423d7d8d1a1a25671dd2adefaa742f3fc516a4 100644 (file)
@@ -22,7 +22,6 @@
 #define SURFACEWIN_H
 
 #include "defines.h"
-#include "log.h"
 #include "surface.h"
 #include <winsock2.h>
 #include <d3d9.h>
diff --git a/tbboxx.cc b/tbboxx.cc
new file mode 100644 (file)
index 0000000..4019b77
--- /dev/null
+++ b/tbboxx.cc
@@ -0,0 +1,78 @@
+/*
+    Copyright 2007 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 "tbboxx.h"
+
+#include "log.h"
+
+TBBoxx::TBBoxx()
+{
+  titleBarOn = 0;
+  borderOn = 0;
+  titleText = NULL;
+}
+
+TBBoxx::~TBBoxx()
+{
+  if (titleText) delete[] titleText;
+}
+
+void TBBoxx::setTitleText(const char* takeText)
+{
+  int length = strlen(takeText);
+  titleText = new char[length + 1];
+  strcpy(titleText, takeText);
+}
+
+void TBBoxx::draw()
+{
+  Log::getInstance()->log("TBBoxx", Log::DEBUG, "Draw");
+  
+  fillColour(Colour::VIEWBACKGROUND);
+
+  if (borderOn)
+  {
+    rectangle(0, 0, area.w, area.h, titleBarColour);
+    rectangle(5, 5, area.w-10, area.h-10, Colour::VIEWBACKGROUND);
+  }
+
+  if (titleBarOn)
+  {
+    rectangle(0, 0, area.w, 30, titleBarColour);
+    if (titleText) drawText(titleText, 5, 5, Colour::LIGHTTEXT);
+  }
+
+  Boxx::draw();  
+}
+
+void TBBoxx::setTitleBarColour(Colour& Tcolour)
+{
+  titleBarColour = Tcolour;
+}
+
+void TBBoxx::setTitleBarOn(UCHAR on)
+{
+  titleBarOn = on;
+}
+
+void TBBoxx::setBorderOn(UCHAR on)
+{
+  borderOn = on;
+}
diff --git a/tbboxx.h b/tbboxx.h
new file mode 100644 (file)
index 0000000..b1290c3
--- /dev/null
+++ b/tbboxx.h
@@ -0,0 +1,56 @@
+/*
+    Copyright 2007 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 TBBOXX_H
+#define TBBOXX_H
+
+#include <stdio.h>
+
+#include "boxx.h"
+#include "defines.h"
+#include "colour.h"
+
+// Note! Do not use setBackgroundColour on a TBBoxx or anything derived from it -
+// it will screw up the display
+
+class TBBoxx : public Boxx
+{
+  public:
+    TBBoxx();
+    virtual ~TBBoxx();
+    virtual void draw();
+
+    void setBorderOn(UCHAR on);
+    void setTitleBarOn(UCHAR on);
+    void setTitleText(const char* title);
+
+    void setTitleBarColour(Colour& colour);
+    char* getTitleText() { return titleText; };
+
+  private:
+    char* titleText;
+    UCHAR borderOn;
+
+  protected:
+    Colour titleBarColour;
+    UCHAR titleBarOn;
+};
+
+#endif
diff --git a/tcp.cc b/tcp.cc
index 2600635b24162f3eed5491d41de7360de212cc47..70f53ee6c199ff69d6609f91fa911bf53a9e7bb1 100644 (file)
--- a/tcp.cc
+++ b/tcp.cc
@@ -24,6 +24,8 @@
 #include <Iphlpapi.h>
 #endif
 
+#include "log.h"
+
 TCP::TCP()
 {
   sock = 0;
diff --git a/tcp.h b/tcp.h
index 0ecba21e3cfe56d82ee070aeecc4b1230958dc2e..9b2e6be41376d6bb0ebfba4046a3288c8cc65ec7 100644 (file)
--- a/tcp.h
+++ b/tcp.h
@@ -43,7 +43,6 @@
 #endif
 
 #include "defines.h"
-#include "log.h"
 
 class TCP
 {
index 0c1b460988ea527b6381201790f8b5e5a4bfb32a..a95e964b6733e1b6f913b74410faf033f9d9d77e 100755 (executable)
--- a/timers.cc
+++ b/timers.cc
 
 #include "timers.h"
 
+#include "log.h"
+#include "command.h"
+#include "timerreceiver.h"
+
 Timers* Timers::instance = NULL;
 
 Timers::Timers()
index 3c95e60c1b876f1ece007f11fe0e4c13b9657384..55ddc9a76cd79e076c17fe2cec6cbb22d14e4003 100755 (executable)
--- a/timers.h
+++ b/timers.h
 #define TIMERS_H
 
 #include <stdio.h>
+#include <list>
+
 #ifndef WIN32
-#include <pthread.h>
+#include "threadp.h"
+#else
+#include "threadwin.h"
 #endif
-#include <list>
 
 #include "defines.h"
-#include "log.h"
-#include "command.h"
-#include "timerreceiver.h"
 
-#ifdef WIN32
-#include "threadwin.h"
-#else
-#include "threadp.h"
-#endif
+
+class Log;
+class TimerReceiver;
 
 /*
 
diff --git a/udp.cc b/udp.cc
index e8e5a752aa083600c8c5c7bc5940071382fe727f..ec70e090aae0f7544aef7f684c073c20952bf672 100755 (executable)
--- a/udp.cc
+++ b/udp.cc
 
 #include "udp.h"
 
+#include "dsock.h"
+#include "messagequeue.h"
+#include "message.h"
+#include "log.h"
+
 //void dump(unsigned char* data, USHORT size);
 //unsigned char dcc(UCHAR c);
 
diff --git a/udp.h b/udp.h
index 913339176ea5db10178c9d3d36d7720d82822f00..cfdacc6f48d0682ae50626abbde52dfcf1a8ec1a 100755 (executable)
--- a/udp.h
+++ b/udp.h
@@ -26,9 +26,6 @@
 #include <ctype.h>
 
 #include "defines.h"
-#include "log.h"
-#include "dsock.h"
-#include "messagequeue.h"
 
 #ifdef WIN32
 #include "threadwin.h"
 #include "threadp.h"
 #endif
 
+class DatagramSocket;
+class MessageQueue;
+class Log;
+
 class UDP : public Thread_TYPE
 {
   public:
index fbb98299ceac295e54adeda3a493b8b9ff4daf89..fb0c1dfb74ef793ad3f0d302a43410f5ff423e34 100644 (file)
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
+#include <time.h>
+
 #include "vaudioplayer.h"
+
 #include "audioplayer.h"
-#include <time.h>
+#include "message.h"
+#include "remote.h"
+#include "wsymbol.h"
+#include "boxstack.h"
+#include "vdr.h"
+#include "media.h"
+#include "i18n.h"
+#include "wjpeg.h"
+#include "timers.h"
+#include "video.h"
+#include "command.h"
 
 VAudioplayer::VAudioplayer(VMediaList *p)
 {
   parent=p;
   Video* video = Video::getInstance();
-  create(video->getScreenWidth(),video->getScreenHeight());
+  setSize(video->getScreenWidth(),video->getScreenHeight());
+  createBuffer();
   banner=NULL;
   fullname=NULL;
   filename=NULL;
@@ -54,7 +68,7 @@ AudioPlayer * VAudioplayer::getPlayer(bool createIfNeeded)
 
 VAudioplayer::~VAudioplayer()
 {
-  if (banner) ViewMan::getInstance()->removeView(banner);
+  if (banner) BoxStack::getInstance()->remove(banner);
   if (fullname) delete fullname;
   if (filename) delete filename;
   Timers::getInstance()->cancelTimer(this,1);
@@ -84,7 +98,7 @@ int VAudioplayer::handleCommand(int command)
     case Remote::DF_UP:
     case Remote::UP:
       play(VMediaList::MV_PREV);
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       rt= 2;
       break;
     case Remote::FORWARD:
@@ -94,7 +108,7 @@ int VAudioplayer::handleCommand(int command)
     case Remote::DF_DOWN:
     case Remote::DOWN:
       play(VMediaList::MV_NEXT);
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       rt= 2;
       break;
     case Remote::SKIPFORWARD:
@@ -205,9 +219,9 @@ void VAudioplayer::processMessage(Message* m)
     //check if press is outside this view! then simulate cancel
     int x=(m->parameter>>16)-getScreenX();
     int y=(m->parameter&0xFFFF)-getScreenY();
-    if (x<0 || y <0 || x>getWidth() || y>getHeight())
+    if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
     {
-      ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+      BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
     }
   }
   else if (m->message == Message::PLAYER_EVENT) {
@@ -223,8 +237,8 @@ void VAudioplayer::processMessage(Message* m)
       case AudioPlayer::SHORT_UPDATE:
                                if (banner) {
                                        drawClocks();
-                                       ViewMan::getInstance()->updateView(banner,&clocksRegion);
-                                       ViewMan::getInstance()->updateView(banner,&barRegion);
+                                       BoxStack::getInstance()->update(banner,&clocksRegion);
+                                 BoxStack::getInstance()->update(banner,&barRegion);
                                        Timers::getInstance()->setTimerD(this, 3, 1);
                                }
         break;
@@ -247,11 +261,11 @@ VAudioplayer * VAudioplayer::createPlayer(VMediaList * mparent, bool bplayall) {
    Log::getInstance()->log("VAudioplayer::createPlayer", Log::DEBUG, "p=%p",
   mparent);
    VAudioplayer *vmn=new VAudioplayer(mparent);
-   ViewMan::getInstance()->add(vmn);
-   ViewMan::getInstance()->updateView(vmn);
+   BoxStack::getInstance()->add(vmn);
+   BoxStack::getInstance()->update(vmn);
    vmn->play();
    if (bplayall) vmn->startPlayall();
-   ViewMan::getInstance()->updateView(vmn);
+   BoxStack::getInstance()->update(vmn);
    return vmn;
 }
 
@@ -325,12 +339,12 @@ void VAudioplayer::showBanner(bool forceNewTime) {
   Timers::getInstance()->setTimerD(this,1,remainingTime);
   if (playerError) Timers::getInstance()->setTimerD(this,2,BANNER_ERROR_TIME);
        Timers::getInstance()->setTimerD(this,3, 1);
-  ViewMan::getInstance()->updateView(banner);
+  BoxStack::getInstance()->update(banner);
   }
 
 void VAudioplayer::destroyBanner() {
   if (banner) {
-    ViewMan::getInstance()->removeView(banner);
+    BoxStack::getInstance()->remove(banner);
     banner=NULL;
     }
   Timers::getInstance()->cancelTimer(this,1);
@@ -385,39 +399,39 @@ void VAudioplayer::timercall(int clientref) {
    
   }
 
-void VAudioplayer::sendViewMsg(View *v,bool vdestroy) {
+void VAudioplayer::sendViewMsg(Boxx *v,bool vdestroy) {
   Message* m = new Message(); 
   m->message = vdestroy?Message::CLOSE_ME:Message::ADD_VIEW;
-  m->to = ViewMan::getInstance();
+  m->to = BoxStack::getInstance();
   m->from = v;
   m->parameter=(ULONG)v;
   Command::getInstance()->postMessageFromOuterSpace(m);
 }
 
-View * VAudioplayer::createBannerView(int numlines) {
-  View *rt=new View();
+TBBoxx * VAudioplayer::createBannerView(int numlines) {
+  TBBoxx *rt=new TBBoxx();
   UINT height=numlines*30+60;
   UINT vheight=Video::getInstance()->getScreenHeight();
   UINT vwidth=Video::getInstance()->getScreenWidth();
   if (height > vheight-2*BANNER_BOTTOM_MARGIN)
     height=vheight-2*BANNER_BOTTOM_MARGIN;
-  rt->create(vwidth -2*BANNER_X_MARGIN, height);
+  rt->setSize(vwidth -2*BANNER_X_MARGIN, height);
+  rt->createBuffer();
   if (Video::getInstance()->getFormat() == Video::PAL)
   {
-    rt->setScreenPos(BANNER_X_MARGIN, vheight-height-BANNER_BOTTOM_MARGIN);
+    rt->setPosition(BANNER_X_MARGIN, vheight-height-BANNER_BOTTOM_MARGIN);
   }
   else
   {
-    rt->setScreenPos(BANNER_X_MARGIN, vheight-height-BANNER_BOTTOM_MARGIN);
+    rt->setPosition(BANNER_X_MARGIN, vheight-height-BANNER_BOTTOM_MARGIN);
   }
 
-  rt->setBackgroundColour(Colour::VIEWBACKGROUND);
   rt->setTitleBarOn(0);
   //from vvideorec 
        //set the regions for the closcks and bars on banner
-  barRegion.x = rt->area.w-BARLEN-20;
-  barRegion.y = rt->area.h - 30;   // FIXME, need to be - 1? and below?
-  barRegion.w = rt->area.w-BARLEN+10;
+  barRegion.x = rt->getWidth()-BARLEN-20;
+  barRegion.y = rt->getHeight() - 30;   // FIXME, need to be - 1? and below?
+  barRegion.w = rt->getWidth()-BARLEN+10;
   barRegion.h = 30;
 
   clocksRegion.x = 130;
@@ -425,7 +439,7 @@ View * VAudioplayer::createBannerView(int numlines) {
   clocksRegion.w = 190;
   clocksRegion.h = surface->getFontHeight();
   Log::getInstance()->log("VAudioPlayer",Log::DEBUG,"created banner %p",rt);
-  ViewMan::getInstance()->add(rt);
+  BoxStack::getInstance()->add(rt);
   return rt;
 }
 
@@ -436,13 +450,13 @@ void VAudioplayer::drawBanner(){
   char *playerTitle=getPlayer()->getTitle();
   if (playerTitle) title=playerTitle;
   else title=filename;
-  char *pl=tr("Playlist");
+  const char *pl=tr("Playlist");
   int num=parent->getNumEntries(MEDIA_TYPE_AUDIO,currentMedia->index);
   bool playerError=getPlayer()->getState() == AudioPlayer::S_ERROR;
   //1more line for long dirs
   int numlines=playall?5:4;
   int len=0;
-  char *first=NULL;
+  const char *first=NULL;
   char *playerInfo=NULL;
   if (playerError) {
     numlines=3;
@@ -503,14 +517,15 @@ void VAudioplayer::drawBanner(){
   //now the real drawing functions
   banner->draw();
   WSymbol w;
-  w.setSurface(banner->surface);
+  banner->TEMPADD(&w);
+//  w.setSurface(banner->surface);
   //title
-  banner->rectangle(0, 0, banner->area.w, 30, Colour::TITLEBARBACKGROUND);
+  banner->rectangle(0, 0, banner->getWidth(), 30, Colour::TITLEBARBACKGROUND);
   banner->drawText(title, 5, 5, Colour::LIGHTTEXT);
   banner->drawPara(buf,5,32,Colour::LIGHTTEXT);
   int x=10;
-  int ybottom=banner->area.h;
-  banner->rectangle(0, ybottom - barRegion.h, banner->area.w, barRegion.h, Colour::TITLEBARBACKGROUND);
+  int ybottom=banner->getHeight();
+  banner->rectangle(0, ybottom - barRegion.h, banner->getWidth(), barRegion.h, Colour::TITLEBARBACKGROUND);
   bool drawSymbol=true;
   switch(getPlayer()->getState()) {
     case AudioPlayer::S_PAUSE:
@@ -536,7 +551,7 @@ void VAudioplayer::drawBanner(){
       break;
   }
   if (drawSymbol) {
-    w.setSurfaceOffset(x, ybottom-24);
+    w.setPosition(x, ybottom-24);
     w.draw();
   }
   else {
index 951457326e95de06ab2e5905bf9628c249cd2b93..33f839dd09ee74b2fdd3d6830a1c189459a0db28 100644 (file)
 #include <string.h>
 #include <vector>
 
-#include "view.h"
-#include "remote.h"
-#include "wsymbol.h"
-#include "viewman.h"
-#include "vdr.h"
-#include "media.h"
+#include "tbboxx.h"
+#include "timerreceiver.h"
 #include "colour.h"
-#include "i18n.h"
+#include "region.h"
 #include "vmedialist.h"
-#include "wjpeg.h"
+
+class Message;
 
 /**
   * the audio player frontend
@@ -43,7 +40,7 @@
 */
 class AudioPlayer;
 
-class VAudioplayer : public View,public TimerReceiver
+class VAudioplayer : public TBBoxx, public TimerReceiver
 {
   public:
     ~VAudioplayer();
@@ -83,19 +80,19 @@ class VAudioplayer : public View,public TimerReceiver
     void updateBanner(bool restart=false);
                void drawBanner();
                void drawClocks();
-               View *createBannerView(int numlines);
+               TBBoxx *createBannerView(int numlines);
                int bannerlines;
                //add or destroy a view (banner, info)
-               void sendViewMsg(View *v,bool destroy=false);
+               void sendViewMsg(Boxx *v,bool destroy=false);
                //get the player - create it if necessary
                AudioPlayer* getPlayer(bool create=true);
     VMediaList   *parent;
-    View *banner;
+    TBBoxx *banner;
     char * fullname;
     char * filename;
     ULONG ftime;
     bool playall;
-    char * mediaError;
+    const char * mediaError;
     Media * currentMedia;
                bool justPlaying;
                int numentries;
index 61782f31ab84ad749455579b41a41f4bec772e7e..1ecc426dac5ac17804366a16c96f870cdf3560d9 100644 (file)
 
 #include "vaudioselector.h"
 
-VAudioSelector::VAudioSelector(void* tparent,bool* availableMpegAudioChannels,
-        bool* availableAc3AudioChannels,
-        int currentAudioChannel, RecInfo* recInfo)
+#include "remote.h"
+#include "colour.h"
+#include "video.h"
+#include "boxstack.h"
+#include "i18n.h"
+#include "message.h"
+#include "command.h"
+#include "recinfo.h"
+#include "log.h"
+#include "channel.h"
+
+VAudioSelector::VAudioSelector(void* tparent, bool* availableMpegAudioChannels,
+        bool* availableAc3AudioChannels, int currentAudioChannel, RecInfo* recInfo)
 {
   Log::getInstance()->log("VAS", Log::DEBUG, "%i", currentAudioChannel);
 
   parent = tparent;
 
-  create(200, 120);
+  liveMode = false;
 
-//  setTitleText(tr("Audio"));
-//  setTitleBarOn(1);
-//  setTitleBarColour(Colour::TITLEBARBACKGROUND);
+  setSize(200, 120);
+  createBuffer();
 
-  sl.setSurface(surface);
-  sl.setSurfaceOffset(40, 30);
-  sl.setDimensions(area.w - 45, area.h - 30);
+  sl.setPosition(40, 30);
+  sl.setSize(area.w - 45, area.h - 30);
+  add(&sl);
 
   // Load data from availableAudioChannels, currentAudioChannel and recInfo
 
@@ -180,12 +189,53 @@ VAudioSelector::VAudioSelector(void* tparent,bool* availableMpegAudioChannels,
   }
 }
 
+VAudioSelector::VAudioSelector(void* tparent, Channel* channel, int currentAudioChannel)
+{
+  parent = tparent;
+
+  liveMode = true;
+
+  setSize(200, 120);
+  createBuffer();
+
+  sl.setPosition(40, 30);
+  sl.setSize(area.w - 45, area.h - 30);
+  add(&sl);
+
+  // Load data from availableAudioChannels, currentAudioChannel and recInfo
+
+  for (UINT i = 0; i < channel->numAPids; i++)
+  {
+    AudioChannel* ac = new AudioChannel();
+    ac->type = 0;
+    ac->name = new char[strlen(channel->apids[i].name) + 1];
+    strcpy(ac->name, channel->apids[i].name);
+    ac->pestype = channel->apids[i].pid;
+    acl.push_back(ac);
+  }
+    
+  int audioChannelListSize = acl.size();
+
+  if (audioChannelListSize)
+  {
+    for(int i = 0; i < audioChannelListSize; i++)
+    {
+      AudioChannel* ac = acl[i];
+      sl.addOption(ac->name, (ULONG)ac, (ac->pestype == currentAudioChannel));
+    }
+  }
+  else
+  {
+    sl.addOption(tr("No audio channel data available"), 0, 1);
+  }
+}
+
 VAudioSelector::~VAudioSelector()
 {
   int audioChannelListSize = acl.size();
   for(int i = 0; i < audioChannelListSize; i++)
   {
-    delete acl[i];
+    delete acl[i]; // FIXME memory leak - nobody is deleting audio channel name?
   }
   acl.clear();
 
@@ -200,7 +250,10 @@ VAudioSelector::~VAudioSelector()
 
 void VAudioSelector::draw()
 {
-  View::draw();
+  TBBoxx::draw();
+  
+  // FIXME bad drawing
+  
   rectangle(0, 0, area.w, 30, Colour::TITLEBARBACKGROUND);
   drawText(tr("Audio"), 45, 5, Colour::LIGHTTEXT);
 
@@ -224,7 +277,7 @@ int VAudioSelector::handleCommand(int command)
       sl.up();
       sl.draw();
 
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
 
       Message* m = new Message();
       m->from = this;
@@ -241,7 +294,7 @@ int VAudioSelector::handleCommand(int command)
       sl.down();
       sl.draw();
 
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
 
       Message* m = new Message();
       m->from = this;
@@ -264,22 +317,22 @@ void VAudioSelector::processMessage(Message* m)
     if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
       sl.draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
     }
   }
   else if (m->message == Message::MOUSE_LBDOWN)
   {
     if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
-      ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+      BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
     }
     else
     { //check if press is outside this view! then simulate cancel
       int x=(m->parameter>>16)-getScreenX();
       int y=(m->parameter&0xFFFF)-getScreenY();
-      if (x<0 || y <0 || x>getWidth() || y>getHeight())
+      if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
       {
-        ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+        BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
       }
     }
   }
index 1eff1b887c51496579f695c33e6197c7635251d5..34a3ca52879b25c174438900289ed4d3e10f506c 100644 (file)
 #include <vector>
 #include <algorithm>
 
-#include "view.h"
-#include "remote.h"
+#include "tbboxx.h"
 #include "wselectlist.h"
-#include "colour.h"
-#include "video.h"
-#include "viewman.h"
-#include "i18n.h"
-#include "message.h"
-#include "command.h"
+
+class RecInfo;
+class Channel;
 
 #define PES_AUDIO_START 0xc0
 #define PES_AUDIO_MAXCHANNELS 0x20
@@ -51,11 +47,16 @@ class AudioChannel
 
 typedef vector<AudioChannel*> AudioChannelList;
 
-class VAudioSelector : public View
+class VAudioSelector : public TBBoxx
 {
   public:
-    VAudioSelector(void* parent, bool* availableMpegAudioChannels,
-        bool* availableAc3AudioChannels,  int currentAudioChannel, RecInfo* recInfo);
+    VAudioSelector(void* parent, bool* availableMpegAudioChannels,                    // Recording mode
+        bool* availableAc3AudioChannels, int currentAudioChannel, RecInfo* recInfo);
+
+    VAudioSelector(void* tparent, Channel* channel, int currentAudioChannel);         // Live mode
+
+    VAudioSelector(void* parent, Channel* channel);
+
     ~VAudioSelector();
 
     int handleCommand(int command);
@@ -65,6 +66,8 @@ class VAudioSelector : public View
   private:
     void* parent;
     WSelectList sl;
+    
+    bool liveMode;
 
     AudioChannelList acl;
 };
index c6e4769fdc5a1ac92b45cc39ae788169db4d9753..ae2dd105d1cdd2b4d73128bb13149444ca2af8af 100644 (file)
 
 #include "vchannellist.h"
 
+#include "remote.h"
+#include "wsymbol.h"
+#include "vvideolive.h"
+#include "colour.h"
+#include "video.h"
+#include "i18n.h"
+#include "channel.h"
+#include "message.h"
+#include "boxstack.h"
+#include "vchannelselect.h"
+
 VChannelList::VChannelList(ULONG type)
 {
-  viewman = ViewMan::getInstance();
-  create(570, 420);
+  boxstack = BoxStack::getInstance();
+  setSize(570, 420);
+  createBuffer();
   if (Video::getInstance()->getFormat() == Video::PAL)
   {
-    setScreenPos(80, 70);
+    setPosition(80, 70);
   }
   else
   {
-    setScreenPos(70, 35);
+    setPosition(70, 35);
   }
 
-
-  setBackgroundColour(Colour::VIEWBACKGROUND);
   setTitleBarOn(1);
 
   if (type == VDR::VIDEO)
@@ -47,9 +57,9 @@ VChannelList::VChannelList(ULONG type)
   }
   setTitleBarColour(Colour::TITLEBARBACKGROUND);
 
-  sl.setSurface(surface);
-  sl.setSurfaceOffset(10, 30 + 5);
-  sl.setDimensions(area.w - 20, area.h - 30 - 15 - 30);
+  sl.setPosition(10, 30 + 5);
+  sl.setSize(area.w - 20, area.h - 30 - 15 - 30);
+  add(&sl);
 }
 
 VChannelList::~VChannelList()
@@ -94,37 +104,37 @@ void VChannelList::highlightChannel(Channel* chan)
   sl.hintSetCurrent(chan->index);
   sl.draw();
   doShowingBar();
-  viewman->updateView(this);
+  boxstack->update(this);
 }
 
 void VChannelList::draw()
 {
-  View::draw();
+  TBBoxx::draw();
   sl.draw();
 
   // Put the status stuff at the bottom
 
   WSymbol w;
-  w.setSurface(surface);
+  TEMPADD(&w);
 
   w.nextSymbol = WSymbol::UP;
-  w.setSurfaceOffset(20, 385);
+  w.setPosition(20, 385);
   w.draw();
 
   w.nextSymbol = WSymbol::DOWN;
-  w.setSurfaceOffset(50, 385);
+  w.setPosition(50, 385);
   w.draw();
 
   w.nextSymbol = WSymbol::SKIPBACK;
-  w.setSurfaceOffset(85, 385);
+  w.setPosition(85, 385);
   w.draw();
 
   w.nextSymbol = WSymbol::SKIPFORWARD;
-  w.setSurfaceOffset(115, 385);
+  w.setPosition(115, 385);
   w.draw();
 
   w.nextSymbol = WSymbol::PLAY;
-  w.setSurfaceOffset(150, 385);
+  w.setPosition(150, 385);
   w.draw();
 
   doShowingBar();
@@ -138,12 +148,6 @@ void VChannelList::doShowingBar()
   char showing[200];
   sprintf(showing, tr("%i to %i of %i"), topOption, sl.getBottomOption(), sl.getNumOptions());
 
-//  Box b;
-//  b.setSurfaceOffset(220, 385);
-//  b.setDimensions(160, 25);
-//  b.fillColour(Colour::VIEWBACKGROUND);
-//  b.drawText(showing, 0, 0, Colour::LIGHTTEXT);
-
   rectangle(220, 385, 220+160, 385+25, Colour::VIEWBACKGROUND);
   drawText(showing, 220, 385, Colour::LIGHTTEXT);
 }
@@ -159,7 +163,7 @@ int VChannelList::handleCommand(int command)
       sl.draw();
 
       doShowingBar();
-      viewman->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::DF_DOWN:
@@ -169,7 +173,7 @@ int VChannelList::handleCommand(int command)
       sl.draw();
 
       doShowingBar();
-      viewman->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::SKIPBACK:
@@ -178,7 +182,7 @@ int VChannelList::handleCommand(int command)
       sl.draw();
 
       doShowingBar();
-      viewman->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::SKIPFORWARD:
@@ -187,7 +191,7 @@ int VChannelList::handleCommand(int command)
       sl.draw();
 
       doShowingBar();
-      viewman->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::ZERO:
@@ -203,8 +207,8 @@ int VChannelList::handleCommand(int command)
     {
       VChannelSelect* v = new VChannelSelect(this);
       v->draw();
-      viewman->add(v);
-      viewman->updateView(v);
+      boxstack->add(v);
+      boxstack->update(v);
       v->handleCommand(command);
       return 2;
     }
@@ -218,8 +222,8 @@ int VChannelList::handleCommand(int command)
       VVideoLive* v = new VVideoLive(chanList, chan->type, this);
 
       v->draw();
-      viewman->add(v);
-      viewman->updateView(v);
+      boxstack->add(v);
+      boxstack->update(v);
 
       v->channelChange(VVideoLive::NUMBER, chan->number);
 
@@ -242,22 +246,22 @@ void VChannelList::processMessage(Message* m)
     {
       sl.draw();
       doShowingBar();
-      viewman->updateView(this);
+      boxstack->update(this);
     }
   }
   else if (m->message == Message::MOUSE_LBDOWN)
   {
     if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
-      viewman->handleCommand(Remote::OK); //simulate OK press
+      boxstack->handleCommand(Remote::OK); //simulate OK press
     }
     else
     { //check if press is outside this view! then simulate cancel
       int x=(m->parameter>>16)-getScreenX();
       int y=(m->parameter&0xFFFF)-getScreenY();
-      if (x<0 || y <0 || x>getWidth() || y>getHeight())
+      if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
       {
-        viewman->handleCommand(Remote::BACK); //simulate cancel press
+        boxstack->handleCommand(Remote::BACK); //simulate cancel press
       }
     }
   }
@@ -278,8 +282,8 @@ void VChannelList::processMessage(Message* m)
     VVideoLive* v = new VVideoLive(chanList, VDR::VIDEO, this); // FIXME - what's wrong with it?
 
     v->draw();
-    viewman->add(v);
-    viewman->updateView(v);
+    boxstack->add(v);
+    boxstack->update(v);
     v->channelChange(VVideoLive::NUMBER, m->parameter);
   }
 }
index 04215737feffb299f8268d14c520bea997346ceb..ad13c51c27d8dedac8f5bdfad27850a0bdbdeb75 100644 (file)
 #include <string.h>
 #include <vector>
 
-#include "view.h"
-#include "wselectlist.h"
-#include "remote.h"
-#include "wsymbol.h"
-#include "viewman.h"
+#include "tbboxx.h"
+#include "defines.h"
 #include "vdr.h"
-#include "channel.h"
-#include "vvideolive.h"
-#include "colour.h"
-#include "video.h"
-#include "i18n.h"
-#include "message.h"
-
-class VChannelList : public View
+#include "wselectlist.h"
+
+class Channel;
+class BoxStack;
+class Message;
+
+class VChannelList : public TBBoxx
 {
   public:
     VChannelList(ULONG type);
@@ -51,7 +47,7 @@ class VChannelList : public View
     void draw();
 
   private:
-    ViewMan* viewman;
+    BoxStack* boxstack;
     ChannelList* chanList;
 
     WSelectList sl;
index b538de2479f311022cd89e63a6bb57b018958e92..8264ccb0bd4925f61966aa0ca70a92e0a0d1daf0 100644 (file)
 
 #include "vchannelselect.h"
 
+#include "remote.h"
+#include "vvideolive.h"
+#include "message.h"
+#include "boxstack.h"
+#include "colour.h"
+#include "log.h"
+#include "timers.h"
+#include "command.h"
+
 // this class only works as it does because the remote command
 // values for the numbers are the numbers themselves !
 
-VChannelSelect::VChannelSelect(View* v)
+VChannelSelect::VChannelSelect(Boxx* v)
 {
   parent = v;
   numGot = 0;
@@ -33,8 +42,9 @@ VChannelSelect::VChannelSelect(View* v)
   if (numWidth > 10) numWidth = 10;
   for (int i = 0; i < numWidth; i++) input[i] = -1;
 
-  create((numWidth*10) + 22, 30); // 10 px = width of number chars in font
-  setScreenPos(80, 60);
+  setSize((numWidth*10) + 22, 30); // 10 px = width of number chars in font
+  createBuffer();
+  setPosition(80, 60);
   setBackgroundColour(Colour::VIEWBACKGROUND);
 }
 
@@ -63,7 +73,7 @@ void VChannelSelect::doInput(int number)
 
 void VChannelSelect::draw()
 {
-  View::draw();
+  Boxx::draw();
 
   // draw numbers
   char text[2];
@@ -115,7 +125,7 @@ void VChannelSelect::changeChannel(bool which)
   // Close me
   m = new Message(); // Delete self
   m->from = this;
-  m->to = ViewMan::getInstance();
+  m->to = BoxStack::getInstance();
   m->message = Message::CLOSE_ME;
   if (which)
     Command::getInstance()->postMessageNoLock(m);
@@ -140,7 +150,7 @@ int VChannelSelect::handleCommand(int command)
     {
       doInput(command);
       draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       if (numGot == numWidth) changeChannel(true);
       else Timers::getInstance()->setTimerD(this, 1, 3);
       return 2;
index 9449e5f73754218b6ed203fda68975356500be0b..0df97839e037b484e92decf66890ee4e9f3ffa3f 100644 (file)
 #define VCHANNELSELECT_H
 
 #include <stdio.h>
+#include <math.h>
 
-#include "view.h"
-#include "remote.h"
-#include "vvideolive.h"
-#include "message.h"
-#include "viewman.h"
-#include "colour.h"
-#include "log.h"
+#include "boxx.h"
 #include "timerreceiver.h"
-#include "timers.h"
 
-class VVideoLive;
-
-class VChannelSelect : public View, public TimerReceiver
+class VChannelSelect : public Boxx, public TimerReceiver
 {
   public:
-    VChannelSelect(View* v);
+    VChannelSelect(Boxx* v);
     ~VChannelSelect();
 
     void draw();
@@ -46,7 +38,7 @@ class VChannelSelect : public View, public TimerReceiver
     void timercall(int clientReference);
 
   private:
-    View* parent;
+    Boxx* parent;
 
     int input[10];
     int numGot;
index 52ed9950367f2f2824cfa0fea33b52474701517b..b7323d8462c09b85ef695565ac1b424d1a260c16 100644 (file)
 
 #include "vconnect.h"
 
+#include "video.h"
+#include "colour.h"
+#include "command.h"
+#include "i18n.h"
+#include "boxstack.h"
+#include "message.h"
+#include "log.h"
+#include "wol.h"
+#include "vserverselect.h"
+
 VConnect::VConnect()
 {
-  viewman = ViewMan::getInstance();
+  boxstack = BoxStack::getInstance();
   vdr = VDR::getInstance();
   logger = Log::getInstance();
 
-  create(400, 200);
+  setSize(400, 200);
+  createBuffer();
   if (Video::getInstance()->getFormat() == Video::PAL)
   {
-    setScreenPos(170, 200);
+    setPosition(170, 200);
   }
   else
   {
-    setScreenPos(160, 150);
+    setPosition(160, 150);
   }
 
   exitable = 0;
@@ -73,7 +84,7 @@ void VConnect::threadMethod()
   {
     setOneLiner(tr("Locating server"));
     draw();
-    viewman->updateView(this);
+    boxstack->update(this);
 
     vdr->findServers(servers);
     if (!irun)
@@ -96,9 +107,9 @@ void VConnect::threadMethod()
       selectedServer = -1;
       VServerSelect* vs = new VServerSelect(servers, this);
       vs->draw();
-      viewman->add(vs);  // FIXME - do this better - perhaps post message to Command
-                         // Otherwise it will be using ViewMan without the Command mutex locked
-      viewman->updateView(vs);
+      boxstack->add(vs);  // FIXME - do this better - perhaps post message to Command
+                          // Otherwise it will be using BoxStack without the Command mutex locked
+      boxstack->update(vs);
 
       threadLock();
       threadWaitForSignal();
@@ -130,7 +141,7 @@ void VConnect::threadMethod()
 
     setOneLiner(tr("Connecting to VDR"));
     draw();
-    viewman->updateView(this);
+    boxstack->update(this);
 
     success = vdr->connect();
     if (success)
@@ -152,7 +163,7 @@ void VConnect::threadMethod()
     }
 
     draw();
-    viewman->updateView(this);
+    boxstack->update(this);
     MILLISLEEP(delay);
 
   } while(!success);
index bc4cdf495354e6f263f1b489e60230c818bd7f22..3f4704ef1bf8afd8ecbf0af37b0d7d2f1298d262 100644 (file)
 #include <string.h>
 #include <vector>
 
-#include "view.h"
-#include "viewman.h"
+#include "vinfo.h"
 #include "vdr.h"
-#include "command.h"
-#include "message.h"
-#include "colour.h"
-#include "video.h"
-#include "i18n.h"
 
 #ifdef WIN32
 #include "threadwin.h"
 #include "threadp.h"
 #endif
 
+class Log;
+class BoxStack;
+class Message;
+
 class VConnect : public VInfo, public Thread_TYPE
 {
   public:
@@ -57,6 +55,7 @@ class VConnect : public VInfo, public Thread_TYPE
     void threadPostStopCleanup() {};
     void clearServerIPs();
 
+    BoxStack* boxstack;
     UCHAR irun;
     VDR* vdr;
     Log* logger;
diff --git a/vdr.cc b/vdr.cc
index c89b746aede8ab047052438f51222c6eb4ecb613..af0be4609996f11f3ebe3b402ef50a609f8881a0 100644 (file)
--- a/vdr.cc
+++ b/vdr.cc
 */
 
 #include "vdr.h"
+
 #include "recman.h"
+#include "tcp.h"
+#include "log.h"
+#include "recinfo.h"
+#include "dsock.h"
+#include "channel.h"
+#include "event.h"
+#include "wol.h"
 
 VDR* VDR::instance = NULL;
 
@@ -887,7 +895,7 @@ EventList* VDR::getChannelSchedule(ULONG number, time_t start, ULONG duration)
   return eventList;
 }
 
-int VDR::configSave(char* section, char* key, const char* value)
+int VDR::configSave(const char* section, const char* key, const char* value)
 {
   ULONG totalLength = 8 + strlen(section) + strlen(key) + strlen(value) + 3; // 8 for headers, 3 for nulls
   UCHAR* buffer = new UCHAR[totalLength];
@@ -928,7 +936,7 @@ int VDR::configSave(char* section, char* key, const char* value)
   return toReturn;
 }
 
-char* VDR::configLoad(char* section, char* key)
+char* VDR::configLoad(const char* section, const char* key)
 {
   ULONG totalLength = 8 + strlen(section) + strlen(key) + 2; // 8 for headers, 2 for nulls
   UCHAR* buffer = new UCHAR[totalLength];
@@ -1011,6 +1019,8 @@ RecTimerList* VDR::getRecTimersList()
       newRecTimer->channelNumber = extractULONG();
       newRecTimer->startTime = extractULONG();
       newRecTimer->stopTime = extractULONG();
+      newRecTimer->day = extractULONG();
+      newRecTimer->weekDays = extractULONG();
 
       tempString = extractString();
       newRecTimer->setFile(tempString);
@@ -1432,3 +1442,46 @@ ULONG VDR::loadImage(const char* fileName, ULONG x, ULONG y)
 
   return lengthBytes;
 }
+
+int VDR::deleteTimer(RecTimer* delTimer)
+{
+  Log::getInstance()->log("VDR", Log::DEBUG, "Delete timer called");
+  
+  unsigned long totalLength = 28;
+  UCHAR* buffer = new UCHAR[totalLength];
+
+  *(unsigned long*)&buffer[0] = htonl(totalLength - 4);
+  *(unsigned long*)&buffer[4] = htonl(VDR_DELETETIMER);
+  *(unsigned long*)&buffer[8] = htonl(delTimer->channelNumber);
+  *(unsigned long*)&buffer[12] = htonl(delTimer->weekDays);
+  *(unsigned long*)&buffer[16] = htonl(delTimer->day);
+  *(unsigned long*)&buffer[20] = htonl(delTimer->startTime);
+  *(unsigned long*)&buffer[24] = htonl(delTimer->stopTime);
+   
+
+  MUTEX_LOCK(&mutex);
+  if (!connected) { MUTEX_UNLOCK(&mutex); return 0; }
+
+  unsigned int a = tcp->sendPacket(buffer, totalLength);
+  delete []buffer;
+
+  if (a != totalLength)
+  {
+    disconnect();
+    MUTEX_UNLOCK(&mutex);
+    return 0;
+  }
+
+  if (!getPacket())
+  {
+    MUTEX_UNLOCK(&mutex);
+    return 0;
+  }
+
+  int toReturn = (int)extractULONG();
+  freePacket();
+  MUTEX_UNLOCK(&mutex);
+
+  return toReturn;
+}
+
diff --git a/vdr.h b/vdr.h
index ce74fea94b80738cf375231b088fc5f30fa5e185..97513a149502992f7290643556bf303663a6742b 100644 (file)
--- a/vdr.h
+++ b/vdr.h
 #include <algorithm>
 
 #include "defines.h"
-#include "log.h"
-#include "dsock.h"
-#include "tcp.h"
-#include "channel.h"
-#include "event.h"
 #include "rectimer.h"
-#include "recinfo.h"
 #include "mark.h"
-#include "wol.h"
 #include "media.h"
 
+class TCP;
+class Log;
+class RecInfo;
+class Event;
+class Channel;
+
 using namespace std;
 
 typedef vector<Event*> EventList;
@@ -125,6 +124,7 @@ class VDR
     bool       getNextIFrame(ULONG frameNumber, ULONG direction, ULLONG* rfilePosition, ULONG* rframeNumber, ULONG* rframeLength);
                // Direction: 0=backwards, 1=forwards
     MarkList*  getMarks(char* fileName);
+    int        deleteTimer(RecTimer* delTimer);
 
     ChannelList* getChannelsList(ULONG type);
     int          streamChannel(ULONG number);
@@ -136,8 +136,8 @@ class VDR
     int        stopStreaming();
     EventList* getChannelSchedule(ULONG number);
     EventList* getChannelSchedule(ULONG number, time_t start, ULONG duration);
-    int        configSave(char* section, char* key, const char* value);
-    char*      configLoad(char* section, char* key);
+    int        configSave(const char* section, const char* key, const char* value);
+    char*      configLoad(const char* section, const char* key);
     ULONG      setEventTimer(char* timerString);
 
     RecTimerList* getRecTimersList();
@@ -210,6 +210,7 @@ class VDR
     const static ULONG VDR_GETRECINFO          = 20;
     const static ULONG VDR_GETMARKS            = 21;
     const static ULONG VDR_GETCHANNELPIDS      = 22;
+    const static ULONG VDR_DELETETIMER         = 23;
     const static ULONG VDR_GETMEDIALIST        = 30;
     const static ULONG VDR_GETIMAGE            = 31;
     const static ULONG VDR_GETIMAGEBLOCK       = 32;
diff --git a/vepg.cc b/vepg.cc
index 06859ee17abc8edd996297381bbf12c66ffff319..d18787e66a51dd7e61bc727817d1286c8af4c3c4 100644 (file)
--- a/vepg.cc
+++ b/vepg.cc
 
 #include "vepg.h"
 
+#include "remote.h"
+#include "vchannellist.h"
+#include "command.h"
+#include "video.h"
+#include "vepgsettimer.h"
+#include "timers.h"
+#include "wsymbol.h"
+#include "message.h"
+#include "colour.h"
+#include "vvideolive.h"
+#include "boxstack.h"
+#include "channel.h"
+#include "i18n.h"
+
 VEpg* VEpg::instance = NULL;
 
 VEpg::VEpg(VVideoLive* v, UINT currentChannel, ULONG streamType)
@@ -71,7 +85,7 @@ VEpg::VEpg(VVideoLive* v, UINT currentChannel, ULONG streamType)
   }
 
   // initialise variables and pointers
-  viewman = ViewMan::getInstance();
+  boxstack = BoxStack::getInstance();
   videoLive = v;
   eventList = NULL;
   chanList = VDR::getInstance()->getChannelsList(streamType); //TODO want to be able to display video and radio together
@@ -86,36 +100,42 @@ VEpg::VEpg(VVideoLive* v, UINT currentChannel, ULONG streamType)
   // Create pallet on which to paint our epg view and position it in centre of screen.
   // Need to reduce size to deal with overscanning TVs.
 
-  create(xsize, ysize);
-  setScreenPos(xpos, ypos);
+  setSize(xsize, ysize);
+  createBuffer();
+  setPosition(xpos, ypos);
 
   // beautify
-  Colour transparent = Colour(0, 0, 0, 0);
-  setBackgroundColour(transparent);
+//  Colour transparent = Colour(0, 0, 0, 0);
+//  setBackgroundColour(transparent);
 
-  progTitle.setSurface(surface);
-  progTitle.setSurfaceOffset(0,0);
-  progTitle.setDimensions(300,(Surface::getFontHeight() + 4) * 2 + 16); //paragraph line seperation is 4 pixels
+//  progTitle.setSurface(surface);
+  progTitle.setPosition(0,0);
+  progTitle.setSize(300,(Surface::getFontHeight() + 4) * 2 + 16); //paragraph line seperation is 4 pixels
   progTitle.setBackgroundColour(Colour::TITLEBARBACKGROUND);
   progTitle.setTextPos(5, 16);
   progTitle.setGap(4);
+  add(&progTitle);
 
-  progInfo.setSurface(surface);
-  progInfo.setSurfaceOffset(0, progTitle.getOffsetY() + progTitle.getHeight());
-  progInfo.setDimensions(300,((Surface::getFontHeight() + 4) * summaryLines) + summaryLowerPadding);
+//  progInfo.setSurface(surface);
+  progInfo.setBackgroundColour(Colour::VIEWBACKGROUND);
+  progInfo.setPosition(0, progTitle.getY() + progTitle.getHeight());
+  progInfo.setSize(300,((Surface::getFontHeight() + 4) * summaryLines) + summaryLowerPadding);
   progInfo.setGap(4);
+  add(&progInfo);
 
-  chanName.setSurface(surface);
-  chanName.setDimensions(510, (Surface::getFontHeight() + 4));
-  chanName.setSurfaceOffset(305, chanNameYpos);
-  chanName.setBackgroundColour(Colour(0, 0, 0, 90));
+//  chanName.setSurface(surface);
+  chanName.setSize(510, (Surface::getFontHeight() + 4));
+  chanName.setPosition(305, chanNameYpos);
+    Colour t1(0, 0, 0, 90);
+  chanName.setBackgroundColour(t1);
+  add(&chanName);
 
   // create area to display list of channels
-  chanListbox.setSurface(surface); // add channel list
-  chanListbox.setSurfaceOffset(0, progInfo.getOffsetY() + progInfo.getHeight() + Surface::getFontHeight() + 8); // position channel list
-  chanListbox.setDimensions(150, ((Surface::getFontHeight() + 2) * gridRows) + 5); //listbox line seperation is 2 pixels
+//  chanListbox.setSurface(surface); // add channel list
+  chanListbox.setPosition(0, progInfo.getY() + progInfo.getHeight() + Surface::getFontHeight() + 8); // position channel list
+  chanListbox.setSize(150, ((Surface::getFontHeight() + 2) * gridRows) + 5); //listbox line seperation is 2 pixels
   chanListbox.setGap(2);
-
+  add(&chanListbox);
 
   // populate channel list
   if (chanList)
@@ -155,7 +175,7 @@ VEpg::~VEpg()
       delete eventLista[listIndex];
     }
   }
-  //  delete [] eventLista;
+  //  delete [] eventLista; // FIXME
 
   // destroy dynamically allocated memory
 }
@@ -200,64 +220,79 @@ void VEpg::setInfo(Event* event)
 
 void VEpg::draw()
 {
-  View::draw(); // draw pallet
-
+//  View::draw(); // draw pallet
+  // beautify
+  Colour transparent = Colour(0, 0, 0, 0);
+  fillColour(transparent);
+  
+  
   // Moved all the dynamic data drawing to a seperate function
 
   // Display the status and key stuff at the bottom
-  int keyx = chanListbox.getOffsetX();
-  int keyy = chanListbox.getOffsetY() + chanListbox.getHeight() + 2;
-  rectangle(keyx, keyy, 605, Surface::getFontHeight() * 2 + 14, Colour(100, 100, 100, 255));
 
-  WSymbol w;
-  w.setSurface(surface);
+  UINT keyx = chanListbox.getRootBoxOffsetX();
+  UINT keyy = chanListbox.getRootBoxOffsetY() + chanListbox.getHeight() + 2;
+  Colour ref1 = Colour(100, 100, 100, 255);
+  rectangle(keyx, keyy, 605, Surface::getFontHeight() * 2 + 14, ref1);
 
+  WSymbol w;
+  TEMPADD(&w);
+  
   w.nextSymbol = WSymbol::LEFTARROW;
-  w.setSurfaceOffset(keyx + 1, keyy + 20);
+  w.setPosition(keyx + 1, keyy + 20);
   w.draw();
 
   w.nextSymbol = WSymbol::UP;
-  w.setSurfaceOffset(keyx + 26, keyy + 3);
+  w.setPosition(keyx + 26, keyy + 3);
   w.draw();
 
   w.nextSymbol = WSymbol::DOWN;
-  w.setSurfaceOffset(keyx + 26, keyy + 36);
+  w.setPosition(keyx + 26, keyy + 36);
   w.draw();
 
   w.nextSymbol = WSymbol::RIGHTARROW;
-  w.setSurfaceOffset(keyx + 50, keyy + 20);
+  w.setPosition(keyx + 50, keyy + 20);
   w.draw();
 
   drawText(tr("OK"), keyx + 18, keyy + 20, Colour::LIGHTTEXT);
 
-  rectangle(keyx + 72, keyy + 4, 104, Surface::getFontHeight() + 2, Colour(200, 0, 0, 255));
+  Colour ref2 = Colour(200, 0, 0, 255);
+  rectangle(keyx + 72, keyy + 4, 104, Surface::getFontHeight() + 2, ref2);
   drawText(tr("Page up"), keyx + 74, keyy + 5, Colour::LIGHTTEXT);
 
-  rectangle(keyx + 72, keyy + Surface::getFontHeight() + 8, 104, Surface::getFontHeight() + 2, Colour(0, 200, 0, 255));
+  Colour ref3 = Colour(0, 200, 0, 255);
+  rectangle(keyx + 72, keyy + Surface::getFontHeight() + 8, 104, Surface::getFontHeight() + 2, ref3);
   drawText(tr("Page down"), keyx + 74, keyy + Surface::getFontHeight() + 9, Colour::LIGHTTEXT);
 
-  rectangle(keyx + 180, keyy + 4, 104, Surface::getFontHeight() + 2, Colour(200, 200, 0, 255));
+  Colour ref4 = Colour(200, 200, 0, 255);
+  rectangle(keyx + 180, keyy + 4, 104, Surface::getFontHeight() + 2, ref4);
   drawText(tr("-24 hours"), keyx + 182, keyy + 5, Colour::LIGHTTEXT);
 
-  rectangle(keyx + 180, keyy + Surface::getFontHeight() + 8, 104, Surface::getFontHeight() + 2, Colour(0, 0, 200, 255));
+  Colour ref5 = Colour(0, 0, 200, 255);
+  rectangle(keyx + 180, keyy + Surface::getFontHeight() + 8, 104, Surface::getFontHeight() + 2, ref5);
   drawText(tr("+24 hours"), keyx + 182, keyy + Surface::getFontHeight() + 9, Colour::LIGHTTEXT);
 
-  rectangle(keyx + 290, keyy + 4, 180, Surface::getFontHeight() + 2, Colour(180, 180, 180, 255));
+  Colour ref6 = Colour(180, 180, 180, 255);
+  rectangle(keyx + 290, keyy + 4, 180, Surface::getFontHeight() + 2, ref6);
   drawText(tr("Guide / Back: Close"), keyx + 292 , keyy + 5, Colour::LIGHTTEXT);
 
-  rectangle(keyx + 290, keyy + Surface::getFontHeight() + 8, 180, Surface::getFontHeight() + 2, Colour(180, 180, 180, 255));
+  Colour ref7 = Colour(180, 180, 180, 255);
+  rectangle(keyx + 290, keyy + Surface::getFontHeight() + 8, 180, Surface::getFontHeight() + 2, ref7);
   Colour red = Colour(130, 0, 0);
   drawText(tr("Rec: Set timer"), keyx + 292, keyy + Surface::getFontHeight() + 9, red);
 
-  rectangle(keyx + 474, keyy + 4, 128, Surface::getFontHeight() + 2, Colour(180, 180, 180, 255));
+  Colour ref8 = Colour(180, 180, 180, 255);
+  rectangle(keyx + 474, keyy + 4, 128, Surface::getFontHeight() + 2, ref8);
   w.nextSymbol = WSymbol::PLAY;
-  w.setSurfaceOffset(keyx + 476, keyy + 5);
+  w.setPosition(keyx + 476, keyy + 5);
   w.draw();
   drawText(tr("Sel channel"), keyx + 496, keyy + 5, Colour::LIGHTTEXT);
 
-  rectangle(keyx + 474, keyy + Surface::getFontHeight() + 8, 128, Surface::getFontHeight() + 2, Colour(180, 180, 180, 255));
+  Colour ref9 = Colour(180, 180, 180, 255);
+  rectangle(keyx + 474, keyy + Surface::getFontHeight() + 8, 128, Surface::getFontHeight() + 2, ref9);
   drawText(tr("Go: Preview"), keyx + 476, keyy + Surface::getFontHeight() + 9, Colour::LIGHTTEXT);
 
+
   // Draw all the dynamic data
   drawData();
 }
@@ -269,8 +304,8 @@ void VEpg::drawData()
   // So, blank out the data area first
 
   rectangle(
-    chanListbox.getOffsetX(),
-    chanListbox.getOffsetY() - Surface::getFontHeight() - 3,
+    chanListbox.getRootBoxOffsetX(),
+    chanListbox.getRootBoxOffsetY() - Surface::getFontHeight() - 3,
     155 + WINDOW_WIDTH * MINUTE_SCALE,
     chanListbox.getHeight() + Surface::getFontHeight() + 4,
     Colour::BLACK);
@@ -278,6 +313,7 @@ void VEpg::drawData()
   chanListbox.draw();
   drawgrid();
   chanName.draw(); // TODO this should be dealt with by vvideolive
+
   progTitle.draw();
   progInfo.draw();
 
@@ -293,10 +329,10 @@ void VEpg::drawData()
 void VEpg::timercall(int clientReference)
 {
   drawData();
-  // Put updateView through master mutex since viewman is not mutex protected
+  // Put updateView through master mutex since boxstack is not mutex protected
   Message* m = new Message();
   m->message = Message::REDRAW;
-  m->to = ViewMan::getInstance();
+  m->to = boxstack;
   m->from = this;
   m->parameter = 0;
   Command::getInstance()->postMessageFromOuterSpace(m);
@@ -311,7 +347,7 @@ int VEpg::handleCommand(int command)
     { // cursor up the channel list
       chanListbox.up();
       drawData();
-      viewman->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::DF_DOWN:
@@ -319,7 +355,7 @@ int VEpg::handleCommand(int command)
     { // cursor down the channel list
       chanListbox.down();
       drawData();
-      viewman->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::DF_LEFT:
@@ -327,7 +363,7 @@ int VEpg::handleCommand(int command)
     { // cursor left through time
       selTime = thisEvent.time - 1;
       drawData();
-      viewman->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::DF_RIGHT:
@@ -336,7 +372,7 @@ int VEpg::handleCommand(int command)
     // cursor right through time
       selTime = thisEvent.time + thisEvent.duration;
       drawData();
-      viewman->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::RED:
@@ -344,7 +380,7 @@ int VEpg::handleCommand(int command)
     // cursor up one page
       chanListbox.pageUp();
       drawData();
-      viewman->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::GREEN:
@@ -352,7 +388,7 @@ int VEpg::handleCommand(int command)
     // cursor down one page
       chanListbox.pageDown();
       drawData();
-      viewman->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::BLUE:
@@ -360,7 +396,7 @@ int VEpg::handleCommand(int command)
     // step forward 24 hours
       selTime += 24 * 60 * 60;
       drawData();
-      viewman->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::YELLOW:
@@ -368,7 +404,7 @@ int VEpg::handleCommand(int command)
     // step forward 24 hours
       selTime -= 24 * 60 * 60;
       drawData();
-      viewman->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::RECORD:
@@ -377,8 +413,8 @@ int VEpg::handleCommand(int command)
       Log::getInstance()->log("VEPG", Log::DEBUG, "ID %lu TIME %lu DURATION %lu TITLE %s", thisEvent.id, thisEvent.time, thisEvent.duration, thisEvent.title);
       VEpgSetTimer* vs = new VEpgSetTimer(&thisEvent, (*chanList)[chanListbox.getCurrentOption()]);
       vs->draw();
-      viewman->add(vs);
-      viewman->updateView(vs);
+      boxstack->add(vs);
+      boxstack->update(vs);
       return 2;
     }
     case Remote::PLAY:
@@ -445,26 +481,28 @@ void VEpg::drawgrid() // redraws grid and select programme
     updateEventList();
   }
   // draw time scale
+  Colour white = Colour(255, 255, 255, 255);
+  
   t = ltime;
   struct tm* tms;
   tms = localtime(&t);
   strftime(timeString, 19, "%a %e %b", tms);
-  int timey = chanListbox.getOffsetY() - Surface::getFontHeight() - 3;
+  int timey = chanListbox.getRootBoxOffsetY() - Surface::getFontHeight() - 3;
   int timex = 135;
   drawTextRJ(timeString, timex - 10, timey, Colour::LIGHTTEXT); // print date
   strftime(timeString, 19, "%H:%M", tms);
   drawText(timeString, timex, timey, Colour::LIGHTTEXT); // print left time
-  rectangle(155, timey + Surface::getFontHeight(), 2, 7, Colour(255, 255, 255, 255));
+  rectangle(155, timey + Surface::getFontHeight(), 2, 7, white);
   t = t + 3600;
   tms = localtime(&t);
   strftime(timeString, 19, "%H:%M", tms);
   drawText(timeString, timex + 180, timey, Colour::LIGHTTEXT); // print middle time
-  rectangle(335, timey + Surface::getFontHeight(), 2, 7, Colour(255, 255, 255, 255));
+  rectangle(335, timey + Surface::getFontHeight(), 2, 7, white);
   t = t + 3600;
   tms = localtime(&t);
   strftime(timeString, 19, "%H:%M", tms);
   drawText(timeString, timex + 360, timey, Colour::LIGHTTEXT); // print right time
-  rectangle(515, timey + Surface::getFontHeight(), 2, 7, Colour(255, 255, 255, 255));
+  rectangle(515, timey + Surface::getFontHeight(), 2, 7, white);
   // pointer to selTime
   //rectangle(155 + (selTime - ltime) / 20, timey + Surface::getFontHeight(), 2, 7, Colour(255, 50, 50, 255));
 
@@ -485,7 +523,7 @@ void VEpg::drawgrid() // redraws grid and select programme
   thisEvent.id = 0;
   bool swapColour = FALSE; // alternate cell colour
   bool currentRow = FALSE;
-  int y = chanListbox.getOffsetY() + 5; // vertical position of cell
+  int y = chanListbox.getRootBoxOffsetY() + 5; // vertical position of cell
   Colour bg, fg; // background colour of cells in grid
   // for each displayed channel, find programmes that fall in 2.5 hour time window
   for(UINT listIndex = 0; listIndex < gridRows; listIndex++)
@@ -589,7 +627,7 @@ void VEpg::setCurrentChannel(char* chname)
 {
   chanName.setText(chname);
   chanName.draw();
-  viewman->updateView(this);
+  boxstack->update(this);
 }
 
 void VEpg::paintCell(Event* event, int yOffset, Colour bg, Colour fg)
@@ -658,67 +696,67 @@ void VEpg::processMessage(Message* m)
     if (chanListbox.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
       drawData();
-      ViewMan::getInstance()->updateView(this);
+      boxstack->update(this);
     }
   }
   else if (m->message == Message::MOUSE_LBDOWN)
   {
     if (chanListbox.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
-      ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+      boxstack->handleCommand(Remote::OK); //simulate OK press
     }
     else
     {
       //check if press is outside this view! then simulate cancel
       int x=(m->parameter>>16)-getScreenX();
       int y=(m->parameter&0xFFFF)-getScreenY();
-      int keyx = chanListbox.getOffsetX();
-      int keyy = chanListbox.getOffsetY() + chanListbox.getHeight() + 2;
+      int keyx = chanListbox.getRootBoxOffsetX();
+      int keyy = chanListbox.getRootBoxOffsetY() + chanListbox.getHeight() + 2;
 
-      if (x<0 || y <0 || x>getWidth() || y>getHeight())
+      if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
       {
-        ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+        boxstack->handleCommand(Remote::BACK); //simulate cancel press
       }
       else if (x>=(keyx+72) && y>=(keyy+4) &&x<=(keyx+72+104) &&y<=(keyy+4+Surface::getFontHeight() + 2))
       {
-        ViewMan::getInstance()->handleCommand(Remote::RED);
+        boxstack->handleCommand(Remote::RED);
       }
       else if (x>=(keyx+72) && y>=(keyy+ Surface::getFontHeight() + 8) &&x<=(keyx+72+104) &&y<=(keyy+8+2*Surface::getFontHeight() + 2))
       {
-        ViewMan::getInstance()->handleCommand(Remote::GREEN);
+        boxstack->handleCommand(Remote::GREEN);
       }
       else if (x>=(keyx+180) && y>=(keyy+4) &&x<=(keyx+180+104) &&y<=(keyy+4+Surface::getFontHeight() + 2))
       {
-        ViewMan::getInstance()->handleCommand(Remote::YELLOW);
+        boxstack->handleCommand(Remote::YELLOW);
       }
       else if (x>=(keyx+180) && y>=(keyy+ Surface::getFontHeight() + 8) &&x<=(keyx+180+104) &&y<=(keyy+8+2*Surface::getFontHeight() + 2))
       {
-        ViewMan::getInstance()->handleCommand(Remote::BLUE);
+        boxstack->handleCommand(Remote::BLUE);
       }
       else if (x>=(keyx+290) && y>=(keyy+4) &&x<=(keyx+180+290) &&y<=(keyy+4+Surface::getFontHeight() + 2))
       {
-        ViewMan::getInstance()->handleCommand(Remote::BACK);
+        boxstack->handleCommand(Remote::BACK);
       }
       else if (x>=(keyx+290) && y>=(keyy+ Surface::getFontHeight() + 8) &&x<=(keyx+290+180) &&y<=(keyy+8+2*Surface::getFontHeight() + 2))
       {
-        ViewMan::getInstance()->handleCommand(Remote::RECORD);
+        boxstack->handleCommand(Remote::RECORD);
       }
       else if (x>=(keyx+474) && y>=(keyy+4) &&x<=(keyx+128+474) &&y<=(keyy+4+Surface::getFontHeight() + 2))
       {
-        ViewMan::getInstance()->handleCommand(Remote::PLAY);
+        boxstack->handleCommand(Remote::PLAY);
       }
       else if (x>=(keyx+474) && y>=(keyy+ Surface::getFontHeight() + 8) &&x<=(keyx+238+474) &&y<=(keyy+8+2*Surface::getFontHeight() + 2))
       {
-        ViewMan::getInstance()->handleCommand(Remote::GO);
+        boxstack->handleCommand(Remote::GO);
       }
-      else if ( x>=(chanListbox.getOffsetX())
-                && y>=(chanListbox.getOffsetY() + 5)
+      else if ( x>=(chanListbox.getRootBoxOffsetX())
+                && y>=(chanListbox.getRootBoxOffsetY() + 5)
                 // &&x<=(chanListbox.getOffsetX()+155 + WINDOW_WIDTH * MINUTE_SCALE)
-                &&y<=(chanListbox.getOffsetY() - Surface::getFontHeight()
-                - 3+chanListbox.getHeight() + Surface::getFontHeight() + 3)
+                &&y<=(chanListbox.getRootBoxOffsetY() - Surface::getFontHeight()
+                - 3+(int)chanListbox.getHeight() + Surface::getFontHeight() + 3)
               )
       {
-        int cy=y-(chanListbox.getOffsetY() + 5);
+        int cy=y-(chanListbox.getRootBoxOffsetY() + 5);
         int row=cy/(Surface::getFontHeight()+2);
         int clistTop = chanListbox.getTopOption();
         chanListbox.hintSetCurrent(clistTop+row);
@@ -728,7 +766,7 @@ void VEpg::processMessage(Message* m)
 
         selTime = ttime;
         drawData();
-        viewman->updateView(this);
+        boxstack->update(this);
       }
     }
   }
diff --git a/vepg.h b/vepg.h
index 04aa1d604c1b7b9abd62473a07edc0f53528fe48..c633b4907b116ea4cc449ff1c2490967fd225b0b 100644 (file)
--- a/vepg.h
+++ b/vepg.h
 
 #ifndef VEPG_H
 #define VEPG_H
-#define WINDOW_WIDTH (150)
-#define MINUTE_SCALE (3)
+
 #include <stdio.h>
 #include <string.h>
 
-#include "view.h"
-#include "remote.h"
-#include "wselectlist.h"
-#include "viewman.h"
-#include "vdr.h"
-#include "vchannellist.h"
-#include "command.h"
-#include "message.h"
-#include "colour.h"
-#include "video.h"
+#include "boxx.h"
+#include "defines.h"
+#include "timerreceiver.h"
 #include "wtextbox.h"
+#include "vdr.h"
+#include "wselectlist.h"
 #include "event.h"
-#include "message.h"
-#include "vvideolive.h"
-#include "vepgsettimer.h"
-#include "timers.h"
+
+class Message;
+class VVideoLive;
+class BoxStack;
+
+#define WINDOW_WIDTH (150)
+#define MINUTE_SCALE (3)
 
 class VVideoLive;
 
-class VEpg : public View, public TimerReceiver
+class VEpg : public Boxx, public TimerReceiver
 {
   public:
     VEpg(VVideoLive* v, UINT currentChannel, ULONG streamType);
@@ -85,7 +82,7 @@ class VEpg : public View, public TimerReceiver
     void paintCell(Event* event, int yOffset, Colour bg, Colour fg);
     time_t prevHour(time_t* t);
     VVideoLive* videoLive;
-    ViewMan* viewman;
+    BoxStack* boxstack;
     UINT gridRows;
 };
 
index 4e0bcef5741f5b0ee3d4ae6cba54c8aa1b1a847f..4059b1120ded5d3922da3bae34bc03bde18095c3 100644 (file)
 
 #include "vepgsettimer.h"
 
+#include "event.h"
+#include "channel.h"
+#include "boxstack.h"
+#include "vdr.h"
+#include "log.h"
+#include "vinfo.h"
+#include "message.h"
+#include "command.h"
+#include "video.h"
+#include "remote.h"
+#include "i18n.h"
+
 VEpgSetTimer::VEpgSetTimer(Event* tevent, Channel* tchannel)
 {
-  viewman = ViewMan::getInstance();
+  boxstack = BoxStack::getInstance();
   vdr = VDR::getInstance();
   logger = Log::getInstance();
 
   event = tevent;
   channel = tchannel;
 
-  create(400, 240);
+  setSize(400, 240);
+  createBuffer();
   if (Video::getInstance()->getFormat() == Video::PAL)
   {
-    setScreenPos(150, 170);
+    setPosition(150, 170);
   }
   else
   {
-    setScreenPos(140, 140);
+    setPosition(140, 140);
   }
 
-  setBackgroundColour(Colour::VIEWBACKGROUND);
   setTitleBarOn(1);
   setTitleBarColour(Colour::TITLEBARBACKGROUND);
   setBorderOn(true);
   setTitleText(tr("Set Timer"));
 
-  buttonYes.setSurface(surface);
-  buttonNo.setSurface(surface);
-  buttonYes.setSurfaceOffset(80, 40 + (7 * surface->getFontHeight()));
-  buttonNo.setSurfaceOffset(220, 40 + (7 * surface->getFontHeight()));
+  add(&buttonYes);
+  add(&buttonNo);
+
+  buttonYes.setPosition(80, 40 + (7 * surface->getFontHeight()));
+  buttonNo.setPosition(220, 40 + (7 * surface->getFontHeight()));
 
   buttonYes.setText(tr("Yes"));
   buttonNo.setText(tr("No"));
@@ -161,7 +174,7 @@ void VEpgSetTimer::swap()
 
 void VEpgSetTimer::draw()
 {
-  View::draw();
+  TBBoxx::draw();
   drawPara(event->title, 10, 40, Colour::LIGHTTEXT);
   drawText(channel->name, 10, 40 + (2 * surface->getFontHeight()), Colour::LIGHTTEXT);
 
@@ -202,7 +215,7 @@ int VEpgSetTimer::handleCommand(int command)
     {
       swap();
       draw();
-      ViewMan::getInstance()->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::DF_RIGHT:
@@ -210,7 +223,7 @@ int VEpgSetTimer::handleCommand(int command)
     {
       swap();
       draw();
-      ViewMan::getInstance()->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::BACK:
@@ -247,15 +260,16 @@ void VEpgSetTimer::doit()
   else if (ret == 2) logger->log("VEPGST", Log::DEBUG, "Fail: General failure setting timer");
 
   VInfo* vi = new VInfo();
-  vi->create(400, 150);
+  vi->setSize(400, 150);
+  vi->createBuffer();
   vi->setExitable();
   vi->setBorderOn(1);
   vi->setTitleBarOn(0);
 
   if (Video::getInstance()->getFormat() == Video::PAL)
-    vi->setScreenPos(170, 200);
+    vi->setPosition(170, 200);
   else
-    vi->setScreenPos(160, 150);
+    vi->setPosition(160, 150);
 
   if (ret == 0) vi->setOneLiner(tr("Timer set successfully"));
   else if (ret == 1) vi->setOneLiner(tr("There is already a timer for this event"));
@@ -264,12 +278,11 @@ void VEpgSetTimer::doit()
 
   Message* m = new Message();
   m->message = Message::ADD_VIEW;
-  m->to = viewman;
+  m->to = boxstack;
   m->parameter = (ULONG)vi;
   Command::getInstance()->postMessageNoLock(m);
 }
 
-
 void VEpgSetTimer::processMessage(Message* m)
 {
   if (m->message == Message::MOUSE_MOVE)
@@ -279,34 +292,34 @@ void VEpgSetTimer::processMessage(Message* m)
       buttonNo.setActive(0);
       selectedOption = YES;
       draw();
-      ViewMan::getInstance()->updateView(this);
+      boxstack->update(this);
     }
     else if (buttonNo.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
       buttonYes.setActive(0);
       selectedOption = NO;
       draw();
-      ViewMan::getInstance()->updateView(this);
+      boxstack->update(this);
     }
   }
   else if (m->message == Message::MOUSE_LBDOWN)
   {
     if (buttonYes.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
-      ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+      boxstack->handleCommand(Remote::OK); //simulate OK press
     }
     else if (buttonNo.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
-      ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+      boxstack->handleCommand(Remote::OK); //simulate OK press
     }
     else
     {
       //check if press is outside this view! then simulate cancel
       int x=(m->parameter>>16)-getScreenX();
       int y=(m->parameter&0xFFFF)-getScreenY();
-      if (x<0 || y <0 || x>getWidth() || y>getHeight())
+      if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
       {
-        ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+        boxstack->handleCommand(Remote::BACK); //simulate cancel press
       }
     }
   }
index b2ee0f9e2ff5da1ed96824dfe66e3927a16e5e52..e09da8a32f54b02728703fb0441ba216ce5b7593 100644 (file)
 #define VEPGSETTIMER_H
 
 #include <time.h>
-#include "video.h"
-#include "view.h"
-#include "remote.h"
-#include "viewman.h"
-#include "vdr.h"
-#include "event.h"
-#include "channel.h"
-#include "i18n.h"
+
+#include "tbboxx.h"
 #include "wbutton.h"
-#include "vinfo.h"
-#include "message.h"
-#include "command.h"
 
-class VEpgSetTimer : public View
+class Event;
+class Channel;
+class Log;
+class VDR;
+class Message;
+class BoxStack;
+
+class VEpgSetTimer : public TBBoxx
 {
   public:
     VEpgSetTimer(Event* event, Channel* channel);
@@ -46,8 +44,8 @@ class VEpgSetTimer : public View
     void draw();
 
   private:
+    BoxStack* boxstack;
     Log* logger;
-    ViewMan* viewman;
     VDR* vdr;
 
     Event* event;
index c73bd64f1193705bbc1e3fd44856d041086db270..c4409be997d381f27592ff1c161cf4fcac75d2d3 100644 (file)
--- a/vfeed.cc
+++ b/vfeed.cc
 
 #include "vfeed.h"
 
+#include "log.h"
+#include "demuxer.h"
+#include "callback.h"
+
 VFeed::VFeed(Callback* tcb)
 : cb(*tcb)
 {
diff --git a/vfeed.h b/vfeed.h
index 54975ef0fbda56371eea69a63d3a9bb02661c904..514c9084e495423a5a12b7667b65c0ba25c0485a 100644 (file)
--- a/vfeed.h
+++ b/vfeed.h
 #include <stdio.h>
 #include <time.h>
 
-#include "log.h"
-#include "demuxer.h"
-#include "callback.h"
-
 #ifdef WIN32
 #include "threadwin.h"
 #else
 #include "threadp.h"
 #endif
 
+class Callback;
+
 class VFeed : public Thread_TYPE
 {
   public:
diff --git a/view.cc b/view.cc
deleted file mode 100644 (file)
index 0354881..0000000
--- a/view.cc
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
-    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 "view.h"
-
-char View::numViews = 0;
-
-View::View()
-{
-  titleBarOn = 0;
-  borderOn = 0;
-
-  titleText = NULL;
-
-  surface = NULL;
-
-  numViews++;
-  Log::getInstance()->log("View", Log::DEBUG, "Construct %p, now %u", this, numViews);
-}
-
-View::~View()
-{
-  if (titleText) delete[] titleText;
-
-  if (surface != NULL) delete surface;
-
-  numViews--;
-  Log::getInstance()->log("View", Log::DEBUG, "Destruct, now %u", numViews);
-}
-
-bool View::create(UINT w, UINT h)
-{
-  area.w = w;
-  area.h = h;
-
-  surface = new Surface_TYPE();
-  return surface->create(area.w, area.h);
-}
-
-void View::setTitleText(const char* takeText)
-{
-  int length = strlen(takeText);
-  titleText = new char[length + 1];
-  strcpy(titleText, takeText);
-}
-
-void View::draw()
-{
-
-  if (borderOn)
-  {
-    rectangle(0, 0, area.w, area.h, titleBarColour);
-    rectangle(5, 5, area.w-10, area.h-10, backgroundColour);
-  }
-  else
-  {
-    fillColour(backgroundColour);
-  }
-
-  if (titleBarOn)
-  {
-    rectangle(0, 0, area.w, 30, titleBarColour);
-    if (titleText) drawText(titleText, 5, 5, Colour::LIGHTTEXT);
-  }
-}
-
-int View::handleCommand(int command)
-{
-  return 0;
-}
-
-void View::processMessage(Message* m)
-{
-}
-
-void View::setBackgroundColour(Colour& Tcolour)
-{
-  backgroundColour = Tcolour;
-}
-
-void View::setTitleBarColour(Colour& Tcolour)
-{
-  titleBarColour = Tcolour;
-}
-
-void View::setTitleBarOn(UCHAR on)
-{
-  titleBarOn = on;
-}
-
-void View::setBorderOn(UCHAR on)
-{
-  borderOn = on;
-}
diff --git a/view.h b/view.h
deleted file mode 100644 (file)
index 53f0755..0000000
--- a/view.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-    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 VIEW_H
-#define VIEW_H
-
-#include <stdio.h>
-
-#include "log.h"
-#include "box.h"
-#include "defines.h"
-#include "message.h"
-#include "colour.h"
-
-class AbstractViewMan;
-
-class View : public Box
-{
-  public:
-    View();
-    virtual ~View();
-    bool create(UINT width, UINT height); // Even numbers only ?
-
-    virtual void draw();
-    virtual int handleCommand(int command);
-    virtual void processMessage(Message* m); // The master lock will be locked
-
-    void setBorderOn(UCHAR on);
-    void setTitleBarOn(UCHAR on);
-    void setTitleText(const char* title);
-    void setBackgroundColour(Colour& colour);
-    void setTitleBarColour(Colour& colour);
-
-    char* getTitleText() { return titleText; };
-
-    void setViewMan(AbstractViewMan* tviewman) { viewman=tviewman; };
-
-  private:
-    static char numViews;
-
-    char* titleText;
-    UCHAR borderOn;
-
-  protected:
-    Colour backgroundColour;
-    Colour titleBarColour;
-    UCHAR titleBarOn;
-
-    AbstractViewMan* viewman;
-};
-
-#endif
diff --git a/viewman.cc b/viewman.cc
deleted file mode 100644 (file)
index a4ebd12..0000000
+++ /dev/null
@@ -1,456 +0,0 @@
-/*
-    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 "viewman.h"
-#include "command.h"
-
-ViewMan* ViewMan::instance = NULL;
-
-ViewMan::ViewMan()
-{
-  if (instance) return;
-  instance = this;
-  initted = 0;
-  numViews = 0;
-}
-
-ViewMan::~ViewMan()
-{
-  instance = NULL;
-}
-
-ViewMan* ViewMan::getInstance()
-{
-  return instance;
-}
-
-int ViewMan::init()
-{
-  if (initted) return 0;
-  initted = 1;
-  return 1;
-}
-
-int ViewMan::shutdown()
-{
-  if (!initted) return 0;
-
-  // FIXME don't think this can work properly, removeAll leaves the wallpaper there!
-  removeAll();
-
-  initted = 0;
-  return 1;
-}
-
-int ViewMan::add(View* v)
-{
-  if (!initted) return 0;
-  if (numViews == 16) return 0;
-
-  views[numViews++] = v;
-
-  return 1;
-}
-
-// ---------------------------------------------------- REMOVE CODE
-
-int ViewMan::removeView(View* toDelete)
-{
-  if (!initted) return 0;
-  if (numViews == 0) return 0;
-
-//  Log::getInstance()->log("ViewMan", Log::DEBUG, "entering remove, numViews=%i", numViews);
-
-  int i;
-
-  if (toDelete == NULL)
-  {
-    toDelete = views[numViews-1];
-    i = numViews - 1;
-  }
-  else
-  {
-    // to be deleted view is more likely to be at the top
-    for (i = numViews-1; i >= 0; i--)
-    {
-//      Log::getInstance()->log("ViewMan", Log::DEBUG, "todel: %p, i=%i, views[i]=%p", toDelete, i, views[i]);
-      if (views[i] == toDelete) break;
-    }
-
-    if (i == -1)
-    {
-      // not a View we have!
-      return 0;
-    }
-  }
-
-//  Log::getInstance()->log("ViewMan", Log::DEBUG, "Starting deleteView");
-  deleteView(i);
-//  Log::getInstance()->log("ViewMan", Log::DEBUG, "Done deleteView");
-
-  // Shift the views on top down one
-  --numViews;
-  for(int j = i; j < numViews; j++) views[j] = views[j+1];
-
-  // Delete the view
-  delete toDelete;
-
-  // If there is only the wallpaper left signal command
-  if (numViews == 1)
-  {
-    Message* m = new Message();
-    m->to = Command::getInstance();
-    m->message = Message::LAST_VIEW_CLOSE;
-    Command::getInstance()->postMessageNoLock(m);
-  }
-
-  return 1;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// NEW STUFF
-/////////////////////////////////////////////////////////////////////////////
-
-void ViewMan::deleteView(int z)
-{
-//  Log::getInstance()->log("ViewMan", Log::DEBUG, "Delete view %i of %i", z, numViews);
-  RegionList rl;
-  boxSplit(views[z]->area, z + 1, numViews, 1, rl);
-  while(!rl.empty())
-  {
-    repaintRevealed(z, rl.front());
-    rl.pop_front();
-  }
-}
-
-void ViewMan::updateView(View* toUpdate, Region* regionToUpdate)
-{
-//  Log::getInstance()->log("ViewMan", Log::DEBUG, "UpdateView called");
-  // Get the z index of the view
-
-  int z;
-  for (z = 0; z < numViews; z++)
-  {
-    if (views[z] == toUpdate) break;
-  }
-
-  if (z == numViews)
-  {
-    // not a View we have!
-    return;
-  }
-
-  // get the region for the whole view, could be less than that
-  // for smaller updates
-
-  Region r = views[z]->area;
-
-  if (regionToUpdate)
-  {
-    // Can be null if the whole view should be updated
-    // If this is given the numbers are relative to the size of the view, not the screen
-
-    r.x += regionToUpdate->x;
-    r.y += regionToUpdate->y;
-    r.w = regionToUpdate->w;
-    r.h = regionToUpdate->h;
-  }
-
-  RegionList rl;
-
-  Region r2;
-  boxSplit(r, z+1, numViews, 1, rl);
-  while(!rl.empty())
-  {
-    r2 = rl.front();
-    r2.z = z;
-    views[z]->blt(r2);
-    rl.pop_front();
-  }
-}
-
-void ViewMan::repaintRevealed(int x, Region r)
-{
-  RegionList rl;
-  boxSplit(r, x - 1, -1, -1, rl);
-
-  Region r2;
-  while(!rl.empty())
-  {
-    r2 = rl.front();
-    views[r2.z]->blt(r2);
-    rl.pop_front();
-  }
-}
-
-void ViewMan::boxSplit(Region r, int start, int end, int direction, RegionList& rl)
-{
-//  printf("Y=  S=%i E=%i D=%i: Boxsplit: %i %i %i %i\n", start, end, direction, r.x, r.y, r.w, r.h);
-
-  for(int z = start; z != end; z += direction)
-  {
-    if (r.overlappedBy(views[z]->area))
-    {
-//      printf("Z=%i S=%i E=%i D=%i: %i overlaps\n", z, start, end, direction, z);
-
-      int top = r.y;
-      int btm = r.y2();
-
-      if (views[z]->area.y > r.y)
-      {
-//        printf("Z=%i S=%i E=%i D=%i: Case 1 for %i %i %i %i split by %i: %i %i %i %i\n", z, start, end, direction, r.x, r.y, r.w, r.h, z, views[z]->area.x, views[z]->area.y, views[z]->area.w, views[z]->area.h);
-        top = views[z]->area.y;
-        Region newR;
-        newR.x = r.x;
-        newR.y = r.y;
-        newR.w = r.w;
-        newR.h = views[z]->area.y - r.y;
-        boxSplit(newR, z + direction, end, direction, rl);
-
-        if (direction == -1)
-        {
-          Region newR2;
-          newR2.x = r.x;
-          newR2.y = views[z]->area.y;
-          newR2.w = r.w;
-          newR2.h = r.h - newR.h;
-          boxSplit(newR2, z, end, -1, rl);
-          return;
-        }
-      }
-
-      if (views[z]->area.y2() < r.y2())
-      {
-//        printf("Z=%i S=%i E=%i D=%i: Case 2 for %i %i %i %i split by %i: %i %i %i %i\n", z, start, end, direction, r.x, r.y, r.w, r.h, z, views[z]->area.x, views[z]->area.y, views[z]->area.w, views[z]->area.h);
-        btm = views[z]->area.y2();
-        Region newR;
-        newR.x = r.x;
-        newR.y = views[z]->area.y2() + 1;
-        newR.w = r.w;
-        newR.h = r.y2() - newR.y + 1;
-        boxSplit(newR, z + direction, end, direction, rl);
-
-        if (direction == -1)
-        {
-          Region newR2;
-          newR2.x = r.x;
-          newR2.y = r.y;
-          newR2.w = r.w;
-          newR2.h = r.h - newR.h;
-          boxSplit(newR2, z, end, -1, rl);
-          return;
-        }
-      }
-
-      if (views[z]->area.x > r.x)
-      {
-//        printf("Z=%i S=%i E=%i D=%i: Case 3 for %i %i %i %i split by %i: %i %i %i %i\n", z, start, end, direction, r.x, r.y, r.w, r.h, z, views[z]->area.x, views[z]->area.y, views[z]->area.w, views[z]->area.h);
-        Region newR;
-        newR.x = r.x;
-        newR.y = top;
-        newR.w = views[z]->area.x - r.x;
-        newR.h = btm - top + 1;
-        boxSplit(newR, z + direction, end, direction, rl);
-
-        if (direction == -1)
-        {
-          Region newR2;
-          newR2.x = r.x + newR.w;
-          newR2.y = r.y;
-          newR2.w = r.w - newR.w;
-          newR2.h = r.h;
-          boxSplit(newR2, z, end, -1, rl);
-          return;
-        }
-      }
-
-      if (views[z]->area.x2() < r.x2())
-      {
-//        printf("Z=%i S=%i E=%i D=%i: Case 4 for %i %i %i %i split by %i: %i %i %i %i\n", z, start, end, direction, r.x, r.y, r.w, r.h, z, views[z]->area.x, views[z]->area.y, views[z]->area.w, views[z]->area.h);
-        Region newR;
-        newR.x = views[z]->area.x2() + 1;
-        newR.y = top;
-        newR.w = r.x2() - newR.x + 1;
-        newR.h = btm - top + 1;
-        boxSplit(newR, z + direction, end, direction, rl);
-
-        if (direction == -1)
-        {
-          Region newR2;
-          newR2.x = r.x;
-          newR2.y = r.y;
-          newR2.w = r.w - newR.w;
-          newR2.h = r.h;
-          boxSplit(newR2, z, end, -1, rl);
-          return;
-        }
-      }
-
-      if (direction == -1)
-      {
-        // we are going down the stack
-        // r is underlapped by views[z]
-        // but we have not split
-        // Therefore this region under test is
-        // completely covering views[z]
-
-        // don't go any further down, generate a region and quit
-
-//        printf("Repaint region: %i %i %i %i\n", r.x, r.y, r.w, r.h);
-        r.z = z;
-        rl.push_front(r);
-      }
-
-//      printf("Returning from Z=%i\n", z);
-      return;
-    }
-    else
-    {
-//      printf("Z=%i S=%i E=%i D=%i: %i does not overlap\n", z, start, end, direction, z);
-    }
-  }
-
-  // if direction = 1 then we have come to a region that is
-  // entirely clear of higher views and needs to be redrawn
-
-  // if direction = -1 then we have come to a region that is on
-  // the very bottom with nothing below it to repaint.
-  // do nothing. stale window data will be left on screen?
-
-  if (direction == 1)
-  {
-    rl.push_front(r);
-  }
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// END NEW STUFF
-/////////////////////////////////////////////////////////////////////////////
-
-// ---------------------------------------------------- END OF REMOVE CODE
-
-
-void ViewMan::removeAll()
-{
-  // 1.. Don't delete wallpaper. No point.
-  for (; numViews > 1; --numViews)
-  {
-    delete views[numViews-1];
-  }
-}
-
-int ViewMan::handleCommand(int command)
-{
-  int retVal;
-  int retVal2 = 0;
-  int i;
-
-  if (command != Remote::NA_NONE)
-  {
-    // handle command return values
-    // 0 - drop through to next view
-    // 1 - dont drop to next view, but not handled
-    // 2 - handled - stop command here
-    // 4 - handled - delete this view
-
-    for (i=numViews-1; i>=0; i--)
-    {
-//      Log::getInstance()->log("ViewMan", Log::DEBUG, "Giving command to i=%i", i);
-      retVal = views[i]->handleCommand(command);
-      if (retVal == 1)
-      {
-        // not handled but don't give to any more views
-        return 0;
-      }
-
-      if (retVal == 2)
-      {
-        // command handled
-        retVal2 = 1;
-        break;
-      }
-      else if (retVal == 4)
-      {
-//        Log::getInstance()->log("ViewMan", Log::DEBUG, "Return 4: i=%i, views[i]=%p", i, views[i]);
-        removeView(views[i]);
-        retVal2 = 1;
-        break;
-      }
-    }
-  }
-  else
-  {
-    // fake the return code
-    retVal2 = 2;
-  }
-
-  return retVal2;
-}
-
-void ViewMan::processMessage(Message* m)
-{
-  if (m->to != this)
-  {
-    for (int i = numViews-1; i >= 0; i--)
-    {
-      if (views[i] == m->to)
-      {
-        Log::getInstance()->log("ViewMan", Log::DEBUG, "sending message from view %p to view %p %lu", m->from, m->to, m->message);
-        views[i]->processMessage(m);
-        return;
-      }
-    }
-    return;
-  }
-
-  /* Handle mouse events*/
-  // They come in with m->to = NULL? and just need to be delivered to top view?
-  if ((numViews > 1) && ((m->message == Message::MOUSE_MOVE) || (m->message == Message::MOUSE_LBDOWN)))
-  {
-    views[numViews-1]->processMessage(m);
-    return;
-  }
-
-  Log::getInstance()->log("ViewMan", Log::DEBUG, "it's for meeee!");
-
-  switch(m->message)
-  {
-    case Message::CLOSE_ME:
-    {
-      removeView((View*)m->from);
-      break;
-    }
-    case Message::ADD_VIEW: // currently not used by anything but it might come in useful again
-    {
-      View* toAdd = (View*)m->parameter;
-      add(toAdd);
-      toAdd->draw();
-      updateView(toAdd);
-      break;
-    }
-    case Message::REDRAW:
-    {
-      View* toRedraw = (View*)m->from;
-      Region* toRedrawRegion = (Region*)m->parameter;
-      updateView(toRedraw, toRedrawRegion);
-      break;
-    }
-  }
-}
diff --git a/viewman.h b/viewman.h
deleted file mode 100644 (file)
index 7a71054..0000000
--- a/viewman.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-    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 VIEWMAN_H
-#define VIEWMAN_H
-
-#include <stdio.h>
-#include <time.h>
-#include <signal.h>
-#include <list>
-
-#include "defines.h"
-#include "view.h"
-#include "message.h"
-#include "messagequeue.h"
-#include "remote.h"
-#include "surface.h"
-#include "region.h"
-
-//using namespace std;
-
-//using namespace __gnu_cxx; // needed for newer compilers?
-
-typedef list<Region> RegionList;
-
-class AbstractViewMan
-{
-  public:
-    AbstractViewMan() {};
-    virtual ~AbstractViewMan() {};
-
-    virtual int handleCommand(int command)=0;
-
-    virtual int add(View* v)=0;
-    virtual int removeView(View* toRemove)=0;
-    virtual void removeAll()=0;
-    virtual void updateView(View* toUpdate, Region* regionToUpdate = NULL)=0;
-};
-
-
-class ViewMan: public AbstractViewMan
-{
-  public:
-    ViewMan();
-    virtual ~ViewMan();
-    static ViewMan* getInstance();
-
-    int init();
-    int shutdown();
-
-    int add(View* v);
-    int removeView(View* toRemove);
-    void removeAll();
-    void updateView(View* toUpdate, Region* regionToUpdate = NULL);
-
-    int handleCommand(int command);
-    void processMessage(Message* m);
-
-  private:
-    static ViewMan* instance;
-    int initted;
-
-    View* views[20];
-    int numViews;
-
-    // New windowing stuff
-    void deleteView(int z);
-    void repaintRevealed(int x, Region r);
-    void boxSplit(Region r, int start, int end, int direction, RegionList& rl);
-};
-
-#endif
index 790c45185eaa553fd24c6781e9e17f3d6409edd6..eff47a0b37da6541b415d9146a3a84ca9ea34766 100644 (file)
--- a/vinfo.cc
+++ b/vinfo.cc
 
 #include "vinfo.h"
 
+#include "remote.h"
+#include "colour.h"
+#include "wbutton.h"
+#include "i18n.h"
+#include "boxstack.h"
+
 VInfo::VInfo()
 {
   mainText = NULL;
@@ -27,7 +33,6 @@ VInfo::VInfo()
   dropThrough = 0;
   okbutton = false;
 
-  setBackgroundColour(Colour::VIEWBACKGROUND);
   setTitleBarOn(1);
   setTitleBarColour(Colour::TITLEBARBACKGROUND);
 }
@@ -47,7 +52,7 @@ void VInfo::setDropThrough()
   dropThrough = 1;
 }
 
-void VInfo::setMainText(char* takeText)
+void VInfo::setMainText(const char* takeText)
 {
   int length = strlen(takeText);
   mainText = new char[length + 1];
@@ -55,7 +60,7 @@ void VInfo::setMainText(char* takeText)
   mainTextType = NORMAL;
 }
 
-void VInfo::setOneLiner(char* takeText)
+void VInfo::setOneLiner(const char* takeText)
 {
   int length = strlen(takeText);
   mainText = new char[length + 1];
@@ -65,7 +70,7 @@ void VInfo::setOneLiner(char* takeText)
 
 void VInfo::draw()
 {
-  View::draw();
+  TBBoxx::draw();
 
   if (mainText)
   {
@@ -83,13 +88,15 @@ void VInfo::draw()
 
   if (okbutton)
   {
+/*
     WButton button;
-    button.setSurface(surface);
-    button.setSurfaceOffset((area.w / 2) - 30, area.h - 50);
+    button.setPosition((area.w / 2) - 30, area.h - 50);
     button.setText(tr("OK"));
     button.setActive(1);
+    add(&button);
     button.draw();
-  }
+*/
+  } // FIXME check
 }
 
 int VInfo::handleCommand(int command)
@@ -117,6 +124,6 @@ void VInfo::processMessage(Message* m)
 {
   if (m->message == Message::MOUSE_LBDOWN)
   {
-    ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+    BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
   }
 }
diff --git a/vinfo.h b/vinfo.h
index 4f806bde2beea58f65844e9e6c5575c9a4d33e38..92deb0684611e88df5fd1df597b7b93ecdfb6a16 100644 (file)
--- a/vinfo.h
+++ b/vinfo.h
 #include <stdio.h>
 #include <string.h>
 
+#include "tbboxx.h"
 #include "defines.h"
-#include "view.h"
-#include "remote.h"
-#include "colour.h"
-#include "wbutton.h"
-#include "i18n.h"
-#include "viewman.h"
-
-class VInfo : public View
+
+class VInfo : public TBBoxx
 {
   public:
     VInfo();
     virtual ~VInfo();
 
-    void setMainText(char* title);
-    void setOneLiner(char* text);
+    void setMainText(const char* title);
+    void setOneLiner(const char* text);
     void setExitable();
     void setDropThrough();
     void okButton();
index 6f1f835803e0fda3037a055cdd52c3b07b9956fb..b1e5ccaaa85221ea85a0520f2fcede7d84f55006 100644 (file)
 
 #include "vlivebanner.h"
 
+#include "vvideolive.h"
+#include "remote.h"
+#include "colour.h"
+#include "video.h"
+#include "event.h"
+#include "vinfo.h"
+#include "boxstack.h"
+#include "i18n.h"
+#include "timers.h"
+#include "channel.h"
+#include "command.h"
+
 VLiveBanner* VLiveBanner::instance = NULL;
 
 VLiveBanner::VLiveBanner(VVideoLive* tvvideoLive, Channel* channel, bool bannerTakesCommands)
@@ -34,25 +46,25 @@ VLiveBanner::VLiveBanner(VVideoLive* tvvideoLive, Channel* channel, bool bannerT
   clockRegion.w = 60;
   clockRegion.h = 30;
 
-  create(500, 120);
+  setSize(500, 120);
+  createBuffer();
   if (Video::getInstance()->getFormat() == Video::PAL)
   {
-    setScreenPos(124, 410);
+    setPosition(124, 410);
   }
   else
   {
-    setScreenPos(114, 320);
+    setPosition(114, 320);
   }
 
 
-  setBackgroundColour(Colour::VIEWBACKGROUND);
   setTitleBarOn(1);
   setTitleBarColour(Colour::TITLEBARBACKGROUND);
 
-  sl.setSurface(surface);
-  sl.setSurfaceOffset(0, 30);
-  sl.setDimensions(area.w, area.h - 60);
+  sl.setPosition(0, 30);
+  sl.setSize(area.w, area.h - 60);
   sl.setNoLoop();
+  add(&sl);
 
   setChannel(channel);
 }
@@ -138,8 +150,7 @@ void VLiveBanner::setChannel(Channel* tChannel)
 
 void VLiveBanner::draw()
 {
-  View::draw();
-  sl.draw();
+  TBBoxx::draw();
   rectangle(0, area.h - 30, area.w, 30, titleBarColour);
 
   rectangle(7, area.h - 24, 18, 16, Colour::RED);
@@ -170,7 +181,7 @@ int VLiveBanner::handleCommand(int command)
       sl.up();
       sl.draw();
 
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
 
       // Arrows pressed, go to an 8s timer
       Timers::getInstance()->setTimerD(this, 1, 8);
@@ -186,7 +197,7 @@ int VLiveBanner::handleCommand(int command)
       sl.down();
       sl.draw();
 
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
 
       // Arrows pressed, go to an 8s timer
       Timers::getInstance()->setTimerD(this, 1, 8);
@@ -224,17 +235,18 @@ int VLiveBanner::handleCommand(int command)
       else vi->setMainText(tr("Summary unavailable"));
       if (Video::getInstance()->getFormat() == Video::PAL)
       {
-        vi->setScreenPos(120, 130);
+        vi->setPosition(120, 130);
       }
       else
       {
-        vi->setScreenPos(110, 90);
+        vi->setPosition(110, 90);
       }
-      vi->create(510, 270);
+      vi->setSize(510, 270);
+      vi->createBuffer();
       vi->draw();
 
-      ViewMan::getInstance()->add(vi);
-      ViewMan::getInstance()->updateView(vi);
+      BoxStack::getInstance()->add(vi);
+      BoxStack::getInstance()->update(vi);
 
       return 2;
     }
@@ -262,7 +274,7 @@ void VLiveBanner::timercall(int clientReference)
     // delete me!
     Message* m = new Message();  // Delete self
     m->message = Message::CLOSE_ME;
-    m->to = ViewMan::getInstance();
+    m->to = BoxStack::getInstance();
     m->from = this;
     Command::getInstance()->postMessageFromOuterSpace(m);
   }
@@ -272,7 +284,7 @@ void VLiveBanner::timercall(int clientReference)
     drawClock();
     Message* m = new Message();
     m->message = Message::REDRAW;
-    m->to = ViewMan::getInstance();
+    m->to = BoxStack::getInstance();
     m->from = this;
     m->parameter = (ULONG)&clockRegion;
     Command::getInstance()->postMessageFromOuterSpace(m);
@@ -306,7 +318,7 @@ void VLiveBanner::processMessage(Message* m)
     if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
       sl.draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
     }
   }
   else if (m->message == Message::MOUSE_LBDOWN)
@@ -314,20 +326,20 @@ void VLiveBanner::processMessage(Message* m)
     //check if press is outside this view! then simulate cancel
     int x=(m->parameter>>16)-getScreenX();
     int y=(m->parameter&0xFFFF)-getScreenY();
-    if (x<0 || y <0 || x>getWidth() || y>getHeight())
+    if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
     {
-      ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+      BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
     }
     else if (y>=(int)area.h-24 && y<=(int)area.h-6)
     {
       //y coordinate is right!
       if (x>=7 &&x<=25)
       {
-        ViewMan::getInstance()->handleCommand(Remote::RED); //simulate red press
+        BoxStack::getInstance()->handleCommand(Remote::RED); //simulate red press
       }
       else if (x>=110 &&x<=128)
       {
-        ViewMan::getInstance()->handleCommand(Remote::GREEN); //simulate red press
+        BoxStack::getInstance()->handleCommand(Remote::GREEN); //simulate red press
       }
     }
   }
index 85ee138d9e276c43840d07fdc6e2897bcb6a1287..79cc51ea377726acbc7736c6f1e07d1e78c9cd87 100644 (file)
 #include <vector>
 #include <algorithm>
 
-#include "view.h"
-#include "remote.h"
-#include "vdr.h"
-#include "wselectlist.h"
-#include "colour.h"
-#include "video.h"
-#include "event.h"
-#include "vinfo.h"
-#include "viewman.h"
-#include "i18n.h"
+#include "tbboxx.h"
 #include "timerreceiver.h"
-#include "timers.h"
-//#include "vvideolive.h"
+#include "wselectlist.h"
+#include "region.h"
+#include "vdr.h"
 
 class VVideoLive;
+class Channel;
 
-class VLiveBanner : public View, public TimerReceiver
+class VLiveBanner : public TBBoxx, public TimerReceiver
 {
   public:
     VLiveBanner(VVideoLive* tvvideoLive, Channel* channel, bool bannerTakesCommands);
index baaa129455b8b70c91bff5c9b27c3c31132a29fe..e29a74583f0a656d2fa0ac00fca18e214e24fbd7 100644 (file)
 */
 
 #include <vector>
-#include "unistd.h"
-#include "vmedialist.h"
 #include <time.h>
 #include <string.h>
+#include "unistd.h"
+
+#include "vmedialist.h"
+
 #include "vpicture.h"
 #include "vaudioplayer.h"
-
+#include "remote.h"
+#include "wsymbol.h"
+#include "boxstack.h"
+#include "vvideolive.h"
+#include "colour.h"
+#include "video.h"
+#include "i18n.h"
+#include "vdr.h"
+#include "command.h"
+#include "vinfo.h"
 
 using namespace std;
 class MediaDirectory {
@@ -225,33 +236,30 @@ struct MediaSorterTime
 
 VMediaList::VMediaList()
 {
+  boxstack = BoxStack::getInstance();
+
        dirlist=new DirList();
   Log::getInstance()->log("VMediaList::VMediaList", Log::DEBUG, "dirlist=%p,curren=%p",dirlist,dirlist->getCurrent());
        dirlist->getCurrent()->setSortorder(SORT_NAME);
-  create(570, 420);
+  setSize(570, 420);
+  createBuffer();
   if (Video::getInstance()->getFormat() == Video::PAL)
-  {
-    setScreenPos(80, 70);
-  }
+    setPosition(80, 70);
   else
-  {
-    setScreenPos(70, 35);
-  }
+    setPosition(70, 35);
 
-  setBackgroundColour(Colour::VIEWBACKGROUND);
   setTitleBarOn(1);
   setTitleBarColour(Colour::TITLEBARBACKGROUND);
 
-  sl.setSurface(surface);
-  sl.setSurfaceOffset(10, 30 + 5);
-  sl.setDimensions(area.w - 20, area.h - 30 - 15 - 30);
+  sl.setPosition(10, 30 + 5);
+  sl.setSize(area.w - 20, area.h - 30 - 15 - 30);
   sl.addColumn(0);
   sl.addColumn(60);
+  add(&sl);
+  
   mediaList=NULL;
   loading=true;
   sortOrder=SORT_NONE;
-
-
 }
 
 VMediaList::~VMediaList()
@@ -356,7 +364,7 @@ void VMediaList::highlightMedia(Media* media)
   sl.hintSetCurrent(media->index);
   sl.draw();
   doShowingBar();
-  ViewMan::getInstance()->updateView(this);
+  boxstack->update(this);
 }
 
 void VMediaList::draw()
@@ -366,40 +374,45 @@ void VMediaList::draw()
   SNPRINTF(title, 398, tr("Media - %s"), dirlist->getCurrent()->getDisplayname());
   title[399]=0;
   setTitleText(title);
-  View::draw();
+  
   if (loading)
   {
+    sl.setVisible(false);
+    TBBoxx::draw();
     drawText(tr("Loading..."), 240, 180, Colour::LIGHTTEXT);
   }
-  else {
-  if (sl.getNumOptions() > 0) sl.draw();
+  else 
+  {
+    //if (sl.getNumOptions() > 0) sl.draw();
+    sl.setVisible(true);
+    TBBoxx::draw();
 
-  // Put the status stuff at the bottom
+    // Put the status stuff at the bottom
 
-  WSymbol w;
-  w.setSurface(surface);
+    WSymbol w;
+    TEMPADD(&w);
 
-  w.nextSymbol = WSymbol::UP;
-  w.setSurfaceOffset(20, 385);
-  w.draw();
+    w.nextSymbol = WSymbol::UP;
+    w.setPosition(20, 385);
+    w.draw();
 
-  w.nextSymbol = WSymbol::DOWN;
-  w.setSurfaceOffset(50, 385);
-  w.draw();
+    w.nextSymbol = WSymbol::DOWN;
+    w.setPosition(50, 385);
+    w.draw();
 
-  w.nextSymbol = WSymbol::SKIPBACK;
-  w.setSurfaceOffset(85, 385);
-  w.draw();
+    w.nextSymbol = WSymbol::SKIPBACK;
+    w.setPosition(85, 385);
+    w.draw();
 
-  w.nextSymbol = WSymbol::SKIPFORWARD;
-  w.setSurfaceOffset(115, 385);
-  w.draw();
+    w.nextSymbol = WSymbol::SKIPFORWARD;
+    w.setPosition(115, 385);
+    w.draw();
 
-  w.nextSymbol = WSymbol::PLAY;
-  w.setSurfaceOffset(150, 385);
-  w.draw();
+    w.nextSymbol = WSymbol::PLAY;
+    w.setPosition(150, 385);
+    w.draw();
 
-  doShowingBar();
+    doShowingBar();
   }
 }
 
@@ -409,7 +422,7 @@ void VMediaList::doShowingBar()
   if (sl.getNumOptions() == 0) topOption = 0;
 
   char showing[250];
-  char * strmode=tr("Name");
+  const char* strmode=tr("Name");
   switch (sortOrder) {
     case SORT_TIME:
       strmode=tr("Rand");
@@ -473,7 +486,7 @@ int VMediaList::handleCommand(int command)
       sl.hintSetCurrent(0);
       sl.draw();
       doShowingBar();
-      ViewMan::getInstance()->updateView(this);
+      boxstack->update(this);
       return 2;
                        }
     case Remote::DF_UP:
@@ -483,7 +496,7 @@ int VMediaList::handleCommand(int command)
       sl.draw();
 
       doShowingBar();
-      ViewMan::getInstance()->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::DF_DOWN:
@@ -493,7 +506,7 @@ int VMediaList::handleCommand(int command)
       sl.draw();
 
       doShowingBar();
-      ViewMan::getInstance()->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::SKIPBACK:
@@ -502,7 +515,7 @@ int VMediaList::handleCommand(int command)
       sl.draw();
 
       doShowingBar();
-      ViewMan::getInstance()->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::SKIPFORWARD:
@@ -511,7 +524,7 @@ int VMediaList::handleCommand(int command)
       sl.draw();
 
       doShowingBar();
-      ViewMan::getInstance()->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::BLUE:
@@ -519,15 +532,15 @@ int VMediaList::handleCommand(int command)
       switch(sortOrder) {
         case SORT_NAME:
           sortList(SORT_TIME);
-          ViewMan::getInstance()->updateView(this);
+          boxstack->update(this);
           return 2;
         case SORT_TIME:
           sortList(SORT_RANDOM);
-          ViewMan::getInstance()->updateView(this);
+          boxstack->update(this);
           return 2;
         default:
           sortList(SORT_NAME);
-          ViewMan::getInstance()->updateView(this);
+          boxstack->update(this);
           return 2;
       }
     }
@@ -580,8 +593,8 @@ int VMediaList::handleCommand(int command)
       VVideoLive* v = new VVideoLive(mediaList, media->type, this);
 
       v->draw();
-      ViewMan::getInstance()->add(v);
-      ViewMan::getInstance()->updateView(v);
+      boxstack->add(v);
+      boxstack->updatev);
 
       v->medianelChange(VVideoLive::NUMBER, media->number);
       */
@@ -607,22 +620,22 @@ void VMediaList::processMessage(Message* m)
     {
       sl.draw();
       doShowingBar();
-      ViewMan::getInstance()->updateView(this);
+      boxstack->update(this);
     }
   }
   else if (m->message == Message::MOUSE_LBDOWN)
   {
     if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
-      ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+      boxstack->handleCommand(Remote::OK); //simulate OK press
     }
     else
     { //check if press is outside this view! then simulate cancel
       int x=(m->parameter>>16)-getScreenX();
       int y=(m->parameter&0xFFFF)-getScreenY();
-      if (x<0 || y <0 || x>getWidth() || y>getHeight())
+      if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
       {
-        ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+        boxstack->handleCommand(Remote::BACK); //simulate cancel press
       }
     }
   }
@@ -632,10 +645,10 @@ int VMediaList::createList() {
    Log::getInstance()->log("VMediaList::createList", Log::DEBUG, "");
    VMediaList *vmn=new VMediaList();
    //show the "loading" indicator
-   ViewMan::getInstance()->add(vmn);
+   BoxStack::getInstance()->add(vmn);
    int rt=vmn->load();
    if ( rt != 0) {
-     ViewMan::getInstance()->removeView(vmn);
+     BoxStack::getInstance()->remove(vmn);
      }
    return rt;
 }
@@ -665,7 +678,7 @@ int VMediaList::load() {
        
        loading=true;
        draw();
-  ViewMan::getInstance()->updateView(this);
+  boxstack->update(this);
   VDR* vdr=VDR::getInstance();
    Log::getInstance()->log("VMediaList::load", Log::DEBUG, "load list for %s",dirlist->getPath());
   if (vdr->isConnected()) {
@@ -674,7 +687,7 @@ int VMediaList::load() {
      if (mn != NULL) {
        setList(mn);
                         draw();
-       ViewMan::getInstance()->updateView(this);
+       boxstack->update(this);
        return 0;
        }
   }
@@ -683,22 +696,24 @@ int VMediaList::load() {
   }
   else {
     Log::getInstance()->log("VMediaList", Log::ERR, "unable to get MediaList for %s",dirlist->getPath());
+
     VInfo* vi = new VInfo();
-    vi->create(400, 150);
+    vi->setSize(400, 150);
+    vi->createBuffer();
     vi->setExitable();
     vi->setBorderOn(1);
     vi->setTitleBarOn(0);
 
     if (Video::getInstance()->getFormat() == Video::PAL)
-      vi->setScreenPos(170, 200);
+      vi->setPosition(170, 200);
     else
-      vi->setScreenPos(160, 150);
+      vi->setPosition(160, 150);
     vi->setOneLiner(tr("unable to get media list"));
     vi->draw();
 
     Message* m = new Message();
     m->message = Message::ADD_VIEW;
-    m->to = ViewMan::getInstance();
+    m->to = boxstack;
     m->parameter = (ULONG)vi;
     Command::getInstance()->postMessageNoLock(m);
   }
@@ -708,3 +723,4 @@ int VMediaList::load() {
 const char * VMediaList::getDirname() const {
        return dirlist->getCurrent()->getFullPath();
 }
+
index ff2b5414a7f7318340c5e08a49843af89f90435a..6ebbebf4fbdd1e36c760685882ea8138f7d27a65 100644 (file)
 #include <string.h>
 #include <vector>
 
-#include "view.h"
+#include "tbboxx.h"
 #include "wselectlist.h"
-#include "remote.h"
-#include "wsymbol.h"
-#include "viewman.h"
-#include "vdr.h"
 #include "media.h"
-#include "vvideolive.h"
-#include "colour.h"
-#include "video.h"
-#include "i18n.h"
 
 class DirList;
-class VMediaList : public View
+class Message;
+class BoxStack;
+
+class VMediaList : public TBBoxx
 {
   public:
     VMediaList();
@@ -75,6 +70,7 @@ class VMediaList : public View
       * fill the medialist basing on the current dirname
       */
     int load();
+    BoxStack*    boxstack;
     MediaList    *mediaList;
     WSelectList sl;
     bool         loading;
index 1f139501de2e7c3c08942977e0d5a71220aff2b9..ebf8bae20d087e9526dc16d7e957efc15f2a8e8a 100644 (file)
--- a/vmute.cc
+++ b/vmute.cc
 
 #include "vmute.h"
 
+#include "remote.h"
+#include "audio.h"
+#include "video.h"
+#include "wsymbol.h"
+#include "colour.h"
+#include "timers.h"
+#include "boxstack.h"
+#include "command.h"
+
 VMute::VMute()
 {
   isMuted = Audio::getInstance()->toggleUserMute();
 
-  create(40, 40);
+  setSize(40, 40);
+  createBuffer();
   if (Video::getInstance()->getFormat() == Video::PAL)
   {
-    setScreenPos(600, 500);
+    setPosition(600, 500);
   }
   else
   {
-    setScreenPos(590, 400);
+    setPosition(590, 400);
   }
-
-  setBackgroundColour(Colour::VIEWBACKGROUND);
 }
 
 VMute::~VMute()
@@ -45,13 +53,14 @@ VMute::~VMute()
 
 void VMute::draw()
 {
-  View::draw();
+  // draw background?
+  fillColour(Colour::VIEWBACKGROUND);
 
   WSymbol w;
-  w.setSurface(surface);
+  TEMPADD(&w);
   if (isMuted) w.nextSymbol = WSymbol::MUTE;
   else w.nextSymbol = WSymbol::UNMUTE;
-  w.setSurfaceOffset(5, 5);
+  w.setPosition(5, 5);
   w.draw();
 
   Timers::getInstance()->setTimerD(this, 1, 2);
@@ -62,7 +71,7 @@ void VMute::timercall(int clientReference)
   // delete me!
   Message* m = new Message(); // Delete self
   m->message = Message::CLOSE_ME;
-  m->to = ViewMan::getInstance();
+  m->to = BoxStack::getInstance();
   m->from = this;
   Command::getInstance()->postMessageFromOuterSpace(m);
 }
@@ -75,7 +84,7 @@ int VMute::handleCommand(int command)
     {
       isMuted = Audio::getInstance()->toggleUserMute();
       draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       // handled
       return 2;
     }
diff --git a/vmute.h b/vmute.h
index 3709115feece97e00014cd8a4671ab9dffdced5f..ce223a8c1d678e47b2948e777f1d6799290133d7 100644 (file)
--- a/vmute.h
+++ b/vmute.h
 
 #include <stdio.h>
 
-#include "view.h"
-#include "remote.h"
-#include "audio.h"
-#include "wsymbol.h"
-#include "colour.h"
-#include "video.h"
+#include "boxx.h"
 #include "timerreceiver.h"
-#include "timers.h"
-#include "viewman.h"
 
-class VMute : public View, public TimerReceiver
+class VMute : public Boxx, public TimerReceiver
 {
   public:
     VMute();
diff --git a/voptions.cc b/voptions.cc
deleted file mode 100644 (file)
index c264846..0000000
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
-    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(void* tparent, const char* title, const OPTIONDATA* toptionData, const int tnumOptions)
-{
-  viewman = ViewMan::getInstance();
-
-  parent = tparent;
-  optionData = toptionData;
-  numOptions = tnumOptions;
-
-  UINT newHeight = 85;
-  if (numOptions < 4) newHeight += (4 * 30);
-  else newHeight += (numOptions * 30);
-
-  create(530, newHeight);
-
-  setBackgroundColour(Colour::VIEWBACKGROUND);
-  setTitleBarOn(1);
-  setTitleBarColour(Colour::TITLEBARBACKGROUND);
-  setTitleText(title);
-
-  int fontHeight = surface->getFontHeight();
-
-  optionBoxes = new WOptionBox[numOptions];
-
-  UINT i, j;
-  char* config;
-  vdr = VDR::getInstance();
-  // After setup, save all current indexes
-  optionsAtStart = new int[numOptions];
-
-  for (i = 0; i < numOptions; i++)
-  {
-    optionBoxes[i].setSurface(surface);
-    optionBoxes[i].setSurfaceOffset(346, 45 + (i * 30));
-    optionBoxes[i].setDimensions(150, fontHeight);
-
-    if (optionData[i].optionType == OPTIONTYPE_TEXT)
-    {
-      for (j = 0; j < optionData[i].optionCount; j++)
-      {
-        Log::getInstance()->log("Options", Log::DEBUG, "Add option: %s", optionData[i].options[j]);
-        optionBoxes[i].addOption(tr((char*)optionData[i].options[j]));
-      }
-
-      // Set the built in default
-      optionBoxes[i].setSelected(tr((char*)optionData[i].options[optionData[i].defaultOption]));
-    }
-    else
-    {
-      // int mode
-      optionBoxes[i].setIntMode(optionData[i].startInt, optionData[i].optionCount);
-      optionBoxes[i].setSelected(optionData[i].defaultOption);
-    }
-
-    // Now see if there is a config option for it
-    config = vdr->configLoad(optionData[i].configSection, optionData[i].configParam);
-    if (config)
-    {
-      if (optionData[i].optionType == OPTIONTYPE_TEXT)
-      {
-        for (j = 0; j < optionData[i].optionCount; j++)
-        {
-          if (!STRCASECMP(config, optionData[i].options[j]))
-          {
-            optionBoxes[i].setSelected(tr((char*)optionData[i].options[j]));
-          }
-        }
-      }
-      else
-      {
-        optionBoxes[i].setSelected(atoi(config));
-      }
-      delete[] config;
-    }
-
-    // After setup, save initial option
-    optionsAtStart[i] = optionBoxes[i].getSelectedIndex();
-  }
-
-  selectedOption = numOptions;
-  //optionBoxes[0].setActive(1);
-
-  int voff = 0;
-  if ((numOptions < 8) && (numOptions >= 4))
-  {
-    voff = (8 - numOptions) * 10;
-  }
-  else if (numOptions < 4)
-  {
-    voff = 40; //(4 * 10)
-  }
-
-  if (Video::getInstance()->getFormat() == Video::PAL)
-  {
-    setScreenPos(104, 130 + voff);
-  }
-  else
-  {
-    setScreenPos(94, 70 + voff);
-  }
-
-  if (!vdr->isConnected()) Command::getInstance()->connectionLost();
-}
-
-VOptions::~VOptions()
-{
-  delete[] optionsAtStart;
-  delete[] optionBoxes;
-}
-
-void VOptions::draw()
-{
-  View::draw();
-
-  WSymbol wsy;
-  Colour cl;
-
-  drawText(tr("Press back to exit, <, > or [ok] to change"), 10, area.h - 30, Colour::LIGHTTEXT);
-
-  wsy.setSurface(surface);
-  UINT ystart=titleBarOn ? 45 : 15;
-
-  for (UINT i = 0; i < numOptions; i++)
-  {
-    drawText(tr(optionData[i].title), 10, ystart + i*30, Colour::LIGHTTEXT);
-
-    if (i == selectedOption) cl = Colour::SELECTHIGHLIGHT;
-    else cl = Colour::BUTTONBACKGROUND;
-
-    wsy.nextSymbol = WSymbol::LEFTARROW;
-    wsy.nextColour = cl;
-
-    wsy.setSurfaceOffset(328, ystart + 2 + (i * 30));
-    wsy.draw();
-    wsy.nextSymbol = WSymbol::RIGHTARROW;
-    wsy.setSurfaceOffset(498, ystart + 2 + (i * 30));
-    wsy.draw();
-    optionBoxes[i].setSurfaceOffset(346, ystart + (i * 30));
-    optionBoxes[i].draw();
-  }
-}
-
-int VOptions::handleCommand(int command)
-{
-  switch(command)
-  {
-    case Remote::DF_UP:
-    case Remote::UP:
-    {
-      if (selectedOption > 0)
-      {
-        if (selectedOption < numOptions) optionBoxes[selectedOption].setActive(0);
-        --selectedOption;
-        optionBoxes[selectedOption].setActive(1);
-        draw();
-        viewman->updateView(this);
-      }
-      else
-      {
-        if (selectedOption < numOptions) optionBoxes[selectedOption].setActive(0);
-        selectedOption = numOptions;
-        return 0; //Control to tab view
-      }
-      return 2;
-    }
-    case Remote::DF_DOWN:
-    case Remote::DOWN:
-    {
-      if (selectedOption < (numOptions - 1))
-      {
-        if (selectedOption < numOptions) optionBoxes[selectedOption].setActive(0);
-        ++selectedOption;
-        optionBoxes[selectedOption].setActive(1);
-        draw();
-        viewman->updateView(this);
-      }
-      else if (selectedOption == numOptions)
-      {
-        selectedOption = 0;
-        optionBoxes[selectedOption].setActive(1);
-        draw();
-        viewman->updateView(this);
-      }
-      return 2;
-    }
-    case Remote::DF_LEFT:
-    case Remote::LEFT:
-    {
-      if (selectedOption == numOptions) return 2;
-      optionBoxes[selectedOption].left();
-      draw();
-      viewman->updateView(this);
-      return 2;
-    }
-    case Remote::DF_RIGHT:
-    case Remote::RIGHT:
-    {
-      if (selectedOption == numOptions) return 2;
-      optionBoxes[selectedOption].right();
-      draw();
-      viewman->updateView(this);
-      return 2;
-    }
-    case Remote::BACK:
-    {
-      doSave();
-
-      // Instead of returning 4 here which would delete this view
-      // before the doSave message is processed, let the message queue
-      // do the doSave then this close message. That will make the options menu
-      // disappear before this view
-
-      Message* m = new Message();
-      m->message = Message::CLOSE_ME;
-      m->from = this;
-      m->to = viewman;
-      Command::getInstance()->postMessageNoLock(m);
-
-      return 2;
-    }
-    case Remote::OK:
-    {
-      if (selectedOption == numOptions) return 2;
-      optionBoxes[selectedOption].cycle();
-      draw();
-      viewman->updateView(this);
-    }
-  }
-
-  return 1;
-}
-
-void VOptions::doSave()
-{
-  UINT i;
-  int* result = new int[numOptions];
-
-  for (i = 0; i < numOptions; i++)
-  {
-    result[i] = optionBoxes[i].getSelectedIndex();
-
-    if (result[i] != optionsAtStart[i])
-    {
-      Log::getInstance()->log("Options", Log::DEBUG, "Option %i has changed", i);
-
-      if (optionData[i].optionType == OPTIONTYPE_TEXT)
-      {
-        vdr->configSave(optionData[i].configSection, optionData[i].configParam,
-          optionData[i].options[result[i]]);
-      }
-      else
-      {
-        char buffer[20];
-        sprintf(buffer, "%i", result[i]);
-        vdr->configSave(optionData[i].configSection, optionData[i].configParam,
-          buffer);
-      }
-    }
-  }
-
-  // Save a vector of option IDs that have changed
-
-  map<int, int>* optionChanges = new map<int, int>;
-
-  for (i = 0; i < numOptions; i++)
-  {
-    if (result[i] != optionsAtStart[i])
-    {
-      (*optionChanges)[optionData[i].id] = result[i];
-    }
-  }
-
-  delete[] result;
-
-  // Send it to parent for changes to be applied
-  Message* m = new Message();
-  m->message = Message::CHANGED_OPTIONS;
-  m->to = parent;
-  m->parameter = (ULONG)optionChanges;
-  Command::getInstance()->postMessageNoLock(m);
-}
-
-void VOptions::processMessage(Message* m)
-{
-  if (m->message == Message::MOUSE_MOVE)
-  {
-    int x=(m->parameter>>16)-getScreenX();
-    int y=(m->parameter&0xFFFF)-getScreenY();
-    UINT i;
-    for (i = 0; i < numOptions; i++)
-    {
-      if (optionBoxes[i].mouseMove(x,y))
-      {
-        if (selectedOption != numOptions) optionBoxes[selectedOption].setActive(0);
-        optionBoxes[i].setActive(1);
-        selectedOption=i;
-        draw();
-        viewman->updateView(this);
-        break;
-      }
-    }
-  }
-  else if (m->message == Message::MOUSE_LBDOWN)
-  {
-    int x=(m->parameter>>16)-getScreenX();
-    int y=(m->parameter&0xFFFF)-getScreenY();
-    UINT i;
-    bool butpress=false;
-    for (i = 0; i < numOptions; i++)
-    {
-      if (optionBoxes[i].mouseLBDOWN(x,y))
-      {
-        ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
-        butpress=true;
-        break;
-      }
-    }
-    if (!butpress)
-    {
-      //check if press is outside this view! then simulate cancel
-      if (x<0 || y <0 || x>getWidth() || y>getHeight())
-      {
-        ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
-      }
-    }
-  }
-}
diff --git a/voptions.h b/voptions.h
deleted file mode 100644 (file)
index ea6684e..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-    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 <map>
-#include "defines.h"
-#include "view.h"
-#include "viewman.h"
-#include "vdr.h"
-#include "colour.h"
-#include "video.h"
-#include "woptionbox.h"
-#include "wsymbol.h"
-#include "i18n.h"
-#include "command.h"
-
-typedef struct
-{
-  UINT id;               // Used for working out what has changed at the end
-  char *title;           // Name of the option
-  char *configSection;   // Which section of the config file
-  char *configParam;     // Parameter name in the config file
-  UINT optionType;       // 1 for text, 2 for int
-  UINT optionCount;      // How many choices?
-  UINT defaultOption;    // Serial of the default choice (base 0), or actual option in int mode
-  int startInt;          // Starting int for int mode
-  const char * const * options;  // Text for the options (null for int mode)
-} OPTIONDATA;
-
-class VOptions : public View
-{
-  public:
-    VOptions(void* tparent, const char* title, const OPTIONDATA* toptionData, const int tnumOptions);
-    ~VOptions();
-
-    int handleCommand(int command);
-    void processMessage(Message* m);
-    void draw();
-
-  private:
-    void doSave();
-
-    const OPTIONDATA* optionData;
-    UINT numOptions;
-    UINT selectedOption;
-    WOptionBox* optionBoxes;
-    VDR* vdr;
-    int* optionsAtStart;
-    void* parent;
-};
-
-#endif
-
diff --git a/voptionsmenu.cc b/voptionsmenu.cc
deleted file mode 100644 (file)
index ee7ef78..0000000
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
-    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 "voptionsmenu.h"
-
-VOptionsMenu::VOptionsMenu()
-{
-  viewman = ViewMan::getInstance();
-
-  setBackgroundColour(Colour::VIEWBACKGROUND);
-  setTitleBarOn(1);
-  setTitleBarColour(Colour::TITLEBARBACKGROUND);
-  setTitleText(tr("Options"));
-
-//  int fontHeight = surface->getFontHeight();
-
-  doGeneral();
-  doRemoteConfig();
-  doTimers();
-  doAdvanced();
-
-  create();
-  draw();
-}
-
-VOptionsMenu::~VOptionsMenu()
-{
-}
-
-void VOptionsMenu::draw()
-{
-  VTabsViewMan::draw();
-}
-
-int VOptionsMenu::handleCommand(int command)
-{
-  return VTabsViewMan::handleCommand(command);
-}
-
-void VOptionsMenu::processMessage(Message* m)
-{
-  if (m->message == Message::CHANGED_OPTIONS)
-  {
-    doApplyChanges((map<int,int>*)m->parameter);
-    //viewman->removeView(this);
-
-    if (!VDR::getInstance()->isConnected()) Command::getInstance()->connectionLost();
-  }
-  else if (m->message == Message::CHANGED_REMOTECONTROL)
-  {
-    char* remote = Remote::getInstance()->SaveKeysConfig(); //FIXME
-    VDR::getInstance()->configSave("General","Remote keys",remote);
-    delete[] remote;
-  }
-  else
-  {
-    VTabsViewMan::processMessage(m);
-  }
-}
-
-void VOptionsMenu::doApplyChanges(map<int,int>* changedOptions)
-{
-  Video* video = Video::getInstance();
-  map<int,int>::iterator i;
-
-  for(i = changedOptions->begin(); i != changedOptions->end(); i++)
-  {
-//    printf("I FIRST = %i SECOND = %i\n", i->first, i->second);
-
-    switch(i->first)
-    {
-      case 1:
-      {
-        if (i->second == 1)
-        {
-          Log::getInstance()->log("Options", Log::DEBUG, "Setting New Remote");
-          Remote::getInstance()->setRemoteType(Remote::NEWREMOTE);
-        }
-        else
-        {
-          Log::getInstance()->log("Options", Log::DEBUG, "Setting Old Remote");
-          Remote::getInstance()->setRemoteType(Remote::OLDREMOTE);
-        }
-        break;
-      }
-      case 2:
-      {
-        Message* m = new Message();
-        m->message = Message::CHANGE_LANGUAGE;
-        m->to = Command::getInstance();
-        Command::getInstance()->postMessageNoLock(m);
-        break;
-      }
-      case 3:
-      {
-        if (i->second == 1)
-        {
-          Log::getInstance()->log("Options", Log::DEBUG, "Setting S-Video");
-          video->setConnection(Video::SVIDEO);
-        }
-        else
-        {
-          Log::getInstance()->log("Options", Log::DEBUG, "Setting RGB/Composite");
-          video->setConnection(Video::COMPOSITERGB);
-        }
-        break;
-      }
-      case 4:
-      {
-        if (i->second == 1)
-        {
-          Log::getInstance()->log("Options", Log::DEBUG, "Setting 16:9 TV");
-          video->setTVsize(Video::ASPECT16X9);
-        }
-        else
-        {
-          Log::getInstance()->log("Options", Log::DEBUG, "Setting 4:3 TV");
-          video->setTVsize(Video::ASPECT4X3);
-        }
-        break;
-      }
-      case 5:
-      {
-        if (i->second == 1)
-        {
-          Log::getInstance()->log("Options", Log::DEBUG, "Setting letterbox");
-          video->setMode(Video::LETTERBOX);
-        }
-        else
-        {
-          Log::getInstance()->log("Options", Log::DEBUG, "Setting chop-sides");
-          video->setMode(Video::NORMAL);
-        }
-        break;
-      }
-      case 13:
-      {
-        size_t newTCPsize = 2048;
-
-        if (i->second == 0) newTCPsize = 1024;
-        else if (i->second == 1) newTCPsize = 2048;
-        else if (i->second == 2) newTCPsize = 4096;
-        else if (i->second == 3) newTCPsize = 8192;
-        else if (i->second == 4) newTCPsize = 16384;
-        else if (i->second == 5) newTCPsize = 32768;
-        else if (i->second == 6) newTCPsize = 65536;
-
-        Log::getInstance()->log("Options", Log::DEBUG, "Setting TCP window size %i", newTCPsize);
-        VDR::getInstance()->setReceiveWindow(newTCPsize);
-        break;
-      }
-    }
-  }
-
-  delete changedOptions;
-
-}
-
-void VOptionsMenu::doGeneral()
-{
-  static const int numOptions = 8;
-
-  static const char* options1[] = {"Old", "New"};
-  static const char* options3[] = {"RGB+composite", "S-Video"};
-  static const char* options4[] = {"4:3", "16:9"};
-  static const char* options5[] = {"Chop sides", "Letterbox"};
-  static const char* options6[] = {"On", "Off", "Last state"};
-  static const char* options7[] = {"All", "FTA only"};
-  static const char* options15[] = {"Alphabetical", "Chronological"};
-
-  const static OPTIONDATA optionData[numOptions] =
-  {
-    {1, "Remote control type",      "General", "Remote type",      OPTIONTYPE_TEXT, 2, 0, 0, options1 },
-    {2, "Language",                 "General", "Language",         OPTIONTYPE_TEXT, I18n::NumLanguages, 0, 0, I18n::Languages },
-    {3, "TV connection type",       "TV",      "Connection",       OPTIONTYPE_TEXT, 2, 0, 0, options3 },
-    {4, "TV aspect ratio",          "TV",      "Aspect",           OPTIONTYPE_TEXT, 2, 0, 0, options4 },
-    {5, "16:9 on 4:3 display mode", "TV",      "Widemode",         OPTIONTYPE_TEXT, 2, 0, 0, options5 },
-    {6, "Power state after bootup", "General", "Power After Boot", OPTIONTYPE_TEXT, 3, 0, 0, options6 },
-    {7, "Display channels",         "General", "Channels",         OPTIONTYPE_TEXT, 2, 0, 0, options7 },
-    {15, "Recordings sort order",   "General", "Recordings Sort Order", OPTIONTYPE_TEXT, 2, 0, 0, options15 },
-  };
-
-  // As all the above data is const static, it can be sent to the new View, this stack frame can
-  // quit and the pointers will all still be valid. I think. (Hope).
-
-  VOptions* v = new VOptions(this, tr("General"), optionData, numOptions);
-  v->draw();
-  add(v);
-  //viewman->updateView(v);
-}
-
-void VOptionsMenu::doRemoteConfig()
-{
-  VRemoteConfig* v = new VRemoteConfig(this);
-  v->draw();
-  add(v);
-}
-
-void VOptionsMenu::doTimers()
-{
-  static const int numOptions = 4;
-
-  const static OPTIONDATA optionData[numOptions] =
-  {
-    {9, "Default start margin (minutes)",  "Timers", "Start margin",  OPTIONTYPE_INT, 20, 5, 0, NULL },
-    {10, "Default end margin (minutes)",   "Timers", "End margin",    OPTIONTYPE_INT, 20, 5, 0, NULL },
-    {11, "Default priority",               "Timers", "Priority",      OPTIONTYPE_INT, 100, 99, 0, NULL },
-    {12, "Default lifetime",               "Timers", "Lifetime",      OPTIONTYPE_INT, 100, 99, 0, NULL },
-  };
-
-  // As all the above data is const static, it can be sent to the new View, this stack frame can
-  // quit and the pointers will all still be valid. I think. (Hope).
-
-  VOptions* v = new VOptions(this, tr("Timers"), optionData, numOptions);
-  v->draw();
-  add(v);
-  //viewman->updateView(v);
-}
-
-void VOptionsMenu::doAdvanced()
-{
-  static const int numOptions = 3;
-
-  static const char* options13[] = {"1024", "2048", "4096", "8192", "16384", "32768", "65536"};
-  static const char* options14[] = {"No", "Yes"};
-
-  const static OPTIONDATA optionData[numOptions] =
-  {
-    {8, "VDR-Pri 0=OK !See forums!",  "General",  "Live priority",      OPTIONTYPE_INT,  100, 0, 0, NULL },
-    {13, "TCP receive window size",   "Advanced", "TCP receive window", OPTIONTYPE_TEXT, 7, 1, 0, options13 },
-    {14, "Use WSS (PAL only)",        "General",  "WSS",                OPTIONTYPE_TEXT, 2, 0, 0, options14 }
-  };
-
-  // As all the above data is const static, it can be sent to the new View, this stack frame can
-  // quit and the pointers will all still be valid. I think. (Hope).
-
-  VOptions* v = new VOptions(this, tr("Advanced"), optionData, numOptions);
-  v->draw();
-  add(v);
-  //viewman->updateView(v);
-}
diff --git a/voptionsmenu.h b/voptionsmenu.h
deleted file mode 100644 (file)
index 9f07582..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-    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 VOPTIONSMENU_H
-#define VOPTIONSMENU_H
-
-#include <vector>
-#include <map>
-#include "view.h"
-#include "remote.h"
-#include "viewman.h"
-#include "vdr.h"
-#include "colour.h"
-#include "video.h"
-#include "wbutton.h"
-#include "i18n.h"
-#include "voptions.h"
-#include "vremoteconfig.h"
-#include "vtabsviewman.h"
-
-class VOptionsMenu : public VTabsViewMan
-{
-  public:
-    VOptionsMenu();
-    ~VOptionsMenu();
-
-    int handleCommand(int command);
-    void processMessage(Message* m);
-    void draw();
-
-  private:
-    void doGeneral();
-    void doTimers();
-    void doAdvanced();
-    void doRemoteConfig();
-    void doApplyChanges(map<int,int>* changedOptions);
-
-    vector<WButton*> buttons;
-    vector<WButton*>::iterator selectedButton;
-};
-
-#endif
diff --git a/vopts.cc b/vopts.cc
new file mode 100644 (file)
index 0000000..76a237c
--- /dev/null
+++ b/vopts.cc
@@ -0,0 +1,293 @@
+/*
+    Copyright 2007 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 "vopts.h"
+
+#include "colour.h"
+#include "video.h"
+#include "i18n.h"
+#include "remote.h"
+#include "boxstack.h"
+#include "woptionpane.h"
+#include "wremoteconfig.h"
+#include "log.h"
+#include "option.h"
+#include "vdr.h"
+#include "command.h"
+
+//#include "vdr.h"
+//#include "command.h"
+
+VOpts::VOpts()
+{
+  setTitleBarOn(1);
+  setTitleBarColour(Colour::TITLEBARBACKGROUND);
+  setTitleText(tr("Options"));
+
+  setSize(520, 360);
+  createBuffer();
+  if (Video::getInstance()->getFormat() == Video::PAL)
+    setPosition(100, 110);
+  else
+    setPosition(90, 90);
+  
+  tabbar.setPosition(6, 32);
+  tabbar.setSize(getWidth() - 12, getHeight() - 34);
+  add(&tabbar);
+  
+  Option* option;
+  WOptionPane* wop;
+  
+  //  --- edit options start here
+  
+  static const char* options1[] = {"Old", "New"};
+  static const char* options3[] = {"RGB+composite", "S-Video"};
+  static const char* options4[] = {"4:3", "16:9"};
+  static const char* options5[] = {"Chop sides", "Letterbox"};
+  static const char* options6[] = {"On", "Off", "Last state"};
+  static const char* options7[] = {"All", "FTA only"};
+  static const char* options15[] = {"Alphabetical", "Chronological"};
+
+  static const char* options13[] = {"1024", "2048", "4096", "8192", "16384", "32768", "65536"};
+  static const char* options14[] = {"No", "Yes"};
+
+  numPanes = 4;
+  panes = new Boxx*[numPanes];
+  wop = new WOptionPane(); 
+  tabbar.addTab(tr("General"), wop);
+  panes[0] = wop;
+  
+  option = new Option(1, "Remote control type",      "General", "Remote type",           Option::TYPE_TEXT, 2, 0, 0, options1);
+  options.push_back(option);
+  wop->addOptionLine(option);
+  option = new Option(2, "Language",                 "General", "Language",              Option::TYPE_TEXT, I18n::NumLanguages, 0, 0, I18n::Languages);
+  options.push_back(option);
+  wop->addOptionLine(option);
+  option = new Option(3, "TV connection type",       "TV",      "Connection",            Option::TYPE_TEXT, 2, 0, 0, options3);
+  options.push_back(option);
+  wop->addOptionLine(option);
+  option = new Option(4, "TV aspect ratio",          "TV",      "Aspect",                Option::TYPE_TEXT, 2, 0, 0, options4);
+  options.push_back(option);
+  wop->addOptionLine(option);
+  option = new Option(5, "16:9 on 4:3 display mode", "TV",      "Widemode",              Option::TYPE_TEXT, 2, 0, 0, options5);
+  options.push_back(option);
+  wop->addOptionLine(option);
+  option = new Option(6, "Power state after bootup", "General", "Power After Boot",      Option::TYPE_TEXT, 3, 0, 0, options6);
+  options.push_back(option);
+  wop->addOptionLine(option);
+  option = new Option(7, "Display channels",         "General", "Channels",              Option::TYPE_TEXT, 2, 0, 0, options7);
+  options.push_back(option);
+  wop->addOptionLine(option);
+  option = new Option(15, "Recordings sort order",   "General", "Recordings Sort Order", Option::TYPE_TEXT, 2, 0, 0, options15);
+  options.push_back(option);
+  wop->addOptionLine(option);
+  
+    
+  WRemoteConfig* wrc = new WRemoteConfig();
+  tabbar.addTab(tr("Remote Control"), wrc);
+  panes[1] = wrc;
+  
+  
+  wop = new WOptionPane(); 
+  tabbar.addTab(tr("Timers"), wop);
+  panes[2] = wop;
+  
+  option = new Option(9, "Default start margin (minutes)",  "Timers", "Start margin",  Option::TYPE_INT, 20, 5, 0, NULL);
+  options.push_back(option);
+  wop->addOptionLine(option);
+  option = new Option(10, "Default end margin (minutes)",   "Timers", "End margin",    Option::TYPE_INT, 20, 5, 0, NULL);
+  options.push_back(option);
+  wop->addOptionLine(option);
+  option = new Option(11, "Default priority",               "Timers", "Priority",      Option::TYPE_INT, 100, 99, 0, NULL);
+  options.push_back(option);
+  wop->addOptionLine(option);
+  option = new Option(12, "Default lifetime",               "Timers", "Lifetime",      Option::TYPE_INT, 100, 99, 0, NULL);
+  options.push_back(option);
+  wop->addOptionLine(option);
+
+    
+  wop = new WOptionPane(); 
+  tabbar.addTab(tr("Advanced"), wop);
+  panes[3] = wop;
+  
+  option = new Option(8, "VDR-Pri 0=OK !See forums!",  "General",  "Live priority",      Option::TYPE_INT,  100, 0, 0, NULL);
+  options.push_back(option);
+  wop->addOptionLine(option);
+  option = new Option(13, "TCP receive window size",   "Advanced", "TCP receive window", Option::TYPE_TEXT, 7, 1, 0, options13);
+  options.push_back(option);
+  wop->addOptionLine(option);
+  option = new Option(14, "Use WSS (PAL only)",        "General",  "WSS",                Option::TYPE_TEXT, 2, 0, 0, options14);
+  options.push_back(option);
+  wop->addOptionLine(option);  
+}
+
+VOpts::~VOpts()
+{
+  for (int i = 0; i < numPanes; i++) delete panes[i];
+  delete[] panes;
+
+  for(vector<Option*>::iterator j = options.begin(); j != options.end(); j++) delete *j;
+}
+
+int VOpts::handleCommand(int command)
+{
+  // either is active, handle back
+  if (command == Remote::BACK)
+  {
+    doSave();
+    return 4;
+  }
+  else
+  {
+    int retval = tabbar.handleCommand(command);
+    if (retval == 1)
+    {
+      BoxStack::getInstance()->update(this);
+      return 2;
+    }
+    else
+    {
+      return 1; // ???
+    }
+  }
+}
+
+void VOpts::doSave()
+{
+  VDR* vdr = VDR::getInstance();
+
+  // Damn, and the dynamic idea was going *so* well...
+  WOptionPane* wop;
+  wop = (WOptionPane*)panes[0];
+  wop->saveOpts();  
+  wop = (WOptionPane*)panes[2];
+  wop->saveOpts();  
+  wop = (WOptionPane*)panes[3];
+  wop->saveOpts();  
+
+
+  for (UINT i = 0; i < options.size(); i++)
+  {
+    if (options[i]->configChoice == options[i]->userSetChoice) continue; // no change
+
+    Log::getInstance()->log("Options", Log::DEBUG, "Option %i has changed", i);
+
+    // Save to vdr
+
+    if (options[i]->optionType == Option::TYPE_TEXT)
+    {
+      vdr->configSave(options[i]->configSection, options[i]->configKey, options[i]->options[options[i]->userSetChoice]);
+    }
+    else
+    {
+      char buffer[20];
+      sprintf(buffer, "%i", options[i]->userSetChoice);
+      vdr->configSave(options[i]->configSection, options[i]->configKey, buffer);
+    }
+    
+    // Set new setting
+    
+    switch(options[i]->id)
+    {
+      case 1:
+      {
+        if (options[i]->userSetChoice == 1)
+        {
+          Log::getInstance()->log("Options", Log::DEBUG, "Setting New Remote");
+          Remote::getInstance()->setRemoteType(Remote::NEWREMOTE);
+        }
+        else
+        {
+          Log::getInstance()->log("Options", Log::DEBUG, "Setting Old Remote");
+          Remote::getInstance()->setRemoteType(Remote::OLDREMOTE);
+        }
+        break;
+      }
+      case 2:
+      {
+        Message* m = new Message();
+        m->message = Message::CHANGE_LANGUAGE;
+        m->to = Command::getInstance();
+        Command::getInstance()->postMessageNoLock(m);
+        break;
+      }
+      case 3:
+      {
+        if (options[i]->userSetChoice == 1)
+        {
+          Log::getInstance()->log("Options", Log::DEBUG, "Setting S-Video");
+          Video::getInstance()->setConnection(Video::SVIDEO);
+        }
+        else
+        {
+          Log::getInstance()->log("Options", Log::DEBUG, "Setting RGB/Composite");
+          Video::getInstance()->setConnection(Video::COMPOSITERGB);
+        }
+        break;
+      }
+      case 4:
+      {
+        if (options[i]->userSetChoice == 1)
+        {
+          Log::getInstance()->log("Options", Log::DEBUG, "Setting 16:9 TV");
+          Video::getInstance()->setTVsize(Video::ASPECT16X9);
+        }
+        else
+        {
+          Log::getInstance()->log("Options", Log::DEBUG, "Setting 4:3 TV");
+          Video::getInstance()->setTVsize(Video::ASPECT4X3);
+        }
+        break;
+      }
+      case 5:
+      {
+        if (options[i]->userSetChoice == 1)
+        {
+          Log::getInstance()->log("Options", Log::DEBUG, "Setting letterbox");
+          Video::getInstance()->setMode(Video::LETTERBOX);
+        }
+        else
+        {
+          Log::getInstance()->log("Options", Log::DEBUG, "Setting chop-sides");
+          Video::getInstance()->setMode(Video::NORMAL);
+        }
+        break;
+      }
+      case 13:
+      {
+        size_t newTCPsize = 2048;
+
+        if (options[i]->userSetChoice == 0) newTCPsize = 1024;
+        else if (options[i]->userSetChoice == 1) newTCPsize = 2048;
+        else if (options[i]->userSetChoice == 2) newTCPsize = 4096;
+        else if (options[i]->userSetChoice == 3) newTCPsize = 8192;
+        else if (options[i]->userSetChoice == 4) newTCPsize = 16384;
+        else if (options[i]->userSetChoice == 5) newTCPsize = 32768;
+        else if (options[i]->userSetChoice == 6) newTCPsize = 65536;
+
+        Log::getInstance()->log("Options", Log::DEBUG, "Setting TCP window size %i", newTCPsize);
+        VDR::getInstance()->setReceiveWindow(newTCPsize);
+        break;
+      }
+    }
+  }
+}
+
diff --git a/vopts.h b/vopts.h
new file mode 100644 (file)
index 0000000..e9cfaef
--- /dev/null
+++ b/vopts.h
@@ -0,0 +1,53 @@
+/*
+    Copyright 2007 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 VOPTS_H
+#define VOPTS_H
+
+#include <vector>
+#include "tbboxx.h"
+#include "defines.h"
+#include "wtabbar.h"
+
+class Boxx;
+class Option;
+
+class VOpts : public TBBoxx
+{
+  public:
+    VOpts();
+    ~VOpts();
+    
+    int handleCommand(int command);    
+    
+  private:
+    void doSave();
+  
+    WTabBar tabbar;  
+    
+    int numPanes;
+    Boxx** panes;
+    
+    vector<Option*> options;    
+
+};
+
+#endif
+
index 139d5873e8ca06bcc9dea2f767a09e48634e1dad..25badaa18dfac116d9e16de2a5112aff2eb5dd06 100644 (file)
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
+#include <time.h>
+
 #include "vpicture.h"
+
 #include "vpicturebanner.h"
-#include <time.h>
+#include "timers.h"
+#include "boxx.h"
+#include "wselectlist.h"
+#include "remote.h"
+#include "wsymbol.h"
+#include "boxstack.h"
+#include "vdr.h"
+#include "media.h"
+#include "vvideolive.h"
+#include "video.h"
+#include "vinfo.h"
+#include "i18n.h"
+#include "message.h"
+#include "command.h"
 
 Colour VPicture::pictureBack=Colour(140,140,140);
 Colour VPicture::infoBack=Colour(110,110,110);
@@ -56,7 +72,8 @@ VPicture::VPicture(VMediaList *p)
   reader=new VPreader(this);
   needDraw=false;
   Video* video = Video::getInstance();
-  create(video->getScreenWidth(), video->getScreenHeight());
+  setSize(video->getScreenWidth(), video->getScreenHeight());
+  createBuffer();
   jpeg.setSurface(surface);
        jpeg.setDimensions(area.w,area.h);
   banner=NULL;
@@ -71,12 +88,13 @@ VPicture::VPicture(VMediaList *p)
   rotate=0;
   info=NULL;
   jpeg.setBackgroundColour(pictureBack);
+  add(&jpeg);
 }
 
 VPicture::~VPicture()
 {
   delete reader;
-  if (banner) ViewMan::getInstance()->removeView(banner);
+  if (banner) BoxStack::getInstance()->remove(banner);
   if (fullname) delete fullname;
   if (filename) delete filename;
   Timers::getInstance()->cancelTimer(this,1);
@@ -90,7 +108,7 @@ void VPicture::draw()
 {
   Log::getInstance()->log("VPicture::draw", Log::DEBUG, "needDraw=%d,p=%p",
        needDraw,this);
-  View::draw();
+//  View::draw();
   if (mediaError) {
     drawText(mediaError,20,area.h-10,Colour::LIGHTTEXT);
     return;
@@ -111,7 +129,7 @@ int VPicture::handleCommand(int command)
     case Remote::UP:
     case Remote::SKIPBACK:
       showPicture(VMediaList::MV_PREV);
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       rt= 2;
       break;
     case Remote::FORWARD:
@@ -122,7 +140,7 @@ int VPicture::handleCommand(int command)
     case Remote::DOWN:
     case Remote::SKIPFORWARD:
       showPicture(VMediaList::MV_NEXT);
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       rt= 2;
       break;
     case Remote::REVERSE:
@@ -143,7 +161,7 @@ int VPicture::handleCommand(int command)
     {
       slideshow=true;
       showPicture(VMediaList::MV_NEXT);
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       rt= 2;
     }
     break;
@@ -174,7 +192,7 @@ int VPicture::handleCommand(int command)
           break;
         }
       showPicture(VMediaList::MV_NONE,rotate);
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       rt=2;
       break;
     case Remote::GREEN:
@@ -205,9 +223,9 @@ void VPicture::processMessage(Message* m)
     //check if press is outside this view! then simulate cancel
     int x=(m->parameter>>16)-getScreenX();
     int y=(m->parameter&0xFFFF)-getScreenY();
-    if (x<0 || y <0 || x>getWidth() || y>getHeight())
+    if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
     {
-      ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+      BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
     }
   }
 }
@@ -216,12 +234,12 @@ VPicture * VPicture::createViewer(VMediaList * mparent, bool bslideshow) {
    Log::getInstance()->log("VPicture::createViewer", Log::DEBUG, "p=%p",
        mparent);
    VPicture *vmn=new VPicture(mparent);
-   ViewMan::getInstance()->add(vmn);
-   ViewMan::getInstance()->updateView(vmn);
+   BoxStack::getInstance()->add(vmn);
+   BoxStack::getInstance()->update(vmn);
    vmn->showPicture();
    if (bslideshow) vmn->startSlideshow();
    vmn->showBanner();
-   ViewMan::getInstance()->updateView(vmn);
+   BoxStack::getInstance()->update(vmn);
    return vmn;
 }
 
@@ -236,7 +254,7 @@ void VPicture::showPicture(ULONG move, int rt) {
   load(currentMedia);
   if (mediaError || jpeg.hasError()) destroyInfo();
   else updateInfo();
-  ViewMan::getInstance()->updateView(this);
+  BoxStack::getInstance()->update(this);
 }
 
 
@@ -296,7 +314,7 @@ void VPicture::showBanner(bool loading,int shortDisplay) {
     }
   if (banner) destroyBanner(!loading);
   banner= new VPictureBanner(this, loading, slideshow);
-  banner->setBackgroundColour(infoBack);
+  banner->fillColour(infoBack);
   if (! loading) {
     int len=strlen(filename)+Media::TIMEBUFLEN+20;
     char buf[len];
@@ -317,10 +335,10 @@ void VPicture::showBanner(bool loading,int shortDisplay) {
   if (! slideshow && shortDisplay == 0) shortDisplay=8;
   //OK we start timer if we don't load and either shortDisplay or no slideshow
   if (! loading && shortDisplay != 0)   Timers::getInstance()->setTimerD(this,2,shortDisplay);
-  if (! loading) sendViewMsg(banner,false);
+  if (! loading) ;  /*sendViewMsg(banner,false); upgrade to boxx */
        else {
-               ViewMan::getInstance()->add(banner);
-               ViewMan::getInstance()->updateView(banner);
+               BoxStack::getInstance()->add(banner);
+               BoxStack::getInstance()->update(banner);
        }
 
   }
@@ -328,8 +346,8 @@ void VPicture::showBanner(bool loading,int shortDisplay) {
 void VPicture::destroyBanner(bool fromTimer) {
   shortBanner=false;
   if (banner) {
-    if (fromTimer) sendViewMsg(banner,true);
-               else ViewMan::getInstance()->removeView(banner);
+    if (fromTimer) ;/* sendViewMsg(banner,true); upgrade to boxx*/
+               else BoxStack::getInstance()->remove(banner);
     banner=NULL;
     if (! fromTimer) Timers::getInstance()->cancelTimer(this,2);
     }
@@ -364,17 +382,19 @@ void VPicture::timercall(int clientref) {
 void VPicture::showInfo(){
   if (info) destroyInfo();
   if (! currentMedia) return;
+
   info=new VInfo();
   info->setTitleText(currentMedia->getFileName());
   info->setDropThrough();
-  info->create(500, 300);
+  info->setSize(500, 300);
+  info->createBuffer();
   info->setBorderOn(1);
   info->setTitleBarOn(1);
 
   if (Video::getInstance()->getFormat() == Video::PAL)
-       info->setScreenPos(100, 180);
+       info->setPosition(100, 180);
   else
-       info->setScreenPos(100, 150);
+       info->setPosition(100, 150);
   char buf[INFOBUF];
   char tbuf[Media::TIMEBUFLEN];
   snprintf(buf,INFOBUF,"%s= %s\n%s= %ld x %ld\n%s= %ld kBytes\n%s= %s\n%s= %ld\n%s= 1/%ld",
@@ -402,10 +422,10 @@ void VPicture::destroyInfo(bool fromTimer){
   if (! fromTimer) Timers::getInstance()->cancelTimer(this,3);
 }
 
-void VPicture::sendViewMsg(View *v,bool vdestroy) {
+void VPicture::sendViewMsg(Boxx *v,bool vdestroy) {
        Message* m = new Message(); 
   m->message = vdestroy?Message::CLOSE_ME:Message::ADD_VIEW;
-  m->to = ViewMan::getInstance();
+  m->to = BoxStack::getInstance();
   m->from = v;
        m->parameter=(ULONG)v;
   Command::getInstance()->postMessageFromOuterSpace(m);
index 3c8eaa0a75d8f66108264ea986c0c3a3b44c050f..df997d28a980b7ee4523698837a1bcee31e3f9e0 100644 (file)
 #include <string.h>
 #include <vector>
 
-#include "view.h"
-#include "wselectlist.h"
-#include "remote.h"
-#include "wsymbol.h"
-#include "viewman.h"
-#include "vdr.h"
-#include "media.h"
-#include "vvideolive.h"
-#include "colour.h"
-#include "video.h"
-#include "vinfo.h"
-#include "i18n.h"
+#include "boxx.h"
+#include "timerreceiver.h"
 #include "vmedialist.h"
+#include "colour.h"
 #include "wjpeg.h"
 
+class Message;
+class VInfo;
+
 /**
   * the picture viewer
   * will ineract with the parent List for ff,back, slide show...
@@ -47,7 +41,7 @@
 */
 class VPictureBanner;
 
-class VPicture : public View,public TimerReceiver
+class VPicture : public Boxx, public TimerReceiver
 {
   public:
     ~VPicture();
@@ -76,7 +70,7 @@ class VPicture : public View,public TimerReceiver
     void updateInfo();
     void destroyInfo(bool fromTimer=false);
                //add or destroy a view (banner, info)
-               void sendViewMsg(View *v,bool destroy=false);
+               void sendViewMsg(Boxx *v,bool destroy=false);
                //send command in main thread
                void sendCommandMsg(int command);
     VMediaList   *parent;
@@ -90,7 +84,7 @@ class VPicture : public View,public TimerReceiver
     ULONG ftime;
     bool slideshow;
     int showtime;
-    char * mediaError;
+    const char * mediaError;
     Media * currentMedia;
     const static int INITIAL_SHOWTIME=5;
     bool shortBanner;
index 13abc08836727316805ad7f1fb4e5159a220eddf..85c4015208fc368d66d703ff0dd9ea594eddbc60 100644 (file)
 */
 
 #include "vpicturebanner.h"
-#include "vpicture.h"
 
+#include "vpicture.h"
+#include "wsymbol.h"
+#include "remote.h"
+#include "colour.h"
+#include "video.h"
+#include "vinfo.h"
+#include "boxstack.h"
+#include "i18n.h"
 
 VPictureBanner::VPictureBanner(VPicture *p, bool ld, bool sl)
 {
@@ -28,9 +35,9 @@ VPictureBanner::VPictureBanner(VPicture *p, bool ld, bool sl)
   slideshow=sl;
   parent=p;
   Video *v=Video::getInstance();
-  create(v->getScreenWidth()-100, 36);
-  setScreenPos(50, v->getScreenHeight()-50);
-  setBackgroundColour(Colour::VIEWBACKGROUND);
+  setSize(v->getScreenWidth()-100, 36);
+  createBuffer();
+  setPosition(50, v->getScreenHeight()-50);
   setTitleBarOn(0);
   info=NULL;
   Log::getInstance()->log("VPictureBanner",Log::DEBUG,"created %p",this);
@@ -48,7 +55,7 @@ VPictureBanner::~VPictureBanner()
 
 void VPictureBanner::draw()
 {
-  View::draw();
+//  View::draw();
   if (loading) {
     if (info) {
       char buf[strlen(info)+100];
@@ -68,14 +75,14 @@ void VPictureBanner::draw()
     drawText(tr("info"), 5+18+3+rotsize+3+18+3, area.h - 25, Colour::LIGHTTEXT);
     x+=infsize+3;
     WSymbol w;
-    w.setSurface(surface);
+    TEMPADD(&w);
     if (slideshow) {
       w.nextSymbol = WSymbol::PAUSE;
       }
     else {
       w.nextSymbol = WSymbol::PLAY;
     }
-    w.setSurfaceOffset(x, area.h-24);
+    w.setPosition(x, area.h-24);
     w.draw();
     x+=20+3;
     if (info) {
@@ -96,27 +103,27 @@ void VPictureBanner::processMessage(Message* m)
 {
   if (m->message == Message::MOUSE_MOVE)
   {
-    ;
+    
   }
   else if (m->message == Message::MOUSE_LBDOWN)
   {
     //check if press is outside this view! then simulate cancel
     int x=(m->parameter>>16)-getScreenX();
     int y=(m->parameter&0xFFFF)-getScreenY();
-    if (x<0 || y <0 || x>getWidth() || y>getHeight())
+    if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
     {
-      ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+      BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
     }
     else if (y>=(int)area.h-24 && y<=(int)area.h-6)
     {
       //y coordinate is right!
       if (x>=7 &&x<=25)
       {
-        ViewMan::getInstance()->handleCommand(Remote::RED); //simulate red press
+        BoxStack::getInstance()->handleCommand(Remote::RED); //simulate red press
       }
       else if (x>=110 &&x<=128)
       {
-        ViewMan::getInstance()->handleCommand(Remote::GREEN); //simulate red press
+        BoxStack::getInstance()->handleCommand(Remote::GREEN); //simulate red press
       }
     }
   }
index 49f5d1c77d20f19520ef6346b3fef08b5a8a4b72..f99b015c79ac726524d90d90ee44ec0662b43d93 100644 (file)
 #include <vector>
 #include <algorithm>
 
-#include "view.h"
-#include "remote.h"
-#include "colour.h"
-#include "video.h"
-#include "vinfo.h"
-#include "viewman.h"
-#include "i18n.h"
+#include "tbboxx.h"
 
 class VPicture;
 
-class VPictureBanner : public View
+class VPictureBanner : public TBBoxx
 {
   public:
     VPictureBanner(VPicture *p,bool loading, bool slideshow);
index 1cf63d60d0aecd505f5c330494005c3de9ac30a0..eafd74e14835ba45607eeac21bc7fbdc0650cafd 100644 (file)
 
 #include "vquestion.h"
 
+#include "remote.h"
+#include "boxstack.h"
+#include "colour.h"
+#include "i18n.h"
+#include "command.h"
+
 VQuestion::VQuestion(void* treplyTo)
 {
   replyTo = treplyTo;
   mainText = NULL;
   selectedOption = NO;
 
-  buttonYes.setSurfaceOffset(40, 130);
-  buttonNo.setSurfaceOffset(140, 130);
+  buttonYes.setPosition(40, 130);
+  buttonNo.setPosition(140, 130);
 
   buttonYes.setText(tr("Yes"));
   buttonNo.setText(tr("No"));
   buttonNo.setActive(1);
+  
+  add(&buttonYes);
+  add(&buttonNo);  
 }
 
 VQuestion::~VQuestion()
@@ -39,7 +48,7 @@ VQuestion::~VQuestion()
   if (mainText) delete[] mainText;
 }
 
-void VQuestion::setMainText(char* takeText)
+void VQuestion::setMainText(const char* takeText)
 {
   int length = strlen(takeText);
   mainText = new char[length + 1];
@@ -48,14 +57,9 @@ void VQuestion::setMainText(char* takeText)
 
 void VQuestion::draw()
 {
-  View::draw();
-
-  buttonYes.setSurface(surface);
-  buttonNo.setSurface(surface);
+  TBBoxx::draw();
 
   if (mainText) drawPara(mainText, 10, 45, Colour::LIGHTTEXT);
-  buttonYes.draw();
-  buttonNo.draw();
 }
 
 void VQuestion::swap()
@@ -83,7 +87,7 @@ int VQuestion::handleCommand(int command)
     {
       swap();
       draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       return 2;
     }
     case Remote::DF_RIGHT:
@@ -91,7 +95,7 @@ int VQuestion::handleCommand(int command)
     {
       swap();
       draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       return 2;
     }
     case Remote::BACK:
@@ -128,34 +132,34 @@ void VQuestion::processMessage(Message* m)
       buttonNo.setActive(0);
       selectedOption = YES;
       draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
     }
     else if (buttonNo.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
       buttonYes.setActive(0);
       selectedOption = NO;
       draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
     }
   }
   else if (m->message == Message::MOUSE_LBDOWN)
   {
     if (buttonYes.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
-      ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+      BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
     }
     else if (buttonNo.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
-      ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+      BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
     }
     else
     {
       //check if press is outside this view! then simulate cancel
       int x=(m->parameter>>16)-getScreenX();
       int y=(m->parameter&0xFFFF)-getScreenY();
-      if (x<0 || y <0 || x>getWidth() || y>getHeight())
+      if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
       {
-        ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+        BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
       }
     }
   }
index f50c9901a552489b0dc153baa3aa23d394431967..4dd01fa6cc193a65340b50bb6c92e0b41b4df551 100644 (file)
 #include <stdio.h>
 #include <string.h>
 
-#include "view.h"
+#include "tbboxx.h"
 #include "wbutton.h"
-#include "remote.h"
-#include "viewman.h"
-#include "colour.h"
-#include "i18n.h"
-#include "command.h"
 
-class VQuestion : public View
+class VQuestion : public TBBoxx
 {
   public:
     VQuestion(void* replyTo);
     ~VQuestion();
     void setDefault(UCHAR option);
-    void setMainText(char* title);
+    void setMainText(const char* title);
 
     int handleCommand(int command);
     void processMessage(Message* m);
index 55d73e22576ca4978d944d253c3ce0a56c250e60..0e18753cd273739639e0b57e46484d6bbfbf5fd7 100644 (file)
 
 #include "vradiorec.h"
 
+#include "command.h"
+#include "osd.h"
+#include "player.h"
+#include "wsymbol.h"
+#include "recording.h"
+#include "message.h"
+#include "vdr.h"
+#include "video.h"
+#include "timers.h"
+#include "playerradio.h"
+#include "boxstack.h"
+#include "remote.h"
+#include "vinfo.h"
+#include "i18n.h"
+
 VRadioRec::VRadioRec(Recording* rec)
 {
-  viewman = ViewMan::getInstance();
+  boxstack = BoxStack::getInstance();
   vdr = VDR::getInstance();
   video = Video::getInstance();
   timers = Timers::getInstance();
@@ -57,8 +72,9 @@ VRadioRec::VRadioRec(Recording* rec)
 
   Log::getInstance()->log("VRadioRec", Log::DEBUG, "SM: %u EM: %u", startMargin, endMargin);
 
-  create(video->getScreenWidth(), video->getScreenHeight());
-  setBackgroundColour(Colour::BLACK);
+  setSize(video->getScreenWidth(), video->getScreenHeight());
+  createBuffer();
+  setPosition(0, 0);
 
   barRegion.x = 0;
   barRegion.y = video->getScreenHeight() - 58;   // FIXME, need to be - 1? and below?
@@ -91,7 +107,7 @@ VRadioRec::~VRadioRec()
 
 void VRadioRec::draw()
 {
-  View::draw();
+  fillColour(Colour::BLACK);
 }
 
 void VRadioRec::go()
@@ -125,15 +141,16 @@ void VRadioRec::go()
     Message* m = new Message();
     m->message = Message::CLOSE_ME;
     m->from = this;
-    m->to = viewman;
+    m->to = boxstack;
     Command::getInstance()->postMessageNoLock(m);
 
     VInfo* vi = new VInfo();
-    vi->create(400, 150);
+    vi->setSize(400, 150);
+    vi->createBuffer();
     if (video->getFormat() == Video::PAL)
-      vi->setScreenPos(170, 200);
+      vi->setPosition(170, 200);
     else
-      vi->setScreenPos(160, 150);
+      vi->setPosition(160, 150);
     vi->setExitable();
     vi->setBorderOn(1);
     vi->setTitleBarOn(0);
@@ -142,7 +159,7 @@ void VRadioRec::go()
 
     m = new Message();
     m->message = Message::ADD_VIEW;
-    m->to = viewman;
+    m->to = boxstack;
     m->parameter = (ULONG)vi;
     Command::getInstance()->postMessageNoLock(m);
   }
@@ -241,7 +258,7 @@ void VRadioRec::processMessage(Message* m)
     int y=(m->parameter&0xFFFF)-(int)getScreenY();
     if (!barShowing)
     {
-      ViewMan::getInstance()->handleCommand(Remote::OK); //simulate rok press
+      boxstack->handleCommand(Remote::OK); //simulate rok press
     }
     else if ((int)barRegion.x<=x && (int)barRegion.y<=y && ((int)barRegion.x+(int)barRegion.w)>=x
              &&  ((int)barRegion.y+(int)barRegion.h)>=y)
@@ -263,7 +280,7 @@ void VRadioRec::processMessage(Message* m)
     }
     else
     {
-      ViewMan::getInstance()->handleCommand(Remote::OK); //simulate rok press
+      boxstack->handleCommand(Remote::OK); //simulate rok press
     }
   }
   else if (m->message == Message::PLAYER_EVENT)
@@ -340,9 +357,9 @@ void VRadioRec::doBar(int action)
   */
 
   WSymbol w;
-  w.setSurface(surface);
+  TEMPADD(&w);
   w.nextSymbol = 0;
-  w.setSurfaceOffset(barRegion.x + 66, barRegion.y + 16);
+  w.setPosition(barRegion.x + 66, barRegion.y + 16);
 
   UCHAR playerState = 0;
 
@@ -365,7 +382,7 @@ void VRadioRec::doBar(int action)
 
   drawBarClocks();
 
-  ViewMan::getInstance()->updateView(this, &barRegion);
+  BoxStack::getInstance()->update(this, &barRegion);
 
   timers->setTimerD(this, 1, 4); // only set the getridofbar timer if not ffwd/fbwd
   timers->setTimerD(this, 2, 0, 200000000);
@@ -388,7 +405,7 @@ void VRadioRec::timercall(int clientReference)
       drawBarClocks();
       Message* m = new Message();
       m->message = Message::REDRAW;
-      m->to = ViewMan::getInstance();
+      m->to = boxstack;
       m->from = this;
       m->parameter = (ULONG)&barRegion;
       Command::getInstance()->postMessageFromOuterSpace(m);
@@ -530,7 +547,7 @@ void VRadioRec::removeBar()
 
   Message* m = new Message();
   m->message = Message::REDRAW;
-  m->to = ViewMan::getInstance();
+  m->to = boxstack;
   m->from = this;
   m->parameter = (ULONG)&barRegion;
   Command::getInstance()->postMessageFromOuterSpace(m);
index d7f9aa6193960939e07c3060360052bbae8d8bab..3bed0e3f03ca0d6862f89541d7166d590279c04b 100644 (file)
 
 #include <stdio.h>
 
-#include "video.h"
-#include "view.h"
-#include "playerradio.h"
-#include "vdr.h"
-#include "recording.h"
-#include "command.h"
-#include "colour.h"
-#include "osd.h"
-#include "timers.h"
+#include "boxx.h"
 #include "timerreceiver.h"
-#include "message.h"
+#include "defines.h"
+#include "colour.h"
+#include "region.h"
 
+class Recording;
+class Message;
+class VDR;
+class Video;
+class PlayerRadio;
 class Timers;
 
-class VRadioRec : public View, public TimerReceiver
+class VRadioRec : public Boxx, public TimerReceiver
 {
   public:
     VRadioRec(Recording* rec);
@@ -55,6 +54,7 @@ class VRadioRec : public View, public TimerReceiver
     Timers* timers;
     PlayerRadio* player;
     Recording* myRec;
+    BoxStack* boxstack;
 
     Colour barBlue;
 
index 8f410800ca28cbfb8eb0a0a3c6579037258daaec..336d6198ebac8eb68f0e1e06531eb9ca645e0ed0 100644 (file)
 
 #include "vrecmove.h"
 
+#include "defines.h"
+#include "recording.h"
+#include "remote.h"
+#include "vinfo.h"
+#include "colour.h"
+#include "video.h"
+#include "i18n.h"
+#include "command.h"
+#include "wsymbol.h"
+#include "recman.h"
+#include "directory.h"
+#include "message.h"
+#include "boxstack.h"
+
 VRecMove::VRecMove(RecMan* trecman)
 {
   recman = trecman;
 
-  create(260, 210);
+  setSize(260, 210);
+  createBuffer();
   if (Video::getInstance()->getFormat() == Video::PAL)
   {
-    setScreenPos(220, 160);
+    setPosition(220, 160);
   }
   else
   {
-    setScreenPos(210, 130);
+    setPosition(210, 130);
   }
 
-  setBackgroundColour(Colour::VIEWBACKGROUND);
   setTitleBarOn(1);
   setBorderOn(1);
   setTitleText(tr("Move recording"));
   setTitleBarColour(Colour::TITLEBARBACKGROUND);
 
-  sl.setSurface(surface);
-  sl.setSurfaceOffset(10, 30 + 5);
-  sl.setDimensions(area.w - 40, area.h - 30 - 15);
+  sl.setPosition(10, 30 + 5);
+  sl.setSize(area.w - 40, area.h - 30 - 15);
+  add(&sl);
 
   Directory* dir = recman->getRootDir();
   sl.addOption("/", (ULONG)dir, 1);
@@ -76,19 +90,18 @@ void VRecMove::addDirs(Directory* dir, char* prefix)
 
 void VRecMove::draw()
 {
-  View::draw();
-  sl.draw();
+  TBBoxx::draw();
 
   rectangle(area.w - 30, 30 + 5, 20, area.h - 30 - 15, Colour::VIEWBACKGROUND);
   WSymbol w;
-  w.setSurface(surface);
+  TEMPADD(&w);
 
   w.nextSymbol = WSymbol::SMALLUP;
-  w.setSurfaceOffset(area.w - 28, 30 + 7);
+  w.setPosition(area.w - 28, 30 + 7);
   w.draw();
 
   w.nextSymbol = WSymbol::SMALLDOWN;
-  w.setSurfaceOffset(area.w - 28, area.h - 26);
+  w.setPosition(area.w - 28, area.h - 26);
   w.draw();
 }
 
@@ -101,7 +114,7 @@ int VRecMove::handleCommand(int command)
     {
       sl.up();
       sl.draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       return 2;
     }
     case Remote::DF_DOWN:
@@ -109,7 +122,7 @@ int VRecMove::handleCommand(int command)
     {
       sl.down();
       sl.draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       return 2;
     }
     case Remote::OK:
@@ -138,23 +151,23 @@ void VRecMove::processMessage(Message* m)
     if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
       sl.draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
     }
   }
   else if (m->message == Message::MOUSE_LBDOWN)
   {
     if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
-      ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+      BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
     }
     else
     {
       //check if press is outside this view! then simulate cancel
       int x=(m->parameter>>16)-getScreenX();
       int y=(m->parameter&0xFFFF)-getScreenY();
-      if (x<0 || y <0 || x>getWidth() || y>getHeight())
+      if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
       {
-        ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+        BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
       }
     }
   }
index 58d4a822c51452824816c9e8dd48c98b91d4029f..49c73e5a0d788f87a7bbeeeffc0bebb43cc5f676 100644 (file)
 #include <stdio.h>
 #include <string.h>
 
-#include "defines.h"
-#include "view.h"
-#include "recording.h"
+#include "tbboxx.h"
 #include "wselectlist.h"
-#include "remote.h"
-#include "vinfo.h"
-#include "colour.h"
-#include "video.h"
-#include "i18n.h"
-#include "command.h"
-#include "directory.h"
-#include "message.h"
-#include "viewman.h"
-
-class VRecMove : public View
+
+class RecMan;
+class Directory;
+class Message;
+
+class VRecMove : public TBBoxx
 {
   public:
     VRecMove(RecMan* recman);
index 4f264cddb74ceb026945be948bc136ab0b9d0bfb..4a2667a2b75d5477ce4d05e0c36a991134f04f2c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright 2004-2005 Chris Tallon
+    Copyright 2004-2007 Chris Tallon
 
     This file is part of VOMP.
 
 
 #include "vrecordinglist.h"
 
+#include "recman.h"
+#include "directory.h"
+#include "recording.h"
+#include "remote.h"
+#include "wsymbol.h"
+#include "boxstack.h"
+#include "vrecordingmenu.h"
+#include "vdr.h"
+#include "vvideorec.h"
+#include "vradiorec.h"
+#include "colour.h"
+#include "video.h"
+#include "i18n.h"
+#include "command.h"
+#include "vinfo.h"
+
 VRecordingList::VRecordingList()
 {
-  viewman = ViewMan::getInstance();
+  boxstack = BoxStack::getInstance();
   recman = NULL;
   loading = true;
 
-  create(570, 420);
+  setSize(570, 420);
+  createBuffer();
   if (Video::getInstance()->getFormat() == Video::PAL)
   {
-    setScreenPos(80, 70);
+    setPosition(80, 70);
   }
   else
   {
-    setScreenPos(70, 35);
+    setPosition(70, 35);
   }
 
-  setBackgroundColour(Colour::VIEWBACKGROUND);
   setTitleBarOn(1);
   setTitleBarColour(Colour::TITLEBARBACKGROUND);
 
-  sl.setSurface(surface);
-  sl.setSurfaceOffset(10, 30 + 5);
-  sl.setDimensions(area.w - 20, area.h - 30 - 15 - 30);
+  sl.setPosition(10, 30 + 5);
+  sl.setSize(area.w - 20, area.h - 30 - 15 - 30);
+  add(&sl);
 }
 
 VRecordingList::~VRecordingList()
@@ -126,7 +142,7 @@ void VRecordingList::draw(bool doIndexPop)
     }
   }
 
-  View::draw();
+  TBBoxx::draw();
 
   if (loading)
   {
@@ -142,26 +158,26 @@ void VRecordingList::draw(bool doIndexPop)
     // Symbols
 
     WSymbol w;
-    w.setSurface(surface);
+    TEMPADD(&w);
 
     w.nextSymbol = WSymbol::UP;
-    w.setSurfaceOffset(20, 385);
+    w.setPosition(20, 385);
     w.draw();
 
     w.nextSymbol = WSymbol::DOWN;
-    w.setSurfaceOffset(50, 385);
+    w.setPosition(50, 385);
     w.draw();
 
     w.nextSymbol = WSymbol::SKIPBACK;
-    w.setSurfaceOffset(85, 385);
+    w.setPosition(85, 385);
     w.draw();
 
     w.nextSymbol = WSymbol::SKIPFORWARD;
-    w.setSurfaceOffset(115, 385);
+    w.setPosition(115, 385);
     w.draw();
 
     w.nextSymbol = WSymbol::PLAY;
-    w.setSurfaceOffset(150, 385);
+    w.setPosition(150, 385);
     w.draw();
 
     drawTextRJ(tr("[ok] = menu"), 560, 385, Colour::LIGHTTEXT);
@@ -193,23 +209,23 @@ void VRecordingList::processMessage(Message* m)
     {
       sl.draw();
       doShowingBar();
-      viewman->updateView(this);
+      boxstack->update(this);
     }
   }
   else if (m->message == Message::MOUSE_LBDOWN)
   {
     if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
-      viewman->handleCommand(Remote::OK); //simulate OK press
+      boxstack->handleCommand(Remote::OK); //simulate OK press
     }
     else
     {
       //check if press is outside this view! then simulate cancel
       int x=(m->parameter>>16)-getScreenX();
       int y=(m->parameter&0xFFFF)-getScreenY();
-      if (x<0 || y <0 || x>getWidth() || y>getHeight())
+      if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
       {
-        viewman->handleCommand(Remote::BACK); //simulate cancel press
+        boxstack->handleCommand(Remote::BACK); //simulate cancel press
       }
     }
   }
@@ -251,24 +267,25 @@ void VRecordingList::doDeleteSelected()
   if (success != 1)
   {
     VInfo* vi = new VInfo();
-    vi->create(360, 200);
+    vi->setSize(360, 200);
+    vi->createBuffer();
     if (Video::getInstance()->getFormat() == Video::PAL)
-      vi->setScreenPos(190, 170);
+      vi->setPosition(190, 170);
     else
-      vi->setScreenPos(180, 120);
+      vi->setPosition(180, 120);
     vi->setOneLiner(tr("Failed to delete recording"));
     vi->setExitable();
     vi->setBorderOn(1);
     vi->setTitleBarColour(Colour::DANGER);
     vi->okButton();
     vi->draw();
-    viewman->add(vi);
-    viewman->updateView(vi);
+    boxstack->add(vi);
+    boxstack->update(vi);
   }
   else
   {
     draw();
-    viewman->updateView(this);
+    boxstack->update(this);
   }
 
 }
@@ -290,24 +307,25 @@ void VRecordingList::doMoveRecording(Directory* toDir)
   if (success != 1)
   {
     VInfo* vi = new VInfo();
-    vi->create(360, 200);
+    vi->setSize(360, 200);
+    vi->createBuffer();
     if (Video::getInstance()->getFormat() == Video::PAL)
-      vi->setScreenPos(190, 170);
+      vi->setPosition(190, 170);
     else
-      vi->setScreenPos(180, 120);
+      vi->setPosition(180, 120);
     vi->setOneLiner(tr("Failed to move recording"));
     vi->setExitable();
     vi->setBorderOn(1);
     vi->setTitleBarColour(Colour::DANGER);
     vi->okButton();
     vi->draw();
-    viewman->add(vi);
-    viewman->updateView(vi);
+    boxstack->add(vi);
+    boxstack->update(vi);
   }
   else
   {
     draw();
-    viewman->updateView(this);
+    boxstack->update(this);
   }
 }
 
@@ -325,16 +343,16 @@ int VRecordingList::doPlay(bool resume)
     {
       VRadioRec* radrec = new VRadioRec(toPlay);
       radrec->draw();
-      viewman->add(radrec);
-      viewman->updateView(radrec);
+      boxstack->add(radrec);
+      boxstack->update(radrec);
       radrec->go();
     }
     else
     {
       VVideoRec* vidrec = new VVideoRec(toPlay);
       vidrec->draw();
-      viewman->add(vidrec);
-      viewman->updateView(vidrec);
+      boxstack->add(vidrec);
+      boxstack->update(vidrec);
       vidrec->go(resume);
     }
     return 1;
@@ -368,7 +386,7 @@ int VRecordingList::handleCommand(int command)
       sl.draw();
 
       doShowingBar();
-      viewman->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::DF_DOWN:
@@ -382,7 +400,7 @@ int VRecordingList::handleCommand(int command)
 
       doShowingBar();
       Log::getInstance()->log("P", Log::DEBUG, "3");
-      viewman->updateView(this);
+      boxstack->update(this);
       Log::getInstance()->log("P", Log::DEBUG, "4");
       return 2;
     }
@@ -392,7 +410,7 @@ int VRecordingList::handleCommand(int command)
       sl.draw();
 
       doShowingBar();
-      viewman->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::SKIPFORWARD:
@@ -401,7 +419,7 @@ int VRecordingList::handleCommand(int command)
       sl.draw();
 
       doShowingBar();
-      viewman->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::OK:
@@ -422,7 +440,7 @@ int VRecordingList::handleCommand(int command)
             slIndexStack.push(sl.getCurrentOption());
             sl.clear();
             draw();
-            viewman->updateView(this);
+            boxstack->update(this);
           }
           return 2;
         }
@@ -438,8 +456,8 @@ int VRecordingList::handleCommand(int command)
         v->setParent(this);
         v->setRecording(current);
         v->draw();
-        viewman->add(v);
-        viewman->updateView(v);
+        boxstack->add(v);
+        boxstack->update(v);
         return 2;
       }
       // should not get to here
@@ -452,7 +470,7 @@ int VRecordingList::handleCommand(int command)
         recman->up();
         sl.clear();
         draw(true);
-        viewman->updateView(this);
+        boxstack->update(this);
         return 2;
       }
       else
@@ -497,7 +515,7 @@ bool VRecordingList::load()
     recman->sort();
 
     draw();
-    viewman->updateView(this);
+    boxstack->update(this);
   }
 
   return success;
@@ -509,5 +527,6 @@ void VRecordingList::reSort()
   recman->sort();
   sl.clear();
   draw();
-  viewman->updateView(this);
+  boxstack->update(this);
 }
+
index ae0c480ac086ada7230a3575b7c660c9d9e5f5bd..1a398ace4d1b8a1011916e14f489614d50f1fd0c 100644 (file)
 #include <vector>
 #include <stack>
 
-#include "view.h"
-#include "recman.h"
-#include "directory.h"
-#include "recording.h"
+#include "tbboxx.h"
 #include "wselectlist.h"
-#include "remote.h"
-#include "wsymbol.h"
-#include "viewman.h"
-#include "vrecordingmenu.h"
-#include "vdr.h"
-#include "vvideorec.h"
-#include "vradiorec.h"
-#include "colour.h"
-#include "video.h"
-#include "i18n.h"
-#include "command.h"
 
-class VRecordingList : public View
+class Message;
+class BoxStack;
+class RecMan;
+class Directory;
+class Recording;
+
+class VRecordingList : public TBBoxx
 {
   public:
     VRecordingList();
@@ -57,7 +49,7 @@ class VRecordingList : public View
     void drawData(bool doIndexPop = false);
 
   private:
-
+    BoxStack* boxstack;
     bool loading;
     RecMan* recman;
     Directory* dir;
index fb764c179b36c81538577a0446b410873b6d215d..d50e7131457fdb1bae11cf6398c8fe42567c33de 100644 (file)
 
 #include "vrecordingmenu.h"
 
+#include "remote.h"
+#include "vquestion.h"
+#include "vinfo.h"
+#include "vdr.h"
+#include "colour.h"
+#include "video.h"
+#include "i18n.h"
+#include "command.h"
+#include "vrecmove.h"
+#include "boxstack.h"
+#include "recman.h"
+#include "vrecordinglist.h"
+#include "recording.h"
+#include "message.h"
+
 VRecordingMenu::VRecordingMenu(RecMan* trecman)
 {
   rec = NULL;
   recman = trecman;
 
-  create(200, 164);
+  setSize(200, 164);
+  createBuffer();
   if (Video::getInstance()->getFormat() == Video::PAL)
   {
-    setScreenPos(260, 190);
+    setPosition(260, 190);
   }
   else
   {
-    setScreenPos(250, 160);
+    setPosition(250, 160);
   }
 
-  setBackgroundColour(Colour::VIEWBACKGROUND);
   setTitleBarOn(1);
   setBorderOn(1);
   setTitleText(tr("Programme menu"));
   setTitleBarColour(Colour::TITLEBARBACKGROUND);
 
-  sl.setSurface(surface);
-  sl.setSurfaceOffset(10, 30 + 5);
-  sl.setDimensions(area.w - 20, area.h - 30 - 15);
+  sl.setPosition(10, 30 + 5);
+  sl.setSize(area.w - 20, area.h - 30 - 15);
   sl.addOption(tr("Play"), 1, 1);
   sl.addOption(tr("Resume"), 2, 0);
   sl.addOption(tr("Summary"), 3, 0);
   sl.addOption(tr("Move"), 4, 0);
   sl.addOption(tr("Delete"), 5, 0);
+  add(&sl);
 }
 
 VRecordingMenu::~VRecordingMenu()
@@ -65,12 +80,6 @@ void VRecordingMenu::setRecording(Recording* trec)
   rec = trec;
 }
 
-void VRecordingMenu::draw()
-{
-  View::draw();
-  sl.draw();
-}
-
 int VRecordingMenu::handleCommand(int command)
 {
   switch(command)
@@ -80,7 +89,7 @@ int VRecordingMenu::handleCommand(int command)
     {
       sl.up();
       sl.draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       return 2;
     }
     case Remote::DF_DOWN:
@@ -88,7 +97,7 @@ int VRecordingMenu::handleCommand(int command)
     {
       sl.down();
       sl.draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       return 2;
     }
     case Remote::OK:
@@ -118,6 +127,12 @@ int VRecordingMenu::handleCommand(int command)
         rec->loadRecInfo();
 
         VInfo* vi = new VInfo();
+        vi->setSize(490, 300);
+        vi->createBuffer();
+        if (Video::getInstance()->getFormat() == Video::PAL)
+          vi->setPosition(120, 130);
+        else
+          vi->setPosition(110, 90);
         vi->setTitleText(tr("Programme summary"));
         vi->setBorderOn(1);
         vi->setExitable();
@@ -125,18 +140,9 @@ int VRecordingMenu::handleCommand(int command)
           vi->setMainText(rec->recInfo->summary);
         else
           vi->setMainText(tr("Summary unavailable"));
-        if (Video::getInstance()->getFormat() == Video::PAL)
-        {
-          vi->setScreenPos(120, 130);
-        }
-        else
-        {
-          vi->setScreenPos(110, 90);
-        }
-        vi->create(490, 300);
         vi->draw();
-        ViewMan::getInstance()->add(vi);
-        ViewMan::getInstance()->updateView(vi);
+        BoxStack::getInstance()->add(vi);
+        BoxStack::getInstance()->update(vi);
 
         return 2;
       }
@@ -146,16 +152,16 @@ int VRecordingMenu::handleCommand(int command)
         VRecMove* vrm = new VRecMove(recman);
         vrm->setParent(this);
         vrm->draw();
-        ViewMan::getInstance()->add(vrm);
-        ViewMan::getInstance()->updateView(vrm);
+        BoxStack::getInstance()->add(vrm);
+        BoxStack::getInstance()->update(vrm);
         return 2;
       }
 
       if (sl.getCurrentOptionData() == 5)
       {
         VQuestion* v = new VQuestion(this);
-        v->create(260, 180);
-        v->setBackgroundColour(Colour::VIEWBACKGROUND);
+        v->setSize(260, 180);
+        v->createBuffer();
         v->setTitleBarColour(Colour::DANGER);
         v->setTitleBarOn(1);
         v->setBorderOn(1);
@@ -164,16 +170,16 @@ int VRecordingMenu::handleCommand(int command)
         v->setDefault(VQuestion::NO);
         if (Video::getInstance()->getFormat() == Video::PAL)
         {
-          v->setScreenPos(230, 160);
+          v->setPosition(230, 160);
         }
         else
         {
-          v->setScreenPos(220, 140);
+          v->setPosition(220, 140);
         }
 
         v->draw();
-        ViewMan::getInstance()->add(v);
-        ViewMan::getInstance()->updateView(v);
+        BoxStack::getInstance()->add(v);
+        BoxStack::getInstance()->update(v);
         return 2;
       }
     }
@@ -193,23 +199,23 @@ void VRecordingMenu::processMessage(Message* m)
     if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
       sl.draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
     }
   }
   else if (m->message == Message::MOUSE_LBDOWN)
   {
     if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
-      ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+      BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
     }
     else
     {
       //check if press is outside this view! then simulate cancel
       int x=(m->parameter>>16)-getScreenX();
       int y=(m->parameter&0xFFFF)-getScreenY();
-      if (x<0 || y <0 || x>getWidth() || y>getHeight())
+      if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
       {
-        ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+        BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
       }
     }
   }
@@ -219,7 +225,7 @@ void VRecordingMenu::processMessage(Message* m)
     {
       Message* m2 = new Message(); // Delete self
       m2->from = this;
-      m2->to = ViewMan::getInstance();
+      m2->to = BoxStack::getInstance();
       m2->message = Message::CLOSE_ME;
       Command::getInstance()->postMessageNoLock(m2);
 
@@ -234,7 +240,7 @@ void VRecordingMenu::processMessage(Message* m)
   {
     Message* m2 = new Message(); // Delete self
     m2->from = this;
-    m2->to = ViewMan::getInstance();
+    m2->to = BoxStack::getInstance();
     m2->message = Message::CLOSE_ME;
     Command::getInstance()->postMessageNoLock(m2);
 
index 54c5fa1d77d3cd51e3888a1c50c5643753cb2a77..fb932c633c78b11340512476d47a21b3fdae19e8 100644 (file)
 #include <stdio.h>
 #include <string.h>
 
-#include "view.h"
-#include "recording.h"
+#include "tbboxx.h"
 #include "wselectlist.h"
-#include "remote.h"
-#include "vrecordinglist.h"
-#include "vquestion.h"
-#include "message.h"
-#include "vinfo.h"
-#include "vdr.h"
-#include "colour.h"
-#include "video.h"
-#include "i18n.h"
-#include "command.h"
-#include "vrecmove.h"
 
 class VRecordingList;
+class RecMan;
+class Recording;
+class Message;
 
-class VRecordingMenu : public View
+class VRecordingMenu : public TBBoxx
 {
   public:
     VRecordingMenu(RecMan* recman);
@@ -51,7 +42,6 @@ class VRecordingMenu : public View
 
     int handleCommand(int command);
     void processMessage(Message* m);
-    void draw();
 
   private:
     RecMan* recman;
index b8cb8655880f207a535fff534f69049ffefdd7f1..910d051f411fd26ca177be25bb67dd48baf8ea1c 100644 (file)
 
 #include "vremoteconfig.h"
 
+#include "remote.h"
+#include "wsymbol.h"
+#include "viewman.h"
+#include "vdr.h"
+#include "colour.h"
+#include "video.h"
+#include "i18n.h"
+#include "command.h"
+#include "message.h"
+
 VRemoteConfig::VRemoteConfig(void* tparent)
 {
   parent = tparent;
@@ -67,9 +77,9 @@ void VRemoteConfig::initSelectList(bool startup)
         top=sl.getTopOption();
         
     }
-    sl.setSurface(surface);
-    sl.setSurfaceOffset(10,  40);
-    sl.setDimensions(area.w - 20, area.h - 30 - 15 -30 );
+//    sl.setSurface(surface);
+//    sl.setSurfaceOffset(10,  40);
+//    sl.setDimensions(area.w - 20, area.h - 30 - 15 -30 );
     sl.clear();
     sl.addColumn(0);
     sl.addColumn(150);
index 193b767f84e4b923d0c07c9632d3d6da62925f11..8a69c3fa78eadd2b99c050ec4f8710c940afa38f 100644 (file)
 
 #include "view.h"
 #include "wselectlist.h"
-#include "remote.h"
-#include "wsymbol.h"
-#include "viewman.h"
-#include "vdr.h"
-#include "colour.h"
-#include "video.h"
-#include "i18n.h"
-#include "command.h"
+
+class Remote;
+class Message;
 
 class VRemoteConfig : public View
 {
@@ -56,7 +51,6 @@ class VRemoteConfig : public View
       void initSelectList(bool startup);
       void doSave();
       void* parent;
-
    
 };
 
index d633d9fe8f37332897962beca70781c45e003417..91826328b4a32189aed45175c415b485edd4289b 100644 (file)
 
 #include "vscreensaver.h"
 
+#include "defines.h"
+#include "log.h"
+#include "remote.h"
+#include "colour.h"
+#include "video.h"
+#include "surface.h"
+
 VScreensaver::VScreensaver()
 {
-  setScreenPos(0, 0);
+  setPosition(0, 0);
   Video* video = Video::getInstance();
   screenWidth = video->getScreenWidth();
   screenHeight = video->getScreenHeight();
@@ -39,15 +46,13 @@ VScreensaver::~VScreensaver()
 
 void VScreensaver::draw()
 {
-  setBackgroundColour(Colour::BLACK);
-  View::draw();
+  fillColour(Colour::BLACK);
   threadStart();
 }
 
 int VScreensaver::handleCommand(int command)
 {
   threadCancel();
-
   return 4;
 }
 
index 4d3330e952784c738d854208d48de9902588e476..e7e594a396756969cc0fbe639eb24e60a9f8fd14 100644 (file)
 #include <time.h>
 #include <math.h>
 
-#include "defines.h"
-#include "log.h"
-#include "view.h"
-#include "remote.h"
-#include "colour.h"
-#include "video.h"
-#include "video.h"
+#include "boxx.h"
 
 #ifdef WIN32
 #include "threadwin.h"
@@ -40,7 +34,7 @@
 #endif
 
 
-class VScreensaver : public View, public Thread_TYPE
+class VScreensaver : public Boxx, public Thread_TYPE
 {
   public:
     VScreensaver();
index 11dc19a1cd4474ad034e2432fa433ae5462c18d5..e9acdf70992b168aae8f4ecf383dca97f147d003 100644 (file)
 
 #include "vserverselect.h"
 
+#include "defines.h"
+#include "remote.h"
+#include "colour.h"
+#include "video.h"
+#include "boxstack.h"
+#include "i18n.h"
+#include "command.h"
+
+
 VServerSelect::VServerSelect(vector<VDRServer>& servers, void* treplyTo)
 {
   // I tried the whole passing using a reference here, but
@@ -27,24 +36,24 @@ VServerSelect::VServerSelect(vector<VDRServer>& servers, void* treplyTo)
   // a char array. so now we have the messy dereferencing...
   // anyway, now it doesn't use a object wide reference.
 
-  create(300, 200);
+  setSize(300, 200);
+  createBuffer();
   if (Video::getInstance()->getFormat() == Video::PAL)
   {
-    setScreenPos(220, 200);
+    setPosition(220, 200);
   }
   else
   {
-    setScreenPos(210, 150);
+    setPosition(210, 150);
   }
 
-  setBackgroundColour(Colour::VIEWBACKGROUND);
   setTitleBarOn(1);
   setTitleBarColour(Colour::TITLEBARBACKGROUND);
   setTitleText(tr("Choose a VDR server"));
 
-  sl.setSurface(surface);
-  sl.setSurfaceOffset(10, 30 + 5);
-  sl.setDimensions(area.w - 20, area.h - 30 - 15);
+  sl.setPosition(10, 30 + 5);
+  sl.setSize(area.w - 20, area.h - 30 - 15);
+  add(&sl);
 
   sl.addOption(servers[0].name, 0, 1);
   for(UINT k = 1; k < servers.size(); k++)
@@ -61,8 +70,7 @@ VServerSelect::~VServerSelect()
 
 void VServerSelect::draw()
 {
-  View::draw();
-  sl.draw();
+  TBBoxx::draw();
 }
 
 int VServerSelect::handleCommand(int command)
@@ -74,7 +82,7 @@ int VServerSelect::handleCommand(int command)
     {
       sl.up();
       sl.draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       return 2;
     }
     case Remote::DF_DOWN:
@@ -82,7 +90,7 @@ int VServerSelect::handleCommand(int command)
     {
       sl.down();
       sl.draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       return 2;
     }
     case Remote::OK:
@@ -106,14 +114,14 @@ void VServerSelect::processMessage(Message* m)
     if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
       sl.draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
     }
   }
   else if (m->message == Message::MOUSE_LBDOWN)
   {
     if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
-      ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+      BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
     }
   }
 }
index af6a68c6c829857a3d276864d010b9e578412279..708528a723ad6dcf93e30221b5cbb32a902ab051 100644 (file)
 #include <string.h>
 #include <vector>
 
-#include "defines.h"
-#include "view.h"
-#include "remote.h"
-#include "wselectlist.h"
-#include "colour.h"
-#include "video.h"
-#include "viewman.h"
-#include "i18n.h"
+#include "tbboxx.h"
 #include "vdr.h"
-#include "command.h"
+#include "wselectlist.h"
+
+class Message;
 
 using namespace std;
 
-class VServerSelect : public View
+class VServerSelect : public TBBoxx
 {
   public:
     VServerSelect(vector<VDRServer>& servers, void* replyTo);
diff --git a/vtabsviewman.cc b/vtabsviewman.cc
deleted file mode 100644 (file)
index 1ecbef1..0000000
+++ /dev/null
@@ -1,438 +0,0 @@
-/*
-    Copyright 2004-2007 Chris Tallon, Marten Richter
-
-    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 "vtabsviewman.h"
-#include "video.h"
-#include "wsymbol.h"
-#include "remote.h"
-#include "command.h"
-#include "viewman.h"
-
-VTabsViewMan::VTabsViewMan()
-{
-    numViews = 0;
-    selectedView = 0;
-    backgroundColour = Colour::VIEWBACKGROUND;
-    tabHasControl = true;
-}
-
-VTabsViewMan::~VTabsViewMan()
-{
-    removeAll();
-}
-
-int VTabsViewMan::add(View* v)
-{
-    if (numViews == 16) return 0;
-
-    v->setTitleBarOn(0); //No Title Bar
-    v->setViewMan(this); //For this view, we are the viewman
-    v->setBackgroundColour(Colour::TABVIEWBACKGROUND);
-
-    views[numViews++] = v;
-
-    if (surface!=NULL) create(); //Recreating surface
-
-    return 1;
-}
-
-int VTabsViewMan::removeView(View* toDelete)
-{
-    if (numViews == 0) return 0;
-
-    int i;
-
-    if (toDelete == NULL)
-    {
-        toDelete = views[numViews-1];
-        i = numViews - 1;
-    }
-    else
-    {
-        // to be deleted view is more likely to be at the top
-        for (i = numViews-1; i >= 0; i--)
-        {
-            if (views[i] == toDelete) break;
-        }
-        if (i == -1)
-        {
-            // not a View we have!
-            return 0;
-        }
-    }
-//    deleteView(i);
-
-    // Shift the views on top down one
-    --numViews;
-    for(int j = i; j < numViews; j++) views[j] = views[j+1];
-
-    // Delete the view
-    delete toDelete;
-
-    if (surface!=NULL) create(); //Recreating surface, if we are initted
-    if (selectedView >= numViews) selectedView = numViews-1;
-
-    return 1;
-}
-
-void VTabsViewMan::removeAll()
-{
-    for (; numViews > 0; --numViews)
-    {
-        delete views[numViews-1];
-    }
-}
-
-void VTabsViewMan::updateView(View* toUpdate, Region* regionToUpdate)
-{
-    draw();
-    ViewMan::getInstance()->updateView(this,regionToUpdate);
-}
-
-void VTabsViewMan::create()
-{
-    if (surface!=NULL)
-    {
-        delete surface;//destroy old surface
-        surface=NULL;
-    }
-    Region newarea;
-    int i;
-    if (numViews == 0)
-    {
-        newarea.h=200;
-        newarea.w=200;
-    }
-    else
-    {
-        for (i = 0; i < numViews; i++)
-        {
-            newarea.h=max(views[i]->getHeight(),newarea.h);
-            newarea.w=max(views[i]->getWidth(),newarea.w);
-        }
-    }
-    newarea.h += 30; //Title Bar
-    newarea.h += 30; //Tab bar
-    newarea.h += 2; //Border
-    newarea.w += 2;
-
-    //centering
-
-    newarea.y = Video::getInstance()->getScreenHeight()/2-newarea.h/2;
-    newarea.x = Video::getInstance()->getScreenWidth()/2-newarea.w/2;
-    setScreenPos(newarea.x,newarea.y);
-
-    //Now iterate through the views and set the position
-
-    for (i = 0; i < numViews; i++)
-    {
-        views[i]->setScreenPos(newarea.x+1,newarea.y+1+30+30);
-    }
-    View::create(newarea.w,newarea.h);
-
-}
-
-
-void VTabsViewMan::draw()
-{
-    if (surface==NULL) return;
-    View::draw();
-    //Now Drawing the tabs bar
-    int xpos=1;
-    WSymbol wsy;
-    wsy.setSurface(surface);
-
-    if (selectedView>=2)
-    {
-        wsy.nextSymbol = WSymbol::LEFTARROW;
-        wsy.nextColour = Colour::BUTTONBACKGROUND;
-        wsy.setSurfaceOffset(xpos, 40);
-        wsy.draw();
-        xpos+=20;
-    }
-    int i;
-    UINT textypos=30+30-2-surface->getFontHeight();
-    for (i = max(selectedView-1,0); i < numViews && xpos+150+20 < (int)area.w; i++)
-    {
-        if (i == selectedView)
-        {
-            rectangle(xpos+1,30+1,150,30,Colour::TABVIEWBACKGROUND);
-        }
-        else
-        {
-             rectangle(xpos+1,30+1,150,28,Colour::TABVIEWBACKGROUND);
-        }
-        if (i == selectedView && tabHasControl)
-            drawText(views[i]->getTitleText(),xpos+5,textypos,Colour::SELECTHIGHLIGHT);
-        else
-            drawText(views[i]->getTitleText(),xpos+5,textypos,Colour::LIGHTTEXT);
-
-        xpos+=151;
-    }
-    if (i < numViews)
-    {
-        wsy.nextSymbol = WSymbol::RIGHTARROW;
-        wsy.nextColour = Colour::BUTTONBACKGROUND;
-        wsy.setSurfaceOffset(xpos+5, 40);
-        wsy.draw();
-        xpos+=20;
-    }
-
-
-    if (selectedView < numViews) views[selectedView]->draw();
-}
-
-void VTabsViewMan::blt(Region& r)
-{
-    Box::blt(r);
-
-    if (selectedView < numViews) {
-        Region helper=r;
-        helper.x = max(helper.x,views[selectedView]->area.x);
-        helper.w -= helper.x-r.x;
-        helper.y = max(helper.y,views[selectedView]->area.y);
-        helper.h -= helper.y-r.y;
-        helper.w = min(helper.w,views[selectedView]->area.w);
-        helper.h = min(helper.h,views[selectedView]->area.h);
-        views[selectedView]->blt(helper);
-    }
-}
-
-
-int VTabsViewMan::handleCommand(int command)
-{
-  int retVal;
-  int i;
-  if (command == Remote::BACK)
-  {
-      for (i=0;i<numViews;i++)
-      {
-          views[i]->handleCommand(Remote::BACK);
-      }
-      // Instead of returning 4 here which would delete this view
-      // before the doSave messages are processed, let the message queue
-      // do the doSave then this close message. That will make the options menu
-      // disappear before this view
-
-      Message* m = new Message();
-      m->message = Message::CLOSE_ME;
-      m->from = this;
-      m->to = ViewMan::getInstance();
-      Command::getInstance()->postMessageNoLock(m);
-      return 2;
-  }
-  else if (tabHasControl) //our control bar is selected, we are the master of the universe
-  {
-      switch (command)
-      {
-      case Remote::DF_DOWN:
-      case Remote::DOWN:
-      {
-          tabHasControl = false; //loose control
-          if (selectedView < numViews)
-          {
-              views[selectedView]->handleCommand(command);
-              draw();
-           
-
-    //          viewman->updateView(this);   // CJT // this line makes it flash twice, unneccessary?
-              return 2;
-          }
-          else
-            return 2;
-      }break;
-      case Remote::DF_LEFT:
-      case Remote::LEFT:
-      {
-        selectedView=max(0,selectedView-1);
-        draw();
-        viewman->updateView(this);
-        return 2;
-      }break;
-      case Remote::DF_RIGHT:
-      case Remote::RIGHT:
-      {
-        selectedView=min(numViews-1,selectedView+1);
-        draw();
-        viewman->updateView(this);
-        return 2;
-      }break;
-      }
-      return 1;
-  }
-  else if (command != Remote::NA_NONE)
-  {
-    // handle command return values
-    // 0 - drop through to next view //this means me
-    // 1 - dont drop to next view, but not handled
-    // 2 - handled - stop command here
-    // 4 - handled - delete this view //delete me too
-
-
-      if (selectedView < numViews)
-      {
-          retVal = views[selectedView]->handleCommand(command);
-          if (retVal == 1)
-          {
-              // not handled but don't give to any more views
-              return 1;
-          }
-          if (retVal == 2)
-          {
-              // command handled
-              return 2;
-          }
-          else if (retVal == 4)
-          {
-              //        Log::getInstance()->log("ViewMan", Log::DEBUG, "Return 4: i=%i, views[i]=%p", i, views[i]);
-
-              return 1;
-          } else if (retVal == 0) {
-              tabHasControl = true;
-              draw(); // I have control
-              viewman->updateView(this);
-              return 2;
-          }
-
-      }
-  }
-  else
-  {
-    // fake the return code
-    return  2;
-  }
-
-  return 0;
-
-}
-
-void VTabsViewMan::processMessage(Message* m)
-{
-    /* Handle mouse events*/
-  // They come in with m->to = ViewMan and just need to be delivered to selectedView?
-  if ((numViews > 0) && ((m->message == Message::MOUSE_MOVE) || (m->message == Message::MOUSE_LBDOWN)))
-  {
-      //TODO, add Tab bar interaction
-    int x=(m->parameter>>16)-getScreenX();
-    int y=(m->parameter&0xFFFF)-getScreenY();
-    if (x<0 || y <0 || x>getWidth() || y>getHeight())
-    {
-        if (m->message == Message::MOUSE_LBDOWN)
-        {
-            Message *newm=new Message();
-            newm->from=NULL;
-            newm->to=Command::getInstance();
-            newm->message=Message::UDP_BUTTON;
-            newm->parameter=Remote::BACK;
-            Command::getInstance()->postMessage(newm);
-        }
-    } else {
-        if ( y <= 60)
-        { //my area
-            if (y >= 30 && m->message == Message::MOUSE_LBDOWN)
-            {
-                 int xpos=1;
-                 if (selectedView>=2)
-                 {
-                     if (xpos < x && x <=xpos+20)
-                     {
-                         tabHasControl=true;
-                         Message *newm=new Message();
-                         newm->from=NULL;
-                         newm->to=Command::getInstance();
-                         newm->message=Message::UDP_BUTTON;
-                         newm->parameter=Remote::LEFT;
-                         Command::getInstance()->postMessage(newm);
-                         return;
-                     }
-                     xpos+=20;
-                 }
-                 int i;
-                 for (i = max(selectedView-1,0);i < numViews && xpos+150+20 < (int)area.w; i++)
-                 {
-                     if (xpos < x && x <=xpos+150)
-                     {
-                         tabHasControl=true;
-                         selectedView = i;
-                         draw();
-                         ViewMan::getInstance()->updateView(this);
-                         return;
-                     }
-                     xpos+=151;
-                 }
-                 if (i < numViews)
-                 {
-                     if (xpos < x && x <=xpos+20)
-                     {
-                         tabHasControl=true;
-                         Message *newm=new Message();
-                         newm->from=NULL;
-                         newm->to=Command::getInstance();
-                         newm->message=Message::UDP_BUTTON;
-                         newm->parameter=Remote::RIGHT;
-                         Command::getInstance()->postMessage(newm);
-                         return;
-                     }
-                 }
-            }
-        }
-        else //tabs area
-        {
-            tabHasControl=false;
-            views[selectedView]->processMessage(m);
-        }
-    }
-    return;
-  }
-
-  if (m->to != this)
-  {
-    for (int i = numViews-1; i >= 0; i--)
-    {
-      if (views[i] == m->to)
-      {
-        Log::getInstance()->log("VTabsViewMan", Log::DEBUG, "sending message from view %p to view %p %lu", m->from, m->to, m->message);
-        views[i]->processMessage(m);
-        return;
-      }
-    }
-    return;
-  }
-
-
-
-  Log::getInstance()->log("VTabsViewMan", Log::DEBUG, "it's for meeee!");
-
-  switch(m->message)
-  {
-    case Message::CLOSE_ME:
-    {
-      removeView((View*)m->from);
-      break;
-    }
-    case Message::ADD_VIEW: // currently not used by anything but it might come in useful again
-    {
-      View* toAdd = (View*)m->parameter;
-      add(toAdd);
-      toAdd->draw();
-      ViewMan::getInstance()->updateView(this);
-      break;
-    }
-  }
-}
diff --git a/vtabsviewman.h b/vtabsviewman.h
deleted file mode 100644 (file)
index 198e31a..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-    Copyright 2004-2007 Chris Tallon,Marten Richter
-
-    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 VTABSVIEWMAN_H
-#define VTABSVIEWMAN_H
-
-#include "view.h"
-#include "viewman.h"
-
-
-class VTabsViewMan: public View,AbstractViewMan 
-{
-public:
-    VTabsViewMan();
-    ~VTabsViewMan();
-
-    int add(View* v);
-    int removeView(View* toRemove);
-    void removeAll();
-    void create();
-
-    void draw();
-    int handleCommand(int command);
-    void processMessage(Message* m); // The master lock will be locked
-    void updateView(View* toUpdate, Region* regionToUpdate = NULL);
-
-    void blt(Region& r);
-
-protected:
-    View* views[20];
-    int numViews;
-    int selectedView;
-    bool tabHasControl;
-
-};
-#endif
-
index c0fec618480744dbe7e143e43302bfb373f41282..4ca114998b2a8ef455e1690aabcedb8c5e294967 100644 (file)
 
 #include "vtimeredit.h"
 
+#include "remote.h"
+#include "wsymbol.h"
+#include "boxstack.h"
+#include "vdr.h"
+#include "colour.h"
+#include "video.h"
+#include "i18n.h"
+#include "timers.h"
+#include "vquestion.h"
+#include "command.h"
+
 VTimerEdit::VTimerEdit(RecTimer* trt)
 {
   recTimer = trt;
 
-  create(570, 420);
+  setSize(570, 420);
+  createBuffer();
   if (Video::getInstance()->getFormat() == Video::PAL)
   {
-    setScreenPos(80, 70);
+    setPosition(80, 70);
   }
   else
   {
-    setScreenPos(70, 35);
+    setPosition(70, 35);
   }
+  selectedButton = 0;
+  buttonBack.setPosition(30,350);
+  buttonDelete.setPosition(400,350);
+  buttonBack.setText("Back");
+  buttonBack.setActive(1);
+  buttonDelete.setText("Delete");
+  add(&buttonBack);
+  add(&buttonDelete);
 
-
-  setBackgroundColour(Colour::VIEWBACKGROUND);
   setTitleBarOn(1);
   setTitleText(tr("Edit Timer"));
   setTitleBarColour(Colour::TITLEBARBACKGROUND);
+}
 
+VTimerEdit::~VTimerEdit()
+{
+}
 
-  // Draw statics
+void VTimerEdit::setParent(VTimerList* tvTimerList)
+{
+  vTimerList = tvTimerList;
+}
 
-  draw(); // View::draw
+void VTimerEdit::draw()
+{
+  TBBoxx::draw();
 
   int xpos = 20;
   int ypos = 50;
@@ -114,18 +141,29 @@ VTimerEdit::VTimerEdit(RecTimer* trt)
   if (recTimer->recording) strcpy(buffer, "Yes");
   else                     strcpy(buffer, "No");
   drawText(buffer, xpos, ypos, Colour::LIGHTTEXT);         ypos += surface->getFontHeight();
-
-
 }
 
-VTimerEdit::~VTimerEdit()
+void VTimerEdit::swap()
 {
+  if (selectedButton == 0)
+  {
+    buttonBack.setActive(0);
+    buttonDelete.setActive(1);
+    selectedButton = 1;
+  }
+  else
+  {
+    buttonDelete.setActive(0);
+    buttonBack.setActive(1);
+    selectedButton = 0;
+  }
 }
 
 int VTimerEdit::handleCommand(int command)
 {
   switch(command)
   {
+    /*
     case Remote::DF_UP:
     case Remote::UP:
     {
@@ -140,9 +178,46 @@ int VTimerEdit::handleCommand(int command)
       ViewMan::getInstance()->updateView(this);
       return 2;
     }
+    */
+    case Remote::LEFT:
+    case Remote::DF_RIGHT:
+    {
+      swap();
+      buttonBack.draw();
+      buttonDelete.draw();
+      BoxStack::getInstance()->update(this);
+      return 2;
+    }
+    case Remote::RIGHT:
+    case Remote::DF_LEFT:
+    {
+      swap();
+      buttonBack.draw();
+      buttonDelete.draw();
+      BoxStack::getInstance()->update(this);
+      return 2;
+    }
     case Remote::OK:
     {
-
+      // Back
+      if (selectedButton == 0) return 4;
+      // Delete
+      VQuestion* v = new VQuestion(this);
+      v->setSize(260, 180);
+      v->createBuffer();
+      v->setTitleBarColour(Colour::DANGER);
+      v->setTitleBarOn(1);
+      v->setBorderOn(1);
+      v->setTitleText("Delete timer");
+      v->setMainText("Are you sure you want to delete this timer?");
+      v->setDefault(VQuestion::NO);
+      if (Video::getInstance()->getFormat() == Video::PAL)
+        v->setPosition(230, 160);
+      else
+        v->setPosition(220, 140);
+      v->draw();
+      BoxStack::getInstance()->add(v);
+      BoxStack::getInstance()->update(v);
       return 2;
     }
     case Remote::BACK:
@@ -158,6 +233,24 @@ void VTimerEdit::processMessage(Message* m)
 {
   if (m->message == Message::MOUSE_LBDOWN)
   {
-    ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+    BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
+  }
+  else if (m->message == Message::QUESTION_YES)
+  {
+  if (selectedButton == 1)
+    {
+      Message* m2 = new Message(); // Delete self
+      m2->from = this;
+      m2->to = BoxStack::getInstance();
+      m2->message = Message::CLOSE_ME;
+      Command::getInstance()->postMessageNoLock(m2);
+
+      m2 = new Message(); // OK. Want this to delete before this message does its job
+      m2->from = this;
+      m2->to = vTimerList;
+      m2->message = Message::DELETE_SELECTED_TIMER;
+      Command::getInstance()->postMessageNoLock(m2);
+    }
   }
 }
+
index 259a5b3694fc94b48f604f8f0a55d50b006e30b1..1ae14d65acda7aef2588de990eb3876787716508 100644 (file)
 #include <stdio.h>
 #include <string.h>
 
-#include "view.h"
-#include "wselectlist.h"
-#include "remote.h"
-#include "wsymbol.h"
-#include "viewman.h"
-#include "vdr.h"
-#include "colour.h"
-#include "video.h"
-#include "i18n.h"
-#include "timers.h"
-
-class VTimerEdit : public View
+#include "tbboxx.h"
+#include "wbutton.h"
+
+class VTimerList;
+class RecTimer;
+class Message;
+
+class VTimerEdit : public TBBoxx
 {
   public:
     VTimerEdit(RecTimer* rt);
     ~VTimerEdit();
 
+    void draw();
     int handleCommand(int command);
     void processMessage(Message* m);
+    void setParent(VTimerList* tvTimerList);
 
   private:
+    void swap();
     RecTimer* recTimer;
-
+    VTimerList* vTimerList;
+    WButton buttonBack;
+    WButton buttonDelete;
+    UINT selectedButton;
 };
 
 #endif
+
index 3d280513e7b1ef9a97a23a2ac62cd92d1700871a..e00a8c511bc294efc0d1aa547c29bbe370984ffb 100644 (file)
 
 #include "vtimerlist.h"
 
+#include "message.h"
+#include "remote.h"
+#include "wsymbol.h"
+#include "colour.h"
+#include "video.h"
+#include "i18n.h"
+#include "timers.h"
+#include "vtimeredit.h"
+#include "command.h"
+#include "boxstack.h"
+#include "vdr.h"
+#include "vinfo.h"
+
 VTimerList::VTimerList()
 {
   recTimerList = NULL;
@@ -36,67 +49,71 @@ VTimerList::VTimerList()
 
   flipflop = true;
 
-  create(570, 420);
+  setSize(570, 420);
+  createBuffer();
   if (Video::getInstance()->getFormat() == Video::PAL)
   {
-    setScreenPos(80, 70);
+    setPosition(80, 70);
   }
   else
   {
-    setScreenPos(70, 35);
+    setPosition(70, 35);
   }
 
-
-  setBackgroundColour(Colour::VIEWBACKGROUND);
   setTitleBarOn(1);
   setTitleText(tr("Timers"));
   setTitleBarColour(Colour::TITLEBARBACKGROUND);
 
-  sl.setSurface(surface);
-  sl.setSurfaceOffset(30, 30 + 5);
-  sl.setDimensions(area.w - 40, area.h - 30 - 15 - 30);
+  sl.setPosition(30, 30 + 5);
+  sl.setSize(area.w - 40, area.h - 30 - 15 - 30);
+  add(&sl);
+}
+
+VTimerList::~VTimerList()
+{
+  Timers::getInstance()->cancelTimer(this, 1);
+  if (recTimerList)
+  {
+    for (UINT i = 0; i < recTimerList->size(); i++)
+    {
+      delete (*recTimerList)[i];
+    }
+
+    recTimerList->clear();
+    delete recTimerList;
+  }
+}
 
+void VTimerList::draw()
+{
   // Draw statics
 
-  draw(); // View::draw
+  TBBoxx::draw();
 
   WSymbol w;
-  w.setSurface(surface);
+  TEMPADD(&w);
 
   w.nextSymbol = WSymbol::UP;
-  w.setSurfaceOffset(20, 385);
+  w.setPosition(20, 385);
   w.draw();
 
   w.nextSymbol = WSymbol::DOWN;
-  w.setSurfaceOffset(50, 385);
+  w.setPosition(50, 385);
   w.draw();
 
   w.nextSymbol = WSymbol::SKIPBACK;
-  w.setSurfaceOffset(85, 385);
+  w.setPosition(85, 385);
   w.draw();
 
   w.nextSymbol = WSymbol::SKIPFORWARD;
-  w.setSurfaceOffset(115, 385);
+  w.setPosition(115, 385);
   w.draw();
 
   drawTextRJ("[ok] = edit", 560, 385, Colour::LIGHTTEXT);
 
   drawClock();
-}
-
-VTimerList::~VTimerList()
-{
-  Timers::getInstance()->cancelTimer(this, 1);
-  if (recTimerList)
-  {
-    for (UINT i = 0; i < recTimerList->size(); i++)
-    {
-      delete (*recTimerList)[i];
-    }
-
-    recTimerList->clear();
-    delete recTimerList;
-  }
+  drawShowing();
+  drawIndicators();
 }
 
 bool VTimerList::load()
@@ -129,10 +146,6 @@ bool VTimerList::load()
     first = 0;
   }
 
-  sl.draw();
-  drawShowing();
-  drawIndicators();
-  ViewMan::getInstance()->updateView(this);
   return true;
 }
 
@@ -184,7 +197,6 @@ void VTimerList::drawIndicators()
     {
       if (flipflop)
       {
-        //rectangle(6, ypos, 18, 16, Colour::RED);
         rectangle(6, ypos, 18, 16, Colour::RED);
         drawText("R", 8, ypos-3, Colour::LIGHTTEXT);
       }
@@ -214,7 +226,7 @@ void VTimerList::timercall(int clientReference)
 
   Message* m = new Message();
   m->message = Message::REDRAW;
-  m->to = ViewMan::getInstance();
+  m->to = BoxStack::getInstance();
   m->from = this;
   m->parameter = (ULONG)&clockRegion;
   Command::getInstance()->postMessageFromOuterSpace(m);
@@ -224,7 +236,7 @@ void VTimerList::timercall(int clientReference)
 
   m = new Message();
   m->message = Message::REDRAW;
-  m->to = ViewMan::getInstance();
+  m->to = BoxStack::getInstance();
   m->from = this;
   m->parameter = (ULONG)&indicatorsRegion;
   Command::getInstance()->postMessageFromOuterSpace(m);
@@ -241,7 +253,7 @@ int VTimerList::handleCommand(int command)
       sl.draw();
       drawShowing();
       drawIndicators();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       return 2;
     }
     case Remote::DF_DOWN:
@@ -251,7 +263,7 @@ int VTimerList::handleCommand(int command)
       sl.draw();
       drawShowing();
       drawIndicators();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       return 2;
     }
     case Remote::SKIPBACK:
@@ -260,7 +272,7 @@ int VTimerList::handleCommand(int command)
       sl.draw();
       drawShowing();
       drawIndicators();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       return 2;
     }
     case Remote::SKIPFORWARD:
@@ -269,28 +281,20 @@ int VTimerList::handleCommand(int command)
       sl.draw();
       drawShowing();
       drawIndicators();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       return 2;
     }
     case Remote::OK:
     {
       RecTimer* recTimer = NULL;
       if (recTimerList) recTimer = (RecTimer*)sl.getCurrentOptionData();
-//      {
-//        int currentOption = sl.getCurrentOption();
-//
-//        for (UINT i = 0; i < recTimerList->size(); i++)
-//        {
-//          recTimer = (*recTimerList)[i];
-//          if (currentOption == recTimer->index) break;
-//        }
-//      }
-
       if (recTimer == NULL) return 2;
 
       VTimerEdit* v = new VTimerEdit(recTimer);
-      ViewMan::getInstance()->add(v);
-      ViewMan::getInstance()->updateView(v);
+      v->setParent(this);
+      v->draw();
+      BoxStack::getInstance()->add(v);
+      BoxStack::getInstance()->update(v);
 
       return 2;
     }
@@ -310,24 +314,82 @@ void VTimerList::processMessage(Message* m)
     if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
       sl.draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
     }
   }
   else if (m->message == Message::MOUSE_LBDOWN)
   {
     if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
-      ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+      BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
     }
     else
     {
       //check if press is outside this view! then simulate cancel
       int x=(m->parameter>>16)-getScreenX();
       int y=(m->parameter&0xFFFF)-getScreenY();
-      if (x<0 || y <0 || x>getWidth() || y>getHeight())
+      if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
       {
-        ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+        BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
       }
     }
   }
+  else if (m->message == Message::DELETE_SELECTED_TIMER)
+  {
+    RecTimer* recTimer = (RecTimer*)sl.getCurrentOptionData();
+    if (recTimer == NULL) return;
+    Log::getInstance()->log("VTimerList", Log::DEBUG, "Got timer to delete");
+
+  
+    ULONG retval = VDR::getInstance()->deleteTimer(recTimer);
+    Log::getInstance()->log("VTimerList", Log::DEBUG, "Got return fron delete timer: %lu", retval);
+    
+    if (retval != 10)
+    {
+      VInfo* errorBox = new VInfo();
+      errorBox->setSize(360, 200);
+      errorBox->createBuffer();
+      if (Video::getInstance()->getFormat() == Video::PAL)
+        errorBox->setPosition(190, 170);
+      else
+        errorBox->setPosition(180, 120);
+
+    
+      if (retval == 1) errorBox->setOneLiner(tr("Timers being edited at VDR, please try later"));
+      else if (retval == 3)  errorBox->setOneLiner(tr("Unable to delete timer - timer is running"));
+      else if (retval == 4)  errorBox->setOneLiner(tr("Error - timer not found at VDR"));
+      else                   errorBox->setOneLiner(tr("Unknown error"));
+
+      errorBox->setExitable();
+      errorBox->setBorderOn(1);
+      errorBox->setTitleBarColour(Colour::DANGER);
+      errorBox->okButton();
+      errorBox->draw();
+      BoxStack::getInstance()->add(errorBox);
+      BoxStack::getInstance()->update(errorBox);
+    }
+    
+    int saveIndex = sl.getCurrentOption();
+    int saveTop = sl.getTopOption();
+     
+    if (recTimerList)
+    {
+      for (UINT i = 0; i < recTimerList->size(); i++)
+      {
+        delete (*recTimerList)[i];
+      }
+
+      recTimerList->clear();
+      delete recTimerList;
+    }
+
+    sl.clear();
+    load();
+
+    sl.hintSetCurrent(saveIndex);
+    sl.hintSetTop(saveTop);
+    draw();
+    BoxStack::getInstance()->update(this);
+  }
 }
+
index 2a251684fdfba1b7636d89fd3e40c59085f32c3b..53e0fa9f4469eab1213f68f7605b23643b46b5f8 100644 (file)
 #include <string.h>
 #include <vector>
 
-#include "view.h"
-#include "wselectlist.h"
-#include "remote.h"
-#include "wsymbol.h"
-#include "viewman.h"
+#include "tbboxx.h"
+#include "timerreceiver.h"
 #include "vdr.h"
-#include "colour.h"
-#include "video.h"
-#include "i18n.h"
-#include "timers.h"
-#include "vtimeredit.h"
+#include "wselectlist.h"
+#include "region.h"
+
+class Message;
 
-class VTimerList : public View, public TimerReceiver
+class VTimerList : public TBBoxx, public TimerReceiver
 {
   public:
     VTimerList();
@@ -47,6 +43,7 @@ class VTimerList : public View, public TimerReceiver
     void timercall(int clientReference);
     void processMessage(Message* m);
     bool load();
+    void draw();
 
   private:
     RecTimerList* recTimerList;
index aff2612ac3df2f6e9c4ad22109cd9132f8232dbd..5d6ccee91ddb725e44f43a2064e9ab2217481df6 100644 (file)
 
 #include "vvideolive.h"
 
+#include "vchannellist.h"
+#include "video.h"
+#include "player.h"
+#include "playerradio.h"
+#include "channel.h"
+#include "vlivebanner.h"
+#include "boxstack.h"
+#include "vchannelselect.h"
+#include "colour.h"
+#include "osd.h"
+#include "vinfo.h"
+#include "command.h"
+#include "i18n.h"
+#include "vepg.h"
+#include "wtextbox.h"
+#include "remote.h"
+#include "vaudioselector.h"
+
 VVideoLive* VVideoLive::instance = NULL;
 
 VVideoLive::VVideoLive(ChannelList* tchanList, ULONG tstreamType, VChannelList* tvchannelList)
 {
   instance = this;
   vdr = VDR::getInstance();
-  viewman = ViewMan::getInstance();
+  boxstack = BoxStack::getInstance();
   video = Video::getInstance();
 
   chanList = tchanList;
@@ -50,9 +68,10 @@ VVideoLive::VVideoLive(ChannelList* tchanList, ULONG tstreamType, VChannelList*
     ((Player*)player)->init();
   }
 
-  create(video->getScreenWidth(), video->getScreenHeight());
+  setSize(video->getScreenWidth(), video->getScreenHeight());
+  createBuffer();
   Colour transparent(0, 0, 0, 0);
-  setBackgroundColour(transparent);
+  fillColour(transparent);
 
   dowss = false;
   char* optionWSS = vdr->configLoad("General", "WSS");
@@ -64,8 +83,8 @@ VVideoLive::VVideoLive(ChannelList* tchanList, ULONG tstreamType, VChannelList*
   Log::getInstance()->log("VVideoLive", Log::DEBUG, "Do WSS: %u", dowss);
 
   wss.setFormat(video->getFormat());
-  wss.setSurface(surface);
   wss.setWide(true);
+  add(&wss);
 
   wssRegion.x = 0;
   wssRegion.y = 6;
@@ -93,11 +112,6 @@ VVideoLive* VVideoLive::getInstance()
   return instance;
 }
 
-void VVideoLive::draw()
-{
-  View::draw();
-}
-
 int VVideoLive::handleCommand(int command)
 {
   switch(command)
@@ -173,21 +187,31 @@ int VVideoLive::handleCommand(int command)
     {
       VChannelSelect* v = new VChannelSelect(this);
       v->draw();
-      viewman->add(v);
-      viewman->updateView(v);
+      boxstack->add(v);
+      boxstack->update(v);
 
       v->handleCommand(command);
 
       return 2;
     }
+    case Remote::GREEN:
+    {
+      if (streamType == VDR::VIDEO)
+      {
+        VAudioSelector* vas = new VAudioSelector(this, (*chanList)[currentChannel], ((Player*)player)->getCurrentAudioChannel());
+        vas->setBackgroundColour(Colour::VIEWBACKGROUND);
+        vas->setPosition(0, getHeight()-200);
+        vas->draw();
+        BoxStack::getInstance()->add(vas);
+        BoxStack::getInstance()->update(vas);        
+      }
+    }
 #ifdef DEV
     case Remote::YELLOW:
     {
-      break;
     }
     case Remote::BLUE:
     {
-      break;
     }
 #endif
   }
@@ -249,7 +273,7 @@ void VVideoLive::channelChange(UCHAR changeType, UINT newData)
   {
     vlb->setChannel((*chanList)[currentChannel]);
     vlb->draw();
-    viewman->updateView(vlb);
+    boxstack->update(vlb);
   }
 
   play();
@@ -266,7 +290,7 @@ void VVideoLive::processMessage(Message* m)
 {
   if (m->message == Message::MOUSE_LBDOWN)
   {
-    ViewMan::getInstance()->handleCommand(Remote::OK); //simulate rok press
+    BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press
   }
   else if (m->message == Message::CHANNEL_CHANGE)
   {
@@ -282,6 +306,11 @@ void VVideoLive::processMessage(Message* m)
     video->setMode(videoMode);
     if (saveUnavailable) showUnavailable(1);
   }
+  else if (m->message == Message::AUDIO_CHANGE_CHANNEL)
+  {
+    Log::getInstance()->log("VVideoLive", Log::DEBUG, "Received change audio channel to %i", m->parameter);
+    ((Player*)player)->setAudioChannel(m->parameter);
+  }
   else if (m->message == Message::PLAYER_EVENT)
   {
     switch(m->parameter)
@@ -312,7 +341,7 @@ void VVideoLive::processMessage(Message* m)
           Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 43");
           wss.setWide(false);
           wss.draw();
-          ViewMan::getInstance()->updateView(this, &wssRegion);
+          BoxStack::getInstance()->update(this, &wssRegion);
         }
         break;
       }
@@ -323,7 +352,7 @@ void VVideoLive::processMessage(Message* m)
           Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 169");
           wss.setWide(true);
           wss.draw();
-          ViewMan::getInstance()->updateView(this, &wssRegion);
+          BoxStack::getInstance()->update(this, &wssRegion);
         }
         break;
       }
@@ -340,8 +369,8 @@ void VVideoLive::doBanner(bool bannerTakesCommands)
   VLiveBanner* vlb = new VLiveBanner(this, (*chanList)[currentChannel], bannerTakesCommands);
 
   vlb->draw();
-  viewman->add(vlb);
-  viewman->updateView(vlb);
+  boxstack->add(vlb);
+  boxstack->update(vlb);
 }
 
 void VVideoLive::doNoSuchChannel()
@@ -359,26 +388,27 @@ void VVideoLive::showUnavailable(int active)
     unavailable = 1;
 
     unavailableView = new VInfo();
-    unavailableView->create(400, 200);
+    unavailableView->setSize(400, 200);
+    unavailableView->createBuffer();
     if (video->getFormat() == Video::PAL)
     {
-      unavailableView->setScreenPos(170, 200);
+      unavailableView->setPosition(170, 200);
     }
     else
     {
-      unavailableView->setScreenPos(160, 150);
+      unavailableView->setPosition(160, 150);
     }
     unavailableView->setTitleText((*chanList)[currentChannel]->name);
     unavailableView->setOneLiner(tr("Channel unavailable"));
     unavailableView->setDropThrough();
     unavailableView->draw();
-    viewman->add(unavailableView);
-    viewman->updateView(unavailableView);
+    boxstack->add(unavailableView);
+    boxstack->update(unavailableView);
   }
   else
   {
     unavailable = 0;
-    viewman->removeView(unavailableView);
+    boxstack->remove(unavailableView);
     unavailableView = NULL;
   }
 }
@@ -419,7 +449,7 @@ void VVideoLive::play(int noShowVLB)
 void VVideoLive::stop(int noRemoveVLB)
 {
   if (unavailable) return;
-  if (!noRemoveVLB && VLiveBanner::getInstance()) viewman->removeView(VLiveBanner::getInstance()); // if live banner is present, remove it. won't cause damage if its not present
+  if (!noRemoveVLB && VLiveBanner::getInstance()) boxstack->remove(VLiveBanner::getInstance()); // if live banner is present, remove it. won't cause damage if its not present
 
   if (streamType == VDR::RADIO)
   {
@@ -465,8 +495,8 @@ void VVideoLive::showEPG()
   VEpg* vepg = new VEpg(this, currentChannel, streamType);
   vepg->draw();
 
-  viewman->add(vepg);
-  viewman->updateView(vepg);
+  boxstack->add(vepg);
+  boxstack->update(vepg);
 }
 
 void VVideoLive::toggleChopSides()
@@ -484,3 +514,4 @@ void VVideoLive::toggleChopSides()
     video->setMode(Video::NORMAL);
   }
 }
+
index 6a8354f5536a3703425399be5f5851546841c1a6..be76ab554dd93e2d51fc8371d83cb4f30406092a 100644 (file)
 #include <stdio.h>
 #include <vector>
 
-#include "view.h"
-#include "player.h"
-#include "playerradio.h"
-#include "vdr.h"
-#include "channel.h"
-#include "vlivebanner.h"
-#include "viewman.h"
-#include "vchannelselect.h"
-#include "colour.h"
-#include "osd.h"
-#include "vinfo.h"
-#include "command.h"
-#include "i18n.h"
-#include "vepg.h"
-#include "wtextbox.h"
+#include "boxx.h"
+#include "region.h"
 #include "wwss.h"
+#include "vdr.h"
 
 class VEpg;
 class VChannelList;
 class VLiveBanner;
+class VInfo;
+class Video;
+class VChannelList;
+class BoxStack;
 
-class VVideoLive : public View
+class VVideoLive : public Boxx
 {
   public:
     VVideoLive(ChannelList* chanList, ULONG streamType, VChannelList* vchannelList);
     ~VVideoLive();
     static VVideoLive* getInstance();
-    void draw();
     int handleCommand(int command);
     void processMessage(Message* m);
     void streamEnd(); // from command
@@ -73,7 +64,7 @@ class VVideoLive : public View
 
   private:
     static VVideoLive* instance;
-  //  ViewMan* viewman;
+    BoxStack* boxstack;
     VDR* vdr;
     Video* video;
     void* player; // HA HA FIXME
index 6e7c4a8d09682c0b91a87771d487243876ca82ae..e85ad5e9155b78071a9a15bc7f54e07fc536fb02 100644 (file)
 
 #include "vvideorec.h"
 
+#include "command.h"
+#include "osd.h"
+#include "wsymbol.h"
+#include "audio.h"
+#include "vdr.h"
+#include "video.h"
+#include "timers.h"
+#include "player.h"
+#include "recording.h"
+#include "vaudioselector.h"
+#include "message.h"
+#include "remote.h"
+#include "boxstack.h"
+#include "vinfo.h"
+#include "i18n.h"
+
 VVideoRec::VVideoRec(Recording* rec)
 {
-  viewman = ViewMan::getInstance();
+  boxstack = BoxStack::getInstance();
   vdr = VDR::getInstance();
   video = Video::getInstance();
   timers = Timers::getInstance();
   vas = NULL;
+  vsummary = NULL;
 
   player = new Player(Command::getInstance(), this, true);
   player->init();
@@ -62,7 +79,8 @@ VVideoRec::VVideoRec(Recording* rec)
 
   Log::getInstance()->log("VVideoRec", Log::DEBUG, "SM: %u EM: %u", startMargin, endMargin);
 
-  create(video->getScreenWidth(), video->getScreenHeight());
+  setSize(video->getScreenWidth(), video->getScreenHeight());
+  createBuffer();
   transparent.set(0, 0, 0, 0);
   setBackgroundColour(transparent);
 
@@ -94,15 +112,9 @@ VVideoRec::VVideoRec(Recording* rec)
   Log::getInstance()->log("VVideoRec", Log::DEBUG, "Do WSS: %u", dowss);
 
   wss.setFormat(video->getFormat());
-  wss.setSurface(surface);
   wss.setWide(true);
+  add(&wss);
 
-/*
-  wssRegion.x = 0;
-  wssRegion.y = 6;
-  wssRegion.w = video->getScreenWidth();
-  wssRegion.h = 2;
-*/
   wssRegion.x = 0;
   wssRegion.y = 0;
   wssRegion.w = video->getScreenWidth();
@@ -111,12 +123,16 @@ VVideoRec::VVideoRec(Recording* rec)
 
 VVideoRec::~VVideoRec()
 {
+  Log::getInstance()->log("VVideoRec", Log::DEBUG, "Entering vvideorec destructor");
+
   if (vas)
   {
-    viewman->removeView(vas);
+    boxstack->remove(vas);
     vas = NULL;
   }
 
+  if (vsummary) delete vsummary;
+
   if (playing) stopPlay();
   video->setDefaultAspect();
 
@@ -129,11 +145,6 @@ VVideoRec::~VVideoRec()
   // rec->recInfo->resumePoint - this will fix the ~10s offset problem as well
 }
 
-void VVideoRec::draw()
-{
-  View::draw();
-}
-
 void VVideoRec::go(bool resume)
 {
   ULONG startFrameNum;
@@ -167,15 +178,16 @@ void VVideoRec::go(bool resume)
     Message* m = new Message();
     m->message = Message::CLOSE_ME;
     m->from = this;
-    m->to = viewman;
+    m->to = boxstack;
     Command::getInstance()->postMessageNoLock(m);
 
     VInfo* vi = new VInfo();
-    vi->create(400, 150);
+    vi->setSize(400, 150);
+    vi->createBuffer();
     if (video->getFormat() == Video::PAL)
-      vi->setScreenPos(170, 200);
+      vi->setPosition(170, 200);
     else
-      vi->setScreenPos(160, 150);
+      vi->setPosition(160, 150);
     vi->setExitable();
     vi->setBorderOn(1);
     vi->setTitleBarOn(0);
@@ -184,7 +196,7 @@ void VVideoRec::go(bool resume)
 
     m = new Message();
     m->message = Message::ADD_VIEW;
-    m->to = viewman;
+    m->to = boxstack;
     m->parameter = (ULONG)vi;
     Command::getInstance()->postMessageNoLock(m);
   }
@@ -201,8 +213,15 @@ int VVideoRec::handleCommand(int command)
       return 2;
     }
 
-    case Remote::STOP:
     case Remote::BACK:
+    {
+      if (vsummary)
+      {
+        removeSummary();
+        return 2;
+      }
+    } // DROP THROUGH
+    case Remote::STOP:
     case Remote::MENU:
     {
       if (playing) stopPlay();
@@ -239,6 +258,17 @@ int VVideoRec::handleCommand(int command)
       doBar(0);
       return 2;
     }
+    case Remote::RED:
+    {
+      if (vsummary) removeSummary();
+      else doSummary();
+      return 2;
+    }
+    case Remote::GREEN:
+    {
+      doAudioSelector();
+      return 2;
+    }
     case Remote::YELLOW:
     {
       if (myRec->hasMarks())
@@ -299,11 +329,6 @@ int VVideoRec::handleCommand(int command)
       player->skipForward(10);
       return 2;
     }
-    case Remote::GREEN:
-    {
-      doAudioSelector();
-      return 2;
-    }
     case Remote::FULL:
     case Remote::TV:
     {
@@ -313,6 +338,12 @@ int VVideoRec::handleCommand(int command)
 
     case Remote::OK:
     {
+      if (vsummary)
+      {
+        removeSummary();
+        return 2;
+      }
+      
       if (barShowing) removeBar();
       else doBar(0);
       return 2;
@@ -330,8 +361,8 @@ int VVideoRec::handleCommand(int command)
     case Remote::NINE:  player->jumpToPercent(90); doBar(0);  return 2;
 
 #ifdef DEV
-    case Remote::RED:
-    {
+//    case Remote::RED:
+//    {
       //Don't use RED for anything. It will eventually be recording summary
 
       //player->test1();
@@ -343,12 +374,12 @@ int VVideoRec::handleCommand(int command)
       Video::getInstance()->setPosition(170, 5);
       VEpg* vepg = new VEpg(NULL, 0);
       vepg->draw();
-      ViewMan::getInstance()->add(vepg);
-      ViewMan::getInstance()->updateView(vepg);
+      BoxStack::getInstance()->add(vepg);
+      BoxStack::getInstance()->update(vepg);
       */
 
-      return 2;
-    }
+//      return 2;
+//    }
 
 #endif
 
@@ -368,7 +399,7 @@ void VVideoRec::processMessage(Message* m)
 
     if (!barShowing)
     {
-      ViewMan::getInstance()->handleCommand(Remote::OK); //simulate rok press
+      BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press
     }
     else if (barRegion.x<=x && barRegion.y<=y && (barRegion.x+barRegion.w)>=x && (barRegion.y+barRegion.h)>=y)
     {
@@ -426,7 +457,7 @@ void VVideoRec::processMessage(Message* m)
     }
     else
     {
-      ViewMan::getInstance()->handleCommand(Remote::OK); //simulate rok press
+      BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press
     }
   }
   else if (m->from == player)
@@ -459,7 +490,7 @@ void VVideoRec::processMessage(Message* m)
           Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 43");
           wss.setWide(false);
           wss.draw();
-          viewman->updateView(this, &wssRegion);
+          boxstack->update(this, &wssRegion);
         }
         break;
       }
@@ -470,7 +501,7 @@ void VVideoRec::processMessage(Message* m)
           Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 169");
           wss.setWide(true);
           wss.draw();
-          viewman->updateView(this, &wssRegion);
+          boxstack->update(this, &wssRegion);
         }
         break;
       }
@@ -541,25 +572,18 @@ void VVideoRec::doAudioSelector()
       availableAc3AudioChannels = player->getDemuxerAc3AudioChannels();
   }
 
-  vas = new VAudioSelector(this, availableMpegAudioChannels,availableAc3AudioChannels, currentAudioChannel, myRec->recInfo);
+  vas = new VAudioSelector(this, availableMpegAudioChannels, availableAc3AudioChannels, currentAudioChannel, myRec->recInfo);
   vas->setBackgroundColour(barBlue);
-  if (video->getFormat() == Video::PAL)
-  {
-//    vas->setScreenPos(62, barRegion.y - 120);
-    vas->setScreenPos(0, barRegion.y - 120);
-  }
-  else
-  {
-//    vas->setScreenPos(57, barRegion.y - 120);
-    vas->setScreenPos(0, barRegion.y - 120);
-  }
+  vas->setPosition(0, barRegion.y - 120);
+
+// pal 62, ntsc 57
 
   barVasHold = true;
   doBar(0);
 
   vas->draw();
-  viewman->add(vas);
-  viewman->updateView(vas);
+  boxstack->add(vas);
+  boxstack->update(vas);
 }
 
 void VVideoRec::doBar(int action)
@@ -585,9 +609,9 @@ void VVideoRec::doBar(int action)
   */
 
   WSymbol w;
-  w.setSurface(surface);
+  TEMPADD(&w);
   w.nextSymbol = 0;
-  w.setSurfaceOffset(barRegion.x + 66, barRegion.y + 16);
+  w.setPosition(barRegion.x + 66, barRegion.y + 16);
 
   UCHAR playerState = 0;
 
@@ -624,7 +648,7 @@ void VVideoRec::doBar(int action)
 
   drawBarClocks();
 
-  viewman->updateView(this, &barRegion);
+  boxstack->update(this, &barRegion);
 
   timers->cancelTimer(this, 1);
 
@@ -654,7 +678,7 @@ void VVideoRec::timercall(int clientReference)
       drawBarClocks();
       Message* m = new Message();
       m->message = Message::REDRAW;
-      m->to = ViewMan::getInstance();
+      m->to = BoxStack::getInstance();
       m->from = this;
       m->parameter = (ULONG)&barRegion;
       Command::getInstance()->postMessageFromOuterSpace(m);
@@ -806,8 +830,44 @@ void VVideoRec::removeBar()
 
   Message* m = new Message();
   m->message = Message::REDRAW;
-  m->to = ViewMan::getInstance();
+  m->to = BoxStack::getInstance();
   m->from = this;
   m->parameter = (ULONG)&barRegion;
   Command::getInstance()->postMessageFromOuterSpace(m);
 }
+
+void VVideoRec::doSummary()
+{
+  vsummary = new VInfo();
+  vsummary->setTitleText(myRec->getProgName());
+  vsummary->setBorderOn(1);
+  vsummary->setExitable();
+  if (myRec->recInfo->summary) vsummary->setMainText(myRec->recInfo->summary);
+  else vsummary->setMainText(tr("Summary unavailable"));
+  if (Video::getInstance()->getFormat() == Video::PAL)
+  {
+    vsummary->setPosition(120, 130);
+  }
+  else
+  {
+    vsummary->setPosition(110, 90);
+  }
+  vsummary->setSize(510, 270);
+  add(vsummary);
+  vsummary->draw();
+
+  BoxStack::getInstance()->update(this);
+}
+
+void VVideoRec::removeSummary()
+{
+  if (vsummary)
+  {
+    remove(vsummary);
+    delete vsummary;
+    vsummary = NULL;
+    draw();
+    BoxStack::getInstance()->update(this);
+  }
+}
+
index 09014363103c4c016af24c3bf979b766cc5fcb17..e51f071d2a98dbdb483e45344d9831ef9c23302f 100644 (file)
 
 #include <stdio.h>
 
-#include "video.h"
-#include "view.h"
-#include "player.h"
-#include "vdr.h"
-#include "recording.h"
-#include "command.h"
-#include "colour.h"
-#include "osd.h"
-#include "timers.h"
+#include "boxx.h"
 #include "timerreceiver.h"
-#include "message.h"
 #include "wwss.h"
-#include "vaudioselector.h"
-
-//#include "vepg.h" // for testing EPG in NTSC with a NTSC test video
+#include "region.h"
+#include "colour.h"
 
+class VDR;
+class Video;
 class Timers;
+class Player;
+class Recording;
 class VAudioSelector;
+class Message;
+class BoxStack;
+class VInfo;
+
+//#include "vepg.h" // for testing EPG in NTSC with a NTSC test video
 
-class VVideoRec : public View, public TimerReceiver
+class VVideoRec : public Boxx, public TimerReceiver
 {
   public:
     VVideoRec(Recording* rec);
     ~VVideoRec();
-    void draw();
     int handleCommand(int command);
     void go(bool resume);
 
@@ -55,7 +53,7 @@ class VVideoRec : public View, public TimerReceiver
     void processMessage(Message* m);
 
   private:
-   // ViewMan* viewman;
+    BoxStack* boxstack;
     VDR* vdr;
     Video* video;
     Timers* timers;
@@ -82,6 +80,8 @@ class VVideoRec : public View, public TimerReceiver
     void drawBarClocks();
     void stopPlay();
     void removeBar();
+    void doSummary();
+    void removeSummary();
     Region barRegion;
     Region clocksRegion;
 
@@ -91,6 +91,8 @@ class VVideoRec : public View, public TimerReceiver
     Wwss wss;
     Region wssRegion;
     bool dowss;
+    
+    VInfo* vsummary;
 };
 
 #endif
index d7e684db62948d13eb6dbab5004da900e7f4a94a..df3316b16833e0b2a825ee45dcfd3c217e9c42ec 100644 (file)
 
 #include "vvolume.h"
 
+#include "remote.h"
+#include "audio.h"
+#include "wsymbol.h"
+#include "colour.h"
+#include "video.h"
+#include "timers.h"
+#include "boxstack.h"
+#include "command.h"
+
 VVolume::VVolume()
 {
   displayVolume = Audio::getInstance()->getVolume();
 
-  create(227, 31);
+  setSize(227, 31);
+  createBuffer();
   if (Video::getInstance()->getFormat() == Video::PAL)
   {
-    setScreenPos(100, 499);
+    setPosition(100, 499);
   }
   else
   {
-    setScreenPos(90, 400);
+    setPosition(90, 400);
   }
-
-  setBackgroundColour(Colour::VIEWBACKGROUND);
 }
 
 VVolume::~VVolume()
@@ -45,12 +53,14 @@ VVolume::~VVolume()
 
 void VVolume::draw()
 {
-  View::draw();
+  Boxx::draw();
+
+  fillColour(Colour::VIEWBACKGROUND);
 
   WSymbol w;
-  w.setSurface(surface);
+  TEMPADD(&w);
   w.nextSymbol = WSymbol::VOLUME2;
-  w.setSurfaceOffset(3, 10);
+  w.setPosition(3, 10);
   w.draw();
 
   int i = 0;
@@ -58,14 +68,14 @@ void VVolume::draw()
   for(; i < displayVolume; i++)
   {
     w.nextSymbol = WSymbol::VOLBAR;
-    w.setSurfaceOffset(40 + (i * 9), 3);
+    w.setPosition(40 + (i * 9), 3);
     w.draw();
   }
 
   for(; i < 20; i++)
   {
     w.nextSymbol = WSymbol::VOLDOT;
-    w.setSurfaceOffset(40 + (i * 9), 13);
+    w.setPosition(40 + (i * 9), 13);
     w.draw();
   }
 
@@ -77,7 +87,7 @@ void VVolume::timercall(int clientReference)
   // delete me!
   Message* m = new Message(); // Delete self
   m->message = Message::CLOSE_ME;
-  m->to = ViewMan::getInstance();
+  m->to = BoxStack::getInstance();
   m->from = this;
   Command::getInstance()->postMessageFromOuterSpace(m);
 }
@@ -91,7 +101,7 @@ int VVolume::handleCommand(int command)
     {
       displayVolume = Audio::getInstance()->volumeDown();
       draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       // handled
       return 2;
     }
@@ -100,7 +110,7 @@ int VVolume::handleCommand(int command)
     {
       displayVolume = Audio::getInstance()->volumeUp();
       draw();
-      ViewMan::getInstance()->updateView(this);
+      BoxStack::getInstance()->update(this);
       // handled
       return 2;
     }
index ce24717c581b62bcb2d80517dc82dedfa3dd6882..80dd518a2a25ed917f8d529e0d64ae3d4d927216 100644 (file)
--- a/vvolume.h
+++ b/vvolume.h
 
 #include <stdio.h>
 
-#include "view.h"
-#include "remote.h"
-#include "audio.h"
-#include "wsymbol.h"
-#include "colour.h"
-#include "video.h"
+#include "boxx.h"
 #include "timerreceiver.h"
-#include "timers.h"
-#include "viewman.h"
 
-class VVolume : public View, public TimerReceiver
+class VVolume : public Boxx, public TimerReceiver
 {
   public:
     VVolume();
diff --git a/vwallpaper.cc b/vwallpaper.cc
deleted file mode 100644 (file)
index c432340..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-    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 "vwallpaper.h"
-
-VWallpaper::VWallpaper()
-{
-
-}
-
-VWallpaper::~VWallpaper()
-{
-}
-
-void VWallpaper::init(char* name)
-{
-  Video* video = Video::getInstance();
-  create(video->getScreenWidth(), video->getScreenHeight());
-
-  jpeg.init(name);
-  jpeg.setSurface(surface);
-}
-
-void VWallpaper::draw()
-{
-  View::draw();
-  jpeg.draw();
-}
diff --git a/vwallpaper.h b/vwallpaper.h
deleted file mode 100644 (file)
index 721c73a..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-    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 VWALLPAPER_H
-#define VWALLPAPER_H
-
-#include <stdio.h>
-#include <string.h>
-
-#include "view.h"
-#include "wjpeg.h"
-
-#include "osd.h"
-#include "surface.h"
-#include "video.h"
-
-class VWallpaper : public View
-{
-  public:
-    VWallpaper();
-    ~VWallpaper();
-
-    void init(char* file);
-
-    void draw();
-
-  private:
-    Surface* wallpaperSurface;
-    WJpeg jpeg;
-};
-
-#endif
index b2bc219f6a730445edb5d90e7cf5b711802b49d0..2f5b31f9a357b48521d533ebbd67e76a409ce517 100644 (file)
 
 #include "vwelcome.h"
 
+#include "remote.h"
+#include "vdr.h"
+#include "vchannellist.h"
+#include "vrecordinglist.h"
+#include "vtimerlist.h"
+#include "command.h"
+#include "message.h"
+#include "colour.h"
+#include "video.h"
+#include "i18n.h"
+#include "timers.h"
+#include "vscreensaver.h"
+#include "vmedialist.h"
+#include "boxstack.h"
+#include "vopts.h"
+
 VWelcome::VWelcome()
 {
-  viewman = ViewMan::getInstance();
+  boxstack = BoxStack::getInstance();
 
   clockRegion.x = 400;
   clockRegion.y = 0;
   clockRegion.w = 60;
   clockRegion.h = 30;
 
-  create(460, 220);
+  setSize(460, 220);
+  createBuffer();
   if (Video::getInstance()->getFormat() == Video::PAL)
   {
-    setScreenPos(140, 170);
+    setPosition(140, 170);
   }
   else
   {
-    setScreenPos(130, 140);
+    setPosition(130, 140);
   }
 
-  setBackgroundColour(Colour::VIEWBACKGROUND);
   setTitleBarOn(1);
   setTitleBarColour(Colour::TITLEBARBACKGROUND);
 
-  sl.setSurface(surface);
-  sl.setSurfaceOffset(20, 40);
-  sl.setDimensions(200, 160);
+  sl.setPosition(20, 40);
+  sl.setSize(200, 160);
+  add(&sl);
 
   setTitleText(tr("Welcome"));
   sl.addOption(tr("1. Live TV"), 1, 1);
@@ -56,8 +72,9 @@ VWelcome::VWelcome()
   sl.addOption(tr("6. Options"), 6, 0);
   sl.addOption(tr("7. Reboot"), 7, 0);
 
-  jpeg.setSurface(surface);
-  jpeg.setSurfaceOffset(240, 60);
+  jpeg.setPosition(240, 60);
+  jpeg.init("/vdr.jpg");
+  add(&jpeg);
 }
 
 VWelcome::~VWelcome()
@@ -67,10 +84,7 @@ VWelcome::~VWelcome()
 
 void VWelcome::draw()
 {
-  View::draw();
-  sl.draw();
-  jpeg.init("/vdr.jpg");
-  jpeg.draw();
+  TBBoxx::draw();
   drawClock();
 }
 
@@ -97,10 +111,10 @@ void VWelcome::drawClock()
 void VWelcome::timercall(int clientReference)
 {
   drawClock();
-  // Put updateView through master mutex since viewman is not mutex protected
+  // Put updateView through master mutex since boxstack is not mutex protected
   Message* m = new Message();
   m->message = Message::REDRAW;
-  m->to = ViewMan::getInstance();
+  m->to = boxstack;
   m->from = this;
   m->parameter = (ULONG)&clockRegion;
   Command::getInstance()->postMessageFromOuterSpace(m);
@@ -115,7 +129,7 @@ int VWelcome::handleCommand(int command)
     {
       sl.up();
       sl.draw();
-      viewman->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::DF_DOWN:
@@ -123,7 +137,7 @@ int VWelcome::handleCommand(int command)
     {
       sl.down();
       sl.draw();
-      viewman->updateView(this);
+      boxstack->update(this);
       return 2;
     }
     case Remote::ONE:
@@ -204,9 +218,9 @@ int VWelcome::handleCommand(int command)
     case Remote::NINE:
     {
       VScreensaver* vscreensaver = new VScreensaver();
-      viewman->add(vscreensaver);
+      boxstack->add(vscreensaver);
       vscreensaver->draw();
-//      viewman->updateView(vscreensaver);
+//      boxstack->update(vscreensaver);
 
       return 2;
     }
@@ -232,8 +246,8 @@ void VWelcome::doChannelsList()
     vchan->setList(chanList);
 
     vchan->draw();
-    viewman->add(vchan);
-    viewman->updateView(vchan);
+    boxstack->add(vchan);
+    boxstack->update(vchan);
   }
   else
   {
@@ -251,8 +265,8 @@ void VWelcome::doRadioList()
     vchan->setList(chanList);
 
     vchan->draw();
-    viewman->add(vchan);
-    viewman->updateView(vchan);
+    boxstack->add(vchan);
+    boxstack->update(vchan);
   }
   else
   {
@@ -264,8 +278,8 @@ void VWelcome::doRecordingsList()
 {
   VRecordingList* vrec = new VRecordingList();
   vrec->draw();
-  viewman->add(vrec);
-  viewman->updateView(vrec);
+  boxstack->add(vrec);
+  boxstack->update(vrec);
 
   if (!vrec->load())
   {
@@ -277,24 +291,33 @@ void VWelcome::doMediaList()
 {
   VMediaList::createList();
 }
+
 void VWelcome::doTimersList()
 {
   VTimerList* vtl = new VTimerList();
-  viewman->add(vtl);
-  viewman->updateView(vtl);
-
   if (!vtl->load())
   {
+    delete vtl;
     Command::getInstance()->connectionLost();
+    return;
   }
+  
+  vtl->draw();
+  boxstack->add(vtl);
+  boxstack->update(vtl);
 }
 
 void VWelcome::doOptions()
 {
-  VOptionsMenu* voptionsmenu = new VOptionsMenu();
-  voptionsmenu->draw();
-  viewman->add(voptionsmenu);
-  viewman->updateView(voptionsmenu);
+//  VOptionsMenu* voptionsmenu = new VOptionsMenu();
+//  voptionsmenu->draw();
+//  boxstack->add(voptionsmenu);
+//  boxstack->updateView(voptionsmenu);
+
+  VOpts* vopts = new VOpts();
+  vopts->draw();
+  boxstack->add(vopts);
+  boxstack->update(vopts);
 }
 
 void VWelcome::processMessage(Message* m)
@@ -304,14 +327,14 @@ void VWelcome::processMessage(Message* m)
     if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
       sl.draw();
-      viewman->updateView(this);
+      boxstack->update(this);
     }
   }
   else if (m->message == Message::MOUSE_LBDOWN)
   {
     if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
-      ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+      boxstack->handleCommand(Remote::OK); //simulate OK press
     }
   }
 }
index 56f7b146bcb083a47ccaa08eff693d73973ce6e2..d078cb41e339ce04dbb4d0887a03fbd140c9a1b4 100644 (file)
 #include <stdio.h>
 #include <string.h>
 
-#include "view.h"
-#include "remote.h"
+#include "tbboxx.h"
+#include "timerreceiver.h"
 #include "wselectlist.h"
 #include "wjpeg.h"
-#include "viewman.h"
-#include "vdr.h"
-#include "vchannellist.h"
-#include "vrecordinglist.h"
-#include "vtimerlist.h"
-#include "command.h"
-#include "message.h"
-#include "colour.h"
-#include "video.h"
-#include "voptionsmenu.h"
-#include "i18n.h"
-#include "timers.h"
-#include "vscreensaver.h"
-#include "vmedialist.h"
-
-class VWelcome : public View, public TimerReceiver
+#include "region.h"
+
+class Message;
+class BoxStack;
+
+class VWelcome : public TBBoxx, public TimerReceiver
 {
   public:
     VWelcome();
     ~VWelcome();
 
+    void create();
+
     int handleCommand(int command);
     void processMessage(Message* m);
     void draw();
@@ -58,7 +50,7 @@ class VWelcome : public View, public TimerReceiver
     WSelectList sl;
     WJpeg jpeg;
 
-   // ViewMan* viewman;
+    BoxStack* boxstack;
 
     void doChannelsList();
     void doRadioList();
index e638c9aace96fba740dc11798c53a5f8d61b3c67..03faf470496bc65b2a970780461691178f22ce92 100644 (file)
 
 #include "wbutton.h"
 
+#include "colour.h"
+
 WButton::WButton()
 {
   int fontHeight = Surface::getFontHeight();
-  setDimensions(70, fontHeight);
+  setSize(70, fontHeight);
 
   mytext = NULL;
   active = 0;
   tag = 0;
+  dimmed = false;
 }
 
 WButton::~WButton()
@@ -35,7 +38,7 @@ WButton::~WButton()
   if (mytext) delete[] mytext;
 }
 
-void WButton::setText(char* takeText)
+void WButton::setText(const char* takeText)
 {
   int length = strlen(takeText);
   mytext = new char[length + 1];
@@ -44,12 +47,25 @@ void WButton::setText(char* takeText)
 
 void WButton::setActive(UCHAR tactive)
 {
+  dimmed = false;
   active = tactive;
 }
 
+void WButton::dim()
+{
+  // a bolt on for now - an active but dimmed state
+  dimmed = true;
+  active = false;
+}
+
 void WButton::draw()
 {
-  if (active)
+  if (dimmed)
+  {
+    fillColour(Colour::BLACK);
+    drawText(mytext, 0, 0, Colour::SELECTHIGHLIGHT);
+  }
+  else if (active)
   {
     fillColour(Colour::SELECTHIGHLIGHT);
     drawText(mytext, 0, 0, Colour::DARKTEXT);
@@ -71,23 +87,29 @@ int WButton::getTag()
   return tag;
 }
 
+// Sorry, I've broken these in the boxx upgrade - chris
+
 bool WButton::mouseMove(int x, int y)
 {
+/*
   if ((x-offsetX)>=area.x && (y-offsetY)>=area.y
     && (x-offsetX)<=area.w && (y-offsetY)<=area.h && !active)
   {
     setActive(1);
     return true;
   }
+*/
   return false;
 }
 
 bool WButton::mouseLBDOWN(int x, int y)
 {
+/*
   if ((x-offsetX)>=area.x && (y-offsetY)>=area.y
     && (x-offsetX)<=area.w && (y-offsetY)<=area.h && active)
   {
     return true;
   }
+*/
   return false;
 }
index 14461aa38780c3f808ce004cbe5f61502b6a5b70..b84f3e19e1ead60e8d114d2d47afb45e189e2a83 100644 (file)
--- a/wbutton.h
+++ b/wbutton.h
 #include <string.h>
 
 #include "defines.h"
-#include "widget.h"
-#include "colour.h"
+#include "boxx.h"
 
-class WButton : public Widget
+class WButton : public Boxx
 {
   public:
     WButton();
     ~WButton();
-    void setText(char* text);
+    void setText(const char* text);
     void setActive(UCHAR tactive);
+    void dim();
     void draw();
     void setTag(int tag);
     int getTag();
@@ -44,6 +44,7 @@ class WButton : public Widget
 
   private:
     UCHAR active;
+    bool dimmed;
 
     char* mytext;
     int tag;
diff --git a/widget.cc b/widget.cc
deleted file mode 100644 (file)
index 757ce56..0000000
--- a/widget.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-    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 "widget.h"
-
-Widget::Widget()
-{
-  backgroundColour = Colour::VIEWBACKGROUND;
-}
-
-Widget::~Widget()
-{
-}
-
-void Widget::setSurface(Surface* tsurface)
-{
-  surface = tsurface;
-}
-
-void Widget::setDimensions(int twidth, int theight)
-{
-  area.w = twidth;
-  area.h = theight;
-}
-
-void Widget::setBackgroundColour(Colour& Tcolour)
-{
-  backgroundColour = Tcolour;
-}
-
-int Widget::getOffsetY()
-{
-  return offsetY;
-}
-
-int Widget::getOffsetX()
-{
-  return offsetX;
-}
-
-bool Widget::mouseMove(int x, int y)
-{
-  return false;
-}
-
-bool Widget::mouseLBDOWN(int x, int y)
-{
-  return false;
-}
diff --git a/widget.h b/widget.h
deleted file mode 100644 (file)
index a2d01bb..0000000
--- a/widget.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-    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 WIDGET_H
-#define WIDGET_H
-
-#include "log.h"
-#include "box.h"
-#include "defines.h"
-
-// Abstract
-class Widget : public Box
-{
-  public:
-    Widget();
-    virtual ~Widget();
-    virtual void draw()=0;
-    void setSurface(Surface* tsurface);
-    void setDimensions(int width, int height);
-    void setBackgroundColour(Colour& colour);
-    int getOffsetY();
-    int getOffsetX();
-
-    virtual bool mouseMove(int x, int y);
-    virtual bool mouseLBDOWN(int x, int y);
-
-  private:
-
-  protected:
-    Colour backgroundColour;
-};
-
-#endif
index 31ce101491d00390474e8419f956ff24f694239f..882259e68f965f102892ca4792925f792b7f9659 100644 (file)
@@ -39,7 +39,7 @@
 #include "audiowin.h"
 #include "vdr.h"
 #include "osdwin.h"
-#include "viewman.h"
+#include "boxstack.h"
 #include "command.h"
 
 void sighandler(int signalReceived);
@@ -53,7 +53,7 @@ Mtd* mtd;
 Led* led;
 Osd* osd;
 Timers* timers;
-ViewMan* viewman;
+BoxStack* boxstack;
 Command* command;
 VDR* vdr;
 Video* video;
@@ -144,10 +144,10 @@ INT WINAPI WinMain( HINSTANCE hinst , HINSTANCE previnst, LPSTR cmdline, int cmd
   vdr        = new VDR();
   video      = new VideoWin();
   audio      = new AudioWin();
-  viewman    = new ViewMan();
+  boxstack   = new BoxStack();
   command    = new Command();
 
-  if (!logger || !remote || !mtd || !led || !osd || !video || !audio || !viewman || !command)
+  if (!logger || !remote || !mtd || !led || !osd || !video || !audio || !boxstack || !command)
   {
     ERROR_MSG("Could not create objects. Memory problems?\n");
     shutdown(1);
@@ -281,14 +281,14 @@ INT WINAPI WinMain( HINSTANCE hinst , HINSTANCE previnst, LPSTR cmdline, int cmd
   return 0;
   }
 
-  success = viewman->init();
+  success = boxstack->init();
   if (success)
   {
-    logger->log("Core", Log::INFO, "ViewMan module initialised");
+    logger->log("Core", Log::INFO, "BoxStack module initialised");
   }
   else
   {
-    logger->log("Core", Log::EMERG, "ViewMan module failed to initialise");
+    logger->log("Core", Log::EMERG, "BoxStack module failed to initialise");
     shutdown(1);
   WSACleanup();
   return 0;
@@ -659,7 +659,7 @@ LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam)
       Message *mousemes=new Message();
       mousemes->message=Message::MOUSE_MOVE;
       mousemes->from=NULL;
-      mousemes->to=ViewMan::getInstance();
+      mousemes->to=BoxStack::getInstance();
       mousemes->parameter=(mpos.x & 0xFFFF)<< 16| (mpos.y & 0xFFFF);
       mousemes->tag=0;
       //command->postMessageFromOuterSpace(mousemes);
@@ -692,7 +692,7 @@ LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam)
       Message *mousemes=new Message();
       mousemes->message=Message::MOUSE_LBDOWN;
       mousemes->from=NULL;
-      mousemes->to=ViewMan::getInstance();
+      mousemes->to=BoxStack::getInstance();
       mousemes->parameter=(mpos.x & 0xFFFF)<< 16| (mpos.y & 0xFFFF);
       mousemes->tag=0;
       command->postMessageFromOuterSpace(mousemes);
@@ -786,11 +786,11 @@ bool InitApp(HINSTANCE hinst,int cmdshow) {
 
 void shutdown(int code)
 {
-  if (viewman)
+  if (boxstack)
   {
-    viewman->shutdown();
-    delete viewman;
-    logger->log("Core", Log::NOTICE, "ViewMan module shut down");
+    boxstack->shutdown();
+    delete boxstack;
+    logger->log("Core", Log::NOTICE, "BoxStack module shut down");
   }
 
   if (command) // shut down command here in case views have posted messages
@@ -878,4 +878,5 @@ ULLONG htonll(ULLONG a)
   return (((ULLONG)htonl((ULONG)((a<<32)>> 32))<<32)
     |(ULONG)htonl(((ULONG) (a >> 32))));
 }
-#endif
\ No newline at end of file
+#endif
+
index 4e750a041e7ee298124ba9825cc2832d4ca9cd08..4b1f55d70ef10c7b28d592c3a08dfea7cb0b60f5 100644 (file)
--- a/wjpeg.cc
+++ b/wjpeg.cc
 
 #include "wjpeg.h"
 #include <setjmp.h>
-#include "i18n.h"
 
+#include "i18n.h"
+#include "log.h"
+#include "surface.h"
 
 extern "C" void
 jpeg_memio_src (j_decompress_ptr cinfo, void * userdata);
@@ -174,7 +176,7 @@ void WJpeg::drawPixel(int x, int y,int w,int h,int xpos, int ypos,Colour c){
      Log::getInstance()->log("WJpeg:drawPixel",Log::ERR,"pixpos < 0 x=%d, y=%d",xb,yb);
      return;
    }
-   Box::drawPixel((UINT)xb,(UINT)yb,c);
+   Boxx::drawPixel((UINT)xb,(UINT)yb,c);
 }
 
 int WJpeg::drawJpeg() {
@@ -284,8 +286,13 @@ int WJpeg::drawJpeg() {
   logger->log("BJpeg", Log::DEBUG, "JPEG startup done pw=%i ph=%i, xo=%i,yo=%i, iw=%i, ih=%i", picturew, pictureh,xpos,ypos,w,h);
 
   // Init the surface
+
+// Temp disabled for boxx. what does this do anyway .. - cjt
+/*
   if (useImageDimensions) setDimensions(picturew, pictureh);
   fillColour(backgroundColour);
+*/
+
 
   //line len in bytes (3 bytes per Pixel) - for buffer (can be bigger then surface)
   int linelen=cinfo.output_width*3;
diff --git a/wjpeg.h b/wjpeg.h
index 2e2a9c9fbb4d2601409ef12754406560e2343c9b..cebde65f58dea49c86a3b0d5f05606754765f068 100644 (file)
--- a/wjpeg.h
+++ b/wjpeg.h
@@ -32,9 +32,9 @@ extern "C"
 //TODO find a replacement on WIN32
 #endif
 
-#include "log.h"
-#include "widget.h"
-#include "surface.h"
+#include "boxx.h"
+
+class Surface;
 
 //a reader to be implemented by the caller
 class JpegReader {
@@ -51,9 +51,16 @@ class JpegReader {
   virtual ~JpegReader(){};
 };
 
-class WJpeg : public Widget
+class WJpeg : public Boxx
 {
   public:
+  
+    // temp for boxx
+    void setSurface(Surface* tsurface) {};
+    void setDimensions(int width, int height) {};
+    void setBackgroundColour(Colour& colour) {};
+  
+  
     WJpeg();
     virtual ~WJpeg();
     int init(char* fileName, bool useImage=true, JpegReader *rdr=NULL);
diff --git a/wol.cc b/wol.cc
index f9081db68df335f219927d8693e740ffbf0d738d..0af301ba793c16ce6ef871ca511b4baaf75d3f0a 100644 (file)
--- a/wol.cc
+++ b/wol.cc
@@ -30,6 +30,8 @@
 #include <netinet/in.h>
 #include "wol.h"
 
+#include "log.h"
+
 #define _PATH_PROCNET_ARP "/proc/net/arp"
 
 Wol* Wol::instance = NULL;
diff --git a/wol.h b/wol.h
index 02312a5e8b3e916f90bf3e46f5e465c30a0bea57..a8aee22a5a97361d35bba4914b64adee7293ec8f 100644 (file)
--- a/wol.h
+++ b/wol.h
@@ -28,7 +28,8 @@
 
 #include <stdio.h>
 #include <string.h>
-#include "log.h"
+
+class Log;
 
 class Wol
 {
index be1b5d22dff00a1f37a2c415d657e731dd761eea..76a0101303087246bf06dcbe4c9273ba83533e3a 100644 (file)
@@ -20,6 +20,9 @@
 
 #include "woptionbox.h"
 
+#include "colour.h"
+#include "unistd.h"
+
 WOptionBox::WOptionBox()
 {
   numOptions = 0;
@@ -28,6 +31,20 @@ WOptionBox::WOptionBox()
   currentOption = 0;
 
   mode = MODE_TEXT;
+  
+  textbox.setPosition(20, 0);
+  textbox.setSize(10, surface->getFontHeight());
+  textbox.setParaMode(false);
+  textbox.setTextPos(0, 0);
+  add(&textbox);
+  
+  leftArrow.setPosition(0, 2);
+  leftArrow.nextSymbol = WSymbol::LEFTARROW;
+  add(&leftArrow);
+  
+  rightArrow.setPosition(0, 2);
+  rightArrow.nextSymbol = WSymbol::RIGHTARROW;
+  add(&rightArrow);
 }
 
 WOptionBox::~WOptionBox()
@@ -38,45 +55,64 @@ WOptionBox::~WOptionBox()
   free(options);
 }
 
-void WOptionBox::addOption(const char* takeText)
+void WOptionBox::setSize(UINT w, UINT h)
 {
-  int length = strlen(takeText);
-  char* newOption = new char[length + 1];
-  strcpy(newOption, takeText);
-  options = (char**)realloc(options, (numOptions+1) * sizeof(char*));
-  options[numOptions] = newOption;
-  numOptions++;
+  Boxx::setSize(w, h);
+  textbox.setSize(w - 40, surface->getFontHeight());
+  rightArrow.setPosition(w - 18, 2);
 }
 
 void WOptionBox::setActive(UCHAR tactive)
 {
   active = tactive;
+  setData();
 }
 
-void WOptionBox::draw()
+void WOptionBox::setData()
 {
+  // set colours, set text
+
   if (active)
   {
-    fillColour(Colour::SELECTHIGHLIGHT);
-    drawText(options[currentOption], 0, 0, Colour::DARKTEXT);
+    textbox.setForegroundColour(Colour::DARKTEXT);
+    textbox.setBackgroundColour(Colour::SELECTHIGHLIGHT);
+    leftArrow.nextColour = Colour::SELECTHIGHLIGHT;
+    rightArrow.nextColour = Colour::SELECTHIGHLIGHT;
   }
   else
   {
-    fillColour(Colour::BUTTONBACKGROUND);
-    drawText(options[currentOption], 0, 0, Colour::LIGHTTEXT);
+    textbox.setForegroundColour(Colour::LIGHTTEXT);
+    textbox.setBackgroundColour(Colour::BUTTONBACKGROUND);
+    leftArrow.nextColour = Colour::BUTTONBACKGROUND;
+    rightArrow.nextColour = Colour::BUTTONBACKGROUND;
   }
+  textbox.setText(options[currentOption]);
+
+}
+
+void WOptionBox::addOption(const char* takeText)
+{
+  int length = strlen(takeText);
+  char* newOption = new char[length + 1];
+  strcpy(newOption, takeText);
+  options = (char**)realloc(options, (numOptions+1) * sizeof(char*));
+  options[numOptions] = newOption;
+  numOptions++;
+  setData();
 }
 
 void WOptionBox::left()
 {
   if (currentOption == 0) return;
   --currentOption;
+  setData();
 }
 
 void WOptionBox::right()
 {
   if (currentOption == (numOptions - 1)) return;
   ++currentOption;
+  setData();
 }
 
 void WOptionBox::cycle()
@@ -89,6 +125,7 @@ void WOptionBox::cycle()
   {
     ++currentOption;
   }
+  setData();
 }
 
 void WOptionBox::setSelected(const char* toSelect)
@@ -98,17 +135,14 @@ void WOptionBox::setSelected(const char* toSelect)
     if (!strcmp(toSelect, options[i]))
     {
       currentOption = i;
+      setData();
       return;
     }
   }
   currentOption = 0;
+  setData();
 }
 
-//char* WOptionBox::getSelected()
-//{
-//  return options[currentOption];
-//}
-
 int WOptionBox::getSelectedIndex()
 {
   if (mode == MODE_TEXT)
@@ -142,29 +176,35 @@ void WOptionBox::setSelected(int toSelect)
     if (atoi(options[i]) == toSelect)
     {
       currentOption = i;
+      setData();
       return;
     }
   }
   currentOption = 0;
+  setData();
 }
 
 bool WOptionBox::mouseMove(int x, int y)
 {
+/*
   if ((x-offsetX)>=area.x && (y-offsetY)>=area.y
     && (x-offsetX)<=area.w && (y-offsetY)<=area.h && !active)
   {
     setActive(1);
     return true;
   }
+  */
   return false;
 }
 
 bool WOptionBox::mouseLBDOWN(int x, int y)
 {
+/*
   if ((x-offsetX)>=area.x && (y-offsetY)>=area.y
     && (x-offsetX)<=area.w && (y-offsetY)<=area.h && active)
   {
     return true;
   }
+  */
   return false;
 }
index 3e4261b28ca638f3edc3f5cdf344f5f9e95d6208..de365bb3a2e97cf8140f2f3927bfddd5edf61730 100644 (file)
 #include <stdlib.h>
 
 #include "defines.h"
-#include "widget.h"
-#include "colour.h"
+#include "boxx.h"
+#include "wsymbol.h"
+#include "wtextbox.h"
 
-class WOptionBox : public Widget
+class WOptionBox : public Boxx
 {
   public:
     WOptionBox();
@@ -39,14 +40,14 @@ class WOptionBox : public Widget
 
     void addOption(const char* newOption);
     void setSelected(const char* selectedOption);
-//    char* getSelected();
     void setActive(UCHAR tactive);
     void left();
     void right();
     void cycle();
-    void draw();
     int getSelectedIndex();
 
+    virtual void setSize(UINT w, UINT h);
+
     virtual bool mouseMove(int x, int y);
     virtual bool mouseLBDOWN(int x, int y);
 
@@ -60,6 +61,12 @@ class WOptionBox : public Widget
     UINT currentOption;
 
     int mode;
+
+    void setData();
+
+    WSymbol leftArrow;
+    WSymbol rightArrow;
+    WTextbox textbox;
 };
 
 #endif
diff --git a/woptionpane.cc b/woptionpane.cc
new file mode 100644 (file)
index 0000000..3b3e109
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+    Copyright 2007 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 "woptionpane.h"
+#include "wtextbox.h"
+#include "i18n.h"
+#include "woptionbox.h"
+#include "log.h"
+#include "vdr.h"
+#include "remote.h"
+#include "option.h"
+
+WOptionPane::WOptionPane()
+{
+  numOptions = 0;
+  selectedOption = -1;
+}
+
+WOptionPane::~WOptionPane()
+{
+  for(int i = 0; i < numOptions; i++)
+  {
+    delete textBoxes[i];
+    delete optionBoxes[i];
+  }
+}
+
+void WOptionPane::draw()
+{
+  Boxx::draw();
+  drawText(tr("Press back to exit, <, > or [ok] to change"), 10, area.h - 30, Colour::LIGHTTEXT);
+}
+
+void WOptionPane::saveOpts()
+{
+  // Due to the way the pane is constructed, options[0] corresponds to textBoxes[0] and optionBoxes[0] etc
+  
+  for(int i = 0; i < numOptions; i++)
+  {
+    options[i]->userSetChoice = optionBoxes[i]->getSelectedIndex();
+  }
+}
+
+void WOptionPane::addOptionLine(Option* option)
+{
+  int fontHeight = surface->getFontHeight();
+
+  options.resize(numOptions+1);
+  options[numOptions] = option;
+  
+  WTextbox* tb = new WTextbox();
+  tb->setPosition(4, 4 + (numOptions * 30));
+  tb->setSize(300, fontHeight);
+  tb->setText(tr(option->displayText));
+  tb->setTextPos(0, 0);
+  add(tb);
+  
+  textBoxes.resize(numOptions+1);
+  textBoxes[numOptions] = tb;
+
+  WOptionBox* ob = new WOptionBox();
+  ob->setPosition(310, 4 + (numOptions * 30));
+  ob->setSize(190, fontHeight);  
+  add(ob);
+  
+  optionBoxes.resize(numOptions+1);
+  optionBoxes[numOptions] = ob;
+  
+  if (option->optionType == Option::TYPE_TEXT)
+  {
+    for (UINT j = 0; j < option->numChoices; j++)
+    {
+      Log::getInstance()->log("Options", Log::DEBUG, "Add option: %s", option->options[j]);
+      ob->addOption(tr(option->options[j]));
+    }
+
+    // Set the selected choice
+    ob->setSelected(tr(option->options[option->configChoice]));
+  }
+  else
+  {
+    // int mode
+    ob->setIntMode(option->startInt, option->numChoices);
+    ob->setSelected(option->configChoice);
+  }
+
+  numOptions++;
+  
+}
+
+int WOptionPane::handleCommand(int command)
+{
+  switch(command)
+  {
+    case Remote::DF_UP:
+    case Remote::UP:
+    {
+      if (selectedOption > 0)
+      {
+        optionBoxes[selectedOption]->setActive(0);
+        --selectedOption;
+        optionBoxes[selectedOption]->setActive(1);
+        return 1;
+      }
+      else
+      {
+        optionBoxes[selectedOption--]->setActive(0);
+        return 4; // Signal return control to parent
+      }
+    }
+    case Remote::DF_DOWN:
+    case Remote::DOWN:
+    {
+      if (selectedOption < (numOptions - 1))
+      {
+        if (selectedOption != -1) optionBoxes[selectedOption]->setActive(0);
+        ++selectedOption;
+        optionBoxes[selectedOption]->setActive(1);
+        return 1;
+      }
+      else if (selectedOption == (numOptions - 1))
+      {
+        optionBoxes[selectedOption]->setActive(0);
+        selectedOption = -1;
+        return 4; // Signal return control to parent
+      }
+    }
+    case Remote::DF_LEFT:
+    case Remote::LEFT:
+    {
+      optionBoxes[selectedOption]->left();
+      return 1;
+    }
+    case Remote::DF_RIGHT:
+    case Remote::RIGHT:
+    {
+      optionBoxes[selectedOption]->right();
+      return 1;
+    }
+    case Remote::OK:
+    {
+      optionBoxes[selectedOption]->cycle();
+      return 1;
+    }
+  }
+
+  return 0;
+}
+
+
+
+
diff --git a/woptionpane.h b/woptionpane.h
new file mode 100644 (file)
index 0000000..1120c8c
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+    Copyright 2007 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 WOPTIONPANE_H
+#define WOPTIONPANE_H
+
+#include <vector>
+#include "boxx.h"
+#include "defines.h"
+
+class WTextbox;
+class WOptionBox;
+class Option;
+
+class WOptionPane : public Boxx
+{
+  public:
+    WOptionPane();
+    ~WOptionPane();
+    void addOptionLine(Option*);
+    int handleCommand(int command);
+    void saveOpts();
+    void draw();
+    
+  private:
+    int numOptions;
+    int selectedOption;
+    
+    vector<Option*> options;
+    
+    vector<WTextbox*> textBoxes;
+    vector<WOptionBox*> optionBoxes;
+};
+
+#endif
+
diff --git a/wremoteconfig.cc b/wremoteconfig.cc
new file mode 100644 (file)
index 0000000..cbda1d9
--- /dev/null
@@ -0,0 +1,235 @@
+/*
+    Copyright 2007 Chris Tallon, Marten Richter
+
+    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 "wremoteconfig.h"
+
+#include "remote.h"
+#include "wsymbol.h"
+#include "colour.h"
+#include "i18n.h"
+
+WRemoteConfig::WRemoteConfig()
+{
+  remote = Remote::getInstance();
+  learnmode = false;
+  active = false;
+
+  sl.setShowSelOption(false);
+  sl.setPosition(10, 30);
+  add(&sl);
+  initSelectList(true);
+}
+
+WRemoteConfig::~WRemoteConfig()
+{
+}
+
+void WRemoteConfig::initSelectList(bool startup)
+{
+  ULONG selection = 0;
+  ULONG top = 0;
+
+  if (!startup)
+  {
+    selection = sl.getCurrentOption();
+    top = sl.getTopOption();
+  }
+
+  sl.clear();
+  sl.addColumn(0);
+  sl.addColumn(150);
+  sl.addColumn(300);
+  
+  ULONG i;
+  for (i = 0; i < 256; i++)
+  {
+    const char * name = remote->CommandDesc((UCHAR)i);
+    if (name != NULL)
+    {
+      char *line = remote->CommandTranslateStr((UCHAR)i);
+      sl.addOption(line,i,0);
+    }
+  }
+  if (!startup)
+  {
+    sl.hintSetCurrent(selection);
+    sl.hintSetTop(top);
+  }
+}
+
+void WRemoteConfig::setSize(UINT w, UINT h)
+{
+  Boxx::setSize(w, h);
+  sl.setSize(area.w - 20, area.h - 70);
+}
+
+void WRemoteConfig::draw()
+{
+  Boxx::draw();
+  
+  drawText(tr("Command"), 15, 4, Colour::LIGHTTEXT);
+  drawText(tr("Hard wired"), 165, 4, Colour::LIGHTTEXT);
+  drawText(tr("User assignable"), 315, 4, Colour::LIGHTTEXT);
+
+  if (learnmode)
+  {
+    drawText(tr("Learning! Press any hardwired key to exit!"), 15, area.h - 30, Colour::SELECTHIGHLIGHT);
+  }
+  else
+  {
+    drawText(tr("Press [ok] for learning or MENU to reset to defaults! "), 15, area.h - 30, Colour::LIGHTTEXT);
+  }
+}
+
+/*
+void WRemoteConfig::processMessage(Message* m)
+{
+  Log::getInstance()->log("VRecordingList", Log::DEBUG, "Got message value %lu", m->message);
+
+  if (m->message == Message::MOUSE_MOVE)
+  {
+    if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+    {
+      sl.setShowSelOption(true);
+      sl.draw();
+      viewman->updateView(this);
+    }
+  }
+  else if (m->message == Message::MOUSE_LBDOWN)
+  {
+    if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+    {
+      ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+    }
+    else
+    {
+      //check if press is outside this view! then simulate cancel
+      int x=(m->parameter>>16)-getScreenX();
+      int y=(m->parameter&0xFFFF)-getScreenY();
+      if (x<0 || y <0 || x>getWidth() || y>getHeight())
+      {
+        ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+      }
+    }
+  }
+}
+*/
+
+/*
+void WRemoteConfig::doSave()
+{
+    Message* m = new Message();
+    m->message = Message::CHANGED_REMOTECONTROL;
+    m->to = parent;
+    m->parameter = 0;
+    Command::getInstance()->postMessageNoLock(m);
+    
+}
+*/
+
+int WRemoteConfig::handleCommand(int command)
+{
+  if (learnmode)
+  {
+    learnmode = false;
+    if (command == Remote::NA_LEARN)
+    {
+      initSelectList(false);
+    }
+    return 1;
+  }
+  switch(command)
+  {
+    case Remote::DF_UP:
+    case Remote::UP:
+    {
+      if (sl.getCurrentOption() != 0)
+      {
+        sl.up();
+        return 1;
+      }
+      else
+      {
+        sl.setShowSelOption(false);
+        active = false;
+        return 4; // return control to vopts
+      }
+    }
+    case Remote::DF_DOWN:
+    case Remote::DOWN:
+    {
+      if (!active)
+      {
+        active = true;    
+        sl.setShowSelOption(true);
+      }
+      else
+      {
+        sl.down();
+      }
+      return 1;
+    }
+    case Remote::SKIPBACK:
+    {
+      sl.pageUp();
+      return 1;
+    }
+    case Remote::SKIPFORWARD:
+    {
+      sl.pageDown();
+      return 1;
+    }
+    case Remote::OK:
+    {
+      learnmode = true;
+      remote->EnterLearningMode(sl.getCurrentOptionData());
+      return 1;
+    }
+    case Remote::BACK:
+    {
+      return 0;
+/*
+      doSave();
+
+      // Instead of returning 4 here which would delete this view
+      // before the doSave message is processed, let the message queue
+      // do the doSave then this close message. That will make the options menu
+      // disappear before this view
+
+      Message* m = new Message();
+      m->message = Message::CLOSE_ME;
+      m->from = this;
+      m->to = viewman;
+      Command::getInstance()->postMessageNoLock(m);
+      return 2;
+*/      
+    }
+    case Remote::MENU:
+    {
+      remote->ResetToDefault();
+      initSelectList(false);
+      return 1;
+    }
+  }
+
+  return 0;
+}
+
+
diff --git a/wremoteconfig.h b/wremoteconfig.h
new file mode 100644 (file)
index 0000000..37c1823
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+    Copyright 2007 Chris Tallon, Marten Richter
+
+    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 WREMOTECONFIG_H
+#define WREMOTECONFIG_H
+
+#include "boxx.h"
+#include "wselectlist.h"
+
+class Remote;
+class Message;
+
+class WRemoteConfig : public Boxx
+{
+  public:
+    WRemoteConfig();
+    ~WRemoteConfig();
+    
+    void setSize(UINT w, UINT h);
+    int handleCommand(int command);
+    void draw();
+
+  private:
+    WSelectList sl;
+    Remote *remote;
+    bool learnmode;
+    void initSelectList(bool startup);
+    bool active;
+};
+
+#endif
+
index 6fdf0f764710bfdc5a83d1d7bcc2df90d13f69bf..9295324b76ccb9a9d23b5be3bbd41b31dcd0bd85 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "wselectlist.h"
 
+#include "colour.h"
+
 WSelectList::WSelectList()
 {
   selectedOption = 0;
@@ -29,6 +31,7 @@ WSelectList::WSelectList()
   noLoop = 0;
   gap = 1;
   showseloption = true;
+  backgroundColour = Colour::VIEWBACKGROUND;
 }
 
 WSelectList::~WSelectList()
@@ -56,6 +59,11 @@ void WSelectList::setNoLoop()
   noLoop = 1;
 }
 
+void WSelectList::setBackgroundColour(Colour& colour)
+{
+  backgroundColour = colour;
+}
+
 void WSelectList::hintSetCurrent(int idx)
 {
   selectedOption = idx;
@@ -67,7 +75,7 @@ void WSelectList::hintSetTop(int idx)
   topOption = idx;
 }
 
-int WSelectList::addOption(char* text, ULONG data, int selected)
+int WSelectList::addOption(const char* text, ULONG data, int selected)
 {
   int thisNewOption = options.size();
 
@@ -224,7 +232,7 @@ ULONG WSelectList::getCurrentOptionData()
 
 bool WSelectList::mouseMove(int x, int y)
 {
-  int ml = getMouseLine(x-offsetX,y-offsetY);
+  int ml = getMouseLine(x-getRootBoxOffsetX(), y-getRootBoxOffsetY());
   if (ml>=0 && ml!=(int)selectedOption)
   {
     selectedOption = ml;
@@ -235,7 +243,7 @@ bool WSelectList::mouseMove(int x, int y)
 
 bool WSelectList::mouseLBDOWN(int x, int y)
 {
-  int ml = getMouseLine(x-offsetX, y-offsetY);
+  int ml = getMouseLine(x-getRootBoxOffsetX(), y-getRootBoxOffsetY());
   if (ml == (int)selectedOption)
   {
     /* caller should generate a OK message*/
index 2a486c5d1ced81ff867ece19618a32a6fb32d0a5..dbd1b9e9037dffa47783ea6d6056a585fa4778e1 100644 (file)
@@ -27,8 +27,7 @@
 #include <vector>
 
 #include "defines.h"
-#include "widget.h"
-#include "colour.h"
+#include "boxx.h"
 
 using namespace std;
 
@@ -38,7 +37,7 @@ typedef struct
   ULONG data;
 } wsloption;
 
-class WSelectList : public Widget
+class WSelectList : public Boxx
 {
   public:
     WSelectList();
@@ -48,8 +47,9 @@ class WSelectList : public Widget
 
     void setNoLoop();
     void setShowSelOption(bool set) { showseloption = set; };
-    int addOption(char* text, ULONG data, int selected);
+    int addOption(const char* text, ULONG data, int selected);
     void draw();
+    void setBackgroundColour(Colour& colour);
 
     void down();
     void up();
@@ -80,6 +80,9 @@ class WSelectList : public Widget
     int numColumns;
     int noLoop;
     bool showseloption;
+    
+    UINT gap;
+    Colour backgroundColour;
 };
 
 #endif
index 81171d608b9eee1c6a7621d5fb087d51aff12a02..863b01e3d408d27f9a2c2cbfd553a9d60b35abd6 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "wsymbol.h"
 
+#include "colour.h"
+
 UCHAR WSymbol::widths[] = { 2, 2, 4, 4, 1, 1, 3, 3, 3, 3, 3, 4, 4, 2, 2, 3, 5, 5, 4, 4, 2, 2};
 UCHAR WSymbol::heights[] = { 8, 8, 12, 12, 24, 4, 18, 18, 18, 18, 18, 30, 30, 16, 16, 18, 18, 18, 16, 16, 8, 8};
 
index c0be54975fc83c8e9cfbc7950fb681f068bf0543..364ef6834c501820bfb8bb90a44f4208390b256a 100644 (file)
--- a/wsymbol.h
+++ b/wsymbol.h
 #define WSYMBOL_H
 
 #include "defines.h"
-#include "widget.h"
-#include "colour.h"
+#include "boxx.h"
 
-class WSymbol : public Widget
+class WSymbol : public Boxx
 {
   public:
     WSymbol();
diff --git a/wtabbar.cc b/wtabbar.cc
new file mode 100644 (file)
index 0000000..ef54b9b
--- /dev/null
@@ -0,0 +1,248 @@
+/*
+    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 "wtabbar.h"
+#include "surface.h"
+#include "remote.h"
+#include "wbutton.h"
+#include "colour.h"
+
+WTabBar::WTabBar()
+{
+  buttonBarActive = true;
+  visiblePane = 0;
+  setBackgroundColour(Colour::VIEWBACKGROUND);
+  
+  symbolLeft.setPosition(0, 4);
+  symbolLeft.nextColour = Colour::BUTTONBACKGROUND;
+  symbolLeft.nextSymbol = WSymbol::LEFTARROW;
+  add(&symbolLeft);
+
+  symbolRight.setPosition(getWidth() - 28, 4);
+  symbolRight.nextColour = Colour::BUTTONBACKGROUND;
+  symbolRight.nextSymbol = WSymbol::RIGHTARROW;
+  add(&symbolRight);
+}
+
+WTabBar::~WTabBar()
+{
+  for (UINT i = 0; i < tabs.size(); i++)
+  {
+    delete tabs[i].button;
+  }
+}
+
+void WTabBar::addTab(const char* name, Boxx* boxx)
+{
+  TabDetails td;
+  td.name = name;
+  td.nameWidth = 0;
+  
+  for(UINT i = 0; i < strlen(name); i++)
+  {
+    td.nameWidth += charWidth(name[i]);
+  }
+
+  UINT newButtonX = 22;
+  for(UINT i = 0; i < tabs.size(); i++) newButtonX += tabs[i].button->getWidth() + 10;
+
+  WButton* newButton = new WButton();
+  newButton->setText(name);
+  newButton->setPosition(newButtonX, 2);
+  newButton->setSize(td.nameWidth + 6, Surface::getFontHeight());
+  if ((newButtonX + newButton->getWidth()) > (getWidth() - 22)) newButton->setVisible(false);
+  add(newButton);
+    
+  boxx->setPosition(0, 34);
+  boxx->setSize(getWidth(), getHeight()-34);
+  add(boxx);
+
+  td.button = newButton;
+  td.pane = boxx;
+  tabs.push_back(td);
+    
+  if (tabs.size() == 1)
+  {
+    newButton->setActive(true);
+    boxx->setVisible(true);
+  }
+  else
+  {
+    newButton->setActive(false);
+    boxx->setVisible(false);
+    symbolRight.nextColour = Colour::SELECTHIGHLIGHT;  // if this is the 2nd+ tab, ensure right arrow goes active
+  }
+}
+
+int WTabBar::handleCommand(int command)
+{
+  // This returns 0 for not handled, and 1 for handled and please-update-me, 2 for handled-no-update
+
+  // if the focus is in a pane, send the command there
+  if (!buttonBarActive)
+  {
+    // Send the command to the pane
+    // Return code should be:
+      // 0 - not handled
+      // 1 - handled - stop command here
+      // 4 - handled - pane is returning control to here
+      // FIXME standardise these
+      
+    int paneRetCode = tabs[visiblePane].pane->handleCommand(command);
+    if (paneRetCode == 0)
+    {
+      return 0;
+    }
+    else if (paneRetCode == 1)
+    {
+      draw();
+      return 1;
+    }
+    else if (paneRetCode == 4)
+    {
+      buttonBarActive = true;
+      tabs[visiblePane].button->setActive(true);      
+      if (visiblePane != 0) symbolLeft.nextColour = Colour::SELECTHIGHLIGHT;
+      if (visiblePane != tabs.size() - 1) symbolRight.nextColour = Colour::SELECTHIGHLIGHT;
+      draw();
+      return 1;
+    }
+  }
+
+  if (buttonBarActive)
+  {
+    switch(command)
+    {
+      case Remote::DF_LEFT:
+      case Remote::LEFT:
+      {
+        if (!left()) return 2;
+        draw();
+        return 1;
+      }
+      case Remote::DF_RIGHT:
+      case Remote::RIGHT:
+      {
+        if (!right()) return 2;
+        draw();
+        return 1;
+      }
+      case Remote::DOWN:
+      case Remote::DF_DOWN:
+      {
+        buttonBarActive = false;
+        tabs[visiblePane].button->dim();
+        symbolLeft.nextColour = Colour::BUTTONBACKGROUND;
+        symbolRight.nextColour = Colour::BUTTONBACKGROUND;
+        if (tabs[visiblePane].pane->handleCommand(command) == 1) // shouldn't return anything else at this point?!
+        {
+          draw();
+          return 1;
+        }
+      }    
+    }  
+  }
+  return 0;  
+}  
+
+// When there are too many tabs to display simultaneously, extend this to shift the tabs left and right
+
+bool WTabBar::left()
+{
+  if (visiblePane == 0) return false;
+  tabs[visiblePane].button->setActive(false);
+  tabs[visiblePane].pane->setVisible(false);
+  --visiblePane;
+  tabs[visiblePane].button->setActive(true);
+  tabs[visiblePane].pane->setVisible(true);
+
+  if (visiblePane == 0) symbolLeft.nextColour = Colour::BUTTONBACKGROUND;
+  symbolRight.nextColour = Colour::SELECTHIGHLIGHT;
+
+  // Move the buttons..
+  if (tabs[visiblePane].button->getVisible() == false)
+  {
+    tabs[visiblePane].button->setVisible(true);
+    // We have gone << past the last visible button
+    UINT newButtonX = 22;
+    UINT j;
+    for(j = visiblePane; j < tabs.size(); j++) // start with the button just uncovered
+    {
+      if ((newButtonX + tabs[j].button->getWidth()) > (getWidth() - 22)) break; // this one too big.
+      tabs[j].button->setPosition(newButtonX, 2);
+      newButtonX += tabs[j].button->getWidth() + 10;
+    }
+    for(; j < tabs.size(); j++) // hide the rest
+    {
+      tabs[j].button->setVisible(false);
+    }
+  }
+
+  return true;
+}
+
+bool WTabBar::right()
+{
+  if (visiblePane == tabs.size() - 1) return false;
+  tabs[visiblePane].button->setActive(false);
+  tabs[visiblePane].pane->setVisible(false);
+  ++visiblePane;
+  tabs[visiblePane].button->setActive(true);
+  tabs[visiblePane].pane->setVisible(true);
+  
+  if (visiblePane == tabs.size() - 1) symbolRight.nextColour = Colour::BUTTONBACKGROUND;
+  symbolLeft.nextColour = Colour::SELECTHIGHLIGHT;
+
+  // Move the buttons..
+  if (tabs[visiblePane].button->getVisible() == false)
+  {
+    tabs[visiblePane].button->setVisible(true);
+    // We have gone >> past the last visible button
+    // Move all buttons left, but need to work out which one to finally display as first on the left
+    UINT displayWidth = getWidth() - 44;
+    UINT widthSum = tabs[visiblePane].button->getWidth(); // start with width of newly shown button (on the right)
+    int startWith = 0;
+    int i;
+    for(i = visiblePane - 1; i >= 0; i--)
+    {
+      widthSum += tabs[i].button->getWidth() + 10; // add on width needed to display also the previous button
+      if (widthSum > displayWidth) // then it's too much
+      {
+        startWith = i + 1;
+        break;
+      }
+    }
+    
+    for(i = 0; i < startWith; i++) // For each button to the left of startWith...
+    {
+      tabs[i].button->setVisible(false);
+    }
+    
+    UINT newButtonX = 22;
+    for(UINT j = startWith; j <= visiblePane; j++) // startWith -> the one we just uncovered
+    {
+      tabs[j].button->setPosition(newButtonX, 2);
+      newButtonX += tabs[j].button->getWidth() + 10;
+    }      
+  }
+  
+  return true;
+}
+
diff --git a/wtabbar.h b/wtabbar.h
new file mode 100644 (file)
index 0000000..3868309
--- /dev/null
+++ b/wtabbar.h
@@ -0,0 +1,59 @@
+/*
+    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 WTABBAR_H
+#define WTABBAR_H
+
+#include <vector>
+#include "defines.h"
+#include "boxx.h"
+#include "wsymbol.h"
+
+class WButton;
+
+typedef struct sTabDetails
+{
+  const char* name;
+  UINT nameWidth;
+  WButton* button;
+  Boxx* pane;
+} TabDetails;
+
+class WTabBar : public Boxx
+{
+  public:
+    WTabBar();
+    ~WTabBar();
+    void addTab(const char* name, Boxx* boxx);
+    int handleCommand(int command);
+
+  private:
+    bool left();
+    bool right();
+  
+    UINT visiblePane;
+    bool buttonBarActive;
+    vector<TabDetails> tabs;
+    
+    WSymbol symbolLeft;
+    WSymbol symbolRight;
+};
+
+#endif
index 66696ffea8b9d3067b113c07b5568c581adc9ef7..42c574bd77a551eab34e57b158d12fde6371b1d6 100644 (file)
 
 #include "wtextbox.h"
 
-WTextbox::WTextbox()
+#include "colour.h"
+
+WTextbox::WTextbox(const char* ttext)
 {
-  int fontHeight = Surface::getFontHeight();
-  setDimensions(70, fontHeight);
-  setDimensions(100,100);
+//  int fontHeight = Surface::getFontHeight();
+  //setDimensions(70, fontHeight);
+  //setDimensions(100,100);
+  setSize(100, 100);
   text = NULL;
   foreColour = Colour::LIGHTTEXT;
-  backColour = Colour::VIEWBACKGROUND;
   textX = 5;
   textY = 2;
+  
+  paraMode = true;
+  
+  if (ttext) setText(ttext);
 }
 
 WTextbox::~WTextbox()
 {
-  if (text) delete[] text; //TODO is this needed?
+  if (text) delete[] text;
 }
 
-void WTextbox::setText(char* takeText)
+void WTextbox::setParaMode(bool mode)
 {
-  int length = strlen(takeText);
-  text = new char[length + 1];
-  strcpy(text, takeText);
+  paraMode = mode;
 }
 
-void WTextbox::setBackgroundColour(Colour bcolour)
+void WTextbox::setText(const char* takeText)
 {
-  backColour = bcolour;
+  if (text) delete[] text;
+  int length = strlen(takeText);
+  text = new char[length + 1];
+  strcpy(text, takeText);
 }
 
 void WTextbox::setForegroundColour(Colour fcolour)
@@ -56,9 +63,12 @@ void WTextbox::setForegroundColour(Colour fcolour)
 
 void WTextbox::draw()
 {
-  fillColour(backColour);
+  Boxx::draw();
   if (text)
-    drawPara(text, textX, textY, foreColour);
+  {
+    if (paraMode) drawPara(text, textX, textY, foreColour);
+    else          drawText(text, textX, textY, foreColour);
+  }
 }
 
 void WTextbox::setTextPos(int x, int y)
index 87bdaae50319f1c6cf5e8007dbb0dbd8c9b5bc1e..9ac707288c32bb283d40c2ad3a9720c8a10cf74d 100644 (file)
 #include <string.h>
 
 #include "defines.h"
-#include "widget.h"
-#include "colour.h"
+#include "boxx.h"
 
-class WTextbox : public Widget
+class Colour;
+
+class WTextbox : public Boxx
 {
   public:
-    WTextbox();
+    WTextbox(const char* ttext = NULL);
     ~WTextbox();
-    void setText(char* text);
+    void setText(const char* text);
     void draw();
-    void setBackgroundColour(Colour bcolour);
     void setForegroundColour(Colour fcolour);
     void setTextPos(int x, int y); // optional
+    void setParaMode(bool mode);
 
   private:
 
     char* text;
     Colour foreColour;
-    Colour backColour;
     int textX;
     int textY;
+    bool paraMode;
 };
 
 #endif
diff --git a/wwss.cc b/wwss.cc
index 25bfa739b74a7ac07aa27d278d810e971fa2e5ba..34a5c481ccfa24d044557df9ad55f89aca5d9ad6 100644 (file)
--- a/wwss.cc
+++ b/wwss.cc
@@ -20,6 +20,9 @@
 
 #include "wwss.h"
 
+#include "colour.h"
+#include "video.h"
+
 Wwss::Wwss()
 {
   format = Video::NTSC;
diff --git a/wwss.h b/wwss.h
index feff7a85e745f5402f36fc2a48233e7ac8f977d1..99f137a609a9d6b9fe1b9afbbb6499e0f1b88dd6 100644 (file)
--- a/wwss.h
+++ b/wwss.h
 #include <stdio.h>
 #include <string.h>
 
+#include "boxx.h"
 #include "defines.h"
-#include "widget.h"
-#include "colour.h"
-#include "video.h"
 
-class Wwss : public Widget
+class Wwss : public Boxx
 {
   public:
     Wwss();