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.

101 lines
3.4KB

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