From 71057b3a535ecb0bd743274201922ebc246ce287 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Mon, 11 Jul 2005 23:09:48 +0000 Subject: [PATCH] Un-hardcoded all the colours --- Makefile | 2 +- box.cc | 29 ++++++++++++++++---------- box.h | 13 ++++++------ colour.cc | 47 +++++++++++++++++++++++++++++++++++++++++ colour.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++ command.cc | 2 +- command.h | 1 + vchannellist.cc | 8 +++---- vchannellist.h | 1 + vchannelselect.cc | 14 ++++++------- vchannelselect.h | 1 + view.cc | 34 ++++++++---------------------- view.h | 15 +++++--------- vinfo.cc | 6 +++--- vinfo.h | 1 + vlivebanner.cc | 6 +++--- vlivebanner.h | 1 + vmute.cc | 2 +- vmute.h | 1 + vquestion.cc | 2 +- vquestion.h | 1 + vradiolive.cc | 2 +- vradiolive.h | 1 + vrecordinglist.cc | 12 +++++------ vrecordinglist.h | 1 + vrecordingmenu.cc | 8 +++---- vrecordingmenu.h | 1 + vserverselect.cc | 4 ++-- vserverselect.h | 1 + vvideolive.cc | 3 ++- vvideolive.h | 1 + vvideorec.cc | 3 ++- vvideorec.h | 1 + vvolume.cc | 2 +- vvolume.h | 1 + vwelcome.cc | 6 +++--- vwelcome.h | 1 + wbutton.cc | 23 ++++---------------- wbutton.h | 1 + wselectlist.cc | 8 +++---- wselectlist.h | 1 + wsymbol.cc | 2 +- wsymbol.h | 1 + 43 files changed, 208 insertions(+), 116 deletions(-) create mode 100644 colour.cc create mode 100644 colour.h diff --git a/Makefile b/Makefile index 38e2f06..21f0214 100644 --- 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 b15980b..9bd6c6e 100644 --- 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 ee80e49..c9af906 100644 --- a/box.h +++ b/box.h @@ -24,6 +24,7 @@ #include #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 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 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 diff --git a/command.cc b/command.cc index f438d88..fe7bd6c 100644 --- a/command.cc +++ b/command.cc @@ -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); diff --git a/command.h b/command.h index 6cef15a..c7a0b56 100644 --- 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 { diff --git a/vchannellist.cc b/vchannellist.cc index f1a818f..67291f5 100644 --- a/vchannellist.cc +++ b/vchannellist.cc @@ -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) diff --git a/vchannellist.h b/vchannellist.h index d45196c..c7b1973 100644 --- a/vchannellist.h +++ b/vchannellist.h @@ -34,6 +34,7 @@ #include "channel.h" #include "vvideolive.h" #include "vradiolive.h" +#include "colour.h" class VChannelList : public View { diff --git a/vchannelselect.cc b/vchannelselect.cc index b9e3c17..b0711e9 100644 --- a/vchannelselect.cc +++ b/vchannelselect.cc @@ -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; } } diff --git a/vchannelselect.h b/vchannelselect.h index 0c0461b..cb95c6e 100644 --- a/vchannelselect.h +++ b/vchannelselect.h @@ -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 e39115f..3a57030 100644 --- 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 d70d566..a8f40c6 100644 --- 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 diff --git a/vinfo.cc b/vinfo.cc index eb8a057..b227959 100644 --- 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 4c9ae37..6fa1382 100644 --- 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 { diff --git a/vlivebanner.cc b/vlivebanner.cc index 155b34a..871001d 100644 --- a/vlivebanner.cc +++ b/vlivebanner.cc @@ -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) diff --git a/vlivebanner.h b/vlivebanner.h index 03267d5..b0701db 100644 --- a/vlivebanner.h +++ b/vlivebanner.h @@ -28,6 +28,7 @@ #include "remote.h" #include "vdr.h" #include "wselectlist.h" +#include "colour.h" class VLiveBanner : public View { diff --git a/vmute.cc b/vmute.cc index 00d6e24..3adc881 100644 --- 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 b3d1f0c..60ef05e 100644 --- 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 { diff --git a/vquestion.cc b/vquestion.cc index 075ff25..d4f5a83 100644 --- a/vquestion.cc +++ b/vquestion.cc @@ -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(); } diff --git a/vquestion.h b/vquestion.h index 7a0b857..e887491 100644 --- a/vquestion.h +++ b/vquestion.h @@ -28,6 +28,7 @@ #include "wbutton.h" #include "remote.h" #include "viewman.h" +#include "colour.h" class VQuestion : public View { diff --git a/vradiolive.cc b/vradiolive.cc index e941cff..9273437 100644 --- a/vradiolive.cc +++ b/vradiolive.cc @@ -29,7 +29,7 @@ VRadioLive::VRadioLive(List* tchanList) currentChannel = 0; setDimensions(100, 100); - setBackgroundColour(0, 0, 0, 255); + setBackgroundColour(Colour::VIEWBACKGROUND); } VRadioLive::~VRadioLive() diff --git a/vradiolive.h b/vradiolive.h index 00dc743..2b31e1e 100644 --- a/vradiolive.h +++ b/vradiolive.h @@ -30,6 +30,7 @@ #include "channel.h" #include "viewman.h" #include "remote.h" +#include "colour.h" class VRadioLive : public View { diff --git a/vrecordinglist.cc b/vrecordinglist.cc index 91979a2..05d82a9 100644 --- a/vrecordinglist.cc +++ b/vrecordinglist.cc @@ -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); } diff --git a/vrecordinglist.h b/vrecordinglist.h index 1d5425c..2044f40 100644 --- a/vrecordinglist.h +++ b/vrecordinglist.h @@ -35,6 +35,7 @@ #include "vrecordingmenu.h" #include "vdr.h" #include "vvideorec.h" +#include "colour.h" class VRecordingList : public View { diff --git a/vrecordingmenu.cc b/vrecordingmenu.cc index fc434e3..8e1d703 100644 --- a/vrecordingmenu.cc +++ b/vrecordingmenu.cc @@ -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"); diff --git a/vrecordingmenu.h b/vrecordingmenu.h index 6fe269e..b21bd5a 100644 --- a/vrecordingmenu.h +++ b/vrecordingmenu.h @@ -33,6 +33,7 @@ #include "message.h" #include "vinfo.h" #include "vdr.h" +#include "colour.h" class VRecordingList; diff --git a/vserverselect.cc b/vserverselect.cc index 8a96bdc..0953541 100644 --- a/vserverselect.cc +++ b/vserverselect.cc @@ -30,9 +30,9 @@ VServerSelect::VServerSelect(std::vector* 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); diff --git a/vserverselect.h b/vserverselect.h index c00b9ff..6655360 100644 --- a/vserverselect.h +++ b/vserverselect.h @@ -29,6 +29,7 @@ #include "view.h" #include "remote.h" #include "wselectlist.h" +#include "colour.h" class VServerSelect : public View { diff --git a/vvideolive.cc b/vvideolive.cc index c6da0eb..25b672f 100644 --- a/vvideolive.cc +++ b/vvideolive.cc @@ -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() diff --git a/vvideolive.h b/vvideolive.h index 5664871..838d805 100644 --- a/vvideolive.h +++ b/vvideolive.h @@ -31,6 +31,7 @@ #include "vlivebanner.h" #include "viewman.h" #include "vchannelselect.h" +#include "colour.h" class VVideoLive : public View { diff --git a/vvideorec.cc b/vvideorec.cc index a1e8af0..793e481 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -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() diff --git a/vvideorec.h b/vvideorec.h index 42ac6ad..872a18e 100644 --- a/vvideorec.h +++ b/vvideorec.h @@ -28,6 +28,7 @@ #include "vdr.h" #include "recording.h" #include "command.h" +#include "colour.h" class VVideoRec : public View { diff --git a/vvolume.cc b/vvolume.cc index d8cd838..348bf27 100644 --- a/vvolume.cc +++ b/vvolume.cc @@ -27,7 +27,7 @@ VVolume::VVolume() setDimensions(31, 227); setScreenPos(100, 499); - setBackgroundColour(0, 0, 100, 255); + setBackgroundColour(Colour::VIEWBACKGROUND); } void VVolume::draw() diff --git a/vvolume.h b/vvolume.h index a5ea0b7..068f483 100644 --- 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 { diff --git a/vwelcome.cc b/vwelcome.cc index 1fb335e..2a950b6 100644 --- a/vwelcome.cc +++ b/vwelcome.cc @@ -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(); diff --git a/vwelcome.h b/vwelcome.h index fe5a52b..86ed434 100644 --- a/vwelcome.h +++ b/vwelcome.h @@ -35,6 +35,7 @@ #include "vrecordinglist.h" #include "command.h" #include "message.h" +#include "colour.h" class VWelcome : public View { diff --git a/wbutton.cc b/wbutton.cc index ccf322f..e8395a5 100644 --- a/wbutton.cc +++ b/wbutton.cc @@ -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); - - } diff --git a/wbutton.h b/wbutton.h index f93c5c3..f93d9fe 100644 --- a/wbutton.h +++ b/wbutton.h @@ -26,6 +26,7 @@ #include "defines.h" #include "box.h" +#include "colour.h" class WButton : public Box { diff --git a/wselectlist.cc b/wselectlist.cc index de93a2e..c6e27f3 100644 --- a/wselectlist.cc +++ b/wselectlist.cc @@ -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; } diff --git a/wselectlist.h b/wselectlist.h index 3dca0b7..66d8e28 100644 --- a/wselectlist.h +++ b/wselectlist.h @@ -25,6 +25,7 @@ #include #include "box.h" +#include "colour.h" class WSelectList : public Box { diff --git a/wsymbol.cc b/wsymbol.cc index 4315f98..1d02df4 100644 --- a/wsymbol.cc +++ b/wsymbol.cc @@ -556,7 +556,7 @@ void WSymbol::draw() if ((base[bytesIn] >> (7 - bitsIn)) & 0x01) { - drawPixel(x, y, 0xFFFFFFFF); + drawPixel(x, y, Colour::LIGHTTEXT); } } } diff --git a/wsymbol.h b/wsymbol.h index c7e66ea..5b0eb79 100644 --- a/wsymbol.h +++ b/wsymbol.h @@ -23,6 +23,7 @@ #include "defines.h" #include "box.h" +#include "colour.h" class WSymbol : public Box { -- 2.39.5