|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- # data file for the Fltk User Interface Designer (fluid)
- version 1.0110
- header_name {.h}
- code_name {.cc}
- decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {}
-
- decl {//License: GNU GPL version 2 or later} {}
-
- decl {\#include <stdlib.h>} {public
- }
-
- decl {\#include <stdio.h>} {public
- }
-
- decl {\#include <string.h>} {public
- }
-
- decl {\#include <FL/Fl_Button.H>} {public
- }
-
- decl {\#include <FL/Fl_File_Chooser.H>} {public
- }
-
- decl {\#include "../Misc/Master.h"} {public
- }
-
- decl {\#include "../Misc/Part.h"} {public
- }
-
- decl {\#include "../Misc/Bank.h"} {public
- }
-
- decl {\#include "../Misc/Config.h"} {public
- }
-
- decl {\#include "../Misc/Util.h"} {public
- }
-
- class BankProcess_ {} {
- Function {process()} {open return_type {virtual void}
- } {
- code {;} {}
- }
- 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)} {open
- } {
- code {what=NULL;
- whatslot=NULL;
- nslot=0;
- nselected=NULL;} {selected
- }
- }
- 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_)} {} {
- 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();} {}
- }
- Function {refresh()} {} {
- code {if (bank->emptyslot(nslot))
- color(46);
- else if (bank->isPADsynth_used(nslot))
- color(124);
- else
- color(51);
-
-
- if (*nselected==nslot)
- color(6);
-
-
- copy_label(bank->getnamenumbered(nslot).c_str());} {}
- }
- decl {int *what,*whatslot,nslot,highlight, *nselected;} {}
- decl {void (BankProcess_:: *fnc)(void);} {}
- decl {BankProcess_ *bp;} {}
- }
-
- class BankUI {open : {public BankProcess_}
- } {
- Function {make_window()} {open
- } {
- Fl_Window bankuiwindow {
- label Bank
- xywh {492 406 785 575} type Double
- code0 {o->label(bank->bankfiletitle.c_str());}
- code1 {if (bank->bankfiletitle.empty()) 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.");} visible
- } {
- 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_FRAME
- 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_FRAME
- 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_FRAME
- 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_FRAME
- 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_FRAME
- 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_Check_Button writebutton {
- label WRITE
- callback {if (o->value()>0.5) mode=2;
- removeselection();}
- xywh {116 534 99 30} type Radio box UP_BOX down_box DOWN_BOX labelfont 1 labelsize 13
- code0 {if (bank->locked()) o->deactivate();}
- }
- Fl_Check_Button readbutton {
- label READ selected
- callback {if (o->value()>0.5) mode=1;
- removeselection();}
- xywh {11 534 99 30} type Radio box UP_BOX down_box DOWN_BOX labelfont 1 labelsize 13
- code0 {o->value(1);}
- }
- Fl_Check_Button clearbutton {
- label CLEAR
- callback {if (o->value()>0.5) mode=3;
- removeselection();}
- xywh {221 534 99 30} type Radio box UP_BOX down_box DOWN_BOX labelfont 1 labelsize 13
- code0 {if (bank->locked()) o->deactivate();}
- }
- Fl_Check_Button swapbutton {
- label SWAP
- callback {if (o->value()>0.5) mode=4;
- removeselection();}
- xywh {325 534 99 30} type Radio box UP_BOX down_box DOWN_BOX 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} 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();
- std::string dirname=bank->banks[n].dir;
- if (dirname.empty()) return;
-
- if (bank->loadbank(dirname)==2)
- fl_alert("Error: Could not load the bank from the directory\\n%s.",dirname.c_str());
- for (int i=0;i<BANK_SIZE;i++) bs[i]->refresh();
- refreshmainwindow();}
- 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:",bank->getname(slot).c_str());
- 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->part[*npart]->load_mutex);
- bank->loadfromslot(slot,master->part[*npart]);
- pthread_mutex_unlock(&master->part[*npart]->load_mutex);
- master->part[*npart]->applyparameters();
- snprintf((char *)master->part[*npart]->Pname,PART_MAX_NAME_LEN,"%s",bank->getname(slot).c_str());
- 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->part[*npart]->load_mutex);
- bank->savetoslot(slot,master->part[*npart]);
- pthread_mutex_unlock(&master->part[*npart]->load_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.c_str());
- 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;i<BANK_SIZE;i++)
- bs[i]->refresh();} {}
- }
- Function {removeselection()} {} {
- code {if (nselected>=0) {
- int ns=nselected;
- nselected=-1;
- bs[ns]->refresh();
- };} {}
- }
- Function {rescan_for_banks()} {} {
- code {banklist->clear();
- bank->rescanforbanks();
-
- for (unsigned int i=0;i<bank->banks.size();i++) {
- banklist->add(bank->banks[i].name.c_str());
- }
- if (banklist->size() == 0)
- banklist->add(" ");} {}
- }
- 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
- }
- }
|