diff options
author | Andrea Weikert <elubie@gmx.net> | 2009-06-30 03:21:11 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2009-06-30 03:21:11 +0400 |
commit | da32a0594b80aa5f980e17f446eb2d20c76272c5 (patch) | |
tree | 5761ecd7e7e1c652676124c30a9b2e82121cb167 /source/blender/editors/space_file | |
parent | 17d5bfd9709583cb58c030ecea3f7d3fb44a81ad (diff) |
2.5 file browser
* remove '.' and '..' from file browser list. sigh!
* removed delete buttons from automatically added bookmarks (Desktop and Documents)
Note: please check on non-Windows platforms
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 19 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_panels.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_file/fsmenu.c | 39 | ||||
-rw-r--r-- | source/blender/editors/space_file/fsmenu.h | 13 |
4 files changed, 12 insertions, 61 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index dd20c8e8224..3e24f360e40 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -137,22 +137,15 @@ static void file_select(SpaceFile* sfile, ARegion* ar, const rcti* rect, short v params->active_file = last_file; if(file && S_ISDIR(file->type)) { - /* the path is too long and we are not going up! */ - if (strcmp(file->relname, ".") && - strcmp(file->relname, "..") && - strlen(params->dir) + strlen(file->relname) >= FILE_MAX ) + /* the path is too long! */ + if (strlen(params->dir) + strlen(file->relname) >= FILE_MAX ) { // XXX error("Path too long, cannot enter this directory"); } else { - if (strcmp(file->relname, "..")==0) { - /* avoids /../../ */ - BLI_parent_dir(params->dir); - } else { - strcat(params->dir, file->relname); - strcat(params->dir,"/"); - params->file[0] = '\0'; - BLI_cleanup_dir(G.sce, params->dir); - } + strcat(params->dir, file->relname); + strcat(params->dir,"/"); + params->file[0] = '\0'; + BLI_cleanup_dir(G.sce, params->dir); filelist_setdir(sfile->files, params->dir); filelist_free(sfile->files); params->active_file = -1; diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index b370624d312..560c509ddcb 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -44,7 +44,7 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat uiLayout* layout = uiLayoutRow(pa->layout, UI_LAYOUT_ALIGN_LEFT); char *fname = fsmenu_get_entry(fsmenu, category, i); uiItemStringO(layout, fname, icon, "FILE_OT_select_bookmark", "dir", fname); - if (allow_delete) + if (allow_delete && fsmenu_can_save(fsmenu, category, i) ) uiItemIntO(layout, "", ICON_X, "FILE_OT_delete_bookmark", "index", i); } uiBlockEndAlign(block); diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index 59e8dcf82e6..a87ad4c4fd8 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -65,7 +65,6 @@ struct _FSMenuEntry { char *path; short save; - short xs, ys; }; typedef struct FSMenu @@ -74,9 +73,6 @@ typedef struct FSMenu FSMenuEntry *fsmenu_bookmarks; FSMenuEntry *fsmenu_recent; - FSMenuCategory selected_category; - int selected_entry; - } FSMenu; static FSMenu *g_fsmenu = NULL; @@ -89,17 +85,6 @@ struct FSMenu* fsmenu_get(void) return g_fsmenu; } -void fsmenu_select_entry(struct FSMenu* fsmenu, FSMenuCategory category, int index) -{ - fsmenu->selected_category = category; - fsmenu->selected_entry = index; -} - -int fsmenu_is_selected(struct FSMenu* fsmenu, FSMenuCategory category, int index) -{ - return (category==fsmenu->selected_category) && (index==fsmenu->selected_entry); -} - static FSMenuEntry *fsmenu_get_category(struct FSMenu* fsmenu, FSMenuCategory category) { FSMenuEntry *fsms = NULL; @@ -154,36 +139,16 @@ char *fsmenu_get_entry(struct FSMenu* fsmenu, FSMenuCategory category, int idx) return fsme?fsme->path:NULL; } -void fsmenu_set_pos(struct FSMenu* fsmenu, FSMenuCategory category, int idx, short xs, short ys) +short fsmenu_can_save (struct FSMenu* fsmenu, FSMenuCategory category, int idx) { FSMenuEntry *fsme; for (fsme= fsmenu_get_category(fsmenu, category); fsme && idx; fsme= fsme->next) idx--; - if (fsme) { - fsme->xs = xs; - fsme->ys = ys; - } + return fsme?fsme->save:0; } -int fsmenu_get_pos (struct FSMenu* fsmenu, FSMenuCategory category, int idx, short* xs, short* ys) -{ - FSMenuEntry *fsme; - - for (fsme= fsmenu_get_category(fsmenu, category); fsme && idx; fsme= fsme->next) - idx--; - - if (fsme) { - *xs = fsme->xs; - *ys = fsme->ys; - return 1; - } - - return 0; -} - - void fsmenu_insert_entry(struct FSMenu* fsmenu, FSMenuCategory category, char *path, int sorted, short save) { FSMenuEntry *prev; diff --git a/source/blender/editors/space_file/fsmenu.h b/source/blender/editors/space_file/fsmenu.h index c51c45b7dc4..2cab622d523 100644 --- a/source/blender/editors/space_file/fsmenu.h +++ b/source/blender/editors/space_file/fsmenu.h @@ -52,22 +52,15 @@ int fsmenu_get_nentries (struct FSMenu* fsmenu, FSMenuCategory category); */ char* fsmenu_get_entry (struct FSMenu* fsmenu, FSMenuCategory category, int index); -void fsmenu_select_entry (struct FSMenu* fsmenu, FSMenuCategory category, int index); - -int fsmenu_is_selected (struct FSMenu* fsmenu, FSMenuCategory category, int index); - - /** Sets the position of the fsmenu entry at @a index */ -void fsmenu_set_pos (struct FSMenu* fsmenu, FSMenuCategory category, int index, short xs, short ys); - - /** Returns the position of the fsmenu entry at @a index. return value is 1 if successful, 0 otherwise */ -int fsmenu_get_pos (struct FSMenu* fsmenu, FSMenuCategory category, int index, short* xs, short* ys); - /** 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 (struct FSMenu* fsmenu, FSMenuCategory category, char *path, int sorted, short save); + /** Return whether the entry was created by the user and can be saved and deleted */ +short fsmenu_can_save (struct FSMenu* fsmenu, FSMenuCategory category, int index); + /** Removes the fsmenu entry at the given @a index. */ void fsmenu_remove_entry (struct FSMenu* fsmenu, FSMenuCategory category, int index); |