From f28726025503928b458ce1805855f7da24f0491e Mon Sep 17 00:00:00 2001 From: Rejean Loyer Date: Mon, 25 Feb 2013 23:42:15 -0500 Subject: [PATCH 1/4] ede; fixed removed intermediate objects directory and target directory from EDE.epj to allow the default option to support additional compilers. --- libede/EDE.epj | 2 -- 1 file changed, 2 deletions(-) diff --git a/libede/EDE.epj b/libede/EDE.epj index 7fb0b90..6509ee5 100644 --- a/libede/EDE.epj +++ b/libede/EDE.epj @@ -6,8 +6,6 @@ "DefaultNameSpace" : "ede", "TargetType" : "SharedLibrary", "TargetFileName" : "EDE", - "TargetDirectory" : "obj/$(CONFIG).$(PLATFORM)", - "ObjectsDirectory" : "obj/$(CONFIG).$(PLATFORM)", "Libraries" : [ "ecere" ] -- 1.8.3.1 From 021f46f0de53d6b80a14654f06ec96442fb2e638 Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Sun, 6 Sep 2020 19:36:11 -0400 Subject: [PATCH 2/4] libede/FileSystemBox: Set path to CWD upon creation; Ensure outputPath is initialized; Clear list - Also removed bad spaces --- libede/src/FileSystemBox.ec | 130 +++++++++++++++++++++----------------------- 1 file changed, 63 insertions(+), 67 deletions(-) diff --git a/libede/src/FileSystemBox.ec b/libede/src/FileSystemBox.ec index 36e6b7b..82a7abd 100644 --- a/libede/src/FileSystemBox.ec +++ b/libede/src/FileSystemBox.ec @@ -53,7 +53,7 @@ static char * fileIconNames[] = "<:ecere>mimeTypes/package.png", /* treeLoader */ "<:ecere>places/startHere.png", /* lineNumbers */ - + "" }; @@ -79,19 +79,19 @@ static char * compIconNames[] = public enum _FileType { none, - + normalFile, ewsFile, epjFile, ecFile, ehFile, cFile, hFile, cppFile, hppFile, textFile, webFile, pictureFile, soundFile, archiveFile, packageFile, opticalMediaImageFile, /* these (all previous) are sort equal */ - + folder, folderOpen, computer, drive, netDrive, cdrom, removable, floppy, network, server, share, // these are sort equal - + // utilities treeLoader, lineNumbers; - /*property char * + /*property char * { set { @@ -212,7 +212,7 @@ public: virtual bool Window::NotifyNodeOpen(FileSystemBox box, FileSystemBoxSelection selection); virtual bool Window::NotifyNodeMenu(FileSystemBox box, Menu menu, FileSystemBoxSelection selection); virtual bool Window::NotifyIteratorInit(FileSystemBox box, FileSystemIterator fileSystemIterator); - + property char * path { set @@ -282,7 +282,7 @@ public: }; property bool columnsCompareStyle { set { bits.columnsCompareStyle = value; } get { return bits.columnsCompareStyle; } }; property bool textFileLinesStyle { set { bits.textFileLinesStyle = value; } get { return bits.textFileLinesStyle; } }; - + property FileSystemNode node { get @@ -467,7 +467,10 @@ private: FileSystemBox() { - path = CopyString(""); + char wd[MAX_LOCATION]; + GetWorkingDir(wd, sizeof(wd)); + property::path = wd; + InitFileIcons(); InitCompIcons(); // todo: these icons should not be initialize, they should be set // or at least initalized when the comparison listing is requested @@ -584,7 +587,7 @@ private: } return true; } - + bool NotifyRightClick(ListBox listBox, int x, int y, Modifiers mods) { DataRow row = listBox.currentRow; @@ -626,8 +629,8 @@ private: popup = PopupMenu { master = this, menu = menu, - position = { - x + clientStart.x + absPosition.x - guiApp.desktop.position.x, + position = { + x + clientStart.x + absPosition.x - guiApp.desktop.position.x, y + clientStart.y + absPosition.y - guiApp.desktop.position.y } }; popup.Create(); @@ -860,7 +863,7 @@ private: MenuItem itemEditPaste { editMenu, "Paste\tCtrl+V", p; - + bool NotifySelect(MenuItem selection, Modifiers mods) { //EditPaste(); @@ -878,7 +881,7 @@ private: } }; - // WHY is this crashing ? + // WHY is this crashing ? /*void OnResize(int width, int height) { if(this && nameField) @@ -972,14 +975,15 @@ private: GetLastDirectory(path, name); else name[0] = '\0'; - + /*if(!path) GetWorkingDir(startPath, sizeof(startPath)); else strcpy(path, startPath);*/ - bits.mode = directory; + list.Clear(); + delete root; #ifdef __WIN32__ if(isRoot) @@ -1669,7 +1673,7 @@ public: location.GetPath(path); { FileListing listing { path }; - + ExplorerFileItem item; DataRow row; @@ -1724,7 +1728,7 @@ public: location.GetPath(path); { FileListing listing { path }; - + ExplorerFileItem item; DataRow row; @@ -1773,7 +1777,7 @@ public: location.GetPath(path); { FileListing listing { path }; - + ExplorerFileItem item; DataRow row; @@ -1820,7 +1824,7 @@ public: location.GetPath(path); { FileListing listing { path }; - + ExplorerFileItem item; DataRow row; @@ -1866,7 +1870,7 @@ public: { _[c].Free(); delete _[c]; - } + } count = 0; size = 0; } @@ -1905,9 +1909,9 @@ public: int hWnd = clientSize.h; int wList = view.list.size.w + view.split.size.w; - + float scale = Min((float)(wWnd - 10) / wBmp, (float)(hWnd - 10) / hBmp); - + int wDraw = (int)(wBmp * scale); int hDraw = (int)(hBmp * scale); @@ -1958,10 +1962,10 @@ public: for(pos = 0; pos < selectedItems.count; pos++) { Bitmap bitmap { }; - selItem = (ExplorerFileItem)selectedItems._[pos]; + selItem = (ExplorerFileItem)selectedItems._[pos]; bitmap.Load(selItem.path, null, displaySystem); //view.bitmaps.Add(bitmap); - } + } if(item && item.type == pictureFile) { view.bitmap = Bitmap { }; @@ -1984,7 +1988,7 @@ public: location.GetPath(path); { FileListing listing { path }; - + ExplorerFileItem item; DataRow row; @@ -2020,7 +2024,7 @@ public: FileSystemNode selection; virtual bool Window::NotifyNodeSelect(ExplorerTree tree, FileSystemNode node); - + property FileSystemNode node { get @@ -2108,7 +2112,7 @@ public: } return true; } - + bool NotifyRightClick(ListBox listBox, int x, int y, Modifiers mods) { DataRow row = listBox.currentRow; @@ -2129,8 +2133,8 @@ public: popup = PopupMenu { master = this, menu = menu, - position = { - x + clientStart.x + absPosition.x - guiApp.desktop.position.x, + position = { + x + clientStart.x + absPosition.x - guiApp.desktop.position.x, y + clientStart.y + absPosition.y - guiApp.desktop.position.y } }; popup.Create(); @@ -2203,7 +2207,7 @@ public: MenuItem itemEditPaste { editMenu, "Paste\tCtrl+V", p; - + bool NotifySelect(MenuItem selection, Modifiers mods) { //EditPaste(); @@ -2221,7 +2225,7 @@ public: } }; - // WHY is this crashing ? + // WHY is this crashing ? /-*void OnResize(int width, int height) { if(this && nameField) @@ -2249,14 +2253,14 @@ public: #endif AddTreeNode(root, true, false, false, null, tree); - // How can this make sense for linux? + // How can this make sense for linux? #ifdef __WIN32__ while(listing.Find()) { int len = strlen(listing.name); char info[MAX_LOCATION]; char name[MAX_LOCATION]; - if(listing.stats.attribs.isDrive && + if(listing.stats.attribs.isDrive && len > 3 && !strncmp(&listing.name[1], ": [", 3)) { strncpy(name, listing.name, 2); @@ -2309,7 +2313,7 @@ public: ClipBoard clipBoard { }; if(clipBoard.Allocate(size+1)) { - GetSel(clipBoard.memory, true); + GetSel(clipBoard.memory, true); // Save clipboard clipBoard.Save(); } @@ -2358,11 +2362,11 @@ hGlobal = GlobalAlloc(GHND, Len(DF) + Len(strFiles)) 'put all files to a exclusi If hGlobal Then 'if the globalalloc worked lpGlobal = GlobalLock(hGlobal) 'lock the hGlobal DF.pFiles = Len(DF) 'set the size of the files - + Call CopyMem(ByVal lpGlobal, DF, Len(DF)) 'copy df to the lpglobal Call CopyMem(ByVal (lpGlobal + Len(DF)), ByVal strFiles, Len(strFiles)) 'copy strfiles to lpglobal Call GlobalUnlock(hGlobal) 'unlock hglobal again - + SetClipboardData CF_HDROP, hGlobal 'put files to the clipboard End If *-/ @@ -2389,7 +2393,7 @@ public: } BSloc Remove(FileSystemNode item) { - + } } #endif @@ -2438,7 +2442,7 @@ public class ExplorerFileItem : struct //float scale = Min((float)clientSize.w / (float)bitmap.width, (float)clientSize.h / (float)bitmap.height); int w = 16; //(int)(bitmap.width * scale); int h = 16; //(int)(bitmap.height * scale); - + Bitmap icon; icon = control.fileIcons[type].bitmap; @@ -2449,7 +2453,7 @@ public class ExplorerFileItem : struct indentSize = 8; } textOffset = indent * indentSize + (icon ? (icon.width + 6) : 0); - + if(info) sprintf(label, "%s [%s]", name, info); else @@ -2550,7 +2554,7 @@ public: { //_[c].Free() delete _[c]; - } + } count = 0; size = 0; } @@ -2562,7 +2566,7 @@ ExplorerFileItem MakeFileItem(const FileAttribs attribs, const char * fileName, char info[MAX_LOCATION]; char name[MAX_LOCATION]; char extension[MAX_EXTENSION]; - + ExplorerFileItem item { }; //if(stats.attribs.isFile) // -- should work now @@ -2579,7 +2583,7 @@ ExplorerFileItem MakeFileItem(const FileAttribs attribs, const char * fileName, item.type = cdrom; if(attribs.isRemote) item.type = netDrive; - if(attribs.isRemovable) + if(attribs.isRemovable) { if(fileName[0] == 'A' || fileName[0] == 'B') item.type = floppy; @@ -2592,11 +2596,11 @@ ExplorerFileItem MakeFileItem(const FileAttribs attribs, const char * fileName, GetExtension(fileName, extension); //strupr(extension); strlwr(extension); - + item.type = _FileType::SelectByExtension(extension); } - if(attribs.isDrive && + if(attribs.isDrive && len > 3 && !strncmp(&fileName[1], ": [", 3)) { strncpy(name, fileName, 2); @@ -2726,7 +2730,7 @@ public: Array exists; // would use (see) BoolArrayInt to pack this into an int if could be accessed as an array void GetPath(String outputPath) - { + { if(path) strcpy(outputPath, path); else if(parent) @@ -2741,17 +2745,9 @@ public: PathCat(temp, outputPath); strcpy(outputPath, temp); } - /*else - { - /-*#ifdef __WIN32__ - strcpy(outputPath, "/"); - #else*-/ - //strcpy(outputPath, name); - strcpy(outputPath, path); - PathCat(outputPath, name); - //#endif - }*/ } + else + strcpy(outputPath, name ? name : ""); } bool IsChildOf(FileSystemNode node) @@ -2768,7 +2764,7 @@ public: if(children.first) { FileSystemNode child; - + for(child = children.first; child; child = child.next) { FileSystemNode copy { }; @@ -2782,7 +2778,7 @@ public: } } } - + void EnsureVisible(bool expand) { if(parent) @@ -2838,8 +2834,9 @@ public: if(!this) return; - + comp = fsb.comparedPaths && fsb.comparedPaths.count > 1; + icon = fsb.fileIcons[type].bitmap; alt = bits.isListItem ? path : name; if(comp && !fsb.bits.columnsCompareStyle && cmpIcon) @@ -2868,7 +2865,7 @@ public: strcpy(text, label ? label : alt); //"%d-%d/%s", stats.inode, stats.nlink //sprintf(text, "%d-%d/%s", stats.inode, stats.nlink, label ? label : alt); len = strlen(text); - + if(!icon) { if(type == folder || type == folderOpen) @@ -2877,18 +2874,17 @@ public: indent = 8; } //textOffset = indent * indentSize + (icon ? (icon.width + 4) : 0); - + surface.SetForeground(displayFlags.selected ? fsb.selectionText : fsb.foreground); surface.TextOpacity(false); surface.TextExtent(text, len, &w, &h); h = Max(h, 16); - + // Draw the current row stipple if(displayFlags.selected) //surface.Area(xStart - 1, y, xStart - 1, y + h - 1); //surface.Area(xStart + w - 1, y, xStart + w + 1, y + h - 1); surface.Area(xStart - 3, y, xStart + w + 1, y + h - 1); - //surface.WriteTextDots(alignment, x + textOffset, y + 2, width - textOffset, alt, strlen(alt)); surface.WriteTextDots(alignment, xStart, y + 2, width, text, len); @@ -3134,7 +3130,7 @@ public: if(stats.attribs.isShare) node.type = share; if(stats.attribs.isCDROM) node.type = cdrom; if(stats.attribs.isRemote) node.type = netDrive; - if(stats.attribs.isRemovable) + if(stats.attribs.isRemovable) { if(name[0] == 'A' || name[0] == 'B') node.type = floppy; @@ -3164,7 +3160,7 @@ FileSystemNode MakeFileSystemNode( char info[MAX_LOCATION]; char name2[MAX_LOCATION]; char extension[MAX_EXTENSION]; - + FileSystemNode node { stats = stats }; /*if(!pathAddName) @@ -3187,7 +3183,7 @@ FileSystemNode MakeFileSystemNode( if(stats.attribs.isShare) node.type = share; if(stats.attribs.isCDROM) node.type = cdrom; if(stats.attribs.isRemote) node.type = netDrive; - if(stats.attribs.isRemovable) + if(stats.attribs.isRemovable) { if(name[0] == 'A' || name[0] == 'B') node.type = floppy; @@ -3199,11 +3195,11 @@ FileSystemNode MakeFileSystemNode( { GetExtension(name, extension); strlwr(extension); - + node.type = _FileType::SelectByExtension(extension); } - if(stats.attribs.isDrive && + if(stats.attribs.isDrive && len > 3 && !strncmp(&name[1], ": [", 3)) { strncpy(name2, name, 2); -- 1.8.3.1 From bc25e0084823e36a8403b14a96985459328cbe3c Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Sun, 6 Sep 2020 20:49:14 -0400 Subject: [PATCH 3/4] Explorer; libede: Fixes to compile, warnings; fixed single window coming up when invoking without arguments --- explorer/explorer.epj | 4 +- explorer/src/DeleteBox.ec | 8 +-- explorer/src/Explorer.ec | 38 ++++++++----- explorer/src/ExplorerWindow.ec | 23 ++++---- explorer/src/Finder.ec | 18 +++---- libede/src/CreateNewFileDialog.ec | 6 +-- libede/src/FileSystemBox.ec | 110 +++++++++++++++++++++----------------- libede/src/FileSystemCache.ec | 33 +++++++----- libede/src/FileSystemIterator.ec | 18 ++++--- libede/src/FileSystemSearch.ec | 32 +++++------ 10 files changed, 164 insertions(+), 126 deletions(-) diff --git a/explorer/explorer.epj b/explorer/explorer.epj index 804866e..39cea87 100644 --- a/explorer/explorer.epj +++ b/explorer/explorer.epj @@ -50,12 +50,12 @@ "Folder" : "extern", "Files" : [ { - "FileName" : "../../../sdk/extras/gui/controls/ToolBar.ec", + "FileName" : "$(ECERE_SDK_SRC)/extras/gui/controls/ToolBar.ec", "Options" : { "ExcludeFromBuild" : true } }, - "../../../sdk/extras/gui/controls/SearchBox.ec" + "$(ECERE_SDK_SRC)/extras/gui/controls/SearchBox.ec" ], "Configurations" : [ { diff --git a/explorer/src/DeleteBox.ec b/explorer/src/DeleteBox.ec index d9c2d08..e91f52c 100644 --- a/explorer/src/DeleteBox.ec +++ b/explorer/src/DeleteBox.ec @@ -14,7 +14,7 @@ public: ListBox source; private: - + ListBox list { parent = this, borderStyle = deep, hasVertScroll = true, hasHorzScroll = true; @@ -73,7 +73,7 @@ private: } // what if a child of some parent was added before that parent, should check to remove // or is it imposible to get the backwards order from GetMultiSelection - + //for(branch = (ExplorerFileBranch)row.tag; branch; branch = branch.parent) // branches.Add(branch); } @@ -94,11 +94,11 @@ private: parent.DuplicateChildren(true, true, root, list); } } - + */ /* copies.count = branches.count; - + { bool added = true; uint b; diff --git a/explorer/src/Explorer.ec b/explorer/src/Explorer.ec index 134b675..6b9f872 100644 --- a/explorer/src/Explorer.ec +++ b/explorer/src/Explorer.ec @@ -46,12 +46,13 @@ class Explorer : GuiApplication openArgsStartAt = 2; else if(!strcmpi(argv[1], "find") && argc > 2) { - char * unquoted; if(argv[2][0] == '\"') - StripQuotes(argv[2], unquoted); + { + findWhat = new char[strlen(argv[2])+1]; + StripQuotes(argv[2], findWhat); + } else - unquoted = argv[2]; - findWhat = CopyString(unquoted); + findWhat = CopyString(argv[2]); if(argc > 3) { if(!strcmpi(argv[3], "in") && argc > 4) @@ -61,7 +62,7 @@ class Explorer : GuiApplication } else searchPath = ""; // same - } + } else if(!strcmpi(argv[1], "search") && argc > 2) searchPath = argv[2]; else if(!strcmpi(argv[1], "compare") && argc > 2) @@ -71,11 +72,11 @@ class Explorer : GuiApplication if(argc == 3) { goPath = ""; // current dir - comparedPaths.Add(goPath); + comparedPaths.Add(CopyString((const char *)goPath)); // TODO: Review whether this gets freed? } for(c = 2; c < argc; c++) { - char * s; + const char * s; goPath = argv[c]; s = goPath; if(s) @@ -106,6 +107,8 @@ class Explorer : GuiApplication explorerWnd.Create(); explorerWnd.location = goPath;//explorerWnd.GoTo(goPath, false, false); } + if(openArgsStartAt == -1) + break; } } else if(searchPath) @@ -121,8 +124,14 @@ class Explorer : GuiApplication explorerWnd.Create(); explorerWnd.view.columnsCompareStyle = true; explorerWnd.comparedLocations = comparedPaths; + comparedPaths = null; // delete comparedPaths; } + if(comparedPaths) + { + comparedPaths.Free(); + delete comparedPaths; + } return true; } } @@ -131,17 +140,20 @@ struct QuickPathTool { char path[MAX_LOCATION]; - property char * + property const char * { set { - char * unquoted; GetWorkingDir(path, MAX_LOCATION); if(value[0] == '\"') + { + char * unquoted = new char[strlen(value) + 1]; StripQuotes(value, unquoted); + PathCat(path, unquoted); + delete unquoted; + } else - unquoted = value; - PathCat(path, unquoted); + PathCat(path, value); if(!FileExists(path)) { // this incomplete functionality is not quite at it's place in this class @@ -152,7 +164,7 @@ struct QuickPathTool StripLastDirectory(path, path); if(FileExists(path)) { - // TODO: message location does not exist, + // TODO: message location does not exist, // this higher location exists though // go there? break; @@ -160,7 +172,7 @@ struct QuickPathTool } if(!len) { - // TODO: message location does not exist, + // TODO: message location does not exist, // unable to select alternate location } path[0] = '\0'; diff --git a/explorer/src/ExplorerWindow.ec b/explorer/src/ExplorerWindow.ec index f1c0a2d..d22c0d2 100644 --- a/explorer/src/ExplorerWindow.ec +++ b/explorer/src/ExplorerWindow.ec @@ -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]) @@ -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 { @@ -1317,7 +1320,7 @@ class ExplorerWindow : Window } return true; }*/ - + /*bool ViewNotifyItemOpen(ExplorerView view, ExplorerFileItem item) { ExplorerFileBranch branch = tree.branch; @@ -1326,14 +1329,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) @@ -1409,7 +1412,7 @@ class ExplorerWindow : Window NotifyItemOpen = ViewNotifyItemOpen; }; lastViewId = viewList; - + tree.Load(); view.Load(tree.root); }*/ diff --git a/explorer/src/Finder.ec b/explorer/src/Finder.ec index c65367f..42e2d58 100644 --- a/explorer/src/Finder.ec +++ b/explorer/src/Finder.ec @@ -31,7 +31,7 @@ public: void SearchStart() { char text[2048]; - + searchThread.active = true; searchThread.optionSubdirs = options.subdirs.checked; @@ -45,7 +45,7 @@ public: strcpy(searchThread.location, location.GetText()); strcpy(searchThread.nameSearch, findName.GetText()); strcpy(searchThread.contentSearch, findTextContent.GetText()); - + actions.startStop.text = "Stop Search"; actions.clear.disabled = false; view.results.Clear(); @@ -57,7 +57,7 @@ public: view.browser.text = "Browser"; sprintf(text, "Search Results (Searching %s)", location.GetText()); view.results.text = text; - + searchThread.Create(); } @@ -104,7 +104,7 @@ public: void SearchTerminate() { char text[1024]; - + if(searchThread.terminate) sprintf(text, "Search Results (%d item(s) found), Search was aborted.", searchThread.matchCount); else @@ -112,7 +112,7 @@ public: view.results.text = text; sprintf(text, "Browser (%d item(s) searched)", searchThread.count); view.browser.text = text; - + actions.startStop.text = "Start Search"; } @@ -190,7 +190,7 @@ class ExplorerSearchView : ExplorerView class ExplorerSearchViewTree : ExplorerSearchView { - + DataField resultsFieldPath { "char *" }; ListBox results @@ -252,9 +252,9 @@ class ExplorerSearchViewTree : ExplorerSearchView { OldList selection; Link item; - + listBox.GetMultiSelection(selection); - + for(item = selection.first; item; item = item.next) { char path[MAX_LOCATION]; @@ -274,7 +274,7 @@ class ExplorerSearchViewTree : ExplorerSearchView } bool Lists_NotifyDoubleClick(ListBox listBox, int x, int y, Modifiers mods) - { + { if(listBox.currentRow) { char path[MAX_LOCATION]; diff --git a/libede/src/CreateNewFileDialog.ec b/libede/src/CreateNewFileDialog.ec index 49755a0..0c793cb 100644 --- a/libede/src/CreateNewFileDialog.ec +++ b/libede/src/CreateNewFileDialog.ec @@ -10,7 +10,7 @@ public class CreateNewFileDialog : Window public: - property char * currentDirectory + property const char * currentDirectory { set { @@ -18,7 +18,7 @@ public: PathCat(currentDirectory, value); FileFixCase(currentDirectory); } - get { return (char *)currentDirectory; } + get { return currentDirectory; } }; private: @@ -27,7 +27,7 @@ private: CreateNewFileDialog() { - FileNameType c; + //FileNameType c; GetWorkingDir(currentDirectory, MAX_DIRECTORY); FileFixCase(currentDirectory); diff --git a/libede/src/FileSystemBox.ec b/libede/src/FileSystemBox.ec index 82a7abd..36edd05 100644 --- a/libede/src/FileSystemBox.ec +++ b/libede/src/FileSystemBox.ec @@ -3,22 +3,22 @@ import "FileSystemCache" #ifdef __WIN32__ static char * rootName = "Entire Computer"; -static char * msNetwork = "Microsoft Windows Network"; +static const char * msNetwork = "Microsoft Windows Network"; #else -static char * rootName = "File System"; +static const char * rootName = "File System"; #endif private: define guiApp = (GuiApplication)((__thisModule).application); define selectionColor = guiApp.currentSkin.selectionColor; //Color { 10, 36, 106 }; -void MessageBoxTodo(char * message) +void MessageBoxTodo(const char * message) { PrintLn("MessageBoxTodo(char * message) -- ", message); MessageBox { type = ok, text = "MessageBoxTodo(char * message)", contents = message }.Modal(); } -static char * fileIconNames[] = +static const char * fileIconNames[] = { "<:ecere>mimeTypes/file.png", /* none */ @@ -58,7 +58,7 @@ static char * fileIconNames[] = }; define countOfCompIconNames = 6; -static char * compIconNames[] = +static const char * compIconNames[] = { /* "<:ede>a.png", @@ -213,7 +213,7 @@ public: virtual bool Window::NotifyNodeMenu(FileSystemBox box, Menu menu, FileSystemBoxSelection selection); virtual bool Window::NotifyIteratorInit(FileSystemBox box, FileSystemIterator fileSystemIterator); - property char * path + property const char * path { set { @@ -233,7 +233,11 @@ public: { set { - delete comparedPaths; + if(comparedPaths) + { + comparedPaths.Free(); + delete comparedPaths; + } if(value && value.count) comparedPaths = value; if(locationBox) @@ -334,7 +338,7 @@ public: delete map; } - FileSystemNode SelectLocation(char * location) + FileSystemNode SelectLocation(const char * location) { int c; char * temp; @@ -355,7 +359,7 @@ public: for(c = steps.count - 1; c >= 0; c--) { - char * t = steps[c]; + //char * t = steps[c]; node = Find(steps[c], node); if(!node) break; @@ -418,6 +422,7 @@ public: bool MenuOpen(MenuItem selection, Modifiers mods) { OpenNode(); + return true; } bool MenuReplaceListItemByContainingDir(MenuItem selection, Modifiers mods) @@ -482,6 +487,11 @@ private: ~FileSystemBox() { + if(comparedPaths) + { + comparedPaths.Free(); + delete comparedPaths; + } delete extensions; delete path; } @@ -699,7 +709,7 @@ private: { if(row) { - FileSystemNode node = (FileSystemNode)row.tag; + //FileSystemNode node = (FileSystemNode)row.tag; } return true; } @@ -708,7 +718,7 @@ private: { if(row) { - FileSystemNode node = (FileSystemNode)row.tag; + //FileSystemNode node = (FileSystemNode)row.tag; } return true; } @@ -717,7 +727,7 @@ private: { if(row) { - FileSystemNode node = (FileSystemNode)row.tag; + //FileSystemNode node = (FileSystemNode)row.tag; } return true; } @@ -731,20 +741,20 @@ private: bool NotifyKeyDown(ListBox listBox, DataRow row, Key key, unichar ch) { - bool result; + //bool result = false; if((SmartKey)key == enter) - result = OpenNode(); + /*result = */OpenNode(); #if 0 else if((SmartKey)key == f2) - result = RenameNode(); + /*result = */RenameNode(); #endif else if((SmartKey)key == f2) { FileSystemNode node = selection.node; node.row.Edit(nameField); } - else - result = true; + //else + //result = true; return true; } }; @@ -777,12 +787,12 @@ private: int wWnd = fsb.show.clientSize.w; int hWnd = fsb.show.clientSize.h; - int wList = 0;//fsb.list.size.w + fsb.split.size.w; + //int wList = 0;//fsb.list.size.w + fsb.split.size.w; - float scale = Min((float)(wWnd - 10) / wBmp, (float)(hWnd - 10) / hBmp); + //float scale = Min((float)(wWnd - 10) / wBmp, (float)(hWnd - 10) / hBmp); - int wDraw = (int)(wBmp * scale); - int hDraw = (int)(hBmp * scale); + //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); @@ -797,7 +807,7 @@ private: surface.Area(0, 0, fsb.clientSize.w - 1, fsb.clientSize.h - 1); } } - } + }; bool OpenNode() { @@ -967,9 +977,9 @@ private: { bool isRoot = !strcmp(path, "/"); char name[MAX_LOCATION]; - FileSystemNode parent; - FileSystemNode node; - FileListing listing { path, extensions = extensions }; + //FileSystemNode parent; + //FileSystemNode node; + //FileListing listing { path, extensions = extensions }; if(!isRoot) GetLastDirectory(path, name); @@ -1105,7 +1115,7 @@ private: } } - bool ListIterator_OnObject(char * name, char * path, FileStats stats, bool isRootObject) + bool ListIterator_OnObject(const char * name, const char * path, FileStats stats, bool isRootObject) { ProcessListItem(name, path, stats, false); return false; @@ -1113,7 +1123,7 @@ private: //void ListIterator_OnLeavingDirectory(char * path) { } - void ProcessListItem(char * name, char * path, FileStats stats, bool isListItem) + void ProcessListItem(const char * name, const char * path, FileStats stats, bool isListItem) { if((!bits.foldersOnly && !bits.filesOnly) || (bits.foldersOnly && stats.attribs.isDirectory) || (bits.filesOnly && stats.attribs.isFile)) { @@ -1192,17 +1202,21 @@ private: FileListing listing { path, extensions = extensions }; while(listing.Find()) { - char * test; + //char * test; FileSystemNode child = null; if((!bits.foldersOnly && !bits.filesOnly) || (bits.foldersOnly && listing.stats.attribs.isDirectory) || (bits.filesOnly && listing.stats.attribs.isFile)) child = MakeAndAddToTreeFileSystemNodeFromFileListing(listing, parent); if(child) + { added = true; - test = child.name; - if(!test) - PrintLn("error"); + /* + test = child.name; + if(!test) + PrintLn("error"); + */ + } } if(!added) added = true; @@ -1212,7 +1226,7 @@ private: void LoadComparedList() { - int c, cmp/*, smallest*/, icon;//, equalCount; + int c/*, cmp*/ /*, smallest*/, icon;//, equalCount; int count = comparedPaths ? comparedPaths.count : 0; //bool allDone = false; bool not; @@ -1456,7 +1470,7 @@ private: void AddNode(FileSystemNode node) { DataRow row = list.AddRow(); - row.tag = (int)node; + row.tag = (intptr)node; node.row = row; incref node; row.SetData(nameField, node); @@ -1488,7 +1502,7 @@ private: (bits.filesOnly && listing.stats.attribs.isFile)))*/ { bool textFileLinesStyle = false; - char * test = listing.name; + const char * test = listing.name; if(!test) PrintLn("error"); result = MakeFileSystemNode(listing.stats, listing.name, listing.path, false, bits.previewPictures, false, displaySystem); @@ -1525,7 +1539,7 @@ private: node.indent = addTo.indent + 1; addTo.children.Add(node); } - row.tag = (int)node; + row.tag = (intptr)node; node.row = row; row.SetData(null, node); if(bits.pathColumn) @@ -2677,7 +2691,7 @@ private: } public: - /*//LinkElement link; + /* LinkElement link; FileSystemNode parent; FileSystemNodeType type; @@ -2690,12 +2704,12 @@ public: property bool isListItem { set { bits.isListItem = value; } get { return bits.isListItem; } }; - property char * path + property const char * path { set { delete path; if(value && value[0]) path = CopyString(value); } get { return path; } isset { return path && path[0]; } } - property char * name + property const char * name { set { delete name; if(value && value[0]) name = CopyString(value); } get { return name; } isset { return name && name[0]; } @@ -2705,12 +2719,12 @@ public: set { delete extension; if(value && value[0]) extension = CopyString(value); } get { return extension; } isset { return extension && extension[0]; } } - property char * label + property const char * label { set { delete label; if(value && value[0]) label = CopyString(value); } get { return label; } isset { return label && label[0]; } } - property char * info + property const char * info { set { delete info; if(value && value[0]) info = CopyString(value); } get { return info; } isset { return info && info[0]; } @@ -2819,7 +2833,7 @@ public: void OnDisplay(Surface surface, int x, int y, int width, FileSystemBox fsb, Alignment alignment, DataDisplayFlags displayFlags) { //int indentSize = (displayFlags.dropBox) ? 0 : 10; - int indent = 16; + //int indent = 16; int xStart; int len; int w, h; @@ -3097,7 +3111,7 @@ public: //} #endif - bool OnGetDataFromString(char * string) + bool OnGetDataFromString(const char * string) { #if 0 if(string && *string) @@ -3111,7 +3125,7 @@ public: return false; } - char * OnGetString(char * tempString, FileSystemToolWindow fileSysToolWnd, bool * needClass) + const char * OnGetString(char * tempString, void * unused /*FileSystemToolWindow fileSysToolWnd*/, bool * needClass) { return name ? name : ""; } @@ -3154,7 +3168,7 @@ FileSystemNode MakeFileSystemNode( const bool pathAddName, const bool previewPicture, const bool isListItem, - const DisplaySystem displaySystem) + /*const */DisplaySystem displaySystem) { int len = strlen(name); char info[MAX_LOCATION]; @@ -3215,8 +3229,8 @@ FileSystemNode MakeFileSystemNode( if(pathAddName) { - bool isFile = stats.attribs.isFile; - bool isFolder = stats.attribs.isDirectory; + //bool isFile = stats.attribs.isFile; + //bool isFolder = stats.attribs.isDirectory; char full[MAX_LOCATION]; strcpy(full, path); PathCat(full, name); @@ -3249,8 +3263,8 @@ FileSystemNode MakeComparedFileSystemNode( const bool previewPicture, const int cmpIcon, const bool cmpNot, - const Array exists, - const DisplaySystem displaySystem) + /*const */Array exists, + /*const */DisplaySystem displaySystem) { FileSystemNode node = MakeFileSystemNode(stats, name, path, pathAddName, previewPicture, false, displaySystem); if(node) diff --git a/libede/src/FileSystemCache.ec b/libede/src/FileSystemCache.ec index 03920bd..89eeaa1 100644 --- a/libede/src/FileSystemCache.ec +++ b/libede/src/FileSystemCache.ec @@ -132,16 +132,16 @@ public: iterateStartPath = true; // COMPILER TOFIX: this will not compile (error: method class must be derived from class) -- bool Whatever/*FileSystemCache*/::OnFolder(...) - bool /*FileSystemCache*/DummyFileSystemCacheWindow::OnObject(char * name, char * path, FileStats stats, bool isRootObject) + bool /*FileSystemCache*/DummyFileSystemCacheWindow::OnObject(const char * name, const char * path, FileStats stats, bool isRootObject) { bool result = true; FileSystemCache cache = this.cache; - uint dev = stats.dev; - uint inode = stats.inode; + //uint dev = stats.dev; + //uint inode = stats.inode; char * p; FSCacheObject parent = isRootObject ? null : cache.normalParentStack.lastIterator.data; FSCacheObject o { parent, name = CopyString(isRootObject ? path : name), stats = stats }; - FileStats s; + //FileStats s; if(isRootObject) { // TODO see if we can find a parent for it @@ -163,20 +163,22 @@ public: } cache.objects.Add(o); #if _DEBUG + /* if(cache.objects.count % 1000 == 0) PrintLn(path, " ----- ", cache.objects.count / 1000, " --------- ", dev); - FileGetStatsLink(path, s); + */ + //FileGetStatsLink(path, s); + /* if(s.inode != inode) { PrintLn(s.inode); PrintLn(inode); - PrintLn("crap"); } + */ p = o.GetPath(); if(strcmp(p, path)) { int c; - PrintLn("damn"); PrintLn(p); for(c = 0; c < cache.normalParentStack.count; c++) { @@ -185,10 +187,10 @@ public: PrintLn(p); } PrintLn(path); - PrintLn("bad"); } delete p; #endif + /* if(dev && inode && cache.bits.indexInodes) { FileSystemDeviceCache devCache = cache.deviceCaches[dev]; @@ -203,17 +205,18 @@ public: inodes.Add(o); } } + */ return result; } - void /*FileSystemCache*/DummyFileSystemCacheWindow::OnEnteringDirectory(char * path) + void /*FileSystemCache*/DummyFileSystemCacheWindow::OnEnteringDirectory(const char * path) { FileSystemCache cache = this.cache; FSCacheObject o = cache.objects.lastIterator.data; cache.normalParentStack.Add(o); } - void /*FileSystemCache*/DummyFileSystemCacheWindow::OnLeavingDirectory(char * path) + void /*FileSystemCache*/DummyFileSystemCacheWindow::OnLeavingDirectory(const char * path) { FileSystemCache cache = this.cache; cache.normalParentStack.lastIterator.Remove(); @@ -310,8 +313,11 @@ public: void Special(char * path/*, Map linksPaths*//*Map> devsInodesDone*/, DummyFileSystemCacheWindow dummyWindow) { FileSystemCacheIterator fsci { owner = dummyWindow, cache = this, iterateStartPath = true; - bool /*FileSystemCache*/DummyFileSystemCacheWindow::OnObject(char * name, char * path, FileStats stats, bool isRootObject) + bool /*FileSystemCache*/DummyFileSystemCacheWindow::OnObject(const char * name, const char * path, + FileStats stats, bool isRootObject) { + /* + uint dev = stats.dev; uint inode = stats.inode; FileSystemCache cache = this.cache; @@ -353,6 +359,7 @@ public: } else PrintLn("no dev/inode"); + */ return true; } }; @@ -455,12 +462,12 @@ private: } } -Array GetPathDirNamesArray(char * path) +Array GetPathDirNamesArray(const char * path) { Array names; if(path && path[0]) { - char * p = path; + const char * p = path; char rest[MAX_LOCATION]; char name[MAX_FILENAME]; names = { }; diff --git a/libede/src/FileSystemIterator.ec b/libede/src/FileSystemIterator.ec index 6c2cab3..8561a54 100644 --- a/libede/src/FileSystemIterator.ec +++ b/libede/src/FileSystemIterator.ec @@ -25,10 +25,10 @@ public: { char name[MAX_LOCATION] = ""; FileStats stats; - if(followLinks) + //if(followLinks) FileGetStats(startPath, stats); - else - FileGetStatsLink(startPath, stats); + /*else + FileGetStatsLink(startPath, stats);*/ GetLastDirectory(startPath, name); listDirEntries = OnObject(owner, name, startPath, stats, true); if(listDirEntries) @@ -45,7 +45,7 @@ public: { if(frame.listing.Find()) { - FileStats stats = followLinks ? frame.listing.stats : frame.listing.lstats; + FileStats stats = /*followLinks ? */frame.listing.stats /*: frame.listing.lstats*/; listDirEntries = OnObject(owner, frame.listing.name, frame.listing.path, stats, !iterateStartPath && stack.count == 1); if(stats.attribs.isDirectory) { @@ -101,18 +101,20 @@ public: bool iterateStartPath; virtual bool Iterate(char * startPath, bool followLinks); - virtual bool any_object::OnObject(/*any_object data, */char * name, char * path, FileStats stats, bool isRootObject); - virtual void any_object::OnEnteringDirectory(/*any_object data, */char * path); - virtual void any_object::OnLeavingDirectory(/*any_object data, */char * path); + virtual bool any_object::OnObject(/*any_object data, */const char * name, const char * path, FileStats stats, bool isRootObject); + virtual void any_object::OnEnteringDirectory(/*any_object data, */const char * path); + virtual void any_object::OnLeavingDirectory(/*any_object data, */const char * path); private: } // TODO: implement threaded iteration somehow.... +/* static class IteratorThread : Thread { void Temp() { - //listing = FileListing { dir, extensions = filter.extensions }; // there should be a sorted = true/false + //listing = FileListing { dir, extensions = filter.extensions }; // there should be a sorted = true/false } } +*/ diff --git a/libede/src/FileSystemSearch.ec b/libede/src/FileSystemSearch.ec index 690cd71..d198f1b 100644 --- a/libede/src/FileSystemSearch.ec +++ b/libede/src/FileSystemSearch.ec @@ -12,7 +12,7 @@ struct SearchStackFrame int tag; char path[MAX_LOCATION]; FileListing listing; - + bool branched; //DataRow result; //DataRow browse; @@ -47,7 +47,7 @@ public: terminate = false; } - virtual bool Window::NotifyUpdateSearchLocation(FileSystemSearch search, char * location); + virtual bool Window::NotifyUpdateSearchLocation(FileSystemSearch search, const char * location); virtual bool Window::NotifySearchSortResults(FileSystemSearch search); virtual bool Window::NotifySearchSortBrowser(FileSystemSearch search); virtual bool Window::NotifySearchTerminated(FileSystemSearch search); @@ -61,7 +61,7 @@ public: - bool SearchFileContent(String path) + bool SearchFileContent(const String path) { bool match = false; File file = FileOpen(path, read); @@ -96,8 +96,8 @@ public: find = SearchString(buffer, start, contentSearch, optionContentMatchCase, optionContentMatchWord); // todo add a maximum line length possibility as param - for(bstart = start; - bstart < readCount && newLine && (!find || newLine < find); + for(bstart = start; + bstart < readCount && newLine && (!find || newLine < find); bstart += (newLine - &buffer[bstart]) / sizeof(char)) { newLine = strstr(&buffer[bstart], "\n"); @@ -131,14 +131,14 @@ public: find = SearchString(buffer, start, contentSearch, optionContentMatchCase, optionContentMatchWord); file.Seek(seekBack, current); } - match = (bool)find; + match = find != null; } delete file; } return match; } - - // I wonder if this is optimized at the c level to be compiled inline + + // I wonder if this is optimized at the c level to be compiled inline // and to use in-place in-stack memory for both the return value and the parameters // if not, c should be more optimized... // would the const have any impact on optimization? @@ -155,24 +155,24 @@ public: // \\Nateus\data\ is not remote, etc... // How to? FileStats stats; - + terminate = false; count = 0; matchCount = 0; - + hasNameSearch = (strlen(nameSearch) != 0); hasSizeSearch = false; // this is temporary hasContentSearch = (strlen(contentSearch) != 0); listLines = true; lines = OldList { }; - + //SearchDir(location); FileGetStats(location, stats); strcpy(stack[0].path, location); - stack[0].listing = FileListing { stack[0].path }; // there should be a sorted = true/false + stack[0].listing = FileListing { stack[0].path }; // there should be a sorted = true/false //fsb.list.Clear(); // Binary Search sorting... @@ -198,7 +198,7 @@ public: } guiApp.Unlock(); } - + for(frame = 0; frame >= 0 && !terminate; ) { guiApp.Lock(); @@ -222,13 +222,13 @@ public: if(stack[frame].listing.Find()) { count++; - + //match = (strcmp(stack[frame].listing.name, nameSearch) == 0); //match = (stack[frame].listing.name[0] == nameSearch[0]); //match = (bool)strstr(stack[frame].listing.name, nameSearch); - + if(hasNameSearch) - match = (bool)SearchString(stack[frame].listing.name, 0, nameSearch, optionNameMatchCase, optionNameMatchWord); + match = SearchString(stack[frame].listing.name, 0, nameSearch, optionNameMatchCase, optionNameMatchWord) != null; else match = true; -- 1.8.3.1 From 9e16f30612eb73393d7fde121037b1546c98c22b Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Sun, 6 Sep 2020 21:02:15 -0400 Subject: [PATCH 4/4] Fixed major issues - Files were not showing at startup - Toggling details wasn't working - Toggling showcase didn't reset the view properly --- explorer/src/ExplorerWindow.ec | 30 +++++++++++++++++------------- libede/src/FileSystemBox.ec | 5 +++++ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/explorer/src/ExplorerWindow.ec b/explorer/src/ExplorerWindow.ec index d22c0d2..eb690c3 100644 --- a/explorer/src/ExplorerWindow.ec +++ b/explorer/src/ExplorerWindow.ec @@ -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(); @@ -1207,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() @@ -1387,6 +1390,7 @@ class ExplorerWindow : Window //userMode = true; addressBar.path = view.path; ReadyTree(); + view.Refresh(); return true; } diff --git a/libede/src/FileSystemBox.ec b/libede/src/FileSystemBox.ec index 36edd05..8842cf1 100644 --- a/libede/src/FileSystemBox.ec +++ b/libede/src/FileSystemBox.ec @@ -281,6 +281,11 @@ public: split.leftPane = value ? list : null; split.visible = value; show.visible = value; + if(!value) + { + list.parent = this; + list.anchor = Anchor { left = 0, top = 0, right = 0, bottom = 0 }; + } } get { return bits.preview; } }; -- 1.8.3.1