Max 5 API Reference
00001 // ext_path.h -- path definitions 00002 00003 #ifndef _EXT_PATH_H_ 00004 #define _EXT_PATH_H_ 00005 00006 #ifdef __cplusplus 00007 extern "C" { 00008 #endif 00009 00010 #if C74_PRAGMA_STRUCT_PACKPUSH 00011 #pragma pack(push, 2) 00012 #elif C74_PRAGMA_STRUCT_PACK 00013 #pragma pack(2) 00014 #endif 00015 00016 00017 /** 00018 The size you should use when allocating strings for full paths. 00019 @ingroup files 00020 */ 00021 #define MAX_PATH_CHARS 2048 00022 00023 /** 00024 The size you should use when allocating strings for filenames. 00025 At the time of this writing it supports up to 256 UTF chars 00026 @ingroup files 00027 */ 00028 #define MAX_FILENAME_CHARS 512 00029 00030 00031 typedef short FILE_REF; 00032 00033 #define PATH_SEPARATOR_CHAR '/' 00034 #define PATH_SEPARATOR_STRING "/" 00035 #define PATH_CROSS_PLAT_NAMES 00036 #define SEPARATOR_CHAR PATH_SEPARATOR_CHAR // for backwards compatibility 00037 00038 00039 /** 00040 Constants that determine the output of path_nameconform(). 00041 @ingroup files 00042 @see #e_max_path_types 00043 @see path_nameconform() 00044 */ 00045 typedef enum { 00046 PATH_STYLE_MAX = 0, ///< use PATH_STYLE_MAX_PLAT 00047 PATH_STYLE_NATIVE, ///< use PATH_STYLE_NATIVE_PLAT 00048 PATH_STYLE_COLON, ///< ':' sep, "vol:" volume, ":" relative, "^:" boot 00049 PATH_STYLE_SLASH, ///< '/' sep, "vol:/" volume, "./" relative, "/" boot 00050 PATH_STYLE_NATIVE_WIN ///< '\\' sep, "vol:\\" volume, ".\\" relative, "\\" boot 00051 } e_max_path_styles; 00052 00053 #ifdef WIN_VERSION 00054 #define PATH_STYLE_MAX_PLAT PATH_STYLE_SLASH 00055 #define PATH_STYLE_NATIVE_PLAT PATH_STYLE_NATIVE_WIN 00056 #else 00057 #define PATH_STYLE_MAX_PLAT PATH_STYLE_SLASH 00058 #define PATH_STYLE_NATIVE_PLAT PATH_STYLE_SLASH // PATH_STYLE_COLON path changes for Max 5-jkc 00059 #endif 00060 00061 /** 00062 Constants that determine the output of path_nameconform(). 00063 @ingroup files 00064 @see #e_max_path_styles 00065 @see path_nameconform() 00066 */ 00067 typedef enum { 00068 PATH_TYPE_IGNORE = 0, ///< ignore 00069 PATH_TYPE_ABSOLUTE, ///< absolute path 00070 PATH_TYPE_RELATIVE, ///< relative path 00071 PATH_TYPE_BOOT, ///< boot path 00072 PATH_TYPE_C74, ///< Cycling '74 folder 00073 PATH_TYPE_PATH ///< path 00074 } e_max_path_types; 00075 00076 00077 #ifdef PATH_CROSS_PLAT_NAMES 00078 #define PATH_CHAR_IS_SEPARATOR(c) (((c) == ':') || ((c) == '/') || ((c) == '\\')) 00079 #else 00080 #define PATH_CHAR_IS_SEPARATOR(c) ((c) == PATH_SEPARATOR_CHAR) 00081 #endif 00082 00083 00084 /** 00085 Flags used to represent properties of a file in a #t_fileinfo struct. 00086 @ingroup files 00087 */ 00088 typedef enum { 00089 PATH_FILEINFO_ALIAS = 1, ///< alias 00090 PATH_FILEINFO_FOLDER = 2, ///< folder 00091 PATH_FILEINFO_PACKAGE = 4 ///< package (Mac-only) 00092 } e_max_fileinfo_flags; 00093 00094 #define FILEINFO_ALIAS PATH_FILEINFO_ALIAS // for backwards compatibility 00095 #define FILEINFO_FOLDER PATH_FILEINFO_FOLDER // for backwards compatibility 00096 00097 00098 /** Flags used by functions such as path_foldernextfile() and path_openfolder(). 00099 @ingroup files 00100 */ 00101 typedef enum { 00102 PATH_REPORTPACKAGEASFOLDER = 1, ///< if not true, then a Mac OS package will be reported as a file rather than a folder. 00103 PATH_FOLDER_SNIFF = 2 ///< sniff 00104 } e_max_path_folder_flags; 00105 00106 00107 /** 00108 Permissions or mode with which to open a file. 00109 @ingroup files 00110 */ 00111 typedef enum { 00112 PATH_READ_PERM = 1, ///< Read mode 00113 PATH_WRITE_PERM = 2, ///< Write mode 00114 PATH_RW_PERM = 3 ///< Read/Write mode 00115 } e_max_openfile_permissions; 00116 #define READ_PERM PATH_READ_PERM // for backwards compatibility 00117 #define WRITE_PERM PATH_WRITE_PERM // for backwards compatibility 00118 #define RW_PERM PATH_RW_PERM // for backwards compatibility 00119 00120 #define PATH_DEFAULT_PATHNAME_COUNT 16 00121 00122 // indices allow for fast access 00123 typedef enum { 00124 PATH_STARTUP_PATH = 0, 00125 PATH_SEARCH_PATH, 00126 PATH_ACTION_PATH, 00127 PATH_HELP_PATH 00128 } e_max_path_indices; 00129 00130 #define STARTUP_PATH PATH_STARTUP_PATH // for backwards compatibility 00131 #define SEARCH_PATH PATH_SEARCH_PATH // for backwards compatibility 00132 #define ACTION_PATH PATH_ACTION_PATH // for backwards compatibility 00133 #define HELP_PATH PATH_HELP_PATH // for backwards compatibility 00134 00135 00136 #define COLLECTIVE_FILECOPY 1 // flag for copying an object-used file to support path 00137 #define COLLECTIVE_COPYTOMADEFOLDER 2 // flag to copying to the folder you made 00138 00139 00140 #define TYPELIST_SIZE 32 //maximum number of types returned 00141 00142 typedef enum { 00143 TYPELIST_MAXFILES = 1, 00144 TYPELIST_EXTERNS = 2, 00145 TYPELIST_COLLECTIVES = 4 00146 } e_max_typelists; 00147 00148 00149 /** 00150 Information about a file. 00151 @ingroup files 00152 */ 00153 typedef struct _fileinfo { 00154 long type; ///< type (four-char-code) 00155 long creator; ///< Mac-only creator (four-char-code) 00156 long date; ///< date 00157 long flags; ///< One of the values defined in #e_max_fileinfo_flags 00158 } t_fileinfo; 00159 00160 00161 /** The path data structure. This struct is provided for debugging convenience, 00162 but should be considered opaque and is subject to change without notice. 00163 @ingroup files 00164 */ 00165 typedef struct _path { 00166 void *p_name; // all we have on Windows, may just be folder name on Mac 00167 long p_dirID; // directory ID on Mac 00168 short p_vRefNum; // volume on Mac 00169 short p_wd; // working directory on the Mac (compatibility mode) 00170 } t_path; 00171 00172 00173 /** The pathlink data structure. This struct is provided for debugging convenience, 00174 but should be considered opaque and is subject to change without notice. 00175 @ingroup files 00176 */ 00177 typedef struct _pathlink { 00178 short l_path; // index into path table, or p_wd in compatibility mode 00179 short l_ancestor; // logical parent, i.e., what path caused this path to be included 00180 short l_temp; // used for temporary flag when updating folders 00181 struct _pathlink *l_next; 00182 short l_parent; // true parent folder 00183 short l_recursive; // true if is or was added from a parent recursively 00184 void *l_watcher; // watcher to see if this folder changes 00185 } t_pathlink; 00186 00187 00188 // flags for t_searchpath 00189 typedef enum { 00190 PATH_FLAGS_RECURSIVE = 1 00191 } e_max_searchpath_flags; 00192 00193 00194 /** 00195 Retrieve the Path ID of the Max application. 00196 @ingroup files 00197 @return The path id. 00198 */ 00199 short path_getapppath(void); 00200 00201 short path_getsupportpath(void); 00202 00203 #ifdef MAC_VERSION 00204 00205 #ifndef __FILES__ 00206 #include <Files.h> 00207 #endif // __FILES__ 00208 00209 short path_tofsref(short path, char *filename, FSRef *ref); 00210 short path_fromfsref(FSRef *ref); 00211 #endif // MAC_VERSION 00212 00213 void path_namefrompathname(char *pathname, char *name); 00214 00215 00216 /** 00217 Find a Max document by name in the search path. 00218 This routine performs the same function as the routine path_getdefault(). 00219 locatefile() searches through the directories specified by the user for 00220 Patcher files and tables in the File Preferences dialog as well as the 00221 current default path (see path_getdefault) and the directory 00222 containing the Max application 00223 00224 @ingroup files 00225 @param name A C string that is the name of the file to look for. 00226 @param outvol The Path ID containing the location of the file if it is found. 00227 @param binflag If the file found is in binary format (it’s of type ‘maxb’) 1 is returned here; 00228 if it’s in text format, 0 is returned. 00229 00230 @return If a file is found with the name 00231 specified by filename, locatefile returns 0, otherwise it returns non-zero. 00232 00233 @remark filename and vol can then be passed to binbuf_read to read and open file the file. 00234 When using MAXplay, the search path consists of all subdirectories of 00235 the directory containing the MAXplay application. locatefile only 00236 searches for files of type ‘maxb’ and ‘TEXT.’ 00237 00238 @see locatefile_extended() 00239 */ 00240 short locatefile(char *name, short *outvol, short *binflag); 00241 00242 00243 /** 00244 Find a Max document by name in the search path. 00245 This function searches through the same directories as locatefile, 00246 but allows you to specify a type and creator of your own. 00247 00248 @ingroup files 00249 @param name A C string that is the name of the file to look for. 00250 @param outvol The Path ID containing the location of the file if it is found. 00251 @param filetype The filetype of the file to look for. 00252 If you pass 0L, files of all filetypes are considered. 00253 @param creator The creator of the file to look for. If you pass 0L, files with any creator are considered. 00254 00255 @return If a file is found with the name 00256 specified by filename, locatefile returns 0, otherwise it returns non-zero. 00257 00258 @see locatefile_extended() 00259 */ 00260 short locatefiletype(char *name, short *outvol, long filetype, long creator); 00261 00262 short locatefilelist(char *name, short *outvol, long *outtype, long *filetypelist, short numtypes); 00263 00264 00265 /** 00266 Find a Max document by name in the search path. 00267 This is the preferred method for file searching since its introduction in Max version 4. 00268 00269 This routine performs the same function as the routine path_getdefault(). 00270 locatefile() searches through the directories specified by the user for 00271 Patcher files and tables in the File Preferences dialog as well as the 00272 current default path (see path_getdefault) and the directory 00273 containing the Max application 00274 00275 @ingroup files 00276 @version 4.0 00277 00278 @param name The file name for the search, receives actual filename. 00279 @param outvol The Path ID of the file (if found). 00280 @param outtype The file type of the file (if found). 00281 @param filetypelist The file type(s) that you are searching for. 00282 @param numtypes The number of file types in the typelist array (1 if a single entry). 00283 00284 @return If a file is found with the name 00285 specified by filename, locatefile returns 0, otherwise it returns non-zero. 00286 00287 @remark The old file search routines locatefile() and locatefiletype() 00288 are still supported in Max 4, but the use of a new routine 00289 locatefile_extended() is highly recommended. However, 00290 locatefile_extended() has an important difference from 00291 locatefile() and locatefiletype() that may require some rewriting 00292 of your code. <em>It modifies its name parameter</em> in certain cases, while 00293 locatefile() and locatefiletype() do not. The two cases where it 00294 could modify the incoming filename string are 1) when an alias is 00295 specified, the file pointed to by the alias is returned; and 2) when a full 00296 path is specified, the output is the filename plus the path number of the 00297 folder it's in. 00298 00299 This is important because many people pass the s_name field of a 00300 #t_symbol to locatefile(). If the name field of a #t_symbol were to be 00301 modified, the symbol table would be corrupted. To avoid this problem, 00302 use strncpy_zero() to copy the contents of a #t_symbol to a character string first, 00303 as shown below: 00304 @code 00305 char filename[MAX_FILENAME_CHARS]; 00306 strncpy_zero(filename,str->s_name, MAX_FILENAME_CHARS); 00307 result = locatefile_extended(filename,&path,&type,typelist,1); 00308 @endcode 00309 */ 00310 short locatefile_extended(char *name, short *outvol, long *outtype, long *filetypelist, short numtypes); 00311 00312 short locatefile_pathlist(t_pathlink *list, char *name, short *outvol, long *outtype, long *filetypelist, short numtypes); 00313 00314 00315 /** 00316 Resolve a Path ID plus a (possibly extended) file name 00317 into a path that identifies the file’s directory and a filename. 00318 This routine converts a name and Path ID to a standard form in which 00319 the name has no path information and does not refer to an aliased file. 00320 00321 @ingroup files 00322 @param name A file name (which may be fully or partially qualified), 00323 will contain the file name on return. 00324 @param path The Path ID to be resolved. 00325 @param outpath The Path ID of the returned file name. 00326 00327 @return Returns 0 if successful. 00328 */ 00329 short path_resolvefile(char *name, short path, short *outpath); 00330 00331 00332 /** 00333 Retrive a #t_fileinfo structure from a file/path combination. 00334 00335 @ingroup files 00336 @param name The file name to be queried. 00337 @param path The Path ID of the file. 00338 @param info The address of a #t_fileinfo structure to contain the file information. 00339 00340 @return Returns 0 if successful, otherwise it returns an OS-specific error code. 00341 */ 00342 short path_fileinfo(char *name, short path, void *info); 00343 00344 short path_tempfolder(); 00345 short path_createfolder(short path, char *name, short *newpath); 00346 00347 // internal use only -- not exported -- use path_createfolder() 00348 short path_createnewfolder(short path, char *name, short *newpath); 00349 00350 short path_copyfile(short srcpath, char *srcname, short dstpath, char *dstname); 00351 short path_copytotempfile(short srcpath, char *srcname, short *outpath, char *outname); 00352 short path_copyfolder(short srcpath, short dstpath, char *dstname, long recurse, short *newpath); 00353 short path_getpath(short path, char *name, short *outpath); 00354 short path_getname(short path, char *name, short *outpath); 00355 00356 00357 /** 00358 Create a fully qualified file name from a Path ID/file name combination. 00359 Unlike path_topotentialname(), this routine will only convert a 00360 pathname pair to a valid path string if the path exists. 00361 00362 @ingroup files 00363 @param path The path to be used. 00364 @param file The file name to be used. 00365 @param name Loaded with the fully extended file name on return. 00366 @return Returns 0 if successful, otherwise it returns an OS-specific error code. 00367 */ 00368 short path_topathname(short path, char *file, char *name); 00369 00370 00371 /** 00372 Create a filename and Path ID combination from a fully qualified file name. 00373 Note that path_frompathname() does not require that the file actually exist. 00374 In this way you can use it to convert a full path you may have received as an 00375 argument to a file writing message to a form appropriate to provide to 00376 a routine such as path_createfile(). 00377 00378 @ingroup files 00379 @param name The extended file path to be converted. 00380 @param path Contains the Path ID on return. 00381 @param filename Contains the file name on return. 00382 @return Returns 0 if successful, otherwise it returns an OS-specific error code. 00383 */ 00384 short path_frompathname(char *name, short *path, char *filename); 00385 00386 00387 short path_frompotentialpathname(char *name, short *path, char *filename); 00388 00389 00390 void path_splitnames(const char *pathname, char *foldername, char *filename); 00391 short path_getnext(t_pathlink *list, short *val); 00392 00393 00394 /** 00395 Install a path as the default search path. 00396 The default path is searched before the Max search path. For instance, 00397 when loading a patcher from a directory outside the search path, the 00398 patcher’s directory is searched for files before the search path. 00399 path_setdefault() allows you to set a path as the default. 00400 00401 @ingroup files 00402 @param path The path to use as the search path. 00403 If path is already part of the Max Search path, it will not be added 00404 (since, by default, it will be searched during file searches). 00405 @param recursive If non-zero, all subdirectories will be installed in the default search list. 00406 Be very careful with the use of the recursive argument—it has the capacity to 00407 slow down file searches dramatically as the list of folders is being built. 00408 Max itself never creates a hierarchical default search path. 00409 */ 00410 void path_setdefault(short path, short recursive); 00411 00412 00413 /** 00414 Retrieve the Path ID of the default search path. 00415 @ingroup files 00416 @return The path id of the default search path. 00417 */ 00418 short path_getdefault(void); 00419 00420 00421 void path_setdefaultlist(struct _pathlink *list); 00422 00423 00424 /** 00425 Determine the modification date of the selected path. 00426 00427 @ingroup files 00428 @param path The Path ID of the directory to check. 00429 @param date The last modification date of the directory. 00430 @return An error code. 00431 */ 00432 short path_getmoddate(short path, unsigned long *date); 00433 00434 00435 /** 00436 Determine the modification date of the selected file. 00437 00438 @ingroup files 00439 @param filename The name of the file to query. 00440 @param path The Path ID of the file. 00441 @param date The last modification date of the file upon return. 00442 @return An error code. 00443 */ 00444 short path_getfilemoddate(char *filename, short path, unsigned long *date); 00445 00446 00447 short path_getfilecreationdate(char *filename, short path, unsigned long *date); 00448 short path_getfilesize(char *filename, short path, unsigned long *date); 00449 long path_listcount(t_pathlink *list); 00450 00451 short nameinpath(char *name, short *ref); // <-- use path_nameinpath() 00452 short path_nameinpath(char *name, short path, short *ref); 00453 00454 short path_sysnameinpath(char *name, short *ref); 00455 00456 00457 /** 00458 Prepare a directory for iteration. 00459 @ingroup files 00460 @param path The directory Path ID to open. 00461 @return The return value of this routine is an internal “folder state” structure 00462 used for further folder manipulation. It should be saved and used for 00463 calls to path_foldernextfile() and path_closefolder(). 00464 If the folder cannot be found or accessed, path_openfolder() returns 0. 00465 */ 00466 void *path_openfolder(short path); 00467 00468 00469 /** 00470 Get the next file in the directory. 00471 In conjunction with path_openfolder() and path_closefolder(), 00472 this routine allows you to iterate through all of the files in a path. 00473 00474 @ingroup files 00475 @param xx The “folder state” value returned by path_openfolder(). 00476 @param filetype Contains the file type of the file type on return. 00477 @param name Contains the file name of the next file on return. 00478 @param descend Unused. 00479 @return Returns non-zero if successful, and zero when there are no more files. 00480 @see #e_max_path_folder_flags 00481 */ 00482 short path_foldernextfile(void *xx, long *filetype, char *name, short descend); 00483 00484 00485 /** 00486 Complete a directory iteration. 00487 @ingroup files 00488 @param x The “folder state” value originally returned by path_openfolder(). 00489 */ 00490 void path_closefolder(void *x); 00491 00492 00493 short path_renamefile(char *name, short path, char *newname); 00494 short path_getprefstring(short type, short index, t_symbol **s); 00495 void path_setprefstring(short type, short index, t_symbol *s, short update); 00496 void path_makefromsymbol(long pathtype, t_symbol *sp, short recursive); 00497 00498 /** 00499 Open a file given a filename and Path ID. 00500 00501 @ingroup files 00502 @param name The name of the file to be opened. 00503 @param path The Path ID of the file to be opened. 00504 @param ref A #t_filehandle reference to the opened file will be returned in this parameter. 00505 @param perm The permission for the opened file as defined in #e_max_openfile_permissions. 00506 @return An error code. 00507 */ 00508 short path_opensysfile(char *name, short path, t_filehandle *ref, short perm); 00509 00510 00511 /** 00512 Create a file given a type code, a filename, and a Path ID. 00513 00514 @ingroup files 00515 @param name The name of the file to be opened. 00516 @param path The Path ID of the file to be opened. 00517 @param type The file type of the created file. 00518 @param ref A #t_filehandle reference to the opened file will be returned in this parameter. 00519 @return An error code. 00520 */ 00521 short path_createsysfile(char *name, short path, long type, t_filehandle *ref); 00522 00523 00524 short path_createressysfile(char *name, short path, long type, t_filehandle *ref); 00525 00526 00527 /** 00528 Convert a source path string to destination path string using the specified style and type. 00529 00530 @ingroup files 00531 @param src A pointer to source character string to be converted. 00532 @param dst A pointer to destination character string. 00533 @param style The destination filepath style, as defined in #e_max_path_styles 00534 @param type The destination filepath type, as defined in #e_max_path_types 00535 @return An error code. 00536 00537 @see #MAX_PATH_CHARS 00538 */ 00539 short path_nameconform(char *src, char *dst, long style, long type); 00540 00541 short path_deletefile(char *name, short path); 00542 short path_extendedfileinfo(char *name, short path, t_fileinfo *info, long *typelist, short numtypes, short sniff); 00543 short path_getstyle(char *name); 00544 char path_getseparator(char *name); 00545 short path_fileisresource(char *name, short path); 00546 00547 /** 00548 Create a fully qualified file name from a Path ID/file name combination, 00549 regardless of whether or not the file exists on disk. 00550 00551 @ingroup files 00552 @param path The path to be used. 00553 @param file The file name to be used. 00554 @param name Loaded with the fully extended file name on return. 00555 @param check Flag to check if a file with the given path exists. 00556 @return Returns 0 if successful, otherwise it returns an OS-specific error code. 00557 00558 @see path_topathname() 00559 */ 00560 short path_topotentialname(short path, char *file, char *name, short check); 00561 00562 00563 #ifdef WIN_VERSION 00564 short path_topotentialunicodename(short path, char *file, unsigned short **name, long *outlen, short check); 00565 short path_fromunicodepathname(unsigned short *name, short *path, char *filename, short check); // if check is non-zero then file must exist 00566 #endif 00567 void path_addsearchpath(short path, short parent); 00568 void path_addnamed(long pathtype, char *name, short recursive, short permanent); 00569 00570 void path_removefromlist(t_pathlink **list, short parent); 00571 00572 short defvolume(void); // <-- use path_getdefault() 00573 short getfolder(short *vol); 00574 00575 00576 /** 00577 Present the user with the standard open file dialog. 00578 This function is convenient wrapper for using Mac OS Navigation 00579 Services or Standard File for opening files. 00580 00581 The mapping of extensions to types is configured in the C74:/init/max-fileformats.txt file. 00582 The standard types to use for Max files are ‘maxb’ for old-format binary files, 00583 ‘TEXT’ for text files, and 'JSON' for newer format patchers or other .json files. 00584 00585 @ingroup files 00586 @param name A C-string that will receive the name of the file the user wants to open. 00587 The C-string should be allocated with a size of at least #MAX_FILENAME_CHARS. 00588 @param volptr Receives the Path ID of the file the user wants to open. 00589 @param typeptr The file type of the file the user wants to open. 00590 @param types A list of file types to display. This is not limited to 4 00591 types as in the SFGetFile() trap. Pass NULL to display all types. 00592 @param ntypes The number of file types in typelist. Pass 0 to display all types. 00593 00594 @return 0 if the user clicked Open in the dialog box. 00595 If the user cancelled, open_dialog() returns a non-zero value. 00596 00597 @see saveasdialog_extended() 00598 @see locatefile_extended() 00599 */ 00600 short open_dialog(char *name, short *volptr, long *typeptr, long *types, short ntypes); 00601 00602 00603 /** 00604 Present the user with the standard save file dialog. 00605 00606 The mapping of extensions to types is configured in the C74:/init/max-fileformats.txt file. 00607 The standard types to use for Max files are ‘maxb’ for old-format binary files, 00608 ‘TEXT’ for text files, and 'JSON' for newer format patchers or other .json files. 00609 00610 @ingroup files 00611 @param filename A C-string containing a default name for the file to save. 00612 If the user decides to save a file, its name is returned here. 00613 The C-string should be allocated with a size of at least #MAX_FILENAME_CHARS. 00614 00615 @param path If the user decides to save the file, the Path ID of the location chosen is returned here. 00616 00617 @param binptr Pass NULL for this parameter. 00618 This parameter was used in Max 4 to allow the choice of saving binary or text format patchers. 00619 00620 @return 0 if the user choose to save the file. 00621 If the user cancelled, returns a non-zero value. 00622 00623 @see open_dialog() 00624 @see saveasdialog_extended() 00625 @see locatefile_extended() 00626 */ 00627 short saveas_dialog(char *filename, short *path, short *binptr); 00628 00629 00630 /** 00631 Present the user with the standard save file dialog with your own list of file types. 00632 00633 saveasdialog_extended() is similar to saveas_dialog(), but allows the 00634 additional feature of specifying a list of possible types. These will be 00635 displayed in a pop-up menu. 00636 00637 File types found in the typelist argument that match known Max types 00638 will be displayed with descriptive text. Unmatched types will simply 00639 display the type name (for example, "foXx" is not a standard type so it 00640 would be shown in the pop-up menu as foXx) 00641 00642 Known file types include: 00643 - TEXT: text file 00644 - maxb: Max binary patcher 00645 - maxc: Max collective 00646 - Midi: MIDI file 00647 - Sd2f: Sound Designer II audio file 00648 - NxTS: NeXT/Sun audio file 00649 - WAVE: WAVE audio file. 00650 - AIFF: AIFF audio file 00651 - mP3f: Max preference file 00652 - PICT: PICT graphic file 00653 - MooV: Quicktime movie file 00654 - aPcs: VST plug-in 00655 - AFxP: VST effect patch data file 00656 - AFxB: VST effect bank data file 00657 - DATA: Raw data audio file 00658 - ULAW: NeXT/Sun audio file 00659 00660 @ingroup files 00661 @param name A C-string containing a default name for the file to save. 00662 If the user decides to save a file, its name is returned here. 00663 The C-string should be allocated with a size of at least #MAX_FILENAME_CHARS. 00664 00665 @param vol If the user decides to save the file, the Path ID of the location chosen is returned here. 00666 00667 @param type Returns the type of file chosen by the user. 00668 @param typelist The list of types provided to the user. 00669 @param numtypes The number of file types in typelist. 00670 00671 @return 0 if the user choose to save the file. 00672 If the user cancelled, returns a non-zero value. 00673 00674 @see open_dialog() 00675 @see locatefile_extended() 00676 */ 00677 short saveasdialog_extended(char *name, short *vol, long *type, long *typelist, short numtypes); 00678 00679 void saveas_autoextension(char way); 00680 void saveas_setselectedtype(long type); 00681 00682 void typelist_make(long *types, long include, short *numtypes); 00683 00684 00685 00686 short preferences_path(char *name, short create, short *path); 00687 short preferences_subpath(char *name, short path, short create, short *subpath); 00688 short textpreferences_read(char *filename, short path, short defaultid); 00689 short textpreferences_default(short id); 00690 void *textpreferences_open(void); 00691 void textpreferences_addraw(void *p, char *fmt, ...); 00692 void textpreferences_add(void *p, char *fmt, ...); 00693 void textpreferences_addoption(void *p, char *fmt, ...); 00694 void textpreferences_addrect(void *p, char *msg, short top, short left, short bottom, short right); 00695 short textpreferences_close(void *p, char *filename, short path); 00696 00697 00698 00699 #if C74_PRAGMA_STRUCT_PACKPUSH 00700 #pragma pack(pop) 00701 #elif C74_PRAGMA_STRUCT_PACK 00702 #pragma pack() 00703 #endif 00704 00705 #ifdef __cplusplus 00706 } 00707 #endif 00708 00709 00710 #endif // _EXT_PATH_H_
Copyright © 2008, Cycling '74