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.

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