libede:FileSystemBox: added FileSystemNode::label
[ede] / libede / src / FileSystemBox.ec
index e47925d..f21d8a6 100644 (file)
@@ -8,7 +8,7 @@ static char * rootName = "File System";
 #endif
 
 private:
-define guiApp = ((GuiApplication)__thisModule);  // how to do this in a dll?
+define guiApp = (GuiApplication)((__thisModule).application);
 define selectionColor = guiApp.currentSkin.selectionColor; //Color { 10, 36, 106 };
 
 static char * fileIconNames[] = 
@@ -202,6 +202,7 @@ public:
       get { return bits.treeBranches; }
    };
    property bool navigateFolders { set { bits.navigateFolders = value; bits.filesOnly = !value; } get { return bits.navigateFolders; } };
+   property bool multiSelect { set { list.multiSelect = value; } get { return list.multiSelect; } };
    
    property FileSystemNode node
    {
@@ -412,7 +413,8 @@ private:
 
       bool NotifyDoubleClick(ListBox listBox, int x, int y, Modifiers mods)
       {
-         return OpenNode();
+         OpenNode();
+         return false;
       }
 
       bool NotifyKeyDown(ListBox listBox, DataRow row, Key key, unichar ch)
@@ -598,7 +600,7 @@ private:
       if(isRoot)
       {
          root.type = computer;
-         root.name = rootName;
+         root.label = rootName;
       }
 
       list.Sort(nameField, 1);
@@ -1782,6 +1784,7 @@ public:
    int indent;
    char * path;
    char * name;
+   char * label;
    char * extension;
    char * info;
    DataRow row;
@@ -1798,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];
@@ -1869,6 +1873,7 @@ public:
       }
       //if(name)
       delete name;
+      delete label;
       delete info;
    }
 
@@ -1887,7 +1892,7 @@ public:
       int len;
       int w, h;
       //int textOffset;
-      char label[MAX_FILENAME];
+      char string[MAX_FILENAME];
 
       Bitmap icon;
 
@@ -1902,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)
       {
@@ -1917,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
@@ -1927,9 +1932,9 @@ 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) -- how to do this in a dll?
+      if(!guiApp.textMode)
       {
          if(displayFlags.current)
          {