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"
28 VTeletextView::VTeletextView(TeletextDecoderVBIEBU* TTdecoder,Boxx* playerview)
36 if (Video::getInstance()->getFormat() == Video::PAL)
39 setSize(680,22); //Only first line
46 setSize(680,18);//only first line
54 VTeletextView::~VTeletextView ()
56 // Make sure the timer is deleted
57 Log::getInstance()->log("VTeletextView", Log::DEBUG, "VTeletextView destruct");
59 BoxStack::getInstance()->update(pv);
60 Timers::getInstance()->cancelTimer(this, 1);
61 ttdecoder->unRegisterTeletextView(this);
65 void VTeletextView::draw(bool completedraw, bool onlyfirstline)
67 //Log::getInstance()->log("VTeletextView", Log::ERR, "Start draw");
71 Boxx *drawtarget=NULL;
80 ox=this->getScreenX();
81 oy=this->getScreenY();
85 if (ttdecoder->isDirty(x,y) || completedraw) {
86 cTeletextChar c=ttdecoder->getChar(x,y);
88 //Skip Blinking and conceal
89 drawtarget->drawTTChar(ox,oy,x,y,c);
90 ttdecoder->setChar(x,y,c);
93 // Log::getInstance()->log("VTeletextView", Log::ERR, "Line %d",y);
94 if (onlyfirstline) break;
96 // Log::getInstance()->log("VTeletextView", Log::ERR, "Start end");
105 int VTeletextView::handleCommand(int command) {
106 if (subtitlemode) return 0; //Ok we are in subtitle mode, we are a slave of the player
123 // key in teletext page
133 void VTeletextView::doKey(int command)
137 if (command==9) return; //not allowed
139 pagenums[0]=command+ 48;
143 } else if (keyindigit==2) {
145 pagenums[0]=48+((page &0xF00)>>8);
146 pagenums[1]=command+ 48;
149 } else if (keyindigit==3) {
151 pagenums[0]=48+((page &0xF00)>>8);
152 pagenums[1]=48+((page &0x0F0)>>4);
153 pagenums[2]=48+command;
155 ttdecoder->setPage(page);
157 ttdecoder->setKeyinDigits(pagenums,true);
160 if (Video::getInstance()->getFormat() == Video::PAL) {
171 BoxStack::getInstance()->update(this,&toupdate);
175 void VTeletextView::timercall(int clientReference)
180 void VTeletextView::processMessage(Message* m)
182 if (m->message == Message::TELETEXTUPDATE)
185 BoxStack::getInstance()->update(this);
186 BoxStack::getInstance()->update(pv);
188 } else if (m->message == Message::TELETEXTUPDATEFIRSTLINE)
192 if (Video::getInstance()->getFormat() == Video::PAL) {
205 BoxStack::getInstance()->update(this,&toupdate);