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
path: root/source
diff options
context:
space:
mode:
authorAndrea Weikert <elubie@gmx.net>2009-07-01 00:34:00 +0400
committerAndrea Weikert <elubie@gmx.net>2009-07-01 00:34:00 +0400
commit60c2599a1a5990c66eb8e7c4d9d9959526a3cc2d (patch)
tree67302fe5ef3d70a6d8174baaf915dd234030552c /source
parent406b16e7d19b765bd5567661077d78aa315d8fc0 (diff)
2.5 filebrowser
* show only name of the last directory for the bookmark * small fix of projectfile: header BLI_fileops.h was moved Note: full path should appear in tool tip later, also for renaming bookmarks later on.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenlib/BLI_util.h1
-rw-r--r--source/blender/blenlib/intern/util.c19
-rw-r--r--source/blender/editors/space_file/file_panels.c14
3 files changed, 32 insertions, 2 deletions
diff --git a/source/blender/blenlib/BLI_util.h b/source/blender/blenlib/BLI_util.h
index 30c9fc353b3..a138ea780ea 100644
--- a/source/blender/blenlib/BLI_util.h
+++ b/source/blender/blenlib/BLI_util.h
@@ -50,6 +50,7 @@ void BLI_make_existing_file(char *name);
void BLI_split_dirfile(char *string, char *dir, char *file);
void BLI_split_dirfile_basic(const char *string, char *dir, char *file);
void BLI_join_dirfile(char *string, const char *dir, const char *file);
+void BLI_getlastdir(const char* dir, char *last, int maxlen);
int BLI_testextensie(const char *str, const char *ext);
void BLI_uniquename(struct ListBase *list, void *vlink, char defname[], char delim, short name_offs, short len);
void BLI_newname(char * name, int add);
diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c
index 26f4c2dd415..b9d4daaf5b2 100644
--- a/source/blender/blenlib/intern/util.c
+++ b/source/blender/blenlib/intern/util.c
@@ -736,6 +736,25 @@ void BLI_splitdirstring(char *di, char *fi)
}
}
+void BLI_getlastdir(const char* dir, char *last, int maxlen)
+{
+ char *s = dir;
+ char *lslash = NULL;
+ char *prevslash = NULL;
+ while (*s) {
+ if ((*s == '\\') || (*s == '/')) {
+ prevslash = lslash;
+ lslash = s;
+ }
+ s++;
+ }
+ if (prevslash) {
+ BLI_strncpy(last, prevslash+1, maxlen);
+ } else {
+ BLI_strncpy(last, dir, maxlen);
+ }
+}
+
char *BLI_gethome(void) {
#if !defined(WIN32)
return getenv("HOME");
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index a9a93d93de0..29c759d43c0 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -69,9 +69,19 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat
uiBlockSetEmboss(block, UI_EMBOSSP);
uiBlockBeginAlign(block);
for (i=0; i< nentries;++i) {
+ char dir[FILE_MAX];
+ char temp[FILE_MAX];
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);
+ char *entry = fsmenu_get_entry(fsmenu, category, i);
+
+ /* create nice bookmark name, shows last directory in the full path currently */
+ BLI_strncpy(temp, entry, FILE_MAX);
+ BLI_add_slash(temp);
+ BLI_getlastdir(temp, dir, FILE_MAX);
+ BLI_del_slash(dir);
+
+ /* operator shows the short bookmark name, should eventually have tooltip */
+ uiItemStringO(layout, dir, icon, "FILE_OT_select_bookmark", "dir", entry);
if (allow_delete && fsmenu_can_save(fsmenu, category, i) )
uiItemIntO(layout, "", ICON_X, "FILE_OT_delete_bookmark", "index", i);
}