diff --git a/source/blender/editors/space_file/file_intern.hh b/source/blender/editors/space_file/file_intern.hh index f65d440c46b..25261671b50 100644 --- a/source/blender/editors/space_file/file_intern.hh +++ b/source/blender/editors/space_file/file_intern.hh @@ -19,6 +19,7 @@ struct AssetLibrary; struct bContextDataResult; struct FileAssetSelectParams; struct FileSelectParams; +struct Main; struct SpaceFile; struct View2D; struct uiLayout; @@ -29,7 +30,7 @@ bool file_main_region_needs_refresh_before_draw(SpaceFile *sfile); int /*eContextResult*/ file_context(const bContext *C, const char *member, - struct bContextDataResult *result); + bContextDataResult *result); /* `file_draw.cc` */ @@ -46,7 +47,7 @@ void file_draw_list(const bContext *C, ARegion *region); */ bool file_draw_hint_if_invalid(const bContext *C, const SpaceFile *sfile, ARegion *region); -void file_draw_check_ex(bContext *C, struct ScrArea *area); +void file_draw_check_ex(bContext *C, ScrArea *area); void file_draw_check(bContext *C); /** * For use with; #UI_block_func_set. @@ -59,64 +60,58 @@ bool file_draw_check_exists(SpaceFile *sfile); struct wmOperator; struct wmOperatorType; -void FILE_OT_highlight(struct wmOperatorType *ot); -void FILE_OT_sort_column_ui_context(struct wmOperatorType *ot); -void FILE_OT_select(struct wmOperatorType *ot); -void FILE_OT_select_walk(struct wmOperatorType *ot); -void FILE_OT_select_all(struct wmOperatorType *ot); -void FILE_OT_select_box(struct wmOperatorType *ot); -void FILE_OT_select_bookmark(struct wmOperatorType *ot); -void FILE_OT_bookmark_add(struct wmOperatorType *ot); -void FILE_OT_bookmark_delete(struct wmOperatorType *ot); -void FILE_OT_bookmark_cleanup(struct wmOperatorType *ot); -void FILE_OT_bookmark_move(struct wmOperatorType *ot); +void FILE_OT_highlight(wmOperatorType *ot); +void FILE_OT_sort_column_ui_context(wmOperatorType *ot); +void FILE_OT_select(wmOperatorType *ot); +void FILE_OT_select_walk(wmOperatorType *ot); +void FILE_OT_select_all(wmOperatorType *ot); +void FILE_OT_select_box(wmOperatorType *ot); +void FILE_OT_select_bookmark(wmOperatorType *ot); +void FILE_OT_bookmark_add(wmOperatorType *ot); +void FILE_OT_bookmark_delete(wmOperatorType *ot); +void FILE_OT_bookmark_cleanup(wmOperatorType *ot); +void FILE_OT_bookmark_move(wmOperatorType *ot); void FILE_OT_reset_recent(wmOperatorType *ot); -void FILE_OT_hidedot(struct wmOperatorType *ot); -void FILE_OT_execute(struct wmOperatorType *ot); +void FILE_OT_hidedot(wmOperatorType *ot); +void FILE_OT_execute(wmOperatorType *ot); -void FILE_OT_external_operation(struct wmOperatorType *ot); +void FILE_OT_external_operation(wmOperatorType *ot); void file_external_operations_menu_register(void); /** * Variation of #FILE_OT_execute that accounts for some mouse specific handling. * Otherwise calls the same logic. */ -void FILE_OT_mouse_execute(struct wmOperatorType *ot); -void FILE_OT_cancel(struct wmOperatorType *ot); -void FILE_OT_parent(struct wmOperatorType *ot); -void FILE_OT_directory_new(struct wmOperatorType *ot); -void FILE_OT_previous(struct wmOperatorType *ot); -void FILE_OT_next(struct wmOperatorType *ot); -void FILE_OT_refresh(struct wmOperatorType *ot); -void FILE_OT_filenum(struct wmOperatorType *ot); -void FILE_OT_delete(struct wmOperatorType *ot); -void FILE_OT_rename(struct wmOperatorType *ot); -void FILE_OT_smoothscroll(struct wmOperatorType *ot); -void FILE_OT_filepath_drop(struct wmOperatorType *ot); -void FILE_OT_start_filter(struct wmOperatorType *ot); -void FILE_OT_edit_directory_path(struct wmOperatorType *ot); -void FILE_OT_view_selected(struct wmOperatorType *ot); +void FILE_OT_mouse_execute(wmOperatorType *ot); +void FILE_OT_cancel(wmOperatorType *ot); +void FILE_OT_parent(wmOperatorType *ot); +void FILE_OT_directory_new(wmOperatorType *ot); +void FILE_OT_previous(wmOperatorType *ot); +void FILE_OT_next(wmOperatorType *ot); +void FILE_OT_refresh(wmOperatorType *ot); +void FILE_OT_filenum(wmOperatorType *ot); +void FILE_OT_delete(wmOperatorType *ot); +void FILE_OT_rename(wmOperatorType *ot); +void FILE_OT_smoothscroll(wmOperatorType *ot); +void FILE_OT_filepath_drop(wmOperatorType *ot); +void FILE_OT_start_filter(wmOperatorType *ot); +void FILE_OT_edit_directory_path(wmOperatorType *ot); +void FILE_OT_view_selected(wmOperatorType *ot); void file_directory_enter_handle(bContext *C, void *arg_unused, void *arg_but); void file_filename_enter_handle(bContext *C, void *arg_unused, void *arg_but); -int file_highlight_set(struct SpaceFile *sfile, struct ARegion *region, int mx, int my); +int file_highlight_set(SpaceFile *sfile, ARegion *region, int mx, int my); /** * Use to set the file selector path from some arbitrary source. */ -void file_sfile_filepath_set(struct SpaceFile *sfile, const char *filepath); -void file_sfile_to_operator_ex(struct bContext *C, - struct Main *bmain, - struct wmOperator *op, - struct SpaceFile *sfile, - char *filepath); -void file_sfile_to_operator(struct bContext *C, - struct Main *bmain, - struct wmOperator *op, - struct SpaceFile *sfile); +void file_sfile_filepath_set(SpaceFile *sfile, const char *filepath); +void file_sfile_to_operator_ex( + bContext *C, Main *bmain, wmOperator *op, SpaceFile *sfile, char *filepath); +void file_sfile_to_operator(bContext *C, Main *bmain, wmOperator *op, SpaceFile *sfile); -void file_operator_to_sfile(struct Main *bmain, struct SpaceFile *sfile, struct wmOperator *op); +void file_operator_to_sfile(Main *bmain, SpaceFile *sfile, wmOperator *op); /* `space_file.cc` */ @@ -124,17 +119,17 @@ extern const char *file_context_dir[]; /* doc access */ /* `filesel.cc` */ -void fileselect_refresh_params(struct SpaceFile *sfile); +void fileselect_refresh_params(SpaceFile *sfile); /** * Sets #FileSelectParams.file (name of selected file) */ -void fileselect_file_set(struct bContext *C, SpaceFile *sfile, int index); +void fileselect_file_set(bContext *C, SpaceFile *sfile, int index); bool file_attribute_column_type_enabled(const FileSelectParams *params, FileAttributeColumnType column); /** * Check if the region coordinate defined by \a x and \a y are inside the column header. */ -bool file_attribute_column_header_is_inside(const struct View2D *v2d, +bool file_attribute_column_header_is_inside(const View2D *v2d, const FileLayout *layout, int x, int y); @@ -149,39 +144,35 @@ float file_string_width(const char *str); float file_font_pointsize(void); void file_select_deselect_all(SpaceFile *sfile, eDirEntry_SelectFlag flag); -int file_select_match(struct SpaceFile *sfile, const char *pattern, char *matched_file); -int autocomplete_directory(struct bContext *C, char *str, void *arg_v); -int autocomplete_file(struct bContext *C, char *str, void *arg_v); +int file_select_match(SpaceFile *sfile, const char *pattern, char *matched_file); +int autocomplete_directory(bContext *C, char *str, void *arg_v); +int autocomplete_file(bContext *C, char *str, void *arg_v); -void file_params_smoothscroll_timer_clear(struct wmWindowManager *wm, - struct wmWindow *win, - SpaceFile *sfile); -void file_params_renamefile_clear(struct FileSelectParams *params); +void file_params_smoothscroll_timer_clear(wmWindowManager *wm, wmWindow *win, SpaceFile *sfile); +void file_params_renamefile_clear(FileSelectParams *params); /** * Set the renaming-state to #FILE_PARAMS_RENAME_POSTSCROLL_PENDING and trigger the smooth-scroll * timer. To be used right after a file was renamed. * Note that the caller is responsible for setting the correct rename-file info * (#FileSelectParams.renamefile or #FileSelectParams.rename_id). */ -void file_params_invoke_rename_postscroll(struct wmWindowManager *wm, - struct wmWindow *win, - SpaceFile *sfile); +void file_params_invoke_rename_postscroll(wmWindowManager *wm, wmWindow *win, SpaceFile *sfile); /** * To be executed whenever renaming ends (successfully or not). */ -void file_params_rename_end(struct wmWindowManager *wm, - struct wmWindow *win, +void file_params_rename_end(wmWindowManager *wm, + wmWindow *win, SpaceFile *sfile, - struct FileDirEntry *rename_file); + FileDirEntry *rename_file); /** * Helper used by both main update code, and smooth-scroll timer, * to try to enable rename editing from #FileSelectParams.renamefile name. */ -void file_params_renamefile_activate(struct SpaceFile *sfile, struct FileSelectParams *params); +void file_params_renamefile_activate(SpaceFile *sfile, FileSelectParams *params); typedef void *onReloadFnData; -typedef void (*onReloadFn)(struct SpaceFile *space_data, onReloadFnData custom_data); -typedef struct SpaceFile_Runtime { +typedef void (*onReloadFn)(SpaceFile *space_data, onReloadFnData custom_data); +struct SpaceFile_Runtime { /* Called once after the file browser has reloaded. Reset to NULL after calling. * Use file_on_reload_callback_register() to register a callback. */ onReloadFn on_reload; @@ -192,34 +183,34 @@ typedef struct SpaceFile_Runtime { bool is_blendfile_status_set; bool is_blendfile_readable; ReportList is_blendfile_readable_reports; -} SpaceFile_Runtime; +}; /** * Register an on-reload callback function. Note that there can only be one such function at a * time; registering a new one will overwrite the previous one. */ -void file_on_reload_callback_register(struct SpaceFile *sfile, +void file_on_reload_callback_register(SpaceFile *sfile, onReloadFn callback, onReloadFnData custom_data); /* folder_history.cc */ /* not listbase itself */ -void folderlist_free(struct ListBase *folderlist); -void folderlist_popdir(struct ListBase *folderlist, char *dir); -void folderlist_pushdir(struct ListBase *folderlist, const char *dir); -const char *folderlist_peeklastdir(struct ListBase *folderlist); -bool folderlist_clear_next(struct SpaceFile *sfile); +void folderlist_free(ListBase *folderlist); +void folderlist_popdir(ListBase *folderlist, char *dir); +void folderlist_pushdir(ListBase *folderlist, const char *dir); +const char *folderlist_peeklastdir(ListBase *folderlist); +bool folderlist_clear_next(SpaceFile *sfile); -void folder_history_list_ensure_for_active_browse_mode(struct SpaceFile *sfile); -void folder_history_list_free(struct SpaceFile *sfile); -struct ListBase folder_history_list_duplicate(struct ListBase *listbase); +void folder_history_list_ensure_for_active_browse_mode(SpaceFile *sfile); +void folder_history_list_free(SpaceFile *sfile); +ListBase folder_history_list_duplicate(ListBase *listbase); /* `file_panels.cc` */ -void file_tool_props_region_panels_register(struct ARegionType *art); -void file_execute_region_panels_register(struct ARegionType *art); -void file_tools_region_panels_register(struct ARegionType *art); +void file_tool_props_region_panels_register(ARegionType *art); +void file_execute_region_panels_register(ARegionType *art); +void file_tools_region_panels_register(ARegionType *art); /* `file_utils.cc` */ @@ -235,8 +226,8 @@ void file_path_to_ui_path(const char *path, char *r_pathi, int max_size); /* C-handle for #ed::asset_browser::AssetCatalogFilterSettings. */ typedef struct FileAssetCatalogFilterSettingsHandle FileAssetCatalogFilterSettingsHandle; -void file_create_asset_catalog_tree_view_in_layout(struct AssetLibrary *asset_library, - struct uiLayout *layout, +void file_create_asset_catalog_tree_view_in_layout(AssetLibrary *asset_library, + uiLayout *layout, SpaceFile *space_file, FileAssetSelectParams *params); diff --git a/source/blender/editors/space_file/filelist.hh b/source/blender/editors/space_file/filelist.hh index 24e37af3889..4d1cd1e7d5e 100644 --- a/source/blender/editors/space_file/filelist.hh +++ b/source/blender/editors/space_file/filelist.hh @@ -8,11 +8,15 @@ #pragma once +struct AssetLibrary; struct AssetLibraryReference; +struct bContext; struct BlendHandle; struct FileIndexerType; struct FileList; struct FileSelection; +struct ID; +struct ImBuf; struct bUUID; struct wmWindowManager; @@ -20,22 +24,22 @@ struct FileDirEntry; typedef uint32_t FileUID; -typedef enum FileSelType { +enum FileSelType { FILE_SEL_REMOVE = 0, FILE_SEL_ADD = 1, FILE_SEL_TOGGLE = 2, -} FileSelType; +}; -typedef enum FileCheckType { +enum FileCheckType { CHECK_DIRS = 1, CHECK_FILES = 2, CHECK_ALL = 3, -} FileCheckType; +}; -void filelist_setsorting(struct FileList *filelist, short sort, bool invert_sort); -void filelist_sort(struct FileList *filelist); +void filelist_setsorting(FileList *filelist, short sort, bool invert_sort); +void filelist_sort(FileList *filelist); -void filelist_setfilter_options(struct FileList *filelist, +void filelist_setfilter_options(FileList *filelist, bool do_filter, bool hide_dot, bool hide_parent, @@ -49,38 +53,37 @@ void filelist_setfilter_options(struct FileList *filelist, * * The given indexer allocation should be handled by the caller or defined statically. */ -void filelist_setindexer(struct FileList *filelist, const struct FileIndexerType *indexer); +void filelist_setindexer(FileList *filelist, const FileIndexerType *indexer); /** * \param catalog_id: The catalog that should be filtered by if \a catalog_visibility is * #FILE_SHOW_ASSETS_FROM_CATALOG. May be NULL otherwise. */ void filelist_set_asset_catalog_filter_options( - struct FileList *filelist, + FileList *filelist, eFileSel_Params_AssetCatalogVisibility catalog_visibility, - const struct bUUID *catalog_id); -void filelist_tag_needs_filtering(struct FileList *filelist); -void filelist_filter(struct FileList *filelist); + const bUUID *catalog_id); +void filelist_tag_needs_filtering(FileList *filelist); +void filelist_filter(FileList *filelist); /** * \param asset_library_ref: May be NULL to unset the library. */ -void filelist_setlibrary(struct FileList *filelist, - const struct AssetLibraryReference *asset_library_ref); +void filelist_setlibrary(FileList *filelist, const AssetLibraryReference *asset_library_ref); void filelist_init_icons(void); void filelist_free_icons(void); -void filelist_file_get_full_path(const struct FileList *filelist, +void filelist_file_get_full_path(const FileList *filelist, const FileDirEntry *file, char r_filepath[/*FILE_MAX_LIBEXTRA*/]); -struct ImBuf *filelist_getimage(struct FileList *filelist, int index); -struct ImBuf *filelist_file_getimage(const FileDirEntry *file); -struct ImBuf *filelist_geticon_image_ex(const FileDirEntry *file); -struct ImBuf *filelist_geticon_image(struct FileList *filelist, int index); -int filelist_geticon(struct FileList *filelist, int index, bool is_main); +ImBuf *filelist_getimage(FileList *filelist, int index); +ImBuf *filelist_file_getimage(const FileDirEntry *file); +ImBuf *filelist_geticon_image_ex(const FileDirEntry *file); +ImBuf *filelist_geticon_image(FileList *filelist, int index); +int filelist_geticon(FileList *filelist, int index, bool is_main); -struct FileList *filelist_new(short type); -void filelist_settype(struct FileList *filelist, short type); -void filelist_clear(struct FileList *filelist); -void filelist_clear_ex(struct FileList *filelist, +FileList *filelist_new(short type); +void filelist_settype(FileList *filelist, short type); +void filelist_clear(FileList *filelist); +void filelist_clear_ex(FileList *filelist, bool do_asset_library, bool do_cache, bool do_selection); @@ -88,19 +91,19 @@ void filelist_clear_ex(struct FileList *filelist, * A "smarter" version of #filelist_clear() that calls partial clearing based on the filelist * force-reset flags. */ -void filelist_clear_from_reset_tag(struct FileList *filelist); -void filelist_free(struct FileList *filelist); +void filelist_clear_from_reset_tag(FileList *filelist); +void filelist_free(FileList *filelist); /** * Get the root path of the file list. To get the full path for a file, use * #filelist_file_get_full_path(). */ -const char *filelist_dir(const struct FileList *filelist); -bool filelist_is_dir(const struct FileList *filelist, const char *path); +const char *filelist_dir(const FileList *filelist); +bool filelist_is_dir(const FileList *filelist, const char *path); /** * May modify in place given `dirpath`, which is expected to be #FILE_MAX_LIBEXTRA length. */ -void filelist_setdir(struct FileList *filelist, char dirpath[1090 /*FILE_MAX_LIBEXTRA*/]); +void filelist_setdir(FileList *filelist, char dirpath[1090 /*FILE_MAX_LIBEXTRA*/]); /** * Limited version of full update done by space_file's file_refresh(), @@ -108,8 +111,8 @@ void filelist_setdir(struct FileList *filelist, char dirpath[1090 /*FILE_MAX_LIB * Ensures given filelist is ready to be used (i.e. it is filtered and sorted), * unless it is tagged for a full refresh. */ -int filelist_files_ensure(struct FileList *filelist); -int filelist_needs_reading(const struct FileList *filelist); +int filelist_files_ensure(FileList *filelist); +int filelist_needs_reading(const FileList *filelist); /** * Request a file from the file browser cache, adding it to the cache if necessary. * @@ -120,99 +123,97 @@ int filelist_needs_reading(const struct FileList *filelist); * #filelist_entry_get_id(), that take a file index and return data directly from the * #FileListInternEntry. */ -FileDirEntry *filelist_file(struct FileList *filelist, int index); -FileDirEntry *filelist_file_ex(struct FileList *filelist, int index, bool use_request); +FileDirEntry *filelist_file(FileList *filelist, int index); +FileDirEntry *filelist_file_ex(FileList *filelist, int index, bool use_request); /** * Find a file from a file name, or more precisely, its file-list relative path, inside the * filtered items. \return The index of the found file or -1. */ -int filelist_file_find_path(struct FileList *filelist, const char *file); +int filelist_file_find_path(FileList *filelist, const char *file); /** * Find a file representing \a id. * \return The index of the found file or -1. */ -int filelist_file_find_id(const struct FileList *filelist, const struct ID *id); +int filelist_file_find_id(const FileList *filelist, const ID *id); /** * Get the ID a file represents (if any). For #FILE_MAIN, #FILE_MAIN_ASSET. */ -struct ID *filelist_file_get_id(const struct FileDirEntry *file); +ID *filelist_file_get_id(const FileDirEntry *file); /** * Same as #filelist_file_get_id(), but gets the file by index (doesn't require the file to be * cached, uses #FileListInternEntry only). */ -struct ID *filelist_entry_get_id(const struct FileList *filelist, int index); +ID *filelist_entry_get_id(const FileList *filelist, int index); /** * Get the #FileDirEntry.relpath value without requiring the #FileDirEntry to be available (doesn't * require the file to be cached, uses #FileListInternEntry only). */ -const char *filelist_entry_get_relpath(const struct FileList *filelist, int index); +const char *filelist_entry_get_relpath(const FileList *filelist, int index); bool filelist_uid_is_set(const FileUID uid); void filelist_uid_unset(FileUID *r_uid); -void filelist_file_cache_slidingwindow_set(struct FileList *filelist, size_t window_size); +void filelist_file_cache_slidingwindow_set(FileList *filelist, size_t window_size); /** * Load in cache all entries "around" given index (as much as block cache may hold). */ -bool filelist_file_cache_block(struct FileList *filelist, int index); +bool filelist_file_cache_block(FileList *filelist, int index); -bool filelist_needs_force_reset(const struct FileList *filelist); -void filelist_tag_force_reset(struct FileList *filelist); -void filelist_tag_force_reset_mainfiles(struct FileList *filelist); -bool filelist_pending(const struct FileList *filelist); -bool filelist_needs_reset_on_main_changes(const struct FileList *filelist); -bool filelist_is_ready(const struct FileList *filelist); +bool filelist_needs_force_reset(const FileList *filelist); +void filelist_tag_force_reset(FileList *filelist); +void filelist_tag_force_reset_mainfiles(FileList *filelist); +bool filelist_pending(const FileList *filelist); +bool filelist_needs_reset_on_main_changes(const FileList *filelist); +bool filelist_is_ready(const FileList *filelist); -unsigned int filelist_entry_select_set(const struct FileList *filelist, - const struct FileDirEntry *entry, +unsigned int filelist_entry_select_set(const FileList *filelist, + const FileDirEntry *entry, FileSelType select, const eDirEntry_SelectFlag flag, FileCheckType check); -void filelist_entry_select_index_set(struct FileList *filelist, +void filelist_entry_select_index_set(FileList *filelist, int index, FileSelType select, eDirEntry_SelectFlag flag, FileCheckType check); -void filelist_entries_select_index_range_set(struct FileList *filelist, +void filelist_entries_select_index_range_set(FileList *filelist, FileSelection *sel, FileSelType select, eDirEntry_SelectFlag flag, FileCheckType check); -eDirEntry_SelectFlag filelist_entry_select_get(struct FileList *filelist, - struct FileDirEntry *entry, +eDirEntry_SelectFlag filelist_entry_select_get(FileList *filelist, + FileDirEntry *entry, FileCheckType check); -eDirEntry_SelectFlag filelist_entry_select_index_get(struct FileList *filelist, +eDirEntry_SelectFlag filelist_entry_select_index_get(FileList *filelist, int index, FileCheckType check); -bool filelist_entry_is_selected(struct FileList *filelist, int index); +bool filelist_entry_is_selected(FileList *filelist, int index); /** * Set selection of the '..' parent entry, but only if it's actually visible. */ -void filelist_entry_parent_select_set(struct FileList *filelist, +void filelist_entry_parent_select_set(FileList *filelist, FileSelType select, eDirEntry_SelectFlag flag, FileCheckType check); -void filelist_setrecursion(struct FileList *filelist, int recursion_level); +void filelist_setrecursion(FileList *filelist, int recursion_level); -struct AssetLibrary *filelist_asset_library(struct FileList *filelist); +AssetLibrary *filelist_asset_library(FileList *filelist); -struct BlendHandle *filelist_lib(struct FileList *filelist); +BlendHandle *filelist_lib(FileList *filelist); /** * \param dir: Must be #FILE_MAX_LIBEXTRA long! */ -bool filelist_islibrary(struct FileList *filelist, char *dir, char **r_group); -void filelist_freelib(struct FileList *filelist); +bool filelist_islibrary(FileList *filelist, char *dir, char **r_group); +void filelist_freelib(FileList *filelist); /** Return the total raw number of entries listed in the given `filelist`, whether they are * filtered out or not. */ -int filelist_files_num_entries(struct FileList *filelist); +int filelist_files_num_entries(FileList *filelist); -void filelist_readjob_start(struct FileList *filelist, - int space_notifier, - const struct bContext *C); -void filelist_readjob_stop(struct FileList *filelist, struct wmWindowManager *wm); -int filelist_readjob_running(struct FileList *filelist, struct wmWindowManager *wm); +void filelist_readjob_start(FileList *filelist, int space_notifier, const bContext *C); +void filelist_readjob_stop(FileList *filelist, wmWindowManager *wm); +int filelist_readjob_running(FileList *filelist, wmWindowManager *wm); -bool filelist_cache_previews_update(struct FileList *filelist); -void filelist_cache_previews_set(struct FileList *filelist, bool use_previews); -bool filelist_cache_previews_running(struct FileList *filelist); -bool filelist_cache_previews_done(struct FileList *filelist); +bool filelist_cache_previews_update(FileList *filelist); +void filelist_cache_previews_set(FileList *filelist, bool use_previews); +bool filelist_cache_previews_running(FileList *filelist); +bool filelist_cache_previews_done(FileList *filelist);