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.

110 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 <FL/Fl.H>
  19. #include <FL/Fl_Window.H>
  20. #include <FL/Fl_Group.H>
  21. #include <FL/Fl_Output.H>
  22. #include <FL/Fl_Button.H>
  23. #include <FL/Fl_Box.H>
  24. #include <FL/Fl_Output.H>
  25. #include <list>
  26. #include "ComplexEnvelopePlugin.h"
  27. #include "../SpiralPluginGUI.h"
  28. #include "../Widgets/Fl_Knob.H"
  29. #include "Bezier.h"
  30. #ifndef EnvelopeGUI
  31. #define EnvelopeGUI
  32. class Fl_Envelope : public Fl_Group
  33. {
  34. public:
  35. Fl_Envelope(int x,int y, int w, int h, char *Name);
  36. ~Fl_Envelope();
  37. virtual int handle(int event);
  38. virtual void draw();
  39. void Clear();
  40. void SetBezier(bool s) { m_Bezier=s; }
  41. void SetLength(float s) { m_Length=s; }
  42. vector<Vec2> GetCVList();
  43. void SetCVList(const vector<Vec2> &CV);
  44. private:
  45. class Fl_Handle : public Fl_Widget
  46. {
  47. public:
  48. Fl_Handle(int x,int y, int w, int h, char *Name);
  49. ~Fl_Handle();
  50. virtual int handle(int event);
  51. virtual void draw();
  52. bool Deleted() { return m_DelMe; }
  53. void DelMe() { m_DelMe=true; }
  54. void SetIsCoincident(bool s) { m_Coincident=s; }
  55. bool Changed() { bool t=m_Changed; m_Changed=false; return t; }
  56. private:
  57. bool m_DelMe;
  58. bool m_Changed;
  59. bool m_Coincident;
  60. };
  61. float m_Length;
  62. float m_Time;
  63. bool m_Bezier;
  64. list<Fl_Handle*> m_HandleList;
  65. vector<Vec2> m_HandlePos;
  66. int m_Origin_x;
  67. int m_Origin_y;
  68. };
  69. class ComplexEnvelopePluginGUI : public SpiralPluginGUI
  70. {
  71. public:
  72. ComplexEnvelopePluginGUI(int w, int h, ComplexEnvelopePlugin *o,const HostInfo *Info);
  73. virtual void UpdateValues();
  74. virtual SpiralPlugin* GetPlugin() { return m_Plugin; }
  75. void SetCVList(const vector<Vec2> &CV) { m_Envelope->SetCVList(CV); }
  76. ComplexEnvelopePlugin *m_Plugin;
  77. private:
  78. Fl_Envelope *m_Envelope;
  79. Fl_Button *m_Type;
  80. Fl_Knob *m_Length;
  81. Fl_Output *m_TLength;
  82. //// Callbacks ////
  83. inline void cb_Type_i(Fl_Button *o, void *v);
  84. static void cb_Type(Fl_Button *o, void *v);
  85. inline void cb_Length_i(Fl_Knob *o, void *v);
  86. static void cb_Length(Fl_Knob *o, void *v);
  87. inline void cb_UpdateEnv_i(Fl_Envelope *o, void*v);
  88. static void cb_UpdateEnv(Fl_Envelope* o, void* v);
  89. };
  90. #endif