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.

97 lines
2.6KB

  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, const int Len);
  30. void SetLength(const int Len);
  31. int GetLength() { return m_Length; }
  32. void SetPos(float p) {m_Pos=p;}
  33. void SetUpdate(bool p) {m_Update=p;}
  34. void StopUpdate(bool p) {m_StopUpdate=p;}
  35. void SetWaveSize(float s) {m_WaveSize=s;}
  36. void SetMainWin(Fl_Window *s) {m_MainWin=s;}
  37. void DrawWav();
  38. void DrawWidgets();
  39. void DrawEveryThing();
  40. void DrawPosMarker();
  41. void SetSnap(bool s) {m_Snap=s;}
  42. void SetSnapAngle(int s) { m_SnapDegrees=s; }
  43. void SetBGColour (unsigned c) { m_BGColour=(Fl_Color)c; }
  44. void SetWaveColour (unsigned c) { m_WaveColour=(Fl_Color)c; }
  45. void SetSelColour (unsigned c) { m_SelColour=(Fl_Color)c; }
  46. void SetIndColour (unsigned c) { m_IndColour=(Fl_Color)c; }
  47. void SetMrkColour (unsigned c) { m_MrkColour=(Fl_Color)c; }
  48. typedef void (cb)(Fl_Widget *, int);
  49. void SetMoveCallback(cb *cb_Move);
  50. void SelectAll();
  51. long GetRangeStart() { return m_RangeStart; }
  52. long GetRangeEnd() { return m_RangeEnd; }
  53. private:
  54. float const *m_data;
  55. Fl_Window *m_MainWin;
  56. int m_Length;
  57. int m_InnerRad;
  58. int m_OuterRad;
  59. int m_BorderRad;
  60. int m_IndSX,m_IndSY,m_IndEX,m_IndEY;
  61. int m_MidX,m_MidY;
  62. float m_StartAngle;
  63. float m_EndAngle;
  64. float m_MoveAngle;
  65. long m_RangeStart;
  66. long m_RangeEnd;
  67. float m_Angle;
  68. float m_Pos;
  69. bool m_Update;
  70. bool m_StopUpdate;
  71. float m_WaveSize;
  72. int m_Move;
  73. int m_LastMove;
  74. bool m_Snap;
  75. int m_SnapDegrees;
  76. int m_PosMarkerCount;
  77. cb *cb_Move;
  78. Fl_Color m_BGColour, m_WaveColour, m_SelColour, m_IndColour, m_MrkColour;
  79. };
  80. #endif