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.

69 lines
2.0KB

  1. /* MousePlugin
  2. * Copyleft (C) 2002 Dan Bethell <dan@pawfal.org>
  3. * Dave Griffiths <dave@pawfal.org>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. */
  19. #include "MousePluginGUI.h"
  20. #include <FL/fl_draw.h>
  21. #include <FL/fl_draw.H>
  22. static const int GUI_COLOUR = 154;
  23. static const int GUIBG_COLOUR = 144;
  24. static const int GUIBG2_COLOUR = 145;
  25. ScratchWidget::ScratchWidget (int x, int y, int w, int h, const char *l, int BUFSIZE) :
  26. Fl_Widget (x, y, w, h, l),
  27. m_Data (0.0),
  28. m_Channels (1),
  29. m_Bufsize (BUFSIZE)
  30. {
  31. }
  32. void ScratchWidget::draw() {
  33. fl_color (GUIBG_COLOUR);
  34. fl_rectf (x(), y(), w(), h());
  35. fl_push_clip (x(), y(), w(), h());
  36. int val = (int)(((m_Data * -1) + 1) * (h() / 2.0));
  37. fl_color (FL_WHITE);
  38. fl_rectf (x(), y() + val, w(), h());
  39. fl_pop_clip();
  40. }
  41. ////////////////////////////////////////////
  42. MousePluginGUI::MousePluginGUI (int w, int h, MousePlugin *o, ChannelHandler *ch, const HostInfo *Info) :
  43. SpiralPluginGUI (w, h, o, ch)
  44. {
  45. m_Scope = new ScratchWidget (5, 20, 60, 100, "Scratch", Info->BUFSIZE);
  46. end();
  47. }
  48. void MousePluginGUI::Update () {
  49. m_Scope->m_Data = m_GUICH->GetFloat ("Data");
  50. m_Scope->redraw();
  51. }
  52. // Update GUI on Load
  53. void MousePluginGUI::UpdateValues (SpiralPlugin* o) {
  54. }
  55. const string MousePluginGUI::GetHelpText (const string &loc) {
  56. return string("")
  57. + "\n"
  58. + "\n";
  59. }