diff options
author | Andrea Weikert <elubie@gmx.net> | 2010-03-15 23:28:13 +0300 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2010-03-15 23:28:13 +0300 |
commit | 8fdb4d45063f01be975cf3c6351607115a0b8d4e (patch) | |
tree | d23e627f659b2718de89f442c167b37e838a26d6 | |
parent | ae6ee27d37f94a5c26cdf6060d71c5b6bc209a0e (diff) |
Fix [#21618] Wrong Icon For BLEND file on File/Append
While the folder icon was originally planned when in append/link mode, it's easier to distinguish with a blender icon, so the folder icon is now replaced.
Also fixed issue introduced in rev. 27491 where filter settings were incorrectly set when moving out of .blend file again.
-rw-r--r-- | source/blender/editors/space_file/file_draw.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 20 | ||||
-rw-r--r-- | source/blender/editors/space_file/filesel.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_file/space_file.c | 4 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 12 |
6 files changed, 35 insertions, 15 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index a2b4dcbac60..63729f03e58 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -298,6 +298,9 @@ static int get_file_icon(struct direntry *file) if ( strcmp(file->relname, "..") == 0) { return ICON_FILE_PARENT; } + if(file->flags & BLENDERFILE) { + return ICON_FILE_BLEND; + } return ICON_FILE_FOLDER; } else if (file->flags & BLENDERFILE) diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index b90bb47e6ce..c11260d7179 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -627,13 +627,13 @@ struct ImBuf * filelist_geticon(struct FileList* filelist, int index) fidx = filelist->fidx[index]; file = &filelist->filelist[fidx]; if (file->type & S_IFDIR) { - if ( strcmp(filelist->filelist[fidx].relname, "..") == 0) { - ibuf = gSpecialFileImages[SPECIAL_IMG_PARENT]; - } else if ( strcmp(filelist->filelist[fidx].relname, ".") == 0) { - ibuf = gSpecialFileImages[SPECIAL_IMG_REFRESH]; - } else { - ibuf = gSpecialFileImages[SPECIAL_IMG_FOLDER]; - } + if ( strcmp(filelist->filelist[fidx].relname, "..") == 0) { + ibuf = gSpecialFileImages[SPECIAL_IMG_PARENT]; + } else if ( strcmp(filelist->filelist[fidx].relname, ".") == 0) { + ibuf = gSpecialFileImages[SPECIAL_IMG_REFRESH]; + } else { + ibuf = gSpecialFileImages[SPECIAL_IMG_FOLDER]; + } } else { ibuf = gSpecialFileImages[SPECIAL_IMG_UNKNOWNFILE]; } @@ -788,8 +788,12 @@ void filelist_setfiletypes(struct FileList* filelist, short has_quicktime) file->type= file->s.st_mode; /* restore the mess below */ /* Don't check extensions for directories */ - if (file->type & S_IFDIR) + if (file->type & S_IFDIR) { + if(BLO_has_bfile_extension(file->relname)) { + file->flags |= BLENDERFILE; + } continue; + } if(BLO_has_bfile_extension(file->relname)) { file->flags |= BLENDERFILE; diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 758740e676a..6945e8c959a 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -194,7 +194,7 @@ short ED_fileselect_set_params(SpaceFile *sfile) params->filter = 0; params->sort = FILE_SORT_ALPHA; } - + params->oldflag = params->flag; return 1; } @@ -414,6 +414,9 @@ void file_change_dir(bContext *C, int checkdir) char dir[FILE_MAX]; if (filelist_islibrary(sfile->files, dir, group)) { sfile->params->flag &= ~FILE_FILTER; + } else { + /* reset the old flag */ + sfile->params->flag = sfile->params->oldflag; } } if(folderlist_clear_next(sfile)) diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 105ece8e95f..141d4f63f1c 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -140,8 +140,6 @@ static void file_free(SpaceLink *sl) } if (sfile->params) { - if(sfile->params->pupmenu) - MEM_freeN(sfile->params->pupmenu); MEM_freeN(sfile->params); sfile->params= NULL; } @@ -208,6 +206,8 @@ static void file_refresh(const bContext *C, ScrArea *sa) filelist_readdir(sfile->files); thumbnails_start(sfile->files, C); BLI_strncpy(params->dir, filelist_dir(sfile->files), FILE_MAX); + } else { + filelist_filter(sfile->files); } if(params->sort!=FILE_SORT_NONE) filelist_sort(sfile->files, params->sort); diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 293eac3c5a5..8e460b80585 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -162,21 +162,23 @@ typedef struct FileSelectParams { short type; /* XXXXX for now store type here, should be moved to the operator */ short flag; /* settings for filter, hiding dots files,... */ + short oldflag; /* temp storage of original flag settings */ short sort; /* sort order */ short display; /* display mode flag */ short filter; /* filter when (flags & FILE_FILTER) is true */ /* XXX - temporary, better move to filelist */ short active_bookmark; + short pad; int active_file; int selstate; /* short */ /* XXX --- still unused -- */ short f_fp; /* show font preview */ - short menu; /* currently selected option in pupmenu */ + short pad2; char fp_str[8]; /* string to use for font preview */ - char *pupmenu; /* allows menu for save options - result stored in menup */ + /* XXX --- end unused -- */ } FileSelectParams; diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 9b7e6b5bc05..ddbeb8a85fe 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -567,6 +567,14 @@ static void rna_Sequencer_display_mode_update(bContext *C, PointerRNA *ptr) ED_sequencer_update_view(C, view); } +static void rna_FileSelectParams_flag_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + FileSelectParams* params = (FileSelectParams*)ptr->data; + if (params) { + params->oldflag = params->flag; + } +} + #else static void rna_def_space(BlenderRNA *brna) @@ -1838,12 +1846,12 @@ static void rna_def_fileselect_params(BlenderRNA *brna) prop= RNA_def_property(srna, "do_filter", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FILE_FILTER); RNA_def_property_ui_text(prop, "Filter Files", "Enable filtering of files"); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, "rna_FileSelectParams_flag_update"); prop= RNA_def_property(srna, "hide_dot", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FILE_HIDE_DOT); RNA_def_property_ui_text(prop, "Hide Dot Files", "Hide hidden dot files"); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_LIST , NULL); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_LIST , "rna_FileSelectParams_flag_update"); prop= RNA_def_property(srna, "sort", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "sort"); |