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_desktopfolder(); 00346 short path_createfolder(short path, char *name, short *newpath); 00347 00348 // internal use only -- not exported -- use path_createfolder() 00349 short path_createnewfolder(short path, char *name, short *newpath); 00350 00351 short path_copyfile(short srcpath, char *srcname, short dstpath, char *dstname); 00352 short path_copytotempfile(short srcpath, char *srcname, short *outpath, char *outname); 00353 short path_copyfolder(short srcpath, short dstpath, char *dstname, long recurse, short *newpath); 00354 short path_getpath(short path, char *name, short *outpath); 00355 short path_getname(short path, char *name, short *outpath); 00356 00357 00358 /** 00359 Create a fully qualified file name from a Path ID/file name combination. 00360 Unlike path_topotentialname(), this routine will only convert a 00361 pathname pair to a valid path string if the path exists. 00362 00363 @ingroup files 00364 @param path The path to be used. 00365 @param file The file name to be used. 00366 @param name Loaded with the fully extended file name on return. 00367 @return Returns 0 if successful, otherwise it returns an OS-specific error code. 00368 */ 00369 short path_topathname(short path, char *file, char *name); 00370 00371 00372 /** 00373 Create a filename and Path ID combination from a fully qualified file name. 00374 Note that path_frompathname() does not require that the file actually exist. 00375 In this way you can use it to convert a full path you may have received as an 00376 argument to a file writing message to a form appropriate to provide to 00377 a routine such as path_createfile(). 00378 00379 @ingroup files 00380 @param name The extended file path to be converted. 00381 @param path Contains the Path ID on return. 00382 @param filename Contains the file name on return. 00383 @return Returns 0 if successful, otherwise it returns an OS-specific error code. 00384 */ 00385 short path_frompathname(char *name, short *path, char *filename); 00386 00387 00388 short path_frompotentialpathname(char *name, short *path, char *filename); 00389 00390 00391 void path_splitnames(const char *pathname, char *foldername, char *filename); 00392 short path_getnext(t_pathlink *list, short *val); 00393 00394 00395 /** 00396 Install a path as the default search path. 00397 The default path is searched before the Max search path. For instance, 00398 when loading a patcher from a directory outside the search path, the 00399 patcher’s directory is searched for files before the search path. 00400 path_setdefault() allows you to set a path as the default. 00401 00402 @ingroup files 00403 @param path The path to use as the search path. 00404 If path is already part of the Max Search path, it will not be added 00405 (since, by default, it will be searched during file searches). 00406 @param recursive If non-zero, all subdirectories will be installed in the default search list. 00407 Be very careful with the use of the recursive argument—it has the capacity to 00408 slow down file searches dramatically as the list of folders is being built. 00409 Max itself never creates a hierarchical default search path. 00410 */ 00411 void path_setdefault(short path, short recursive); 00412 00413 00414 /** 00415 Retrieve the Path ID of the default search path. 00416 @ingroup files 00417 @return The path id of the default search path. 00418 */ 00419 short path_getdefault(void); 00420 00421 00422 void path_setdefaultlist(struct _pathlink *list); 00423 00424 00425 /** 00426 Determine the modification date of the selected path. 00427 00428 @ingroup files 00429 @param path The Path ID of the directory to check. 00430 @param date The last modification date of the directory. 00431 @return An error code. 00432 */ 00433 short path_getmoddate(short path, unsigned long *date); 00434 00435 00436 /** 00437 Determine the modification date of the selected file. 00438 00439 @ingroup files 00440 @param filename The name of the file to query. 00441 @param path The Path ID of the file. 00442 @param date The last modification date of the file upon return. 00443 @return An error code. 00444 */ 00445 short path_getfilemoddate(char *filename, short path, unsigned long *date); 00446 00447 00448 short path_getfilecreationdate(char *filename, short path, unsigned long *date); 00449 short path_getfilesize(char *filename, short path, unsigned long *date); 00450 long path_listcount(t_pathlink *list); 00451 00452 short nameinpath(char *name, short *ref); // <-- use path_nameinpath() 00453 short path_nameinpath(char *name, short path, short *ref); 00454 00455 short path_sysnameinpath(char *name, short *ref); 00456 00457 00458 /** 00459 Prepare a directory for iteration. 00460 @ingroup files 00461 @param path The directory Path ID to open. 00462 @return The return value of this routine is an internal “folder state” structure 00463 used for further folder manipulation. It should be saved and used for 00464 calls to path_foldernextfile() and path_closefolder(). 00465 If the folder cannot be found or accessed, path_openfolder() returns 0. 00466 */ 00467 void *path_openfolder(short path); 00468 00469 00470 /** 00471 Get the next file in the directory. 00472 In conjunction with path_openfolder() and path_closefolder(), 00473 this routine allows you to iterate through all of the files in a path. 00474 00475 @ingroup files 00476 @param xx The “folder state” value returned by path_openfolder(). 00477 @param filetype Contains the file type of the file type on return. 00478 @param name Contains the file name of the next file on return. 00479 @param descend Unused. 00480 @return Returns non-zero if successful, and zero when there are no more files. 00481 @see #e_max_path_folder_flags 00482 */ 00483 short path_foldernextfile(void *xx, long *filetype, char *name, short descend); 00484 00485 00486 /** 00487 Complete a directory iteration. 00488 @ingroup files 00489 @param x The “folder state” value originally returned by path_openfolder(). 00490 */ 00491 void path_closefolder(void *x); 00492 00493 00494 short path_renamefile(char *name, short path, char *newname); 00495 short path_getprefstring(short type, short index, t_symbol **s); 00496 void path_setprefstring(short type, short index, t_symbol *s, short update); 00497 void path_makefromsymbol(long pathtype, t_symbol *sp, short recursive); 00498 00499 /** 00500 Open a file given a filename and Path ID. 00501 00502 @ingroup files 00503 @param name The name of the file to be opened. 00504 @param path The Path ID of the file to be opened. 00505 @param ref A #t_filehandle reference to the opened file will be returned in this parameter. 00506 @param perm The permission for the opened file as defined in #e_max_openfile_permissions. 00507 @return An error code. 00508 */ 00509 short path_opensysfile(char *name, short path, t_filehandle *ref, short perm); 00510 00511 00512 /** 00513 Create a file given a type code, a filename, and a Path ID. 00514 00515 @ingroup files 00516 @param name The name of the file to be opened. 00517 @param path The Path ID of the file to be opened. 00518 @param type The file type of the created file. 00519 @param ref A #t_filehandle reference to the opened file will be returned in this parameter. 00520 @return An error code. 00521 */ 00522 short path_createsysfile(char *name, short path, long type, t_filehandle *ref); 00523 00524 00525 short path_createressysfile(char *name, short path, long type, t_filehandle *ref); 00526 00527 00528 /** 00529 Convert a source path string to destination path string using the specified style and type. 00530 00531 @ingroup files 00532 @param src A pointer to source character string to be converted. 00533 @param dst A pointer to destination character string. 00534 @param style The destination filepath style, as defined in #e_max_path_styles 00535 @param type The destination filepath type, as defined in #e_max_path_types 00536 @return An error code. 00537 00538 @see #MAX_PATH_CHARS 00539 */ 00540 short path_nameconform(char *src, char *dst, long style, long type); 00541 00542 short path_deletefile(char *name, short path); 00543 short path_extendedfileinfo(char *name, short path, t_fileinfo *info, long *typelist, short numtypes, short sniff); 00544 short path_getstyle(char *name); 00545 char path_getseparator(char *name); 00546 short path_fileisresource(char *name, short path); 00547 00548 /** 00549 Create a fully qualified file name from a Path ID/file name combination, 00550 regardless of whether or not the file exists on disk. 00551 00552 @ingroup files 00553 @param path The path to be used. 00554 @param file The file name to be used. 00555 @param name Loaded with the fully extended file name on return. 00556 @param check Flag to check if a file with the given path exists. 00557 @return Returns 0 if successful, otherwise it returns an OS-specific error code. 00558 00559 @see path_topathname() 00560 */ 00561 short path_topotentialname(short path, char *file, char *name, short check); 00562 00563 00564 #ifdef WIN_VERSION 00565 short path_topotentialunicodename(short path, char *file, unsigned short **name, long *outlen, short check); 00566 short path_fromunicodepathname(unsigned short *name, short *path, char *filename, short check); // if check is non-zero then file must exist 00567 #endif 00568 void path_addsearchpath(short path, short parent); 00569 void path_addnamed(long pathtype, char *name, short recursive, short permanent); 00570 00571 void path_removefromlist(t_pathlink **list, short parent); 00572 00573 short defvolume(void); // <-- use path_getdefault() 00574 short getfolder(short *vol); 00575 00576 00577 /** 00578 Present the user with the standard open file dialog. 00579 This function is convenient wrapper for using Mac OS Navigation 00580 Services or Standard File for opening files. 00581 00582 The mapping of extensions to types is configured in the C74:/init/max-fileformats.txt file. 00583 The standard types to use for Max files are ‘maxb’ for old-format binary files, 00584 ‘TEXT’ for text files, and 'JSON' for newer format patchers or other .json files. 00585 00586 @ingroup files 00587 @param name A C-string that will receive the name of the file the user wants to open. 00588 The C-string should be allocated with a size of at least #MAX_FILENAME_CHARS. 00589 @param volptr Receives the Path ID of the file the user wants to open. 00590 @param typeptr The file type of the file the user wants to open. 00591 @param types A list of file types to display. This is not limited to 4 00592 types as in the SFGetFile() trap. Pass NULL to display all types. 00593 @param ntypes The number of file types in typelist. Pass 0 to display all types. 00594 00595 @return 0 if the user clicked Open in the dialog box. 00596 If the user cancelled, open_dialog() returns a non-zero value. 00597 00598 @see saveasdialog_extended() 00599 @see locatefile_extended() 00600 */ 00601 short open_dialog(char *name, short *volptr, long *typeptr, long *types, short ntypes); 00602 00603 00604 /** 00605 Present the user with the standard save file dialog. 00606 00607 The mapping of extensions to types is configured in the C74:/init/max-fileformats.txt file. 00608 The standard types to use for Max files are ‘maxb’ for old-format binary files, 00609 ‘TEXT’ for text files, and 'JSON' for newer format patchers or other .json files. 00610 00611 @ingroup files 00612 @param filename A C-string containing a default name for the file to save. 00613 If the user decides to save a file, its name is returned here. 00614 The C-string should be allocated with a size of at least #MAX_FILENAME_CHARS. 00615 00616 @param path If the user decides to save the file, the Path ID of the location chosen is returned here. 00617 00618 @param binptr Pass NULL for this parameter. 00619 This parameter was used in Max 4 to allow the choice of saving binary or text format patchers. 00620 00621 @return 0 if the user choose to save the file. 00622 If the user cancelled, returns a non-zero value. 00623 00624 @see open_dialog() 00625 @see saveasdialog_extended() 00626 @see locatefile_extended() 00627 */ 00628 short saveas_dialog(char *filename, short *path, short *binptr); 00629 00630 00631 /** 00632 Present the user with the standard save file dialog with your own list of file types. 00633 00634 saveasdialog_extended() is similar to saveas_dialog(), but allows the 00635 additional feature of specifying a list of possible types. These will be 00636 displayed in a pop-up menu. 00637 00638 File types found in the typelist argument that match known Max types 00639 will be displayed with descriptive text. Unmatched types will simply 00640 display the type name (for example, "foXx" is not a standard type so it 00641 would be shown in the pop-up menu as foXx) 00642 00643 Known file types include: 00644 - TEXT: text file 00645 - maxb: Max binary patcher 00646 - maxc: Max collective 00647 - Midi: MIDI file 00648 - Sd2f: Sound Designer II audio file 00649 - NxTS: NeXT/Sun audio file 00650 - WAVE: WAVE audio file. 00651 - AIFF: AIFF audio file 00652 - mP3f: Max preference file 00653 - PICT: PICT graphic file 00654 - MooV: Quicktime movie file 00655 - aPcs: VST plug-in 00656 - AFxP: VST effect patch data file 00657 - AFxB: VST effect bank data file 00658 - DATA: Raw data audio file 00659 - ULAW: NeXT/Sun audio file 00660 00661 @ingroup files 00662 @param name A C-string containing a default name for the file to save. 00663 If the user decides to save a file, its name is returned here. 00664 The C-string should be allocated with a size of at least #MAX_FILENAME_CHARS. 00665 00666 @param vol If the user decides to save the file, the Path ID of the location chosen is returned here. 00667 00668 @param type Returns the type of file chosen by the user. 00669 @param typelist The list of types provided to the user. 00670 @param numtypes The number of file types in typelist. 00671 00672 @return 0 if the user choose to save the file. 00673 If the user cancelled, returns a non-zero value. 00674 00675 @see open_dialog() 00676 @see locatefile_extended() 00677 */ 00678 short saveasdialog_extended(char *name, short *vol, long *type, long *typelist, short numtypes); 00679 00680 void saveas_autoextension(char way); 00681 void saveas_setselectedtype(long type); 00682 00683 void typelist_make(long *types, long include, short *numtypes); 00684 00685 00686 00687 short preferences_path(char *name, short create, short *path); 00688 short preferences_subpath(char *name, short path, short create, short *subpath); 00689 short textpreferences_read(char *filename, short path, short defaultid); 00690 short textpreferences_default(short id); 00691 void *textpreferences_open(void); 00692 void textpreferences_addraw(void *p, char *fmt, ...); 00693 void textpreferences_add(void *p, char *fmt, ...); 00694 void textpreferences_addoption(void *p, char *fmt, ...); 00695 void textpreferences_addrect(void *p, char *msg, short top, short left, short bottom, short right); 00696 short textpreferences_close(void *p, char *filename, short path); 00697 00698 00699 00700 #if C74_PRAGMA_STRUCT_PACKPUSH 00701 #pragma pack(pop) 00702 #elif C74_PRAGMA_STRUCT_PACK 00703 #pragma pack() 00704 #endif 00705 00706 #ifdef __cplusplus 00707 } 00708 #endif 00709 00710 00711 #endif // _EXT_PATH_H_
Copyright © 2008, Cycling '74