bunch of changes, unfortunate lack of commits
authorRejean Loyer <rejean.loyer@gmail.com>
Sat, 1 Oct 2011 18:17:14 +0000 (14:17 -0400)
committerRejean Loyer <rejean.loyer@gmail.com>
Sat, 1 Oct 2011 18:17:14 +0000 (14:17 -0400)
explorer/explorer.epj
explorer/src/Explorer.ec
explorer/src/ExplorerWindow.ec
libede/EDE.epj
libede/src/CreateNewFileDialog.ec [new file with mode: 0644]
libede/src/FileSystemBox.ec
libede/src/FileSystemSearch.ec

index be5f9fa..eb35059 100644 (file)
@@ -5,8 +5,6 @@
       "Warnings" : "All",
       "TargetType" : "Executable",
       "TargetFileName" : "explorer",
-      "TargetDirectory" : "obj/$(CONFIG).$(PLATFORM)",
-      "ObjectsDirectory" : "obj/$(CONFIG).$(PLATFORM)",
       "Libraries" : [
          "ecere"
       ]
index da5dce5..8bfeaa8 100644 (file)
@@ -63,7 +63,7 @@ class Explorer : GuiApplication
       {
          ExplorerWindow explorerWnd { };
          explorerWnd.Create();
-         explorerWnd.view.path = goPath;
+         explorerWnd.GoTo(goPath, false, false);
       }
       else if(searchPath)
       {
index b8cb03d..54a6a6a 100644 (file)
@@ -2,26 +2,56 @@ import "Explorer"
 import "IconBag"
 import "ToolBar"
 
+#ifdef _DEBUG
+   define title = "Ecere Explorer (Debug)";
+#else
+   define title = "Ecere Explorer";
+#endif
+
+/*
+define backgroundColor = Color { 30, 40, 50 }; //Color { 20, 20, 60 };
+define foregroundColor = lightGray; //white;
+define selectionColor = lightYellow;
+define selectionText = Color { 20, 30, 40 };
+define toolBarBackgroundColor = backgroundColor;//white; //Color { 240, 240, 250 };
+define toolBarForegroundColor = foregroundColor;//white; //Color { 240, 240, 250 };
+*/
+define backgroundColor = beige;//white; //Color { 128, 145, 175 }; //200, 224, 224 }; //lightGray;
+define foregroundColor = black;
+define selectionColor = app.currentSkin.selectionColor;
+define selectionText = app.currentSkin.selectionText;
+define toolBarBackgroundColor = backgroundColor;//white; //Color { 240, 240, 250 };
+define toolBarForegroundColor = foregroundColor;//white; //Color { 240, 240, 250 };
+
 enum ExplorerToolId
 {
    none,
    newWindow, goBack, goForward, goUp, goHome,
+   newFile, newFolder,
    browse,
    panelTree, panelSearch,
    addressBar,
    refresh,
    viewList, viewDetails, viewIcons, viewCards, viewShowcase, viewTree, viewCustom,
-   previewPictures
+   previewPictures,
+
+   searchInFileName,
+   inFileNameMatchCase,
+   inFileNameMatchWord,
+   searchInFileContent,
+   inFileContentMatchCase,
+   inFileContentMatchWord,
+   searchInSubDirs,
+   searchStart,
+   searchStop,
+
+   hasHeader
 };
 
 class ExplorerWindow : Window
 {
-#ifdef _DEBUG
-   text = "Ecere Explorer (Debug)";
-#else
-   text = "Ecere Explorer";
-#endif
-   background = activeBorder;
+   text = title;
+   background = backgroundColor;
    borderStyle = sizable;
    hasMaximize = true;
    hasMinimize = true;
@@ -31,6 +61,7 @@ class ExplorerWindow : Window
    size = { 840, 480 };
    minClientSize = { 600, 300 };
    nativeDecorations = true;
+   tabCycle = true;
 
    /*
    bool userMode;
@@ -42,6 +73,11 @@ class ExplorerWindow : Window
    ExplorerToolId lastViewId;
 */
 
+   bool treeInitialized;
+   int historyIndex;
+   Array<HistoryItem> history { };
+
+
    menu = Menu { };
    
    Menu fileMenu { menu, "File", f };
@@ -64,32 +100,45 @@ class ExplorerWindow : Window
       alphaBlend = true;
       iconNames =
       [
-         "<:ecere>emblems/unreadable.png",     /* none */
+         "<:ecere>emblems/unreadable.png",         /* none */
 
-         "<:ecere>actions/windowNew.png",            /* newWindow */
-         "<:ecere>actions/goPrevious.png",           /* goBack */
-         "<:ecere>actions/goNext.png",               /* goForward */
-         "<:ecere>actions/goUp.png",                 /* goUp */
-         "<:ecere>actions/goHome.png",               /* goHome */
+         "<:ecere>actions/windowNew.png",          /* newWindow */
+         "<:ecere>actions/goPrevious.png",         /* goBack */
+         "<:ecere>actions/goNext.png",             /* goForward */
+         "<:ecere>actions/goUp.png",               /* goUp */
+         "<:ecere>actions/goHome.png",             /* goHome */
+         "<:ecere>mimeTypes/file.png",             /* newFile */
+         "<:ecere>actions/folderNew.png",          /* newFolder */
 
-         ":browse.png",                                           /* browse */
+         ":browse.png",                            /* browse */
 
-         ":panel-tree.png",                                       /* panelTree */
-         "<:ecere>actions/editFind.png",             /* panelSearch */
+         ":panel-tree.png",                        /* panelTree */
+         "<:ecere>actions/editFind.png",           /* panelSearch */
 
-         "<:ecere>emblems/unreadable.png",     /* addressBar */
+         "",                                       /* addressBar */
 
-         "<:ecere>actions/viewRefresh.png",          /* refresh */
+         "<:ecere>actions/viewRefresh.png",        /* refresh */
 
-         ":view-list.png",                                        /* viewList */
-         ":view-details.png",                                     /* viewDetails */
-         ":view-icons.png",                                       /* viewIcons */
-         ":view-cards.png",                                       /* viewCards */
-         ":view-showcase-right.png",                              /* viewShowcase */
-         ":panel-tree.png",                                       /* viewTree */
-         ":view-custom.png",                                      /* viewCustom */
+         ":view-list.png",                         /* viewList */
+         ":view-details.png",                      /* viewDetails */
+         ":view-icons.png",                        /* viewIcons */
+         ":view-cards.png",                        /* viewCards */
+         ":view-showcase-right.png",               /* viewShowcase */
+         ":panel-tree.png",                        /* viewTree */
+         ":view-custom.png",                       /* viewCustom */
          
-         "<:ecere>mimeTypes/image.png"     /* previewPictures */
+         "<:ecere>mimeTypes/image.png",            /* previewPictures */
+
+         "",                                       /* searchInFileName */
+         "<:ecere>emblems/unreadable.png",         /* inFileNameMatchCase */
+         "<:ecere>emblems/unreadable.png",         /* inFileNameMatchWord */
+         "",                                       /* searchInFileContent */
+         "<:ecere>emblems/unreadable.png",         /* inFileContentMatchCase */
+         "<:ecere>emblems/unreadable.png",         /* inFileContentMatchWord */
+         ":browse.png",                            /* searchInSubDirs */
+         "<:ecere>actions/editFind.png",           /* searchStart */
+         "<:ecere>emblems/unreadable.png",         /* searchStop */
+         "<:ecere>emblems/unreadable.png"          /* hasHeader */
       ];
    };
 
@@ -98,9 +147,10 @@ class ExplorerWindow : Window
       this;
       gap = 0;
       direction = vertical;
-      background = activeBorder;
-      //opacity = 1.0f;
-      
+      background = backgroundColor;
+      opacity = 0.0f;
+      tabCycle = true;
+
       anchor = { left = 0, top = 0, right = 0, bottom = 0 };
       //moveable = false;
    };
@@ -108,9 +158,13 @@ class ExplorerWindow : Window
    ToolBar/*<ExplorerToolId>*/ toolBar
    {
       stack, this;
-      iconBag = iconBag;
       size = { h = 32 };
       //moveable = false;
+      borderStyle = none;
+      background = toolBarBackgroundColor;
+      tabCycle = true;
+
+      iconBag = iconBag;
 
       void NotifyToolClick(ToolButton button)
       {
@@ -124,12 +178,14 @@ class ExplorerWindow : Window
                break;
             case goBack:
             case goForward:
+               historyIndex += id == goBack ? -1 : 1;
+               GoToHistoryIndex(false, false, false);
                break;
             case goHome:
             {
                char * home = getenv("HOME");
                if(home && home[0] && FileExists(home).isDirectory)
-                  GoToLocation(home, false, false);
+                  GoTo(home, false, false);
                break;
             }
             case goUp:
@@ -142,92 +198,121 @@ class ExplorerWindow : Window
                   newPath[0] = '/';
                   newPath[1] = 0;
                }
-               GoToLocation(newPath, false, false);
+               GoTo(newPath, false, false);
                delete newPath;
                break;
             }
+            case newFile:
+               if(CreateNewFileDialog { master = this, parent = parent, currentDirectory = view.path }.Modal() == ok )
+                  Refresh();
+               break;
+            case newFolder:
+               if(CreateDirectoryDialog { master = this, parent = parent, currentDirectory = view.path }.Modal() == ok )
+                  Refresh();
+               break;
             case panelTree:
-               // TODO TOFIX : need to fix Stacker for this to work
+               SearchStop();
+               //ToggleSearchMode(false);
                tree.visible = button.checked;
                split.visible = button.checked;
                if(button.checked)
                {
                   split.rightPane = view;
                   view.anchor = { top = 0, bottom = 0, right = 0 };
-                  tree.SelectLocation(view.path);
+                  GoTo(addressBar.path, false, false);
+                  ReadyTree();
                }
                else
                {
                   split.rightPane = null;
-                  view.anchor = { left = 0, top = 0, bottom = 0, right = 0 };
+                  view.anchor = { left = 2, top = 0, bottom = 0, right = 0 };
                }
                //search.visible = !button.checked;
                panels.size = { panels.size.w, panels.size.h }; // TOFIX : another Stacker fix needed
                break;
             case panelSearch:
-               // TODO TOFIX : need to fix Stacker for this to work
-               //search.visible = button.checked;
-               tree.visible = false; //!button.checked;
-               split.visible = false; //!button.checked;
+               ToggleSearchMode(button.checked);
+
+               //tree.visible = false; //!button.checked;
+               //split.visible = false; //!button.checked;
                if(button.checked)
                {
                   /*split.rightPane = view;
                   view.anchor = { top = 0, bottom = 0, right = 0 };*/
-                  split.rightPane = null;
-                  view.anchor = { left = 0, top = 0, bottom = 0, right = 0 };
+                  //split.rightPane = null;
+                  //view.anchor = { left = 2, top = 0, bottom = 0, right = 0 };
 
-                  SearchStart();
+                  //SearchStart();
+                  searchInFileName.Activate();
                }
                else
                {
-                  split.rightPane = null;
-                  view.anchor = { left = 0, top = 0, bottom = 0, right = 0 };
+                  //split.rightPane = null;
+                  //view.anchor = { left = 2, top = 0, bottom = 0, right = 0 };
 
-                  SearchStop();
-                  view.path = addressBar.path;
+                  GoTo(addressBar.path, false, false);
                }
-               panels.size = { panels.size.w, panels.size.h }; // TOFIX : another Stacker fix needed
+               //panels.size = { panels.size.w, panels.size.h }; // TOFIX : another Stacker fix needed
                break;
             case refresh:
-               if(tree.visible)
-                  tree.Refresh();
-               view.Refresh();
+               Refresh();
                break;
             case previewPictures:
                view.previewPictures = button.checked;
                view.Refresh();
                break;
             case viewList:
+               view.details = false;
+               view.treeBranches = false;
+               view.Refresh();
+               break;
             case viewDetails:
+               view.details = true;
+               view.treeBranches = false;
+               view.Refresh();
+               break;
             case viewIcons:
             case viewCards:
-            case viewShowcase:
                //SwitchViews(toolId);
+               view.details = false;
                view.treeBranches = false;
                view.Refresh();
                break;
+            case viewShowcase:
+               view.preview = button.checked;
+               view.Refresh();
+               break;
             case viewTree:
                view.treeBranches = button.checked;
                view.Refresh();
                break;
+            case hasHeader:
+               view.hasHeader ^= true;
+               break;
          }
+         view.Activate();
       }
    };
 
-   Window s1 { toolBar, size = { w = 8 } };
-   ToolButton goBack { toolBar, this, id = ExplorerToolId::goBack };
-   Window s2 { toolBar, size = { w = 2 } };
-   ToolButton goForward { toolBar, this, id = ExplorerToolId::goForward };
-   Window s3 { toolBar, size = { w = 2 } };
-   ToolButton refresh { toolBar, this, id = ExplorerToolId::refresh };
-   Window s4 { toolBar, size = { w = 2 } };
-   ToolButton goHome { toolBar, this, id = ExplorerToolId::goHome };
-   Window s5 { toolBar, size = { w = 8 } };
+   Window { toolBar, size = { w = 8 }, inactive = true };
+   ToolButton goBack { toolBar, this, id = ExplorerToolId::goBack, hotKey = { left, alt = true }, disabled = true };
+   Window { toolBar, size = { w = 2 }, inactive = true };
+   ToolButton goForward { toolBar, this, id = ExplorerToolId::goForward, hotKey = { right, alt = true }, disabled = true };
+   Window { toolBar, size = { w = 2 }, inactive = true };
+   ToolButton refresh { toolBar, this, id = ExplorerToolId::refresh, hotKey = { r, ctrl = true } };
+   Window { toolBar, size = { w = 2 }, inactive = true };
+   ToolButton goHome { toolBar, this, id = ExplorerToolId::goHome, hotKey = { h, ctrl = true } };
+   Window { toolBar, size = { w = 8 }, inactive = true };
    PathBox addressBar
    {
       toolBar, this;
-      size = { 300, 23 }, id = ExplorerToolId::addressBar;
+      size = { 300, 22 }, id = ExplorerToolId::addressBar;
       typeExpected = directory;
+      borderStyle = deep;
+      background = toolBarBackgroundColor;
+      foreground = toolBarForegroundColor;
+      selectionColor = selectionColor;
+      selectionText = selectionText;
 
       bool OnKeyDown(Key key, unichar ch)
       {
@@ -241,33 +326,46 @@ class ExplorerWindow : Window
 
       bool NotifyModified(PathBox pathBox)
       {
-         GoToLocation(pathBox.path, false, false);
+         GoTo(pathBox.path, false, false);
          return true;
       }
    };
    FlipStacker { toolBar, spring = previous };
-   Window s6 { toolBar, size = { w = 8 } };
-   ToolButton goUp { toolBar, this, id = ExplorerToolId::goUp };
-   Window s7 { toolBar, size = { w = 8 } };
-   GroupToggleToolButton selectedPanel;
-   GroupToggleToolButton panelTree   { toolBar, this, id = ExplorerToolId::panelTree, selected = &selectedPanel, checked = true };
-   GroupToggleToolButton panelSearch { toolBar, this, id = ExplorerToolId::panelSearch, selected = &selectedPanel };
-   selectedPanel = panelTree;
-   Window s8 { toolBar, size = { w = 8 } };
-   OptionToolButton selectedView;
+   Window { toolBar, size = { w = 8 }, inactive = true };
+   ToolButton newFile { toolBar, this, id = ExplorerToolId::newFile, hotKey = { n, ctrl = true } };
+   Window { toolBar, size = { w = 2 }, inactive = true };
+   ToolButton newFolder { toolBar, this, id = ExplorerToolId::newFolder, hotKey = { d, ctrl = true } };
+   Window { toolBar, size = { w = 8 }, inactive = true };
+   ToolButton goUp { toolBar, this, id = ExplorerToolId::goUp, hotKey = { up, alt = true } };
+   Window { toolBar, size = { w = 8 }, inactive = true };
+   //GroupToggleToolButton selectedPanel;
+   ToggleToolButton panelTree   { toolBar, this, id = ExplorerToolId::panelTree, hotKey = { t, ctrl = true }/*, selected = &selectedPanel*//*, checked = true*/ };
+   ToggleToolButton panelSearch { toolBar, this, id = ExplorerToolId::panelSearch, hotKey = { f, ctrl = true }/*, selected = &selectedPanel*/ };
+   //selectedPanel = panelTree;
+   Window { toolBar, size = { w = 8 }, inactive = true };
+   /*OptionToolButton selectedView;
    OptionToolButton viewList     { toolBar, this, id = ExplorerToolId::viewList, selected = &selectedView, checked = true };
    OptionToolButton viewDetails  { toolBar, this, id = ExplorerToolId::viewDetails, selected = &selectedView };
    OptionToolButton viewIcons    { toolBar, this, id = ExplorerToolId::viewIcons, selected = &selectedView };
    OptionToolButton viewTiles    { toolBar, this, id = ExplorerToolId::viewCards, selected = &selectedView };
    OptionToolButton viewShowcase { toolBar, this, id = ExplorerToolId::viewShowcase, selected = &selectedView };
    OptionToolButton viewTree     { toolBar, this, id = ExplorerToolId::viewTree, selected = &selectedView };
-   selectedView = viewList;
-   Window s9 { toolBar, size = { w = 8 } };
+   selectedView = viewList;*/
+   //ToggleToolButton viewList     { toolBar, this, id = ExplorerToolId::viewList, checked = true };
+   ToggleToolButton viewDetails  { toolBar, this, id = ExplorerToolId::viewDetails };
+   //ToggleToolButton viewIcons    { toolBar, this, id = ExplorerToolId::viewIcons };
+   //ToggleToolButton viewTiles    { toolBar, this, id = ExplorerToolId::viewCards };
+   ToggleToolButton viewShowcase { toolBar, this, id = ExplorerToolId::viewShowcase };
+   ToggleToolButton viewTree     { toolBar, this, id = ExplorerToolId::viewTree };
+   Window { toolBar, size = { w = 8 }, inactive = true };
    ToggleToolButton previewPictures { toolBar, this, id = ExplorerToolId::previewPictures };
 
-   Window s10 { toolBar, size = { w = 8 } };
-   ToolButton newWindow { toolBar, this, id = ExplorerToolId::newWindow };
-   Window s11 { toolBar, size = { w = 8 } };
+   Window { toolBar, size = { w = 8 }, inactive = true };
+   ToolButton hasHeader { toolBar, this, id = ExplorerToolId::hasHeader };
+   Window { toolBar, size = { w = 8 }, inactive = true };
+   ToolButton newWindow { toolBar, this, id = ExplorerToolId::newWindow, hotKey = { w, ctrl = true } };
+   Window { toolBar, size = { w = 8 }, inactive = true };
+
 
    /*void OnDestroy()
    {
@@ -291,56 +389,187 @@ class ExplorerWindow : Window
       stack, this;
       gap = 0;
       direction = horizontal;
-      background = yellow;//activeBorder;
-      //opacity = 1.0f;
+      opacity = 0.0f;
+      tabCycle = true;
 
       anchor.left = 0;
-      anchor.bottom = 0;
+      //anchor.bottom = 0;
       anchor.right = 0;
+
+      //size = { h = 400 };
+   };
+
+   FlipStacker flipStack { stack, spring = previous };
+
+   //Window searchSpace { stack, size = { h = 32 }, background = toolBarBackgroundColor, inactive = true, opacity = 0.0f };
+
+   ToolBar/*<ExplorerToolId>*/ searchBar
+   {
+      stack, this;
+      size = { h = 32 };
+      visible = false;
+      //moveable = false;
+      borderStyle = none;
+      background = toolBarBackgroundColor;
+      tabCycle = true;
+      iconBag = iconBag;
+
+      void NotifyToolClick(ToolButton button)
+      {
+         ExplorerToolId id = (ExplorerToolId)button.id;
+         switch(id)
+         {
+            case none:
+               break;
+            case searchStart:
+               SearchStart();
+               break;
+            case searchStop:
+               SearchStop();
+               break;
+         }
+         view.Activate();
+      }
+   };
+
+
+   Window { searchBar, size = { w = 8 }, inactive = true };
+   Label { searchBar, this, labeledWindow = searchInFileName};
+   Window { searchBar, size = { w = 2 }, inactive = true };
+   EditBox searchInFileName
+   {
+      searchBar, this;
+      size = { 200, 22 }, id = ExplorerToolId::searchInFileName;
+      borderStyle = deep;
+      background = toolBarBackgroundColor;
+      foreground = toolBarForegroundColor;
+      selectionColor = selectionColor;
+      selectionText = selectionText;
+      text = "File Name:";
+
+      bool NotifyKeyDown(EditBox editBox, Key key, unichar ch)
+      {
+         if((SmartKey)key == enter)
+            SearchStart();
+         return true;
+      }
+
+      /*bool NotifyActivate(Window window, bool active, Window previous)
+      {
+         if(active)
+         {
+            toolBar.focusHolder = window;
+         }
+         return true;
+      }*/
    };
+   Window { searchBar, size = { w = 2 }, inactive = true };
+#ifndef __WIN32__
+   ToggleToolButton inFileNameMatchCase { searchBar, this, id = ExplorerToolId::inFileNameMatchCase };
+#endif
+   ToggleToolButton inFileNameMatchWord { searchBar, this, id = ExplorerToolId::inFileNameMatchWord };
+   Window { searchBar, size = { w = 8 }, inactive = true };
+   Label { searchBar, this, labeledWindow = searchInFileContent};
+   Window { searchBar, size = { w = 2 }, inactive = true };
+   EditBox searchInFileContent
+   {
+      searchBar, this;
+      size = { 200, 22 }, id = ExplorerToolId::searchInFileContent;
+      borderStyle = deep;
+      background = toolBarBackgroundColor;
+      foreground = toolBarForegroundColor;
+      selectionColor = selectionColor;
+      selectionText = selectionText;
+      text = "File Content:";
 
-   //FlipStacker flipStack { stack, spring = previous };
+      bool NotifyKeyDown(EditBox editBox, Key key, unichar ch)
+      {
+         if((SmartKey)key == enter)
+            SearchStart();
+         return true;
+      }
+
+      /*bool NotifyActivate(Window window, bool active, Window previous)
+      {
+         if(active)
+            toolBar.focusHolder = window;
+         return true;
+      }*/
+   };
+   FlipStacker { searchBar, spring = previous };
+   ToggleToolButton inFileContentMatchCase { searchBar, this, id = ExplorerToolId::inFileContentMatchCase };
+   ToggleToolButton inFileContentMatchWord { searchBar, this, id = ExplorerToolId::inFileContentMatchWord };
+   Window { searchBar, size = { w = 8 }, inactive = true };
+   ToggleToolButton searchInSubDirs { searchBar, this, id = ExplorerToolId::searchInSubDirs, checked = true };
+   Window { searchBar, size = { w = 8 }, inactive = true };
+   ToolButton searchStart { searchBar, this, id = ExplorerToolId::searchStart, hotKey = { s, ctrl = true } };
+   Window { searchBar, size = { w = 8 }, inactive = true };
+   ToolButton searchStop { searchBar, this, id = ExplorerToolId::searchStop, hotKey = { escape }, disabled = true; };
+   Window { searchBar, size = { w = 8 }, inactive = true };
+
+
+
+   //Window { searchBar, size = { h = 1 } };
 
    /*SearchPanel searchPanel
    {
       panels, this;
    };*/
 
-   Window hack
+   /*Window hack
    {
       panels, this;
       anchor.top = 0;
       anchor.bottom = 0;
       anchor.right = 0;
-      borderStyle = deep;
-   };
+      borderStyle = none;
+      background = backgroundColor;
+   };*/
 
    /*Tree*/FileSystemBox tree//;
    {
-      hack, this;
+      panels, this;
       size = { w = 240 };
       borderStyle = none;
+      background = backgroundColor;
+      foreground = foregroundColor;
+      selectionColor = selectionColor;
+      selectionText = selectionText;
       visible = false;
-      /*anchor.top = 0;
-      anchor.bottom = 0;*/
-      anchor = { left = 0, top = 0, bottom = 0 };
+      anchor.top = 0;
+      anchor.bottom = 0;
+      //anchor = { left = 0, top = 0, bottom = 0 };
 
       treeBranches = true;
       foldersOnly = true;
       autoLoad = false;
 
-      bool NotifyNodeSelect(FileSystemBox box, FileSystemNode node)
+      bool NotifyNodeSelect(FileSystemBox box, FileSystemBoxSelection selection)
       {
-         char p[MAX_LOCATION];
-         node.GetPath(p);
-         GoToLocation(node.path, false, true);
+         if(treeInitialized)
+         {
+            FileSystemNode node = selection.node;
+            if(node)
+            {
+               char p[MAX_LOCATION];
+               node.GetPath(p);
+               GoTo(node.path, false, true);
+            }
+         }
          return true;
       }
+
+      /*bool NotifyActivate(Window window, bool active, Window previous)
+      {
+         if(active)
+            toolBar.focusHolder = window;
+         return true;
+      }*/
    };
 
    PaneSplitter split
    {
-      hack, this;
+      panels, this;
       visible = false;
       leftPane = tree;//, rightPane = view;
       split = 300;
@@ -348,77 +577,235 @@ class ExplorerWindow : Window
 
    FileSystemBox view
    {
-      hack, this;
+      panels, this;
       borderStyle = none;
-      /*anchor.top = 0;
+      background = backgroundColor;
+      foreground = foregroundColor;
+      selectionColor = selectionColor;
+      selectionText = selectionText;
+      anchor.top = 0;
       anchor.bottom = 0;
-      anchor.right = 0;*/
-      anchor = { left = 0, top = 0, bottom = 0, right = 0 };
+      anchor.right = 0;
+      //anchor = { left = 2, top = 0, bottom = 0, right = 0 };
 
       locationBox = addressBar;
       navigateFolders = true;
       multiSelect = true;
       autoLoad = false;
 
-      bool NotifyNodeOpen(FileSystemBox box, FileSystemNode node)
+      bool NotifyNodeOpen(FileSystemBox box, FileSystemBoxSelection selection)
       {
-         if(node.type.isFile)
+         FileSystemNode node = selection.node;
+         if(node)
          {
-            char path[MAX_LOCATION];
-         #ifndef __WIN32__
-            char command[MAX_LOCATION];
-            node.GetPath(path);
-            /*_FileType t = node.type;
-            if(t == ewsFile || t == epjFile ||
-                  t == ecFile || t == ehFile ||
-                  t == cppFile || t == hppFile ||
-                  t == cFile || t == hFile ||
-                  t == textFile || t == webFile)*/
-               sprintf(command, "ide %s", path);
-            /*else
-               sprintf(command, "%s", path);*/
-            Execute(command);
-         #else
-            node.GetPath(path);
-            ShellOpen(path);
-         #endif
+            if(node.type.isFile)
+            {
+               char path[MAX_LOCATION];
+            #ifndef __WIN32__
+               char command[MAX_LOCATION];
+               node.GetPath(path);
+               /*_FileType t = node.type;
+               if(t == ewsFile || t == epjFile ||
+                     t == ecFile || t == ehFile ||
+                     t == cppFile || t == hppFile ||
+                     t == cFile || t == hFile ||
+                     t == textFile || t == webFile)*/
+                  sprintf(command, "gnome-open \"%s\"", path);
+               /*else
+                  sprintf(command, "%s", path);*/
+               Execute(command);
+            #else
+               node.GetPath(path);
+               ShellOpen(path);
+            #endif
+            }
+            else if(node.type.isFolder)
+               GoTo(node.path, true, false);
          }
-         else if(node.type.isFolder && tree.visible)
-            tree.SelectLocation(node.path);
+         UpdateHistoryItem(selection);
+         return true;
+      }
+
+      bool NotifyNodeSelect(FileSystemBox box, FileSystemBoxSelection selection)
+      {
+         UpdateHistoryItem(selection);
          return true;
       }
+
+      /*bool NotifyActivate(Window window, bool active, Window previous)
+      {
+         if(active)
+            toolBar.focusHolder = window;
+         return true;
+      }*/
    };
 
    FileSystemSearch searchThread
    {
-      owner = this, fsb = view/*, searchPanel = this*/;
+      owner = this, fsb = view, tree = tree/*, searchPanel = this*/;
+
+      /*bool ExplorerWindow::NotifyUpdateSearchLocation(FileSystemSearch search, char * location)
+      {
+         char string[MAX_LOCATION + 2048];
+         sprintf(string, "%s (Searching %s)", title, location);
+         PrintLn(string); //view.results.text = string;
+         text = string;
+         return true;
+      }*/
 
-      bool Window::NotifyUpdateSearchLocation(FileSystemSearch search, char * location)
+      bool ExplorerWindow::NotifySearchTerminated(FileSystemSearch search)
       {
-         char text[2048];
-         sprintf(text, "Search Results (Searching %s)", location);
-         PrintLn(text); //view.results.text = text;
+         searchStop.disabled = true;
          return true;
       }
    };
 
-   void SearchStart()
+   void ToggleSearchMode(bool inSearch)
    {
-      char text[2048];
+      SearchStop();
+      //search.visible = inSearch;
+      //panelSearch.checked = inSearch; // <------ this is toggling panelSearch even though it shouldn't
+      //searchSpace.visible = !inSearch;
+      searchBar.visible = inSearch;
+      history[historyIndex].inSearch = inSearch;
+      size = { size.w, size.h };
+      view.pathColumn = inSearch;
+      /*if(inSearch)
+         searchThread.InitResults();*/
+      if(inSearch && /*(*/searchInFileName.contents[0]/* || searchInFileContents.contents[0])*/)
+         SearchStart();
+   }
 
+   void ReadyTree()
+   {
+      if(tree.visible)
+      {
+         if(!treeInitialized)
+         {
+            tree.path = "/"; // this should be available as a parameter
+            treeInitialized = true;
+         }
+         tree.SelectLocation(view.path);
+      }
+   }
+
+   void Refresh()
+   {
+      if(searchBar.visible)
+         SearchStart();
+      else
+      {
+         if(tree.visible)
+            tree.Refresh();
+         view.Refresh();
+      }
+   }
+
+   void GoTo(char * location, bool viewIsAtLocation, bool treeIsAtLocation)
+   {
+      HistoryItem item = null;
+      if(!history.count || fstrcmp(history[historyIndex].path, location))
+      {
+         int c;
+         for(c = 0; c < history.count; c++)
+            if(!fstrcmp(history[c].path, location))
+               break;
+         if(c == history.count)
+         {
+            item = { path = CopyString(location) };
+            if(history.count)
+            {
+               while(historyIndex < history.count-1)
+               {
+                  delete history[history.count-1].path;
+                  history.count--;
+               }
+            }
+            history.Add(item);
+            historyIndex = history.count-1;
+         }
+         else
+            historyIndex = c;
+      }
+      GoToHistoryIndex(viewIsAtLocation, treeIsAtLocation, item != null);
+   }
+
+   void GoToHistoryIndex(bool viewIsAtLocation, bool treeIsAtLocation, bool updateHistoryItem)
+   {
+      HistoryItem item = history[historyIndex];
+
+      goBack.disabled = historyIndex == 0;
+      goForward.disabled = historyIndex == history.count-1;
+      goUp.disabled = !fstrcmp(item.path, "/");
+
+      if(!viewIsAtLocation)
+      {
+         if(item.inSearch != panelSearch.checked)
+         {
+            ToggleSearchMode(item.inSearch);
+            if(item.inSearch)
+               SearchStart();
+         }
+         if(!item.inSearch)
+         /*{
+            //SearchStart();
+         }
+         else*/
+         {
+            view.path = item.path;
+            item.holdRecordingSelection = true;
+            view.SelectMultipleByPath(item.selection);
+         }
+      }
+      if(tree.visible && !treeIsAtLocation)
+         tree.SelectLocation(item.path);
+
+      if(updateHistoryItem)
+         UpdateHistoryItem(view.selection);
+   }
+
+   void UpdateHistoryItem(FileSystemBoxSelection selection)
+   {
+      HistoryItem item = history[historyIndex];
+
+      if(!item.holdRecordingSelection)
+      {
+         if(selection.node || (selection.nodes && selection.nodes.count))
+         {
+            item.selection.Free();
+            if(selection.nodes.count)
+            {
+               for(node : selection.nodes)
+                  item.selection.Add(CopyString(node.path));
+            }
+            else if(selection.node)
+               item.selection.Add(CopyString(selection.node.path));
+         }
+      }
+      else
+         item.holdRecordingSelection = false;
+   }
+
+   void SearchStart()
+   {
+      SearchStop();
       searchThread.active = true;
 
-      searchThread.optionSubdirs = true; //options.subdirs.checked;
+      searchThread.optionSubdirs = searchInSubDirs.checked == true;
       searchThread.optionTree = view.treeBranches; //(options.subdirs.checked && options.tree.checked);
-      searchThread.optionBrowser = false; //(options.subdirs.checked && options.browser.checked);
-      searchThread.optionNameMatchCase = false; //findName.optionMatchCase.checked;
-      searchThread.optionNameMatchWord = false; //findName.optionMatchWord.checked;
-      searchThread.optionContentMatchCase = false; //findTextContent.optionMatchCase.checked;
-      searchThread.optionContentMatchWord = false; //findTextContent.optionMatchWord.checked;
+      searchThread.optionBrowser = tree.visible; //(options.subdirs.checked && options.browser.checked);
+#ifndef __WIN32__
+      searchThread.optionNameMatchCase = inFileNameMatchCase.checked;
+#else
+      searchThread.optionNameMatchCase = false;
+#endif
+      searchThread.optionNameMatchWord = inFileNameMatchWord.checked;
+      searchThread.optionContentMatchCase = inFileContentMatchCase.checked;
+      searchThread.optionContentMatchWord = inFileContentMatchWord.checked;
 
-      strcpy(searchThread.location, view.path/*location.GetText()*/);
-      strcpy(searchThread.nameSearch, ".txt"/*findName.GetText()*/);
-      strcpy(searchThread.contentSearch, ""/*findTextContent.GetText()*/);
+      strcpy(searchThread.location, view.path);
+      strcpy(searchThread.nameSearch, searchInFileName.contents);
+      strcpy(searchThread.contentSearch, searchInFileContent.contents);
 
       //actions.startStop.text = "Stop Search";
       //actions.clear.disabled = false;
@@ -429,11 +816,16 @@ class ExplorerWindow : Window
       //ToggleBrowserDisplay(searchThread.optionBrowser);
 
       //view.browser.text = "Browser";
-      //sprintf(text, "Search Results (Searching %s)", location.GetText());
-      PrintLn("Search Results (Searching ", view.path, ")");
-      //view.results.text = text;
-
+      /*{
+         char string[MAX_LOCATION + 2048];
+         sprintf(string, "%s (Searching %s)", title, view.path);
+         //PrintLn(string); //view.results.text = string;
+         text = string;
+      }*/
+      searchThread.InitResults();
       searchThread.Create();
+      searchStop.disabled = false;
+      //Update(null);
    }
 
    bool SearchStop()
@@ -441,6 +833,7 @@ class ExplorerWindow : Window
       if(searchThread.active)
       {
          searchThread.terminate = true;
+         //searchStop.disabled = true;
          app.Unlock();
             searchThread.Wait();
          app.Lock();
@@ -542,17 +935,9 @@ class ExplorerWindow : Window
       lastViewId = viewId;
    }*/
 
-   void GoToLocation(char * location, bool viewIsAtLocation, bool treeIsAtLocation)
-   {
-      if(!viewIsAtLocation)
-         view.path = location;
-      if(tree.visible && !treeIsAtLocation)
-         tree.SelectLocation(location);
-   }
-
    /*void SearchLocation(char * location)
    {
-      GoToLocation(location);
+      GoTo(location);
       search.location.editBox.contents = location;
    }*/
 
@@ -560,7 +945,13 @@ class ExplorerWindow : Window
    {
       //userMode = true;
       addressBar.path = view.path;
-      tree.path = "/"; // this should be available as a parameter
+      ReadyTree();
+      return true;
+   }
+
+   bool OnClose(bool parentClosing)
+   {
+      SearchStop();
       return true;
    }
 
@@ -595,3 +986,16 @@ class ExplorerWindow : Window
 }
 
 //class TreeFileSystemBox : FileSystemBox { }
+
+class HistoryItem
+{
+   char * path;
+   bool holdRecordingSelection;
+   bool inSearch;
+   Array<String> selection { };
+
+   ~HistoryItem()
+   {
+      delete path;
+   }
+}
index 2b477b8..1dd2ea0 100644 (file)
@@ -45,7 +45,8 @@
          "Folder" : "src",
          "Files" : [
             "FileSystemBox.ec",
-            "FileSystemSearch.ec"
+            "FileSystemSearch.ec",
+            "CreateNewFileDialog.ec"
          ]
       }
    ],
diff --git a/libede/src/CreateNewFileDialog.ec b/libede/src/CreateNewFileDialog.ec
new file mode 100644 (file)
index 0000000..49755a0
--- /dev/null
@@ -0,0 +1,89 @@
+public import "ecere"
+
+public class CreateNewFileDialog : Window
+{
+   background = activeBorder;
+   minClientSize = Size { 240, 100 };
+   tabCycle = true;
+   hasClose = true;
+   text = "Create New File";
+
+public:
+
+   property char * currentDirectory
+   {
+      set
+      {
+         GetWorkingDir(currentDirectory, MAX_DIRECTORY);  // is this necessary?
+         PathCat(currentDirectory, value);
+         FileFixCase(currentDirectory);
+      }
+      get { return (char *)currentDirectory; }
+   };
+
+private:
+
+   char currentDirectory[MAX_DIRECTORY];
+
+   CreateNewFileDialog()
+   {
+      FileNameType c;
+
+      GetWorkingDir(currentDirectory, MAX_DIRECTORY);
+      FileFixCase(currentDirectory);
+   }
+
+   ~CreateNewFileDialog()
+   {
+   }
+
+   bool OnPostCreate()
+   {
+      newNewFileName.SelectAll();
+      return true;
+   }
+
+   Button ok
+   {
+      parent = this, isDefault = true, position = { 70, 60 }, size = { 60 }, text = "OK";
+      bool NotifyClicked(Button button, int x, int y, Modifiers mods)
+      {
+         if(newNewFileName.contents && newNewFileName.contents[0])
+         {
+            char newFilePath[MAX_DIRECTORY];
+            strcpy(newFilePath, currentDirectory);
+            PathCat(newFilePath, newNewFileName.contents);
+            if(!FileExists(newFilePath).isFile)
+            {
+               File f = FileOpen(newFilePath, write);
+               if(f)
+               {
+                  f.Flush();
+               }
+               delete f;
+               Destroy(DialogResult::ok);
+            }
+            else
+               MessageBox { master = this, parent = parent, type = ok, text = "Create NewFile Error", contents = "NewFile already exists." }.Modal();
+         }
+         else
+            MessageBox { master = this, parent = parent, type = ok, text = "Create NewFile Error", contents = "Please enter a name." }.Modal();
+         return true;
+      }
+   };
+
+   Button cancel
+   {
+      parent = this, position = { 140, 60 }, size = { 60 }, hotKey = escape, text = "Cancel";
+      NotifyClicked = ButtonCloseDialog;
+   };
+
+   EditBox newNewFileName
+   {
+      this, textHorzScroll = true, anchor = { left = 10, right = 10, top = 30 }, size = { 250 };
+      hotKey = altN, text = "Name";
+      contents = "New NewFile";
+   };
+   Label { this, position = { 10, 10 }, labeledWindow = newNewFileName };
+
+}
index 294e414..fda27fa 100644 (file)
@@ -139,13 +139,20 @@ public enum _FileType
 
 class FileSystemBoxBits
 {
-   bool foldersOnly:1, filesOnly:1, details:1, treeBranches:1, previewPictures:1, navigateFolders:1, autoLoad:1;
+   bool foldersOnly:1, filesOnly:1, details:1, pathColumn:1, treeBranches:1, previewPictures:1, navigateFolders:1, autoLoad:1;
+   bool preview:1;
    //bool header:1, freeSelect:1, fullRowSelect:1, multiSelect:1, autoScroll:1, alwaysHL : 1, moveRows:1, resizable:1;
    //bool moveFields:1, clearHeader:1, alwaysEdit:1, collapse:1, treeBranch:1, rootCollapse:1, heightSet:1;
    //bool sortable:1, noDragging:1, fillLastField:1, expandOnAdd:1;
 };
 
 public class FileSystemBox : Window // should we not derive from ListBox instead?
+                                    // I say we should, but we can't right now...
+                                    // because ListBox (inside ecere library) is
+                                    // not exposing enough internal machinery...
+                                    // could we not have a different private and
+                                    // public mechanism when deriving a class than
+                                    // we do when simply instanciating a class?
 /*
    this stuff from the listbox would be nicely exposed...
       fullRowSelect = false;
@@ -163,11 +170,11 @@ public class FileSystemBox : Window // should we not derive from ListBox instead
 
 public:
    FileSystemNode root;
-   FileSystemNode selection;
+   FileSystemBoxSelection selection { };
 
-   virtual bool Window::NotifyNodeSelect(FileSystemBox box, FileSystemNode node);
+   virtual bool Window::NotifyNodeSelect(FileSystemBox box, FileSystemBoxSelection selection);
    //virtual bool Window::NotifyNodeNavigate(FileSystemBox box, FileSystemNode node);
-   virtual bool Window::NotifyNodeOpen(FileSystemBox box, FileSystemNode node);
+   virtual bool Window::NotifyNodeOpen(FileSystemBox box, FileSystemBoxSelection selection);
    
    property char * path
    {
@@ -190,7 +197,8 @@ public:
    property bool filesOnly { set { bits.filesOnly = value; bits.foldersOnly = !value; } get { return bits.filesOnly; } };
    property bool previewPictures { set { bits.previewPictures = value; } get { return bits.previewPictures; } };
    property char * extensions { set { delete extensions; if(value && value[0]) extensions = CopyString(value); } get { return extensions; } }
-   property bool details { set { bits.details = value; } get { return bits.details; } };
+   property bool details { set { bits.details = value; ChangeViewType(); } get { return bits.details; } };
+   property bool pathColumn { set { bits.pathColumn = value; ChangeViewType(); } get { return bits.pathColumn; } };
    property bool treeBranches
    {
       set
@@ -202,9 +210,23 @@ public:
       }
       get { return bits.treeBranches; }
    };
+   property Color selectionColor { set { list.selectionColor = value; } get { return list.selectionColor; }/* isset { return selectionColor ? true : false; }*/ };
+   property Color selectionText  { set { list.selectionText = value; } get { return list.selectionText; }/* isset { return selectionText ? true : false; }*/ };
    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 bool autoLoad { set { bits.autoLoad = value; } get { return bits.autoLoad; } };
+   property bool hasHeader { set { list.hasHeader = value; } get { return list.hasHeader; } };
+   property bool preview
+   {
+      set
+      {
+         bits.preview = value;
+         split.leftPane = value ? list : null;
+         split.visible = value;
+         show.visible = value;
+      }
+      get { return bits.preview; }
+   };
    
    property FileSystemNode node
    {
@@ -231,6 +253,32 @@ public:
       }
    }
 
+   void SelectMultipleByPath(Array<String> paths)
+   {
+      DataRow row;
+      bool firstRow = false;
+      Map<String, bool> map { };
+      for(path : paths)
+         map[path] = true;
+      for(row = list.firstRow; row; row = row.next)
+      {
+         FileSystemNode node = (FileSystemNode)row.tag;
+         if(map[node.path])
+         {
+            if(!firstRow)
+            {
+               list.SelectRow(row);
+               firstRow = true;
+            }
+            else
+               row.selected = true;
+         }
+         else
+            row.selected = false;
+      }
+      delete map;
+   }
+
    FileSystemNode SelectLocation(char * location)
    {
       int c;
@@ -291,7 +339,7 @@ public:
       else
       {
          FileSystemNode start = parent ? parent : root;
-         if(!start.loaded || !start.childrenLoaded)
+         if(!start.bits.loaded || !start.bits.childrenLoaded)
             LoadTreeNode(start);
          for(node = start.children.first; node; node = node.next)
             if(node.name && !fstrcmp(node.name, name))
@@ -302,6 +350,11 @@ public:
       return result;
    }
 
+   void Clear()
+   {
+      list.Clear();
+   }
+
    void Refresh()
    {
       Load();
@@ -315,6 +368,9 @@ private:
 
    BitmapResource fileIcons[_FileType];
 
+   Bitmap bitmap;
+   //BitmapArray bitmaps { growingFactor = 16 };
+
    FileSystemBox()
    {
       char wd[MAX_LOCATION];
@@ -325,11 +381,18 @@ private:
       list.AddField(nameField);
       bits.autoLoad = true;
    }
+
    ~FileSystemBox()
    {
       delete extensions;
       delete path;
    }
+
+   watch(background)
+   {
+      list.background = background;
+   };
+
    void InitFileIcons()
    {
       _FileType c;
@@ -340,10 +403,11 @@ private:
       }
    }
 
-   DataField nameField { dataType = "FileSystemNode", width = 240, userData = this, freeData = false };
-   DataField pathField { header = "Location", dataType = /*"String"*/ "char *", width = 100, freeData = false };
+   DataField nameField { header = "Name", dataType = "FileSystemNode", width = 240, userData = this, freeData = false };
+   DataField pathField { header = "Location", dataType = /*"String"*/ "char *", width = 300, freeData = false };
    DataField typeField { header = "Type", dataType = /*"String"*/ "char *", width = 40, freeData = false };
    DataField sizeField { header = "Size", dataType = "FileSize", width = 96, alignment = right, freeData = false };
+   DataField modifiedField { header = "Modified", dataType = "SecSince1970", width = 96, alignment = right, freeData = false };
 
    bool OnPostCreate()
    {
@@ -361,6 +425,7 @@ private:
       hasVertScroll = true;
       fullRowSelect = false;
       sortable = true;
+      alwaysHighLight = true;
 
       anchor = Anchor { left = 0, top = 0, right = 0, bottom = 0 };
 
@@ -393,7 +458,7 @@ private:
             }
             else
             {
-               if(!node.loaded || !node.childrenLoaded)
+               if(!node.bits.loaded || !node.bits.childrenLoaded)
                {
                   LoadTreeNode(node);
                   //list.Sort(nameField, 1);
@@ -415,9 +480,14 @@ private:
             FileSystemNode node = (FileSystemNode)row.tag;
             if(node)
             {
+               char * text;
+
                PopupMenu popup;
                Menu menu { };
 
+               text = PrintString("Open ", node.path);
+
+               MenuItem { menu, text, o, NotifySelect = MenuOpen, disabled = false };
                MenuItem { menu, "Cut\tCtrl+X", t, NotifySelect = null, disabled = false };
                MenuItem { menu, "Copy\tCtrl+C", c, NotifySelect = null, disabled = false };
                MenuItem { menu, "Paste\tCtrl+V", p, NotifySelect = null, disabled = false /*!clipboard*/ };
@@ -439,12 +509,57 @@ private:
 
       bool NotifySelect(ListBox listBox, DataRow row, Modifiers mods)
       {
-         if(row)
+         OldList rows;
+         OldLink item;
+
+         selection.nodes.Free();
+         list.GetMultiSelection(rows);
+         for(item = rows.first; item; item = item.next)
          {
+            DataRow row = item.data;
             FileSystemNode node = (FileSystemNode)row.tag;
-            NotifyNodeSelect(listBox.parent.master, this, node);
-            selection = node;
+            selection.nodes.Add(node);
+            incref node;
+         }
+         rows.Free(null);
+         if(row)
+            selection.node = (FileSystemNode)row.tag;
+         else
+            selection.node = null;
+
+         if(selection.node && bits.preview)
+         {
+            //int pos;
+            FileSystemNode node = selection.node;
+            /*if(bitmap)
+               bitmap.Free();*/
+            delete bitmap;
+            if(node && node.type == pictureFile)
+            {
+               bitmap = Bitmap { };
+               bitmap.Load(node.path, null, displaySystem);
+            }
+
+            /*bitmaps.Clear();
+            bitmaps = BitmapArray { };
+            for(pos = 0; pos < selectedItems.count; pos++)
+            {
+               Bitmap bitmap { };
+               selItem = (ExplorerFileItem)selectedItems._[pos];
+               bitmap.Load(selItem.path, null, displaySystem);
+               //bitmaps.Add(bitmap);
+            }
+            if(node && node.type == pictureFile)
+            {
+               bitmap = Bitmap { };
+               bitmap.Load(node.path, null, displaySystem);
+            }*/
+
+            show.Update(null);
+            //NotifyItemSelect(master, view, item, selectedItems);
          }
+
+         NotifyNodeSelect(listBox.parent.master, this, selection);
          return true;
       }
 
@@ -477,7 +592,7 @@ private:
 
       bool NotifyDoubleClick(ListBox listBox, int x, int y, Modifiers mods)
       {
-         bool result = !(selection && selection.type.isFolder && bits.navigateFolders);
+         bool result = !(selection.node && selection.node.type.isFolder && bits.navigateFolders);
          OpenNode();
          return result;
       }
@@ -493,11 +608,68 @@ private:
       }
    };
 
+   PaneSplitter split
+   {
+      this;
+      //leftPane = list;
+      rightPane = show;
+      //split = 200;
+      scaleSplit = 0.5f;
+      tabCycle = true;
+      visible = false;
+   };
+
+   Window show
+   {
+      this;
+      visible = false;
+      borderStyle = none;
+      anchor = Anchor { top = 0, right = 0, bottom = 0 };
+
+      void OnRedraw(Surface surface)
+      {
+         FileSystemBox fsb = (FileSystemBox)parent;
+         if(fsb.bitmap)
+         {
+            int wBmp = fsb.bitmap.width;
+            int hBmp = fsb.bitmap.height;
+            int wWnd = fsb.show.clientSize.w;
+            int hWnd = fsb.show.clientSize.h;
+
+            int wList = 0;//fsb.list.size.w + fsb.split.size.w;
+
+            float scale = Min((float)(wWnd - 10) / wBmp, (float)(hWnd - 10) / hBmp);
+
+            int wDraw = (int)(wBmp * scale);
+            int hDraw = (int)(hBmp * scale);
+
+      #ifndef __linux__
+            surface.Filter(fsb.bitmap, (wWnd - wDraw) / 2, (hWnd - hDraw) / 2, 0, 0, wDraw, hDraw, wBmp, hBmp);
+      #else
+            // Until Filter / Stretch works with X
+            surface.Blit(fsb.bitmap, (wWnd - wBmp) / 2, (hWnd - hBmp) / 2, 0, 0, wBmp, hBmp);
+      #endif
+         }
+         else
+         {
+            surface.SetForeground(white);
+            surface.Area(0, 0, fsb.clientSize.w - 1, fsb.clientSize.h - 1);
+         }
+      }
+   }
+
+   bool MenuOpen(MenuItem selection, Modifiers mods)
+   {
+      OpenNode();
+   }
+
    bool OpenNode()
    {
       bool result;
-      if(selection && selection.type.isFolder && bits.navigateFolders)
-         property::path = selection.path;
+      FileSystemBoxSelection selection = this.selection.Copy();
+      FileSystemNode node = selection.node;
+      if(node && node.type.isFolder && bits.navigateFolders)
+         property::path = node.path;
       result = NotifyNodeOpen(this.master, this, selection);
       return result;
    }
@@ -552,6 +724,24 @@ private:
          nameField.width = width - 80;
    }*/
 
+   void ChangeViewType()
+   {
+      list.Clear();
+      list.ClearFields();
+      list.resizable = bits.details || bits.pathColumn;
+      list.moveFields = bits.details || bits.pathColumn;
+      list.hasHeader = bits.details || bits.pathColumn;
+      list.AddField(nameField);
+      if(bits.pathColumn)
+         list.AddField(pathField);
+      if(bits.details)
+      {
+         list.AddField(typeField);
+         list.AddField(sizeField);
+         list.AddField(modifiedField);
+      }
+   }
+
    void Load()
    {
       // TODO: fix this!
@@ -583,7 +773,7 @@ private:
             (bits.foldersOnly && listing.stats.attribs.isDirectory) ||
             (bits.filesOnly && listing.stats.attribs.isFile))
          {
-            FileSystemNode node = MakeFileSystemNode(listing.stats, listing.name, listing.path, bits.previewPictures, displaySystem);
+            FileSystemNode node = MakeFileSystemNode(listing.stats, listing.name, listing.path, false, bits.previewPictures, displaySystem);
             AddNode(node);
          }
       }
@@ -593,10 +783,15 @@ private:
    void LoadTree()
    {
       bool isRoot = !strcmp(path, "/");
-      //char startPath[MAX_LOCATION];
+      char name[MAX_LOCATION];
       FileSystemNode parent;
       FileSystemNode node;
       FileListing listing { path, extensions = extensions };
+
+      if(!isRoot)
+         GetLastDirectory(path, name);
+      else
+         name[0] = '\0';
       
       /*if(!path)
          GetWorkingDir(startPath, sizeof(startPath));
@@ -609,7 +804,7 @@ private:
    #ifdef __WIN32__
       if(isRoot)
       {
-         root = FileSystemNode { loaded = true, childrenLoaded = true };
+         root = FileSystemNode { bits.loaded = true, bits.childrenLoaded = true };
          AddTreeNode(root, true, false, null);
          while(listing.Find())
          {
@@ -630,13 +825,13 @@ private:
                info[0] = 0;
             }
 
-            parent = MakeFileSystemNode(listing.stats, name, listing.path, bits.previewPictures, displaySystem);
+            parent = MakeFileSystemNode(listing.stats, name, listing.path, false, bits.previewPictures, displaySystem);
             if(info[0])
-               parent.info = CopyString(info);
-            parent.loaded = true;
+               parent.info = info; //CopyString(info);
+            parent.bits.loaded = true;
             AddTreeNode(parent, !listing.stats.attribs.isDirectory, listing.stats.attribs.isDirectory, root);
             if(!listing.stats.attribs.isDirectory)
-               parent.childrenLoaded = true;
+               parent.bits.childrenLoaded = true;
          }
 
          node = FileSystemNode { name = msNetwork, type = network };
@@ -646,7 +841,7 @@ private:
       else
    #endif
       {
-         root = MakeFileSystemNode(FileStats { attribs = FileExists(path)}, path, path, bits.previewPictures, displaySystem);
+         root = MakeFileSystemNode(FileStats { attribs = FileExists(path)}, name, path, false, bits.previewPictures, displaySystem);
          AddTreeNode(root, false, true, null);
          LoadTreeNode(root);
       }
@@ -663,7 +858,7 @@ private:
 
    void LoadTreeNode(FileSystemNode node)
    {
-      if(!node.loaded)
+      if(!node.bits.loaded)
       {
          char path[MAX_LOCATION];
          node.GetPath(path);
@@ -678,29 +873,29 @@ private:
                   (bits.foldersOnly && listing.stats.attribs.isDirectory) ||
                   (bits.filesOnly && listing.stats.attribs.isFile)))
                {
-                  FileSystemNode child = MakeFileSystemNode(listing.stats, listing.name, listing.path, bits.previewPictures, displaySystem);
+                  FileSystemNode child = MakeFileSystemNode(listing.stats, listing.name, listing.path, false, bits.previewPictures, displaySystem);
                   AddTreeNode(child, true, false, node);
                   NodeChildLoad(child, node);
                }
             }
          }
-         node.childrenLoaded = true;
-         node.loaded = true;
+         node.bits.childrenLoaded = true;
+         node.bits.loaded = true;
          node.row.SortSubRows(false);
       }
-      else if(!node.childrenLoaded)
+      else if(!node.bits.childrenLoaded)
       {
          FileSystemNode child;
          if(node.children.first)
          {
             for(child = node.children.first; child; child = child.next)
             {
-               if(!child.loaded)
+               if(!child.bits.loaded)
                   LoadTreeNode(child);
-               else if(!child.childrenLoaded)
+               else if(!child.bits.childrenLoaded)
                   NodeChildLoad(child, node);
             }
-            node.childrenLoaded = true;
+            node.bits.childrenLoaded = true;
             node.row.SortSubRows(false);
          }
       }
@@ -719,7 +914,7 @@ private:
                (bits.foldersOnly && listing.stats.attribs.isDirectory) ||
                (bits.filesOnly && listing.stats.attribs.isFile))
             {
-               FileSystemNode child = MakeFileSystemNode(listing.stats, listing.name, listing.path, bits.previewPictures, displaySystem);
+               FileSystemNode child = MakeFileSystemNode(listing.stats, listing.name, listing.path, false, bits.previewPictures, displaySystem);
                AddTreeNode(child, listing.stats.attribs.isFile, !listing.stats.attribs.isFile, parent);
                added = true;
             }
@@ -727,18 +922,26 @@ private:
          if(!added)
             added = true;
       }
-      parent.childrenLoaded = true;
+      parent.bits.childrenLoaded = true;
    }
 
    void AddNode(FileSystemNode node)
    {
       DataRow row = list.AddRow();
       row.tag = (int)node;
+      node.row = row;
+      incref node;
       row.SetData(nameField, node);
+      if(bits.pathColumn)
+         row.SetData(pathField, node.path);
       if(bits.details)
       {
-         row.SetData(typeField, node.extension);
-         row.SetData(sizeField, (void *)node.stats.size);
+         if(node.type.isFile)
+         {
+            row.SetData(typeField, node.extension);
+            row.SetData(sizeField, /*(void *)*/node.stats.size);
+         }
+         row.SetData(modifiedField, node.stats.modified);
       }
    }
 
@@ -754,13 +957,19 @@ private:
       row.tag = (int)node;
       node.row = row;
       row.SetData(null, node);
+      if(bits.pathColumn)
+         row.SetData(pathField, node.path);
       if(bits.details)
       {
-         row.SetData(typeField, node.extension);
-         row.SetData(sizeField, (void *)node.stats.size);
+         if(node.type.isFile)
+         {
+            row.SetData(typeField, node.extension);
+            row.SetData(sizeField, /*(void *)*/node.stats.size);
+         }
+         row.SetData(modifiedField, node.stats.modified);
       }
 
-      node.loaded = loaded;
+      node.bits.loaded = loaded;
       if(addLoader)
          //AddTreeNode(FileSystemNode { }, false, false, node); // why would this create a compile error?
          AddTreeNode(FileSystemNode { type = none }, false, false, node);
@@ -774,10 +983,15 @@ private:
    void DeleteNode(FileSystemNode node)
    {
       FileSystemNode child;
-      for(; (child = node.children.first); )
-         DeleteNode(child);
+      if(treeBranches)
+      {
+         for(; (child = node.children.first); )
+            DeleteNode(child);
+      }
       list.DeleteRow(node.row);
       node.Delete();
+      //delete node;
+      //Update(null);
    }
 }
 
@@ -1839,8 +2053,51 @@ ExplorerFileItem MakeFileItem(const FileAttribs attribs, const char * fileName,
 #endif
 */
 
-public class FileSystemNode : struct
+public class FileSystemBoxSelection
+{
+public:
+   FileSystemNode node;
+   Array<FileSystemNode> nodes { };
+
+private:
+   FileSystemBoxSelection Copy()
+   {
+      FileSystemBoxSelection copy { node = node };
+      for(node : nodes)
+      {
+         copy.nodes.Add(node);
+         incref node;
+      }
+      return copy;
+   }
+
+   ~FileSystemBoxSelection()
+   {
+      nodes.Free();
+   }
+}
+
+class FileSystemNodeBits
 {
+   bool loaded:1, childrenLoaded:1, displayPath:1;
+};
+
+public class FileSystemNode
+{
+
+private:
+   FileSystemNodeBits bits;
+   char * path;
+   char * name;
+   char * extension;
+   char * label;
+   char * info;
+
+   ~FileSystemNode()
+   {
+      Free();
+   }
+
 public:
    /*//LinkElement<FileSystemNode> link;
    FileSystemNode parent;
@@ -1851,13 +2108,34 @@ public:
 
    FileSystemNode prev, next;
 
-   bool loaded, childrenLoaded;
    int indent;
-   char * path;
-   char * name;
-   char * label;
-   char * extension;
-   char * info;
+
+   property char * path
+   {
+      set { delete path; if(value && value[0]) path = CopyString(value); }
+      get { return path; } isset { return path && path[0]; }
+   }
+   property char * name
+   {
+      set { delete name; if(value && value[0]) name = CopyString(value); }
+      get { return name; } isset { return name && name[0]; }
+   }
+   property char * extension
+   {
+      set { delete extension; if(value && value[0]) extension = CopyString(value); }
+      get { return extension; } isset { return extension && extension[0]; }
+   }
+   property char * label
+   {
+      set { delete label; if(value && value[0]) label = CopyString(value); }
+      get { return label; } isset { return label && label[0]; }
+   }
+   property char * info
+   {
+      set { delete info; if(value && value[0]) info = CopyString(value); }
+      get { return info; } isset { return info && info[0]; }
+   }
+
    DataRow row;
    OldList children;
    _FileType type;
@@ -1869,9 +2147,11 @@ public:
 
    void GetPath(String outputPath)
    {  
-      FileSystemNode up;
-      if(parent)
+      if(path)
+         strcpy(outputPath, path);
+      else if(parent)
       {
+         FileSystemNode up;
          if(name)
             strcpy(outputPath, name);
          for(up = parent; up; up = up.parent)
@@ -1881,16 +2161,16 @@ public:
             PathCat(temp, outputPath);
             strcpy(outputPath, temp);
          }
-      }
-      else
-      {
-/*#ifdef __WIN32__
-         strcpy(outputPath, "/");
-#else*/
-         //strcpy(outputPath, name);
-         strcpy(outputPath, path);
-         PathCat(outputPath, name);
-//#endif
+         /*else
+         {
+   /-*#ifdef __WIN32__
+            strcpy(outputPath, "/");
+   #else*-/
+            //strcpy(outputPath, name);
+            strcpy(outputPath, path);
+            PathCat(outputPath, name);
+   //#endif
+         }*/
       }
    }
 
@@ -1912,9 +2192,9 @@ public:
          for(child = children.first; child; child = child.next)
          {
             FileSystemNode copy { };
-            copy.name = CopyString(child.name);
+            copy.name = child.name; //CopyString(child.name);
             copy.type = child.type;
-            fsb.AddTreeNode(copy, child.loaded, false, addTo);
+            fsb.AddTreeNode(copy, child.bits.loaded, false, addTo);
             if(forceExpanded)
                copy.row.collapsed = false;
             if(recursive)
@@ -1946,7 +2226,9 @@ public:
          children.Delete(child);
       }
       //if(name)
+      delete path;
       delete name;
+      delete extension;
       delete label;
       delete info;
    }
@@ -1995,6 +2277,7 @@ public:
       }
       //textOffset = indent * indentSize + (icon ? (icon.width + 4) : 0);
       
+      surface.SetForeground(displayFlags.selected ? fsb.selectionText : fsb.foreground);
       surface.TextOpacity(false);
       surface.TextExtent(string, len, &w, &h);
       h = Max(h, 16);
@@ -2124,18 +2407,32 @@ public:
    return node;
 }*/
 
-FileSystemNode MakeFileSystemNode(const FileStats stats,
-      const char * fileName, const char * filePath,
-      const bool previewPicture, const DisplaySystem displaySystem)
+FileSystemNode MakeFileSystemNode(
+   const FileStats stats,
+   const char * name,
+   const char * path,
+   const bool pathAddName,
+   const bool previewPicture,
+   const DisplaySystem displaySystem)
 {
-   int len = strlen(fileName);
+   int len = strlen(name);
    char info[MAX_LOCATION];
-   char name[MAX_LOCATION];
+   char name2[MAX_LOCATION];
    char extension[MAX_EXTENSION];
    
    FileSystemNode node { stats = stats };
 
-   //if(stats.attribs.isFile) // TODO fix this in ecere
+   /*if(!pathAddName)
+   {
+      char o[MAX_LOCATION];
+      //char r[MAX_LOCATION];
+      //StripLastDirectory(path, o);
+      GetLastDirectory(path, o);
+      if(fstrcmp(name, o))
+      //if(!FileExists(path))
+         PrintLn("Stop!");
+   }*/
+   //if(stats.attribs.isFile) // TODO fix this in ecere -- WTH -- this has been fixed :/
    if(stats.attribs.isDirectory)
    {
       extension[0] = '\0';
@@ -2147,7 +2444,7 @@ FileSystemNode MakeFileSystemNode(const FileStats stats,
       if(stats.attribs.isRemote) node.type = netDrive;
       if(stats.attribs.isRemovable) 
       {
-         if(fileName[0] == 'A' || fileName[0] == 'B')
+         if(name[0] == 'A' || name[0] == 'B')
             node.type = floppy;
          else
             node.type = removable;
@@ -2155,36 +2452,46 @@ FileSystemNode MakeFileSystemNode(const FileStats stats,
    }
    else
    {
-      GetExtension(fileName, extension);
+      GetExtension(name, extension);
       strlwr(extension);
       
       node.type = _FileType::SelectByExtension(extension);
    }
 
    if(stats.attribs.isDrive && 
-         len > 3 && !strncmp(&fileName[1], ": [", 3))
+         len > 3 && !strncmp(&name[1], ": [", 3))
    {
-      strncpy(name, fileName, 2);
-      name[2] = 0;
-      strncpy(info, &fileName[4], len - 5);
+      strncpy(name2, name, 2);
+      name2[2] = 0;
+      strncpy(info, &name[4], len - 5);
       info[len - 5] = 0;
    }
    else
    {
-      strcpy(name, fileName);
+      strcpy(name2, name);
       info[0] = 0;
    }
 
-   node.path = CopyString(filePath);
-   node.name = CopyString(name);
+   if(pathAddName)
+   {
+      bool isFile = stats.attribs.isFile;
+      bool isFolder = stats.attribs.isDirectory;
+      char full[MAX_LOCATION];
+      strcpy(full, path);
+      PathCat(full, name);
+      node.path = full; //CopyString(full);
+   }
+   else
+      node.path = path; //CopyString(path);
+   node.name = name2; //CopyString(name2);
    if(info[0])
-      node.info = CopyString(info);
-   node.extension = CopyString(extension);
+      node.info = info; //CopyString(info);
+   node.extension = extension; //CopyString(extension);
 
    if(node.type == pictureFile && previewPicture)
    {
       node.bitmap = Bitmap { alphaBlend = true };
-      node.bitmap.Load(filePath, null, displaySystem);
+      node.bitmap.Load(path, null, displaySystem);
    }
 
    return node;
index cb003f4..53b6da8 100644 (file)
@@ -37,6 +37,9 @@ public:
 
    Window owner;
    FileSystemBox fsb;
+   FileSystemBox tree;
+
+   FileSystemNode messageNode;
 
    FileSystemSearch()
    {
@@ -49,6 +52,15 @@ public:
    virtual bool Window::NotifySearchSortBrowser(FileSystemSearch search);
    virtual bool Window::NotifySearchTerminated(FileSystemSearch search);
 
+   void InitResults()
+   {
+      fsb.Clear();
+      //CreateMessageNode();
+      //messageNode.label = "No results yet!";
+   }
+
+
+
    bool SearchFileContent(String path)
    {
       bool match = false;
@@ -162,30 +174,51 @@ public:
       strcpy(stack[0].path, location);
       stack[0].listing = FileListing { stack[0].path };  // there should be a sorted = true/false 
 
-      fsb.list.Clear();
+      //fsb.list.Clear();
                                                          // Binary Search sorting...
       if(optionTree)
          stack[0].branched = false;
-      /*if(optionBrowser)
+      if(optionBrowser)
       {
          guiApp.Lock();
          {
             //stack[0].browse = searchPanel.AddBrowserRow();
-            //node = MakeFileSystemNode(attribs, stack[0].path,
+            //DeleteMessageNode();
+            //node = MakeFileSystemNode(attribs, stack[0].path, true,
             //      stack[0].path, fsb.bits.previewPictures, fsb.displaySystem);
             //stack[0].browse.SetData(browserNameField, node);
             //stack[0].browse.SetData(typeField, null);
             //stack[0].browse.SetData(sizeField, null);
 
-            stack[0].browse = MakeFileSystemNode(stats, stack[0].path, stack[0].path,
-                  fsb.bits.previewPictures, fsb.displaySystem);
-            fsb.AddTreeNode(stack[0].browse, true, false, null); // TEMPORARY // searchPanel.AddBrowse(stack[0].browse, null);
+            //DeleteMessageNode();
+            tree.Clear();
+            stack[0].browse = MakeFileSystemNode(stats, stack[0].path, stack[0].path, false,
+                  tree.bits.previewPictures, tree.displaySystem);
+            tree.AddTreeNode(stack[0].browse, false, true, null); // TEMPORARY // searchPanel.AddBrowse(stack[0].browse, null);
          }
          guiApp.Unlock();
-      }*/
+      }
       
       for(frame = 0; frame >= 0 && !terminate; )
       {
+         guiApp.Lock();
+         {
+            double thisTime = GetTime();
+            if(thisTime - lastTime > 0.25)
+            {
+               NotifyUpdateSearchLocation(owner, this, stack[frame].listing.path); // TEMPORARY // searchPanel.SearchUpdateLabel(stack[frame].listing.path);
+               //if(!messageNode)
+               //   CreateMessageNode();
+               //delete messageNode.label;
+               //messageNode.label = PrintString("Searching '", stack[frame].listing.path, "'...");
+               //messageNode.EnsureVisible(false);
+               //fsb.Select(messageNode);
+               //fsb.Update(null);
+               //guiApp.UpdateDisplay();
+               lastTime = thisTime;
+            }
+         }
+         guiApp.Unlock();
          if(stack[frame].listing.Find())
          {
             count++;
@@ -215,15 +248,17 @@ public:
                         guiApp.Lock();
                            if(frame)
                            {
+                              DeleteMessageNode();
                               stack[frame].result = MakeFileSystemNode(stack[frame - 1].listing.stats,
-                                    stack[frame - 1].listing.name, stack[frame - 1].path,
+                                    stack[frame - 1].listing.name, stack[frame - 1].path, true,
                                     fsb.bits.previewPictures, fsb.displaySystem);
                               fsb.AddTreeNode(stack[frame].result, true, false, stack[frame - 1].result); // TEMPORARY // searchPanel.AddResult(stack[frame].result, stack[frame - 1].result);
                               stack[frame].result.row.collapsed = false;
                            }
                            else
                            {
-                              stack[0].result = MakeFileSystemNode(stats, stack[0].path, stack[0].path,
+                              DeleteMessageNode();
+                              stack[0].result = MakeFileSystemNode(stats, stack[0].path, stack[0].path, true,
                                     fsb.bits.previewPictures, fsb.displaySystem);
                               fsb.AddTreeNode(stack[0].result, true, false, null); // TEMPORARY // searchPanel.AddResult(stack[0].result, null);
                               stack[0].result.row.collapsed = false;
@@ -238,21 +273,29 @@ public:
             }
             if(optionSubdirs && stack[frame].listing.stats.attribs.isDirectory)
             {
-               guiApp.Lock();
+               /*guiApp.Lock();
                   {
                      double thisTime = GetTime();
                      if(thisTime - lastTime > 0.25)
                      {
                         NotifyUpdateSearchLocation(owner, this, stack[stackTop].listing.path); // TEMPORARY // searchPanel.SearchUpdateLabel(stack[stackTop].listing.path);
+                        if(!messageNode)
+                           CreateMessageNode();
+                        //delete messageNode.label;
+                        messageNode.label = PrintString("Searching '", stack[stackTop].listing.path, "'...");
+                        messageNode.EnsureVisible(false);
+                        fsb.Update(null);
+                        guiApp.UpdateDisplay();
                         lastTime = thisTime;
                      }
                   }
-                  //searchPanel.SearchUpdateLabel(stack[stackTop].listing.path);
+                  //searchPanel.SearchUpdateLabel(stack[stackTop].listing.path);*/
                   frame++;
-                  /*if(optionBrowser)
+               /*   /-*if(optionBrowser)
                   {
+                     DeleteMessageNode();
                      stack[frame].browse = MakeFileSystemNode(stack[stackTop].listing.stats,
-                           stack[stackTop].listing.name, stack[stackTop].path,
+                           stack[stackTop].listing.name, stack[stackTop].path, true,
                            fsb.bits.previewPictures, fsb.displaySystem);
                      fsb.AddTreeNode(stack[frame].browse, true, false, stack[stackTop].browse); // TEMPORARY // searchPanel.AddBrowse(stack[frame].browse, stack[stackTop].browse);
 
@@ -262,8 +305,8 @@ public:
                         //searchPanel.SortBrowser();  // this can be very bad for performance in some situations
                                                 // there should be a way to sort the nodes as they are added
                                                 // BinarySearch sorting implementation in listBox's Sort?
-                  }*/
-               guiApp.Unlock();
+                  }*-/
+               guiApp.Unlock();*/
                strcpy(stack[frame].path, stack[stackTop].listing.path);
                stack[frame].listing = FileListing { stack[frame].path };
                if(optionTree)
@@ -271,8 +314,9 @@ public:
                if(match)
                {
                   guiApp.Lock();
+                     DeleteMessageNode();
                      stack[frame].result = MakeFileSystemNode(stack[stackTop].listing.stats,
-                           stack[stackTop].listing.name, stack[stackTop].path,
+                           stack[stackTop].listing.name, stack[stackTop].path, true,
                            fsb.bits.previewPictures, fsb.displaySystem);
                      if(optionTree)
                      {
@@ -297,8 +341,9 @@ public:
                   /*if(optionBrowser)
                   {
                      FileSystemNode item;
+                     DeleteMessageNode();
                      item = MakeFileSystemNode(stack[frame].listing.stats,
-                           stack[frame].listing.name, stack[frame].path,
+                           stack[frame].listing.name, stack[frame].path, true,
                            fsb.bits.previewPictures, fsb.displaySystem);
                      fsb.AddTreeNode(item, true, false, stack[frame].browse); // TEMPORARY // searchPanel.AddBrowse(item, stack[frame].browse);
                      //if(frame == 1)
@@ -309,8 +354,9 @@ public:
                   if(match)
                   {
                      FileSystemNode item;
+                     DeleteMessageNode();
                      item = MakeFileSystemNode(stack[frame].listing.stats,
-                           stack[frame].listing.name, stack[frame].path,
+                           stack[frame].listing.name, stack[frame].path, true,
                            fsb.bits.previewPictures, fsb.displaySystem);
                      if(optionTree)
                      {
@@ -327,7 +373,7 @@ public:
                            sprintf(temp, "lines %d", lin.num);
                            for(lin = lin.next; lin && strlen(temp) < MAX_F_STRING; lin = lin.next)
                               strcatf(temp, ", %d", lin.num);
-                           node = FileSystemNode { name = CopyString(temp), type = lineNumbers };
+                           node = FileSystemNode { name = temp/*CopyString(temp)*/, type = lineNumbers };
                            fsb.AddTreeNode(node, true, false, item); // TEMPORARY // searchPanel.AddResult(node, item);
                            //row.AddRow().SetData(resultsNameField, node);
                            lines.Free(null);
@@ -365,7 +411,25 @@ public:
 
       guiApp.Lock();
       NotifySearchTerminated(owner, this); // TEMPORARY // searchPanel.SearchTerminate();
+      //delete messageNode.label;
+      //messageNode.label = PrintString("Searching '", stack[stackTop].listing.path, "'...");
+      //delete the messageNode;
+      //fsb.Update(null);
       guiApp.Unlock();
       return 0;
    }
+
+private:
+   void CreateMessageNode()
+   {
+      //messageNode = MakeFileSystemNode({ }, " ", " ", false, false, fsb.displaySystem);
+      //messageNode.type = normalFile;
+      //fsb.AddNode(messageNode);
+   }
+   void DeleteMessageNode()
+   {
+      //if(messageNode)
+      //   fsb.DeleteNode(messageNode);
+      //messageNode = null;
+   }
 }