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

decl {//License: GNU GPL version 2} {} 

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

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

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

decl {\#include "WidgetPDial.h"} {public
} 

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

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

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

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

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

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

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

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

class PartSysEffSend {: {public Fl_Group}
} {
  Function {make_window()} {private
  } {
    Fl_Window syseffsend {
      private xywh {584 83 90 35} type Double hide
      class Fl_Group
    } {
      Fl_Dial {} {
        label 01
        callback {master->setPsysefxvol(npart,neff,(int) o->value());}
        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->value(master->Psysefxvol[neff][npart]);}
        code2 {char tmp[10];snprintf(tmp,10,"%d",neff);o->label(strdup(tmp));}
        class WidgetPDial
      }
    }
  }
  Function {PartSysEffSend(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
    code {master=NULL;
neff=0;
npart=0;} {}
  }
  Function {init(Master *master_,int npart_,int neff_)} {} {
    code {npart=npart_;
neff=neff_;
master=master_;
make_window();
syseffsend->show();
end();} {}
  }
  Function {~PartSysEffSend()} {} {
    code {syseffsend->hide();
//delete(syseffsend);} {}
  }
  decl {Master *master;} {}
  decl {int neff;} {}
  decl {int npart;} {}
} 

class PartUI_ {} {
  Function {showparameters(int kititem,int engine)} {return_type virtual
  } {}
} 

class PartKitItem {: {public Fl_Group}
} {
  Function {make_window()} {private
  } {
    Fl_Window partkititem {
      private xywh {113 271 670 30} type Double hide
      class Fl_Group
    } {
      Fl_Group partkititemgroup {
        private xywh {55 0 605 20} box FLAT_BOX
        code0 {if (part->kit[n].Penabled==0) o->deactivate();}
      } {
        Fl_Counter minkcounter {
          callback {part->kit[n].Pminkey=(int)o->value();}
          xywh {225 0 55 15} type Simple minimum 0 maximum 128 step 1
          code0 {o->value(part->kit[n].Pminkey);}
        }
        Fl_Button {} {
          label m
          callback {if (part->lastnote>=0) minkcounter->value(part->lastnote);
minkcounter->do_callback();
maxkcounter->do_callback();}
          tooltip {set the minimum key to the last pressed key} xywh {285 3 15 12} box THIN_UP_BOX labelsize 10
        }
        Fl_Button {} {
          label M
          callback {if (part->lastnote>=0) maxkcounter->value(part->lastnote);
maxkcounter->do_callback();
minkcounter->do_callback();}
          tooltip {set the maximum key to the last pressed key} xywh {315 3 15 12} box THIN_UP_BOX labelsize 10
        }
        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 {partui->showparameters(n,0);}
          xywh {420 0 40 15} box THIN_UP_BOX labelsize 12
          code0 {if (part->kit[n].Padenabled==0) o->deactivate();}
          code1 {if (n==0) o->hide();}
        }
        Fl_Button subeditbutton {
          label edit
          callback {partui->showparameters(n,1);}
          xywh {490 0 40 15} box THIN_UP_BOX labelsize 12
          code0 {if (part->kit[n].Psubenabled==0) o->deactivate();}
          code1 {if (n==0) o->hide();}
        }
        Fl_Check_Button mutedcheck {
          callback {part->kit[n].Pmuted=(int)o->value();}
          private xywh {60 0 20 15} down_box DOWN_BOX labelfont 1 labelsize 12 align 4
          code0 {o->value(part->kit[n].Pmuted);}
        }
        Fl_Counter maxkcounter {
          callback {part->kit[n].Pmaxkey=(int)o->value();}
          xywh {335 0 55 15} type Simple minimum 0 maximum 128 step 1
          code0 {o->value(part->kit[n].Pmaxkey);}
        }
        Fl_Button labelbutton {
          label {Bass Drum}
          callback {const char *tmp=fl_input("Kit item name:",(const char *)part->kit[n].Pname);
if (tmp!=NULL) snprintf((char *)part->kit[n].Pname,PART_MAX_NAME_LEN,"%s",tmp);}
          xywh {90 0 130 15} box THIN_DOWN_BOX down_box FLAT_BOX labelfont 1 labelsize 11 align 20
          code0 {o->label((char *)part->kit[n].Pname);}
        }
        Fl_Check_Button adcheck {
          callback {part->kit[n].Padenabled=(int)o->value();
if (part->kit[n].Padenabled!=0) adeditbutton->activate();
       else  adeditbutton->deactivate();}
          private xywh {400 0 20 15} down_box DOWN_BOX labelfont 1 labelsize 12 align 4
          code0 {o->value(part->kit[n].Padenabled);}
          code1 {if (n==0) o->hide();}
        }
        Fl_Check_Button subcheck {
          callback {part->kit[n].Psubenabled=(int)o->value();
if (part->kit[n].Psubenabled!=0) subeditbutton->activate();
       else  subeditbutton->deactivate();}
          private xywh {470 0 20 15} down_box DOWN_BOX labelfont 1 labelsize 12 align 4
          code0 {o->value(part->kit[n].Psubenabled);}
          code1 {if (n==0) o->hide();}
        }
        Fl_Choice sendtoeffect {
          callback {if (o->value()!=0) part->kit[n].Psendtoparteffect=(int)o->value()-1;
    else part->kit[n].Psendtoparteffect=127;} open
          xywh {615 0 45 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
          code0 {o->add("OFF");char nrstr[10]; for(int i=0;i<NUM_PART_EFX;i++){sprintf(nrstr,"FX%d",i+1);o->add(nrstr);};}
          code1 {o->value(part->kit[n].Psendtoparteffect+1);if (part->kit[n].Psendtoparteffect==127) o->value(0);}
        } {}
        Fl_Button padeditbutton {
          label edit
          callback {partui->showparameters(n,2);}
          xywh {560 0 40 15} box THIN_UP_BOX labelsize 12
          code0 {if (part->kit[n].Ppadenabled==0) o->deactivate();}
          code1 {if (n==0) o->hide();}
        }
        Fl_Check_Button padcheck {
          callback {part->kit[n].Ppadenabled=(int)o->value();
if (part->kit[n].Ppadenabled!=0) padeditbutton->activate();
       else padeditbutton->deactivate();}
          private xywh {540 0 20 15} down_box DOWN_BOX labelfont 1 labelsize 12 align 4
          code0 {o->value(part->kit[n].Ppadenabled);}
          code1 {if (n==0) o->hide();}
        }
      }
      Fl_Check_Button enabledcheck {
        label 01
        callback {int answer=1;
if (o->value()==0) answer=fl_ask("Delete the item?");
if (answer!=0){
master->busy=true;
 part->setkititemstatus(n,(int) o->value());
master->busy=false;

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
} else o->value(1);}
        private xywh {30 0 20 15} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 4
        code0 {snprintf(label,10,"%d",n+1);o->label(strdup(label));}
        code1 {o->value(part->kit[n].Penabled);}
        code2 {if (n==0) o->deactivate();}
      }
    }
  }
  Function {PartKitItem(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
    code {n=0;
part=NULL;} {}
  }
  Function {refresh()} {} {
    code {enabledcheck->value(part->kit[n].Penabled);
if (part->kit[n].Penabled==0) partkititemgroup->deactivate();
else partkititemgroup->activate();

mutedcheck->value(part->kit[n].Pmuted);
labelbutton->label((char *)part->kit[n].Pname);
minkcounter->value(part->kit[n].Pminkey);
maxkcounter->value(part->kit[n].Pmaxkey);
adcheck->value(part->kit[n].Padenabled);
adcheck->do_callback();
subcheck->value(part->kit[n].Psubenabled);
subcheck->do_callback();

sendtoeffect->value(part->kit[n].Psendtoparteffect+1);
if (part->kit[n].Psendtoparteffect==127) sendtoeffect->value(0);

this->redraw();} {
      callback {int answer=1;
if (o->value()==0) answer=fl_ask("Delete the item?");
if (answer!=0){
master->busy=true;
 part->setkititemstatus(n,(int) o->value());
master->busy=false;

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
} else o->value(1);}
    }
  }
  Function {init(Part *part_,int n_,Master *master_,PartUI_ *partui_)} {} {
    code {part=part_;
n=n_;
partui=partui_;
master=master_;
make_window();
//partkititem->show();
end();} {}
  }
  Function {~PartKitItem()} {} {
    code {partkititem->hide();
//delete(partkititem);} {}
  }
  decl {Part *part;} {}
  decl {int n;} {}
  decl {Master *master;} {}
  decl {char label[10];} {}
  decl {PartUI_ *partui;} {}
} 

class PartUI {: {public Fl_Group,PartUI_}
} {
  Function {make_window()} {private
  } {
    Fl_Window partgroup {
      private xywh {107 533 385 180} type Double hide
      class Fl_Group
    } {
      Fl_Group partgroupui {
        xywh {0 0 385 180}
        code0 {if (part->Penabled==0) o->deactivate();}
      } {
        Fl_Dial {} {
          label Pan
          callback {part->setPpanning((int) o->value());}
          xywh {50 40 25 25} box ROUND_UP_BOX labelsize 12 maximum 127 step 1
          code0 {o->value(part->Ppanning);}
          class WidgetPDial
        }
        Fl_Counter {} {
          label KeyShift
          callback {part->Pkeyshift=(int) o->value()+64;}
          xywh {195 45 90 20} labelsize 12 align 1 minimum -64 maximum 64 step 1
          code0 {o->lstep(12);}
          code1 {o->value(part->Pkeyshift-64);}
        }
        Fl_Scroll {} {open
          xywh {166 91 125 60} box ENGRAVED_FRAME 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(master,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:",(const char *)part->Pname);
   if (tmp!=NULL) snprintf((char *)part->Pname,PART_MAX_NAME_LEN,"%s",tmp);
} else {
  if (event==FL_LEFT_MOUSE) bankui->show();
       else instrumenteditwindow->show();
};} selected
          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 THIN_DOWN_BOX down_box FLAT_BOX labelfont 1 labelsize 12 align 84
          code0 {o->label((char *)part->Pname);}
        }
        Fl_Box {} {
          label {To Sys.Efx.}
          xywh {166 81 95 10} labelfont 1 labelsize 10
        }
        Fl_Check_Button {} {
          label NoteOn
          callback {part->Pnoteon=(int) o->value();}
          tooltip {set if the part receives NoteOn messages} xywh {0 155 65 20} down_box DOWN_BOX labelfont 1 labelsize 12
          code0 {o->value(part->Pnoteon);}
        }
        Fl_Counter minkcounter {
          label {Min.k}
          callback {part->Pminkey=(int) o->value();
if (part->Pminkey>part->Pmaxkey) 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->value(part->Pminkey);}
        }
        Fl_Counter maxkcounter {
          label {Max.k}
          callback {part->Pmaxkey=(int) o->value();

if (part->Pminkey>part->Pmaxkey) 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->value(part->Pmaxkey);}
        }
        Fl_Dial {} {
          label Volume
          callback {part->setPvolume((int) o->value());}
          tooltip {Part Volume} xywh {10 35 30 30} box ROUND_UP_BOX labelsize 12 maximum 127 step 1
          code0 {o->value(part->Pvolume);}
          class WidgetPDial
        }
        Fl_Dial {} {
          label {Vel.Ofs.}
          callback {part->Pveloffs=(int) o->value();}
          tooltip {Velocity Offset} xywh {135 40 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
          code0 {o->value(part->Pveloffs);}
          class WidgetPDial
        }
        Fl_Dial {} {
          label {Vel.Sns.}
          callback {part->Pvelsns=(int) o->value();}
          tooltip {Velocity Sensing Function} xywh {95 40 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
          code0 {o->value(part->Pvelsns);}
          class WidgetPDial
        }
        Fl_Button {} {
          label Controllers
          callback {ctlwindow->show();}
          xywh {295 90 85 30} box PLASTIC_UP_BOX labelfont 1 labelsize 12
        }
        Fl_Check_Button {} {
          label Poly
          callback {part->Ppolymode=(int) o->value();}
          tooltip {Part mode (mono/poly)} xywh {65 155 45 20} down_box DOWN_BOX labelfont 1 labelsize 12
          code0 {o->value(part->Ppolymode);}
        }
        Fl_Check_Button {} {
          label Portamento
          callback {part->ctl.portamento.portamento=(int) o->value();}
          tooltip {Enable/Disable the portamento} xywh {115 155 85 20} down_box DOWN_BOX labelfont 1 labelsize 12
          code0 {o->value(part->ctl.portamento.portamento);}
        }
        Fl_Button {} {
          label {Edit instrument}
          callback {instrumenteditwindow->show();}
          xywh {15 105 130 30} box PLASTIC_UP_BOX color 230 labelfont 1 labelsize 17
        }
        Fl_Button {} {
          label m
          callback {if (part->lastnote>=0) minkcounter->value(part->lastnote);
minkcounter->do_callback();
maxkcounter->do_callback();}
          tooltip {set the minimum key to the last pressed key} xywh {315 155 15 12} box THIN_UP_BOX labelsize 10
        }
        Fl_Button {} {
          label M
          callback {if (part->lastnote>=0) maxkcounter->value(part->lastnote);
maxkcounter->do_callback();
minkcounter->do_callback();}
          tooltip {set the maximum key to the last pressed key} xywh {345 155 15 12} box THIN_UP_BOX labelsize 10
        }
        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 {330 155 15 12} box THIN_UP_BOX labelfont 1 labelsize 10
        }
        Fl_Choice {} {
          label {MIDI Chn.Rcv.}
          callback {part->Prcvchn=(int) o->value();} open
          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->value(part->Prcvchn);}
        } {}
        Fl_Choice keylimitlist {
          label KLmt
          callback {int val=0;
val=atoi(o->text());
part->setkeylimit(val);} open
          tooltip {Key Limit} xywh {210 155 50 20} down_box BORDER_BOX labelsize 10 align 8 textfont 1 textsize 10
        } {}
      }
      Fl_Check_Button {} {
        label Enabled
        callback {master->busy=true;
master->partonoff(npart,(int) o->value());
master->busy=false;
if (part->Penabled==0) partgroupui->deactivate();
    else partgroupui->activate();}
        xywh {90 5 75 20} down_box DOWN_BOX labelfont 1 labelsize 12
        code0 {o->value(part->Penabled);}
      }
    }
    Fl_Window ctlwindow {
      label Controllers
      private xywh {198 472 460 130} type Double hide
    } {
      Fl_Check_Button {} {
        label Expr
        callback {part->ctl.expression.receive=(int) o->value();}
        tooltip {Expression enable} xywh {155 55 45 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10
        code0 {o->value(part->ctl.expression.receive);}
      }
      Fl_Dial {} {
        label PanDpth
        callback {part->ctl.panning.depth=(int) o->value();}
        tooltip {Panning Depth} xywh {10 55 30 30} labelsize 10 maximum 127 step 1
        code0 {o->value(part->ctl.panning.depth);}
        class WidgetPDial
      }
      Fl_Dial {} {
        label FltCut
        callback {part->ctl.filtercutoff.depth=(int) o->value();}
        tooltip {Filter Cutoff depth} xywh {90 55 30 30} labelsize 10 maximum 127 step 1
        code0 {o->value(part->ctl.filtercutoff.depth);}
        class WidgetPDial
      }
      Fl_Dial {} {
        label FltQ
        callback {part->ctl.filterq.depth=(int) o->value();}
        tooltip {Filter Q depth} xywh {50 55 30 30} labelsize 10 maximum 127 step 1
        code0 {o->value(part->ctl.filterq.depth);}
        class WidgetPDial
      }
      Fl_Dial {} {
        label BwDpth
        callback {part->ctl.bandwidth.depth=(int) o->value();}
        tooltip {BandWidth depth} xywh {125 10 30 30} labelsize 10 maximum 127 step 1
        code0 {o->value(part->ctl.bandwidth.depth);}
        class WidgetPDial
      }
      Fl_Dial {} {
        label ModWh
        callback {part->ctl.modwheel.depth=(int) o->value();}
        tooltip {Modulation Wheel depth} xywh {50 10 30 30} labelsize 10 maximum 127 step 1
        code0 {o->value(part->ctl.modwheel.depth);}
        class WidgetPDial
      }
      Fl_Counter {} {
        label {PWheelB.Rng (cents)}
        callback {part->ctl.pitchwheel.bendrange=(int) o->value();}
        tooltip {Pitch Wheel Bend Range (cents)} xywh {165 15 110 20} labelsize 10 align 1 minimum -6400 maximum 6400 step 1
        code0 {o->value(part->ctl.pitchwheel.bendrange);}
        code1 {o->lstep(100);}
      }
      Fl_Check_Button {} {
        label FMamp
        callback {part->ctl.fmamp.receive=(int) o->value();}
        tooltip {FM amplitude enable} xywh {205 55 60 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10
        code0 {o->value(part->ctl.fmamp.receive);}
      }
      Fl_Check_Button {} {
        label Vol
        callback {part->ctl.volume.receive=(int) o->value();}
        tooltip {Volume enable} xywh {155 80 45 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10
        code0 {o->value(part->ctl.volume.receive);}
      }
      Fl_Check_Button {} {
        label Sustain
        callback {part->ctl.sustain.receive=(int) o->value();
if (part->ctl.sustain.receive==0) {
  part->RelaseSustainedKeys();
  part->ctl.setsustain(0);
};}
        tooltip {Sustain pedal enable} xywh {205 80 60 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10
        code0 {o->value(part->ctl.sustain.receive);}
      }
      Fl_Button {} {
        label Close
        callback {ctlwindow->hide();}
        xywh {330 105 95 20} box THIN_UP_BOX
      }
      Fl_Button {} {
        label {Reset all controllers}
        callback {part->SetController(C_resetallcontrollers,0);}
        xywh {5 105 210 20} box THIN_UP_BOX
      }
      Fl_Group {} {
        label Portamento open
        xywh {280 15 120 85} box ENGRAVED_FRAME labelfont 1 labelsize 10
      } {
        Fl_Check_Button {} {
          label Rcv
          callback {part->ctl.portamento.receive=(int) o->value();}
          tooltip {Receive Portamento Controllers} xywh {285 20 40 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10
          code0 {o->value(part->ctl.portamento.receive);}
        }
        Fl_Dial {} {
          label time
          callback {part->ctl.portamento.time=(int) o->value();}
          tooltip {Portamento time} xywh {285 60 25 25} labelsize 10 maximum 127 step 1
          code0 {o->value(part->ctl.portamento.time);}
          class WidgetPDial
        }
        Fl_Counter {} {
          label thresh
          callback {part->ctl.portamento.pitchthresh=(int) o->value();}
          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->value(part->ctl.portamento.pitchthresh);}
        }
        Fl_Check_Button {} {
          label {th.type}
          callback {part->ctl.portamento.pitchthreshtype=(int) o->value();}
          tooltip {Threshold type (min/max)} xywh {370 70 15 15} down_box DOWN_BOX labelsize 10 align 2
          code0 {o->value(part->ctl.portamento.pitchthreshtype);}
        }
        Fl_Box {} {
          label {x100 cnt.}
          xywh {340 50 55 15} labelsize 10 align 16
        }
        Fl_Dial {} {
          label {t.dn/up}
          callback {int x=(int) o->value();

part->ctl.portamento.updowntimestretch=x;}
          tooltip {Portamento time stretch (up/down)} xywh {315 60 25 25} labelsize 10 maximum 127 step 1
          code0 {o->value(part->ctl.portamento.updowntimestretch);}
          class WidgetPDial
        }
      }
      Fl_Group {} {
        label Resonance open
        xywh {400 15 45 85} box ENGRAVED_BOX labelfont 1 labelsize 10
      } {
        Fl_Dial {} {
          label BWdpth
          callback {part->ctl.resonancebandwidth.depth=(int) o->value();}
          tooltip {BandWidth controller depth} xywh {410 60 25 25} labelsize 10 maximum 127 step 1
          code0 {o->value(part->ctl.resonancebandwidth.depth);}
          class WidgetPDial
        }
        Fl_Dial {} {
          label CFdpth
          callback {part->ctl.resonancecenter.depth=(int) o->value();}
          tooltip {Center Frequency controller Depth} xywh {410 20 25 25} labelsize 10 maximum 127 step 1
          code0 {o->value(part->ctl.resonancecenter.depth);}
          class WidgetPDial
        }
      }
      Fl_Check_Button {} {
        label {Exp MWh}
        callback {part->ctl.modwheel.exponential=(int) o->value();}
        tooltip {Exponential modulation wheel} xywh {10 15 40 25} down_box DOWN_BOX labelsize 10 align 148
        code0 {o->value(part->ctl.modwheel.exponential);}
      }
      Fl_Check_Button {} {
        label {Exp BW}
        callback {part->ctl.bandwidth.exponential=(int) o->value();}
        tooltip {Exponential BandWidth Controller} xywh {85 15 35 25} down_box DOWN_BOX labelsize 10 align 148
        code0 {o->value(part->ctl.bandwidth.exponential);}
      }
    }
    Fl_Window partfx {
      label {Part's Insert Effects}
      private xywh {121 424 390 145} type Double hide
    } {
      Fl_Counter inseffnocounter {
        label {FX No.}
        callback {ninseff=(int) o->value()-1;
insefftype->value(part->partefx[ninseff]->geteffect());
//insefftype->do_callback();
inseffectui->refresh(part->partefx[ninseff]);
int x=part->Pefxroute[ninseff];
if (x==127) x=1;
bypasseff->value(part->Pefxbypass[ninseff]);

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 {master->busy=true;
part->partefx[ninseff]->changeeffect((int) o->value());
master->busy=false;
inseffectui->refresh(part->partefx[ninseff]);}
        xywh {155 110 70 15} down_box BORDER_BOX labelsize 11 align 6
        code0 {o->value(part->partefx[ninseff]->geteffect());}
      } {
        menuitem {} {
          label {No Effect}
          xywh {35 35 100 20} labelfont 1 labelsize 11
        }
        menuitem {} {
          label Reverb
          xywh {45 45 100 20} labelfont 1 labelsize 11
        }
        menuitem {} {
          label Echo
          xywh {55 55 100 20} labelfont 1 labelsize 11
        }
        menuitem {} {
          label Chorus
          xywh {65 65 100 20} labelfont 1 labelsize 11
        }
        menuitem {} {
          label Phaser
          xywh {70 70 100 20} labelfont 1 labelsize 11
        }
        menuitem {} {
          label AlienWah
          xywh {80 80 100 20} labelfont 1 labelsize 11
        }
        menuitem {} {
          label Distortion
          xywh {90 90 100 20} labelfont 1 labelsize 11
        }
        menuitem {} {
          label EQ
          xywh {100 100 100 20} labelfont 1 labelsize 11
        }
        menuitem {} {
          label DynFilter
          xywh {110 110 100 20} labelfont 1 labelsize 11
        }
      }
      Fl_Group inseffectuigroup {
        xywh {5 5 380 100} box FLAT_BOX color 48
      } {
        Fl_Group inseffectui {
          xywh {5 5 380 95}
          code0 {o->init(part->partefx[ninseff]);}
          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 {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 11 align 6
        code0 {int x=part->Pefxroute[ninseff]; if (x==127) x=1;}
        code1 {o->value(x);}
      } {
        menuitem {} {
          label {Next Effect}
          xywh {45 45 100 20} labelfont 1 labelsize 11
        }
        menuitem {} {
          label {Part Out}
          xywh {55 55 100 20} labelfont 1 labelsize 11
        }
        menuitem {} {
          label {Dry Out}
          xywh {65 65 100 20} labelfont 1 labelsize 11
        }
      }
      Fl_Check_Button bypasseff {
        label bypass
        callback {part->Pefxbypass[ninseff]=(((int)o->value())!=0);}
        tooltip {if the effect is not used (is bypassed)} xywh {90 110 60 15} down_box DOWN_BOX labelsize 12
        code0 {int x=part->Pefxbypass[ninseff];o->value(x);}
      }
      Fl_Button {} {
        label C
        callback {presetsui->copy(part->partefx[ninseff]);}
        xywh {90 127 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
      }
      Fl_Button {} {
        label P
        callback {master->busy=true;
presetsui->paste(part->partefx[ninseff],inseffectui);
master->busy=false;}
        xywh {120 127 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
      }
    }
    Fl_Window instrumentkitlist {
      label {Instrument Kit}
      xywh {113 324 670 370} type Double hide
    } {
      Fl_Button {} {
        label {Close Window}
        callback {instrumentkitlist->hide();}
        xywh {375 350 160 20} box THIN_UP_BOX
      }
      Fl_Scroll kitlist {
        xywh {0 15 670 330} type VERTICAL box THIN_UP_BOX
        code0 {if (part->Pkitmode==0) o->deactivate();}
      } {
        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(part,i,master,this);}}
        } {}
      }
      Fl_Box {} {
        label {No.}
        xywh {5 0 25 15} labelfont 1 labelsize 12 align 18
      }
      Fl_Box {} {
        label {M.}
        xywh {55 0 25 15} labelfont 1 labelsize 12 align 18
      }
      Fl_Box {} {
        label {Min.k}
        xywh {235 0 40 15} labelfont 1 labelsize 12 align 18
      }
      Fl_Box {} {
        label {Max.k}
        xywh {345 0 40 15} labelfont 1 labelsize 12 align 18
      }
      Fl_Box {} {
        label ADsynth
        xywh {405 0 50 15} labelfont 1 labelsize 12 align 18
      }
      Fl_Box {} {
        label SUBsynth
        xywh {470 0 60 15} labelfont 1 labelsize 12 align 18
      }
      Fl_Choice {} {
        label Mode
        callback {part->Pkitmode=(int) o->value();
if (part->Pkitmode==0) {
     kitlist->deactivate();
 } else {
 kitlist->activate();
};}
        xywh {35 350 70 15} down_box BORDER_BOX labelsize 12 textfont 1 textsize 12
        code0 {o->value(part->Pkitmode);}
      } {
        menuitem {} {
          label OFF
          xywh {0 0 100 20} labelfont 1 labelsize 12
        }
        menuitem {} {
          label MULTI
          xywh {10 10 100 20} labelfont 1 labelsize 12
        }
        menuitem {} {
          label SINGLE
          xywh {20 20 100 20} labelfont 1 labelsize 12
        }
      }
      Fl_Check_Button {} {
        label {Drum mode}
        callback {part->Pdrummode=(int) o->value();}
        xywh {285 350 70 15} down_box DOWN_BOX labelsize 11
        code0 {o->value(part->Pdrummode);}
      }
      Fl_Box {} {
        label {FX.r.}
        xywh {620 0 30 15} labelfont 1 labelsize 12 align 18
      }
      Fl_Box {} {
        label PADsynth
        xywh {540 0 60 15} labelfont 1 labelsize 12 align 18
      }
    }
    Fl_Window instrumenteditwindow {
      label {Instrument Edit}
      xywh {182 214 395 360} type Double hide
    } {
      Fl_Group {} {
        xywh {0 220 395 110} box ENGRAVED_FRAME
      } {
        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} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 18 align 128
            code0 {if (part->kit[0].Ppadenabled==0) o->deactivate();}
          }
          Fl_Check_Button padsynenabledcheck {
            label Enabled
            callback {int x=(int) o->value();
part->kit[0].Ppadenabled=x;
if (x==0) padeditbutton->deactivate();
     else padeditbutton->activate();}
            tooltip {enable/disable PADsynth} xywh {215 255 80 20} box PLASTIC_UP_BOX down_box DOWN_BOX color 222 selection_color 218 labelfont 1 labelsize 12
            code1 {o->value(part->kit[0].Ppadenabled);}
          }
        }
        Fl_Group {} {
          label ADDsynth
          xywh {5 245 100 80} box ENGRAVED_FRAME labelfont 1
        } {
          Fl_Check_Button adsynenabledcheck {
            label Enabled
            callback {int x=(int) o->value();
part->kit[0].Padenabled=x;
if (x==0) adeditbutton->deactivate();
     else adeditbutton->activate();}
            tooltip {enable/disable ADsynth} xywh {15 255 80 20} box PLASTIC_UP_BOX down_box DOWN_BOX color 222 selection_color 218 labelfont 1 labelsize 12
            code1 {o->value(part->kit[0].Padenabled);}
          }
          Fl_Button adeditbutton {
            label Edit
            callback {showparameters(0,0);}
            xywh {15 281 80 34} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 18 align 128
            code0 {if (part->kit[0].Padenabled==0) o->deactivate();}
          }
        }
        Fl_Group {} {
          label SUBsynth
          xywh {105 245 100 80} box ENGRAVED_FRAME labelfont 1
        } {
          Fl_Check_Button subsynenabledcheck {
            label Enabled
            callback {int x=(int) o->value();
part->kit[0].Psubenabled=x;
if (x==0) subeditbutton->deactivate();
     else subeditbutton->activate();}
            tooltip {enable/disable SUBsynth} xywh {115 255 80 20} box PLASTIC_UP_BOX down_box DOWN_BOX color 222 selection_color 218 labelfont 1 labelsize 12
            code1 {o->value(part->kit[0].Psubenabled);}
          }
          Fl_Button subeditbutton {
            label Edit
            callback {showparameters(0,1);}
            xywh {115 280 80 35} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 18 align 128
            code0 {if (part->kit[0].Psubenabled==0) o->deactivate();}
          }
        }
        Fl_Button {} {
          label {Kit Edit}
          callback {instrumentkitlist->show();}
          xywh {310 245 80 35} box PLASTIC_UP_BOX color 238 selection_color 220 labelfont 1 align 128
        }
        Fl_Button {} {
          label Effects
          callback {partfx->show();}
          xywh {310 290 80 35} box PLASTIC_UP_BOX color 230 labelfont 1 labelsize 16
        }
      }
      Fl_Group {} {
        xywh {0 5 395 215} box ENGRAVED_FRAME
      } {
        Fl_Input {} {
          label {Author and Copyright}
          callback {snprintf((char *)part->info.Pauthor,MAX_INFO_TEXT_SIZE,"%s",o->value());}
          xywh {5 60 385 50} type Multiline color 26 labelsize 10 align 5
          code0 {o->maximum_size(MAX_INFO_TEXT_SIZE);}
          code1 {o->value((char *) &part->info.Pauthor);}
        }
        Fl_Input {} {
          label Comments
          callback {snprintf((char *)part->info.Pcomments,MAX_INFO_TEXT_SIZE,"%s",o->value());}
          xywh {5 125 385 90} type Multiline color 26 labelsize 12 align 5
          code0 {o->maximum_size(MAX_INFO_TEXT_SIZE);}
          code1 {o->value((char *) &part->info.Pcomments);}
        }
        Fl_Choice {} {
          label {Type:}
          callback {part->info.Ptype=o->value();}
          xywh {5 25 155 20} down_box BORDER_BOX labelfont 1 labelsize 12 align 5 textsize 11
          code0 {o->value(part->info.Ptype);}
        } {
          menuitem {} {
            label {--------------------------}
            xywh {20 20 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label Piano
            xywh {10 10 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label {Chromatic Percussion}
            xywh {20 20 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label Organ
            xywh {30 30 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label Guitar
            xywh {40 40 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label Bass
            xywh {50 50 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label {Solo Strings}
            xywh {60 60 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label Ensemble
            xywh {70 70 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label Brass
            xywh {80 80 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label Reed
            xywh {90 90 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label Pipe
            xywh {100 100 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label {Synth Lead}
            xywh {110 110 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label {Synth Pad}
            xywh {120 120 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label {Synth Effects}
            xywh {130 130 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label Ethnic
            xywh {140 140 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label Percussive
            xywh {150 150 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label {Sound Effects}
            xywh {160 160 100 20} labelfont 1 labelsize 12
          }
        }
      }
      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_Group(x,y,w,h,label)} {} {
    code {part=NULL;
adnoteui=NULL;
subnoteui=NULL;
padnoteui=NULL;
lastkititem=-1;} {}
  }
  Function {init(Part *part_,Master *master_,int npart_,BankUI *bankui_)} {} {
    code {bankui=bankui_;
part=part_;
npart=npart_;
master=master_;
ninseff=0;

make_window();
partgroup->position(this->parent()->x()+2,this->parent()->y()+2);
partgroup->show();
end();


//if (config.ui.showinstrumentinfo!=0) instrumenteditwindow->show();

int klimits[]={1,2,3,4,5,6,7,8,9,10,15,20,30,50,100,0};

keylimitlist->add("OFF");
int k=0;
int val=-1;
char tmp[10];
while (klimits[k]!=0){
	sprintf(tmp,"%d",klimits[k]);
	keylimitlist->add(tmp);
	if ((val==-1)){
		if (klimits[k]>part->Pkeylimit) val=k;
	};
	k++;
};

if (val==-1) val=k;
keylimitlist->value(val);} {}
  }
  Function {showparameters(int kititem,int engine)} {} {
    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;
};

if (kititem!=lastkititem){
    if (adnoteui!=NULL) delete (adnoteui);
    if (subnoteui!=NULL) delete (subnoteui);   
    if (padnoteui!=NULL) delete (padnoteui);
    adnoteui=NULL;subnoteui=NULL;padnoteui=NULL;
    lastkititem=kititem;

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

    if (part->kit[kititem].adpars!=NULL) 
      adnoteui=new ADnoteUI(part->kit[kititem].adpars,master);

    if (part->kit[kititem].subpars!=NULL) 
       subnoteui=new SUBnoteUI(part->kit[kititem].subpars);

    if (part->kit[kititem].padpars!=NULL) 
      padnoteui=new PADnoteUI(part->kit[kititem].padpars,master);

};



if ((engine==0)&&(adnoteui!=NULL)) adnoteui->ADnoteGlobalParameters->show();
if ((engine==1)&&(subnoteui!=NULL)) subnoteui->SUBparameters->show();
if ((engine==2)&&(adnoteui!=NULL)) padnoteui->padnotewindow->show();} {}
  }
  Function {~PartUI()} {} {
    code {if (adnoteui!=NULL) delete (adnoteui);
if (subnoteui!=NULL) delete (subnoteui);
if (padnoteui!=NULL) delete (padnoteui);

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

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

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

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

instrumenteditwindow->hide();
delete(instrumenteditwindow);} {}
  }
  decl {Part *part;} {}
  decl {Master *master;} {}
  decl {BankUI *bankui;} {}
  decl {ADnoteUI *adnoteui;} {}
  decl {SUBnoteUI *subnoteui;} {}
  decl {PADnoteUI *padnoteui;} {}
  decl {PartSysEffSend *psyef[NUM_SYS_EFX];} {}
  decl {int npart;} {}
  decl {int ninseff;} {}
  decl {int lastkititem;} {}
  decl {PartKitItem *partkititem[NUM_KIT_ITEMS];} {}
}