home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 November / CMCD1104.ISO / Software / Complet / ZynAddFX / Setup_ZynAddSubFX-2.1.1.exe / ConfigUI.fl < prev    next >
Encoding:
FLTK User Interface Designer  |  2004-08-27  |  13.5 KB  |  420 lines

  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0105 
  3. header_name {.h} 
  4. code_name {.cc}
  5. decl {//Copyright (c) 2002-2004 Nasca Octavian Paul} {} 
  6.  
  7. decl {//License: GNU GPL version 2} {} 
  8.  
  9. decl {\#include <stdio.h>} {public
  10.  
  11. decl {\#include <math.h>} {public
  12.  
  13. decl {\#include <stdlib.h>} {public
  14.  
  15. decl {\#include <FL/Fl_File_Chooser.H>} {public
  16.  
  17. decl {\#include "../globals.h"} {public
  18.  
  19. decl {\#include "../Misc/Util.h"} {public
  20.  
  21. decl {\#include "../Misc/Dump.h"} {public
  22.  
  23. decl {extern Dump dump;} {public
  24.  
  25. class ConfigUI {} {
  26.   Function {make_window()} {} {
  27.     Fl_Window configwindow {
  28.       label {ZynAddSubFX Settings}
  29.       callback {writebankcfg();
  30. o->hide();}
  31.       xywh {88 313 510 340} type Double hide
  32.     } {
  33.       Fl_Tabs {} {
  34.         xywh {5 5 500 305}
  35.       } {
  36.         Fl_Group {} {
  37.           label {Main settings} selected
  38.           xywh {5 25 500 285}
  39.         } {
  40.           Fl_Group {} {
  41.             label {Sample Rate}
  42.             xywh {15 45 165 30} box ENGRAVED_FRAME
  43.           } {
  44.             Fl_Choice {} {
  45.               callback {if ((int)o->value()==0) samplerateinput->activate();
  46.        else samplerateinput->deactivate();
  47.  
  48. int samplerates[7]={44100,16000,22050,32000,44100,48000,96000};
  49. config.cfg.SampleRate=samplerates[(int)o->value()];
  50.  
  51. setsamplerateinput();}
  52.               xywh {20 50 85 20} down_box BORDER_BOX textsize 10
  53.               code0 {o->value(getsamplerateorder());}
  54.             } {
  55.               menuitem {} {
  56.                 label Custom
  57.                 xywh {10 10 100 20} labelfont 1
  58.               }
  59.               menuitem {} {
  60.                 label 16000Hz
  61.                 xywh {30 30 100 20} labelfont 1
  62.               }
  63.               menuitem {} {
  64.                 label 22050Hz
  65.                 xywh {20 20 100 20} labelfont 1
  66.               }
  67.               menuitem {} {
  68.                 label 32000Hz
  69.                 xywh {30 30 100 20} labelfont 1
  70.               }
  71.               menuitem {} {
  72.                 label 44100Hz
  73.                 xywh {40 40 100 20} labelfont 1
  74.               }
  75.               menuitem {} {
  76.                 label 48000Hz
  77.                 xywh {50 50 100 20} labelfont 1
  78.               }
  79.               menuitem {} {
  80.                 label 96000Hz
  81.                 xywh {60 60 100 20} labelfont 1
  82.               }
  83.             }
  84.             Fl_Input samplerateinput {
  85.               callback {char *tmp;
  86. config.cfg.SampleRate=strtoul(o->value(),&tmp,10);}
  87.               xywh {115 50 60 20} type Int textfont 1
  88.               code0 {setsamplerateinput();}
  89.               code1 {if (getsamplerateorder()!=0) o->deactivate();}
  90.             }
  91.           }
  92.           Fl_Input {} {
  93.             label {Buffer Size}
  94.             callback {char *tmp;
  95. config.cfg.SoundBufferSize=strtoul(o->value(),&tmp,10);}
  96.             tooltip {Internal Sound Buffer Size (samples)} xywh {190 45 60 20} type Int labelsize 12 align 129 textfont 1
  97.             code0 {char *tmpbuf=new char[100];o->cut(0,o->maximum_size());}
  98.             code1 {snprintf(tmpbuf,100,"%d",config.cfg.SoundBufferSize);o->insert(tmpbuf);}
  99.             code2 {delete(tmpbuf);}
  100.           }
  101.           Fl_Light_Button {} {
  102.             label {Swap Stereo }
  103.             callback {config.cfg.SwapStereo=(int) o->value();}
  104.             xywh {20 80 85 20} box THIN_UP_BOX labelsize 11
  105.             code0 {o->value(config.cfg.SwapStereo);}
  106.           }
  107.           Fl_Choice {} {
  108.             label OscilSize
  109.             callback {config.cfg.OscilSize=128<<o->value();}
  110.             tooltip {ADSynth Oscillator Size (samples)} xywh {175 80 75 20} down_box BORDER_BOX labelfont 1 labelsize 12 textsize 10
  111.             code0 {o->value( (int) (log(config.cfg.OscilSize/128.0-1.0)/log(2)) +1);}
  112.           } {
  113.             menuitem {} {
  114.               label 128
  115.               xywh {25 25 100 20} labelfont 1
  116.             }
  117.             menuitem {} {
  118.               label 256
  119.               xywh {35 35 100 20} labelfont 1
  120.             }
  121.             menuitem {} {
  122.               label 512
  123.               xywh {45 45 100 20} labelfont 1
  124.             }
  125.             menuitem {} {
  126.               label 1024
  127.               xywh {45 45 100 20} labelfont 1
  128.             }
  129.             menuitem {} {
  130.               label 2048
  131.               xywh {55 55 100 20} labelfont 1
  132.             }
  133.             menuitem {} {
  134.               label 4096
  135.               xywh {55 55 100 20} labelfont 1
  136.             }
  137.             menuitem {} {
  138.               label 8192
  139.               xywh {65 65 100 20} labelfont 1
  140.             }
  141.             menuitem {} {
  142.               label 16384
  143.               xywh {75 75 100 20} labelfont 1
  144.             }
  145.           }
  146.           Fl_Box {} {
  147.             label {Most settings has effect only after ZynAddSubFX is restarted.}
  148.             xywh {15 270 235 30} labelfont 1 labelsize 12 align 128
  149.           }
  150.           Fl_Box {} {
  151.             label {Read the Readme.txt for other settings}
  152.             xywh {10 250 240 20} labelfont 1 labelsize 12 align 128
  153.           }
  154.           Fl_Group {} {
  155.             xywh {15 125 230 85} box ENGRAVED_BOX
  156.           } {
  157.             Fl_File_Input {} {
  158.               label {Dump File}
  159.               callback {snprintf(config.cfg.DumpFile,config.maxstringsize,"%s",o->value());}
  160.               xywh {20 170 220 35} align 5
  161.               code0 {o->insert(config.cfg.DumpFile);}
  162.             }
  163.             Fl_Check_Button {} {
  164.               label {Dump notes}
  165.               callback {config.cfg.DumpNotesToFile=(int) o->value();
  166. dump.startnow();//this has effect only if this option was disabled}
  167.               xywh {20 130 100 20} down_box DOWN_BOX
  168.               code0 {o->value(config.cfg.DumpNotesToFile);}
  169.             }
  170.             Fl_Check_Button {} {
  171.               label Append
  172.               callback {config.cfg.DumpAppend=(int) o->value();}
  173.               xywh {160 130 80 20} down_box DOWN_BOX
  174.               code0 {o->value(config.cfg.DumpAppend);}
  175.             }
  176.           }
  177.           Fl_Group {} {
  178.             xywh {255 45 245 260} box ENGRAVED_FRAME
  179.           } {
  180.             Fl_Box {} {
  181.               label {Note: Not all the following settings are used (this depends on the operating system, etc..)}
  182.               xywh {260 50 235 45} labelfont 1 labelsize 12 align 128
  183.             }
  184.             Fl_Group {} {
  185.               label Linux
  186.               xywh {260 110 235 115} box ENGRAVED_BOX labelfont 1 labelsize 16 align 5
  187.             } {
  188.               Fl_File_Input {} {
  189.                 label {OSS Sequencer Device (/dev/...)}
  190.                 callback {snprintf(config.cfg.LinuxOSSSeqInDev,config.maxstringsize,"%s",o->value());}
  191.                 xywh {265 180 225 35} align 5
  192.                 code0 {o->insert(config.cfg.LinuxOSSSeqInDev);}
  193.               }
  194.               Fl_File_Input {} {
  195.                 label {OSS Wave Out Device (/dev/...)}
  196.                 callback {snprintf(config.cfg.LinuxOSSWaveOutDev,config.maxstringsize,"%s",o->value());}
  197.                 xywh {265 130 225 35} align 5
  198.                 code0 {o->insert(config.cfg.LinuxOSSWaveOutDev);}
  199.               }
  200.             }
  201.             Fl_Group {} {
  202.               label Windows
  203.               xywh {260 250 235 50} box ENGRAVED_BOX labelfont 1 labelsize 16 align 5
  204.             } {
  205.               Fl_Counter {} {
  206.                 label {Midi In Dev}
  207.                 callback {config.cfg.WindowsMidiInId=(int) o->value();
  208. midiinputnamebox->label(config.winmididevices[config.cfg.WindowsMidiInId].name);}
  209.                 xywh {270 270 65 20} type Simple labelsize 12 align 1 minimum 0 maximum 100 step 1
  210.                 code0 {o->maximum(config.winmidimax-1);}
  211.                 code1 {o->value(config.cfg.WindowsMidiInId);}
  212.               }
  213.               Fl_Box midiinputnamebox {
  214.                 label {Midi input device name}
  215.                 xywh {340 260 150 35} labelfont 1 labelsize 12 align 212
  216.                 code0 {o->label(config.winmididevices[config.cfg.WindowsMidiInId].name);}
  217.               }
  218.             }
  219.           }
  220.           Fl_Counter {} {
  221.             label {XML compression level}
  222.             callback {config.cfg.GzipCompression=(int) o->value();}
  223.             tooltip {gzip compression level (0 - uncompressed)} xywh {20 215 65 15} type Simple labelsize 12 align 8 minimum 0 maximum 9 step 1
  224.             code0 {o->value(config.cfg.GzipCompression);}
  225.           }
  226.           Fl_Choice {} {
  227.             label {PADsynth Interpolation}
  228.             callback {config.cfg.Interpolation=(int) o->value();}
  229.             xywh {175 105 75 15} down_box BORDER_BOX labelsize 11 textsize 12
  230.             code0 {o->value(config.cfg.Interpolation);}
  231.           } {
  232.             menuitem {} {
  233.               label {Linear(fast)}
  234.               xywh {0 0 100 20} labelfont 1 labelsize 10
  235.             }
  236.             menuitem {} {
  237.               label {Cubic(slow)}
  238.               xywh {10 10 100 20} labelfont 1 labelsize 10
  239.             }
  240.           }
  241.         }
  242.         Fl_Group {} {
  243.           label {Bank root dirs}
  244.           xywh {5 25 500 285} hide
  245.         } {
  246.           Fl_Browser rootsbrowse {
  247.             callback {activatebutton_rootdir(o->value()!=0);}
  248.             xywh {15 35 485 220} type Hold
  249.           }
  250.           Fl_Button {} {
  251.             label {Add root directory...}
  252.             callback {const char *dirname;
  253. dirname=fl_dir_chooser("Add a root directory for banks:",NULL,0);
  254. if (dirname==NULL) return;
  255.  
  256. rootsbrowse->add(dirname);}
  257.             xywh {15 265 80 35} box THIN_UP_BOX align 128
  258.           }
  259.           Fl_Button removerootdirbutton {
  260.             label {Remove root dir...}
  261.             callback {if (rootsbrowse->value()!=0) {
  262.    rootsbrowse->remove(rootsbrowse->value());
  263. };
  264. activatebutton_rootdir(false);}
  265.             xywh {105 265 80 35} box THIN_UP_BOX align 128
  266.             code0 {o->deactivate();}
  267.           }
  268.           Fl_Button makedefaultrootdirbutton {
  269.             label {Make default}
  270.             callback {int n=rootsbrowse->value();
  271.  
  272. if (n!=0) {
  273.    rootsbrowse->move(1,n);
  274.    rootsbrowse->value(1);
  275.    rootsbrowse->redraw();
  276. };
  277. activatebutton_rootdir(true);}
  278.             xywh {190 265 80 35} box THIN_UP_BOX align 128
  279.             code0 {o->deactivate();}
  280.           }
  281.         }
  282.         Fl_Group {} {
  283.           label {Presets dirs}
  284.           xywh {5 25 500 285} hide
  285.         } {
  286.           Fl_Browser presetbrowse {
  287.             callback {activatebutton_presetdir(o->value()!=0);}
  288.             xywh {15 35 485 220} type Hold
  289.           }
  290.           Fl_Button {} {
  291.             label {Add preset directory...}
  292.             callback {const char *dirname;
  293. dirname=fl_dir_chooser("Add a preset directory :",NULL,0);
  294. if (dirname==NULL) return;
  295.  
  296. presetbrowse->add(dirname);}
  297.             xywh {15 265 80 35} box THIN_UP_BOX align 128
  298.           }
  299.           Fl_Button removepresetbutton {
  300.             label {Remove preset dir...}
  301.             callback {if (presetbrowse->value()!=0) {
  302.    presetbrowse->remove(presetbrowse->value());
  303. };
  304. activatebutton_presetdir(false);}
  305.             xywh {105 265 80 35} box THIN_UP_BOX align 128
  306.             code0 {o->deactivate();}
  307.           }
  308.           Fl_Button makedefaultpresetbutton {
  309.             label {Make default}
  310.             callback {int n=presetbrowse->value();
  311.  
  312. if (n!=0) {
  313.    presetbrowse->move(1,n);
  314.    presetbrowse->value(1);
  315.    presetbrowse->redraw();
  316. };
  317. activatebutton_presetdir(true);}
  318.             xywh {190 265 80 35} box THIN_UP_BOX align 128
  319.             code0 {o->deactivate();}
  320.           }
  321.         }
  322.       }
  323.       Fl_Button {} {
  324.         label Close
  325.         callback {configwindow->hide();
  326. writebankcfg();
  327. writepresetcfg();}
  328.         xywh {200 315 105 20} box THIN_UP_BOX
  329.       }
  330.     }
  331.   }
  332.   Function {ConfigUI()} {} {
  333.     code {make_window();
  334. readbankcfg();
  335. readpresetcfg();} {}
  336.   }
  337.   Function {activatebutton_rootdir(bool active)} {} {
  338.     code {if (active) {
  339.     removerootdirbutton->activate();
  340.     makedefaultrootdirbutton->activate();
  341. }else{
  342.     removerootdirbutton->deactivate();
  343.     makedefaultrootdirbutton->deactivate();
  344. };} {}
  345.   }
  346.   Function {activatebutton_presetdir(bool active)} {} {
  347.     code {if (active) {
  348.     removepresetbutton->activate();
  349.     makedefaultpresetbutton->activate();
  350. }else{
  351.     removepresetbutton->deactivate();
  352.     makedefaultpresetbutton->deactivate();
  353. };} {}
  354.   }
  355.   Function {readbankcfg()} {} {
  356.     code {rootsbrowse->clear();
  357.  
  358. for (int i=0;i<MAX_BANK_ROOT_DIRS;i++){
  359.   if (config.cfg.bankRootDirList[i]!=NULL) rootsbrowse->add(config.cfg.bankRootDirList[i]);
  360. };} {}
  361.   }
  362.   Function {writebankcfg()} {} {
  363.     code {config.clearbankrootdirlist();
  364.  
  365. for (int n=0;n<rootsbrowse->size();n++){ 
  366.      config.cfg.bankRootDirList[n]=new char [MAX_STRING_SIZE];
  367.      strncpy(config.cfg.bankRootDirList[n],rootsbrowse->text(n+1),MAX_STRING_SIZE);
  368. };} {}
  369.   }
  370.   Function {readpresetcfg()} {} {
  371.     code {presetbrowse->clear();
  372.  
  373. for (int i=0;i<MAX_BANK_ROOT_DIRS;i++){
  374.   if (config.cfg.presetsDirList[i]!=NULL) presetbrowse->add(config.cfg.presetsDirList[i]);
  375. };} {}
  376.   }
  377.   Function {writepresetcfg()} {} {
  378.     code {config.clearpresetsdirlist();
  379.  
  380. for (int n=0;n<presetbrowse->size();n++){ 
  381.      config.cfg.presetsDirList[n]=new char [MAX_STRING_SIZE];
  382.      strncpy(config.cfg.presetsDirList[n],presetbrowse->text(n+1),MAX_STRING_SIZE);
  383. };} {}
  384.   }
  385.   Function {getsamplerateorder()} {return_type int
  386.   } {
  387.     code {int smpr=config.cfg.SampleRate;
  388. int order=0;
  389. switch(smpr){
  390.    case 16000:order=1;break;
  391.    case 22050:order=2;break;
  392.    case 32000:order=3;break;
  393.    case 44100:order=4;break;
  394.    case 48000:order=5;break;
  395.    case 96000:order=6;break;
  396.    default:order=0;break;
  397. };
  398. return(order);} {}
  399.   }
  400.   Function {setsamplerateinput()} {return_type void
  401.   } {
  402.     code {char *tmpbuf=new char[100];
  403. samplerateinput->cut(0,samplerateinput->maximum_size());
  404. snprintf(tmpbuf,100,"%d",config.cfg.SampleRate);
  405. samplerateinput->insert(tmpbuf);
  406. delete (tmpbuf);} {}
  407.   }
  408.   Function {show()} {} {
  409.     code {configwindow->show();} {}
  410.   }
  411.