Audio plugin host https://kx.studio/carla
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.

294 lines
9.7KB

  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0110
  3. header_name {.h}
  4. code_name {.cc}
  5. decl {\#include <FL/fl_ask.H>} {selected public
  6. }
  7. decl {\#include <cstdio>} {public
  8. }
  9. decl {\#include <cstdlib>} {public
  10. }
  11. decl {\#include <string>} {public
  12. }
  13. decl {\#include "Osc_ListModel.h"} {public
  14. }
  15. decl {\#include "Osc_DataModel.h"} {public
  16. }
  17. class PresetsUI_ {} {
  18. Function {refresh()} {open return_type {virtual void}
  19. } {
  20. code {;} {}
  21. }
  22. Function {~PresetsUI_()} {open return_type virtual
  23. } {
  24. code {;} {}
  25. }
  26. }
  27. class PresetsUI {} {
  28. Function {PresetsUI(Fl_Osc_Interface *osc_):listmodel(osc_), datamodel(osc_)} {} {
  29. code {osc = osc_;
  30. arraymode = false;
  31. make_window();
  32. listmodel.callback = [this](Osc_ListModel::list_t list) {
  33. copybrowse->clear();
  34. pastebrowse->clear();
  35. files.clear();
  36. printf("adding entries<%s>...\\n", datamodel.value.c_str());
  37. if(datamodel.value.empty())
  38. return;
  39. for(unsigned i=0;i<list.size();++i){
  40. std::string type = std::get<2>(list[i]);
  41. std::string comp = datamodel.value.substr(1);
  42. if(arraymode)
  43. comp += "n";
  44. bool same = comp == type;
  45. same |= strstr(type.c_str(), "Plfo") && strstr(comp.c_str(), "Plfo");
  46. if(!same)
  47. continue;
  48. files.push_back(std::get<0>(list[i]));
  49. copybrowse->add(std::get<1>(list[i]).c_str());
  50. pastebrowse->add(std::get<1>(list[i]).c_str());
  51. }};
  52. datamodel.callback = [this](Osc_DataModel::value_t val) {
  53. printf("Value = %s\\n", val.c_str());
  54. copytypetext->label(val.c_str());
  55. pastetypetext->label(val.c_str());
  56. listmodel.update("/presets/scan-for-presets");
  57. };
  58. } {}
  59. }
  60. Function {~PresetsUI()} {} {
  61. code {copywin->hide();delete(copywin);
  62. pastewin->hide();delete(pastewin);} {}
  63. }
  64. Function {make_window()} {} {
  65. Fl_Window copywin {
  66. label {Copy to Clipboard/Preset}
  67. xywh {190 173 265 430} type Double box THIN_UP_BOX color 238 hide modal
  68. } {
  69. Fl_Browser copybrowse {
  70. callback {int val=o->value();
  71. if (val!=0){
  72. presetname->cut(0,presetname->maximum_size());
  73. presetname->insert(o->text(val));
  74. };}
  75. xywh {10 25 245 320} type Select
  76. }
  77. Fl_Button copypbutton {
  78. label {Copy to Preset}
  79. callback {const char *tmp=presetname->value();
  80. if (tmp!=NULL) {
  81. if (strlen(tmp)>0){
  82. if(arraymode)
  83. osc->write("/presets/copy", "ssi", url.c_str(), tmp, arrayidx);
  84. else
  85. osc->write("/presets/copy", "ss", url.c_str(), tmp);
  86. copywin->hide();
  87. };
  88. };}
  89. xywh {145 355 110 20} box THIN_UP_BOX
  90. }
  91. Fl_Button copybutton {
  92. label {Copy to Clipboard}
  93. callback {
  94. if(arraymode)
  95. osc->write("/presets/copy", "si", url.c_str(), arrayidx);
  96. else
  97. osc->write("/presets/copy", "s", url.c_str());
  98. copywin->hide();}
  99. xywh {25 385 90 35} box THIN_UP_BOX align 192
  100. }
  101. Fl_Button {} {
  102. label Cancel
  103. callback {copywin->hide();}
  104. xywh {160 385 80 35} box THIN_UP_BOX align 192
  105. }
  106. Fl_Box {} {
  107. label {Type:}
  108. xywh {10 5 40 15} labelsize 11 align 20
  109. }
  110. Fl_Box copytypetext {
  111. xywh {50 5 205 15} box FLAT_BOX color 238 labelfont 1 labelsize 11 align 20
  112. }
  113. Fl_Input presetname {
  114. callback {const char *tmp=o->value();
  115. if (tmp==NULL) tmp="";
  116. if (strlen(tmp)>0) {
  117. copybutton->deactivate();
  118. copypbutton->activate();
  119. } else {
  120. copybutton->activate();
  121. copypbutton->deactivate();
  122. };}
  123. xywh {10 355 130 20} when 1
  124. }
  125. }
  126. Fl_Window pastewin {
  127. label {Paste from Clipboard/Preset}
  128. xywh {463 173 265 430} type Double box THIN_UP_BOX color 238 hide modal
  129. } {
  130. Fl_Browser pastebrowse {
  131. callback {if (o->value()==0) {
  132. pastepbutton->deactivate();
  133. deletepbutton->deactivate();
  134. }else{
  135. pastepbutton->activate();
  136. deletepbutton->activate();
  137. };}
  138. xywh {10 25 245 320} type Hold
  139. }
  140. Fl_Button pastepbutton {
  141. label {Paste from Preset}
  142. callback {int n=pastebrowse->value()-1;
  143. if (n>=0){
  144. if(arraymode)
  145. osc->write("/presets/paste", "ssi", url.c_str(), files[n].c_str(), arrayidx);
  146. else
  147. osc->write("/presets/paste", "ss", url.c_str(), files[n].c_str());
  148. }
  149. pastewin->hide();
  150. pui->refresh();}
  151. xywh {10 355 160 20} box THIN_UP_BOX
  152. }
  153. Fl_Button pastebutton {
  154. label {Paste from Clipboard}
  155. callback {
  156. if(arraymode)
  157. osc->write("/presets/paste", "si", url.c_str(), arrayidx);
  158. else
  159. osc->write("/presets/paste", "s", url.c_str());
  160. pastewin->hide();
  161. pui->refresh();}
  162. xywh {25 385 90 35} box THIN_UP_BOX align 192
  163. }
  164. Fl_Button {} {
  165. label Cancel
  166. callback {pastewin->hide();}
  167. xywh {160 385 80 35} box THIN_UP_BOX align 192
  168. }
  169. Fl_Box pastetypetext {
  170. xywh {55 5 200 15} box FLAT_BOX color 238 labelfont 1 labelsize 11 align 20
  171. }
  172. Fl_Box {} {
  173. label {Type:}
  174. xywh {15 5 40 15} labelsize 11 align 20
  175. }
  176. Fl_Button deletepbutton {
  177. label Delete
  178. callback {int n=pastebrowse->value()-1;
  179. if (n>=0) {
  180. osc->write("/presets/delete", "s", files[n].c_str());
  181. }
  182. rescan(url);
  183. } selected
  184. xywh {180 355 75 20} box THIN_UP_BOX
  185. }
  186. }
  187. }
  188. Function {paste(std::string url_, PresetsUI_ *pui, int idx)} {} {code {
  189. url = url_;
  190. this->pui=pui;
  191. bool but=(Fl::event_button()!=FL_LEFT_MOUSE);
  192. pastepbutton->deactivate();
  193. deletepbutton->deactivate();
  194. arraymode = true;
  195. arrayidx = idx;
  196. if(but) {
  197. osc->write("/presets/paste", "si", url.c_str(), idx);
  198. pui->refresh();
  199. } else {
  200. rescan(url_);
  201. pastewin->show();
  202. }
  203. } {}}
  204. Function {copy(std::string url_, int idx)} {} {code {
  205. copybutton->activate();
  206. copypbutton->deactivate();
  207. arraymode = true;
  208. arrayidx = idx;
  209. url = url_;
  210. this->pui=NULL;
  211. bool but=(Fl::event_button()!=FL_LEFT_MOUSE);
  212. presetname->cut(0,presetname->maximum_size());
  213. if(but) {
  214. osc->write("/presets/copy", "si", url_.c_str(), idx);
  215. } else {
  216. rescan(url_);
  217. copywin->show();
  218. }
  219. } {}}
  220. Function {copy(std::string url_)} {} {
  221. code {
  222. copybutton->activate();
  223. copypbutton->deactivate();
  224. arraymode = false;
  225. url = url_;
  226. this->pui=NULL;
  227. bool but=(Fl::event_button()!=FL_LEFT_MOUSE);
  228. presetname->cut(0,presetname->maximum_size());
  229. if(but) {
  230. osc->write("/presets/copy", "s", url_.c_str());
  231. } else {
  232. rescan(url_);
  233. copywin->show();
  234. };} {}
  235. }
  236. Function {paste(std::string url_, PresetsUI_ *pui)} {} {
  237. code {
  238. url = url_;
  239. this->pui=pui;
  240. bool but=(Fl::event_button()!=FL_LEFT_MOUSE);
  241. pastepbutton->deactivate();
  242. deletepbutton->deactivate();
  243. arraymode = false;
  244. if(but) {
  245. osc->write("/presets/paste", "s", url.c_str());
  246. pui->refresh();
  247. } else {
  248. rescan(url_);
  249. pastewin->show();
  250. };} {}
  251. }
  252. Function {rescan(std::string url)} {} {
  253. code {copybrowse->clear();
  254. pastebrowse->clear();
  255. printf("Datamodel Update...");
  256. datamodel.update(url+"preset-type");
  257. } {}
  258. }
  259. decl {std::string url;} {public local
  260. }
  261. decl {Fl_Osc_Interface *osc;} {public local
  262. }
  263. decl {Osc_ListModel listmodel;} {public local
  264. }
  265. decl {Osc_DataModel datamodel;} {public local
  266. }
  267. decl {std::vector<std::string> files;} {public local
  268. }
  269. decl {bool arraymode;} {public local
  270. }
  271. decl {int arrayidx;} {public local
  272. }
  273. decl {PresetsUI_ *pui;} {public local
  274. }
  275. }
  276. decl {PresetsUI *presetsui;} {public
  277. }