You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
3.7KB

  1. /* SpiralPlugin
  2. * Copyleft (C) 2000 David Griffiths <dave@pawfal.org>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. */
  18. #include "OutputPluginGUI.h"
  19. #include <FL/fl_draw.h>
  20. #include <FL/fl_file_chooser.H>
  21. static const int GUI_COLOUR = 179;
  22. static const int GUIBG_COLOUR = 144;
  23. static const int GUIBG2_COLOUR = 145;
  24. OutputPluginGUI::OutputPluginGUI(int w, int h, SpiralPlugin *o, ChannelHandler *ch,const HostInfo *Info) :
  25. SpiralPluginGUI(w,h,o,ch)
  26. {
  27. Volume = new Fl_Knob(30, 22, 40, 40, "Volume");
  28. Volume->color(GUI_COLOUR);
  29. Volume->type(Fl_Knob::DOTLIN);
  30. Volume->labelsize(10);
  31. Volume->maximum(1);
  32. Volume->step(0.001);
  33. Volume->value(0.5);
  34. Volume->callback((Fl_Callback*)cb_Volume);
  35. OpenRead = new Fl_Button(2, 80, 30, 15, "Read");
  36. OpenRead->type(1);
  37. OpenRead->down_box(FL_DOWN_BOX);
  38. OpenRead->labelsize(10);
  39. OpenRead->callback((Fl_Callback*)cb_OpenRead);
  40. OpenDuplex = new Fl_Button(34, 80, 31, 15, "Dplx");
  41. OpenDuplex->type(1);
  42. OpenDuplex->down_box(FL_DOWN_BOX);
  43. OpenDuplex->labelsize(10);
  44. OpenDuplex->callback((Fl_Callback*)cb_OpenDuplex);
  45. OpenWrite = new Fl_Button(68, 80, 30, 15, "Write");
  46. OpenWrite->type(1);
  47. OpenWrite->down_box(FL_DOWN_BOX);
  48. OpenWrite->labelsize(10);
  49. OpenWrite->callback((Fl_Callback*)cb_OpenWrite);
  50. end();
  51. }
  52. void OutputPluginGUI::UpdateValues(SpiralPlugin *o)
  53. {
  54. Volume->value(OSSOutput::Get()->GetVolume());
  55. }
  56. //// Callbacks ////
  57. inline void OutputPluginGUI::cb_Volume_i(Fl_Knob* o, void* v)
  58. {
  59. m_GUICH->Set("Volume",(float)o->value());
  60. m_GUICH->SetCommand(OutputPlugin::SET_VOLUME);
  61. }
  62. void OutputPluginGUI::cb_Volume(Fl_Knob* o, void* v)
  63. { ((OutputPluginGUI*)(o->parent()))->cb_Volume_i(o,v); }
  64. inline void OutputPluginGUI::cb_OpenRead_i(Fl_Button* o, void* v)
  65. {
  66. if (o->value())
  67. {
  68. OpenWrite->value(0);
  69. m_GUICH->SetCommand(OutputPlugin::CLOSE);
  70. m_GUICH->Wait();
  71. m_GUICH->SetCommand(OutputPlugin::OPENREAD);
  72. m_GUICH->Wait();
  73. }
  74. else
  75. {
  76. OpenWrite->value(0);
  77. m_GUICH->SetCommand(OutputPlugin::CLOSE);
  78. m_GUICH->Wait();
  79. }
  80. }
  81. void OutputPluginGUI::cb_OpenRead(Fl_Button* o, void* v)
  82. { ((OutputPluginGUI*)(o->parent()))->cb_OpenRead_i(o,v); }
  83. inline void OutputPluginGUI::cb_OpenDuplex_i(Fl_Button* o, void* v)
  84. {
  85. if (o->value())
  86. {
  87. OpenRead->value(0);
  88. m_GUICH->SetCommand(OutputPlugin::CLOSE);
  89. m_GUICH->Wait();
  90. m_GUICH->SetCommand(OutputPlugin::OPENDUPLEX);
  91. m_GUICH->Wait();
  92. }
  93. else
  94. {
  95. OpenRead->value(0);
  96. m_GUICH->SetCommand(OutputPlugin::CLOSE);
  97. m_GUICH->Wait();
  98. }
  99. }
  100. void OutputPluginGUI::cb_OpenDuplex(Fl_Button* o, void* v)
  101. { ((OutputPluginGUI*)(o->parent()))->cb_OpenDuplex_i(o,v); }
  102. inline void OutputPluginGUI::cb_OpenWrite_i(Fl_Button* o, void* v)
  103. {
  104. if (o->value())
  105. {
  106. OpenRead->value(0);
  107. m_GUICH->SetCommand(OutputPlugin::CLOSE);
  108. m_GUICH->Wait();
  109. m_GUICH->SetCommand(OutputPlugin::OPENWRITE);
  110. m_GUICH->Wait();
  111. }
  112. else
  113. {
  114. OpenRead->value(0);
  115. m_GUICH->SetCommand(OutputPlugin::CLOSE);
  116. m_GUICH->Wait();
  117. }
  118. }
  119. void OutputPluginGUI::cb_OpenWrite(Fl_Button* o, void* v)
  120. { ((OutputPluginGUI*)(o->parent()))->cb_OpenWrite_i(o,v); }