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)
137 char * path = view.path;
138 char * newPath = new char[strlen(path)+1];
139 StripLastDirectory(path, newPath);
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 view.path = pathBox.path;
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 };
324 bool NotifyNodeSelect(FileSystemBox box, FileSystemNode node)
326 char p[MAX_LOCATION];
328 view.path = node.path;
337 leftPane = tree;//, rightPane = view;
348 anchor = { left = 0, top = 0, bottom = 0, right = 0 };
350 locationBox = addressBar;
351 navigateFolders = true;
354 bool NotifyNodeOpen(FileSystemBox box, FileSystemNode node)
359 char command[MAX_LOCATION];
360 /*_FileType t = node.type;
361 if(t == ewsFile || t == epjFile ||
362 t == ecFile || t == ehFile ||
363 t == cppFile || t == hppFile ||
364 t == cFile || t == hFile ||
365 t == textFile || t == webFile)*/
366 sprintf(command, "ide %s", node.path);
368 sprintf(command, "%s", node.path);*/
371 ShellOpen(node.path);
374 else if(node.type.isFolder && tree.visible)
375 tree.SelectLocation(node.path);
380 /*ExplorerSearch search
385 size = Size { 624, 268 };
386 anchor = Anchor { left = 0, top = 0, bottom = 0 };
389 ExplorerViewSearch results;*/
393 parent = deep, master = this;
395 anchor = Anchor { top = 0, bottom = 0, right = 0 };
398 // Preview / Showcase
399 /*PreviewArea previewArea
404 //FlipStacker flipPanels { panels, spring = previous };
406 /*bool TreeNotifyBranchSelect(ExplorerTree tree, ExplorerFileBranch branch)
410 char path[MAX_LOCATION];
411 branch.GetPath(path);
412 toolBar.addressBar.contents = path;
418 /*bool ViewNotifyItemOpen(ExplorerView view, ExplorerFileItem item)
420 ExplorerFileBranch branch = tree.branch;
423 if(item.type.isFolderType)
425 ExplorerFileBranch child;
427 if(!branch.loaded || !branch.childrenLoaded)
428 BranchLoad(branch, tree.tree);
430 for(child = branch.children.first; child; child = child.next)
431 if(!strcmp(child.name, item.name))
436 if(branch.row.collapsed)
437 child.row.collapsed = true;
438 child.EnsureVisible(false);
444 char path[MAX_LOCATION];
445 branch.GetPath(path);
446 PathCat(path, item.name);
452 /*void SwitchViews(ExplorerToolId viewId)
454 ExplorerFileBranch branch = tree.branch;
458 case viewList: view = ExplorerViewList { parent = viewHolder, master = this }; break;
459 case viewDetails: view = ExplorerViewDetails { parent = viewHolder, master = this }; break;
460 case viewIcons: view = ExplorerViewIcons { parent = viewHolder, master = this }; break;
461 case viewCards: view = ExplorerViewCards { parent = viewHolder, master = this }; break;
462 case viewShowcase: view = ExplorerViewShowcase { parent = viewHolder, master = this }; break;
464 view.tabCycle = true;
465 view.previewPictures = toolBar.previewPictures.checked;
466 view.anchor = Anchor { left = 0, top = 0, bottom = 0, right = 0 };
467 view.NotifyItemOpen = ViewNotifyItemOpen;
473 /*void GoToLocation(char * location)
477 char step[MAX_LOCATION];
479 StringArray steps { growingFactor = 4 };
480 ExplorerFileBranch last = null;
482 temp = CopyString(location);
485 GetLastDirectory(temp, step);
486 StripLastDirectory(temp, temp);
487 steps.Add(CopyString(step));
490 for(c = steps._count - 1; c >= 0; c--)
492 last = tree.Find(steps._[c], last);
502 /*void SearchLocation(char * location)
504 GoToLocation(location);
505 search.location.editBox.contents = location;
511 addressBar.path = view.path;
512 tree.path = "/"; // this should be available as a parameter
523 view = ExplorerViewList
525 parent = viewHolder, master = this;
527 previewPictures = toolBar.previewPictures.checked;
528 anchor = Anchor { left = 0, top = 0, bottom = 0, right = 0 };
529 NotifyItemOpen = ViewNotifyItemOpen;
531 lastViewId = viewList;
534 view.Load(tree.root);
546 //class TreeFileSystemBox : FileSystemBox { }