]> git.vomp.tv Git - vompclient-marten.git/blob - vpicturebanner.cc
Fix bug in demuxer widescreen signaling
[vompclient-marten.git] / vpicturebanner.cc
1 /*
2     Copyright 2004-2005 Chris Tallon, Andreas Vogel
3
4     This file is part of VOMP.
5
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.
10
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.
15
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.
19 */
20
21 #include "vpicturebanner.h"
22
23 #include "wsymbol.h"
24 #include "remote.h"
25 #include "colour.h"
26 #include "video.h"
27 #include "vinfo.h"
28 #include "boxstack.h"
29 #include "i18n.h"
30 #include "log.h"
31
32 VPictureBanner::VPictureBanner(bool ld, bool sl)
33 {
34   shortInfo=ld;
35   slideshow=sl;
36   Video *v=Video::getInstance();
37   setSize(v->getScreenWidth()-100, 36);
38   createBuffer();
39   setPosition(50, v->getScreenHeight()-50);
40   setTitleBarOn(0);
41   info=NULL;
42   Log::getInstance()->log("VPictureBanner",Log::DEBUG,"created %p",this);
43   //TODO compute sizes from text
44   rotsize=70;
45   infsize=50;
46 }
47
48 VPictureBanner::~VPictureBanner()
49 {
50   Log::getInstance()->log("VPictureBanner",Log::DEBUG,"deleted %p",this);
51 }
52
53
54
55 void VPictureBanner::draw()
56 {
57 //  View::draw();
58   if (shortInfo) {
59     if (info) {
60       drawText(info,5,area.h-25,DrawStyle::LIGHTTEXT);
61       }
62     else drawText(tr("Loading"),5,3,DrawStyle::LIGHTTEXT);
63     }
64   else {
65     int x=5;
66     rectangle(x, area.h - 24, 18, 16, DrawStyle::RED);
67     x+=18+3;
68     drawText(tr("rotate"), x, area.h - 25, DrawStyle::LIGHTTEXT);
69     x+=rotsize+3;
70     rectangle(x, area.h - 24, 18, 16, DrawStyle::GREEN);
71     x+=18+3;
72     drawText(tr("info"), 5+18+3+rotsize+3+18+3, area.h - 25, DrawStyle::LIGHTTEXT);
73     x+=infsize+3;
74     WSymbol w;
75     TEMPADD(&w);
76     if (!slideshow) {
77       w.nextSymbol = WSymbol::PAUSE;
78       }
79     else {
80       w.nextSymbol = WSymbol::PLAY;
81     }
82     w.setPosition(x, area.h-24);
83     w.draw();
84     x+=20+3;
85     if (info) {
86       drawText(info,x,area.h - 25,DrawStyle::LIGHTTEXT);
87     }
88   }
89 }
90
91 int VPictureBanner::handleCommand(int command)
92 {
93   //don not handle commands - leave this to the picture viewer
94   return 0;
95 }
96
97
98
99 void VPictureBanner::processMessage(Message* m)
100 {
101   if (m->message == Message::MOUSE_MOVE)
102   {
103     
104   }
105   else if (m->message == Message::MOUSE_LBDOWN)
106   {
107     //check if press is outside this view! then simulate cancel
108     int x=(m->parameter>>16)-getScreenX();
109     int y=(m->parameter&0xFFFF)-getScreenY();
110     if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
111     {
112       BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
113     }
114     else if (y>=(int)area.h-24 && y<=(int)area.h-6)
115     {
116       //y coordinate is right!
117       if (x>=7 &&x<=25)
118       {
119         BoxStack::getInstance()->handleCommand(Remote::RED); //simulate red press
120       }
121       else if (x>=110 &&x<=128)
122       {
123         BoxStack::getInstance()->handleCommand(Remote::GREEN); //simulate red press
124       }
125     }
126   }
127 }
128
129 void VPictureBanner::setText(const char * text) {
130   if (info) delete info;
131   info=NULL;
132   if(!text) return;
133   info=new char[strlen(text)+1];
134   strcpy(info,text);
135 }
136
137
138
139
140