Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-28 20:46:14 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-28 20:46:14 +0400
commitaa44603146e87f29f08cee2abab7e0ddd89222c5 (patch)
treedf7c7a0f0ecec9317c0350584a83644d9517c40c /source/blender/editors/space_file/filesel.c
parent74e4ad20c9e8d19f85aaa2995652e3f65bdfc0c9 (diff)
2.5: File browser
* Side panels now use list widgets. * Enabled theme colors for side panel. * Add button in bookmarks panel. * Operator panel title now uses operator name. * For unix, added / to system, and home and desktop to bookmarks. * For opening fileselect with filter, cleaned up the code a bit, adding WM_operator_properties_filesel instead of duplicating code. * Also added filter for all operators calling fileselect, only image and file open did it before. * Hide . files by default, and also hide files ending with ~. * Added back .. (but not .) in the file list, I really missed this. * File highlight now only happens when you're actually over a file, instead staying after you move the mouse away. * Fix some redraw/refresh issues.
Diffstat (limited to 'source/blender/editors/space_file/filesel.c')
-rw-r--r--source/blender/editors/space_file/filesel.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 6263f9fe57f..8ee7d3515b5 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -124,18 +124,24 @@ short ED_fileselect_set_params(SpaceFile *sfile)
if (op) {
BLI_strncpy(params->title, op->type->name, sizeof(params->title));
params->filter = 0;
- params->filter |= RNA_boolean_get(op->ptr, "filter_folder") ? FOLDERFILE : 0;
params->filter |= RNA_boolean_get(op->ptr, "filter_blender") ? BLENDERFILE : 0;
params->filter |= RNA_boolean_get(op->ptr, "filter_image") ? IMAGEFILE : 0;
params->filter |= RNA_boolean_get(op->ptr, "filter_movie") ? MOVIEFILE : 0;
+ params->filter |= RNA_boolean_get(op->ptr, "filter_text") ? TEXTFILE : 0;
+ params->filter |= RNA_boolean_get(op->ptr, "filter_python") ? PYSCRIPTFILE : 0;
+ params->filter |= RNA_boolean_get(op->ptr, "filter_font") ? FTFONTFILE : 0;
+ params->filter |= RNA_boolean_get(op->ptr, "filter_sound") ? SOUNDFILE : 0;
+ params->filter |= RNA_boolean_get(op->ptr, "filter_text") ? TEXTFILE : 0;
+ params->filter |= RNA_boolean_get(op->ptr, "filter_folder") ? FOLDERFILE : 0;
if (params->filter != 0)
params->flag |= FILE_FILTER;
+
+ params->flag |= FILE_HIDE_DOT;
- if (RNA_property_is_set(op->ptr, "display")) {
- params->display= RNA_int_get(op->ptr, "display");
- } else {
- params->display = FILE_SHORTDISPLAY;
- }
+ if(params->filter & (IMAGEFILE|MOVIEFILE))
+ params->display= FILE_IMGDISPLAY;
+ else
+ params->display= FILE_SHORTDISPLAY;
/* if operator has path set, use it, otherwise keep the last */
if (RNA_property_is_set(op->ptr, "filename")) {
@@ -147,12 +153,15 @@ short ED_fileselect_set_params(SpaceFile *sfile)
}
} else {
/* default values, if no operator */
- params->flag = 0;
+ params->flag |= FILE_HIDE_DOT;
params->display = FILE_SHORTDISPLAY;
params->filter = 0;
params->sort = FILE_SORT_ALPHA;
}
+ /* new params, refresh file list */
+ if(sfile->files) filelist_free(sfile->files);
+
return 1;
}
@@ -188,8 +197,8 @@ int ED_fileselect_layout_offset(FileLayout* layout, int x, int y)
offsetx = (x)/(layout->tile_w + 2*layout->tile_border_x);
offsety = (y)/(layout->tile_h + 2*layout->tile_border_y);
- if (offsetx > layout->columns-1) offsetx = -1 ;
- if (offsety > layout->rows-1) offsety = -1 ;
+ if (offsetx > layout->columns-1) return -1 ;
+ if (offsety > layout->rows-1) return -1 ;
if (layout->flag & FILE_LAYOUT_HOR)
active_file = layout->rows*offsetx + offsety;
@@ -386,7 +395,7 @@ int file_select_match(struct SpaceFile *sfile, const char *pattern)
void autocomplete_directory(struct bContext *C, char *str, void *arg_v)
{
char tmp[FILE_MAX];
- SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
+ SpaceFile *sfile= CTX_wm_space_file(C);
/* search if str matches the beginning of name */
if(str[0] && sfile->files) {