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 "wwinmp3audiofilter.h"
27 WWinMp3AudioFilter::WWinMp3AudioFilter()
31 sl.setShowSelOption(false);
32 sl.setPosition(15,30+15);
38 WWinMp3AudioFilter::~WWinMp3AudioFilter()
43 void WWinMp3AudioFilter::initSelectList(bool startup)
49 selection=sl.getCurrentOption();
50 top=sl.getTopOption();
56 AudioWin *aw=(AudioWin*) Audio::getInstance();
58 const AudioFilterDescList *list=aw->getMp3AudioFilterList(filselected);
59 for (i = 0; i < list->size();i++)
61 const char * name = (*list)[i].friendlyname;
64 char * desc=new char [strlen(name)+1];
66 sl.addOption(desc,i,0);
72 sl.hintSetCurrent(selection);
77 void WWinMp3AudioFilter::setSize(UINT w, UINT h)
80 sl.setSize(area.w - 240, area.h - 30-15-30);
84 void WWinMp3AudioFilter::draw()
88 drawText(tr("Selected Filter:"), 15, 15, DrawStyle::LIGHTTEXT);
90 AudioWin *aw=(AudioWin*) Audio::getInstance();
91 const AudioFilterDescList *list=aw->getMp3AudioFilterList(filselected);
92 if (filselected!=-1) drawText((*list)[filselected].friendlyname,215,15,DrawStyle::LIGHTTEXT);
95 /* if (!(*list)[sl.getCurrentOptionData()].vmr9tested)
97 rectangle(area.w - 220, 160, 200, 20, DrawStyle::YELLOW);
98 drawText(tr("VMR 9 support: ?"), area.w - 220, 160, DrawStyle::DARKTEXT);
100 else if ((*list)[sl.getCurrentOptionData()].vmr9)
102 rectangle(area.w - 220, 160, 200, 20, DrawStyle::GREEN);
103 drawText(tr("VMR 9 support: yes"), area.w - 220, 160, DrawStyle::DARKTEXT);
107 rectangle(area.w - 220, 160, 200, 20, DrawStyle::RED);
108 drawText(tr("VMR 9 support: no"), area.w - 220, 160, DrawStyle::DARKTEXT);
111 drawText(tr("Press [ok] to select filter! "), 15, area.h - 30, DrawStyle::LIGHTTEXT);
119 bool WWinMp3AudioFilter::mouseLBDOWN(int x, int y)
121 if (sl.mouseLBDOWN(x,y))
123 BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
129 bool WWinMp3AudioFilter::mouseMove(int x, int y)
131 if (sl.mouseMove(x,y))
133 sl.setShowSelOption(true);
141 void WWinMp3AudioFilter::processMessage(Message* m)
143 Log::getInstance()->log("VRecordingList", Log::DEBUG, "Got message value %lu", m->message);
145 if (m->message == Message::MOUSE_MOVE)
147 if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
149 sl.setShowSelOption(true);
152 viewman->updateView(this);
155 else if (m->message == Message::MOUSE_LBDOWN)
157 if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
159 ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
163 //check if press is outside this view! then simulate cancel
164 int x=(m->parameter>>16)-getScreenX();
165 int y=(m->parameter&0xFFFF)-getScreenY();
166 if (x<0 || y <0 || x>getWidth() || y>getHeight())
168 ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
176 /*void WWinMp3AudioFilter::doSave()
178 Message* m = new Message();
179 m->message = Message::CHANGED_DEVICEOPTIONS;
182 Command::getInstance()->postMessageNoLock(m);
187 int WWinMp3AudioFilter::handleCommand(int command)
195 if (sl.getCurrentOption() != 0)
198 sl.setShowSelOption(true);
203 sl.setShowSelOption(false);
204 return 4; //Control to vpots control
207 case Remote::DF_DOWN:
212 sl.setShowSelOption(true);
215 case Remote::SKIPBACK:
222 case Remote::SKIPFORWARD:
232 AudioWin*aw=(AudioWin*)Audio::getInstance();
233 aw->selectMp3AudioFilter(sl.getCurrentOptionData());
246 // stop command getting to any more views