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.2KB

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