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.

84 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 "FlipflopPluginGUI.h"
  19. #include <FL/fl_draw.h>
  20. #include <FL/fl_draw.H>
  21. ////////////////////////////////////////////
  22. FlipflopPluginGUI::FlipflopPluginGUI(int w, int h,FlipflopPlugin *o,ChannelHandler *ch,const HostInfo *Info) :
  23. SpiralPluginGUI(w,h,o,ch)
  24. {
  25. m_TriggerTime = new Fl_Knob (20, 15, 40, 40, "Trigger Time");
  26. m_TriggerTime->color (Info->GUI_COLOUR);
  27. m_TriggerTime->labelsize(8);
  28. m_TriggerTime->maximum(1.0f);
  29. m_TriggerTime->minimum(0.0f);
  30. m_TriggerTime->step(0.0001f);
  31. m_TriggerTime->labelsize(8);
  32. m_TriggerTime->callback((Fl_Callback*)cb_TriggerTime);
  33. m_Monostable = new Fl_Button (10, 70, 60, 20, "Monostable");
  34. m_Monostable->color (Info->GUI_COLOUR);
  35. m_Monostable->selection_color (Info->GUI_COLOUR);
  36. m_Monostable->box (FL_PLASTIC_UP_BOX);
  37. m_Monostable->labelsize(8);
  38. m_Monostable->type(1);
  39. m_Monostable->callback((Fl_Callback*)cb_Monostable);
  40. end();
  41. }
  42. void FlipflopPluginGUI::UpdateValues(SpiralPlugin *o)
  43. {
  44. FlipflopPlugin* Plugin=(FlipflopPlugin*)o;
  45. m_TriggerTime->value(Plugin->GetTriggerTime());
  46. m_Monostable->value(Plugin->GetMonostable());
  47. }
  48. //// Callbacks ////
  49. inline void FlipflopPluginGUI::cb_TriggerTime_i(Fl_Knob* o, void* v)
  50. {
  51. m_GUICH->Set("TriggerTime",(float)o->value());
  52. }
  53. void FlipflopPluginGUI::cb_TriggerTime(Fl_Knob* o, void* v)
  54. { ((FlipflopPluginGUI*)(o->parent()))->cb_TriggerTime_i(o,v);}
  55. inline void FlipflopPluginGUI::cb_Monostable_i(Fl_Button* o, void* v)
  56. {
  57. m_GUICH->Set("Monostable",(bool)o->value());
  58. }
  59. void FlipflopPluginGUI::cb_Monostable(Fl_Button* o, void* v)
  60. { ((FlipflopPluginGUI*)(o->parent()))->cb_Monostable_i(o,v);}
  61. const string FlipflopPluginGUI::GetHelpText(const string &loc){
  62. return string("")
  63. + "This plugin has two modes, bistable (the default) converts momentary\n"
  64. + "pulses into sustained pulses, i.e one pulse to set the output to 1.0,\n"
  65. + "and another pulse to flip it back to -1.0.\n\n"
  66. + "Monostable mode is sort of the reverse, any input pulse detected will\n"
  67. + "cause an output pulse to be generated, the length of which is set by the\n"
  68. + "trigger time control (out of 1 second max)\n\n"
  69. + "For a better description, google \"flipflop bistable monostable\" :)";
  70. }