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, see <https://www.gnu.org/licenses/>.
20 #include "wwinvideofilter.h"
26 WWinVideoFilter::WWinVideoFilter()
30 sl.setShowSelOption(false);
31 sl.setPosition(15,30+15);
34 WWinVideoFilter::~WWinVideoFilter()
39 void WWinVideoFilter::initSelectList(bool startup)
45 selection=sl.getCurrentOption();
46 top=sl.getTopOption();
52 VideoWin *vw=(VideoWin*) Video::getInstance();
54 const VideoFilterDescList *list=vw->getVideoFilterList(filselected);
55 for (i = 0; i < list->size();i++)
57 const char * name = (*list)[i].friendlyname;
60 char * desc=new char [strlen(name)+1];
62 sl.addOption(desc, reinterpret_cast<void*>(i), 0);
68 sl.hintSetCurrent(selection);
73 void WWinVideoFilter::setSize(UINT w, UINT h)
76 sl.setSize(area.w - 240, area.h - 30-15-30);
79 void WWinVideoFilter::draw()
83 drawText(tr("Selected Filter:"), 15, 15, DrawStyle::LIGHTTEXT);
85 VideoWin *vw=(VideoWin*) Video::getInstance();
86 const VideoFilterDescList *list=vw->getVideoFilterList(filselected);
87 if (filselected!=-1) drawText((*list)[filselected].friendlyname,215,15,DrawStyle::LIGHTTEXT);
90 if (!(*list)[reinterpret_cast<ULONG>(sl.getCurrentOptionData())].vmr9tested)
92 rectangle(area.w - 220, 160, 200, 20, DrawStyle::YELLOW);
93 drawText(tr("VMR 9 support: ?"), area.w - 220, 160, DrawStyle::DARKTEXT);
95 else if ((*list)[reinterpret_cast<ULONG>(sl.getCurrentOptionData())].vmr9)
97 rectangle(area.w - 220, 160, 200, 20, DrawStyle::GREEN);
98 drawText(tr("VMR 9 support: yes"), area.w - 220, 160, DrawStyle::DARKTEXT);
102 rectangle(area.w - 220, 160, 200, 20, DrawStyle::RED);
103 drawText(tr("VMR 9 support: no"), area.w - 220, 160, DrawStyle::DARKTEXT);
106 drawText(tr("Press [ok] to select filter! "), 15, area.h - 30, DrawStyle::LIGHTTEXT);
110 bool WWinVideoFilter::mouseLBDOWN(int x, int y)
112 if (sl.mouseLBDOWN(x,y))
114 BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press
120 bool WWinVideoFilter::mouseMove(int x, int y)
122 if (sl.mouseMove(x,y))
124 sl.setShowSelOption(true);
132 void WWinVideoFilter::processMessage(Message* m)
134 Log::getInstance()->log("VRecordingList", Log::DEBUG, "Got message value %lu", m->message);
136 if (m->message == Message::MOUSE_MOVE)
138 if (sl.mouseMove(m->parameter - getScreenX(), m->tag - getScreenY()))
140 sl.setShowSelOption(true);
143 viewman->updateView(this);
146 else if (m->message == Message::MOUSE_LBDOWN)
148 if (sl.mouseLBDOWN(m->parameter - getScreenX(), m->tag - getScreenY()))
150 ViewMan::getInstance()->handleCommand(Input::OK); //simulate OK press
154 //check if press is outside this view! then simulate cancel
155 int x = m->parameter - getScreenX();
156 int y = m->tag - getScreenY();
157 if (x<0 || y <0 || x>getWidth() || y>getHeight())
159 ViewMan::getInstance()->handleCommand(Input::BACK); //simulate cancel press
167 void WWinVideoFilter::doSave()
169 Message* m = new Message();
170 m->message = Message::CHANGED_DEVICEOPTIONS;
173 //Control::getInstance()->postMessage(m);
178 int WWinVideoFilter::handleCommand(int command)
185 if (sl.getCurrentOption() != 0)
188 sl.setShowSelOption(true);
193 sl.setShowSelOption(false);
194 return 4; //Control to vopts control
200 sl.setShowSelOption(true);
203 case Input::SKIPBACK:
208 case Input::SKIPFORWARD:
215 VideoWin*vw=(VideoWin*)Video::getInstance();
216 vw->selectVideoFilter(reinterpret_cast<ULONG>(sl.getCurrentOptionData()));