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.

PresetsUI.fl 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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 <stdio.h>} {public
  8. }
  9. decl {\#include <stdlib.h>} {public
  10. }
  11. decl {\#include "../Params/PresetsArray.h"} {}
  12. decl {\#include "../Params/Presets.h"} {public
  13. }
  14. class PresetsUI_ {} {
  15. Function {refresh()} {open return_type {virtual void}
  16. } {
  17. code {;} {}
  18. }
  19. Function {~PresetsUI_()} {open return_type virtual
  20. } {
  21. code {;} {}
  22. }
  23. }
  24. class PresetsUI {} {
  25. Function {PresetsUI()} {} {
  26. code {p=NULL;
  27. make_window();} {}
  28. }
  29. Function {~PresetsUI()} {} {
  30. code {copywin->hide();delete(copywin);
  31. pastewin->hide();delete(pastewin);} {}
  32. }
  33. Function {make_window()} {} {
  34. Fl_Window copywin {
  35. label {Copy to Clipboard/Preset}
  36. xywh {190 173 265 430} type Double box THIN_UP_BOX color 238 hide modal
  37. } {
  38. Fl_Browser copybrowse {
  39. callback {int val=o->value();
  40. if (val!=0){
  41. presetname->cut(0,presetname->maximum_size());
  42. presetname->insert(o->text(val));
  43. };}
  44. xywh {10 25 245 320} type Select
  45. }
  46. Fl_Button copypbutton {
  47. label {Copy to Preset}
  48. callback {const char *tmp=presetname->value();
  49. if (tmp!=NULL) {
  50. if (strlen(tmp)>0){
  51. p->copy(tmp);
  52. copywin->hide();
  53. };
  54. };}
  55. xywh {145 355 110 20} box THIN_UP_BOX
  56. }
  57. Fl_Button copybutton {
  58. label {Copy to Clipboard}
  59. callback {p->copy(NULL);
  60. copywin->hide();}
  61. xywh {25 385 90 35} box THIN_UP_BOX align 192
  62. }
  63. Fl_Button {} {
  64. label Cancel
  65. callback {copywin->hide();}
  66. xywh {160 385 80 35} box THIN_UP_BOX align 192
  67. }
  68. Fl_Box {} {
  69. label {Type:}
  70. xywh {10 5 40 15} labelsize 11 align 20
  71. }
  72. Fl_Box copytypetext {
  73. xywh {50 5 205 15} box FLAT_BOX color 238 labelfont 1 labelsize 11 align 20
  74. }
  75. Fl_Input presetname {
  76. callback {const char *tmp=o->value();
  77. if (tmp==NULL) tmp="";
  78. if (strlen(tmp)>0) {
  79. copybutton->deactivate();
  80. copypbutton->activate();
  81. } else {
  82. copybutton->activate();
  83. copypbutton->deactivate();
  84. };}
  85. xywh {10 355 130 20} when 1
  86. }
  87. }
  88. Fl_Window pastewin {
  89. label {Paste from Clipboard/Preset}
  90. xywh {463 173 265 430} type Double box THIN_UP_BOX color 238 hide modal
  91. } {
  92. Fl_Browser pastebrowse {
  93. callback {if (o->value()==0) {
  94. pastepbutton->deactivate();
  95. deletepbutton->deactivate();
  96. }else{
  97. pastepbutton->activate();
  98. deletepbutton->activate();
  99. };}
  100. xywh {10 25 245 320} type Hold
  101. }
  102. Fl_Button pastepbutton {
  103. label {Paste from Preset}
  104. callback {int n=pastebrowse->value();
  105. if (n!=0) p->paste(n);
  106. pastewin->hide();
  107. pui->refresh();}
  108. xywh {10 355 160 20} box THIN_UP_BOX
  109. }
  110. Fl_Button pastebutton {
  111. label {Paste from Clipboard}
  112. callback {p->paste(0);
  113. pastewin->hide();
  114. pui->refresh();}
  115. xywh {25 385 90 35} box THIN_UP_BOX align 192
  116. }
  117. Fl_Button {} {
  118. label Cancel
  119. callback {pastewin->hide();}
  120. xywh {160 385 80 35} box THIN_UP_BOX align 192
  121. }
  122. Fl_Box pastetypetext {
  123. xywh {55 5 200 15} box FLAT_BOX color 238 labelfont 1 labelsize 11 align 20
  124. }
  125. Fl_Box {} {
  126. label {Type:}
  127. xywh {15 5 40 15} labelsize 11 align 20
  128. }
  129. Fl_Button deletepbutton {
  130. label Delete
  131. callback {int n=pastebrowse->value();
  132. if (this->p_is_PresetArray) {
  133. PresetsArray *pre = dynamic_cast<PresetsArray *>(p);
  134. if (n!=0) pre->deletepreset(n);
  135. rescanArray();
  136. } else {
  137. if (n!=0) p->deletepreset(n);
  138. rescan();
  139. }} selected
  140. xywh {180 355 75 20} box THIN_UP_BOX
  141. }
  142. }
  143. }
  144. Function {copy(Presets *p)} {} {
  145. code {copybutton->activate();
  146. copypbutton->deactivate();
  147. this->p=p;
  148. this->pui=NULL;
  149. bool but=(Fl::event_button()!=FL_LEFT_MOUSE);
  150. presetname->cut(0,presetname->maximum_size());
  151. if (but) p->copy(NULL);
  152. else {
  153. rescan();
  154. copytypetext->label(&p->type[1]);
  155. copywin->show();
  156. };} {}
  157. }
  158. Function {paste(Presets *p,PresetsUI_ *pui)} {} {
  159. code {this->p=p;
  160. this->pui=pui;
  161. bool but=(Fl::event_button()!=FL_LEFT_MOUSE);
  162. pastepbutton->deactivate();
  163. deletepbutton->deactivate();
  164. if (but) {
  165. p->paste(0);
  166. pui->refresh();
  167. } else {
  168. rescan();
  169. pastetypetext->label(&p->type[1]);
  170. if (p->checkclipboardtype()) pastebutton->activate();
  171. else pastebutton->deactivate();
  172. this->p_is_PresetArray = false;
  173. pastewin->show();
  174. };} {}
  175. }
  176. Function {copy(Presets *p,int n)} {} {
  177. code {PresetsArray *pre = dynamic_cast<PresetsArray *>(p);
  178. if(pre)
  179. pre->setelement(n);
  180. copyArray(p);} {}
  181. }
  182. Function {paste(Presets *p,PresetsUI_ *pui,int n)} {} {
  183. code {PresetsArray *pre = dynamic_cast<PresetsArray *>(p);
  184. if(pre)
  185. pre->setelement(n);
  186. pasteArray(p,pui);} {}
  187. }
  188. Function {rescan()} {} {
  189. code {copybrowse->clear();
  190. pastebrowse->clear();
  191. p->rescanforpresets();
  192. for (unsigned int i=0;i<presetsstore.presets.size();i++){
  193. std::string name=presetsstore.presets[i].name;
  194. if(name.empty())
  195. continue;
  196. copybrowse->add(name.c_str());
  197. pastebrowse->add(name.c_str());
  198. };} {}
  199. }
  200. decl {Presets *p;} {public local
  201. }
  202. decl {PresetsUI_ *pui;} {public local
  203. }
  204. Function {copyArray(Presets *p)} {open
  205. } {
  206. code {PresetsArray *pre = dynamic_cast<PresetsArray *>(p);
  207. copybutton->activate();
  208. copypbutton->deactivate();
  209. this->p=p;
  210. this->pui=NULL;
  211. bool but=(Fl::event_button()!=FL_LEFT_MOUSE);
  212. presetname->cut(0,presetname->maximum_size());
  213. if (but) pre->copy(NULL);
  214. else {
  215. rescanArray();
  216. copytypetext->label(&pre->type[1]);
  217. copywin->show();
  218. };} {}
  219. }
  220. Function {pasteArray(Presets *p,PresetsUI_ *pui)} {open
  221. } {
  222. code {PresetsArray *pre = dynamic_cast<PresetsArray *>(p);
  223. this->p=p;
  224. this->pui=pui;
  225. bool but=(Fl::event_button()!=FL_LEFT_MOUSE);
  226. pastepbutton->deactivate();
  227. deletepbutton->deactivate();
  228. if (but) {
  229. pre->paste(0);
  230. pui->refresh();
  231. } else {
  232. rescanArray();
  233. pastetypetext->label(&pre->type[1]);
  234. if (pre->checkclipboardtype()) pastebutton->activate();
  235. else pastebutton->deactivate();
  236. this->p_is_PresetArray = true;
  237. pastewin->show();
  238. };} {}
  239. }
  240. Function {rescanArray()} {open
  241. } {
  242. code {PresetsArray *pre = dynamic_cast<PresetsArray *>(p);
  243. copybrowse->clear();
  244. pastebrowse->clear();
  245. pre->rescanforpresets();
  246. for (unsigned int i=0;i<presetsstore.presets.size();i++){
  247. std::string name=presetsstore.presets[i].name;
  248. if(name.empty())
  249. continue;
  250. copybrowse->add(name.c_str());
  251. pastebrowse->add(name.c_str());
  252. };} {}
  253. }
  254. decl {bool p_is_PresetArray;} {public
  255. }
  256. }
  257. decl {PresetsUI *presetsui;} {public
  258. }