private EditInterface setupEditInterface(SlideAction editingAction, Slide slide) { currentAction = editingAction; EditInterface editInterface = editingAction.getEditInterface(); editingAction.ChangesMade += editingAction_ChangesMade; editInterface.addCommand(new EditInterfaceCommand("Change Type", callback => { callback.showBrowser <Func <String, SlideAction> >(actionTypeBrowser, delegate(Func <String, SlideAction> result, ref string errorPrompt) { currentAction.ChangesMade -= editingAction_ChangesMade; SlideAction newAction = result(currentAction.Name); newAction.ChangesMade += editingAction_ChangesMade; actionEditor.EditInterface = setupEditInterface(newAction, slide); editingAction_ChangesMade(newAction); errorPrompt = ""; return(true); }); })); if (editingAction.AllowPreview) { editInterface.addCommand(new EditInterfaceCommand("Preview", callback => { previewTriggerAction.clear(); currentAction.setupAction(slide, previewTriggerAction); if (PreviewTrigger != null) { PreviewTrigger.Invoke(); } })); } return(editInterface); }
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 applySceneInfo(SlideSceneInfo info) { if (info.SceneThumbInfo != null) { slideEditorController.SlideImageManager.addUnsavedSceneThumb(slide, info.SceneThumbInfo.copy()); } setupScene.clear(); info.applyToSlide(slide); slide.populateCommand(setupScene); mvcContext.runAction("Editor/SetupScene"); updateThumbnail(); }
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)); } }
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"); } }