Exemplo n.º 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));
        }
Exemplo n.º 2
0
        public void createItem(string path, EditorController editorController)
        {
            String fullPath = Path.Combine(path, "Imagesets.xml");

            using (StreamWriter imagesetsStream = new StreamWriter(editorController.ResourceProvider.openWriteStream(fullPath)))
            {
                imagesetsStream.Write(String.Format(ImagesetsText, PluginNamespace, BrandingImageName, IconName));
            }
        }
Exemplo n.º 3
0
 void editorController_ProjectChanged(EditorController editorController)
 {
     if (editorController.ResourceProvider != null)
     {
         if (!projectExplorer.Visible)
         {
             projectExplorer.Visible = true;
         }
     }
 }
        public void createItem(string path, EditorController editorController)
        {
            String fullPath = Path.Combine(path, Name);

            rmlTypeController.createRmlFileSafely(fullPath);
            String timelineName            = timelineTypeController.createTimelineFileSafely(fullPath);
            AnomalousMvcContext mvcContext = mvcTypeController.CurrentObject;

            if (mvcContext != null)
            {
                String name = PathExtensions.RemoveExtension(fullPath);
                if (mvcContext.Views.hasItem(name))
                {
                    MessageBox.show(String.Format("A view named '{0}' already exists. Would you like to overwrite it?", name), "Overwrite?", MessageBoxStyle.IconQuest | MessageBoxStyle.Yes | MessageBoxStyle.No, (result) =>
                    {
                        if (result == MessageBoxStyle.Yes)
                        {
                            mvcContext.Views.remove(mvcContext.Views[name]);
                            createView(mvcContext, name, BackButton);
                        }
                    });
                }
                else
                {
                    createView(mvcContext, name, BackButton);
                }
                if (mvcContext.Controllers.hasItem(name))
                {
                    MessageBox.show(String.Format("A controller named '{0}' already exists. Would you like to overwrite it?", name), "Overwrite?", MessageBoxStyle.IconQuest | MessageBoxStyle.Yes | MessageBoxStyle.No, (result) =>
                    {
                        if (result == MessageBoxStyle.Yes)
                        {
                            mvcContext.Controllers.remove(mvcContext.Controllers[name]);
                            createController(mvcContext, name, timelineName, BackButton);
                        }
                    });
                }
                else
                {
                    createController(mvcContext, name, timelineName, BackButton);
                }
                editorController.saveAllCachedResources();
            }
        }
Exemplo n.º 5
0
        public void createItem(string path, EditorController editorController)
        {
            String filePath = Path.Combine(path, Path.ChangeExtension(Name, ".oms"));

            filePath = Path.ChangeExtension(filePath, ".oms");
            if (editorController.ResourceProvider.exists(filePath))
            {
                MessageBox.show(String.Format("Are you sure you want to override {0}?", filePath), "Override", MessageBoxStyle.IconQuest | MessageBoxStyle.Yes | MessageBoxStyle.No, delegate(MessageBoxStyle overrideResult)
                {
                    if (overrideResult == MessageBoxStyle.Yes)
                    {
                        typeController.createNew(filePath, Type);
                    }
                });
            }
            else
            {
                typeController.createNew(filePath, Type);
            }
        }
 public RcssTypeController(EditorController editorController)
     : base(".rcss", Encoding.UTF8, editorController)
 {
 }
Exemplo n.º 7
0
 public ProjectDocumentHandler(EditorController editorController)
 {
     this.editorController = editorController;
 }
 public void createItem(string path, EditorController editorController)
 {
     createItemCallback(path, editorController);
 }
        public DependencyEditorContext(DDAtlasDependency plugin, String file, DependencyTypeController dependencyTypeController, EditorController editorController, GuiFrameworkUICallback uiCallback)
        {
            this.dependencyTypeController = dependencyTypeController;
            this.currentFile = file;
            this.plugin      = plugin;

            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());

            GenericPropertiesFormView genericPropertiesView = new GenericPropertiesFormView("MvcContext", plugin.EditInterface, editorController, uiCallback, true);

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

            EditorTaskbarView taskbar = new EditorTaskbarView("InfoBar", currentFile, "Editor/Close");

            taskbar.addTask(new CallbackTask("SaveAll", "Save All", "Editor/SaveAllIcon", "", 0, true, item =>
            {
                saveAll();
            }));
            taskbar.addTask(new RunMvcContextActionTask("Save", "Save Dependency Definition File", "CommonToolstrip/Save", "File", "Editor/Save", mvcContext));
            mvcContext.Views.add(taskbar);

            mvcContext.Controllers.add(new MvcController("Editor",
                                                         new RunCommandsAction("Show",
                                                                               new ShowViewCommand("MvcContext"),
                                                                               new ShowViewCommand("InfoBar")),
                                                         new RunCommandsAction("Close", new CloseAllViewsCommand()),
                                                         new CallbackAction("Save", context =>
            {
                save();
            })));

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

            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);
        }
 public UnknownDocumentHandler(EditorController editorController)
 {
     this.editorController = editorController;
 }
Exemplo n.º 11
0
        public RmlEditorContext(String file, RmlTypeController rmlTypeController, AnomalousMvcContext editingMvcContext, EditorController editorController, EditorUICallback uiCallback)
        {
            this.rmlTypeController = rmlTypeController;
            this.currentFile       = file;
            this.uiCallback        = uiCallback;

            undoBuffer = new UndoRedoBuffer(50);

            rmlTypeController.loadText(currentFile);

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

            TextEditorView textEditorView = new TextEditorView("RmlEditor", () => rmlComponent.CurrentRml, wordWrap: false, textHighlighter: RmlTextHighlighter.Instance);

            textEditorView.ElementName = new MDILayoutElementName(GUILocationNames.MDI, DockLocation.Left);
            textEditorView.Buttons.add(new CloseButtonDefinition("Close", "RmlTextEditor/Close"));
            textEditorView.ComponentCreated += (view, component) =>
            {
                textEditorComponent = component;
            };
            mvcContext.Views.add(textEditorView);

            RmlWysiwygView rmlView = new RmlWysiwygView("RmlView", uiCallback, undoBuffer);

            rmlView.ElementName       = new MDILayoutElementName(GUILocationNames.MDI, DockLocation.Left);
            rmlView.RmlFile           = file;
            rmlView.ComponentCreated += (view, component) =>
            {
                rmlComponent            = component;
                rmlComponent.RmlEdited += rmlEditor =>
                {
                    if (textEditorComponent != null)
                    {
                        textEditorComponent.Text = rmlEditor.CurrentRml;
                    }
                };
            };
            mvcContext.Views.add(rmlView);

            DragAndDropView <WysiwygDragDropItem> htmlDragDrop = new DragAndDropView <WysiwygDragDropItem>("HtmlDragDrop",
                                                                                                           new WysiwygDragDropItem("Heading", "Editor/HeaderIcon", "<h1>Heading</h1>"),
                                                                                                           new WysiwygDragDropItem("Paragraph", "Editor/ParagraphsIcon", "<p>Add paragraph text here.</p>"),
                                                                                                           new WysiwygDragDropItem("Image", "Editor/ImageIcon", String.Format("<img src=\"{0}\" style=\"width:200px;\"></img>", RmlWysiwygComponent.DefaultImage)),
                                                                                                           new WysiwygDragDropItem("Link", "Editor/LinksIcon", "<a onclick=\"None\">Link</a>"),
                                                                                                           new WysiwygDragDropItem("Button", "Editor/AddButtonIcon", "<input type=\"submit\" onclick=\"None\">Button</input>"),
                                                                                                           new WysiwygDragDropItem("Separator", CommonResources.NoIcon, "<x-separator/>"),
                                                                                                           new WysiwygDragDropItem("Two Columns", CommonResources.NoIcon, "<div class=\"TwoColumn\"><div class=\"Column\"><p>Column 1 text goes here.</p></div><div class=\"Column\"><p>Column 2 text goes here.</p></div></div>"),
                                                                                                           new WysiwygDragDropItem("Heading and Paragraph", CommonResources.NoIcon, "<h1>Heading For Paragraph.</h1><p>Paragraph for heading.</p>", "div"),
                                                                                                           new WysiwygDragDropItem("Left Image and Paragraph", CommonResources.NoIcon, String.Format("<div class=\"ImageParagraphLeft\"><img src=\"{0}\" style=\"width:200px;\"/><p>Add paragraph text here.</p></div>", RmlWysiwygComponent.DefaultImage)),
                                                                                                           new WysiwygDragDropItem("Right Image and Paragraph", CommonResources.NoIcon, String.Format("<div class=\"ImageParagraphRight\"><img src=\"{0}\" style=\"width:200px;\"/><p>Add paragraph text here.</p></div>", RmlWysiwygComponent.DefaultImage))
                                                                                                           );

            htmlDragDrop.Dragging += (item, position) =>
            {
                rmlComponent.setPreviewElement(position, item.PreviewMarkup, item.PreviewTagType);
            };
            htmlDragDrop.DragEnded += (item, position) =>
            {
                if (rmlComponent.contains(position))
                {
                    rmlComponent.insertRml(item.createDocumentMarkup());
                }
                else
                {
                    rmlComponent.cancelAndHideEditor();
                    rmlComponent.clearPreviewElement(false);
                }
            };
            htmlDragDrop.ItemActivated += (item) =>
            {
                rmlComponent.insertRml(item.createDocumentMarkup());
            };
            htmlDragDrop.ElementName = new MDILayoutElementName(GUILocationNames.MDI, DockLocation.Left);
            mvcContext.Views.add(htmlDragDrop);

            EditorTaskbarView taskbar = new EditorTaskbarView("InfoBar", currentFile, "Editor/Close");

            taskbar.addTask(new CallbackTask("SaveAll", "Save All", "Editor/SaveAllIcon", "", 0, true, item =>
            {
                saveAll();
            }));
            taskbar.addTask(new RunMvcContextActionTask("Save", "Save Rml File", "CommonToolstrip/Save", "File", "Editor/Save", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("Undo", "Undo", CommonResources.NoIcon, "Edit", "Editor/Undo", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("Redo", "Redo", CommonResources.NoIcon, "Edit", "Editor/Redo", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("Cut", "Cut", "Editor/CutIcon", "Edit", "Editor/Cut", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("Copy", "Copy", "Editor/CopyIcon", "Edit", "Editor/Copy", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("Paste", "Paste", "Editor/PasteIcon", "Edit", "Editor/Paste", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("SelectAll", "Select All", "Editor/SelectAllIcon", "Edit", "Editor/SelectAll", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("RmlEditor", "Edit Rml", RmlTypeController.Icon, "Edit", "RmlTextEditor/Show", mvcContext));
            mvcContext.Views.add(taskbar);

            mvcContext.Controllers.add(new MvcController("RmlTextEditor",
                                                         new RunCommandsAction("Show",
                                                                               new ShowViewIfNotOpenCommand("RmlEditor")),
                                                         new RunCommandsAction("Close",
                                                                               new CloseViewCommand(),
                                                                               new CallbackCommand(context =>
            {
                textEditorComponent = null;
            }))
                                                         ));

            mvcContext.Controllers.add(new MvcController("HtmlDragDrop",
                                                         new RunCommandsAction("Show",
                                                                               new ShowViewIfNotOpenCommand("HtmlDragDrop")),
                                                         new RunCommandsAction("Close",
                                                                               new CloseViewCommand())
                                                         ));

            mvcContext.Controllers.add(new MvcController("Editor",
                                                         new RunCommandsAction("Show",
                                                                               new ShowViewCommand("RmlView"),
                                                                               new ShowViewCommand("InfoBar")),
                                                         new RunCommandsAction("Close", new CloseAllViewsCommand()),
                                                         new CallbackAction("Save", context =>
            {
                save();
            }),
                                                         new CallbackAction("Cut", context =>
            {
                if (textEditorComponent != null)
                {
                    textEditorComponent.cut();
                }
            }),
                                                         new CallbackAction("Copy", context =>
            {
                if (textEditorComponent != null)
                {
                    textEditorComponent.copy();
                }
            }),
                                                         new CallbackAction("Paste", context =>
            {
                if (textEditorComponent != null)
                {
                    textEditorComponent.paste();
                }
            }),
                                                         new CallbackAction("SelectAll", context =>
            {
                if (textEditorComponent != null)
                {
                    textEditorComponent.selectAll();
                }
            }),
                                                         new CallbackAction("Undo", context =>
            {
                undoBuffer.undo();
            }),
                                                         new CallbackAction("Redo", context =>
            {
                undoBuffer.execute();
            })
                                                         ));

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

            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);

            if (editingMvcContext != null)
            {
                String controllerName = PathExtensions.RemoveExtension(file);
                if (editingMvcContext.Controllers.hasItem(controllerName))
                {
                    MvcController viewController = editingMvcContext.Controllers[controllerName];

                    GenericPropertiesFormView genericPropertiesView = new GenericPropertiesFormView("MvcContext", viewController.getEditInterface(), editorController, uiCallback, true);
                    genericPropertiesView.ElementName = new MDILayoutElementName(GUILocationNames.MDI, DockLocation.Left);
                    genericPropertiesView.Buttons.add(new CloseButtonDefinition("Close", "MvcEditor/Close"));
                    mvcContext.Views.add(genericPropertiesView);

                    taskbar.addTask(new RunMvcContextActionTask("EditActions", "Edit Actions", "MvcContextEditor/ControllerIcon", "Edit", "MvcEditor/Show", mvcContext));

                    mvcContext.Controllers.add(new MvcController("MvcEditor",
                                                                 new RunCommandsAction("Show",
                                                                                       new ShowViewIfNotOpenCommand("MvcContext")),
                                                                 new RunCommandsAction("Close",
                                                                                       new CloseViewCommand())
                                                                 ));
                }

                if (editingMvcContext.Views.hasItem(controllerName))
                {
                    RmlView view = editingMvcContext.Views[controllerName] as RmlView;
                    if (view != null && view.RmlFile == file)
                    {
                        GenericPropertiesFormView genericPropertiesView = new GenericPropertiesFormView("MvcView", view.getEditInterface(), editorController, uiCallback, true);
                        genericPropertiesView.ElementName = new MDILayoutElementName(GUILocationNames.MDI, DockLocation.Left);
                        genericPropertiesView.Buttons.add(new CloseButtonDefinition("Close", "MvcViewEditor/Close"));
                        mvcContext.Views.add(genericPropertiesView);

                        taskbar.addTask(new RunMvcContextActionTask("EditView", "Edit View", "MvcContextEditor/IndividualViewIcon", "Edit", "MvcViewEditor/Show", mvcContext));

                        mvcContext.Controllers.add(new MvcController("MvcViewEditor",
                                                                     new RunCommandsAction("Show",
                                                                                           new ShowViewIfNotOpenCommand("MvcView")),
                                                                     new RunCommandsAction("Close",
                                                                                           new CloseViewCommand())
                                                                     ));
                    }
                }

                taskbar.addTask(new CallbackTask("PreviewMvc", "Preview", "MvcContextEditor/MVCcomIcon", "", 0, true, (item) =>
                {
                    uiCallback.previewMvcContext(editingMvcContext);
                }));
            }
        }
Exemplo n.º 12
0
 public XmlTypeController(EditorController editorController)
     : base(".xml", Encoding.UTF8, editorController)
 {
 }
        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());
        }
Exemplo n.º 14
0
 public PropTypeController(EditorController editorController)
     : base(".prop", editorController)
 {
 }
Exemplo n.º 15
0
 public DependencyTypeController(EditorController editorController)
     : base(".ddd", editorController)
 {
 }
Exemplo n.º 16
0
 public MvcTypeController(EditorController editorController)
     : base(".mvc", editorController)
 {
 }
Exemplo n.º 17
0
 public OffsetSequenceTypeController(EditorController editorController)
     : base(".oms", editorController)
 {
 }
Exemplo n.º 18
0
 public TextTypeController(String extension, Encoding textEncoding, EditorController editorController)
     : base(extension, editorController)
 {
     this.TextEncoding = textEncoding;
 }
Exemplo n.º 19
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;
            });
        }
Exemplo n.º 20
0
 public EditorTypeController(String extension, EditorController editorController)
 {
     this.Extension        = extension;
     this.EditorController = editorController;
 }
        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 SaveableTypeController(String extension, EditorController editorController)
     : base(extension, editorController)
 {
 }
        void editorController_ProjectChanged(EditorController editorController)
        {
            if (mvcEditorContext != null)
            {
                mvcEditorContext.close();
            }
            if (movementSequenceEditorContext != null)
            {
                movementSequenceEditorContext.close();
            }
            if (offsetSequenceEditorContext != null)
            {
                offsetSequenceEditorContext.close();
            }
            if (pluginEditorContext != null)
            {
                pluginEditorContext.close();
            }
            if (dependencyEditorContext != null)
            {
                dependencyEditorContext.close();
            }
            if (timelineEditorContext != null)
            {
                timelineEditorContext.close();
            }
            if (rmlEditorContext != null)
            {
                rmlEditorContext.close();
            }
            if (rcssEditorContext != null)
            {
                rcssEditorContext.close();
            }
            if (trmlEditorContext != null)
            {
                trmlEditorContext.close();
            }
            if (xmlEditorContext != null)
            {
                xmlEditorContext.close();
            }
            if (propEditorContext != null)
            {
                propEditorContext.close();
            }

            if (editorController.ResourceProvider != null)
            {
                standaloneController.DocumentController.addToRecentDocuments(editorController.ResourceProvider.BackingLocation);
                //Try to open a default mvc context
                String mvcFile = "MvcContext.mvc";
                if (editorController.ResourceProvider.exists(mvcFile))
                {
                    editorController.openEditor(mvcFile);
                }
                else
                {
                    IEnumerable <String> files = editorController.ResourceProvider.listFiles("*.mvc", "", true);
                    String firstMvcFile        = files.FirstOrDefault();
                    if (firstMvcFile != null)
                    {
                        editorController.openEditor(firstMvcFile);
                    }
                }
            }
        }
Exemplo n.º 24
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);
                }
            });
        }
Exemplo n.º 25
0
 public MovementSequenceTypeController(EditorController editorController)
     : base(".seq", editorController)
 {
 }
 public TimelineTypeController(EditorController editorController)
     : base(".tl", editorController)
 {
 }
Exemplo n.º 27
0
 public PluginTypeController(EditorController editorController)
     : base(".ddp", editorController)
 {
 }
Exemplo n.º 28
0
        public MvcEditorContext(AnomalousMvcContext editingContext, String file, MvcTypeController mvcTypeController, EditorController editorController, EditorUICallback uiCallback)
        {
            this.mvcTypeController = mvcTypeController;
            this.currentFile       = file;
            this.editingContext    = editingContext;

            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());

            GenericPropertiesFormView genericPropertiesView = new GenericPropertiesFormView("MvcContext", editingContext.getEditInterface(), editorController, uiCallback, true);

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

            taskbar = new EditorTaskbarView("InfoBar", currentFile, "Editor/Close");
            taskbar.addTask(new CallbackTask("SaveAll", "Save All", "Editor/SaveAllIcon", "", 0, true, item =>
            {
                saveAll();
            }));
            taskbar.addTask(new RunMvcContextActionTask("Save", "Save Rml File", "CommonToolstrip/Save", "File", "Editor/Save", mvcContext));
            mvcContext.Views.add(taskbar);

            mvcContext.Controllers.add(new MvcController("Editor",
                                                         new RunCommandsAction("Show",
                                                                               new ShowViewCommand("MvcContext"),
                                                                               new ShowViewCommand("InfoBar")),
                                                         new RunCommandsAction("Close",
                                                                               new CloseAllViewsCommand()),
                                                         new CallbackAction("Save", context =>
            {
                save();
            })));

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

            taskbar.addTask(new CallbackTask("PreviewMvc", "Preview", "MvcContextEditor/MVCcomIcon", "", 0, true, (item) =>
            {
                uiCallback.previewMvcContext(editingContext);
            }));

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