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.

65 lines
2.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 "CounterPluginGUI.h"
  19. #include <FL/fl_draw.h>
  20. #include <FL/fl_draw.H>
  21. #include <stdio.h>
  22. ////////////////////////////////////////////
  23. CounterPluginGUI::CounterPluginGUI(int w, int h,CounterPlugin *o,ChannelHandler *ch,const HostInfo *Info) :
  24. SpiralPluginGUI(w,h,o,ch)
  25. {
  26. m_Count = new Fl_Input(5, 20, 50, 20, "Count");
  27. m_Count->color(Info->GUI_COLOUR);
  28. m_Count->labelsize(8);
  29. m_Count->align(FL_ALIGN_BOTTOM|FL_ALIGN_CENTER);
  30. m_Count->textsize(10);
  31. m_Count->value("4");
  32. m_Count->when(FL_WHEN_ENTER_KEY);
  33. m_Count->callback((Fl_Callback*)cb_Count);
  34. end();
  35. }
  36. void CounterPluginGUI::UpdateValues(SpiralPlugin *o)
  37. {
  38. CounterPlugin* Plugin = (CounterPlugin*)o;
  39. char t[256];
  40. sprintf(t,"%d",Plugin->GetCount());
  41. m_Count->value(t);
  42. }
  43. //// Callbacks ////
  44. inline void CounterPluginGUI::cb_Count_i(Fl_Input* o, void* v)
  45. {
  46. m_GUICH->Set("Count",(int)strtod(o->value(),NULL));
  47. }
  48. void CounterPluginGUI::cb_Count(Fl_Input* o, void* v)
  49. { ((CounterPluginGUI*)(o->parent()))->cb_Count_i(o,v);}
  50. const string CounterPluginGUI::GetHelpText(const string &loc){
  51. return string("")
  52. + "Counts input pulses (zero crossings) and flips the output\n"
  53. + "CV every time the count is reached.";
  54. }