X-Git-Url: https://ecere.com/cgi-bin/gitweb.cgi?p=ede;a=blobdiff_plain;f=libede%2Fsrc%2FFileSystemSearch.ec;h=53b6da8f273357056069f073e9ededb8c5355d90;hp=cb003f430846380c3a6fc96981ea8f984b895e43;hb=4943336814b7b33a190e420e7ed6014921522014;hpb=35e36a354682ec9e42d18303195d0f4c765519c9 diff --git a/libede/src/FileSystemSearch.ec b/libede/src/FileSystemSearch.ec index cb003f4..53b6da8 100644 --- a/libede/src/FileSystemSearch.ec +++ b/libede/src/FileSystemSearch.ec @@ -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; + } }