Fixed major issues
[ede] / explorer / src / ExplorerWindow.ec
index f1c0a2d..eb690c3 100644 (file)
@@ -66,7 +66,7 @@ enum Icon
    searchInSubDirs, searchStart, searchStop,
    hasHeader
 };
-static char * iconNames[Icon::enumSize] =
+static const char * iconNames[Icon::enumSize] =
 {
    "<:ecere>emblems/unreadable.png",         /* missing */
 
@@ -152,7 +152,7 @@ class ExplorerWindow : Window
 
    int treeSplit;
    int searchSplit;
-   
+
    ExplorerToolId lastViewId;
 */
 
@@ -162,7 +162,7 @@ class ExplorerWindow : Window
 
 
    menu = Menu { };
-   
+
    Menu fileMenu { menu, "File", f };
    Menu windowMenu { menu, "Window", w };
       MenuItem itemNewWindow { windowMenu, "New Window", n, NotifySelect = NewWindow_NotifySelect };
@@ -445,7 +445,7 @@ class ExplorerWindow : Window
    IconToolButton goUp { toolBar, this, icon = goUp, hotKey = { up, alt = true }, toolTip = "Go to Parent Folder";
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
       {
-         char * path = view.path;
+         const char * path = view.path;
          char * newPath = new char[strlen(path)+1];
          StripLastDirectory(path, newPath);
          if(!newPath[0])
@@ -532,7 +532,7 @@ class ExplorerWindow : Window
    ToggleIconToolButton viewDetails  { toolBar, this, icon = viewDetails, toolTip = "Toggle Listing Details";
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
       {
-         view.details = true;
+         view.details = button.checked;
          view.treeBranches = false;
          view.Refresh();
          view.Activate();
@@ -881,6 +881,7 @@ class ExplorerWindow : Window
       {
          //((FileSystemCacheIterator)fileSystemIterator).cache = testCache;
          //((FileSystemIterator)fileSystemIterator)
+         return true;
       }
 
       bool NotifyNodeOpen(FileSystemBox box, FileSystemBoxSelection selection)
@@ -931,7 +932,7 @@ class ExplorerWindow : Window
 
          //PrintLn(node.name);
          if(box.selection.nodes.count == 1)
-            itemString = node.name;
+            itemString = CopyString(node.name);
          else
             itemString = PrintString(box.selection.nodes.count, " items");
          text = PrintString("Open ", itemString);
@@ -1102,6 +1103,7 @@ class ExplorerWindow : Window
          if(CreateNewFileDialog { /*master = */ew/*, parent = parent*/, currentDirectory = selection ? ew.view.selection.node.path : ew.view.path }.Modal() == ok )
             ew.Refresh();
       }
+      return true;
    }
 
    //void NewFolder()
@@ -1113,10 +1115,11 @@ class ExplorerWindow : Window
          if(CreateDirectoryDialog { /*master = */ew/*, parent = parent*/, currentDirectory = selection ? ew.view.selection.node.path : ew.view.path }.Modal() == ok )
             ew.Refresh();
       }
+      return true;
    }
 
    //void GoTo(char * location/*, bool viewIsAtLocation, bool treeIsAtLocation*/)
-   property char * location
+   property const char * location
    {
       set
       {
@@ -1204,24 +1207,27 @@ class ExplorerWindow : Window
 
    void UpdateHistoryItem(FileSystemBoxSelection selection)
    {
-      HistoryItem item = history[historyIndex];
-
-      if(!item.holdRecordingSelection)
+      if(history.count > historyIndex)   // TODO: Review why this would happen...
       {
-         if(selection.node || (selection.nodes && selection.nodes.count))
+         HistoryItem item = history[historyIndex];
+
+         if(!item.holdRecordingSelection)
          {
-            item.selection.Free();
-            if(selection.nodes.count)
+            if(selection.node || (selection.nodes && selection.nodes.count))
             {
-               for(node : selection.nodes)
-                  item.selection.Add(CopyString(node.path));
+               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 if(selection.node)
-               item.selection.Add(CopyString(selection.node.path));
          }
+         else
+            item.holdRecordingSelection = false;
       }
-      else
-         item.holdRecordingSelection = false;
    }
 
    void SearchStart()
@@ -1317,7 +1323,7 @@ class ExplorerWindow : Window
       }
       return true;
    }*/
-   
+
    /*bool ViewNotifyItemOpen(ExplorerView view, ExplorerFileItem item)
    {
       ExplorerFileBranch branch = tree.branch;
@@ -1326,14 +1332,14 @@ class ExplorerWindow : Window
          if(item.type.isFolderType)
          {
             ExplorerFileBranch child;
-            
+
             if(!branch.loaded || !branch.childrenLoaded)
                BranchLoad(branch, tree.tree);
 
             for(child = branch.children.first; child; child = child.next)
                if(!strcmp(child.name, item.name))
                   break;
-            
+
             if(child)
             {
                if(branch.row.collapsed)
@@ -1384,6 +1390,7 @@ class ExplorerWindow : Window
       //userMode = true;
       addressBar.path = view.path;
       ReadyTree();
+      view.Refresh();
       return true;
    }
 
@@ -1409,7 +1416,7 @@ class ExplorerWindow : Window
          NotifyItemOpen = ViewNotifyItemOpen;
       };
       lastViewId = viewList;
-      
+
       tree.Load();
       view.Load(tree.root);
    }*/