feat(settings): persist application defaults and workspace on exit (phase 100)
This commit is contained in:
parent
bd0a63c06d
commit
2a86d766ca
8 changed files with 150 additions and 4 deletions
|
|
@ -21,6 +21,8 @@ static const xtc_setting_info schema[] = {
|
|||
STR("plugins",vst2_paths,"VST2 search paths (colon-separated)"),
|
||||
STR("plugins",vst3_paths,"VST3 search paths (colon-separated)"),
|
||||
STR("plugins",ladspa_paths,"LADSPA search paths (colon-separated)"),
|
||||
NUM("interface",main_x,"Main window X",-32768,32768), NUM("interface",main_y,"Main window Y",-32768,32768),
|
||||
NUM("interface",inspector_visible,"Track inspector visible: 0 or 1",0,1),
|
||||
NUM("interface",width,"Main window width",1220,3840), NUM("interface",height,"Main window height",720,2160),
|
||||
NUM("interface",piano_width,"Piano window width",800,3840), NUM("interface",piano_height,"Piano window height",520,2160),
|
||||
NUM("interface",transport_detached,"Floating transport: 0 or 1",0,1),
|
||||
|
|
@ -175,7 +177,7 @@ xtc_result xtc_settings_save(const xtc_settings *s,const char *path)
|
|||
n=snprintf(temporary,sizeof(temporary),"%s.tmp-XXXXXX",path); if(n<0 || (size_t)n>=sizeof(temporary)) return XTC_ERR_CAPACITY;
|
||||
fd=mkstemp(temporary); if(fd<0) return XTC_ERR_IO;
|
||||
f=fdopen(fd,"wb"); if(!f) {close(fd);unlink(temporary);return XTC_ERR_IO;}
|
||||
r=XTC_OK; if(fputs("; xtc application preferences. Saved by Preferences / Apply.\n",f)<0) r=XTC_ERR_IO;
|
||||
r=XTC_OK; if(fputs("; xtc application preferences. Saved on Preferences / Apply and clean exit.\n",f)<0) r=XTC_ERR_IO;
|
||||
for(i=0;i<COUNT && r==XTC_OK;++i) {
|
||||
char value[4096]; const char *p;
|
||||
if(strcmp(section,schema[i].section)) { section=schema[i].section; if(fprintf(f,"\n[%s]\n",section)<0) {r=XTC_ERR_IO;break;} }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue