void glob_initfromgui(void *dummy, t_symbol *s, int argc, t_atom *argv) { char *cwd = atom_getsymbolarg(0, argc, argv)->s_name; t_namelist *nl; unsigned int i; int did_fontwarning = 0; int j; sys_oldtclversion = atom_getfloatarg(1, argc, argv); if (argc != 2 + 3 * NZOOM * NFONT) bug("glob_initfromgui"); for (j = 0; j < NZOOM; j++) for (i = 0; i < NFONT; i++) { int size = atom_getfloatarg(3 * (i + j * NFONT) + 2, argc, argv); int width = atom_getfloatarg(3 * (i + j * NFONT) + 3, argc, argv); int height = atom_getfloatarg(3 * (i + j * NFONT) + 4, argc, argv); if (!(size && width && height)) { size = (j+1)*sys_fontspec[i].fi_pointsize; width = (j+1)*sys_fontspec[i].fi_width; height = (j+1)*sys_fontspec[i].fi_height; if (!did_fontwarning) { verbose(1, "ignoring invalid font-metrics from GUI"); did_fontwarning = 1; } } sys_gotfonts[j][i].fi_pointsize = size; sys_gotfonts[j][i].fi_width = width; sys_gotfonts[j][i].fi_height = height; #if 0 fprintf(stderr, "font (%d %d %d)\n", sys_gotfonts[j][i].fi_pointsize, sys_gotfonts[j][i].fi_width, sys_gotfonts[j][i].fi_height); #endif } /* load dynamic libraries specified with "-lib" args */ if (sys_oktoloadfiles(0)) { for (nl = STUFF->st_externlist; nl; nl = nl->nl_next) if (!sys_load_lib(0, nl->nl_string)) post("%s: can't load library", nl->nl_string); sys_oktoloadfiles(1); } /* open patches specifies with "-open" args */ for (nl = sys_openlist; nl; nl = nl->nl_next) openit(cwd, nl->nl_string); namelist_free(sys_openlist); sys_openlist = 0; /* send messages specified with "-send" args */ for (nl = sys_messagelist; nl; nl = nl->nl_next) { t_binbuf *b = binbuf_new(); binbuf_text(b, nl->nl_string, strlen(nl->nl_string)); binbuf_eval(b, 0, 0, 0); binbuf_free(b); } namelist_free(sys_messagelist); sys_messagelist = 0; }
void glob_initfromgui(void *dummy, t_symbol *s, int argc, t_atom *argv) { char *cwd = atom_getsymbolarg(0, argc, argv)->s_name; t_namelist *nl; unsigned int i; int j; int nhostfont = (argc-2)/3; sys_oldtclversion = atom_getfloatarg(1, argc, argv); if (argc != 2 + 3 * nhostfont) bug("glob_initfromgui"); for (i = 0; i < NFONT; i++) { int best = 0; int wantheight = sys_fontlist[i].fi_maxheight; int wantwidth = sys_fontlist[i].fi_maxwidth; for (j = 1; j < nhostfont; j++) { if (atom_getintarg(3 * j + 4, argc, argv) <= wantheight && atom_getintarg(3 * j + 3, argc, argv) <= wantwidth) best = j; } /* best is now the host font index for the desired font index i. */ sys_fontlist[i].fi_hostfontsize = atom_getintarg(3 * best + 2, argc, argv); sys_fontlist[i].fi_width = atom_getintarg(3 * best + 3, argc, argv); sys_fontlist[i].fi_height = atom_getintarg(3 * best + 4, argc, argv); } #if 0 for (i = 0; i < 6; i++) fprintf(stderr, "font (%d %d %d) -> (%d %d %d)\n", sys_fontlist[i].fi_fontsize, sys_fontlist[i].fi_maxwidth, sys_fontlist[i].fi_maxheight, sys_fontlist[i].fi_hostfontsize, sys_fontlist[i].fi_width, sys_fontlist[i].fi_height); #endif /* auto-load anything in that is in startupdir */ if(!sys_nostartup) sys_loadstartup(); /* load dynamic libraries specified with "-lib" args */ for (nl = sys_externlist; nl; nl = nl->nl_next) if (!sys_load_lib(0, nl->nl_string)) post("%s: can't load library", nl->nl_string); /* open patches specifies with "-open" args */ for (nl = sys_openlist; nl; nl = nl->nl_next) openit(cwd, nl->nl_string); namelist_free(sys_openlist); sys_openlist = 0; /* send messages specified with "-send" args */ for (nl = sys_messagelist; nl; nl = nl->nl_next) { t_binbuf *b = binbuf_new(); binbuf_text(b, nl->nl_string, strlen(nl->nl_string)); binbuf_eval(b, 0, 0, 0); binbuf_free(b); } namelist_free(sys_messagelist); sys_messagelist = 0; }
void Pd::clearSearchPath() noexcept { Pd& pd = Pd::get(); std::lock_guard<std::mutex> guard(pd.m_mutex); namelist_free(sys_searchpath); sys_searchpath = NULL; }
void sys_setextrapath(const char *p) { char pathbuf[MAXPDSTRING]; namelist_free(sys_staticpath); /* add standard place for users to install stuff first */ #ifdef __gnu_linux__ sys_expandpath("~/pd-externals", pathbuf, MAXPDSTRING); sys_staticpath = namelist_append(0, pathbuf, 0); sys_staticpath = namelist_append(sys_staticpath, "/usr/local/lib/pd-externals", 0); #endif #ifdef __APPLE__ sys_expandpath("~/Library/Pd", pathbuf, MAXPDSTRING); sys_staticpath = namelist_append(0, pathbuf, 0); sys_staticpath = namelist_append(sys_staticpath, "/Library/Pd", 0); #endif #ifdef _WIN32 sys_expandpath("%ProgramFiles%/Common Files/Pd", pathbuf, MAXPDSTRING); sys_staticpath = namelist_append(0, pathbuf, 0); sys_expandpath("%UserProfile%/Application Data/Pd", pathbuf, MAXPDSTRING); sys_staticpath = namelist_append(sys_staticpath, pathbuf, 0); #endif /* add built-in "extra" path last so its checked last */ sys_staticpath = namelist_append(sys_staticpath, p, 0); }
/* new values from dialog window */ void glob_startup_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) { int i; namelist_free(sys_externlist); sys_externlist = 0; sys_defeatrt = atom_getintarg(0, argc, argv); sys_flags = sys_decodedialog(atom_getsymbolarg(1, argc, argv)); for (i = 0; i < argc-2; i++) { t_symbol *s = sys_decodedialog(atom_getsymbolarg(i+2, argc, argv)); if (*s->s_name) sys_externlist = namelist_append_files(sys_externlist, s->s_name); } }
/* new values from dialog window */ void glob_path_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) { int i; namelist_free(sys_searchpath); sys_searchpath = 0; sys_usestdpath = atom_getintarg(0, argc, argv); sys_verbose = atom_getintarg(1, argc, argv); for (i = 0; i < argc-2; i++) { t_symbol *s = sys_decodedialog(atom_getsymbolarg(i+2, argc, argv)); if (*s->s_name) sys_searchpath = namelist_append_files(sys_searchpath, s->s_name); } }
void cpd_searchpath_clear() { namelist_free(sys_searchpath); sys_searchpath = NULL; }
void sys_setextrapath(const char *p) { namelist_free(pd_extrapath); pd_extrapath = namelist_append(0, p, 0); }
void libpd_clear_search_path(void) { namelist_free(sys_searchpath); sys_searchpath = NULL; }
void libpd_clear_search_path(void) { sys_lock(); namelist_free(STUFF->st_searchpath); STUFF->st_searchpath = NULL; sys_unlock(); }