From bdabb0eb1aeac9ea9d4f1fa40889b8d30937c1f0 Mon Sep 17 00:00:00 2001
From: monoguitari <113245090+monoguitari@users.noreply.github.com>
Date: Sat, 19 Aug 2023 03:22:16 -0400
Subject: Toggling icon for mic and added webcapturedoc to dropdown

---
 src/client/views/nodes/FontIconBox/FontIconBox.tsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/client/views/nodes/FontIconBox/FontIconBox.tsx')

diff --git a/src/client/views/nodes/FontIconBox/FontIconBox.tsx b/src/client/views/nodes/FontIconBox/FontIconBox.tsx
index 5ff5f7bfa..41ad90155 100644
--- a/src/client/views/nodes/FontIconBox/FontIconBox.tsx
+++ b/src/client/views/nodes/FontIconBox/FontIconBox.tsx
@@ -6,7 +6,7 @@ import { observer } from 'mobx-react';
 import * as React from 'react';
 import { Doc, DocListCast, StrListCast } from '../../../../fields/Doc';
 import { ScriptField } from '../../../../fields/ScriptField';
-import { BoolCast, Cast, NumCast, ScriptCast, StrCast } from '../../../../fields/Types';
+import { BoolCast, Cast, DocCast, NumCast, ScriptCast, StrCast } from '../../../../fields/Types';
 import { CollectionViewType, DocumentType } from '../../../documents/DocumentTypes';
 import { SelectionManager } from '../../../util/SelectionManager';
 import { undoable, UndoManager } from '../../../util/UndoManager';
@@ -242,7 +242,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
         const list: IListItemProps[] = this.buttonList
             .filter(value => !Doc.noviceMode || !noviceList.length || noviceList.includes(value))
             .map(value => ({
-                text: value.charAt(0).toUpperCase() + value.slice(1),
+                text: value === "string" ? value.charAt(0).toUpperCase() + value.slice(1) : StrCast(DocCast(value)?.title),
                 val: value,
                 style: getStyle(value),
                 onClick: undoable(() => script.script.run({ this: this.layoutDoc, self: this.rootDoc, value }), value),
-- 
cgit v1.2.3-70-g09d2


From 2466587655888d5894159b942f09661ab73ebe66 Mon Sep 17 00:00:00 2001
From: monoguitari <113245090+monoguitari@users.noreply.github.com>
Date: Sat, 19 Aug 2023 08:33:14 -0400
Subject: Revert "Toggling icon for mic and added webcapturedoc to dropdown"

This reverts commit bdabb0eb1aeac9ea9d4f1fa40889b8d30937c1f0.
---
 src/client/util/CurrentUserUtils.ts                |  8 +---
 src/client/views/UndoStack.tsx                     |  4 +-
 src/client/views/nodes/FontIconBox/FontIconBox.tsx |  4 +-
 .../views/nodes/RecordingBox/RecordingBox.tsx      | 47 ++--------------------
 .../views/nodes/RecordingBox/RecordingView.tsx     |  3 +-
 src/client/views/nodes/trails/PresElementBox.tsx   |  2 +-
 6 files changed, 12 insertions(+), 56 deletions(-)

(limited to 'src/client/views/nodes/FontIconBox/FontIconBox.tsx')

diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts
index 54828867e..25c8f511b 100644
--- a/src/client/util/CurrentUserUtils.ts
+++ b/src/client/util/CurrentUserUtils.ts
@@ -714,9 +714,7 @@ export class CurrentUserUtils {
             { title: "View",    icon: "View",          toolTip: "View tools",           subMenu: CurrentUserUtils.viewTools(),   expertMode: false, toolType:CollectionViewType.Freeform, funcs: {hidden: `!SelectionManager_selectedDocType(self.toolType, self.expertMode)`, linearView_IsOpen: `SelectionManager_selectedDocType(self.toolType, self.expertMode)`} }, // Always available
             { title: "Web",     icon: "Web",           toolTip: "Web functions",        subMenu: CurrentUserUtils.webTools(),    expertMode: false, toolType:DocumentType.WEB,            funcs: {hidden: `!SelectionManager_selectedDocType(self.toolType, self.expertMode)`, linearView_IsOpen: `SelectionManager_selectedDocType(self.toolType, self.expertMode)`} }, // Only when Web is selected
             { title: "Schema",  icon: "Schema",linearBtnWidth:58,toolTip: "Schema functions",subMenu: CurrentUserUtils.schemaTools(), expertMode: false, toolType:CollectionViewType.Schema,   funcs: {hidden: `!SelectionManager_selectedDocType(self.toolType, self.expertMode)`, linearView_IsOpen: `SelectionManager_selectedDocType(self.toolType, self.expertMode)`} }, // Only when Schema is selected
-            { title: "Audio",   icon: 'microphone',    toolTip: "Dictate",              btnType: ButtonType.ToggleButton,        expertMode: false,                                       funcs: {hidden: `getIsRecording()`},                                                                  ignoreClick: true,             scripts: { onClick:  'return toggleRecording(_readOnly_)'},},
-            { title: "StopRec", icon: "stop",          toolTip: "Stop",                 btnType: ButtonType.ToggleButton,        expertMode: false,                                       funcs: {hidden: `!getIsRecording()`},                                                                  ignoreClick: true,             scripts: { onClick: `return toggleRecording(_readOnly_)`}},
-            { title: "Dropdown",                       toolTip: "Workspace Recordings", btnType: ButtonType.DropdownList,        expertMode: false,                                       funcs: {btnList: `getWorkspaceRecordings()`},                                                         ignoreClick: true,             scripts: { script: `toggleRecPlayback(value)`}, },
+            { title: "Audio",   icon: "microphone",    toolTip: "Dictate",              btnType: ButtonType.ToggleButton,        expertMode: false,                                                                                                          ignoreClick: true,             scripts: { onClick:  'return toggleRecording(_readOnly_)'}, funcs: { }}
         ];
     }
 
@@ -739,8 +737,6 @@ export class CurrentUserUtils {
     static setupContextMenuBtn(params:Button, menuDoc:Doc):Doc {
         const menuBtnDoc = DocListCast(menuDoc?.data).find(doc => doc.title === params.title);
         const subMenu = params.subMenu;
-        Doc.UserDoc().workspaceRecordings = new List<Doc>;
-        Doc.UserDoc().isRecording = false;
         if (!subMenu) { // button does not have a sub menu
             return this.setupContextMenuButton(params, menuBtnDoc);
         }  
@@ -1003,4 +999,4 @@ ScriptingGlobals.add(function createNewPresentation() { return MainView.Instance
 ScriptingGlobals.add(function openPresentation(pres:Doc) { return MainView.Instance.openPresentation(pres); }, "creates a new presentation when called");
 ScriptingGlobals.add(function createNewFolder() { return MainView.Instance.createNewFolder(); }, "creates a new folder in myFiles when called");
 ScriptingGlobals.add(function importDocument() { return CurrentUserUtils.importDocument(); }, "imports files from device directly into the import sidebar");
-ScriptingGlobals.add(function setInkToolDefaults() { Doc.ActiveTool = InkTool.None; });
+ScriptingGlobals.add(function setInkToolDefaults() { Doc.ActiveTool = InkTool.None; });
\ No newline at end of file
diff --git a/src/client/views/UndoStack.tsx b/src/client/views/UndoStack.tsx
index 813cdd050..a551e5332 100644
--- a/src/client/views/UndoStack.tsx
+++ b/src/client/views/UndoStack.tsx
@@ -37,7 +37,7 @@ export class UndoStack extends React.Component<UndoStackProps> {
                             }}>
                             {UndoManager.undoStackNames.map((name, i) => (
                                 <div className="undoStack-resultContainer" key={i}>
-                                    <div className="undoStack-commandString">{StrCast(name).replace(/[^\.]*\./, '')}</div>
+                                    <div className="undoStack-commandString">{name.replace(/[^\.]*\./, '')}</div>
                                 </div>
                             ))}
                             {Array.from(UndoManager.redoStackNames)
@@ -45,7 +45,7 @@ export class UndoStack extends React.Component<UndoStackProps> {
                                 .map((name, i) => (
                                     <div className="undoStack-resultContainer" key={i}>
                                         <div className="undoStack-commandString" style={{ fontWeight: 'bold', color: 'red' }}>
-                                            {StrCast(name).replace(/[^\.]*\./, '')}
+                                            {name.replace(/[^\.]*\./, '')}
                                         </div>
                                     </div>
                                 ))}
diff --git a/src/client/views/nodes/FontIconBox/FontIconBox.tsx b/src/client/views/nodes/FontIconBox/FontIconBox.tsx
index 41ad90155..5ff5f7bfa 100644
--- a/src/client/views/nodes/FontIconBox/FontIconBox.tsx
+++ b/src/client/views/nodes/FontIconBox/FontIconBox.tsx
@@ -6,7 +6,7 @@ import { observer } from 'mobx-react';
 import * as React from 'react';
 import { Doc, DocListCast, StrListCast } from '../../../../fields/Doc';
 import { ScriptField } from '../../../../fields/ScriptField';
-import { BoolCast, Cast, DocCast, NumCast, ScriptCast, StrCast } from '../../../../fields/Types';
+import { BoolCast, Cast, NumCast, ScriptCast, StrCast } from '../../../../fields/Types';
 import { CollectionViewType, DocumentType } from '../../../documents/DocumentTypes';
 import { SelectionManager } from '../../../util/SelectionManager';
 import { undoable, UndoManager } from '../../../util/UndoManager';
@@ -242,7 +242,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
         const list: IListItemProps[] = this.buttonList
             .filter(value => !Doc.noviceMode || !noviceList.length || noviceList.includes(value))
             .map(value => ({
-                text: value === "string" ? value.charAt(0).toUpperCase() + value.slice(1) : StrCast(DocCast(value)?.title),
+                text: value.charAt(0).toUpperCase() + value.slice(1),
                 val: value,
                 style: getStyle(value),
                 onClick: undoable(() => script.script.run({ this: this.layoutDoc, self: this.rootDoc, value }), value),
diff --git a/src/client/views/nodes/RecordingBox/RecordingBox.tsx b/src/client/views/nodes/RecordingBox/RecordingBox.tsx
index 3237ce6cd..8fa2861b6 100644
--- a/src/client/views/nodes/RecordingBox/RecordingBox.tsx
+++ b/src/client/views/nodes/RecordingBox/RecordingBox.tsx
@@ -15,8 +15,6 @@ import { BoolCast, DocCast } from '../../../../fields/Types';
 import { ScriptingGlobals } from '../../../util/ScriptingGlobals';
 import { DocumentManager } from '../../../util/DocumentManager';
 import { Docs } from '../../../documents/Documents';
-import { CollectionFreeFormView } from '../../collections/collectionFreeForm/CollectionFreeFormView';
-import { CurrentUserUtils } from '../../../util/CurrentUserUtils';
 
 @observer
 export class RecordingBox extends ViewBoxBaseComponent<FieldViewProps>() {
@@ -84,64 +82,27 @@ export class RecordingBox extends ViewBoxBaseComponent<FieldViewProps>() {
     static screengrabber: RecordingBox | undefined;
 }
 ScriptingGlobals.add(function toggleRecording(_readOnly_: boolean) {
-    console.log(_readOnly_)
-    console.log(RecordingBox.screengrabber)
     if (_readOnly_) return RecordingBox.screengrabber ? true : false;
     if (RecordingBox.screengrabber) {
-        //if recordingbox is true; when we press the stop button. changed vals temporarily to see if changes happening
-        console.log('grabbing screen!')
         RecordingBox.screengrabber.Pause?.();
         setTimeout(() => {
             RecordingBox.screengrabber?.Finish?.();
-            RecordingBox.screengrabber!.rootDoc.overlayX = 400; //was 100
+            RecordingBox.screengrabber!.rootDoc.overlayX = 100;
             RecordingBox.screengrabber!.rootDoc.overlayY = 100;
-            console.log(RecordingBox.screengrabber?.rootDoc)
             RecordingBox.screengrabber = undefined;
         }, 100);
-        Doc.UserDoc().isRecording = false;
-        // console.log(RecordingBox.screengrabber.dataDoc);
-        // Doc.AddDocToList(Doc.UserDoc(), "workspaceRecordings", RecordingBox.screengrabber.dataDoc);
-        Doc.AddDocToList(Doc.UserDoc(), "workspaceRecordings", RecordingBox.screengrabber.rootDoc);
-        // console.log(RecordingBox.screengrabber.rootDoc)
-        // console.log(RecordingBox.screengrabber.dataDoc.data?.valueOf);
     } else {
-        //when we first press mic
         const screengrabber = Docs.Create.WebCamDocument('', {
             _width: 384,
             _height: 216,
         });
-        // Doc.UserDoc().currentScreenGrab = screengrabber;
-        screengrabber.overlayX = 100; //was -400
-        screengrabber.overlayY = 100; //was 0
+        screengrabber.overlayX = -400;
+        screengrabber.overlayY = 0;
         screengrabber[Doc.LayoutFieldKey(screengrabber) + '_trackScreen'] = true;
-        Doc.AddToMyOverlay(screengrabber);  //just adds doc to overlay
+        Doc.AddToMyOverlay(screengrabber);
         DocumentManager.Instance.AddViewRenderedCb(screengrabber, docView => {
             RecordingBox.screengrabber = docView.ComponentView as RecordingBox;
             RecordingBox.screengrabber.Record?.();
         });
-        // Doc.AddDocToList(Doc.UserDoc(), "workspaceRecordings", screengrabber);
-        Doc.UserDoc().isRecording = true;
-        
     }
 }, 'toggle recording');
-ScriptingGlobals.add(function toggleRecPlayback(value: Doc) {
-    console.log(value)
-    const screenvid = Docs.Create.VideoDocument('', {_width: 384, _height: 216});
-    
-    let ffView = Array.from(DocumentManager.Instance.DocumentViews).find(view => view.ComponentView instanceof CollectionFreeFormView);
-    (ffView?.ComponentView as CollectionFreeFormView).props.addDocument?.(value); 
-
-});
-
-ScriptingGlobals.add(function getCurrRecording() {
-    console.log(RecordingBox.screengrabber);
-});
-ScriptingGlobals.add(function getWorkspaceRecordings() {
-    return Doc.UserDoc().workspaceRecordings
-});
-ScriptingGlobals.add(function getIsRecording() {
-    return Doc.UserDoc().isRecording;
-})
-
-
-
diff --git a/src/client/views/nodes/RecordingBox/RecordingView.tsx b/src/client/views/nodes/RecordingBox/RecordingView.tsx
index 8c0f5efef..0e386b093 100644
--- a/src/client/views/nodes/RecordingBox/RecordingView.tsx
+++ b/src/client/views/nodes/RecordingBox/RecordingView.tsx
@@ -163,9 +163,8 @@ export function RecordingView(props: IRecordingViewProps) {
     // if this is called, then we're done recording all the segments
     const finish = () => {
         // call stop on the video recorder if active
-        console.log(videoRecorder.current?.state);
         videoRecorder.current?.state !== 'inactive' && videoRecorder.current?.stop();
-        console.log("this it")
+
         // end the streams (audio/video) to remove recording icon
         const stream = videoElementRef.current!.srcObject;
         stream instanceof MediaStream && stream.getTracks().forEach(track => track.stop());
diff --git a/src/client/views/nodes/trails/PresElementBox.tsx b/src/client/views/nodes/trails/PresElementBox.tsx
index 5de51dbe9..aa514be3b 100644
--- a/src/client/views/nodes/trails/PresElementBox.tsx
+++ b/src/client/views/nodes/trails/PresElementBox.tsx
@@ -365,7 +365,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
 
     @undoBatch
     @action
-    startRecording =    (e: React.MouseEvent, activeItem: Doc) => {
+    startRecording = (e: React.MouseEvent, activeItem: Doc) => {
         e.stopPropagation();
         if (PresElementBox.videoIsRecorded(activeItem)) {
             // if we already have an existing recording
-- 
cgit v1.2.3-70-g09d2


From 5e8cc0a6a7f8dfc0c33fbdfa8879de88f057233e Mon Sep 17 00:00:00 2001
From: monoguitari <113245090+monoguitari@users.noreply.github.com>
Date: Sat, 19 Aug 2023 08:39:45 -0400
Subject: Revert "Revert "Toggling icon for mic and added webcapturedoc to
 dropdown""

This reverts commit 2466587655888d5894159b942f09661ab73ebe66.
---
 src/client/util/CurrentUserUtils.ts                |  8 +++-
 src/client/views/UndoStack.tsx                     |  4 +-
 src/client/views/nodes/FontIconBox/FontIconBox.tsx |  4 +-
 .../views/nodes/RecordingBox/RecordingBox.tsx      | 47 ++++++++++++++++++++--
 .../views/nodes/RecordingBox/RecordingView.tsx     |  3 +-
 src/client/views/nodes/trails/PresElementBox.tsx   |  2 +-
 6 files changed, 56 insertions(+), 12 deletions(-)

(limited to 'src/client/views/nodes/FontIconBox/FontIconBox.tsx')

diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts
index 25c8f511b..54828867e 100644
--- a/src/client/util/CurrentUserUtils.ts
+++ b/src/client/util/CurrentUserUtils.ts
@@ -714,7 +714,9 @@ export class CurrentUserUtils {
             { title: "View",    icon: "View",          toolTip: "View tools",           subMenu: CurrentUserUtils.viewTools(),   expertMode: false, toolType:CollectionViewType.Freeform, funcs: {hidden: `!SelectionManager_selectedDocType(self.toolType, self.expertMode)`, linearView_IsOpen: `SelectionManager_selectedDocType(self.toolType, self.expertMode)`} }, // Always available
             { title: "Web",     icon: "Web",           toolTip: "Web functions",        subMenu: CurrentUserUtils.webTools(),    expertMode: false, toolType:DocumentType.WEB,            funcs: {hidden: `!SelectionManager_selectedDocType(self.toolType, self.expertMode)`, linearView_IsOpen: `SelectionManager_selectedDocType(self.toolType, self.expertMode)`} }, // Only when Web is selected
             { title: "Schema",  icon: "Schema",linearBtnWidth:58,toolTip: "Schema functions",subMenu: CurrentUserUtils.schemaTools(), expertMode: false, toolType:CollectionViewType.Schema,   funcs: {hidden: `!SelectionManager_selectedDocType(self.toolType, self.expertMode)`, linearView_IsOpen: `SelectionManager_selectedDocType(self.toolType, self.expertMode)`} }, // Only when Schema is selected
-            { title: "Audio",   icon: "microphone",    toolTip: "Dictate",              btnType: ButtonType.ToggleButton,        expertMode: false,                                                                                                          ignoreClick: true,             scripts: { onClick:  'return toggleRecording(_readOnly_)'}, funcs: { }}
+            { title: "Audio",   icon: 'microphone',    toolTip: "Dictate",              btnType: ButtonType.ToggleButton,        expertMode: false,                                       funcs: {hidden: `getIsRecording()`},                                                                  ignoreClick: true,             scripts: { onClick:  'return toggleRecording(_readOnly_)'},},
+            { title: "StopRec", icon: "stop",          toolTip: "Stop",                 btnType: ButtonType.ToggleButton,        expertMode: false,                                       funcs: {hidden: `!getIsRecording()`},                                                                  ignoreClick: true,             scripts: { onClick: `return toggleRecording(_readOnly_)`}},
+            { title: "Dropdown",                       toolTip: "Workspace Recordings", btnType: ButtonType.DropdownList,        expertMode: false,                                       funcs: {btnList: `getWorkspaceRecordings()`},                                                         ignoreClick: true,             scripts: { script: `toggleRecPlayback(value)`}, },
         ];
     }
 
@@ -737,6 +739,8 @@ export class CurrentUserUtils {
     static setupContextMenuBtn(params:Button, menuDoc:Doc):Doc {
         const menuBtnDoc = DocListCast(menuDoc?.data).find(doc => doc.title === params.title);
         const subMenu = params.subMenu;
+        Doc.UserDoc().workspaceRecordings = new List<Doc>;
+        Doc.UserDoc().isRecording = false;
         if (!subMenu) { // button does not have a sub menu
             return this.setupContextMenuButton(params, menuBtnDoc);
         }  
@@ -999,4 +1003,4 @@ ScriptingGlobals.add(function createNewPresentation() { return MainView.Instance
 ScriptingGlobals.add(function openPresentation(pres:Doc) { return MainView.Instance.openPresentation(pres); }, "creates a new presentation when called");
 ScriptingGlobals.add(function createNewFolder() { return MainView.Instance.createNewFolder(); }, "creates a new folder in myFiles when called");
 ScriptingGlobals.add(function importDocument() { return CurrentUserUtils.importDocument(); }, "imports files from device directly into the import sidebar");
-ScriptingGlobals.add(function setInkToolDefaults() { Doc.ActiveTool = InkTool.None; });
\ No newline at end of file
+ScriptingGlobals.add(function setInkToolDefaults() { Doc.ActiveTool = InkTool.None; });
diff --git a/src/client/views/UndoStack.tsx b/src/client/views/UndoStack.tsx
index a551e5332..813cdd050 100644
--- a/src/client/views/UndoStack.tsx
+++ b/src/client/views/UndoStack.tsx
@@ -37,7 +37,7 @@ export class UndoStack extends React.Component<UndoStackProps> {
                             }}>
                             {UndoManager.undoStackNames.map((name, i) => (
                                 <div className="undoStack-resultContainer" key={i}>
-                                    <div className="undoStack-commandString">{name.replace(/[^\.]*\./, '')}</div>
+                                    <div className="undoStack-commandString">{StrCast(name).replace(/[^\.]*\./, '')}</div>
                                 </div>
                             ))}
                             {Array.from(UndoManager.redoStackNames)
@@ -45,7 +45,7 @@ export class UndoStack extends React.Component<UndoStackProps> {
                                 .map((name, i) => (
                                     <div className="undoStack-resultContainer" key={i}>
                                         <div className="undoStack-commandString" style={{ fontWeight: 'bold', color: 'red' }}>
-                                            {name.replace(/[^\.]*\./, '')}
+                                            {StrCast(name).replace(/[^\.]*\./, '')}
                                         </div>
                                     </div>
                                 ))}
diff --git a/src/client/views/nodes/FontIconBox/FontIconBox.tsx b/src/client/views/nodes/FontIconBox/FontIconBox.tsx
index 5ff5f7bfa..41ad90155 100644
--- a/src/client/views/nodes/FontIconBox/FontIconBox.tsx
+++ b/src/client/views/nodes/FontIconBox/FontIconBox.tsx
@@ -6,7 +6,7 @@ import { observer } from 'mobx-react';
 import * as React from 'react';
 import { Doc, DocListCast, StrListCast } from '../../../../fields/Doc';
 import { ScriptField } from '../../../../fields/ScriptField';
-import { BoolCast, Cast, NumCast, ScriptCast, StrCast } from '../../../../fields/Types';
+import { BoolCast, Cast, DocCast, NumCast, ScriptCast, StrCast } from '../../../../fields/Types';
 import { CollectionViewType, DocumentType } from '../../../documents/DocumentTypes';
 import { SelectionManager } from '../../../util/SelectionManager';
 import { undoable, UndoManager } from '../../../util/UndoManager';
@@ -242,7 +242,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
         const list: IListItemProps[] = this.buttonList
             .filter(value => !Doc.noviceMode || !noviceList.length || noviceList.includes(value))
             .map(value => ({
-                text: value.charAt(0).toUpperCase() + value.slice(1),
+                text: value === "string" ? value.charAt(0).toUpperCase() + value.slice(1) : StrCast(DocCast(value)?.title),
                 val: value,
                 style: getStyle(value),
                 onClick: undoable(() => script.script.run({ this: this.layoutDoc, self: this.rootDoc, value }), value),
diff --git a/src/client/views/nodes/RecordingBox/RecordingBox.tsx b/src/client/views/nodes/RecordingBox/RecordingBox.tsx
index 8fa2861b6..3237ce6cd 100644
--- a/src/client/views/nodes/RecordingBox/RecordingBox.tsx
+++ b/src/client/views/nodes/RecordingBox/RecordingBox.tsx
@@ -15,6 +15,8 @@ import { BoolCast, DocCast } from '../../../../fields/Types';
 import { ScriptingGlobals } from '../../../util/ScriptingGlobals';
 import { DocumentManager } from '../../../util/DocumentManager';
 import { Docs } from '../../../documents/Documents';
+import { CollectionFreeFormView } from '../../collections/collectionFreeForm/CollectionFreeFormView';
+import { CurrentUserUtils } from '../../../util/CurrentUserUtils';
 
 @observer
 export class RecordingBox extends ViewBoxBaseComponent<FieldViewProps>() {
@@ -82,27 +84,64 @@ export class RecordingBox extends ViewBoxBaseComponent<FieldViewProps>() {
     static screengrabber: RecordingBox | undefined;
 }
 ScriptingGlobals.add(function toggleRecording(_readOnly_: boolean) {
+    console.log(_readOnly_)
+    console.log(RecordingBox.screengrabber)
     if (_readOnly_) return RecordingBox.screengrabber ? true : false;
     if (RecordingBox.screengrabber) {
+        //if recordingbox is true; when we press the stop button. changed vals temporarily to see if changes happening
+        console.log('grabbing screen!')
         RecordingBox.screengrabber.Pause?.();
         setTimeout(() => {
             RecordingBox.screengrabber?.Finish?.();
-            RecordingBox.screengrabber!.rootDoc.overlayX = 100;
+            RecordingBox.screengrabber!.rootDoc.overlayX = 400; //was 100
             RecordingBox.screengrabber!.rootDoc.overlayY = 100;
+            console.log(RecordingBox.screengrabber?.rootDoc)
             RecordingBox.screengrabber = undefined;
         }, 100);
+        Doc.UserDoc().isRecording = false;
+        // console.log(RecordingBox.screengrabber.dataDoc);
+        // Doc.AddDocToList(Doc.UserDoc(), "workspaceRecordings", RecordingBox.screengrabber.dataDoc);
+        Doc.AddDocToList(Doc.UserDoc(), "workspaceRecordings", RecordingBox.screengrabber.rootDoc);
+        // console.log(RecordingBox.screengrabber.rootDoc)
+        // console.log(RecordingBox.screengrabber.dataDoc.data?.valueOf);
     } else {
+        //when we first press mic
         const screengrabber = Docs.Create.WebCamDocument('', {
             _width: 384,
             _height: 216,
         });
-        screengrabber.overlayX = -400;
-        screengrabber.overlayY = 0;
+        // Doc.UserDoc().currentScreenGrab = screengrabber;
+        screengrabber.overlayX = 100; //was -400
+        screengrabber.overlayY = 100; //was 0
         screengrabber[Doc.LayoutFieldKey(screengrabber) + '_trackScreen'] = true;
-        Doc.AddToMyOverlay(screengrabber);
+        Doc.AddToMyOverlay(screengrabber);  //just adds doc to overlay
         DocumentManager.Instance.AddViewRenderedCb(screengrabber, docView => {
             RecordingBox.screengrabber = docView.ComponentView as RecordingBox;
             RecordingBox.screengrabber.Record?.();
         });
+        // Doc.AddDocToList(Doc.UserDoc(), "workspaceRecordings", screengrabber);
+        Doc.UserDoc().isRecording = true;
+        
     }
 }, 'toggle recording');
+ScriptingGlobals.add(function toggleRecPlayback(value: Doc) {
+    console.log(value)
+    const screenvid = Docs.Create.VideoDocument('', {_width: 384, _height: 216});
+    
+    let ffView = Array.from(DocumentManager.Instance.DocumentViews).find(view => view.ComponentView instanceof CollectionFreeFormView);
+    (ffView?.ComponentView as CollectionFreeFormView).props.addDocument?.(value); 
+
+});
+
+ScriptingGlobals.add(function getCurrRecording() {
+    console.log(RecordingBox.screengrabber);
+});
+ScriptingGlobals.add(function getWorkspaceRecordings() {
+    return Doc.UserDoc().workspaceRecordings
+});
+ScriptingGlobals.add(function getIsRecording() {
+    return Doc.UserDoc().isRecording;
+})
+
+
+
diff --git a/src/client/views/nodes/RecordingBox/RecordingView.tsx b/src/client/views/nodes/RecordingBox/RecordingView.tsx
index 0e386b093..8c0f5efef 100644
--- a/src/client/views/nodes/RecordingBox/RecordingView.tsx
+++ b/src/client/views/nodes/RecordingBox/RecordingView.tsx
@@ -163,8 +163,9 @@ export function RecordingView(props: IRecordingViewProps) {
     // if this is called, then we're done recording all the segments
     const finish = () => {
         // call stop on the video recorder if active
+        console.log(videoRecorder.current?.state);
         videoRecorder.current?.state !== 'inactive' && videoRecorder.current?.stop();
-
+        console.log("this it")
         // end the streams (audio/video) to remove recording icon
         const stream = videoElementRef.current!.srcObject;
         stream instanceof MediaStream && stream.getTracks().forEach(track => track.stop());
diff --git a/src/client/views/nodes/trails/PresElementBox.tsx b/src/client/views/nodes/trails/PresElementBox.tsx
index aa514be3b..5de51dbe9 100644
--- a/src/client/views/nodes/trails/PresElementBox.tsx
+++ b/src/client/views/nodes/trails/PresElementBox.tsx
@@ -365,7 +365,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
 
     @undoBatch
     @action
-    startRecording = (e: React.MouseEvent, activeItem: Doc) => {
+    startRecording =    (e: React.MouseEvent, activeItem: Doc) => {
         e.stopPropagation();
         if (PresElementBox.videoIsRecorded(activeItem)) {
             // if we already have an existing recording
-- 
cgit v1.2.3-70-g09d2


From 40a39db25646b513c25554a2abdf35ef977500a8 Mon Sep 17 00:00:00 2001
From: monoguitari <113245090+monoguitari@users.noreply.github.com>
Date: Sat, 19 Aug 2023 08:52:33 -0400
Subject: Revert "Revert "Revert "Toggling icon for mic and added webcapturedoc
 to dropdown"""

This reverts commit 5e8cc0a6a7f8dfc0c33fbdfa8879de88f057233e.
---
 src/client/util/CurrentUserUtils.ts                |  8 +---
 src/client/views/UndoStack.tsx                     |  4 +-
 src/client/views/nodes/FontIconBox/FontIconBox.tsx |  4 +-
 .../views/nodes/RecordingBox/RecordingBox.tsx      | 47 ++--------------------
 .../views/nodes/RecordingBox/RecordingView.tsx     |  3 +-
 src/client/views/nodes/trails/PresElementBox.tsx   |  2 +-
 6 files changed, 12 insertions(+), 56 deletions(-)

(limited to 'src/client/views/nodes/FontIconBox/FontIconBox.tsx')

diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts
index 54828867e..25c8f511b 100644
--- a/src/client/util/CurrentUserUtils.ts
+++ b/src/client/util/CurrentUserUtils.ts
@@ -714,9 +714,7 @@ export class CurrentUserUtils {
             { title: "View",    icon: "View",          toolTip: "View tools",           subMenu: CurrentUserUtils.viewTools(),   expertMode: false, toolType:CollectionViewType.Freeform, funcs: {hidden: `!SelectionManager_selectedDocType(self.toolType, self.expertMode)`, linearView_IsOpen: `SelectionManager_selectedDocType(self.toolType, self.expertMode)`} }, // Always available
             { title: "Web",     icon: "Web",           toolTip: "Web functions",        subMenu: CurrentUserUtils.webTools(),    expertMode: false, toolType:DocumentType.WEB,            funcs: {hidden: `!SelectionManager_selectedDocType(self.toolType, self.expertMode)`, linearView_IsOpen: `SelectionManager_selectedDocType(self.toolType, self.expertMode)`} }, // Only when Web is selected
             { title: "Schema",  icon: "Schema",linearBtnWidth:58,toolTip: "Schema functions",subMenu: CurrentUserUtils.schemaTools(), expertMode: false, toolType:CollectionViewType.Schema,   funcs: {hidden: `!SelectionManager_selectedDocType(self.toolType, self.expertMode)`, linearView_IsOpen: `SelectionManager_selectedDocType(self.toolType, self.expertMode)`} }, // Only when Schema is selected
-            { title: "Audio",   icon: 'microphone',    toolTip: "Dictate",              btnType: ButtonType.ToggleButton,        expertMode: false,                                       funcs: {hidden: `getIsRecording()`},                                                                  ignoreClick: true,             scripts: { onClick:  'return toggleRecording(_readOnly_)'},},
-            { title: "StopRec", icon: "stop",          toolTip: "Stop",                 btnType: ButtonType.ToggleButton,        expertMode: false,                                       funcs: {hidden: `!getIsRecording()`},                                                                  ignoreClick: true,             scripts: { onClick: `return toggleRecording(_readOnly_)`}},
-            { title: "Dropdown",                       toolTip: "Workspace Recordings", btnType: ButtonType.DropdownList,        expertMode: false,                                       funcs: {btnList: `getWorkspaceRecordings()`},                                                         ignoreClick: true,             scripts: { script: `toggleRecPlayback(value)`}, },
+            { title: "Audio",   icon: "microphone",    toolTip: "Dictate",              btnType: ButtonType.ToggleButton,        expertMode: false,                                                                                                          ignoreClick: true,             scripts: { onClick:  'return toggleRecording(_readOnly_)'}, funcs: { }}
         ];
     }
 
@@ -739,8 +737,6 @@ export class CurrentUserUtils {
     static setupContextMenuBtn(params:Button, menuDoc:Doc):Doc {
         const menuBtnDoc = DocListCast(menuDoc?.data).find(doc => doc.title === params.title);
         const subMenu = params.subMenu;
-        Doc.UserDoc().workspaceRecordings = new List<Doc>;
-        Doc.UserDoc().isRecording = false;
         if (!subMenu) { // button does not have a sub menu
             return this.setupContextMenuButton(params, menuBtnDoc);
         }  
@@ -1003,4 +999,4 @@ ScriptingGlobals.add(function createNewPresentation() { return MainView.Instance
 ScriptingGlobals.add(function openPresentation(pres:Doc) { return MainView.Instance.openPresentation(pres); }, "creates a new presentation when called");
 ScriptingGlobals.add(function createNewFolder() { return MainView.Instance.createNewFolder(); }, "creates a new folder in myFiles when called");
 ScriptingGlobals.add(function importDocument() { return CurrentUserUtils.importDocument(); }, "imports files from device directly into the import sidebar");
-ScriptingGlobals.add(function setInkToolDefaults() { Doc.ActiveTool = InkTool.None; });
+ScriptingGlobals.add(function setInkToolDefaults() { Doc.ActiveTool = InkTool.None; });
\ No newline at end of file
diff --git a/src/client/views/UndoStack.tsx b/src/client/views/UndoStack.tsx
index 813cdd050..a551e5332 100644
--- a/src/client/views/UndoStack.tsx
+++ b/src/client/views/UndoStack.tsx
@@ -37,7 +37,7 @@ export class UndoStack extends React.Component<UndoStackProps> {
                             }}>
                             {UndoManager.undoStackNames.map((name, i) => (
                                 <div className="undoStack-resultContainer" key={i}>
-                                    <div className="undoStack-commandString">{StrCast(name).replace(/[^\.]*\./, '')}</div>
+                                    <div className="undoStack-commandString">{name.replace(/[^\.]*\./, '')}</div>
                                 </div>
                             ))}
                             {Array.from(UndoManager.redoStackNames)
@@ -45,7 +45,7 @@ export class UndoStack extends React.Component<UndoStackProps> {
                                 .map((name, i) => (
                                     <div className="undoStack-resultContainer" key={i}>
                                         <div className="undoStack-commandString" style={{ fontWeight: 'bold', color: 'red' }}>
-                                            {StrCast(name).replace(/[^\.]*\./, '')}
+                                            {name.replace(/[^\.]*\./, '')}
                                         </div>
                                     </div>
                                 ))}
diff --git a/src/client/views/nodes/FontIconBox/FontIconBox.tsx b/src/client/views/nodes/FontIconBox/FontIconBox.tsx
index 41ad90155..5ff5f7bfa 100644
--- a/src/client/views/nodes/FontIconBox/FontIconBox.tsx
+++ b/src/client/views/nodes/FontIconBox/FontIconBox.tsx
@@ -6,7 +6,7 @@ import { observer } from 'mobx-react';
 import * as React from 'react';
 import { Doc, DocListCast, StrListCast } from '../../../../fields/Doc';
 import { ScriptField } from '../../../../fields/ScriptField';
-import { BoolCast, Cast, DocCast, NumCast, ScriptCast, StrCast } from '../../../../fields/Types';
+import { BoolCast, Cast, NumCast, ScriptCast, StrCast } from '../../../../fields/Types';
 import { CollectionViewType, DocumentType } from '../../../documents/DocumentTypes';
 import { SelectionManager } from '../../../util/SelectionManager';
 import { undoable, UndoManager } from '../../../util/UndoManager';
@@ -242,7 +242,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
         const list: IListItemProps[] = this.buttonList
             .filter(value => !Doc.noviceMode || !noviceList.length || noviceList.includes(value))
             .map(value => ({
-                text: value === "string" ? value.charAt(0).toUpperCase() + value.slice(1) : StrCast(DocCast(value)?.title),
+                text: value.charAt(0).toUpperCase() + value.slice(1),
                 val: value,
                 style: getStyle(value),
                 onClick: undoable(() => script.script.run({ this: this.layoutDoc, self: this.rootDoc, value }), value),
diff --git a/src/client/views/nodes/RecordingBox/RecordingBox.tsx b/src/client/views/nodes/RecordingBox/RecordingBox.tsx
index 3237ce6cd..8fa2861b6 100644
--- a/src/client/views/nodes/RecordingBox/RecordingBox.tsx
+++ b/src/client/views/nodes/RecordingBox/RecordingBox.tsx
@@ -15,8 +15,6 @@ import { BoolCast, DocCast } from '../../../../fields/Types';
 import { ScriptingGlobals } from '../../../util/ScriptingGlobals';
 import { DocumentManager } from '../../../util/DocumentManager';
 import { Docs } from '../../../documents/Documents';
-import { CollectionFreeFormView } from '../../collections/collectionFreeForm/CollectionFreeFormView';
-import { CurrentUserUtils } from '../../../util/CurrentUserUtils';
 
 @observer
 export class RecordingBox extends ViewBoxBaseComponent<FieldViewProps>() {
@@ -84,64 +82,27 @@ export class RecordingBox extends ViewBoxBaseComponent<FieldViewProps>() {
     static screengrabber: RecordingBox | undefined;
 }
 ScriptingGlobals.add(function toggleRecording(_readOnly_: boolean) {
-    console.log(_readOnly_)
-    console.log(RecordingBox.screengrabber)
     if (_readOnly_) return RecordingBox.screengrabber ? true : false;
     if (RecordingBox.screengrabber) {
-        //if recordingbox is true; when we press the stop button. changed vals temporarily to see if changes happening
-        console.log('grabbing screen!')
         RecordingBox.screengrabber.Pause?.();
         setTimeout(() => {
             RecordingBox.screengrabber?.Finish?.();
-            RecordingBox.screengrabber!.rootDoc.overlayX = 400; //was 100
+            RecordingBox.screengrabber!.rootDoc.overlayX = 100;
             RecordingBox.screengrabber!.rootDoc.overlayY = 100;
-            console.log(RecordingBox.screengrabber?.rootDoc)
             RecordingBox.screengrabber = undefined;
         }, 100);
-        Doc.UserDoc().isRecording = false;
-        // console.log(RecordingBox.screengrabber.dataDoc);
-        // Doc.AddDocToList(Doc.UserDoc(), "workspaceRecordings", RecordingBox.screengrabber.dataDoc);
-        Doc.AddDocToList(Doc.UserDoc(), "workspaceRecordings", RecordingBox.screengrabber.rootDoc);
-        // console.log(RecordingBox.screengrabber.rootDoc)
-        // console.log(RecordingBox.screengrabber.dataDoc.data?.valueOf);
     } else {
-        //when we first press mic
         const screengrabber = Docs.Create.WebCamDocument('', {
             _width: 384,
             _height: 216,
         });
-        // Doc.UserDoc().currentScreenGrab = screengrabber;
-        screengrabber.overlayX = 100; //was -400
-        screengrabber.overlayY = 100; //was 0
+        screengrabber.overlayX = -400;
+        screengrabber.overlayY = 0;
         screengrabber[Doc.LayoutFieldKey(screengrabber) + '_trackScreen'] = true;
-        Doc.AddToMyOverlay(screengrabber);  //just adds doc to overlay
+        Doc.AddToMyOverlay(screengrabber);
         DocumentManager.Instance.AddViewRenderedCb(screengrabber, docView => {
             RecordingBox.screengrabber = docView.ComponentView as RecordingBox;
             RecordingBox.screengrabber.Record?.();
         });
-        // Doc.AddDocToList(Doc.UserDoc(), "workspaceRecordings", screengrabber);
-        Doc.UserDoc().isRecording = true;
-        
     }
 }, 'toggle recording');
-ScriptingGlobals.add(function toggleRecPlayback(value: Doc) {
-    console.log(value)
-    const screenvid = Docs.Create.VideoDocument('', {_width: 384, _height: 216});
-    
-    let ffView = Array.from(DocumentManager.Instance.DocumentViews).find(view => view.ComponentView instanceof CollectionFreeFormView);
-    (ffView?.ComponentView as CollectionFreeFormView).props.addDocument?.(value); 
-
-});
-
-ScriptingGlobals.add(function getCurrRecording() {
-    console.log(RecordingBox.screengrabber);
-});
-ScriptingGlobals.add(function getWorkspaceRecordings() {
-    return Doc.UserDoc().workspaceRecordings
-});
-ScriptingGlobals.add(function getIsRecording() {
-    return Doc.UserDoc().isRecording;
-})
-
-
-
diff --git a/src/client/views/nodes/RecordingBox/RecordingView.tsx b/src/client/views/nodes/RecordingBox/RecordingView.tsx
index 8c0f5efef..0e386b093 100644
--- a/src/client/views/nodes/RecordingBox/RecordingView.tsx
+++ b/src/client/views/nodes/RecordingBox/RecordingView.tsx
@@ -163,9 +163,8 @@ export function RecordingView(props: IRecordingViewProps) {
     // if this is called, then we're done recording all the segments
     const finish = () => {
         // call stop on the video recorder if active
-        console.log(videoRecorder.current?.state);
         videoRecorder.current?.state !== 'inactive' && videoRecorder.current?.stop();
-        console.log("this it")
+
         // end the streams (audio/video) to remove recording icon
         const stream = videoElementRef.current!.srcObject;
         stream instanceof MediaStream && stream.getTracks().forEach(track => track.stop());
diff --git a/src/client/views/nodes/trails/PresElementBox.tsx b/src/client/views/nodes/trails/PresElementBox.tsx
index 5de51dbe9..aa514be3b 100644
--- a/src/client/views/nodes/trails/PresElementBox.tsx
+++ b/src/client/views/nodes/trails/PresElementBox.tsx
@@ -365,7 +365,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
 
     @undoBatch
     @action
-    startRecording =    (e: React.MouseEvent, activeItem: Doc) => {
+    startRecording = (e: React.MouseEvent, activeItem: Doc) => {
         e.stopPropagation();
         if (PresElementBox.videoIsRecorded(activeItem)) {
             // if we already have an existing recording
-- 
cgit v1.2.3-70-g09d2


From ec6a5f5d5684ca66cd21bb8fef91c86852dd126f Mon Sep 17 00:00:00 2001
From: monoguitari <113245090+monoguitari@users.noreply.github.com>
Date: Sat, 19 Aug 2023 08:53:11 -0400
Subject: Revert "Revert "Revert "Revert "Toggling icon for mic and added
 webcapturedoc to dropdown""""

This reverts commit 40a39db25646b513c25554a2abdf35ef977500a8.
---
 src/client/util/CurrentUserUtils.ts                |  8 +++-
 src/client/views/UndoStack.tsx                     |  4 +-
 src/client/views/nodes/FontIconBox/FontIconBox.tsx |  4 +-
 .../views/nodes/RecordingBox/RecordingBox.tsx      | 47 ++++++++++++++++++++--
 .../views/nodes/RecordingBox/RecordingView.tsx     |  3 +-
 src/client/views/nodes/trails/PresElementBox.tsx   |  2 +-
 6 files changed, 56 insertions(+), 12 deletions(-)

(limited to 'src/client/views/nodes/FontIconBox/FontIconBox.tsx')

diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts
index 25c8f511b..54828867e 100644
--- a/src/client/util/CurrentUserUtils.ts
+++ b/src/client/util/CurrentUserUtils.ts
@@ -714,7 +714,9 @@ export class CurrentUserUtils {
             { title: "View",    icon: "View",          toolTip: "View tools",           subMenu: CurrentUserUtils.viewTools(),   expertMode: false, toolType:CollectionViewType.Freeform, funcs: {hidden: `!SelectionManager_selectedDocType(self.toolType, self.expertMode)`, linearView_IsOpen: `SelectionManager_selectedDocType(self.toolType, self.expertMode)`} }, // Always available
             { title: "Web",     icon: "Web",           toolTip: "Web functions",        subMenu: CurrentUserUtils.webTools(),    expertMode: false, toolType:DocumentType.WEB,            funcs: {hidden: `!SelectionManager_selectedDocType(self.toolType, self.expertMode)`, linearView_IsOpen: `SelectionManager_selectedDocType(self.toolType, self.expertMode)`} }, // Only when Web is selected
             { title: "Schema",  icon: "Schema",linearBtnWidth:58,toolTip: "Schema functions",subMenu: CurrentUserUtils.schemaTools(), expertMode: false, toolType:CollectionViewType.Schema,   funcs: {hidden: `!SelectionManager_selectedDocType(self.toolType, self.expertMode)`, linearView_IsOpen: `SelectionManager_selectedDocType(self.toolType, self.expertMode)`} }, // Only when Schema is selected
-            { title: "Audio",   icon: "microphone",    toolTip: "Dictate",              btnType: ButtonType.ToggleButton,        expertMode: false,                                                                                                          ignoreClick: true,             scripts: { onClick:  'return toggleRecording(_readOnly_)'}, funcs: { }}
+            { title: "Audio",   icon: 'microphone',    toolTip: "Dictate",              btnType: ButtonType.ToggleButton,        expertMode: false,                                       funcs: {hidden: `getIsRecording()`},                                                                  ignoreClick: true,             scripts: { onClick:  'return toggleRecording(_readOnly_)'},},
+            { title: "StopRec", icon: "stop",          toolTip: "Stop",                 btnType: ButtonType.ToggleButton,        expertMode: false,                                       funcs: {hidden: `!getIsRecording()`},                                                                  ignoreClick: true,             scripts: { onClick: `return toggleRecording(_readOnly_)`}},
+            { title: "Dropdown",                       toolTip: "Workspace Recordings", btnType: ButtonType.DropdownList,        expertMode: false,                                       funcs: {btnList: `getWorkspaceRecordings()`},                                                         ignoreClick: true,             scripts: { script: `toggleRecPlayback(value)`}, },
         ];
     }
 
@@ -737,6 +739,8 @@ export class CurrentUserUtils {
     static setupContextMenuBtn(params:Button, menuDoc:Doc):Doc {
         const menuBtnDoc = DocListCast(menuDoc?.data).find(doc => doc.title === params.title);
         const subMenu = params.subMenu;
+        Doc.UserDoc().workspaceRecordings = new List<Doc>;
+        Doc.UserDoc().isRecording = false;
         if (!subMenu) { // button does not have a sub menu
             return this.setupContextMenuButton(params, menuBtnDoc);
         }  
@@ -999,4 +1003,4 @@ ScriptingGlobals.add(function createNewPresentation() { return MainView.Instance
 ScriptingGlobals.add(function openPresentation(pres:Doc) { return MainView.Instance.openPresentation(pres); }, "creates a new presentation when called");
 ScriptingGlobals.add(function createNewFolder() { return MainView.Instance.createNewFolder(); }, "creates a new folder in myFiles when called");
 ScriptingGlobals.add(function importDocument() { return CurrentUserUtils.importDocument(); }, "imports files from device directly into the import sidebar");
-ScriptingGlobals.add(function setInkToolDefaults() { Doc.ActiveTool = InkTool.None; });
\ No newline at end of file
+ScriptingGlobals.add(function setInkToolDefaults() { Doc.ActiveTool = InkTool.None; });
diff --git a/src/client/views/UndoStack.tsx b/src/client/views/UndoStack.tsx
index a551e5332..813cdd050 100644
--- a/src/client/views/UndoStack.tsx
+++ b/src/client/views/UndoStack.tsx
@@ -37,7 +37,7 @@ export class UndoStack extends React.Component<UndoStackProps> {
                             }}>
                             {UndoManager.undoStackNames.map((name, i) => (
                                 <div className="undoStack-resultContainer" key={i}>
-                                    <div className="undoStack-commandString">{name.replace(/[^\.]*\./, '')}</div>
+                                    <div className="undoStack-commandString">{StrCast(name).replace(/[^\.]*\./, '')}</div>
                                 </div>
                             ))}
                             {Array.from(UndoManager.redoStackNames)
@@ -45,7 +45,7 @@ export class UndoStack extends React.Component<UndoStackProps> {
                                 .map((name, i) => (
                                     <div className="undoStack-resultContainer" key={i}>
                                         <div className="undoStack-commandString" style={{ fontWeight: 'bold', color: 'red' }}>
-                                            {name.replace(/[^\.]*\./, '')}
+                                            {StrCast(name).replace(/[^\.]*\./, '')}
                                         </div>
                                     </div>
                                 ))}
diff --git a/src/client/views/nodes/FontIconBox/FontIconBox.tsx b/src/client/views/nodes/FontIconBox/FontIconBox.tsx
index 5ff5f7bfa..41ad90155 100644
--- a/src/client/views/nodes/FontIconBox/FontIconBox.tsx
+++ b/src/client/views/nodes/FontIconBox/FontIconBox.tsx
@@ -6,7 +6,7 @@ import { observer } from 'mobx-react';
 import * as React from 'react';
 import { Doc, DocListCast, StrListCast } from '../../../../fields/Doc';
 import { ScriptField } from '../../../../fields/ScriptField';
-import { BoolCast, Cast, NumCast, ScriptCast, StrCast } from '../../../../fields/Types';
+import { BoolCast, Cast, DocCast, NumCast, ScriptCast, StrCast } from '../../../../fields/Types';
 import { CollectionViewType, DocumentType } from '../../../documents/DocumentTypes';
 import { SelectionManager } from '../../../util/SelectionManager';
 import { undoable, UndoManager } from '../../../util/UndoManager';
@@ -242,7 +242,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
         const list: IListItemProps[] = this.buttonList
             .filter(value => !Doc.noviceMode || !noviceList.length || noviceList.includes(value))
             .map(value => ({
-                text: value.charAt(0).toUpperCase() + value.slice(1),
+                text: value === "string" ? value.charAt(0).toUpperCase() + value.slice(1) : StrCast(DocCast(value)?.title),
                 val: value,
                 style: getStyle(value),
                 onClick: undoable(() => script.script.run({ this: this.layoutDoc, self: this.rootDoc, value }), value),
diff --git a/src/client/views/nodes/RecordingBox/RecordingBox.tsx b/src/client/views/nodes/RecordingBox/RecordingBox.tsx
index 8fa2861b6..3237ce6cd 100644
--- a/src/client/views/nodes/RecordingBox/RecordingBox.tsx
+++ b/src/client/views/nodes/RecordingBox/RecordingBox.tsx
@@ -15,6 +15,8 @@ import { BoolCast, DocCast } from '../../../../fields/Types';
 import { ScriptingGlobals } from '../../../util/ScriptingGlobals';
 import { DocumentManager } from '../../../util/DocumentManager';
 import { Docs } from '../../../documents/Documents';
+import { CollectionFreeFormView } from '../../collections/collectionFreeForm/CollectionFreeFormView';
+import { CurrentUserUtils } from '../../../util/CurrentUserUtils';
 
 @observer
 export class RecordingBox extends ViewBoxBaseComponent<FieldViewProps>() {
@@ -82,27 +84,64 @@ export class RecordingBox extends ViewBoxBaseComponent<FieldViewProps>() {
     static screengrabber: RecordingBox | undefined;
 }
 ScriptingGlobals.add(function toggleRecording(_readOnly_: boolean) {
+    console.log(_readOnly_)
+    console.log(RecordingBox.screengrabber)
     if (_readOnly_) return RecordingBox.screengrabber ? true : false;
     if (RecordingBox.screengrabber) {
+        //if recordingbox is true; when we press the stop button. changed vals temporarily to see if changes happening
+        console.log('grabbing screen!')
         RecordingBox.screengrabber.Pause?.();
         setTimeout(() => {
             RecordingBox.screengrabber?.Finish?.();
-            RecordingBox.screengrabber!.rootDoc.overlayX = 100;
+            RecordingBox.screengrabber!.rootDoc.overlayX = 400; //was 100
             RecordingBox.screengrabber!.rootDoc.overlayY = 100;
+            console.log(RecordingBox.screengrabber?.rootDoc)
             RecordingBox.screengrabber = undefined;
         }, 100);
+        Doc.UserDoc().isRecording = false;
+        // console.log(RecordingBox.screengrabber.dataDoc);
+        // Doc.AddDocToList(Doc.UserDoc(), "workspaceRecordings", RecordingBox.screengrabber.dataDoc);
+        Doc.AddDocToList(Doc.UserDoc(), "workspaceRecordings", RecordingBox.screengrabber.rootDoc);
+        // console.log(RecordingBox.screengrabber.rootDoc)
+        // console.log(RecordingBox.screengrabber.dataDoc.data?.valueOf);
     } else {
+        //when we first press mic
         const screengrabber = Docs.Create.WebCamDocument('', {
             _width: 384,
             _height: 216,
         });
-        screengrabber.overlayX = -400;
-        screengrabber.overlayY = 0;
+        // Doc.UserDoc().currentScreenGrab = screengrabber;
+        screengrabber.overlayX = 100; //was -400
+        screengrabber.overlayY = 100; //was 0
         screengrabber[Doc.LayoutFieldKey(screengrabber) + '_trackScreen'] = true;
-        Doc.AddToMyOverlay(screengrabber);
+        Doc.AddToMyOverlay(screengrabber);  //just adds doc to overlay
         DocumentManager.Instance.AddViewRenderedCb(screengrabber, docView => {
             RecordingBox.screengrabber = docView.ComponentView as RecordingBox;
             RecordingBox.screengrabber.Record?.();
         });
+        // Doc.AddDocToList(Doc.UserDoc(), "workspaceRecordings", screengrabber);
+        Doc.UserDoc().isRecording = true;
+        
     }
 }, 'toggle recording');
+ScriptingGlobals.add(function toggleRecPlayback(value: Doc) {
+    console.log(value)
+    const screenvid = Docs.Create.VideoDocument('', {_width: 384, _height: 216});
+    
+    let ffView = Array.from(DocumentManager.Instance.DocumentViews).find(view => view.ComponentView instanceof CollectionFreeFormView);
+    (ffView?.ComponentView as CollectionFreeFormView).props.addDocument?.(value); 
+
+});
+
+ScriptingGlobals.add(function getCurrRecording() {
+    console.log(RecordingBox.screengrabber);
+});
+ScriptingGlobals.add(function getWorkspaceRecordings() {
+    return Doc.UserDoc().workspaceRecordings
+});
+ScriptingGlobals.add(function getIsRecording() {
+    return Doc.UserDoc().isRecording;
+})
+
+
+
diff --git a/src/client/views/nodes/RecordingBox/RecordingView.tsx b/src/client/views/nodes/RecordingBox/RecordingView.tsx
index 0e386b093..8c0f5efef 100644
--- a/src/client/views/nodes/RecordingBox/RecordingView.tsx
+++ b/src/client/views/nodes/RecordingBox/RecordingView.tsx
@@ -163,8 +163,9 @@ export function RecordingView(props: IRecordingViewProps) {
     // if this is called, then we're done recording all the segments
     const finish = () => {
         // call stop on the video recorder if active
+        console.log(videoRecorder.current?.state);
         videoRecorder.current?.state !== 'inactive' && videoRecorder.current?.stop();
-
+        console.log("this it")
         // end the streams (audio/video) to remove recording icon
         const stream = videoElementRef.current!.srcObject;
         stream instanceof MediaStream && stream.getTracks().forEach(track => track.stop());
diff --git a/src/client/views/nodes/trails/PresElementBox.tsx b/src/client/views/nodes/trails/PresElementBox.tsx
index aa514be3b..5de51dbe9 100644
--- a/src/client/views/nodes/trails/PresElementBox.tsx
+++ b/src/client/views/nodes/trails/PresElementBox.tsx
@@ -365,7 +365,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
 
     @undoBatch
     @action
-    startRecording = (e: React.MouseEvent, activeItem: Doc) => {
+    startRecording =    (e: React.MouseEvent, activeItem: Doc) => {
         e.stopPropagation();
         if (PresElementBox.videoIsRecorded(activeItem)) {
             // if we already have an existing recording
-- 
cgit v1.2.3-70-g09d2

