From b703eab295330e6f81564fbb39a10a1a2fdd2f54 Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Sun, 27 Dec 2009 11:30:35 +0000 Subject: moved old qt4 branch --- .../synti/zynaddsubfx/UI/VirKeyboard.fl | 400 +++++++++++++++++++++ 1 file changed, 400 insertions(+) create mode 100644 muse_qt4_evolution/synti/zynaddsubfx/UI/VirKeyboard.fl (limited to 'muse_qt4_evolution/synti/zynaddsubfx/UI/VirKeyboard.fl') diff --git a/muse_qt4_evolution/synti/zynaddsubfx/UI/VirKeyboard.fl b/muse_qt4_evolution/synti/zynaddsubfx/UI/VirKeyboard.fl new file mode 100644 index 00000000..aed2c930 --- /dev/null +++ b/muse_qt4_evolution/synti/zynaddsubfx/UI/VirKeyboard.fl @@ -0,0 +1,400 @@ +# data file for the Fltk User Interface Designer (fluid) +version 1.0106 +header_name {.h} +code_name {.cc} +decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} + +decl {//License: GNU GPL version 2} {} + +decl {\#include } {public +} + +decl {\#include } {public +} + +decl {\#include } {public +} + +decl {\#include "../globals.h"} {public +} + +decl {\#include "../Misc/Master.h"} {public +} + +decl {\#include "../Input/MidiIn.h"} {public +} + +decl {\#include "WidgetPDial.h"} {public +} + +decl {const int keyspos[12]={0,-1,1,-2,2,3,-4,4,-5,5,-6,6};} {} + +decl {const int keysoct1qw[]={'q','2','w','3','e','r','5','t','6','y','7','u','i','9','o','0','p','[','=',']','\\\\',FL_Enter,0};} {} + +decl {const int keysoct2qw[]={'z','s','x','d','c','v','g','b','h','n','j','m',',','l','.',';','/',0};} {} + +decl {const int keysoct1dw[]={'\\'','2',',','3','.','p','5','y','6','f','7','g','c','9','r','0','l','/',']','=','\\\\',FL_Enter,0};} {} + +decl {const int keysoct2dw[]={';','o','q','e','j','k','i','x','d','b','h','m','w','n','v','s','z',0};} {} + +class VirKeys {: {public Fl_Box} +} { + decl {static const int N_OCT=6;} {} + decl {static const int SIZE_WHITE=14;} {} + decl {static const int SIZE_BLACK=8;} {} + Function {VirKeys(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { + code {master=NULL;} {} + } + Function {init(Master *master_)} {} { + code {master=master_; +for (int i=0;i=0){//white keys + if (pressed[i]==0) fl_color(250,240,230); + else fl_color(FL_BLUE); + fl_rectf(ox+(kv+7*noct)*SIZE_WHITE+3,oy+ly*3/5+2, + SIZE_WHITE-4,ly*2/5-3); + } else {//black keys + kv=keyspos[(i+1)%12]; + if (pressed[i]==0) fl_color(FL_BLACK); + else fl_color(FL_BLUE); + fl_rectf(ox+(kv+7*noct)*SIZE_WHITE-SIZE_BLACK/2+2,oy+2, + SIZE_BLACK-3,ly*3/5-5); + }; +};} {} + } + Function {handle(int event)} {return_type int + } { + code {int i; +int ly=h(); +int x_=Fl::event_x()-x(); +int y_=Fl::event_y()-y(); +if ( (x_<0)&&(x_>w()) && (y_<0)&&(y_>h())){ + return(0); +}; + + +if ((event==FL_PUSH)||(event==FL_DRAG)||(event==FL_RELEASE)){ + int kpos=-1; + + if (y_>ly*3/5){//white keys + int pos=x_/SIZE_WHITE; + if (pos<0) return(1); + for (i=0;i<12;i++) { + if (pos%7==keyspos[i]) { + kpos=pos/7*12+i; + break; + }; + }; + } else {//black keys + int pos=(x_+SIZE_WHITE/2)/SIZE_WHITE; + if (pos<0) return(1); + for (i=1;i<12;i++) { + if (pos%7==-keyspos[i]) { + kpos=pos/7*12+i; + break; + }; + }; + }; + + if (((event==FL_PUSH)||(event==FL_DRAG))&& + (Fl::event_shift()==0)) { + presskey(kpos,1,1); + }; + + if ((event==FL_PUSH)&&(Fl::event_shift()!=0)) { + if (pressed[kpos]==0) presskey(kpos,0,1); + else relasekey(kpos,1); + }; + if ((event==FL_RELEASE)&&(Fl::event_shift()==0)) + relaseallkeys(1); + take_focus(); +}; + + +const int *keysoct1=keysoct1qw; +const int *keysoct2=keysoct2qw; + +if (config.cfg.VirKeybLayout==2) { + keysoct1=keysoct1dw; + keysoct2=keysoct2dw; +}; + +if ((event==FL_KEYDOWN)||(event==FL_KEYUP)){ + int key=Fl::event_key(); + int kpos=-1; + for (i=0;keysoct1[i]!=0;i++) if (key==keysoct1[i]) kpos=i+12*keyoct1; + for (i=0;keysoct2[i]!=0;i++) if (key==keysoct2[i]) kpos=i+12*keyoct2; + + if (kpos==-1) return(0); + if (event==FL_KEYDOWN) presskey(kpos,0,2); + else relasekey(kpos,2); +}; + +return(1);} {} + } + Function {presskey(int nk,int exclusive,int type)} {} { + code {if (nk>=N_OCT*12) return; +if ((nk<0)&&(exclusive==0)) { + relaseallkeys(type); + return; +}; +if (pressed[nk]!=0) return;//the key is already pressed + +if (exclusive!=0) relaseallkeys(type); +pressed[nk]=type; + +damage(1); +float vel=midivel; +if (rndvelocity!=0){ + vel=midivel*(127.0-rndvelocity)/127.0+RND*rndvelocity; +}; + +master->busy=true; + master->NoteOn(midich,nk+midioct*12,(int)vel); +master->busy=false;} {} + } + Function {relasekey(int nk,int type)} {} { + code {if ((nk<0)||(nk>=N_OCT*12)) return; +if (pressed[nk]==0) return;//the key is not pressed +if ((type!=0)&&(pressed[nk]!=type)) return; + +pressed[nk]=0; + + +damage(1); + +master->busy=true; + master->NoteOff(midich,nk+12*midioct); +master->busy=false;} {} + } + Function {relaseallkeys(int type)} {} { + code {for (int i=0;ihide();} + xywh {95 563 650 130} type Double hide + } { + Fl_Box virkeys { + label Keyboard + xywh {10 10 590 80} box FLAT_BOX color 17 + code0 {o->init(master);} + class VirKeys + } + Fl_Counter {} { + label {"qwer.." Oct} + callback {relaseallkeys(); +virkeys->keyoct1=(int) o->value(); +virkeys->take_focus();} + tooltip {keys "q2w3er5t6y..." octave} xywh {380 95 45 15} type Simple labelsize 10 align 4 when 6 minimum 0 maximum 5 step 1 textfont 1 textsize 10 + code0 {o->value(virkeys->keyoct1);} + } + Fl_Counter {} { + label {"zxcv.." Oct} + callback {relaseallkeys(); +virkeys->keyoct2=(int) o->value(); +virkeys->take_focus();} + tooltip {keys "zsxdcvgbh..." octave} xywh {380 110 45 15} type Simple labelsize 10 align 4 when 6 minimum 0 maximum 5 step 1 textfont 1 textsize 10 + code0 {o->value(virkeys->keyoct2);} + } + Fl_Value_Slider {} { + label Vel + callback {virkeys->midivel=(int) o->value(); +virkeys->take_focus();} + tooltip Velocity xywh {95 105 100 15} type {Horz Knob} box FLAT_BOX labelsize 10 align 5 minimum 1 maximum 127 step 1 + code0 {o->value(virkeys->midivel);} + } + Fl_Counter {} { + label {Oct.} + callback {relaseallkeys(); +virkeys->midioct=(int) o->value(); +virkeys->take_focus();} + tooltip {Midi Octave} xywh {255 100 55 20} type Simple labelsize 12 align 4 when 6 minimum 0 maximum 5 step 1 textfont 1 textsize 12 + code0 {o->value(virkeys->midioct);} + } + Fl_Button {} { + label Close + callback {relaseallkeys(); +virkeyboardwindow->hide();} + xywh {545 105 55 20} box THIN_UP_BOX + } + Fl_Value_Slider {} { + label Cval + callback {int ctl=midictl; + +master->busy=true; + master->SetController(virkeys->midich,ctl,(int) o->value()); +master->busy=false; +virkeys->take_focus();} + tooltip {Controller value} xywh {605 10 15 115} type {Vert Fill} box ENGRAVED_BOX selection_color 229 labelsize 8 align 5 minimum 127 maximum 0 step 1 value 64 textsize 7 + } + Fl_Choice {} { + label Controller + callback {switch((int) o->value()+1){ + case 1: midictl=C_modwheel; break; + case 2: midictl=C_volume; break; + case 3: midictl=C_panning; break; + case 4: midictl=C_expression; break; + case 5: midictl=C_sustain; break; + case 6: midictl=C_portamento; break; + case 7: midictl=C_filterq; break; + case 8: midictl=C_filtercutoff; break; + case 9: midictl=C_bandwidth; break; + case 10: midictl=C_fmamp; break; + case 11: midictl=C_resonance_center; break; + case 12: midictl=C_resonance_bandwidth; break; + default: midictl=C_NULL; break; + +}; + + + +virkeys->take_focus();} + xywh {435 105 100 15} down_box BORDER_BOX labelsize 10 align 5 when 6 textfont 1 textsize 10 + code0 {midictl=C_filtercutoff;o->value(7);} + } { + menuitem {} { + label {01: Mod.Wheel} + xywh {0 0 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label {07: Volume} + xywh {10 10 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label {10: Panning} + xywh {20 20 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label {11: Expression} + xywh {30 30 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label {64: Sustain} + xywh {40 40 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label {65: Portamento} + xywh {50 50 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label {71: Filter Q} + xywh {60 60 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label {74: Filter Freq.} + xywh {70 70 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label {75: Bandwidth} + xywh {80 80 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label {76: FM Gain} + xywh {90 90 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label {77: Res. c. freq} + xywh {100 100 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label {78: Res. bw.} + xywh {110 110 100 20} labelfont 1 labelsize 10 + } + } + Fl_Roller pitchwheelroller { + label Pwh + callback {master->lock(); + master->SetController(virkeys->midich,C_pitchwheel,-(int) o->value()); +master->unlock(); +virkeys->take_focus();} + tooltip {Pitch Wheel} xywh {625 10 20 95} box PLASTIC_UP_BOX labelsize 8 align 1 when 3 minimum -8192 maximum 8192 step 64 + } + Fl_Button {} { + label R + callback {pitchwheelroller->value(0); +pitchwheelroller->do_callback();} + tooltip {Reset Pitch Bend} xywh {625 110 20 15} box THIN_UP_BOX labelfont 1 + } + Fl_Dial {} { + label Vrnd + callback {virkeys->rndvelocity=(int) o->value();} + tooltip {Velocity Randomness} xywh {205 105 20 20} box ROUND_UP_BOX labelsize 10 align 129 maximum 127 step 1 + code0 {o->value(virkeys->rndvelocity);} + class WidgetPDial + } + Fl_Choice partrcv { + label {MIDI Ch.} + callback {relaseallkeys(); +virkeys->midich=(int) o->value(); +virkeys->take_focus();} open + tooltip {Send to Midi Channel} xywh {20 105 65 20} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 + code0 {char nrstr[10]; for(int i=0;iadd(nrstr); else o->add("Drum10");};} + code1 {o->value(virkeys->midich);} + } {} + } + } + Function {VirKeyboard(Master *master_)} {} { + code {master=master_; +midictl=75; +make_window();} {} + } + Function {show()} {} { + code {virkeyboardwindow->show();} {} + } + Function {relaseallkeys()} {} { + code {virkeys->relaseallkeys(0);} {} + } + decl {Master *master;} {} + decl {int midictl;} {} +} -- cgit v1.2.3