# data file for the Fltk User Interface Designer (fluid)
version 1.0302 
header_name {.h} 
code_name {.cc}
decl {\#include "../Params/PADnoteParameters.h"} {public local
} 

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

decl {\#include <FL/Fl_Box.H>} {public local
} 

decl {\#include <FL/Fl_Group.H>} {public local
} 

decl {\#include <FL/Fl_File_Chooser.H>} {public local
} 

decl {\#include <math.h>} {private local
} 

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

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

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

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

decl {\#include "Osc_IntModel.h"} {private local
}

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

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

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

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

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

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

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

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

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

class PADnoteUI {open : {public PresetsUI_}
} {
  Function {PADnoteUI(std::string location_, Fl_Osc_Interface *osc_)} {open
  } {
    code {assert(osc_);
assert(!location_.empty());

location=location_;
oscui=NULL;
osc_i = osc_;
resui=new ResonanceUI(osc_i, location+"resonance/");
initialized = false;
applybutton = NULL;
make_window();
apply_watcher = new Osc_IntModel(osc_i);
apply_watcher->callback=[this](int needsPrepare) {
    if(needsPrepare) {
        applybutton->color(FL_RED);
        applybutton->redraw();
        if(oscui) {
            oscui->applybutton->color(FL_RED);
            oscui->applybutton->redraw();
        }
        if(resui) {
            resui->applybutton->color(FL_RED);
            resui->applybutton->redraw();
        }
    } else {
        applybutton->color(FL_GRAY);
        applybutton->redraw();
        if(oscui) {
            oscui->applybutton->color(FL_GRAY);
            oscui->applybutton->redraw();
        }
        if(resui) {
            resui->applybutton->color(FL_GRAY);
            resui->applybutton->redraw();
        }
    }
};
apply_watcher->doUpdate(location+"needPrepare");
initialized = true;} {}
  }
  Function {make_window()} {open
  } {
    Fl_Window padnotewindow {
      label {PAD synth Parameters} open
      xywh {52 324 535 430} type Double hide
      class Fl_Osc_Window
    } {

      Fl_Box dummy {
        xywh {25 25 25 25}
        code0 {padnotewindow->init(osc_i, location);}
      }
      Fl_Tabs {} {
        callback {if (o->value()!=harmonicstructuregroup) applybutton->hide();
	else applybutton->show();} open
        xywh {0 0 535 395} box UP_FRAME
      } {
        Fl_Group harmonicstructuregroup {
          label {Harmonic Structure} open
          xywh {0 20 535 375} box UP_FRAME
          class Fl_Osc_Group
        } {
          Fl_Group bwprofilegroup {open
            xywh {5 30 90 260} box UP_FRAME
            class Fl_Osc_Group
          } {
            Fl_Dial hpbasepar1 {
              label Width
              callback {if(hpui) hpui->update();
cbwidget->do_callback();}
              xywh {20 75 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
              code2 {o->init("Php.base.par1");o->reset_value=80;}
              class Fl_Osc_Dial
            }
            Fl_Choice hpbasetype {
              label {Base Type}
              callback {if(initialized) {hprofile->redraw();
 hpui->update();
cbwidget->do_callback();}}
              xywh {15 45 75 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
              code0 {o->init("Php.base.type");}
              class Fl_Osc_Choice
            } {
              MenuItem {} {
                label Gauss
                xywh {15 15 100 20} labelfont 1 labelsize 10
              }
              MenuItem {} {
                label Square
                xywh {25 25 100 20} labelfont 1 labelsize 10
              }
              MenuItem {} {
                label DoubleExp
                xywh {35 35 100 20} labelfont 1 labelsize 10
              }
            }
            Fl_Dial hpfreqmult {
              label FreqMlt
              callback {hpui->update();
cbwidget->do_callback();}
              xywh {55 75 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
              code0 {o->init("Php.freqmult");}
              class Fl_Osc_Dial
            }
            Fl_Dial hpmpar1 {
              label Str
              callback {hpui->update();
cbwidget->do_callback();}
              xywh {15 115 20 20} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
              code0 {o->init("Php.modulator.par1");}
              class Fl_Osc_Dial
            }
            Fl_Dial hpmfreq {
              label SFreq
              callback {hpui->update();
cbwidget->do_callback();}
              xywh {40 115 20 20} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
              code0 {o->init("Php.modulator.freq");o->reset_value=30;}
              class Fl_Osc_Dial
            }
            Fl_Group {} {
              xywh {10 160 80 105} box BORDER_BOX
            } {
              Fl_Choice hpamptype {
                label AmpMultiplier
                callback {if(initialized) {hprofile->redraw();
                hpui->update();
cbwidget->do_callback();}}
                xywh {15 175 70 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
                code0 {o->init("Php.amp.type");}
                class Fl_Osc_Choice
              } {
                MenuItem {} {
                  label OFF
                  xywh {45 45 100 20} labelfont 1 labelsize 10
                }
                MenuItem {} {
                  label Gauss
                  xywh {55 55 100 20} labelfont 1 labelsize 10
                }
                MenuItem {} {
                  label Sine
                  xywh {65 65 100 20} labelfont 1 labelsize 10
                }
                MenuItem {} {
                  label Flat
                  xywh {75 75 100 20} labelfont 1 labelsize 10
                }
              }
              Fl_Choice hpampmode {
                label AmpMode
                callback {if(initialized) {hpui->update();
cbwidget->do_callback();}}
                xywh {15 205 70 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
                code0 {o->init("Php.amp.mode");}
                class Fl_Osc_Choice
              } {
                MenuItem {} {
                  label Sum
                  xywh {60 60 100 20} labelfont 1 labelsize 10
                }
                MenuItem {} {
                  label Mult
                  xywh {70 70 100 20} labelfont 1 labelsize 10
                }
                MenuItem {} {
                  label Div1
                  xywh {80 80 100 20} labelfont 1 labelsize 10
                }
                MenuItem {} {
                  label Div2
                  xywh {90 90 100 20} labelfont 1 labelsize 10
                }
              }
              Fl_Dial hpamppar1 {
                label Par1
                callback {hpui->update();
cbwidget->do_callback();}
                xywh {15 235 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
                code0 {o->init("Php.amp.par1");o->reset_value=80;}
                class Fl_Osc_Dial
              }
              Fl_Dial hpamppar2 {
                label Par2
                callback {hpui->update();
cbwidget->do_callback();}
                xywh {55 235 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
                code0 {o->init("Php.amp.par2");o->reset_value=64;}
                class Fl_Osc_Dial
              }
            }
            Fl_Check_Button hpautoscale {
              label autoscale
              callback {
              if(initialized) {
                  hpui->update();
                  hprofile->redraw();
              cbwidget->do_callback();}}
              xywh {10 270 60 15} down_box DOWN_BOX labelsize 10
              code0 {o->init("Php.autoscale");}
              class Fl_Osc_Check
            }
            Fl_Choice hponehalf {
              callback {if(initialized) {hprofile->redraw();
hpui->update();
cbwidget->do_callback();}}
              xywh {10 143 80 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
              code0 {o->init("Php.onehalf");}
              class Fl_Osc_Choice
            } {
              MenuItem {} {
                label Full
                xywh {25 25 100 20} labelfont 1 labelsize 10
              }
              MenuItem {} {
                label {Upper Half}
                xywh {45 45 100 20} labelfont 1 labelsize 10
              }
              MenuItem {} {
                label {Lower Half}
                xywh {35 35 100 20} labelfont 1 labelsize 10
              }
            }
            Fl_Dial hpwidth {
              label Size
              callback {hpui->update();
cbwidget->do_callback();}
              xywh {65 115 20 20} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
              code0 {o->init("Php.width");o->reset_value=127;}
              class Fl_Osc_Dial
            }
          }
          Fl_Group oscilgroup {open
            xywh {100 155 270 135} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 align 6
            code0 {oscilgroup->base = location; oscilgroup->ext="oscilgen/"; oscilgroup->osc = osc_i;}
            code1 {osc=new Fl_Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");osc->init(false);}
            class Fl_Osc_Group
          } {}
          Fl_Button {} {
            label Change
            callback {if (oscui!=NULL) delete (oscui);
oscui=new OscilEditor(false, location+"oscilgen/",osc_i);}
            xywh {375 270 60 20} box THIN_UP_BOX labelfont 1 labelsize 11
          }
          Fl_Box cbwidget {
            label {Harmonic Content}
            callback {opui->update();
            if(applybutton) {
                applybutton->color(FL_RED);
                applybutton->redraw();}}
            xywh {125 135 205 20} align 16
          }
          Fl_Button {} {
            label Resonance
            callback {resui->resonancewindow->redraw();
resui->resonancewindow->show();
resui->setcbwidget(cbwidget,applybutton);}
            xywh {375 225 80 20} box THIN_UP_BOX
          }
          Fl_Dial bwdial {
            label BandWidth
            callback {o->oscWrite("bandwidthvalue");cbwidget->do_callback();}
            xywh {15 295 35 35} box ROUND_UP_BOX labelsize 10 maximum 1000 step 1
            code0 {o->init("Pbandwidth");o->reset_value=500;}
            class Fl_Osc_Dial
          }
          Fl_Value_Output bwcents {
            label cents
            xywh {55 305 55 15} labelsize 10 align 6 maximum 10000 step 0.1
            code0 {o->init("bandwidthvalue");}
            class Fl_Osc_Output
          }
          Fl_Group {} {open
            xywh {315 295 215 45} box UP_FRAME
          } {
            Fl_Choice hrpostype {
              label OvertonesPosition
              callback {if(initialized) {opui->update();
cbwidget->do_callback();}}
              xywh {325 310 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 11
              code0 {o->init("Phrpos.type");}
              class Fl_Osc_Choice
            } {
              MenuItem {} {
                label Harmonic
                xywh {70 70 100 20} labelfont 1 labelsize 11
              }
              MenuItem {} {
                label ShiftU
                xywh {80 80 100 20} labelfont 1 labelsize 11
              }
              MenuItem {} {
                label ShiftL
                xywh {90 90 100 20} labelfont 1 labelsize 11
              }
              MenuItem {} {
                label PowerU
                xywh {90 90 100 20} labelfont 1 labelsize 11
              }
              MenuItem {} {
                label PowerL
                xywh {100 100 100 20} labelfont 1 labelsize 11
              }
              MenuItem {} {
                label Sine
                xywh {110 110 100 20} labelfont 1 labelsize 11
              }
              MenuItem {} {
                label Power
                xywh {120 120 100 20} labelfont 1 labelsize 11
              }
              MenuItem {} {
                label Shift selected
                xywh {130 130 100 20} labelfont 1 labelsize 11
              }
            }
            Fl_Dial hrpospar1 {
              label Par1
              callback {opui->update();
                  hpui->update();
cbwidget->do_callback();}
              xywh {425 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 255 step 1
              code0 {o->init("Phrpos.par1");o->reset_value=64;}
              class Fl_Osc_Dial
            }
            Fl_Dial hrpospar2 {
              label Par2
              callback {opui->update();
cbwidget->do_callback();}
              xywh {460 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 255 step 1
              code0 {o->init("Phrpos.par2");o->reset_value=64;}
              class Fl_Osc_Dial
            }
            Fl_Dial hrpospar3 {
              label ForceH
              callback {opui->update();
cbwidget->do_callback();}
              xywh {495 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 255 step 1
              code0 {o->init("Phrpos.par3");}
              class Fl_Osc_Dial
            }
          }
          Fl_Choice bwscale {
            label {Bandwidth Scale}
            callback {if(initialized) {cbwidget->do_callback();}}
            xywh {120 305 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 11
            code0 {o->init("Pbwscale");}
            class Fl_Osc_Choice
          } {
            MenuItem {} {
              label Normal
              xywh {95 95 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label EqualHz
              xywh {105 105 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label Quater
              xywh {115 115 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label Half
              xywh {125 125 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label {75%}
              xywh {135 135 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label {150%}
              xywh {145 145 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label Double
              xywh {145 145 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label {Inv.Half}
              xywh {155 155 100 20} labelfont 1 labelsize 11
            }
          }
          Fl_Group overtonepos {
            xywh {5 345 525 45} box FLAT_BOX color 51 selection_color 218 labelcolor 63
            code0 {opui=new PADnoteOvertonePosition(o->x(),o->y(),o->w(),o->h(),"");}
            code1 {opui->init();}
          } {}
          Fl_Choice qsamplesize {
            label {Sample Size}
            callback {if(initialized) {cbwidget->do_callback();}}
            xywh {375 190 115 20} down_box BORDER_BOX labelsize 10 align 5 textsize 11
            code0 {o->init("Pquality.samplesize");}
            class Fl_Osc_Choice
          } {
            MenuItem {} {
              label {16k (Tiny)}
              xywh {155 155 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label 32k
              xywh {165 165 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label {64k (Small)}
              xywh {175 175 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label 128k
              xywh {185 185 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label {256k (Normal)}
              xywh {205 205 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label 512k
              xywh {200 200 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label {1M (Big)}
              xywh {205 205 100 20} labelfont 1 labelsize 11
            }
          }
          Fl_Choice qsmpoct {
            label {smp/oct}
            callback {if(initialized) cbwidget->do_callback();}
            xywh {430 155 45 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11
            code0 {o->init("Pquality.smpoct");}
            class Fl_Osc_Choice
          } {
            MenuItem {} {
              label {0.5}
              xywh {10 10 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label 1
              xywh {0 0 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label 2
              xywh {10 10 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label 3
              xywh {20 20 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label 4
              xywh {30 30 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label 6
              xywh {40 40 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label 12
              xywh {50 50 100 20} labelfont 1 labelsize 11
            }
          }
          Fl_Choice qoct {
            label {no.oct}
            callback {if(initialized) cbwidget->do_callback();}
            xywh {480 155 45 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11
            code0 {o->init("Pquality.oct");}
            class Fl_Osc_Choice
          } {
            MenuItem {} {
              label 1
              xywh {10 10 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label 2
              xywh {20 20 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label 3
              xywh {30 30 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label 4
              xywh {40 40 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label 5
              xywh {50 50 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label 6
              xywh {60 60 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label 7
              xywh {70 70 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label 8
              xywh {80 80 100 20} labelfont 1 labelsize 11
            }
          }
          Fl_Choice qbasenote {
            label base
            callback {if(initialized) cbwidget->do_callback();}
            xywh {375 155 50 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11
            code0 {o->init("Pquality.basenote");}
            class Fl_Osc_Choice
          } {
            MenuItem {} {
              label {C-2}
              xywh {10 10 100 20} labelfont 1
            }
            MenuItem {} {
              label {G-2}
              xywh {20 20 100 20} labelfont 1
            }
            MenuItem {} {
              label {C-3}
              xywh {20 20 100 20} labelfont 1
            }
            MenuItem {} {
              label {G-3}
              xywh {30 30 100 20} labelfont 1
            }
            MenuItem {} {
              label {C-4}
              xywh {30 30 100 20} labelfont 1
            }
            MenuItem {} {
              label {G-4}
              xywh {40 40 100 20} labelfont 1
            }
            MenuItem {} {
              label {C-5}
              xywh {40 40 100 20} labelfont 1
            }
            MenuItem {} {
              label {G-5}
              xywh {50 50 100 20} labelfont 1
            }
            MenuItem {} {
              label {G-6}
              xywh {60 60 100 20} labelfont 1
            }
          }
          Fl_Group hprofile {
            xywh {100 45 430 90} box FLAT_BOX color 51 selection_color 218 labelcolor 63
            code0 {hpui=new PADnoteHarmonicProfile(o->x(),o->y(),o->w(),o->h(),"");}
            code1 {hpui->init();}
          } {}
          Fl_Box {} {
            label {Profile of One Harmonic (Frequency Distribution)}
            xywh {160 25 315 20}
          }
          Fl_Choice spectrummode {
            label {Spectrum Mode}
            callback {
if (o->value()==0){
   bwprofilegroup->activate();
   bwdial->activate();
   bwcents->activate();
   hprofile->activate();
   hprofile->color(51);
   bwscale->activate();
} else {
   bwprofilegroup->deactivate();
   bwdial->deactivate();
   bwcents->deactivate();
   hprofile->deactivate();
   hprofile->color(48);
   bwscale->deactivate();
};

hpui->update();
cbwidget->do_callback();}
            xywh {220 305 90 20} down_box BORDER_BOX labelfont 1 labelsize 10 align 5 textsize 11
            code0 {o->init("Pmode");}
            class Fl_Osc_Choice
          } {
            MenuItem {} {
              label Bandwidth
              xywh {105 105 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label Discrete
              xywh {125 125 100 20} labelfont 1 labelsize 11
            }
            MenuItem {} {
              label Continuous
              xywh {115 115 100 20} labelfont 1 labelsize 11
            }
          }
        }
        Fl_Group {} {
          label {Envelopes&LFOs} open
          xywh {0 20 535 375} box UP_FRAME hide
        } {
          Fl_Group {} {
            label FREQUENCY open
            xywh {5 275 525 115} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
          } {
            Fl_Group freqenv {
              label {PADSynth - Frequency Envelope} open
              xywh {10 315 205 70} box FLAT_BOX color 51 align 144
              code0 {o->init(ENV_ASR, osc_i, location, "FreqEnvelope/");}
              class EnvelopeUI
            } {}
            Fl_Counter octave {
              label Octave
              tooltip Octave xywh {470 295 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11
              code0 {o->init("octave");}
              class Fl_Osc_Counter
            }
            Fl_Counter coarsedet {
              label {Coarse det.}
              tooltip {Coarse Detune} xywh {455 365 70 20} type Simple labelsize 10 align 5 minimum -64 maximum 63 step 1 textfont 1 textsize 11
              code0 {o->init("coarsedetune");}
              code3 {o->lstep(10);}
              class Fl_Osc_Counter
            }
            Fl_Group freqlfo {
              label {Frequency LFO     } open
              xywh {215 315 230 70} box FLAT_BOX color 47 align 144
              code0 {o->init(osc_i, location, "FreqLfo/");}
              class LFOUI
            } {}
            Fl_Slider detune {
              callback {o->oscWrite("detunevalue");}
              tooltip {Fine Detune (cents)} xywh {60 296 295 15} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1
              code0 {o->init("PDetune", 'i');}
              class Fl_Osc_Slider
            }
            Fl_Value_Output detunevalueoutput {
              label Detune
              xywh {12 296 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10
              code0 {o->init("detunevalue");}
              class Fl_Osc_Output
            }
            Fl_Choice detunetype {
              label {Detune Type}
              callback {o->oscWrite("detunevalue");} open
              xywh {450 330 75 20} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
              code0 {o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");}
              code1 {o->init("PDetuneType",1);}
              class Fl_Osc_Choice
            } {}
            Fl_Dial bendadjustdial {
              label Bend
              tooltip {How the frequency varies according to the pitch wheel} xywh {60 278 15 15} box ROUND_UP_BOX labelsize 10 align 8 minimum -64 maximum 63 step 1
              code0 {o->init("PBendAdjust");o->reset_value=24;o->set_transform([](float x){return x/24.0f;});o->set_rounding(2);}
              class Fl_Osc_Dial
            }
            Fl_Dial offsethzdial {
              label Offset
              tooltip {Offset of frequency in Hz} xywh {110 278 15 15} box ROUND_UP_BOX labelsize 10 align 8 minimum -64 maximum 63 step 1
              code0 {o->init("POffsetHz"); o->set_rounding(2); o->set_transform([](float x){x/=64; return 15*(x*sqrtf(fabsf(x)));});}
              class Fl_Osc_Dial
            }
            Fl_Check_Button hz440 {
              label 440Hz
              callback {if (o->value()==0) fixedfreqetdial->deactivate();
   else fixedfreqetdial->activate();}
              tooltip {set the base frequency to 440Hz} xywh {365 295 50 15} down_box DOWN_BOX labelfont 1 labelsize 10
              code0 {o->init("Pfixedfreq");}
              class Fl_Osc_Check
            }
            Fl_Dial fixedfreqetdial {
              label {Eq.T.}
              tooltip {How the frequency varies according to the keyboard (leftmost for fixed frequency)} xywh {420 295 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1
              code0 {o->init("PfixedfreqET");}
              class Fl_Osc_Dial
            }
          }
          Fl_Group {} {
            label AMPLITUDE open
            xywh {5 25 240 250} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
          } {
            Fl_Value_Slider volume {
              label Vol
              tooltip Volume xywh {10 50 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1
              code0 {o->init("PVolume", 'i');o->reset_value=90;}
              class Fl_Osc_VSlider
            }
            Fl_Value_Slider vsns {
              label {V.Sns}
              tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 70 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1
              code0 {o->init("PAmpVelocityScaleFunction");o->reset_value=64;}
              class Fl_Osc_VSlider
            }
            Fl_Dial pan {
              label Pan
              tooltip {Panning (leftmost is Random)} xywh {210 45 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
              code0 {o->init("PPanning");o->reset_value=64;}
              class Fl_Osc_Dial
            }
            Fl_Dial {} {
              label De-pop selected
              tooltip {Pop suppression} xywh {208 238 20 20} type Float labelsize 10 maximum 127 step 1 textfont 1 textsize 11
              code0 {o->init("Fadein_adjustment");o->reset_value=20;}
              class Fl_Osc_Dial
            }
            Fl_Dial pstr {
              label {P.Str.}
              tooltip {Punch Strength} xywh {78 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
              code0 {o->init("PPunchStrength");}
              class Fl_Osc_Dial
            }
            Fl_Dial pt {
              label {P.t.}
              tooltip {Punch Time (duration)} xywh {108 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
              code0 {o->init("PPunchTime");o->reset_value=60;}
              class Fl_Osc_Dial
            }
            Fl_Dial pstc {
              label {P.Stc.}
              tooltip {Punch Stretch} xywh {138 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
              code0 {o->init("PPunchStretch");o->reset_value=64;}
              class Fl_Osc_Dial
            }
            Fl_Dial pvel {
              label {P.Vel.}
              tooltip {Punch Velocity Sensing} xywh {168 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
              code0 {o->init("PPunchVelocitySensing");o->reset_value=72;}
              class Fl_Osc_Dial
            }
            Fl_Group ampenv {
              label {PADSynth - Amplitude Envelope} open
              xywh {10 95 205 70} box FLAT_BOX color 51 align 144
              code0 {o->init(ENV_ADSR, osc_i, location, "AmpEnvelope/");}
              class EnvelopeUI
            } {}
            Fl_Group amplfo {
              label {Amplitude LFO     } open
              xywh {10 165 230 70} box FLAT_BOX color 47 align 144
              code0 {o->init(osc_i, location, "AmpLfo/");}
              class LFOUI
            } {}
            Fl_Check_Button stereo {
              label Stereo
              callback {hprofile->redraw();}
              xywh {10 245 70 25} down_box DOWN_BOX labelsize 12
              code0 {o->init("PStereo");}
              class Fl_Osc_Check
            }
          }
          Fl_Group {} {
            label FILTER open
            xywh {245 25 285 250} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
          } {
            Fl_Group filterenv {
              label {PADSynth - Filter Envelope} open
              xywh {250 130 275 70} box FLAT_BOX color 51 align 144
              code0 {o->init(ENV_ADSR_FILTER, osc_i, location, "FilterEnvelope/");}
              class EnvelopeUI
            } {}
            Fl_Group filterlfo {
              label {Filter LFO     } open
              xywh {250 200 230 70} box FLAT_BOX color 47 align 144
              code0 {o->init(osc_i, location, "FilterLfo/");}
              class LFOUI
            } {}
            Fl_Group filterui {
              label {PADsynth - Filter} open
              xywh {250 50 275 75} box FLAT_BOX color 50 align 144
              code0 {o->init(location + "PFilter",
              osc_i, location, "GlobalFilter/");}
              class FilterUI
            } {}
          }
        }
      }
      Fl_Button applybutton {
        label {Apply Changes}
        callback {osc_i->requestValue(location+"prepare");
//MiddleWare::preparePadSynth(location.c_str(), pars);
o->color(FL_GRAY);
if (oscui!=NULL) {
	oscui->applybutton->color(FL_GRAY);
	oscui->applybutton->redraw();
};
if (resui!=NULL) {
	resui->applybutton->color(FL_GRAY);
	resui->applybutton->redraw();
};}
        xywh {200 400 135 25} box THIN_UP_BOX
        code0 {o->color(FL_RED);}
      }
      Fl_Button {} {
        label Close
        callback {padnotewindow->hide();}
        xywh {470 400 60 25} box THIN_UP_BOX
      }
      Fl_Button {} {
        label C
        callback {presetsui->copy(padnotewindow->loc());}
        xywh {400 405 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
      }
      Fl_Button {} {
        label P
        callback {presetsui->paste(padnotewindow->loc(),this);}
        xywh {430 405 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
      }
      Fl_Button {} {
        label export
        callback {char *filename;
filename=fl_file_chooser("Export samples:","(*.wav)",NULL,0);
if (filename==NULL) return;
fl_filename_setext(filename,"");
o->oscWrite("export2wav", "s", filename);}
        tooltip {export samples as wav file} xywh {5 400 55 25} box THIN_UP_BOX color 51 labelsize 11 align 128
        class Fl_Osc_Button
      }
    }
  }
  Function {refresh()} {open
  } {
    code {amplfo->refresh();
freqlfo->refresh();
filterlfo->refresh();

ampenv->refresh();
freqenv->refresh();
filterenv->refresh();
filterui->refresh();


/* harmonic structure parametrs */

resui->refresh();
if (oscui) oscui->refresh();

if (spectrummode->value()==0){
   bwprofilegroup->activate();
   bwdial->activate();
   bwcents->activate();
   hprofile->activate();
   hprofile->color(51);
   bwscale->activate();
} else {
   bwprofilegroup->deactivate();
   bwdial->deactivate();
   bwcents->deactivate();
   hprofile->deactivate();
   hprofile->color(48);
   bwscale->activate();
};

hprofile->redraw();
opui->update();

osc->redraw();
//MiddleWare::preparePadSynth(location.c_str(), pars);
applybutton->color(FL_GRAY);
applybutton->parent()->redraw();} {}
  }
  Function {~PADnoteUI()} {} {
    code {
delete apply_watcher;
delete(oscui);
delete(resui);


padnotewindow->hide();
delete padnotewindow;} {}
  }
  decl {OscilEditor *oscui;} {public local
  }
  decl {bool initialized;}{private local
  }
  decl {Fl_Oscilloscope *osc;} {public local
  }
  decl {ResonanceUI *resui;} {public local
  }
  decl {std::string location;} {private local
  }
  decl {Fl_Osc_Interface *osc_i;} {private local
  }
  decl {PADnoteHarmonicProfile *hpui;} {private local
  }
  decl {PADnoteOvertonePosition *opui;} {private local
  }
  decl {class Osc_IntModel *apply_watcher;} {private local
  }
} 
