diff options
author | Andrea Weikert <elubie@gmx.net> | 2007-09-02 21:25:03 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2007-09-02 21:25:03 +0400 |
commit | 356ab943736e8a2434a8ff5845873482597ba5e2 (patch) | |
tree | 910356ace904dc4f11f1daf15330bb0827934f5b /source/blender/include | |
parent | 22c23fb04f7f1297b971f03d69b8b04b7dd9caa4 (diff) |
== imagebrowser ==
Initial commit of imagebrowser in trunk.
BIG COMMIT!
Main changes:
* completely reworked imasel space
* creation and storage of the preview images for materials, textures, world and lamp
* thumbnails of images and movie files when browsing in the file system
* loading previews from external .blend when linking or appending
* thumbnail caching according to the Thumbnail Managing Standard: http://jens.triq.net/thumbnail-spec/
* for now just kept imasel access mostly as old imgbrowser (CTRL+F4, CTRL+F1) a bit hidden still.
* filtering of file types (images, movies, .blend, py,...)
* preliminary managing of bookmarks ('B' button to add, XKEY while bookmark active to delete)
More detailed info which will be updated here: http://wiki.blender.org/index.php/User:Elubie/PreviewImageBrowser
Places that need special review (and probably fixes):
* BLO_blendhandle_get_previews in readblenentry
* readfile.c: do_version and refactorings of do_library_append
* UI integration
TODO and known issues still:
* Accented characters do not display correctly with international fonts
* Crash was reported when browsing in directory with movie files
* Bookmark management still needs some UI work (second scrollbar?), feedback here is welcome!
Credits:
Samir Bharadwaj (samirbharadwaj@yahoo.com) for the icon images.
Many thanks to everyone who gave feedback and helped so far!
Diffstat (limited to 'source/blender/include')
-rw-r--r-- | source/blender/include/BIF_filelist.h | 87 | ||||
-rw-r--r-- | source/blender/include/BIF_fsmenu.h | 7 | ||||
-rw-r--r-- | source/blender/include/BIF_imasel.h | 25 | ||||
-rw-r--r-- | source/blender/include/BIF_interface_icons.h | 3 | ||||
-rw-r--r-- | source/blender/include/BIF_resources.h | 2 | ||||
-rw-r--r-- | source/blender/include/BIF_space.h | 3 | ||||
-rw-r--r-- | source/blender/include/BSE_drawimasel.h | 35 | ||||
-rw-r--r-- | source/blender/include/BSE_filesel.h | 2 | ||||
-rw-r--r-- | source/blender/include/blendef.h | 5 | ||||
-rw-r--r-- | source/blender/include/datatoc.h | 3 | ||||
-rw-r--r-- | source/blender/include/interface.h | 2 |
11 files changed, 133 insertions, 41 deletions
diff --git a/source/blender/include/BIF_filelist.h b/source/blender/include/BIF_filelist.h new file mode 100644 index 00000000000..a8d8e6f9445 --- /dev/null +++ b/source/blender/include/BIF_filelist.h @@ -0,0 +1,87 @@ +/** + * $Id: $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. The Blender + * Foundation also sells licenses for use in proprietary software under + * the Blender License. See http://www.blender.org/BL/ for information + * about this. + * + * 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, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2007 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef BIF_FILELIST_H +#define BIF_FILELIST_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct FileList; +struct direntry; +struct BlendHandle; + +struct FileList * BIF_filelist_new(); +void BIF_filelist_init_icons(); +void BIF_filelist_free_icons(); +struct FileList * BIF_filelist_copy(struct FileList* filelist); +int BIF_filelist_find(struct FileList* filelist, char *file); +void BIF_filelist_free(struct FileList* filelist); +void BIF_filelist_freelib(struct FileList* filelist); +void BIF_filelist_sort(struct FileList* filelist, short sort); +int BIF_filelist_numfiles(struct FileList* filelist); +const char * BIF_filelist_dir(struct FileList* filelist); +void BIF_filelist_setdir(struct FileList* filelist, const char *dir); +void BIF_filelist_appenddir(struct FileList* filelist, const char *relname); +struct direntry * BIF_filelist_file(struct FileList* filelist, int index); +void BIF_filelist_hidedot(struct FileList* filelist, short hide); +void BIF_filelist_setfilter(struct FileList* filelist, unsigned int filter); +void BIF_filelist_filter(struct FileList* filelist); +void BIF_filelist_swapselect(struct FileList* filelist); +void BIF_filelist_imgsize(struct FileList* filelist, short w, short h); +void BIF_filelist_loadimage(struct FileList* filelist, int index); +struct ImBuf * BIF_filelist_getimage(struct FileList* filelist, int index); + +void BIF_filelist_readdir(struct FileList* filelist); + +int BIF_filelist_empty(struct FileList* filelist); +void BIF_filelist_parent(struct FileList* filelist); +void BIF_filelist_setfiletypes(struct FileList* filelist, short has_quicktime); +int BIF_filelist_islibrary (struct FileList* filelist, char* dir, char* group); +void BIF_filelist_from_main(struct FileList* filelist); +void BIF_filelist_from_library(struct FileList* filelist); +void BIF_filelist_append_library(struct FileList* filelist, char *dir, char* file, short flag, int idcode); +void BIF_filelist_settype(struct FileList* filelist, int type); +short BIF_filelist_gettype(struct FileList* filelist); +void BIF_filelist_setipotype(struct FileList* filelist, short ipotype); +void BIF_filelist_hasfunc(struct FileList* filelist, int has_func); + +struct BlendHandle *BIF_filelist_lib(struct FileList* filelist); +int BIF_groupname_to_code(char *group); /* TODO: where should this go */ + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/source/blender/include/BIF_fsmenu.h b/source/blender/include/BIF_fsmenu.h index b32dee01854..1c5280c14f8 100644 --- a/source/blender/include/BIF_fsmenu.h +++ b/source/blender/include/BIF_fsmenu.h @@ -55,17 +55,20 @@ char* fsmenu_build_menu (void); /** Append a seperator to the FSMenu, inserts always follow the * last seperator. */ -void fsmenu_append_seperator (void); +void fsmenu_append_separator (void); /** Inserts a new fsmenu entry with the given @a path. * Duplicate entries are not added. * @param sorted Should entry be inserted in sorted order? */ -void fsmenu_insert_entry (char *path, int sorted); +void fsmenu_insert_entry (char *path, int sorted, short save); /** Removes the fsmenu entry at the given @a index. */ void fsmenu_remove_entry (int index); + /** saves the 'favourites' to the specified file */ +void fsmenu_write_file(const char *filename); + /** Free's all the memory associated with the fsmenu */ void fsmenu_free (void); diff --git a/source/blender/include/BIF_imasel.h b/source/blender/include/BIF_imasel.h index d6a1800730b..0e92abe14e4 100644 --- a/source/blender/include/BIF_imasel.h +++ b/source/blender/include/BIF_imasel.h @@ -33,28 +33,19 @@ #define BIF_IMASEL_H struct SpaceImaSel; -struct OneSelectableIma; struct ScrArea; -struct ImaDir; -void imadir_parent(struct SpaceImaSel *simasel); -int bitset(int l, int bit); -void free_sel_ima(struct OneSelectableIma *firstima); - -void write_new_pib(struct SpaceImaSel *simasel); -void free_ima_dir(struct ImaDir *firstdir); -void check_for_pib(struct SpaceImaSel *simasel); -void clear_ima_dir(struct SpaceImaSel *simasel); -void check_ima_dir_name(char *dir); -int get_ima_dir(char *dirname, int dtype, int *td, struct ImaDir **first); -void get_next_image(struct SpaceImaSel *simasel); -void get_file_info(struct SpaceImaSel *simasel); -void get_pib_file(struct SpaceImaSel *simasel); -void change_imadir(struct SpaceImaSel *simasel); -void check_imasel_copy(struct SpaceImaSel *simasel); void free_imasel(struct SpaceImaSel *simasel); void clever_numbuts_imasel(void); +void activate_imageselect(int type, char *title, char *file, void (*func)(char *)); +void activate_imageselect_menu(int type, char *title, char *file, char *pupmenu, short *menup, void (*func)(char *)); +void activate_imageselect_args(int type, char *title, char *file, void (*func)(char *, void *, void *), void *arg1, void *arg2); + +void activate_databrowse_imasel(struct ID *id, int idcode, int fromcode, int retval, short *menup, void (*func)(unsigned short)); +/* +void activate_databrowse_imasel_args(struct ID *id, int idcode, int fromcode, short *menup, void (*func)(char *, void *, void *), void *arg1, void *arg2); +*/ #endif diff --git a/source/blender/include/BIF_interface_icons.h b/source/blender/include/BIF_interface_icons.h index c69fa122099..c628d68e9db 100644 --- a/source/blender/include/BIF_interface_icons.h +++ b/source/blender/include/BIF_interface_icons.h @@ -48,6 +48,7 @@ typedef struct IconFile { #define ICON_DEFAULT_HEIGHT 16 +#define PREVIEW_DEFAULT_HEIGHT 96 /* Resizable Icons for Blender @@ -57,6 +58,8 @@ int BIF_icon_get_width(int icon_id); int BIF_icon_get_height(int icon_id); void BIF_icon_draw(float x, float y, int icon_id); +void BIF_icon_draw_preview(float x, float y, int icon_id, int nocreate); + void BIF_icon_draw_aspect(float x, float y, int icon_id, float aspect); void BIF_icon_draw_aspect_blended(float x, float y, int icon_id, float aspect, int shade); void BIF_icons_free(); diff --git a/source/blender/include/BIF_resources.h b/source/blender/include/BIF_resources.h index 77c0f5861e3..d734e59046f 100644 --- a/source/blender/include/BIF_resources.h +++ b/source/blender/include/BIF_resources.h @@ -164,7 +164,7 @@ typedef enum { ICON_FACESEL_DEHLT, ICON_FACESEL_HLT, ICON_EDIT_DEHLT, - ICON_BLANK19, + ICON_BOOKMARKS, ICON_BLANK20, ICON_BLANK21, ICON_BLANK22, diff --git a/source/blender/include/BIF_space.h b/source/blender/include/BIF_space.h index 884f0459abf..12f1e1586a0 100644 --- a/source/blender/include/BIF_space.h +++ b/source/blender/include/BIF_space.h @@ -75,6 +75,9 @@ struct SpaceOops; /* sequence handler codes */ #define SEQ_HANDLER_PROPERTIES 60 +/* imasel handler codes */ +#define IMASEL_HANDLER_IMAGE 70 + /* theme codes */ #define B_ADD_THEME 3301 #define B_DEL_THEME 3302 diff --git a/source/blender/include/BSE_drawimasel.h b/source/blender/include/BSE_drawimasel.h index f412ca08584..6c68ba79bb9 100644 --- a/source/blender/include/BSE_drawimasel.h +++ b/source/blender/include/BSE_drawimasel.h @@ -33,27 +33,28 @@ #ifndef BSE_DRAWIMASEL_H #define BSE_DRAWIMASEL_H + +/* button events */ +#define B_FS_FILENAME 1 +#define B_FS_DIRNAME 2 +#define B_FS_DIR_MENU 3 +#define B_FS_PARDIR 4 +#define B_FS_LOAD 5 +#define B_FS_CANCEL 6 +#define B_FS_LIBNAME 7 +#define B_FS_BOOKMARK 8 + +/* ui geometry */ +#define IMASEL_BUTTONS_HEIGHT 60 +#define TILE_BORDER_X 8 +#define TILE_BORDER_Y 8 + struct ScrArea; struct SpaceImaSel; -void viewgate(short sx, short sy, short ex, short ey); -void areaview (void); -void calc_hilite(struct SpaceImaSel *simasel); -void make_sima_area(struct SpaceImaSel *simasel); -void draw_sima_area(struct SpaceImaSel *simasel); -void select_ima_files(struct SpaceImaSel *simasel); -void move_imadir_sli(struct SpaceImaSel *simasel); -void move_imafile_sli(struct SpaceImaSel *simasel); -void ima_select_all(struct SpaceImaSel *simasel); -void pibplay(struct SpaceImaSel *simasel); void drawimaselspace(struct ScrArea *sa, void *spacedata); - -/* void calc_hilite(SpaceImaSel *simasel); */ -/* void ima_select_all(SpaceImaSel *simasel); */ -/* void move_imadir_sli(SpaceImaSel *simasel); */ -/* void move_imafile_sli(SpaceImaSel *simasel); */ -/* void pibplay(SpaceImaSel *simasel); */ -/* void select_ima_files(SpaceImaSel *simasel); */ +void calc_imasel_rcts(SpaceImaSel *simasel, int winx, int winy); +void do_imasel_buttonevents(short event, SpaceImaSel *simasel); #endif /* BSE_DRAWIMASEL_H */ diff --git a/source/blender/include/BSE_filesel.h b/source/blender/include/BSE_filesel.h index 6934899062e..a41eea32040 100644 --- a/source/blender/include/BSE_filesel.h +++ b/source/blender/include/BSE_filesel.h @@ -53,8 +53,6 @@ void activate_fileselect(int type, char *title, char *file, void (*func)(char *) void activate_fileselect_menu(int type, char *title, char *file, char *pupmenu, short *menup, void (*func)(char *)); void activate_fileselect_args(int type, char *title, char *file, void (*func)(char *, void *, void *), void *arg1, void *arg2); -void activate_imageselect(int type, char *title, char *file, void (*func)(char *)); - void activate_databrowse(struct ID *id, int idcode, int fromcode, int retval, short *menup, void (*func)(unsigned short)); void activate_databrowse_args(struct ID *id, int idcode, int fromcode, short *menup, void (*func)(char *, void *, void *), void *arg1, void *arg2); diff --git a/source/blender/include/blendef.h b/source/blender/include/blendef.h index 596b11c609c..349685a5d8a 100644 --- a/source/blender/include/blendef.h +++ b/source/blender/include/blendef.h @@ -344,7 +344,10 @@ #define B_CONTEXT_SWITCH 406 /* IMASEL: 450 */ -/* in imasel.h */ +/* in imasel.h - not any more - elubie */ +#define B_SORTIMASELLIST 451 +#define B_RELOADIMASELDIR 452 +#define B_FILTERIMASELDIR 453 /* TEXT: 500 */ #define B_TEXTBROWSE 501 diff --git a/source/blender/include/datatoc.h b/source/blender/include/datatoc.h index d7a1aa5c78c..7afd4428d70 100644 --- a/source/blender/include/datatoc.h +++ b/source/blender/include/datatoc.h @@ -44,6 +44,9 @@ extern char datatoc_Bfs[]; extern int datatoc_blenderbuttons_size; extern char datatoc_blenderbuttons[]; +extern int datatoc_prvicons_size; +extern char datatoc_prvicons[]; + extern int datatoc_Bfont_size; extern char datatoc_Bfont[]; diff --git a/source/blender/include/interface.h b/source/blender/include/interface.h index d7be02c6fc5..d8e779b9af8 100644 --- a/source/blender/include/interface.h +++ b/source/blender/include/interface.h @@ -230,7 +230,7 @@ extern void ui_draw_but(uiBut *but); extern void ui_rasterpos_safe(float x, float y, float aspect); extern void ui_draw_tria_icon(float x, float y, float aspect, char dir); extern void ui_draw_anti_x(float x1, float y1, float x2, float y2); - +extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select); #endif |