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;
174 /*split.rightPane = view;
175 view.anchor = { top = 0, bottom = 0, right = 0 };*/
176 split.rightPane = null;
177 view.anchor = { left = 0, top = 0, bottom = 0, right = 0 };
183 split.rightPane = null;
184 view.anchor = { left = 0, top = 0, bottom = 0, right = 0 };
187 view.path = addressBar.path;
189 panels.size = { panels.size.w, panels.size.h }; // TOFIX : another Stacker fix needed
196 case previewPictures:
197 view.previewPictures = button.checked;
205 //SwitchViews(toolId);
206 view.treeBranches = false;
210 view.treeBranches = button.checked;
217 Window s1 { toolBar, size = { w = 8 } };
218 ToolButton goBack { toolBar, this, id = ExplorerToolId::goBack };
219 Window s2 { toolBar, size = { w = 2 } };
220 ToolButton goForward { toolBar, this, id = ExplorerToolId::goForward };
221 Window s3 { toolBar, size = { w = 2 } };
222 ToolButton refresh { toolBar, this, id = ExplorerToolId::refresh };
223 Window s4 { toolBar, size = { w = 2 } };
224 ToolButton goHome { toolBar, this, id = ExplorerToolId::goHome };
225 Window s5 { toolBar, size = { w = 8 } };
229 size = { 300, 23 }, id = ExplorerToolId::addressBar;
230 typeExpected = directory;
232 bool OnKeyDown(Key key, unichar ch)
234 if((SmartKey)key == enter)
236 // how to make enter effect a modification
237 // how to implement in PathBox
242 bool NotifyModified(PathBox pathBox)
244 GoToLocation(pathBox.path, false, false);
248 FlipStacker { toolBar, spring = previous };
249 Window s6 { toolBar, size = { w = 8 } };
250 ToolButton goUp { toolBar, this, id = ExplorerToolId::goUp };
251 Window s7 { toolBar, size = { w = 8 } };
252 GroupToggleToolButton selectedPanel;
253 GroupToggleToolButton panelTree { toolBar, this, id = ExplorerToolId::panelTree, selected = &selectedPanel, checked = true };
254 GroupToggleToolButton panelSearch { toolBar, this, id = ExplorerToolId::panelSearch, selected = &selectedPanel };
255 selectedPanel = panelTree;
256 Window s8 { toolBar, size = { w = 8 } };
257 OptionToolButton selectedView;
258 OptionToolButton viewList { toolBar, this, id = ExplorerToolId::viewList, selected = &selectedView, checked = true };
259 OptionToolButton viewDetails { toolBar, this, id = ExplorerToolId::viewDetails, selected = &selectedView };
260 OptionToolButton viewIcons { toolBar, this, id = ExplorerToolId::viewIcons, selected = &selectedView };
261 OptionToolButton viewTiles { toolBar, this, id = ExplorerToolId::viewCards, selected = &selectedView };
262 OptionToolButton viewShowcase { toolBar, this, id = ExplorerToolId::viewShowcase, selected = &selectedView };
263 OptionToolButton viewTree { toolBar, this, id = ExplorerToolId::viewTree, selected = &selectedView };
264 selectedView = viewList;
265 Window s9 { toolBar, size = { w = 8 } };
266 ToggleToolButton previewPictures { toolBar, this, id = ExplorerToolId::previewPictures };
268 Window s10 { toolBar, size = { w = 8 } };
269 ToolButton newWindow { toolBar, this, id = ExplorerToolId::newWindow };
270 Window s11 { toolBar, size = { w = 8 } };
274 iconBag.window = null;
278 bool OnLoadGraphics()
284 void OnUnloadGraphics()
293 direction = horizontal;
294 background = yellow;//activeBorder;
302 //FlipStacker flipStack { stack, spring = previous };
304 /*SearchPanel searchPanel
318 /*Tree*/FileSystemBox tree//;
326 anchor = { left = 0, top = 0, bottom = 0 };
332 bool NotifyNodeSelect(FileSystemBox box, FileSystemNode node)
334 char p[MAX_LOCATION];
336 GoToLocation(node.path, false, true);
345 leftPane = tree;//, rightPane = view;
356 anchor = { left = 0, top = 0, bottom = 0, right = 0 };
358 locationBox = addressBar;
359 navigateFolders = true;
363 bool NotifyNodeOpen(FileSystemBox box, FileSystemNode node)
367 char path[MAX_LOCATION];
369 char command[MAX_LOCATION];
371 /*_FileType t = node.type;
372 if(t == ewsFile || t == epjFile ||
373 t == ecFile || t == ehFile ||
374 t == cppFile || t == hppFile ||
375 t == cFile || t == hFile ||
376 t == textFile || t == webFile)*/
377 sprintf(command, "ide %s", path);
379 sprintf(command, "%s", path);*/
386 else if(node.type.isFolder && tree.visible)
387 tree.SelectLocation(node.path);
392 FileSystemSearch searchThread
394 owner = this, fsb = view/*, searchPanel = this*/;
396 bool Window::NotifyUpdateSearchLocation(FileSystemSearch search, char * location)
399 sprintf(text, "Search Results (Searching %s)", location);
400 PrintLn(text); //view.results.text = text;
409 searchThread.active = true;
411 searchThread.optionSubdirs = true; //options.subdirs.checked;
412 searchThread.optionTree = view.treeBranches; //(options.subdirs.checked && options.tree.checked);
413 searchThread.optionBrowser = false; //(options.subdirs.checked && options.browser.checked);
414 searchThread.optionNameMatchCase = false; //findName.optionMatchCase.checked;
415 searchThread.optionNameMatchWord = false; //findName.optionMatchWord.checked;
416 searchThread.optionContentMatchCase = false; //findTextContent.optionMatchCase.checked;
417 searchThread.optionContentMatchWord = false; //findTextContent.optionMatchWord.checked;
419 strcpy(searchThread.location, view.path/*location.GetText()*/);
420 strcpy(searchThread.nameSearch, ".txt"/*findName.GetText()*/);
421 strcpy(searchThread.contentSearch, ""/*findTextContent.GetText()*/);
423 //actions.startStop.text = "Stop Search";
424 //actions.clear.disabled = false;
425 //view.results.Clear();
426 //view.results.hasHeader = !searchThread.optionTree;
427 //view.results.treeBranches = searchThread.optionTree;
428 //view.browser.Clear();
429 //ToggleBrowserDisplay(searchThread.optionBrowser);
431 //view.browser.text = "Browser";
432 //sprintf(text, "Search Results (Searching %s)", location.GetText());
433 PrintLn("Search Results (Searching ", view.path, ")");
434 //view.results.text = text;
436 searchThread.Create();
441 if(searchThread.active)
443 searchThread.terminate = true;
452 /*ExplorerSearch search
457 size = Size { 624, 268 };
458 anchor = Anchor { left = 0, top = 0, bottom = 0 };
461 ExplorerViewSearch results;*/
465 parent = deep, master = this;
467 anchor = Anchor { top = 0, bottom = 0, right = 0 };
470 // Preview / Showcase
471 /*PreviewArea previewArea
476 //FlipStacker flipPanels { panels, spring = previous };
478 /*bool TreeNotifyBranchSelect(ExplorerTree tree, ExplorerFileBranch branch)
482 char path[MAX_LOCATION];
483 branch.GetPath(path);
484 toolBar.addressBar.contents = path;
490 /*bool ViewNotifyItemOpen(ExplorerView view, ExplorerFileItem item)
492 ExplorerFileBranch branch = tree.branch;
495 if(item.type.isFolderType)
497 ExplorerFileBranch child;
499 if(!branch.loaded || !branch.childrenLoaded)
500 BranchLoad(branch, tree.tree);
502 for(child = branch.children.first; child; child = child.next)
503 if(!strcmp(child.name, item.name))
508 if(branch.row.collapsed)
509 child.row.collapsed = true;
510 child.EnsureVisible(false);
516 char path[MAX_LOCATION];
517 branch.GetPath(path);
518 PathCat(path, item.name);
524 /*void SwitchViews(ExplorerToolId viewId)
526 ExplorerFileBranch branch = tree.branch;
530 case viewList: view = ExplorerViewList { parent = viewHolder, master = this }; break;
531 case viewDetails: view = ExplorerViewDetails { parent = viewHolder, master = this }; break;
532 case viewIcons: view = ExplorerViewIcons { parent = viewHolder, master = this }; break;
533 case viewCards: view = ExplorerViewCards { parent = viewHolder, master = this }; break;
534 case viewShowcase: view = ExplorerViewShowcase { parent = viewHolder, master = this }; break;
536 view.tabCycle = true;
537 view.previewPictures = toolBar.previewPictures.checked;
538 view.anchor = Anchor { left = 0, top = 0, bottom = 0, right = 0 };
539 view.NotifyItemOpen = ViewNotifyItemOpen;
545 void GoToLocation(char * location, bool viewIsAtLocation, bool treeIsAtLocation)
547 if(!viewIsAtLocation)
548 view.path = location;
549 if(tree.visible && !treeIsAtLocation)
550 tree.SelectLocation(location);
553 /*void SearchLocation(char * location)
555 GoToLocation(location);
556 search.location.editBox.contents = location;
562 addressBar.path = view.path;
563 tree.path = "/"; // this should be available as a parameter
574 view = ExplorerViewList
576 parent = viewHolder, master = this;
578 previewPictures = toolBar.previewPictures.checked;
579 anchor = Anchor { left = 0, top = 0, bottom = 0, right = 0 };
580 NotifyItemOpen = ViewNotifyItemOpen;
582 lastViewId = viewList;
585 view.Load(tree.root);
597 //class TreeFileSystemBox : FileSystemBox { }