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 "wwinaudiofilter.h"
26 WWinAudioFilter::WWinAudioFilter()
30 sl.setShowSelOption(false);
31 sl.setPosition(15,30+15);
34 WWinAudioFilter::~WWinAudioFilter()
39 void WWinAudioFilter::initSelectList(bool startup)
45 selection=sl.getCurrentOption();
46 top=sl.getTopOption();
52 AudioWin *aw=(AudioWin*) Audio::getInstance();
54 const AudioFilterDescList *list=aw->getAudioFilterList(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 WWinAudioFilter::setSize(UINT w, UINT h)
76 sl.setSize(area.w - 240, area.h - 30-15-30);
79 void WWinAudioFilter::draw()
83 drawText(tr("Selected Filter:"), 15, 15, DrawStyle::LIGHTTEXT);
85 AudioWin *aw=(AudioWin*) Audio::getInstance();
86 const AudioFilterDescList *list=aw->getAudioFilterList(filselected);
87 if (filselected!=-1) drawText((*list)[filselected].friendlyname,215,15,DrawStyle::LIGHTTEXT);
90 /* if (!(*list)[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)[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);
111 bool WWinAudioFilter::mouseLBDOWN(int x, int y)
113 if (sl.mouseLBDOWN(x,y))
115 BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press
121 bool WWinAudioFilter::mouseMove(int x, int y)
123 if (sl.mouseMove(x,y))
125 sl.setShowSelOption(true);
132 void WWinAudioFilter::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>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
140 sl.setShowSelOption(true);
143 viewman->updateView(this);
146 else if (m->message == Message::MOUSE_LBDOWN)
148 if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-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>>16)-getScreenX();
156 int y=(m->parameter&0xFFFF)-getScreenY();
157 if (x<0 || y <0 || x>getWidth() || y>getHeight())
159 ViewMan::getInstance()->handleCommand(Input::BACK); //simulate cancel press
167 void WWinAudioFilter::doSave()
169 Message* m = new Message();
170 m->message = Message::CHANGED_DEVICEOPTIONS;
173 //Command::getInstance()->postMessage(m);
178 int WWinAudioFilter::handleCommand(int command)
185 if (sl.getCurrentOption() != 0)
188 sl.setShowSelOption(true);
193 sl.setShowSelOption(false);
194 return 4; //Control to vopts control
199 Log::getInstance()->log("P", Log::DEBUG, "1");
201 sl.setShowSelOption(true);
204 case Input::SKIPBACK:
210 case Input::SKIPFORWARD:
218 AudioWin*aw=(AudioWin*)Audio::getInstance();
219 aw->selectAudioFilter(reinterpret_cast<ULONG>(sl.getCurrentOptionData()));
232 // stop command getting to any more views