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);
            }
        }
Пример #2
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");
            }
        }