2011-02-21 07:25:24 +00:00
|
|
|
/*
|
2009-01-06 14:42:54 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2018-06-01 18:19:39 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2009-01-06 14:42:54 +00:00
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-01-06 14:42:54 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
2011-02-21 07:25:24 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup editors
|
2011-02-21 07:25:24 +00:00
|
|
|
*/
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __ED_FILESELECT_H__
|
|
|
|
|
#define __ED_FILESELECT_H__
|
2009-01-06 14:42:54 +00:00
|
|
|
|
2009-06-29 20:23:40 +00:00
|
|
|
struct ARegion;
|
|
|
|
|
struct FileSelectParams;
|
Final 'FileBrowser First Stage' merge.
It basically rewrites most of filelist.c, with some more limited changes in other areas of filebrowser.
From user perspective, it:
* Removes some info in 'long' drawing mode (owner, permissions) - OS-specific data that do not really matter in Blender!
* Makes short/long display 'fixed' size (among four choices, like thumbnails mode).
* Allows to list several layers of dirtree at once, in a flat way (inside .blend files and/or real directories).
* Consequently, adds datablocks types filtering.
* Uses way less RAM when listing big directories, especially in thumbnail mode (we are talking of several hundred of MiB spared).
* Generates thumbnails way faster.
From code perspective, it:
* Is ready for asset engine needs (on data structure level in filebrowser's listing).
* Simplifies and makes 'generic' file listing much lighter.
* Separates file listing in three different aspects:
** 'generic' filelisting (in BLI), which becomes a shallow wrapper around stat struct.
** 'filebrowser drawing' filelisting, which only contains current visible subset of the whole list (sliding window), with extra drawing data (strings for size, date/time, preview, etc.).
** 'asset-ready' filelisting, which is used for operations common to 'basic' filehandling and future asset-related one.
* Uses uuid's to handle file selection/state in the browser, instead of using flags in filelisting items.
* Uses much lighter BLI_task handling for previews, instead of heavy 'job' system (using the new 'notifier' timer to handle UI refresh, in similar way to jobs).
* Moves .blend datablocks preview handling to IMB_thumbnail (necessary to avoid storing all datablock previews at once, and gives better consistency and performances too).
Revision: https://developer.blender.org/D1316
Thanks to Campbell & Sergey for the reviews. :)
2015-08-19 22:41:39 +02:00
|
|
|
struct ScrArea;
|
2013-03-15 19:56:29 +00:00
|
|
|
struct SpaceFile;
|
2010-03-10 19:30:20 +00:00
|
|
|
struct bContext;
|
2013-03-15 19:56:29 +00:00
|
|
|
struct wmWindowManager;
|
2009-01-06 14:42:54 +00:00
|
|
|
|
2009-03-08 13:14:12 +00:00
|
|
|
#define FILE_LAYOUT_HOR 1
|
|
|
|
|
#define FILE_LAYOUT_VER 2
|
|
|
|
|
|
Final 'FileBrowser First Stage' merge.
It basically rewrites most of filelist.c, with some more limited changes in other areas of filebrowser.
From user perspective, it:
* Removes some info in 'long' drawing mode (owner, permissions) - OS-specific data that do not really matter in Blender!
* Makes short/long display 'fixed' size (among four choices, like thumbnails mode).
* Allows to list several layers of dirtree at once, in a flat way (inside .blend files and/or real directories).
* Consequently, adds datablocks types filtering.
* Uses way less RAM when listing big directories, especially in thumbnail mode (we are talking of several hundred of MiB spared).
* Generates thumbnails way faster.
From code perspective, it:
* Is ready for asset engine needs (on data structure level in filebrowser's listing).
* Simplifies and makes 'generic' file listing much lighter.
* Separates file listing in three different aspects:
** 'generic' filelisting (in BLI), which becomes a shallow wrapper around stat struct.
** 'filebrowser drawing' filelisting, which only contains current visible subset of the whole list (sliding window), with extra drawing data (strings for size, date/time, preview, etc.).
** 'asset-ready' filelisting, which is used for operations common to 'basic' filehandling and future asset-related one.
* Uses uuid's to handle file selection/state in the browser, instead of using flags in filelisting items.
* Uses much lighter BLI_task handling for previews, instead of heavy 'job' system (using the new 'notifier' timer to handle UI refresh, in similar way to jobs).
* Moves .blend datablocks preview handling to IMB_thumbnail (necessary to avoid storing all datablock previews at once, and gives better consistency and performances too).
Revision: https://developer.blender.org/D1316
Thanks to Campbell & Sergey for the reviews. :)
2015-08-19 22:41:39 +02:00
|
|
|
#define MAX_FILE_COLUMN 4
|
2009-05-14 18:08:14 +00:00
|
|
|
|
|
|
|
|
typedef enum FileListColumns {
|
2019-04-17 06:17:24 +02:00
|
|
|
COLUMN_NAME = 0,
|
|
|
|
|
COLUMN_DATE,
|
|
|
|
|
COLUMN_TIME,
|
|
|
|
|
COLUMN_SIZE,
|
2009-05-14 18:08:14 +00:00
|
|
|
} FileListColumns;
|
|
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
typedef struct FileLayout {
|
2019-04-17 06:17:24 +02:00
|
|
|
/* view settings - XXX - move into own struct */
|
|
|
|
|
int prv_w;
|
|
|
|
|
int prv_h;
|
|
|
|
|
int tile_w;
|
|
|
|
|
int tile_h;
|
|
|
|
|
int tile_border_x;
|
|
|
|
|
int tile_border_y;
|
|
|
|
|
int prv_border_x;
|
|
|
|
|
int prv_border_y;
|
|
|
|
|
int rows;
|
|
|
|
|
int columns;
|
|
|
|
|
int width;
|
|
|
|
|
int height;
|
|
|
|
|
int flag;
|
|
|
|
|
int dirty;
|
|
|
|
|
int textheight;
|
|
|
|
|
float column_widths[MAX_FILE_COLUMN];
|
|
|
|
|
|
|
|
|
|
/* When we change display size, we may have to update static strings like size of files... */
|
|
|
|
|
short curr_size;
|
2009-03-08 13:14:12 +00:00
|
|
|
} FileLayout;
|
|
|
|
|
|
2011-03-14 19:56:13 +00:00
|
|
|
typedef struct FileSelection {
|
2019-04-17 06:17:24 +02:00
|
|
|
int first;
|
|
|
|
|
int last;
|
2011-03-14 19:56:13 +00:00
|
|
|
} FileSelection;
|
|
|
|
|
|
|
|
|
|
struct rcti;
|
|
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
struct FileSelectParams *ED_fileselect_get_params(struct SpaceFile *sfile);
|
2009-01-06 14:42:54 +00:00
|
|
|
|
2009-07-27 19:06:33 +00:00
|
|
|
short ED_fileselect_set_params(struct SpaceFile *sfile);
|
2009-01-06 14:42:54 +00:00
|
|
|
|
2009-01-08 18:47:16 +00:00
|
|
|
void ED_fileselect_reset_params(struct SpaceFile *sfile);
|
|
|
|
|
|
2009-03-08 13:14:12 +00:00
|
|
|
void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar);
|
|
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
FileLayout *ED_fileselect_get_layout(struct SpaceFile *sfile, struct ARegion *ar);
|
2009-03-08 13:14:12 +00:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
int ED_fileselect_layout_numfiles(FileLayout *layout, struct ARegion *ar);
|
|
|
|
|
int ED_fileselect_layout_offset(FileLayout *layout, int x, int y);
|
|
|
|
|
FileSelection ED_fileselect_layout_offset_rect(FileLayout *layout, const struct rcti *rect);
|
2009-03-08 13:14:12 +00:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
void ED_fileselect_layout_tilepos(FileLayout *layout, int tile, int *x, int *y);
|
2009-03-08 13:14:12 +00:00
|
|
|
|
2010-01-19 03:59:05 +00:00
|
|
|
void ED_operatormacros_file(void);
|
2009-03-08 13:14:12 +00:00
|
|
|
|
Final 'FileBrowser First Stage' merge.
It basically rewrites most of filelist.c, with some more limited changes in other areas of filebrowser.
From user perspective, it:
* Removes some info in 'long' drawing mode (owner, permissions) - OS-specific data that do not really matter in Blender!
* Makes short/long display 'fixed' size (among four choices, like thumbnails mode).
* Allows to list several layers of dirtree at once, in a flat way (inside .blend files and/or real directories).
* Consequently, adds datablocks types filtering.
* Uses way less RAM when listing big directories, especially in thumbnail mode (we are talking of several hundred of MiB spared).
* Generates thumbnails way faster.
From code perspective, it:
* Is ready for asset engine needs (on data structure level in filebrowser's listing).
* Simplifies and makes 'generic' file listing much lighter.
* Separates file listing in three different aspects:
** 'generic' filelisting (in BLI), which becomes a shallow wrapper around stat struct.
** 'filebrowser drawing' filelisting, which only contains current visible subset of the whole list (sliding window), with extra drawing data (strings for size, date/time, preview, etc.).
** 'asset-ready' filelisting, which is used for operations common to 'basic' filehandling and future asset-related one.
* Uses uuid's to handle file selection/state in the browser, instead of using flags in filelisting items.
* Uses much lighter BLI_task handling for previews, instead of heavy 'job' system (using the new 'notifier' timer to handle UI refresh, in similar way to jobs).
* Moves .blend datablocks preview handling to IMB_thumbnail (necessary to avoid storing all datablock previews at once, and gives better consistency and performances too).
Revision: https://developer.blender.org/D1316
Thanks to Campbell & Sergey for the reviews. :)
2015-08-19 22:41:39 +02:00
|
|
|
void ED_fileselect_clear(struct wmWindowManager *wm, struct ScrArea *sa, struct SpaceFile *sfile);
|
2010-03-10 19:30:20 +00:00
|
|
|
|
Final 'FileBrowser First Stage' merge.
It basically rewrites most of filelist.c, with some more limited changes in other areas of filebrowser.
From user perspective, it:
* Removes some info in 'long' drawing mode (owner, permissions) - OS-specific data that do not really matter in Blender!
* Makes short/long display 'fixed' size (among four choices, like thumbnails mode).
* Allows to list several layers of dirtree at once, in a flat way (inside .blend files and/or real directories).
* Consequently, adds datablocks types filtering.
* Uses way less RAM when listing big directories, especially in thumbnail mode (we are talking of several hundred of MiB spared).
* Generates thumbnails way faster.
From code perspective, it:
* Is ready for asset engine needs (on data structure level in filebrowser's listing).
* Simplifies and makes 'generic' file listing much lighter.
* Separates file listing in three different aspects:
** 'generic' filelisting (in BLI), which becomes a shallow wrapper around stat struct.
** 'filebrowser drawing' filelisting, which only contains current visible subset of the whole list (sliding window), with extra drawing data (strings for size, date/time, preview, etc.).
** 'asset-ready' filelisting, which is used for operations common to 'basic' filehandling and future asset-related one.
* Uses uuid's to handle file selection/state in the browser, instead of using flags in filelisting items.
* Uses much lighter BLI_task handling for previews, instead of heavy 'job' system (using the new 'notifier' timer to handle UI refresh, in similar way to jobs).
* Moves .blend datablocks preview handling to IMB_thumbnail (necessary to avoid storing all datablock previews at once, and gives better consistency and performances too).
Revision: https://developer.blender.org/D1316
Thanks to Campbell & Sergey for the reviews. :)
2015-08-19 22:41:39 +02:00
|
|
|
void ED_fileselect_exit(struct wmWindowManager *wm, struct ScrArea *sa, struct SpaceFile *sfile);
|
2010-03-10 19:30:20 +00:00
|
|
|
|
2016-06-14 16:30:16 +02:00
|
|
|
int ED_path_extension_type(const char *path);
|
|
|
|
|
int ED_file_extension_icon(const char *path);
|
2010-12-17 19:05:34 +00:00
|
|
|
|
2013-12-20 17:39:22 +01:00
|
|
|
void ED_file_read_bookmarks(void);
|
|
|
|
|
|
2016-06-27 10:54:17 +02:00
|
|
|
void ED_file_change_dir(struct bContext *C);
|
2015-02-11 00:09:45 +01:00
|
|
|
|
|
|
|
|
/* File menu stuff */
|
|
|
|
|
|
2018-05-17 15:05:17 +02:00
|
|
|
/* FSMenuEntry's without paths indicate separators */
|
|
|
|
|
typedef struct FSMenuEntry {
|
2019-04-17 06:17:24 +02:00
|
|
|
struct FSMenuEntry *next;
|
2018-05-17 15:05:17 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
char *path;
|
|
|
|
|
char name[256]; /* FILE_MAXFILE */
|
|
|
|
|
short save;
|
|
|
|
|
short valid;
|
|
|
|
|
short pad[2];
|
2018-05-17 15:05:17 +02:00
|
|
|
} FSMenuEntry;
|
|
|
|
|
|
2015-02-11 00:09:45 +01:00
|
|
|
typedef enum FSMenuCategory {
|
2019-04-17 06:17:24 +02:00
|
|
|
FS_CATEGORY_SYSTEM,
|
|
|
|
|
FS_CATEGORY_SYSTEM_BOOKMARKS,
|
|
|
|
|
FS_CATEGORY_BOOKMARKS,
|
|
|
|
|
FS_CATEGORY_RECENT,
|
2015-02-11 00:09:45 +01:00
|
|
|
} FSMenuCategory;
|
|
|
|
|
|
|
|
|
|
typedef enum FSMenuInsert {
|
2019-04-17 06:17:24 +02:00
|
|
|
FS_INSERT_SORTED = (1 << 0),
|
|
|
|
|
FS_INSERT_SAVE = (1 << 1),
|
|
|
|
|
/** moves the item to the front of the list when its not already there */
|
|
|
|
|
FS_INSERT_FIRST = (1 << 2),
|
|
|
|
|
/** just append to preseve delivered order */
|
|
|
|
|
FS_INSERT_LAST = (1 << 3),
|
2015-02-11 00:09:45 +01:00
|
|
|
} FSMenuInsert;
|
|
|
|
|
|
|
|
|
|
struct FSMenu;
|
|
|
|
|
struct FSMenuEntry;
|
|
|
|
|
|
|
|
|
|
struct FSMenu *ED_fsmenu_get(void);
|
|
|
|
|
struct FSMenuEntry *ED_fsmenu_get_category(struct FSMenu *fsmenu, FSMenuCategory category);
|
2019-04-17 06:17:24 +02:00
|
|
|
void ED_fsmenu_set_category(struct FSMenu *fsmenu,
|
|
|
|
|
FSMenuCategory category,
|
|
|
|
|
struct FSMenuEntry *fsm_head);
|
2015-02-11 00:09:45 +01:00
|
|
|
|
|
|
|
|
int ED_fsmenu_get_nentries(struct FSMenu *fsmenu, FSMenuCategory category);
|
|
|
|
|
|
|
|
|
|
struct FSMenuEntry *ED_fsmenu_get_entry(struct FSMenu *fsmenu, FSMenuCategory category, int index);
|
|
|
|
|
|
|
|
|
|
char *ED_fsmenu_entry_get_path(struct FSMenuEntry *fsentry);
|
|
|
|
|
void ED_fsmenu_entry_set_path(struct FSMenuEntry *fsentry, const char *path);
|
|
|
|
|
|
|
|
|
|
char *ED_fsmenu_entry_get_name(struct FSMenuEntry *fsentry);
|
|
|
|
|
void ED_fsmenu_entry_set_name(struct FSMenuEntry *fsentry, const char *name);
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#endif /* __ED_FILESELECT_H__ */
|