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 "wwinmp3audiofilter.h"
26 WWinMp3AudioFilter::WWinMp3AudioFilter()
30 sl.setShowSelOption(false);
31 sl.setPosition(15,30+15);
37 WWinMp3AudioFilter::~WWinMp3AudioFilter()
42 void WWinMp3AudioFilter::initSelectList(bool startup)
48 selection=sl.getCurrentOption();
49 top=sl.getTopOption();
55 AudioWin *aw=(AudioWin*) Audio::getInstance();
57 const AudioFilterDescList *list=aw->getMp3AudioFilterList(filselected);
58 for (i = 0; i < list->size();i++)
60 const char * name = (*list)[i].friendlyname;
63 char * desc=new char [strlen(name)+1];
65 sl.addOption(desc, reinterpret_cast<void*>(i), 0);
71 sl.hintSetCurrent(selection);
76 void WWinMp3AudioFilter::setSize(u4 w, u4 h)
79 sl.setSize(area.w - 240, area.h - 30-15-30);
83 void WWinMp3AudioFilter::draw()
87 drawText(tr("Selected Filter:"), 15, 15, DrawStyle::LIGHTTEXT);
89 AudioWin *aw=(AudioWin*) Audio::getInstance();
90 const AudioFilterDescList *list=aw->getMp3AudioFilterList(filselected);
91 if (filselected!=-1) drawText((*list)[filselected].friendlyname,215,15,DrawStyle::LIGHTTEXT);
94 /* if (!(*list)[sl.getCurrentOptionData()].vmr9tested)
96 rectangle(area.w - 220, 160, 200, 20, DrawStyle::YELLOW);
97 drawText(tr("VMR 9 support: ?"), area.w - 220, 160, DrawStyle::DARKTEXT);
99 else if ((*list)[sl.getCurrentOptionData()].vmr9)
101 rectangle(area.w - 220, 160, 200, 20, DrawStyle::GREEN);
102 drawText(tr("VMR 9 support: yes"), area.w - 220, 160, DrawStyle::DARKTEXT);
106 rectangle(area.w - 220, 160, 200, 20, DrawStyle::RED);
107 drawText(tr("VMR 9 support: no"), area.w - 220, 160, DrawStyle::DARKTEXT);
110 drawText(tr("Press [ok] to select filter! "), 15, area.h - 30, DrawStyle::LIGHTTEXT);
118 bool WWinMp3AudioFilter::mouseLBDOWN(int x, int y)
120 if (sl.mouseLBDOWN(x,y))
122 BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press
128 bool WWinMp3AudioFilter::mouseMove(int x, int y)
130 if (sl.mouseMove(x,y))
132 sl.setShowSelOption(true);
140 void WWinMp3AudioFilter::processMessage(Message* m)
142 Log::getInstance()->log("VRecordingList", Log::DEBUG, "Got message value %lu", m->message);
144 if (m->message == Message::MOUSE_MOVE)
146 if (sl.mouseMove(m->parameter - getScreenX(), m->tag - getScreenY()))
148 sl.setShowSelOption(true);
151 viewman->updateView(this);
154 else if (m->message == Message::MOUSE_LBDOWN)
156 if (sl.mouseLBDOWN(m->parameter - getScreenX(), m->tag - getScreenY()))
158 ViewMan::getInstance()->handleCommand(Input::OK); //simulate OK press
162 //check if press is outside this view! then simulate cancel
163 int x = m->parameter - getScreenX();
164 int y = m->tag - getScreenY();
165 if (x<0 || y <0 || x>getWidth() || y>getHeight())
167 ViewMan::getInstance()->handleCommand(Input::BACK); //simulate cancel press
175 /*void WWinMp3AudioFilter::doSave()
177 Message* m = new Message();
178 m->message = Message::CHANGED_DEVICEOPTIONS;
181 //Control::getInstance()->postMessage(m);
186 int WWinMp3AudioFilter::handleCommand(int command)
193 if (sl.getCurrentOption() != 0)
196 sl.setShowSelOption(true);
201 sl.setShowSelOption(false);
202 return 4; //Control to vpots control
209 sl.setShowSelOption(true);
212 case Input::SKIPBACK:
219 case Input::SKIPFORWARD:
229 AudioWin*aw=(AudioWin*)Audio::getInstance();
230 aw->selectMp3AudioFilter(reinterpret_cast<u4>(sl.getCurrentOptionData()));
243 // stop command getting to any more views