list.o queue.o node.o recording.o channel.o message.o playerradio.o messagequeue.o \
view.o vinfo.o vwallpaper.o vvolume.o vrecordinglist.o vlivebanner.o vmute.o \
vrecordingmenu.o vquestion.o vchannellist.o vwelcome.o vvideolive.o vvideorec.o vradiolive.o \
- vchannelselect.o vserverselect.o \
+ vchannelselect.o vserverselect.o colour.o \
wselectlist.o wjpeg.o wsymbol.o wbutton.o \
fonts/helvB24.o fonts/helvB18.o
// Level 1 drawing functions
-void Box::fillColour(int r, int g, int b, int a)
+void Box::fillColour(Colour& colour)
{
- rectangle(0, 0, width, height, r, g, b, a);
+ rectangle(0, 0, width, height, colour);
}
-void Box::drawPara(char* text, int x, int y, int r, int g, int b)
+void Box::drawPara(char* text, int x, int y, Colour& colour)
{
char line[256];
int lineHeight = surface->getFontHeight() + 6;
line[linePos++] = '\0';
if (printLine || (linePos > 1)) // if some text was put in line
{
- drawText(line, x, ypos, r, g, b);
+ drawText(line, x, ypos, colour);
ypos += lineHeight;
if (ypos > (height - lineHeight)) break;
}
// Level 0 drawing functions
-void Box::rectangle(int x1, int y1, int width, int height, int r, int g, int b, int a)
+void Box::rectangle(int x1, int y1, int width, int height, Colour& colour)
{
- surface->fillblt(screenX + x1, screenY + y1, width, height, surface->rgba(r, g, b, a));
+ surface->fillblt(screenX + x1, screenY + y1, width, height, surface->rgba(colour.red, colour.green, colour.blue, colour.alpha));
}
-void Box::drawText(char* text, int x, int y, int r, int g, int b)
+void Box::drawText(char* text, int x, int y, Colour& colour)
{
- surface->drawText(text, screenX + x, screenY + y, r, g, b);
+ surface->drawText(text, screenX + x, screenY + y, colour.red, colour.green, colour.blue);
}
-void Box::drawTextRJ(char* text, int x, int y, int r, int g, int b)
+void Box::drawTextRJ(char* text, int x, int y, Colour& colour)
{
- surface->drawTextRJ(text, screenX + x, screenY + y, r, g, b);
+ surface->drawTextRJ(text, screenX + x, screenY + y, colour.red, colour.green, colour.blue);
}
-void Box::drawPixel(int x, int y, int c)
+void Box::drawPixel(int x, int y, Colour& colour)
{
+ int c;
+ c = ( (0xFF000000 )
+ | (colour.red << 16)
+ | (colour.green << 8)
+ | (colour.blue ) );
+
+
surface->drawPixel(screenX + x, screenY + y, c);
}
#include <stdio.h>
#include "log.h"
+#include "colour.h"
#include "surface.h"
// Abstract ???????
virtual void draw();
// Drawing functions level 1
- void fillColour(int r, int g, int b, int a);
- void drawPara(char* text, int x, int y, int r, int g, int b);
+ void fillColour(Colour& colour);
+ void drawPara(char* text, int x, int y, Colour& colour);
// Drawing functions level 0
- void rectangle(int x1, int y1, int x2, int y2, int r, int g, int b, int a);
- void drawText(char* text, int x, int y, int r, int g, int b);
- void drawTextRJ(char* text, int x, int y, int r, int g, int b);
- void drawPixel(int x, int y, int c);
+ 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);
int getScreenX();
int getScreenY();
--- /dev/null
+/*
+ Copyright 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 "colour.h"
+
+/*
+Real colours
+*/
+Colour Colour::VIDEOBLUE(0, 0, 150);
+Colour Colour::VIEWBACKGROUND(0, 0, 100);
+Colour Colour::TITLEBARBACKGROUND(0, 0, 200);
+Colour Colour::SELECTHIGHLIGHT(240, 250, 80);
+Colour Colour::LIGHTTEXT(255, 255, 255);
+Colour Colour::DARKTEXT(0, 0, 100);
+Colour Colour::DANGER(200, 0, 0);
+Colour Colour::BUTTONBACKGROUND(0, 0, 150);
+
+
+/*
+Silly colours
+
+Colour Colour::VIDEOBLUE(250, 0, 0);
+Colour Colour::VIEWBACKGROUND(100, 0, 100);
+Colour Colour::TITLEBARBACKGROUND(100, 0, 200);
+Colour Colour::SELECTHIGHLIGHT(240, 250, 180);
+Colour Colour::LIGHTTEXT(255, 0, 255);
+Colour Colour::DARKTEXT(0, 0, 255);
+Colour Colour::DANGER(200, 200, 0);
+Colour Colour::BUTTONBACKGROUND(255, 255, 255);
+*/
--- /dev/null
+/*
+ Copyright 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 COLOUR_H
+#define COLOUR_H
+
+class Colour
+{
+ public:
+ Colour()
+ { red = 0; green = 0; blue = 0; alpha = 255; }
+
+ Colour(int Tred, int Tgreen, int Tblue)
+ { red = Tred; green = Tgreen; blue = Tblue; alpha = 255; }
+
+ Colour(int Tred, int Tgreen, int Tblue, int Talpha)
+ { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; }
+
+
+ int red;
+ int green;
+ int blue;
+ int alpha;
+
+ static Colour VIDEOBLUE;
+ static Colour VIEWBACKGROUND;
+ static Colour TITLEBARBACKGROUND;
+ static Colour SELECTHIGHLIGHT;
+ static Colour LIGHTTEXT;
+ static Colour DARKTEXT;
+ static Colour DANGER;
+ static Colour BUTTONBACKGROUND;
+
+};
+
+#endif
// Blue background
View* v = new View();
v->setDimensions(SCREENHEIGHT, SCREENWIDTH);
- v->setBackgroundColour(0, 0, 150, 255);
+ v->setBackgroundColour(Colour::VIDEOBLUE);
v->draw();
v->show();
viewman->add(v);
#include "vserverselect.h"
#include "vwelcome.h"
#include "vmute.h"
+#include "colour.h"
class Command : public MessageQueue
{
setScreenPos(80, 70);
setDimensions(420, 570);
- setBackgroundColour(0, 0, 100, 255);
+ setBackgroundColour(Colour::VIEWBACKGROUND);
setTitleBarOn(1);
if (type == VDR::VIDEO)
{
setTitleText("Radio Stations");
}
- setTitleBarColour(0, 0, 200, 255);
+ setTitleBarColour(Colour::TITLEBARBACKGROUND);
sl.setScreenPos(screenX + 10, screenY + 30 + 5);
sl.setDimensions(height - 30 - 15 - 30, width - 20);
Box b;
b.setScreenPos(screenX + 220, screenY + 385);
b.setDimensions(25, 160);
- b.fillColour(0, 0, 100, 255);
- b.drawText(showing, 0, 0, 255, 255, 255);
+ b.fillColour(Colour::VIEWBACKGROUND);
+ b.drawText(showing, 0, 0, Colour::LIGHTTEXT);
}
int VChannelList::handleCommand(int command)
#include "channel.h"
#include "vvideolive.h"
#include "vradiolive.h"
+#include "colour.h"
class VChannelList : public View
{
setDimensions(30, 53);
setScreenPos(80, 60);
- setBackgroundColour(0, 0, 100, 255);
+ setBackgroundColour(Colour::VIEWBACKGROUND);
first = -1;
second = -1;
case 0 ... 9:
{
sprintf(text, "%i", first);
- drawText(text, 7, 5, 255, 255, 255);
+ drawText(text, 7, 5, Colour::LIGHTTEXT);
break;
}
case -1:
{
- drawText("_", 7, 5, 255, 255, 255);
+ drawText("_", 7, 5, Colour::LIGHTTEXT);
break;
}
}
case 0 ... 9:
{
sprintf(text, "%i", second);
- drawText(text, 20, 5, 255, 255, 255);
+ drawText(text, 20, 5, Colour::LIGHTTEXT);
break;
}
case -1:
{
- drawText("_", 20, 5, 255, 255, 255);
+ drawText("_", 20, 5, Colour::LIGHTTEXT);
break;
}
}
case 0 ... 9:
{
sprintf(text, "%i", third);
- drawText(text, 33, 5, 255, 255, 255);
+ drawText(text, 33, 5, Colour::LIGHTTEXT);
break;
}
case -1:
{
- drawText("_", 33, 5, 255, 255, 255);
+ drawText("_", 33, 5, Colour::LIGHTTEXT);
break;
}
}
#include "vvideolive.h"
#include "message.h"
#include "viewman.h"
+#include "colour.h"
class VVideoLive;
delNSec = 0;
seconds = 0;
- backgroundR = 0;
- backgroundG = 0;
- backgroundB = 0;
- backgroundA = 0;
-
- titleBarR = 0;
- titleBarG = 0;
- titleBarB = 0;
- titleBarA = 0;
-
titleBarOn = 0;
borderOn = 0;
if (borderOn)
{
- rectangle(0, 0, width, height, titleBarR, titleBarG, titleBarB, titleBarA);
- rectangle(5, 5, width-10, height-10, backgroundR, backgroundG, backgroundB, backgroundA);
+ rectangle(0, 0, width, height, titleBarColour);
+ rectangle(5, 5, width-10, height-10, backgroundColour);
}
else
{
- fillColour(backgroundR, backgroundG, backgroundB, backgroundA);
+ fillColour(backgroundColour);
}
if (titleBarOn)
{
- rectangle(0, 0, width, 30, titleBarR, titleBarG, titleBarB, titleBarA);
- if (titleText) drawText(titleText, 5, 5, 255, 255, 255);
+ rectangle(0, 0, width, 30, titleBarColour);
+ if (titleText) drawText(titleText, 5, 5, Colour::LIGHTTEXT);
}
}
{
}
-void View::setBackgroundColour(UCHAR r, UCHAR g, UCHAR b, UCHAR a)
+void View::setBackgroundColour(Colour& Tcolour)
{
- backgroundR = r;
- backgroundG = g;
- backgroundB = b;
- backgroundA = a;
+ backgroundColour = Tcolour;
}
-void View::setTitleBarColour(UCHAR r, UCHAR g, UCHAR b, UCHAR a)
+void View::setTitleBarColour(Colour& Tcolour)
{
- titleBarR = r;
- titleBarG = g;
- titleBarB = b;
- titleBarA = a;
+ titleBarColour = Tcolour;
}
void View::setTitleBarOn(UCHAR on)
#include "box.h"
#include "defines.h"
#include "message.h"
+#include "colour.h"
class View : public Box
{
void setBorderOn(UCHAR on);
void setTitleBarOn(UCHAR on);
void setTitleText(char* title);
- void setBackgroundColour(UCHAR r, UCHAR g, UCHAR b, UCHAR a);
- void setTitleBarColour(UCHAR r, UCHAR g, UCHAR b, UCHAR a);
+ void setBackgroundColour(Colour& colour);
+ void setTitleBarColour(Colour& colour);
// For use by ViewMan
long delSec;
private:
static char numViews;
- UCHAR backgroundR;
- UCHAR backgroundG;
- UCHAR backgroundB;
- UCHAR backgroundA;
+ Colour backgroundColour;
UCHAR titleBarOn;
UCHAR borderOn;
char* titleText;
protected:
- UCHAR titleBarR;
- UCHAR titleBarG;
- UCHAR titleBarB;
- UCHAR titleBarA;
+ Colour titleBarColour;
};
#endif
mainText = NULL;
exitable = 0;
- setBackgroundColour(0, 0, 100, 255);
+ setBackgroundColour(Colour::VIEWBACKGROUND);
setTitleBarOn(1);
- setTitleBarColour(0, 0, 200, 255);
+ setTitleBarColour(Colour::TITLEBARBACKGROUND);
}
VInfo::~VInfo()
{
View::draw();
- if (mainText) drawPara(mainText, 10, 45, 255, 255, 255);
+ if (mainText) drawPara(mainText, 10, 45, Colour::LIGHTTEXT);
}
int VInfo::handleCommand(int command)
#include "defines.h"
#include "view.h"
#include "remote.h"
+#include "colour.h"
class VInfo : public View
{
setScreenPos(130, 370);
setDimensions(120, 500);
- setBackgroundColour(0, 0, 100, 255);
+ setBackgroundColour(Colour::VIEWBACKGROUND);
setTitleBarOn(1);
setTitleText("The channel name");
- setTitleBarColour(0, 0, 200, 255);
+ setTitleBarColour(Colour::TITLEBARBACKGROUND);
sl.setScreenPos(screenX, screenY + 30);
sl.setDimensions(height - 60, width);
View::draw();
sl.draw();
- rectangle(0, height - 30, width, 30, titleBarR, titleBarG, titleBarB, titleBarA);
+ rectangle(0, height - 30, width, 30, titleBarColour);
}
int VLiveBanner::handleCommand(int command)
#include "remote.h"
#include "vdr.h"
#include "wselectlist.h"
+#include "colour.h"
class VLiveBanner : public View
{
setDimensions(40, 40);
setScreenPos(600, 500);
- setBackgroundColour(0, 0, 100, 255);
+ setBackgroundColour(Colour::VIEWBACKGROUND);
}
void VMute::draw()
#include "remote.h"
#include "audio.h"
#include "wsymbol.h"
+#include "colour.h"
class VMute : public View
{
buttonYes.setScreenPos(screenX + 40, screenY + 120);
buttonNo.setScreenPos(screenX + 140, screenY + 120);
- if (mainText) drawPara(mainText, 10, 45, 255, 255, 255);
+ if (mainText) drawPara(mainText, 10, 45, Colour::LIGHTTEXT);
buttonYes.draw();
buttonNo.draw();
}
#include "wbutton.h"
#include "remote.h"
#include "viewman.h"
+#include "colour.h"
class VQuestion : public View
{
currentChannel = 0;
setDimensions(100, 100);
- setBackgroundColour(0, 0, 0, 255);
+ setBackgroundColour(Colour::VIEWBACKGROUND);
}
VRadioLive::~VRadioLive()
#include "channel.h"
#include "viewman.h"
#include "remote.h"
+#include "colour.h"
class VRadioLive : public View
{
setScreenPos(80, 70);
setDimensions(420, 570);
- setBackgroundColour(0, 0, 100, 255);
+ setBackgroundColour(Colour::VIEWBACKGROUND);
setTitleBarOn(1);
- setTitleBarColour(0, 0, 200, 255);
+ setTitleBarColour(Colour::TITLEBARBACKGROUND);
sl.setScreenPos(screenX + 10, screenY + 30 + 5);
sl.setDimensions(height - 30 - 15 - 30, width - 20);
w.draw();
// FIXME Right justify this!
- drawText("[ok] = menu", 450, 385, 255, 255, 255);
+ drawText("[ok] = menu", 450, 385, Colour::LIGHTTEXT);
doShowingBar();
char freeSpace[50];
int gigFree = Directory::freeSpace / 1024;
snprintf(freeSpace, 49, "%lu%%, %iGB free", Directory::usedPercent, gigFree);
- drawTextRJ(freeSpace, 560, 5, 255, 255, 255);
+ drawTextRJ(freeSpace, 560, 5, Colour::LIGHTTEXT);
}
void VRecordingList::doShowingBar()
Box b;
b.setScreenPos(screenX + 220, screenY + 385);
b.setDimensions(25, 160);
- b.fillColour(0, 0, 100, 255);
- b.drawText(showing, 0, 0, 255, 255, 255);
+ b.fillColour(Colour::VIEWBACKGROUND);
+ b.drawText(showing, 0, 0, Colour::LIGHTTEXT);
}
#include "vrecordingmenu.h"
#include "vdr.h"
#include "vvideorec.h"
+#include "colour.h"
class VRecordingList : public View
{
setScreenPos(260, 190);
setDimensions(140, 200);
- setBackgroundColour(0, 0, 100, 255);
+ setBackgroundColour(Colour::VIEWBACKGROUND);
setTitleBarOn(1);
setBorderOn(1);
setTitleText("Programme menu");
- setTitleBarColour(0, 0, 200, 255);
+ setTitleBarColour(Colour::TITLEBARBACKGROUND);
sl.setScreenPos(screenX + 10, screenY + 30 + 5);
sl.setDimensions(height - 30 - 15, width - 20);
{
VQuestion* v = new VQuestion();
v->setParent(this);
- v->setBackgroundColour(0, 0, 100, 255);
- v->setTitleBarColour(200, 0, 0, 255);
+ v->setBackgroundColour(Colour::VIEWBACKGROUND);
+ v->setTitleBarColour(Colour::DANGER);
v->setTitleBarOn(1);
v->setBorderOn(1);
v->setTitleText("Delete recording");
#include "message.h"
#include "vinfo.h"
#include "vdr.h"
+#include "colour.h"
class VRecordingList;
setDimensions(200, 300);
setScreenPos(220, 200);
- setBackgroundColour(0, 0, 100, 255);
+ setBackgroundColour(Colour::VIEWBACKGROUND);
setTitleBarOn(1);
- setTitleBarColour(0, 0, 200, 255);
+ setTitleBarColour(Colour::TITLEBARBACKGROUND);
setTitleText("Choose a VDR server");
sl.setScreenPos(screenX + 10, screenY + 30 + 5);
#include "view.h"
#include "remote.h"
#include "wselectlist.h"
+#include "colour.h"
class VServerSelect : public View
{
currentChannel = 0;
setDimensions(SCREENHEIGHT, SCREENWIDTH);
- setBackgroundColour(0, 0, 0, 0);
+ Colour transparent(0, 0, 0, 0);
+ setBackgroundColour(transparent);
}
VVideoLive::~VVideoLive()
#include "vlivebanner.h"
#include "viewman.h"
#include "vchannelselect.h"
+#include "colour.h"
class VVideoLive : public View
{
myRec = rec;
setDimensions(SCREENHEIGHT, SCREENWIDTH);
- setBackgroundColour(0, 0, 0, 0);
+ Colour transparent(0, 0, 0, 0);
+ setBackgroundColour(transparent);
}
VVideoRec::~VVideoRec()
#include "vdr.h"
#include "recording.h"
#include "command.h"
+#include "colour.h"
class VVideoRec : public View
{
setDimensions(31, 227);
setScreenPos(100, 499);
- setBackgroundColour(0, 0, 100, 255);
+ setBackgroundColour(Colour::VIEWBACKGROUND);
}
void VVolume::draw()
#include "remote.h"
#include "audio.h"
#include "wsymbol.h"
+#include "colour.h"
class VVolume : public View
{
setDimensions(190, 460);
setScreenPos(140, 170);
- setBackgroundColour(0, 0, 100, 255);
+ setBackgroundColour(Colour::VIEWBACKGROUND);
setTitleBarOn(1);
- setTitleBarColour(0, 0, 200, 255);
+ setTitleBarColour(Colour::TITLEBARBACKGROUND);
setTitleText("Welcome");
sl.setScreenPos(screenX + 20, screenY + 40);
struct tm* tm = localtime(&t);
strftime(timeString, 19, "%H:%M", tm);
- drawTextRJ(timeString, 450, 5, 255, 255, 255);
+ drawTextRJ(timeString, 450, 5, Colour::LIGHTTEXT);
jpeg.init("/vdr.jpg");
jpeg.draw();
#include "vrecordinglist.h"
#include "command.h"
#include "message.h"
+#include "colour.h"
class VWelcome : public View
{
void WButton::draw()
{
- UCHAR r1, g1, b1, r2, g2, b2;
-
if (active)
{
- r1 = 0;
- g1 = 0;
- b1 = 100;
- r2 = 240;
- g2 = 250;
- b2 = 80;
+ fillColour(Colour::SELECTHIGHLIGHT);
+ drawText(mytext, 0, 0, Colour::DARKTEXT);
}
else
{
- r1 = 255;
- g1 = 255;
- b1 = 255;
- r2 = 0;
- g2 = 0;
- b2 = 150;
+ fillColour(Colour::BUTTONBACKGROUND);
+ drawText(mytext, 0, 0, Colour::LIGHTTEXT);
}
-
- fillColour(r2, g2, b2, 255);
- drawText(mytext, 0, 0, r1, g1, b1);
-
-
}
#include "defines.h"
#include "box.h"
+#include "colour.h"
class WButton : public Box
{
- fillColour(0, 0, 100, 255);
+ fillColour(Colour::VIEWBACKGROUND);
int ypos = 5;
for (int i = topOption; i < (topOption + numOptionsDisplayable); i++)
if (i == selectedOption)
{
- rectangle(0, ypos, width, fontHeight, 240, 250, 80, 255);
- drawText(options[i], 5, ypos, 0, 0, 0);
+ rectangle(0, ypos, width, fontHeight, Colour::SELECTHIGHLIGHT);
+ drawText(options[i], 5, ypos, Colour::DARKTEXT);
}
else
{
- drawText(options[i], 5, ypos, 255, 255, 255);
+ drawText(options[i], 5, ypos, Colour::LIGHTTEXT);
}
ypos += ySeperation;
}
#include <string.h>
#include "box.h"
+#include "colour.h"
class WSelectList : public Box
{
if ((base[bytesIn] >> (7 - bitsIn)) & 0x01)
{
- drawPixel(x, y, 0xFFFFFFFF);
+ drawPixel(x, y, Colour::LIGHTTEXT);
}
}
}
#include "defines.h"
#include "box.h"
+#include "colour.h"
class WSymbol : public Box
{