Browse Source

[fileBrowser] Automatically replace old filetree, sync tree and gallery even if not the same tab

Clément Espeute 2 tháng trước cách đây
mục cha
commit
e5790bd350
3 tập tin đã thay đổi với 16 bổ sung3 xóa
  1. 1 1
      bin/app.html
  2. 5 1
      hide/Ide.hx
  3. 10 1
      hide/view/FileBrowser.hx

+ 1 - 1
bin/app.html

@@ -92,7 +92,7 @@
 		<separator></separator>
 		<menu label="About" component="hide.view.About"></menu>
 		<menu label="Debug" class="debug"></menu>
-		<menu label="Legacy Resources" component="hide.view.FileTree" state='{"path":""}'></menu>
+		<menu label="Legacy Resources" component="hide.view.FileTree" state='{"path":"", "legacy": true}'></menu>
 		<menu label="Editor Gym" component="hide.view.Gym"></menu>
 	</menu>
 	<menu label="Database" class="database">

+ 5 - 1
hide/Ide.hx

@@ -472,6 +472,10 @@ class Ide extends hide.tools.IdeData {
 		for( vcl in hide.ui.View.viewClasses )
 			comps.set(vcl.name, true);
 		function checkRec(i:golden.Config.ItemConfig) {
+			if (i.componentName == 'hide.view.FileTree' && i.componentState?.legacy == null) {
+				i.componentName = "hide.view.FileBrowser";
+				i.componentState = {savedLayout: "SingleTree"};
+			}
 			if( i.componentName != null && i.componentState != null && !comps.exists(i.componentName) ) {
 				i.componentState.deletedComponent = i.componentName;
 				i.componentName = "hide.view.Unknown";
@@ -569,7 +573,7 @@ class Ide extends hide.tools.IdeData {
 				if( isCDB )
 					open("hide.view.CdbTable",{}, function(v) v.fullScreen = true);
 				else
-					open("hide.view.Browser",{savedLayout: "SingleTree"}, Left);
+					open("hide.view.FileBrowser",{savedLayout: "SingleTree"}, Left);
 			}
 			if( firstInit ) {
 				firstInit = false;

+ 10 - 1
hide/view/FileBrowser.hx

@@ -410,7 +410,7 @@ class FileBrowser extends hide.ui.View<FileBrowserState> {
 		fancyTree.onContextMenu = contextMenu.bind(false);
 
 		fancyTree.rebuildTree();
-		fancyTree.openItem(root);
+		fancyTree.openItem(root, true);
 
 		fancyTree.onDoubleClick = (item: FileEntry) -> {
 			if (item.kind == File) {
@@ -506,8 +506,17 @@ class FileBrowser extends hide.ui.View<FileBrowserState> {
 		fancyTree.onSelectionChanged = () -> {
 			var selection = fancyTree.getSelectedItems();
 
+			// Sinc folder view with other filebrowser in SingleMiniature mode
 			if (selection.length > 0) {
 				openDir(selection[0], false);
+				var views = ide.getViews(hide.view.FileBrowser);
+				for (view in views) {
+					if (view == this)
+						continue;
+					if (view.layout == SingleMiniature) {
+						view.openDir(selection[0], false);
+					}
+				}
 			}
 		}