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()
59 for (UINT i = 0; i < recTimerList->size(); i++)
61 delete (*recTimerList)[i];
64 recTimerList->clear();
69 void VTimerList::drawData()
82 for (UINT i = 0; i < recTimerList->size(); i++)
84 recTimer = (*recTimerList)[i];
85 btime = localtime((time_t*)&recTimer->startTime);
86 strftime(strA, 299, "%d/%m %H:%M ", btime);
87 snprintf(strB, 299, "%s\t%s", strA, recTimer->getName());
88 recTimer->index = sl.addOption(strB, first);
93 void VTimerList::drawClock()
95 // Blank the area first
96 rectangle(area.w - 150, 0, 150, 30, titleBarColour);
101 struct tm* tms = localtime(&t);
102 strftime(timeString, 19, "%d/%m %H:%M:%S", tms);
103 drawTextRJ(timeString, 560, 5, Colour::LIGHTTEXT);
105 Timers::getInstance()->setTimer(this, 1, t + 1);
108 void VTimerList::draw()
113 // Put the status stuff at the bottom
116 w.setSurface(surface);
118 w.nextSymbol = WSymbol::UP;
119 w.setSurfaceOffset(20, 385);
122 w.nextSymbol = WSymbol::DOWN;
123 w.setSurfaceOffset(50, 385);
126 w.nextSymbol = WSymbol::SKIPBACK;
127 w.setSurfaceOffset(85, 385);
130 w.nextSymbol = WSymbol::SKIPFORWARD;
131 w.setSurfaceOffset(115, 385);
134 drawTextRJ("[ok] = edit", 560, 385, Colour::LIGHTTEXT);
140 void VTimerList::doShowingBar()
142 int topOption = sl.getTopOption() + 1;
143 if (sl.getNumOptions() == 0) topOption = 0;
145 rectangle(220, 385, 180, 25, Colour::VIEWBACKGROUND);
147 sprintf(showing, tr("%i to %i of %i"), topOption, sl.getBottomOption(), sl.getNumOptions());
148 drawText(showing, 220, 385, Colour::LIGHTTEXT);
151 void VTimerList::timercall(int clientReference)
154 ViewMan::getInstance()->updateView(this, &clockRegion);
157 int VTimerList::handleCommand(int command)
168 ViewMan::getInstance()->updateView(this);
171 case Remote::DF_DOWN:
178 ViewMan::getInstance()->updateView(this);
181 case Remote::SKIPBACK:
187 ViewMan::getInstance()->updateView(this);
190 case Remote::SKIPFORWARD:
196 ViewMan::getInstance()->updateView(this);
201 RecTimer* recTimer = NULL;
204 int currentOption = sl.getCurrentOption();
206 for (UINT i = 0; i < recTimerList->size(); i++)
208 recTimer = (*recTimerList)[i];
209 if (currentOption == recTimer->index) break;
213 if (recTimer == NULL) return 2;
215 // recTimer is the one you want FIXME
224 // stop command getting to any more views