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.

133 lines
4.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 <FL/Fl.H>
  19. #include <FL/Fl_Window.H>
  20. #include <FL/Fl_Group.H>
  21. #include <FL/Fl_Scroll.H>
  22. #include <FL/Fl_Slider.H>
  23. #include <FL/Fl_Counter.H>
  24. #include <FL/Fl_Output.H>
  25. #include <FL/Fl_Box.H>
  26. #include "MatrixPlugin.h"
  27. #include "../SpiralPluginGUI.h"
  28. #include "../Widgets/Fl_Knob.H"
  29. #include "../Widgets/Fl_LED_Button.H"
  30. #ifndef MatrixGUI
  31. #define MatrixGUI
  32. class Fl_MatrixButton : public Fl_Button
  33. {
  34. public:
  35. Fl_MatrixButton(int x, int y, int w, int h, char* n);
  36. ~Fl_MatrixButton() {}
  37. virtual int handle(int event);
  38. float GetVolume() { return m_VolVal/255.0f; }
  39. void SetVolume(float s)
  40. {
  41. m_VolVal=s*255;
  42. fl_color((char)m_VolVal,(char)m_VolVal,255);
  43. selection_color(fl_color());
  44. }
  45. void SetVolCallback(Fl_Callback* s, void *c) { cb_VolChange=s; cb_context=c; }
  46. private:
  47. bool m_SliderHidden;
  48. Fl_Slider *m_Volume;
  49. float m_VolVal;
  50. void (*cb_VolChange)(Fl_Widget*, void*);
  51. void *cb_context;
  52. inline void cb_Vol_i(Fl_Slider* o, void* v);
  53. static void cb_Vol(Fl_Slider* o, void* v);
  54. };
  55. class MatrixPluginGUI : public SpiralPluginGUI
  56. {
  57. public:
  58. MatrixPluginGUI(int w, int h, MatrixPlugin *o,ChannelHandler *ch,const HostInfo *Info);
  59. virtual void UpdateValues(SpiralPlugin *o);
  60. virtual void Update();
  61. protected:
  62. const string GetHelpText(const string &loc);
  63. private:
  64. void UpdateMatrix();
  65. int Numbers[MATX*MATY];
  66. Pattern m_GUIMatrix[NUM_PATTERNS];
  67. int m_LastLight;
  68. Fl_Button* m_NoteCut;
  69. Fl_Counter* m_Pattern;
  70. Fl_Counter* m_PlayPattern;
  71. Fl_Counter* m_Length;
  72. Fl_Knob* m_Speed;
  73. Fl_MatrixButton* m_Matrix[MATX][MATY];
  74. Fl_Counter* m_Octave;
  75. Fl_Counter* m_SpeedVal;
  76. Fl_LED_Button* m_Flash[MATX];
  77. Fl_Button* m_CopyBtn;
  78. Fl_Button* m_PasteBtn;
  79. Fl_Button* m_ClearBtn;
  80. Fl_Box* m_TransLbl;
  81. Fl_Button* m_TransUpBtn;
  82. Fl_Button* m_TransDnBtn;
  83. //// Callbacks ////
  84. inline void cb_Matrix_i(Fl_Button* o, void* v);
  85. static void cb_Matrix(Fl_Button* o, void* v);
  86. inline void cb_MatVol_i(Fl_Button* o, void* v);
  87. static void cb_MatVol(Fl_Button* o, void* v);
  88. inline void cb_Pattern_i(Fl_Counter* o, void* v);
  89. static void cb_Pattern(Fl_Counter* o, void* v);
  90. inline void cb_PlayPattern_i(Fl_Counter* o, void* v);
  91. static void cb_PlayPattern(Fl_Counter* o, void* v);
  92. inline void cb_Length_i(Fl_Counter* o, void* v);
  93. static void cb_Length(Fl_Counter* o, void* v);
  94. inline void cb_Speed_i(Fl_Knob* o, void* v);
  95. static void cb_Speed(Fl_Knob* o, void* v);
  96. inline void cb_NoteCut_i(Fl_Button* o, void* v);
  97. static void cb_NoteCut(Fl_Button* o, void* v);
  98. inline void cb_Octave_i(Fl_Counter* o, void* v);
  99. static void cb_Octave(Fl_Counter* o, void* v);
  100. inline void cb_SpeedVal_i (Fl_Counter* o, void* v);
  101. static void cb_SpeedVal (Fl_Counter* o, void* v);
  102. inline void cb_CopyBtn_i (Fl_Button* o, void* v);
  103. static void cb_CopyBtn (Fl_Button* o, void* v);
  104. inline void cb_PasteBtn_i (Fl_Button* o, void* v);
  105. static void cb_PasteBtn (Fl_Button* o, void* v);
  106. inline void cb_ClearBtn_i (Fl_Button* o, void* v);
  107. static void cb_ClearBtn (Fl_Button* o, void* v);
  108. inline void cb_TransUpBtn_i (Fl_Button* o, void* v);
  109. static void cb_TransUpBtn (Fl_Button* o, void* v);
  110. inline void cb_TransDnBtn_i (Fl_Button* o, void* v);
  111. static void cb_TransDnBtn (Fl_Button* o, void* v);
  112. };
  113. #endif