8 newWindow, goBack, goForward, goUp, goHome,
10 panelTree, panelSearch,
13 viewList, viewDetails, viewIcons, viewCards, viewShowcase, viewTree, viewCustom,
17 class ExplorerWindow : Window
20 text = "Ecere Explorer (Debug)";
22 text = "Ecere Explorer";
24 background = activeBorder;
25 borderStyle = sizable;
32 minClientSize = { 600, 300 };
33 nativeDecorations = true;
42 ExplorerToolId lastViewId;
47 Menu fileMenu { menu, "File", f };
48 Menu windowMenu { menu, "Window", w };
49 MenuItem itemNewWindow
51 windowMenu, "New Window", n;
53 bool NotifySelect(MenuItem selection, Modifiers mods)
55 ExplorerWindow { }.Create();
60 IconBag<ExplorerToolId> iconBag
62 //window = guiApp.desktop;
67 "<:ecere>emblems/unreadable.png", /* none */
69 "<:ecere>actions/windowNew.png", /* newWindow */
70 "<:ecere>actions/goPrevious.png", /* goBack */
71 "<:ecere>actions/goNext.png", /* goForward */
72 "<:ecere>actions/goUp.png", /* goUp */
73 "<:ecere>actions/goHome.png", /* goHome */
75 ":browse.png", /* browse */
77 ":panel-tree.png", /* panelTree */
78 "<:ecere>actions/editFind.png", /* panelSearch */
80 "<:ecere>emblems/unreadable.png", /* addressBar */
82 "<:ecere>actions/viewRefresh.png", /* refresh */
84 ":view-list.png", /* viewList */
85 ":view-details.png", /* viewDetails */
86 ":view-icons.png", /* viewIcons */
87 ":view-cards.png", /* viewCards */
88 ":view-showcase-right.png", /* viewShowcase */
89 ":panel-tree.png", /* viewTree */
90 ":view-custom.png", /* viewCustom */
92 "<:ecere>mimeTypes/image.png" /* previewPictures */
100 direction = vertical;
101 background = activeBorder;
104 anchor = { left = 0, top = 0, right = 0, bottom = 0 };
108 ToolBar/*<ExplorerToolId>*/ toolBar
115 void NotifyToolClick(ToolButton button)
117 ExplorerToolId id = (ExplorerToolId)button.id;
123 ExplorerWindow { }.Create();
130 char * home = getenv("HOME");
131 if(home && home[0] && FileExists(home).isDirectory)
132 GoToLocation(home, false, false);
137 char * path = view.path;
138 char * newPath = new char[strlen(path)+1];
139 StripLastDirectory(path, newPath);
145 GoToLocation(newPath, false, false);
150 // TODO TOFIX : need to fix Stacker for this to work
151 tree.visible = button.checked;
152 split.visible = button.checked;
155 split.rightPane = view;
156 view.anchor = { top = 0, bottom = 0, right = 0 };
157 tree.SelectLocation(view.path);
161 split.rightPane = null;
162 view.anchor = { left = 0, top = 0, bottom = 0, right = 0 };
164 //search.visible = !button.checked;
165 panels.size = { panels.size.w, panels.size.h }; // TOFIX : another Stacker fix needed
168 // TODO TOFIX : need to fix Stacker for this to work
169 //search.visible = button.checked;
170 tree.visible = false; //!button.checked;
171 split.visible = false; //!button.checked;
172 if(false/*button.checked*/)
174 split.rightPane = view;
175 view.anchor = { top = 0, bottom = 0, right = 0 };
179 split.rightPane = null;
180 view.anchor = { left = 0, top = 0, bottom = 0, right = 0 };
182 panels.size = { panels.size.w, panels.size.h }; // TOFIX : another Stacker fix needed
189 case previewPictures:
190 view.previewPictures = button.checked;
198 //SwitchViews(toolId);
199 view.treeBranches = false;
203 view.treeBranches = button.checked;
210 Window s1 { toolBar, size = { w = 8 } };
211 ToolButton goBack { toolBar, this, id = ExplorerToolId::goBack };
212 Window s2 { toolBar, size = { w = 2 } };
213 ToolButton goForward { toolBar, this, id = ExplorerToolId::goForward };
214 Window s3 { toolBar, size = { w = 2 } };
215 ToolButton refresh { toolBar, this, id = ExplorerToolId::refresh };
216 Window s4 { toolBar, size = { w = 2 } };
217 ToolButton goHome { toolBar, this, id = ExplorerToolId::goHome };
218 Window s5 { toolBar, size = { w = 8 } };
222 size = { 300, 23 }, id = ExplorerToolId::addressBar;
223 typeExpected = directory;
225 bool OnKeyDown(Key key, unichar ch)
227 if((SmartKey)key == enter)
229 // how to make enter effect a modification
230 // how to implement in PathBox
235 bool NotifyModified(PathBox pathBox)
237 GoToLocation(pathBox.path, false, false);
241 FlipStacker { toolBar, spring = previous };
242 Window s6 { toolBar, size = { w = 8 } };
243 ToolButton goUp { toolBar, this, id = ExplorerToolId::goUp };
244 Window s7 { toolBar, size = { w = 8 } };
245 GroupToggleToolButton selectedPanel;
246 GroupToggleToolButton panelTree { toolBar, this, id = ExplorerToolId::panelTree, selected = &selectedPanel, checked = true };
247 GroupToggleToolButton panelSearch { toolBar, this, id = ExplorerToolId::panelSearch, selected = &selectedPanel };
248 selectedPanel = panelTree;
249 Window s8 { toolBar, size = { w = 8 } };
250 OptionToolButton selectedView;
251 OptionToolButton viewList { toolBar, this, id = ExplorerToolId::viewList, selected = &selectedView, checked = true };
252 OptionToolButton viewDetails { toolBar, this, id = ExplorerToolId::viewDetails, selected = &selectedView };
253 OptionToolButton viewIcons { toolBar, this, id = ExplorerToolId::viewIcons, selected = &selectedView };
254 OptionToolButton viewTiles { toolBar, this, id = ExplorerToolId::viewCards, selected = &selectedView };
255 OptionToolButton viewShowcase { toolBar, this, id = ExplorerToolId::viewShowcase, selected = &selectedView };
256 OptionToolButton viewTree { toolBar, this, id = ExplorerToolId::viewTree, selected = &selectedView };
257 selectedView = viewList;
258 Window s9 { toolBar, size = { w = 8 } };
259 ToggleToolButton previewPictures { toolBar, this, id = ExplorerToolId::previewPictures };
261 Window s10 { toolBar, size = { w = 8 } };
262 ToolButton newWindow { toolBar, this, id = ExplorerToolId::newWindow };
263 Window s11 { toolBar, size = { w = 8 } };
267 iconBag.window = null;
271 bool OnLoadGraphics()
277 void OnUnloadGraphics()
286 direction = horizontal;
287 background = yellow;//activeBorder;
295 //FlipStacker flipStack { stack, spring = previous };
297 /*SearchPanel searchPanel
311 /*Tree*/FileSystemBox tree//;
319 anchor = { left = 0, top = 0, bottom = 0 };
325 bool NotifyNodeSelect(FileSystemBox box, FileSystemNode node)
327 char p[MAX_LOCATION];
329 GoToLocation(node.path, false, true);
338 leftPane = tree;//, rightPane = view;
349 anchor = { left = 0, top = 0, bottom = 0, right = 0 };
351 locationBox = addressBar;
352 navigateFolders = true;
356 bool NotifyNodeOpen(FileSystemBox box, FileSystemNode node)
361 char command[MAX_LOCATION];
362 /*_FileType t = node.type;
363 if(t == ewsFile || t == epjFile ||
364 t == ecFile || t == ehFile ||
365 t == cppFile || t == hppFile ||
366 t == cFile || t == hFile ||
367 t == textFile || t == webFile)*/
368 sprintf(command, "ide %s", node.path);
370 sprintf(command, "%s", node.path);*/
373 ShellOpen(node.path);
376 else if(node.type.isFolder && tree.visible)
377 tree.SelectLocation(node.path);
382 /*ExplorerSearch search
387 size = Size { 624, 268 };
388 anchor = Anchor { left = 0, top = 0, bottom = 0 };
391 ExplorerViewSearch results;*/
395 parent = deep, master = this;
397 anchor = Anchor { top = 0, bottom = 0, right = 0 };
400 // Preview / Showcase
401 /*PreviewArea previewArea
406 //FlipStacker flipPanels { panels, spring = previous };
408 /*bool TreeNotifyBranchSelect(ExplorerTree tree, ExplorerFileBranch branch)
412 char path[MAX_LOCATION];
413 branch.GetPath(path);
414 toolBar.addressBar.contents = path;
420 /*bool ViewNotifyItemOpen(ExplorerView view, ExplorerFileItem item)
422 ExplorerFileBranch branch = tree.branch;
425 if(item.type.isFolderType)
427 ExplorerFileBranch child;
429 if(!branch.loaded || !branch.childrenLoaded)
430 BranchLoad(branch, tree.tree);
432 for(child = branch.children.first; child; child = child.next)
433 if(!strcmp(child.name, item.name))
438 if(branch.row.collapsed)
439 child.row.collapsed = true;
440 child.EnsureVisible(false);
446 char path[MAX_LOCATION];
447 branch.GetPath(path);
448 PathCat(path, item.name);
454 /*void SwitchViews(ExplorerToolId viewId)
456 ExplorerFileBranch branch = tree.branch;
460 case viewList: view = ExplorerViewList { parent = viewHolder, master = this }; break;
461 case viewDetails: view = ExplorerViewDetails { parent = viewHolder, master = this }; break;
462 case viewIcons: view = ExplorerViewIcons { parent = viewHolder, master = this }; break;
463 case viewCards: view = ExplorerViewCards { parent = viewHolder, master = this }; break;
464 case viewShowcase: view = ExplorerViewShowcase { parent = viewHolder, master = this }; break;
466 view.tabCycle = true;
467 view.previewPictures = toolBar.previewPictures.checked;
468 view.anchor = Anchor { left = 0, top = 0, bottom = 0, right = 0 };
469 view.NotifyItemOpen = ViewNotifyItemOpen;
475 void GoToLocation(char * location, bool viewIsAtLocation, bool treeIsAtLocation)
477 if(!viewIsAtLocation)
478 view.path = location;
479 if(tree.visible && !treeIsAtLocation)
480 tree.SelectLocation(location);
483 /*void SearchLocation(char * location)
485 GoToLocation(location);
486 search.location.editBox.contents = location;
492 addressBar.path = view.path;
493 tree.path = "/"; // this should be available as a parameter
504 view = ExplorerViewList
506 parent = viewHolder, master = this;
508 previewPictures = toolBar.previewPictures.checked;
509 anchor = Anchor { left = 0, top = 0, bottom = 0, right = 0 };
510 NotifyItemOpen = ViewNotifyItemOpen;
512 lastViewId = viewList;
515 view.Load(tree.root);
527 //class TreeFileSystemBox : FileSystemBox { }