X-Git-Url: http://ecere.com/cgi-bin/gitweb.cgi?p=ede;a=blobdiff_plain;f=explorer%2Fsrc%2FExplorerWindow.ec;h=a235a0506f7ade3f373c897986b79b8ca9dba3fb;hp=40fa4a462c758e17c9e42d5b8d216c771e9fb50c;hb=5ca58573e2de7f993025de4064316b1af46e42e6;hpb=0670a6f4922e1560db8cbe20da06a6ad588a6cc5 diff --git a/explorer/src/ExplorerWindow.ec b/explorer/src/ExplorerWindow.ec index 40fa4a4..a235a05 100644 --- a/explorer/src/ExplorerWindow.ec +++ b/explorer/src/ExplorerWindow.ec @@ -10,13 +10,17 @@ enum ExplorerToolId panelTree, panelSearch, addressBar, refresh, - viewList, viewDetails, viewIcons, viewCards, viewShowcase, viewCustom, + viewList, viewDetails, viewIcons, viewCards, viewShowcase, viewTree, viewCustom, previewPictures }; class ExplorerWindow : Window { +#ifdef _DEBUG + text = "Ecere Explorer (Debug)"; +#else text = "Ecere Explorer"; +#endif background = activeBorder; borderStyle = sizable; hasMaximize = true; @@ -82,6 +86,7 @@ class ExplorerWindow : Window ":view-icons.png", /* viewIcons */ ":view-cards.png", /* viewCards */ ":view-showcase-right.png", /* viewShowcase */ + ":panel-tree.png", /* viewTree */ ":view-custom.png", /* viewCustom */ "<:ecere>mimeTypes/image.png" /* previewPictures */ @@ -120,11 +125,23 @@ class ExplorerWindow : Window case goBack: case goForward: break; + case goHome: + { + char * home = getenv("HOME"); + if(home && home[0] && FileExists(home).isDirectory) + view.path = home; + break; + } case goUp: { char * path = view.path; - char * newPath = new char[strlen(path)]; + char * newPath = new char[strlen(path)+1]; StripLastDirectory(path, newPath); + if(!newPath[0]) + { + newPath[0] = '/'; + newPath[1] = 0; + } view.path = newPath; delete newPath; break; @@ -132,13 +149,36 @@ class ExplorerWindow : Window case panelTree: // TODO TOFIX : need to fix Stacker for this to work tree.visible = button.checked; + split.visible = button.checked; + if(button.checked) + { + split.rightPane = view; + view.anchor = { top = 0, bottom = 0, right = 0 }; + tree.SelectLocation(view.path); + } + else + { + split.rightPane = null; + view.anchor = { left = 0, top = 0, bottom = 0, right = 0 }; + } //search.visible = !button.checked; panels.size = { panels.size.w, panels.size.h }; // TOFIX : another Stacker fix needed break; case panelSearch: // TODO TOFIX : need to fix Stacker for this to work //search.visible = button.checked; - tree.visible = !button.checked; + tree.visible = false; //!button.checked; + split.visible = false; //!button.checked; + if(false/*button.checked*/) + { + split.rightPane = view; + view.anchor = { top = 0, bottom = 0, right = 0 }; + } + else + { + split.rightPane = null; + view.anchor = { left = 0, top = 0, bottom = 0, right = 0 }; + } panels.size = { panels.size.w, panels.size.h }; // TOFIX : another Stacker fix needed break; case refresh: @@ -156,6 +196,12 @@ class ExplorerWindow : Window case viewCards: case viewShowcase: //SwitchViews(toolId); + view.treeBranches = false; + view.Refresh(); + break; + case viewTree: + view.treeBranches = button.checked; + view.Refresh(); break; } } @@ -207,6 +253,7 @@ class ExplorerWindow : Window OptionToolButton viewIcons { toolBar, this, id = ExplorerToolId::viewIcons, selected = &selectedView }; OptionToolButton viewTiles { toolBar, this, id = ExplorerToolId::viewCards, selected = &selectedView }; OptionToolButton viewShowcase { toolBar, this, id = ExplorerToolId::viewShowcase, selected = &selectedView }; + OptionToolButton viewTree { toolBar, this, id = ExplorerToolId::viewTree, selected = &selectedView }; selectedView = viewList; Window s9 { toolBar, size = { w = 8 } }; ToggleToolButton previewPictures { toolBar, this, id = ExplorerToolId::previewPictures }; @@ -252,28 +299,82 @@ class ExplorerWindow : Window panels, this; };*/ - /*Tree*/FileSystemBox tree; - /*{ + Window hack + { panels, this; - size = { w = 240 }; anchor.top = 0; anchor.bottom = 0; - navigateFolders = true; + anchor.right = 0; + borderStyle = deep; + }; + + /*Tree*/FileSystemBox tree//; + { + hack, this; + size = { w = 240 }; + borderStyle = none; + visible = false; + /*anchor.top = 0; + anchor.bottom = 0;*/ + anchor = { left = 0, top = 0, bottom = 0 }; + treeBranches = true; foldersOnly = true; - borderStyle = none; + + bool NotifyNodeSelect(FileSystemBox box, FileSystemNode node) + { + char p[MAX_LOCATION]; + node.GetPath(p); + view.path = node.path; + return true; + } + }; + + PaneSplitter split + { + hack, this; visible = false; - };*/ + leftPane = tree;//, rightPane = view; + split = 300; + }; FileSystemBox view { - panels, this; - anchor.top = 0; + hack, this; + borderStyle = none; + /*anchor.top = 0; anchor.bottom = 0; - anchor.right = 0; + anchor.right = 0;*/ + anchor = { left = 0, top = 0, bottom = 0, right = 0 }; + locationBox = addressBar; navigateFolders = true; - borderStyle = none; + multiSelect = true; + + bool NotifyNodeOpen(FileSystemBox box, FileSystemNode node) + { + if(node.type.isFile) + { + #ifndef __WIN32__ + char command[MAX_LOCATION]; + /*_FileType t = node.type; + if(t == ewsFile || t == epjFile || + t == ecFile || t == ehFile || + t == cppFile || t == hppFile || + t == cFile || t == hFile || + t == textFile || t == webFile)*/ + sprintf(command, "ide %s", node.path); + /*else + sprintf(command, "%s", node.path);*/ + Execute(command); + #else + ShellOpen(node.path); + #endif + } + else if(node.type.isFolder && tree.visible) + tree.SelectLocation(node.path); + return true; + } }; /*ExplorerSearch search @@ -292,13 +393,6 @@ class ExplorerWindow : Window parent = deep, master = this; tabCycle = true; anchor = Anchor { top = 0, bottom = 0, right = 0 }; - }; - - SplitWindow split - { - deep, this; - leftPane = tree, rightPane = viewHolder; - split = 300; };*/ // Preview / Showcase @@ -415,6 +509,7 @@ class ExplorerWindow : Window { //userMode = true; addressBar.path = view.path; + tree.path = "/"; // this should be available as a parameter return true; }