예제 #1
0
 public override void setupAction(Slide slide, RunCommandsAction action)
 {
     action.addCommand(new PlayTimelineCommand()
     {
         Timeline = Path.Combine(slide.UniqueName, timelineFileName),
     });
 }
예제 #2
0
        private static void createController(AnomalousMvcContext mvcContext, String name, bool backButton)
        {
            MvcController     controller = new MvcController(name);
            RunCommandsAction show       = new RunCommandsAction("Show");

            show.addCommand(new ShowViewCommand(name));
            if (backButton)
            {
                show.addCommand(new RecordBackAction());
            }
            controller.Actions.add(show);
            RunCommandsAction close = new RunCommandsAction("Close");

            close.addCommand(new CloseViewCommand());
            controller.Actions.add(close);
            mvcContext.Controllers.add(controller);
        }
예제 #3
0
        public SetupSceneAction(String name, CameraPosition cameraPosition, LayerState layers, MusclePosition musclePosition, PresetState medicalState, bool captureHighlight, bool isHighlighted)
        {
            action         = new RunCommandsAction(name);
            Layers         = layers != null;
            Camera         = cameraPosition != null;
            MusclePosition = musclePosition != null;
            MedicalState   = medicalState != null;
            HighlightTeeth = captureHighlight;

            if (Layers)
            {
                ChangeLayersCommand changeLayersCommand = new ChangeLayersCommand();
                changeLayersCommand.Layers.copyFrom(layers);
                action.addCommand(changeLayersCommand);
            }

            if (MusclePosition)
            {
                SetMusclePositionCommand musclePositionCommand = new SetMusclePositionCommand();
                musclePositionCommand.MusclePosition = musclePosition;
                action.addCommand(musclePositionCommand);
            }

            if (Camera)
            {
                MoveCameraCommand moveCameraCommand = new MoveCameraCommand();
                moveCameraCommand.CameraPosition = cameraPosition;
                action.addCommand(moveCameraCommand);
            }

            if (MedicalState)
            {
                ChangeMedicalStateCommand medicalStateCommand = new ChangeMedicalStateCommand();
                medicalStateCommand.PresetState = medicalState;
                action.addCommand(medicalStateCommand);
            }

            if (HighlightTeeth)
            {
                action.addCommand(new ChangeTeethHighlightsCommand(isHighlighted));
            }

            AllowPreview = true;
        }
예제 #4
0
        public override void setupAction(Slide slide, RunCommandsAction action)
        {
            RunCommandsAction clone = CopySaver.Default.copy(this.action);

            foreach (var command in clone.Commands)
            {
                action.addCommand(command);
            }
            clone.clear();
        }
        public void createViews(String name, RunCommandsAction showCommand, AnomalousMvcContext context, SlideDisplayManager displayManager, Slide slide)
        {
            SlideInstanceLayoutStrategy instanceStrategy = createLayoutStrategy(displayManager);

            foreach (SlidePanel panel in panels.Values)
            {
                MyGUIView view = panel.createView(slide, name);
                instanceStrategy.addView(view);
                showCommand.addCommand(new ShowViewCommand(view.Name));
                context.Views.add(view);
            }
        }
예제 #6
0
        public void captureSceneState(EditUICallback callback)
        {
            action.clear();
            if (Layers)
            {
                ChangeLayersCommand changeLayers = new ChangeLayersCommand();
                changeLayers.Layers.captureState();
                action.addCommand(changeLayers);
            }

            if (MusclePosition)
            {
                SetMusclePositionCommand musclePosition = new SetMusclePositionCommand();
                musclePosition.MusclePosition.captureState();
                action.addCommand(musclePosition);
            }

            if (Camera)
            {
                MoveCameraCommand moveCamera = new MoveCameraCommand();
                callback.runOneWayCustomQuery(CameraPosition.CustomEditQueries.CaptureCameraPosition, moveCamera.CameraPosition);
                action.addCommand(moveCamera);
            }

            if (MedicalState)
            {
                ChangeMedicalStateCommand medicalState = new ChangeMedicalStateCommand();
                MedicalState medState = new MedicalState("");
                medState.update();
                medicalState.captureFromMedicalState(medState);
                action.addCommand(medicalState);
            }

            if (HighlightTeeth)
            {
                action.addCommand(new ChangeTeethHighlightsCommand(TeethController.HighlightContacts));
            }
        }
예제 #7
0
        public void setupContext(AnomalousMvcContext context, String name, ResourceProvider resourceProvider, SlideDisplayManager displayManager)
        {
            MvcController     controller  = new MvcController(name);
            RunCommandsAction showCommand = new RunCommandsAction("Show");

            showCommand.addCommand(new CloseAllViewsCommand());
            String timelinePath = Path.Combine(UniqueName, "Timeline.tl");

            if (resourceProvider.exists(timelinePath))
            {
                showCommand.addCommand(new PlayTimelineCommand(timelinePath));
            }
            foreach (var action in triggerActions.Values)
            {
                action.addToController(this, controller, context);
            }
            context.Controllers.add(controller);

            layoutStrategy.createViews(name, showCommand, context, displayManager, this);

            controller.Actions.add(showCommand);
            customizeController(controller, showCommand);
        }
예제 #8
0
        private void refreshPanelPreviews(RunCommandsAction showEditorWindowsCommand)
        {
            SlideDisplayManager         displayManager = new SlideDisplayManager(true);
            SlideInstanceLayoutStrategy instanceLayout = slide.LayoutStrategy.createLayoutStrategy(displayManager);

            foreach (RmlSlidePanel panel in slide.Panels.Where(p => p is RmlSlidePanel))
            {
                String  editorViewName = panel.createViewName("RmlView");
                RmlView rmlView        = new RmlView(editorViewName);
                rmlView.ElementName = panel.ElementName;
                rmlView.RmlFile     = panel.getRmlFilePath(slide);
                instanceLayout.addView(rmlView);
                mvcContext.Views.add(rmlView);
                showEditorWindowsCommand.addCommand(new ShowViewCommand(rmlView.Name));
            }
        }
        private void refreshPanelEditors(bool replaceExistingEditors)
        {
            int oldEditorCount = rmlEditors.Count;

            if (replaceExistingEditors)
            {
                mvcContext.runAction("Editor/CloseEditors");
            }
            currentRmlEditor = null;
            closeEditorWindowsCommand.clear();
            showEditorWindowsCommand.clear();
            foreach (var editor in rmlEditors.Values)
            {
                mvcContext.Views.remove(editor.View);
                if (editor.Component != null)
                {
                    editor.Component.ElementDraggedOffDocument -= RmlWysiwyg_ElementDraggedOffDocument;
                    editor.Component.ElementDroppedOffDocument -= RmlWysiwyg_ElementDroppedOffDocument;
                    editor.Component.ElementReturnedToDocument -= RmlWysiwyg_ElementReturnedToDocument;
                    editor.Component.cancelAndHideEditor();
                }
            }
            rmlEditors.Clear();

            SlideInstanceLayoutStrategy instanceLayout = slide.LayoutStrategy.createLayoutStrategy(displayManager);

            foreach (RmlSlidePanel panel in slide.Panels.Where(p => p is RmlSlidePanel))
            {
                String         editorViewName = panel.createViewName("RmlView");
                RmlWysiwygView rmlView        = new RmlWysiwygView(editorViewName, this.uiCallback, this.undoBuffer);
                rmlView.ElementName = panel.ElementName;
                rmlView.RmlFile     = panel.getRmlFilePath(slide);
                rmlView.ContentId   = "Content";
                instanceLayout.addView(rmlView);
                rmlView.ComponentCreated += (view, component) =>
                {
                    var editor = rmlEditors[view.Name];
                    editor.Component     = component;
                    component.RmlEdited += rmlEditor =>
                    {
                        String rml = rmlEditor.CurrentRml;
                        editor.CachedResource.CachedString = rml;
                        editorController.ResourceProvider.ResourceCache.add(editor.CachedResource);
                        updateThumbnail();
                    };
                    component.ElementDraggedOffDocument += RmlWysiwyg_ElementDraggedOffDocument;
                    component.ElementDroppedOffDocument += RmlWysiwyg_ElementDroppedOffDocument;
                    component.ElementReturnedToDocument += RmlWysiwyg_ElementReturnedToDocument;
                };
                rmlView.UndoRedoCallback = (rml) =>
                {
                    this.wysiwygUndoCallback(editorViewName, rml);
                };
                rmlView.RequestFocus += (view) =>
                {
                    setCurrentRmlEditor(view.Name);
                };
                rmlView.GetMissingRmlCallback = getDefaultMissingRml;
                rmlView.addCustomStrategy(imageStrategy);
                rmlView.addCustomStrategy(linkTriggerStrategy);
                rmlView.addCustomStrategy(buttonTriggerStragegy);
                rmlView.addCustomStrategy(inputStrategy);
                mvcContext.Views.add(rmlView);
                rmlEditors.Add(rmlView.Name, new RmlEditorViewInfo(rmlView, panel, editorController.ResourceProvider));
                showEditorWindowsCommand.addCommand(new ShowViewCommand(rmlView.Name));
                closeEditorWindowsCommand.addCommand(new CloseViewIfOpen(rmlView.Name));
                if (currentRmlEditor == null)
                {
                    setCurrentRmlEditor(rmlView.Name);
                }
            }

            if (replaceExistingEditors)
            {
                mvcContext.runAction("Editor/ShowEditors");
            }
        }
예제 #10
0
        public SlideEditorContext(Slide slide, String slideName, SlideshowEditController editorController, StandaloneController standaloneController, LectureUICallback uiCallback, UndoRedoBuffer undoBuffer, MedicalSlideItemTemplate itemTemplate, bool autoSetupScene, Action <String, String> wysiwygUndoCallback)
        {
            this.slide      = slide;
            this.uiCallback = uiCallback;
            if (uiCallback.hasCustomQuery(PlayTimelineAction.CustomActions.EditTimeline))
            {
                uiCallback.removeCustomQuery(PlayTimelineAction.CustomActions.EditTimeline);
            }
            uiCallback.addOneWayCustomQuery(PlayTimelineAction.CustomActions.EditTimeline, new Action <PlayTimelineAction>(action_EditTimeline));
            this.slideEditorController          = editorController;
            this.undoBuffer                     = undoBuffer;
            this.imageRenderer                  = standaloneController.ImageRenderer;
            this.itemTemplate                   = itemTemplate;
            this.wysiwygUndoCallback            = wysiwygUndoCallback;
            this.editorController               = editorController;
            this.layerController                = standaloneController.LayerController;
            this.sceneViewController            = standaloneController.SceneViewController;
            panelResizeWidget                   = new PanelResizeWidget();
            panelResizeWidget.RecordResizeUndo += panelResizeWidget_RecordResizeUndo;

            displayManager = new SlideDisplayManager(editorController.VectorMode);

            RunCommandsAction previewTriggerAction = new RunCommandsAction("PreviewTrigger");

            imageStrategy       = new SlideImageStrategy(slide, undoBuffer, this.slideEditorController.ResourceProvider, slide.UniqueName);
            linkTriggerStrategy = new SlideTriggerStrategy(slide, createTriggerActionBrowser(), undoBuffer, "a", "TriggerLink", "Lecture.Icon.TriggerIcon", standaloneController.NotificationManager, previewTriggerAction);
            linkTriggerStrategy.PreviewTrigger += triggerStrategy_PreviewTrigger;
            buttonTriggerStragegy = new SlideTriggerStrategy(slide, createTriggerActionBrowser(), undoBuffer, "button", "Trigger", "Lecture.Icon.TriggerIcon", standaloneController.NotificationManager, previewTriggerAction);
            buttonTriggerStragegy.PreviewTrigger += triggerStrategy_PreviewTrigger;
            inputStrategy = new SlideInputStrategy(slide, undoBuffer, standaloneController.NotificationManager, previewTriggerAction, "input", CommonResources.NoIcon);
            inputStrategy.PreviewTrigger += triggerStrategy_PreviewTrigger;

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

            showEditorWindowsCommand  = new RunCommandsAction("ShowEditors");
            closeEditorWindowsCommand = new RunCommandsAction("CloseEditors");

            RunCommandsAction showCommand = new RunCommandsAction("Show",
                                                                  new ShowViewCommand("InfoBar"),
                                                                  new RunActionCommand("Editor/SetupScene"),
                                                                  new RunActionCommand("Editor/ShowEditors")
                                                                  );

            refreshPanelEditors(false);

            htmlDragDrop = new DragAndDropTaskManager <WysiwygDragDropItem>(
                new WysiwygDragDropItem("Heading", "Editor/HeaderIcon", "<h1>Add Heading Here</h1>"),
                new WysiwygDragDropItem("Paragraph", "Editor/ParagraphsIcon", "<p>Add paragraph text here.</p>"),
                new WysiwygCallbackDragDropItem("Image", "Editor/ImageIcon", String.Format("<img src=\"{0}\" class=\"Center\" style=\"width:80%;\"></img>", RmlWysiwygComponent.DefaultImage),
                                                () => //Markup Callback
            {
                String actionName           = Guid.NewGuid().ToString();
                ShowPopupImageAction action = new ShowPopupImageAction(actionName)
                {
                    ImageName = RmlWysiwygComponent.DefaultImage
                };
                slide.addAction(action);
                return(String.Format("<img src=\"{0}\" class=\"Center\" style=\"width:80%;\" onclick=\"{1}\"></img>", RmlWysiwygComponent.DefaultImage, actionName));
            }),
                new WysiwygDragDropItem("Data Dispaly", CommonResources.NoIcon, "<data type=\"volume\" target=\"\">Data Display</data>"),
                new WysiwygCallbackDragDropItem("Trigger", "Lecture.Icon.TriggerIcon", "<button class=\"Trigger\" onclick=\"\">Add trigger text here.</a>",
                                                () => //Markup Callback
            {
                String actionName       = Guid.NewGuid().ToString();
                SetupSceneAction action = new SetupSceneAction(actionName);
                action.captureSceneState(uiCallback);
                slide.addAction(action);
                return(String.Format("<button class=\"Trigger\" onclick=\"{0}\">Add trigger text here.</a>", actionName));
            }),
                new WysiwygCallbackDragDropItem("Slider", CommonResources.NoIcon, "<input type=\"range\" min=\"0\" max=\"100\" value=\"0\" change=\"\"/>",
                                                () => //Markup Callback
            {
                String actionName       = Guid.NewGuid().ToString();
                BlendSceneAction action = new BlendSceneAction(actionName);
                action.captureSceneToStartAndEnd(uiCallback);
                slide.addAction(action);
                return(String.Format("<input type=\"range\" min=\"0\" max=\"100\" value=\"0\" onchange=\"{0}\"/>", actionName));
            })
                );
            htmlDragDrop.Dragging += (item, position) =>
            {
                foreach (var editor in rmlEditors.Values)
                {
                    editor.Component.setPreviewElement(position, item.PreviewMarkup, item.PreviewTagType);
                }
            };
            htmlDragDrop.DragEnded += (item, position) =>
            {
                bool allowAdd = true;
                foreach (var editor in rmlEditors.Values)
                {
                    if (allowAdd && editor.Component.contains(position))
                    {
                        editor.Component.insertRml(item.createDocumentMarkup());
                        setCurrentRmlEditor(editor.View.Name);
                        allowAdd = false;
                    }
                    else
                    {
                        editor.Component.cancelAndHideEditor();
                        editor.Component.clearPreviewElement(false);
                    }
                }
            };
            htmlDragDrop.ItemActivated += (item) =>
            {
                rmlEditors[currentRmlEditor].Component.insertRml(item.createDocumentMarkup());
            };

            taskbar = new SlideTaskbarView("InfoBar", slideName);
            taskbar.addTask(new CallbackTask("Save", "Save", "CommonToolstrip/Save", "", 0, true, item =>
            {
                saveAll();
            }));
            taskbar.addTask(new CallbackTask("Undo", "Undo", "Lecture.Icon.Undo", "Edit", 0, true, item =>
            {
                undoBuffer.undo();
            }));
            taskbar.addTask(new CallbackTask("Redo", "Redo", "Lecture.Icon.Redo", "Edit", 0, true, item =>
            {
                undoBuffer.execute();
            }));
            foreach (Task htmlDragDropTask in htmlDragDrop.Tasks)
            {
                taskbar.addTask(htmlDragDropTask);
            }
            taskbar.addTask(new CallbackTask("AddSlide", "Add Slide", "Lecture.Icon.AddSlide", "Edit", 0, true, item =>
            {
                slideEditorController.createSlide();
            }));
            taskbar.addTask(new CallbackTask("DuplicateSlide", "Duplicate Slide", "Lecture.Icon.DuplicateSlide", "Edit", 0, true, item =>
            {
                slideEditorController.duplicateSlide(slide);
            }));
            taskbar.addTask(new CallbackTask("RemoveSlide", "Remove Slide", "Lecture.Icon.RemoveSlide", "Edit", 0, true, item =>
            {
                editorController.removeSelectedSlides();
            }));
            taskbar.addTask(new CallbackTask("Capture", "Capture", "Lecture.Icon.Capture", "Edit", 0, true, item =>
            {
                editorController.capture();
            }));
            taskbar.addTask(new CallbackTask("EditTimeline", "Edit Timeline", "Lecture.Icon.EditTimeline", "Edit", 0, true, item =>
            {
                editorController.editTimeline(slide, "Timeline.tl", "Timeline");
            }));
            taskbar.addTask(new CallbackTask("Present", "Present", "Lecture.Icon.Present", "Edit", 0, true, item =>
            {
                editorController.runSlideshow(slide);
            }));
            taskbar.addTask(new CallbackTask("PresentFromBeginning", "Present From Beginning", "Lecture.Icon.PresentBeginning", "Edit", 0, true, item =>
            {
                editorController.runSlideshow(0);
            }));

            slideLayoutPicker = new SlideLayoutPickerTask();
            makeTempPresets();
            slideLayoutPicker.ChangeSlideLayout += slideLayoutPicker_ChangeSlideLayout;
            taskbar.addTask(slideLayoutPicker);

            styleManager = new SlideshowStyleManager(editorController, uiCallback);
            styleManager.addStyleFile(Path.Combine(slide.UniqueName, Slide.StyleSheetName), "This Slide");
            styleManager.addStyleFile("SlideMasterStyles.rcss", "All Slides");
            taskbar.addTask(new CallbackTask("EditSlideshowTheme", "Edit Slideshow Theme", "Lecture.Icon.EditStyle", "Edit", 0, true, item =>
            {
                IntVector2 taskPosition = item.CurrentTaskPositioner.findGoodWindowPosition(SlideshowStyleManager.Width, SlideshowStyleManager.Height);
                styleManager.showEditor(taskPosition.x, taskPosition.y);
            }));

            taskbar.addTask(new CallbackTask("ResetSlide", "Reset Slide", "Lecture.Icon.RevertIcon", "Edit", 0, true, item =>
            {
                resetSlide();
            }));

            mvcContext.Views.add(taskbar);

            setupScene = new RunCommandsAction("SetupScene");
            if (autoSetupScene)
            {
                setupScene.addCommand(new CallbackCommand(context =>
                {
                    undoState  = LayerState.CreateAndCapture();
                    undoCamera = sceneViewController.ActiveWindow != null ? sceneViewController.ActiveWindow.createCameraPosition() : null;
                }));
                slide.populateCommand(setupScene);
                setupScene.addCommand(new CallbackCommand(context =>
                {
                    if (undoState != null)
                    {
                        layerController.pushUndoState(undoState);
                        undoState = null;
                    }
                    if (undoCamera != null)
                    {
                        if (sceneViewController.ActiveWindow != null)
                        {
                            sceneViewController.ActiveWindow.pushUndoState(undoCamera);
                        }
                        undoCamera = null;
                    }
                }));
            }

            mvcContext.Controllers.add(new MvcController("Editor",
                                                         setupScene,
                                                         showCommand,
                                                         showEditorWindowsCommand,
                                                         closeEditorWindowsCommand,
                                                         new RunCommandsAction("Close", new CloseAllViewsCommand())
                                                         ));

            mvcContext.Controllers.add(new MvcController("Common",
                                                         new RunCommandsAction("Start", new RunActionCommand("Editor/Show")),
                                                         new CallbackAction("Focus", context =>
            {
                htmlDragDrop.CreateIconPreview();
                GlobalContextEventHandler.setEventContext(eventContext);
                if (Focus != null)
                {
                    Focus.Invoke(this);
                }
                slideLayoutPicker.createLayoutPicker();
                panelResizeWidget.createResizeWidget();
                if (currentRmlEditor != null)     //Make sure we have an active editor
                {
                    String current   = currentRmlEditor;
                    currentRmlEditor = null;
                    setCurrentRmlEditor(current);
                }
                this.slideEditorController.VectorModeChanged += slideEditorController_VectorModeChanged;
            }),
                                                         new CallbackAction("Blur", blur),
                                                         new RunCommandsAction("Suspended", new SaveViewLayoutCommand()),
                                                         new RunCommandsAction("Resumed", new RestoreViewLayoutCommand()),
                                                         previewTriggerAction));

            eventContext = new EventContext();
            ButtonEvent saveEvent = new ButtonEvent(EventLayers.Gui);

            saveEvent.addButton(KeyboardButtonCode.KC_LCONTROL);
            saveEvent.addButton(KeyboardButtonCode.KC_S);
            saveEvent.FirstFrameUpEvent += eventManager =>
            {
                saveAll();
            };
            eventContext.addEvent(saveEvent);

            ButtonEvent undoEvent = new ButtonEvent(EventLayers.Gui);

            undoEvent.addButton(KeyboardButtonCode.KC_LCONTROL);
            undoEvent.addButton(KeyboardButtonCode.KC_Z);
            undoEvent.FirstFrameUpEvent += eventManager =>
            {
                undoBuffer.undo();
            };
            eventContext.addEvent(undoEvent);

            ButtonEvent redoEvent = new ButtonEvent(EventLayers.Gui);

            redoEvent.addButton(KeyboardButtonCode.KC_LCONTROL);
            redoEvent.addButton(KeyboardButtonCode.KC_Y);
            redoEvent.FirstFrameUpEvent += eventManager =>
            {
                undoBuffer.execute();
            };
            eventContext.addEvent(redoEvent);

            ButtonEvent runEvent = new ButtonEvent(EventLayers.Gui);

            runEvent.addButton(KeyboardButtonCode.KC_F5);
            runEvent.FirstFrameUpEvent += eventManager =>
            {
                ThreadManager.invoke(() =>
                {
                    editorController.runSlideshow(0);
                });
            };
            eventContext.addEvent(runEvent);

            ButtonEvent captureEvent = new ButtonEvent(EventLayers.Gui);

            captureEvent.addButton(KeyboardButtonCode.KC_LCONTROL);
            captureEvent.addButton(KeyboardButtonCode.KC_SPACE);
            captureEvent.FirstFrameUpEvent += eventManager =>
            {
                editorController.capture();
            };
            eventContext.addEvent(captureEvent);
        }
예제 #11
0
 public override void setupAction(Slide slide, RunCommandsAction action)
 {
     action.addCommand(new StopTimelineCommand());
 }
예제 #12
0
        public SlideshowRuntime(Slideshow slideshow, ResourceProvider resourceProvider, GUIManager guiManager, int startIndex, TaskController additionalTasks)
        {
            this.guiManager = guiManager;

            Assembly assembly = Assembly.GetExecutingAssembly();

            using (Stream resourceStream = assembly.GetManifestResourceStream(SlideshowProps.BaseContextProperties.File))
            {
                mvcContext = SharedXmlSaver.Load <AnomalousMvcContext>(resourceStream);
            }
            navModel       = (NavigationModel)mvcContext.Models[SlideshowProps.BaseContextProperties.NavigationModel];
            displayManager = new SlideDisplayManager(slideshow.VectorMode);
            foreach (Slide slide in slideshow.Slides)
            {
                String slideName = slide.UniqueName;
                slide.setupContext(mvcContext, slideName, resourceProvider, displayManager);

                NavigationLink link = new NavigationLink(slideName, null, slideName + "/Show");
                navModel.addNavigationLink(link);
            }

            RunCommandsAction runCommands = (RunCommandsAction)mvcContext.Controllers["Common"].Actions["Start"];

            runCommands.addCommand(new NavigateToIndexCommand()
            {
                Index = startIndex
            });

            taskbar        = new ClosingTaskbar();
            taskbarLink    = new SingleChildChainLink(SlideTaskbarName, taskbar);
            taskbar.Close += close;
            previousTask   = new CallbackTask("Slideshow.Back", "Back", PreviousTaskName, "None", arg =>
            {
                back();
            });
            nextTask = new CallbackTask("Slideshow.Forward", "Forward", NextTaskName, "None", arg =>
            {
                next();
            });
            taskbar.addItem(new TaskTaskbarItem(previousTask));
            taskbar.addItem(new TaskTaskbarItem(nextTask));
            taskbar.addItem(new TaskTaskbarItem(new CallbackTask("Slideshow.Reload", "Reload", ReloadTaskName, "None", arg =>
            {
                reload();
            })));
            //taskbar.addItem(new TaskTaskbarItem(new CallbackTask("Slideshow.ToggleMode", "Toggle Display Mode", "SlideshowIcons/NormalVectorToggle", "None", arg =>
            //{
            //    displayManager.VectorMode = !displayManager.VectorMode;
            //    guiManager.layout();
            //})));
            taskbar.addItem(new TaskTaskbarItem(new CallbackTask("Slideshow.ZoomIn", "Zoom In", "SlideshowIcons/ZoomIn", "None", arg =>
            {
                zoomIn();
            })));
            taskbar.addItem(new TaskTaskbarItem(new CallbackTask("Slideshow.ResetZoom", "Reset Zoom", "SlideshowIcons/ResetZoom", "None", arg =>
            {
                if (displayManager.AdditionalZoomMultiple != 1.0f)
                {
                    displayManager.AdditionalZoomMultiple = 1.0f;
                    guiManager.layout();
                }
            })));
            taskbar.addItem(new TaskTaskbarItem(new CallbackTask("Slideshow.ZoomOut", "Zoom Out", "SlideshowIcons/ZoomOut", "None", arg =>
            {
                zoomOut();
            })));

            eventContext = new EventContext();
            ButtonEvent nextEvent = new ButtonEvent(EventLayers.Gui);

            nextEvent.addButton(KeyboardButtonCode.KC_RIGHT);
            nextEvent.FirstFrameUpEvent += eventManager =>
            {
                next();
            };
            eventContext.addEvent(nextEvent);

            ButtonEvent backEvent = new ButtonEvent(EventLayers.Gui);

            backEvent.addButton(KeyboardButtonCode.KC_LEFT);
            backEvent.FirstFrameUpEvent += eventManager =>
            {
                back();
            };
            eventContext.addEvent(backEvent);

            ButtonEvent zoomInEvent = new ButtonEvent(EventLayers.Gui);

            zoomInEvent.addButton(KeyboardButtonCode.KC_EQUALS);
            zoomInEvent.FirstFrameUpEvent += eventManager =>
            {
                zoomIn();
            };
            eventContext.addEvent(zoomInEvent);

            ButtonEvent zoomOutEvent = new ButtonEvent(EventLayers.Gui);

            zoomOutEvent.addButton(KeyboardButtonCode.KC_MINUS);
            zoomOutEvent.FirstFrameUpEvent += eventManager =>
            {
                zoomOut();
            };
            eventContext.addEvent(zoomOutEvent);

            ButtonEvent closeEvent = new ButtonEvent(EventLayers.Gui);

            closeEvent.addButton(KeyboardButtonCode.KC_ESCAPE);
            closeEvent.FirstFrameUpEvent += eventManager =>
            {
                ThreadManager.invoke(close); //Delay so we do not modify the input collection
            };
            eventContext.addEvent(closeEvent);

            foreach (Task task in additionalTasks.Tasks)
            {
                taskbar.addItem(new TaskTaskbarItem(task));
            }

            mvcContext.Blurred += (ctx) =>
            {
                guiManager.deactivateLink(SlideTaskbarName);
                guiManager.removeLinkFromChain(taskbarLink);
                GlobalContextEventHandler.disableEventContext(eventContext);
            };
            mvcContext.Focused += (ctx) =>
            {
                guiManager.addLinkToChain(taskbarLink);
                guiManager.pushRootContainer(SlideTaskbarName);
                setNavigationIcons();
                GlobalContextEventHandler.setEventContext(eventContext);
            };
            mvcContext.RemovedFromStack += (ctx) =>
            {
                taskbar.Dispose();
            };
        }
예제 #13
0
        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;
            });
        }
예제 #14
0
        public void captureSceneStateTo(EditUICallback callback, Action setLayerState, Action setMusclePosition, Action <CameraPosition> setCameraPosition, Action <MedicalState> setMedicalState)
        {
            if (Layers)
            {
                if (layersCommand == null)
                {
                    layersCommand = new BlendLayersCommand();
                    action.addCommand(layersCommand);
                }

                setLayerState();
            }
            else if (layersCommand != null)
            {
                action.removeCommand(layersCommand);
                layersCommand = null;
            }

            if (MusclePosition)
            {
                if (muscleCommand == null)
                {
                    muscleCommand = new BlendMusclePositionCommand();
                    action.addCommand(muscleCommand);
                }

                setMusclePosition();
            }
            else if (muscleCommand != null)
            {
                action.removeCommand(muscleCommand);
                muscleCommand = null;
            }

            if (Camera)
            {
                if (cameraCommand == null)
                {
                    cameraCommand = new MoveBlendedCameraCommand();
                    action.addCommand(cameraCommand);
                }

                CameraPosition camPos = new CameraPosition();
                callback.runOneWayCustomQuery(CameraPosition.CustomEditQueries.CaptureCameraPosition, camPos);
                setCameraPosition(camPos);
            }
            else if (cameraCommand != null)
            {
                action.removeCommand(cameraCommand);
                cameraCommand = null;
            }

            if (MedicalState)
            {
                if (medicalStateCommand == null)
                {
                    medicalStateCommand = new BlendMedicalStateCommand();
                    action.addCommand(medicalStateCommand);
                }

                MedicalState medState = new MedicalState("");
                medState.update();
                setMedicalState(medState);
            }
            else if (medicalStateCommand != null)
            {
                action.removeCommand(medicalStateCommand);
                medicalStateCommand = null;
            }
        }