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.

160 lines
4.5KB

  1. /* SpiralSynthModular
  2. * Copyleft (C) 2002 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. #ifndef SPIRALSYNTHMODULAR
  19. #define SPIRALSYNTHMODULAR
  20. #include <FL/Fl.H>
  21. #include <FL/x.H>
  22. #include <FL/Fl_Double_Window.H>
  23. #include <FL/Fl_Group.H>
  24. #include <FL/Fl_Button.H>
  25. #include <FL/Fl_Pixmap.H>
  26. #include <FL/Fl_Scroll.H>
  27. #include <FL/Fl_Pack.H>
  28. #include <FL/Fl_Tile.H>
  29. #include <strstream>
  30. #include <iostream>
  31. #include <map>
  32. #include "SpiralSynthModularInfo.h"
  33. #include "GUI/Widgets/Fl_DeviceGUI.h"
  34. #include "GUI/Widgets/Fl_CommentGUI.h"
  35. #include "GUI/Widgets/Fl_Canvas.h"
  36. #include "SpiralSound/Plugins/SpiralPlugin.h"
  37. #include "SettingsWindow.h"
  38. typedef Fl_Double_Window SpiralWindowType;
  39. // typedef Fl_Window SpiralWindowType;
  40. class SettingsWindow;
  41. class DeviceWin
  42. {
  43. public:
  44. DeviceWin() : m_DeviceGUI(NULL) {}
  45. ~DeviceWin();
  46. int m_PluginID;
  47. SpiralPlugin* m_Device;
  48. Fl_DeviceGUI* m_DeviceGUI;
  49. };
  50. class SynthModular
  51. {
  52. public:
  53. SynthModular();
  54. ~SynthModular();
  55. SpiralWindowType * CreateWindow();
  56. void LoadPlugins();
  57. void Update();
  58. void AddDevice(int n, int x, int y);
  59. void AddComment(int n);
  60. void ClearUp();
  61. void UpdateHostInfo();
  62. bool CallbackMode() { return m_CallbackUpdateMode; }
  63. void UpdatePluginGUIs();
  64. void LoadPatch(const char *fn);
  65. private:
  66. DeviceWin* NewDeviceWin(int n, int x, int y);
  67. DeviceWin* NewComment(int n, int x, int y);
  68. HostInfo m_Info;
  69. static DeviceGUIInfo BuildDeviceGUIInfo(PluginInfo &PInfo);
  70. // currently static, to allow the callback
  71. // cb_UpdatePluginInfo to access the map.
  72. static map<int,DeviceWin*> m_DeviceWinMap;
  73. int m_NextID;
  74. int m_NextPluginButton;
  75. int m_NextPluginButtonXPos;
  76. int m_NextPluginButtonYPos;
  77. static bool m_CallbackUpdateMode;
  78. string m_FilePath;
  79. // Main GUI stuff
  80. void CreateGUI(int xoff=0, int yoff=0, char *name="");
  81. Fl_Group *m_MainButtons;
  82. Fl_Button *m_Load;
  83. Fl_Button *m_Save;
  84. Fl_Button *m_New;
  85. Fl_Button *m_OpenEditor;
  86. Fl_Button *m_Options;
  87. Fl_Group *m_AppGroup;
  88. Fl_Scroll *m_AppScroll;
  89. Fl_Canvas *m_Canvas;
  90. Fl_Scroll *m_CanvasScroll;
  91. Fl_Scroll *m_ToolBox;
  92. Fl_Pack *m_ToolPack;
  93. Fl_Group *m_Buttons;
  94. Fl_Button *m_NewComment;
  95. SettingsWindow *m_SettingsWindow;
  96. SpiralWindowType* m_TopWindow;
  97. Fl_Tile* m_TopTile;
  98. Fl_Group* m_MainWindow;
  99. Fl_Group* m_EditorWindow;
  100. vector<Fl_Button*> m_DeviceVec;
  101. inline void cb_NewDevice_i(Fl_Button* o, void* v);
  102. static void cb_NewDevice(Fl_Button* o, void* v);
  103. inline void cb_NewDeviceFromMenu_i(Fl_Canvas* o, void* v);
  104. static void cb_NewDeviceFromMenu(Fl_Canvas* o, void* v);
  105. inline void cb_NewComment_i(Fl_Button* o, void* v);
  106. static void cb_NewComment(Fl_Button* o, void* v);
  107. inline void cb_Load_i(Fl_Button* o, void* v);
  108. static void cb_Load(Fl_Button* o, void* v);
  109. inline void cb_Save_i(Fl_Button* o, void* v);
  110. static void cb_Save(Fl_Button* o, void* v);
  111. inline void cb_New_i(Fl_Button* o, void* v);
  112. static void cb_New(Fl_Button* o, void* v);
  113. inline void cb_Connection_i(Fl_Canvas* o, void* v);
  114. static void cb_Connection(Fl_Canvas* o, void* v);
  115. inline void cb_Unconnect_i(Fl_Canvas* o, void* v);
  116. static void cb_Unconnect(Fl_Canvas* o, void* v);
  117. inline void cb_Close_i(Fl_Window* o, void* v);
  118. static void cb_Close(Fl_Window* o, void* v);
  119. inline void cb_OpenEditor_i(Fl_Button* o, void* v);
  120. static void cb_OpenEditor(Fl_Button* o, void* v);
  121. inline void cb_Rload_i(Fl_Button* o, void* v);
  122. static void cb_Rload(Fl_Button* o, void* v);
  123. static void cb_Update(void* o, bool Mode);
  124. static void cb_UpdatePluginInfo(int ID, void *PluginInfo);
  125. friend istream &operator>>(istream &s, SynthModular &o);
  126. friend ostream &operator<<(ostream &s, SynthModular &o);
  127. };
  128. istream &operator>>(istream &s, SynthModular &o);
  129. ostream &operator<<(ostream &s, SynthModular &o);
  130. #endif