2 Copyright 2005-2008 Chris Tallon, Marten Richter
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "vteletextview.h"
26 #include "playerlivetv.h"
29 VTeletextView::VTeletextView(TeletextDecoderVBIEBU* TTdecoder,Boxx* playerview, PlayerLiveTV* playerObj)
38 if (Video::getInstance()->getFormat() == Video::PAL)
41 setSize(680,22); //Only first line
48 setSize(680,18);//only first line
56 VTeletextView::~VTeletextView ()
58 // Make sure the timer is deleted
59 Log::getInstance()->log("VTeletextView", Log::DEBUG, "VTeletextView destruct");
61 BoxStack::getInstance()->update(pv);
62 Timers::getInstance()->cancelTimer(this, 1);
63 ttdecoder->unRegisterTeletextView(this);
67 void VTeletextView::draw(bool completedraw, bool onlyfirstline)
69 //Log::getInstance()->log("VTeletextView", Log::ERR, "Start draw");
73 Boxx *drawtarget=NULL;
82 ox=this->getScreenX();
83 oy=this->getScreenY();
87 if (ttdecoder->isDirty(x,y) || completedraw) {
88 cTeletextChar c=ttdecoder->getChar(x,y);
90 //Skip Blinking and conceal
91 drawtarget->drawTTChar(ox,oy,x,y,c);
92 ttdecoder->setChar(x,y,c);
95 // Log::getInstance()->log("VTeletextView", Log::ERR, "Line %d",y);
96 if (onlyfirstline) break;
98 // Log::getInstance()->log("VTeletextView", Log::ERR, "Start end");
107 int VTeletextView::handleCommand(int command) {
108 if (subtitlemode) return 0; //Ok we are in subtitle mode, we are a slave of the player
113 if(player) player->tellSubtitlesOSDVisible(false); // Only on liveTV
126 // key in teletext page
136 void VTeletextView::doKey(int command)
140 if (command==9) return; //not allowed
142 pagenums[0]=command+ 48;
146 } else if (keyindigit==2) {
148 pagenums[0]=48+((page &0xF00)>>8);
149 pagenums[1]=command+ 48;
152 } else if (keyindigit==3) {
154 pagenums[0]=48+((page &0xF00)>>8);
155 pagenums[1]=48+((page &0x0F0)>>4);
156 pagenums[2]=48+command;
158 ttdecoder->setPage(page);
160 ttdecoder->setKeyinDigits(pagenums,true);
163 if (Video::getInstance()->getFormat() == Video::PAL) {
174 BoxStack::getInstance()->update(this,&toupdate);
178 void VTeletextView::timercall(int clientReference)
183 void VTeletextView::processMessage(Message* m)
185 if (m->message == Message::TELETEXTUPDATE)
188 BoxStack::getInstance()->update(this);
189 BoxStack::getInstance()->update(pv);
191 } else if (m->message == Message::TELETEXTUPDATEFIRSTLINE)
195 if (Video::getInstance()->getFormat() == Video::PAL) {
208 BoxStack::getInstance()->update(this,&toupdate);