Revision: 21275
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21275
Author:   elubie
Date:     2009-06-30 22:34:00 +0200 (Tue, 30 Jun 2009)

Log Message:
-----------
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.

Modified Paths:
--------------
    
branches/blender2.5/blender/projectfiles_vc9/blender/blenlib/BLI_blenlib.vcproj
    branches/blender2.5/blender/source/blender/blenlib/BLI_util.h
    branches/blender2.5/blender/source/blender/blenlib/intern/util.c
    branches/blender2.5/blender/source/blender/editors/space_file/file_panels.c

Modified: 
branches/blender2.5/blender/projectfiles_vc9/blender/blenlib/BLI_blenlib.vcproj
===================================================================
--- 
branches/blender2.5/blender/projectfiles_vc9/blender/blenlib/BLI_blenlib.vcproj 
    2009-06-30 20:32:45 UTC (rev 21274)
+++ 
branches/blender2.5/blender/projectfiles_vc9/blender/blenlib/BLI_blenlib.vcproj 
    2009-06-30 20:34:00 UTC (rev 21275)
@@ -652,7 +652,7 @@
                                >
                        </File>
                        <File
-                               
RelativePath="..\..\..\source\blender\blenlib\intern\BLI_fileops.h"
+                               
RelativePath="..\..\..\source\blender\blenlib\BLI_fileops.h"
                                >
                        </File>
                        <File

Modified: branches/blender2.5/blender/source/blender/blenlib/BLI_util.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenlib/BLI_util.h       
2009-06-30 20:32:45 UTC (rev 21274)
+++ branches/blender2.5/blender/source/blender/blenlib/BLI_util.h       
2009-06-30 20:34:00 UTC (rev 21275)
@@ -50,6 +50,7 @@
 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);

Modified: branches/blender2.5/blender/source/blender/blenlib/intern/util.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenlib/intern/util.c    
2009-06-30 20:32:45 UTC (rev 21274)
+++ branches/blender2.5/blender/source/blender/blenlib/intern/util.c    
2009-06-30 20:34:00 UTC (rev 21275)
@@ -736,6 +736,25 @@
        }
 }
 
+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");

Modified: 
branches/blender2.5/blender/source/blender/editors/space_file/file_panels.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/file_panels.c 
2009-06-30 20:32:45 UTC (rev 21274)
+++ branches/blender2.5/blender/source/blender/editors/space_file/file_panels.c 
2009-06-30 20:34:00 UTC (rev 21275)
@@ -69,9 +69,19 @@
        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);
        }


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to