# data file for the Fltk User Interface Designer (fluid)
version 1.0105 
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 "../globals.h"} {public
} 

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

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

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

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

decl {\#include "../Params/SUBnoteParameters.h"} {public
} 

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

class SUBnoteharmonic {: {public Fl_Group}
} {
  Function {make_window()} {private
  } {
    Fl_Window harmonic {
      xywh {329 403 90 225} type Double hide
      class Fl_Group
    } {
      Fl_Slider mag {
        callback {int x=0;
if (Fl::event_button1()) x=127-(int)o->value();
   else o->value(127-x);
pars->Phmag[n]=x;
if (pars->Phmag[n]==0) o->selection_color(0);
    else o->selection_color(222);}
        tooltip {harmonic's magnitude} xywh {0 15 10 115} type {Vert Knob} box FLAT_BOX selection_color 222 labelcolor 0 maximum 127 step 1 value 127
        code0 {o->value(127-pars->Phmag[n]);}
        code1 {if (pars->Phmag[n]==0) o->selection_color(0);}
      }
      Fl_Slider bw {
        callback {int x=64;
if (Fl::event_button1()) x=127-(int)o->value();
   else o->value(x);
pars->Phrelbw[n]=x;}
        tooltip {harmonic's bandwidth} xywh {0 135 10 75} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 64
        code0 {o->value(127-pars->Phrelbw[n]);}
      }
      Fl_Box {} {
        xywh {10 170 5 5} box FLAT_BOX color 45
        code0 {if (n+1==MAX_SUB_HARMONICS) o->hide();}
      }
      Fl_Box {} {
        label 01
        xywh {0 210 10 15} labelfont 1 labelsize 9 align 20
        code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));}
      }
      Fl_Box {} {
        label 01
        xywh {0 0 10 15} labelfont 1 labelsize 9 align 20
        code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));}
      }
    }
  }
  Function {SUBnoteharmonic(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
    code {n=0;} {}
  }
  Function {init(SUBnoteParameters *pars_,int n_)} {} {
    code {pars=pars_;
n=n_;
make_window();
harmonic->show();
end();} {}
  }
  Function {refresh()} {} {
    code {mag->value(127-pars->Phmag[n]);
if (pars->Phmag[n]==0) mag->selection_color(0);
bw->value(127-pars->Phrelbw[n]);} {selected
    }
  }
  Function {~SUBnoteharmonic()} {} {
    code {harmonic->hide();
hide();
//delete(harmonic);} {}
  }
  decl {SUBnoteParameters *pars;} {}
  decl {int n;} {}
} 

class SUBnoteUI {: {public PresetsUI_}
} {
  Function {make_window()} {} {
    Fl_Window SUBparameters {
      label {SUBsynth Parameters}
      xywh {26 214 735 390} type Double hide
    } {
      Fl_Scroll {} {
        xywh {5 140 435 245} type HORIZONTAL box THIN_UP_BOX
      } {
        Fl_Pack harmonics {open
          xywh {10 145 425 235} type HORIZONTAL
          code0 {for (int i=0;i<MAX_SUB_HARMONICS;i++){h[i]=new SUBnoteharmonic(0,0,15,o->h(),"");h[i]->init(pars,i);}}
        } {}
      }
      Fl_Button {} {
        label Close
        callback {SUBparameters->hide();}
        xywh {625 365 105 20} box THIN_UP_BOX labelfont 1 labelsize 12
      }
      Fl_Group {} {
        label AMPLITUDE
        xywh {5 5 215 135} box THIN_UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17
      } {
        Fl_Value_Slider vol {
          label Vol
          callback {pars->PVolume=(int)o->value();}
          tooltip Volume xywh {10 25 140 15} type {Horz Knob} box FLAT_BOX labelsize 12 align 8 maximum 127 step 1
          code0 {o->value(pars->PVolume);}
        }
        Fl_Value_Slider vsns {
          label {V.Sns}
          callback {pars->PAmpVelocityScaleFunction=(int) o->value();}
          tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 45 140 15} type {Horz Knob} box FLAT_BOX labelsize 12 align 8 maximum 127 step 1
          code0 {o->value(pars->PAmpVelocityScaleFunction);}
        }
        Fl_Dial pan {
          label Pan
          callback {pars->PPanning=(int) o->value();}
          tooltip {Panning (leftmost is Random)} xywh {185 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
          code0 {o->value(pars->PPanning);}
          class WidgetPDial
        }
        Fl_Group ampenv {
          label {SUBsynth - Amplitude Envelope} open
          xywh {10 65 205 70} box FLAT_BOX color 51 align 144
          code0 {o->init(pars->AmpEnvelope);}
          class EnvelopeUI
        } {}
      }
      Fl_Group {} {
        xywh {495 325 235 35} box THIN_UP_FRAME
      } {
        Fl_Counter filterstages {
          label {Filter Stages}
          callback {pars->Pnumstages=(int) o->value();}
          tooltip {How many times the noise is filtered} xywh {515 340 45 15} type Simple labelfont 1 labelsize 10 align 1 minimum 1 maximum 5 step 1 textsize 10
          code0 {o->value(pars->Pnumstages);}
        }
        Fl_Choice magtype {
          label {Mag.Type}
          callback {pars->Phmagtype=(int) o->value();}
          xywh {585 340 65 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 12
          code0 {o->value(pars->Phmagtype);}
        } {
          menuitem {} {
            label Linear
            xywh {20 20 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label {-40dB}
            xywh {30 30 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label {-60dB}
            xywh {40 40 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label {-80dB}
            xywh {50 50 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label {-100dB}
            xywh {60 60 100 20} labelfont 1 labelsize 12
          }
        }
        Fl_Choice start {
          label Start
          callback {pars->Pstart=(int) o->value();} open
          xywh {670 340 50 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 12
          code0 {o->value(pars->Pstart);}
        } {
          menuitem {} {
            label Zero
            xywh {30 30 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label RND
            xywh {40 40 100 20} labelfont 1 labelsize 12
          }
          menuitem {} {
            label {Max.}
            xywh {50 50 100 20} labelfont 1 labelsize 12
          }
        }
      }
      Fl_Group freqsettingsui {
        label FREQUENCY
        xywh {440 5 290 135} box THIN_UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17
      } {
        Fl_Group freqenvelopegroup {
          label {SUBsynth - Frequency Envelope} open
          xywh {445 65 205 70} box FLAT_BOX color 51 align 144
          code0 {o->init(pars->FreqEnvelope);}
          code1 {if (pars->PFreqEnvelopeEnabled==0) o->deactivate();}
          class EnvelopeUI
        } {}
        Fl_Check_Button freqee {
          label Enabled
          callback {pars->PFreqEnvelopeEnabled=o->value();
if (o->value()==0) freqenvelopegroup->deactivate();
    else freqenvelopegroup->activate();
o->show();
freqsettingsui->redraw();}
          xywh {445 68 55 15} down_box DOWN_BOX labelfont 1 labelsize 10
          code0 {o->value(pars->PFreqEnvelopeEnabled);}
        }
        Fl_Counter octave {
          label Octave
          callback {int k=(int) o->value();
if (k<0) k+=16;
pars->PCoarseDetune = k*1024+
   pars->PCoarseDetune%1024;}
          tooltip Octave xywh {670 50 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 12
          code0 {int k=pars->PCoarseDetune/1024;if (k>=8) k-=16;}
          code2 {o->value(k);}
        }
        Fl_Counter coarsedet {
          label {Coarse Det.}
          callback {int k=(int) o->value();
if (k<0) k+=1024;
pars->PCoarseDetune = k+
   (pars->PCoarseDetune/1024)*1024;}
          tooltip {Coarse Detune} xywh {655 115 60 20} labelsize 11 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 12
          code0 {int k=pars->PCoarseDetune%1024;if (k>=512) k-=1024;}
          code2 {o->value(k);}
          code3 {o->lstep(10);}
        }
        Fl_Slider detune {
          callback {pars->PDetune=(int)o->value()+8192;
detunevalueoutput->do_callback();}
          tooltip {Fine Detune (cents)} xywh {495 25 230 15} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1
          code0 {o->value(pars->PDetune-8192);}
        }
        Fl_Value_Output detunevalueoutput {
          label Detune
          callback {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));}
          xywh {448 25 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10
          code0 {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));}
        }
        Fl_Check_Button hz440 {
          label 440Hz
          callback {int x=(int) o->value();
pars->Pfixedfreq=x;
if (x==0) fixedfreqetdial->deactivate();
   else fixedfreqetdial->activate();}
          tooltip {set the base frequency to 440Hz} xywh {555 45 50 15} down_box DOWN_BOX labelfont 1 labelsize 11
          code0 {o->value(pars->Pfixedfreq);}
        }
        Fl_Dial fixedfreqetdial {
          label {Eq.T.}
          callback {pars->PfixedfreqET=(int) o->value();}
          tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {610 45 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1
          code0 {o->value(pars->PfixedfreqET);}
          code1 {if (pars->Pfixedfreq==0) o->deactivate();}
          class WidgetPDial
        }
        Fl_Choice detunetype {
          label {Detune Type}
          callback {pars->PDetuneType=(int) o->value()+1;
detunevalueoutput->do_callback();} open
          xywh {655 85 70 15} 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->value(pars->PDetuneType-1);}
        } {}
      }
      Fl_Check_Button stereo {
        label Stereo
        callback {pars->Pstereo=(int) o->value();}
        xywh {440 325 55 35} box THIN_UP_BOX down_box DOWN_BOX labelfont 1 labelsize 10
        code0 {o->value(pars->Pstereo);}
      }
      Fl_Button {} {
        label Clear
        callback {for (int i=0;i<MAX_SUB_HARMONICS;i++){
    h[i]->mag->value(127);
    pars->Phmag[i]=0;
    h[i]->bw->value(64);
    pars->Phrelbw[i]=64;
};
pars->Phmag[0]=127;
h[0]->mag->value(0);
SUBparameters->redraw();}
        tooltip {Clear the harmonics} xywh {445 365 70 20} box THIN_UP_BOX labelfont 1 labelsize 12
      }
      Fl_Group bandwidthsettingsui {
        label BANDWIDTH
        xywh {220 5 220 135} box THIN_UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17
      } {
        Fl_Group bandwidthenvelopegroup {
          label {SUBsynth - BandWidth Envelope} open
          xywh {225 65 205 70} box FLAT_BOX color 51 align 144
          code0 {o->init(pars->BandWidthEnvelope);}
          code1 {if (pars->PBandWidthEnvelopeEnabled==0) o->deactivate();}
          class EnvelopeUI
        } {}
        Fl_Check_Button bwee {
          label Enabled
          callback {pars->PBandWidthEnvelopeEnabled=o->value();
if (o->value()==0) bandwidthenvelopegroup->deactivate();
    else bandwidthenvelopegroup->activate();
o->show();
bandwidthsettingsui->redraw();}
          xywh {225 67 55 15} down_box DOWN_BOX labelfont 1 labelsize 10
          code0 {o->value(pars->PBandWidthEnvelopeEnabled);}
        }
        Fl_Value_Slider bandwidth {
          label {Band Width}
          callback {pars->Pbandwidth=(int) o->value();}
          xywh {225 40 115 15} type {Horz Knob} box FLAT_BOX labelsize 10 align 1 maximum 127 step 1
          code0 {o->value(pars->Pbandwidth);}
        }
        Fl_Value_Slider bwidthscale {
          label {B.Width Scale}
          callback {pars->Pbwscale=(int) o->value()+64;}
          tooltip {How much I increase the BandWidth according to lower/higher harmonics} xywh {345 40 90 15} type {Horz Knob} box FLAT_BOX labelsize 10 align 1 minimum -64 maximum 63 step 1
          code0 {o->value(pars->Pbwscale-64);}
        }
      }
      Fl_Group globalfiltergroup {
        label FILTER
        xywh {440 140 290 185} box THIN_UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 17
        code0 {if (pars->PGlobalFilterEnabled==0) o->deactivate();}
      } {
        Fl_Group filterenv {
          label {SUBsynth - Filter Envelope} open
          xywh {445 250 275 70} box FLAT_BOX color 51 align 144
          code0 {o->init(pars->GlobalFilterEnvelope);}
          class EnvelopeUI
        } {}
        Fl_Group filterui {
          label {SUBsynthl - Filter} open
          xywh {445 170 275 75} box FLAT_BOX color 50 align 144
          code0 {o->init(pars->GlobalFilter,&pars->PGlobalFilterVelocityScale,&pars->PGlobalFilterVelocityScaleFunction);}
          class FilterUI
        } {}
      }
      Fl_Check_Button filtere {
        label Enabled
        callback {pars->PGlobalFilterEnabled=o->value();
if (o->value()==0) globalfiltergroup->deactivate();
    else globalfiltergroup->activate();
o->show();
globalfiltergroup->redraw();}
        xywh {445 145 85 20} down_box DOWN_BOX labelfont 1 labelsize 12
        code0 {o->value(pars->PGlobalFilterEnabled);}
      }
      Fl_Button {} {
        label C
        callback {presetsui->copy(pars);}
        xywh {540 370 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
      }
      Fl_Button {} {
        label P
        callback {presetsui->paste(pars,this);}
        xywh {570 370 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
      }
    }
  }
  Function {refresh()} {} {
    code {for (int i=0;i<MAX_SUB_HARMONICS;i++) h[i]->refresh();
vol->value(pars->PVolume);
vsns->value(pars->PAmpVelocityScaleFunction);
pan->value(pars->PPanning);


bandwidth->value(pars->Pbandwidth);
bwidthscale->value(pars->Pbwscale-64);
bwee->value(pars->PBandWidthEnvelopeEnabled);
if (pars->PBandWidthEnvelopeEnabled==0) bandwidthenvelopegroup->deactivate();
    else bandwidthenvelopegroup->activate();
bwee->show();
bandwidthsettingsui->redraw();

detunevalueoutput->value(getdetune(pars->PDetuneType,0,pars->PDetune));
freqee->value(pars->PFreqEnvelopeEnabled);
if (pars->PFreqEnvelopeEnabled==0) freqenvelopegroup->deactivate();
    else freqenvelopegroup->activate();
freqee->show();
freqsettingsui->redraw();

detune->value(pars->PDetune-8192);
hz440->value(pars->Pfixedfreq);

fixedfreqetdial->value(pars->PfixedfreqET);

int k=pars->PCoarseDetune/1024;if (k>=8) k-=16;
octave->value(k);

detunetype->value(pars->PDetuneType-1);

k=pars->PCoarseDetune%1024;if (k>=512) k-=1024;
coarsedet->value(k);

filtere->value(pars->PGlobalFilterEnabled);
if (pars->PGlobalFilterEnabled==0) globalfiltergroup->deactivate();
    else globalfiltergroup->activate();
filtere->show();
globalfiltergroup->redraw();

stereo->value(pars->Pstereo);
filterstages->value(pars->Pnumstages);
magtype->value(pars->Phmagtype);
start->value(pars->Pstart);

ampenv->refresh();
bandwidthenvelopegroup->refresh();
freqenvelopegroup->refresh();
filterui->refresh();
filterenv->refresh();} {}
  }
  Function {SUBnoteUI(SUBnoteParameters *parameters)} {} {
    code {pars=parameters;
make_window();} {}
  }
  Function {~SUBnoteUI()} {} {
    code {//for (int i=0;i<MAX_SUB_HARMONICS;i++) delete (h[i]);
SUBparameters->hide();
delete(SUBparameters);} {}
  }
  decl {SUBnoteParameters *pars;} {}
  decl {SUBnoteharmonic *h[MAX_SUB_HARMONICS];} {}
}