commit 2c48a3fd0f8463b7ebc5d57a0608cbc2e185bacb
parent db4a88df125cad6a55dff584a0bd20180c1415fc
Author: paulnasca <paulnasca>
Date: Sun, 13 Jun 2004 10:50:07 +0000
*** empty log message ***
Diffstat:
3 files changed, 274 insertions(+), 173 deletions(-)
diff --git a/src/Misc/Config.C b/src/Misc/Config.C
@@ -30,7 +30,6 @@
#endif
#include "Config.h"
-#define MAX_STRING_SIZE 4000
Config::Config(){
maxstringsize=MAX_STRING_SIZE;//for ui
diff --git a/src/Misc/Config.h b/src/Misc/Config.h
@@ -23,6 +23,8 @@
#ifndef CONFIG_H
#define CONFIG_H
#include "../globals.h"
+#define MAX_STRING_SIZE 4000
+
class Config{
public:
diff --git a/src/UI/ConfigUI.fl b/src/UI/ConfigUI.fl
@@ -15,6 +15,9 @@ decl {\#include <math.h>} {public
decl {\#include <stdlib.h>} {public
}
+decl {\#include <FL/Fl_File_Chooser.H>} {public
+}
+
decl {\#include "../globals.h"} {public
}
@@ -27,208 +30,305 @@ decl {\#include "../Misc/Dump.h"} {public
decl {extern Dump dump;} {public
}
-class ConfigUI {selected
+class ConfigUI {open
} {
- Function {make_window()} {} {
+ Function {make_window()} {open
+ } {
Fl_Window configwindow {
label {ZynAddSubFX Settings}
- xywh {120 213 500 290} type Double hide
+ callback {writebankcfg();
+o->hide();}
+ xywh {88 313 510 340} type Double visible
} {
- Fl_Button {} {
- label OK
- callback {configwindow->hide();}
- xywh {70 265 100 20} box THIN_UP_BOX
- }
- Fl_Group {} {
- label {Sample Rate}
- xywh {5 25 165 30} box ENGRAVED_FRAME
+ Fl_Tabs {} {
+ xywh {5 5 500 305}
} {
- Fl_Choice {} {
- callback {if ((int)o->value()==0) samplerateinput->activate();
+ Fl_Group {} {
+ label {Main settings}
+ xywh {5 25 500 285} hide
+ } {
+ Fl_Group {} {
+ label {Sample Rate}
+ xywh {15 45 165 30} box ENGRAVED_FRAME
+ } {
+ Fl_Choice {} {
+ callback {if ((int)o->value()==0) samplerateinput->activate();
else samplerateinput->deactivate();
int samplerates[7]={44100,16000,22050,32000,44100,48000,96000};
config.cfg.SampleRate=samplerates[(int)o->value()];
setsamplerateinput();}
- xywh {10 30 85 20} down_box BORDER_BOX textsize 10
- code0 {o->value(getsamplerateorder());}
- } {
- menuitem {} {
- label Custom
- xywh {0 0 100 20} labelfont 1
- }
- menuitem {} {
- label 16000Hz
- xywh {20 20 100 20} labelfont 1
+ xywh {20 50 85 20} down_box BORDER_BOX textsize 10
+ code0 {o->value(getsamplerateorder());}
+ } {
+ menuitem {} {
+ label Custom
+ xywh {10 10 100 20} labelfont 1
+ }
+ menuitem {} {
+ label 16000Hz
+ xywh {30 30 100 20} labelfont 1
+ }
+ menuitem {} {
+ label 22050Hz
+ xywh {20 20 100 20} labelfont 1
+ }
+ menuitem {} {
+ label 32000Hz
+ xywh {30 30 100 20} labelfont 1
+ }
+ menuitem {} {
+ label 44100Hz
+ xywh {40 40 100 20} labelfont 1
+ }
+ menuitem {} {
+ label 48000Hz
+ xywh {50 50 100 20} labelfont 1
+ }
+ menuitem {} {
+ label 96000Hz
+ xywh {60 60 100 20} labelfont 1
+ }
+ }
+ Fl_Input samplerateinput {
+ callback {char *tmp;
+config.cfg.SampleRate=strtoul(o->value(),&tmp,10);}
+ xywh {115 50 60 20} type Int textfont 1
+ code0 {setsamplerateinput();}
+ code1 {if (getsamplerateorder()!=0) o->deactivate();}
+ }
}
- menuitem {} {
- label 22050Hz
- xywh {10 10 100 20} labelfont 1
+ Fl_Input {} {
+ label {Buffer Size}
+ callback {char *tmp;
+config.cfg.SoundBufferSize=strtoul(o->value(),&tmp,10);}
+ tooltip {Internal Sound Buffer Size (samples)} xywh {190 45 60 20} type Int labelsize 12 align 129 textfont 1
+ code0 {char *tmpbuf=new char[100];o->cut(0,o->maximum_size());}
+ code1 {snprintf(tmpbuf,100,"%d",config.cfg.SoundBufferSize);o->insert(tmpbuf);}
+ code2 {delete(tmpbuf);}
}
- menuitem {} {
- label 32000Hz
- xywh {20 20 100 20} labelfont 1
+ Fl_Light_Button {} {
+ label {Swap Stereo }
+ callback {config.cfg.SwapStereo=(int) o->value();}
+ xywh {20 80 85 20} box THIN_UP_BOX labelsize 11
+ code0 {o->value(config.cfg.SwapStereo);}
}
- menuitem {} {
- label 44100Hz
- xywh {30 30 100 20} labelfont 1
+ Fl_Choice {} {
+ label OscilSize
+ callback {config.cfg.OscilSize=128<<o->value();}
+ tooltip {ADSynth Oscillator Size (samples)} xywh {175 80 75 20} down_box BORDER_BOX labelfont 1 labelsize 12 textsize 10
+ code0 {o->value( (int) (log(config.cfg.OscilSize/128.0-1.0)/log(2)) +1);}
+ } {
+ menuitem {} {
+ label 128
+ xywh {25 25 100 20} labelfont 1
+ }
+ menuitem {} {
+ label 256
+ xywh {35 35 100 20} labelfont 1
+ }
+ menuitem {} {
+ label 512
+ xywh {45 45 100 20} labelfont 1
+ }
+ menuitem {} {
+ label 1024
+ xywh {45 45 100 20} labelfont 1
+ }
+ menuitem {} {
+ label 2048
+ xywh {55 55 100 20} labelfont 1
+ }
+ menuitem {} {
+ label 4096
+ xywh {55 55 100 20} labelfont 1
+ }
+ menuitem {} {
+ label 8192
+ xywh {65 65 100 20} labelfont 1
+ }
+ menuitem {} {
+ label 16384
+ xywh {75 75 100 20} labelfont 1
+ }
}
- menuitem {} {
- label 48000Hz
- xywh {40 40 100 20} labelfont 1
+ Fl_Box {} {
+ label {Most settings has effect only after ZynAddSubFX is restarted.}
+ xywh {20 245 235 30} labelfont 1 labelsize 12 align 128
}
- menuitem {} {
- label 96000Hz
- xywh {50 50 100 20} labelfont 1
+ Fl_Box {} {
+ label {Read the Readme.txt for other settings}
+ xywh {15 225 240 20} labelfont 1 labelsize 12 align 128
}
- }
- Fl_Input samplerateinput {
- callback {char *tmp;
-config.cfg.SampleRate=strtoul(o->value(),&tmp,10);}
- xywh {105 30 60 20} type Int textfont 1
- code0 {setsamplerateinput();}
- code1 {if (getsamplerateorder()!=0) o->deactivate();}
- }
- }
- Fl_Input {} {
- label {Buffer Size}
- callback {char *tmp;
-config.cfg.SoundBufferSize=strtoul(o->value(),&tmp,10);}
- tooltip {Internal Sound Buffer Size (samples)} xywh {180 30 60 20} type Int labelsize 12 align 129 textfont 1
- code0 {char *tmpbuf=new char[100];o->cut(0,o->maximum_size());}
- code1 {snprintf(tmpbuf,100,"%d",config.cfg.SoundBufferSize);o->insert(tmpbuf);}
- code2 {delete(tmpbuf);}
- }
- Fl_Light_Button {} {
- label {Swap Stereo }
- callback {config.cfg.SwapStereo=(int) o->value();}
- xywh {10 60 85 20} box THIN_UP_BOX labelsize 11
- code0 {o->value(config.cfg.SwapStereo);}
- }
- Fl_Choice {} {
- label OscilSize
- callback {config.cfg.OscilSize=128<<o->value();}
- tooltip {ADSynth Oscillator Size (samples)} xywh {165 60 75 20} down_box BORDER_BOX labelfont 1 labelsize 12 textsize 10
- code0 {o->value( (int) (log(config.cfg.OscilSize/128.0-1.0)/log(2)) +1);}
- } {
- menuitem {} {
- label 128
- xywh {15 15 100 20} labelfont 1
- }
- menuitem {} {
- label 256
- xywh {25 25 100 20} labelfont 1
- }
- menuitem {} {
- label 512
- xywh {35 35 100 20} labelfont 1
- }
- menuitem {} {
- label 1024
- xywh {35 35 100 20} labelfont 1
- }
- menuitem {} {
- label 2048
- xywh {45 45 100 20} labelfont 1
- }
- menuitem {} {
- label 4096
- xywh {45 45 100 20} labelfont 1
- }
- menuitem {} {
- label 8192
- xywh {55 55 100 20} labelfont 1
- }
- menuitem {} {
- label 16384
- xywh {65 65 100 20} labelfont 1
- }
- }
- Fl_Box {} {
- label {Most settings has effect only after ZynAddSubFX is restarted.}
- xywh {10 225 235 30} labelfont 1 labelsize 12 align 128
- }
- Fl_Box {} {
- label {Read the Readme.txt for other settings}
- xywh {5 205 240 20} labelfont 1 labelsize 12 align 128
- }
- Fl_Group {} {
- xywh {5 95 230 85} box ENGRAVED_BOX
- } {
- Fl_File_Input {} {
- label {Dump File}
- callback {snprintf(config.cfg.DumpFile,config.maxstringsize,"%s",o->value());}
- xywh {10 140 220 35} align 5
- code0 {o->insert(config.cfg.DumpFile);}
- }
- Fl_Check_Button {} {
- label {Dump notes}
- callback {config.cfg.DumpNotesToFile=(int) o->value();
+ Fl_Group {} {
+ xywh {15 115 230 85} box ENGRAVED_BOX
+ } {
+ Fl_File_Input {} {
+ label {Dump File}
+ callback {snprintf(config.cfg.DumpFile,config.maxstringsize,"%s",o->value());}
+ xywh {20 160 220 35} align 5
+ code0 {o->insert(config.cfg.DumpFile);}
+ }
+ Fl_Check_Button {} {
+ label {Dump notes}
+ callback {config.cfg.DumpNotesToFile=(int) o->value();
dump.startnow();//this has effect only if this option was disabled}
- xywh {10 100 100 20} down_box DOWN_BOX
- code0 {o->value(config.cfg.DumpNotesToFile);}
- }
- }
- Fl_Group {} {
- xywh {250 30 245 260} box ENGRAVED_FRAME
- } {
- Fl_Box {} {
- label {Note: Not all the following settings are used (this depends on the operating system, etc..)}
- xywh {255 35 235 45} labelfont 1 labelsize 12 align 128
- }
- Fl_Group {} {
- label Linux
- xywh {255 95 235 115} box ENGRAVED_BOX labelfont 1 labelsize 16 align 5
- } {
- Fl_File_Input {} {
- label {OSS Sequencer Device (/dev/...)}
- callback {snprintf(config.cfg.LinuxOSSSeqInDev,config.maxstringsize,"%s",o->value());}
- xywh {260 165 225 35} align 5
- code0 {o->insert(config.cfg.LinuxOSSSeqInDev);}
+ xywh {20 120 100 20} down_box DOWN_BOX
+ code0 {o->value(config.cfg.DumpNotesToFile);}
+ }
+ }
+ Fl_Group {} {
+ xywh {255 45 245 260} box ENGRAVED_FRAME
+ } {
+ Fl_Box {} {
+ label {Note: Not all the following settings are used (this depends on the operating system, etc..)}
+ xywh {260 50 235 45} labelfont 1 labelsize 12 align 128
+ }
+ Fl_Group {} {
+ label Linux
+ xywh {260 110 235 115} box ENGRAVED_BOX labelfont 1 labelsize 16 align 5
+ } {
+ Fl_File_Input {} {
+ label {OSS Sequencer Device (/dev/...)}
+ callback {snprintf(config.cfg.LinuxOSSSeqInDev,config.maxstringsize,"%s",o->value());}
+ xywh {265 180 225 35} align 5
+ code0 {o->insert(config.cfg.LinuxOSSSeqInDev);}
+ }
+ Fl_File_Input {} {
+ label {OSS Wave Out Device (/dev/...)}
+ callback {snprintf(config.cfg.LinuxOSSWaveOutDev,config.maxstringsize,"%s",o->value());}
+ xywh {265 130 225 35} align 5
+ code0 {o->insert(config.cfg.LinuxOSSWaveOutDev);}
+ }
+ }
+ Fl_Group {} {
+ label Windows
+ xywh {260 250 235 50} box ENGRAVED_BOX labelfont 1 labelsize 16 align 5
+ } {
+ Fl_Counter {} {
+ label {Midi In Dev}
+ callback {config.cfg.WindowsMidiInId=(int) o->value();
+midiinputnamebox->label(config.winmididevices[config.cfg.WindowsMidiInId].name);}
+ xywh {270 270 65 20} type Simple labelsize 12 align 1 minimum 0 maximum 100 step 1
+ code0 {o->maximum(config.winmidimax-1);}
+ code1 {o->value(config.cfg.WindowsMidiInId);}
+ }
+ Fl_Box midiinputnamebox {
+ label {Midi input device name}
+ xywh {340 260 150 35} labelfont 1 labelsize 12 align 212
+ code0 {o->label(config.winmididevices[config.cfg.WindowsMidiInId].name);}
+ }
+ }
}
- Fl_File_Input {} {
- label {OSS Wave Out Device (/dev/...)}
- callback {snprintf(config.cfg.LinuxOSSWaveOutDev,config.maxstringsize,"%s",o->value());}
- xywh {260 115 225 35} align 5
- code0 {o->insert(config.cfg.LinuxOSSWaveOutDev);}
+ Fl_Check_Button {} {
+ label Append
+ callback {config.cfg.DumpAppend=(int) o->value();}
+ xywh {160 120 80 20} down_box DOWN_BOX
+ code0 {o->value(config.cfg.DumpAppend);}
+ }
+ Fl_Counter {} {
+ label {XML compression level}
+ callback {config.cfg.GzipCompression=(int) o->value();}
+ tooltip {gzip compression level (0 - uncompressed)} xywh {20 205 65 15} type Simple labelsize 12 align 8 minimum 0 maximum 9 step 1
+ code0 {o->value(config.cfg.GzipCompression);}
}
}
Fl_Group {} {
- label Windows
- xywh {255 235 235 50} box ENGRAVED_BOX labelfont 1 labelsize 16 align 5
+ label {Bank root dirs} open
+ xywh {5 25 500 285}
} {
- Fl_Counter {} {
- label {Midi In Dev}
- callback {config.cfg.WindowsMidiInId=(int) o->value();
-midiinputnamebox->label(config.winmididevices[config.cfg.WindowsMidiInId].name);}
- xywh {265 255 65 20} type Simple labelsize 12 align 1 minimum 0 maximum 100 step 1
- code0 {o->maximum(config.winmidimax-1);}
- code1 {o->value(config.cfg.WindowsMidiInId);}
+ Fl_Browser rootsbrowse {
+ callback {activatebutton_rootdir(o->value()!=0);}
+ xywh {15 35 485 220} type Hold
+ }
+ Fl_Button {} {
+ label {Add root directory...}
+ callback {const char *dirname;
+dirname=fl_dir_chooser("Add a root directory for banks:",NULL,0);
+if (dirname==NULL) return;
+
+rootsbrowse->add(dirname);}
+ xywh {15 265 80 35} box THIN_UP_BOX align 128
+ }
+ Fl_Button removerootdirbutton {
+ label {Remove root dir...}
+ callback {if (rootsbrowse->value()!=0) {
+ rootsbrowse->remove(rootsbrowse->value());
+};
+activatebutton_rootdir(false);}
+ xywh {105 265 80 35} box THIN_UP_BOX align 128
+ code0 {o->deactivate();}
}
- Fl_Box midiinputnamebox {
- label {Midi input device name}
- xywh {335 245 150 35} labelfont 1 labelsize 12 align 212
- code0 {o->label(config.winmididevices[config.cfg.WindowsMidiInId].name);}
+ Fl_Button makedefaultrootdirbutton {
+ label {Make default}
+ callback {int n=rootsbrowse->value();
+
+if (n!=0) {
+ rootsbrowse->move(1,n);
+ rootsbrowse->value(1);
+ rootsbrowse->redraw();
+};
+activatebutton_rootdir(true);}
+ xywh {190 265 80 35} box THIN_UP_BOX align 128
+ code0 {o->deactivate();}
}
}
}
- Fl_Check_Button {} {
- label Append
- callback {config.cfg.DumpAppend=(int) o->value();}
- xywh {150 100 80 20} down_box DOWN_BOX
- code0 {o->value(config.cfg.DumpAppend);}
- }
- Fl_Counter {} {
- label {XML compression level}
- callback {config.cfg.GzipCompression=(int) o->value();}
- tooltip {gzip compression level (0 - uncompressed)} xywh {10 185 65 15} type Simple labelsize 12 align 8 minimum 0 maximum 9 step 1
- code0 {o->value(config.cfg.GzipCompression);}
+ Fl_Button {} {
+ label Close
+ callback {configwindow->hide();
+writebankcfg();}
+ xywh {200 315 105 20} box THIN_UP_BOX
}
}
}
- Function {ConfigUI()} {} {
- code {make_window();} {}
+ Function {ConfigUI()} {open
+ } {
+ code {make_window();
+readbankcfg();} {}
+ }
+ Function {activatebutton_rootdir(bool active)} {open
+ } {
+ code {if (active) {
+ removerootdirbutton->activate();
+ makedefaultrootdirbutton->activate();
+}else{
+ removerootdirbutton->deactivate();
+ makedefaultrootdirbutton->deactivate();
+};} {}
+ }
+ Function {readbankcfg()} {} {
+ code {rootsbrowse->clear();
+
+int start=0,end=0;
+char *dirlist=config.cfg.bankRootDirList;
+int dirlistlen=strlen(dirlist);
+char *currentrootdir=new char [dirlistlen];
+while (start<dirlistlen){
+ for (int i=start+1;i<dirlistlen;i++){
+ if (dirlist[i]<32) break;
+ end=i;
+ };
+ snprintf(currentrootdir,end-start+2,"%s",&dirlist[start]);
+
+ //a root director was found
+ rootsbrowse->add(currentrootdir);
+
+ start=end+2;
+};
+delete(currentrootdir);} {}
+ }
+ Function {writebankcfg()} {open
+ } {
+ code {char *str=config.cfg.bankRootDirList;
+str[0]='\\0';
+
+for (int n=1;n<rootsbrowse->size()+1;n++){
+ strncat(str,rootsbrowse->text(n),MAX_STRING_SIZE);
+ strncat(str,"\\n",MAX_STRING_SIZE);
+};} {selected
+ }
}
Function {getsamplerateorder()} {return_type int
} {