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.

94 lines
3.0KB

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