Un-hardcoded all the colours
authorChris Tallon <chris@vomp.tv>
Mon, 11 Jul 2005 23:09:48 +0000 (23:09 +0000)
committerChris Tallon <chris@vomp.tv>
Mon, 11 Jul 2005 23:09:48 +0000 (23:09 +0000)
43 files changed:
Makefile
box.cc
box.h
colour.cc [new file with mode: 0644]
colour.h [new file with mode: 0644]
command.cc
command.h
vchannellist.cc
vchannellist.h
vchannelselect.cc
vchannelselect.h
view.cc
view.h
vinfo.cc
vinfo.h
vlivebanner.cc
vlivebanner.h
vmute.cc
vmute.h
vquestion.cc
vquestion.h
vradiolive.cc
vradiolive.h
vrecordinglist.cc
vrecordinglist.h
vrecordingmenu.cc
vrecordingmenu.h
vserverselect.cc
vserverselect.h
vvideolive.cc
vvideolive.h
vvideorec.cc
vvideorec.h
vvolume.cc
vvolume.h
vwelcome.cc
vwelcome.h
wbutton.cc
wbutton.h
wselectlist.cc
wselectlist.h
wsymbol.cc
wsymbol.h

index 38e2f065573c824447c641c34f2dd9b32559611d..21f0214c5fdfc4f8284e4fcf7efdfb230c9378b9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ OBJECTS = main.o command.o log.o remote.o led.o mtd.o video.o audio.o tcp.o dire
           list.o queue.o node.o recording.o channel.o message.o playerradio.o messagequeue.o \
           view.o vinfo.o vwallpaper.o vvolume.o vrecordinglist.o vlivebanner.o vmute.o \
           vrecordingmenu.o vquestion.o vchannellist.o vwelcome.o vvideolive.o vvideorec.o vradiolive.o \
-          vchannelselect.o vserverselect.o \
+          vchannelselect.o vserverselect.o colour.o \
           wselectlist.o wjpeg.o wsymbol.o wbutton.o \
           fonts/helvB24.o fonts/helvB18.o
 
diff --git a/box.cc b/box.cc
index b15980b371c720471e023e0f2f437246ec108bce..9bd6c6ed7d64222490024230bb9fb66ae6054739 100644 (file)
--- a/box.cc
+++ b/box.cc
@@ -90,12 +90,12 @@ int Box::getHeight()
 
 // 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;
@@ -158,7 +158,7 @@ void Box::drawPara(char* text, int x, int y, int r, int g, int b)
     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;
     }
@@ -171,22 +171,29 @@ void Box::drawPara(char* text, int x, int y, int r, int g, int b)
 
 // 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);
 }
diff --git a/box.h b/box.h
index ee80e491f91101e9452efa7bf11e654398ceed67..c9af906ca661e40324ac809f5bf62d71b2de53e9 100644 (file)
--- a/box.h
+++ b/box.h
@@ -24,6 +24,7 @@
 #include <stdio.h>
 
 #include "log.h"
+#include "colour.h"
 #include "surface.h"
 
 // Abstract ???????
@@ -40,14 +41,14 @@ class Box
     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();
diff --git a/colour.cc b/colour.cc
new file mode 100644 (file)
index 0000000..c11377b
--- /dev/null
+++ b/colour.cc
@@ -0,0 +1,47 @@
+/*
+    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);
+*/
diff --git a/colour.h b/colour.h
new file mode 100644 (file)
index 0000000..f9b914b
--- /dev/null
+++ b/colour.h
@@ -0,0 +1,53 @@
+/*
+    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
index f438d889711dfadb27c83c4c2c94d82ec688e379..fe7bd6cba07df32042197c65117da93703e5e884 100644 (file)
@@ -87,7 +87,7 @@ void Command::run()
   // 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);
index 6cef15a763ef91b4d5ab9fb643097ba0b0a22a87..c7a0b56791506e5001c4111e1d11827ff76f3721 100644 (file)
--- a/command.h
+++ b/command.h
@@ -48,6 +48,7 @@
 #include "vserverselect.h"
 #include "vwelcome.h"
 #include "vmute.h"
+#include "colour.h"
 
 class Command : public MessageQueue
 {
index f1a818f294e1b1291205798ec2e4c44b6f3fbcf7..67291f52a4d098551276ae682ced110ceb4b2464 100644 (file)
@@ -25,7 +25,7 @@ VChannelList::VChannelList(ULONG type)
   setScreenPos(80, 70);
   setDimensions(420, 570);
 
-  setBackgroundColour(0, 0, 100, 255);
+  setBackgroundColour(Colour::VIEWBACKGROUND);
   setTitleBarOn(1);
 
   if (type == VDR::VIDEO)
@@ -36,7 +36,7 @@ VChannelList::VChannelList(ULONG type)
   {
     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);
@@ -120,8 +120,8 @@ void VChannelList::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);
 }
 
 int VChannelList::handleCommand(int command)
index d45196c98d6e1ce215bb2b24b41eba6cb42bdf01..c7b197372c659a101d88e65dee19670ddefba817 100644 (file)
@@ -34,6 +34,7 @@
 #include "channel.h"
 #include "vvideolive.h"
 #include "vradiolive.h"
+#include "colour.h"
 
 class VChannelList : public View
 {
index b9e3c170bab3bfe812b3e5d380c244321e593436..b0711e9cac0d912ee3590b6758d6d2570da0c073 100644 (file)
@@ -28,7 +28,7 @@ VChannelSelect::VChannelSelect(VVideoLive* v, int command)
   setDimensions(30, 53);
   setScreenPos(80, 60);
 
-  setBackgroundColour(0, 0, 100, 255);
+  setBackgroundColour(Colour::VIEWBACKGROUND);
 
   first = -1;
   second = -1;
@@ -51,12 +51,12 @@ void VChannelSelect::draw()
     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;
     }
   }
@@ -66,12 +66,12 @@ void VChannelSelect::draw()
     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;
     }
   }
@@ -81,12 +81,12 @@ void VChannelSelect::draw()
     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;
     }
   }
index 0c0461bad913a88a24403f5ea2b3bc232194a1aa..cb95c6efd6a481ea036a04f5c24c41658dd3cc97 100644 (file)
@@ -28,6 +28,7 @@
 #include "vvideolive.h"
 #include "message.h"
 #include "viewman.h"
+#include "colour.h"
 
 class VVideoLive;
 
diff --git a/view.cc b/view.cc
index e39115fab6d7baadc3781e45bf4f9fee12b88602..3a570301c23cabc03790d8b5ea9a61cecbc17f0d 100644 (file)
--- a/view.cc
+++ b/view.cc
@@ -33,16 +33,6 @@ View::View()
   delNSec = 0;
   seconds = 0;
 
-  backgroundR = 0;
-  backgroundG = 0;
-  backgroundB = 0;
-  backgroundA = 0;
-
-  titleBarR = 0;
-  titleBarG = 0;
-  titleBarB = 0;
-  titleBarA = 0;
-
   titleBarOn = 0;
   borderOn = 0;
 
@@ -72,18 +62,18 @@ void View::draw()
 
   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);
   }
 }
 
@@ -96,20 +86,14 @@ void View::processMessage(Message* m)
 {
 }
 
-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)
diff --git a/view.h b/view.h
index d70d566c9abba496b281e00baa47c4c1c34d526c..a8f40c6e71ef3eb30495993044e2521ce9752402 100644 (file)
--- a/view.h
+++ b/view.h
@@ -27,6 +27,7 @@
 #include "box.h"
 #include "defines.h"
 #include "message.h"
+#include "colour.h"
 
 class View : public Box
 {
@@ -40,8 +41,8 @@ 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;
@@ -54,10 +55,7 @@ class View : public Box
   private:
     static char numViews;
 
-    UCHAR backgroundR;
-    UCHAR backgroundG;
-    UCHAR backgroundB;
-    UCHAR backgroundA;
+    Colour backgroundColour;
 
     UCHAR titleBarOn;
     UCHAR borderOn;
@@ -65,10 +63,7 @@ class View : public Box
     char* titleText;
 
   protected:
-    UCHAR titleBarR;
-    UCHAR titleBarG;
-    UCHAR titleBarB;
-    UCHAR titleBarA;
+    Colour titleBarColour;
 };
 
 #endif
index eb8a0573a23c995c48d8615b6bba4b1f3bf9b745..b227959b2e1709a907aa0da588e4aad7b1332182 100644 (file)
--- a/vinfo.cc
+++ b/vinfo.cc
@@ -25,9 +25,9 @@ VInfo::VInfo()
   mainText = NULL;
   exitable = 0;
 
-  setBackgroundColour(0, 0, 100, 255);
+  setBackgroundColour(Colour::VIEWBACKGROUND);
   setTitleBarOn(1);
-  setTitleBarColour(0, 0, 200, 255);
+  setTitleBarColour(Colour::TITLEBARBACKGROUND);
 }
 
 VInfo::~VInfo()
@@ -51,7 +51,7 @@ void VInfo::draw()
 {
   View::draw();
 
-  if (mainText) drawPara(mainText, 10, 45, 255, 255, 255);
+  if (mainText) drawPara(mainText, 10, 45, Colour::LIGHTTEXT);
 }
 
 int VInfo::handleCommand(int command)
diff --git a/vinfo.h b/vinfo.h
index 4c9ae37a1c1d0be0bb215bd470906fdb221f7b63..6fa138228ffe30196f1a9293e020d78815acc28e 100644 (file)
--- a/vinfo.h
+++ b/vinfo.h
@@ -27,6 +27,7 @@
 #include "defines.h"
 #include "view.h"
 #include "remote.h"
+#include "colour.h"
 
 class VInfo : public View
 {
index 155b34a6d04d4833f6d4c031b7f6e136306a2bf7..871001d8de98a65078e74171d3bd05cb5b83a584 100644 (file)
@@ -25,10 +25,10 @@ VLiveBanner::VLiveBanner()
   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);
@@ -55,7 +55,7 @@ void VLiveBanner::draw()
 
   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)
index 03267d5f61e0102b8938707b3f4d0e6b4c1730bf..b0701dbc29e7a28cbca6bffcf4ebea96e002dc90 100644 (file)
@@ -28,6 +28,7 @@
 #include "remote.h"
 #include "vdr.h"
 #include "wselectlist.h"
+#include "colour.h"
 
 class VLiveBanner : public View
 {
index 00d6e248d2087063fc72745a752662031d6663c5..3adc8812716c549b746ab0d5142c840905db5a99 100644 (file)
--- a/vmute.cc
+++ b/vmute.cc
@@ -27,7 +27,7 @@ VMute::VMute()
   setDimensions(40, 40);
   setScreenPos(600, 500);
 
-  setBackgroundColour(0, 0, 100, 255);
+  setBackgroundColour(Colour::VIEWBACKGROUND);
 }
 
 void VMute::draw()
diff --git a/vmute.h b/vmute.h
index b3d1f0cccf5f41404cccff2f921d3086e9cbae1a..60ef05ea3345bf299b30d2f994efe95100abec22 100644 (file)
--- a/vmute.h
+++ b/vmute.h
@@ -27,6 +27,7 @@
 #include "remote.h"
 #include "audio.h"
 #include "wsymbol.h"
+#include "colour.h"
 
 class VMute : public View
 {
index 075ff25b02ce0928c598ac509feaddcc23f75a3c..d4f5a8382234d722d534c2d62d6af925a3f8c72d 100644 (file)
@@ -50,7 +50,7 @@ void VQuestion::draw()
   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();
 }
index 7a0b85788487cd8283c451b1c12d441360d88725..e887491d11303d0dbb201f05409d4433e27544e4 100644 (file)
@@ -28,6 +28,7 @@
 #include "wbutton.h"
 #include "remote.h"
 #include "viewman.h"
+#include "colour.h"
 
 class VQuestion : public View
 {
index e941cffeabe0cd1a5147efdd5bb4ca76fcb26f9e..92734374f8314020074f503ec0feec03b0eaac68 100644 (file)
@@ -29,7 +29,7 @@ VRadioLive::VRadioLive(List* tchanList)
   currentChannel = 0;
 
   setDimensions(100, 100);
-  setBackgroundColour(0, 0, 0, 255);
+  setBackgroundColour(Colour::VIEWBACKGROUND);
 }
 
 VRadioLive::~VRadioLive()
index 00dc74323bd19b41a46476c82856a9c7de8e0d95..2b31e1e7b725046b727c53bfdc7d53e7cf6b30cf 100644 (file)
@@ -30,6 +30,7 @@
 #include "channel.h"
 #include "viewman.h"
 #include "remote.h"
+#include "colour.h"
 
 class VRadioLive : public View
 {
index 91979a2fb23994f9be8aee6cac62b2e9dc300cea..05d82a9f841b4b8a1feefaf03429ed3e2e1656e5 100644 (file)
@@ -25,9 +25,9 @@ VRecordingList::VRecordingList()
   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);
@@ -129,14 +129,14 @@ void VRecordingList::draw()
   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()
@@ -149,8 +149,8 @@ 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);
 }
 
 
index 1d5425c3b164e70e1a8ea3f0be6822bd2dec394a..2044f400a777dcab6b5f4b3ff1d69572e29aa0ca 100644 (file)
@@ -35,6 +35,7 @@
 #include "vrecordingmenu.h"
 #include "vdr.h"
 #include "vvideorec.h"
+#include "colour.h"
 
 class VRecordingList : public View
 {
index fc434e3849827ee890568eae22b93ea90470047b..8e1d703bab0975fc7999e1246e4c91695838152f 100644 (file)
@@ -27,11 +27,11 @@ VRecordingMenu::VRecordingMenu()
   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);
@@ -124,8 +124,8 @@ int VRecordingMenu::handleCommand(int command)
     {
       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");
index 6fe269e563b1c66998bd43d1b4412c17ec4afe65..b21bd5a857b5eddfd8d60a6754090a862bed868d 100644 (file)
@@ -33,6 +33,7 @@
 #include "message.h"
 #include "vinfo.h"
 #include "vdr.h"
+#include "colour.h"
 
 class VRecordingList;
 
index 8a96bdca8a2e5a400da3acf5000ac68256e627ed..09535416b56a8cb58761f2035aaa731f277c31f9 100644 (file)
@@ -30,9 +30,9 @@ VServerSelect::VServerSelect(std::vector<char*>* serverIPs, int* tselectServer)
 
   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);
index c00b9ff1a3e660e341cae3dccd3f17eebef7257a..66553607253d76f3da66d7e58789e89f267292f8 100644 (file)
@@ -29,6 +29,7 @@
 #include "view.h"
 #include "remote.h"
 #include "wselectlist.h"
+#include "colour.h"
 
 class VServerSelect : public View
 {
index c6da0eb152388a3698514b195a8be2e3811c3d34..25b672f6f07ceee740ec4b4e8f8cbe8903c81253 100644 (file)
@@ -29,7 +29,8 @@ VVideoLive::VVideoLive(List* tchanList)
   currentChannel = 0;
 
   setDimensions(SCREENHEIGHT, SCREENWIDTH);
-  setBackgroundColour(0, 0, 0, 0);
+  Colour transparent(0, 0, 0, 0);
+  setBackgroundColour(transparent);
 }
 
 VVideoLive::~VVideoLive()
index 5664871e63f324da00b51c6f53e20ff6dc37a330..838d805cb06f04d0435ced74b3edf6a3bdab5b03 100644 (file)
@@ -31,6 +31,7 @@
 #include "vlivebanner.h"
 #include "viewman.h"
 #include "vchannelselect.h"
+#include "colour.h"
 
 class VVideoLive : public View
 {
index a1e8af075f4b5ca332f3cb7e5bd647151ae32848..793e481218a19d60f69ccd650020ddda3a84a216 100644 (file)
@@ -29,7 +29,8 @@ VVideoRec::VVideoRec(Recording* rec)
   myRec = rec;
 
   setDimensions(SCREENHEIGHT, SCREENWIDTH);
-  setBackgroundColour(0, 0, 0, 0);
+  Colour transparent(0, 0, 0, 0);
+  setBackgroundColour(transparent);
 }
 
 VVideoRec::~VVideoRec()
index 42ac6adaab4851e1251c6c9b1996fe2eb0c6f715..872a18e4d2c7afc5fd0386355cd79d340b21971f 100644 (file)
@@ -28,6 +28,7 @@
 #include "vdr.h"
 #include "recording.h"
 #include "command.h"
+#include "colour.h"
 
 class VVideoRec : public View
 {
index d8cd838faead700b45419957ef3de5c8df39f2e3..348bf2721367afb23ebd60316e744b1a2a5377b1 100644 (file)
@@ -27,7 +27,7 @@ VVolume::VVolume()
   setDimensions(31, 227);
   setScreenPos(100, 499);
 
-  setBackgroundColour(0, 0, 100, 255);
+  setBackgroundColour(Colour::VIEWBACKGROUND);
 }
 
 void VVolume::draw()
index a5ea0b722f82ad2bc249008ab12aea5d258f0fdc..068f483fa1103a2c663c56bff24c12abd15366b2 100644 (file)
--- a/vvolume.h
+++ b/vvolume.h
@@ -27,6 +27,7 @@
 #include "remote.h"
 #include "audio.h"
 #include "wsymbol.h"
+#include "colour.h"
 
 class VVolume : public View
 {
index 1fb335ec5587ab5091da00e0a4d097cf10b0b6ce..2a950b6e8b8a4da28dda6d05559733d00fe31414 100644 (file)
@@ -25,9 +25,9 @@ VWelcome::VWelcome()
   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);
@@ -58,7 +58,7 @@ void VWelcome::draw()
   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();
index fe5a52b3d465f7b2d7ccf0093b294875b29f264f..86ed434139ff2dd3d19971040aebd07c42830b9e 100644 (file)
@@ -35,6 +35,7 @@
 #include "vrecordinglist.h"
 #include "command.h"
 #include "message.h"
+#include "colour.h"
 
 class VWelcome : public View
 {
index ccf322f3452e3cce09863247dd2a77b2950763aa..e8395a5b3b842b2e71e24e92679ce96e7eab950b 100644 (file)
@@ -48,29 +48,14 @@ void WButton::setActive(UCHAR tactive)
 
 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);
-
-
 }
index f93c5c3d37855584fa2e0362f73c9a20251fc9a7..f93d9fee554bba5ffe82796c4cddb0d7b0452de1 100644 (file)
--- a/wbutton.h
+++ b/wbutton.h
@@ -26,6 +26,7 @@
 
 #include "defines.h"
 #include "box.h"
+#include "colour.h"
 
 class WButton : public Box
 {
index de93a2e674bd08ed7f2d240059046a27ff908ef1..c6e27f3a42f6109be03ac86381f026f1517ed5bc 100644 (file)
@@ -87,7 +87,7 @@ void WSelectList::draw()
 
 
 
-  fillColour(0, 0, 100, 255);
+  fillColour(Colour::VIEWBACKGROUND);
 
   int ypos = 5;
   for (int i = topOption; i < (topOption + numOptionsDisplayable); i++)
@@ -97,12 +97,12 @@ void WSelectList::draw()
 
     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;
   }
index 3dca0b7858b281639b74b2dc60475d74144c3eb3..66d8e287be498478ab30286012c365c0ed277a54 100644 (file)
@@ -25,6 +25,7 @@
 #include <string.h>
 
 #include "box.h"
+#include "colour.h"
 
 class WSelectList : public Box
 {
index 4315f989737a26559657e3be93834b973011c070..1d02df4512120c69e321e35375a201af5adddb30 100644 (file)
@@ -556,7 +556,7 @@ void WSymbol::draw()
 
       if ((base[bytesIn] >> (7 - bitsIn)) & 0x01)
       {
-        drawPixel(x, y, 0xFFFFFFFF);
+        drawPixel(x, y, Colour::LIGHTTEXT);
       }
     }
   }
index c7e66ea8f3d9f5df20c45a466e608059b34630f7..5b0eb79e636086fdc0e4b22350ab76a1dc8bf227 100644 (file)
--- a/wsymbol.h
+++ b/wsymbol.h
@@ -23,6 +23,7 @@
 
 #include "defines.h"
 #include "box.h"
+#include "colour.h"
 
 class WSymbol : public Box
 {