import "Explorer" import "IconBag" import "ToolBar" enum ExplorerToolId { none, newWindow, goBack, goForward, goUp, goHome, browse, panelTree, panelSearch, addressBar, refresh, viewList, viewDetails, viewIcons, viewCards, viewShowcase, viewCustom, previewPictures }; class ExplorerWindow : Window { text = "Ecere Explorer"; background = activeBorder; borderStyle = sizable; hasMaximize = true; hasMinimize = true; hasClose = true; size = { 840, 480 }; minClientSize = { 600, 300 }; nativeDecorations = 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 */ ":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); 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 }; 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; }; // Preview / Showcase /*PreviewArea previewArea { panels, this; };*/ //FlipStacker flipPanels { panels, spring = previous }; bool OnPostCreate() { addressBar.path = view.path; return true; } } //class TreeFileSystemBox : FileSystemBox { }