Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_file/filesel.c
| Show First 20 Lines • Show All 628 Lines • ▼ Show 20 Lines | if (fnmatch(pattern, file->relname, 0) == 0) { | ||||
| } | } | ||||
| match++; | match++; | ||||
| } | } | ||||
| } | } | ||||
| return match; | return match; | ||||
| } | } | ||||
| bool autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v)) | int autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v)) | ||||
| { | { | ||||
| SpaceFile *sfile = CTX_wm_space_file(C); | SpaceFile *sfile = CTX_wm_space_file(C); | ||||
| int match = AUTOCOMPLETE_NO_MATCH; | int match = AUTOCOMPLETE_NO_MATCH; | ||||
| /* search if str matches the beginning of name */ | /* search if str matches the beginning of name */ | ||||
| if (str[0] && sfile->files) { | if (str[0] && sfile->files) { | ||||
| char dirname[FILE_MAX]; | char dirname[FILE_MAX]; | ||||
| Show All 33 Lines | if (dir) { | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_strncpy(sfile->params->dir, str, sizeof(sfile->params->dir)); | BLI_strncpy(sfile->params->dir, str, sizeof(sfile->params->dir)); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return match == AUTOCOMPLETE_FULL_MATCH; | return match; | ||||
| } | } | ||||
| bool autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v)) | int autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v)) | ||||
| { | { | ||||
| SpaceFile *sfile = CTX_wm_space_file(C); | SpaceFile *sfile = CTX_wm_space_file(C); | ||||
| int match = AUTOCOMPLETE_NO_MATCH; | int match = AUTOCOMPLETE_NO_MATCH; | ||||
| /* search if str matches the beginning of name */ | /* search if str matches the beginning of name */ | ||||
| if (str[0] && sfile->files) { | if (str[0] && sfile->files) { | ||||
| AutoComplete *autocpl = autocomplete_begin(str, FILE_MAX); | AutoComplete *autocpl = autocomplete_begin(str, FILE_MAX); | ||||
| int nentries = filelist_numfiles(sfile->files); | int nentries = filelist_numfiles(sfile->files); | ||||
| int i; | int i; | ||||
| for (i = 0; i < nentries; ++i) { | for (i = 0; i < nentries; ++i) { | ||||
| struct direntry *file = filelist_file(sfile->files, i); | struct direntry *file = filelist_file(sfile->files, i); | ||||
| if (file && (S_ISREG(file->type) || S_ISDIR(file->type))) { | if (file && (S_ISREG(file->type) || S_ISDIR(file->type))) { | ||||
| autocomplete_do_name(autocpl, file->relname); | autocomplete_do_name(autocpl, file->relname); | ||||
| } | } | ||||
| } | } | ||||
| match = autocomplete_end(autocpl, str); | match = autocomplete_end(autocpl, str); | ||||
| } | } | ||||
| return match == AUTOCOMPLETE_FULL_MATCH; | |||||
| return match; | |||||
| } | } | ||||
| void ED_fileselect_clear(struct wmWindowManager *wm, struct SpaceFile *sfile) | void ED_fileselect_clear(struct wmWindowManager *wm, struct SpaceFile *sfile) | ||||
| { | { | ||||
| /* only NULL in rare cases - [#29734] */ | /* only NULL in rare cases - [#29734] */ | ||||
| if (sfile->files) { | if (sfile->files) { | ||||
| thumbnails_stop(wm, sfile->files); | thumbnails_stop(wm, sfile->files); | ||||
| filelist_freelib(sfile->files); | filelist_freelib(sfile->files); | ||||
| Show All 25 Lines | |||||