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"
25 VPictureBanner::VPictureBanner(VPicture *p, bool ld, bool sl)
30 Video *v=Video::getInstance();
31 create(v->getScreenWidth()-100, 36);
32 setScreenPos(50, v->getScreenHeight()-50);
33 setBackgroundColour(Colour::VIEWBACKGROUND);
36 Log::getInstance()->log("VPictureBanner",Log::DEBUG,"created %p",this);
37 //TODO compute sizes from text
42 VPictureBanner::~VPictureBanner()
44 Log::getInstance()->log("VPictureBanner",Log::DEBUG,"deleted %p",this);
49 void VPictureBanner::draw()
54 char buf[strlen(info)+100];
55 sprintf(buf,"%s %s",tr("Loading"),info);
56 drawText(buf,5,area.h-25,Colour::LIGHTTEXT);
58 else drawText(tr("Loading"),5,3,Colour::LIGHTTEXT);
62 rectangle(x, area.h - 24, 18, 16, Colour::RED);
64 drawText(tr("rotate"), x, area.h - 25, Colour::LIGHTTEXT);
66 rectangle(x, area.h - 24, 18, 16, Colour::GREEN);
68 drawText(tr("info"), 5+18+3+rotsize+3+18+3, area.h - 25, Colour::LIGHTTEXT);
71 w.setSurface(surface);
73 w.nextSymbol = WSymbol::PAUSE;
76 w.nextSymbol = WSymbol::PLAY;
78 w.setSurfaceOffset(x, area.h-24);
82 drawText(info,x,area.h - 25,Colour::LIGHTTEXT);
87 int VPictureBanner::handleCommand(int command)
89 //don not handle commands - leave this to the picture viewer
95 void VPictureBanner::processMessage(Message* m)
97 if (m->message == Message::MOUSE_MOVE)
101 else if (m->message == Message::MOUSE_LBDOWN)
103 //check if press is outside this view! then simulate cancel
104 int x=(m->parameter>>16)-getScreenX();
105 int y=(m->parameter&0xFFFF)-getScreenY();
106 if (x<0 || y <0 || x>getWidth() || y>getHeight())
108 ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
110 else if (y>=(int)area.h-24 && y<=(int)area.h-6)
112 //y coordinate is right!
115 ViewMan::getInstance()->handleCommand(Remote::RED); //simulate red press
117 else if (x>=110 &&x<=128)
119 ViewMan::getInstance()->handleCommand(Remote::GREEN); //simulate red press
125 void VPictureBanner::setText(const char * text) {
126 if (info) delete info;
129 info=new char[strlen(text)+1];