+ 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();