2 Copyright 2004-2007 Chris Tallon, Marten Richter
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 "wwinvideofilter.h"
27 WWinVideoFilter::WWinVideoFilter()
31 sl.setShowSelOption(false);
32 sl.setPosition(15,30+15);
35 WWinVideoFilter::~WWinVideoFilter()
40 void WWinVideoFilter::initSelectList(bool startup)
46 selection=sl.getCurrentOption();
47 top=sl.getTopOption();
53 VideoWin *vw=(VideoWin*) Video::getInstance();
55 const VideoFilterDescList *list=vw->getVideoFilterList(filselected);
56 for (i = 0; i < list->size();i++)
58 const char * name = (*list)[i].friendlyname;
61 char * desc=new char [strlen(name)+1];
63 sl.addOption(desc,i,0);
69 sl.hintSetCurrent(selection);
74 void WWinVideoFilter::setSize(UINT w, UINT h)
77 sl.setSize(area.w - 240, area.h - 30-15-30);
80 void WWinVideoFilter::draw()
84 drawText(tr("Selected Filter:"), 15, 15, DrawStyle::LIGHTTEXT);
86 VideoWin *vw=(VideoWin*) Video::getInstance();
87 const VideoFilterDescList *list=vw->getVideoFilterList(filselected);
88 if (filselected!=-1) drawText((*list)[filselected].friendlyname,215,15,DrawStyle::LIGHTTEXT);
91 if (!(*list)[sl.getCurrentOptionData()].vmr9tested)
93 rectangle(area.w - 220, 160, 200, 20, DrawStyle::YELLOW);
94 drawText(tr("VMR 9 support: ?"), area.w - 220, 160, DrawStyle::DARKTEXT);
96 else if ((*list)[sl.getCurrentOptionData()].vmr9)
98 rectangle(area.w - 220, 160, 200, 20, DrawStyle::GREEN);
99 drawText(tr("VMR 9 support: yes"), area.w - 220, 160, DrawStyle::DARKTEXT);
103 rectangle(area.w - 220, 160, 200, 20, DrawStyle::RED);
104 drawText(tr("VMR 9 support: no"), area.w - 220, 160, DrawStyle::DARKTEXT);
107 drawText(tr("Press [ok] to select filter! "), 15, area.h - 30, DrawStyle::LIGHTTEXT);
111 bool WWinVideoFilter::mouseLBDOWN(int x, int y)
113 if (sl.mouseLBDOWN(x,y))
115 BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
121 bool WWinVideoFilter::mouseMove(int x, int y)
123 if (sl.mouseMove(x,y))
125 sl.setShowSelOption(true);
133 void WWinVideoFilter::processMessage(Message* m)
135 Log::getInstance()->log("VRecordingList", Log::DEBUG, "Got message value %lu", m->message);
137 if (m->message == Message::MOUSE_MOVE)
139 if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
141 sl.setShowSelOption(true);
144 viewman->updateView(this);
147 else if (m->message == Message::MOUSE_LBDOWN)
149 if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
151 ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
155 //check if press is outside this view! then simulate cancel
156 int x=(m->parameter>>16)-getScreenX();
157 int y=(m->parameter&0xFFFF)-getScreenY();
158 if (x<0 || y <0 || x>getWidth() || y>getHeight())
160 ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
168 void WWinVideoFilter::doSave()
170 Message* m = new Message();
171 m->message = Message::CHANGED_DEVICEOPTIONS;
174 Command::getInstance()->postMessageNoLock(m);
179 int WWinVideoFilter::handleCommand(int command)
187 if (sl.getCurrentOption() != 0)
190 sl.setShowSelOption(true);
195 sl.setShowSelOption(false);
196 return 4; //Control to vopts control
199 case Remote::DF_DOWN:
203 sl.setShowSelOption(true);
206 case Remote::SKIPBACK:
211 case Remote::SKIPFORWARD:
218 VideoWin*vw=(VideoWin*)Video::getInstance();
219 vw->selectVideoFilter(sl.getCurrentOptionData());