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 "vchannelselect.h"
23 // this class only works as it does because the remote command
24 // values for the numbers are the numbers themselves !
26 VChannelSelect::VChannelSelect(VVideoLive* v, int command)
31 setBackgroundColour(Colour::VIEWBACKGROUND);
41 VChannelSelect::~VChannelSelect()
43 Timers::getInstance()->cancelTimer(this, 1);
46 void VChannelSelect::draw()
58 sprintf(text, "%i", first);
59 drawText(text, 7, 5, Colour::LIGHTTEXT);
64 drawText("_", 7, 5, Colour::LIGHTTEXT);
73 sprintf(text, "%i", second);
74 drawText(text, 20, 5, Colour::LIGHTTEXT);
79 drawText("_", 20, 5, Colour::LIGHTTEXT);
88 sprintf(text, "%i", third);
89 drawText(text, 33, 5, Colour::LIGHTTEXT);
94 drawText("_", 33, 5, Colour::LIGHTTEXT);
99 Timers::getInstance()->setTimer(this, 1, (struct timespec){3, 0});
102 int VChannelSelect::handleCommand(int command)
106 case Remote::ZERO ... Remote::NINE:
108 if (numGot == 2) first = second;
114 ViewMan::getInstance()->updateView(this);
118 Message* m = new Message();
120 m->to = ViewMan::getInstance();
121 m->message = Message::CLOSE_ME;
122 ViewMan::getInstance()->postMessage(m);
124 // Is there valid data?
125 if ((first > 0) || (second > 0) || (third > 0))
130 m->message = Message::CHANNEL_CHANGE;
131 m->parameter = (first * 100) + (second * 10) + third;
132 ViewMan::getInstance()->postMessage(m);
140 // allow command to drop through to other views
144 void VChannelSelect::timercall(int clientReference)
146 Log::getInstance()->log("VChannelSelect", Log::DEBUG, "Timer call");
149 Message* m = new Message();
151 m->to = ViewMan::getInstance();
152 m->message = Message::CLOSE_ME;
153 ViewMan::getInstance()->postMessage(m);
155 // Is there valid data?
156 if ((first > 0) || (second > 0) || (third > 0))
160 ULONG newChannel = 0;
164 newChannel += first * 100;
166 newChannel += second * 10;
174 m->message = Message::CHANNEL_CHANGE;
175 m->parameter = newChannel;
176 ViewMan::getInstance()->postMessage(m);