2 Copyright 2005-2008 Chris Tallon, Marten Richter
\r
4 This file is part of VOMP.
\r
6 VOMP is free software; you can redistribute it and/or modify
\r
7 it under the terms of the GNU General Public License as published by
\r
8 the Free Software Foundation; either version 2 of the License, or
\r
9 (at your option) any later version.
\r
11 VOMP is distributed in the hope that it will be useful,
\r
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 GNU General Public License for more details.
\r
16 You should have received a copy of the GNU General Public License
\r
17 along with VOMP; if not, write to the Free Software
\r
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\r
21 #include "vteletextview.h"
\r
24 #include "boxstack.h"
\r
28 VTeletextView::VTeletextView(TeletextDecoderVBIEBU* TTdecoder,Boxx* playerview)
\r
30 ttdecoder=TTdecoder;
\r
36 if (Video::getInstance()->getFormat() == Video::PAL)
\r
38 //setSize(680, 550);
\r
39 setSize(680,22); //Only first line
\r
40 setPosition(40, 26);
\r
44 setPosition(40, 30);
\r
45 //setSize(680, 450);
\r
46 setSize(680,18);//only first line
\r
54 VTeletextView::~VTeletextView ()
\r
56 // Make sure the timer is deleted
\r
57 Log::getInstance()->log("VTeletextView", Log::DEBUG, "VTeletextView destruct");
\r
59 BoxStack::getInstance()->update(pv);
\r
60 Timers::getInstance()->cancelTimer(this, 1);
\r
61 ttdecoder->unRegisterTeletextView(this);
\r
65 void VTeletextView::draw(bool completedraw, bool onlyfirstline)
\r
67 //Log::getInstance()->log("VTeletextView", Log::ERR, "Start draw");
\r
71 Boxx *drawtarget=NULL;
\r
73 for (y=0;y<25;y++) {
\r
80 ox=this->getScreenX();
\r
81 oy=this->getScreenY();
\r
84 for (x=0;x<40;x++) {
\r
85 if (ttdecoder->isDirty(x,y) || completedraw) {
\r
86 cTeletextChar c=ttdecoder->getChar(x,y);
\r
88 //Skip Blinking and conceal
\r
89 drawtarget->drawTTChar(ox,oy,x,y,c);
\r
90 ttdecoder->setChar(x,y,c);
\r
93 // Log::getInstance()->log("VTeletextView", Log::ERR, "Line %d",y);
\r
94 if (onlyfirstline) break;
\r
96 // Log::getInstance()->log("VTeletextView", Log::ERR, "Start end");
\r
105 int VTeletextView::handleCommand(int command) {
\r
106 if (subtitlemode) return 0; //Ok we are in subtitle mode, we are a slave of the player
\r
115 case Remote::THREE:
\r
119 case Remote::SEVEN:
\r
120 case Remote::EIGHT:
\r
123 // key in teletext page
\r
133 void VTeletextView::doKey(int command)
\r
136 if (keyindigit==1){
\r
137 if (command==9) return; //not allowed
\r
139 pagenums[0]=command+ 48;
\r
143 } else if (keyindigit==2) {
\r
145 pagenums[0]=48+((page &0xF00)>>8);
\r
146 pagenums[1]=command+ 48;
\r
149 } else if (keyindigit==3) {
\r
151 pagenums[0]=48+((page &0xF00)>>8);
\r
152 pagenums[1]=48+((page &0x0F0)>>4);
\r
153 pagenums[2]=48+command;
\r
155 ttdecoder->setPage(page);
\r
157 ttdecoder->setKeyinDigits(pagenums,true);
\r
160 if (Video::getInstance()->getFormat() == Video::PAL) {
\r
171 BoxStack::getInstance()->update(this,&toupdate);
\r
175 void VTeletextView::timercall(int clientReference)
\r
180 void VTeletextView::processMessage(Message* m)
\r
182 if (m->message == Message::TELETEXTUPDATE)
\r
185 BoxStack::getInstance()->update(this);
\r
186 BoxStack::getInstance()->update(pv);
\r
188 } else if (m->message == Message::TELETEXTUPDATEFIRSTLINE)
\r
192 if (Video::getInstance()->getFormat() == Video::PAL) {
\r
205 BoxStack::getInstance()->update(this,&toupdate);
\r