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:
authorDalai Felinto <dfelinto@gmail.com>2009-07-07 11:25:44 +0400
committerDalai Felinto <dfelinto@gmail.com>2009-07-07 11:25:44 +0400
commitcfd5046c9e4a6617a20cfc7e59519a84d3c18b9d (patch)
tree2c2c1180a69c5996ad7ebbca151234469cdf475a /source/blender/editors/space_file/filesel.c
parent79633056ac3848237d8bb8245523501905582f2e (diff)
2.5 filebrowser: previous/next + bugfix + elubie's changes and cleanup
* Previous/Next Folder browser * bugfix: "open most recently opened directory". * Previous and Next functionalities: - use BACKSPACE to navigate to previous folders - use SHIFT+BACKSPACE to navigate forward - once you change the folder by other ways the forward folder list is cleared * bug fix: the sfile->params->dir set through ED_fileselect_set_params wasn't correct. According to the code taking the settings from the existing (previous) filebrowser is a temp solution. In that case this is a fix for a temp solution :) (changes in: wm_event_system.c, filesel.c and ED_fileselect.h) ** Andrea(elubie): we can get away of the folderlist_clear_next test if we manually pass a boolean to file_change_dir (e.g. file_change_dir(sfile, true)). I tried not to mess up with your changes here. It's slightly slower (and maybe hacky) but its's more conservative IMHO. (my first commit to 2.5 ... that was a good reason to put my paper on hold :p)
Diffstat (limited to 'source/blender/editors/space_file/filesel.c')
-rw-r--r--source/blender/editors/space_file/filesel.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index ea42ad80fe6..c42c83eda98 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -84,12 +84,12 @@
FileSelectParams* ED_fileselect_get_params(struct SpaceFile *sfile)
{
if (!sfile->params) {
- ED_fileselect_set_params(sfile, "", "/", 0, FILE_SHORTDISPLAY, 0, FILE_SORT_ALPHA);
+ ED_fileselect_set_params(sfile, "", NULL, "/", 0, FILE_SHORTDISPLAY, 0, FILE_SORT_ALPHA);
}
return sfile->params;
}
-short ED_fileselect_set_params(SpaceFile *sfile, const char *title, const char *path,
+short ED_fileselect_set_params(SpaceFile *sfile, const char *title, const char *last_dir, const char *path,
short flag, short display, short filter, short sort)
{
char name[FILE_MAX], dir[FILE_MAX], file[FILE_MAX];
@@ -107,14 +107,19 @@ short ED_fileselect_set_params(SpaceFile *sfile, const char *title, const char *
params->sort = sort;
BLI_strncpy(params->title, title, sizeof(params->title));
-
- BLI_strncpy(name, path, sizeof(name));
- BLI_convertstringcode(name, G.sce);
- BLI_split_dirfile(name, dir, file);
- BLI_strncpy(params->file, file, sizeof(params->file));
- BLI_strncpy(params->dir, dir, sizeof(params->dir));
- BLI_make_file_string(G.sce, params->dir, dir, ""); /* XXX needed ? - also solve G.sce */
+ if(last_dir){
+ BLI_strncpy(params->dir, last_dir, sizeof(params->dir));
+ }
+ else {
+ BLI_strncpy(name, path, sizeof(name));
+ BLI_convertstringcode(name, G.sce);
+
+ BLI_split_dirfile(name, dir, file);
+ BLI_strncpy(params->file, file, sizeof(params->file));
+ BLI_strncpy(params->dir, dir, sizeof(params->dir));
+ BLI_make_file_string(G.sce, params->dir, dir, ""); /* XXX needed ? - also solve G.sce */
+ }
return 1;
}
@@ -279,3 +284,18 @@ FileLayout* ED_fileselect_get_layout(struct SpaceFile *sfile, struct ARegion *ar
}
return sfile->layout;
}
+
+void file_change_dir(struct SpaceFile *sfile)
+{
+ if (sfile->params) {
+ filelist_setdir(sfile->files, sfile->params->dir);
+
+ if(folderlist_clear_next(sfile))
+ folderlist_free(sfile->folders_next);
+
+ folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
+
+ filelist_free(sfile->files);
+ sfile->params->active_file = -1;
+ }
+}