From 899efe656c8e16fd5845e437af375b1ecb02fb7f Mon Sep 17 00:00:00 2001
From: kimdahey <claire_kim1@brown.edu>
Date: Fri, 17 Jan 2020 14:51:51 -0500
Subject: added temporary golden layout functions

---
 .../views/collections/CollectionDockingView.tsx    | 79 +++++++++++++++++++++-
 1 file changed, 78 insertions(+), 1 deletion(-)

(limited to 'src/client/views/collections/CollectionDockingView.tsx')

diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index 022eccc13..9fa6edf8a 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -174,7 +174,7 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp
     }
 
     //
-    //  Creates a vertical split on the right side of the docking view, and then adds the Document to that split
+    //  Creates a vertical split on the right side of the docking view, and then adds the Document to the right of that split
     //
     @undoBatch
     @action
@@ -207,6 +207,77 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp
         instance.layoutChanged();
         return true;
     }
+
+    //
+    //  Creates a horizontal split on the docking view, and then adds the Document to the top of that split
+    //
+    @undoBatch
+    @action
+    public static AddTopSplit(document: Doc, dataDoc: Doc | undefined, libraryPath?: Doc[]) {
+        if (!CollectionDockingView.Instance) return false;
+        const instance = CollectionDockingView.Instance;
+        const newItemStackConfig = {
+            type: 'stack',
+            content: [CollectionDockingView.makeDocumentConfig(document, dataDoc, undefined, libraryPath)]
+        };
+
+        const newContentItem = instance._goldenLayout.root.layoutManager.createContentItem(newItemStackConfig, instance._goldenLayout);
+
+        if (instance._goldenLayout.root.contentItems.length === 0) {
+            instance._goldenLayout.root.addChild(newContentItem, 0);
+        } else if (instance._goldenLayout.root.contentItems[0].isColumn) {
+            instance._goldenLayout.root.contentItems[0].addChild(newContentItem, 0);
+        } else {
+            const hlayout = instance._goldenLayout.root.contentItems[0];
+            const newColumn = hlayout.layoutManager.createContentItem({ type: "column" }, instance._goldenLayout);
+            hlayout.parent.replaceChild(hlayout, newColumn);
+
+            newColumn.addChild(newContentItem, 0, true);
+            newColumn.addChild(hlayout, undefined, true);
+
+            hlayout.config.height = 50;
+            newContentItem.config.height = 50;
+        }
+        newContentItem.callDownwards('_$init');
+        instance.layoutChanged();
+        return true;
+    }
+
+    //
+    //  Creates a horizontal split on the docking view, and then adds the Document to the bottom of that split
+    //
+    @undoBatch
+    @action
+    public static AddBottomSplit(document: Doc, dataDoc: Doc | undefined, libraryPath?: Doc[]) {
+        if (!CollectionDockingView.Instance) return false;
+        const instance = CollectionDockingView.Instance;
+        const newItemStackConfig = {
+            type: 'stack',
+            content: [CollectionDockingView.makeDocumentConfig(document, dataDoc, undefined, libraryPath)]
+        };
+
+        const newContentItem = instance._goldenLayout.root.layoutManager.createContentItem(newItemStackConfig, instance._goldenLayout);
+
+        if (instance._goldenLayout.root.contentItems.length === 0) {
+            instance._goldenLayout.root.addChild(newContentItem);
+        } else if (instance._goldenLayout.root.contentItems[0].isColumn) {
+            instance._goldenLayout.root.contentItems[0].addChild(newContentItem);
+        } else {
+            const hlayout = instance._goldenLayout.root.contentItems[0];
+            const newColumn = hlayout.layoutManager.createContentItem({ type: "column" }, instance._goldenLayout);
+            hlayout.parent.replaceChild(hlayout, newColumn);
+
+            newColumn.addChild(newContentItem, undefined, true);
+            newColumn.addChild(hlayout, 0, true);
+
+            hlayout.config.height = 50;
+            newContentItem.config.height = 50;
+        }
+        newContentItem.callDownwards('_$init');
+        instance.layoutChanged();
+        return true;
+    }
+
     //
     //  Creates a vertical split on the right side of the docking view, and then adds the Document to that split
     //
@@ -703,6 +774,10 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> {
             return MainView.Instance.openWorkspace(doc);
         } else if (location === "onRight") {
             return CollectionDockingView.AddRightSplit(doc, dataDoc, libraryPath);
+        } else if (location === "onTop") {
+            return CollectionDockingView.AddTopSplit(doc, dataDoc, libraryPath);
+        } else if (location === "onBottom") {
+            return CollectionDockingView.AddBottomSplit(doc, dataDoc, libraryPath);
         } else if (location === "close") {
             return CollectionDockingView.CloseRightSplit(doc);
         } else {
@@ -754,3 +829,5 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> {
 }
 Scripting.addGlobal(function openOnRight(doc: any) { CollectionDockingView.AddRightSplit(doc, undefined); });
 Scripting.addGlobal(function useRightSplit(doc: any) { CollectionDockingView.UseRightSplit(doc, undefined); });
+Scripting.addGlobal(function openOnTop(doc: any) { CollectionDockingView.AddTopSplit(doc, undefined); }); // TEMPORARY didnt really know what this did but it seems important so
+Scripting.addGlobal(function openOnBottom(doc: any) { CollectionDockingView.AddBottomSplit(doc, undefined); }); // TEMPORARY didnt really know what this did but it seems important so
-- 
cgit v1.2.3-70-g09d2


From bd1282ff8609c46c4ce813cdea7b3dcdc04f59d1 Mon Sep 17 00:00:00 2001
From: kimdahey <claire_kim1@brown.edu>
Date: Fri, 17 Jan 2020 15:36:23 -0500
Subject: removed golden layout stuff

---
 .../views/collections/CollectionDockingView.tsx    | 76 ----------------------
 src/client/views/nodes/DocumentView.tsx            |  2 -
 2 files changed, 78 deletions(-)

(limited to 'src/client/views/collections/CollectionDockingView.tsx')

diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index 9fa6edf8a..5f9b4e0c7 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -208,76 +208,6 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp
         return true;
     }
 
-    //
-    //  Creates a horizontal split on the docking view, and then adds the Document to the top of that split
-    //
-    @undoBatch
-    @action
-    public static AddTopSplit(document: Doc, dataDoc: Doc | undefined, libraryPath?: Doc[]) {
-        if (!CollectionDockingView.Instance) return false;
-        const instance = CollectionDockingView.Instance;
-        const newItemStackConfig = {
-            type: 'stack',
-            content: [CollectionDockingView.makeDocumentConfig(document, dataDoc, undefined, libraryPath)]
-        };
-
-        const newContentItem = instance._goldenLayout.root.layoutManager.createContentItem(newItemStackConfig, instance._goldenLayout);
-
-        if (instance._goldenLayout.root.contentItems.length === 0) {
-            instance._goldenLayout.root.addChild(newContentItem, 0);
-        } else if (instance._goldenLayout.root.contentItems[0].isColumn) {
-            instance._goldenLayout.root.contentItems[0].addChild(newContentItem, 0);
-        } else {
-            const hlayout = instance._goldenLayout.root.contentItems[0];
-            const newColumn = hlayout.layoutManager.createContentItem({ type: "column" }, instance._goldenLayout);
-            hlayout.parent.replaceChild(hlayout, newColumn);
-
-            newColumn.addChild(newContentItem, 0, true);
-            newColumn.addChild(hlayout, undefined, true);
-
-            hlayout.config.height = 50;
-            newContentItem.config.height = 50;
-        }
-        newContentItem.callDownwards('_$init');
-        instance.layoutChanged();
-        return true;
-    }
-
-    //
-    //  Creates a horizontal split on the docking view, and then adds the Document to the bottom of that split
-    //
-    @undoBatch
-    @action
-    public static AddBottomSplit(document: Doc, dataDoc: Doc | undefined, libraryPath?: Doc[]) {
-        if (!CollectionDockingView.Instance) return false;
-        const instance = CollectionDockingView.Instance;
-        const newItemStackConfig = {
-            type: 'stack',
-            content: [CollectionDockingView.makeDocumentConfig(document, dataDoc, undefined, libraryPath)]
-        };
-
-        const newContentItem = instance._goldenLayout.root.layoutManager.createContentItem(newItemStackConfig, instance._goldenLayout);
-
-        if (instance._goldenLayout.root.contentItems.length === 0) {
-            instance._goldenLayout.root.addChild(newContentItem);
-        } else if (instance._goldenLayout.root.contentItems[0].isColumn) {
-            instance._goldenLayout.root.contentItems[0].addChild(newContentItem);
-        } else {
-            const hlayout = instance._goldenLayout.root.contentItems[0];
-            const newColumn = hlayout.layoutManager.createContentItem({ type: "column" }, instance._goldenLayout);
-            hlayout.parent.replaceChild(hlayout, newColumn);
-
-            newColumn.addChild(newContentItem, undefined, true);
-            newColumn.addChild(hlayout, 0, true);
-
-            hlayout.config.height = 50;
-            newContentItem.config.height = 50;
-        }
-        newContentItem.callDownwards('_$init');
-        instance.layoutChanged();
-        return true;
-    }
-
     //
     //  Creates a vertical split on the right side of the docking view, and then adds the Document to that split
     //
@@ -774,10 +704,6 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> {
             return MainView.Instance.openWorkspace(doc);
         } else if (location === "onRight") {
             return CollectionDockingView.AddRightSplit(doc, dataDoc, libraryPath);
-        } else if (location === "onTop") {
-            return CollectionDockingView.AddTopSplit(doc, dataDoc, libraryPath);
-        } else if (location === "onBottom") {
-            return CollectionDockingView.AddBottomSplit(doc, dataDoc, libraryPath);
         } else if (location === "close") {
             return CollectionDockingView.CloseRightSplit(doc);
         } else {
@@ -829,5 +755,3 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> {
 }
 Scripting.addGlobal(function openOnRight(doc: any) { CollectionDockingView.AddRightSplit(doc, undefined); });
 Scripting.addGlobal(function useRightSplit(doc: any) { CollectionDockingView.UseRightSplit(doc, undefined); });
-Scripting.addGlobal(function openOnTop(doc: any) { CollectionDockingView.AddTopSplit(doc, undefined); }); // TEMPORARY didnt really know what this did but it seems important so
-Scripting.addGlobal(function openOnBottom(doc: any) { CollectionDockingView.AddBottomSplit(doc, undefined); }); // TEMPORARY didnt really know what this did but it seems important so
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 845a2d3ab..dabe5a7aa 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -601,8 +601,6 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
         subitems.push({ description: "Open Full Screen", event: () => CollectionDockingView.Instance && CollectionDockingView.Instance.OpenFullScreen(this, this.props.LibraryPath), icon: "desktop" });
         subitems.push({ description: "Open Tab        ", event: () => this.props.addDocTab(this.props.Document, this.props.DataDoc, "inTab", this.props.LibraryPath), icon: "folder" });
         subitems.push({ description: "Open Right      ", event: () => this.props.addDocTab(this.props.Document, this.props.DataDoc, "onRight", this.props.LibraryPath), icon: "caret-square-right" });
-        subitems.push({ description: "Open Top        ", event: () => this.props.addDocTab(this.props.Document, this.props.DataDoc, "onTop", this.props.LibraryPath), icon: "caret-square-right" }); // TEMPORARY for gestures
-        subitems.push({ description: "Open Bottom     ", event: () => this.props.addDocTab(this.props.Document, this.props.DataDoc, "onBottom", this.props.LibraryPath), icon: "caret-square-right" }); // TEMPORARY for gestures
         subitems.push({ description: "Open Alias Tab  ", event: () => this.props.addDocTab(Doc.MakeAlias(this.props.Document), this.props.DataDoc, "inTab"), icon: "folder" });
         subitems.push({ description: "Open Alias Right", event: () => this.props.addDocTab(Doc.MakeAlias(this.props.Document), this.props.DataDoc, "onRight"), icon: "caret-square-right" });
         subitems.push({ description: "Open Fields     ", event: () => this.props.addDocTab(Docs.Create.KVPDocument(this.props.Document, { width: 300, height: 300 }), undefined, "onRight"), icon: "layer-group" });
-- 
cgit v1.2.3-70-g09d2

