From: Rejean Loyer Date: Wed, 14 Sep 2011 06:30:49 +0000 (-0400) Subject: explorer: started migration to FileSystemBox based explorer. also using newly migrate... X-Git-Url: http://ecere.com/cgi-bin/gitweb.cgi?p=ede;a=commitdiff_plain;h=36c3b8012682a36987d0cbeb2399fe003cf7622f explorer: started migration to FileSystemBox based explorer. also using newly migrated and updated early toolbar code to sdk/extras/gui/controls/ToolBar.ec --- diff --git a/explorer/explorer.epj b/explorer/explorer.epj index 8fa78f8..0a12173 100644 --- a/explorer/explorer.epj +++ b/explorer/explorer.epj @@ -3,14 +3,11 @@ "ModuleName" : "explorer", "Options" : { "Warnings" : "All", - "MemoryGuard" : false, - "Profile" : false, - "StrictNameSpaces" : false, "TargetType" : "Executable", + "TargetFileName" : "explorer", "Libraries" : [ "ecere" - ], - "Console" : false + ] }, "Configurations" : [ { @@ -20,16 +17,14 @@ "Optimization" : "None", "PreprocessorDefinitions" : [ "_DEBUG" - ], - "TargetFileName" : "explorer" + ] } }, { "Name" : "Release", "Options" : { "Debug" : false, - "Optimization" : "Speed", - "TargetFileName" : "explorer" + "Optimization" : "Speed" } } ], @@ -37,39 +32,55 @@ { "Folder" : "extern", "Files" : [ - + "/sdk/extras/gui/controls/SelectorBar.ec", + "/sdk/extras/gui/controls/ToolBar.ec", + "/sdk/extras/gui/IconBag.ec" ] }, { - "Folder" : "src", + "Folder" : "migration", "Files" : [ - "Explorer.ec", - "ExplorerTree.ec", - "DeleteBox.ec", - "Finder.ec", - "NotificationBox.ec", - "Panels.ec", - "Search.ec" - ] + { + "Folder" : "structures", + "Files" : [ + "src/Structures/ArrayBasic.ec", + "src/Structures/ArrayBinaryIndexed.ec", + "src/Structures/ArrayBinarySorted.ec", + "src/Structures/ArrayFactoredGrowth.ec", + "src/Structures/ArrayNotes.ec", + "src/Structures/ArrayTypes.ec", + "src/Structures/ArrayUtilities.ec", + "src/Structures/Stack.ec", + "src/Structures/Temp.ec" + ] + }, + "src/DeleteBox.ec", + "src/Finder.ec", + "src/NotificationBox.ec", + "src/Panels.ec", + "src/Search.ec" + ], + "Options" : { + "ExcludeFromBuild" : true + } }, { - "Folder" : "outside", + "Folder" : "src", "Files" : [ - "src/SplitWindow.ec", - "src/Structures/ArrayFactoredGrowth.ec", - "src/Structures/ArrayUtilities.ec", - "src/Skin.ec" + "Explorer.ec", + "ExplorerWindow.ec" ] } ], "ResourcesPath" : "res", "Resources" : [ + "browse.png", "panel-tree.png", "view-cards.png", "view-details.png", "view-icons.png", "view-list.png", - "view-showcase-right.png", - "browse.png" + "view-showcase-left.png", + "view-showcase-right.png" ] } \ No newline at end of file diff --git a/explorer/src/Explorer.ec b/explorer/src/Explorer.ec index e1ce565..2f447f8 100644 --- a/explorer/src/Explorer.ec +++ b/explorer/src/Explorer.ec @@ -1,10 +1,10 @@ -public import "ecere" -import "SplitWindow" +import "ecere" +import "EDE" +import "ExplorerWindow" -import "ExplorerTree" // meant to be called ExplorerTools -import "Finder" -import "Search" // meant to be called ExplorerSearch -import "Panels" +//import "Finder" +//import "Search" +//import "Panels" /* #ifdef __WIN32__ @@ -14,510 +14,7 @@ import "Panels" #endif */ -enum ExplorerToolId -{ - none, - newWindow, goBack, goForward, goUp, goHome, - browse, - panelTree, panelSearch, - addressBar, - refreshView, - viewList, viewDetails, viewIcons, viewCards, viewShowcase, viewCustom, - previewPictures -}; - -static char * toolIconNames[] = -{ - "<: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", /* refreshView */ - - ":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 */ - - "" -}; - -class ToolButton : Button -{ - size = Size { 24, 24 }; - - property int toolId - { - set - { - bitmap = BitmapResource { fileName = toolIconNames[value], alphaBlend = true }; - id = value; - } - } - - bool TestToolBar::NotifyClicked(ToolButton button, int x, int y, Modifiers mods) - { - NotifyToolClick(this.parent, this, button.id); - return true; - } -} - -class ToggleToolButton : ToolButton -{ - toggle = true; - size = Size { 24, 24 }; - - bool TestToolBar::NotifyClicked(ToggleToolButton button, int x, int y, Modifiers mods) - { - NotifyToolClick(this.parent, this, button.id); - return true; - } -} - -class GroupToggleToolButton : ToolButton -{ - toggle = true; - size = Size { 24, 24 }; - GroupToggleToolButton * selected; - bool TestToolBar::NotifyClicked(GroupToggleToolButton button, int x, int y, Modifiers mods) - { - bool configured = (bool)button.selected; - bool preselection = (configured && (*button.selected)); - bool reclick = preselection ? (*button.selected == button) : false; - if(configured && preselection && !reclick) - { - (*button.selected).checked = false; - *button.selected = button; - } - NotifyToolClick(this.parent, this, button.id); - return true; - } -} - -class OptionToolButton : ToolButton -{ - toggle = true; - size = Size { 24, 24 }; - OptionToolButton * selected; - bool TestToolBar::NotifyClicked(OptionToolButton button, int x, int y, Modifiers mods) - { - bool configured = (bool)button.selected; - bool preselection = (configured && (*button.selected)); - bool reclick = preselection ? (*button.selected == button) : false; - if(configured && !preselection) - *button.selected = button; - else if(configured && !reclick) - { - (*button.selected).checked = false; - *button.selected = button; - } - button.checked = true; - if(!reclick) - NotifyToolClick(this.parent, this, button.id); - return true; - } -} - -class TestToolBar : Window -{ - int xL, xR; - - borderStyle = bevel; - inactive = true; - background = activeBorder; - size = Size { h = 32 }; - anchor = Anchor { left = 0, top = 0, right = 0 }; - - virtual void Window::NotifyToolClick(TestToolBar toolBar, int id); - - xL = 0; - - ToolButton newWindow { this, anchor = { left = (xL += 20) }, toolId = ExplorerToolId::newWindow }; - - ToolButton goBack { this, anchor = { left = (xL += 46) }, toolId = ExplorerToolId::goBack }; - ToolButton goForward { this, anchor = { left = (xL += 26) }, toolId = ExplorerToolId::goForward }; - ToolButton goUp { this, anchor = { left = (xL += 30) }, toolId = ExplorerToolId::goUp }; - ToolButton goHome { this, anchor = { left = (xL += 30) }, toolId = ExplorerToolId::goHome }; - - GroupToggleToolButton panelTree { this, anchor = { left = (xL += 46) }, toolId = ExplorerToolId::panelTree, selected = &selectedPanel, checked = true }; - GroupToggleToolButton panelSearch { this, anchor = { left = (xL += 26) }, toolId = ExplorerToolId::panelSearch, selected = &selectedPanel }; - GroupToggleToolButton selectedPanel; - selectedPanel = panelTree; - - xR = 0; - - OptionToolButton viewList { this, anchor = { right = (xR += 20) }, toolId = ExplorerToolId::viewList, selected = &selectedView, checked = true }; - OptionToolButton viewDetails { this, anchor = { right = (xR += 26) }, toolId = ExplorerToolId::viewDetails, selected = &selectedView }; - OptionToolButton viewIcons { this, anchor = { right = (xR += 26) }, toolId = ExplorerToolId::viewIcons, selected = &selectedView }; - OptionToolButton viewTiles { this, anchor = { right = (xR += 26) }, toolId = ExplorerToolId::viewCards, selected = &selectedView }; - OptionToolButton viewShowcase { this, anchor = { right = (xR += 26) }, toolId = ExplorerToolId::viewShowcase, selected = &selectedView }; - OptionToolButton selectedView; - selectedView = viewList; - - ToggleToolButton previewPictures { this, anchor = { right = (xR += 46) }, toolId = ExplorerToolId::previewPictures }; - - ToolButton refreshView { this, anchor = { right = (xR += 46) }, toolId = ExplorerToolId::refreshView }; - - EditBox addressBar - { - this, master; - size = { w = 250 }, anchor = { left = (xL += 30), right = (xR += 30) }, id = ExplorerToolId::addressBar; - }; - - /*DropBox tileSet - { - this, - anchor = { left = (xPos += 88) }; - inactive = true; - - bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods) - { - return true; - } - };*/ - - TestToolBar() - { - /*tileSet.AddString("Forest").tag = 0; - tileSet.AddString("Winter").tag = 0; - tileSet.AddString("Wasteland").tag = 0;*/ - } -}; - -class ExplorerWindow : Window -{ - text = "Ecere Explorer"; - background = activeBorder; - borderStyle = sizable; - hasMaximize = true; - hasMinimize = true; - hasClose = true; - hasMenuBar = true; - tabCycle = true; - size = Size { 888, 840 }; - - bool userMode; - bool clipboard; - - int treeSplit; - int searchSplit; - - ExplorerToolId lastViewId; - - menu = Menu { }; - - Menu fileMenu { menu, "File", f }; - Menu windowMenu { menu, "Window", w }; - MenuItem newWindow - { - windowMenu, "New Window", n; - - bool NotifySelect(MenuItem selection, Modifiers mods) - { - ExplorerWindow { }.Create(); - return true; - } - }; - - TestToolBar toolBar - { - this; - - void NotifyToolClick(TestToolBar toolBar, int id) - { - ExplorerToolId toolId = (ExplorerToolId)id; - switch(toolId) - { - case none: - break; - case newWindow: - ExplorerWindow { }.Create(); - break; - case goBack: - case goForward: - break; - case goUp: - { - ExplorerFileBranch branch = tree.branch; - if(branch && branch.parent) - tree.Select(branch.parent); - break; - } - case panelTree: - if(tree.visible) - { - split.leftPane = null; - split.visible = false; - tree.visible = false; - treeSplit = split.split; - split.OnResize(split.size.w, split.size.h); - } - else - { - if(search.visible) - { - search.visible = false; - searchSplit = split.split; - } - tree.visible = true; - split.leftPane = tree; - split.visible = true; - split.split = treeSplit; - split.OnResize(split.size.w, split.size.h); - SwitchViews(lastViewId); - } - break; - case panelSearch: - if(search.visible) - { - split.leftPane = null; - split.visible = false; - search.visible = false; - searchSplit = split.split; - split.OnResize(split.size.w, split.size.h); - SwitchViews(lastViewId); - } - else - { - if(tree.visible) - { - tree.visible = false; - treeSplit = split.split; - } - search.visible = true; - split.leftPane = search; - split.visible = true; - split.split = searchSplit; - - view = ExplorerSearchViewTree { viewHolder, this }; - view.previewPictures = toolBar.previewPictures.checked; - view.anchor = Anchor { left = 0, top = 0, bottom = 0, right = 0 }; - view.NotifyItemOpen = ViewNotifyItemOpen; - view.Create(); - search.view = (ExplorerSearchViewTree)view; - - split.OnResize(split.size.w, split.size.h); - } - break; - case refreshView: - if(view) - view.Refresh(); - break; - case previewPictures: - if(view) - view.previewPictures = toolBar.previewPictures.checked; - break; - case viewList: - case viewDetails: - case viewIcons: - case viewCards: - case viewShowcase: - SwitchViews(toolId); - break; - } - } - }; - - 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; - } - - Window deep - { - this; - borderStyle = deep; - tabCycle = true; - anchor = Anchor { left = 0, top = 34, right = 0, bottom = 0 }; - }; - - ExplorerTree tree - { - deep, this; - //visible = false; - tabCycle = true; - size = Size { 624, 268 }; - anchor = Anchor { left = 0, top = 0, bottom = 0 }; - text = "Browser", hotKey = Key { e, alt = true }; - NotifyBranchSelect = TreeNotifyBranchSelect; - }; - - ExplorerView view; - - ExplorerSearch search - { - deep, this; - visible = false; - tabCycle = true; - size = Size { 624, 268 }; - anchor = Anchor { left = 0, top = 0, bottom = 0 }; - }; - - ExplorerViewSearch results; - - 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); - } - } - } - - 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; - }; - - 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; - 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 ExplorerApp : GuiApplication +class Explorer : GuiApplication { //skin = "Acovel"; @@ -564,13 +61,13 @@ class ExplorerApp : GuiApplication { ExplorerWindow explorerWnd { }; explorerWnd.Create(); - explorerWnd.GoToLocation(goPath); + //explorerWnd.GoToLocation(goPath); } else if(searchPath) { ExplorerWindow explorerWnd { }; explorerWnd.Create(); - explorerWnd.SearchLocation(searchPath); + //explorerWnd.SearchLocation(searchPath); } return true; } @@ -621,4 +118,4 @@ struct QuickPathTool property bool { get { return (bool)path[0]; } } }; -define app = ((ExplorerApp)__thisModule); +define app = ((Explorer)__thisModule); diff --git a/explorer/src/ExplorerWindow.ec b/explorer/src/ExplorerWindow.ec index 5a5b37f..bdfe373 100644 --- a/explorer/src/ExplorerWindow.ec +++ b/explorer/src/ExplorerWindow.ec @@ -1,58 +1,451 @@ -public import "ecere" +import "Explorer" +import "IconBag" +import "ToolBar" -private: -define guiApp = ((GuiApplication)__thisModule); -define selectionColor = guiApp.currentSkin.selectionColor; //Color { 10, 36, 106 }; - -static char * iconNames[] = +enum ExplorerToolId { - "<:ecere>tango/16x16/mimetypes/file-x-generic.png", /*none*/ - - "<:ecere>tango/16x16/mimetypes/file-x-generic.png", /*normalFile*/ - "<:ecere>tango/16x16/mimetypes/text-ews-work.png", /*ewsFile*/ - "<:ecere>tango/16x16/mimetypes/text-epj-assembly.png", /*epjFile*/ - "<:ecere>tango/16x16/mimetypes/text-ec-source.png", /*ecFile*/ - "<:ecere>tango/16x16/mimetypes/text-eh-header.png", /*ehFile*/ - "<:ecere>tango/16x16/mimetypes/text-c-source.png", /*cFile*/ - "<:ecere>tango/16x16/mimetypes/text-h-header.png", /*hFile*/ - "<:ecere>tango/16x16/mimetypes/text-cpp-source.png", /*cppFile*/ - "<:ecere>tango/16x16/mimetypes/text-hpp-header.png", /*hppFile*/ - "<:ecere>tango/16x16/mimetypes/text-x-generic.png", /*textFile*/ - "<:ecere>tango/16x16/mimetypes/text-html.png", /*webFile*/ - "<:ecere>tango/16x16/mimetypes/image-x-generic.png", /*pictureFile*/ - "<:ecere>tango/16x16/status/audio-volume-high.png", /*soundFile*/ - "<:ecere>tango/16x16/mimetypes/package-x-generic.png", /*archiveFile*/ - "<:ecere>tango/16x16/mimetypes/package-x-software.png", /*packageFile*/ - "<:ecere>tango/16x16/mimetypes/package-x-optical-disc.png", /*opticalMediaImageFile*/ - - "<:ecere>tango/16x16/places/folder.png", - "<:ecere>tango/16x16/status/folder-open.png", - "<:ecere>tango/16x16/devices/computer.png", - "<:ecere>tango/16x16/devices/drive-harddisk.png", - "<:ecere>tango/16x16/places/folder-remote.png", - "<:ecere>tango/16x16/devices/media-optical.png", - "<:ecere>tango/16x16/devices/drive-removable-media.png", - "<:ecere>tango/16x16/devices/media-floppy.png", - "<:ecere>tango/16x16/places/network-workgroup.png", - "<:ecere>tango/16x16/places/network-server.png", - "<:ecere>tango/16x16/places/folder-remote.png", - - "<:ecere>tango/16x16/mimetypes/package-x-generic.png", /*treeLoader*/ - "<:ecere>tango/16x16/places/start-here.png" /*lineNumbers*/ + none, + newWindow, goBack, goForward, goUp, goHome, + browse, + panelTree, panelSearch, + addressBar, + refresh, + viewList, viewDetails, viewIcons, viewCards, viewShowcase, viewCustom, + previewPictures }; -public class FileSystemToolWindow : public Window +class ExplorerWindow : Window { - BitmapResource icons[FileItemType]; + 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 newWindow + { + 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 */ + ":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); + 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; + }; + + /*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); - FileSystemToolWindow() + 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) { - FileItemType c; - for(c = 0; c < FileItemType::enumSize; c++) + int c; + char * temp; + char step[MAX_LOCATION]; + + StringArray steps { growingFactor = 4 }; + ExplorerFileBranch last = null; + + temp = CopyString(location); + while(strlen(temp)) { - icons[c] = BitmapResource { iconNames[c], alphaBlend = true }; - AddResource(icons[c]); + 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 { }