1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 * 16 * The Original Code is Copyright (C) 2007 Blender Foundation. 17 * All rights reserved. 18 */ 19 20 /** \file 21 * \ingroup spfile 22 */ 23 24 #pragma once 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 struct BlendHandle; 31 struct FileList; 32 struct FileSelection; 33 struct wmWindowManager; 34 35 struct FileDirEntry; 36 37 typedef enum FileSelType { 38 FILE_SEL_REMOVE = 0, 39 FILE_SEL_ADD = 1, 40 FILE_SEL_TOGGLE = 2, 41 } FileSelType; 42 43 typedef enum FileCheckType { 44 CHECK_DIRS = 1, 45 CHECK_FILES = 2, 46 CHECK_ALL = 3, 47 } FileCheckType; 48 49 struct ListBase *folderlist_new(void); 50 void folderlist_free(struct ListBase *folderlist); 51 struct ListBase *folderlist_duplicate(ListBase *folderlist); 52 void folderlist_popdir(struct ListBase *folderlist, char *dir); 53 void folderlist_pushdir(struct ListBase *folderlist, const char *dir); 54 const char *folderlist_peeklastdir(struct ListBase *folderlist); 55 int folderlist_clear_next(struct SpaceFile *sfile); 56 57 void filelist_setsorting(struct FileList *filelist, const short sort, bool invert_sort); 58 void filelist_sort(struct FileList *filelist); 59 60 void filelist_setfilter_options(struct FileList *filelist, 61 const bool do_filter, 62 const bool hide_dot, 63 const bool hide_parent, 64 const uint64_t filter, 65 const uint64_t filter_id, 66 const char *filter_glob, 67 const char *filter_search); 68 void filelist_filter(struct FileList *filelist); 69 70 void filelist_init_icons(void); 71 void filelist_free_icons(void); 72 void filelist_imgsize(struct FileList *filelist, short w, short h); 73 struct ImBuf *filelist_getimage(struct FileList *filelist, const int index); 74 struct ImBuf *filelist_geticon_image(struct FileList *filelist, const int index); 75 int filelist_geticon(struct FileList *filelist, const int index, const bool is_main); 76 77 struct FileList *filelist_new(short type); 78 void filelist_clear(struct FileList *filelist); 79 void filelist_clear_ex(struct FileList *filelist, const bool do_cache, const bool do_selection); 80 void filelist_free(struct FileList *filelist); 81 82 const char *filelist_dir(struct FileList *filelist); 83 bool filelist_is_dir(struct FileList *filelist, const char *path); 84 void filelist_setdir(struct FileList *filelist, char *r_dir); 85 86 int filelist_files_ensure(struct FileList *filelist); 87 int filelist_empty(struct FileList *filelist); 88 FileDirEntry *filelist_file(struct FileList *filelist, int index); 89 int filelist_file_findpath(struct FileList *filelist, const char *file); 90 FileDirEntry *filelist_entry_find_uuid(struct FileList *filelist, const int uuid[4]); 91 void filelist_file_cache_slidingwindow_set(struct FileList *filelist, size_t window_size); 92 bool filelist_file_cache_block(struct FileList *filelist, const int index); 93 94 bool filelist_force_reset(struct FileList *filelist); 95 bool filelist_pending(struct FileList *filelist); 96 bool filelist_is_ready(struct FileList *filelist); 97 98 unsigned int filelist_entry_select_set(const struct FileList *filelist, 99 const struct FileDirEntry *entry, 100 FileSelType select, 101 unsigned int flag, 102 FileCheckType check); 103 void filelist_entry_select_index_set(struct FileList *filelist, 104 const int index, 105 FileSelType select, 106 unsigned int flag, 107 FileCheckType check); 108 void filelist_entries_select_index_range_set(struct FileList *filelist, 109 FileSelection *sel, 110 FileSelType select, 111 unsigned int flag, 112 FileCheckType check); 113 unsigned int filelist_entry_select_get(struct FileList *filelist, 114 struct FileDirEntry *entry, 115 FileCheckType check); 116 unsigned int filelist_entry_select_index_get(struct FileList *filelist, 117 const int index, 118 FileCheckType check); 119 void filelist_entry_parent_select_set(struct FileList *filelist, 120 FileSelType select, 121 unsigned int flag, 122 FileCheckType check); 123 124 void filelist_setrecursion(struct FileList *filelist, const int recursion_level); 125 126 struct BlendHandle *filelist_lib(struct FileList *filelist); 127 bool filelist_islibrary(struct FileList *filelist, char *dir, char **r_group); 128 void filelist_freelib(struct FileList *filelist); 129 130 void filelist_readjob_start(struct FileList *filelist, const struct bContext *C); 131 void filelist_readjob_stop(struct wmWindowManager *wm, struct Scene *owner_scene); 132 int filelist_readjob_running(struct wmWindowManager *wm, struct Scene *owner_scene); 133 134 bool filelist_cache_previews_update(struct FileList *filelist); 135 void filelist_cache_previews_set(struct FileList *filelist, const bool use_previews); 136 bool filelist_cache_previews_running(struct FileList *filelist); 137 138 #ifdef __cplusplus 139 } 140 #endif 141