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.

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