7 define title = "Ecere Explorer (Debug)";
9 define title = "Ecere Explorer";
13 define backgroundColor = Color { 30, 40, 50 }; //Color { 20, 20, 60 };
14 define foregroundColor = lightGray; //white;
15 define selectionColor = lightYellow;
16 define selectionText = Color { 20, 30, 40 };
17 define toolBarBackgroundColor = backgroundColor;//white; //Color { 240, 240, 250 };
18 define toolBarForegroundColor = foregroundColor;//white; //Color { 240, 240, 250 };
20 define backgroundColor = Color { 155, 170, 160 };
21 //define backgroundColor = Color { 250, 250, 255 };
22 //define backgroundColor = beige;//white; //Color { 128, 145, 175 }; //200, 224, 224 }; //lightGray;
23 define foregroundColor = Color { 45, 45, 45 };//black;
24 define selectionColor = Color { 80, 140, 110 };//app.currentSkin.selectionColor;
25 define selectionText = black;//app.currentSkin.selectionText;
26 define toolBarBackgroundColor = Color { 170, 187, 176 }; //backgroundColor;//white; //Color { 240, 240, 250 };
27 define toolBarForegroundColor = foregroundColor;//white; //Color { 240, 240, 250 };
32 newWindow, goBack, goForward, goUp, goHome,
35 panelTree, panelSearch,
38 viewList, viewDetails, viewIcons, viewCards, viewShowcase, viewTree, viewCustom,
45 inFileContentMatchCase,
46 inFileContentMatchWord,
57 newWindow, goBack, goForward, goUp, goHome, newFile, newFolder,
59 panelTree, panelSearch,
62 viewList, viewDetails, viewIcons, viewCards, viewShowcase, viewTree, viewCustom,
64 searchInFileName, inFileNameMatchCase, inFileNameMatchWord,
65 searchInFileContent, inFileContentMatchCase, inFileContentMatchWord,
66 searchInSubDirs, searchStart, searchStop,
69 static char * iconNames[Icon::enumSize] =
71 "<:ecere>emblems/unreadable.png", /* missing */
73 "<:ecere>actions/windowNew.png", /* newWindow */
74 "<:ecere>actions/goPrevious.png", /* goBack */
75 "<:ecere>actions/goNext.png", /* goForward */
76 "<:ecere>actions/goUp.png", /* goUp */
77 "<:ecere>actions/goHome.png", /* goHome */
78 "<:ecere>mimeTypes/file.png", /* newFile */
79 "<:ecere>actions/folderNew.png", /* newFolder */
81 ":browse.png", /* browse */
83 ":panel-tree.png", /* panelTree */
84 "<:ecere>actions/editFind.png", /* panelSearch */
88 "<:ecere>actions/viewRefresh.png", /* refresh */
90 ":view-list.png", /* viewList */
91 ":view-details.png", /* viewDetails */
92 ":view-icons.png", /* viewIcons */
93 ":view-cards.png", /* viewCards */
94 ":view-showcase-right.png", /* viewShowcase */
95 ":panel-tree.png", /* viewTree */
96 ":view-custom.png", /* viewCustom */
98 "<:ecere>mimeTypes/image.png", /* previewPictures */
100 "", /* searchInFileName */
101 "<:ecere>emblems/unreadable.png", /* inFileNameMatchCase */
102 "<:ecere>emblems/unreadable.png", /* inFileNameMatchWord */
103 "", /* searchInFileContent */
104 "<:ecere>emblems/unreadable.png", /* inFileContentMatchCase */
105 "<:ecere>emblems/unreadable.png", /* inFileContentMatchWord */
106 ":browse.png", /* searchInSubDirs */
107 "<:ecere>actions/editFind.png", /* searchStart */
108 "<:ecere>emblems/unreadable.png", /* searchStop */
109 "<:ecere>emblems/unreadable.png" /* hasHeader */
112 class IconToolButton : ToolButton
115 //bitmapAlignment = left;
121 bitmap = BitmapResource { fileName = iconNames[value], alphaBlend = true };
127 class ToggleIconToolButton : IconToolButton
133 class ExplorerWindow : Window
136 background = backgroundColor;
137 borderStyle = sizable;
144 minClientSize = { 600, 300 };
145 nativeDecorations = true;
147 icon = { ":explorerIcon.png" };
156 ExplorerToolId lastViewId;
159 bool treeInitialized;
161 Array<HistoryItem> history { };
166 Menu fileMenu { menu, "File", f };
167 Menu windowMenu { menu, "Window", w };
168 MenuItem itemNewWindow { windowMenu, "New Window", n, NotifySelect = NewWindow_NotifySelect };
170 bool NewWindow_NotifySelect(MenuItem selection, Modifiers mods)
172 //ExplorerWindow { }.Create();
173 ExplorerWindow w { };//.Create();
174 w.location = location;
175 w.view.autoLoad = true;
177 w.Activate(); // tocheck: not working?
182 IconBag<ExplorerToolId> iconBag
184 //window = guiApp.desktop;
197 direction = vertical;
198 background = backgroundColor;
205 anchor = { left = 0, top = 0, right = 0, bottom = 0 };
209 ToolBar/*<ExplorerToolId>*/ toolBar
215 background = toolBarBackgroundColor;
221 flipper = addressBar;
225 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
227 bool noViewActivation = false;
228 ExplorerToolId id = (ExplorerToolId)button.id;
235 noViewActivation = true;
236 NewWindow_NotifySelect(null, 0);
241 historyIndex += id == goBack ? -1 : 1;
242 GoToHistoryIndex(/*false, false, */false);
246 char * home = getenv("HOME");
247 if(home && home[0] && FileExists(home).isDirectory)
248 location = home;//GoTo(home, false, false);
253 char * path = view.path;
254 char * newPath = new char[strlen(path)+1];
255 StripLastDirectory(path, newPath);
261 location = newPath;//GoTo(newPath, false, false);
266 NewFile(view, null, 0);
269 NewFolder(view, null, 0);
273 //ToggleSearchMode(false);
274 tree.visible = button.checked;
275 split.visible = button.checked;
278 split.rightPane = view;
279 view.anchor = { top = 0, bottom = 0, right = 0 };
280 location = addressBar.path;//GoTo(addressBar.path, false, false);
285 split.rightPane = null;
286 view.anchor = { left = 2, top = 0, bottom = 0, right = 0 };
288 //search.visible = !button.checked;
291 ToggleSearchMode(button.checked);
293 //tree.visible = false; //!button.checked;
294 //split.visible = false; //!button.checked;
297 /*split.rightPane = view;
298 view.anchor = { top = 0, bottom = 0, right = 0 };*/
299 //split.rightPane = null;
300 //view.anchor = { left = 2, top = 0, bottom = 0, right = 0 };
303 searchInFileName.Activate();
307 //split.rightPane = null;
308 //view.anchor = { left = 2, top = 0, bottom = 0, right = 0 };
310 location = addressBar.path;//GoTo(addressBar.path, false, false);
316 case previewPictures:
317 view.previewPictures = button.checked;
321 view.details = false;
322 view.treeBranches = false;
327 view.treeBranches = false;
332 //SwitchViews(toolId);
333 view.details = false;
334 view.treeBranches = false;
338 view.preview = button.checked;
342 view.treeBranches = button.checked;
346 view.hasHeader ^= true;
349 if(!noViewActivation)
356 Window { toolBar, size = { w = 8 }, inactive = true };
357 IconToolButton goBack { toolBar, this, icon = goBack, hotKey = { left, alt = true }, toolTip = "Back", disabled = true;
358 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
361 GoToHistoryIndex(/*false, false, */false);
366 Window { toolBar, size = { w = 2 }, inactive = true };
367 IconToolButton goForward { toolBar, this, icon = goForward, hotKey = { right, alt = true }, toolTip = "Forward", disabled = true;
368 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
371 GoToHistoryIndex(/*false, false, */false);
376 Window { toolBar, size = { w = 2 }, inactive = true };
377 IconToolButton refresh { toolBar, this, icon = refresh, hotKey = { r, ctrl = true }, toolTip = "Refresh";
378 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
385 Window { toolBar, size = { w = 2 }, inactive = true };
386 IconToolButton goHome { toolBar, this, icon = goHome, hotKey = { h, ctrl = true }, toolTip = "Go Home";
387 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
389 char * home = getenv("HOME");
390 if(home && home[0] && FileExists(home).isDirectory)
391 location = home;//GoTo(home, false, false);
396 Window { toolBar, size = { w = 8 }, inactive = true };
400 size = { 300, 22 };//, icon = addressBar;
401 typeExpected = directory;
403 background = toolBarBackgroundColor;
404 foreground = toolBarForegroundColor;
405 selectionColor = selectionColor;
406 selectionText = selectionText;
407 toolTip = "Location";
409 bool OnKeyDown(Key key, unichar ch)
411 if((SmartKey)key == enter)
413 // how to make enter effect a modification
414 // how to implement in PathBox
419 bool NotifyModified(PathBox pathBox)
421 location = pathBox.path;//GoTo(pathBox.path, false, false);
425 //FlipStacker { toolBar, spring = previous };
426 Window { toolBar, size = { w = 8 }, inactive = true };
427 IconToolButton newFile { toolBar, this, icon = newFile, hotKey = { l, ctrl = true }, toolTip = "Create New File";
428 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
430 NewFile(view, null, 0);
435 Window { toolBar, size = { w = 2 }, inactive = true };
436 IconToolButton newFolder { toolBar, this, icon = newFolder, hotKey = { d, ctrl = true }, toolTip = "Create New Folder";
437 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
439 NewFolder(view, null, 0);
444 Window { toolBar, size = { w = 8 }, inactive = true };
445 IconToolButton goUp { toolBar, this, icon = goUp, hotKey = { up, alt = true }, toolTip = "Go to Parent Folder";
446 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
448 char * path = view.path;
449 char * newPath = new char[strlen(path)+1];
450 StripLastDirectory(path, newPath);
456 location = newPath;//GoTo(newPath, false, false);
462 Window { toolBar, size = { w = 8 }, inactive = true };
463 //GroupToggleIconToolButton selectedPanel;
464 ToggleIconToolButton panelTree { toolBar, this, icon = panelTree/*, selected = &selectedPanel*//*, checked = true*/, toolTip = "Toggle Tree Panel";
465 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
468 //ToggleSearchMode(false);
469 tree.visible = button.checked;
470 split.visible = button.checked;
473 split.rightPane = view;
474 view.anchor = { top = 0, bottom = 0, right = 0 };
475 location = addressBar.path;//GoTo(addressBar.path, false, false);
480 split.rightPane = null;
481 view.anchor = { left = 2, top = 0, bottom = 0, right = 0 };
483 //search.visible = !button.checked;
488 ToggleIconToolButton panelSearch { toolBar, this, icon = panelSearch, hotKey = { f, ctrl = true }/*, selected = &selectedPanel*/, toolTip = "Toggle Search";
489 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
491 ToggleSearchMode(button.checked);
493 //tree.visible = false; //!button.checked;
494 //split.visible = false; //!button.checked;
497 /*split.rightPane = view;
498 view.anchor = { top = 0, bottom = 0, right = 0 };*/
499 //split.rightPane = null;
500 //view.anchor = { left = 2, top = 0, bottom = 0, right = 0 };
503 searchInFileName.Activate();
507 //split.rightPane = null;
508 //view.anchor = { left = 2, top = 0, bottom = 0, right = 0 };
510 location = addressBar.path;//GoTo(addressBar.path, false, false);
516 //selectedPanel = panelTree;
517 Window { toolBar, size = { w = 8 }, inactive = true };
518 /*OptionIconToolButton selectedView;
519 OptionIconToolButton viewList { toolBar, this, icon = viewList, selected = &selectedView, checked = true };
520 OptionIconToolButton viewDetails { toolBar, this, icon = viewDetails, selected = &selectedView };
521 OptionIconToolButton viewIcons { toolBar, this, icon = viewIcons, selected = &selectedView };
522 OptionIconToolButton viewTiles { toolBar, this, icon = viewCards, selected = &selectedView };
523 OptionIconToolButton viewShowcase { toolBar, this, icon = viewShowcase, selected = &selectedView };
524 OptionIconToolButton viewTree { toolBar, this, icon = viewTree, selected = &selectedView };
525 selectedView = viewList;*/
526 //ToggleIconToolButton viewList { toolBar, this, icon = viewList, checked = true };
528 view.details = false;
529 view.treeBranches = false;
532 ToggleIconToolButton viewDetails { toolBar, this, icon = viewDetails, toolTip = "Toggle Listing Details";
533 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
536 view.treeBranches = false;
543 //SwitchViews(toolId);
544 view.details = false;
545 view.treeBranches = false;
548 //ToggleIconToolButton viewIcons { toolBar, this, icon = viewIcons };
549 //ToggleIconToolButton viewTiles { toolBar, this, icon = viewCards };
550 ToggleIconToolButton viewShowcase { toolBar, this, icon = viewShowcase, toolTip = "Toggle Showcase";
551 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
553 view.preview = button.checked;
559 ToggleIconToolButton viewTree { toolBar, this, icon = viewTree, hotKey = { t, ctrl = true }, toolTip = "Toggle Tree Listing";
560 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
562 view.treeBranches = button.checked;
568 Window { toolBar, size = { w = 8 }, inactive = true };
569 ToggleIconToolButton previewPictures { toolBar, this, icon = previewPictures, toolTip = "Toggle Picture Preview";
570 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
572 view.previewPictures = button.checked;
579 Window { toolBar, size = { w = 8 }, inactive = true };
580 ToggleIconToolButton hasHeader { toolBar, this, icon = hasHeader, toolTip = "Toggle Listing Header";
581 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
583 view.hasHeader ^= true;
588 Window { toolBar, size = { w = 8 }, inactive = true };
589 IconToolButton newWindow { toolBar, this, icon = newWindow, hotKey = { w, ctrl = true }, toolTip = "Open New Window";
590 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
592 NewWindow_NotifySelect(null, 0);
596 Window { toolBar, size = { w = 8 }, inactive = true };
602 iconBag.window = null;
606 bool OnLoadGraphics()
612 void OnUnloadGraphics()
622 direction = horizontal;
630 //size = { h = 400 };
633 //FlipStacker flipStack { stack, spring = previous };
635 //Window searchSpace { stack, size = { h = 32 }, background = toolBarBackgroundColor, inactive = true, opacity = 0.0f };
637 ToolBar/*<ExplorerToolId>*/ searchBar
644 background = toolBarBackgroundColor;
649 flipper = searchInFileContent;
653 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
655 ExplorerToolId id = (ExplorerToolId)button.id;
673 Window { searchBar, size = { w = 8 }, inactive = true };
674 //Label { searchBar, this, labeledWindow = searchInFileName};
675 //Window { searchBar, size = { w = 2 }, inactive = true };
676 SearchBox searchInFileName
679 size = { 200, 22 };//, icon = searchInFileName;
681 background = toolBarBackgroundColor;
682 foreground = toolBarForegroundColor;
683 selectionColor = selectionColor;
684 selectionText = selectionText;
685 //text = "File Name:";
686 caption = "Search File Names";
687 toolTip = "Search File Names";
689 bool NotifyKeyDown(EditBox editBox, Key key, unichar ch)
691 if((SmartKey)key == enter)
696 /*bool NotifyActivate(Window window, bool active, Window previous)
700 toolBar.focusHolder = window;
705 Window { searchBar, size = { w = 2 }, inactive = true };
707 ToggleIconToolButton inFileNameMatchCase { searchBar, this, icon = inFileNameMatchCase, toolTip = "Toggle Match Case";
708 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
714 ToggleIconToolButton inFileNameMatchWord { searchBar, this, icon = inFileNameMatchWord, toolTip = "Toggle Match Whole Word";
715 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
720 Window { searchBar, size = { w = 8 }, inactive = true };
721 //Label { searchBar, this, labeledWindow = searchInFileContent};
722 //Window { searchBar, size = { w = 2 }, inactive = true };
723 SearchBox searchInFileContent
726 size = { 200, 22 };//, icon = searchInFileContent;
728 background = toolBarBackgroundColor;
729 foreground = toolBarForegroundColor;
730 selectionColor = selectionColor;
731 selectionText = selectionText;
732 //text = "File Content:";
733 caption = "Search File Contents";
734 toolTip = "Search File Contents";
736 bool NotifyKeyDown(EditBox editBox, Key key, unichar ch)
738 if((SmartKey)key == enter)
743 /*bool NotifyActivate(Window window, bool active, Window previous)
746 toolBar.focusHolder = window;
750 //FlipStacker { searchBar, spring = previous };
751 ToggleIconToolButton inFileContentMatchCase { searchBar, this, icon = inFileContentMatchCase, toolTip = "Toggle Match Case";
752 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
757 ToggleIconToolButton inFileContentMatchWord { searchBar, this, icon = inFileContentMatchWord, toolTip = "Toggle Match Whole Word";
758 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
763 Window { searchBar, size = { w = 8 }, inactive = true };
764 ToggleIconToolButton searchInSubDirs { searchBar, this, icon = searchInSubDirs, checked = true, toolTip = "Toggle Include Subfolders";
765 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
770 Window { searchBar, size = { w = 8 }, inactive = true };
771 IconToolButton searchStart { searchBar, this, icon = searchStart, hotKey = { s, ctrl = true }, toolTip = "Start Search";
772 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
779 Window { searchBar, size = { w = 8 }, inactive = true };
780 IconToolButton searchStop { searchBar, this, icon = searchStop, hotKey = { escape }, disabled = true, toolTip = "Stop Search";
781 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
788 Window { searchBar, size = { w = 8 }, inactive = true };
792 //Window { searchBar, size = { h = 1 } };
794 /*SearchPanel searchPanel
806 background = backgroundColor;
809 /*Tree*/FileSystemBox tree//;
814 background = backgroundColor;
815 foreground = foregroundColor;
816 selectionColor = selectionColor;
817 selectionText = selectionText;
821 //anchor = { left = 0, top = 0, bottom = 0 };
827 bool NotifyNodeSelect(FileSystemBox box, FileSystemBoxSelection selection)
831 FileSystemNode node = selection.node;
834 char p[MAX_LOCATION];
836 location = node.path;//GoTo(node.path, false, true);
842 /*bool NotifyActivate(Window window, bool active, Window previous)
845 toolBar.focusHolder = window;
854 leftPane = tree;//, rightPane = view;
858 //FileSystemCache testCache;
863 background = backgroundColor;
864 foreground = foregroundColor;
865 selectionColor = selectionColor;
866 selectionText = selectionText;
870 //anchor = { left = 2, top = 0, bottom = 0, right = 0 };
872 locationBox = addressBar;
873 navigateFolders = true;
877 //iteratorClass = class(FileSystemCacheIterator);
878 //iteratorClass = class(FileSystemIterator);
880 bool NotifyIteratorInit(FileSystemBox box, FileSystemIterator fileSystemIterator)
882 //((FileSystemCacheIterator)fileSystemIterator).cache = testCache;
883 //((FileSystemIterator)fileSystemIterator)
886 bool NotifyNodeOpen(FileSystemBox box, FileSystemBoxSelection selection)
888 FileSystemNode node = selection.node;
893 char path[MAX_LOCATION];
895 // char command[MAX_LOCATION];
896 // node.GetPath(path);
897 // /*_FileType t = node.type;
898 // if(t == ewsFile || t == epjFile ||
899 // t == ecFile || t == ehFile ||
900 // t == cppFile || t == hppFile ||
901 // t == cFile || t == hFile ||
902 // t == textFile || t == webFile)*/
903 // sprintf(command, "gnome-open \"%s\"", path);
905 // sprintf(command, "%s", path);*/
912 else if(node.type.isFolder)
913 location = node.path;//GoTo(node.path, true, false);
915 UpdateHistoryItem(selection);
919 bool NotifyNodeSelect(FileSystemBox box, FileSystemBoxSelection selection)
921 if(!comparedLocations)
922 UpdateHistoryItem(selection);
926 bool NotifyNodeMenu(FileSystemBox box, Menu menu, FileSystemBoxSelection selection)
930 FileSystemNode node = selection.node;
932 //PrintLn(node.name);
933 if(box.selection.nodes.count == 1)
934 itemString = node.name;
936 itemString = PrintString(box.selection.nodes.count, " items");
937 text = PrintString("Open ", itemString);
938 MenuItem { menu, text, o, disabled = false;
939 NotifySelect = FileSystemBox::MenuOpen
940 /*bool FileSystemBox::NotifySelect(MenuItem selection, Modifiers mods)
942 for(node : this.selection.nodes)
944 // todo: somehow bring MenuOpen / OpenNode behavior ourside
950 if(node.type == folder)
952 text = PrintString("Open ", itemString, " in another window");
953 MenuItem { menu, text, w, disabled = false;
954 bool FileSystemBox::NotifySelect(MenuItem selection, Modifiers mods)
956 for(node : this.selection.nodes)
958 ExplorerWindow ew { /*location = this.selection.node.path*/ };//.Create();
960 ew.location = /*this.selection.*/node.path;
966 MenuDivider { menu };
967 text = PrintString("Open ", itemString, " in shell");
968 MenuItem { menu, text, w, disabled = false;
969 bool FileSystemBox::NotifySelect(MenuItem selection, Modifiers mods)
971 for(node : this.selection.nodes)
973 if(node.stats.attribs)
974 ShellOpen(/*this.selection.*/node.path);
980 MenuDivider { menu };
981 MenuItem { menu, "Create File", w, NotifySelect = NewFile, disabled = false };
982 MenuItem { menu, "Create Folder", w, NotifySelect = NewFolder, disabled = false };
984 if(panelSearch.checked)
986 MenuDivider { menu };
987 MenuItem { menu, "Open Containing Folder", f, NotifySelect = FileSystemBox::MenuOpen, disabled = false;
988 bool FileSystemBox::NotifySelect(MenuItem selection, Modifiers mods)
990 char path[MAX_LOCATION];
991 StripLastDirectory(this.selection.node.path, path);
996 MenuItem { menu, "Open Containing Folder in another window", r, NotifySelect = FileSystemBox::MenuOpen, disabled = false;
997 bool FileSystemBox::NotifySelect(MenuItem selection, Modifiers mods)
999 char path[MAX_LOCATION];
1000 ExplorerWindow ew { /*location = this.selection.node.path*/ };//.Create();
1002 StripLastDirectory(this.selection.node.path, path);
1009 if(node.isListItem/* && TODO: unless node is at root location*/)
1011 MenuDivider { menu };
1012 MenuItem { menu, "Replace by Parent\tCtrl+R", r, NotifySelect = FileSystemBox::MenuReplaceListItemByContainingDir, disabled = false };
1014 else if(box.mode == list)
1016 MenuDivider { menu };
1017 MenuItem { menu, "Replace List Item\tCtrl+R", r, NotifySelect = FileSystemBox::MenuReplaceListItemByChild, disabled = false };
1019 MenuDivider { menu };
1020 MenuItem { menu, "Cut\tCtrl+X", t, NotifySelect = null, disabled = false };
1021 MenuItem { menu, "Copy\tCtrl+C", c, NotifySelect = null, disabled = false };
1022 MenuItem { menu, "Paste\tCtrl+V", p, NotifySelect = null, disabled = false /*!clipboard*/ };
1023 MenuItem { menu, "Delete\tDel", d, NotifySelect = null, disabled = false };
1024 //MenuDivider { menu };
1028 /*bool NotifyActivate(Window window, bool active, Window previous)
1031 toolBar.focusHolder = window;
1036 FileSystemSearch searchThread
1038 owner = this, fsb = view, tree = tree/*, searchPanel = this*/;
1040 /*bool ExplorerWindow::NotifyUpdateSearchLocation(FileSystemSearch search, char * location)
1042 char string[MAX_LOCATION + 2048];
1043 sprintf(string, "%s (Searching %s)", title, location);
1044 PrintLn(string); //view.results.text = string;
1049 bool ExplorerWindow::NotifySearchTerminated(FileSystemSearch search)
1051 searchStop.disabled = true;
1056 void ToggleSearchMode(bool inSearch)
1059 //search.visible = inSearch;
1060 //panelSearch.checked = inSearch; // <------ this is toggling panelSearch even though it shouldn't
1061 //searchSpace.visible = !inSearch;
1062 searchBar.visible = inSearch;
1063 history[historyIndex].inSearch = inSearch;
1064 view.pathColumn = inSearch;
1066 searchThread.InitResults();*/
1067 if(inSearch && /*(*/searchInFileName.contents[0]/* || searchInFileContents.contents[0])*/)
1075 if(!treeInitialized)
1077 tree.path = "/"; // this should be available as a parameter
1078 treeInitialized = true;
1080 tree.SelectLocation(view.path);
1086 if(searchBar.visible)
1097 bool FileSystemBox::NewFile(MenuItem selection, Modifiers mods)
1099 if(master._class == class(ExplorerWindow))
1101 ExplorerWindow ew = (ExplorerWindow)master;
1102 if(CreateNewFileDialog { /*master = */ew/*, parent = parent*/, currentDirectory = selection ? ew.view.selection.node.path : ew.view.path }.Modal() == ok )
1108 bool FileSystemBox::NewFolder(MenuItem selection, Modifiers mods)
1110 if(master._class == class(ExplorerWindow))
1112 ExplorerWindow ew = (ExplorerWindow)master;
1113 if(CreateDirectoryDialog { /*master = */ew/*, parent = parent*/, currentDirectory = selection ? ew.view.selection.node.path : ew.view.path }.Modal() == ok )
1118 //void GoTo(char * location/*, bool viewIsAtLocation, bool treeIsAtLocation*/)
1119 property char * location
1123 HistoryItem item = null;
1124 if(!history.count || fstrcmp(history[historyIndex].path, value))
1127 for(c = 0; c < history.count; c++)
1128 if(!fstrcmp(history[c].path, value))
1130 if(c == history.count)
1132 item = { path = CopyString(value) };
1135 while(historyIndex < history.count-1)
1137 delete history[history.count-1].path;
1142 historyIndex = history.count-1;
1147 GoToHistoryIndex(/*viewIsAtLocation, treeIsAtLocation, */item != null);
1149 get { return view.path; }
1152 property Array<String> comparedLocations
1157 view.comparedPaths = value;
1161 return view.comparedPaths;
1165 void GoToHistoryIndex(/*bool viewIsAtLocation, bool treeIsAtLocation, */bool updateHistoryItem)
1167 bool viewIsAtLocation;
1168 bool treeIsAtLocation;
1169 HistoryItem item = history[historyIndex];
1171 goBack.disabled = historyIndex == 0;
1172 goForward.disabled = historyIndex == history.count-1;
1173 goUp.disabled = !fstrcmp(item.path, "/");
1175 viewIsAtLocation = !fstrcmp(item.path, tree.path);
1176 treeIsAtLocation = !fstrcmp(item.path, view.path);
1178 if(!viewIsAtLocation)
1180 if(item.inSearch != panelSearch.checked)
1182 ToggleSearchMode(item.inSearch);
1192 if(fstrcmp(view.path, item.path))
1193 view.path = item.path;
1194 item.holdRecordingSelection = true;
1195 view.SelectMultipleByPath(item.selection);
1198 if(tree.visible && !treeIsAtLocation)
1199 tree.SelectLocation(item.path);
1201 if(updateHistoryItem)
1202 UpdateHistoryItem(view.selection);
1205 void UpdateHistoryItem(FileSystemBoxSelection selection)
1207 HistoryItem item = history[historyIndex];
1209 if(!item.holdRecordingSelection)
1211 if(selection.node || (selection.nodes && selection.nodes.count))
1213 item.selection.Free();
1214 if(selection.nodes.count)
1216 for(node : selection.nodes)
1217 item.selection.Add(CopyString(node.path));
1219 else if(selection.node)
1220 item.selection.Add(CopyString(selection.node.path));
1224 item.holdRecordingSelection = false;
1230 searchThread.active = true;
1232 searchThread.optionSubdirs = searchInSubDirs.checked == true;
1233 searchThread.optionTree = view.treeBranches; //(options.subdirs.checked && options.tree.checked);
1234 searchThread.optionBrowser = tree.visible; //(options.subdirs.checked && options.browser.checked);
1236 searchThread.optionNameMatchCase = inFileNameMatchCase.checked;
1238 searchThread.optionNameMatchCase = false;
1240 searchThread.optionNameMatchWord = inFileNameMatchWord.checked;
1241 searchThread.optionContentMatchCase = inFileContentMatchCase.checked;
1242 searchThread.optionContentMatchWord = inFileContentMatchWord.checked;
1244 strcpy(searchThread.location, view.path);
1245 strcpy(searchThread.nameSearch, searchInFileName.contents);
1246 strcpy(searchThread.contentSearch, searchInFileContent.contents);
1248 //actions.startStop.text = "Stop Search";
1249 //actions.clear.disabled = false;
1250 //view.results.Clear();
1251 //view.results.hasHeader = !searchThread.optionTree;
1252 //view.results.treeBranches = searchThread.optionTree;
1253 //view.browser.Clear();
1254 //ToggleBrowserDisplay(searchThread.optionBrowser);
1256 //view.browser.text = "Browser";
1258 char string[MAX_LOCATION + 2048];
1259 sprintf(string, "%s (Searching %s)", title, view.path);
1260 //PrintLn(string); //view.results.text = string;
1263 searchThread.InitResults();
1264 searchThread.Create();
1265 searchStop.disabled = false;
1271 if(searchThread.active)
1273 searchThread.terminate = true;
1274 //searchStop.disabled = true;
1276 searchThread.Wait();
1283 /*ExplorerSearch search
1288 size = Size { 624, 268 };
1289 anchor = Anchor { left = 0, top = 0, bottom = 0 };
1292 ExplorerViewSearch results;*/
1296 parent = deep, master = this;
1298 anchor = Anchor { top = 0, bottom = 0, right = 0 };
1301 // Preview / Showcase
1302 /*PreviewArea previewArea
1307 //FlipStacker flipPanels { panels, spring = previous };
1309 /*bool TreeNotifyBranchSelect(ExplorerTree tree, ExplorerFileBranch branch)
1313 char path[MAX_LOCATION];
1314 branch.GetPath(path);
1315 toolBar.addressBar.contents = path;
1321 /*bool ViewNotifyItemOpen(ExplorerView view, ExplorerFileItem item)
1323 ExplorerFileBranch branch = tree.branch;
1326 if(item.type.isFolderType)
1328 ExplorerFileBranch child;
1330 if(!branch.loaded || !branch.childrenLoaded)
1331 BranchLoad(branch, tree.tree);
1333 for(child = branch.children.first; child; child = child.next)
1334 if(!strcmp(child.name, item.name))
1339 if(branch.row.collapsed)
1340 child.row.collapsed = true;
1341 child.EnsureVisible(false);
1347 char path[MAX_LOCATION];
1348 branch.GetPath(path);
1349 PathCat(path, item.name);
1355 /*void SwitchViews(ExplorerToolId viewId)
1357 ExplorerFileBranch branch = tree.branch;
1361 case viewList: view = ExplorerViewList { parent = viewHolder, master = this }; break;
1362 case viewDetails: view = ExplorerViewDetails { parent = viewHolder, master = this }; break;
1363 case viewIcons: view = ExplorerViewIcons { parent = viewHolder, master = this }; break;
1364 case viewCards: view = ExplorerViewCards { parent = viewHolder, master = this }; break;
1365 case viewShowcase: view = ExplorerViewShowcase { parent = viewHolder, master = this }; break;
1367 view.tabCycle = true;
1368 view.previewPictures = toolBar.previewPictures.checked;
1369 view.anchor = Anchor { left = 0, top = 0, bottom = 0, right = 0 };
1370 view.NotifyItemOpen = ViewNotifyItemOpen;
1373 lastViewId = viewId;
1376 /*void SearchLocation(char * location)
1378 location = location;//GoTo(location);
1379 search.location.editBox.contents = location;
1385 addressBar.path = view.path;
1390 bool OnClose(bool parentClosing)
1403 view = ExplorerViewList
1405 parent = viewHolder, master = this;
1407 previewPictures = toolBar.previewPictures.checked;
1408 anchor = Anchor { left = 0, top = 0, bottom = 0, right = 0 };
1409 NotifyItemOpen = ViewNotifyItemOpen;
1411 lastViewId = viewList;
1414 view.Load(tree.root);
1426 //class TreeFileSystemBox : FileSystemBox { }
1431 bool holdRecordingSelection;
1433 Array<String> selection { };