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 LogNT::getInstance()->debug("VPictureBanner", "created {}", static_cast<void*>(this));
43 //TODO compute sizes from text
47 MessageQueue::getInstance()->addReceiver(this);
50 VPictureBanner::~VPictureBanner()
52 MessageQueue::getInstance()->removeReceiver(this);
53 LogNT::getInstance()->debug("VPictureBanner", "deleted {}", static_cast<void*>(this));
58 void VPictureBanner::draw()
63 drawText(info,5,area.h-25,DrawStyle::LIGHTTEXT);
65 else drawText(tr("Loading"),5,3,DrawStyle::LIGHTTEXT);
69 rectangle(x, area.h - 24, 18, 16, DrawStyle::RED);
71 drawText(tr("rotate"), x, area.h - 25, DrawStyle::LIGHTTEXT);
73 rectangle(x, area.h - 24, 18, 16, DrawStyle::GREEN);
75 drawText(tr("info"), 5+18+3+rotsize+3+18+3, area.h - 25, DrawStyle::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,DrawStyle::LIGHTTEXT);
94 int VPictureBanner::handleCommand(int /*command*/)
96 //don not handle commands - leave this to the picture viewer
97 return BoxStack::DROP_THROUGH;
102 void VPictureBanner::processMessage(Message* m)
104 if (m->message == Message::MOUSE_MOVE)
108 else if (m->message == Message::MOUSE_LBDOWN)
110 int x = m->parameter - getScreenX();
111 int y = m->tag - getScreenY();
113 if (coordsOutsideBox(m))
115 Input::sendInputKey(Input::BACK);
117 else if (y >= (toi4(area.h) - 24) && y <= toi4(area.h) - 6)
119 //y coordinate is right!
122 BoxStack::getInstance()->handleCommand(Input::RED); //simulate red press
124 else if (x>=110 &&x<=128)
126 BoxStack::getInstance()->handleCommand(Input::GREEN); //simulate red press
132 void VPictureBanner::setText(const char * text) {
133 if (info) delete info;
136 info=new char[strlen(text)+1];