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.
This commit is contained in:
Andrea Weikert 2010-03-15 20:28:13 +00:00
parent ae6ee27d37
commit 8fdb4d4506
6 changed files with 35 additions and 15 deletions

@ -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)

@ -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;

@ -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))

@ -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);

@ -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;

@ -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");