ControllerUI.fl (6364B)
1 # data file for the Fltk User Interface Designer (fluid) 2 version 1.0110 3 header_name {.h} 4 code_name {.cxx} 5 decl {\#include <FL/Fl_Box.H>} {selected public 6 } 7 8 decl {\#include <stdlib.h>} {public 9 } 10 11 decl {\#include "Controller.h"} {public 12 } 13 14 decl {Controller *controller;} {} 15 16 class Pad {: {public Fl_Box} 17 } { 18 Function {Pad(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { 19 code {} {} 20 } 21 Function {temp_draw()} {} { 22 code {/*int ox=x(),oy=y(),lx=w(),ly=h(),i,ix,iy,oiy; 23 float freqx; 24 25 fl_color(FL_BLACK); 26 fl_rectf(ox,oy,lx,ly); 27 28 29 30 fl_color(FL_GRAY); 31 32 fl_line_style(FL_SOLID); 33 fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); 34 */} {} 35 } 36 Function {sendmidi(int button,float datax,float datay)} {} { 37 code {controller->send(button,datax); 38 controller->send(button+1,datay);} {} 39 } 40 Function {handle(int event)} {return_type int 41 } { 42 code {int x_=Fl::event_x()-x(); 43 int y_=Fl::event_y()-y(); 44 45 if ((event==FL_PUSH)||(event==FL_DRAG)){ 46 if (x_<0) x_=0;if (y_<0) y_=0; 47 if (x_>=w()) x_=w();if (y_>=h()-1) y_=h()-1; 48 49 float tmpx=(float) x_/(w()); 50 float tmpy=1.0-(float) y_/h(); 51 52 int b=Fl::event_buttons()>>24; 53 54 if (b&1) sendmidi(0,tmpx,tmpy); 55 if (b&2) sendmidi(2,tmpx,tmpy); 56 if (b&4) sendmidi(4,tmpx,tmpy); 57 58 }; 59 60 return(1);} {} 61 } 62 decl {int oldx,oldy;} {} 63 } 64 65 class ControllerUI {} { 66 Function {make_window()} {} { 67 Fl_Window controlleruiwindow { 68 label {Midi Controller} 69 callback {o->hide(); 70 exit(0);} 71 xywh {210 213 340 410} type Double hide 72 } { 73 Fl_Counter {} { 74 label {Output Channel} 75 callback {controller->Pchout=(int) o->value();} 76 xywh {10 13 75 22} type Simple labelsize 10 align 5 minimum 0 maximum 15 step 1 textfont 1 77 code0 {o->value(controller->Pchout);} 78 } 79 Fl_Box {} { 80 xywh {10 80 320 320} box ENGRAVED_BOX color 176 81 class Pad 82 } 83 Fl_Choice {} { 84 callback {nbut=(int) o->value(); 85 refreshvalues();} 86 xywh {10 50 75 20} down_box BORDER_BOX 87 } { 88 MenuItem {} { 89 label {But.1 X} 90 xywh {0 0 100 20} labelfont 1 labelsize 12 91 } 92 MenuItem {} { 93 label {But.1 Y} 94 xywh {10 10 100 20} labelfont 1 labelsize 12 divider 95 } 96 MenuItem {} { 97 label {But.2 X} 98 xywh {10 10 100 20} labelfont 1 labelsize 12 99 } 100 MenuItem {} { 101 label {But.2 Y} 102 xywh {20 20 100 20} labelfont 1 labelsize 12 divider 103 } 104 MenuItem {} { 105 label {But.3 X} 106 xywh {20 20 100 20} labelfont 1 labelsize 12 107 } 108 MenuItem {} { 109 label {But.3 Y} 110 xywh {30 30 100 20} labelfont 1 labelsize 12 111 } 112 } 113 Fl_Group ctlgroup { 114 xywh {95 35 60 40} box ENGRAVED_BOX 115 } { 116 Fl_Counter ctlcounter { 117 label Controller 118 callback {controller->pars[nbut].ctl.par=(int) o->value();} 119 xywh {100 50 50 15} type Simple labelsize 10 align 1 minimum 0 maximum 127 step 1 textfont 1 textsize 12 120 } 121 } 122 Fl_Choice modechoice { 123 label Mode 124 callback {controller->pars[nbut].mode=(int) o->value(); 125 refreshvalues();} 126 xywh {95 13 60 20} down_box BORDER_BOX labelsize 10 align 5 127 } { 128 MenuItem {} { 129 label OFF 130 xywh {30 30 100 20} labelfont 1 labelsize 12 131 } 132 MenuItem {} { 133 label {Ctl.} 134 xywh {20 20 100 20} labelfont 1 labelsize 12 135 } 136 MenuItem {} { 137 label RPN 138 xywh {30 30 100 20} labelfont 1 labelsize 12 deactivate 139 } 140 MenuItem {} { 141 label NRPN 142 xywh {40 40 100 20} labelfont 1 labelsize 12 143 } 144 } 145 Fl_Group nrpngroup { 146 xywh {160 35 170 40} box ENGRAVED_BOX 147 } { 148 Fl_Counter cparcounter { 149 label {CoarseP.} 150 callback {controller->pars[nbut].nrpn.cpar=(int) o->value();} 151 xywh {165 50 50 15} type Simple labelsize 10 align 1 minimum 0 maximum 127 step 1 textfont 1 textsize 12 152 } 153 Fl_Counter fparcounter { 154 label {FineP.} 155 callback {controller->pars[nbut].nrpn.fpar=(int) o->value();} 156 xywh {220 50 50 15} type Simple labelsize 10 align 1 minimum 0 maximum 127 step 1 textfont 1 textsize 12 157 } 158 Fl_Counter cvalcounter { 159 label {CoarseV.} 160 callback {controller->pars[nbut].nrpn.cval=(int) o->value();} 161 xywh {275 50 50 15} type Simple labelsize 10 align 1 minimum 0 maximum 127 step 1 textfont 1 textsize 12 162 } 163 } 164 Fl_Counter val1counter { 165 label {Val.1} 166 callback {controller->pars[nbut].val1=(int) o->value();} 167 xywh {190 15 50 15} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 textfont 1 textsize 12 168 } 169 Fl_Counter val2counter { 170 label {Val.2} 171 callback {controller->pars[nbut].val2=(int) o->value();} 172 xywh {275 15 50 15} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 value 127 textfont 1 textsize 12 173 } 174 Fl_Button exchangebutton { 175 label {<->} 176 callback {unsigned char tmp=controller->pars[nbut].val2; 177 controller->pars[nbut].val2=controller->pars[nbut].val1; 178 controller->pars[nbut].val1=tmp; 179 refreshvalues();} 180 xywh {245 15 25 15} box THIN_UP_BOX 181 } 182 } 183 } 184 Function {refreshvalues()} {} { 185 code {modechoice->value(controller->pars[nbut].mode); 186 val1counter->value(controller->pars[nbut].val1); 187 val2counter->value(controller->pars[nbut].val2); 188 ctlcounter->value(controller->pars[nbut].ctl.par); 189 cparcounter->value(controller->pars[nbut].nrpn.cpar); 190 fparcounter->value(controller->pars[nbut].nrpn.fpar); 191 cvalcounter->value(controller->pars[nbut].nrpn.cval); 192 193 if (controller->pars[nbut].mode!=0){ 194 val1counter->activate(); 195 val2counter->activate(); 196 exchangebutton->activate(); 197 }else{ 198 val1counter->deactivate(); 199 val2counter->deactivate(); 200 exchangebutton->deactivate(); 201 }; 202 203 if (controller->pars[nbut].mode==1) ctlgroup->activate(); 204 else ctlgroup->deactivate(); 205 206 if (controller->pars[nbut].mode==3) nrpngroup->activate(); 207 else nrpngroup->deactivate();} {} 208 } 209 Function {ControllerUI(Controller *controller_)} {} { 210 code {nbut=0; 211 controller=controller_; 212 make_window(); 213 refreshvalues(); 214 controlleruiwindow->show();} {} 215 } 216 decl {int nbut;} {} 217 }