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.

90 lines
2.8KB

  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. DiskWriterPluginGUI::DiskWriterPluginGUI(int w, int h, SpiralPlugin *o, ChannelHandler *ch,const HostInfo *Info) :
  22. SpiralPluginGUI(w,h,o,ch)
  23. {
  24. Open = new Fl_Button(5, 15, 90, 20, "Open");
  25. Open->type(1);
  26. Open->down_box(FL_DOWN_BOX);
  27. Open->labelsize(10);
  28. Open->callback((Fl_Callback*)cb_Open);
  29. Record = new Fl_Button(5, 35, 90, 20, "Record");
  30. Record->type(1);
  31. Record->down_box(FL_DOWN_BOX);
  32. Record->labelsize(10);
  33. Record->callback((Fl_Callback*)cb_Record);
  34. end();
  35. }
  36. void DiskWriterPluginGUI::UpdateValues(SpiralPlugin *o)
  37. {
  38. }
  39. //// Callbacks ////
  40. inline void DiskWriterPluginGUI::cb_Open_i(Fl_Button* o, void* v)
  41. {
  42. if (o->value())
  43. {
  44. char *fn=fl_file_chooser("Pick a Wav file to save to", "*.wav", NULL);
  45. char t[256];
  46. sprintf(t,"%s",fn);
  47. if (fn && fn!="")
  48. {
  49. m_GUICH->SetData("Filename",(void*)t);
  50. m_GUICH->SetCommand(DiskWriterPlugin::OPENWAV);
  51. }
  52. else
  53. {
  54. m_GUICH->SetCommand(DiskWriterPlugin::CLOSEWAV);
  55. o->value(false);
  56. }
  57. }
  58. else
  59. {
  60. m_GUICH->SetCommand(DiskWriterPlugin::CLOSEWAV);
  61. }
  62. }
  63. void DiskWriterPluginGUI::cb_Open(Fl_Button* o, void* v)
  64. { ((DiskWriterPluginGUI*)(o->parent()))->cb_Open_i(o,v); }
  65. inline void DiskWriterPluginGUI::cb_Record_i(Fl_Button* o, void* v)
  66. {
  67. if (o->value()) m_GUICH->SetCommand(DiskWriterPlugin::RECORD);
  68. else m_GUICH->SetCommand(DiskWriterPlugin::STOP);
  69. }
  70. void DiskWriterPluginGUI::cb_Record(Fl_Button* o, void* v)
  71. { ((DiskWriterPluginGUI*)(o->parent()))->cb_Record_i(o,v); }
  72. const string DiskWriterPluginGUI::GetHelpText(const string &loc){
  73. return string("")
  74. + "One way of recording your creations to disk. First open a file\n"
  75. + "you wish to save to, then hit record to start recording.\n"
  76. + "You are able to stop and restart recording without closing the\n"
  77. + "file, which should make life a little easier if you are doing\n"
  78. + "things like recording lots of little samples.";
  79. }