Example #1
0
        public void initialize(StandaloneController standaloneController)
        {
            GUIManager guiManager = standaloneController.GUIManager;

            guiManager.MainGUIShown  += new Action(guiManager_MainGUIShown);
            guiManager.MainGUIHidden += new Action(guiManager_MainGUIHidden);

            //Prop Mover
            MedicalController medicalController = standaloneController.MedicalController;

            propMover = new SimObjectMover("Props", medicalController.PluginManager.RendererPlugin, medicalController.EventManager, standaloneController.SceneViewController);

            this.standaloneController = standaloneController;
            editorTimelineController  = new TimelineController(standaloneController);
            standaloneController.giveGUIsToTimelineController(editorTimelineController);

            scratchAreaController = new ScratchAreaController(standaloneController.Clipboard);

            //Controller
            editorController = new EditorController(standaloneController, editorTimelineController);
            standaloneController.DocumentController.addDocumentHandler(new ProjectDocumentHandler(editorController));
            standaloneController.DocumentController.UnknownDocumentHander = new UnknownDocumentHandler(editorController);
            propEditController = new PropEditController(propMover);

            //UI Helpers
            editorUICallback = new EditorUICallback(standaloneController, editorController, propEditController);

            typeControllerManager = new TypeControllerManager(standaloneController, this);
            typeControllerManager.FilesystemWatcherCreated += typeControllerManager_FilesystemWatcherCreated;

            //Dialogs
            scratchArea = new ScratchArea(scratchAreaController, editorUICallback);
            guiManager.addManagedDialog(scratchArea);

            projectExplorer = new ProjectExplorer(editorController, typeControllerManager);
            guiManager.addManagedDialog(projectExplorer);

            //Tasks Menu
            TaskController taskController = standaloneController.TaskController;

            aspectRatioTask = new AspectRatioTask(standaloneController.SceneViewController);

            if (MedicalConfig.ShowDeveloperTools)
            {
                taskController.addTask(new MDIDialogOpenTask(scratchArea, "Medical.ScratchArea", "Scratch Area", "EditorIcons.ScratchAreaIcon", TaskMenuCategories.Create));
                taskController.addTask(new MDIDialogOpenTask(projectExplorer, "Medical.EditorTools", "Editor Tools", "EditorIcons.EditorTools", TaskMenuCategories.Create));
                taskController.addTask(aspectRatioTask);
            }

            editorTaskbarFactory = new EditorTaskbarFactory(editorController);
            standaloneController.ViewHostFactory.addFactory(new EditorInfoBarFactory());
            standaloneController.ViewHostFactory.addFactory(new TextEditorComponentFactory());
            standaloneController.ViewHostFactory.addFactory(editorTaskbarFactory);
            CommonEditorResources.initialize(standaloneController);

            editorController.ProjectChanged += editorController_ProjectChanged;

            //Editor Views
            standaloneController.ViewHostFactory.addFactory(new OffsetSequenceEditorFactory(standaloneController.MedicalController, standaloneController.Clipboard));
        }
 public override void editing(PropEditController propEditController)
 {
     if (PropSimObject != null)
     {
         arrow       = PropSimObject.getElement(Arrow.ArrowBehaviorName) as Arrow;
         arrow.Color = ArrowColor;
     }
 }
Example #3
0
 public override void editing(PropEditController propEditController)
 {
     if (PropSimObject != null)
     {
         caliper = PropSimObject.getElement(Caliper.BehaviorName) as Caliper;
         caliper.setMeasurement(Millimeters);
     }
 }
 public override void editing(PropEditController propEditController)
 {
     findHandBehavior();
     Thumb.apply();
     Index.apply();
     Middle.apply();
     Ring.apply();
     Pinky.apply();
 }
 public override void editing(PropEditController propEditController)
 {
     if (PropSimObject != null)
     {
         arrow            = PropSimObject.getElement(Arrow.ArrowBehaviorName) as Arrow;
         arrow.Scale      = scale;
         arrow.TailLength = tailLength;
     }
 }
Example #6
0
 public override void editing(PropEditController propEditController)
 {
     if (PropSimObject != null)
     {
         plane       = PropSimObject.getElement(Plane.BehaviorName) as Plane;
         plane.Color = color;
         plane.Size  = size;
         plane.createObject();
     }
 }
 public override void editing(PropEditController propEditController)
 {
     if (PropSimObject != null)
     {
         line        = PropSimObject.getElement(LineProp.BehaviorName) as LineProp;
         line.Length = length;
         line.Color  = color;
         line.createLine();
     }
 }
 public override void editing(PropEditController propEditController)
 {
     if (PropSimObject != null)
     {
         syringe = PropSimObject.getElement(Syringe.BehaviorName) as Syringe;
         if (syringe != null)
         {
             syringe.setPlungePosition(PlungePercentage);
         }
     }
 }
 public override void editing(PropEditController propEditController)
 {
     if (PropSimObject != null)
     {
         highlight           = PropSimObject.getElement(CircularHighlight.BehaviorName) as CircularHighlight;
         highlight.MajorAxis = majorAxis;
         highlight.MinorAxis = minorAxis;
         highlight.Theta     = theta;
         highlight.Color     = color;
         highlight.Thickness = thickness;
         highlight.createEllipse();
     }
 }
 public override void editing(PropEditController propEditController)
 {
 }
 public virtual void editingCompleted(PropEditController propEditController)
 {
 }
        public TypeControllerManager(StandaloneController standaloneController, EditorPlugin plugin)
        {
            this.standaloneController = standaloneController;
            propEditController        = plugin.PropEditController;
            EditorController editorController = plugin.EditorController;

            editorController.ProjectChanged          += editorController_ProjectChanged;
            editorController.ResourceProviderClosing += editorController_ResourceProviderClosing;
            editorController.ResourceProviderOpened  += editorController_ResourceProviderOpened;

            //MVC Type Controller
            MvcTypeController mvcTypeController = new MvcTypeController(editorController);

            mvcTypeController.OpenEditor += (file, editingMvcContex) =>
            {
                mvcEditorContext = new MvcEditorContext(editingMvcContex, file, mvcTypeController, plugin.EditorController, plugin.UICallback);
                plugin.UICallback.CurrentEditingMvcContext = editingMvcContex;
                if (standaloneController.SharePluginController != null)
                {
                    CallbackTask cleanupBeforeShareTask = new CallbackTask("Lecture.SharePluginTask", standaloneController.SharePluginController.Name, standaloneController.SharePluginController.IconName, standaloneController.SharePluginController.Category, 0, false, (item) =>
                    {
                        MessageBox.show("Before sharing your Editor Project it will be saved. Do you wish to continue?", "Share Editor Project", MessageBoxStyle.IconQuest | MessageBoxStyle.Yes | MessageBoxStyle.No, (result) =>
                        {
                            if (result == MessageBoxStyle.Yes)
                            {
                                editorController.saveAllCachedResources();
                                standaloneController.SharePluginController.sharePlugin(editorController.ResourceProvider.BackingProvider, PluginCreationTool.EditorTools);
                            }
                        });
                    });
                    mvcEditorContext.addTask(cleanupBeforeShareTask);
                }
                mvcEditorContext.Focused += (obj) =>
                {
                    mvcEditorContext = obj;
                };
                mvcEditorContext.Blured += (obj) =>
                {
                    if (mvcEditorContext == obj)
                    {
                        mvcEditorContext = null;
                    }
                };
                editorController.runEditorContext(mvcEditorContext.MvcContext);
            };

            //Rml type controller
            RmlTypeController rmlTypeController = new RmlTypeController(editorController);

            rmlTypeController.OpenEditor += (file) =>
            {
                rmlEditorContext        = new RmlEditorContext(file, rmlTypeController, mvcTypeController.CurrentObject, plugin.EditorController, plugin.UICallback);
                rmlEditorContext.Focus += (obj) =>
                {
                    rmlEditorContext = obj;
                };
                rmlEditorContext.Blur += obj =>
                {
                    rmlTypeController.updateCachedText(obj.CurrentFile, obj.CurrentText);
                    if (rmlEditorContext == obj)
                    {
                        rmlEditorContext = null;
                    }
                };
                editorController.runEditorContext(rmlEditorContext.MvcContext);
            };

            //Rcss Type Controller
            RcssTypeController rcssTypeController = new RcssTypeController(editorController);

            rcssTypeController.OpenEditor += (file) =>
            {
                rcssEditorContext        = new RcssEditorContext(file, rmlTypeController.LastRmlFile, rcssTypeController);
                rcssEditorContext.Focus += (obj) =>
                {
                    rcssEditorContext = obj;
                };
                rcssEditorContext.Blur += (obj) =>
                {
                    rcssTypeController.updateCachedText(obj.CurrentFile, obj.CurrentText);
                    if (rcssEditorContext == obj)
                    {
                        rcssEditorContext = null;
                    }
                };
                editorController.runEditorContext(rcssEditorContext.MvcContext);
            };

            //Plugin type controller
            PluginTypeController pluginTypeController = new PluginTypeController(editorController);

            pluginTypeController.OpenEditor += (file, ddPlugin) =>
            {
                pluginEditorContext        = new PluginEditorContext(ddPlugin, file, pluginTypeController, plugin.EditorController, plugin.UICallback, standaloneController);
                pluginEditorContext.Focus += obj =>
                {
                    pluginEditorContext = obj;
                };
                pluginEditorContext.Blur += obj =>
                {
                    if (pluginEditorContext == obj)
                    {
                        pluginEditorContext = null;
                    }
                };
                editorController.runEditorContext(pluginEditorContext.MvcContext);
            };

            //Dependency type controller
            DependencyTypeController dependencyTypeController = new DependencyTypeController(editorController);

            dependencyTypeController.OpenEditor += (file, ddDep) =>
            {
                dependencyEditorContext        = new DependencyEditorContext(ddDep, file, dependencyTypeController, plugin.EditorController, plugin.UICallback);
                dependencyEditorContext.Focus += obj =>
                {
                    dependencyEditorContext = obj;
                };
                dependencyEditorContext.Blur += obj =>
                {
                    if (dependencyEditorContext == obj)
                    {
                        dependencyEditorContext = null;
                    }
                };
                editorController.runEditorContext(dependencyEditorContext.MvcContext);
            };

            //Movement Sequence type controller
            MovementSequenceTypeController movementSequenceTypeController = new MovementSequenceTypeController(editorController);

            movementSequenceTypeController.OpenEditor += (file, movementSequence) =>
            {
                movementSequenceEditorContext        = new MovementSequenceEditorContext(movementSequence, file, movementSequenceTypeController);
                movementSequenceEditorContext.Focus += obj =>
                {
                    movementSequenceEditorContext = obj;
                };
                movementSequenceEditorContext.Blur += obj =>
                {
                    if (movementSequenceEditorContext == obj)
                    {
                        movementSequenceEditorContext = null;
                    }
                };
                editorController.runEditorContext(movementSequenceEditorContext.MvcContext);
            };



            //Movement Sequence type controller
            OffsetSequenceTypeController offsetSequenceTypeController = new OffsetSequenceTypeController(editorController);

            offsetSequenceTypeController.OpenEditor += (file, movementSequence) =>
            {
                offsetSequenceEditorContext        = new OffsetSequenceEditorContext(movementSequence, file, offsetSequenceTypeController, plugin.UICallback, plugin.SimObjectMover);
                offsetSequenceEditorContext.Focus += obj =>
                {
                    offsetSequenceEditorContext = obj;
                };
                offsetSequenceEditorContext.Blur += obj =>
                {
                    if (offsetSequenceEditorContext == obj)
                    {
                        offsetSequenceEditorContext = null;
                    }
                };
                editorController.runEditorContext(offsetSequenceEditorContext.MvcContext);
            };

            //TRML Type controller
            TRmlTypeController trmlTypeController = new TRmlTypeController(editorController);

            trmlTypeController.OpenEditor += (file) =>
            {
                trmlEditorContext        = new TRmlEditorContext(file, rmlTypeController.LastRmlFile, trmlTypeController);
                trmlEditorContext.Focus += obj =>
                {
                    trmlEditorContext = obj;
                };
                trmlEditorContext.Blur += obj =>
                {
                    trmlTypeController.updateCachedText(obj.CurrentFile, obj.CurrentText);
                    if (trmlEditorContext == obj)
                    {
                        trmlEditorContext = null;
                    }
                };
                editorController.runEditorContext(trmlEditorContext.MvcContext);
            };

            //Timeline type controller
            TimelineTypeController timelineTypeController = new TimelineTypeController(editorController);

            timelineTypeController.OpenEditor += (file, timeline) =>
            {
                propEditController.removeAllOpenProps();
                timelineEditorContext        = new TimelineEditorContext(timeline, file, timelineTypeController, propEditController, standaloneController.PropFactory, plugin.EditorController, plugin.UICallback, plugin.TimelineController);
                timelineEditorContext.Focus += obj =>
                {
                    timelineEditorContext = obj;
                };
                timelineEditorContext.Blur += obj =>
                {
                    if (obj == timelineEditorContext)
                    {
                        timelineEditorContext = null;
                    }
                };
                editorController.runEditorContext(timelineEditorContext.MvcContext);
            };

            //Xml Type Controller
            XmlTypeController xmlTypeController = new XmlTypeController(editorController);

            xmlTypeController.OpenEditor += (file) =>
            {
                xmlEditorContext        = new XmlEditorContext(file, rmlTypeController.LastRmlFile, xmlTypeController);
                xmlEditorContext.Focus += (obj) =>
                {
                    xmlEditorContext = obj;
                };
                xmlEditorContext.Blur += (obj) =>
                {
                    xmlTypeController.updateCachedText(obj.CurrentFile, obj.CurrentText);
                    if (xmlEditorContext == obj)
                    {
                        xmlEditorContext = null;
                    }
                };
                editorController.runEditorContext(xmlEditorContext.MvcContext);
            };

            //Prop type controller
            PropTypeController propTypeController = new PropTypeController(editorController);

            propTypeController.OpenEditor += (file, propDefinition) =>
            {
                propEditorContext        = new PropEditorContext(propDefinition, file, propTypeController, plugin.EditorController, plugin.UICallback);
                propEditorContext.Focus += obj =>
                {
                    propEditorContext = obj;
                };
                propEditorContext.Blur += obj =>
                {
                    if (propEditorContext == obj)
                    {
                        propEditorContext = null;
                    }
                };
                editorController.runEditorContext(propEditorContext.MvcContext);
            };

            //Add item templates
            editorController.addItemTemplate(new EmptyViewItemTemplate(rmlTypeController, mvcTypeController));
            editorController.addItemTemplate(new ViewWithTimelineItemTemplate(rmlTypeController, mvcTypeController, timelineTypeController));

            //Add type controllers to editor controller, this also adds some item templates
            editorController.addTypeController(timelineTypeController);
            editorController.addTypeController(movementSequenceTypeController);
            editorController.addTypeController(offsetSequenceTypeController);
            editorController.addTypeController(rmlTypeController);
            editorController.addTypeController(trmlTypeController);
            editorController.addTypeController(rcssTypeController);
            editorController.addTypeController(mvcTypeController);
            editorController.addTypeController(pluginTypeController);
            editorController.addTypeController(dependencyTypeController);
            editorController.addTypeController(xmlTypeController);
            editorController.addTypeController(propTypeController);

            //Add any final item templates
            editorController.addItemTemplate(new PluginBrandingResourceItemTemplate());
        }
Example #13
0
 public override void editing(PropEditController propEditController)
 {
     movePreviewProp(Translation, Rotation);
     propEditController.CurrentMovePropAction = this;
     propEditController.ShowTools             = true;
 }
Example #14
0
        public CommonUICallback(StandaloneController standaloneController, EditorController editorController, PropEditController propEditController)
        {
            this.editorController     = editorController;
            this.standaloneController = standaloneController;
            this.propEditController   = propEditController;

            this.addOneWayCustomQuery(CameraPosition.CustomEditQueries.CaptureCameraPosition, delegate(CameraPosition camPos)
            {
                SceneViewWindow activeWindow = standaloneController.SceneViewController.ActiveWindow;
                if (activeWindow != null)
                {
                    camPos.Translation = activeWindow.Translation;
                    camPos.LookAt      = activeWindow.LookAt;
                    activeWindow.calculateIncludePoint(camPos);
                }
            });

            this.addOneWayCustomQuery(CameraPosition.CustomEditQueries.PreviewCameraPosition, delegate(CameraPosition camPos)
            {
                SceneViewWindow activeWindow = standaloneController.SceneViewController.ActiveWindow;
                if (activeWindow != null)
                {
                    CameraPosition undo = activeWindow.createCameraPosition();
                    activeWindow.setPosition(camPos, MedicalConfig.CameraTransitionTime);
                    activeWindow.pushUndoState(undo);
                }
            });

            this.addCustomQuery <PresetState>(ChangeMedicalStateCommand.CustomEditQueries.CapturePresetState, delegate(SendResult <PresetState> resultCallback)
            {
                PresetStateCaptureDialog stateCaptureDialog = new PresetStateCaptureDialog(resultCallback);
                stateCaptureDialog.SmoothShow = true;
                stateCaptureDialog.open(true);
            });

            this.addOneWayCustomQuery(RmlView.CustomQueries.OpenFileInRmlViewer, delegate(String file)
            {
                editorController.openEditor(file);
            });

            this.addCustomQuery <Browser>(ViewCollection.CustomQueries.CreateViewBrowser, delegate(SendResult <Browser> resultCallback)
            {
                Browser browser = new Browser("Views", "Choose View Type");
                standaloneController.MvcCore.ViewHostFactory.createViewBrowser(browser);
                String errorPrompt = null;
                resultCallback(browser, ref errorPrompt);
            });

            this.addCustomQuery <Browser>(ModelCollection.CustomQueries.CreateModelBrowser, delegate(SendResult <Browser> resultCallback)
            {
                Browser browser = new Browser("Models", "Choose Model Type");

                browser.addNode(null, null, new BrowserNode("DataModel", typeof(DataModel), DataModel.DefaultName));
                browser.addNode(null, null, new BrowserNode("Navigation", typeof(NavigationModel), NavigationModel.DefaultName));
                browser.addNode(null, null, new BrowserNode("MedicalStateInfo", typeof(MedicalStateInfoModel), MedicalStateInfoModel.DefaultName));
                browser.addNode(null, null, new BrowserNode("BackStack", typeof(BackStackModel), BackStackModel.DefaultName));
                String error = null;
                resultCallback(browser, ref error);
            });

            this.addCustomQuery <Type>(RunCommandsAction.CustomQueries.ShowCommandBrowser, delegate(SendResult <Type> resultCallback)
            {
                this.showBrowser(RunCommandsAction.CreateCommandBrowser(), resultCallback);
            });

            this.addCustomQuery <Color>(ShowTextAction.CustomQueries.ChooseColor, queryDelegate =>
            {
                ColorDialog colorDialog = new ColorDialog();
                colorDialog.showModal((result, color) =>
                {
                    if (result == NativeDialogResult.OK)
                    {
                        String errorPrompt = null;
                        queryDelegate.Invoke(color, ref errorPrompt);
                    }
                });
            });

            this.addOneWayCustomQuery <ShowPropAction>(ShowPropAction.CustomQueries.KeepOpenToggle, showPropAction =>
            {
                if (showPropAction.KeepOpen)
                {
                    propEditController.removeOpenProp(showPropAction);
                }
                else
                {
                    propEditController.addOpenProp(showPropAction);
                }
            });

            this.addSyncCustomQuery <Browser, IEnumerable <String>, String>(FileBrowserEditableProperty.CustomQueries.BuildBrowser, (searchPattern, prompt) =>
            {
                return(createFileBrowser(searchPattern, prompt));
            });

            this.addSyncCustomQuery <Browser>(AnatomyManager.CustomQueries.BuildBrowser, () =>
            {
                return(AnatomyManager.buildBrowser());
            });

            this.addSyncCustomQuery <Browser>(PropBrowserEditableProperty.CustomQueries.BuildBrowser, () =>
            {
                Browser browser = new Browser("Props", "Choose Prop");
                foreach (var propDef in standaloneController.TimelineController.PropFactory.PropDefinitions)
                {
                    if (standaloneController.LicenseManager.allowPropUse(propDef.PropLicenseId))
                    {
                        browser.addNode(propDef.BrowserPath, new BrowserNode(propDef.PrettyName, propDef.Name));
                    }
                }
                return(browser);
            });

            this.addSyncCustomQuery <Browser>(ElementNameEditableProperty.CustomQueries.BuildBrowser, () =>
            {
                Browser browser = new Browser("Screen Location Name", "Choose Screen Location Name");
                foreach (var elementName in standaloneController.GUIManager.NamedLinks)
                {
                    browser.addNode(null, null, new BrowserNode(elementName.UniqueDerivedName, elementName));
                }
                return(browser);
            });

            addOneWayCustomQuery <String>(PlaySoundAction.CustomQueries.EditExternally, soundFile =>
            {
                if (soundFile != null && editorController.ResourceProvider.exists(soundFile))
                {
                    String fullPath = editorController.ResourceProvider.getFullFilePath(soundFile);
                    OtherProcessManager.openLocalURL(fullPath);
                }
            });
        }
 public override void editing(PropEditController propEditController)
 {
     //movePreviewProp(Translation, Rotation);
 }
Example #16
0
 public override void editingCompleted(PropEditController propEditController)
 {
     caliper = null;
 }
Example #17
0
 public override void editingCompleted(PropEditController propEditController)
 {
     propEditController.CurrentMovePropAction = null;
     propEditController.ShowTools             = false;
     base.editingCompleted(propEditController);
 }
        public TimelineEditorContext(Timeline timeline, String path, TimelineTypeController timelineTypeController, PropEditController propEditController, PropFactory propFactory, EditorController editorController, GuiFrameworkUICallback uiCallback, TimelineController timelineController)
        {
            this.currentTimeline        = timeline;
            this.currentFile            = path;
            this.timelineTypeController = timelineTypeController;
            this.propEditController     = propEditController;

            mvcContext = new AnomalousMvcContext();
            mvcContext.StartupAction = "Common/Start";
            mvcContext.FocusAction   = "Common/Focus";
            mvcContext.BlurAction    = "Common/Blur";
            mvcContext.SuspendAction = "Common/Suspended";
            mvcContext.ResumeAction  = "Common/Resumed";

            mvcContext.Models.add(new EditMenuManager());
            mvcContext.Models.add(new EditInterfaceHandler());

            mvcContext.Views.add(new TimelineEditorView("TimelineEditor", currentTimeline, timelineController, editorController, propEditController));

            ExpandingGenericEditorView genericEditor = new ExpandingGenericEditorView("TimelinePropertiesEditor", currentTimeline.getEditInterface(), editorController, uiCallback);

            genericEditor.ElementName = new MDILayoutElementName(GUILocationNames.MDI, DockLocation.Left);
            mvcContext.Views.add(genericEditor);

            PropTimelineView propTimelineView = new PropTimelineView("PropTimeline", propEditController, propFactory);

            propTimelineView.Buttons.add(new CloseButtonDefinition("Close", "PropTimeline/Close"));
            mvcContext.Views.add(propTimelineView);

            OpenPropManagerView propManagerView = new OpenPropManagerView("PropManager", propEditController);

            propManagerView.Buttons.add(new CloseButtonDefinition("Close", "PropManager/Close"));
            mvcContext.Views.add(propManagerView);

            MovementSequenceEditorView movementSequenceEditor = new MovementSequenceEditorView("MovementSequenceEditor", listenForSequenceChanges: true);

            movementSequenceEditor.Buttons.add(new CloseButtonDefinition("Close", "MovementSequenceEditor/Close"));
            movementSequenceEditor.ElementName = new MDILayoutElementName(GUILocationNames.MDI, DockLocation.Top);
            mvcContext.Views.add(movementSequenceEditor);

            EditorTaskbarView taskbar = new EditorTaskbarView("TimelineInfoBar", currentFile, "TimelineEditor/Close");

            taskbar.addTask(new CallbackTask("SaveAll", "Save All", "Editor/SaveAllIcon", "", 0, true, item =>
            {
                saveAll();
            }));
            taskbar.addTask(new RunMvcContextActionTask("Save", "Save Timeline", "CommonToolstrip/Save", "", "TimelineEditor/Save", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("Cut", "Cut", "Editor/CutIcon", "", "TimelineEditor/Cut", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("Copy", "Copy", "Editor/CopyIcon", "", "TimelineEditor/Copy", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("Paste", "Paste", "Editor/PasteIcon", "", "TimelineEditor/Paste", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("SelectAll", "Select All", "Editor/SelectAllIcon", "", "TimelineEditor/SelectAll", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("Translation", "Translation", "Editor/TranslateIcon", "", "TimelineEditor/Translation", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("Rotation", "Rotation", "Editor/RotateIcon", "", "TimelineEditor/Rotation", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("PropTimeline", "Prop Timeline Editor", "Editor/PropTimelineEditorIcon", "", "PropTimeline/ShowIfNotOpen", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("PropManager", "Open Prop Manager", "Editor/PropManagerIcon", "", "PropManager/ShowIfNotOpen", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("MovementSequenceEditor", "Movement Sequence Editor", "Editor/MovementSequenceEditorIcon", "", "MovementSequenceEditor/ShowIfNotOpen", mvcContext));
            mvcContext.Views.add(taskbar);

            mvcContext.Controllers.add(new MvcController("TimelineEditor",
                                                         new RunCommandsAction("Show",
                                                                               new ShowViewCommand("TimelineEditor"),
                                                                               new ShowViewCommand("TimelinePropertiesEditor"),
                                                                               new ShowViewCommand("TimelineInfoBar")
                                                                               ),
                                                         new RunCommandsAction("Close",
                                                                               new CloseAllViewsCommand()),
                                                         new CallbackAction("Save", context =>
            {
                timelineTypeController.saveTimeline(currentTimeline, currentFile);
            }),
                                                         new CutAction(),
                                                         new CopyAction(),
                                                         new PasteAction(),
                                                         new SelectAllAction(),
                                                         new CallbackAction("Translation", context =>
            {
                propEditController.setMoveMode();
            }),
                                                         new CallbackAction("Rotation", context =>
            {
                propEditController.setRotateMode();
            })
                                                         ));

            mvcContext.Controllers.add(new MvcController("PropTimeline",
                                                         new RunCommandsAction("ShowIfNotOpen",
                                                                               new ShowViewIfNotOpenCommand("PropTimeline")
                                                                               ),
                                                         new RunCommandsAction("Close",
                                                                               new CloseViewCommand())));

            mvcContext.Controllers.add(new MvcController("PropManager",
                                                         new RunCommandsAction("ShowIfNotOpen",
                                                                               new ShowViewIfNotOpenCommand("PropManager")),
                                                         new RunCommandsAction("Close",
                                                                               new CloseViewCommand())));

            mvcContext.Controllers.add(new MvcController("MovementSequenceEditor",
                                                         new RunCommandsAction("ShowIfNotOpen",
                                                                               new ShowViewIfNotOpenCommand("MovementSequenceEditor")
                                                                               ),
                                                         new RunCommandsAction("Close",
                                                                               new CloseViewCommand())));

            mvcContext.Controllers.add(new MvcController("Common",
                                                         new RunCommandsAction("Start", new RunActionCommand("TimelineEditor/Show")),
                                                         new CallbackAction("Focus", context =>
            {
                GlobalContextEventHandler.setEventContext(eventContext);
                if (Focus != null)
                {
                    Focus.Invoke(this);
                }
            }),
                                                         new CallbackAction("Blur", context =>
            {
                GlobalContextEventHandler.disableEventContext(eventContext);
                propEditController.removeAllOpenProps();
                if (Blur != null)
                {
                    Blur.Invoke(this);
                }
            }),
                                                         new RunCommandsAction("Suspended", new SaveViewLayoutCommand()),
                                                         new RunCommandsAction("Resumed", new RestoreViewLayoutCommand())));

            eventContext = new EventContext();

            eventContext.addEvent(new ButtonEvent(EventLayers.Gui,
                                                  frameUp: eventManager =>
            {
                saveAll();
            },
                                                  keys: new KeyboardButtonCode[] { KeyboardButtonCode.KC_LCONTROL, KeyboardButtonCode.KC_S }));

            eventContext.addEvent(new ButtonEvent(EventLayers.Gui,
                                                  frameUp: eventManager =>
            {
                if (timeline.TimelineController.Playing)
                {
                    timeline.TimelineController.stopPlayback();
                }
                else
                {
                    timeline.TimelineController.startPlayback(timeline, propEditController.MarkerPosition, false);
                }
            },
                                                  keys: new KeyboardButtonCode[] { KeyboardButtonCode.KC_LCONTROL, KeyboardButtonCode.KC_SPACE }));

            eventContext.addEvent(new ButtonEvent(EventLayers.Gui,
                                                  frameUp: eventManager =>
            {
                mvcContext.runAction("TimelineEditor/Cut");
            },
                                                  keys: new KeyboardButtonCode[] { KeyboardButtonCode.KC_LCONTROL, KeyboardButtonCode.KC_X }));

            eventContext.addEvent(new ButtonEvent(EventLayers.Gui,
                                                  frameUp: eventManager =>
            {
                mvcContext.runAction("TimelineEditor/Copy");
            },
                                                  keys: new KeyboardButtonCode[] { KeyboardButtonCode.KC_LCONTROL, KeyboardButtonCode.KC_C }));

            eventContext.addEvent(new ButtonEvent(EventLayers.Gui,
                                                  frameUp: eventManager =>
            {
                mvcContext.runAction("TimelineEditor/Paste");
            },
                                                  keys: new KeyboardButtonCode[] { KeyboardButtonCode.KC_LCONTROL, KeyboardButtonCode.KC_V }));

            eventContext.addEvent(new ButtonEvent(EventLayers.Gui,
                                                  frameUp: eventManager =>
            {
                mvcContext.runAction("TimelineEditor/SelectAll");
            },
                                                  keys: new KeyboardButtonCode[] { KeyboardButtonCode.KC_LCONTROL, KeyboardButtonCode.KC_A }));

            eventContext.addEvent(new ButtonEvent(EventLayers.Gui,
                                                  frameUp: eventManager =>
            {
                mvcContext.runAction("TimelineEditor/Translation");
            },
                                                  keys: new KeyboardButtonCode[] { KeyboardButtonCode.KC_LCONTROL, KeyboardButtonCode.KC_T }));

            eventContext.addEvent(new ButtonEvent(EventLayers.Gui,
                                                  frameUp: eventManager =>
            {
                mvcContext.runAction("TimelineEditor/Rotation");
            },
                                                  keys: new KeyboardButtonCode[] { KeyboardButtonCode.KC_LCONTROL, KeyboardButtonCode.KC_R }));

            eventContext.addEvent(new ButtonEvent(EventLayers.Gui,
                                                  frameUp: EventManager =>
            {
                mvcContext.runAction("PropTimeline/ShowIfNotOpen");
            },
                                                  keys: new KeyboardButtonCode[] { KeyboardButtonCode.KC_LCONTROL, KeyboardButtonCode.KC_P }));
        }
 public override void editingCompleted(PropEditController propEditController)
 {
     highlight = null;
 }
Example #20
0
 public override void editingCompleted(PropEditController propEditController)
 {
     plane = null;
 }
 public abstract void editing(PropEditController propEditController);
 public override void editing(PropEditController propEditController)
 {
     doAttachment();
 }
        public EditorUICallback(StandaloneController standaloneController, EditorController editorController, PropEditController propEditController)
            : base(standaloneController, editorController, propEditController)
        {
            this.addOneWayCustomQuery(AnomalousMvcContext.CustomQueries.Preview, delegate(AnomalousMvcContext context)
            {
                previewMvcContext(context);
            });

            this.addSyncCustomQuery<Browser>(ViewBrowserEditableProperty.CustomQueries.BuildBrowser, () =>
            {
                Browser browser = new Browser("Views", "Choose View");
                if (CurrentEditingMvcContext != null)
                {
                    foreach (View view in CurrentEditingMvcContext.Views)
                    {
                        browser.addNode(null, null, new BrowserNode(view.Name, view.Name));
                    }
                }
                return browser;
            });

            this.addSyncCustomQuery<Browser, Type>(ModelBrowserEditableProperty.CustomQueries.BuildBrowser, (assignableFromType) =>
            {
                Browser browser = new Browser("Models", "Choose Model");
                if (CurrentEditingMvcContext != null)
                {
                    foreach (MvcModel model in CurrentEditingMvcContext.Models)
                    {
                        if (assignableFromType.IsAssignableFrom(model.GetType()))
                        {
                            browser.addNode(null, null, new BrowserNode(model.Name, model.Name));
                        }
                    }
                }
                return browser;
            });

            this.addOneWayCustomQuery(View.CustomQueries.AddControllerForView, delegate(View view)
            {
                AnomalousMvcContext context = CurrentEditingMvcContext;
                String controllerName = view.Name;
                if (context.Controllers.hasItem(controllerName))
                {
                    MessageBox.show(String.Format("There is already a controller named {0}. Cannot create a new one.", controllerName), "Error", MessageBoxStyle.IconError | MessageBoxStyle.Ok);
                }
                else
                {
                    MvcController controller = new MvcController(controllerName);
                    RunCommandsAction showCommand = new RunCommandsAction("Show");
                    showCommand.addCommand(new ShowViewCommand(view.Name));
                    controller.Actions.add(showCommand);

                    RunCommandsAction closeCommand = new RunCommandsAction("Close");
                    closeCommand.addCommand(new CloseViewCommand());
                    controller.Actions.add(closeCommand);
                    context.Controllers.add(controller);
                }
            });

            this.addSyncCustomQuery<Browser>(ActionBrowserEditableProperty.CustomQueries.BuildBrowser, () =>
            {
                return createActionBrowser();
            });

            this.addSyncCustomQuery<Browser>(ElementAttributeEditor.CustomQueries.BuildActionBrowser, () =>
            {
                return createActionBrowser();
            });

            this.addSyncCustomQuery<Browser, IEnumerable<String>, String, String>(ElementAttributeEditor.CustomQueries.BuildFileBrowser, (searchPatterns, prompt, leadingPath) =>
            {
                return createFileBrowser(searchPatterns, prompt, leadingPath);
            });

            this.addCustomQuery<String, String>(PlaySoundAction.CustomQueries.Record, (queryResult, soundFile) =>
            {
                this.getInputString("Enter a name for the sound file.", delegate(String result, ref String errorMessage)
                {
                    String finalSoundFile = Path.ChangeExtension(result, ".ogg");
                    String error = null;
                    QuickSoundRecorder.ShowDialog(standaloneController.MedicalController, finalSoundFile, editorController.ResourceProvider.openWriteStream,
                    newSoundFile =>
                    {
                        queryResult.Invoke(newSoundFile, ref error);
                    });
                    return true;
                });
            });

            this.addSyncCustomQuery<Browser>(TimelinePreActionEditInterface.CustomQueries.BuildActionBrowser, () =>
            {
                var browser = new Browser("Pre Actions", "Choose Pre Action");
                browser.addNode(null, null, new BrowserNode("Change Scene", typeof(OpenNewSceneAction)));
                browser.addNode(null, null, new BrowserNode("Show Skip To Post Actions Prompt", typeof(SkipToPostActions)));
                browser.addNode(null, null, new BrowserNode("Run Mvc Action", typeof(RunMvcAction)));
                return browser;
            });

            this.addSyncCustomQuery<Browser>(TimelinePostActionEditInterface.CustomQueries.BuildActionBrowser, () =>
            {
                var browser = new Browser("Post Actions", "Choose Post Action");
                browser.addNode(null, null, new BrowserNode("Load Another Timeline", typeof(LoadAnotherTimeline)));
                browser.addNode(null, null, new BrowserNode("Repeat Previous", typeof(RepeatPreviousPostActions)));
                browser.addNode(null, null, new BrowserNode("Run Mvc Action", typeof(RunMvcAction)));
                return browser;
            });
        }