summaryrefslogtreecommitdiff
path: root/attic/muse_qt4_evolution/synti/zynaddsubfx/UI/PartUI.fl
blob: a3a91782a658498fdc4d7c6bd5877da36d37fba3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
# 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];} {}
}