2 Copyright 2004-2005 Chris Tallon, Andreas Vogel
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 "vpicturebanner.h"
32 VPictureBanner::VPictureBanner(VPicture *p, bool ld, bool sl)
37 Video *v=Video::getInstance();
38 setSize(v->getScreenWidth()-100, 36);
40 setPosition(50, v->getScreenHeight()-50);
43 Log::getInstance()->log("VPictureBanner",Log::DEBUG,"created %p",this);
44 //TODO compute sizes from text
49 VPictureBanner::~VPictureBanner()
51 Log::getInstance()->log("VPictureBanner",Log::DEBUG,"deleted %p",this);
56 void VPictureBanner::draw()
61 char buf[strlen(info)+100];
62 sprintf(buf,"%s %s",tr("Loading"),info);
63 drawText(buf,5,area.h-25,Colour::LIGHTTEXT);
65 else drawText(tr("Loading"),5,3,Colour::LIGHTTEXT);
69 rectangle(x, area.h - 24, 18, 16, Colour::RED);
71 drawText(tr("rotate"), x, area.h - 25, Colour::LIGHTTEXT);
73 rectangle(x, area.h - 24, 18, 16, Colour::GREEN);
75 drawText(tr("info"), 5+18+3+rotsize+3+18+3, area.h - 25, Colour::LIGHTTEXT);
80 w.nextSymbol = WSymbol::PAUSE;
83 w.nextSymbol = WSymbol::PLAY;
85 w.setPosition(x, area.h-24);
89 drawText(info,x,area.h - 25,Colour::LIGHTTEXT);
94 int VPictureBanner::handleCommand(int command)
96 //don not handle commands - leave this to the picture viewer
102 void VPictureBanner::processMessage(Message* m)
104 if (m->message == Message::MOUSE_MOVE)
108 else if (m->message == Message::MOUSE_LBDOWN)
110 //check if press is outside this view! then simulate cancel
111 int x=(m->parameter>>16)-getScreenX();
112 int y=(m->parameter&0xFFFF)-getScreenY();
113 if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
115 BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
117 else if (y>=(int)area.h-24 && y<=(int)area.h-6)
119 //y coordinate is right!
122 BoxStack::getInstance()->handleCommand(Remote::RED); //simulate red press
124 else if (x>=110 &&x<=128)
126 BoxStack::getInstance()->handleCommand(Remote::GREEN); //simulate red press
132 void VPictureBanner::setText(const char * text) {
133 if (info) delete info;
136 info=new char[strlen(text)+1];