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.

116 lines
2.9KB

  1. /* SpiralLoops
  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_Double_Window.H>
  20. #include <iostream>
  21. #ifndef LOOPWIDGET
  22. #define LOOPWIDGET
  23. class Fl_Loop : public Fl_Group
  24. {
  25. public:
  26. Fl_Loop(int x, int y, int w, int h, const char* label=0);
  27. virtual void draw();
  28. virtual int handle(int event);
  29. void SetData(float const *set) {m_data=set;}
  30. void SetLength(const int Len);
  31. void SetPos(float *p) {m_Pos=p;}
  32. void SetUpdate(bool p) {m_Update=p;}
  33. void StopUpdate(bool p) {m_StopUpdate=p;}
  34. void SetWaveSize(float s) {m_WaveSize=s;}
  35. void SetMainWin(Fl_Window *s) {m_MainWin=s;}
  36. void SetIdle();
  37. void UnsetIdle();
  38. void DrawWav();
  39. void DrawWidgets();
  40. void DrawEveryThing();
  41. void DrawPosMarker();
  42. void SetSnap(bool s) {m_Snap=s;}
  43. void SetSnapAngle(int s) {m_SnapDegrees=s;}
  44. typedef void (cb_CopyBuf1)(Fl_Loop *, int, int);
  45. typedef void (cb_CopyBuf2)(Fl_Loop *, int);
  46. void SetupCopyBufFuncs(cb_CopyBuf1 *Cut,
  47. cb_CopyBuf1 *Copy,
  48. cb_CopyBuf2 *Paste,
  49. cb_CopyBuf2 *PasteMix,
  50. cb_CopyBuf1 *cb_ZeroRange,
  51. cb_CopyBuf1 *cb_ReverseRange,
  52. cb_CopyBuf1 *cb_Halve,
  53. cb_CopyBuf1 *cb_Hold,
  54. cb_CopyBuf1 *cb_SelectAll,
  55. cb_CopyBuf1 *cb_NewTrigger,
  56. cb_CopyBuf1 *cb_Move);
  57. int GetX() {return x();}
  58. int GetY() {return y();}
  59. int GetW() {return w();}
  60. int GetH() {return h();}
  61. private:
  62. float const *m_data;
  63. Fl_Window *m_MainWin;
  64. int m_Length;
  65. int m_InnerRad;
  66. int m_OuterRad;
  67. int m_BorderRad;
  68. int m_IndSX,m_IndSY,m_IndEX,m_IndEY;
  69. int m_MidX,m_MidY;
  70. float m_StartAngle;
  71. float m_EndAngle;
  72. float m_MoveAngle;
  73. int m_RangeStart;
  74. int m_RangeEnd;
  75. float m_Angle;
  76. float *m_Pos;
  77. bool m_Update;
  78. bool m_StopUpdate;
  79. float m_WaveSize;
  80. int m_Move;
  81. int m_LastMove;
  82. bool m_Snap;
  83. int m_SnapDegrees;
  84. int m_PosMarkerCount;
  85. static void cb_Idle(void* o);
  86. cb_CopyBuf1 *cb_Cut;
  87. cb_CopyBuf1 *cb_Copy;
  88. cb_CopyBuf2 *cb_Paste;
  89. cb_CopyBuf2 *cb_PasteMix;
  90. cb_CopyBuf1 *cb_ZeroRange;
  91. cb_CopyBuf1 *cb_ReverseRange;
  92. cb_CopyBuf1 *cb_Halve;
  93. cb_CopyBuf1 *cb_Hold;
  94. cb_CopyBuf1 *cb_SelectAll;
  95. cb_CopyBuf1 *cb_NewTrigger;
  96. cb_CopyBuf1 *cb_Move;
  97. };
  98. #endif