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.

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