From: Rejean Loyer Date: Fri, 16 Sep 2011 12:52:52 +0000 (-0400) Subject: explorer: better internal GoToLocation code. X-Git-Url: https://ecere.com/cgi-bin/gitweb.cgi?p=ede;a=commitdiff_plain;h=6873f3a9950231d117b4ba693783e015f1abe7c5 explorer: better internal GoToLocation code. --- diff --git a/explorer/src/ExplorerWindow.ec b/explorer/src/ExplorerWindow.ec index a2968e9..c557372 100644 --- a/explorer/src/ExplorerWindow.ec +++ b/explorer/src/ExplorerWindow.ec @@ -129,7 +129,7 @@ class ExplorerWindow : Window { char * home = getenv("HOME"); if(home && home[0] && FileExists(home).isDirectory) - view.path = home; + GoToLocation(home, false, false); break; } case goUp: @@ -142,7 +142,7 @@ class ExplorerWindow : Window newPath[0] = '/'; newPath[1] = 0; } - view.path = newPath; + GoToLocation(newPath, false, false); delete newPath; break; } @@ -234,7 +234,7 @@ class ExplorerWindow : Window bool NotifyModified(PathBox pathBox) { - view.path = pathBox.path; + GoToLocation(pathBox.path, false, false); return true; } }; @@ -326,7 +326,7 @@ class ExplorerWindow : Window { char p[MAX_LOCATION]; node.GetPath(p); - view.path = node.path; + GoToLocation(node.path, false, true); return true; } }; @@ -472,34 +472,13 @@ class ExplorerWindow : Window lastViewId = viewId; }*/ - /*void GoToLocation(char * location) + void GoToLocation(char * location, bool viewIsAtLocation, bool treeIsAtLocation) { - int c; - char * temp; - char step[MAX_LOCATION]; - - StringArray steps { growingFactor = 4 }; - ExplorerFileBranch last = null; - - temp = CopyString(location); - while(strlen(temp)) - { - GetLastDirectory(temp, step); - StripLastDirectory(temp, temp); - steps.Add(CopyString(step)); - } - - for(c = steps._count - 1; c >= 0; c--) - { - last = tree.Find(steps._[c], last); - if(!last) - break; - tree.Select(last); - } - - delete temp; - delete steps; - }*/ + if(!viewIsAtLocation) + view.path = location; + if(tree.visible && !treeIsAtLocation) + tree.SelectLocation(location); + } /*void SearchLocation(char * location) {