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()
67 sprintf(text, "%i", first);
68 drawText(text, 7, 5, Colour::LIGHTTEXT);
73 drawText("_", 7, 5, Colour::LIGHTTEXT);
91 sprintf(text, "%i", second);
92 drawText(text, 20, 5, Colour::LIGHTTEXT);
97 drawText("_", 20, 5, Colour::LIGHTTEXT);
115 sprintf(text, "%i", third);
116 drawText(text, 33, 5, Colour::LIGHTTEXT);
121 drawText("_", 33, 5, Colour::LIGHTTEXT);
126 Timers::getInstance()->setTimerD(this, 1, 3);
129 int VChannelSelect::handleCommand(int command)
144 if (numGot == 2) first = second;
150 ViewMan::getInstance()->updateView(this);
154 // Is there valid data?
155 if ((first > 0) || (second > 0) || (third > 0))
157 Message* m = new Message();
160 m->message = Message::CHANNEL_CHANGE;
161 m->parameter = (first * 100) + (second * 10) + third;
162 ViewMan::getInstance()->postMessage(m);
172 // allow command to drop through to other views
176 void VChannelSelect::timercall(int clientReference)
178 Log::getInstance()->log("VChannelSelect", Log::DEBUG, "Timer call");
181 Message* m = new Message(); // Delete self
183 m->to = ViewMan::getInstance();
184 m->message = Message::CLOSE_ME;
185 ViewMan::getInstance()->postMessage(m);
187 // Is there valid data?
188 if ((first > 0) || (second > 0) || (third > 0))
192 ULONG newChannel = 0;
196 newChannel += first * 100;
198 newChannel += second * 10;
203 m = new Message(); // Must be done after this view deleted
206 m->message = Message::CHANNEL_CHANGE;
207 m->parameter = newChannel;
208 ViewMan::getInstance()->postMessage(m);