home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 November / CMCD1104.ISO / Software / Complet / ZynAddFX / Setup_ZynAddSubFX-2.1.1.exe / MasterUI.fl < prev    next >
Encoding:
FLTK User Interface Designer  |  2004-10-02  |  56.2 KB  |  1,745 lines

  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0104 
  3. header_name {.h} 
  4. code_name {.cc}
  5. decl {//Copyright (c) 2002-2004 Nasca Octavian Paul} {} 
  6.  
  7. decl {//License: GNU GPL version 2} {} 
  8.  
  9. decl {\#include <stdlib.h>} {public
  10.  
  11. decl {\#include <stdio.h>} {public
  12.  
  13. decl {\#include <string.h>} {public
  14.  
  15. decl {\#include "WidgetPDial.h"} {public
  16.  
  17. decl {\#include "ADnoteUI.h"} {public
  18.  
  19. decl {\#include "SUBnoteUI.h"} {public
  20.  
  21. decl {\#include "EffUI.h"} {public
  22.  
  23. decl {\#include "VirKeyboard.h"} {public
  24.  
  25. decl {\#include "ConfigUI.h"} {public
  26.  
  27. decl {\#include "BankUI.h"} {public
  28.  
  29. decl {\#include "PartUI.h"} {public
  30.  
  31. decl {\#include "MicrotonalUI.h"} {public
  32.  
  33. decl {\#include "SeqUI.h"} {public
  34.  
  35. decl {\#include "PresetsUI.h"} {public
  36.  
  37. decl {\#include "../Misc/Master.h"} {public
  38.  
  39. decl {\#include "../Misc/Part.h"} {public
  40.  
  41. decl {\#include "../Misc/Util.h"} {public
  42.  
  43. decl {\#include "../globals.h"} {public
  44.  
  45. class VUMeter {: {public Fl_Box}
  46. } {
  47.   Function {VUMeter(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} {
  48.     code {master=NULL;
  49. npart=-1;} {}
  50.   }
  51.   Function {init(Master *master_,int part_)} {} {
  52.     code {//the "part_" parameters sets the part (if it is >=0), else it sets the master
  53. master=master_;
  54. label(NULL);
  55. npart=part_;} {}
  56.   }
  57.   Function {draw_master()} {} {
  58.     code {\#define MIN_DB (-48)
  59. int ox=x(); int oy=y(); int lx=w(); int ly=h();
  60.  
  61. pthread_mutex_lock(&master->mutex);
  62. REALTYPE dbl=rap2dB(master->vuoutpeakl);
  63. REALTYPE dbr=rap2dB(master->vuoutpeakr);
  64. REALTYPE maxdbl=rap2dB(master->vumaxoutpeakl);
  65. REALTYPE maxdbr=rap2dB(master->vumaxoutpeakr);
  66. int clipped=master->vuclipped;
  67. pthread_mutex_unlock(&master->mutex);
  68.  
  69. dbl=(MIN_DB-dbl)/MIN_DB; 
  70. if (dbl<0.0) dbl=0.0;
  71.   else if (dbl>1.0)dbl=1.0;
  72.  
  73. dbr=(MIN_DB-dbr)/MIN_DB; 
  74. if (dbr<0.0) dbr=0.0;
  75.   else if (dbr>1.0) dbr=1.0; 
  76.  
  77. \#define VULENX (lx-35)
  78. \#define VULENY (ly/2-3)
  79.  
  80. dbl*=VULENX;dbr*=VULENX;
  81.  
  82. int idbl=(int) dbl;
  83. int idbr=(int) dbr;
  84.  
  85. //draw the vu-meter lines
  86. fl_rectf(ox,oy,idbr,VULENY,0,200,255);
  87. fl_rectf(ox,oy+ly/2,idbl,VULENY,0,200,255);
  88. fl_rectf(ox+idbr,oy,VULENX-idbr,VULENY,0,0,0);
  89. fl_rectf(ox+idbl,oy+ly/2,VULENX-idbl,VULENY,0,0,0);
  90.  
  91. //draw the scales
  92. REALTYPE  tmp=VULENX*1.0/MIN_DB;
  93. for (int i=1;i<1-MIN_DB;i++){
  94.    int tx=VULENX+(int) (tmp*i);
  95.    fl_rectf(ox+tx,oy,1,VULENY+ly/2,0,160,200);
  96.    if (i%5==0) fl_rectf(ox+tx,oy,1,VULENY+ly/2,0,230,240);
  97.    if (i%10==0) fl_rectf(ox+tx-1,oy,2,VULENY+ly/2,0,225,255);
  98. };
  99.  
  100. //draw the red box if clipping has occured
  101. if (clipped==0) fl_rectf(ox+VULENX+2,oy+1,lx-VULENX-3,ly-4,0,0,10);
  102.            else fl_rectf(ox+VULENX+2,oy+1,lx-VULENX-3,ly-4,250,10,10);
  103.  
  104. //draw the maxdB 
  105. fl_font(FL_HELVETICA|FL_BOLD,10);
  106. fl_color(255,255,255);
  107. char tmpstr[10];
  108. if ((maxdbl>MIN_DB-20)){
  109.   snprintf((char *)&tmpstr,10,"%ddB",(int)maxdbr);
  110.   fl_draw(tmpstr,ox+VULENX+1,oy+1,lx-VULENX-1,VULENY,FL_ALIGN_RIGHT,NULL,0);
  111. };
  112. if ((maxdbr>MIN_DB-20)){
  113.   snprintf((char *)&tmpstr,10,"%ddB",(int)maxdbl);
  114.   fl_draw(tmpstr,ox+VULENX+1,oy+ly/2+1,lx-VULENX-1,VULENY,FL_ALIGN_RIGHT,NULL,0);
  115. };} {}
  116.   }
  117.   Function {draw_part()} {} {
  118.     code {\#define MIN_DB (-48)
  119. int ox=x(); int oy=y(); int lx=w(); int ly=h();
  120.  
  121. if (!active_r()){
  122.   pthread_mutex_lock(&master->mutex);
  123.    int fakedb=master->fakepeakpart[npart];
  124.   pthread_mutex_unlock(&master->mutex);
  125.   fl_rectf(ox,oy,lx,ly,140,140,140);
  126.   if (fakedb>0){
  127.     fakedb=(int)(fakedb/255.0*ly)+4;
  128.     fl_rectf(ox+2,oy+ly-fakedb,lx-4,fakedb,0,0,0);
  129.   };
  130.   
  131.   return;
  132. };
  133.  
  134. //draw the vu lines
  135. pthread_mutex_lock(&master->mutex);
  136.  REALTYPE db=rap2dB(master->vuoutpeakpart[npart]);
  137. pthread_mutex_unlock(&master->mutex);
  138.  
  139. db=(MIN_DB-db)/MIN_DB; 
  140. if (db<0.0) db=0.0;
  141.   else if (db>1.0) db=1.0;
  142.  
  143. db*=ly-2;
  144.  
  145. int idb=(int) db;
  146.  
  147. fl_rectf(ox,oy+ly-idb,lx,idb,0,200,255);
  148. fl_rectf(ox,oy,lx,ly-idb,0,0,0);
  149.  
  150.  
  151. //draw the scales
  152. REALTYPE  tmp=ly*1.0/MIN_DB;
  153.  for (int i=1;i<1-MIN_DB;i++){
  154.     int ty=ly+(int) (tmp*i);
  155.     if (i%5==0) fl_rectf(ox,oy+ly-ty,lx,1,0,160,200);
  156.     if (i%10==0) fl_rectf(ox,oy+ly-ty,lx,1,0,230,240);
  157. };} {}
  158.   }
  159.   Function {draw()} {} {
  160.     code {if (npart>=0) draw_part();
  161.    else draw_master();} {}
  162.   }
  163.   Function {tickdraw(VUMeter *o)} {return_type {static void}
  164.   } {
  165.     code {o->redraw();} {}
  166.   }
  167.   Function {tick(void *v)} {return_type {static void}
  168.   } {
  169.     code {tickdraw((VUMeter *) v);
  170. Fl::add_timeout(1.0/25.0,tick,v);//25 fps} {}
  171.   }
  172.   Function {handle(int event)} {return_type int
  173.   } {
  174.     code {switch(event){
  175.    case FL_SHOW:
  176.              tick(this);
  177.              break;
  178.    case FL_HIDE:
  179.              Fl::remove_timeout(tick,this);
  180.              break;
  181.    case FL_PUSH:
  182.              if (npart>=0) break;
  183.              pthread_mutex_lock(&master->mutex);
  184.              master->vuresetpeaks();
  185.              pthread_mutex_unlock(&master->mutex);
  186.              break;
  187. };
  188. return(1);} {}
  189.   }
  190.   decl {Master *master;} {}
  191.   decl {int npart;} {}
  192.  
  193. class SysEffSend {: {public WidgetPDial}
  194. } {
  195.   Function {SysEffSend(int x,int y, int w, int h, const char *label=0):WidgetPDial(x,y,w,h,label)} {} {
  196.     code {master=NULL;
  197. neff1=0;
  198. neff2=0;} {}
  199.   }
  200.   Function {init(Master *master_,int neff1_,int neff2_)} {} {
  201.     code {neff1=neff1_;
  202. neff2=neff2_;
  203. master=master_;
  204. minimum(0);
  205. maximum(127);
  206. step(1);
  207. labelfont(1);
  208. labelsize(10);
  209. align(FL_ALIGN_TOP);
  210.  
  211. value(master->Psysefxsend[neff1][neff2]);
  212. char tmp[20];snprintf(tmp,20,"%d->%d",neff1+1,neff2+1);this->label(strdup(tmp));} {}
  213.   }
  214.   Function {~SysEffSend()} {} {
  215.     code {hide();} {}
  216.   }
  217.   Function {handle(int event)} {return_type int
  218.   } {
  219.     code {if ((event==FL_PUSH) || (event==FL_DRAG)){
  220.    master->setPsysefxsend(neff1,neff2,(int) value());
  221. };
  222.  
  223. return(WidgetPDial::handle(event));} {}
  224.   }
  225.   decl {Master *master;} {}
  226.   decl {int neff1;} {}
  227.   decl {int neff2;} {}
  228.  
  229. class Panellistitem {: {public Fl_Group}
  230. } {
  231.   Function {make_window()} {private
  232.   } {
  233.     Fl_Window panellistitem {
  234.       private xywh {315 213 70 260} type Double hide
  235.       class Fl_Group
  236.     } {
  237.       Fl_Group panellistitemgroup {
  238.         private xywh {0 20 70 240} box PLASTIC_THIN_UP_BOX
  239.         code0 {if (master->part[npart]->Penabled==0) o->deactivate();}
  240.       } {
  241.         Fl_Group {} {
  242.           xywh {45 65 15 110} box ENGRAVED_FRAME
  243.         } {
  244.           Fl_Box {} {
  245.             label {V U}
  246.             xywh {45 65 15 110} box FLAT_BOX color 0 selection_color 75 labelcolor 55 align 128
  247.             code0 {o->init(master,npart);}
  248.             class VUMeter
  249.           }
  250.         }
  251.         Fl_Button partname {
  252.           label {  }
  253.           callback {if ((int)bankui->cbwig->value()!=(npart+1)){
  254.    bankui->cbwig->value(npart+1);
  255.    bankui->cbwig->do_callback();
  256. };
  257. bankui->show();}
  258.           xywh {5 27 60 30} box THIN_DOWN_BOX down_box FLAT_BOX labelfont 1 labelsize 10 align 208
  259.         }
  260.         Fl_Slider partvolume {
  261.           callback {master->part[npart]->setPvolume((int) o->value());}
  262.           xywh {10 65 30 110} type {Vert Knob} box FLAT_BOX minimum 127 maximum 0 step 1 value 127
  263.           code0 {o->value(master->part[npart]->Pvolume);}
  264.         }
  265.         Fl_Dial partpanning {
  266.           callback {master->part[npart]->setPpanning((int) o->value());}
  267.           xywh {20 180 30 30} maximum 127 step 1
  268.           code0 {o->value(master->part[npart]->Ppanning);}
  269.           class WidgetPDial
  270.         }
  271.         Fl_Button {} {
  272.           label edit
  273.           callback {if ((int)bankui->cbwig->value()!=(npart+1)){
  274.    bankui->cbwig->value(npart+1);
  275.    bankui->cbwig->do_callback();
  276. };}
  277.           xywh {15 235 40 20} box PLASTIC_UP_BOX labelsize 10
  278.         }
  279.         Fl_Choice partrcv {
  280.           callback {master->part[npart]->Prcvchn=(int) o->value();} open
  281.           tooltip {receive from Midi channel} xywh {10 213 50 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
  282.           code0 {char nrstr[10]; for(int i=0;i<NUM_MIDI_CHANNELS;i++){sprintf(nrstr,"Ch%d",i+1);if (i!=9) o->add(nrstr); else o->add("Dr10");};}
  283.           code1 {o->value(master->part[npart]->Prcvchn);}
  284.         } {}
  285.       }
  286.       Fl_Check_Button partenabled {
  287.         label 01
  288.         callback {pthread_mutex_lock(&master->mutex);
  289.  master->partonoff(npart,(int) o->value());
  290. pthread_mutex_unlock(&master->mutex);
  291.  
  292. if ((int) o->value()==0) panellistitemgroup->deactivate();
  293.   else {
  294.     panellistitemgroup->activate();
  295.     if ((int)bankui->cbwig->value()!=(npart+1)){
  296.        bankui->cbwig->value(npart+1);
  297.        bankui->cbwig->do_callback();
  298.     };
  299. };
  300.  
  301. o->redraw();}
  302.         private xywh {5 0 45 20} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 24
  303.         code0 {char tmp[10];snprintf(tmp,10,"%d",npart+1);o->label(strdup(tmp));}
  304.         code1 {o->value(master->part[npart]->Penabled);}
  305.       }
  306.     }
  307.   }
  308.   Function {Panellistitem(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
  309.     code {npart=0;
  310. master=NULL;
  311. bankui=NULL;} {}
  312.   }
  313.   Function {init(Master *master_, int npart_,BankUI *bankui_)} {} {
  314.     code {npart=npart_;
  315. master=master_;
  316. bankui=bankui_;
  317.  
  318. make_window();
  319. panellistitem->show();
  320. end();} {}
  321.   }
  322.   Function {refresh()} {open
  323.   } {
  324.     code {partenabled->value(master->part[npart]->Penabled);
  325. if (master->part[npart]->Penabled!=0) panellistitemgroup->activate();
  326.      else panellistitemgroup->deactivate();
  327.  
  328. partvolume->value(master->part[npart]->Pvolume);
  329. partpanning->value(master->part[npart]->Ppanning);
  330. partrcv->value(master->part[npart]->Prcvchn);
  331.  
  332. partname->label((char *)master->part[npart]->Pname);
  333.  
  334. if ((int)bankui->cbwig->value()!=(npart+1))
  335.    panellistitemgroup->color(fl_rgb_color(160,160,160));
  336. else 
  337.    panellistitemgroup->color(fl_rgb_color(50,190,240));
  338.  
  339. panellistitemgroup->redraw();} {}
  340.   }
  341.   Function {~Panellistitem()} {} {
  342.     code {panellistitem->hide();
  343. //delete(panellistitem);} {}
  344.   }
  345.   decl {int npart;} {}
  346.   decl {Master *master;} {}
  347.   decl {BankUI *bankui;} {}
  348.  
  349. class MasterUI {} {
  350.   Function {make_window()} {} {
  351.     Fl_Window masterwindow {
  352.       label zynaddsubfx
  353.       callback {\#ifdef VSTAUDIOOUT
  354. //fl_alert("ZynAddSubFX could not be closed this way, because it's a VST plugin. Please use the host aplication to close it.");
  355.     masterwindow->iconize();
  356. \#else
  357. if (fl_ask("Exit and leave the unsaved data?")) *exitprogram=1;
  358. \#endif}
  359.       xywh {353 127 390 465} type Double hide
  360.     } {
  361.       Fl_Menu_Bar mastermenu {
  362.         xywh {-5 0 690 25}
  363.       } {
  364.         submenu {} {
  365.           label {&File}
  366.           xywh {0 0 100 20}
  367.         } {
  368.           menuitem {} {
  369.             label {&New (erase all)...}
  370.             callback {do_new_master();}
  371.             xywh {20 20 100 20}
  372.           }
  373.           menuitem {} {
  374.             label {&Open Parameters...}
  375.             callback {do_load_master();}
  376.             xywh {20 20 100 20}
  377.           }
  378.           menuitem {} {
  379.             label {&Save All Parameters...}
  380.             callback {do_save_master();}
  381.             xywh {10 10 100 20} divider
  382.           }
  383.           menuitem {} {
  384.             label {&Load Scale Settings...}
  385.             callback {char *filename;
  386. filename=fl_file_chooser("Open:","({*.xsz})",NULL,0);
  387. if (filename==NULL) return;
  388.  
  389. pthread_mutex_lock(&master->mutex);
  390.   //clear all parameters
  391.   master->microtonal.defaults();
  392.  
  393.   //load the data
  394.   int result=master->microtonal.loadXML(filename);
  395. pthread_mutex_unlock(&master->mutex);
  396.  
  397.  
  398.  delete microtonalui;  
  399.  microtonalui=new MicrotonalUI(&master->microtonal);
  400.  
  401. if (result==-10) fl_alert("Error: Could not load the file\\nbecause it is not a scale file.");
  402.       else if (result<0) fl_alert("Error: Could not load the file.");}
  403.             xywh {35 35 100 20}
  404.           }
  405.           menuitem {} {
  406.             label {Save Sc&ale Settings ..}
  407.             callback {char *filename;
  408. int result=0;
  409.  
  410. filename=fl_file_chooser("Save:","({*.xsz})",NULL,0);
  411. if (filename==NULL) return;
  412. filename=fl_filename_setext(filename,".xsz");
  413.  
  414. result=fileexists(filename);
  415. if (result) {
  416.     result=0;
  417.    if (!fl_ask("The file exists. \\nOverwrite it?")) return;
  418.        
  419. };
  420.  
  421.  
  422. pthread_mutex_lock(&master->mutex);
  423. result=master->microtonal.saveXML(filename);
  424. pthread_mutex_unlock(&master->mutex);
  425.  
  426. if (result<0) fl_alert("Error: Could not save the file.");
  427.  
  428.  
  429. updatepanel();}
  430.             xywh {25 25 100 20}
  431.           }
  432.           menuitem {} {
  433.             label {Show Scale Settings...}
  434.             callback {microtonalui->show();}
  435.             xywh {0 0 100 20} divider
  436.           }
  437.           menuitem {} {
  438.             label {&Settings...}
  439.             callback {configui->show();}
  440.             xywh {25 25 100 20} divider
  441.           }
  442.           menuitem {} {
  443.             label {&Copyright...}
  444.             callback {aboutwindow->show();}
  445.             xywh {15 15 100 20} divider
  446.           }
  447.           menuitem {} {
  448.             label {E&xit}
  449.             callback {masterwindow->do_callback();}
  450.             xywh {10 10 100 20}
  451.           }
  452.         }
  453.         submenu {} {
  454.           label {&Instrument}
  455.           xywh {10 10 100 20}
  456.         } {
  457.           menuitem {} {
  458.             label {&Clear Instrument...}
  459.             callback {if (fl_ask("Clear instrument's parameters ?")){
  460. //       int npart=(int)npartcounter->value()-1;
  461.        pthread_mutex_lock(&master->mutex);
  462.        master->part[npart]->defaultsinstrument();
  463.        pthread_mutex_unlock(&master->mutex);
  464.  
  465.        npartcounter->do_callback();
  466. };
  467.  
  468. updatepanel();}
  469.             xywh {35 35 100 20}
  470.           }
  471.           menuitem {} {
  472.             label {&Open Instrument...}
  473.             callback {const char *filename;
  474. filename=fl_file_chooser("Load:","({*.xiz})",NULL,0);
  475. if (filename==NULL) return;
  476.  
  477.  
  478. pthread_mutex_lock(&master->mutex);
  479. //  int npart=(int)npartcounter->value()-1;
  480.  
  481.   //clear all instrument parameters, first
  482.   master->part[npart]->defaultsinstrument();
  483.  
  484.   //load the instr. parameters
  485.   int result=master->part[npart]->loadXMLinstrument(filename);
  486.  
  487. pthread_mutex_unlock(&master->mutex);
  488. master->part[npart]->applyparameters();
  489.  
  490. npartcounter->do_callback();
  491. updatepanel();
  492.  
  493. if (result==-10) fl_alert("Error: Could not load the file\\nbecause it is not an instrument file.");
  494.       else if (result<0) fl_alert("Error: Could not load the file.");}
  495.             xywh {30 30 100 20}
  496.           }
  497.           menuitem {} {
  498.             label {&Save Instrument ...}
  499.             callback {char *filename;
  500.  
  501. filename=fl_file_chooser("Save:","({*.xiz})",NULL,0);
  502. if (filename==NULL) return;
  503. filename=fl_filename_setext(filename,".xiz");
  504.  
  505. int result=fileexists(filename);
  506. if (result) {
  507.     result=0;
  508.    if (!fl_ask("The file exists. \\nOverwrite it?")) return;
  509.        
  510. };
  511.  
  512.  
  513. pthread_mutex_lock(&master->mutex);
  514. result=master->part[npart]->saveXML(filename);
  515. pthread_mutex_unlock(&master->mutex);
  516.  
  517. if (result<0) fl_alert("Error: Could not save the file.");
  518.  
  519. updatepanel();}
  520.             xywh {20 20 100 20} divider
  521.           }
  522.           menuitem {} {
  523.             label {Show Instrument &Bank...}
  524.             callback {bankui->show();}
  525.             xywh {0 0 100 20} divider
  526.           }
  527.           menuitem {} {
  528.             label {&Virtual Keyboard...}
  529.             callback {virkeyboard->show();}
  530.             xywh {10 10 100 20}
  531.           }
  532.         }
  533.         submenu recordmenu {
  534.           label {&Record}
  535.           xywh {0 0 100 20}
  536.         } {
  537.           menuitem {} {
  538.             label {&Choose WAV file...}
  539.             callback {char *filename;
  540. recordbutton->deactivate();
  541. pausebutton->deactivate();
  542. pauselabel->deactivate();
  543. stopbutton->deactivate();
  544. filename=fl_file_chooser("Record to audio file:","(*.wav)",NULL,0);
  545. if (filename==NULL) return;
  546. fl_filename_setext(filename,".wav");
  547.  
  548. int result=master->HDDRecorder.preparefile(filename,0);
  549. if (result==1) {
  550.     result=0;
  551.    if (fl_ask("The file exists. \\nOverwrite it?"))
  552.        master->HDDRecorder.preparefile(filename,1);
  553. };
  554. if (result==0) recordbutton->activate();
  555.  
  556. if (result!=0) fl_alert("Error: Could not save the file.");}
  557.             xywh {0 0 100 20}
  558.           }
  559.         }
  560.         submenu {} {
  561.           label {&Sequencer}
  562.           xywh {0 0 100 20} hide
  563.         } {
  564.           menuitem {} {
  565.             label {Show &Sequencer...}
  566.             callback {sequi->show();}
  567.             xywh {0 0 100 20}
  568.           }
  569.         }
  570.         submenu {} {
  571.           label Misc
  572.           xywh {10 10 100 20}
  573.         } {
  574.           menuitem {} {
  575.             label {Switch User Interface Mode}
  576.             callback {if (fl_ask("Switch the User Interface to Beginner mode ?")){
  577.     masterwindow->hide();
  578.     refresh_master_ui();
  579.     simplemasterwindow->show();
  580.     config.cfg.UserInterfaceMode=2;
  581. };}
  582.             xywh {10 10 100 20}
  583.           }
  584.         }
  585.       }
  586.       Fl_Dial mastervolumedial {
  587.         label {M.Vol}
  588.         callback {master->setPvolume((int) o->value());}
  589.         tooltip {Master Volume} xywh {5 30 30 30} box ROUND_UP_BOX labelfont 1 labelsize 12 align 130 maximum 127 step 1
  590.         code0 {o->value(master->Pvolume);}
  591.         class WidgetPDial
  592.       }
  593.       Fl_Counter masterkeyshiftcounter {
  594.         label {Master KeyShift}
  595.         callback {master->setPkeyshift((int) o->value()+64);}
  596.         xywh {45 31 90 20} labelsize 12 minimum -64 maximum 64 step 1
  597.         code0 {o->lstep(12);}
  598.         code1 {o->value(master->Pkeyshift-64);}
  599.       }
  600.       Fl_Button {} {
  601.         label {Panic!}
  602.         callback {virkeyboard->relaseallkeys();
  603. pthread_mutex_lock(&master->mutex);
  604. master->shutup=1;
  605. pthread_mutex_unlock(&master->mutex);}
  606.         xywh {293 29 92 31} box PLASTIC_UP_BOX color 231 labelfont 1
  607.       }
  608.       Fl_Group partuigroup {
  609.         xywh {0 242 390 183} box ENGRAVED_FRAME
  610.       } {
  611.         Fl_Group partui {
  612.           xywh {4 245 383 175} box FLAT_BOX
  613.           code0 {o->init(master->part[0],master,0,bankui);}
  614.           code1 {o->show();}
  615.           class PartUI
  616.         } {}
  617.       }
  618.       Fl_Tabs {} {
  619.         xywh {0 80 390 160}
  620.       } {
  621.         Fl_Group {} {
  622.           label {System Effects} open
  623.           xywh {0 100 390 140} box ENGRAVED_FRAME labeltype EMBOSSED_LABEL labelsize 18 align 25
  624.         } {
  625.           Fl_Counter syseffnocounter {
  626.             label {Sys.Effect No.}
  627.             callback {nsyseff=(int) o->value()-1;
  628. sysefftype->value(master->sysefx[nsyseff]->geteffect());
  629. syseffectui->refresh(master->sysefx[nsyseff]);}
  630.             xywh {5 120 80 20} type Simple labelfont 1 labelsize 11 align 1 minimum 0 maximum 127 step 1 value 1 textfont 1
  631.             code0 {o->bounds(1,NUM_SYS_EFX);}
  632.             code1 {o->value(nsyseff+1);}
  633.           }
  634.           Fl_Choice sysefftype {
  635.             label EffType
  636.             callback {pthread_mutex_lock(&master->mutex);
  637. master->sysefx[nsyseff]->changeeffect((int) o->value());
  638. pthread_mutex_unlock(&master->mutex);
  639. syseffectui->refresh(master->sysefx[nsyseff]);}
  640.             xywh {315 125 70 15} down_box BORDER_BOX labelsize 11
  641.             code0 {o->value(master->sysefx[nsyseff]->geteffect());}
  642.           } {
  643.             menuitem {} {
  644.               label {No Effect}
  645.               xywh {10 10 100 20} labelfont 1 labelsize 11
  646.             }
  647.             menuitem {} {
  648.               label Reverb
  649.               xywh {20 20 100 20} labelfont 1 labelsize 11
  650.             }
  651.             menuitem {} {
  652.               label Echo
  653.               xywh {30 30 100 20} labelfont 1 labelsize 11
  654.             }
  655.             menuitem {} {
  656.               label Chorus
  657.               xywh {40 40 100 20} labelfont 1 labelsize 11
  658.             }
  659.             menuitem {} {
  660.               label Phaser
  661.               xywh {50 50 100 20} labelfont 1 labelsize 11
  662.             }
  663.             menuitem {} {
  664.               label AlienWah
  665.               xywh {60 60 100 20} labelfont 1 labelsize 11
  666.             }
  667.             menuitem {} {
  668.               label Distortion
  669.               xywh {70 70 100 20} labelfont 1 labelsize 11
  670.             }
  671.             menuitem {} {
  672.               label EQ
  673.               xywh {80 80 100 20} labelfont 1 labelsize 11
  674.             }
  675.             menuitem {} {
  676.               label DynFilter
  677.               xywh {90 90 100 20} labelfont 1 labelsize 11
  678.             }
  679.           }
  680.           Fl_Group syseffectuigroup {
  681.             xywh {5 140 380 95} box FLAT_BOX color 48
  682.           } {
  683.             Fl_Group syseffectui {
  684.               xywh {5 140 380 95}
  685.               code0 {o->init(master->sysefx[nsyseff]);}
  686.               class EffUI
  687.             } {}
  688.           }
  689.           Fl_Button {} {
  690.             label {Send to...}
  691.             callback {syseffsendwindow->show();}
  692.             xywh {95 120 75 20} box THIN_UP_BOX labelfont 1 labelsize 12
  693.           }
  694.           Fl_Button {} {
  695.             label C
  696.             callback {presetsui->copy(master->sysefx[nsyseff]);}
  697.             xywh {215 124 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
  698.           }
  699.           Fl_Button {} {
  700.             label P
  701.             callback {pthread_mutex_lock(&master->mutex);
  702. presetsui->paste(master->sysefx[nsyseff],syseffectui);
  703. pthread_mutex_unlock(&master->mutex);}
  704.             xywh {245 124 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
  705.           }
  706.         }
  707.         Fl_Group {} {
  708.           label {Insertion Effects}
  709.           xywh {0 100 390 140} box ENGRAVED_FRAME labeltype EMBOSSED_LABEL labelsize 18 align 25 hide
  710.         } {
  711.           Fl_Counter inseffnocounter {
  712.             label {Ins.Effect No.}
  713.             callback {ninseff=(int) o->value()-1;
  714. insefftype->value(master->insefx[ninseff]->geteffect());
  715. inseffpart->value(master->Pinsparts[ninseff]+2);
  716. inseffectui->refresh(master->insefx[ninseff]);
  717.  
  718. if (master->Pinsparts[ninseff]!=-1) {
  719.         insefftype->activate();
  720.     inseffectui->activate();
  721.         inseffectuigroup->activate();
  722. } else {
  723.     insefftype->deactivate();
  724.      inseffectui->deactivate();
  725.         inseffectuigroup->deactivate();
  726. };}
  727.             xywh {5 120 80 20} type Simple labelfont 1 labelsize 11 align 1 minimum 0 maximum 127 step 1 value 1 textfont 1
  728.             code0 {o->bounds(1,NUM_INS_EFX);}
  729.             code1 {o->value(ninseff+1);}
  730.           }
  731.           Fl_Choice insefftype {
  732.             label EffType
  733.             callback {pthread_mutex_lock(&master->mutex);
  734. master->insefx[ninseff]->changeeffect((int) o->value());
  735. pthread_mutex_unlock(&master->mutex);
  736. inseffectui->refresh(master->insefx[ninseff]);
  737. inseffectui->show();}
  738.             xywh {315 125 70 15} down_box BORDER_BOX labelsize 11
  739.             code0 {o->value(master->insefx[ninseff]->geteffect());}
  740.             code1 {if (master->Pinsparts[ninseff]== -1) o->deactivate();}
  741.           } {
  742.             menuitem {} {
  743.               label {No Effect}
  744.               xywh {25 25 100 20} labelfont 1 labelsize 11
  745.             }
  746.             menuitem {} {
  747.               label Reverb
  748.               xywh {35 35 100 20} labelfont 1 labelsize 11
  749.             }
  750.             menuitem {} {
  751.               label Echo
  752.               xywh {45 45 100 20} labelfont 1 labelsize 11
  753.             }
  754.             menuitem {} {
  755.               label Chorus
  756.               xywh {55 55 100 20} labelfont 1 labelsize 11
  757.             }
  758.             menuitem {} {
  759.               label Phaser
  760.               xywh {60 60 100 20} labelfont 1 labelsize 11
  761.             }
  762.             menuitem {} {
  763.               label AlienWah
  764.               xywh {70 70 100 20} labelfont 1 labelsize 11
  765.             }
  766.             menuitem {} {
  767.               label Distortion
  768.               xywh {80 80 100 20} labelfont 1 labelsize 11
  769.             }
  770.             menuitem {} {
  771.               label EQ
  772.               xywh {90 90 100 20} labelfont 1 labelsize 11
  773.             }
  774.             menuitem {} {
  775.               label DynFilter
  776.               xywh {100 100 100 20} labelfont 1 labelsize 11
  777.             }
  778.           }
  779.           Fl_Group inseffectuigroup {
  780.             xywh {5 140 380 95} box FLAT_BOX color 48
  781.           } {
  782.             Fl_Group inseffectui {
  783.               xywh {5 140 380 95}
  784.               code0 {o->init(master->insefx[ninseff]);}
  785.               code1 {if (master->Pinsparts[ninseff]== -1) o->deactivate();}
  786.               class EffUI
  787.             } {}
  788.           }
  789.           Fl_Choice inseffpart {
  790.             label {Insert To.}
  791.             callback {master->Pinsparts[ninseff]=(int) o->value()-2;
  792. if ((int) o->value()==1){
  793.     inseffectuigroup->deactivate();
  794.     insefftype->deactivate();
  795.     inseffectui->deactivate();
  796. } else {
  797.     inseffectuigroup->activate();
  798.     insefftype->activate();
  799.     inseffectui->activate();
  800. };
  801. master->insefx[ninseff]->cleanup();} open
  802.             xywh {95 120 80 20} down_box BORDER_BOX labelfont 1 labelsize 10 align 5 textsize 10
  803.             code0 {o->add("Master Out");o->add("Off");}
  804.             code1 {char tmp[50]; for (int i=0;i<NUM_MIDI_PARTS;i++) {sprintf(tmp,"Part %2d",i+1);o->add(tmp);};}
  805.             code3 {o->value(master->Pinsparts[ninseff]+2);}
  806.           } {}
  807.           Fl_Button {} {
  808.             label C
  809.             callback {presetsui->copy(master->insefx[ninseff]);}
  810.             xywh {215 124 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
  811.           }
  812.           Fl_Button {} {
  813.             label P
  814.             callback {pthread_mutex_lock(&master->mutex);
  815. presetsui->paste(master->insefx[ninseff],inseffectui);
  816. pthread_mutex_unlock(&master->mutex);}
  817.             xywh {245 124 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
  818.           }
  819.         }
  820.       }
  821.       Fl_Button {} {
  822.         label Scales
  823.         callback {microtonalui->show();}
  824.         xywh {330 80 56 19} box PLASTIC_UP_BOX color 231 labeltype ENGRAVED_LABEL labelfont 1
  825.       }
  826.       Fl_Group {} {
  827.         xywh {172 30 117 45} box ENGRAVED_BOX
  828.       } {
  829.         Fl_Button recordbutton {
  830.           label {Rec.}
  831.           callback {o->deactivate();
  832. recordmenu->deactivate();
  833. recordmenu->label("&Record(*)");
  834. stopbutton->activate();
  835. pausebutton->activate();
  836. pauselabel->activate();
  837. master->HDDRecorder.start();
  838. master->vuresetpeaks();
  839. mastermenu->redraw();}
  840.           tooltip {Start Recording} xywh {181 36 21 21} box ROUND_UP_BOX color 88 labelfont 1 labelsize 10 align 2 deactivate
  841.         }
  842.         Fl_Button stopbutton {
  843.           label Stop
  844.           callback {o->deactivate();
  845. master->HDDRecorder.stop();
  846. recordbutton->deactivate();
  847. pausebutton->deactivate();
  848. pauselabel->deactivate();
  849. recordmenu->activate();
  850. recordmenu->label("&Record");
  851. mastermenu->redraw();}
  852.           tooltip {Stop Recording and close the audio file} xywh {259 36 21 21} box THIN_UP_BOX color 4 labelfont 1 labelsize 10 align 2 deactivate
  853.         }
  854.         Fl_Button pausebutton {
  855.           label {@||}
  856.           callback {o->deactivate();
  857. master->HDDRecorder.pause();
  858. recordbutton->activate();
  859. mastermenu->redraw();}
  860.           tooltip {Pause Recording} xywh {220 36 21 21} box THIN_UP_BOX color 4 selection_color 4 labelfont 1 labelcolor 3 align 16 deactivate
  861.         }
  862.         Fl_Box pauselabel {
  863.           label Pause
  864.           xywh {214 56 30 15} labelfont 1 labelsize 10 deactivate
  865.         }
  866.       }
  867.       Fl_Group {} {
  868.         xywh {1 427 389 33} box ENGRAVED_FRAME
  869.       } {
  870.         Fl_Box {} {
  871.           label {VU-Meter}
  872.           xywh {4 430 384 30} box FLAT_BOX color 48 selection_color 75
  873.           code0 {o->init(master,-1);}
  874.           class VUMeter
  875.         }
  876.       }
  877.       Fl_Check_Button nrpnbutton {
  878.         label NRPN
  879.         callback {master->ctl.NRPN.receive=(int) o->value();}
  880.         tooltip {Receive NRPNs} xywh {45 65 47 10} down_box DOWN_BOX labelsize 10
  881.         code0 {o->value(master->ctl.NRPN.receive);}
  882.       }
  883.       Fl_Counter npartcounter {
  884.         callback {int nval=(int) o->value()-1;
  885. partuigroup->remove(partui);
  886. delete partui;
  887. partui=new PartUI(0,0,765,525);
  888. partuigroup->add(partui);
  889. partui->init(master->part[nval],master,nval,bankui);
  890. partui->redraw();
  891. o->redraw();
  892. npart=nval;
  893.  
  894. updatepanel();
  895. simplenpartcounter->value(nval+1);
  896. simplenpartcounter->do_callback();} selected
  897.         tooltip {The part number} xywh {5 247 70 23} type Simple labelfont 1 minimum 0 maximum 127 step 1 value 1 textfont 1
  898.         code0 {o->bounds(1,NUM_MIDI_PARTS);}
  899.         code1 {bankui->init(o);}
  900.       }
  901.       Fl_Button {} {
  902.         label vK
  903.         callback {virkeyboard->show();}
  904.         tooltip {Virtual Keyboard} xywh {292 80 35 19} box PLASTIC_UP_BOX color 231 labeltype ENGRAVED_LABEL labelfont 1
  905.       }
  906.       Fl_Button {} {
  907.         label {R.D.}
  908.         callback {globalfinedetuneslider->value(64.0);
  909. globalfinedetuneslider->do_callback();}
  910.         tooltip {Master fine detune reset} xywh {140 65 30 10} box THIN_UP_BOX labelfont 1 labelsize 10
  911.       }
  912.       Fl_Dial globalfinedetuneslider {
  913.         label {F.Det.}
  914.         callback {master->microtonal.Pglobalfinedetune=(int) o->value();}
  915.         tooltip {global fine detune} xywh {143 30 20 20} box ROUND_UP_BOX labelsize 10 align 130 maximum 127 step 1 value 64
  916.         code0 {o->value(master->microtonal.Pglobalfinedetune);}
  917.         class WidgetPDial
  918.       }
  919.       Fl_Button {} {
  920.         label {Panel Window}
  921.         callback {updatepanel();
  922. panelwindow->show();}
  923.         tooltip {Panel Window} xywh {293 62 92 16} box PLASTIC_UP_BOX color 183 labelfont 1 labelsize 10
  924.       }
  925.     }
  926.     Fl_Window aboutwindow {
  927.       label {Copyright...}
  928.       xywh {629 278 330 210} type Double hide
  929.     } {
  930.       Fl_Box {} {
  931.         label {Copyright (c) 2002-2004 Nasca O. Paul}
  932.         xywh {5 35 320 25} labeltype EMBOSSED_LABEL labelsize 18 align 16
  933.       }
  934.       Fl_Box {} {
  935.         label {This is free software; you may redistribute it and/or modify it under the terms of the 
  936. version 2 of the GNU General Public License as published by the Free Software Fundation.
  937.   This program comes with
  938.  ABSOLUTELY NO WARRANTY. 
  939.  See the version 2 of the 
  940. GNU General Public License for details.}
  941.         xywh {0 60 325 115} labelfont 1 labelsize 12 align 144
  942.       }
  943.       Fl_Button {} {
  944.         label {Close this window}
  945.         callback {aboutwindow->hide();}
  946.         xywh {80 180 180 25} box THIN_UP_BOX labelsize 12
  947.       }
  948.       Fl_Box {} {
  949.         label ZynAddSubFX
  950.         xywh {5 5 325 30} labeltype EMBOSSED_LABEL labelfont 1 labelsize 24 labelcolor 0 align 16
  951.       }
  952.     }
  953.     Fl_Window syseffsendwindow {
  954.       label {System Effects Send}
  955.       xywh {171 234 120 250} type Double hide resizable
  956.     } {
  957.       Fl_Scroll {} {open
  958.         xywh {0 45 120 170} box FLAT_BOX resizable
  959.         code0 {for (int neff1=0;neff1<NUM_SYS_EFX;neff1++) for (int neff2=neff1+1;neff2<NUM_SYS_EFX;neff2++)}
  960.         code1 {{syseffsend[neff1][neff2]=new SysEffSend(o->x()+(neff2-1)*35,o->y()+15+neff1*50,30,30);syseffsend[neff1][neff2]->label("aaa");syseffsend[neff1][neff2]->init(master,neff1,neff2);};}
  961.       } {}
  962.       Fl_Button {} {
  963.         label Close
  964.         callback {syseffsendwindow->hide();}
  965.         xywh {25 220 80 25} box THIN_UP_BOX
  966.       }
  967.       Fl_Box {} {
  968.         label {Send system effect's output to other system effects}
  969.         xywh {5 5 110 35} labelsize 10 align 192
  970.       }
  971.     }
  972.     Fl_Window panelwindow {
  973.       label {ZynAddSubFX Panel}
  974.       xywh {72 60 630 635} type Double hide
  975.     } {
  976.       Fl_Scroll {} {open
  977.         xywh {0 5 570 310} type HORIZONTAL box THIN_UP_BOX
  978.       } {
  979.         Fl_Pack {} {open
  980.           xywh {5 10 560 285} type HORIZONTAL
  981.           code0 {for (int i=0;i<NUM_MIDI_PARTS/2;i++){panellistitem[i]=new Panellistitem(0,0,70,260,"");panellistitem[i]->init(master,i,bankui);}}
  982.         } {}
  983.       }
  984.       Fl_Scroll {} {open
  985.         xywh {0 320 570 310} type HORIZONTAL box THIN_UP_BOX
  986.       } {
  987.         Fl_Pack {} {open
  988.           xywh {5 325 560 285} type HORIZONTAL
  989.           code0 {for (int i=NUM_MIDI_PARTS/2;i<NUM_MIDI_PARTS;i++){panellistitem[i]=new Panellistitem(0,0,70,260,"");panellistitem[i]->init(master,i,bankui);}}
  990.         } {}
  991.       }
  992.       Fl_Button {} {
  993.         label Close
  994.         callback {panelwindow->hide();
  995. updatepanel();}
  996.         xywh {575 605 50 25} box THIN_UP_BOX
  997.       }
  998.       Fl_Button {} {
  999.         label Refresh
  1000.         callback {updatepanel();}
  1001.         xywh {575 570 55 25} box THIN_UP_BOX
  1002.       }
  1003.     }
  1004.     Fl_Window simplemasterwindow {
  1005.       label ZynAddSubFX
  1006.       callback {\#ifdef VSTAUDIOOUT
  1007. //fl_alert("ZynAddSubFX could not be closed this way, because it's a VST plugin. Please use the host aplication to close it.");
  1008.     simplemasterwindow->iconize();
  1009. \#else
  1010. if (fl_ask("Exit and leave the unsaved data?")) *exitprogram=1;
  1011. \#endif}
  1012.       xywh {135 383 600 335} type Double hide
  1013.     } {
  1014.       Fl_Menu_Bar {} {
  1015.         xywh {0 0 690 25}
  1016.       } {
  1017.         submenu {} {
  1018.           label {&File}
  1019.           xywh {10 10 100 20}
  1020.         } {
  1021.           menuitem {} {
  1022.             label {&New (erase all)...}
  1023.             callback {do_new_master();}
  1024.             xywh {30 30 100 20}
  1025.           }
  1026.           menuitem {} {
  1027.             label {&Open Parameters...}
  1028.             callback {do_load_master();}
  1029.             xywh {30 30 100 20}
  1030.           }
  1031.           menuitem {} {
  1032.             label {&Save All Parameters...}
  1033.             callback {do_save_master();}
  1034.             xywh {20 20 100 20} divider
  1035.           }
  1036.           menuitem {} {
  1037.             label {&Settings...}
  1038.             callback {configui->show();}
  1039.             xywh {35 35 100 20} divider
  1040.           }
  1041.           menuitem {} {
  1042.             label {&Copyright...}
  1043.             callback {aboutwindow->show();}
  1044.             xywh {25 25 100 20} divider
  1045.           }
  1046.           menuitem {} {
  1047.             label {E&xit}
  1048.             callback {masterwindow->do_callback();}
  1049.             xywh {20 20 100 20}
  1050.           }
  1051.         }
  1052.         submenu {} {
  1053.           label {&Instrument}
  1054.           xywh {20 20 100 20}
  1055.         } {
  1056.           menuitem {} {
  1057.             label {&Open Instrument...}
  1058.             callback {const char *filename;
  1059. filename=fl_file_chooser("Load:","({*.xiz})",NULL,0);
  1060. if (filename==NULL) return;
  1061.  
  1062.  
  1063. pthread_mutex_lock(&master->mutex);
  1064. //  int npart=(int)npartcounter->value()-1;
  1065.  
  1066.   //clear all instrument parameters, first
  1067.   master->part[npart]->defaultsinstrument();
  1068.  
  1069.   //load the instr. parameters
  1070.   int result=master->part[npart]->loadXMLinstrument(filename);
  1071.  
  1072. pthread_mutex_unlock(&master->mutex);
  1073. master->part[npart]->applyparameters();
  1074.  
  1075. simplenpartcounter->do_callback();
  1076.  
  1077. if (result==-10) fl_alert("Error: Could not load the file\\nbecause it is not an instrument file.");
  1078.       else if (result<0) fl_alert("Error: Could not load the file.");}
  1079.             xywh {40 40 100 20}
  1080.           }
  1081.           menuitem {} {
  1082.             label {Show Instrument &Bank...}
  1083.             callback {bankui->show();}
  1084.             xywh {10 10 100 20} divider
  1085.           }
  1086.         }
  1087.         submenu {} {
  1088.           label Misc
  1089.           xywh {0 0 100 20}
  1090.         } {
  1091.           menuitem {} {
  1092.             label {Switch User Interface Mode}
  1093.             callback {if (fl_ask("Switch the User Interface to Advanced mode ?")){
  1094.     simplemasterwindow->hide();
  1095.     refresh_master_ui();
  1096.     masterwindow->show();
  1097.     config.cfg.UserInterfaceMode=1;
  1098. };}
  1099.             xywh {0 0 100 20}
  1100.           }
  1101.         }
  1102.       }
  1103.       Fl_Group simplelistitemgroup {
  1104.         private xywh {125 65 215 150} box ENGRAVED_BOX
  1105.         code0 {if (master->part[npart]->Penabled==0) o->deactivate();}
  1106.       } {
  1107.         Fl_Button partname {
  1108.           callback {if ((int)bankui->cbwig->value()!=(npart+1)){
  1109.    bankui->cbwig->value(npart+1);
  1110.    bankui->cbwig->do_callback();
  1111. };
  1112. bankui->show();}
  1113.           xywh {130 72 205 18} box PLASTIC_THIN_DOWN_BOX down_box FLAT_BOX color 247 labelfont 1 labelsize 12 align 208
  1114.         }
  1115.         Fl_Slider partpanning {
  1116.           label Pan
  1117.           callback {master->part[npart]->setPpanning((int) o->value());}
  1118.           xywh {185 95 70 15} type {Horz Knob} box FLAT_BOX minimum 127 maximum 0 step 1 value 64
  1119.           code0 {o->value(master->part[npart]->Ppanning);}
  1120.         }
  1121.         Fl_Choice partrcv {
  1122.           label {Midi Channel Receive}
  1123.           callback {virkeys->relaseallkeys(0);
  1124. master->part[npart]->Prcvchn=(int) o->value();
  1125. virkeys->midich=(int) o->value();} open
  1126.           tooltip {receive from Midi channel} xywh {140 157 65 18} down_box BORDER_BOX labelsize 11 align 130 textfont 1
  1127.           code0 {char nrstr[10]; for(int i=0;i<NUM_MIDI_CHANNELS;i++){sprintf(nrstr,"Ch%d",i+1);if (i!=9) o->add(nrstr); else o->add("Dr10");};}
  1128.           code1 {o->value(master->part[npart]->Prcvchn);}
  1129.         } {}
  1130.         Fl_Dial partvolume {
  1131.           callback {master->part[npart]->setPvolume((int) o->value());}
  1132.           xywh {145 95 30 30} maximum 127 step 1
  1133.           code0 {o->value(master->part[npart]->Pvolume);}
  1134.           class WidgetPDial
  1135.         }
  1136.         Fl_Box {} {
  1137.           label Volume
  1138.           xywh {130 125 60 15}
  1139.         }
  1140.         Fl_Check_Button simplepartportamento {
  1141.           label Portamento
  1142.           callback {master->part[npart]->ctl.portamento.portamento=(int) o->value();}
  1143.           tooltip {Enable/Disable the portamento} xywh {260 95 75 20} down_box DOWN_BOX labelfont 1 labelsize 10
  1144.           code0 {o->value(master->part[npart]->ctl.portamento.portamento);}
  1145.         }
  1146.         Fl_Counter simpleminkcounter {
  1147.           label {Min.key}
  1148.           callback {master->part[npart]->Pminkey=(int) o->value();
  1149. if (master->part[npart]->Pminkey>master->part[npart]->Pmaxkey) o->textcolor(FL_RED);
  1150.  else o->textcolor(FL_BLACK);}
  1151.           tooltip {Minimum key (that the part receives NoteOn messages)} xywh {210 158 40 15} type Simple labelfont 1 labelsize 10 minimum 0 maximum 127 step 1 textsize 10
  1152.           code0 {o->value(master->part[npart]->Pminkey);}
  1153.         }
  1154.         Fl_Counter simplemaxkcounter {
  1155.           label {Max.key}
  1156.           callback {master->part[npart]->Pmaxkey=(int) o->value();
  1157.  
  1158. if (master->part[npart]->Pminkey>master->part[npart]->Pmaxkey) o->textcolor(FL_RED);
  1159.  else o->textcolor(FL_BLACK);}
  1160.           tooltip {Maximum key (that the part receives NoteOn messages)} xywh {255 158 40 15} type Simple labelfont 1 labelsize 10 minimum 0 maximum 127 step 1 textsize 10
  1161.           code0 {o->value(master->part[npart]->Pmaxkey);}
  1162.         }
  1163.         Fl_Button {} {
  1164.           label m
  1165.           callback {if (master->part[npart]->lastnote>=0) simpleminkcounter->value(master->part[npart]->lastnote);
  1166. simpleminkcounter->do_callback();
  1167. simplemaxkcounter->do_callback();}
  1168.           tooltip {set the minimum key to the last pressed key} xywh {230 188 15 12} box THIN_UP_BOX labelsize 10
  1169.         }
  1170.         Fl_Button {} {
  1171.           label M
  1172.           callback {if (master->part[npart]->lastnote>=0) simplemaxkcounter->value(master->part[npart]->lastnote);
  1173. simplemaxkcounter->do_callback();
  1174. simpleminkcounter->do_callback();}
  1175.           tooltip {set the maximum key to the last pressed key} xywh {260 188 15 12} box THIN_UP_BOX labelsize 10
  1176.         }
  1177.         Fl_Button {} {
  1178.           label R
  1179.           callback {simpleminkcounter->value(0);
  1180. simpleminkcounter->do_callback();
  1181. simplemaxkcounter->value(127);
  1182. simplemaxkcounter->do_callback();}
  1183.           tooltip {reset the minimum key to 0 and maximum key to 127} xywh {245 188 15 12} box THIN_UP_BOX labelfont 1 labelsize 10
  1184.         }
  1185.         Fl_Counter simplepartkeyshiftcounter {
  1186.           label KeyShift
  1187.           callback {master->part[npart]->Pkeyshift=(int) o->value()+64;}
  1188.           xywh {240 120 90 20} labelsize 12 minimum -64 maximum 64 step 1
  1189.           code0 {o->lstep(12);}
  1190.           code1 {o->value(master->part[npart]->Pkeyshift-64);}
  1191.         }
  1192.         Fl_Dial simplesyseffsend {
  1193.           callback {master->setPsysefxvol(npart,nsyseff,(int) o->value());}
  1194.           xywh {300 160 30 30} maximum 127 step 1
  1195.           class WidgetPDial
  1196.         }
  1197.         Fl_Box {} {
  1198.           label Effect
  1199.           xywh {295 190 40 15}
  1200.         }
  1201.       }
  1202.       Fl_Check_Button partenabled {
  1203.         label Enabled
  1204.         callback {pthread_mutex_lock(&master->mutex);
  1205.  master->partonoff(npart,(int) o->value());
  1206. pthread_mutex_unlock(&master->mutex);
  1207.  
  1208. if ((int) o->value()==0) simplelistitemgroup->deactivate();
  1209.   else {
  1210.     simplelistitemgroup->activate();
  1211.     if ((int)bankui->cbwig->value()!=(npart+1)){
  1212.        bankui->cbwig->value(npart+1);
  1213.        bankui->cbwig->do_callback();
  1214.     };
  1215. };
  1216.  
  1217. o->redraw();}
  1218.         private xywh {250 40 85 20} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 24
  1219.         code0 {//char tmp[10];snprintf(tmp,10,"%d",npart+1);o->label(strdup(tmp));}
  1220.         code1 {o->value(master->part[npart]->Penabled);}
  1221.       }
  1222.       Fl_Box virkeys {
  1223.         label Keyboard
  1224.         xywh {5 215 590 80} box BORDER_BOX color 17
  1225.         code0 {o->init(master);}
  1226.         class VirKeys
  1227.       }
  1228.       Fl_Group {} {
  1229.         xywh {340 30 255 185} box ENGRAVED_BOX
  1230.       } {
  1231.         Fl_Tabs {} {
  1232.           xywh {345 35 245 175} align 18
  1233.         } {
  1234.           Fl_Group {} {
  1235.             label {System Effects}
  1236.             xywh {345 55 245 155} box ENGRAVED_FRAME labelfont 1 align 18
  1237.           } {
  1238.             Fl_Counter simplesyseffnocounter {
  1239.               label {Sys.Effect No.}
  1240.               callback {nsyseff=(int) o->value()-1;
  1241. simplesysefftype->value(master->sysefx[nsyseff]->geteffect());
  1242. simplesyseffectui->refresh(master->sysefx[nsyseff]);
  1243. simplerefresh();}
  1244.               xywh {350 75 80 20} type Simple labelfont 1 labelsize 11 align 1 minimum 0 maximum 127 step 1 value 1 textfont 1
  1245.               code0 {o->bounds(1,NUM_SYS_EFX);}
  1246.               code1 {o->value(nsyseff+1);}
  1247.             }
  1248.             Fl_Choice simplesysefftype {
  1249.               label EffType
  1250.               callback {pthread_mutex_lock(&master->mutex);
  1251. master->sysefx[nsyseff]->changeeffect((int) o->value());
  1252. pthread_mutex_unlock(&master->mutex);
  1253. simplesyseffectui->refresh(master->sysefx[nsyseff]);}
  1254.               xywh {515 80 70 15} down_box BORDER_BOX labelsize 11 align 5
  1255.               code0 {o->value(master->sysefx[nsyseff]->geteffect());}
  1256.             } {
  1257.               menuitem {} {
  1258.                 label {No Effect}
  1259.                 xywh {20 20 100 20} labelfont 1 labelsize 11
  1260.               }
  1261.               menuitem {} {
  1262.                 label Reverb
  1263.                 xywh {30 30 100 20} labelfont 1 labelsize 11
  1264.               }
  1265.               menuitem {} {
  1266.                 label Echo
  1267.                 xywh {40 40 100 20} labelfont 1 labelsize 11
  1268.               }
  1269.               menuitem {} {
  1270.                 label Chorus
  1271.                 xywh {50 50 100 20} labelfont 1 labelsize 11
  1272.               }
  1273.               menuitem {} {
  1274.                 label Phaser
  1275.                 xywh {60 60 100 20} labelfont 1 labelsize 11
  1276.               }
  1277.               menuitem {} {
  1278.                 label AlienWah
  1279.                 xywh {70 70 100 20} labelfont 1 labelsize 11
  1280.               }
  1281.               menuitem {} {
  1282.                 label Distortion
  1283.                 xywh {80 80 100 20} labelfont 1 labelsize 11
  1284.               }
  1285.               menuitem {} {
  1286.                 label EQ
  1287.                 xywh {90 90 100 20} labelfont 1 labelsize 11
  1288.               }
  1289.               menuitem {} {
  1290.                 label DynFilter
  1291.                 xywh {100 100 100 20} labelfont 1 labelsize 11
  1292.               }
  1293.             }
  1294.             Fl_Group simplesyseffectuigroup {
  1295.               xywh {350 95 235 95} box FLAT_BOX color 48
  1296.             } {
  1297.               Fl_Group simplesyseffectui {
  1298.                 xywh {350 95 234 95}
  1299.                 code0 {o->init(master->sysefx[nsyseff]);}
  1300.                 class SimpleEffUI
  1301.               } {}
  1302.             }
  1303.             Fl_Button {} {
  1304.               label {Send to...}
  1305.               callback {syseffsendwindow->show();}
  1306.               xywh {435 75 75 20} box THIN_UP_BOX labelfont 1 labelsize 12
  1307.             }
  1308.             Fl_Button {} {
  1309.               label P
  1310.               callback {pthread_mutex_lock(&master->mutex);
  1311. presetsui->paste(master->sysefx[nsyseff],simplesyseffectui);
  1312. pthread_mutex_unlock(&master->mutex);}
  1313.               xywh {560 65 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
  1314.             }
  1315.           }
  1316.           Fl_Group {} {
  1317.             label {Insertion Effects}
  1318.             xywh {345 55 245 155} box ENGRAVED_FRAME labelfont 1 align 18 hide
  1319.           } {
  1320.             Fl_Counter simpleinseffnocounter {
  1321.               label {Ins.Effect No.}
  1322.               callback {ninseff=(int) o->value()-1;
  1323. simpleinsefftype->value(master->insefx[ninseff]->geteffect());
  1324. simpleinseffpart->value(master->Pinsparts[ninseff]+2);
  1325. simpleinseffectui->refresh(master->insefx[ninseff]);
  1326.  
  1327. if (master->Pinsparts[ninseff]!=-1) {
  1328.         simpleinsefftype->activate();
  1329.     simpleinseffectui->activate();
  1330.         simpleinseffectuigroup->activate();
  1331. } else {
  1332.     simpleinsefftype->deactivate();
  1333.      simpleinseffectui->deactivate();
  1334.         simpleinseffectuigroup->deactivate();
  1335. };}
  1336.               xywh {350 75 80 20} type Simple labelfont 1 labelsize 11 align 1 minimum 0 maximum 127 step 1 value 1 textfont 1
  1337.               code0 {o->bounds(1,NUM_INS_EFX);}
  1338.               code1 {o->value(ninseff+1);}
  1339.             }
  1340.             Fl_Choice simpleinsefftype {
  1341.               label EffType
  1342.               callback {pthread_mutex_lock(&master->mutex);
  1343. master->insefx[ninseff]->changeeffect((int) o->value());
  1344. pthread_mutex_unlock(&master->mutex);
  1345. simpleinseffectui->refresh(master->insefx[ninseff]);
  1346. simpleinseffectui->show();}
  1347.               xywh {515 80 70 15} down_box BORDER_BOX labelsize 11 align 5
  1348.               code0 {o->value(master->insefx[ninseff]->geteffect());}
  1349.               code1 {if (master->Pinsparts[ninseff]== -1) o->deactivate();}
  1350.             } {
  1351.               menuitem {} {
  1352.                 label {No Effect}
  1353.                 xywh {35 35 100 20} labelfont 1 labelsize 11
  1354.               }
  1355.               menuitem {} {
  1356.                 label Reverb
  1357.                 xywh {45 45 100 20} labelfont 1 labelsize 11
  1358.               }
  1359.               menuitem {} {
  1360.                 label Echo
  1361.                 xywh {55 55 100 20} labelfont 1 labelsize 11
  1362.               }
  1363.               menuitem {} {
  1364.                 label Chorus
  1365.                 xywh {65 65 100 20} labelfont 1 labelsize 11
  1366.               }
  1367.               menuitem {} {
  1368.                 label Phaser
  1369.                 xywh {70 70 100 20} labelfont 1 labelsize 11
  1370.               }
  1371.               menuitem {} {
  1372.                 label AlienWah
  1373.                 xywh {80 80 100 20} labelfont 1 labelsize 11
  1374.               }
  1375.               menuitem {} {
  1376.                 label Distortion
  1377.                 xywh {90 90 100 20} labelfont 1 labelsize 11
  1378.               }
  1379.               menuitem {} {
  1380.                 label EQ
  1381.                 xywh {100 100 100 20} labelfont 1 labelsize 11
  1382.               }
  1383.               menuitem {} {
  1384.                 label DynFilter
  1385.                 xywh {110 110 100 20} labelfont 1 labelsize 11
  1386.               }
  1387.             }
  1388.             Fl_Group simpleinseffectuigroup {
  1389.               xywh {350 95 234 95} box FLAT_BOX color 48
  1390.             } {
  1391.               Fl_Group simpleinseffectui {
  1392.                 xywh {350 95 234 95}
  1393.                 code0 {o->init(master->insefx[ninseff]);}
  1394.                 code1 {if (master->Pinsparts[ninseff]== -1) o->deactivate();}
  1395.                 class SimpleEffUI
  1396.               } {}
  1397.             }
  1398.             Fl_Choice simpleinseffpart {
  1399.               label {Insert To.}
  1400.               callback {master->Pinsparts[ninseff]=(int) o->value()-2;
  1401. if ((int) o->value()==1){
  1402.     simpleinseffectuigroup->deactivate();
  1403.     simpleinsefftype->deactivate();
  1404.     simpleinseffectui->deactivate();
  1405. } else {
  1406.     simpleinseffectuigroup->activate();
  1407.     simpleinsefftype->activate();
  1408.     simpleinseffectui->activate();
  1409. };
  1410. master->insefx[ninseff]->cleanup();} open
  1411.               xywh {435 75 80 20} down_box BORDER_BOX labelfont 1 labelsize 10 align 5 textsize 10
  1412.               code0 {o->add("Master Out");o->add("Off");}
  1413.               code1 {char tmp[50]; for (int i=0;i<NUM_MIDI_PARTS;i++) {sprintf(tmp,"Part %2d",i+1);o->add(tmp);};}
  1414.               code3 {o->value(master->Pinsparts[ninseff]+2);}
  1415.             } {}
  1416.             Fl_Button {} {
  1417.               label P
  1418.               callback {pthread_mutex_lock(&master->mutex);
  1419. presetsui->paste(master->insefx[ninseff],simpleinseffectui);
  1420. pthread_mutex_unlock(&master->mutex);}
  1421.               xywh {560 65 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
  1422.             }
  1423.           }
  1424.         }
  1425.       }
  1426.       Fl_Group {} {
  1427.         xywh {5 300 590 30} box ENGRAVED_FRAME
  1428.       } {
  1429.         Fl_Box {} {
  1430.           label {VU-Meter}
  1431.           xywh {5 300 590 30} box FLAT_BOX color 41 selection_color 75
  1432.           code0 {o->init(master,-1);}
  1433.           class VUMeter
  1434.         }
  1435.       }
  1436.       Fl_Dial simplemastervolumedial {
  1437.         label {Master Volume}
  1438.         callback {master->setPvolume((int) o->value());}
  1439.         tooltip {Master Volume} xywh {10 35 40 40} box ROUND_UP_BOX labelfont 1 labelsize 12 align 130 maximum 127 step 1
  1440.         code0 {o->value(master->Pvolume);}
  1441.         class WidgetPDial
  1442.       }
  1443.       Fl_Counter simplemasterkeyshiftcounter {
  1444.         label {Master KeyShift}
  1445.         callback {master->setPkeyshift((int) o->value()+64);}
  1446.         xywh {25 110 90 20} labelsize 12 minimum -64 maximum 64 step 1
  1447.         code0 {o->lstep(12);}
  1448.         code1 {o->value(master->Pkeyshift-64);}
  1449.       }
  1450.       Fl_Button {} {
  1451.         label {Stop ALL sounds!}
  1452.         callback {virkeyboard->relaseallkeys();
  1453. pthread_mutex_lock(&master->mutex);
  1454. master->shutup=1;
  1455. pthread_mutex_unlock(&master->mutex);}
  1456.         xywh {5 149 115 31} box PLASTIC_UP_BOX color 231 labelfont 1 labelsize 12
  1457.       }
  1458.       Fl_Button {} {
  1459.         label Reset
  1460.         callback {simpleglobalfinedetuneslider->value(64.0);
  1461. simpleglobalfinedetuneslider->do_callback();}
  1462.         tooltip {Master fine detune reset} xywh {70 32 50 10} box THIN_UP_BOX labelfont 1 labelsize 12 align 128
  1463.       }
  1464.       Fl_Dial simpleglobalfinedetuneslider {
  1465.         label {Fine Detune}
  1466.         callback {master->microtonal.Pglobalfinedetune=(int) o->value();}
  1467.         tooltip {global fine detune} xywh {80 45 30 30} box ROUND_UP_BOX labelsize 12 align 130 maximum 127 step 1 value 64
  1468.         code0 {o->value(master->microtonal.Pglobalfinedetune);}
  1469.         class WidgetPDial
  1470.       }
  1471.       Fl_Counter simplenpartcounter {
  1472.         label Part
  1473.         callback {virkeys->relaseallkeys(0);
  1474. npartcounter->value(o->value());
  1475. npart=(int) o->value()-1;
  1476.  
  1477. simplerefresh();
  1478. virkeys->midich=master->part[npart]->Prcvchn;}
  1479.         tooltip {The part number} xywh {170 40 70 20} type Simple labelfont 1 align 4 minimum 0 maximum 127 step 1 value 1 textfont 1
  1480.         code0 {o->bounds(1,NUM_MIDI_PARTS);}
  1481.       }
  1482.       Fl_Counter {} {
  1483.         label {Keyb.Oct.}
  1484.         callback {virkeys->relaseallkeys(0);
  1485. virkeys->midioct=(int) o->value();
  1486. virkeys->take_focus();}
  1487.         tooltip {Midi Octave} xywh {5 195 55 20} type Simple labelsize 12 align 8 when 6 minimum 0 maximum 5 step 1 textfont 1 textsize 12
  1488.         code0 {o->value(virkeys->midioct);}
  1489.       }
  1490.     }
  1491.     Fl_Window selectuiwindow {
  1492.       label {User Interface mode}
  1493.       callback {*exitprogram=1;}
  1494.       xywh {342 246 430 250} type Double hide non_modal
  1495.     } {
  1496.       Fl_Box {} {
  1497.         label {Welcome to ZynAddSubFX}
  1498.         xywh {5 5 425 40} labeltype SHADOW_LABEL labelfont 1 labelsize 33
  1499.       }
  1500.       Fl_Box {} {
  1501.         label {Please choose the interface mode:}
  1502.         xywh {10 50 265 25} labelfont 1 labelsize 16
  1503.       }
  1504.       Fl_Button {} {
  1505.         label Advanced
  1506.         callback {config.cfg.UserInterfaceMode=1;
  1507. masterwindow->show();
  1508. selectuiwindow->hide();}
  1509.         xywh {10 165 100 35} box PLASTIC_UP_BOX color 229 labelfont 1 labelsize 20
  1510.       }
  1511.       Fl_Box {} {
  1512.         label {.. if you have used ZynAddSubFX before, or you like to have full controll to all parameters.}
  1513.         xywh {110 165 310 35} labelfont 1 labelsize 13 align 144
  1514.       }
  1515.       Fl_Button {} {
  1516.         label Beginner
  1517.         callback {simplemasterwindow->show();
  1518. selectuiwindow->hide();
  1519. config.cfg.UserInterfaceMode=2;}
  1520.         xywh {10 80 100 65} box PLASTIC_UP_BOX color 238 labelfont 1 labelsize 20
  1521.       }
  1522.       Fl_Box {} {
  1523.         label {..if you are a beginner, you prefer using presets or you prefer to use simpler user interfaces. Most functionality of ZynAddSubFX will be hidden in this mode to make simple the learning/using it.}
  1524.         xywh {110 75 320 75} labelfont 1 labelsize 13 align 144
  1525.       }
  1526.       Fl_Box {} {
  1527.         label {You can switch the interface modes anytime you want.}
  1528.         xywh {30 215 360 25} box BORDER_BOX color 51 labelfont 1 labelsize 13 align 144
  1529.       }
  1530.     }
  1531.   }
  1532.   Function {updatesendwindow()} {} {
  1533.     code {for (int neff1=0;neff1<NUM_SYS_EFX;neff1++) 
  1534.   for (int neff2=neff1+1;neff2<NUM_SYS_EFX;neff2++)
  1535.     syseffsend[neff1][neff2]->value(master->Psysefxsend[neff1][neff2]);} {}
  1536.   }
  1537.   Function {updatepanel()} {} {
  1538.     code {for (int npart=0;npart<NUM_MIDI_PARTS;npart++){
  1539.   panellistitem[npart]->refresh();
  1540. };} {}
  1541.   }
  1542.   Function {setfilelabel(const char *filename)} {} {
  1543.     code {if (filename!=NULL) snprintf(&masterwindowlabel[0],100,"%s - ZynAddSubFX",fl_filename_name(filename));
  1544.   else snprintf(&masterwindowlabel[0],100,"%s","ZynAddSubFX (c)2002-2004 Nasca O. Paul");
  1545. masterwindowlabel[99]='\\0';
  1546. masterwindow->label(&masterwindowlabel[0]);
  1547. simplemasterwindow->label(&masterwindowlabel[0]);} {}
  1548.   }
  1549.   Function {MasterUI(Master *master_,int *exitprogram_)} {} {
  1550.     code {master=master_;
  1551. exitprogram=exitprogram_;
  1552. ninseff=0;
  1553. nsyseff=0;
  1554. npart=0;
  1555.  
  1556. for (int i=0;i<NUM_SYS_EFX;i++)
  1557.    for (int j=0;j<NUM_SYS_EFX;j++)
  1558.      syseffsend[i][j]=NULL;
  1559.  
  1560. microtonalui=new MicrotonalUI(&master->microtonal);
  1561. virkeyboard=new VirKeyboard(master);
  1562. bankui=new BankUI(master,&npart);
  1563. configui=new ConfigUI();
  1564. sequi=new SeqUI(master);
  1565.  
  1566. make_window();
  1567. presetsui=new PresetsUI();
  1568. setfilelabel(NULL);
  1569. swapefftype=0;
  1570. simplerefresh();} {}
  1571.   }
  1572.   Function {~MasterUI()} {} {
  1573.     code {masterwindow->hide();
  1574. delete (masterwindow);
  1575. aboutwindow->hide();
  1576. delete (aboutwindow);
  1577. syseffsendwindow->hide();
  1578. delete(syseffsendwindow);
  1579.  
  1580. delete (virkeyboard);
  1581. delete (microtonalui);
  1582. delete (bankui);
  1583. delete (configui);
  1584. delete (sequi);
  1585.  
  1586. delete(presetsui);} {}
  1587.   }
  1588.   Function {showUI()} {} {
  1589.     code {switch (config.cfg.UserInterfaceMode){
  1590.     case 0:selectuiwindow->show();
  1591.     break;
  1592.     case 1:masterwindow->show();
  1593.     break;
  1594.     case 2:simplemasterwindow->show();
  1595.     break;
  1596. };} {}
  1597.   }
  1598.   Function {simplerefresh()} {} {
  1599.     code {partenabled->value(master->part[npart]->Penabled);
  1600. if (master->part[npart]->Penabled!=0) simplelistitemgroup->activate();
  1601.      else simplelistitemgroup->deactivate();
  1602.  
  1603. partvolume->value(master->part[npart]->Pvolume);
  1604. partpanning->value(master->part[npart]->Ppanning);
  1605. partrcv->value(master->part[npart]->Prcvchn);
  1606.  
  1607. if (master->part[npart]->Pname[0]!=0) partname->label((char *)master->part[npart]->Pname);
  1608.     else partname->label("Click here to load a instrument");
  1609.  
  1610. simplelistitemgroup->redraw();
  1611. simplepartportamento->value(master->part[npart]->ctl.portamento.portamento);
  1612. simpleminkcounter->value(master->part[npart]->Pminkey);
  1613. simplemaxkcounter->value(master->part[npart]->Pmaxkey);
  1614.  
  1615. simplepartkeyshiftcounter->value(master->part[npart]->Pkeyshift-64);
  1616. simplesyseffsend->value(master->Psysefxvol[nsyseff][npart]);} {}
  1617.   }
  1618.   Function {do_new_master()} {} {
  1619.     code {if (fl_ask("Clear *ALL* the parameters ?")){
  1620.        delete microtonalui;
  1621.  
  1622.        pthread_mutex_lock(&master->mutex);
  1623.     master->defaults();
  1624.        pthread_mutex_unlock(&master->mutex);
  1625.     
  1626.        refresh_master_ui();
  1627.  
  1628. };
  1629.  
  1630. updatepanel();} {}
  1631.   }
  1632.   Function {do_load_master()} {} {
  1633.     code {char *filename;
  1634. filename=fl_file_chooser("Open:","({*.xmz})",NULL,0);
  1635. if (filename==NULL) return;
  1636.  
  1637.  
  1638. pthread_mutex_lock(&master->mutex);
  1639.   //clear all parameters
  1640.   master->defaults();
  1641.  
  1642.   //load the data
  1643.   int result=master->loadXML(filename);
  1644. pthread_mutex_unlock(&master->mutex);
  1645. master->applyparameters();
  1646.  
  1647. refresh_master_ui();
  1648. if (result>=0) setfilelabel(filename);
  1649.  
  1650. if (result==-10) fl_alert("Error: Could not load the file\\nbecause it is not a zynaddsubfx parameters file.");
  1651.       else if (result<0) fl_alert("Error: Could not load the file.");} {}
  1652.   }
  1653.   Function {do_save_master()} {} {
  1654.     code {char *filename;
  1655. int result=0;
  1656.  
  1657. filename=fl_file_chooser("Save:","({*.xmz})",NULL,0);
  1658. if (filename==NULL) return;
  1659. filename=fl_filename_setext(filename,".xmz");
  1660.  
  1661. result=fileexists(filename);
  1662. if (result) {
  1663.     result=0;
  1664.    if (!fl_ask("The file exists. \\nOverwrite it?")) return;
  1665.        
  1666. };
  1667.  
  1668.  
  1669. pthread_mutex_lock(&master->mutex);
  1670. result=master->saveXML(filename);
  1671. pthread_mutex_unlock(&master->mutex);
  1672.  
  1673. if (result<0) fl_alert("Error: Could not save the file.");
  1674.  
  1675.  
  1676. updatepanel();} {}
  1677.   }
  1678.   Function {refresh_master_ui()} {} {
  1679.     code {ninseff=0;
  1680. nsyseff=0;
  1681. npart=0;
  1682.  
  1683. //the Master UI
  1684. npartcounter->do_callback();
  1685. syseffnocounter->do_callback();
  1686. inseffnocounter->do_callback();
  1687. masterkeyshiftcounter->value(master->Pkeyshift-64);
  1688. mastervolumedial->value(master->Pvolume);    
  1689. globalfinedetuneslider->value(master->microtonal.Pglobalfinedetune);   
  1690. microtonalui=new MicrotonalUI(&master->microtonal);
  1691. nrpnbutton->value(master->ctl.NRPN.receive);
  1692. updatesendwindow();
  1693. updatepanel();
  1694.  
  1695. //the simle MasterUI
  1696. simplenpartcounter->value(1);
  1697. simplesyseffnocounter->value(1);
  1698. simpleinseffnocounter->value(1);
  1699. simplenpartcounter->do_callback();
  1700. simplesyseffnocounter->do_callback();
  1701. simpleinseffnocounter->do_callback();
  1702. simplemasterkeyshiftcounter->value(master->Pkeyshift-64);
  1703. simplemastervolumedial->value(master->Pvolume);    
  1704. simpleglobalfinedetuneslider->value(master->microtonal.Pglobalfinedetune);
  1705. virkeys->midich=master->part[npart]->Prcvchn;
  1706.  
  1707. simplerefresh();
  1708. bankui->hide();} {}
  1709.   }
  1710.   decl {Master *master;} {}
  1711.   decl {MicrotonalUI *microtonalui;} {}
  1712.   decl {SeqUI *sequi;} {}
  1713.   decl {BankUI *bankui;} {}
  1714.   decl {int ninseff,npart;} {}
  1715.   decl {int nsyseff;} {}
  1716.   decl {int *exitprogram;} {}
  1717.   decl {SysEffSend *syseffsend[NUM_SYS_EFX][NUM_SYS_EFX];} {}
  1718.   decl {VirKeyboard *virkeyboard;} {}
  1719.   decl {ConfigUI *configui;} {}
  1720.   decl {int swapefftype;} {}
  1721.   decl {char masterwindowlabel[100];} {}
  1722.   decl {Panellistitem *panellistitem[NUM_MIDI_PARTS];} {}
  1723.