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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "vpicturebanner.h"
32 VPictureBanner::VPictureBanner(bool ld, bool sl)
36 Video *v=Video::getInstance();
37 setSize(v->getScreenWidth()-100, 36);
39 setPosition(50, v->getScreenHeight()-50);
42 Log::getInstance()->log("VPictureBanner",Log::DEBUG,"created %p",this);
43 //TODO compute sizes from text
48 VPictureBanner::~VPictureBanner()
50 Log::getInstance()->log("VPictureBanner",Log::DEBUG,"deleted %p",this);
55 void VPictureBanner::draw()
60 drawText(info,5,area.h-25,DrawStyle::LIGHTTEXT);
62 else drawText(tr("Loading"),5,3,DrawStyle::LIGHTTEXT);
66 rectangle(x, area.h - 24, 18, 16, DrawStyle::RED);
68 drawText(tr("rotate"), x, area.h - 25, DrawStyle::LIGHTTEXT);
70 rectangle(x, area.h - 24, 18, 16, DrawStyle::GREEN);
72 drawText(tr("info"), 5+18+3+rotsize+3+18+3, area.h - 25, DrawStyle::LIGHTTEXT);
77 w.nextSymbol = WSymbol::PAUSE;
80 w.nextSymbol = WSymbol::PLAY;
82 w.setPosition(x, area.h-24);
86 drawText(info,x,area.h - 25,DrawStyle::LIGHTTEXT);
91 int VPictureBanner::handleCommand(int command)
93 //don not handle commands - leave this to the picture viewer
99 void VPictureBanner::processMessage(Message* m)
101 if (m->message == Message::MOUSE_MOVE)
105 else if (m->message == Message::MOUSE_LBDOWN)
107 //check if press is outside this view! then simulate cancel
108 int x=(m->parameter.num>>16)-getScreenX();
109 int y=(m->parameter.num&0xFFFF)-getScreenY();
110 if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
112 BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
114 else if (y>=(int)area.h-24 && y<=(int)area.h-6)
116 //y coordinate is right!
119 BoxStack::getInstance()->handleCommand(Remote::RED); //simulate red press
121 else if (x>=110 &&x<=128)
123 BoxStack::getInstance()->handleCommand(Remote::GREEN); //simulate red press
129 void VPictureBanner::setText(const char * text) {
130 if (info) delete info;
133 info=new char[strlen(text)+1];