libede:FileSystemBox: added FileSystemNode::label
authorRejean Loyer <rejean.loyer@gmail.com>
Fri, 16 Sep 2011 11:56:45 +0000 (07:56 -0400)
committerRejean Loyer <rejean.loyer@gmail.com>
Fri, 16 Sep 2011 11:56:45 +0000 (07:56 -0400)
libede/src/FileSystemBox.ec

index aa2d304..f21d8a6 100644 (file)
@@ -600,7 +600,7 @@ private:
       if(isRoot)
       {
          root.type = computer;
-         root.name = rootName;
+         root.label = rootName;
       }
 
       list.Sort(nameField, 1);
@@ -1784,6 +1784,7 @@ public:
    int indent;
    char * path;
    char * name;
+   char * label;
    char * extension;
    char * info;
    DataRow row;
@@ -1800,7 +1801,8 @@ public:
       FileSystemNode up;
       if(parent)
       {
-         strcpy(outputPath, name);
+         if(name)
+            strcpy(outputPath, name);
          for(up = parent; up; up = up.parent)
          {
             char temp[MAX_LOCATION];
@@ -1871,6 +1873,7 @@ public:
       }
       //if(name)
       delete name;
+      delete label;
       delete info;
    }
 
@@ -1889,7 +1892,7 @@ public:
       int len;
       int w, h;
       //int textOffset;
-      char label[MAX_FILENAME];
+      char string[MAX_FILENAME];
 
       Bitmap icon;
 
@@ -1904,10 +1907,10 @@ public:
          return;
 
       if(info)
-         sprintf(label, "%s [%s]", name, info);
+         sprintf(string, "%s [%s]", label ? label : name, info);
       else
-         strcpy(label, name);
-      len = strlen(label);
+         strcpy(string, label ? label : name);
+      len = strlen(string);
       
       if(!icon)
       {
@@ -1919,7 +1922,7 @@ public:
       //textOffset = indent * indentSize + (icon ? (icon.width + 4) : 0);
       
       surface.TextOpacity(false);
-      surface.TextExtent(label, len, &w, &h);
+      surface.TextExtent(string, len, &w, &h);
       h = Max(h, 16);
     
       // Draw the current row stipple
@@ -1929,7 +1932,7 @@ public:
          surface.Area(xStart - 3, y, xStart + w + 1, y + h - 1);
       
       //surface.WriteTextDots(alignment, x + textOffset, y + 2, width - textOffset, name, strlen(name));
-      surface.WriteTextDots(alignment, xStart, y + 2, width, label, len);
+      surface.WriteTextDots(alignment, xStart, y + 2, width, string, len);
 
       if(!guiApp.textMode)
       {