# data file for the Fltk User Interface Designer (fluid) version 1.0107 header_name {.h} code_name {.cc} decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} decl {//License: GNU GPL version 2 or later} {} decl {\#include } {public } decl {\#include } {public } decl {\#include } {public } decl {\#include } {public } decl {\#include } {public } decl {\#include "../Misc/Master.h"} {public } decl {\#include "../Misc/Bank.h"} {public } decl {\#include "../Misc/Config.h"} {public } class BankProcess_ {} { Function {process()} {open return_type {virtual void} } {} decl {Bank *bank;} {public } } class BankSlot {open : {public Fl_Button,BankProcess_} } { Function {BankSlot(int x,int y, int w, int h, const char *label=0):Fl_Button(x,y,w,h,label)} {} { code {what=NULL; whatslot=NULL; nslot=0; nselected=NULL;} {} } Function {handle(int event)} {return_type int } { code {if (what==NULL) return(0); if (Fl::event_inside(this)){ *what=0;*whatslot=nslot; if ((event==FL_RELEASE)&&(Fl::event_button()==1))*what=1; if ((event==FL_RELEASE)&&(Fl::event_button()==3))*what=2; if (event==FL_PUSH) highlight=1; }else highlight=0; int tmp=Fl_Button::handle(event); if ((*what!=0) && Fl::event_inside(this)) (bp->*fnc)(); return(tmp);} {} } Function {init(int nslot_, int *what_, int *whatslot_,void (BankProcess_:: *fnc_)(void),BankProcess_ *bp_,Bank *bank_,int *nselected_)} {open } { code {nslot=nslot_; what=what_; whatslot=whatslot_; fnc=fnc_; bp=bp_; bank=bank_; nselected=nselected_; box(FL_THIN_UP_BOX); labelfont(0); labelsize(13); align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP); highlight=0; refresh();} {selected } } Function {refresh()} {} { code {if (bank->emptyslot(nslot)) { color(46); } else { if (bank->isPADsynth_used(nslot)) color(26); else color(51); }; if (*nselected==nslot) color(6); label(bank->getnamenumbered(nslot));} {} } decl {int *what,*whatslot,nslot,highlight, *nselected;} {} decl {void (BankProcess_:: *fnc)(void);} {} decl {BankProcess_ *bp;} {} } class BankUI {: {public BankProcess_} } { Function {make_window()} {} { Fl_Window bankuiwindow { label Bank xywh {4 64 785 575} type Double hide code0 {o->label(bank->bankfiletitle);} code1 {if (bank->bankfiletitle==NULL) o->label ("Choose a bank from the bank list on the left (or go to settings if to configure the bank location) or choose 'New Bank...' to make a new bank.");} } { Fl_Button {} { label Close callback {bankuiwindow->hide();} xywh {705 546 70 24} box THIN_UP_BOX } Fl_Group {} { xywh {5 34 772 491} box ENGRAVED_FRAME } { Fl_Pack {} { xywh {10 39 150 481} box BORDER_BOX code0 {o->box(FL_NO_BOX);} code1 {for (int i=0;i<32;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);};} } {} Fl_Pack {} { xywh {163 39 150 481} box BORDER_BOX code0 {o->box(FL_NO_BOX);} code1 {for (int i=32;i<64;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);};} } {} Fl_Pack {} { xywh {316 39 150 481} box BORDER_BOX code0 {o->box(FL_NO_BOX);} code1 {for (int i=64;i<96;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);};} } {} Fl_Pack {} { xywh {469 39 150 481} box BORDER_BOX code0 {o->box(FL_NO_BOX);} code1 {for (int i=96;i<128;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);};} } {} Fl_Pack {} { xywh {622 39 150 481} box BORDER_BOX code0 {o->box(FL_NO_BOX);} code1 {for (int i=128;i<160;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);};} } {} } Fl_Group modeselect { xywh {5 528 425 42} box ENGRAVED_BOX } { Fl_Light_Button writebutton { label WRITE callback {if (o->value()>0.5) mode=2; removeselection();} xywh {116 534 99 30} type Radio box PLASTIC_UP_BOX down_box THIN_DOWN_BOX selection_color 1 labeltype ENGRAVED_LABEL labelfont 1 labelsize 13 code0 {if (bank->locked()) o->deactivate();} } Fl_Light_Button readbutton { label READ callback {if (o->value()>0.5) mode=1; removeselection();} xywh {11 534 99 30} type Radio box PLASTIC_UP_BOX down_box THIN_DOWN_BOX selection_color 101 labeltype ENGRAVED_LABEL labelfont 1 labelsize 13 code0 {o->value(1);} } Fl_Light_Button clearbutton { label CLEAR callback {if (o->value()>0.5) mode=3; removeselection();} xywh {221 534 99 30} type Radio box PLASTIC_UP_BOX down_box THIN_DOWN_BOX selection_color 0 labeltype ENGRAVED_LABEL labelfont 1 labelsize 13 code0 {if (bank->locked()) o->deactivate();} } Fl_Light_Button swapbutton { label SWAP callback {if (o->value()>0.5) mode=4; removeselection();} xywh {325 534 99 30} type Radio box PLASTIC_UP_BOX down_box THIN_DOWN_BOX selection_color 227 labeltype ENGRAVED_LABEL labelfont 1 labelsize 13 code0 {if (bank->locked()) o->deactivate();} } } Fl_Button {} { label {New Bank...} callback {const char *dirname; dirname=fl_input("New empty Bank:"); if (dirname==NULL) return; int result=bank->newbank(dirname); if (result!=0) fl_alert("Error: Could not make a new bank (directory).."); refreshmainwindow();} xywh {685 5 93 25} box PLASTIC_UP_BOX labelfont 1 labelsize 11 align 128 } Fl_Check_Button {} { label {auto close} callback {config.cfg.BankUIAutoClose=(int) o->value();} tooltip {automatically close the bank window if the instrument is loaded} xywh {705 529 60 15} down_box DOWN_BOX labelsize 10 code0 {o->value(config.cfg.BankUIAutoClose);} } Fl_Choice banklist { callback {int n=o->value(); char *dirname=bank->banks[n].dir; if (dirname==NULL) return; if (bank->loadbank(dirname)==2) fl_alert("Error: Could not load the bank from the directory\\n%s.",dirname); for (int i=0;irefresh(); refreshmainwindow();} open xywh {5 8 220 20} down_box BORDER_BOX labelfont 1 align 0 textfont 1 textsize 11 } {} Fl_Button {} { label {Refresh bank list} callback {rescan_for_banks(); banklist->value(0);} tooltip {Refresh the bank list (rescan)} xywh {230 8 105 20} box THIN_UP_BOX color 50 labelsize 11 } Fl_Check_Button {} { label {Show PADsynth status} callback {config.cfg.CheckPADsynth=(int) o->value(); refreshmainwindow();} xywh {435 530 150 15} down_box DOWN_BOX labelsize 11 code0 {o->value(config.cfg.CheckPADsynth);} } } } Function {BankUI(Master *master_,int *npart_)} {} { code {fnc=&BankProcess_::process; master=master_; npart=npart_; bank=&master_->bank; what=0; nselected=-1; make_window(); mode=1;} {} } Function {~BankUI()} {return_type virtual } { code {bankuiwindow->hide(); delete(bankuiwindow);} {} } Function {show()} {} { code {bankuiwindow->show(); simplesetmode(config.cfg.UserInterfaceMode==2);} {} } Function {hide()} {} { code {bankuiwindow->hide();} {} } Function {init(Fl_Valuator *cbwig_)} {} { code {cbwig=cbwig_; rescan_for_banks();} {} } Function {process()} {return_type void } { code {int slot=this->slot; if ((what==2)&&(bank->emptyslot(slot)==0)&&(mode!=4)) {//Rename slot const char *tmp=fl_input("Slot (instrument) name:",(const char *)bank->getname(slot)); if (tmp!=NULL) bank->setname(slot,tmp,-1); bs[slot]->refresh(); }; if ((what==1)&&(mode==1)&&(!bank->emptyslot(slot))){//Reads from slot pthread_mutex_lock(&master->mutex); bank->loadfromslot(slot,master->part[*npart]); pthread_mutex_unlock(&master->mutex); master->part[*npart]->applyparameters(); snprintf((char *)master->part[*npart]->Pname,PART_MAX_NAME_LEN,"%s",bank->getname(slot)); cbwig->do_callback(); if (config.cfg.BankUIAutoClose!=0) bankuiwindow->hide(); }; if ((what==1)&&(mode==2)){//save(write) to slot if (!bank->emptyslot(slot)){ if (!fl_choice("Overwrite the slot no. %d ?","No","Yes",NULL,slot+1)) goto nooverwriteslot; }; pthread_mutex_lock(&master->mutex); bank->savetoslot(slot,master->part[*npart]); pthread_mutex_unlock(&master->mutex); bs[slot]->refresh(); mode=1;readbutton->value(1);writebutton->value(0); nooverwriteslot:; }; if ((what==1)&&(mode==3)&&(!bank->emptyslot(slot))){//Clears the slot if (fl_choice("Clear the slot no. %d ?","No","Yes",NULL,slot+1)){ bank->clearslot(slot); bs[slot]->refresh(); }; }; if (mode==4){//swap bool done=false; if ((what==1)&&(nselected>=0)){ bank->swapslot(nselected,slot); int ns=nselected; nselected=-1; bs[slot]->refresh(); bs[ns]->refresh(); done=true; }; if (((nselected<0)||(what==2))&&(!done)){ int ns=nselected; nselected=slot; if (ns>0) bs[ns]->refresh(); bs[slot]->refresh(); }; }; if (mode!=4) refreshmainwindow();} {} } Function {refreshmainwindow()} {} { code {bankuiwindow->label(bank->bankfiletitle); mode=1;readbutton->value(1);writebutton->value(0);clearbutton->value(0);swapbutton->value(0); nselected=-1; if (bank->locked()){ writebutton->deactivate(); clearbutton->deactivate(); swapbutton->deactivate(); } else { writebutton->activate(); clearbutton->activate(); swapbutton->activate(); }; for (int i=0;irefresh();} {} } Function {removeselection()} {} { code {if (nselected>=0) { int ns=nselected; nselected=-1; bs[ns]->refresh(); };} {} } Function {rescan_for_banks()} {} { code {banklist->clear(); banklist->add(" "); bank->rescanforbanks(); for (int i=1;ibanks[i].name!=NULL) banklist->add(bank->banks[i].name); };} {} } Function {simplesetmode(bool beginnerui)} {} { code {readbutton->value(1); mode=1; removeselection(); if (beginnerui) modeselect->hide(); else modeselect->show();} {} } decl {BankSlot *bs[BANK_SIZE];} {} decl {int slot,what;//"what"=what button is pressed} {} decl {int mode,*npart,nselected;} {} decl {Master *master;} {} decl {void (BankProcess_::* fnc)(void);} {} decl {Fl_Valuator *cbwig;} {public } }