2 Copyright 2004-2005 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "vtimerlist.h"
23 VTimerList::VTimerList(RecTimerList* trtl)
33 if (Video::getInstance()->getFormat() == Video::PAL)
43 setBackgroundColour(Colour::VIEWBACKGROUND);
45 setTitleText(tr("Timers"));
46 setTitleBarColour(Colour::TITLEBARBACKGROUND);
48 sl.setSurface(surface);
49 sl.setSurfaceOffset(10, 30 + 5);
50 sl.setDimensions(area.w - 20, area.h - 30 - 15 - 30);
55 VTimerList::~VTimerList()
57 Timers::getInstance()->cancelTimer(this, 1);
60 for (UINT i = 0; i < recTimerList->size(); i++)
62 delete (*recTimerList)[i];
65 recTimerList->clear();
70 void VTimerList::drawData()
83 for (UINT i = 0; i < recTimerList->size(); i++)
85 recTimer = (*recTimerList)[i];
86 btime = localtime((time_t*)&recTimer->startTime);
87 strftime(strA, 299, "%d/%m %H:%M ", btime);
88 snprintf(strB, 299, "%s\t%s", strA, recTimer->getName());
89 recTimer->index = sl.addOption(strB, first);
94 void VTimerList::drawClock()
96 // Blank the area first
97 rectangle(area.w - 150, 0, 150, 30, titleBarColour);
102 struct tm* tms = localtime(&t);
103 strftime(timeString, 19, "%d/%m %H:%M:%S", tms);
104 drawTextRJ(timeString, 560, 5, Colour::LIGHTTEXT);
106 Timers::getInstance()->setTimer(this, 1, t + 1);
109 void VTimerList::draw()
114 // Put the status stuff at the bottom
117 w.setSurface(surface);
119 w.nextSymbol = WSymbol::UP;
120 w.setSurfaceOffset(20, 385);
123 w.nextSymbol = WSymbol::DOWN;
124 w.setSurfaceOffset(50, 385);
127 w.nextSymbol = WSymbol::SKIPBACK;
128 w.setSurfaceOffset(85, 385);
131 w.nextSymbol = WSymbol::SKIPFORWARD;
132 w.setSurfaceOffset(115, 385);
135 drawTextRJ("[ok] = edit", 560, 385, Colour::LIGHTTEXT);
141 void VTimerList::doShowingBar()
143 int topOption = sl.getTopOption() + 1;
144 if (sl.getNumOptions() == 0) topOption = 0;
146 rectangle(220, 385, 180, 25, Colour::VIEWBACKGROUND);
148 sprintf(showing, tr("%i to %i of %i"), topOption, sl.getBottomOption(), sl.getNumOptions());
149 drawText(showing, 220, 385, Colour::LIGHTTEXT);
152 void VTimerList::timercall(int clientReference)
155 ViewMan::getInstance()->updateView(this, &clockRegion);
158 int VTimerList::handleCommand(int command)
169 ViewMan::getInstance()->updateView(this);
172 case Remote::DF_DOWN:
179 ViewMan::getInstance()->updateView(this);
182 case Remote::SKIPBACK:
188 ViewMan::getInstance()->updateView(this);
191 case Remote::SKIPFORWARD:
197 ViewMan::getInstance()->updateView(this);
202 RecTimer* recTimer = NULL;
205 int currentOption = sl.getCurrentOption();
207 for (UINT i = 0; i < recTimerList->size(); i++)
209 recTimer = (*recTimerList)[i];
210 if (currentOption == recTimer->index) break;
214 if (recTimer == NULL) return 2;
216 // recTimer is the one you want FIXME
225 // stop command getting to any more views