Beispiel #1
0
 public override void started(float timelineTime, Clock clock)
 {
     if (text != null)
     {
         finished    = false;
         textDisplay = TimelineController.showText(text, CameraName);
         if (textDisplay == null)
         {
             finished = true;
         }
         else
         {
             textDisplay.Position             = position;
             textDisplay.Size                 = size;
             textDisplay.FontName             = fontName;
             textDisplay.FontHeight           = fontHeight;
             textDisplay.TextAlign            = textAlign;
             textDisplay.ScenePoint           = scenePoint;
             textDisplay.PositionOnScenePoint = positionOnScenePoint;
         }
     }
     else
     {
         finished = true;
     }
 }
        void TimelineController_PlaybackStopped(object sender, EventArgs e)
        {
            TimelineController timelineController = (TimelineController)sender;

            timelineController.TimelinePlaybackStopped -= TimelineController_PlaybackStopped;
            timelineController.ContinuePrompt.hidePrompt();
        }
        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));
        }
Beispiel #4
0
 public override void editing()
 {
     if (imageFile != null)
     {
         imageDisplay = TimelineController.showImage(imageFile, CameraName);
         if (imageDisplay != null)
         {
             setupImageDisplay();
         }
     }
 }
 public StartEmbeddedMvcTask(String uniqueName, String name, String iconName, String category, Type typeInAssembly, String resourceRoot, String mvcContextName, TimelineController timelineController, AnomalousMvcCore mvcCore, bool sortFiles = false, int weight = DEFAULT_WEIGHT)
     : base(uniqueName, name, iconName, category)
 {
     this.mvcCore            = mvcCore;
     this.ShowOnTaskbar      = false;
     this.Weight             = weight;
     this.mvcContextName     = mvcContextName;
     this.timelineController = timelineController;
     this.assembly           = typeInAssembly.Assembly;
     this.resourceRoot       = resourceRoot;
     this.sortFiles          = sortFiles;
 }
Beispiel #6
0
 public override void editing()
 {
     if (text != null)
     {
         textDisplay = TimelineController.showText(text, CameraName);
         if (textDisplay != null)
         {
             textDisplay.Position             = position;
             textDisplay.Size                 = size;
             textDisplay.FontName             = fontName;
             textDisplay.FontHeight           = fontHeight;
             textDisplay.TextAlign            = textAlign;
             textDisplay.ScenePoint           = scenePoint;
             textDisplay.PositionOnScenePoint = positionOnScenePoint;
             textDisplay.Editable             = true;
             textDisplay.TextEdited          += new EventDelegate <ITextDisplay, string>(textDisplay_TextEdited);
         }
     }
 }
Beispiel #7
0
 public override void started(float timelineTime, Clock clock)
 {
     if (imageFile != null)
     {
         finished     = false;
         imageDisplay = TimelineController.showImage(imageFile, CameraName);
         if (imageDisplay == null)
         {
             finished = true;
         }
         else
         {
             setupImageDisplay();
         }
     }
     else
     {
         finished = true;
     }
 }
Beispiel #8
0
 public override void started(float timelineTime, Clock clock)
 {
     if (soundFile != null)
     {
         finished = false;
         source   = TimelineController.playSound(soundFile);
         if (source != null)
         {
             source.PlaybackFinished += source_PlaybackFinished;
         }
         else
         {
             finished = true;
         }
     }
     else
     {
         finished = true;
     }
 }
Beispiel #9
0
 public override void doAction()
 {
     if (showContinuePrompt)
     {
         timelineControllerAfterDoAction = TimelineController;
         TimelineController.showContinuePrompt("Continue", changeTimelineButton);
     }
     else
     {
         Timeline timeline = TimelineController.openTimeline(TargetTimeline);
         if (timeline != null)
         {
             TimelineController.queueTimeline(timeline);
         }
         else
         {
             Log.Error("Cannot load timeline {0}. It cannot be found.", TargetTimeline);
         }
     }
 }
 public override void doAction()
 {
     TimelineController.openNewScene(Scene);
 }
        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 }));
        }
Beispiel #12
0
 public EditorController(StandaloneController standaloneController, TimelineController timelineController)
 {
     this.timelineController   = timelineController;
     this.standaloneController = standaloneController;
     EditorContextRuntimeName  = "Editor.CurrentEditor";
 }
Beispiel #13
0
 public void giveGUIsToTimelineController(TimelineController timelineController)
 {
     timelineController.ContinuePrompt      = continuePrompt;
     timelineController.ImageDisplayFactory = imageDisplayFactory;
     timelineController.TextDisplayFactory  = textDisplayFactory;
 }
Beispiel #14
0
        public void initializeControllers(BackgroundScene background, LicenseManager licenseManager)
        {
            //Background
            this.background     = background;
            this.LicenseManager = licenseManager;
            atlasPluginManager  = new AtlasPluginManager(this);
            atlasPluginManager.PluginLoadError += new Medical.AtlasPluginManager.PluginMessageDelegate(atlasPluginManager_PluginLoadError);
            atlasPluginManager.manageInstalledPlugins();

            clipboard = new SaveableClipboard();

            //Documents
            DocumentController = new DocumentController();

            //MDI Layout
            mdiLayout = new MDILayoutManager();

            //SceneView
            MyGUIInterface myGUI = MyGUIInterface.Instance;

            sceneViewController = new SceneViewController(mdiLayout, medicalController.EventManager, medicalController.MainTimer, medicalController.PluginManager.RendererPlugin.PrimaryWindow, myGUI.OgrePlatform.RenderManager, background);
            sceneViewController.WindowCreated         += sceneViewController_WindowCreated;
            sceneViewController.WindowDestroyed       += sceneViewController_WindowDestroyed;
            sceneViewController.DefaultBackgroundColor = new Color(0.274f, 0.274f, 0.274f);
            sceneStatsDisplayManager = new SceneStatsDisplayManager(sceneViewController, OgreInterface.Instance.OgrePrimaryWindow.OgreRenderTarget);
            sceneStatsDisplayManager.StatsVisible        = MedicalConfig.EngineConfig.ShowStatistics;
            MedicalConfig.EngineConfig.ShowStatsToggled += engineConfig => sceneStatsDisplayManager.StatsVisible = engineConfig.ShowStatistics;
            lightManager = PluginManager.Instance.RendererPlugin.createSceneViewLightManager();

            //Measurement grid
            measurementGrid = new MeasurementGrid("MeasurementGrid", sceneViewController);
            SceneUnloading += measurementGrid.sceneUnloading;
            SceneLoaded    += measurementGrid.sceneLoaded;

            //Image Renderer
            imageRenderer                       = new ImageRenderer(medicalController, sceneViewController, idleHandler);
            imageRenderer.Background            = background;
            imageRenderer.ImageRenderStarted   += measurementGrid.ScreenshotRenderStarted;
            imageRenderer.ImageRenderCompleted += measurementGrid.ScreenshotRenderCompleted;

            //Anatomy Controller
            anatomyController = new AnatomyController();

            //Medical states
            medicalStateController = new MedicalStateController(imageRenderer, medicalController);
            SceneLoaded           += medicalStateController.sceneLoaded;
            SceneUnloading        += medicalStateController.sceneUnloading;

            //Movement sequences
            movementSequenceController = new MovementSequenceController(medicalController);
            this.SceneLoaded          += movementSequenceController.sceneLoaded;
            musclePositionController   = new MusclePositionController(medicalController.MainTimer, this);

            SceneLoaded    += SleepyActorRepository.SceneLoaded;
            SceneUnloading += SleepyActorRepository.SceneUnloading;

            //Props
            propFactory = new PropFactory(this);

            //Timeline
            timelineController = new TimelineController(this);

            viewHostFactory = new MyGUIViewHostFactory(mdiLayout);
            mvcCore         = new AnomalousMvcCore(this, viewHostFactory);

            //Patient data
            patientDataController = new PatientDataController(this);

            //Tasks
            taskController = new TaskController();

            anatomyTaskManager = new AnatomyTaskManager(taskController, guiManager);

            //Coroutine
            Coroutine.SetTimer(medicalController.MainTimer);

            //Notifications
            notificationManager = new NotificationGUIManager();

            layerController = new LayerController();

            //Create virtual texture manager
            virtualTextureSceneViewLink = new VirtualTextureSceneViewLink(this);
        }
 private void skipToEndButton()
 {
     TimelineController.stopPlayback(true);
 }
 public override void doAction()
 {
     TimelineController.showContinuePrompt("Skip", skipToEndButton);
     TimelineController.TimelinePlaybackStopped += TimelineController_PlaybackStopped;
 }