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.

85 lines
2.5KB

  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 "DiskWriterPluginGUI.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. DiskWriterPluginGUI::DiskWriterPluginGUI(int w, int h, SpiralPlugin *o, ChannelHandler *ch,const HostInfo *Info) :
  25. SpiralPluginGUI(w,h,o,ch)
  26. {
  27. Open = new Fl_Button(5, 15, 90, 20, "Open");
  28. Open->type(1);
  29. Open->down_box(FL_DOWN_BOX);
  30. Open->labelsize(10);
  31. Open->callback((Fl_Callback*)cb_Open);
  32. Record = new Fl_Button(5, 35, 90, 20, "Record");
  33. Record->type(1);
  34. Record->down_box(FL_DOWN_BOX);
  35. Record->labelsize(10);
  36. Record->callback((Fl_Callback*)cb_Record);
  37. end();
  38. }
  39. void DiskWriterPluginGUI::UpdateValues(SpiralPlugin *o)
  40. {
  41. }
  42. //// Callbacks ////
  43. inline void DiskWriterPluginGUI::cb_Open_i(Fl_Button* o, void* v)
  44. {
  45. if (o->value())
  46. {
  47. char *fn=fl_file_chooser("Pick a Wav file to save to", "*.wav", NULL);
  48. char t[256];
  49. sprintf(t,"%s",fn);
  50. if (fn && fn!="")
  51. {
  52. m_GUICH->SetData("Filename",(void*)t);
  53. m_GUICH->SetCommand(DiskWriterPlugin::OPENWAV);
  54. }
  55. else
  56. {
  57. m_GUICH->SetCommand(DiskWriterPlugin::CLOSEWAV);
  58. o->value(false);
  59. }
  60. }
  61. else
  62. {
  63. m_GUICH->SetCommand(DiskWriterPlugin::CLOSEWAV);
  64. }
  65. }
  66. void DiskWriterPluginGUI::cb_Open(Fl_Button* o, void* v)
  67. { ((DiskWriterPluginGUI*)(o->parent()))->cb_Open_i(o,v); }
  68. inline void DiskWriterPluginGUI::cb_Record_i(Fl_Button* o, void* v)
  69. {
  70. if (o->value()) m_GUICH->SetCommand(DiskWriterPlugin::RECORD);
  71. else m_GUICH->SetCommand(DiskWriterPlugin::STOP);
  72. }
  73. void DiskWriterPluginGUI::cb_Record(Fl_Button* o, void* v)
  74. { ((DiskWriterPluginGUI*)(o->parent()))->cb_Record_i(o,v); }