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
3.3KB

  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 "MixSwitchPluginGUI.h"
  19. #include <FL/fl_draw.h>
  20. #include <FL/fl_draw.H>
  21. ////////////////////////////////////////////
  22. MixSwitchPluginGUI::MixSwitchPluginGUI (int w, int h, MixSwitchPlugin *o, ChannelHandler *ch, const HostInfo *Info) :
  23. SpiralPluginGUI (w, h, o, ch)
  24. {
  25. m_Chans = new Fl_Counter (5, 20, 40, 20, "Channels");
  26. m_Chans->labelsize (10);
  27. m_Chans->type (FL_SIMPLE_COUNTER);
  28. m_Chans->box (FL_PLASTIC_UP_BOX);
  29. m_Chans->color (Info->GUI_COLOUR);
  30. m_Chans->selection_color (Info->GUI_COLOUR);
  31. m_Chans->step (1);
  32. m_Chans->value (2);
  33. m_Chans->callback ((Fl_Callback*) cb_Chans);
  34. add (m_Chans);
  35. m_Switch = new Fl_Counter (49, 20, 40, 20, "Select");
  36. m_Switch->labelsize (10);
  37. m_Switch->type (FL_SIMPLE_COUNTER);
  38. m_Switch->box (FL_PLASTIC_UP_BOX);
  39. m_Switch->color (Info->GUI_COLOUR);
  40. m_Switch->selection_color (Info->GUI_COLOUR);
  41. m_Switch->step (1);
  42. m_Switch->value (1);
  43. m_Switch->callback ((Fl_Callback*) cb_Switch);
  44. add (m_Switch);
  45. }
  46. inline void MixSwitchPluginGUI::cb_Chans_i (Fl_Counter* o, void* v) {
  47. if (o->value() < 2) o->value(2);
  48. else {
  49. m_GUICH->Set ("Chans", int (o->value ()));
  50. m_GUICH->SetCommand (MixSwitchPlugin::SETCHANS);
  51. }
  52. }
  53. void MixSwitchPluginGUI::cb_Chans (Fl_Counter* o, void* v) {
  54. ((MixSwitchPluginGUI*) (o->parent ())) -> cb_Chans_i (o, v);
  55. }
  56. inline void MixSwitchPluginGUI::cb_Switch_i (Fl_Counter* o, void* v) {
  57. if (o->value() < 1 || o->value() > m_Chans->value ())
  58. o->value (1);
  59. m_GUICH->Set ("Switch", int (o->value ()));
  60. }
  61. void MixSwitchPluginGUI::cb_Switch (Fl_Counter* o, void* v) {
  62. ((MixSwitchPluginGUI*) (o->parent ())) -> cb_Switch_i (o, v);
  63. }
  64. void MixSwitchPluginGUI::Update () {
  65. int e = m_GUICH->GetInt ("Echo");
  66. if (m_Switch->value () != e) m_Switch->value (e);
  67. }
  68. void MixSwitchPluginGUI::UpdateValues (SpiralPlugin *o) {
  69. MixSwitchPlugin* Plugin = (MixSwitchPlugin*)o;
  70. m_Chans->value (Plugin->GetChans ());
  71. m_Switch->value (Plugin->GetSwitch ());
  72. }
  73. const string MixSwitchPluginGUI::GetHelpText(const string &loc){
  74. return string("")
  75. + "It's a simple n-input 1-output rotary switch.\n\n"
  76. + "The 'Channels' parameter controls the number of outputs.\n\n"
  77. + "The 'Select' parameter selects which input is echoed at the output.\n\n"
  78. + "The 'CV' input also selects which input is echoed at the output.\n\n"
  79. + "The 'Clock' input is a trigger to select the next input chanel.\n\n"
  80. + "The 'CV' output enables you to gang several switches together, by\n"
  81. + "connecting it to the other switches' 'CV' input.\n";
  82. }