Reporting of many bugs
Audio channel selection
+Andreas Vogel
+ Media player
Thanks to the following people for their work with the MVP:
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
#include "afeed.h"
+#include "log.h"
+#include "demuxer.h"
+#include "callback.h"
+
AFeed::AFeed(Callback* tcb)
: cb(*tcb)
{
#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
{
#include "audio.h"
+#include "log.h"
+
Audio* Audio::instance = NULL;
Audio::Audio()
{
Log::getInstance()->log("Audio", Log::DEBUG, "doMuting: user=%i sys=%i", userMute, systemMute);
-
if (userMute || systemMute)
{
return mute();
#include <stdio.h>
#include "defines.h"
-#include "log.h"
#include "draintarget.h"
typedef struct
#include "audiomvp.h"
+#include "log.h"
+
AudioMVP::AudioMVP()
{
if (instance) return;
#include <sys/ioctl.h>
#include "defines.h"
-#include "log.h"
#include "audio.h"
-
typedef struct
{
int parm1;
#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;
return instance;
}
-AudioPlayer::AudioPlayer(View *parent) : afeed(this)
+AudioPlayer::AudioPlayer(Boxx *parent) : afeed(this)
{
frontend=parent;
audio = Audio::getInstance();
-class View;
+class Boxx;
class DemuxerAudio;
//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();
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;
int skipfactor;
//the buffer len in bytes
const static int BUFLEN=50*1024;
- View *frontend;
+ Boxx *frontend;
//requested sequence
int requestedSequence;
//handled sequence
+++ /dev/null
-/*
- 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);
-}
+++ /dev/null
-/*
- 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
--- /dev/null
+/*
+ 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;
+ }
+ }
+}
--- /dev/null
+/*
+ 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
--- /dev/null
+/*
+ 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);
+}
+
--- /dev/null
+/*
+ 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.
+
+*/
+
*/
#include "channel.h"
+
#include "vdr.h"
+#include "log.h"
Channel::Channel()
{
#include <stdio.h>
#include <vector>
-#include "log.h"
#include "defines.h"
using namespace std;
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
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()
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;
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()
//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...
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;
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
}
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;
}
}
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
case Remote::VOLUMEDOWN:
{
VVolume* v = new VVolume();
- viewman->add(v);
+ boxstack->add(v);
v->handleCommand(button); // this will draw+show
return;
}
{
VMute* v = new VMute();
v->draw();
- viewman->add(v);
- viewman->updateView(v);
+ boxstack->add(v);
+ boxstack->update(v);
return;
}
case Remote::POWER:
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();
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();
}
}
{
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;
// 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();
// 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
{
}
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);
// handleCommand(Remote::DOWN);
// handleCommand(Remote::OK);
// handleCommand(Remote::OK);
-// handleCommand(Remote::OK);
+// handleCommand(Remote::RED);
}
}
#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
{
UCHAR firstBoot;
Log* logger;
- ViewMan* viewman;
+ BoxStack* boxstack;
Remote* remote;
- VWallpaper* wallpaper;
+ Boxx* wallpaper;
VInfo* connLost;
-
+
UDP udp;
void processMessage(Message* m);
#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
//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:
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);
}
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];
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;
#include "i18n.h"
#include "language-data.h"
+#include "log.h"
+#include "vdr.h"
+
int I18n::LanguageID = DEFAULT_LANGUAGE_INDEX;
int I18n::initialize(void)
return LanguageID;
}
-char* I18n::translate(char* s)
+const char* I18n::translate(const char* s)
{
if (LanguageID >= 0)
{
#endif
#include "defines.h"
-#include "log.h"
-#include "vdr.h"
+
#define I18N_HEADER
#include "language-data.h"
{
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);
#include "log.h"
#include "timers.h"
#include "vdr.h"
-#include "viewman.h"
+#include "boxstack.h"
#include "command.h"
#include "mtdmvp.h"
#include "osdmvp.h"
#include "audiomvp.h"
#include "videomvp.h"
+#include "wol.h"
#ifndef WIN32
void sighandler(int signalReceived);
Led* led;
Osd* osd;
Timers* timers;
-ViewMan* viewman;
+BoxStack* boxstack;
Command* command;
VDR* vdr;
Video* video;
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);
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);
}
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();
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
#include "messagequeue.h"
+#include "message.h"
+#include "log.h"
+
void MessageQueue::postMessage(Message* m)
{
messages.push(m);
#include <queue>
using namespace std;
-#include "message.h"
-#include "log.h"
+class Message;
typedef queue<Message*> MQueue;
#include "mtdmvp.h"
+#include "log.h"
+
MtdMVP::MtdMVP()
{
if (instance) return;
#include <unistd.h>
#include <fcntl.h>
-#include "log.h"
#include "mtd.h"
class MtdMVP : public Mtd
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 \
--- /dev/null
+/*
+ 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;
+ }
+}
+
--- /dev/null
+/*
+ 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
+
#include "osd.h"
+#include "surface.h"
+
Osd* Osd::instance = NULL;
Osd::Osd()
#include <stdio.h>
-#include "surface.h"
+class Surface;
class Osd
{
}
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);
#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
void Player::setAudioChannel(int newChannel)
{
- demuxer->setAudioChannel(newChannel);
+ if (isRecording)
+ demuxer->setAudioChannel(newChannel);
+ else
+ ((DemuxerTS*)demuxer)->setAID(newChannel);
}
// ----------------------------------- Externally called events
#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:
#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)
#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
{
*/
#include "recinfo.h"
+#include "log.h"
RecInfo::RecInfo()
{
#include <time.h>
#include "defines.h"
-#include "log.h"
class RecInfo
{
*/
#include "recman.h"
+
#include "vdr.h"
RecMan::RecMan()
#include "recording.h"
+#include "recinfo.h"
+#include "mark.h"
+#include "log.h"
+#include "demuxer.h"
+
Recording* Recording::recInfoFor = NULL;
RecInfo* Recording::recInfo = NULL;
#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
{
ULONG channelNumber;
ULONG startTime;
ULONG stopTime;
+ ULONG day;
+ ULONG weekDays;
// int index;
*/
#include "remote.h"
+
#include "i18n.h"
+#include "log.h"
Remote* Remote::instance = NULL;
#include <map>
#include "defines.h"
-#include "log.h"
using namespace std;
typedef map<ULLONG,UCHAR> RemoteTranslationList;
#include "remotemvp.h"
+#include "log.h"
+
RemoteMVP::RemoteMVP()
{
if (instance) return;
#include <unistd.h>
#include <fcntl.h>
-#include "defines.h"
-#include "log.h"
#include "remote.h"
+#include "defines.h"
class RemoteMVP : public Remote
{
#endif
#include <memory.h>
#include "defines.h"
+
#include "draintarget.h"
class Stream
*/
#include "surface.h"
+
#include "osd.h"
+#include "log.h"
Surface* Surface::screen = NULL;
osd_font_t* Surface::font = &font_helvB18;
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;
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;
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;
#include <stdio.h>
#include "defines.h"
-#include "log.h"
// Font stuff
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;
*/
#include "surfacemvp.h"
+
#include "osd.h"
+#include "log.h"
SurfaceMVP::SurfaceMVP(int id)
: Surface(id)
}
#include "defines.h"
-#include "log.h"
#include "surface.h"
// Structures for surface management
#include "surfacewin.h"
#include "osdwin.h"
#include <d3dx9tex.h>
+#include "log.h"
SurfaceWin::SurfaceWin(int id)
: Surface(id)
#define SURFACEWIN_H
#include "defines.h"
-#include "log.h"
#include "surface.h"
#include <winsock2.h>
#include <d3d9.h>
--- /dev/null
+/*
+ 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;
+}
--- /dev/null
+/*
+ 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
#include <Iphlpapi.h>
#endif
+#include "log.h"
+
TCP::TCP()
{
sock = 0;
#endif
#include "defines.h"
-#include "log.h"
class TCP
{
#include "timers.h"
+#include "log.h"
+#include "command.h"
+#include "timerreceiver.h"
+
Timers* Timers::instance = NULL;
Timers::Timers()
#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;
/*
#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);
#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:
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;
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);
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:
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:
//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) {
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;
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;
}
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);
}
-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;
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;
}
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;
//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:
break;
}
if (drawSymbol) {
- w.setSurfaceOffset(x, ybottom-24);
+ w.setPosition(x, ybottom-24);
w.draw();
}
else {
#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
*/
class AudioPlayer;
-class VAudioplayer : public View,public TimerReceiver
+class VAudioplayer : public TBBoxx, public TimerReceiver
{
public:
~VAudioplayer();
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;
#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
}
}
+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();
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);
sl.up();
sl.draw();
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
Message* m = new Message();
m->from = this;
sl.down();
sl.draw();
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
Message* m = new Message();
m->from = this;
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
}
}
}
#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
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);
private:
void* parent;
WSelectList sl;
+
+ bool liveMode;
AudioChannelList acl;
};
#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)
}
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()
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();
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);
}
sl.draw();
doShowingBar();
- viewman->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::DF_DOWN:
sl.draw();
doShowingBar();
- viewman->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::SKIPBACK:
sl.draw();
doShowingBar();
- viewman->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::SKIPFORWARD:
sl.draw();
doShowingBar();
- viewman->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::ZERO:
{
VChannelSelect* v = new VChannelSelect(this);
v->draw();
- viewman->add(v);
- viewman->updateView(v);
+ boxstack->add(v);
+ boxstack->update(v);
v->handleCommand(command);
return 2;
}
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);
{
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
}
}
}
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);
}
}
#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);
void draw();
private:
- ViewMan* viewman;
+ BoxStack* boxstack;
ChannelList* chanList;
WSelectList sl;
#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;
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);
}
void VChannelSelect::draw()
{
- View::draw();
+ Boxx::draw();
// draw numbers
char text[2];
// 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);
{
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;
#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();
void timercall(int clientReference);
private:
- View* parent;
+ Boxx* parent;
int input[10];
int numGot;
#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;
{
setOneLiner(tr("Locating server"));
draw();
- viewman->updateView(this);
+ boxstack->update(this);
vdr->findServers(servers);
if (!irun)
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();
setOneLiner(tr("Connecting to VDR"));
draw();
- viewman->updateView(this);
+ boxstack->update(this);
success = vdr->connect();
if (success)
}
draw();
- viewman->updateView(this);
+ boxstack->update(this);
MILLISLEEP(delay);
} while(!success);
#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:
void threadPostStopCleanup() {};
void clearServerIPs();
+ BoxStack* boxstack;
UCHAR irun;
VDR* vdr;
Log* logger;
*/
#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;
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];
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];
newRecTimer->channelNumber = extractULONG();
newRecTimer->startTime = extractULONG();
newRecTimer->stopTime = extractULONG();
+ newRecTimer->day = extractULONG();
+ newRecTimer->weekDays = extractULONG();
tempString = extractString();
newRecTimer->setFile(tempString);
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;
+}
+
#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;
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);
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();
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;
#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)
}
// 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
// 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)
delete eventLista[listIndex];
}
}
- // delete [] eventLista;
+ // delete [] eventLista; // FIXME
// destroy dynamically allocated memory
}
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();
}
// 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);
chanListbox.draw();
drawgrid();
chanName.draw(); // TODO this should be dealt with by vvideolive
+
progTitle.draw();
progInfo.draw();
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);
{ // cursor up the channel list
chanListbox.up();
drawData();
- viewman->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::DF_DOWN:
{ // cursor down the channel list
chanListbox.down();
drawData();
- viewman->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::DF_LEFT:
{ // cursor left through time
selTime = thisEvent.time - 1;
drawData();
- viewman->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::DF_RIGHT:
// cursor right through time
selTime = thisEvent.time + thisEvent.duration;
drawData();
- viewman->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::RED:
// cursor up one page
chanListbox.pageUp();
drawData();
- viewman->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::GREEN:
// cursor down one page
chanListbox.pageDown();
drawData();
- viewman->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::BLUE:
// step forward 24 hours
selTime += 24 * 60 * 60;
drawData();
- viewman->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::YELLOW:
// step forward 24 hours
selTime -= 24 * 60 * 60;
drawData();
- viewman->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::RECORD:
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:
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));
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++)
{
chanName.setText(chname);
chanName.draw();
- viewman->updateView(this);
+ boxstack->update(this);
}
void VEpg::paintCell(Event* event, int yOffset, Colour bg, Colour fg)
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);
selTime = ttime;
drawData();
- viewman->updateView(this);
+ boxstack->update(this);
}
}
}
#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);
void paintCell(Event* event, int yOffset, Colour bg, Colour fg);
time_t prevHour(time_t* t);
VVideoLive* videoLive;
- ViewMan* viewman;
+ BoxStack* boxstack;
UINT gridRows;
};
#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"));
void VEpgSetTimer::draw()
{
- View::draw();
+ TBBoxx::draw();
drawPara(event->title, 10, 40, Colour::LIGHTTEXT);
drawText(channel->name, 10, 40 + (2 * surface->getFontHeight()), Colour::LIGHTTEXT);
{
swap();
draw();
- ViewMan::getInstance()->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::DF_RIGHT:
{
swap();
draw();
- ViewMan::getInstance()->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::BACK:
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"));
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)
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
}
}
}
#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);
void draw();
private:
+ BoxStack* boxstack;
Log* logger;
- ViewMan* viewman;
VDR* vdr;
Event* event;
#include "vfeed.h"
+#include "log.h"
+#include "demuxer.h"
+#include "callback.h"
+
VFeed::VFeed(Callback* tcb)
: cb(*tcb)
{
#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:
+++ /dev/null
-/*
- 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;
-}
+++ /dev/null
-/*
- 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
+++ /dev/null
-/*
- 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;
- }
- }
-}
+++ /dev/null
-/*
- 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
#include "vinfo.h"
+#include "remote.h"
+#include "colour.h"
+#include "wbutton.h"
+#include "i18n.h"
+#include "boxstack.h"
+
VInfo::VInfo()
{
mainText = NULL;
dropThrough = 0;
okbutton = false;
- setBackgroundColour(Colour::VIEWBACKGROUND);
setTitleBarOn(1);
setTitleBarColour(Colour::TITLEBARBACKGROUND);
}
dropThrough = 1;
}
-void VInfo::setMainText(char* takeText)
+void VInfo::setMainText(const char* takeText)
{
int length = strlen(takeText);
mainText = new char[length + 1];
mainTextType = NORMAL;
}
-void VInfo::setOneLiner(char* takeText)
+void VInfo::setOneLiner(const char* takeText)
{
int length = strlen(takeText);
mainText = new char[length + 1];
void VInfo::draw()
{
- View::draw();
+ TBBoxx::draw();
if (mainText)
{
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)
{
if (m->message == Message::MOUSE_LBDOWN)
{
- ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+ BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
}
}
#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();
#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)
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);
}
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);
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);
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);
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;
}
// 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);
}
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);
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)
//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
}
}
}
#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);
*/
#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 {
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()
sl.hintSetCurrent(media->index);
sl.draw();
doShowingBar();
- ViewMan::getInstance()->updateView(this);
+ boxstack->update(this);
}
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();
}
}
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");
sl.hintSetCurrent(0);
sl.draw();
doShowingBar();
- ViewMan::getInstance()->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::DF_UP:
sl.draw();
doShowingBar();
- ViewMan::getInstance()->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::DF_DOWN:
sl.draw();
doShowingBar();
- ViewMan::getInstance()->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::SKIPBACK:
sl.draw();
doShowingBar();
- ViewMan::getInstance()->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::SKIPFORWARD:
sl.draw();
doShowingBar();
- ViewMan::getInstance()->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::BLUE:
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;
}
}
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);
*/
{
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
}
}
}
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;
}
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()) {
if (mn != NULL) {
setList(mn);
draw();
- ViewMan::getInstance()->updateView(this);
+ boxstack->update(this);
return 0;
}
}
}
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);
}
const char * VMediaList::getDirname() const {
return dirlist->getCurrent()->getFullPath();
}
+
#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();
* fill the medialist basing on the current dirname
*/
int load();
+ BoxStack* boxstack;
MediaList *mediaList;
WSelectList sl;
bool loading;
#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()
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);
// 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);
}
{
isMuted = Audio::getInstance()->toggleUserMute();
draw();
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
// handled
return 2;
}
#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();
+++ /dev/null
-/*
- 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
- }
- }
- }
-}
+++ /dev/null
-/*
- 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
-
+++ /dev/null
-/*
- 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);
-}
+++ /dev/null
-/*
- 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
--- /dev/null
+/*
+ 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;
+ }
+ }
+ }
+}
+
--- /dev/null
+/*
+ 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
+
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);
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;
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);
{
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;
case Remote::UP:
case Remote::SKIPBACK:
showPicture(VMediaList::MV_PREV);
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
rt= 2;
break;
case Remote::FORWARD:
case Remote::DOWN:
case Remote::SKIPFORWARD:
showPicture(VMediaList::MV_NEXT);
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
rt= 2;
break;
case Remote::REVERSE:
{
slideshow=true;
showPicture(VMediaList::MV_NEXT);
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
rt= 2;
}
break;
break;
}
showPicture(VMediaList::MV_NONE,rotate);
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
rt=2;
break;
case Remote::GREEN:
//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
}
}
}
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;
}
load(currentMedia);
if (mediaError || jpeg.hasError()) destroyInfo();
else updateInfo();
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
}
}
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];
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);
}
}
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);
}
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",
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);
#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...
*/
class VPictureBanner;
-class VPicture : public View,public TimerReceiver
+class VPicture : public Boxx, public TimerReceiver
{
public:
~VPicture();
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;
ULONG ftime;
bool slideshow;
int showtime;
- char * mediaError;
+ const char * mediaError;
Media * currentMedia;
const static int INITIAL_SHOWTIME=5;
bool shortBanner;
*/
#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)
{
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);
void VPictureBanner::draw()
{
- View::draw();
+// View::draw();
if (loading) {
if (info) {
char buf[strlen(info)+100];
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) {
{
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
}
}
}
#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);
#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()
if (mainText) delete[] mainText;
}
-void VQuestion::setMainText(char* takeText)
+void VQuestion::setMainText(const char* takeText)
{
int length = strlen(takeText);
mainText = new char[length + 1];
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()
{
swap();
draw();
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
return 2;
}
case Remote::DF_RIGHT:
{
swap();
draw();
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
return 2;
}
case Remote::BACK:
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
}
}
}
#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);
#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();
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?
void VRadioRec::draw()
{
- View::draw();
+ fillColour(Colour::BLACK);
}
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);
m = new Message();
m->message = Message::ADD_VIEW;
- m->to = viewman;
+ m->to = boxstack;
m->parameter = (ULONG)vi;
Command::getInstance()->postMessageNoLock(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)
}
else
{
- ViewMan::getInstance()->handleCommand(Remote::OK); //simulate rok press
+ boxstack->handleCommand(Remote::OK); //simulate rok press
}
}
else if (m->message == Message::PLAYER_EVENT)
*/
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;
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);
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);
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);
#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);
Timers* timers;
PlayerRadio* player;
Recording* myRec;
+ BoxStack* boxstack;
Colour barBlue;
#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);
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();
}
{
sl.up();
sl.draw();
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
return 2;
}
case Remote::DF_DOWN:
{
sl.down();
sl.draw();
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
return 2;
}
case Remote::OK:
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
}
}
}
#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);
/*
- 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()
}
}
- View::draw();
+ TBBoxx::draw();
if (loading)
{
// 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);
{
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
}
}
}
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);
}
}
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);
}
}
{
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;
sl.draw();
doShowingBar();
- viewman->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::DF_DOWN:
doShowingBar();
Log::getInstance()->log("P", Log::DEBUG, "3");
- viewman->updateView(this);
+ boxstack->update(this);
Log::getInstance()->log("P", Log::DEBUG, "4");
return 2;
}
sl.draw();
doShowingBar();
- viewman->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::SKIPFORWARD:
sl.draw();
doShowingBar();
- viewman->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::OK:
slIndexStack.push(sl.getCurrentOption());
sl.clear();
draw();
- viewman->updateView(this);
+ boxstack->update(this);
}
return 2;
}
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
recman->up();
sl.clear();
draw(true);
- viewman->updateView(this);
+ boxstack->update(this);
return 2;
}
else
recman->sort();
draw();
- viewman->updateView(this);
+ boxstack->update(this);
}
return success;
recman->sort();
sl.clear();
draw();
- viewman->updateView(this);
+ boxstack->update(this);
}
+
#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();
void drawData(bool doIndexPop = false);
private:
-
+ BoxStack* boxstack;
bool loading;
RecMan* recman;
Directory* dir;
#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()
rec = trec;
}
-void VRecordingMenu::draw()
-{
- View::draw();
- sl.draw();
-}
-
int VRecordingMenu::handleCommand(int command)
{
switch(command)
{
sl.up();
sl.draw();
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
return 2;
}
case Remote::DF_DOWN:
{
sl.down();
sl.draw();
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
return 2;
}
case Remote::OK:
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();
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;
}
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);
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;
}
}
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
}
}
}
{
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);
{
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);
#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);
int handleCommand(int command);
void processMessage(Message* m);
- void draw();
private:
RecMan* recman;
#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;
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);
#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
{
void initSelectList(bool startup);
void doSave();
void* parent;
-
};
#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();
void VScreensaver::draw()
{
- setBackgroundColour(Colour::BLACK);
- View::draw();
+ fillColour(Colour::BLACK);
threadStart();
}
int VScreensaver::handleCommand(int command)
{
threadCancel();
-
return 4;
}
#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"
#endif
-class VScreensaver : public View, public Thread_TYPE
+class VScreensaver : public Boxx, public Thread_TYPE
{
public:
VScreensaver();
#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
// 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++)
void VServerSelect::draw()
{
- View::draw();
- sl.draw();
+ TBBoxx::draw();
}
int VServerSelect::handleCommand(int command)
{
sl.up();
sl.draw();
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
return 2;
}
case Remote::DF_DOWN:
{
sl.down();
sl.draw();
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
return 2;
}
case Remote::OK:
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
}
}
}
#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);
+++ /dev/null
-/*
- 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;
- }
- }
-}
+++ /dev/null
-/*
- 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
-
#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;
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:
{
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:
{
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);
+ }
}
}
+
#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
+
#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;
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()
first = 0;
}
- sl.draw();
- drawShowing();
- drawIndicators();
- ViewMan::getInstance()->updateView(this);
return true;
}
{
if (flipflop)
{
- //rectangle(6, ypos, 18, 16, Colour::RED);
rectangle(6, ypos, 18, 16, Colour::RED);
drawText("R", 8, ypos-3, Colour::LIGHTTEXT);
}
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);
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);
sl.draw();
drawShowing();
drawIndicators();
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
return 2;
}
case Remote::DF_DOWN:
sl.draw();
drawShowing();
drawIndicators();
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
return 2;
}
case Remote::SKIPBACK:
sl.draw();
drawShowing();
drawIndicators();
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
return 2;
}
case Remote::SKIPFORWARD:
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;
}
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);
+ }
}
+
#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();
void timercall(int clientReference);
void processMessage(Message* m);
bool load();
+ void draw();
private:
RecTimerList* recTimerList;
#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;
((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");
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;
return instance;
}
-void VVideoLive::draw()
-{
- View::draw();
-}
-
int VVideoLive::handleCommand(int command)
{
switch(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
}
{
vlb->setChannel((*chanList)[currentChannel]);
vlb->draw();
- viewman->updateView(vlb);
+ boxstack->update(vlb);
}
play();
{
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)
{
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)
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;
}
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;
}
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()
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;
}
}
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)
{
VEpg* vepg = new VEpg(this, currentChannel, streamType);
vepg->draw();
- viewman->add(vepg);
- viewman->updateView(vepg);
+ boxstack->add(vepg);
+ boxstack->update(vepg);
}
void VVideoLive::toggleChopSides()
video->setMode(Video::NORMAL);
}
}
+
#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
private:
static VVideoLive* instance;
- // ViewMan* viewman;
+ BoxStack* boxstack;
VDR* vdr;
Video* video;
void* player; // HA HA FIXME
#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();
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);
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();
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();
// rec->recInfo->resumePoint - this will fix the ~10s offset problem as well
}
-void VVideoRec::draw()
-{
- View::draw();
-}
-
void VVideoRec::go(bool resume)
{
ULONG startFrameNum;
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);
m = new Message();
m->message = Message::ADD_VIEW;
- m->to = viewman;
+ m->to = boxstack;
m->parameter = (ULONG)vi;
Command::getInstance()->postMessageNoLock(m);
}
return 2;
}
- case Remote::STOP:
case Remote::BACK:
+ {
+ if (vsummary)
+ {
+ removeSummary();
+ return 2;
+ }
+ } // DROP THROUGH
+ case Remote::STOP:
case Remote::MENU:
{
if (playing) stopPlay();
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())
player->skipForward(10);
return 2;
}
- case Remote::GREEN:
- {
- doAudioSelector();
- return 2;
- }
case Remote::FULL:
case Remote::TV:
{
case Remote::OK:
{
+ if (vsummary)
+ {
+ removeSummary();
+ return 2;
+ }
+
if (barShowing) removeBar();
else doBar(0);
return 2;
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();
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
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)
{
}
else
{
- ViewMan::getInstance()->handleCommand(Remote::OK); //simulate rok press
+ BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press
}
}
else if (m->from == player)
Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 43");
wss.setWide(false);
wss.draw();
- viewman->updateView(this, &wssRegion);
+ boxstack->update(this, &wssRegion);
}
break;
}
Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 169");
wss.setWide(true);
wss.draw();
- viewman->updateView(this, &wssRegion);
+ boxstack->update(this, &wssRegion);
}
break;
}
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)
*/
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;
drawBarClocks();
- viewman->updateView(this, &barRegion);
+ boxstack->update(this, &barRegion);
timers->cancelTimer(this, 1);
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);
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);
+ }
+}
+
#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);
void processMessage(Message* m);
private:
- // ViewMan* viewman;
+ BoxStack* boxstack;
VDR* vdr;
Video* video;
Timers* timers;
void drawBarClocks();
void stopPlay();
void removeBar();
+ void doSummary();
+ void removeSummary();
Region barRegion;
Region clocksRegion;
Wwss wss;
Region wssRegion;
bool dowss;
+
+ VInfo* vsummary;
};
#endif
#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()
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;
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();
}
// 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);
}
{
displayVolume = Audio::getInstance()->volumeDown();
draw();
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
// handled
return 2;
}
{
displayVolume = Audio::getInstance()->volumeUp();
draw();
- ViewMan::getInstance()->updateView(this);
+ BoxStack::getInstance()->update(this);
// handled
return 2;
}
#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();
+++ /dev/null
-/*
- 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();
-}
+++ /dev/null
-/*
- 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
#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);
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()
void VWelcome::draw()
{
- View::draw();
- sl.draw();
- jpeg.init("/vdr.jpg");
- jpeg.draw();
+ TBBoxx::draw();
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);
{
sl.up();
sl.draw();
- viewman->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::DF_DOWN:
{
sl.down();
sl.draw();
- viewman->updateView(this);
+ boxstack->update(this);
return 2;
}
case Remote::ONE:
case Remote::NINE:
{
VScreensaver* vscreensaver = new VScreensaver();
- viewman->add(vscreensaver);
+ boxstack->add(vscreensaver);
vscreensaver->draw();
-// viewman->updateView(vscreensaver);
+// boxstack->update(vscreensaver);
return 2;
}
vchan->setList(chanList);
vchan->draw();
- viewman->add(vchan);
- viewman->updateView(vchan);
+ boxstack->add(vchan);
+ boxstack->update(vchan);
}
else
{
vchan->setList(chanList);
vchan->draw();
- viewman->add(vchan);
- viewman->updateView(vchan);
+ boxstack->add(vchan);
+ boxstack->update(vchan);
}
else
{
{
VRecordingList* vrec = new VRecordingList();
vrec->draw();
- viewman->add(vrec);
- viewman->updateView(vrec);
+ boxstack->add(vrec);
+ boxstack->update(vrec);
if (!vrec->load())
{
{
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)
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
}
}
}
#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();
WSelectList sl;
WJpeg jpeg;
- // ViewMan* viewman;
+ BoxStack* boxstack;
void doChannelsList();
void doRadioList();
#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()
if (mytext) delete[] mytext;
}
-void WButton::setText(char* takeText)
+void WButton::setText(const char* takeText)
{
int length = strlen(takeText);
mytext = new char[length + 1];
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);
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;
}
#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();
private:
UCHAR active;
+ bool dimmed;
char* mytext;
int tag;
+++ /dev/null
-/*
- 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;
-}
+++ /dev/null
-/*
- 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
#include "audiowin.h"
#include "vdr.h"
#include "osdwin.h"
-#include "viewman.h"
+#include "boxstack.h"
#include "command.h"
void sighandler(int signalReceived);
Led* led;
Osd* osd;
Timers* timers;
-ViewMan* viewman;
+BoxStack* boxstack;
Command* command;
VDR* vdr;
Video* video;
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);
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;
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);
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);
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
return (((ULLONG)htonl((ULONG)((a<<32)>> 32))<<32)
|(ULONG)htonl(((ULONG) (a >> 32))));
}
-#endif
\ No newline at end of file
+#endif
+
#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);
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() {
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;
//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 {
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);
#include <netinet/in.h>
#include "wol.h"
+#include "log.h"
+
#define _PATH_PROCNET_ARP "/proc/net/arp"
Wol* Wol::instance = NULL;
#include <stdio.h>
#include <string.h>
-#include "log.h"
+
+class Log;
class Wol
{
#include "woptionbox.h"
+#include "colour.h"
+#include "unistd.h"
+
WOptionBox::WOptionBox()
{
numOptions = 0;
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()
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()
{
++currentOption;
}
+ setData();
}
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)
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;
}
#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();
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);
UINT currentOption;
int mode;
+
+ void setData();
+
+ WSymbol leftArrow;
+ WSymbol rightArrow;
+ WTextbox textbox;
};
#endif
--- /dev/null
+/*
+ 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;
+}
+
+
+
+
--- /dev/null
+/*
+ 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
+
--- /dev/null
+/*
+ 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;
+}
+
+
--- /dev/null
+/*
+ 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
+
#include "wselectlist.h"
+#include "colour.h"
+
WSelectList::WSelectList()
{
selectedOption = 0;
noLoop = 0;
gap = 1;
showseloption = true;
+ backgroundColour = Colour::VIEWBACKGROUND;
}
WSelectList::~WSelectList()
noLoop = 1;
}
+void WSelectList::setBackgroundColour(Colour& colour)
+{
+ backgroundColour = colour;
+}
+
void WSelectList::hintSetCurrent(int idx)
{
selectedOption = 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();
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;
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*/
#include <vector>
#include "defines.h"
-#include "widget.h"
-#include "colour.h"
+#include "boxx.h"
using namespace std;
ULONG data;
} wsloption;
-class WSelectList : public Widget
+class WSelectList : public Boxx
{
public:
WSelectList();
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();
int numColumns;
int noLoop;
bool showseloption;
+
+ UINT gap;
+ Colour backgroundColour;
};
#endif
#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};
#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();
--- /dev/null
+/*
+ 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;
+}
+
--- /dev/null
+/*
+ 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
#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)
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)
#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
#include "wwss.h"
+#include "colour.h"
+#include "video.h"
+
Wwss::Wwss()
{
format = Video::NTSC;
#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();