--- /dev/null
+import "ecere"
+import "EDE"
+import "ExplorerWindow"
+
+class Explorer : GuiApplication
+{
+ bool Init()
+ {
+ QuickPathTool goPath { };
+ QuickPathTool searchPath { };
+ char * findWhat = null;
+ SetLoggingMode(debug, null);
+ if(argc > 1)
+ {
+ if(!strcmpi(argv[1], "go") && argc > 2)
+ goPath = argv[2];
+ else if(!strcmpi(argv[1], "find") && argc > 2)
+ {
+ char * unquoted;
+ if(argv[2][0] == '\"')
+ StripQuotes(argv[2], unquoted);
+ else
+ unquoted = argv[2];
+ findWhat = CopyString(unquoted);
+ if(argc > 3)
+ {
+ if(!strcmpi(argv[3], "in") && argc > 4)
+ searchPath = argv[4];
+ else
+ searchPath = ""; // this should make it current dir
+ }
+ else
+ searchPath = ""; // same
+ }
+ else if(!strcmpi(argv[1], "search") && argc > 2)
+ searchPath = argv[2];
+ else if(!strcmpi(argv[1], "image") && argc > 2)
+ ;
+ else if(!strcmpi(argv[1], "slides") && argc > 2)
+ ;
+ else
+ goPath = argv[1];
+ }
+ else
+ goPath = "";
+ if(goPath)
+ {
+ ExplorerWindow explorerWnd { };
+ explorerWnd.Create();
+ //explorerWnd.GoToLocation(goPath);
+ }
+ else if(searchPath)
+ {
+ ExplorerWindow explorerWnd { };
+ explorerWnd.Create();
+ //explorerWnd.SearchLocation(searchPath);
+ }
+ return true;
+ }
+}
+
+struct QuickPathTool
+{
+ char path[MAX_LOCATION];
+
+ property char *
+ {
+ set
+ {
+ char * unquoted;
+ GetWorkingDir(path, MAX_LOCATION);
+ if(value[0] == '\"')
+ StripQuotes(value, unquoted);
+ else
+ unquoted = value;
+ PathCat(path, unquoted);
+ if(!FileExists(path))
+ {
+ // this incomplete functionality is not quite at it's place in this class
+ int len;
+ char * original = CopyString(path);
+ while((len = strlen(path)))
+ {
+ StripLastDirectory(path, path);
+ if(FileExists(path))
+ {
+ // TODO: message location does not exist,
+ // this higher location exists though
+ // go there?
+ break;
+ }
+ }
+ if(!len)
+ {
+ // TODO: message location does not exist,
+ // unable to select alternate location
+ }
+ path[0] = '\0';
+ delete original;
+ }
+ }
+ get { return path[0] ? path : null; }
+ }
+ property bool { get { return (bool)path[0]; } }
+};
+
+define app = ((Explorer)__thisModule);
--- /dev/null
+import "Explorer"
+import "IconBag"
+import "ToolBar"
+
+enum ExplorerToolId
+{
+ none,
+ newWindow, goBack, goForward, goUp, goHome,
+ browse,
+ panelTree, panelSearch,
+ addressBar,
+ refreshView,
+ 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 };
+ nativeDecorations = true;
+
+ IconBag<ExplorerToolId> 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", /* 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 */
+ ];
+ };
+
+ Stacker stack
+ {
+ this;
+ gap = 0;
+ direction = vertical;
+ background = activeBorder;
+ //opacity = 1.0f;
+
+ anchor = { left = 0, top = 0, right = 0, bottom = 0 };
+ //moveable = false;
+ };
+
+ ToolBar<ExplorerToolId> toolBar
+ {
+ stack, this;
+ iconBag = iconBag;
+ size = { h = 32 };
+ //moveable = false;
+ };
+
+ 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 refreshView
+ {
+ toolBar, this, id = ExplorerToolId::refreshView;
+
+ bool NotifyClicked(Button button, int x, int y, Modifiers mods)
+ {
+ fsb.Refresh();
+ return true;
+ }
+ };
+ 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)
+ {
+ fsb.path = pathBox.path;
+ return true;
+ }
+ };
+ Window s6 { toolBar, size = { w = 8 } };
+ ToolButton goUp
+ {
+ toolBar, this, id = ExplorerToolId::goUp;
+
+ bool NotifyClicked(Button button, int x, int y, Modifiers mods)
+ {
+ char * path = fsb.path;
+ char * newPath = new char[strlen(path)];
+ StripLastDirectory(path, newPath);
+ fsb.path = newPath;
+ delete newPath;
+ return true;
+ }
+ };
+ 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;
+
+ bool NotifyClicked(Button button, int x, int y, Modifiers mods)
+ {
+ fsb.previewPictures = button.checked;
+ return true;
+ }
+ };
+
+ Window s10 { toolBar, size = { w = 8 } };
+ ToolButton newWindow
+ {
+ toolBar, this, id = ExplorerToolId::newWindow;
+
+ bool NotifyClicked(Button button, int x, int y, Modifiers mods)
+ {
+ ExplorerWindow { }.Create();
+ return true;
+ }
+ };
+
+ /*void OnDestroy()
+ {
+ iconBag.window = null;
+ delete iconBag;
+ }*/
+
+ bool OnLoadGraphics()
+ {
+ iconBag.Load();
+ return true;
+ }
+
+ void OnUnloadGraphics()
+ {
+ iconBag.Unload();
+ }
+
+ FileSystemBox fsb
+ {
+ stack, this;
+ //anchor = { left = 0, top = 4, right = 0, bottom = 0 };
+ anchor.left = 0;
+ anchor.bottom = 0;
+ anchor.right = 0;
+ locationBox = addressBar;
+ navigateFolders = true;
+ };
+
+ bool OnPostCreate()
+ {
+ addressBar.path = fsb.path;
+ return true;
+ }
+}