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.

81 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 "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(15, 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(5,75,60,20,"Monostable");
  34. m_Monostable->labelsize(8);
  35. m_Monostable->type(1);
  36. m_Monostable->callback((Fl_Callback*)cb_Monostable);
  37. end();
  38. }
  39. void FlipflopPluginGUI::UpdateValues(SpiralPlugin *o)
  40. {
  41. FlipflopPlugin* Plugin=(FlipflopPlugin*)o;
  42. m_TriggerTime->value(Plugin->GetTriggerTime());
  43. m_Monostable->value(Plugin->GetMonostable());
  44. }
  45. //// Callbacks ////
  46. inline void FlipflopPluginGUI::cb_TriggerTime_i(Fl_Knob* o, void* v)
  47. {
  48. m_GUICH->Set("TriggerTime",(float)o->value());
  49. }
  50. void FlipflopPluginGUI::cb_TriggerTime(Fl_Knob* o, void* v)
  51. { ((FlipflopPluginGUI*)(o->parent()))->cb_TriggerTime_i(o,v);}
  52. inline void FlipflopPluginGUI::cb_Monostable_i(Fl_Button* o, void* v)
  53. {
  54. m_GUICH->Set("Monostable",(bool)o->value());
  55. }
  56. void FlipflopPluginGUI::cb_Monostable(Fl_Button* o, void* v)
  57. { ((FlipflopPluginGUI*)(o->parent()))->cb_Monostable_i(o,v);}
  58. const string FlipflopPluginGUI::GetHelpText(const string &loc){
  59. return string("")
  60. + "This plugin has two modes, bistable (the default) converts momentary\n"
  61. + "pulses into sustained pulses, i.e one pulse to set the output to 1.0,\n"
  62. + "and another pulse to flip it back to -1.0.\n\n"
  63. + "Monostable mode is sort of the reverse, any input pulse detected will\n"
  64. + "cause an output pulse to be generated, the length of which is set by the\n"
  65. + "trigger time control (out of 1 second max)\n\n"
  66. + "For a better description, google \"flipflop bistable monostable\" :)";
  67. }