From 33c13de8443ab96bef32fd87529d0105447f12c0 Mon Sep 17 00:00:00 2001 From: Rejean Loyer Date: Sat, 10 Sep 2011 03:36:11 -0400 Subject: [PATCH] explorer: introducing new explorer based on ede::FileSystemBox --- newexplorer/explorer.epj | 59 +++++++++ newexplorer/res/browse.png | Bin 0 -> 593 bytes newexplorer/res/panel-tree.png | Bin 0 -> 261 bytes newexplorer/res/view-cards.png | Bin 0 -> 293 bytes newexplorer/res/view-details.png | Bin 0 -> 279 bytes newexplorer/res/view-icons.png | Bin 0 -> 372 bytes newexplorer/res/view-list.png | Bin 0 -> 239 bytes newexplorer/res/view-showcase-left.png | Bin 0 -> 542 bytes newexplorer/res/view-showcase-right.png | Bin 0 -> 537 bytes newexplorer/src/Explorer.ec | 107 ++++++++++++++++ newexplorer/src/ExplorerWindow.ec | 208 ++++++++++++++++++++++++++++++++ 11 files changed, 374 insertions(+) create mode 100644 newexplorer/explorer.epj create mode 100644 newexplorer/res/browse.png create mode 100644 newexplorer/res/panel-tree.png create mode 100644 newexplorer/res/view-cards.png create mode 100644 newexplorer/res/view-details.png create mode 100644 newexplorer/res/view-icons.png create mode 100644 newexplorer/res/view-list.png create mode 100644 newexplorer/res/view-showcase-left.png create mode 100644 newexplorer/res/view-showcase-right.png create mode 100644 newexplorer/src/Explorer.ec create mode 100644 newexplorer/src/ExplorerWindow.ec diff --git a/newexplorer/explorer.epj b/newexplorer/explorer.epj new file mode 100644 index 0000000..1b4ddf3 --- /dev/null +++ b/newexplorer/explorer.epj @@ -0,0 +1,59 @@ +{ + "Version" : 0.2, + "ModuleName" : "explorer", + "Options" : { + "Warnings" : "All", + "TargetType" : "Executable", + "TargetFileName" : "explorer", + "Libraries" : [ + "ecere" + ] + }, + "Configurations" : [ + { + "Name" : "Debug", + "Options" : { + "Debug" : true, + "Optimization" : "None", + "PreprocessorDefinitions" : [ + "_DEBUG" + ] + } + }, + { + "Name" : "Release", + "Options" : { + "Debug" : false, + "Optimization" : "Speed" + } + } + ], + "Files" : [ + { + "Folder" : "extern", + "Files" : [ + "../../../sdk/extras/gui/controls/SelectorBar.ec", + "../../../sdk/extras/gui/controls/ToolBar.ec", + "../../../sdk/extras/gui/IconBag.ec" + ] + }, + { + "Folder" : "src", + "Files" : [ + "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-left.png", + "view-showcase-right.png" + ] +} \ No newline at end of file diff --git a/newexplorer/res/browse.png b/newexplorer/res/browse.png new file mode 100644 index 0000000000000000000000000000000000000000..f22798915f02ecb32493106d5405febe0e8365f9 GIT binary patch literal 593 zcmV-X0Px#1ZP1_K>z@;j|==^1poj5AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy32;bRa{vGh)&Kwv)&Y=jd7JN2bPDNB8b~7$9Fmkdbk^le!gGod|R5(v#3=I!9l#q}x zVn74Ge*FTA{QCLp==^yLZ=lP=`MLSo$>+|U!-|g`JDQxFnwSiaFE2M+8{o;H0d zP7E{vWC$|0KykszlP8mxEn7wqFJHbqdButqV1wWWq-UlkgIthUH7nU9bqPt>Eq6`` z1IPf73qYEW-FTh6@6rpRFi0&(57+>Z3qYK8#~&y6Y`j4f2B`%b5T6(ec7atf%YPUK z8A6B;HvkkMAQyl%9K632YzWK%e0&rGsNw=r!k}~Awd7@o9zenXKm^fU>#rww02Q~czM9;y;&O7;l1s_O3(hC!%{`YqW9J=&0iZC5D4U%;d-vVs zf_dkX3+6%;<;^*loD0M`v(F`G&pw-+HS1h*=FGFn89+Q`+iipaD_5^f?gZKfQj|Rl zr0^_6;f%A%X*13wrvmBJ>1UEtrkzPno_Z#E)~!lvI6;>1s;*b zK=o%pn6Zg}(Jr7Mdx@v7EBiG@ZaxOxwUfJIfI<=_t`Q}{`DrEPiAAXl0g0J;C3=3Y zAqr*2dWHr?n^Y$O)f9NTIEGmGZ=HOR4``|D&;R{=7q4CNP0RTxU}+uLx#G(~VF}X{ zUng&7>X|4X9pI7lwphGk#{00TGar>KR^51&HGI8P_Toa$mLt19zW68LaxGqF$6XI= zhr2rqC#e5;dcZDN&CA*$|Ix976BYiLobYDu%)8;XDK<6$Xg7nWtDnm{r-UW|v!lvI6;>1s;*b zK=r3VnDK%)%Tb^pdx@v7EBiG@ZaxOxwUfJIfI<=_t`Q}{`DrEPiAAXl0g0J;C3=3Y zAqr*2dWHr?n^Y$O)lBeoaSXBWPyX}&zdf_a0Z9W!CKKfdxfBM0W|PS+j#US4CCpmL zRPgHl{{R2)*Z%$g|K98W|Ige0`CtG3>;M1P=l=d*|8C;{|JCJ=IxMeU%^M~hyVd*u z|8u?LNemmM9zXm0pZ}1A-hrnfGkOhrZ}2Rz5O`?VC^v!SM?$T^*$E1&ybB~8f}|Q) jA7ofLs61`-WoKaP+yDN^n-9%Ew=sCS`njxgN@xNArV4SK literal 0 HcmV?d00001 diff --git a/newexplorer/res/view-details.png b/newexplorer/res/view-details.png new file mode 100644 index 0000000000000000000000000000000000000000..0a52090f0b615ac89fcd8cc382c9dc5e5bcc7a75 GIT binary patch literal 279 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b zK=o%qm@&Y^Ar2_WUgGKN%6^TJn~yAywdF`1h%74J(*-FMJ@&CaHBQ z)YxLttsDD|Uid0zO)xb2>#(p!^3jwko|v~eQ~$1Cd@!zDp?z}Tukhzukq6{^f|phc TSvxZVUBlq%>gTe~DWM4fsk&iA literal 0 HcmV?d00001 diff --git a/newexplorer/res/view-icons.png b/newexplorer/res/view-icons.png new file mode 100644 index 0000000000000000000000000000000000000000..334c5189ce21ecda21452d36cc0ad61fc2ee9f20 GIT binary patch literal 372 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b zK=r3VnDK%)%Tb^pdx@v7EBiG@ZaxOxwUfJIfI<=_t`Q}{`DrEPiAAXl0g0J;C3=3Y zAqr*2dWHr?n^Y$O)!g@VaSXBWUm9e{#bhY(#V+eTdrgD<2gatkHzMNFm2YsGm0iEd zQP$M^^o7dJy}s|haY#gX7)`!;_MHhsTINf&xzdbkg&p(j{5;4$~#UlIISwSpD#Q-by!>)zLD2lOg~ Mr>mdKI;Vst0Om!GS^xk5 literal 0 HcmV?d00001 diff --git a/newexplorer/res/view-list.png b/newexplorer/res/view-list.png new file mode 100644 index 0000000000000000000000000000000000000000..43dddab2478a0bfbb664173b7b7828faf0244b3c GIT binary patch literal 239 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b zK=o%pn6Zg}(Jr7Mdx@v7EBiG@ZaxOxwUfJIfI<=_t`Q}{`DrEPiAAXl0g0J;C3=3Y zAqr*2dWHr?n^Y$O)kJx^IEGmGC;$2X-=5i(A%#JR&1fT2im679$XSQ!4Re|s7rG^x zvcw8Z=XQ9+!h0ag`i$$27{_Yy2cPXN*xG$`Cd}vS;A0LbIyRl7&CTk7WWbI&{kpOf bayS@D^Y+KBs1Mr;w1vUb)z4*}Q$iB}x93Kj literal 0 HcmV?d00001 diff --git a/newexplorer/res/view-showcase-left.png b/newexplorer/res/view-showcase-left.png new file mode 100644 index 0000000000000000000000000000000000000000..c3e85dec4e1798e94b2e2632dcd4215a07a46788 GIT binary patch literal 542 zcmV+(0^$9MP)q`}35C(A1KU!a+ zK12jXK@>_66k$;iQ51@HQS7FfnwFU6wGuV$Vw#C|@luvWiADW-&#_(4IW4ulFzmat z^UOXo^GpUMzfXLL97WGeLR_XKn;=*g{8!7y6vyS>Bj<(+BHLKWmh)_{W%m_I8`gf1 zaMrxpj}drtHQQ>~6@dHdIoL#b>w1EGrUeW(Rk8IFJL}kcodY*Ha*Gq~oas!#U`GJ% zxyJrR4!3ap4yW%@*+b3!LIzPga^#~D%5HF|nPay(6@V4pTpZx)AWe@F8RP~KCpg;1 z$qvrl<3c}|AJRBN+he+(|Jj3hC=r9RT~zl`7k~}Jv<6`3IQ>%$&!p%e#hK0AHJ~iZC!i+RN~7}=i84g1>o0Je*7#HZj>NNiT|@q#S4+sLA;Sk g+mh$YkB#rY06Ct|nEqxMO8@`>07*qoM6N<$f=bos7XSbN literal 0 HcmV?d00001 diff --git a/newexplorer/res/view-showcase-right.png b/newexplorer/res/view-showcase-right.png new file mode 100644 index 0000000000000000000000000000000000000000..721e70555128696769bfeef17574d06be9e30a6d GIT binary patch literal 537 zcmV+!0_OdRP)q}KZ6a{eoNApY6 zhmfEs2qQ6qA}R_Zj6_K*#a^1Jsfmx&)D$)CVVa5dFfGfX#G-!9QSbG1xYB80pP4hW z*V=3E*^`gFFxEetBY$&_@5PQ2et{rz%v$uH+>4)Q)>*dN4(M$E<_6o8o72n}_6KC4E5P;=9Tpi%%FpZD5sX_b( zPPcNtgR%!)>F4?o4P&%Eq5DOO8eHn8@*%YWSU*Zj0Cr8%Kf~x;id(1&dDe~4JVD2E z`d%^;fKT5tvy?(X(>U$V=$&SGmWek^FEYQ(($^F<=$YbC0FJ+A>OFHGS^UDvDr-Me zC>Wb(a)H?oEUfV98>>III_969_$uW2?la2)_ 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); diff --git a/newexplorer/src/ExplorerWindow.ec b/newexplorer/src/ExplorerWindow.ec new file mode 100644 index 0000000..0bd9c17 --- /dev/null +++ b/newexplorer/src/ExplorerWindow.ec @@ -0,0 +1,208 @@ +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 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 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; + } +} -- 1.8.3.1