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 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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 (n!=0) p->deletepreset(n);
  133. rescan();}
  134. xywh {180 355 75 20} box THIN_UP_BOX
  135. }
  136. }
  137. }
  138. Function {copy(Presets *p)} {} {
  139. code {copybutton->activate();
  140. copypbutton->deactivate();
  141. this->p=p;
  142. this->pui=NULL;
  143. bool but=(Fl::event_button()!=FL_LEFT_MOUSE);
  144. presetname->cut(0,presetname->maximum_size());
  145. if (but) p->copy(NULL);
  146. else {
  147. rescan();
  148. copytypetext->label(&p->type[1]);
  149. copywin->show();
  150. };} {}
  151. }
  152. Function {paste(Presets *p,PresetsUI_ *pui)} {} {
  153. code {this->p=p;
  154. this->pui=pui;
  155. bool but=(Fl::event_button()!=FL_LEFT_MOUSE);
  156. pastepbutton->deactivate();
  157. deletepbutton->deactivate();
  158. if (but) {
  159. p->paste(0);
  160. pui->refresh();
  161. } else {
  162. rescan();
  163. pastetypetext->label(&p->type[1]);
  164. if (p->checkclipboardtype()) pastebutton->activate();
  165. else pastebutton->deactivate();
  166. pastewin->show();
  167. };} {}
  168. }
  169. Function {copy(Presets *p,int n)} {} {
  170. code {PresetsArray *pre = dynamic_cast<PresetsArray *>(p);
  171. if(pre)
  172. pre->setelement(n);
  173. copy(p);} {}
  174. }
  175. Function {paste(Presets *p,PresetsUI_ *pui,int n)} {} {
  176. code {PresetsArray *pre = dynamic_cast<PresetsArray *>(p);
  177. if(pre)
  178. pre->setelement(n);
  179. paste(p,pui);} {}
  180. }
  181. Function {rescan()} {} {
  182. code {copybrowse->clear();
  183. pastebrowse->clear();
  184. p->rescanforpresets();
  185. for (unsigned int i=0;i<presetsstore.presets.size();i++){
  186. std::string name=presetsstore.presets[i].name;
  187. if(name.empty())
  188. continue;
  189. copybrowse->add(name.c_str());
  190. pastebrowse->add(name.c_str());
  191. };} {}
  192. }
  193. decl {Presets *p;} {public
  194. }
  195. decl {PresetsUI_ *pui;} {public
  196. }
  197. }
  198. decl {PresetsUI *presetsui;} {public
  199. }