import "Explorer" import "IconBag" import "ToolBar" enum ExplorerToolId { none, newWindow, goBack, goForward, goUp, goHome, browse, panelTree, panelSearch, addressBar, refresh, viewList, viewDetails, viewIcons, viewCards, viewShowcase, viewTree, viewCustom, previewPictures }; class ExplorerWindow : Window { text = "Ecere Explorer"; background = activeBorder; borderStyle = sizable; hasMaximize = true; hasMinimize = true; hasClose = true; hasMenuBar = true; //tabCycle = true; size = { 840, 480 }; minClientSize = { 600, 300 }; nativeDecorations = true; /* bool userMode; bool clipboard; int treeSplit; int searchSplit; ExplorerToolId lastViewId; */ menu = Menu { }; Menu fileMenu { menu, "File", f }; Menu windowMenu { menu, "Window", w }; MenuItem itemNewWindow { windowMenu, "New Window", n; bool NotifySelect(MenuItem selection, Modifiers mods) { ExplorerWindow { }.Create(); return true; } }; IconBag iconBag { //window = guiApp.desktop; window = this; alphaBlend = true; iconNames = [ "<:ecere>emblems/unreadable.png", /* none */ "<:ecere>actions/windowNew.png", /* newWindow */ "<:ecere>actions/goPrevious.png", /* goBack */ "<:ecere>actions/goNext.png", /* goForward */ "<:ecere>actions/goUp.png", /* goUp */ "<:ecere>actions/goHome.png", /* goHome */ ":browse.png", /* browse */ ":panel-tree.png", /* panelTree */ "<:ecere>actions/editFind.png", /* panelSearch */ "<:ecere>emblems/unreadable.png", /* addressBar */ "<:ecere>actions/viewRefresh.png", /* refresh */ ":view-list.png", /* viewList */ ":view-details.png", /* viewDetails */ ":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 */ ]; }; Stacker stack { this; gap = 0; direction = vertical; background = activeBorder; //opacity = 1.0f; anchor = { left = 0, top = 0, right = 0, bottom = 0 }; //moveable = false; }; ToolBar/**/ toolBar { stack, this; iconBag = iconBag; size = { h = 32 }; //moveable = false; void NotifyToolClick(ToolButton button) { ExplorerToolId id = (ExplorerToolId)button.id; switch(id) { case none: break; case newWindow: ExplorerWindow { }.Create(); break; case goBack: case goForward: break; case goUp: { char * path = view.path; char * newPath = new char[strlen(path)]; StripLastDirectory(path, newPath); if(!newPath[0]) { newPath[0] = '/'; newPath[1] = 0; } view.path = newPath; delete newPath; break; } case panelTree: // TODO TOFIX : need to fix Stacker for this to work tree.visible = button.checked; //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; panels.size = { panels.size.w, panels.size.h }; // TOFIX : another Stacker fix needed break; case refresh: if(tree.visible) tree.Refresh(); view.Refresh(); break; case previewPictures: view.previewPictures = button.checked; view.Refresh(); break; case viewList: case viewDetails: case viewIcons: case viewCards: case viewShowcase: //SwitchViews(toolId); view.treeBranches = false; view.Refresh(); break; case viewTree: view.treeBranches = button.checked; view.Refresh(); break; } } }; Window s1 { toolBar, size = { w = 8 } }; ToolButton goBack { toolBar, this, id = ExplorerToolId::goBack }; Window s2 { toolBar, size = { w = 2 } }; ToolButton goForward { toolBar, this, id = ExplorerToolId::goForward }; Window s3 { toolBar, size = { w = 2 } }; ToolButton refresh { toolBar, this, id = ExplorerToolId::refresh }; Window s4 { toolBar, size = { w = 2 } }; ToolButton goHome { toolBar, this, id = ExplorerToolId::goHome }; Window s5 { toolBar, size = { w = 8 } }; PathBox addressBar { toolBar, this; size = { 300, 23 }, id = ExplorerToolId::addressBar; typeExpected = directory; bool OnKeyDown(Key key, unichar ch) { if((SmartKey)key == enter) { // how to make enter effect a modification // how to implement in PathBox } return true; } bool NotifyModified(PathBox pathBox) { view.path = pathBox.path; return true; } }; FlipStacker { toolBar, spring = previous }; Window s6 { toolBar, size = { w = 8 } }; ToolButton goUp { toolBar, this, id = ExplorerToolId::goUp }; Window s7 { toolBar, size = { w = 8 } }; GroupToggleToolButton selectedPanel; GroupToggleToolButton panelTree { toolBar, this, id = ExplorerToolId::panelTree, selected = &selectedPanel, checked = true }; GroupToggleToolButton panelSearch { toolBar, this, id = ExplorerToolId::panelSearch, selected = &selectedPanel }; selectedPanel = panelTree; Window s8 { toolBar, size = { w = 8 } }; OptionToolButton selectedView; OptionToolButton viewList { toolBar, this, id = ExplorerToolId::viewList, selected = &selectedView, checked = true }; OptionToolButton viewDetails { toolBar, this, id = ExplorerToolId::viewDetails, selected = &selectedView }; 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 }; Window s10 { toolBar, size = { w = 8 } }; ToolButton newWindow { toolBar, this, id = ExplorerToolId::newWindow }; Window s11 { toolBar, size = { w = 8 } }; /*void OnDestroy() { iconBag.window = null; delete iconBag; }*/ bool OnLoadGraphics() { iconBag.Load(); return true; } void OnUnloadGraphics() { iconBag.Unload(); } Stacker panels { stack, this; gap = 0; direction = horizontal; background = yellow;//activeBorder; //opacity = 1.0f; anchor.left = 0; anchor.bottom = 0; anchor.right = 0; }; //FlipStacker flipStack { stack, spring = previous }; /*SearchPanel searchPanel { panels, this; };*/ /*Tree*/FileSystemBox tree; /*{ panels, this; size = { w = 240 }; anchor.top = 0; anchor.bottom = 0; navigateFolders = true; treeBranches = true; foldersOnly = true; borderStyle = none; visible = false; };*/ FileSystemBox view { panels, this; anchor.top = 0; anchor.bottom = 0; anchor.right = 0; locationBox = addressBar; navigateFolders = true; borderStyle = none; bool NotifyNodeOpen(FileSystemBox box, FileSystemNode node) { if(node.type.isFile) { char command[MAX_LOCATION]; char * t = node.path; sprintf(command, "ide %s", node.path); ShellOpen(command); } return true; } }; /*ExplorerSearch search { deep, this; visible = false; tabCycle = true; size = Size { 624, 268 }; anchor = Anchor { left = 0, top = 0, bottom = 0 }; }; ExplorerViewSearch results;*/ /*Window viewHolder { 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 /*PreviewArea previewArea { panels, this; };*/ //FlipStacker flipPanels { panels, spring = previous }; /*bool TreeNotifyBranchSelect(ExplorerTree tree, ExplorerFileBranch branch) { if(branch) { char path[MAX_LOCATION]; branch.GetPath(path); toolBar.addressBar.contents = path; view.Load(branch); } return true; }*/ /*bool ViewNotifyItemOpen(ExplorerView view, ExplorerFileItem item) { ExplorerFileBranch branch = tree.branch; if(item && branch) { 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) child.row.collapsed = true; child.EnsureVisible(false); tree.Select(child); } } else { char path[MAX_LOCATION]; branch.GetPath(path); PathCat(path, item.name); ShellOpen(path); } } }*/ /*void SwitchViews(ExplorerToolId viewId) { ExplorerFileBranch branch = tree.branch; view.Destroy(0); switch(viewId) { case viewList: view = ExplorerViewList { parent = viewHolder, master = this }; break; case viewDetails: view = ExplorerViewDetails { parent = viewHolder, master = this }; break; case viewIcons: view = ExplorerViewIcons { parent = viewHolder, master = this }; break; case viewCards: view = ExplorerViewCards { parent = viewHolder, master = this }; break; case viewShowcase: view = ExplorerViewShowcase { parent = viewHolder, master = this }; break; } view.tabCycle = true; view.previewPictures = toolBar.previewPictures.checked; view.anchor = Anchor { left = 0, top = 0, bottom = 0, right = 0 }; view.NotifyItemOpen = ViewNotifyItemOpen; view.Create(); view.Load(branch); lastViewId = viewId; }*/ /*void GoToLocation(char * location) { 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; }*/ /*void SearchLocation(char * location) { GoToLocation(location); search.location.editBox.contents = location; }*/ bool OnPostCreate() { //userMode = true; addressBar.path = view.path; return true; } /*ExplorerWindow() { userMode = false; treeSplit = 300; searchSplit = 200; view = ExplorerViewList { parent = viewHolder, master = this; tabCycle = true; previewPictures = toolBar.previewPictures.checked; anchor = Anchor { left = 0, top = 0, bottom = 0, right = 0 }; NotifyItemOpen = ViewNotifyItemOpen; }; lastViewId = viewList; tree.Load(); view.Load(tree.root); }*/ /*void InitTree() { }*/ /*void InitSearch() { }*/ } //class TreeFileSystemBox : FileSystemBox { }