CXX = $(CC)
INCLUDES = -I../jpeg-6b
-CXXFLAGS_DEV = -g -O0 -Wall -Woverloaded-virtual -Werror -DDEV -D_GNU_SOURCE $(INCLUDES)
-CXXFLAGS_REL = -O3 -Wall -Woverloaded-virtual -Werror -D_GNU_SOURCE $(INCLUDES)
+CXXFLAGS_DEV = -g -O0 -Wall -Woverloaded-virtual -Wshadow -Werror -DDEV -D_GNU_SOURCE $(INCLUDES)
+CXXFLAGS_REL = -O3 -Wall -Woverloaded-virtual -Wshadow -Werror -D_GNU_SOURCE $(INCLUDES)
LDFLAGS = -Wall -static
LIBPATHS =
view.o vinfo.o vwallpaper.o vvolume.o vrecordinglist.o vlivebanner.o vmute.o \
vrecordingmenu.o vquestion.o vchannellist.o vwelcome.o vvideolive.o vvideorec.o vradiolive.o \
vchannelselect.o vserverselect.o colour.o vconnect.o voptions.o \
- wselectlist.o wjpeg.o wsymbol.o wbutton.o woptionbox.o \
+ widget.o wselectlist.o wjpeg.o wsymbol.o wbutton.o woptionbox.o \
fonts/helvB24.o fonts/helvB18.o
.PHONY: clean fresh all install strip
int b = ioctl(fdAudio, AV_SET_AUD_DISABLE_SYNC, &a);
- printf("Audio sync disable = %i\n", b);
+ printf("Audio sync disable = %i\n", b); // is in a DEV block
return 1;
{
height = 0;
width = 0;
+
screenX = 0;
screenY = 0;
+ offsetX = 0;
+ offsetY = 0;
numBoxes++;
Log::getInstance()->log("Box", Log::DEBUG, "Construct, now %u", numBoxes);
- surface = Surface::getObject(Surface::BUFFER);
+ surface = NULL;
}
Box::~Box()
{
}
-void Box::setDimensions(int w, int h)
-{
- width = w;
- height = h;
-}
-
void Box::setScreenPos(int x, int y)
{
screenX = x;
screenY = y;
}
-void Box::show()
+void Box::setSurfaceOffset(UINT x, UINT y)
{
- Log::getInstance()->log("Box", Log::DEBUG, "Show data %u %u %u %u", screenX, screenY, width, height);
- surface->updateToScreen(screenX, screenY, width, height);
+ offsetX = x;
+ offsetY = y;
}
-void Box::showAll()
+void Box::show(int noBufferToScreen)
{
- Surface::bufferToScreen();
+ Log::getInstance()->log("Box", Log::DEBUG, "Show data %p %u %u %u %u %u", surface, screenX, screenY, width, height, noBufferToScreen);
+ surface->updateToBuffer(screenX, screenY, width, height);
+ if (!noBufferToScreen) Surface::bufferToScreen(screenX, screenY, width, height);
}
int Box::getScreenX()
}
thisCharWidth = surface->getCharWidth(text[textPos]);
- if ((lineWidth + thisCharWidth) > (width - (2 * paraMargin)))
+ if ((lineWidth + thisCharWidth) > (int)(width - (2 * paraMargin)))
{
// this character would break the right margin
if (text[textPos] == ' ')
{
drawText(line, x, ypos, colour);
ypos += lineHeight;
- if (ypos > (height - lineHeight)) break;
+ if (ypos > (int)(height - lineHeight)) break;
}
else
{
// Level 0 drawing functions
-void Box::rectangle(int x1, int y1, int width, int height, Colour& colour)
+void Box::rectangle(int x1, int y1, int w, int h, Colour& colour)
{
- surface->fillblt(screenX + x1, screenY + y1, width, height, surface->rgba(colour.red, colour.green, colour.blue, colour.alpha));
+ surface->fillblt(offsetX + x1, offsetY + y1, w, h, surface->rgba(colour.red, colour.green, colour.blue, colour.alpha));
}
void Box::drawText(char* text, int x, int y, Colour& colour)
{
- surface->drawText(text, screenX + x, screenY + y, colour.red, colour.green, colour.blue);
+ surface->drawText(text, offsetX + x, offsetY + y, colour.red, colour.green, colour.blue);
}
void Box::drawTextRJ(char* text, int x, int y, Colour& colour)
{
- surface->drawTextRJ(text, screenX + x, screenY + y, colour.red, colour.green, colour.blue);
+ surface->drawTextRJ(text, offsetX + x, offsetY + y, colour.red, colour.green, colour.blue);
}
-void Box::drawPixel(int x, int y, Colour& colour)
+void Box::drawPixel(UINT x, UINT y, Colour& colour)
{
- int c;
- c = ( (0xFF000000 )
+ int c = ( (0xFF000000 )
| (colour.red << 16)
| (colour.green << 8)
| (colour.blue ) );
- surface->drawPixel(screenX + x, screenY + y, c);
+ surface->drawPixel(offsetX + x, offsetY + y, c);
}
virtual ~Box();
void setScreenPos(int x, int y);
- void setDimensions(int w, int h);
- void show();
+ void setSurfaceOffset(UINT x, UINT y);
+
+ void show(int noBufferToScreen = 0);
virtual void draw();
void rectangle(int x1, int y1, int x2, int y2, Colour& colour);
void drawText(char* text, int x, int y, Colour& colour);
void drawTextRJ(char* text, int x, int y, Colour& colour);
- void drawPixel(int x, int y, Colour& colour);
+ void drawPixel(UINT x, UINT y, Colour& colour);
int getScreenX();
int getScreenY();
int getWidth();
int getHeight();
- static void showAll();
-
private:
protected:
Surface* surface;
- int width;
- int height;
+ UINT width;
+ UINT height;
int screenX;
int screenY;
+ UINT offsetX;
+ UINT offsetY;
+
static char numBoxes;
static const int paraMargin = 10;
// Blue background
View* v = new View();
- v->setDimensions(video->getScreenWidth(), video->getScreenHeight());
+ v->create(video->getScreenWidth(), video->getScreenHeight());
v->setBackgroundColour(Colour::VIDEOBLUE);
v->draw();
v->show();
}
else
{
- ViewMan* viewman = ViewMan::getInstance();
-
viewman->removeAll();
- viewman->redrawAll();
VDR::getInstance()->configSave("General", "Last Power State", "Off");
VDR::getInstance()->disconnect();
void Command::doJustConnected(VConnect* vconnect)
{
Video* video = Video::getInstance();
- ViewMan* viewman = ViewMan::getInstance();
viewman->removeView(vconnect, 0, 1);
VInfo* vi = new VInfo();
- vi->setDimensions(400, 200);
+ vi->create(400, 200);
if (video->getFormat() == Video::PAL)
vi->setScreenPos(170, 200);
else
viewman->removeView(vi);
VWelcome* vw = new VWelcome();
+ vw->draw();
+ vw->show();
viewman->add(vw);
- viewman->redrawAll();
+// viewman->redrawAll();
/*
handleCommand(Remote::DOWN);
#include "viewman.h"
#include "command.h"
-void sighandler(int signal);
+void sighandler(int signalReceived);
void shutdown(int code);
// Global variables --------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------------
-void sighandler(int signal)
+void sighandler(int signalReceived)
{
- Log* logger = Log::getInstance();
-
logger->log("Core", Log::NOTICE, "Signal %i received", signal);
- switch (signal)
+ switch (signalReceived)
{
case SIGINT:
{
Video* video = Video::getInstance();
- screen = new Surface(fdOsd, Surface::SCREEN);
- screen->create(video->getScreenHeight(), video->getScreenWidth());
+ screen = new Surface(Surface::SCREEN);
+ screen->create(video->getScreenWidth(), video->getScreenHeight());
screen->display();
if (doubleBuffering)
{
- buffer = new Surface(fdOsd, Surface::BUFFER);
- buffer->create(video->getScreenHeight(), video->getScreenWidth());
+ buffer = new Surface(Surface::BUFFER);
+ buffer->create(video->getScreenWidth(), video->getScreenHeight());
}
else
{
buf = vdr->getBlock(feedPosition, askFor, &thisRead);
if (!buf) break;
- // temp
- printf("Written direct: %i\n", write(audio->getFD(), buf, thisRead));
+ printf("Written direct: %i\n", write(audio->getFD(), buf, thisRead)); // temp
flipflop = !flipflop;
- printf("A = %i\n", a);
+ printf("A = %i\n", a); commented out
*/
Log::getInstance()->log("Player", Log::DEBUG, "PLAYER TEST 1 4X3");
*/
#include "surface.h"
+#include "osd.h"
Surface* Surface::screen = NULL;
Surface* Surface::buffer = NULL;
int Surface::disableDoubleBuffering = 0;
+osd_font_t* Surface::font = &font_helvB18;
-Surface::Surface(int fd, int id)
+Surface::Surface(int id)
{
if (id == SCREEN) screen = this;
if (id == BUFFER) buffer = this;
- fdOsd = fd;
+ fdOsd = Osd::getInstance()->getFD();
memset(&surface, 0, sizeof(osd_surface_t));
memset(&surface.sfc, 0, sizeof(stbgfx_sfc_t));
memset(&surface.map, 0, sizeof(stbgfx_map_t));
-
- font = &font_helvB18;
}
Surface::~Surface()
return NULL;
}
-int Surface::create(int height, int width)
+int Surface::create(UINT width, UINT height)
{
int r = 0;
int displayNumber = 0; // mvpmc iterates 0->15 till it gets one that works?
void Surface::bufferToScreen() // static, this is for Box::showAll
{
if (disableDoubleBuffering) return;
- buffer->updateToScreen(0, 0, buffer->surface.sfc.width, buffer->surface.sfc.height);
+
+ Log::getInstance()->log("Surface", Log::DEBUG, "Full buffer to screen");
+ bufferToScreen(0, 0, buffer->surface.sfc.width, buffer->surface.sfc.height);
}
-int Surface::updateToScreen(int x, int y, int width, int height) // main method for all normal windows
-{
+//int Surface::updateToScreen(int x, int y, int width, int height) // main method for all normal windows
+//{
/*
With double buffering:
A view has buffer for its surface. this is buffer, copy area specified to screen
A view has screen for its surface. this is screen, all painting work has already been done. ignore
*/
- if (this == screen) return 0;
+// if (this == screen) return 0;
+//
+// return blt(fdOsd, surface.sfc.handle, x, y, width, height, screen->getSurfaceHandle(), x, y);
+//}
- return blt(fdOsd, surface.sfc.handle, x, y, width, height, screen->getSurfaceHandle(), x, y);
+int Surface::bufferToScreen(int x, int y, int width, int height) // static
+{
+ return blt(Osd::getInstance()->getFD(), buffer->getSurfaceHandle(), x, y, width, height, screen->getSurfaceHandle(), x, y);
+}
+
+int Surface::updateToBuffer(int x, int y, int width, int height) // main method for all normal windows
+{
+ return blt(fdOsd, surface.sfc.handle, 0, 0, width, height, buffer->getSurfaceHandle(), x, y);
}
int Surface::blt(int fd, unsigned long shandle, int sx, int sy, int width, int height, unsigned long dhandle, int dx, int dy)
#include <jpeglib.h>
}
+#include "defines.h"
#include "log.h"
class Surface
{
public:
- Surface(int fd, int id);
+ Surface(int id = 0);
~Surface();
static Surface* getObject(int id);
+ static int bufferToScreen(int x, int y, int width, int height);
+ static int getFontHeight();
- int create(int height, int width);
+ int create(UINT width, UINT height);
void display();
unsigned long getSurfaceHandle();
void drawPixel(int x, int y, unsigned int c);
void drawHorzLine(int x1, int x2, int y, unsigned int c);
void drawVertLine(int x, int y1, int y2, unsigned int c);
- int updateToScreen(int x, int y, int width, int height);
+ int updateToBuffer(int x, int y, int width, int height);
int drawText(char* text, int x, int y, int r, int g, int b);
int drawTextRJ(char* text, int x, int y, int r, int g, int b);
int getCharWidth(char c);
- int getFontHeight();
void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b);
void yuv2rgb(int y, int u, int v, unsigned char* pr, unsigned char* pg, unsigned char* pb);
void screenShot(char* fileName);
static Surface* screen;
static Surface* buffer;
static int disableDoubleBuffering;
+ static osd_font_t* font;
int fdOsd;
osd_surface_t surface;
- osd_font_t* font;
void rgb2yuv(unsigned char r, unsigned char g, unsigned char b, unsigned char *y, unsigned char *u, unsigned char *v);
VChannelList::VChannelList(ULONG type)
{
+ create(570, 420);
if (Video::getInstance()->getFormat() == Video::PAL)
{
setScreenPos(80, 70);
setScreenPos(70, 35);
}
- setDimensions(570, 420);
setBackgroundColour(Colour::VIEWBACKGROUND);
setTitleBarOn(1);
}
setTitleBarColour(Colour::TITLEBARBACKGROUND);
- sl.setScreenPos(screenX + 10, screenY + 30 + 5);
+ sl.setSurface(surface);
+ sl.setSurfaceOffset(10, 30 + 5);
sl.setDimensions(width - 20, height - 30 - 15 - 30);
}
// Put the status stuff at the bottom
WSymbol w;
+ w.setSurface(surface);
w.nextSymbol = WSymbol::UP;
- w.setScreenPos(screenX + 20, screenY + 385);
+ w.setSurfaceOffset(20, 385);
w.draw();
w.nextSymbol = WSymbol::DOWN;
- w.setScreenPos(screenX + 50, screenY + 385);
+ w.setSurfaceOffset(50, 385);
w.draw();
w.nextSymbol = WSymbol::SKIPBACK;
- w.setScreenPos(screenX + 85, screenY + 385);
+ w.setSurfaceOffset(85, 385);
w.draw();
w.nextSymbol = WSymbol::SKIPFORWARD;
- w.setScreenPos(screenX + 115, screenY + 385);
+ w.setSurfaceOffset(115, 385);
w.draw();
w.nextSymbol = WSymbol::PLAY;
- w.setScreenPos(screenX + 150, screenY + 385);
+ w.setSurfaceOffset(150, 385);
w.draw();
doShowingBar();
char showing[200];
sprintf(showing, "%i to %i of %i", topOption, sl.getBottomOption(), sl.getNumOptions());
- Box b;
- b.setScreenPos(screenX + 220, screenY + 385);
- b.setDimensions(160, 25);
- b.fillColour(Colour::VIEWBACKGROUND);
- b.drawText(showing, 0, 0, Colour::LIGHTTEXT);
+
+// 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);
}
int VChannelList::handleCommand(int command)
private:
ChannelList* chanList;
- ULONG type;
WSelectList sl;
VChannelSelect::VChannelSelect(VVideoLive* v, int command)
{
- setDimensions(53, 30);
+ create(53, 30);
setScreenPos(80, 60);
setBackgroundColour(Colour::VIEWBACKGROUND);
vdr = VDR::getInstance();
logger = Log::getInstance();
- setDimensions(400, 200);
+ create(400, 200);
if (Video::getInstance()->getFormat() == Video::PAL)
{
setScreenPos(170, 200);
void VConnect::draw()
{
VInfo::draw();
+ logger->log("VConnect", Log::DEBUG, "Draw done");
}
int VConnect::handleCommand(int command)
threadWaitForSignal();
}
- logger->log("Command", Log::NOTICE, "Connecting to server at %s", serverIPs[selectedServer]);
+ logger->log("VConnect", Log::NOTICE, "Connecting to server at %s", serverIPs[selectedServer]);
vdr->setServerIP(serverIPs[selectedServer]);
// Clear the serverIPs vector
titleText = NULL;
+ surface = NULL;
+
numViews++;
Log::getInstance()->log("View", Log::DEBUG, "Construct %p, now %u", this, numViews);
}
{
if (titleText) delete[] titleText;
+ delete surface;
+
numViews--;
Log::getInstance()->log("View", Log::DEBUG, "Destruct, now %u", numViews);
}
+bool View::create(UINT w, UINT h)
+{
+ width = w;
+ height = h;
+
+ surface = new Surface();
+ return surface->create(width, height);
+}
+
void View::setTitleText(char* takeText)
{
int length = strlen(takeText);
public:
View();
virtual ~View();
+ bool create(UINT width, UINT height);
virtual void draw();
virtual int handleCommand(int command);
{
if (!initted) return 0;
+ // FIXME don't think this can work properly, removeAll leaves the wallpaper there!
removeAll();
// get the lock here to ensure that the thread is waiting on the cond
&& ((toDelete->getScreenY() + toDelete->getHeight()) <= (newTopBox->getScreenY() + newTopBox->getHeight()))
)
{
- newTopBox->draw();
newTopBox->show();
Log::getInstance()->log("ViewMan", Log::DEBUG, "re-draw using optimisation 2");
}
// no optimisations left, redo everything.
else
{
- redrawAll(noShow);
+ for (int j = 1; j <= topView; j++)
+ {
+ views[j]->show(1);
+ }
+ if (!noShow) Surface::bufferToScreen();
+
Log::getInstance()->log("ViewMan", Log::DEBUG, "re-draw using no optimisation");
}
}
}
-void ViewMan::redrawAll(int noShow)
-{
- for (int i = 1; i <= topView; i++)
- {
- views[i]->draw();
- }
-
- if (!noShow) Box::showAll();
-}
-
// ---------------------------------------------------- END OF REMOVE CODE
delete views[topView];
}
+ Surface::bufferToScreen();
+
resetThread();
pthread_mutex_unlock(&viewManLock);
}
}
case Message::UPDATE_SCREEN:
{
- Box::showAll();
+ Surface::bufferToScreen();
break;
}
case Message::SWAP_ME_FOR:
toReplace->delNSec = currentTime.tv_nsec;
}
toReplace->draw();
- Box::showAll();
+ toReplace->show();
+ Surface::bufferToScreen();
resetThread();
break;
}
View* toAdd = (View*)m->parameter;
addNoLock(toAdd);
toAdd->draw();
- Box::showAll();
+ toAdd->show();
}
}
}
-int ViewMan::timedDelete(View* v, int seconds, int lock)
+int ViewMan::timedDelete(View* v, int seconds, int lockMutex)
{
int success;
- if (lock) pthread_mutex_lock(&viewManLock);
+ if (lockMutex) pthread_mutex_lock(&viewManLock);
struct timespec currentTime;
clock_gettime(CLOCK_REALTIME, ¤tTime);
}
resetThread();
- if (lock) pthread_mutex_unlock(&viewManLock);
+ if (lockMutex) pthread_mutex_unlock(&viewManLock);
return success;
}
View* nextToDelete = NULL;
// I don't want signals
- sigset_t sigset;
- sigfillset(&sigset);
- pthread_sigmask(SIG_BLOCK, &sigset, NULL);
+ sigset_t sigs;
+ sigfillset(&sigs);
+ pthread_sigmask(SIG_BLOCK, &sigs, NULL);
// locked here
#include "message.h"
#include "messagequeue.h"
#include "remote.h"
+#include "surface.h"
class ViewMan : public MessageQueue
{
int addNoLock(View* v);
int removeView(View* toRemove = NULL, int noLock = 0, int noShow = 0);
void removeAll();
- void redrawAll(int noShow = 0);
int handleCommand(UCHAR command);
int timedDelete(View* v, int seconds, int lock);
- //
// not for external use
void startAutoDeleteThread3();
eventList = NULL;
parent = tparent;
+ create(500, 120);
if (Video::getInstance()->getFormat() == Video::PAL)
{
setScreenPos(125, 410);
setScreenPos(115, 320);
}
- setDimensions(500, 120);
setBackgroundColour(Colour::VIEWBACKGROUND);
setTitleBarOn(1);
setTitleBarColour(Colour::TITLEBARBACKGROUND);
- sl.setScreenPos(screenX, screenY + 30);
+ sl.setSurface(surface);
+ sl.setSurfaceOffset(0, 30);
sl.setDimensions(width, height - 60);
sl.setNoLoop();
{
vi->setScreenPos(110, 90);
}
- vi->setDimensions(510, 270);
+ vi->create(510, 270);
ViewMan::getInstance()->addNoLock(vi);
vi->draw();
{
isMuted = Audio::getInstance()->toggleUserMute();
+ create(40, 40);
if (Video::getInstance()->getFormat() == Video::PAL)
{
setScreenPos(600, 500);
setScreenPos(590, 400);
}
- setDimensions(40, 40);
-
setBackgroundColour(Colour::VIEWBACKGROUND);
}
{
View::draw();
- WSymbol* w = new WSymbol;
- if (isMuted) w->nextSymbol = WSymbol::MUTE;
- else w->nextSymbol = WSymbol::UNMUTE;
- w->setScreenPos(screenX + 5, screenY + 5);
- w->draw();
-
- delete w;
+ WSymbol w;
+ w.setSurface(surface);
+ if (isMuted) w.nextSymbol = WSymbol::MUTE;
+ else w.nextSymbol = WSymbol::UNMUTE;
+ w.setSurfaceOffset(5, 5);
+ w.draw();
}
int VMute::handleCommand(int command)
VOptions::VOptions()
{
- setDimensions(500, 250);
-
+ create(500, 250);
if (Video::getInstance()->getFormat() == Video::PAL)
{
setScreenPos(120, 140);
int fontHeight = surface->getFontHeight();
- optionBox[0].setScreenPos(screenX + 330, screenY + 45);
+ optionBox[0].setSurface(surface);
+ optionBox[0].setSurfaceOffset(330, 45);
optionBox[0].setDimensions(150, fontHeight);
optionBox[0].addOption("Old");
optionBox[0].addOption("New");
- optionBox[1].setScreenPos(screenX + 330, screenY + 75);
+ optionBox[1].setSurface(surface);
+ optionBox[1].setSurfaceOffset(330, 75);
optionBox[1].setDimensions(150, fontHeight);
optionBox[1].addOption("RGB+composite");
optionBox[1].addOption("S-Video");
- optionBox[2].setScreenPos(screenX + 330, screenY + 105);
+ optionBox[2].setSurface(surface);
+ optionBox[2].setSurfaceOffset(330, 105);
optionBox[2].setDimensions(150, fontHeight);
optionBox[2].addOption("4:3");
optionBox[2].addOption("16:9");
- optionBox[3].setScreenPos(screenX + 330, screenY + 135);
+ optionBox[3].setSurface(surface);
+ optionBox[3].setSurfaceOffset(330, 135);
optionBox[3].setDimensions(150, fontHeight);
optionBox[3].addOption("On");
optionBox[3].addOption("Off");
optionBox[3].addOption("Last state");
- optionBox[4].setScreenPos(screenX + 330, screenY + 165);
+ optionBox[4].setSurface(surface);
+ optionBox[4].setSurfaceOffset(330, 165);
optionBox[4].setDimensions(150, fontHeight);
optionBox[4].addOption("All");
optionBox[4].addOption("FTA only");
drawText("Press back to exit, <, > or [ok] to change", 10, 220, Colour::LIGHTTEXT);
+ wsy.setSurface(surface);
+
for (UINT i = 0; i < numOptions; i++)
{
if (i == selectedOption) cl = Colour::SELECTHIGHLIGHT;
wsy.nextSymbol = WSymbol::LEFTARROW;
wsy.nextColour = cl;
- wsy.setScreenPos(screenX + 312, screenY + 47 + (i * 30));
+ wsy.setSurfaceOffset(312, 47 + (i * 30));
wsy.draw();
wsy.nextSymbol = WSymbol::RIGHTARROW;
- wsy.setScreenPos(screenX + 482, screenY + 47 + (i * 30));
+ wsy.setSurfaceOffset(482, 47 + (i * 30));
wsy.draw();
optionBox[i].draw();
optionBox[i].show();
mainText = NULL;
selectedOption = NO;
+ buttonYes.setSurfaceOffset(40, 120);
+ buttonNo.setSurfaceOffset(140, 120);
+
buttonYes.setText("Yes");
buttonNo.setText("No");
buttonNo.setActive(1);
-
}
VQuestion::~VQuestion()
{
View::draw();
- buttonYes.setScreenPos(screenX + 40, screenY + 120);
- buttonNo.setScreenPos(screenX + 140, screenY + 120);
+ buttonYes.setSurface(surface);
+ buttonNo.setSurface(surface);
if (mainText) drawPara(mainText, 10, 45, Colour::LIGHTTEXT);
buttonYes.draw();
chanList = tchanList;
currentChannel = 0;
- setDimensions(100, 100);
+ create(100, 100);
setBackgroundColour(Colour::VIEWBACKGROUND);
}
#include "vrecordinglist.h"
-VRecordingList::VRecordingList(VRecordingList* parent)
+VRecordingList::VRecordingList(VRecordingList* tparent)
{
- myParent = parent;
+ myParent = tparent;
dataInvalid = 0;
+ create(570, 420);
if (Video::getInstance()->getFormat() == Video::PAL)
{
setScreenPos(80, 70);
setScreenPos(70, 35);
}
- setDimensions(570, 420);
-
setBackgroundColour(Colour::VIEWBACKGROUND);
setTitleBarOn(1);
setTitleBarColour(Colour::TITLEBARBACKGROUND);
- sl.setScreenPos(screenX + 10, screenY + 30 + 5);
+ sl.setSurface(surface);
+ sl.setSurfaceOffset(10, 30 + 5);
sl.setDimensions(width - 20, height - 30 - 15 - 30);
}
Recording* rec;
- for (UINT i = 0; i < recDir->recList.size(); i++)
+ for (UINT j = 0; j < recDir->recList.size(); j++)
{
- rec = recDir->recList[i];
+ rec = recDir->recList[j];
btime = localtime((time_t*)&rec->start);
strftime(tempA, 299, "%0d/%0m %0H:%0M ", btime);
sprintf(tempB, "%s\t%s", tempA, rec->getProgName());
// Put the status stuff at the bottom
WSymbol w;
+ w.setSurface(surface);
w.nextSymbol = WSymbol::UP;
- w.setScreenPos(screenX + 20, screenY + 385);
+ w.setSurfaceOffset(20, 385);
w.draw();
w.nextSymbol = WSymbol::DOWN;
- w.setScreenPos(screenX + 50, screenY + 385);
+ w.setSurfaceOffset(50, 385);
w.draw();
w.nextSymbol = WSymbol::SKIPBACK;
- w.setScreenPos(screenX + 85, screenY + 385);
+ w.setSurfaceOffset(85, 385);
w.draw();
w.nextSymbol = WSymbol::SKIPFORWARD;
- w.setScreenPos(screenX + 115, screenY + 385);
+ w.setSurfaceOffset(115, 385);
w.draw();
w.nextSymbol = WSymbol::PLAY;
- w.setScreenPos(screenX + 150, screenY + 385);
+ w.setSurfaceOffset(150, 385);
w.draw();
// FIXME Right justify this!
char showing[200];
sprintf(showing, "%i to %i of %i", topOption, sl.getBottomOption(), sl.getNumOptions());
- Box b;
- b.setScreenPos(screenX + 220, screenY + 385);
- b.setDimensions(160, 25);
- b.fillColour(Colour::VIEWBACKGROUND);
- b.drawText(showing, 0, 0, Colour::LIGHTTEXT);
+
+// 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);
}
ViewMan::getInstance()->postMessage(m1);
}
+
+ show();
+/*
Message* m2 = new Message();
m2->from = this;
m2->to = ViewMan::getInstance();
m2->message = Message::UPDATE_SCREEN;
ViewMan::getInstance()->postMessage(m2);
+*/
}
int VRecordingList::doPlay()
{
rec = NULL;
+ create(200, 140);
if (Video::getInstance()->getFormat() == Video::PAL)
{
setScreenPos(260, 190);
setScreenPos(250, 160);
}
- setDimensions(200, 140);
setBackgroundColour(Colour::VIEWBACKGROUND);
setTitleBarOn(1);
setTitleText("Programme menu");
setTitleBarColour(Colour::TITLEBARBACKGROUND);
- sl.setScreenPos(screenX + 10, screenY + 30 + 5);
+ sl.setSurface(surface);
+ sl.setSurfaceOffset(10, 30 + 5);
sl.setDimensions(width - 20, height - 30 - 15);
sl.addOption("Play", 1);
sl.addOption("Resume", 0);
{
vi->setScreenPos(110, 90);
}
- vi->setDimensions(490, 300);
+ vi->create(490, 300);
ViewMan::getInstance()->addNoLock(vi);
vi->draw();
else if (sl.getCurrentOption() == 3)
{
VQuestion* v = new VQuestion();
+ v->create(260, 180);
v->setParent(this);
v->setBackgroundColour(Colour::VIEWBACKGROUND);
v->setTitleBarColour(Colour::DANGER);
{
v->setScreenPos(220, 140);
}
- v->setDimensions(260, 180);
ViewMan::getInstance()->addNoLock(v);
v->draw();
// a char array. so now we have the messy dereferencing...
// anyway, now it doesn't use a object wide reference.
+ create(300, 200);
if (Video::getInstance()->getFormat() == Video::PAL)
{
setScreenPos(220, 200);
{
setScreenPos(210, 150);
}
- setDimensions(300, 200);
+
setBackgroundColour(Colour::VIEWBACKGROUND);
setTitleBarOn(1);
setTitleBarColour(Colour::TITLEBARBACKGROUND);
setTitleText("Choose a VDR server");
- sl.setScreenPos(screenY + 30 + 5, screenX + 10);
+ sl.setSurfaceOffset(30 + 5, 10);
sl.setDimensions(width - 20, height - 30 - 15);
sl.addOption((*serverIPs)[0], 1);
player->init();
Video* video = Video::getInstance();
- setDimensions(video->getScreenWidth(), video->getScreenHeight());
+ create(video->getScreenWidth(), video->getScreenHeight());
Colour transparent(0, 0, 0, 0);
setBackgroundColour(transparent);
}
unavailable = 1;
unavailableView = new VInfo();
- unavailableView->setDimensions(400, 200);
+ unavailableView->create(400, 200);
if (Video::getInstance()->getFormat() == Video::PAL)
{
unavailableView->setScreenPos(170, 200);
myRec = rec;
Video* video = Video::getInstance();
- setDimensions(video->getScreenWidth(), video->getScreenHeight());
+ create(video->getScreenWidth(), video->getScreenHeight());
Colour transparent(0, 0, 0, 0);
setBackgroundColour(transparent);
}
{
displayVolume = Audio::getInstance()->getVolume();
+ create(227, 31);
if (Video::getInstance()->getFormat() == Video::PAL)
{
setScreenPos(100, 499);
setScreenPos(90, 400);
}
- setDimensions(227, 31);
-
setBackgroundColour(Colour::VIEWBACKGROUND);
}
{
View::draw();
- WSymbol* w = new WSymbol;
- w->nextSymbol = WSymbol::VOLUME2;
- w->setScreenPos(screenX + 3, screenY + 10);
- w->draw();
+ WSymbol w;
+ w.setSurface(surface);
+ w.nextSymbol = WSymbol::VOLUME2;
+ w.setSurfaceOffset(3, 10);
+ w.draw();
int i = 0;
for(; i < displayVolume; i++)
{
- w->nextSymbol = WSymbol::VOLBAR;
- w->setScreenPos(screenX + 40 + (i * 9), screenY + 3);
- w->draw();
+ w.nextSymbol = WSymbol::VOLBAR;
+ w.setSurfaceOffset(40 + (i * 9), 3);
+ w.draw();
}
for(; i < 20; i++)
{
- w->nextSymbol = WSymbol::VOLDOT;
- w->setScreenPos(screenX + 40 + (i * 9), screenY + 13);
- w->draw();
+ w.nextSymbol = WSymbol::VOLDOT;
+ w.setSurfaceOffset(40 + (i * 9), 13);
+ w.draw();
}
-
- delete w;
}
int VVolume::handleCommand(int command)
VWallpaper::~VWallpaper()
{
- delete surface;
}
void VWallpaper::init(char* name)
{
- jpeg.init(name);
-
Video* video = Video::getInstance();
- setDimensions(video->getScreenWidth(), video->getScreenHeight());
-
- // Now override the surface pointer found in Box to a seperate wallpaper surface
- // but only for the wjpeg, not for this object
- wallpaperSurface = new Surface(Osd::getInstance()->getFD(), 0);
- wallpaperSurface->create(height, width);
+ create(video->getScreenWidth(), video->getScreenHeight());
- jpeg.overrideSurface(wallpaperSurface);
- jpeg.draw();
+ jpeg.init(name);
+ jpeg.setSurface(surface);
}
void VWallpaper::draw()
{
- // we want to blit from wallpaperSurface to buffer (or screen if !doubleBuffer)
- Surface::blt(Osd::getInstance()->getFD(), wallpaperSurface->getSurfaceHandle(), 0, 0, width, height, surface->getSurfaceHandle(), 0, 0);
- // and the fd business here is terrible, but what can you do.
+ View::draw();
+ jpeg.draw();
}
VWelcome::VWelcome()
{
- setDimensions(460, 200);
-
+ create(460, 200);
if (Video::getInstance()->getFormat() == Video::PAL)
{
setScreenPos(140, 170);
setScreenPos(130, 140);
}
+ sl.setSurface(surface);
+ jpeg.setSurface(surface);
+
setBackgroundColour(Colour::VIEWBACKGROUND);
setTitleBarOn(1);
setTitleBarColour(Colour::TITLEBARBACKGROUND);
setTitleText("Welcome");
- sl.setScreenPos(screenX + 20, screenY + 40);
+ sl.setSurfaceOffset(20, 40);
sl.setDimensions(170, 140);
sl.addOption("1. Live TV", 1);
sl.addOption("5. Stand by", 0);
sl.addOption("6. Reboot", 0);
- jpeg.setScreenPos(screenX + 240, screenY + 60);
+ jpeg.setSurfaceOffset(240, 60);
}
VWelcome::~VWelcome()
char timeString[20];
time_t t;
time(&t);
- struct tm* tm = localtime(&t);
- strftime(timeString, 19, "%H:%M", tm);
+ struct tm* tms = localtime(&t);
+ strftime(timeString, 19, "%H:%M", tms);
drawTextRJ(timeString, 450, 5, Colour::LIGHTTEXT);
vchan->draw();
vchan->show();
+
// Message* m = new Message();
// m->from = this;
// m->to = ViewMan::getInstance();
ViewMan* viewman = ViewMan::getInstance();
VInfo* viewWait = new VInfo();
- viewWait->setDimensions(460, 190);
+ viewWait->create(460, 190);
if (Video::getInstance()->getFormat() == Video::PAL)
{
viewWait->setScreenPos(140, 170);
WButton::WButton()
{
- int fontHeight = surface->getFontHeight();
+ int fontHeight = Surface::getFontHeight();
setDimensions(70, fontHeight);
mytext = NULL;
#include <string.h>
#include "defines.h"
-#include "box.h"
+#include "widget.h"
#include "colour.h"
-class WButton : public Box
+class WButton : public Widget
{
public:
WButton();
--- /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()
+{
+ width = 0;
+ height = 0;
+}
+
+Widget::~Widget()
+{
+}
+
+void Widget::setSurface(Surface* tsurface)
+{
+ surface = tsurface;
+}
+
+void Widget::setDimensions(int twidth, int theight)
+{
+ width = twidth;
+ height = theight;
+}
--- /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);
+
+ private:
+
+ protected:
+};
+
+#endif
#include "wjpeg.h"
-int WJpeg::init(char* fileName)
+int WJpeg::init(char* tfileName)
{
- this->fileName = fileName;
+ fileName = tfileName;
return 1;
}
-void WJpeg::overrideSurface(Surface* newSurface)
-{
- surface = newSurface;
-}
-
void WJpeg::draw()
{
Log* logger = Log::getInstance();
jpeg_read_header(&cinfo, TRUE);
jpeg_start_decompress(&cinfo);
- logger->log("BJpeg", Log::DEBUG, "JPEG startup done");
+ logger->log("BJpeg", Log::DEBUG, "JPEG startup done %i %i", cinfo.output_width, cinfo.output_height);
// Init the surface
setDimensions(cinfo.output_width, cinfo.output_height);
// MAKE THE 2D ARRAY
- unsigned char* buffer = (unsigned char*)malloc(height * width * 3);
- logger->log("BJpeg", Log::DEBUG, "Buffer allocated at %p", buffer);
+ unsigned char* buffer = (unsigned char*)malloc(width * height * 3);
+ logger->log("BJpeg", Log::DEBUG, "Buffer allocated at %p, width = %i height = %i", buffer, width, height);
unsigned char* bufferPointers[height];
- for(int ps = 0; ps < height; ps++) bufferPointers[ps] = buffer + (ps * width * 3);
+ for(UINT ps = 0; ps < height; ps++) bufferPointers[ps] = buffer + (ps * width * 3);
logger->log("BJpeg", Log::DEBUG, "done array check");
int rowsread = 0;
while (cinfo.output_scanline < cinfo.output_height)
{
+// logger->log("BJpeg", Log::DEBUG, "%i", rowsread);
rowsread += jpeg_read_scanlines(&cinfo, &bufferPointers[rowsread], height);
}
logger->log("BJpeg", Log::DEBUG, "jpeg shutdown done, x, y %u %u", width, height);
- unsigned int c;
- int x, y, xoff;
+ Colour c;
+ UINT x, y, xoff;
unsigned char* p;
for (y = 0; y < height; y++)
{
xoff = x * 3;
- c = ( (0xFF000000 )
- | (p[xoff ] << 16)
- | (p[xoff + 1] << 8)
- | (p[xoff + 2] ) );
+// c = ( (0xFF000000 )
+// | (p[xoff ] << 16)
+// | (p[xoff + 1] << 8)
+// | (p[xoff + 2] ) );
+
+ c.red = p[xoff];
+ c.green = p[xoff + 1];
+ c.blue = p[xoff + 2];
- surface->drawPixel(screenX + x, screenY + y, c);
+ drawPixel(x, y, c);
}
}
}
#include "log.h"
-#include "box.h"
+#include "widget.h"
#include "surface.h"
-class WJpeg : public Box
+class WJpeg : public Widget
{
public:
int init(char* fileName);
void draw();
- void overrideSurface(Surface *newSurface);
-
private:
char* fileName;
};
#include <stdlib.h>
#include "defines.h"
-#include "box.h"
+#include "widget.h"
#include "colour.h"
-class WOptionBox : public Box
+class WOptionBox : public Widget
{
public:
WOptionBox();
noLoop = 1;
}
-void WSelectList::hintSetCurrent(int index)
+void WSelectList::hintSetCurrent(int idx)
{
- selectedOption = index;
+ selectedOption = idx;
if (selectedOption >= options.size()) selectedOption = options.size() - 1;
}
-void WSelectList::hintSetTop(int index)
+void WSelectList::hintSetTop(int idx)
{
- topOption = index;
+ topOption = idx;
}
int WSelectList::addOption(char* text, int selected)
fillColour(Colour::VIEWBACKGROUND);
- int ypos = 5;
+ UINT ypos = 5;
for (UINT i = topOption; i < (topOption + numOptionsDisplayable); i++)
{
if (i == options.size()) return;
#include <vector>
#include "defines.h"
-#include "box.h"
+#include "widget.h"
#include "colour.h"
using namespace std;
-class WSelectList : public Box
+class WSelectList : public Widget
{
public:
WSelectList();
UCHAR* base = symbols + offset;
int widthBytes = widths[nextSymbol];
int widthBits = widthBytes * 8;
- int height = heights[nextSymbol];
+ int sHeight = heights[nextSymbol];
int x, y, bytesIn, bitsIn;
- for (y = 0; y < height; y++)
+ for (y = 0; y < sHeight; y++)
{
for (x = 0; x < widthBits; x++)
{
#define WSYMBOL_H
#include "defines.h"
-#include "box.h"
+#include "widget.h"
#include "colour.h"
-class WSymbol : public Box
+class WSymbol : public Widget
{
public:
WSymbol();