/* SpiralPlugin * Copyleft (C) 2000 David Griffiths * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "OutputPluginGUI.h" #include #include static const int GUI_COLOUR = 179; static const int GUIBG_COLOUR = 144; static const int GUIBG2_COLOUR = 145; OutputPluginGUI::OutputPluginGUI(int w, int h, SpiralPlugin *o, ChannelHandler *ch,const HostInfo *Info) : SpiralPluginGUI(w,h,o,ch) { Volume = new Fl_Knob(30, 22, 40, 40, "Volume"); Volume->color(GUI_COLOUR); Volume->type(Fl_Knob::DOTLIN); Volume->labelsize(10); Volume->maximum(1); Volume->step(0.001); Volume->value(0.5); Volume->callback((Fl_Callback*)cb_Volume); OpenRead = new Fl_Button(2, 80, 30, 15, "Read"); OpenRead->type(1); OpenRead->down_box(FL_DOWN_BOX); OpenRead->labelsize(10); OpenRead->callback((Fl_Callback*)cb_OpenRead); OpenDuplex = new Fl_Button(34, 80, 31, 15, "Dplx"); OpenDuplex->type(1); OpenDuplex->down_box(FL_DOWN_BOX); OpenDuplex->labelsize(10); OpenDuplex->callback((Fl_Callback*)cb_OpenDuplex); OpenWrite = new Fl_Button(68, 80, 30, 15, "Write"); OpenWrite->type(1); OpenWrite->down_box(FL_DOWN_BOX); OpenWrite->labelsize(10); OpenWrite->callback((Fl_Callback*)cb_OpenWrite); end(); } void OutputPluginGUI::UpdateValues(SpiralPlugin *o) { Volume->value(OSSOutput::Get()->GetVolume()); } //// Callbacks //// inline void OutputPluginGUI::cb_Volume_i(Fl_Knob* o, void* v) { m_GUICH->Set("Volume",(float)o->value()); m_GUICH->SetCommand(OutputPlugin::SET_VOLUME); } void OutputPluginGUI::cb_Volume(Fl_Knob* o, void* v) { ((OutputPluginGUI*)(o->parent()))->cb_Volume_i(o,v); } inline void OutputPluginGUI::cb_OpenRead_i(Fl_Button* o, void* v) { if (o->value()) { OpenWrite->value(0); m_GUICH->SetCommand(OutputPlugin::CLOSE); m_GUICH->Wait(); m_GUICH->SetCommand(OutputPlugin::OPENREAD); m_GUICH->Wait(); } else { OpenWrite->value(0); m_GUICH->SetCommand(OutputPlugin::CLOSE); m_GUICH->Wait(); } } void OutputPluginGUI::cb_OpenRead(Fl_Button* o, void* v) { ((OutputPluginGUI*)(o->parent()))->cb_OpenRead_i(o,v); } inline void OutputPluginGUI::cb_OpenDuplex_i(Fl_Button* o, void* v) { if (o->value()) { OpenRead->value(0); m_GUICH->SetCommand(OutputPlugin::CLOSE); m_GUICH->Wait(); m_GUICH->SetCommand(OutputPlugin::OPENDUPLEX); m_GUICH->Wait(); } else { OpenRead->value(0); m_GUICH->SetCommand(OutputPlugin::CLOSE); m_GUICH->Wait(); } } void OutputPluginGUI::cb_OpenDuplex(Fl_Button* o, void* v) { ((OutputPluginGUI*)(o->parent()))->cb_OpenDuplex_i(o,v); } inline void OutputPluginGUI::cb_OpenWrite_i(Fl_Button* o, void* v) { if (o->value()) { OpenRead->value(0); m_GUICH->SetCommand(OutputPlugin::CLOSE); m_GUICH->Wait(); m_GUICH->SetCommand(OutputPlugin::OPENWRITE); m_GUICH->Wait(); } else { OpenRead->value(0); m_GUICH->SetCommand(OutputPlugin::CLOSE); m_GUICH->Wait(); } } void OutputPluginGUI::cb_OpenWrite(Fl_Button* o, void* v) { ((OutputPluginGUI*)(o->parent()))->cb_OpenWrite_i(o,v); }