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.

170 lines
4.7KB

  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 <stdio.h>
  19. #include "SeqPluginGUI.h"
  20. #include <FL/fl_draw.H>
  21. #include <FL/fl_draw.H>
  22. #include <FL/fl_file_chooser.H>
  23. using namespace std;
  24. ////////////////////////////////////////////
  25. SeqPluginGUI::SeqPluginGUI(int w, int h,SeqPlugin *o,const HostInfo *Info) :
  26. SpiralPluginGUI(w,h,o)
  27. {
  28. m_Plugin=o;
  29. //size_range(10,10);
  30. m_Scroll = new Fl_Scroll(50, 20, w-57, h-26, "");
  31. add(m_Scroll);
  32. for (int n=0; n<NUM_PATTERNS; n++)
  33. {
  34. m_Plugin->SetEventMap(n,new Fl_EventMap(0, 0, 1000, 1000, ""));
  35. m_Plugin->GetEventMap(n)->SetType(Fl_EventMap::MELODY_MAP);
  36. m_Scroll->add(m_Plugin->GetEventMap(n));
  37. m_Plugin->GetEventMap(n)->CreateWindow();
  38. m_Plugin->GetEventMap(n)->SetUpdateLineClip(0, 18, w, h-38);
  39. m_Plugin->GetEventMap(n)->hide();
  40. }
  41. m_Plugin->GetEventMap(0)->show();
  42. m_Pattern = new Fl_Counter(5, 20, 40, 20, "Pattern");
  43. m_Pattern->labelsize(10);
  44. m_Pattern->type(FL_SIMPLE_COUNTER);
  45. m_Pattern->step(1);
  46. m_Pattern->value(0);
  47. m_Pattern->callback((Fl_Callback*)cb_Pattern);
  48. add(m_Pattern);
  49. m_Length = new Fl_Knob(5, 60, 40, 40, "Length");
  50. m_Length->color(Info->GUI_COLOUR);
  51. m_Length->type(Fl_Knob::DOTLIN);
  52. m_Length->labelsize(10);
  53. m_Length->maximum(30);
  54. m_Length->step(0.01);
  55. m_Length->value(1.0);
  56. m_Length->callback((Fl_Callback*)cb_Length);
  57. add(m_Length);
  58. m_Speed = new Fl_Knob(5, 115, 40, 40, "Speed");
  59. m_Speed->color(Info->GUI_COLOUR);
  60. m_Speed->type(Fl_Knob::DOTLIN);
  61. m_Speed->labelsize(10);
  62. m_Speed->maximum(4);
  63. m_Speed->step(0.01);
  64. m_Speed->value(2.0);
  65. m_Speed->callback((Fl_Callback*)cb_Speed);
  66. add(m_Speed);
  67. m_Zoom = new Fl_Knob(5,170,40,40,"Zoom");
  68. m_Zoom->color(Info->GUI_COLOUR);
  69. m_Zoom->type(Fl_Knob::DOTLIN);
  70. m_Zoom->labelsize(10);
  71. m_Zoom->maximum(2);
  72. m_Zoom->step(0.01);
  73. m_Zoom->value(1.0);
  74. m_Zoom->callback((Fl_Callback*)cb_Zoom);
  75. add(m_Zoom);
  76. m_Update = new Fl_Button(2,225,45,20,"Update");
  77. m_Update->type(1);
  78. m_Update->labelsize(10);
  79. m_Update->value(1);
  80. m_Update->callback((Fl_Callback*)cb_Update,NULL);
  81. add(m_Update);
  82. m_NoteCut = new Fl_Button(2,245,45,20,"NoteCut");
  83. m_NoteCut->type(1);
  84. m_NoteCut->labelsize(10);
  85. m_NoteCut->value(0);
  86. m_NoteCut->callback((Fl_Callback*)cb_NoteCut);
  87. add(m_NoteCut);
  88. m_Clear = new Fl_Button(2,265,45,20,"Clear");
  89. m_Clear->type(0);
  90. m_Clear->labelsize(10);
  91. m_Clear->value(0);
  92. m_Clear->callback((Fl_Callback*)cb_Clear);
  93. add(m_Clear);
  94. end();
  95. }
  96. void SeqPluginGUI::UpdateValues()
  97. {
  98. }
  99. inline void SeqPluginGUI::cb_Update_i(Fl_Button* o, void* v)
  100. {
  101. m_Plugin->SetUpdate(o->value());
  102. }
  103. void SeqPluginGUI::cb_Update(Fl_Button* o, void* v)
  104. { ((SeqPluginGUI*)(o->parent()))->cb_Update_i(o,v);}
  105. inline void SeqPluginGUI::cb_NoteCut_i(Fl_Button* o, void* v)
  106. {
  107. m_Plugin->SetNoteCut(o->value());
  108. }
  109. void SeqPluginGUI::cb_NoteCut(Fl_Button* o, void* v)
  110. { ((SeqPluginGUI*)(o->parent()))->cb_NoteCut_i(o,v);}
  111. inline void SeqPluginGUI::cb_Zoom_i(Fl_Knob* o, void* v)
  112. {
  113. m_Plugin->SetZoom(o->value());
  114. }
  115. void SeqPluginGUI::cb_Zoom(Fl_Knob* o, void* v)
  116. { ((SeqPluginGUI*)(o->parent()))->cb_Zoom_i(o,v);}
  117. inline void SeqPluginGUI::cb_Pattern_i(Fl_Counter* o, void* v)
  118. {
  119. if (o->value()<0) o->value(0);
  120. if (o->value()>NUM_PATTERNS-1) o->value(NUM_PATTERNS-1);
  121. m_Plugin->SetPattern((int)o->value());
  122. //UpdateValues();
  123. }
  124. void SeqPluginGUI::cb_Pattern(Fl_Counter* o, void* v)
  125. { ((SeqPluginGUI*)(o->parent()))->cb_Pattern_i(o,v);}
  126. inline void SeqPluginGUI::cb_Length_i(Fl_Knob* o, void* v)
  127. {
  128. m_Plugin->SetEndTime(o->value());
  129. }
  130. void SeqPluginGUI::cb_Length(Fl_Knob* o, void* v)
  131. { ((SeqPluginGUI*)(o->parent()))->cb_Length_i(o,v);}
  132. inline void SeqPluginGUI::cb_Speed_i(Fl_Knob* o, void* v)
  133. {
  134. m_Plugin->SetSpeed(o->value()-2.0f);
  135. }
  136. void SeqPluginGUI::cb_Speed(Fl_Knob* o, void* v)
  137. { ((SeqPluginGUI*)(o->parent()))->cb_Speed_i(o,v);}
  138. inline void SeqPluginGUI::cb_Clear_i(Fl_Button* o, void* v)
  139. {
  140. m_Plugin->ClearAll();
  141. }
  142. void SeqPluginGUI::cb_Clear(Fl_Button* o, void* v)
  143. { ((SeqPluginGUI*)(o->parent()))->cb_Clear_i(o,v);}