# data file for the Fltk User Interface Designer (fluid)
version 1.0302 
header_name {.h} 
code_name {.cc}
decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {private local
} 

decl {//License: GNU GPL version 2 or later} {private local
} 

decl {\#include <stdlib.h>} {public local
} 

decl {\#include <stdio.h>} {public local
} 

decl {\#include <string.h>} {public local
} 

decl {\#include <string>} {public local
} 

decl {\#include "Fl_Osc_Dial.H"} {public local
} 

decl {\#include "Fl_Osc_Input.H"} {public local
} 

decl {\#include "PartNameButton.h"} {public local
} 

decl {\#include "EffUI.h"} {public local
} 

decl {\#include "BankUI.h"} {public local
} 

decl {\#include "ADnoteUI.h"} {public local
} 

decl {\#include "SUBnoteUI.h"} {public local
} 

decl {\#include "PADnoteUI.h"} {public local
} 

decl {\#include "../Misc/Config.h"} {public local
} 

decl {\#include "../Misc/Master.h"} {public local
} 

decl {\#include "../Misc/Part.h"} {public local
} 

class PartSysEffSend {open : {public Fl_Group}
} {
  Function {make_window()} {open private
  } {
    Fl_Window syseffsend {
      private xywh {604 244 100 100} type Double box NO_BOX
      class Fl_Group visible
    } {
      Fl_Dial widget {
        label 01
        xywh {0 0 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 align 130 maximum 127 step 1
        code0 {o->size(25,25);}
        code1 {o->alt_init("/","Psysefxvol"+to_s(neff)+"/part"+to_s(npart));}
        code2 {o->mark_dead();}
        code3 {char tmp[10];snprintf(tmp,10,"%d",neff+1);o->copy_label(tmp);}
        class Fl_Osc_Dial
      }
    }
  }
  Function {PartSysEffSend(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
    code {neff=0;
npart=0;} {}
  }
  Function {init(int npart_,int neff_)} {} {
    code {npart=npart_;
neff=neff_;
make_window();
syseffsend->show();
end();} {}
  }
  Function {rebase(int part)} {} {
    code {
    auto *osc = widget->osc;
    std::string old = "Psysefxvol"+to_s(neff)+"/part"+to_s(npart);
    std::string next = "Psysefxvol"+to_s(neff)+"/part"+to_s(part);
    widget->ext      = next;
    osc->renameLink("/"+old, "/"+next, widget);
    osc->requestValue("/"+next);
    npart = part;
    } {}
  }

  Function {~PartSysEffSend()} {} {
    code {syseffsend->hide();
//delete(syseffsend);} {}
  }
  decl {int neff;} {private local
  }
  decl {int npart;} {private local
  }
} 

class PartKitItem {open : {public Fl_Osc_Group}
} {
  Function {make_window()} {open private
  } {
    Fl_Window partkititem {
      private xywh {488 521 670 100} type Double box NO_BOX
      class Fl_Osc_Group visible
    } {
      Fl_Group partkititemgroup {
        private xywh {55 0 605 20}
        class Fl_Osc_Group
      } {
        Fl_Counter minkcounter {
          xywh {225 0 55 15} type Simple minimum 0 maximum 128 step 1
          code0 {o->init("Pminkey");}
          class Fl_Osc_Counter
        }
        Fl_Button {} {
          label m
          callback {o->oscWrite("captureMin");
minkcounter->update();
maxkcounter->update();}
          tooltip {set the minimum key to the last pressed key} xywh {285 3 15 12} box THIN_UP_BOX labelsize 10
          class Fl_Osc_Button
        }
        Fl_Button {} {
          label M
          callback {o->oscWrite("captureMax");
minkcounter->update();
maxkcounter->update();}
          tooltip {set the maximum key to the last pressed key} xywh {315 3 15 12} box THIN_UP_BOX labelsize 10
          class Fl_Osc_Button
        }
        Fl_Button {} {
          label R
          callback {minkcounter->value(0);
minkcounter->do_callback();
maxkcounter->value(127);
maxkcounter->do_callback();}
          tooltip {reset the minimum key to 0 and maximum key to 127} xywh {300 3 15 12} box THIN_UP_BOX labelfont 1 labelsize 10
        }
        Fl_Button adeditbutton {
          label edit
          callback {
	  if (Fl::event_shift())
	      partui->showvoiceparams(n, true);
	  else if (Fl::event_ctrl())
	      partui->showvoiceparams(n, false);
	  else
	      partui->showparameters(n,0);
	  }
          xywh {420 0 40 15} box THIN_UP_BOX labelsize 11
        }
        Fl_Button subeditbutton {
          label edit
          callback {partui->showparameters(n,1);}
          xywh {490 0 40 15} box THIN_UP_BOX labelsize 11
        }
        Fl_Check_Button mutedcheck {
          xywh {60 0 20 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 4
          code0 {o->init("Pmuted");}
          class Fl_Osc_Check
        }
        Fl_Counter maxkcounter {
          xywh {335 0 55 15} type Simple minimum 0 maximum 128 step 1
          code0 {o->init("Pmaxkey");}
          class Fl_Osc_Counter
        }
        Fl_Input labelbutton {
          label {Bass Drum}
          xywh {90 0 130 15} box THIN_DOWN_BOX labelfont 1 labelsize 10 align 20
          code0 {o->init("Pname");}
	  callback { o->oscWrite(o->ext, "s", o->value()); }
          class Fl_Osc_Input
        }
        Fl_Check_Button adcheck {
          callback {if (o->value()!=0) adeditbutton->activate();
       else  adeditbutton->deactivate();}
          private xywh {400 0 20 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 4
          code0 {o->init("Padenabled");}
          class Fl_Osc_Check
        }
        Fl_Check_Button subcheck {
          callback {if(o->value()!=0) subeditbutton->activate();
       else  subeditbutton->deactivate();}
          private xywh {470 0 20 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 4
          code0 {o->init("Psubenabled");}
          class Fl_Osc_Check
        }
        Fl_Choice sendtoeffect {
          xywh {615 0 45 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
          code0 {char nrstr[10]; for(int i=0;i<NUM_PART_EFX;i++){sprintf(nrstr,"FX%d",i+1);o->add(nrstr);};o->add("OFF");}
          code1 {o->init("Psendtoparteffect");//TODO check semantics}
          class Fl_Osc_Choice
        } {}
        Fl_Button padeditbutton {
          label edit
          callback {partui->showparameters(n,2);}
          xywh {560 0 40 15} box THIN_UP_BOX labelsize 11
        }
        Fl_Check_Button padcheck {
          callback {if (o->value()!=0) padeditbutton->activate();
       else padeditbutton->deactivate();}
          private xywh {540 0 20 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 4
          code0 {o->init("Ppadenabled");}
          class Fl_Osc_Check
        }
      }
      Fl_Check_Button enabledcheck {
        label 01
        callback {int answer=1;
        //TODO special case
if (o->value()==0 && !o->is_osc)
    answer=fl_choice("Delete the item?","No","Yes",NULL);
if(!answer)
    o->value(true);

if (o->value()==0) partkititemgroup->deactivate();
else partkititemgroup->activate();
o->redraw();
partui->showparameters(n,-1);//use to delete the ui, if it is not to item 0}
        private xywh {30 0 20 15} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 4
        code0 {snprintf(label,10,"%d",n+1);o->label(label);}
        code1 {o->init("Penabled");}
        code2 {if (n==0) o->deactivate();}
        class Fl_Osc_Check
      }
    }
  }
  Function {PartKitItem(int x,int y, int w, int h, const char *label=0):Fl_Osc_Group(x,y,w,h,label)} {} {
    code {n=0;} {}
  }
  Function {refresh()} {} {
    code {this->redraw();} {}
  }
  Function {init(int n_,class PartUI *partui_)} {} {
    code {n=n_;
        ext = "kit"+to_s(n)+"/";
partui=partui_;
make_window();
if (n == 0)
    mutedcheck->deactivate();
else
    deactivate();

//partkititem->show();
end();} {}
  }
  Function {~PartKitItem()} {} {
    code {} {}
  }
  decl {int n;} {private local
  }
  decl {char label[10];} {private local
  }
  decl {class PartUI *partui;} {private local
  }
} 

class PartUI {open : {public Fl_Osc_Group}
} {
  Function {make_window()} {open private
  } {
    Fl_Window partgroup {
      private xywh {703 379 385 180} type Double box NO_BOX
      class Fl_Group visible
    } {
      Fl_Group partgroupui {open
        xywh {0 0 385 180}
        class Fl_Osc_Group
      } {
        Fl_Dial {} {
          label Pan
          xywh {50 40 25 25} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
          code0 {o->init("Ppanning"); o->reset_value=64;}
          class Fl_Osc_Dial
        }
        Fl_Counter {} {
          label KeyShift
          xywh {195 45 90 20} labelsize 11 align 1 minimum -64 maximum 64 step 1
          code0 {o->lstep(12);}
          code1 {o->init("Pkeyshift", 'i', -64);}
          class Fl_Osc_Counter
        }
        Fl_Scroll {} {open
          xywh {166 91 125 49} box UP_BOX labelfont 1 labelsize 10 align 21
        } {
          Fl_Pack {} {open
            xywh {171 96 115 35} type HORIZONTAL
            code0 {o->spacing(5);}
            code1 {for (int i=0;i<NUM_SYS_EFX;i++){psyef[i]=new PartSysEffSend(0,0,25,35,"");psyef[i]->init(npart,i);}}
          } {}
        }
        Fl_Button {} {
          label {Grand Piano}
          callback {int event=Fl::event_button();
if (event==FL_RIGHT_MOUSE){
   const char *tmp=fl_input("Instrument name:",o->label());
   if (tmp!=NULL)
       o->oscWrite("Pname", "s", tmp);
} else {
  if (event==FL_LEFT_MOUSE) bankui->show();
       else instrumenteditwindow->show();
};}
          tooltip {left mousebutton - to choose/save/.. from/to bank or right mousebutton to change the name or middle button to change the instrument information}
          xywh {195 5 185 20} box UP_FRAME down_box DOWN_FRAME labelfont 1 labelsize 11 align 84
          code0 {/*o->label((char *)part->Pname);*/}
          code1 {o->ext = "Pname";o->oscRegister("Pname");}
          class PartNameButton
        }
        Fl_Box {} {
          label {To Sys.Efx.}
          xywh {166 81 95 10} labelfont 1 labelsize 10
        }
        Fl_Check_Button {} {
          label NoteOn
          tooltip {set if the part receives NoteOn messages} xywh {10 155 65 20} down_box DOWN_BOX labelfont 1 labelsize 11
          code0 {o->init("Pnoteon");}
          class Fl_Osc_Check
        }
        Fl_Counter minkcounter {
          label {Min.k}
          callback {if (minkcounter->value() > maxkcounter->value()) o->textcolor(FL_RED);
 else o->textcolor(FL_BLACK);}
          tooltip {Minimum key (that the part receives NoteOn messages)} xywh {295 125 40 15} type Simple labelfont 1 labelsize 10 minimum 0 maximum 127 step 1 textsize 10
          code0 {o->init("Pminkey");}
          class Fl_Osc_Counter
        }
        Fl_Counter maxkcounter {
          label {Max.k}
          callback {if (minkcounter->value() > maxkcounter->value()) o->textcolor(FL_RED);
 else o->textcolor(FL_BLACK);}
          tooltip {Maximum key (that the part receives NoteOn messages)} xywh {340 125 40 15} type Simple labelfont 1 labelsize 10 minimum 0 maximum 127 step 1 textsize 10
          code0 {o->init("Pmaxkey");}
          class Fl_Osc_Counter
        }
        Fl_Dial {} {
          label Volume
          tooltip {Part Volume} xywh {10 35 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
          code0 {o->init("Pvolume"); o->reset_value=96;}
          class Fl_Osc_Dial
        }
        Fl_Dial {} {
          label {Vel.Ofs.}
          tooltip {Velocity Offset} xywh {135 40 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
          code0 {o->init("Pveloffs"); o->reset_value=64;}
          class Fl_Osc_Dial
        }
        Fl_Dial {} {
          label {Vel.Sns.}
          tooltip {Velocity Sensing Function} xywh {95 40 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
          code0 {o->init("Pvelsns"); o->reset_value=64;}
          class Fl_Osc_Dial
        }
        Fl_Button {} {
          label Controllers
          callback {ctlwindow->show();}
          xywh {295 90 85 30} labelfont 1 labelsize 11
        }
        Fl_Check_Button {} {
          label Portamento
          tooltip {Enable/Disable the portamento} xywh {95 155 88 20} down_box DOWN_BOX labelfont 1 labelsize 11
          code0 {o->init("ctl/portamento.portamento");}
          class Fl_Osc_Check
        }
        Fl_Button {} {
          label {Edit instrument}
          callback {
          if (Fl::event_shift() || Fl::event_ctrl())
              instrumentkitlist->show();
          else
              instrumenteditwindow->show();
          }
          xywh {15 90 130 30} color 52 labelfont 1 labelsize 13
        }
        Fl_Button {} {
          label m
          callback {o->oscWrite("captureMin");
          o->oscWrite("Pminkey");
          o->oscWrite("Pmaxkey");}
          tooltip {set the minimum key to the last pressed key} xywh {315 155 15 12} box THIN_UP_BOX labelsize 10
          class Fl_Osc_Button
        }
        Fl_Button {} {
          label M
          callback {o->oscWrite("captureMax");
          o->oscWrite("Pminkey");
          o->oscWrite("Pmaxkey");}
          tooltip {set the maximum key to the last pressed key} xywh {345 155 15 12} box THIN_UP_BOX labelsize 10
          class Fl_Osc_Button
        }
        Fl_Button {} {
          label R
          callback {o->oscWrite("Pminkey", "i", 0);
          o->oscWrite("Pmaxkey", "i", 127);}
          tooltip {reset the minimum key to 0 and maximum key to 127} xywh {330 155 15 12} box THIN_UP_BOX labelfont 1 labelsize 10
          class Fl_Osc_Button
        }
        Fl_Choice {} {
          label {MIDI Chn.Rcv.}
          tooltip {receive from Midi channel} xywh {310 45 70 20} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
          code0 {char nrstr[10]; for(int i=0;i<NUM_MIDI_CHANNELS;i++){sprintf(nrstr,"Chn%d",i+1);if (i!=9) o->add(nrstr); else o->add("Drms10");};}
          code1 {o->init("Prcvchn");}
          class Fl_Osc_Choice
        } {}
        Fl_Counter keylimitlist {
          label KLmt
          tooltip {Key Limit} xywh {215 155 50 20} labelsize 10 align 8 textfont 1 textsize 10
          code0 {o->init("Pkeylimit",'i');}
          code1 {o->step(1.0,10.0);}
          code2 {o->range(0,127);}
          class Fl_Osc_Counter
        }
        Fl_Choice {} {
          label {Mode :}
          tooltip {Poly, Mono or Legato mode} xywh {80 130 64 18} down_box BORDER_BOX labelfont 1 labelsize 11 textfont 1 textsize 10
          code0 {o->add("Poly"); o->add("Mono"); o->add("Legato");}
          code1 {o->init("polyType");}
          class Fl_Osc_Choice
        } {}
      }
      Fl_Check_Button partenablebutton {
        label Enabled
        callback {if (o->value()==0) partgroupui->deactivate();
    else partgroupui->activate();}
        xywh {90 5 75 20} down_box DOWN_BOX labelfont 1 labelsize 11
        code0 {o->init("Penabled");}
        class Fl_Osc_Check
      }
    }
    Fl_Window ctlwindow {
      label Controllers
      private xywh {777 376 500 135} type Double box NO_BOX
      class Fl_Osc_Window visible
    } {
      Fl_Box {} {
        xywh {0 0 0 0}
        code0 {ctlwindow->init(osc,"/part"+to_s(npart)+"/ctl/");}
      }
      Fl_Check_Button {} {
        label Expr
        tooltip {Expression enable} xywh {155 58 45 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10
        code0 {o->init("expression.receive");}
        class Fl_Osc_Check
      }
      Fl_Dial {} {
        label PanDpth
        tooltip {Panning Depth} xywh {10 55 30 30} labelsize 10 maximum 127 step 1
        code0 {o->init("panning.depth");o->reset_value=64;}
        class Fl_Osc_Dial
      }
      Fl_Dial {} {
        label FltCut
        tooltip {Filter Cutoff depth} xywh {90 55 30 30} labelsize 10 maximum 127 step 1
        code0 {o->init("filtercutoff.depth");o->reset_value=64;}
        class Fl_Osc_Dial
      }
      Fl_Dial {} {
        label FltQ
        tooltip {Filter Q depth} xywh {50 55 30 30} labelsize 10 maximum 127 step 1
        code0 {o->init("filterq.depth");o->reset_value=64;}
        class Fl_Osc_Dial
      }
      Fl_Dial {} {
        label BwDpth
        tooltip {BandWidth depth} xywh {125 10 30 30} labelsize 10 maximum 127 step 1
        code0 {o->init("bandwidth.depth");o->reset_value=64;}
        class Fl_Osc_Dial
      }
      Fl_Dial {} {
        label ModWh
        tooltip {Modulation Wheel depth} xywh {50 10 30 30} labelsize 10 maximum 127 step 1
        code0 {o->init("modwheel.depth");o->reset_value=80;}
        class Fl_Osc_Dial
      }
      Fl_Check_Button benddir {
        label Downward
        callback {if (o->value()) {bendrng->oscMove("pitchwheel.bendrange_down");}
else {bendrng->oscMove("pitchwheel.bendrange");}}
        xywh {205 37 69 15} down_box DOWN_BOX labelsize 10
      }
      Fl_Counter bendrng {
        label {PWheelB.Rng (cents)}
        tooltip {Pitch Wheel Bend Range (cents)} xywh {165 15 110 20} labelsize 10 align 1 minimum -6400 maximum 6400 step 1
        code0 {o->init("pitchwheel.bendrange", 'i');}
        code1 {o->lstep(100);}
        class Fl_Osc_Counter
      }
      Fl_Check_Button bendsplt {
        label Split
        callback {if(o->value()) {benddir->activate();}
            else {benddir->deactivate(); benddir->value(0); benddir->do_callback();}}
        xywh {167 37 38 15} down_box DOWN_BOX labelsize 10
        code0 {o->init("pitchwheel.is_split");}
        class Fl_Osc_Check
      }
      Fl_Check_Button {} {
        label FMamp
        tooltip {FM amplitude enable} xywh {205 58 60 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10
        code0 {o->init("fmamp.receive");}
        class Fl_Osc_Check
      }
      Fl_Check_Button {} {
        label Vol
        tooltip {Volume enable} xywh {155 83 45 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10
        code0 {o->init("volume.receive");}
        class Fl_Osc_Check
      }
      Fl_Check_Button {} {
        label Sustain
        callback {//TODO
            /*if (ctl.sustain.receive==0) {
                ReleaseSustainedKeys();
                ctl.setsustain(0);
            };*/}
        tooltip {Sustain pedal enable} xywh {205 83 60 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10
        code0 {o->init("sustain.receive");}
        class Fl_Osc_Check
      }
      Fl_Button {} {
        label Close
        callback {ctlwindow->hide();}
        xywh {400 110 95 20} box THIN_UP_BOX
      }
      Fl_Button {} {
        label {Reset all controllers}
        callback {o->oscWrite("defaults");//part->SetController(C_resetallcontrollers,0);
	ctlwindow->update();
	}
        xywh {5 110 210 20} box THIN_UP_BOX
        class Fl_Osc_Button
      }
      Fl_Group {} {
        label Portamento open
        xywh {280 15 160 90} box UP_FRAME labelsize 10
        class Fl_Osc_Group
      } {
        Fl_Check_Button {} {
          label Rcv
          tooltip {Receive Portamento Controllers} xywh {285 20 40 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10
          code0 {o->init("portamento.receive");}
          class Fl_Osc_Check
        }
        Fl_Dial {} {
          label time
          tooltip {Portamento time} xywh {285 60 25 25} labelsize 10 maximum 127 step 1
          code0 {o->init("portamento.time");o->reset_value=64;}
          class Fl_Osc_Dial
        }
        Fl_Counter {} {
          label thresh
          tooltip {Minimum or max. difference of the notes in order to do the portamento (x 100 cents)} xywh {340 20 50 20} type Simple labelsize 10 minimum 0 maximum 127 step 1
          code0 {o->init("portamento.pitchthresh");}
          class Fl_Osc_Counter
        }
        Fl_Check_Button {} {
          label {th.type}
          tooltip {Threshold type (min/max)} xywh {365 70 15 15} down_box DOWN_BOX labelsize 10 align 2
          code0 {o->init("portamento.pitchthreshtype");}
          class Fl_Osc_Check
        }
        Fl_Box {} {
          label {x100 cnt.}
          xywh {340 50 55 15} labelsize 10 align 16
        }
        Fl_Dial {} {
          label {t.dn/up}
          tooltip {Portamento time stretch (up/down)} xywh {315 60 25 25} labelsize 10 maximum 127 step 1
          code0 {o->init("portamento.updowntimestretch");o->reset_value=64;}
          class Fl_Osc_Dial
        }
        Fl_Dial propta {
          label {Prp.Rate}
          tooltip {Distance required to double change from nonpropotinal portamento time} xywh {405 20 25 25} labelsize 9 maximum 127 step 1
          code0 {o->init("portamento.propRate");o->reset_value=80;}
          class Fl_Osc_Dial
        }
        Fl_Dial proptb {
          label {Prp.Dpth}
          tooltip {The difference from nonproportinal portamento} xywh {405 60 25 25} labelsize 9 maximum 127 step 1
          code0 {o->init("portamento.propDepth");o->reset_value=90;}
          class Fl_Osc_Dial
        }
        Fl_Check_Button {} {
          label {Proprt.}
          callback {if(o->value()){propta->activate();proptb->activate();}
else {propta->deactivate();proptb->deactivate();}}
          tooltip {Enable Proportinal Portamento (over fixed Portamento)} xywh {285 40 50 15} box THIN_UP_BOX down_box DOWN_BOX labelsize 9
          code0 {o->init("portamento.proportional");}
          class Fl_Osc_Check
        }
      }
      Fl_Group {} {
        label Resonance
        xywh {445 15 50 90} box UP_FRAME labelsize 10
        class Fl_Osc_Group
      } {
        Fl_Dial {} {
          label BWdpth
          tooltip {BandWidth controller depth} xywh {455 60 25 25} labelsize 10 maximum 127 step 1
          code0 {o->init("resonancebandwidth.depth");o->reset_value=64;}
          class Fl_Osc_Dial
        }
        Fl_Dial {} {
          label CFdpth
          tooltip {Center Frequency controller Depth} xywh {455 20 25 25} labelsize 10 maximum 127 step 1
          code0 {o->init("resonancecenter.depth");o->reset_value=64;}
          class Fl_Osc_Dial
        }
      }
      Fl_Check_Button {} {
        label {Exp MWh}
        tooltip {Exponential modulation wheel} xywh {10 15 40 25} down_box DOWN_BOX labelsize 10 align 148
        code0 {o->init("modwheel.exponential");}
        class Fl_Osc_Check
      }
      Fl_Check_Button {} {
        label {Exp BW}
        tooltip {Exponential BandWidth Controller} xywh {85 15 35 25} down_box DOWN_BOX labelsize 10 align 148
        code0 {o->init("bandwidth.exponential");}
        class Fl_Osc_Check
      }
    }
    Fl_Window partfx {
      label {Part's Insert Effects}
      private xywh {569 775 390 145} type Double box NO_BOX
      class Fl_Osc_Window visible
    } {
      Fl_Box {} {
        xywh {0 0 0 0}
        code0 {partfx->init(osc, part_path);}
      }
      Fl_Counter inseffnocounter {
        label {FX No.}
        callback {ninseff=(int) o->value()-1;
        insefftype->oscMove("partefx"+to_s(ninseff)+"/efftype");
        inseffectuigroup->reext("partefx"+to_s(ninseff)+"/");
        bypasseff->oscMove("Pefxbypass"+to_s(ninseff));
        sendtochoice->oscMove("Pefxroute"+to_s(ninseff));
/*insefftype->value(part->partefx[ninseff]->geteffect());*/
//insefftype->do_callback();
inseffectui->refresh();
int x=127;/*part->Pefxroute[ninseff];*/
if (x==127) x=1;

sendtochoice->value(x);}
        xywh {5 110 80 20} type Simple labelfont 1 align 6 minimum 1 maximum 127 step 1 textfont 1
        code0 {o->bounds(1,NUM_PART_EFX);}
        code1 {o->value(ninseff+1);}
      }
      Fl_Choice insefftype {
        label EffType
        callback {inseffectui->efftype = o->value();
inseffectui->refresh();}
        xywh {155 110 70 15} down_box BORDER_BOX labelsize 10 align 6
        code0 {o->init(("partefx"+to_s(ninseff)+"/efftype").c_str());}
        class Fl_Osc_Choice
      } {
        MenuItem {} {
          label {No Effect}
          xywh {35 35 100 20} labelfont 1 labelsize 10
        }
        MenuItem {} {
          label Reverb
          xywh {45 45 100 20} labelfont 1 labelsize 10
        }
        MenuItem {} {
          label Echo
          xywh {55 55 100 20} labelfont 1 labelsize 10
        }
        MenuItem {} {
          label Chorus
          xywh {65 65 100 20} labelfont 1 labelsize 10
        }
        MenuItem {} {
          label Phaser
          xywh {70 70 100 20} labelfont 1 labelsize 10
        }
        MenuItem {} {
          label AlienWah
          xywh {80 80 100 20} labelfont 1 labelsize 10
        }
        MenuItem {} {
          label Distortion
          xywh {90 90 100 20} labelfont 1 labelsize 10
        }
        MenuItem {} {
          label EQ
          xywh {100 100 100 20} labelfont 1 labelsize 10
        }
        MenuItem {} {
          label DynFilter
          xywh {110 110 100 20} labelfont 1 labelsize 10
        }
      }
      Fl_Group inseffectuigroup {
        xywh {5 5 380 100} box FLAT_BOX color 48
        class Fl_Osc_Group
      } {
        Fl_Box {} {
          xywh {0 0 0 0}
          code0 {inseffectuigroup->ext = "partefx0/";}
        }
        Fl_Group inseffectui {
          xywh {5 5 380 95}
          code0 {o->init(true);}
          class EffUI
        } {}
      }
      Fl_Button {} {
        label Close
        callback {partfx->hide();}
        xywh {325 115 60 20} box THIN_UP_BOX
      }
      Fl_Choice sendtochoice {
        label {Send To.}
        callback {(void)o;/*int x=(int) o->value();
part->Pefxroute[ninseff]=x;
if (x==2) part->partefx[ninseff]->setdryonly(true);
	else part->partefx[ninseff]->setdryonly(false);*/}
        xywh {235 110 80 15} down_box BORDER_BOX labelsize 10 align 6
        code0 {/*int x=part->Pefxroute[ninseff]; if (x==127) x=1;*/}
        code1 {o->init(("Pefxroute"+to_s(ninseff)).c_str());}
        class Fl_Osc_Choice
      } {
        MenuItem {} {
          label {Next Effect}
          xywh {45 45 100 20} labelfont 1 labelsize 10
        }
        MenuItem {} {
          label {Part Out}
          xywh {55 55 100 20} labelfont 1 labelsize 10
        }
        MenuItem {} {
          label {Dry Out}
          xywh {65 65 100 20} labelfont 1 labelsize 10
        }
      }
      Fl_Check_Button bypasseff {
        label bypass
        tooltip {if the effect is not used (is bypassed)} xywh {90 110 60 15} down_box DOWN_BOX labelsize 11
        code0 {o->init("Pefxbypass"+to_s(ninseff));}
        class Fl_Osc_Check
      }
      Fl_Button {} {
        label C
        callback {presetsui->copy(partfx->loc()+"partefx"+to_s(ninseff)+"/");}
        xywh {90 127 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
      }
      Fl_Button {} {
        label P
        callback {presetsui->paste(partfx->loc()+"partefx"+to_s(ninseff)+"/",inseffectui);}
        xywh {120 127 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
      }
    }
    Fl_Window instrumentkitlist {
      label {Instrument Kit}
      xywh {601 611 670 370} type Double box NO_BOX
      class Fl_Osc_Window visible
    } {
      Fl_Box {} {
        xywh {0 0 0 0}
        code0 {instrumentkitlist->init(osc, "/part"+to_s(npart)+"/");}
      }
      Fl_Button {} {
        label {Close Window}
        callback {instrumentkitlist->hide();}
        xywh {255 350 160 20} box THIN_UP_BOX
      }
      Fl_Scroll kitlist {open
        xywh {0 15 670 330} type VERTICAL box UP_FRAME
      } {
        Fl_Pack {} {
          xywh {0 20 670 320}
          code0 {for (int i=0;i<NUM_KIT_ITEMS;i++){partkititem[i]=new PartKitItem(0,0,670,20);partkititem[i]->init(i,this);}}
        } {}
      }
      Fl_Box {} {
        label {No.}
        xywh {5 0 25 15} labelfont 1 labelsize 11 align 18
      }
      Fl_Box {} {
        label {M.}
        xywh {55 0 25 15} labelfont 1 labelsize 11 align 18
      }
      Fl_Box {} {
        label {Min.k}
        xywh {235 0 40 15} labelfont 1 labelsize 11 align 18
      }
      Fl_Box {} {
        label {Max.k}
        xywh {345 0 40 15} labelfont 1 labelsize 11 align 18
      }
      Fl_Box {} {
        label ADsynth
        xywh {405 0 50 15} labelfont 1 labelsize 11 align 18
      }
      Fl_Box {} {
        label SUBsynth
        xywh {470 0 60 15} labelfont 1 labelsize 11 align 18
      }
      Fl_Choice {} {
        label Mode
        callback {if (o->value()==0) {
		 for (int i=1;i<NUM_KIT_ITEMS;i++)
		   partkititem[i]->deactivate();
		 partkititem[0]->mutedcheck->deactivate();
        } else {
		 for (int i=1;i<NUM_KIT_ITEMS;i++)
		   partkititem[i]->activate();
                   partkititem[0]->mutedcheck->activate(); };}
        xywh {35 350 70 15} down_box BORDER_BOX labelsize 11 textfont 1 textsize 11
        code0 {o->init("Pkitmode");}
        class Fl_Osc_Choice
      } {
        MenuItem {} {
          label OFF
          xywh {0 0 100 20} labelfont 1 labelsize 11
        }
        MenuItem {} {
          label MULTI
          xywh {10 10 100 20} labelfont 1 labelsize 11
        }
        MenuItem {} {
          label SINGLE
          xywh {20 20 100 20} labelfont 1 labelsize 11
        }
      }
      Fl_Check_Button {} {
        label {Drum mode}
        xywh {125 350 80 15} down_box DOWN_BOX labelsize 10
        code0 {o->init("Pdrummode");}
        class Fl_Osc_Check
      }
      Fl_Button {} {
        label Comments
        callback {instrumenteditwindow->show();}
        xywh {481 350 106 20} box THIN_UP_BOX
      }
      Fl_Button {} {
        label Effects
        callback {partfx->show();} selected
        xywh {600 350 70 20} box THIN_UP_BOX
      }

      Fl_Box {} {
        label {FX.r.}
        xywh {620 0 30 15} labelfont 1 labelsize 11 align 18
      }
      Fl_Box {} {
        label PADsynth
        xywh {540 0 60 15} labelfont 1 labelsize 11 align 18
      }
    }
    Fl_Window instrumenteditwindow {
      label {Instrument Edit} open
      xywh {262 621 395 360} type Double box NO_BOX
      class Fl_Osc_Window visible
    } {
      Fl_Box {} {
        xywh {0 0 0 0}
        code0 {instrumenteditwindow->init(osc, "/part"+to_s(npart)+"/");}
      }
      Fl_Group editgroup {
        xywh {0 220 395 110} box UP_FRAME
        class Fl_Osc_Group
      } {
        Fl_Box {} {
          xywh {0 220 0 0}
          code0 {editgroup->ext = "kit0/";}
        }
        Fl_Group {} {
          label PADsynth
          xywh {205 245 100 80} box ENGRAVED_FRAME labelfont 1
        } {
          Fl_Button padeditbutton {
            label Edit
            callback {showparameters(0,2);}
            xywh {215 280 80 35} color 51 selection_color 51 labelfont 1 labelsize 13 align 128
          }
          Fl_Check_Button padsynenabledcheck {
            label Enabled
            callback {if (o->value()==0) padeditbutton->deactivate();
                else padeditbutton->activate();}
            tooltip {enable/disable PADsynth} xywh {215 255 80 20} box UP_BOX down_box DOWN_BOX color 51 selection_color 0 labelfont 1 labelsize 11
            code1 {o->init("Ppadenabled");}
            class Fl_Osc_Check
          }
        }
        Fl_Group {} {
          label ADsynth
          xywh {5 245 100 80} box ENGRAVED_FRAME labelfont 1
        } {
          Fl_Check_Button adsynenabledcheck {
            label Enabled
            callback {if (o->value()==0) adeditbutton->deactivate();
     else adeditbutton->activate();}
            tooltip {enable/disable ADsynth} xywh {15 255 80 20} box UP_BOX down_box DOWN_BOX color 51 selection_color 0 labelfont 1 labelsize 11
            code1 {o->init("Padenabled");}
            class Fl_Osc_Check
          }
          Fl_Button adeditbutton {
            label Edit
            callback {
	    if (Fl::event_shift()) {
	        showvoiceparams(0, true);
	    } else if (Fl::event_ctrl()) {
	        showvoiceparams(0, false);
	    } else
	        showparameters(0,0);
	    }
            xywh {15 281 80 34} color 51 selection_color 51 labelfont 1 labelsize 13 align 128
          }
        }
        Fl_Group {} {
          label SUBsynth
          xywh {105 245 100 80} box ENGRAVED_FRAME labelfont 1
        } {
          Fl_Check_Button subsynenabledcheck {
            label Enabled
            callback {if (o->value()==0) subeditbutton->deactivate();
     else subeditbutton->activate();}
            tooltip {enable/disable SUBsynth} xywh {115 255 80 20} box UP_BOX down_box DOWN_BOX color 51 selection_color 0 labelfont 1 labelsize 11
            code1 {o->init("Psubenabled");}
            class Fl_Osc_Check
          }
          Fl_Button subeditbutton {
            label Edit
            callback {showparameters(0,1);}
            xywh {115 280 80 35} color 51 selection_color 51 labelfont 1 labelsize 13 align 128
          }
        }
        Fl_Button {} {
          label {Kit Edit}
          callback {instrumentkitlist->show();}
          xywh {310 245 80 35} color 51 selection_color 51 labelfont 1 align 128
        }
        Fl_Button {} {
          label Effects
          callback {partfx->show();}
          xywh {310 290 80 35} color 51 selection_color 51 labelfont 1 labelsize 13
        }
      }
      Fl_Group {} {
        xywh {0 5 395 215} box UP_FRAME
      } {
        Fl_Input {} {
          label {Author and Copyright}
          xywh {5 60 385 50} type Multiline color 124 labelsize 10 align 5
          code0 {o->maximum_size(MAX_INFO_TEXT_SIZE);}
          code1 {o->init("info.Pauthor");}
	  callback { o->oscWrite(o->ext, "s", o->value()); }
          class Fl_Osc_Input
        }
        Fl_Input {} {
          label Comments
          xywh {5 125 385 90} type Multiline color 124 labelsize 11 align 5
          code0 {o->maximum_size(MAX_INFO_TEXT_SIZE);}
          code1 {o->init("info.Pcomments");}
	  callback { o->oscWrite(o->ext, "s", o->value()); }
          class Fl_Osc_Input
        }
        Fl_Choice {} {
          label {Type:}
          xywh {5 25 155 20} down_box BORDER_BOX labelfont 1 labelsize 11 align 5 textsize 10
          code0 {o->init("info.Ptype");}
          class Fl_Osc_Choice
        } {
          MenuItem {} {
            label {--------------------------}
            xywh {20 20 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label Piano
            xywh {10 10 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label {Chromatic Percussion}
            xywh {20 20 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label Organ
            xywh {30 30 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label Guitar
            xywh {40 40 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label Bass
            xywh {50 50 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label {Solo Strings}
            xywh {60 60 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label Ensemble
            xywh {70 70 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label Brass
            xywh {80 80 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label Reed
            xywh {90 90 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label Pipe
            xywh {100 100 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label {Synth Lead}
            xywh {110 110 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label {Synth Pad}
            xywh {120 120 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label {Synth Effects}
            xywh {130 130 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label Ethnic
            xywh {140 140 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label Percussive
            xywh {150 150 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label {Sound Effects}
            xywh {160 160 100 20} labelfont 1 labelsize 11
          }
        }
      }
      Fl_Button {} {
        label Close
        callback {instrumenteditwindow->hide();}
        xywh {150 335 95 25} box THIN_UP_BOX
      }
    }
  }
  Function {PartUI(int x,int y, int w, int h, const char *label=0):Fl_Osc_Group(x,y,w,h,label)} {open
  } {
    code {adnoteui=NULL;
subnoteui=NULL;
padnoteui=NULL;
lastkititem=-1;} {}
  }
  Function {init(std::string part_path_, int npart_,BankUI *bankui_, std::string loc_, Fl_Osc_Interface *osc_)} {open
  } {
    code {assert(osc_);
assert(!loc_.empty());

bankui=bankui_;
part_path = part_path_;
base = part_path;
npart=npart_;
ninseff=0;
osc=osc_;
loc=loc_;

make_window();
\#ifdef NTK_GUI
adsynenabledcheck->selection_color(55);
subsynenabledcheck->selection_color(55);
padsynenabledcheck->selection_color(55);
\#endif
partgroup->position(this->parent()->x()+2,this->parent()->y()+2);
partgroup->show();
end();


//if (config.ui.showinstrumentinfo!=0) instrumenteditwindow->show();
} {}
  }
  Function {cleanuplastkit(int kititem)} {open return_type int
  } {
    code {
if (kititem==lastkititem)
  return 0;
delete adnoteui;
delete subnoteui;
delete padnoteui;
adnoteui=NULL;subnoteui=NULL;padnoteui=NULL;
lastkititem=kititem;

if(kititem>=NUM_KIT_ITEMS) return 1;//bad kit item
if(kititem<0) return 1;
return 0;
} {}}


  Function {showparameters(int kititem,int engine)} {open
  } {
    code {
if (engine==-1){//this is used if I want to clear the engine from the part
    //if (kititem==lastkititem) kititem=-1;
    //else kititem=lastkititem;
    delete adnoteui;
    delete subnoteui;   
    delete padnoteui;
    adnoteui=NULL;subnoteui=NULL;padnoteui=NULL;
    return;
}

    if (cleanuplastkit(kititem))
        return;

if(!adnoteui  && engine==0)//adsynenabledcheck->value())
    adnoteui=new ADnoteUI(loc+"kit"+to_s(kititem)+"/adpars/", osc);

if(!subnoteui && engine==1)//subsynenabledcheck->value()) 
    subnoteui=new SUBnoteUI(osc, loc+"kit"+to_s(kititem)+"/subpars/");

if(!padnoteui && engine==2)//padsynenabledcheck->value()) 
    padnoteui=new PADnoteUI(loc+"kit"+to_s(kititem)+"/padpars/", osc);

if (engine==0&&adnoteui) adnoteui->ADnoteGlobalParameters->show();
if (engine==1&&subnoteui) subnoteui->SUBparameters->show();
if (engine==2&&padnoteui) padnoteui->padnotewindow->show();} {}
  }
  Function {showvoiceparams(int kititem, bool voicelist)} {open
  } {
    code {
if (cleanuplastkit(kititem))
    return;
if(adnoteui ||
   (adnoteui=new ADnoteUI(loc+"kit"+to_s(kititem)+"/adpars/", osc))) {
    if(voicelist)
        adnoteui->ADnoteVoiceList->show();
    else {
        if (adnoteui->advoice->mod_type->value() == 0)
	    adnoteui->advoice->voiceFMparametersgroup->deactivate();
	else
	    adnoteui->advoice->voiceFMparametersgroup->activate();
	adnoteui->ADnoteVoice->show();
    }}} {}}

  Function {~PartUI()} {} {
    code {delete adnoteui;
delete subnoteui;
delete padnoteui;

partgroup->hide();
//delete(partgroup);

ctlwindow->hide();
delete(ctlwindow);

partfx->hide();
delete(partfx);

instrumentkitlist->hide();
delete(instrumentkitlist);

instrumenteditwindow->hide();
delete(instrumenteditwindow);} {}
  }
  decl {BankUI *bankui;} {private local
  }
  decl {ADnoteUI *adnoteui;} {selected public local
  }
  decl {SUBnoteUI *subnoteui;} {private local
  }
  decl {PADnoteUI *padnoteui;} {private local
  }
  decl {PartSysEffSend *psyef[NUM_SYS_EFX];} {private local
  }
  decl {int npart;} {private local
  }
  decl {int ninseff;} {private local
  }
  decl {int lastkititem;} {private local
  }
  decl {PartKitItem *partkititem[NUM_KIT_ITEMS];} {private local
  }
  decl {std::string part_path;} {private local
  }
  decl {std::string loc;} {private local
  }
  decl {Fl_Osc_Interface *osc;} {private local
  }
  Function {rebase(std::string new_loc)} {open
  } {
    code {
    loc = new_loc;
    partgroupui->rebase(new_loc);
ctlwindow->rebase(new_loc+"ctl/");
partfx->rebase(new_loc);
instrumentkitlist->rebase(new_loc);
instrumenteditwindow->rebase(new_loc);
partenablebutton->rebase(new_loc);
int next_part = 0;
const char *tmp = new_loc.c_str();
while(*tmp && !isdigit(*tmp)) tmp++;
next_part = atoi(tmp);
for (int i=0;i<NUM_SYS_EFX;i++)
    psyef[i]->rebase(next_part);
} {selected
    }
  }
} 
